(スタイルシートで言うところのz-indexみたいなイメージ)
- setChildIndex(child:DisplayObject, index:int):void
- コンポーネントの順番を変更
- getChildIndex(child:DisplayObject):int
- コンポーネントの順番を取得
- swapChildren(child1:DisplayObject, child2:DisplayObject):void
- child1とchild2の順番を入れ替える
- swapChildrenAt(index1:int, index2:int):void
- 表示オブジェクト内の2つのインデックス位置にあるコンポーネントを入れ替える
使い方はこんなかんじ
<mx:Script>
<![CDATA[
private function init():void {
myParent.setChildIndex(myChild1, 1);
myParent.setChildIndex(myChild2, 0);
}
]]>
</mx:Script>
<mx:Canvas id="myParent" creationComplete="init();">
<mx:Canvas id="myChild1" backgroundColor="0xff0000" x="50" y="50" width="100" height="100" />
<mx:Canvas id="myChild2" backgroundColor="0x0000ff" x="100" y="100" width="100" height="100" />
</mx:Canvas>
0 件のコメント:
コメントを投稿