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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

z-index 1

Status
Not open for further replies.

TheConeHead

Programmer
Aug 14, 2002
2,106
US
I need to be able to change the layering position on the fly. Like say you have 3 squares on top off each other so you could only see the top. When someone clicks a button, the bottom one comes to the top... how would this be done?

[conehead]
 
Code:
movieClip.swapDepths([i]number[/i])

This lets you specify any number or a variable to set the depth index of a movieclip - bigger numbers appear on top. So just set the depth of the clip when the button is clicked to a higher number.

Code:
clip.onRelease=function(){
this.swapDepths(1000);
}
 
does this still work if they are in different layers since when the movie is published the layers are essentially done away with?

[conehead]
 
Yeah - 'layers' only exist in the authoring environment to make it easy to build stuff, once it's published 'depth' is all that matters.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top