Several people have written
to ask how to add a stop/restart button
to the original slideshow
sample, so I've modified it to do that.
I added a tiny little movieclip in the
bottom left corner of the main movie with
two keyframes in it: "playing" (frame
1) and "stopped" (frame 7). Each
keyframe has a stop action and a corresponding
graphic (eg, a Play symbol on frame "stopped")
in it. When the slideshow is playing and
the user clicks the Stop button, three
things happen
- a new method of the Slideshow component,
stopTransitions, is called. This deletes
the slideshow's onEnterFrame property,
which keeps any new transitions from
happening.
- the current slide's alpha is set
to 99, so it doesn't hang at alpha
= 50 or anything less than full alpha
when the movie is stopped (it's 99
instead of 100 to keep the picture
from shifting)
- the playhead of the stop/start button
movieclip is sent to frame "stopped"
When the slideshow is stopped and the
user clicks the Start button, the slideshow's
activateInSeq method is called with a
pointer to the currently displayed slide
passed as a parameter. The currently
displayed slide pointer (an index into
the slides array) is stored in variable
currentSlide on the main timeline. This
is passed to the slideshow component
as an additional property. It is kept
updated within the activateInSeq method.
|
|
In this version of the slideshow, in addition
to adding a currentSlide variable and the
stop/start button movieclip, I also changed
the main movie to attach the slideshow
component directly to the main timeline,
instead of to blank_mc (since it wasn't
really needed at all, and just complicated
the path to currentSlide more than necessary).
The slideshow component in this sample is version 1.02 as noted in the
comments in the component code.
|