# Swapping movieclips

**URL:** <https://forum.kirupa.com/t/swapping-movieclips/188754>\
**Category:** Uncategorized\
**Created:** [May 10, 2006, 2:54pm UTC](https://forum.kirupa.com/t/swapping-movieclips/188754 "2006-05-10T14:54:49Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![listarella](https://avatars.discourse-cdn.com/v4/letter/l/6de8d8/32.png) [@listarella](https://forum.kirupa.com/u/listarella)\
**Post date:** [May 10, 2006, 2:54pm UTC](https://forum.kirupa.com/t/swapping-movieclips/188754/1 "2006-05-10T14:54:49Z")

</div>

Hì u all,  
I can’t figure out how to solve this problem:  
I have 4 mc on the stage (mc1,mc2…), each mc has a mc inside (in\_mc1,in\_mc2…) that onPress have to bring the respective mc on the front.

in the first frame I have  
i=20;

in the first frame of each mc I have  
in\_mc.onPress=function(){  
\_root.mc.swapdepths(i++);  
}

this code brings the pressed mc on the top of the others, but if I have on top mc1, then mc2 and then mc3 and I press mc2 p.e happens that mc2 is on top but mc3 is over mc1. why???

please help!!!
