I've hit a 开发者_如何学JAVAvery strange issue in adobe flex and I'm not sure how to solve it. I have a popup box that is called on creationComplete before startup of my main application. The popup simply asks for an email address and then the application is enabled showing the email address in a label component.
However, when I try to access the email address from the label component called UserID.text in the application, it is always null even though it is visually present in the label box...It seems like it loses state somehow...so HOW in earth can I keep it from losing state? I need to access the label or some variable throughout the use of the application and everything I try always ends up in a null variable???
The main part of the application that sets the label is here:
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" xmlns:controls="com.iwobanas.controls.*" xmlns:local="*" creationComplete="showWindow(true)">
private function showWindow(modal:Boolean):void
{
var logonWindow:LogonWindow = new LogonWindow();
logonWindow.addEventListener("logon", logonHandler);
PopUpManager.addPopUp(logonWindow, this, modal);
PopUpManager.centerPopUp(logonWindow);
}
public function logonHandler(event:LogonEvent):void
{
UserID.text=event.userId;
}
Any help would be greatly appreciated.
Store the id as a Bindable variable in your application instead of setting the text input directly.
[Bindable]
private var logonId:String;
public function logonHandler(event:LogonEvent):void
{
logonId=event.userId;
}
<mx:TextInput text="{logonId}" />
精彩评论