-
If animation is playing, DO NOT REPEAT IT
Hi,
In my game, there's a button. When I click on it, it plays an animation of 10 frames longs. The problem is; if I keep my finger on the button, the animation will bug and stay to frame 1.
I'd like that the button cannot be pressed before the animation's finish.
So, here's what I want:
I press (or release), the animation plays, but if I press during the animation is playing, it doesn't do anything. I have to wait until the animation is finish to re-start it.
Can you help me?
I know I have to write something with 'true' and 'false', but I don't know how to write it. I tried a lot of things with some threads of this forum, but I didn't reach anywhere...
Thank you!
-
Run for your life!
what code are you currently using on your button?
-
Senior Member
Call your animation movie clip "anim_mc" and add this to the first frame inside of it:
Code:
_root.playTest = "stopped";
stop();
Add this to the second frame:
Code:
_root.playTest = "playing";
Add this to the last frame:
Add this code to the frame where the button is located (on the timeline):
Code:
play_btn.onPress = function() {
if (_root.playTest == "stopped") {
anim_mc.gotoAndPlay(2);
}
};
Call the button "play_btn" and thats it
-
Script kiddie
Are you using a gotoAndPlay() statement? Because if so, I reckon you could fix the problem by using this script on your button instead:
on (release) {
_root.whateverMovieClip.play();
}
-
Senior Member
Originally Posted by VENGEANCE MX
Are you using a gotoAndPlay() statement? Because if so, I reckon you could fix the problem by using this script on your button instead:
on (release) {
_root.whateverMovieClip.play();
}
that would work too i guess it all depends on what you're trying to do
-
Thank you VERY MUCH to all of you! It finally works!
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
|