Copy link to clipboard
Copied
I have a presentation that contains 5 images. I want the presentation to start at image one and run to image five. I then want it to loop back to image TWO and then run to image five and then loop forever. So basically, image one only appears once, at the start. How do I do that? Thanks.
.
1 Correct answer
Your file plays absolutely fine on my machine without changing anything.
How are you previewing the animation?
use Ctrl + Enter to preview the animation on browser.
Copy link to clipboard
Copied
You simply have to go to the last frame, open Actions panel (Windows menu > Actions) and write a line of code over there.
this.gotoAndPlay(2); (for Actionscript 3.0 files), or
this.gotoAndPlay(1); (for HTML5 Canvas files)
Copy link to clipboard
Copied
Sorry - being thick; how do I set it up to return the playhead to the specific frame? Say I want it to go back to frame 25 and then loop continuously from there? Thank you for your answer.
Copy link to clipboard
Copied
this.gotoAndPlay(FrameNumber);
or
this.gotoAndPlay('Label');
Copy link to clipboard
Copied
I have opened my presentation and selected the final frame (frame 40).
I have opened the Actions Window and typed "this.gotoAndPlay(25);" (not in quotes). Frame 25 is where I want to loop from.
In the Actions panel, on the left side it reads:
Scene 1
Layer 1 : Frame 40
Do I have to pin it (I tried but nothing happened)?
In the fame itself, it now has an extra circle (not filled) above the keyframe circle (filled) underneath.
Running the file just results in it running from start to finish and stopping.
Copy link to clipboard
Copied
No, pinning is not needed.
Is there any other code somewhere else?
Can you share your fla file to have a quick look. You can upload it to dropbox or some other file sharing service and post the link.
Copy link to clipboard
Copied
Sorry Nipun - I know I'm doing something wrong here but I don't see it. Yes - I'll gladly share the file but firstly here is what is happening; I have now given the frame I want to loop back to a label having firstly made it a keyframe. Frame 39 has also been turned into a keyframe and the script attached to it - In the top window is the script I've used. The movie plays from start to finish and then stops. Thanks for your patience. I'm using Adobe Animate v.2017.2 on a Mac (OS X 10.12.4) if that helps.
Copy link to clipboard
Copied
when you use frame labels instead of numbers, use quotes in the gotoAndPlay() function call.
this.gotoAndPlay('startloop');
Copy link to clipboard
Copied
I was SO hoping that was the answer!! 8-0 Unfortunately, the same thing is happening, although the label appears to be recognised as it's turned green)
Copy link to clipboard
Copied
This looks fine,.Can you quickly share your file pls
Copy link to clipboard
Copied
You should be able to retrieve the file from this link.
Copy link to clipboard
Copied
Your file plays absolutely fine on my machine without changing anything.
How are you previewing the animation?
use Ctrl + Enter to preview the animation on browser.
Copy link to clipboard
Copied
How frustrating!! I was playing it within Animate itself - everything works fine in it apart from the looping part. However, as you say, I can now see that this is working properly in my browser (and I can't thank you enough for getting me this far!!!!!). Why would Animate not preview it properly - if I do a standard loop, that works. Thank you.
Copy link to clipboard
Copied
Animate "previews" perfectly well... when you press Ctrl-Enter. What it does not do is run script code while in the editor. That would be an insanely bad idea. The last thing anyone would want would to be fighting gotoAndPlays while trying to review an animation.
Copy link to clipboard
Copied
I don't have dropbox but I use SendThisFile - where can I send it to?
Copy link to clipboard
Copied
Two things not related to you main issue:
The text turning green is just that it is now seen as a text string and not a variable. It isn't that frame labels have special significance, any text inside quotes will show in green.
You can add other layers, and it's usually a good idea to have a layer dedicated to the scripts you're adding. That layer would still have. keyframe in frame 39, where the code would be, but it would mean that your last picture would not have a keyframe, it would go from frame24 to 39 like it originally did. It won't cause any problems in this particular case, but there's no advantage in putting in a keyframe where it isn't needed.

