# Bring\_forward

**URL:** <https://forum.kirupa.com/t/bring-forward/33736>\
**Category:** flash\
**Created:** [October 22, 2003, 10:33pm UTC](https://forum.kirupa.com/t/bring-forward/33736 "2003-10-22T22:33:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![swift7777](https://avatars.discourse-cdn.com/v4/letter/s/87869e/32.png) [@swift7777](https://forum.kirupa.com/u/swift7777)\
**Post date:** [October 22, 2003, 10:33pm UTC](https://forum.kirupa.com/t/bring-forward/33736/1 "2003-10-22T22:33:25Z")

</div>

Quick question on bringing forward elements using actionscript,  
basically I have 5 buttons and on the rollover state they have a large graphic that overlaps, the problem is once placed on the stage, because the buttons are so close together the graphic disappears behind other buttons.

Is there a bit of script that will tell a button on the stage to come to the front when a user roll’s over it.

thanx 4 any help.

swift.:panda:

---

<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:** [October 22, 2003, 10:37pm UTC](https://forum.kirupa.com/t/bring-forward/33736/2 "2003-10-22T22:37:26Z")

</div>

look up “swap depth”

---

<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:** [October 23, 2003, 12:05pm UTC](https://forum.kirupa.com/t/bring-forward/33736/3 "2003-10-23T12:05:35Z")

</div>

Thanx 4 reply,

I’ve been checking out the swap depth info but its all for movieClips as apposed to buttons, I thing you can define a movieClip prototype to tell a button to act as a movieClip and swapDepths that way.

What I have got so far is

// Get Function function getDepth() { return this.getDepth(); }  
// Set Function

Button.prototype.swapDepths =MovieClip.prototype.swapDepths;  
function setDepth(nr) {  
swapDepths.call(this, nr);  
}

// Addpropery  
Object.prototype.addProperty("\_Depth", getDepth,this.setDepth);

// Set

logo.\_Depth = 50;  
printy.\_Depth = 40;  
paint.\_Depth = 30;  
design.\_Depth = 20;  
photo.\_Depth = 10;

// Get

trace(logo.\_Depth);  
trace(printy.\_Depth);  
trace(paint.\_Depth);  
trace(design.\_Depth);  
trace(photo.\_Depth);

I just need some code for the button, to make it swapDepths on rollover and rolloff.

Thanx in advance for any help.

swift.

:flower: :flower: :flower: :flower: :skull:

---

<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:** [October 23, 2003, 12:10pm UTC](https://forum.kirupa.com/t/bring-forward/33736/4 "2003-10-23T12:10:59Z")

</div>

You making it very complicated.  
myButt.swapDepths(20);  
myButt.onRollOver = function(){  
myPath.myGraphic.swapDepths(200);  
}  
myButt.onRollOut = function(){  
myPath.myGraphic.swapDepths(19);  
}

SHO
