I've found very little info on the DepthManager class. afaik, you need to increment the kTop property when you use it:

var new_mc = myMovie.createObject(__rowRenderer, "new_mc", DepthManager.kTop++, {owner:this, styleName:this});

At the same time I find it useful to get the next highest depth of the movieclip I want to be over. This next statement adds the movieclip to myMovie at myMovies's next highest depth. So if myMovie has one other object on it at depth 1 then myMovie.getNextHighestDepth() returns "2". var new_mc = myMovie.createObject(__rowRenderer, "new_mc", myMovie.getNextHighestDepth(), {owner:this, styleName:this});

I've had problems using _root.getNextHighestDepth() in a class. It stops at a certain number and any new movieclips replace the movie that is at the same depth.

if createObject is not available (for use mostly with components) use attachMovie in it's place...

Judah

Scott Pobiner wrote:

Hey Mel,

Take a look at the DepthManager. You can use it for exactly what you are trying to do. The catch is that you have to instantiate the MovieClips you want to use via actionscript with the DepthManager functions. Remember to do this because the DepthManager needs to keep track of all elements you want to sort. Then all you have to do is use the constants DepthManage.kTop, DepthManage.kBottom, etc. The manager sorts its children instances using these constants by putting each call to kTop in depth 201 and then moving the rest down sequentially (actually vice versa).

Hope this helps,

_S


Hello,

I have another question for the group:

I was using this...

for (var i in this) {
    if (typeof (this[i]) == "movieclip") {
        trace("movie clip '"+this[i]._name+"' is at depth
"+this[i].getDepth()*-1);
    }
}

...to discover the depth of the movieclips I have on the stage.

Then I wrote this...

postcard_amt = [1, 2, 3];
for (i=0; i<postcard_amt.length; i++) {
    postcard_itm = "postcard"+i+"_mc";
    _root[postcard_itm].onPress = function(){
        trace(this.getDepth());
    }
}

...to specifially single out the _mc's I wanted.
Not sure if that is the best way to write it, but that's not my question
(althought I am open to more efficient ways).

/*************

My question:
What is the best approach to finding the highest depth, the middle depth and
the lowest depth?

*************/

Backstory:
Ideally, what I will be doing is swapDepths() with these _mc's and
reshuffling them accordingly.

if original state is...

1
2
3

...onEvent...

2
3
1

...then another Event...

3
1
2

...and so on.

Thanks for the advice,
fm




_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com



--
"Always bear in mind that your own resolution to succeed is more important than any 
one thing."

"You can have anything you want - if you want it badly enough. You can be anything you want to be, do anything you set out to accomplish if you hold to that desire with singleness of purpose."
- Abraham Lincoln

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to