With Flash 5, Macromedia has considerably enhanced the powerful scripting language: ActionScript. ActionScript can be used for a number of purposes, including automating repetitive animation, keeping track of user interaction and input, and interacting with external data sources. In this manual, we’ll be focusing on using ActionScript to build interactive Flash movies, including the ability to control the Timelines of Instances as well as sequence and structure Flash movies.
What is a Script?
A script in Flash is a Statement or a series of Statements that execute specific tasks. Statements are lines of code that you attach to either a Button Instance or a key frame. When the user {Clicks} a button the Statements attached to that button are executed. When the scrub or play head passes over a particular key frame with a script attached, the Statements attached to the key frame are executed.
For example, the following is a Statement attached to a key frame:
stop ();
When the play head passes over this key frame (wherever it may be on the Timeline) the Statement is executed. In this case, this command instructs the play head to stop at this point on the Timeline.
Statements attached to key frames are called Frame Actions.
This is an example of a Statement attached to a Button Instance:
on (press) {
gotoAndPlay (100); }
When the user {Clicks} the button that these Statements are attached too, Flash moves the play head to the 100th frame on the Timeline and proceeds to continue from that point.
Statements attached to Button Instances are called Object Actions.
In almost all cases, you use a combination of Frame and Object Actions to build interactive structures in Flash.

No comments:
Post a Comment