Creativcheck Creativcheck - 1 month ago 12
ActionScript Question

Adobe Animate canvas play() not work

I making a banner with Adobe Animate CC on the canvas (html5). And I encountered a problem.

Why simple this.stop() inside movieclip code is working (like good old ActionScript), but this.play() make error: is not a function. WTF?!

How can I make my timeline stop and play the animation when I want?

Full code below:

this.stop()
window.setTimeout(go, 2000);


function go()
{
this.play();
}

Answer

the problem is "this". This inside a function do not refer to the main stage movie clip any more - it refers to the function. Add a line before your function:

var that=this;

and change the line inside your function to:

that.play();

:)