Search code examples
apache-flexactionscriptflex4multi-window

flex: what is the best way to create multi window web application?


I am using flex4, I am seeking the answer to create multi window web application. My application is some sort of complex, currently I only know using PopupManager to create a new window. Should I create each MXML for each window that I want to instantiate? And then load the mxml and put it into the stage? Is there any tutorial describing that? I want the program modular and easy to manager, extend.

The current way I am using is use Group to group up all the controls inside a window, and if user want to open that window, I will display the group and bring it to the front. Is it the right way to do windowing? But I can't support drag.

I want to know if there is any native support for draggable window, or dialog?

Also till now all the controls are put inside a single mxml file, is it possible to put one window(or one group) to be a separate mxml file?


Solution

  • to use the PopupManager you must first create a mxml component in your project next to your app in src folder containing a TitleWindow for example as the component container, that container is useful because it is similar to a window, it has the close button...

    For example:

    <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init();"  initialize="requestEvent();" width="368" close="close();" height="116" layout="absolute" backgroundAlpha="100" title="Create Folder" showCloseButton="true" x="29" y="21" borderColor="#FFFFFF" cornerRadius="10" alpha="2" themeColor="#FFFFFF">
    
    </mx:TitleWindow>
    

    To instantiate and pop up that component from your app you must use the PopupManager for example as the following code:

    var create_folder_w:create_folder_window = create_folder_window( PopUpManager.createPopUp(this, create_folder_window,true));

    PopUpManager.centerPopUp(create_folder_w); create_folder_w.addEventListener(FlexEvent.REMOVE,close_create_folder_refresh);

    that code gonna show the window component i show you in the first part

    i hope this simple exmple help u....