Changing Image FileName Based on QT Time...?
Klaus Major
klaus at major-k.de
Tue Oct 19 06:13:07 EDT 2004
Hi John,
> Thanks Klaus!
>
> I'll check out the "currenttime" of player call in the morning. I was
> not aware of currentTime of player.
> Would this be used on an idle script?
NO!!!!!!!
Never use "on idle" or you will get eternal damnation!!! :-D
(At least as evil as "repeat until the mouse is UP"!)
Instead use "send xyz... in abc..."
> Something like:
>
> If currentTime is > 20000 then
> set fileName of image xyz to "slides/slide1.jpg"
> else
> if currentTime is > 25000 then
> set fileName of image xyz to "slides/slide2.jpg"
> ...
Well almost, but i would rather use a "switch...case..." handler in
this case
MUCH MORE readable and less harmful, since there are so many
possibilities
to use "if...then" that
1. most of the time you cannot oversee it with one glance
2. you forget one "end if" almost EVERYTIME ;-)
Like this:
##Start the player:
on mouseup ## or whenever...
start player xyz
check_the_time
end mouseup
on check_the_time
put the currenttime of player xyz into CT
switch
case CT < 20000 AND CT > 10000
set fileName of image xyz to "slides/slide1.jpg"
break
case CT < 30000 AND CT > 20000
set fileName of image xyz to "slides/slide2.jpg"
break
...
end switch
if CT < the duration of player xyz then
## Sound is not yet finished, so we might have to check again...
send check_the_time to me in abc millisecs
end if
end check_the_time
Get the picture?
But see below...
> Am i on the right track?
Yo, but i would suggset to let the player-object do all the work :-)
I mean set and use "the callbacks" of the player to trigger your change
of images...
I just uploaded a tiny stack "Fun with callbacks" to REV-unline ->
"klausimausi" ;-)
That will get you started (hopefully) with callbacks, which are a very
powerful,
yet quite unknown feature of REV.
> Thanks again!
Drop a line (even offlist, if you like) if you need further
inof/assistance...
> John Patten
> Tech Dept
> SBCUSD
Regards
Klaus Major
klaus at major-k.de
http://www.major-k.de
More information about the use-livecode
mailing list