Chapter 10. Automating Scripts with Loops


We've all had to perform repetitive tasks whether complicated or simple, they require us to perform at least one step in a process repeatedly. For example, if you were sending out 100 wedding invitations, repetitive steps could include folding papers, stuffing envelopes, closing envelopes, and affixing stamps each of which you must do 100 times! In ActionScript, performing a set of repeated steps, or actions, multiple times is called looping. ActionScript lets you loop through a set of actions as many times as needed which means that instead of writing an action (or set of actions) several times, you can write it once and then loop through it any number of times. In this lesson, you'll learn how to use the three loop types offered by ActionScript.

The drop-down list as well as the 2-by-2 grid of pictures in this application will be created dynamically using loops.

graphics/10fig01.gif

WHAT YOU WILL LEARN

In this lesson, you will:

  • Learn about the usefulness of loops

  • Learn about the types of loops

  • Set loop conditions

  • Create a nested loop

  • Use loop exceptions

APPROXIMATE TIME

This lesson takes approximately 45 minutes to complete.

LESSON FILES

Media Files:

None

Starting Files:

Lesson10/Assets/pictureShow1.fla

Lesson10/Assets/phoneNumberSearch1.fla

Completed Project:

pictureShow3.fla

phoneNumberSearch2.fla



Macromedia Flash MX ActionScripting Advanced. Training from the Source
Macromedia Flash MX ActionScripting: Advanced Training from the Source
ISBN: 0201770229
EAN: 2147483647
Year: 2002
Pages: 161

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net