setTimeout not working in Animate

Community Beginner ,
Oct 31, 2020

Copy link to clipboard

Copied

I have the following code at a certain frame in a move clip. I want the action to pause for 1 minute before move to "Ob2" frame. What am I doing wrong?
this.stop();
setTimeout(myFunction,60000);
function myFunction() {
this.gotoAndPlay("Obj2");
}

Views

124

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

flash is history but as3 can still used in mobile and desktop apps.

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

Maybe you should put an alert statement in the timeout handler function to determine what exactly it is that's not working.

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

The problem was the code I was given for it to work was wrong. This is the correct code.

this.stop();
setTimeout(this.play.bind(this), 3000);

This works without a click on a button. I just wanted to pause the action without any user interaction.
I forget where I found it. But it works.

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

for others, that's javascript, not actionscript which the op failed to indicate.  (and the confusion between Ob2 and Obj2 is unresolved, though maybe one is a forum typo.)

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

"this." in front of stop() and gotoAndStop() is always an indicator of Canvas documents.

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

saying "always" is incorrect.

 

if that code failed in as3 you'd have a point, but as you know that code with "this" works perfectly well in as3.

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

I know actionscript is history. I am working with html5 canvas. Flash is gone in December.

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

correct, flash is history.  but it's incorrect to say or even imply as3 is history: mobile and desktop apps using as3 are still supported and working though i have my own doubts about the longevity of as3 mobile apps.

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

.

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

I am not building a Flash movie. I am converting a Flsh movie into and htlm5 canvas doeument. Here is the code that works perfectly:

this.stop();
setTimeout(this.play.bind(this), 3000);

It pauses the action at the frame the code is placed and continues to the next this.stop(); Yes it is Java. But as far as I know as3 will not work for html5 canvas documents The code above works great.I have hundreds of places in my project.that I need to do this and it works every time. The code above does the following:

It stops the movie at the frame where it is placed.
Pauses for 3 seconds.

Then continues to the next stop.
Thanks for your help.

😉

Likes

Translate

Translate

Report

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

Copy link to clipboard

Copied

It's JavaScript, not Java. Completely different languages.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
terryj41605550 AUTHOR LATEST
Community Beginner ,
Nov 11, 2020

Copy link to clipboard

Copied

Please excuse me for saying Java instead of Javescript. I noticed it right after posting the pervious post. I just see noway to edit after posting. But correcting a typo does nothing to fix my problem.  But thank you for correcting me.:)

Likes

Translate

Translate

Report

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