Lingo for Playing QuickTime Movies

Date:    Sun, 4 Dec 1994 20:38:40 -0600
From:    Matthew Caldwell <sexkittn@BURN.DEMON.CO.UK>
Subject: Re: QT play Command
OK. The thing with all these exitFrame/go the frame methods of controlling the QT is that you need to establish a suitable condition for the loop to terminate.

Using

  if the movieRate <> 0
repeats as long as the movie is actually playing - ie, its rate is non-zero. This is fine normally, but if the QT controller bar is showing, the movieRate is initially zero, so the loop exits immediately and the movie never gets started.

The simplest solution to this is to place the movie over two frames. In the first frame:

  on exitFrame
    set the movieRate of sprite 2= 1
  end

What you're doing here is telling the movie to start playing. In the second frame, you have the standard:

  on exitFrame
    if the movieRate of sprite 2 <> 0 then go the frame
  end
which loops on this frame until the QT stops playing.

The problem with this approach is that it renders the controller bar rather redundant. You aren't really letting the user have much control, so why have the bar at all?

An alternative is to use the movieTime, which tells you whereabouts you are in the movie regardless of whether it's actually playing or not. This way you stay on the frame until the movie reaches its end:

  on exitFrame
    if the movieTime of sprite 2 < the duration of cast (the castNum of sprite 2) then 
      go the frame
    end if
  end
(It's probably better to put the duration of the cast into a variable beforehand so that you don't need to keep evaluating it, or better still put it right in the script as a constant value).

This allows the user to control the movie back and forth until it reaches the end, but then it'll still jump straight on to the next frame without warning.

Maybe a better way, though (assuming you do actually want people to be able to use the QT controller rather than it being just for decorative effect), is to separate the two functions entirely: you stay on the frame as long as the user wants to keep playing the movie back, forth and sideways, and give them a "go on" button to click when they're ready to move on.

In this case your frame script would look like:

  on exitFrame
    go the frame
  end
(note that since the loop is now unconditional, this will stay on the frame regardless of what the QT is doing)

And your button script would say

  on mouseUp
    go (the frame + 1)
    -- or wherever it is that you want to go next
  end
to provide a way to break out of the loop when desired.