At a loss — How do I get my animation to loop a set number of times before stopping?

Community Beginner ,
Oct 16, 2019 Oct 16, 2019

Copy link to clipboard

Copied

I'm a beginner. Sorry! But I've created an animation that works. It's simple and very straight forward.

 

But it doesn't do what I want which is to start when I click "Start" then loop three times and stop at the end of the animation at frame 58.

 

Here's what I have:

in Layer 1, frame 1 of the animation I have this:


var _this = this;
_this.stop();

 

In Layer 1, frame 2 and to the end (frame 58 is end) I have this:

 

if (!this.looped) this.looped = 1;

if (this.looped++ > 3) this.gotoAndStop('58');

 

In Layer 2, frame 1 and to the end I have this (and a "Start" button):


var _this = this;
_this.button_2.on('click', function(){
_this.gotoAndPlay('2');
});

 

Animation starts when I click "Start" but it only plays once, then goes back to beginning and stops. It seems my "Stop" in Layer 1, frame 1 overrides the loop command? But what do I do to prevent the animation to auto play on load if I don't have a Stop action in there?

TOPICS
ActionScript, Code, How to, Timeline

Views

697

Likes

translate

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
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , Oct 17, 2019 Oct 17, 2019

Likes

translate

Translate

Translate
Adobe Community Professional ,
Oct 17, 2019 Oct 17, 2019

Copy link to clipboard

Copied

Thanks for you kind words. I updated the file. You can download the new version.

Likes

translate

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
community guidelines
Community Beginner ,
Oct 17, 2019 Oct 17, 2019

Copy link to clipboard

Copied

THANK YOU! I tweaked it a tiny bit so it stops on the last frame (second to the last actually, last one didn't work). http://1cc.2b1.myftpupload.com/gstest/1_1_v10_working.html

Likes

translate

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
community guidelines
Adobe Community Professional ,
Oct 18, 2019 Oct 18, 2019

Copy link to clipboard

Copied

Glad I could help! Good lluck on your project. 🙂

Likes

translate

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
community guidelines