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

Looping Statements

With looping statements, you can create an action or set of actions that repeat a certain number of times or while a certain condition holds true. Repeating actions are often used to build arrays, which are special kinds of variables that hold data in a structured, easily accessible way. The looping action makes sure that each piece of data is put into a particular order or retrieved in a particular order. You'll learn more about arrays in Chapter 11. In general, use looping statements to automatically execute actions a specific number of times using an incremental variable. That incremental variable modifies the arguments of each successive method in the loop, or modifies certain properties of objects that are created. For example, you can generate graphics dynamically entirely with ActionScript by duplicating movie clips using looping statements and the duplicateMovieClip action. Use looping statements to change the properties of a whole series of movie clips, modify multiple sound settings, or alter the values of a set of variables.

There are three kinds of looping statements—the while, do while, and for actions—but they all accomplish the same type of task. The first two perform loops while a certain condition holds true. The third statement performs loops using a built-in counter.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


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