kidyi
June 3, 2008, 3:34am
1
I have a movie clip which I want to play part of it in reverse when I click the button.
For example before I click the button, the movie clip will play from frame 150 to 155 then stop. Then when the button is clicked, the movie clip should play from frame 155 to 150.
Is there a way to do it using ActionScript 3?
The general idea is something like this:
addEventListener(Event.ENTER_FRAME, reverseClip);
function reverseClip(e:Event):void
{
clip.gotoAndStop(clip.currentFrame - 1);
}
Best of luck. :thumb:
[quote=Anogar;2335311]The general idea is something like this:
ActionScript Code:
[LEFT]addEventListener[COLOR=#000000]([/COLOR]Event.[COLOR=#000080]ENTER_FRAME[/COLOR], reverseClip[COLOR=#000000])[/COLOR];
[COLOR=#000000]function [/COLOR] reverseClipCOLOR=#000000 [/COLOR]:[COLOR=#0000FF]void[/COLOR]
[COLOR=#000000]{[/COLOR]
clip.[COLOR=#0000FF]gotoAndStop[/COLOR][COLOR=#000000]([/COLOR]clip.[COLOR=#000080]currentFrame[/COLOR] - [COLOR=#000080]1[/COLOR][COLOR=#000000])[/COLOR];
[COLOR=#000000]}[/COLOR]
[/LEFT]
Best of luck. :thumb:[/quote]
Instead of using
clip.gotoAndStop(clip.currentFrame - 1)
you could use
clip.prevFrame();
That’s probably a better idea. :lol:
I haven’t used frames since AS2, heh.
or you can tween the playhead position with tweenLite/Max, and send it from the end to the start.
“Frame tweening - Now you can tween to any frame in a MovieClip, like TweenLite.to(my_mc, 2, {frame:125});”
http://blog.greensock.com/tweenliteas3/