Chapter 4. Making Decisions ... and Repeating Yourself
In This Chapter
Ogling conditional statements
Making decisions with the
ifstatementChecking out the
elseclauseStructuring the
switchstatementSetting up the
forloopFinding unknown elements with the
for..inloopExtracting properties with the
for each..inloopIterating through a
whileloopGetting loopy the
do..whileloop
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.

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access