0
我正在使用組件顯示彈出窗口並使用事件偵聽器來獲取彈出窗口屬性並刪除父窗口中的彈出窗口。然而,在監聽器popup var中,poup var是nul,所以會引發錯誤。無法在FlashBuilder中使用事件從子彈出窗口中檢索屬性
任何建議將不勝感激。
約翰
這裏是我的EditStudentLogInForm.mxml組件..
<?xml version="1.0"?>
<!-- containers\layouts\myComponents\MyLoginForm.mxml -->
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
creationComplete="handleCreationComplete();">
<mx:Script>
<![CDATA[
import mx.managers.PopUpManager;
[Bindable] public var studentLoginEmail:String;
]]>
</mx:Script>
<mx:Form width="333">
<mx:FormItem label="Email">
<mx:TextInput id="username" width="207"/>
</mx:FormItem>
<mx:FormItem label="Password">
<mx:TextInput id="password"
width="205"/>
</mx:FormItem>
</mx:Form>
<mx:HBox>
<mx:Button id="okButton" label="OK"/>
<mx:Button id="cancelButton" label="Cancel" />
</mx:HBox>
</mx:TitleWindow>
這裏是父...
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:s="library://ns.adobe.com/flex/spark">
<mx:Script>
<![CDATA[
import flash.events.Event;
import mx.managers.PopUpManager;
import mx.core.IFlexDisplayObject;
import EditStudentLogInForm;
import mx.containers.TitleWindow;
public var helpWindow:EditStudentLogInForm;
public function showLogin():void {
// Create the TitleWindow container.
var helpWindow:EditStudentLogInForm = EditStudentLogInForm(
PopUpManager.createPopUp(this, EditStudentLogInForm, true));
helpWindow.username.text = "[email protected]";
helpWindow["cancelButton"].addEventListener("click", removeMe);
helpWindow["okButton"].addEventListener("click", submitData);
}
// OK button click event listener.
private function submitData(event:Event):void {
testText.text = helpWindow.username.text;
//*********helpWindow is nul*******
removeMe(event);
}
// Cancel button click event listener.
private function removeMe(event:Event):void {
PopUpManager.removePopUp(helpWindow);
}
]]>
</mx:Script>
</mx:Application>
當然!凌晨2點。我醒了,但我想我的大腦不是。謝謝。 – user278859