Add Lingo to navigation buttons
To make the navigation buttons function, you need to add scripts to the buttons. These scripts
should be attached to the button sprites, rather than to frames in the script channel. Your frame
scripts respond to
mouse clicks.
You start by adding scripts to the button sprites in the start scene.
In the Score, display frames 1 through 10.
1
Right-click (Windows) or Control-click (Macintosh) the Animation button sprite in channel 3,
2
frames 1 through 10.
In the context menu, select Script.
3
The Script window opens with a default handler entered:
on mouseUp me
end
On the second line, type the following script:
4
_movie.go("Animation")
You see the following result:
on mouseUp me
_movie.go("Animation")
end
In the Name text box at the top of the Script window, type GoAnim.
5
Close the Script window, and save your movie.
6
This handler has three parts. The first line tells Director to trigger this handler when the user
clicks on the button sprite to which the script is attached. Specifically, the
the action of releasing the mouse button after it has been pressed. This way the script does not
run until the user releases the mouse button when clicking.
The second line of the handler contains the same code as the previous script that you wrote. It
sends the playhead to the frame that contains the marker named Animation. The difference
between these two scripts is that this one performs its action based on a mouse click, not on
an
event.
exitFrame
Again, the word
Test your script
You are now ready to try out your new button script.
If necessary, bring the Stage window to the foreground by clicking its title bar.
1
Rewind and play your movie.
2
The movie plays, and the start scene remains on the screen. The playhead does not move to
another scene until you click your newly scripted button.
Click the Go to Animation button on the Stage.
3
The button provides feedback by changing color when it is clicked. The playhead moves to the
first frame of the animation scene, and the tire bounces.
Stop your movie.
4
70
Chapter 4: Building Your First Basic Movie
events. After you write the button scripts, they will respond to
exitFrame
on the last line tells Director that the script is finished.
end
event refers to
mouseUp
Need help?
Do you have a question about the DIRECTOR MX 2004-GETTING STARTED WITH DIRECTOR and is the answer not in the manual?
Questions and answers