
Writing scripts to control the movie 73
Digital video movies use a timeline instead of a Score. The timing of the video playback is tied
closely to the sound track of the video. For example, if the video has a sound track, the timing of
the video and sound must remain synchronized during the entire playback of the video. For this
reason, digital videos will skip frames if necessary to keep up with the sound track. On slower
computers, several frames might be skipped during video playback. This kind of animation is
called time-based. These differences are the reason you navigate a Director movie by jumping to
different frames in the movie, and you navigate a digital video by jumping to different times
within the video.
Now you are ready to add scripts to the bitmap graphic buttons for controlling the digital video
playback. The bitmap graphic buttons are a Play button, a Pause button, and a Rewind button.
For these buttons, you use some new scripting terms, including the
movieRate and movieTime
properties of the QuickTime sprite. By changing the values of these properties with Lingo, you
change the way the video plays on the Stage.
When the user navigates to the sound and video scene from a different scene, the digital video
plays from start to finish once. To play the video again without first leaving the scene, you need to
rewind it. You rewind the video by setting its
movieTime property.
The
movieTime property indicates the time, within the digital video, that currently appears on
the screen. The
movieTime is measured in ticks, or 60ths of a second. For example, when the
movie displays the very first frame of video, the
movieTime is 0. When 1 second of the video has
played, the
movieTime equals 60. When 3 seconds of the video have played, the movieTime
equals 180. By setting the
movieTime to a number that you select, you can make the video jump
to a different frame.
Rewind the QuickTime sprite
You can rewind the QuickTime sprite by setting its
movieTime to 0.
1 In the Score, display frames 55 through 64.
2 In frames 55 through 64, right-click (Windows) or Control-click (Macintosh) the Rewind
button sprite.
3 Select Script from the context menu.
The Script window opens with a default
on mouseUp handler already entered.
4 On the second line of the handler, type the following Lingo to rewind the QuickTime sprite:
sprite(1).movieTime = 0
5 Press Enter (Windows) or Return (Macintosh).
6 On the third line of the handler, type the following Lingo:
sprite(1).movieRate = 0
The movieRate property indicates the speed at which the QuickTime sprite is playing. When
the video is stopped, the
movieRate is 0.
The result looks like this:
On mouseUp me
sprite(1).movieTime = 0
sprite(1).movieRate = 0
end
7 In the Name text box at the top of the Script window, type RewindScript.
8 Close the Script window, and save your movie.
Comentarios a estos manuales