Zimenez
Zimenez

Reputation: 15

Actionscript 3 - lock the code from restarting while it loops

I am making a boardgames in flash, with a background with moving objects. It goes on repeat, so they dont stop on the last frame, which in this case is 60 frames. Only problem is, the actionscript code which has its own layer, and exists on frame 1, resets every time it starts over again, logically enough. But then I loose all the data I´ve gained over the time of 60 frames.

Is there a way I can make the actionscript code unbound from the objects loop?

Cheers

Upvotes: 0

Views: 114

Answers (1)

xxbbcc
xxbbcc

Reputation: 17327

On the last frame of your animation, add a bit of AS3 code to force skipping frame 1:

gotoAndPlay ( 2 );

When the playhead reaches the last frame, this line will execute and your animation will restart at frame #2, skipping the code on frame #1.

Upvotes: 0

Related Questions