Window Component depth issues?

Hi all,

I’ve had this problem a few times now and I’m not sure what I’m doing wrong.

I have a Flash movie that attaches a .as defined MovieClip in the first frame of the timeline.
In my MovieClip class, I attach a background image movie and a couple of buttons and whatnot - basically building a screen.

If the user clicks a certain button on the screen (the button is defined entirely in actionscript and isn’t on the flash stage at all), then I want to pop up a Window component.

In my class file, I define _win:Window; but do not instanciate it initially.

I defined the button’s onPress event inside a load listener - this is that definition.

loadListener.onLoadComplete = function(targetMovie:MovieClip):Void {
targetMovie.onPress = function() {
_parent._win = PopUpManager.createPopUp(_parent, Window, true, { title:"", closeButton:false}); for (var i in _parent) {
trace("I is " + i + " at depth " + _parent*.getDepth());
}
}
}

Now, if you look at that, all it does is say, when the button is pressed, create a new pop up - put it into the _win variable in the button’s parent. The window is to be placed at ‘_parent’ (see the first parameter in the createPopUp call).
The wee for loop there just outputs depths of all MovieClips in my class.

From the above code, I would expect a basic window to appear on top of all my movies - since the Window component created by PopUpManager is supposed to start at _parent and work it’s way to the top then draw. For some reason, the Window component is put BEHIND all the other movies my class creates. Why is this?

The depths output by my for loop are as follows

I is _win at depth 100
I is currentlyHighlightedStaff at depth undefined
I is sizePerStaffY at depth undefined
I is sizePerStaffX at depth undefined
I is facesPerRow at depth undefined
I is fireButton at depth 9
I is bonusButton at depth 8
I is wageButton at depth 7
I is staff1 at depth 6
I is staff0 at depth 5
I is mcFireEmployeeDBox at depth 4
I is mcDiagFireButton at depth 3
I is textField at depth 2
I is dataBox at depth 1
I is backgroundImage at depth 0

It looks there like _win should be on top - why isn’t it?

Any ideas?

I’ve uploaded a screenshot to http://www.businessplayground.co.uk/UserFiles/windowproblems.gif to show you what I mean.

Thanks

David