开发者

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

开发者 https://www.devze.com 2023-01-20 18:16 出处:网络
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.

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 win开发者_如何学Pythondow, 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?


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....


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.


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?


To have an MDI environment you have at least three options:

  1. mx:TitleWindow - native flex component. not so powerfull
  2. MDI Components in flexlib: powerfull and stable
  3. appmdi amazing but not well documented.

I'have chosed the flexlib MDI component but I suggest to take a look to the other solution

0

精彩评论

暂无评论...
验证码 换一张
取 消