Window Component depth issues?

  • yossarian
  • Newbie
  • Newbie
  • yossarian
  • Posts: 8

Post 3+ Months Ago

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[i].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 ... oblems.gif to show you what I mean.


  • IceCold
  • Guru
  • Guru
  • User avatar
  • Posts: 1252
  • Loc: Ro

Post 3+ Months Ago

i`m not sure how that PopUpManager.createPopUp function works.
But since it`s depth is the highest, it should be displayed on top of the others (but only on top of the others movies from _parent).
so, either the function is not working properly ... in this case try to attach a movie clip from your library and set it`s depth to be higher than the rest and see if it shows it on top.
or ... you have other layers or movie clips that have their depths higher than your _parent movie clip depth, in this case set the _parent depth to be the highest
  • yossarian
  • Newbie
  • Newbie
  • yossarian
  • Posts: 8

Post 3+ Months Ago

Thanks for the advice, I'll have a look and see.

I think the function may just be behaving incorreclty - if you look at my code, I do a "for (var i in _parent)" loop that shows depths of each clip. It is these clips (that share _parent with my pop up) that have lower stated depths but actually are above.

However, I may be able to piggy back my pop up on a higher parent or something
  • yossarian
  • Newbie
  • Newbie
  • yossarian
  • Posts: 8

Post 3+ Months Ago


Over a year later and I have this probelm again and think "ugh, I never did find out a solution - I wonder if the web knows what's going on yet". I google, find this post and go "ooh, this guy has the same problem - his spelling sucks though".

And I read the post, and the code, and the response and the response to the response - and only THEN do I actually see the poster name and realise this was one of my posts from the past. Coming back to haunt me.

Anyway... Something wierd definately does happen when you use the pop up manager. Completely different project / circumstances and hitting this again.

However, this time, I have the solution - simple as pie.

Instead of using a pop up manager (and I know that won't be possible always, but it is for me in this instance), you just need to create the window yourself.

So.. your class - instead of inheriting from MovieClip, has to inherit from mx.core.UIObject (which itself inherits from MovieClip, so no loss there).

Then in your code you do:

var window = this.createClassObject(Window, "window", this.getNextHighestDepth());

You can set all the same properties and it behaves pretty much (at least so far!) like the popped up window (sans modal). But this time, it respects depth propertly.

Which is nice.

hth anyone else who googles with this problem.

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: No registered users and 3 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum

© 1998-2017. Ozzu® is a registered trademark of Unmelted, LLC.