Highlighted

Trying to get the animation to play only though the play button.

New Here ,
Aug 06, 2020

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.

Views

25

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Trying to get the animation to play only though the play button.

New Here ,
Aug 06, 2020

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.

Views

26

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Aug 06, 2020 0
Adobe Community Professional ,
Aug 07, 2020

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

__________________________________________
HTML5, JSFL, and AS3 samples: http://bit.ly/2mJgDoG

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Aug 07, 2020 0