Fork me on GitHub
Not signed in (Sign In)

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

    • CommentAuthorTheDude
    • CommentTimeAug 15th 2009
     
    TypeError: Error #1034:Type Coercion failed: cannot convert org.flintparticles.twoD.renderers::DisplayObjectRenderer@30a1b81 to org.flintparticles.twoD.renderers.BitmapRenderer
    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;

    };
    • CommentAuthorTheDude
    • CommentTimeAug 17th 2009
     
    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.