Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

stacking order of movie clips 2

Status
Not open for further replies.

sarak

Programmer
May 3, 2001
25
US
My question is about the stacking order of movie clips. I have ButtonA inside MovieClipA. Is it possible to assign an action to ButtonA that brings MovieClipA to the front if it's under, say, MovieClipB? Thanks in advance for any tips!
 
Yes, use the swapDepths action. For example...

this.swapDepths(1000);

should bring your clip to the front of the stack.
 
Sure: it's a big number! LOL

The reason I went for it was just because it was almost certain to be a higher level than anything else in Sarak's movie. To be honest "5" would probably have done it but I wanted to be sure that we got the right result.

To keep things easy to follow in my own scripts I put the clip that I always want on top at depth 1000 within the onClipEvent(load), this is especially useful in games with a lot of duplicated elements flying around.

 
Thanks for the explanation, wangbar!

Do you also know a way to make sure it always is on the top of the stack. I'll try to explain what I mean.
I'm making a website where everytime a user clicks a button,a different window opens (read:a different movie is being loaded). The user can leave the window open or close it. If he leaves it open and clicks another button, a new window should open on top of the stack. Thereby creating cascading windows. Since I don't know in which order the buttons are going to be clicked, I don't know on which level to open the new window. Also, If different windows are open, the users should be able to click a window which is in the background thereby moving it to the front. (kinda like when you open different pictures at the same time in photoshop)


regards, goaganesha
 
I'd create a variable called "top" set to a high number. Whatever button is clicked, have it trigger this action:

this.swapDepths(top);

The clip will assume that level and will swap depths with the clip that was already there so your current clip will always go to the top and the clip that was last at the top will go to the depth that the current clip was on.

Confusing when it's written down but easy to do.
 
Check these:


Regards,
wink4.gif
ldnewbie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top