Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Loop Animate CC timeline X times and stop

New Here ,
Jun 09, 2016 Jun 09, 2016

I'm trying to loop the timeline a few times and stop. All the help files I have found so far do not work. Anyone have any ideas?

TOPICS
How to
30.6K
Translate
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
Enthusiast ,
Jun 09, 2016 Jun 09, 2016

Another time, try to search forum

Put this code on last frame. This is sample for 3 loops.

if(!this.alreadyExecuted){

this.alreadyExecuted=true;

this.loopNum=1;

} else {

this.loopNum++;

if(this.loopNum==3){

this.stop();

}

}

Translate
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
LEGEND ,
Jun 09, 2016 Jun 09, 2016

You can do it in a lot less code than that:

  1. if (!this.looped) this.looped = 1
  2. if (this.looped++ > 3) this.stop(); 

Put the code wherever you want it to stop, set the 3 to the desired loops.

Strange how often this specific simple question comes up.

Translate
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
Advocate ,
Jun 09, 2016 Jun 09, 2016

I mentioned this in another thread with the same subject but I'll add it here as well... that code is more concise but I would change it to:

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

if (this.looped++ == 3) this.stop();

(== instead of >) so that it stops at exactly at a specific number of loops.  Your example loops 4 times instead of 3.

Translate
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
LEGEND ,
Jun 09, 2016 Jun 09, 2016

And as I responded last time, that depends on whether you put the code at the beginning or end of the main timeline.

Translate
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
Advocate ,
Jun 09, 2016 Jun 09, 2016

It doesn't really seem logical to put it at the beginning of the timeline.

Typically when you loop something, you would want to stop on the end frame with something interesting to look at, some kind of message, or a call to action; not go back to a blank beginning frame before the animation started.

Translate
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
New Here ,
Feb 19, 2020 Feb 19, 2020

Does this work for HTML 5 export?

Translate
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
New Here ,
May 19, 2021 May 19, 2021

Just try it in HTML 5 export work greats, thx ! 🙂

Translate
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 07, 2022 Oct 07, 2022

Tried this several times with no success — the file just stops and shows random elements of the file, never loops. 

Translate
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 07, 2022 Oct 07, 2022

Any pointers? 

Translate
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
New Here ,
Nov 17, 2022 Nov 17, 2022

I've been using these above codes in previous banners. Now neither of the codes are working. Aaargh! Stupid update.
Have anyone figured out what to do instead?..   I miss Flash. 

Translate
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
New Here ,
Nov 17, 2022 Nov 17, 2022
LATEST

Already figured it out. I have accidently checked off "Loop Timeline" in Publish Settings. The code is working again. For anyone who might experience the same problem 🙂

Translate
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