Changing image fileName Based on QT Time...?
John Patten
johnpatten at mac.com
Tue Oct 19 12:20:12 EDT 2004
Great Klaus!
I'll check out the sample on your site. I do remember previous mentions about the dangers of "idle."
In my attempts to synch up my slides with audio i began looking at creating a QT SMIL movie using Rev to create the SMIL document. I made some progress after familiarizing myself with SMIL tags, but I was hoping to stay within Rev to do this. Not sure where the SMIL tests would have lead.... I'll check out the example and try some switch statements in conjuction with the callbacks.
Thanks Again!
John Patten
Tech Dept
SBCUSD
On Tuesday, October 19, 2004, at 03:40AM, <use-revolution-request at lists.runrev.com> wrote:
Message: 18
>Date: Tue, 19 Oct 2004 12:13:07 +0200
>From: Klaus Major <klaus at major-k.de>
>Subject: Re: Changing Image FileName Based on QT Time...?
>To: How to use Revolution <use-revolution at lists.runrev.com>
>Message-ID: <7919AD4C-21B7-11D9-862A-000A27B49A96 at major-k.de>
>Content-Type: text/plain; charset=US-ASCII; format=flowed
>
>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