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 / Getting Started / Re: Managing a lot of Proxys and Mediators on: December 12, 2009, 04:50:01
Hi, my problem isn't the GalleryMediator. It have not to listen to the LOADING_COMPLETE but the LoadupUtility dispatchs the Notification twice. First, when the data is loaded and second, when the images are loaded.
My StageMediator listen to this LOADING_COMPLETE and execute twice the function "initializeView"...Therfore the View is gerneratet twice...

Can I say to the StageMediator that it just have to listen for the notifactions until it receive the LOADING_COMPLETE notification?
2  Announcements and General Discussion / Getting Started / Re: Managing a lot of Proxys and Mediators on: December 11, 2009, 08:48:19
Hi, the GalleryMediator is interested in Loadup.LOADING_COMPLETE which i think is the same. It shows me when all images are loaded.

My problem is, that the Startup and the loading of the images listen to the same Proxy (Loadup Utility) so all mediators handle when the Loaduputility sends the LoadingComplete notification.

3  Announcements and General Discussion / Getting Started / Re: Managing a lot of Proxys and Mediators on: December 10, 2009, 12:03:16
ApplicationFacade.PREPARE_GALLERY calls a command

:
override public function execute(note : INotification) : void {
var stageMediator : StageMediator = facade.retrieveMediator(StageMediator.NAME) as StageMediator;
var siteDataProxy : SiteDataProxy = facade.retrieveProxy(SiteDataProxy.NAME) as SiteDataProxy;
var gallery : Gallery = new Gallery();

for (var i : int = 0; i < siteDataProxy.images.length; i++) {
gallery.addImage(new Image(String(i), siteDataProxy.urls[i]));
}

stageMediator.stage.addChild(gallery);
facade.registerMediator(new GalleryMediator(gallery));
}
4  Announcements and General Discussion / Getting Started / Re: Managing a lot of Proxys and Mediators on: December 10, 2009, 08:09:30
Ok thx... now the next question :D

I have a StartupCommand which initialize a StyleSheet and a SiteDataProxy:
:
public class StartupCommand extends SimpleCommand implements ICommand{
private var _monitor : LoadupMonitorProxy;

override public function execute(note : INotification):void{
var stage : Stage = note.getBody() as Stage;
facade.registerMediator(new StageMediator(stage));

facade.registerProxy(new LoadupMonitorProxy());
_monitor = facade.retrieveProxy(LoadupMonitorProxy.NAME) as LoadupMonitorProxy;

var styleSheetProxy : ILoadupProxy = new StyleSheetProxy();
var siteDataProxy : ILoadupProxy = new SiteDataProxy();

facade.registerProxy(styleSheetProxy);
facade.registerProxy(siteDataProxy);

var rStyleSheetProxy : LoadupResourceProxy = makeAndRegisterStartupResource(StyleSheetProxy.SRNAME, styleSheetProxy);
var rSiteDataProxy : LoadupResourceProxy = makeAndRegisterStartupResource(SiteDataProxy.SRNAME, siteDataProxy);

rSiteDataProxy.requires = [rStyleSheetProxy];
_monitor.loadResources();
}

private function makeAndRegisterStartupResource(proxyName : String, appresourceProxy : ILoadupProxy) : LoadupResourceProxy {
var r : LoadupResourceProxy = new LoadupResourceProxy(proxyName, appresourceProxy);
facade.registerProxy(r);
_monitor.addResource(r);
return r;
}
}

Then i have a StageMediator:

:
public class StageMediator extends Mediator implements IMediator {
public static const NAME : String = "stageMediator";

public function StageMediator(viewComponent : Object = null) {
super(NAME, viewComponent);
}

override public function listNotificationInterests() : Array {
return[LoadupMonitorProxy.LOADING_PROGRESS,
LoadupMonitorProxy.LOAD_RESOURCE_TIMED_OUT,
LoadupMonitorProxy.LOADING_FINISHED_INCOMPLETE,
LoadupMonitorProxy.CALL_OUT_OF_SYNC_IGNORED,
LoadupMonitorProxy.LOADING_COMPLETE,
ApplicationFacade.STYLE_SHEET_FAILED,
ApplicationFacade.STYLE_SHEET_LOADED,
ApplicationFacade.STYLE_SHEET_LOADING,
ApplicationFacade.SITE_DATA_FAILED,
ApplicationFacade.SITE_DATA_LOADED,
ApplicationFacade.SITE_DATA_LOADING];
}

override public function handleNotification(note : INotification):void{
switch(note.getName()){
case  ApplicationFacade.STYLE_SHEET_LOADING:
trace("Loading StyleSheet...");
break;
case ApplicationFacade.STYLE_SHEET_LOADED:
trace("StyleSheetLoaded");
break;
case ApplicationFacade.SITE_DATA_LOADING:
trace("Loading Site Date...");
break;
case ApplicationFacade.SITE_DATA_LOADED:
trace("Site Data Loaded");
break;
case LoadupMonitorProxy.CALL_OUT_OF_SYNC_IGNORED:
trace("Abnormal State, Abort");
break;
case LoadupMonitorProxy.LOADING_PROGRESS:
var percent : Number = note.getBody() as Number;
trace("Loading Progress: " + percent + "%");
break;
case LoadupMonitorProxy.LOADING_COMPLETE:
trace(">>Loading Complete");
initializeView();
break;
case LoadupMonitorProxy.LOADING_FINISHED_INCOMPLETE:
trace("Loading Finished Incomplete");
break;
}
}

private function initializeView() : void {
sendNotification(ApplicationFacade.PREPARE_GALLERY);
}

public function get stage():Stage{
return viewComponent as Stage;
}

My Problem is now, that my GalleryMediator and my StageMediator listen to the LoadupMonitorProxy.LOADING_COMPLETE or Loadup.LOADING_COMPLETE notification.

Now the initializeView() functions of the StageMediator get called twice. How i can fix the Problem?
5  Announcements and General Discussion / Getting Started / Re: Managing a lot of Proxys and Mediators on: December 09, 2009, 03:50:55
Thx for the answers

I have done it with the Loadup Utility...if you know how to use it, the loading of assets is realy easy.

Now, i have one GalleryMediator which controls all images. Each of these images has his own Mediator (ImageMediator).
Is this technique efficient or should i use the GalleryMediator for all images?
The images have the same behaviour as button (hover-effect etc)
6  Announcements and General Discussion / Getting Started / Managing a lot of Proxys and Mediators on: December 03, 2009, 04:20:43
Hi,
My problem is very simple but i don't know how i should manage many Proxys with many Mediators.

The app should load images. The paths of these images are in a xml file.
Know I thought about the situation and get that conclusion:

XMLProxy loading XML (finished) -> ImageLoadCommand -> ImageProxy (for each Image) -> ImageVo (SaveData) -> ?

Is that logic right? And how can I send a Notification to a ImageMediator which was created after the XML had been loaded? How should I mange the Names of ImageProxys and ImageMediators

Tobi

Sry for the bad english :D
7  PureMVC Manifold / Demos and Utils / Loading images in a Gallery on: November 30, 2009, 03:27:35
Hi,
Because I just started to programm with pureMVC, I have a question about loading images after I loaded a xml.
I use the Startup Manager from this site to load a xml and a css file. Now i have a ImageVO class which contents the urls of the images.
My problem is where I should put the loading Code and the ImageData.
On one hand it is a Data so it should be in a VO but on the other hand it is easier to load it in the view.

What way is the best:
Should I put the loading code and the data in the ImageVO
Should I create a new VO and a new Proxy
Should I load it in a Mediator at put the data into the viewComponent
Should I load it directly in the view

I hope u can understand my problem.


Pages: [1]