ADBRITE ads links
You are here: CodeIdol.com > Flash > Macromedia Flash® ActionScript: Training from the Source > Lesson4.Arrays And Loops
Macromedia Flash® ActionScript: Training from the Source
| Lesson 4. Arrays and Loops
We all have to perform repetitive tasks. Whether complicated or simple, a repetitive task requires performing at least one step in a process repeatedly. For example, if you were sending out 100 wedding invitations, repet...
|
|
| What You Will Learn
In this lesson, you will:
Discover the usefulness of loopsLearn about the types of loopsExamine loop exceptionsSet loop conditionsCreate a nested loop
...
|
|
| Approximate Time
This lesson takes approximately forty-five minutes to complete.
...
|
|
| Lesson Files
Media Files:
None
Starting Files:
Lesson04/Start/pictureShow1.fla
Lesson04/Start/phoneNumberSearch1.fla
Completed Projects:
Lesson04/Completed/pictureShow3.fla
Lesson04/Completed/phoneNumberSearch2.fla
...
|
|
| Why Loops Are Useful
Loops enable Flash to perform an action (or set of actions) repeatedly, which means that with just a few lines of ActionScript, you can force an action to be executed several thousand times. In ActionScript, you use loops for ...
|
|
| Types of Loops
ActionScript can take advantage of three loop types, all of which repeat an action (or set of actions).
while Loop
The syntax for creating this common type of loop is as follows:
while(someNumber < 10) {
// perform ...
|
|
| Loop Exceptions
In general, a loop continues to perform iterations until its condition is no longer true. However, you can use two actions to change this behavior: continue and break.
With the continue action, you can stop the current iteration (...
|
|
| Creating a Search Application
In this example, we'll create a project that will search for a phone number from within an array based on the person's name.
1. Open phoneNumberSearch1.fla in the Lesson04/Start folder.
This file conta...
|
|
| Writing and Understanding Loop Conditions
For the rest of this lesson, we'll focus on the while loop. The actions within this type of loop are performed continuouslyas long as the condition evaluates to true. For example:
var i:Number = 0;
...
|
|
| Nested Loops
Loops provide a great way of automating a set of scripting tasks. However, loops can accomplish more than the repetitive execution of a set of actions. A nested loopthat is, a loop placed inside another loopcan be useful for creating ...
|
|
| What You Have Learned
In this lesson, you have:
Explored the usefulness of loops (page 79)Learned about the three loop types available in ActionScript (pages 7982)Learned about the continue and break loop exceptions (page 83)Applied for and while...
|
|
You are here: CodeIdol.com > Flash > Macromedia Flash® ActionScript: Training from the Source > Lesson4.Arrays And Loops
|
|
Related tags
Popular Categories
Unix books and guides
AJAX popular information
C# language guides
Windows books and cookbooks
.......
|
|