Copy link to clipboard
Copied
I don't understand actions all too well. I'm trying to get my animation to play only when "play" is pressed, the whole thing plays by itself instead.
Copy link to clipboard
Copied
Hi.
You need to first stop the timeline you're trying to control and then add an event listener to a button to play the same timeline.
Here are code suggestions for both HTML5 Canvas and AS3 documents:
HTML5 canvas
var root = this;
root.start = function()
{
root.gotoAndPlay(1);
};
if (!root.started)
{
root.stop();
root.yourPlayButton.on("click", root.start);
root.started = true;
}
AS3
import flash.events.MouseEvent;
function start(e:MouseEvent):void
{
gotoAndPlay(2);
}
stop();
yourPlayButton.addEventListener(MouseEvent.CLICK, start);
Regards,
JC