Flint Particle System Forum - TypeError: Error #1034 Firework code not working! 2011-06-23T13:39:20+01:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher TypeError: Error #1034 Firework code not working! http://flintparticles.org/forum/comments.php?DiscussionID=250&Focus=902#Comment_902 2009-08-15T11:21:54+01:00 2011-06-23T13:39:20+01:00 TheDude http://flintparticles.org/forum/account.php?u=87 TypeError: Error #1034:Type Coercion failed: cannot convert org.flintparticles.twoD.renderers::DisplayObjectRenderer@30a1b81 to org.flintparticles.twoD.renderers.BitmapRenderer at ... at HOUSEOFHELL_fla::MainTimeline/kill_particles_Bitmap()
at flash.events::EventDispatcher/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/flash.events:EventDispatcher::dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at org.flintparticles.common.utils::FrameUpdater/::frameUpdate()

/////////////////////////////////////

Hi there, essentially I'm trying to code individual firework explosions on the click of a mouse. It works fine sometimes, then other times it throws the above error message. Does anyone have a clue what's going on with this? why is it trying to convert a displayObjectRenderer to a BitmapRenderer?


var eArray:Array = new Array();
var tp:Array = new Array();
var renderArray:Array = new Array();
var rArrayCount:int=0;

function FireWork():void
{
var emitter:Emitter2D = new Emitter2D();

emitter.counter = new Blast( 40 );

emitter.addInitializer( new SharedImage( new Dot( 3 ) ) );
emitter.addInitializer( new ColorInit( 0xFFFD2D2D, 0xFFB10101 ) );
emitter.addInitializer( new Velocity( new DiscZone( new Point( 0, 0 ), 160, 0 ) ) );
emitter.addInitializer( new Lifetime( 2 ) );

emitter.addAction( new Age( Quadratic.easeIn ) );
emitter.addAction( new Fade( 1.0, 0 ) );
emitter.addAction( new Move() );


emitter.addAction( new Accelerate( 0, 150 ) );

var temp:MovieClip=new MovieClip;
temp.mouseEnabled=false;
temp.mouseChildren=false;
temp.name="sfx";
temp.addChild(renderer);

stage.addChild(temp);

Rooms[roomTag].deleteArray.push(temp);//my own custom 'clean up after' array

temp.emitter=emitter;


var renderer:BitmapRenderer = new BitmapRenderer( new Rectangle( 0, 0, 550, 400 ) );
renderer.addFilter( new BlurFilter( 2, 2, 1 ) );
renderer.addFilter( new ColorMatrixFilter( [ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0.95,0 ] ) );
renderer.addEmitter( emitter );

eArray.push(emitter);
renderArray.push(renderer);

emitter.addEventListener( EmitterEvent.EMITTER_EMPTY, kill_particles_Bitmap );


emitter.x = stage.mouseX;
emitter.y = stage.mouseY;

emitter.start();

};

function kill_particles_Bitmap( ev:EmitterEvent ):void
{
ev.target.removeEventListener( EmitterEvent.EMITTER_EMPTY, kill_particles_Bitmap );

var firstRenderer:BitmapRenderer = renderArray.shift();

ev.target.stop();
firstRenderer.removeEmitter( Emitter2D( ev.target ) );

//removeMovie(firstRenderer);

ev = null;

firstRenderer=null;

};]]>
TypeError: Error #1034 Firework code not working! http://flintparticles.org/forum/comments.php?DiscussionID=250&Focus=903#Comment_903 2009-08-17T09:31:10+01:00 2011-06-23T13:39:20+01:00 TheDude http://flintparticles.org/forum/account.php?u=87 Never mind I seem to have solved the issue. I set renderArray and eArray = [] (cleared the arrays) after every instigation of the above code and it works ok now. I set renderArray and eArray = [] (cleared the arrays) after every instigation of the above code and it works ok now.]]>