# \[HELP!\] Swapdepths with an External MC

**URL:** <https://forum.kirupa.com/t/help-swapdepths-with-an-external-mc/307455>\
**Category:** flash\
**Created:** [April 3, 2010, 6:18pm UTC](https://forum.kirupa.com/t/help-swapdepths-with-an-external-mc/307455 "2010-04-03T18:18:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![anticlimacus](https://avatars.discourse-cdn.com/v4/letter/a/ce73a5/32.png) [@anticlimacus](https://forum.kirupa.com/u/anticlimacus)\
**Post date:** [April 3, 2010, 6:18pm UTC](https://forum.kirupa.com/t/help-swapdepths-with-an-external-mc/307455/1 "2010-04-03T18:18:46Z")

</div>

I currently have a player mc, and a background mc. The player is surrounded by 4 rectangles that on hit move background mc (therefore creating a scrolling map).

background mc is a compilation of smaller mc’s. I want to individually set swapdepths for these smaller mc’s using the code below. However this doesn’t seem to work and my player just walks over the background.

```auto
onClipEvent (enterFrame) {
if (this.hitTest (_root.player)) {
this.swapDepths (this_x + this._y+64);
}
}

onClipEvent (load) {
this.swapDepths (this_x + this._y+64);
}

```

I’m assuming the swap depths isn’t working because these MC’s are contained in one MC Background. But I can’t scroll the map without them being in a container MC (unless I want to individually reference every smaller mc to move).

Any insight or suggestion would be fantastic.
