-1

i have a canvas project created by Animate CC , i need to add "onComplete" event to a movie clip generated from Animate CC canvas project , the solution present from createjs site :

target.alpha = 1;
createjs.Tween.get(target)
     .wait(500)
     .to({alpha:0, visible:false}, 1000)
     .call(handleComplete);
function handleComplete() {
    //Tween complete
}

from tweenJs site

i don't want to modify the js file generated by Animate CC , but i could not find a way to hock to movie clip tween I've tried to access exportRoot.MyMovieClipInstanceName.timeline to get the tween but with not lock

regards

Hani Safa
  • 91
  • 5

1 Answers1

0

You shouldn't need to access the timeline directly -- MovieClips fire a "animationend" event when their timeline is complete. From anywhere you should be able to do:

exportRoot.instance.on("animationend", function(e) {
  console.log(e);
});

You could also add code to the timeline in Animate, which basically does the same thing.

this.on("animationend", function(e) {
  console.log(e);
});
Lanny
  • 11,244
  • 1
  • 22
  • 30