A "simple" slideshow
Klaus Major
k_major at os.surf2000.de
Wed Aug 14 15:01:01 EDT 2002
Bonsoir Aurelian,
> On Wednesday, August 14, 2002, at 11:00 AM, Aurélien Durand wrote:
>
>> Actually i'm making a very simple slideshow with about 30 cards. Its
>> script
>> is divided into those 30 cards in order to avoid the script limitation.
>> for example, this script in each card:
>>
>> on openCard
>> wait for 2 seconds
>> visual dissolve
>> go cd "slide004"
>> end openCard
>
> It might work to add "with messages" to the wait.
> However, I'd be inclined to do something like this (untested):
>
> on openCard
> send advanceSlide to me in 2 seconds
> end openCard
>
> on advanceSlide
> global slideShowOn
> if slideShowOn then
> visual dissolve
> go cd "slide004"
> end if
> end advanceSlide
>
> As far as avoiding the script limitation, you might be able to move the
> default openCard handler to the stack. You might be able to move the
> advanceSlide handler to a hidden field that contains the name of the
> next card (and perhaps other info); adjust the send accordingly.
>
> I believe the openCard is called in place during execution of the "go"
> without any tail recursion optimization. Also, it is not placed in the
> list reported by pendingMessages() for delayed execution. If those
> really represent the case, then the original script will will make
> deeper and deeper calls.
>
> Dar Scott
if i understand you right, there are about 30 cards (more or less) and
each contains
a different image ?
In this case you can simply script this:
Put this into the stack-script:
global the_advancing
## This global will store the id of the pendingmessage
## (see there !) "advanceslide"
## This way you can cancel that message from being delivered
## by cancelling this id (global)
on openCard
send advanceSlide to me in 2 seconds
## Or whatever interval will do for you
global the_advancing
put the result into the_advancing
## See above...
end openCard
on advanceSlide
visual dissolve
go next cd
## Will do exactly what you need
## and will even cycle forever when reaching the
## last card in your slideshow ;-)
end advanceSlide
on mouseup
global the_advancing
cancel the_advancing
## Stop the slideshow by just clicking anywhere in the stack
end mouseup
## And you still have 5 statements left in THIS script :-)
Hope that helps.
Au revoir
Klaus Major
k_major at os.surf2000.de
More information about the use-livecode
mailing list