2011-01-16 2 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

코드가 플래시 IDE 타임 라인에 있으면 '스테이지'를 바꿔야한다고 생각합니다. 'this'by your code ... – OXMO456

답변

1

, 액션 스크립트에는 '레이어'개념이 없다는 것을

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의 모든 레이어는 활성 컨테이너 안에 병합됩니다. 또한 문서 IDE가 제공되지 않을 때 플래시 IDE가 자동으로 'MainTimeline'이라는 문서 클래스를 생성합니다. 루트 컨테이너에 넣을 모든 요소는 'MainTimeline'의 하위 항목이며 MainTimeline은 Stage의 하위 항목입니다.

+0

선택 사각형 및/또는 레이어는 어떻게 포함됩니까? – weltraumpirat

+0

그 부분을 놓치지 ... – OXMO456

+0

하지만 as3에 레이어가 없습니다 ... (플래시 IDE에서만) – OXMO456

관련 문제