SamedDeger
SamedDeger

Reputation: 39

How use swapDepths & getNextHighestDepth() in AS3?

I'm trying to convert the following code:

DNA0.swapDepths(this.getNextHighestDepth())

I tried it this way:

DNA0.swapChildren(stage.getChildIndex(DNA0));

But its not working... I guess I didn't understand the logic. Anybody help me?

----EDIT---- @gladoscc, good job. it's work. But I have other convert problems..

Like,

this['DNA'+DNAsy.length].y = this['DNA'+(DNAsy.length-1)].y;
this['DNA'+DNAsx.length].x = this['DNA'+(DNAsy.length-1)].x;
DNAsy.push(this['DNA'+DNAsy.length].y)
DNAsx.push(this['DNA'+DNAsx.length].x)

I guess, I will ask a new question...

Upvotes: 1

Views: 9625

Answers (2)

apscience
apscience

Reputation: 7273

If you want to bring to front, just:

setChildIndex(myMC,numChildren – 1)

Upvotes: 0

sanchez
sanchez

Reputation: 4530

DNA0.parent.setChildIndex( DNA0, DNA0.parent.numChildren -1 );

You can replace DNA0.parent with the DNA0 container reference:

cont.setChildIndex( DNA0, cont.numChildren -1 );

Upvotes: 1

Related Questions