flash actionscript:
[quoted text, click to view] "D_Vallentyne" <webforumsuser@macromedia.com> wrote in message
news:c9359l$8ht$1@forums.macromedia.com...
> hello
>
> i wish to set up a button that will play specific frames of a movie clip
> instance, lets say 1 - 10 on rollover and 10 - 20 on rollout. what i can't
> figure out is how to get it to finish frames 1-10 before starting 10-20 on
a
> rollout. i want to play all 20 frames of the instance if you pass your
cursor
> over the button.
>
> right now i'm using myinstance.gotoandplay(x), but this causes the
instance to
> jump frames if you rollout before the first stage of the animation is
complete.
>
> any help is greatly appreciated, thanks in advance.
> -me
I like to use the modular approach. That way the movieclip has it's own
control code that is triggered by flags set by the buttons and the clip
can't be commanded to do something at the wrong time. Direction flags are
set by the buttons but no action is taken on the flags until the movieclip
is ready to do it.
This is the standard method I use for programming industrial machinery. It
works well for Flash too.
At Frame 1 the movieclip checks a flag to see if it is time to play from 1
to 10.
At frame 10 it stops and waits for a flag telling it to play from 10 to 20.
The movieclip in this example has an instance name of myMc
good luck,
tralfaz
//----------------------------------------------------------------
// inside movieclip on frame 1
stop();
this.done = false;
//----------------------------------------------------------------
// inside movieclip on frame 10
stop();
this.start = false;
//----------------------------------------------------------------
// on main timeline attached to movieclip myMc
onClipEvent(EnterFrame)
{
with(this) // everything refers to this clip now
{
if (_currentframe == 1)
{
if(start) // start flag set?
play();
}
else if(_currentframe == 10)
{
if(done) // time to close?
play();
}
}
}
//----------------------------------------------------------------
// main timeline button code
on (rollOver) {
myMc.start = true;
}
//----------------------------------------------------------------
// main timeline button code
on (rollOut) {
myMc.done = true;
}
//----------------------------------------------------------------