• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 15. Using Basic ActionScripts > Working with For Loops

Working with For Loops

The For loop works with an increasing or decreasing numeric value. For example, you could use a For loop to create several copies of a movie clip on the Stage. Letting the For loop control movie clips to the Stage is far more efficient than having to move them one at a time. In addition, the visitor can control when the items appear on the Stage using a button.

Work with For Loops

Drag a movie clip from the Library to the Stage, and then select the movie clip.

Enter a unique instance name for the movie clip in the Property Inspector.

Place a button on the Stage, and then select the button.

Enter the script as shown in the illustration.

When you play the movie, clicking on the button causes the action to loop 10 times. Each time it loops, it duplicates the original movie clip and rotate it by a 45 degrees plus the current value of x times 10.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint