juaron
01-15-2007, 01:08 PM
I'm using the PopUpManager to create a Window. As the contentPath i'm using an mc from my library. This mc contains a TextArea. After the Window's complete-event I try to read the value of TextArea.text, but I get undefined. TextArea._x however does give me a value. When I place a button on Stage, and use it to read TextArea.text it does work. It seems like there's a delay before the text-property is accessible (maybe is has to be loaded or something?) Does anyone recognize this problem, knows what causes it, and mainly: how to solve it?
I could make an interval-function to check for the value of TextArea.text, but I hope there's a more elegant solution.
Here's the code:
import mx.managers.PopUpManager;
import mx.controls.TextArea;
var win:MovieClip = PopUpManager.createPopUp(_root, mx.containers.Window, false);
win.setSize(640, 560);
win.contentPath = "codeWindow";
var winListener:Object = new Object();
winListener.complete = function(evt_obj:Object) {
var t:TextArea = win.content.textarea;
trace(t._x);//traces correct _x-value
trace(t.text);//traces undefined
};
win.addEventListener("complete", winListener);
I could make an interval-function to check for the value of TextArea.text, but I hope there's a more elegant solution.
Here's the code:
import mx.managers.PopUpManager;
import mx.controls.TextArea;
var win:MovieClip = PopUpManager.createPopUp(_root, mx.containers.Window, false);
win.setSize(640, 560);
win.contentPath = "codeWindow";
var winListener:Object = new Object();
winListener.complete = function(evt_obj:Object) {
var t:TextArea = win.content.textarea;
trace(t._x);//traces correct _x-value
trace(t.text);//traces undefined
};
win.addEventListener("complete", winListener);