Flint Particle System Forum - Ah another error with emitters2010-11-17T12:06:03+00:00http://flintparticles.org/forum/
Lussumo Vanilla & Feed Publisher
Ah another error with emittershttp://flintparticles.org/forum/comments.php?DiscussionID=119&Focus=484#Comment_4842008-11-10T07:06:46+00:002010-11-17T12:06:03+00:00TheDudehttp://flintparticles.org/forum/account.php?u=87
First, some code:
----------------
var renderer:PixelRenderer ;
var emitterCount:int=0;
var eArray:Array = new Array();
function Explode(ob:MovieClip, vx, vy)
{
...
----------------
var renderer:PixelRenderer ; var emitterCount:int=0; var eArray:Array = new Array();
function Explode(ob:MovieClip, vx, vy) {
//positions the Renderer around the object/emitter var gb:Point = globalPosition(ob); var rect1:Rectangle = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight ); rect1.offset(-scene.x, -scene.y);
renderer = new PixelRenderer(rect1); //Add whatever filters you need for the renderer here. var bb:BlurFilter = new BlurFilter( 2, 2, 1 ); renderer.addFilter(bb); //scene displayobject for emitters scene.addChild( renderer );
var emitter:Emitter2D = new Emitter2D(); eArray.push(emitter);
eArray[emitterCount].counter = new Blast( 300 ); eArray[emitterCount].addInitializer( new SharedImage( new Line( 2 ) ) ); eArray[emitterCount].addInitializer( new Lifetime( 0.2,1.2 ) ); eArray[emitterCount].addInitializer( new ColorInit( 0x00000000,0x00000000 ) ); eArray[emitterCount].addAction( new Age( Quadratic.easeIn) ); eArray[emitterCount].addAction(new ColorChange(0xFFFF3300, 0xFFFFFF00)); eArray[emitterCount].addAction( new Move() ); eArray[emitterCount].addInitializer( new Position( new DisplayObjectZone( ob, renderer )) ); eArray[emitterCount].addInitializer( new Velocity( new DiscZone( new Point( vx*10,vy*10 ), 200, 0))); eArray[emitterCount].addAction( new RandomDrift( 15, 15 ) ); renderer.addEmitter(eArray[emitterCount] ); eArray[emitterCount].start( );
ev = null; scene.removeChild(renderer); renderer = null; }
The above works terrifically well until the Explode function is called more than once in a short duration of time- before the particles from the previous explosion are finished and the emitter has not triggered the EMITTER_EMPTY event. I thought that storing the emitters in an array would work but nope, I get particle freeze and an error message.
Can anybody see anything obviously wrong with the code or offer a alternative solution?]]>
Ah another error with emittershttp://flintparticles.org/forum/comments.php?DiscussionID=119&Focus=487#Comment_4872008-11-10T19:10:51+00:002010-11-17T12:06:03+00:00Richardhttp://flintparticles.org/forum/account.php?u=1
What is the error message?
Ah another error with emittershttp://flintparticles.org/forum/comments.php?DiscussionID=119&Focus=488#Comment_4882008-11-11T05:21:26+00:002010-11-17T12:06:03+00:00TheDudehttp://flintparticles.org/forum/account.php?u=87
Error #1009: null Cannot access a property or method of a null object reference
at bhunternew_fla::MainTimeline/kill_particles()
at flash.events::EventDispatcher/dispatchEventFunction()
at ...
at bhunternew_fla::MainTimeline/kill_particles() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at org.flintparticles.common.emitters::Emitter/update() at org.flintparticles.common.emitters::Emitter/updateEventListener() at flash.events::EventDispatcher/dispatchEventFunction() at flash.events::EventDispatcher/dispatchEvent() at org.flintparticles.common.utils::FrameUpdater/frameUpdate()]]>
Ah another error with emittershttp://flintparticles.org/forum/comments.php?DiscussionID=119&Focus=489#Comment_4892008-11-11T06:59:14+00:002010-11-17T12:06:03+00:00Richardhttp://flintparticles.org/forum/account.php?u=1
killParticles is clearing and setting to null the latest renderer, not the renderer used by that emitter. i.e. it clears the second renderer when it should clear the first.
Ah another error with emittershttp://flintparticles.org/forum/comments.php?DiscussionID=119&Focus=490#Comment_4902008-11-12T14:54:44+00:002010-11-17T12:06:03+00:00TheDudehttp://flintparticles.org/forum/account.php?u=87
hey i think i sorted it. i initiated a PixelRenderer var within the function and pushed it into an array. then in killparticles I pop out the first element every time. So far so good. Till next time.