PDA

View Full Version : Reverse Motion Tween?


xNicolex8
04-04-2011, 04:34 PM
Hi, iv been trying to find out how i can reverse a motion tween..

So for my site you click next and its slides from right to left,, then for the back button i just wanted it to go back.. (i know i can do it the long way by doing seperate tweens for it to go back)
but iv got loads of them to do and very little time so i was hoping i could try found out if this way is possible first.

Iv tried searching, some people have said it's impossible but some have said its not, if you tell it to go backwards until its on a certain frame

i saw a thread about it on this forum and someone posted this code:

on (rollOver) {
playBW = true;
}
on (rollOut) {
playBW = false;
}
onClipEvent (enterFrame) {
if (playBW) {
// if the variable playBW is true
gotoAndStop (prevFrame ());
}
}

but on the "onClipEvent" line it says "Clip events are permitted only for movie clip instances"

i'v been puttin on my action script on the buttons, have i just done something wrong?
Sorry not too good with flash :/


Thankyouu

xNicolex8
04-04-2011, 04:47 PM
i also found this code:


on (press) {
while (_root._currentFrame > 2) {
_root.gotoAndStop (_root._currentFrame-1);
}
}

but it also doesn't seem to be working unless again i'm just stupid and have done it wrong.. i assumed for the "2" i would but the current frame it was on and the "1" the frame i wanted it to go to?
=S

Noct
04-05-2011, 02:39 PM
You can't place a clip event on a button, it's a method of MovieClips. It's one of the many reasons why most of us avoid using button symbols. They are nothing but a headache.

Playing the timeline backwards is a pretty simple affair, you just declare an onEnterFrame method that pushes to the prevFrame on each iteration.

on (press) {
//Apply method to clip you wish to control
animMc.onEnterFrame = function():Void {
//If the timeline is past frame 1
if (this._currentframe>1) {
//go back a frame
this.prevFrame();
} else {
//Else at frame 1, stop
this.stop();
delete this.onEnterFrame;
}
};
}