# Forward and backward

**URL:** <https://forum.kirupa.com/t/forward-and-backward/10207>\
**Category:** Uncategorized\
**Created:** [December 27, 2002, 1:01am UTC](https://forum.kirupa.com/t/forward-and-backward/10207 "2002-12-27T01:01:48Z")\
**Posts on this page:** 20\
**Page:** 2

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 6:44pm UTC](https://forum.kirupa.com/t/forward-and-backward/10207/21 "2003-01-15T18:44:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 7:26pm UTC](https://forum.kirupa.com/t/forward-and-backward/10207/22 "2003-01-15T19:26:38Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 8:12pm UTC](https://forum.kirupa.com/t/forward-and-backward/10207/23 "2003-01-15T20:12:29Z")

</div>

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](http://www.sofake.com)

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 8:14pm UTC](https://forum.kirupa.com/t/forward-and-backward/10207/24 "2003-01-15T20:14:10Z")

</div>

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…

```auto
_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).

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 8:30pm UTC](https://forum.kirupa.com/t/forward-and-backward/10207/25 "2003-01-15T20:30:32Z")

</div>

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](http://www.sofake.com) and press buttons out of order and you’ll understand

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 8:36pm UTC](https://forum.kirupa.com/t/forward-and-backward/10207/26 "2003-01-15T20:36:57Z")

</div>

\<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…

```auto
_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).

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 10:49pm UTC](https://forum.kirupa.com/t/forward-and-backward/10207/27 "2003-01-15T22:49:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 10:55pm UTC](https://forum.kirupa.com/t/forward-and-backward/10207/28 "2003-01-15T22:55:00Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 11:09pm UTC](https://forum.kirupa.com/t/forward-and-backward/10207/29 "2003-01-15T23:09:14Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 11:16pm UTC](https://forum.kirupa.com/t/forward-and-backward/10207/30 "2003-01-15T23:16:09Z")

</div>

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…

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

```

On the forward button movie clip add these actions…

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

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 11:28pm UTC](https://forum.kirupa.com/t/forward-and-backward/10207/31 "2003-01-15T23:28:23Z")

</div>

WOOHOO! Thanks so much!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 11:30pm UTC](https://forum.kirupa.com/t/forward-and-backward/10207/32 "2003-01-15T23:30:10Z")

</div>

No problem.

Where did h88s post go though?

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 11:32pm UTC](https://forum.kirupa.com/t/forward-and-backward/10207/33 "2003-01-15T23:32:38Z")

</div>

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();

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [January 15, 2003, 11:36pm UTC](https://forum.kirupa.com/t/forward-and-backward/10207/34 "2003-01-15T23:36:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 17, 2003, 3:23pm UTC](https://forum.kirupa.com/t/forward-and-backward/10207/35 "2003-02-17T15:23:00Z")

</div>

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](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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 17, 2003, 8:10pm UTC](https://forum.kirupa.com/t/forward-and-backward/10207/36 "2003-02-17T20:10:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 18, 2003, 12:29am UTC](https://forum.kirupa.com/t/forward-and-backward/10207/37 "2003-02-18T00:29:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 18, 2003, 3:42am UTC](https://forum.kirupa.com/t/forward-and-backward/10207/38 "2003-02-18T03:42:25Z")

</div>

nice clean code kax 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 18, 2003, 3:50am UTC](https://forum.kirupa.com/t/forward-and-backward/10207/39 "2003-02-18T03:50:32Z")

</div>

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

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

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 18, 2003, 4:00am UTC](https://forum.kirupa.com/t/forward-and-backward/10207/40 "2003-02-18T04:00:58Z")

</div>

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

[Previous page](https://forum.kirupa.com/t/forward-and-backward/10207.md?page=1)

[Next page](https://forum.kirupa.com/t/forward-and-backward/10207.md?page=3)
