A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: Run loop first time only...

  1. #1
    Hello all!

    I've got a "for" loop on the timeline of a MC. Although this MC will be played through several times, I only want the action the "for" loop generates to happen the first time it plays, then skip the code every time thereafter. I've tried initiating a variable to 1, then using "if (variable == 1)" to run the "for" loop, then resetting variable to 0. Of course the problem is that the original variable setting (of 1) runs the next time this MC plays which sets off the "for" loop again. Is there a better way to approach this, or a way to make the variables work?


    Dale Janzen

  2. #2
    Junior Member
    Join Date
    Jun 2001
    Instantiate your variable in the _root timeline, then reference it by "if (_root.variable == 1)". Set the variable inside your loop the first time through to 0.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center