Interactivity with Quicktime

Click here to download the sample files


Adjust the Stage Size In Director:

Select the Stage Window

Look at the Window->Inspectors->Property Inspector Window.

Choose the Movie tab.

Input values for horizontal and vertical in the stage size boxes,    dir_stagesize.jpg
these should match your quicktime movie.


Import a Quicktime Movie

You should know the pixel size,  frame rate, and number of frames.
Choose File-Import...
            Select your movie,  Click Import.

Drag and drop the movie from the Internal Cast Window on to the Stage Window.

Notice the movie is 28 frames long in the Score Window.  Drag the end frame  to make the movie 1 frame long.

Select the quicktime movie,
    Open the Windows->Inspectors->Property Window
    Choose the quicktime tab
    Put a check mark next to paused   
--This will pause the quicktime movie.
    On a PC only, uncheck Direct to Stage.
 
--This will allow you to have type or objects on top of the quicktime movie. This will also slow down performance, use only when needed.  This option is broken on Macs.

Edit the Score Script with Lingo

Double click the first box in the score script.  See the diagram below.

dir_score2.jpg

A script window will appear.  Type the following in the score script. You do not need to add the red explanations.


on exitFrame

--uncomment the next line to print the duration into the message window
--put sprite(1).duration

-- This controls the frame of the QT movie to the horizontal location of the mouse.
-- The width of the example screen is 200 pixels,
-- the quicktime movie has 30 frames times 2 = 60 fields.
-- In order to adjust the movie to "scroll" we take the width of the screen
-- divided by the field rate.  200 width ÷ 60 fields = 3.333

  sprite(1).movieTime = the mouseH / 3.333

   go to the frame

end


Use Control->Play to play the animation.  Use Control->Stop or the apple . to stop it.

Move your mouse across the movie to play the movie.


Add a Frame Counter

Choose the Text Tool in the Tool Box, draw an empty text box somewhere on the stage.

Choose Modify Font..., select a font, color and size.

Use the Property Inspector for the text box, 
    select the Member tab,  dir_member.jpg  
    input the name ptext.
    Select the first info tab,
    change the ink to Background Transparent.   dir_behbutton.jpg


Double click the first box in the score script.   Add the following in bold to your score script:
on exitFrame
      sprite(1).movieRate = the mouseH / 3.333

  -- this puts the frame number of the quicktime movie into the textbox
      put sprite(1).movieTime into member "ptext"

      go to the frame
end


Use Control->Play to play the animation.  Use Control->Stop or the apple . to stop it.

Move your mouse across the movie to play the movie and see numbers in your text field.