Forward and backward

look back one page, download the zip in the 4th post (on that page)

how would u make it just go backwords on like a mouseover?

yes like a mouseover. It’s a motion tween with mutiple keyframes…I want with button that when touched to either go on to the next frame or if the frame is passed a certain number then go backwards to a specfic keyframe.

I’m really having a hard time with this because I’m not sure how to write the If statements for determaining which way to go by what frame it’s on…or the backwards scripts

I saw this site that gave me an idea for my portfolio I’m doing…It will help explain …it’s
www.sofake.com

I am not sure I understand exactly what you want.

So I am going to assume you want it to stop before it reverses, then have the clip when rolled over to play in reverse. I don’t know what you want it to do after that, but maybe this is a shove in the right direction…

_root.onEnterFrame = function() {
	if (this._currentframe == 1) {
		playMe = true;
	}
	if (this._currentframe != this._totalframes) {
		delete _root.ball.onRollOver;
	} else {
		_root.stop();
		_root.ball.onRollOver = function() {
			playMe = false;
		};
	}
	if (playMe == true) {
		this.nextFrame();
	}
	if (playMe == false) {
		this.prevFrame();
	}
};

My method involves that code be put on the first frame of your timeline. And the tween must be done to a movie clip with the instance name “ball” (no quotes, and not IN the movie clip, but TO the movie clip).

thanks lostinbeta I think that will help basicly what i’m trying to do is explain in my last post for a visual go to www.sofake.com and press buttons out of order and you’ll understand

<B>ckmoon:</B> I am pretty sure sofake uses the _xscale and _yscale properties with actionscript to make their site… not tweens. But ya never know.

<B>Arabonradar:</B>If you want the movie to start off stopped, but play when rolled over, then stop before the reverse. Then when you roll over the clip again it will play the reverse (confusing eh?) you can do something like this (please keep in mind that there are probably a billion and a half ways to optimize this, I just did this real quick)…

Follow the same rules as my last post. But use this code…

_root.ball.onRollOver = function() {
	playMe = true;
};
_root.onEnterFrame = function() {
	if (this._currentframe == 1) {
		_root.ball.onRollOver = function() {
			playMe = true;
		};
	}
	if (this._currentframe == this._totalframes) {
		this.stop();
		_root.ball.onRollOver = function() {
			playMe = false;
		};
	}
	if (playMe == true) {
		this.nextFrame();
	}
	if (playMe == false) {
		this.prevFrame();
	}
};
stop();

This… stops your movie on frame 1 with the stop(); action at the end. Then the _root.ball.onRollOver in the very beginning awaits the onRollOver of the clip on the main timeline with the instance name “ball” (no quotes) before it assigns the variable playMe to be true. The if statement at the end that says if playMe is true then play the nextframe (which when repeated acts like a play button). Then the the if statments check if it is on the last frame of the animation, and if so it stops the timeline and assigns a new rollOver action for the movie clip. It assigns the variable playMe as false, which the last if statement says that if playMe is false then play the previous frame (which played repeated creates a playback type thing).

it is very much like the code, beta, but i want 2 buttons, 1 to play forward. 1 to play backwords on mouseover. like scrolling a motion tween

There is something like that in the 2nd page of this thread.

Senocular posted it, it is an attachment called swing.zip.

swing is what im looking for basically, but i dont want the clip to start forward then go the opposite direction, or start backwords and go the opposite direction. i just want it to go one direction only for each button

Create a movieclip with the instance name ball.

INSIDE that movie clip create your tween.

Have a stop() action on Frame 1.

On the main stage create 2 movie clips, one as the back buton and one as the forward button.

On the back button movie clip add these actions…

on (rollOver) {
	this.onEnterFrame = function() {
		_root.ball.prevFrame();
	};
}
on (rollOut) {
	delete this.onEnterFrame;
}

On the forward button movie clip add these actions…

on (rollOver) {
	this.onEnterFrame = function() {
		_root.ball.nextFrame();
	};
}
on (rollOut) {
	delete this.onEnterFrame;
}

WOOHOO! Thanks so much!

No problem.

Where did h88s post go though?

He posted right before me with some nice code, then he deleted it :-\

Thought it was an off topic when i was checking your codes,

MovieClip.prototype.backward = function() {
this.gotoAndStop(this._totalframes);
this.onEnterFrame = function() {
this.gotoAndStop(this._currentframe-1);
};
};

(** Usage: **)

myClip.backward();

This whole thread is about backwards playing… there are about 4 different methods of doing it now in this one thread :wink:

There’s a navigation effect I see a lot in which you click on a button and it plays some MC. When you click on one of the other buttons, the current MC reverses out and the MC for the other button animates in, and so forth.

A good example is the navigation in http://fontsforflash.com

I’m sure the MCs are playing in an emptyMovieClip, but how do you code the buttons to reverse the current MC and play the new one?

Any thoughts are appreciated.

JCS

I believe that is a different method that this one. Probably main tweens that are triggered to play through variables of some sort.

Here’s an example. And now I gotta go. =)

nice clean code kax :slight_smile:

For something that took 5 minutes it’s not that bad… :wink:

Seriously, coming from one of the few people I actually like his work… it’s really appreciated. Thanks, lost. =)

Well I learn a lot from you, and I appreciate that. This menu thing is one thing I learned from you :slight_smile: