switching between movies
userev at canelasoftware.com
Mon Aug 23 10:55:30 CDT 2004
On Aug 23, 2004, at 12:28 AM, Jason Tangen wrote:
> I have two movies (both 640x480, 240 frames, ~2MB each). I want to
> allow the user to click a button to switch back and forth between the
> two without delay. Right now - I'm using the following strategy:
> on keydown key
> if key = space then
> put the currentTime of player "A" into Atime
> set lockscreen to true
> hide player "A"
> set the currentTime of player "B" to Atime
> show player "B"
> start player "B"
> set lockscreen to false
> else pass keyDown
> end keydown
> ...but this results in a rather noticeable delay between the clips. I
> found that setting alwaysBuffer to false helps, but not much. I tried
> importing the clip - but the videoPlayer doesn't allow you to set the
> current frame or time. I thought about frame-based animation or
> animated gifs, but animated gifs seems rather memory intensive
> (especially for 240 frames!)
I modified your program slightly. The main thing I noticed was to take
out the lock screen. This made things pretty snappy. The faster the
computer, the faster the transition. I put this code at the card
on keydown thekey
if thekey = "1" then
stop player "B"
put the currentTime of player "B" into Atime
hide player "B"
set the currentTime of player "A" to Atime
show player "A"
start player "A"
if thekey = "2" then
stop player "A"
put the currentTime of player "A" into Atime
hide player "A"
set the currentTime of player "B" to Atime
show player "B"
start player "B"
More information about the use-livecode