Flash Question
- Started
- Last post
- 3 Responses
- Bullitt
To any of the actionscript grand masters who can help
Trying to add an action to a button, that on mouse press it will tell a movie clip ( which is playing in the background) to gradually slowdown and stop.)Trying to mimic a car breaking basically , so have a brake pedal and a movie clip running. so on mouse press, it will not just stop the movie clip (which is doing something shit like this at the moment : _root.carMoving.stop() ) at the specific frame it is running, it should gradually stop over a space of maybe 25 frames - on the movie clip that is.
Any idea be greatly appreciated. Thanks people.
- Autokern0
so, if i get this correctly this means that the
car is into a movieclip with a certain number of frames
and what you want to do is basically slow down the framerate at which that movieclip is playing. Correct?To be fair, it's quite a tricky problem in the way you set up the thing.
The best way i can think about to solve it would be to have an enterframe that plays the car Mc
And pressing the button what you will do is to make that enterframe
"skip"frames according to how much the brake has been pressed.The problem with this is the movement will look jerky and the slowing down will not be smooth
(because you'll slow the framerate the car will pass from playing to, say, 25 fps, to 12.5fps (a frame of the car each 2 of the main framerate) or 6.25 fps ( a frame each 3).Alternatively you could work around this problem with a setInterval, which relyes on milliseconds than frames.
I can write you the functions you need. Just wanted to understand the problem first.
- yeah, basically mate, I just want a button that will gradually slown down a running movie clip and stop it.Bullitt
- CyBrain0
This can be done with TweenLite. I'll dig around for the syntax.
- CyBrain0
Yes, you can do it with one line of code + import statements with TweenLite (which works for AS2 and AS3)
http://blog.greensock.com/tweenl…
Scroll down to the TweenLite/Max Plugin Explorer.Click on the Frame Example and do a test and the bottom will show generated code like this.
TweenLite.to(mc, 2, {frame:20, ease:Quint.easeOut});Just substitute your movie clip name for mc, frame number for 20 and pick your easing equation.