all groups > flash actionscript > december 2004 >
You're in the

flash actionscript

group:

Play timeline on Reverse


Re: Play timeline on Reverse (_seb_)
12/7/2004 6:36:43 PM
flash actionscript: here's a script to play any timeline backwards.
It works, I've used it mnay time. It was posted a while ago by Navneet:
note that the actions in keyframes still apply when the movie goes
through the timeline backwards.

Make a new movieClip with 3 frames, with no graphics in it and it should
have
this structure

Frame1: Label: "fStop"
Frame2: Label: "fRewind"
Frame3: Label: "fRewLoop"

Now, on Frame1 add these actions

-------------------------------------
function playBackward($mcPath){
if(eval($mcPath)._currentFrame > 1){
eval($mcPath).prevFrame();
} else if (eval($mcPath)._currentFrame == 1) {
eval($mcPath).gotoAndStop(eval($mcPath)._totalFrames);
}//End if
}//End function
stop();
------------------------------------

Frame 2:

if(rewind == true){
playBackward(_level0.myMC2Rewind);
}//End if

----------------------------------

Frame 3

if(rewind == true){
playBackward(_level0.myMC2Rewind);
gotoAndPlay(_currentFrame-1);
} else { gotoAndStop("fStop");
}//End if

----------------------------------

That's all there should be in this movieClip. Exit the editing mode for this
movie and return to stage. From your library drag an instance of this
movieClip
we have just created and give it an instance name of mRewinder. It
should look
like a litte circle and you can place it anywhere. It will not show in your
final movie since there is nothing in it!!

Now, onto your button. For this example, I will presume that the movie
you want
to rewind is called myMC2Rewind and lives on _level0 So the path I will
use is
_level0.myMC2Rewind

You can simply modify it to target the actual path of the movie to
rewind. If
you follow this example complety, I have used "_level0.myMC2Rewind" 3 times.

Let's get to your button.

--------------------------------------
on (rollOver) {
if(_level0.mRewinder.rewind == true){
_level0.mRewinder.rewind = false;
}//End if
_level0.myMC2Rewind.play();
}//End rollover

on (rollOut) {
_level0.mRewinder.rewind = true;
_level0.mRewinder.gotoAndPlay("fRewind");
}//End roll out
---------------------------------------


That's all there is to it. The function playBackward will take care of
rewinding
the movie.

Good luck



[quoted text, click to view]
Play timeline on Reverse xtudios
12/7/2004 10:33:22 PM
I have a _root MC Then I have a button at _root Also I have 2 MC with
instance names: animation_MC animation2_MC (each of this MC has an inside
animation of 11 frames) at the load of the _root Movie both instances will be
stop at a frame in its own timeline animation_MC will be stop at frame 1
animation2_MC will be stop at frame 11 I need that on a release action of my
button the animation_MC gotoansplay to frame 2 and the animation2_MC gotoanplay
ON REVERSE to frame 10 so it can stop at frame 1. And with an if/else action
detect the position of each timeline of each MC so if we performed once the
action, on another on release of the button the action will be the opposite.
Thanks
Re: Play timeline on Reverse NSurveyor
12/7/2004 11:16:16 PM
//Place this code on the _root timeline:
//Adjustable Options===============================
myButton = pathToYourButton;
speed = THESPEEDYOURMOVIECLIPSWILLMOVEATPERFRAMEINMS;
//Ex: speed = 1000, means every 1000 ms,
//your movieclips will move one frame.
//================================================
animation_MC1.gotoAndStop(11);
animation_MC2.gotoAndStop(11);
myButton.onPress = function(){
stopIt(animation_MC,animation_MC2);
animation_MC.playingID = setInterval(playIt,speed,animation_MC,1);
animation_MC2.playingID = setInterval(playIt,speed,animation_MC2,-1);
}
myButton.onRelease = function(){
stopIt(animation_MC,animation_MC2);
animation_MC.playingID = setInterval(playIt,speed,animation_MC,-1);
animation_MC2.playingID = setInterval(playIt,speed,animation_MC2,1);
}
function playIt(someMc,playDir){
toFrame = someMc._currentframe+playDir;
trace(toFrame)
if(toFrame > someMc._totalframes || toFrame < 1){
clearInterval(someMc.playingID);
}else{
someMc.gotoAndStop(toFrame);
}
}
function stopIt(){
for (item in arguments) {
clearInterval(arguments[item].playingID);
}
}
Re: Play timeline on Reverse jameslyon
12/7/2004 11:17:53 PM
Unfortunately there is no reverse play functionality in Flash. I've
experimented with using multiple gotoAndPlay statements on each frame but it
doesn't produce a fluid animation. If you were to adopt this strategy, try
using if/else statements on every frame to determine if it should gotoAndPlay
the previous frame or the next frame. Good luck.
Re: Play timeline on Reverse ilogik
12/8/2004 12:39:32 PM
i have the best and the simplest way to reverse play your animations.... read
it very carefully..... make a invisible MC name it as 'cntrl', keep its first
frame blank and give stop() command on it and on the second frame say...
(line1):- animation2_mc.prevFrame(); (line2):- nextFrame(); and on the
third frame say gotoAndPlay(2); and on your button (onrelease) as u want it
to, say, _root.cntrl.gotoAndPlay(2); what the above command do is play the
animation2_mc backward and keeps it chking until the last frame. this should
work f9 cuz i reverse all my animation using this method and it has worked fine
till now.
Re: Play timeline on Reverse ilogik
12/8/2004 12:41:55 PM
if u still cant crack it u can mail me i would send u the examlpe file that would assist to the max.
Re: Play timeline on Reverse Special-k
12/17/2004 2:18:02 PM
I've got an old version of it up on my site. I'm sure you can leverage from
this too (if you're still playing with it). It's similar to what ilogik was
talking about. http://www.bubba-x.com/learn.asp (click on backwards)

Sorry it's late. Macromedia's forum search tool makes any topic blow up when
you click on the links (well for me at least).

Kelly
AddThis Social Bookmark Button