# How to play MC backward when it's on end?

**URL:** https://forum.kirupa.com/t/how-to-play-mc-backward-when-its-on-end/61561
**Category:** flash
**Created:** [August 19, 2004, 4:23pm UTC](https://forum.kirupa.com/t/how-to-play-mc-backward-when-its-on-end/61561 "2004-08-19T16:23:58Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![DaveS](https://avatars.discourse-cdn.com/v4/letter/d/848f3c/32.png) [@DaveS](https://forum.kirupa.com/u/DaveS)
#### Post date: [August 19, 2004, 4:23pm UTC](https://forum.kirupa.com/t/how-to-play-mc-backward-when-its-on-end/61561/1 "2004-08-19T16:23:58Z")

</div>

Hi!

Can anyone help to solve my problem: I made a very compley shape tween and want it to play backward when it’s end, but I don’t know how. The MC must looping forward and backward.

I don’r have any idea :(. HELP!

---

<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: [August 19, 2004, 4:29pm UTC](https://forum.kirupa.com/t/how-to-play-mc-backward-when-its-on-end/61561/2 "2004-08-19T16:29:57Z")

</div>

```auto

MovieClip.prototype.playBackwards = function(){
this.onEnterFrame = function(){
this._currentframe == 1 ? this.prevFrame : delete this.onEnterFrame;
}
}
// Usage:
movieclip.playBackwards();

```

---

<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: [August 19, 2004, 4:39pm UTC](https://forum.kirupa.com/t/how-to-play-mc-backward-when-its-on-end/61561/3 "2004-08-19T16:39:36Z")

</div>

I tried, but it seems I put the code on wrong place. In \_root timeline I have only one frame, in that frame is placed MovieClip which have 43 frames. MovieClipe instance name is drevo\_mc. What put where?

---

<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: [August 19, 2004, 7:07pm UTC](https://forum.kirupa.com/t/how-to-play-mc-backward-when-its-on-end/61561/4 "2004-08-19T19:07:36Z")

</div>

What I always do is create a “scriptloop”. A movieclip with three keyframes and the following code on each frame.

Frame 1:

```auto
currentFrame = [put your total number of frames here];
stop();

```

Frame 2:

```auto
if (currentFrame != 1) {
	 _root.gotoAndStop(currentFrame - 1);
	 currentFrame -= 1;
} else {
	 gotoAndStop(1);
}

```

Frame 3:

```auto
gotoAndPlay(2);

```

Drag the scriptloop onto the stage and give it an instance name of something like “scriptloop\_rewind” and when you want the movie to go backwards, just use the actionscript:

```auto
scriptloop_rewind.gotoAndPlay(2);

```

Also, please note that the scriptloop must be in EVERY frame of the timeline and that I have assumed you’re trying to rewind the \_root timeline. It’s probably best to put the scriptloop on it’s own layer from start to finish.

---

<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: [August 19, 2004, 7:18pm UTC](https://forum.kirupa.com/t/how-to-play-mc-backward-when-its-on-end/61561/5 "2004-08-19T19:18:37Z")

</div>

I tried, but it seems I put the code on wrong place. In \_root timeline I have only one frame, in that frame is placed MovieClip which have 43 frames. MovieClipe instance name is drevo\_mc. What put where?

In your case, create a new layer in the “drevo\_mc” and drag the scriptloop detailed above into that layer. Then change the following line in frame 2:

```auto
_root.gotoAndStop(currentFrame - 1);

```

To…

```auto
_root.drevo_mc.gotoAndStop(currentFrame - 1);

```

And I guess you’ll insert the number 43 into the “currentFrame” variable in Frame 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: [August 19, 2004, 9:11pm UTC](https://forum.kirupa.com/t/how-to-play-mc-backward-when-its-on-end/61561/6 "2004-08-19T21:11:37Z")

</div>

go to the first frame in your base/root movie (the one that contains drevo\_mc) and paste V’s code, changing the instance name. It should work for you.

---

<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: [August 20, 2004, 6:51am UTC](https://forum.kirupa.com/t/how-to-play-mc-backward-when-its-on-end/61561/7 "2004-08-20T06:51:21Z")

</div>

Superb! It works! But here’s a little problem now. When movie clip rewinds, it stops. But i don’t want to do that 🙂 Is there possibility that I done somethink wrong? Thanks a LOT for your help!

---

<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: [August 20, 2004, 6:56am UTC](https://forum.kirupa.com/t/how-to-play-mc-backward-when-its-on-end/61561/8 "2004-08-20T06:56:09Z")

</div>

> [@newhopekenny](#):
>
> go to the first frame in your base/root movie (the one that contains drevo\_mc) and paste V’s code, changing the instance name. It should work for you.

I tried, but didn’t work. Don’t know why. The \*\*trundrumbalind code \*\*works.

---

<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: [August 20, 2004, 1:31pm UTC](https://forum.kirupa.com/t/how-to-play-mc-backward-when-its-on-end/61561/9 "2004-08-20T13:31:31Z")

</div>

any chance if voets or trund can put together i quick fla. Because i have spent 40 minutes trying it out but doesn’t seem to work. I assume this actionscript works for mx2004.

---

<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: [August 20, 2004, 6:16pm UTC](https://forum.kirupa.com/t/how-to-play-mc-backward-when-its-on-end/61561/10 "2004-08-20T18:16:51Z")

</div>

I’ll post you one in a few minutes mate…

---

<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: [August 20, 2004, 6:29pm UTC](https://forum.kirupa.com/t/how-to-play-mc-backward-when-its-on-end/61561/11 "2004-08-20T18:29:50Z")

</div>

OK, here’s your file. Also note that I’ve changed the line in Frame 2 of the scriptloop from:

```auto
_root.drevo_mc.gotoAndStop(currentFrame - 1);

```

To:

```auto
_root.drevo_mc.gotoAndPlay(currentFrame - 1);

```

This makes the thing loop rather than play, rewind to the beginning and just stop.

Hope this helps, just give me a shout if it’s still not clear from this…

Dave

---

<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: [August 20, 2004, 11:03pm UTC](https://forum.kirupa.com/t/how-to-play-mc-backward-when-its-on-end/61561/12 "2004-08-20T23:03:16Z")

</div>

thanks alot trund. I just didn’t know where to add the scriptloop\_rewind.gotoAndPlay(2); code. Now i know

---

<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: [August 21, 2004, 8:50am UTC](https://forum.kirupa.com/t/how-to-play-mc-backward-when-its-on-end/61561/13 "2004-08-21T08:50:27Z")

</div>

Oh, now I see! That’s work as well. I wonder why Flash haven’t got rewind function integrated. Because this thing is very usefull! Thanks for help!

---

<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: [August 21, 2004, 11:59am UTC](https://forum.kirupa.com/t/how-to-play-mc-backward-when-its-on-end/61561/14 "2004-08-21T11:59:57Z")

</div>

No problem mate
