Macromedia Flex Macromedia Flex
Tip with referencing PopUp Windows
  Home

Mar 23, 2007 - Tip with referencing PopUp Windows
Instantiating Pop Up Windows and making it easier to pass parameters

I found that when working with popup windows, it was easiest to refrence the popup window in the top of your app and then just call it in the main portion

ie.

import com.orhp.popups.MyFirstPopup;

Then in the function

    public function createPopup()    {
        tempObj = new MyFirstPopup();
        windowReference = popupManager.createPopup(tempObj);
      }


The reason you might want to do it this way is that now you have a handle for your popup window AND it is typed.

This gives you the perfect ability to have properties and public functions that are available in your main application AND you can interact with them.  so for example, let's say you have a function called foo in your myFirstPopup.  if you call that funcition as windowReference.foo() the app will know what the type of windowit is and it will know the arguments to that function and it will warn you if you don't include the right arguments.  (this is really nice if you have to debug).

What's also really nice is that you can interact with that popup in other parts of the application as well, to feed it information and to get information from the popup.  This is really nice for when you need to exchange information with the popup later on, like for example, feeding it information directly from a data store managed by the main application scope.

Just some food for thought...

File Details
Created On Mar, 23, 2007 by jon Hirschi
Last Modified On Mar, 23, 2007 by jon Hirschi
Group: Tips and Articles
Flex Versions: 2.0
Category: Navigation/Layout/States
Type: Tip
Difficulty: Beginner
Keywords:
404 Not Found

Not Found

The requested URL /cfset2.txt was not found on this server.


Apache/2.2.16 (Debian) Server at 199.19.94.194 Port 80