user1302382
user1302382

Reputation: 31

Loop swf after certain number of seconds

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

Answers (1)

Diode
Diode

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

Related Questions