2008-06-24

PopUpManager doesn't work in AIR Windows

In the process of upgrading a Flex application at work, I've come across a particuliar issue regarding how the PopUpManager works in AIR. In a Flex application you are likely to have code that looks like this:

var win:MyView = PopUpManager.createPopUp( this, MyView , true ) as MyView;
PopUpManager.centerPopUp( win );
win.dataProvider = someData;

The code above creates an instance of MyView (which extends TitleWindow) and displays it as a model window and finally passes it some data so that the user can complete a task. The code above will work in an AIR application in the main application window, but not in subsequent NativeWindows!

So if your AIR application creates a new window (an instance of Window or NativeWindow) and within that window you run the code above, you will see nothing. So you will start wondering where is the instance of MyView? Is it off the screen somewhere? Who knows where it is, you can't see it and your users won't either. It simply doesn't work.

I searched the Flex bug base and did find a bug about this: SDK-12565. Basically it says that the windowing system is not integrated into the PopUpManager and that it should be. So custom controls like the CompletionInput control which I've used for a long time don't work inside NativeWindow instances. So If this issue affects you in any way and want it corrected sooner rather than later, then vote for bug SDK-12565.

1 comment:

SPS said...

Is this still an issue? In Flex 4.6 I am trying to figure out a way to open a pop-up window in an air app native window.