# Problem with attachMovie and swapDepths

**URL:** <https://forum.kirupa.com/t/problem-with-attachmovie-and-swapdepths/262953>\
**Category:** Uncategorized\
**Created:** [June 11, 2008, 12:14pm UTC](https://forum.kirupa.com/t/problem-with-attachmovie-and-swapdepths/262953 "2008-06-11T12:14:37Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nicrose](https://avatars.discourse-cdn.com/v4/letter/n/b77776/32.png) [@nicrose](https://forum.kirupa.com/u/nicrose)\
**Post date:** [June 11, 2008, 12:14pm UTC](https://forum.kirupa.com/t/problem-with-attachmovie-and-swapdepths/262953/1 "2008-06-11T12:14:37Z")

</div>

Hi all, I’m having the weirdest problem.

```
   I am dynamically attaching a movieclip (that instantiates a class) with attachMovie. In the movieClip itself I have a script that tweens the size of the mc on rollover and rollout, and what I want to do is have it also swap the depth of the movieclip.

```

```auto

this.onRollOver = function() {
    this.swapDepths(9000);
    var Xsize:Tween = new Tween(this, "_width", Elastic.easeOut, this._width, 60, .5, true);
    var Ysize:Tween = new Tween(this, "_height", Elastic.easeOut, this._height, 60, .5, true);
}

```

```
   For some reason, the tweening fires off fine, but the swapDepths never happens. What’s weirder is that when I try to trace a getDepth on the movieClip, it comes back undefined.

   I have no idea what’s going on and would appreciate any help that you guys can offer.

   Thanks in advance!
```
