2011-10-05 5 views
0

업로드하는 동안 업로드 프로세스를 취소하기 위해 스테이지의 모든 버튼을 비활성화해야합니다. 나는이 시도하지만 "myButton이"비활성화되고 계속해서 :AS3 - 하나만 제외하고 모든 버튼 비활성화

stage.mouseChildren = false; 
mysection.mybutton.mouseChildren = true 

은 어떻게 할 수 있나요?

+0

'mouseChildren'을'false'로 설정하면 특정'DisplayObject'의 자식으로부터 발생하는 모든 마우스 이벤트가 억제됩니다. 이것을 '스테이지'에 적용하면 전체 SWF에서 모든 마우스 이벤트를 효과적으로 억제 할 수 있습니다. 필요한 버튼을 명시 적으로 비활성화하거나 하나의 통화에서 비활성화 할 수 있도록 그룹화하는 방법을 찾아야합니다. – Peter

+0

그 버튼을 여러 개 가질 수는 없지만 하나씩 비활성화하지 않는 이유는 무엇입니까? – danii

답변

-1

아래와 같은 내용이 도움이 될 수 있습니다. 하지만 구문 오류가 있는지 확인해야합니다. 체크 시간이 없습니다.

function findMyButton(doc:DisplayObjectContainer , n:String):void{ 
    for(var i:int=0; i<doc.numChildren; i++) 
    { 
    var btn:DisplayObjectContainer = this.getChildAt(i) as DisplayObjectContainer; 

    if(btn && btn.numChildren > 0){ 
     findMyButton(btn , n); 
    } 

     if(btn.name =="btn_upload") 
     { 
     btn.mouseEnabled = true; 
     } 
     else 
     { 
     btn.mouseEnabled = false; 
     } 

    } 

} 

// This ll allow you to disable or enable all your objects 
// so you can activate the button you like after you call this method. 
function conrolmyButtons(doc:DisplayObjectContainer , b:Boolean):void{ 
    for(var i:int=0; i<doc.numChildren; i++) 
    { 
    var btn:DisplayObjectContainer = this.getChildAt(i) as DisplayObjectContainer; 
    if(btn && btn.numChildren > 0){ 
     findMyButton(btn , n); 
    } 
    btn.mouseEnabled = b; 
    } 

} 
+0

코드가 잘못되었습니다. DisplayObject는 자식을 가질 수 없습니다. 다른 말로하면. do.numchildren <<<가 잘못되었습니다. DisplayObject Layer Inheritance가 미달합니까? 자신 만의 코드를 실행하면 엉뚱한 코드를 알 수 있습니다. –

+0

SimpleButton은 InteractiveObejct입니다. InteractiveObject도 자식을 가질 수 없습니다. var btn : DisplayObjectContainer = this.getChildAt (i) as DisplayObjectContainer; <<< 무슨 뜻입니까? 아마도 btn은 simplebutton입니다. 그렇다면 왜 SimpleButton을 DisplayObjectContainer로 변환해야합니까 ??? 당신은 코드를 사용할 수 없습니다 ... –

+0

버튼이 SimpleButton이라는 언급이 있습니까? 그것에 대해 어떤 정보도 볼 수 없습니다. – ymutlu

관련 문제