本文介绍了如何使用和swapDepths则放;的getNextHighestDepth()在AS3?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想转换成以下code:

  DNA0.swapDepths(this.getNextHighestDepth())
 

我尝试了这种方式:

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

但它不工作...我想我不明白的逻辑。有人帮帮我吗?

----编辑----@gladoscc,抓好。它的工作。但我有其他的转换问题。

像,

 这个['DNA'+ DNAsy.length] .Y =本['DNA'+(DNAsy.length-1)]Ÿ。
这个['DNA'+ DNAsx.length] .X =本['DNA'+(DNAsy.length-1)]×。
DNAsy.push(本['DNA'+ DNAsy.length] .Y)
DNAsx.push(本['DNA'+ DNAsx.length] .X)
 

我想,我会提出新问题......

解决方案

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

您可以用DNA0容器参考替换DNA0.parent:

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

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...

解决方案
DNA0.parent.setChildIndex( DNA0, DNA0.parent.numChildren -1 );

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

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

这篇关于如何使用和swapDepths则放;的getNextHighestDepth()在AS3?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-18 19:00