12 Replies Latest reply on Sep 6, 2007 2:00 PM by kglad

    Running Code Every Frame

    New AS3 Developer Level 1
      I am trying to force Flash to run a block of code every frame. In essense what I have is a large movie that is contained on one layer and I have some toggle buttons that allow the user to select which portion of the movie to play. So say we have a movie from frames 1 to 20 and I have cut up this movie into three arbitrary sections:

      First Clip: Frames 1 to 10
      Second Clip: Frames 11 to 15
      Third Clip: Frames 16 to 20

      These clips are represented as toggle buttons on the stage, allowing the user to select which to play. So the user could click all 3 which would play all three in order. The user could also click just clips 1 and 3 which would play frames 1 to 10 and 16 to 20 but skip over 11 to 15

      Because the movie is contained into one long movie I need to check each time to see if the script should go to the next frame or if it should skip to another frame that is non-sequential.

      So I simply need a way to call a function every frame to perform this current frame check. From the research I have done, onEnterFrame use to do this in 2.0 and below, however 3.0 uses all event listeners and I do not know how to get the same functionality.

      Any ideas? Thank you!