views:

50

answers:

3

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?

+1  A: 

In answer to your first question, take a look at the MDI stuff in Flexlib.

In answer to your second question, take a look at the Flex tutorials for how to manage your project.

Gregor Kiddie
i like your first part of answer, but your second answer is really not welcomed.
Bin Chen
+1  A: 

The question is not really what goes into what file, but rather how to implement your objects or classes in relation to one another. If several windows share the same structure or share a type of controls, you can definitely create a base class for those windows, same goes for the controls.

There's nothing particularly difficult about a component you can drag or about a common set of controls. Gregor Kiddie has a point though, why don't you check some Flex tutorials?

PatrickS
is it possible to have several mxml document in one project? How I can load one mxml in another mxml as a control/component?
Bin Chen
More often than not an application consists of several documents. You put to much emphasis on the file format , not enough on the concept. Your application is made of interconnected objects, you can look at it as a bunch of mxml documents, but it would be more helpful to understand what an object or a component is and how you can use them in your application.
PatrickS
If I have several mxml, how one can use another one?
Bin Chen
+1  A: 

Hi Binchen, 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....

Alejandro