all groups > flash actionscript > february 2006 >
You're in the

flash actionscript

group:

timeline.reverseFrames()


timeline.reverseFrames() klpts
2/22/2006 9:47:55 PM
flash actionscript: Hello, I am curious on how to create a button that runs this. What i want to
do, and i'm not sure this is even what i use, but i want to have a clip that
plays and there is a forward button(done) and then a reverse one that plays
that exact item backwards. I don't want to recreate it in the timline then
refrence that location with the button. Any help is appreciated, and if this is
unclear let me know.
Re: timeline.reverseFrames() kglad
2/22/2006 10:56:14 PM
the code below the dotted line adds a new method to movieclips (playF() ) that
lets you play any timeline from frame m to n at fps frames per second. to use
on movieclip mc1:

mc1.playF(m,n,fps);

for a simple play back button you can use surveyor's (or rothrock's):

_root.onEnterFrame=function(){
mc1.prevFrame();
if(mc1._currentframe==1){
delete _root.onEnterFrame;
}
}

------------------------------------------
MovieClip.prototype.playF = function(m, n, fps) {
function playF2(mc) {
if (mc.m<mc.n) {
mc.nextFrame();
} else {
mc.prevFrame();
}
if (mc._currentframe == mc.n) {
clearInterval(mc.int);
}
updateAfterEvent();
}
this.m = m;
this.n = n;
this.fps = fps;
this.gotoAndStop(this.m);
clearInterval(this.int);
this.int = setInterval(playF2, 1000/this.fps, this);
};
AddThis Social Bookmark Button