Slider: Constraining One Sprite to Another

Quicktime: Controlling a Quicktime Movie

(n.b.: this is a simulation; QT doesn't do well in Shockwave)

slider

1. Create a "Line" castmember in the Paint window, 1 pixel high and however long you would like your slider to be. Then create another Paint castmember as your Slider Handle, with these dimensions: 7 pixel by 20 pixels (use the castmember Property Inspector to determine the size of the castmember). Place these sprites on the Stage. Open the Script window, create a new script, and use the "Script" tab in the property inspector to select the Type of script as "Movie". Put in the following script:


on startMovie
set the constraint of sprite 16 to 2
end

Note that "2" indicates the Line sprite channel number and "16" indicates the Slider Handle sprite channel number.

Quicktime movie control: movieTime/movieRate

2. Place the Quicktime castmember in Sprite channel #1. Play the movie to its end, then use the Message Window to find out the total "movieTime" of the QT movie, by typing in:


put the movieTime of sprite 1


then hit Return. A number will appear in the Message Window, which is the movieTime of the Qtmovie. Divide this number by 9 (for the nine rectangles/increments of your slider). The result will become the increments of your slider bar, i.e., 0, 100, 200, 300, 400, 500, 600, 700, 800.
3. Create 9 same-size rectangles that will make up your slider bar (refer to Shockwave movie above for size and arrangement of "rainbow" rectangles). Arrange them on the stage as a slider bar, so as to cover the "Line" sprite. Attach the following sprite script to each of these rectangles, adjusting each script with the corresponding movieTime number:


on mouseWithin
set the movieTime of sprite 1 to 800
set the movieRate of sprite 1 to 0
end


The number "1" here refers to the Quicktime movie in Sprite Channel 1. The number "800" here refers to a movieTime number, and to one corresponding increment on your slider bar. Each different sprite script for each different sprite on your slider will replace this number with the next successive increment number. MovieRate is used to play the movie (1) or stop the movie (0).

Using a Slider to Scroll through Pictures

Replace the movieTime/movieRate scripts with a script to replace the cast member in sprite 1:

on mouseWithin
set the memberNum of sprite 1= 4
end