부모 개체가이 이벤트를 수신하는 모든 자식에게 이벤트를 전달하기를 바랍니다.자녀가 부모 이벤트를 수신 할 수 있습니까?
var boxParent:Sprite = new Sprite();
var boxChild:Sprite = new Sprite();
this.addChild(boxParent);
boxParent.addChild(boxChild);
boxChild.addEventListener("parentTalking", onParentTalking);
boxParent.dispatchEvent(new Event("parentTalking"));
그렇게 할 수있는 방법이 있나요 : 내가 성공하지 아래 코드를 시도? 사전에
for (var i:int = 0; i < boxParent.numChildren; i++) {
(getChildAt(i) as MyChild).hereItGoesParentCommand();
}
감사 :
은 BTW, 나는 내가 좋아하는 일을 피할 수 소원!
자녀가 스테이지를 수신하고 로컬 메소드를 바인딩하고 부모 디스패치를 수행하도록합니다. 이벤트는 최종 거품 단계에서 캡처됩니다 http://fahimchowdhury.blogspot.com/2011/06/as3-child-listening-to-parent.html – zamnuts