層級關系:test(父級) 、 testComponent(子級)
test.ui包含組件testComponent.ui
代碼示例:
//父級代碼:
class Test extends ui.testUI{
constructor(){
super();
//將自己傳過去給子節點的類
this.component.setTestObj(this);
}
public jhHandler():void{
//設置按鈕的屬性變灰
this.ActiveBtn.gray=true;
}
}
//子級代碼
class TestComponent extends ui.testComponentUI{
constructor(){
super();
}
//保存父級的對象應用
public test:Test;
public setTestObj(test:Test):void{
this.test=test;
}
//通過引用調用父節點類的方法
public handler():void{
this.test. jhHandler();
}
}
注意:兄弟節點類的相互引用雷同