# swapDepth problem

**URL:** <https://forum.kirupa.com/t/swapdepth-problem/70657>\
**Category:** flash\
**Created:** [November 16, 2004, 7:19am UTC](https://forum.kirupa.com/t/swapdepth-problem/70657 "2004-11-16T07:19:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lockinsky](https://avatars.discourse-cdn.com/v4/letter/l/71e660/32.png) [@Lockinsky](https://forum.kirupa.com/u/Lockinsky)\
**Post date:** [November 16, 2004, 7:19am UTC](https://forum.kirupa.com/t/swapdepth-problem/70657/1 "2004-11-16T07:19:18Z")

</div>

Hi All,  
In my script I can set depths by using

MC.swapDepths = (n);

This works ok when I use a number for n, but I want to set n by using a variable that is set randomly in the same code block - actually it sets the size of the MC. What I have is a bunch of MCs that move randomly in x and y and I am trying to simulate z movement by resizing the MCs. Obviously the smaller ones should be behind the bigger ones , but this doesn’t work:  
mc1.\_x = random(500);  
mc1.\_y = random(500);  
perspective1 = random(500);  
mc1.\_width =perspective1;  
mc1.\_height = perspective1;  
mc1.swapDepths = perspective1;

Width and height work ok, but not swapDepths. Any ideas?
