-
stop movie on certain frame in timeline??
Hi.
I wondered if there is a way of generating a random number on frame one (say, 23), then play the movie and it stop on frame 23??
Thanks.
-
Senior Member
Here's one way to do it. It assumes the movie in question is called 'mc'.
code:
mc.frameToStop = 1+random(mc._totalframes);
mc.onEnterFrame = function()
{
if (this._currentframe == this.frameToStop)
{
stop();
}
}
mc.play();
-
wehay, perfect jbum. Thanks.
-
Hi jbum.
I used the script, and it generates the random frame fine, but the movie doesn't stop!!
I tried changing it to 'dice1.stop();' but that didn't work either. Any idea why?
Thanks.
-
sorry....where 'dice1' is used in place of 'mc'.
In frame 1, I have dice1.stop();
and then in a button, I have:
Code:
on (release) {
dice1.frameToStop = 1+random(dice1._totalframes);
this.onEnterFrame = function()
{
if (dice1._currentframe == this.frameToStop)
{
stop();
}
}
dice1.play();
}
it just playes the movie over and over and over again.......
-
Try changing this.onEnterFrame to dice.onEnterFrame...
I'm not an expert on flash but it looks like you are doing the onEnterFrame function on a button rather then the movie clip you are attempting to stop
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|