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] jameslyon wrote:
> 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.
//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);
}
}