# Reverse play

**URL:** <https://forum.kirupa.com/t/reverse-play/96519>\
**Category:** Uncategorized\
**Created:** [December 10, 2003, 12:38pm UTC](https://forum.kirupa.com/t/reverse-play/96519 "2003-12-10T12:38:07Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ms\_L](https://avatars.discourse-cdn.com/v4/letter/m/e480ec/32.png) [@Ms\_L](https://forum.kirupa.com/u/Ms_L)\
**Post date:** [December 10, 2003, 12:38pm UTC](https://forum.kirupa.com/t/reverse-play/96519/1 "2003-12-10T12:38:07Z")

</div>

how do i make the timeline play back and forth as well as in a loop?

Leanne:sigh:

---

<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:** [December 10, 2003, 1:04pm UTC](https://forum.kirupa.com/t/reverse-play/96519/2 "2003-12-10T13:04:16Z")

</div>

ya need to do it with a bit of code:

in the first frame:

```auto

if(!Check) {
          Check = true;
          this.onEnterFrame = function() {
                    if(Reverse) {
                              this.prevFrame();
                    }else {
                              this.nextFrame();
                    }
                    if(this._currentframe == 1) {
                              Reverse = false;
                    }
                    if(this._currentframe == this._totalframes) {
                              Reverse = true;
                    }
          }
}

```

---

<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:** [December 10, 2003, 1:05pm UTC](https://forum.kirupa.com/t/reverse-play/96519/3 "2003-12-10T13:05:52Z")

</div>

I have an idea for this. Take the bunch of frames you have;copy them, paste them infront of your other frames,highlight the newly pasted frames and right click, then select:Reverse Frames. And the on the last frame of the whole movie put in the  
gotoandplay(w/e) script to make it go back to the desired frame.

If you need any help, ask.

---

<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:** [December 10, 2003, 1:08pm UTC](https://forum.kirupa.com/t/reverse-play/96519/4 "2003-12-10T13:08:47Z")

</div>

```auto

movieclip.d = 1;
movieclip.stop();
movieclip.onEnterFrame = function() {
	this.d ? this.nextFrame() : this.prevFrame();
	if (this._currentframe == this._totalframes) {
		this._currentframe = this._totalframes-1;
		this.d = 0;
	}
	if (this._currentframe == 1) {
		this._currentframe = 2;
		this.d = 1;
	}
};

```

---

<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:** [December 10, 2003, 1:22pm UTC](https://forum.kirupa.com/t/reverse-play/96519/5 "2003-12-10T13:22:49Z")

</div>

Dear m\_andrews808,

Code is cool. I am using this for my preloader, however when i typed your code in it runs thru the entire .swf.

How do i do it so it only runs back and forth on preloader only?

Leanne X

---

<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:** [December 10, 2003, 1:34pm UTC](https://forum.kirupa.com/t/reverse-play/96519/6 "2003-12-10T13:34:38Z")

</div>

you need to hard code a start frame and end frame where the movie will loop through:

```auto

if(!Check) {
        Check = true;
        this.onEnterFrame = function() {
                if(Reverse) {
                        this.prevFrame();
                }
                if(!Reverse) {
                        this.nextFrame();
                }
                if(this._currentframe == 5) {
                        Reverse = false;
                }
                if(this._currentframe == 10) {
                        Reverse = true;
                }
        }
}

```

the above code for example will play back and fourth between frames 5 and 10. You’ll also need to tell the code to stop when the movie has finished loading. I’ve amended the above code to allow this, when the movie finishes loading you’ll need to add something like:

Reverse = “stopped”;

let me know how you get on

---

<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:** [December 10, 2003, 2:21pm UTC](https://forum.kirupa.com/t/reverse-play/96519/7 "2003-12-10T14:21:56Z")

</div>

do i place ifFrameloaded etc before or after this code ?

On same frame or on another layer?

---

<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:** [December 10, 2003, 2:44pm UTC](https://forum.kirupa.com/t/reverse-play/96519/8 "2003-12-10T14:44:37Z")

</div>

you can put  
[AS]  
if (\_root.getBytesTotal() = \_root.getBytesLoaded()) {  
delete this.onEnterFrame;  
}[/AS]  
at the end of the code (before the last two brackets 😉 )

---

<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:** [December 10, 2003, 2:51pm UTC](https://forum.kirupa.com/t/reverse-play/96519/9 "2003-12-10T14:51:29Z")

</div>

sweet! never knew you could delete clip events like that, thats made my day (sad I know)

put Phat’s code anywhere inside the this.onEnterFrame = function() block, you might want to add a gotoAndStop() or somthing too. If you want specifics, it’ll be quicker and easier if you post the fla

(-:

---

<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:** [December 10, 2003, 2:55pm UTC](https://forum.kirupa.com/t/reverse-play/96519/10 "2003-12-10T14:55:21Z")

</div>

> \*Originally posted by m\_andrews808 \*  
> \*\*sweet! never knew you could delete clip events like that, thats made my day (sad I know)  
> (-: \*\*

I know how it feels 🙂 I was the happiest person on earth when I found out about [COLOR=darkblue][FONT=courier new]\_currentframe[/FONT][/COLOR] :}

---

<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:** [December 10, 2003, 3:10pm UTC](https://forum.kirupa.com/t/reverse-play/96519/11 "2003-12-10T15:10:11Z")

</div>

ok i have posted the .fla as this is a bit confusing as i still dont know where ifFrameloaded goes, or maybe the code your talking about does it too.

---

<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:** [December 10, 2003, 3:12pm UTC](https://forum.kirupa.com/t/reverse-play/96519/12 "2003-12-10T15:12:00Z")

</div>

i cant seem to be able to post it. There is no browse function this end to attach my file.

?

---

<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:** [December 10, 2003, 3:17pm UTC](https://forum.kirupa.com/t/reverse-play/96519/13 "2003-12-10T15:17:24Z")

</div>

are you replying through quick reply or through “post reply 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:** [December 10, 2003, 3:54pm UTC](https://forum.kirupa.com/t/reverse-play/96519/14 "2003-12-10T15:54:37Z")

</div>

THANK YOU

HERE IT IS

---

<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:** [December 10, 2003, 3:54pm UTC](https://forum.kirupa.com/t/reverse-play/96519/15 "2003-12-10T15:54:37Z")

</div>

THANK YOU

HERE IT IS

---

<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:** [December 10, 2003, 3:54pm UTC](https://forum.kirupa.com/t/reverse-play/96519/16 "2003-12-10T15:54:37Z")

</div>

THANK YOU

HERE IT IS

---

<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:** [December 10, 2003, 3:54pm UTC](https://forum.kirupa.com/t/reverse-play/96519/17 "2003-12-10T15:54:37Z")

</div>

THANK YOU

HERE IT IS

---

<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:** [December 10, 2003, 3:55pm UTC](https://forum.kirupa.com/t/reverse-play/96519/18 "2003-12-10T15:55:18Z")

</div>

wow, your enthusiastic! :P:P

---

<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:** [December 10, 2003, 4:18pm UTC](https://forum.kirupa.com/t/reverse-play/96519/19 "2003-12-10T16:18:32Z")

</div>

okay I’ve had a look at your fla, and this is what I’ve come up with. Say your movie started on frame 80:

```auto

if (!Check) {
	Check = true;
	this.onEnterFrame = function() {
		if (Reverse) {
			this.prevFrame();
		}
		if (!Reverse) {
			this.nextFrame();
		}
		if (this._currentframe == 1) {
			Reverse = false;
		}
		if (this._currentframe == 75) {
			Reverse = true;
		}
		if(this.getBytesLoaded() == this.getBytesTotal()) {
			gotoAndStop(80);
			delete this.onEnterFrame;
		}
	}
}

```

should do the job for you. Of course you need to alter the gotoAndStop command to suit your needs
