Specifications

218 ActionScript: Use Script Assist mode
Add frame scripts to the Timeline
by using Script Assist mode
Rather than adding scripts to individual objects, and acting on objects
directly but also dispersing code in many different places in your Flash
document, place the scripts in a frame in the timeline instead. This section
demonstrates how you add scripts to a timeline.
1. On the main Timeline, select Frame 1 of the Actions layer.
2. In the Actions panel toolbar, click Script Assist to display the Script
Assist window.
3. From the Actions toolbox, select ActionScript 2.0 Classes > Movie >
Button > Events and locate the
on(release) event handler.
Double-click the
on(release) event handler to insert it into the
ActionScript editor.
Using the Actions toolbox to insert functions into the script
You’ll notice that code placed on a timeline behaves differently than
code placed on objects. In the previous example, you had to specify the
target object for the
on(release) event handler. This is because youre
not adding the script directly to the object, but rather, youre referring
to it from the code in the timeline. It also explicitly uses the
function
keyword to declare a function. You’ll see how to use Script Assist mode
to handle these in the following steps.
4. Click in the Object text box.
On the Actions panel toolbox, the Insert a Target Path button
is enabled.