9
2
CHAPTER 2
Flash 4 ActionScript Primer
Flash Lite 1.x ActionScript is based on the version of ActionScript that was first available in
Flash Player 4. Consequently, several programming features available in later versions of Flash
Player (for desktop systems) are not available to Flash Lite 1.x applications.
If you’re unfamiliar with Flash 4 ActionScript syntax and features or if you’ve forgotten some
of the details from previous Flash development work, this chapter provides a primer on using
Flash 4 ActionScript in your Flash Lite applications.
This chapter contains the following topics:
Getting and setting movie clip properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9
Controlling other timelines . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Using variables . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Emulating arrays . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Working with text and strings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
Using the call() function to create functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
Using the eval() function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .17
Getting and setting movie clip properties
To get or set a movie clip property (if settable), you can use dot syntax or the
setProperty()
or
getProperty()
functions. You can also use the
tellTarget()
function.
To use dot syntax, specify the movie clip instance name, followed by a dot (.) and then the
property name. For example, the following code gets the
x
screen coordinate (represented by
the
_x
movie clip property) of the movie clip named
cartoonArea
, and assigns the result to a
variable named
x_pos
.
x_pos = cartoonArea._x;
The following example is equivalent to the previous example, but uses the
getProperty()
function to retrieve the movie clip’s
x
position:
x_pos = getProperty(cartoonArea, _x);
Summary of Contents for FLASH 8-LEARNING FLASH LITE 1.X ACTIONSCRIPT
Page 1: ...Learning Flash Lite 1 X ActionScript ...
Page 4: ...4 Contents ...
Page 8: ...8 About Flash Lite 1 x ActionScript ...