PDA

View Full Version : Making MovieClip go in Reverse W/constantLoop



scott1969
January 23rd, 2008, 04:58 PM
Hey Folks,

I could really use you're help on this one. I am building a site in flash that contains a number of cog movie clips. In this animation I have a lever that can shut off the cogs and make the cogs go forward and reverse. I seem to have the forward and stop functionality working, but I can't seem to get the cogs to go in reverse in a constant loop. They will only go in reverse until the beginning of the timeline. Below is the script I am using:

CODE TO STOP CLIP:

function stopClip() {

this.stop();
}

lever1_mc.onPress = function() {

cog1_mc.onEnterFrame = stopClip;
cog2_mc.onEnterFrame = stopClip;
wmncg.onEnterFrame = stopClip;
cog3_mc.onEnterFrame = stopClip;
cog4_mc.onEnterFrame = stopClip;
cog5_mc.onEnterFrame = stopClip;
cog6_mc.onEnterFrame = stopClip;
cnvyr .onEnterFrame = stopClip;
logo.onEnterFrame = stopClip;
balls.onEnterFrame = stopClip;
chn.onEnterFrame = stopClip;
swish_mc.onEnterFrame = stopClip;
gotoAndStop(2);

};


CODE TO REVERSE CLIP:


function rewindClip() {

this.prevFrame();

if (this._currentframe == 1) { delete this.onEnterFrame;
}
for(var i:Number =0; i < 20; i++)
{

this.rotation.prevFrame();
}
}

rewind_bttn.onPress = function() {

cog1_mc.onEnterFrame = rewindClip;
cog2_mc.onEnterFrame = rewindClip;
wmncg.onEnterFrame = rewindClip;
cog3_mc.onEnterFrame = rewindClip;
cog4_mc.onEnterFrame = rewindClip;
cog5_mc.onEnterFrame = rewindClip;
cog6_mc.onEnterFrame = rewindClip;
cnvyr .onEnterFrame = rewindClip;
logo.onEnterFrame = rewindClip;
chn.onEnterFrame = rewindClip;
balls.onEnterFrame = rewindClip;
swish_mc.onEnterFrame = rewindClip;
gotoAndStop(5);

};

Dazzer
January 24th, 2008, 01:15 AM
AS2.

Rigwall
January 24th, 2008, 04:27 AM
Hi Scott
Maybe u should alter the following part of ur script by *NOT* deleting the onEnterFrame... instead set the movie clip to go to its *last* frame if it reaches the FIRST frame.


if (this._currentframe == 1) {
delete this.onEnterFrame; //--> instead of this, send the movie clip to its last frame
}

scott1969
January 25th, 2008, 01:17 PM
Hi Scott
Maybe u should alter the following part of ur script by *NOT* deleting the onEnterFrame... instead set the movie clip to go to its *last* frame if it reaches the FIRST frame.


Hi Rigwall,

What would the code look like?
Thanks for your help.

Scott