Accessibility

TechNote (Archived)

How to loop over some frames a given number of times

ActionScript makes it easy to count things. You can use a variable to count the number of times you pass through a frame.

For instance, to playback frames 10 through 20 five times, then the following Flash 4 ActionScript placed on frame 20 will accomplish that:

 Set Variable: "counter" = counter + 1     If (counter < 5)       Go To and Play (10)     End If 

In Flash 5, you can code the loop this way:

 counter++;     if (counter<5) {         gotoAndPlay (10);     } 

AlertThis content requires Flash

To view this content, JavaScript must be enabled, and you need the latest version of the Adobe Flash Player.

Download the free Flash Player now!

Get Adobe Flash Player

Creative Commons License

Search Support

Document Details

ID:tn_14023

Products Affected:

flashplayer