Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Flash CS5 AS3 Is there a way to reset all the timelines while/if the Frame 1 en Scene 1 is called?

I happen to have lots symbols with timelines, if I gotoAndPlay Scene 1 frame 1, most symbols won't restart.

I use

MovieClip(root).gotoAndPlay("one");
share|improve this question
    
What's with the "one"? Are you using timeline markers? If you want to go to frame one, then you should call gotoAndPlay(1). –  bummzack Nov 23 '11 at 8:14
add comment

1 Answer

up vote 1 down vote accepted

If you have only one level of children, it's easy. You just loop through them and call gotoAndPlay like this:

for (var i:int = 0; i< MovieClip(root).numChildren; i++) 
{
    MovieClip(root).getChildAt(i).gotoAndPlay("one");
}

But if you have multiple levels of children, you should do a recursion through all children and run the code above for all of them.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.