Reputation: 31
I am creating a flash animation using flashEFF animation components. The animation isn't looping like it's supposed to be at the end of the animation, so I would like to hard-code a replay after 20 seconds. How would I use AS3 to loop reset to the beginning after 30 seconds?
Upvotes: 0
Views: 882
Reputation: 25145
You can achieve it like this after identifying the MovieClip instance.
movie.addEventListener(Event.ENTER_FRAME, function (event:Event) {
if(movie.currentFrame == 300){ // if 300 is the last frame
movie.gotoAndPlay(1);
}
});
Or if you want a time out of 30s
setTimeout(function(){
movie.gotoAndPlay(1);
}, 30000);
Upvotes: 1