Search code examples
javascripthtmlflashcreatejs

Listen to the end of tick event easelJS/createJS/movieclip class


I have created a simple animation using flash and exported it as a createJS animation(HTML5) . When I went through the source code , I see

function handleComplete() {
    exportRoot = new lib.stage_01();

    stage = new createjs.Stage(canvas);
    stage.addChild(exportRoot);
    stage.update();

    createjs.Ticker.setFPS(25);
    createjs.Ticker.addEventListener("tick", stage);
}

I am guessing that the tick event is subscribed to , that it updates the canvas every particular duration of time.

My Question is , is it possible to detect when an animation has ended. Basically , I need to invoke a method after the animation ends. And no, I am not using a spritesheet for this purpose , if that helps :-)

Thanks guys.


Solution

  • I made a work around for this.

    Unfortunately , there is no event which you can fire when the animation ends in a movieclip class viz, there is no onAnimationEnd as in the BITMAP ANIMATION CLASS

    I modified my movieclip class to call a method on a particular frame(Useful when there is no dynamically changing content,so that I can know the number of frames I have).