
This is the Title of the Book, eMatter Edition
Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.
Further ActionScript Concepts
|
15
Here we see the variable message:
var message = "Hi there, Flash!";
If we like, we can combine the variable expression message with the literal expres-
sion “ How are you?” as follows:
message + " How are you?"
which becomes “Hi there, Flash! How are you?” when the program runs. You’ll fre-
quently see complex expressions that include shorter expressions when working with
arithmetic, such as:
(2 + 3) * (4 / 2.5) - 1
It’s important to be exposed to expressions early in your programming career,
because the term “expression” is often used in descriptions of programming con-
cepts. For example, I might write, “To assign a value to a variable, type the name of
the variable, then an equals sign followed by any expression.”
Two Vital Statement Types: Conditionals and Loops
In nearly all programs, we’ll use conditionals to add logic to our programs and loops
to perform repetitive tasks.
Making choices using conditionals
One of the really rewarding aspects of Flash programming is making your movies
smart. Here’s what I mean by smart: Suppose a girl named Wendy doesn’t like get-
ting her clothes wet. Before Wendy leaves her house every morning, she looks out
the window to check the weather, and if it’s raining, she brings an umbrella.
Wendy’s smart. She uses basic