Futurescale, Inc. PureMVC Home

The PureMVC Framework Code at the Speed of Thought

Over 10 years of community discussion and knowledge are maintained here as a read-only archive.

New discussions should be taken up in issues on the appropriate projects at https://github.com/PureMVC

Show Posts

| * |

  Show Posts
Pages: [1]
1  Announcements and General Discussion / Architecture / Reset and delete a view on: November 30, 2007, 06:11:26
Hi all,
I just finish a big project build with Flex and PureMVC, and I'm very happy but I have to optimize a bit.

The project contains about ten views in the main ViewStack, the creationPolicy of viewStage is set to auto.
With this settings the first time that the view is showed, Flex create all needed components,
When the user change view, the old view is hidden and the new showed, but the old still live.
In some cases this is a advantage, because when the user come back to the view the state of all components are the same (ie. a list selection).
But there are cases that this is not a good thing, in my scenario after that the user use a application for some time the memory usage increase, because all views are created and there is not a garbage collection.
And I need also that each time a enter in the view all components are resetted.

I just thinking how to solve this situation and I have had this ideas:

Create a component that listen the change event of ViewStack.
When the component is showed create the mediator and the view.
When the component is hidden remove the mediator and the view from the displayList

<mx:ViewStack id="vwStack" left="0" top="0" right="0" bottom="0" resizeToContent="false" creationPolicy="auto">
   <viewHelper mediatorClass="myMediatorClass">
      <myRealView />

Other little advantage of this solution is that you don't need to create all views mediators inside ApplicationMediator.

Someone have other (more elegant) solutions?

2  Announcements and General Discussion / General Discussion / Popup Window on: November 05, 2007, 04:45:02
Hi all, I want to share with you a little code that have found usefull in the project that I just build with PureMVC.
A lot of time I must to open different popup windows each with own Component/Mediator, I have written this code inside ApplicationFacade:

import flash.display.Sprite;
import mx.core.Application
import mx.core.IFlexDisplayObject;
import mx.managers.PopUpManager;

public static function openPopUpWindow( ComponentClass:Class, MediatorClass:Class ):void
var window:IFlexDisplayObject = PopUpManager.createPopUp( Application.application as Sprite, ComponentClass, true );

ApplicationFacade.getInstance().registerMediator( new MediatorClass( window ) );
PopUpManager.centerPopUp( window );

public static function closePopUpWindow( window:IFlexDisplayObject, mediatorName:String ):void
PopUpManager.removePopUp( window );
ApplicationFacade.getInstance().removeMediator( mediatorName );

For open the window you have to call ApplicationFacade.openPopUpWindow( MyComponent, MyComponentMediator );
and for close the window: ApplicationFacade.closePopUpWindow( myComponentInstance, MyComponentMediator.NAME );

3  Announcements and General Discussion / General Discussion / [OT] there are italian here? on: October 12, 2007, 03:44:45
Hi all,
I'm little curious and today I have asked to Cliff if there are italian members, he have asked that don't know it and try to write a post in the forum.
So, I ask to all italian members to contact me (you can send me a private message http://forums.puremvc.org/index.php?action=pm;sa=send;u=11), I would like to make a little pureMVC-it community.

4  Announcements and General Discussion / General Discussion / first project with pureMVC on: July 07, 2007, 05:18:01
Hi Cliff,
I just starting a new project and I have chosen PureMVC instead Cairngorm. I have read all documentations and play a but with the demo (very usefull, thanks).
Now in this project I have some points and I would like to have a suggestion what's the best way to achieve:
- the APP_STARTUP must to read a XML config file
- I must to wait that the config is loaded, parse it and read some resources (other XML and background images)
- when all is loaded I can show the view.

What is the best way to make it?

Pages: [1]