# Scripted Transitions

**URL:** <https://forum.kirupa.com/t/scripted-transitions/43046>\
**Category:** Uncategorized\
**Created:** [February 18, 2004, 9:13am UTC](https://forum.kirupa.com/t/scripted-transitions/43046 "2004-02-18T09:13:17Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sceleratus](https://avatars.discourse-cdn.com/v4/letter/s/e19b73/32.png) [@Sceleratus](https://forum.kirupa.com/u/Sceleratus)\
**Post date:** [February 18, 2004, 9:13am UTC](https://forum.kirupa.com/t/scripted-transitions/43046/1 "2004-02-18T09:13:17Z")

</div>

I want to use 5 buttons. and a content mc !

When page loads mc1 also loads containing some tweens.

When I click a button mc1 plays backwards,  
When finished playing backwards the mc associated with the button clicked loads In the same content mc as  
mc1 was loaded before, also with tweens.

If another button is clicked mc2 plays backwards. And the  
new mc loads associated with the button clicked, also in the same content mc.

And so on…

Do you get the idea.

How would I set up something like this ?

/Erik

---

<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, 2004, 11:17am UTC](https://forum.kirupa.com/t/scripted-transitions/43046/2 "2004-02-18T11:17:15Z")

</div>

If you are using timeline tweens, you just have to make each swf so that the first half of the timeline plays forwards, then reverse the tweens in the second half of the timeline so it looks backwards.

Actionscript can’t really talk to the timeline except for frame labels and frame numbers.

Perhaps you could try a generic action on the last frame of each movie clip. Your main timeline buttons assign the specific values so that the generic action becomes specific and loads the new movie.

Have a look at this to get some ideas:  
[http://www.kirupa.com/developer/mx/preloader\_transition.htm](http://www.kirupa.com/developer/mx/preloader_transition.htm)

---

<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, 2004, 2:55pm UTC](https://forum.kirupa.com/t/scripted-transitions/43046/3 "2004-02-18T14:55:37Z")

</div>

Here’s a thread that can help you: [http://www.kirupaforum.com/forums/showthread.php?s=&threadid=39101](http://www.kirupaforum.com/forums/showthread.php?s=&threadid=39101)

---

<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, 2004, 3:44pm UTC](https://forum.kirupa.com/t/scripted-transitions/43046/4 "2004-02-18T15:44:33Z")

</div>

Nice code Voets ! Impressive stuff !

This one should be in Best of…

Just one question, since Im a bad coder !

Is there a way to take advantage of the  
Prevframe command. Lets say I dont want to make  
a outro animation in the swf’s. I just want to use a intro  
animation and play it backwards for outro ?

/Erik

---

<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, 2004, 4:24pm UTC](https://forum.kirupa.com/t/scripted-transitions/43046/5 "2004-02-18T16:24:11Z")

</div>

You could use a prototype to make the movieclip play backwards using onEnterFrame and prevFrame(), and also have it check when the movieclip is at it’s first frame. If so, you then delete the onEnterFrame handler and call the same action as there normally is at the end of the outro animation:

```auto

MovieClip.prototype.playBackwards = function(){
this.onEnterFrame = function(){
this.prevFrame();
if(this._currentframe == 1){
delete this.onEnterFrame;
_root.container.loadMovie(_root.currMovie+."swf");
}
}
}

```

And then this code on the buttons:

```auto

on (release) {
        if (_root.currMovie == undefined) {
                _root.currMovie = "work";
                _parent.container.loadMovie("work.swf");
        } else if (_root.currMovie != "work") {
                if (_parent.container._currentframe == _parent.container.midframe) {
                        _root.currMovie = "work";
                        _parent.container.playBackwards();
                }
        }
}

```

This is done real quick out of my head though, so it might need some tweaking.

---

<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, 2004, 4:30pm UTC](https://forum.kirupa.com/t/scripted-transitions/43046/6 "2004-02-18T16:30:32Z")

</div>

Thanks for you quick reply !!

I will try this as soon I’m on a faster computer with Flash !!
