all groups > flash actionscript > may 2004 >
You're in the

flash actionscript

group:

playing specific frames of a movie clip


Re: playing specific frames of a movie clip tralfaz
5/26/2004 5:45:43 PM
flash actionscript:
[quoted text, click to view]

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;
}
//----------------------------------------------------------------

playing specific frames of a movie clip D_Vallentyne
5/26/2004 10:21:41 PM
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
Re: playing specific frames of a movie clip JPI
5/26/2004 10:57:52 PM
Well, I would use boolean variables to check if the cursor has rolled out,
and if frames 1-10 have finished playing. By checking the values of these
variables, you should be able to acheive your functionality.
Just be sure to reset the boolean variables.
Hope this helps somewhat.
Re: playing specific frames of a movie clip D_Vallentyne
5/27/2004 6:59:14 PM
thanks, that works well

AddThis Social Bookmark Button