2011-01-16 6 views
1

私はちょうどステージ上で、レイヤー上のすべてのムービークリップにタイムラインでアクセスできますか?

を返すコード...

var selection:Array = new Array(); 
var diplayObjCont:* = stage; 

// The rectangle that defines the selection in the containers coordinate space. 

// Loop throught the containers children. 
for(var a:int; a<diplayObjCont.numChildren; a++){ 
    // Get the childs bounds in the containers coordinate space. 
    var child:DisplayObject = diplayObjCont.getChildAt(a); 
    selection.push(child); 
} 


trace(selection); 

を持っている[オブジェクトMainTimeline]

だから、私は上のすべてのムービークリップを取得するには、このMainTimeline上の層にアクセスすることができますこの層?だから私は簡単な操作 "A_1_2.buttonMode = true;"を行うことができます私のすべてのMCに(例えば、配列で)すべての行を書くことなく(たくさんのMCがレイヤー上にたくさんあります)はいすることができます

+0

コードがflash ideタイムラインにある場合は、私はあなたが 'stage 'あなたのコードで' this 'によって... – OXMO456

答えて

1

、ActionScript3には '層' という概念が存在しないこと

var container:DisplayObjectContainer = foo; 
var index:int = container.numChildren; 
do{ 
    var fooChild:DisplayObject = foo.getChildAt(--index); 
    //do dirty things with fooChild... 
}while(index) 

注意してください。 Flash IDEのすべてのレイヤーがアクティブなコンテナ内でマージされます。 また、ドキュメントクラスが提供されていない場合、Flash IDEは自動的に「MainTimeline」というドキュメントクラスを作成します。ルートコンテナに配置するすべての要素は、 'MainTimeline'の子になります(MainTimelineはStageの子です)

+0

選択矩形やレイヤーはどのように含まれますか? – weltraumpirat

+0

その部分を逃す... – OXMO456

+0

しかし、as3のレイヤーはありません...(フラッシュIDEのみ) – OXMO456

関連する問題