0
votes

My employer decided they wanted me to start doing animation with Adobe's new "Animate CC" application. My issue is that I don't know how to loop my animation outside of the Adobe Animate environment. I am new to Adobe Animate CC and ActionScript, unfortunately, so I will probably need a relatively basic answer to understand why my solution isn't working. From what I can tell, my ActionScript code is being ignored by the IDE completely.

In the IDE and in the browser test command, the animation plays beyond frame 100, to the end, and then flashes a frame of white before repeating. I need it to loop without this white frame interrupting the screen, whether that be through a loop or some other means that I'm just not aware of.

For context: my project has about 100 layers of content and I'm unfamiliar with how this program works. I've thoroughly searched the web for tutorials on how to do what I need to do, but I've come up empty handed.

I have an actions layer among my motion tweens and other layers https://gyazo.com/6e0b8502d98b6c9903bb96ac3a939bae

I've been trying to use gotoAndPlay(0) at frame 100 to start the animation over from the beginning. https://gyazo.com/704ee7158bae6dfd149b6283cfa33451

Basically, how do I use Action-Script in Adobe Animate CC in order to infinitely loop my animation until closed?

Thanks everyone.

1
You need to show your progress, otherwise people will say rtfm... I am not the downvoter. - sixtytrees
Fair enough. I added some screenshots of my work to show more detail of what I've done. - Shen Flips
So is there an issue with doing gotoAndPlay(0)? - BadFeelingAboutThis
Unfortunately, yes. I have the action at the 100th frame and the animation plays past my action code to the end. When it gets to the end, it briefly freezes and flashes a frame of all white before playing again. I would be fine without having the loop if it didn't freeze before repeating even, but... Also, it does this in both the IDE and when using the test command for a browser. - Shen Flips
Do you have any other actions? gotoAndPlay(1) should take you back to the start of the animation. Though if you lots of complex vector content it could be a performance issue. - BadFeelingAboutThis

1 Answers

0
votes

Your flicker may be a result of having an extra blank keyframe on one of your layers.

Assuming that you don't have any additional scripts to stop your animation (e.g. stop()), the Timeline should loop automatically whether your animation is inside a MovieClip or on the main Timeline. You shouldn't have to put any script on your timeline or in a separate AS file to make an animation loop. I would suggest this method.

Additionally, although you have the code specifying that you want it to go the first frame, it will ignore your call because the timeline is still playing and therefore the priority. One way you can combat this is by adding a stop(); function and a delay timer that contains your gotoAndPlay(0) function. This will take focus away from playing the Timeline and will allow you to execute your script. I wouldn't suggest this method because it seems a bit redundant.

However, if you're curious one way that you could approach this is shown below, simply add this script to the frame you want the animation to restart at.

//Stop the Timeline
stop();

//Create a delay timer for 5 miliseconds that is executed once
var timer:Timer = new Timer(5,1);

//Add an event listener that calls once the timer is complete
timer.addEventListener(TimerEvent.TIMER_COMPLETE, timerHandler);

//Start the timer
timer.start();

//Timer handler that is called once the delay timer is complete 
function timerHandler(event:TimerEvent){

     //Go to and play the first frame
     gotoAndPlay(0);
}