O'Reilly logo

Flash CS4 All-in-One For Dummies® by William B. Sanders, Doug Sahlin

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 4. Making Decisions ... and Repeating Yourself

In This Chapter

  • Ogling conditional statements

  • Making decisions with the if statement

  • Checking out the else clause

  • Structuring the switch statement

  • Setting up the for loop

  • Finding unknown elements with the for..in loop

  • Extracting properties with the for each..in loop

  • Iterating through a while loop

  • Getting loopy the do..while loop

Computer programs can make decisions by comparing different sets of information. In Flash CS4, this can be important for applications where more than one alternative is available to the user. Likewise, your computer can process repeated chores so that you only have to write a little code and you can repeat it using loop structures.

Making Decisions ... and Repeating Yourself

In this chapter, we explore the main applied structures of ActionScript 3.0 and also a special kind of object called an array, in which you can store all kinds of elements in a single object. You can use these structures with different functions you can create. Some of the features in this chapter may be familiar from other chapters, but in this chapter we go into more depth.

On One Condition! (Or, Maybe More than One): Conditional Statements

At its base, the conditional statement in ActionScript 3.0 works very much like everyday decisions, such as what to wear, what to read, where to go, and what to do. In all these decisions are conditions. For example, in deciding what to wear, you may ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required