# Problem with swapDepths..WTF mate?

**URL:** <https://forum.kirupa.com/t/problem-with-swapdepths-wtf-mate/263044>\
**Category:** flash\
**Created:** [June 12, 2008, 3:42am UTC](https://forum.kirupa.com/t/problem-with-swapdepths-wtf-mate/263044 "2008-06-12T03:42:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![rondog](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/rondog/32/2478_2.png) [@rondog](https://forum.kirupa.com/u/rondog)\
**Post date:** [June 12, 2008, 3:42am UTC](https://forum.kirupa.com/t/problem-with-swapdepths-wtf-mate/263044/1 "2008-06-12T03:42:20Z")

</div>

I am making a gallery very similar to the way this file acts:

[http://flashden.net/item/strongphotostrong-stack-gallery/12483](http://flashden.net/item/strongphotostrong-stack-gallery/12483)

the problem is my images are not swapping depths!

if I trace each images depth by means of the getDepth() function, they all return -16383…wtf?? here is my code…I removed everything you dont need to see.

```auto

function loadGal(itemID)
{
    var node = xml.firstChild.childNodes[itemID];
    var galLength = node.childNodes.length;
    var depth = 7000;
    var mcl:MovieClipLoader = new MovieClipLoader();
    var mclL:Object = new Object();
    mcl.addListener(mclL);
    for (var i = 0; i < galLength; i++)
    {
        var innerNode = node.childNodes*;
        var src = innerNode.attributes.src;

        //Note: the depth++..makes sense right???

        var mc = picHolder.attachMovie("pic", "pic" + i,depth++);
        mc.id = i;
        mcl.loadClip(src,mc.picHolder2);
        mc.onRelease = function()
        {
            swapPic(this.id);
        };
    }
}

var lastImg = picHolder.pic0.picHolder2;

function swapPic(itemID)
{
    var mc = picHolder["pic" + itemID].picHolder2;
    trace(mc.getDepth()); //Returns -16383..hmmmmmm
    mc.swapDepths(lastImg);
    lastImg = mc;
}

```

any idea why its saying the depth is that retarded number and not working??:stare:
