That would make sense and I really wish it worked that way, however,
that is not the case. Here is a short code example.
in CustomTitleWindow.mxml...
public function doSomething():void {
this.someElement.visible = true;
}
in Application.mxml...
function callFunctionAfterCenterPopUp() {
//create popup, cast to CustomTitleWindow
cTitleWindow = CustomTitleWidnow(PopUpManager.createPopUp
(this,CustomTitleWindow,false));
//center popup
PopUpManager.centerPopUp(cTitleWindow);
//call method within CustomTitleWindow class on popupwindow reference
cTitleWindow.doSomething();//nothing happens
}
It also seems that events do not bubble over to pop-up windows.
in CustomTitleWindow.mxml...
//called on creation complete
public function init():void {
this.addEventListener("somethingHappened", doSomething);
}
in Application.mxml...
//called when a button is clicked for example
public function causeEvent():void {
dispatchEvent(new Event("somethingHappened", true, false));
}
--- In [email protected], "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> Yes, you can call methods on your popup at any time. Just hang on
to a
> reference to it and call as needed.
>
>
>
> ________________________________
>
> From: [email protected]
[mailto:[EMAIL PROTECTED] On
> Behalf Of j301c
> Sent: Friday, November 09, 2007 6:26 PM
> To: [email protected]
> Subject: [flexcoders] How to call methods on popupwindow after its
> PopUpManager.centerPopUp is called
>
>
>
> I have a popupwindow that should display information about and item
> selected from a datagrid on the main application. I have found
> examples where you can pass data to the popupwindow before
centerPopUp
> is called. Is it possible to call methods, or pass data for that
> matter, on that popupwindow instance after centerPopUp is called?
>