# Need some help with transitions

**URL:** <https://forum.kirupa.com/t/need-some-help-with-transitions/56810>\
**Category:** flash\
**Created:** [July 7, 2004, 10:05pm UTC](https://forum.kirupa.com/t/need-some-help-with-transitions/56810 "2004-07-07T22:05:06Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![FlashPlaya](https://avatars.discourse-cdn.com/v4/letter/f/e274bd/32.png) [@FlashPlaya](https://forum.kirupa.com/u/FlashPlaya)\
**Post date:** [July 7, 2004, 10:05pm UTC](https://forum.kirupa.com/t/need-some-help-with-transitions/56810/1 "2004-07-07T22:05:06Z")

</div>

Hello I am trying to build a transition just like [this](http://www.barbarajacobsdesign.com/) I kinda got working but I need some pros to help me out I had it working with these actions: I load the first swf:

1. container1.loadMovie(“section1.swf”);

Then my button actions should be:

on (release) {  
container1.loadMovie(“section1.swf”);  
container1.swapDepths(1);  
}

on (release) {  
container2.loadMovie(“section2.swf”);  
container2.swapDepths(1);  
}

on (release) {  
container3.loadMovie(“section3.swf”);  
container3.swapDepths(1);  
}

and so on…

The strange things happen because when I set a mc to a new Depth, the previous mc goes back to its original stacking order which may be under another mc, so it works only in one direction

so now I am trying this:  
which=1

on (release) {  
this[“container”+which].loadMovie(“section1.swf”);  
this[“container”+which].swapDepths(1);  
if (which == 1) {  
which = 2;  
} else {  
which = 1;  
}  
}  
I hope this make sense. Here is my new file sorry about the sloppy 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:** [July 7, 2004, 10:06pm UTC](https://forum.kirupa.com/t/need-some-help-with-transitions/56810/2 "2004-07-07T22:06:25Z")

</div>

Do you just want to replace the previous swf with the new one?

---

<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:** [July 7, 2004, 10:10pm UTC](https://forum.kirupa.com/t/need-some-help-with-transitions/56810/3 "2004-07-07T22:10:04Z")

</div>

Yeah but I want to have it mask over the last clip. So it loads over the prev clip.

Thanks

---

<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:** [July 7, 2004, 10:17pm UTC](https://forum.kirupa.com/t/need-some-help-with-transitions/56810/4 "2004-07-07T22:17:25Z")

</div>

untested, but I would imagine you could declare a variable “i” as 1, and then use this on your buttons:

on (release) {  
i++  
container1.loadMovie(“section1.swf”);  
container1.swapDepths(i);  
}

---

<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:** [July 7, 2004, 10:21pm UTC](https://forum.kirupa.com/t/need-some-help-with-transitions/56810/5 "2004-07-07T22:21:27Z")

</div>

Thanks Adam14,

I am moron, how do you set the var i as 1, and where do I put it? lol

Thanks

---

<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:** [July 7, 2004, 10:23pm UTC](https://forum.kirupa.com/t/need-some-help-with-transitions/56810/6 "2004-07-07T22:23:00Z")

</div>

in your first frame put this:

i=1

that decalres the variable “i” as “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:** [July 7, 2004, 10:34pm UTC](https://forum.kirupa.com/t/need-some-help-with-transitions/56810/7 "2004-07-07T22:34:37Z")

</div>

Ok I tried that and it so close:) But when you go out of order some happens wiith stack?

Take a look

---

<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:** [July 8, 2004, 11:08am UTC](https://forum.kirupa.com/t/need-some-help-with-transitions/56810/8 "2004-07-08T11:08:54Z")

</div>

I think you want something like this, code is commented:)

scotty(-:

---

<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:** [July 8, 2004, 5:40pm UTC](https://forum.kirupa.com/t/need-some-help-with-transitions/56810/9 "2004-07-08T17:40:37Z")

</div>

SCOTTY, YOU ARE THE BEST!!! PERFECT ONCE AGAIN!!! thanks so much for taking time out for me.

---

<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:** [July 8, 2004, 6:00pm UTC](https://forum.kirupa.com/t/need-some-help-with-transitions/56810/10 "2004-07-08T18:00:29Z")

</div>

You’re welcome=)

---

<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:** [July 9, 2004, 5:19am UTC](https://forum.kirupa.com/t/need-some-help-with-transitions/56810/11 "2004-07-09T05:19:17Z")

</div>

Hey Scotty,

Sorry I have one more prob that I have trying to figure out. I have the buttons over the swfs, but when I do this the swfs load over the buttons. Is there a way to have the buttons over the swfs that are being loaded?

It is weird cause they should just be loading in the clips on the layers right? It is not jumping to another level?

Thanks

---

<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:** [July 9, 2004, 7:37am UTC](https://forum.kirupa.com/t/need-some-help-with-transitions/56810/12 "2004-07-09T07:37:32Z")

</div>

> [@Playapierce](#):
>
> …It is weird cause they should just be loading in the clips on the layers right? It is not jumping to another level?

The layers in your movie are timeline depths, flash uses -16384 to 0 for them. As soon as use swapDepths, the original stacking order is overwritten. Read senocular’s tut on it:

> **[kirupa.com - Depths in Flash](https://www.kirupa.com/developer/actionscript/depths2.htm)**
>
> Find out more about how Flash vertically arranged objects on screen.

What you can do is put the buttons in a mc (beware of your paths;)) and swap this one with the holder clips, something like:

```auto
allTheButtons_mc.swapDepths(i+1);

```

scotty(-:

---

<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:** [July 9, 2004, 5:14pm UTC](https://forum.kirupa.com/t/need-some-help-with-transitions/56810/13 "2004-07-09T17:14:56Z")

</div>

Thanks Scotty,

I looked at the tut. I am kinda getting it:) But still unclear about the where I put those actions. I really appreciate all your help with this!! I it so close lol…

:h:  
var i = 1;  
bt1.gotoAndStop(3);  
holder1.loadMovie(“holder1.swf”);

//I’ve made a loop so you have all the code at one place, I think you get a better oversight  
//I removed the buttons from the “bt” mc’s.  
for (i=1; i\<=5; i++) {  
//to shorten things a bit  
btn = this[“bt”+i];  
//give each button it’s own id  
btn.i = i;  
//on roll over  
btn.onRollOver = function() {  
this.gotoAndStop(2);  
};  
//on roll out  
btn.onRollOut = function() {  
this.gotoAndStop(1);  
};  
//on release  
btn.onRelease = function() {  
//increase i with 5, so you’re sure there’s nothing in that depth  
i += 5;  
//here the id is handy (this.i)  
//because you’re in the bt mc, this.\_parent refers to level0;-))  
this.\_parent[“holder”+this.i].loadMovie(“holder”+this.i+".swf");  
//the holder is swapped 5 “places” so allways on top  
this.\_parent[“holder”+this.i].swapDepths(i);  
//call function setButtons  
setButtons(this.i);  
};  
}  
function setButtons(k) {  
for (j=1; j\<=5; j++) {  
//if the button pressed is not this button  
if (j != k) {  
this[“bt”+j].gotoAndStop(1);  
this[“bt”+j].enabled = 1;  
} else {  
//if the button is pressed is this button  
this[“bt”+j].gotoAndStop(3);  
this[“bt”+j].enabled = 0;  
}  
}  
}

Thanks Scotty!!!

---

<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:** [July 9, 2004, 6:11pm UTC](https://forum.kirupa.com/t/need-some-help-with-transitions/56810/14 "2004-07-09T18:11:16Z")

</div>

This is what I had in mind. Select all your buttons and make them a movieclip with the instancename “nav”.  
Change your code in this:

```auto
var i = 1;
nav.bt1.gotoAndStop(3);//changed the path
holder1.loadMovie("holder1.swf");
for (i=1; i<=5; i++) {
	btn = this.nav["bt"+i];
	btn.i = i;
	btn.onRollOver = function() {
		this.gotoAndStop(2);
	};
	btn.onRollOut = function() {
		this.gotoAndStop(1);
	};
	btn.onRelease = function() {
		i += 5;
		//changed the path for the next two lines
		this._parent._parent["holder"+this.i].loadMovie("holder"+this.i+".swf");
		this._parent._parent["holder"+this.i].swapDepths(i);
		this._parent.swapDepths(i+1);//added this line
		setButtons(this.i);
	};
}
function setButtons(k) {
	//changed the path (nav)
	for (j=1; j<=5; j++) {
		if (j != k) {
			this.nav["bt"+j].gotoAndStop(1);
			this.nav["bt"+j].enabled = 1;
		} else {
			this.nav["bt"+j].gotoAndStop(3);
			this.nav["bt"+j].enabled = 0;
		}
	}
}

```

I didn’t test it, if it doesn’t work, post your fla;)

scotty(-:

---

<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:** [July 9, 2004, 6:25pm UTC](https://forum.kirupa.com/t/need-some-help-with-transitions/56810/15 "2004-07-09T18:25:01Z")

</div>

Man O Man you are good!!🙂 Thanks for all you help on this, and getting back to help me so fast.

Are you on a Mac?

---

<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:** [July 9, 2004, 6:31pm UTC](https://forum.kirupa.com/t/need-some-help-with-transitions/56810/16 "2004-07-09T18:31:13Z")

</div>

No problem, glad I could help:)  
And yep, it’s me and Maccie;)

scotty(-:
