2012-01-13 52 views
1

我有一個通過爲創建一個自定義組件:Flash Builder的兒童彈出調用父函數

public function myFunc():void { 
    //some code 
} 

public function createComp():void { 
    var myVar:customComp = new customComp(); 
    myVar.button01.label = "Some label"; 
    PopUpManager.addPopUp(myVar, this, true); 
} 

當按鈕被按下(button01)該組成部分,我希望它呼籲在myFunc的功能父組件。請記住,所有這一切都在。我在哪裏添加事件偵聽器?

回答

0

FIOFM,從這個參考:http://www.mail-archive.com/[email protected]/msg86364.html

在彈出窗口中,創建一個新的函數變量,然後創建一個按鈕處理功能,如:

<fx:Script> 
    <![CDATA[ 

     public var onSubmit:Function; 

     public function buttonHandler():void { 
      onSubmit.call(); 
     } 
... 

在父母,加上一個公共職能:

public function openCustComp():void 
{ 
    var custComp:panelComp = new panelComp(); 
    PopUpManager.addPopUp(custComp, this, true); 
    custComp.onSubmit = clearCISD; 
    PopUpManager.centerPopUp(instSuppDiaAdd); 
}