Playing a movie clip backward

I rememer seeing somewhere a tut about playing a movie clip backwards to save frames. the effect is like in the advanced rollover tut, only instead of making half the tween one way then half the other, you make it play one way then use script to play it backwards on rollout. anybody know how to do that?
I hope that was understandable.

the only way i can think of (<< that means there is an easier way)

if(someCondition){
prevFrame()
}

and put that in all the frames. there has to be an easier way though.

You could also create a new layer that goes from the first to the last frame of your animation, with that code. Something like onClipEvent (enterFrame) {if () _root.prevFrame ();}
Doing so, you wouldn’t have to put in all the frames.

pom 0]

oh yeah. :slight_smile: forgot about that.

oh man you guys are the greatest. this just cut all of my rollover animations in half for the future. I bow to thee.

Are you sure it’s a good idea ? It might cause some problems, I think. For instance if there are actions in your frames, or in your clips…

pom 0]

Reverse Script:

This script was designed to make it easy for anyone to reverse an animation or Movie Clip. It’s designed for Flash MX so it will not work in Flash 5 or below. All you do is add the following script to your root timeline (Frame 1 or as early as possible):

Movieclip.prototype.backUp = function(howManyFrames) { 
   this.createEmptyMovieClip('revController', 100); 
   this.revController.howMany = howManyFrames; 
   this.revController.onEnterFrame = function() { 
      if (this._parent._currentframe>1 and this.howMany>0) { 
         this._parent.gotoAndStop(this._parent._currentframe-1); 
         this.howMany--; 
      } else { 
         this.removeMovieClip(); 
      } 
   }; 
};

Then all you have to do is, on a button or keyframe, invoke the method and specify which timeline you want to reverse, and how many frames:

timelineToReverse.backUp(howManyFramesToReverse);

Where:
timelineToReverse is a path to a MovieClip, like _root, or _root.someChild.someGrandChild.
howManyFramesToReverse is a number indicating how many frames to go back. This script will not go back beyond the first frame of any movieclip.

Note that this script uses the enterFrame clip event because it will automatically match the frame rate of the movie. This gives the effect of playing the movieclip backwards at the same frame rate. This script does not allow for reversing at increased speeds (not yet anyway).

Also note that if you call this on the last frame of your movieclip you will have to put a stop() action before it, to ensure the movieclip doesn’t loop before the reverse begins…

You could use the setInterval action to control the speed at which the MovieClip plays.
[AS]MovieClip.prototype.backUp = function(FPS, frames) {
var prev, init, frame;
prev = function (mc) {
if (frame++<frames) mc.prevFrame();
else clearInterval(init);
};
init = setInterval(prev, 1000/FPS, this);
};
//
timelineToReverse.backUp(framesPerSecond, howManyFrames);[/AS]
… Why are we posting this in Flash 5? :stuck_out_tongue:

[QUOTE]*Originally posted by telekinesis *

Movieclip.prototype.backUp = function(howManyFrames) { 
   this.createEmptyMovieClip('revController', 100); 
   this.revController.howMany = howManyFrames; 
   this.revController.onEnterFrame = function() { 
      if (this._parent._currentframe>1 and this.howMany>0) { 
         this._parent.gotoAndStop(this._parent._currentframe-1); 
         this.howMany--; 
      } else { 
         this.removeMovieClip(); 
      } 
   }; 
};

Then all you have to do is, on a button or keyframe, invoke the method and specify which timeline you want to reverse, and how many frames:

timelineToReverse.backUp(howManyFramesToReverse);

QUOTE]

Hey I put the code in but came up with it did not work, can you guys help me out:

http://www.mocha-pages.com/links.fla
THANKS!

It didnt work because you didnt define which timeline to play back. Instead of[AS]timelineToReverse.backUp(50);[/AS]use[AS]this.backUp(50);[/AS]

THANKS CLAUDIO!!!

welcome :thumb:

couldnt u just copy the frames and paste them in the timeline then highlight them and go to modify>frames>reverse???

;):slight_smile:

won’t that affect the file size though?

meh, probably