There are many ways to reverse frames … i just did'nt find one that will satisfy my needs , so ended up with my creation 🙂
*Add the code at your last frame in the actions Layer .
stop();
var speed:Number = 20;
function goprev() {
if (_root._currentframe == 1 ) {
clearInterval(nIntervals);
trace("Stop");
}
prevFrame();
trace("going back");
}
var nIntervals = setInterval(goprev, speed);
- Xplanation:
declared a Variable and called it speed limit its data type to Number , it will be used in the setInterval. will control the reverse speed.
var speed:Number = 20;
Next is the goprev() Function that will first check for the currentframe of the timeline if it fully reversed the timeline then it will clear the interval & stop the timeline , if not then it will keep on reversing the timeline untill it satisfy the condition .
function goprev() {
if (_root._currentframe == 1 ) {
clearInterval(nIntervals);
trace("Stop");
}
prevFrame();
trace("going back");
}
then our main controller , the setInterval
var nIntervals = setInterval(goprev, speed);
which is basicly used this way setInterval(name of the function, intervals as time in milliseconds);
Files can be found @ Zainals
Greetings !!
Ahh this flash example has helped me GREATLY !!! I had the need for a bunch of reversals embedded in a timeline and had been searching for ideas everywhere for a compact way how to do this WITHOUT using a moviceClip as a controller.. ty for this example i was able to apply it to my situation with slight modifications!
kindest,
Anonymous
Hey ,
thanks for dropping in.
glad 2 know it helped someone , somewhere 😀
hi , i have problem , your zip file i can’t unzip it state me unpect file format
i use flash version 6
hey aum ,
sorry , but i dont have flash 5 anymore …
but you can try it your self …
open up a new flash file ,do a simple tween on the time line …
on the last frame add the following code to the action layer:
======================================
stop();
var speed:Number = 20;
function goprev() {
if (_root._currentframe == 1 ) {
clearInterval(nIntervals);
trace(“Stop”);
}
prevFrame();
trace(“going back”);
}
var nIntervals = setInterval(goprev, speed);
======================================
hope that works since i never worked with any previous versions of flash but MX2004 …
Hello,
This has just helped me a lot! i had an animated MC button and needed it to reverse. Had originally animated it in but it meant that the button was sometimes left thinking that the mouse had rolled over it without it realising it had rolled out again.
Just removed the _root. and applied the code directly to the button with an on (roll out) and it works a treat!
Cheers
Rob
hey toasters ,
thanks for dropping by & im glad it worked …
i’ll post a new code , soon hopefully for targeting multiple objects .
so watch this space !
wow.. i did what toaster did and it actually worked [which i am still shocked at]
you RULE.
nothing to be shocked about mate , practice makes perfect .
Welcome & Thanks for the comment .
Works perfectly. Thanks!
Q: hot to loop it? (it stops after reversing)