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 / Re: How much does PureMVC add to SWF filesize on: November 08, 2008, 08:13:32
I will try to squeeze it in. PureMVC and TweenLite (& TweenGroup) are essential to me, so that is a 16 Kb footprint...

I can live with that.

Thanks guys!
2  Announcements and General Discussion / Architecture / How much does PureMVC add to SWF filesize on: November 06, 2008, 04:41:06
I want to use the framework to make some templates for banners we often have to produce. Banner development is very limiting in filesize (40-50 Kb Sales, 100-1000 Kb Rich-Media).

How much does the framework add to the SWF filesize?

Cheers,

Pascal
3  Announcements and General Discussion / Public Demos, Tools and Applications / Re: Alternative to WebOrb and to RemoteObject on: April 23, 2008, 10:46:18
SSR is very nice!
I use it for Flash and Flex applications. It gives me one method of remote calling to work with.

Cheers,

Pascal
4  Announcements and General Discussion / Getting Started / Re: CrossPopulating Proxies on: March 19, 2008, 05:37:09
In short: you save the dataset in a variable of the proxy class. In the command you facade.retrieveProxy() the proxy to manipulate the data.

Download the Best Practices PDF.

http://puremvc.org/component/option,com_wrapper/Itemid,30/

It is explained better an more clearly than I could tell you..

Cheers,

Pascal
5  Announcements and General Discussion / Architecture / Validate form data, where to put it? on: December 23, 2007, 03:51:53
Hi,

I am making some forms in Flash (not Flex) and of course need to validate the data entered by the user.

I already made a model.helpers.ValidateHelper class to keep the validation code centralized.

But.. my question is where do I validate. Now I do it in the Mediator of the form, sending notifications to my AlertMediator to popup with a message.

I have also seen validation methods put in the VO, which seems a very good place , but I don't know if that doesn't clashes with sending to a  AMF service.

Anyone got a good practice on this?
6  Announcements and General Discussion / Architecture / Re: Proxy and Business Delegate call on: November 19, 2007, 07:24:16
Does the token also apply to Remoting calls?

I would like to handle my remoting in a switch function as well.
7  Announcements and General Discussion / Architecture / RemoteProxy / Mediator without view / runtime creation Mediator on: October 24, 2007, 02:05:54
Hi,

I have some architectural questions for my Flash application.

Should put one query per RemoteProxy?
Because I cannot find a way to to add a token to my Remoting Call, so I can make a switch in the onResult/onFault handler.
Should I got for a multiple custom onResult/onFault or is there another way to distinct the calls in my non-Flex app?

Mediator without viewComponent
I have an ApplicationMediator that handles the visibility of the screens and a BrowserMediator, without a viewComponent, implementing SWFAddress (linking/urls for flashpages) in the navigation. http://forums.puremvc.org/index.php?topic=75.msg270#msg270
In short, is it supposed to be a mediator or a command?

Two mediators depending on one RemoteProxy call
I have a remoting call that will update a Mediator/View and create multiple other Mediator/View pair and update their content.
What is the best way?
I saw the HelloWorld application do a creation on the view and add the mediator.
That was a great help, but how do I get the specific data to the right mediator/view pair?
Or should it be a command? And if so can I manipulate the mediators directly via a retrieveMediator?

Please advise on best practice solutions.

I would love to see more non-Flex examples of a real application, the flash HelloWorld was not really a RIA. I am a monkey-see-monkey-do learner :-).

thanks,

Pascal

8  Announcements and General Discussion / Architecture / Re: Mediator role on: October 17, 2007, 03:03:03
About mediators without a view. I have got one and it was kind of difficult for me to see where the code should be. First I decided to make it a Proxy, but it has to send and receive Notifications, which doesn't apply to the model (AFIAK).

This is an implementation of SWFAddress, which allows deeplinking in the SWF. It changes the URL, which allows bookmarking. On view changes I send a Nofication from my ApplicationMediator, which this class receives and changes the URL.
When someone lands on the site with an URL, this class sends a similar Notification to change the view in the ApplicationMediator. The internalUpdate switch prevents the application from looping.

I tried to implement it in the ApplicationMediator, but that got too messy and bloated for my taste.

My questions are:
Should it be a Proxy? if so, what to do about the Notification handling?
Should it stay a Mediator? The BrowserMediator gets fed a null object in the ViewPrepCommand, which smells a bit funny.
Should it be a stand-alone class? My problem then is where do I put it, this was the simplest solution I could think of.
Are the (public) constants and 'switch' statements bad practice? I do prefer 'switch' over 'for', it is easier to read.

:
package com.ip.nowhere.view {
import org.puremvc.patterns.mediator.Mediator;
import org.puremvc.interfaces.IMediator;
import org.puremvc.interfaces.INotification;

import com.ip.nowhere.ApplicationFacade;

/**
*/
public class BrowserMediator extends Mediator implements IMediator {
/**
* Canonical name of <code>BrowserMediator</code>.
*/
public static const NAME : String = "BrowserMediator";

public static const EVENTS : String = "/events";
public static const WORKSHOPS : String = "/workshops";
public static const SEARCH : String = "/search";
public static const NEWS : String = "/news";
public static const AGENDA : String = "/agenda";
public static const PICS : String = "/pics";
public static const FILM : String = "/film";
public static const SPEAK : String = "/speak";
public static const READ : String = "/read";
public static const ART : String = "/art";
public static const SHOW : String = "/show";

/**
* View is internally updated.
* If true, <code>handleSWFAddressChange</code> won't send the
* notfications.
*/
private var internalUpdate : Boolean = false;

/**
* Constructor.
*
* @param viewComponent
*/
public function BrowserMediator(viewComponent : Object) {
super(viewComponent);

SWFAddress.onChange = handleSWFAddressChange;
}

/**
* Get <code>BrowserMediator</code> name.
*
* @return Name of <code>BrowserMediator</code>.
*/
override public function getMediatorName() : String {
return BrowserMediator.NAME;
}

/**
* List all notifications.
*
* @return Array List of Notification names.
*/
override public function listNotificationInterests() : Array {
return [ApplicationFacade.STARTUP,
ApplicationFacade.VIEW_EVENTS,
ApplicationFacade.VIEW_WORKSHOPS,
ApplicationFacade.VIEW_SEARCH,
ApplicationFacade.VIEW_NEWS,
ApplicationFacade.VIEW_AGENDA,
ApplicationFacade.VIEW_PICS,
ApplicationFacade.VIEW_FILM,
ApplicationFacade.VIEW_SPEAK,
ApplicationFacade.VIEW_READ,
ApplicationFacade.VIEW_ART,
ApplicationFacade.VIEW_SHOW];
}

/**
* Handle all Notifications.
*
* @param note Notification.
*/
override public function handleNotification(note : INotification) : void {

internalUpdate = true;

switch(note.getName()) {
case ApplicationFacade.STARTUP:
case ApplicationFacade.VIEW_EVENTS:
SWFAddress.setValue(EVENTS);
break;

case ApplicationFacade.VIEW_WORKSHOPS:
SWFAddress.setValue(WORKSHOPS);
break;

case ApplicationFacade.VIEW_SEARCH:
SWFAddress.setValue(SEARCH);
break;

case ApplicationFacade.VIEW_NEWS:
SWFAddress.setValue(NEWS);
break;

case ApplicationFacade.VIEW_AGENDA:
SWFAddress.setValue(AGENDA);
break;

case ApplicationFacade.VIEW_PICS:
SWFAddress.setValue(PICS);
break;

case ApplicationFacade.VIEW_FILM:
SWFAddress.setValue(FILM);
break;

case ApplicationFacade.VIEW_SPEAK:
SWFAddress.setValue(SPEAK);
break;

case ApplicationFacade.VIEW_READ:
SWFAddress.setValue(READ);
break;

case ApplicationFacade.VIEW_ART:
SWFAddress.setValue(ART);
break;

case ApplicationFacade.VIEW_SHOW:
SWFAddress.setValue(SHOW);
break;

default:
}
}

/**
* Handles the <code>onChange</code> event of <code>SWFAddress</code>.
*/
private function handleSWFAddressChange() : void {
if (!internalUpdate) {
switch(SWFAddress.getValue()) {
case EVENTS:
sendNotification(ApplicationFacade.VIEW_EVENTS);
break;

case WORKSHOPS:
sendNotification(ApplicationFacade.VIEW_WORKSHOPS);
break;

case SEARCH:
sendNotification(ApplicationFacade.VIEW_SEARCH);
break;

case NEWS:
sendNotification(ApplicationFacade.VIEW_NEWS);
break;

case AGENDA:
sendNotification(ApplicationFacade.VIEW_AGENDA);
break;

case PICS:
sendNotification(ApplicationFacade.VIEW_PICS);
break;

case FILM:
sendNotification(ApplicationFacade.VIEW_FILM);
break;

case SPEAK:
sendNotification(ApplicationFacade.VIEW_SPEAK);
break;

case READ:
sendNotification(ApplicationFacade.VIEW_READ);
break;

case ART:
sendNotification(ApplicationFacade.VIEW_ART);
break;

case SHOW:
sendNotification(ApplicationFacade.VIEW_SHOW);
break;

default:
}
}

SWFAddress.setTitle(ApplicationProxy.getTitle() + SWFAddress.getValue());

internalUpdate = false;
}
}
}

Next is the ApplicationMediator class. The registerChild method registers the views that act like screens. The selectedChild method makes the selected view visible and hides the others (this is my semi-implementation of Flex's ViewStack, as this is an AS3/Flash application). As you can see both classes seem similar and don't feel DRY. It works, but I am open to refactoring and complying to best practices .

Later,

Pascal

:
package com.ip.nowhere.view {
import flash.display.MovieClip;

import org.puremvc.interfaces.IMediator;
import org.puremvc.interfaces.INotification;
import org.puremvc.patterns.mediator.Mediator;

import com.ip.nowhere.model.ApplicationProxy;
import com.ip.nowhere.ApplicationFacade;

/**
*/
public class ApplicationMediator extends Mediator implements IMediator {
/**
* Canonical name of <code>ApplicationMediator</code>.
*/
public static const NAME : String = "ApplicationMediator";

private var applicationProxy : ApplicationProxy;

/**
* Constructor.
*
* @param viewComponent
*/
public function ApplicationMediator(viewComponent : Object) {
super(viewComponent);

applicationProxy = facade.retrieveProxy(ApplicationProxy.NAME) as ApplicationProxy;

applicationProxy.registerChild(ApplicationFacade.VIEW_EVENTS, application.eventsView);
applicationProxy.registerChild(ApplicationFacade.VIEW_WORKSHOPS, application.workshopsView);
applicationProxy.registerChild(ApplicationFacade.VIEW_SEARCH, application.searchView);
applicationProxy.registerChild(ApplicationFacade.VIEW_NEWS, application.newsView);
applicationProxy.registerChild(ApplicationFacade.VIEW_AGENDA, application.agendaView);
applicationProxy.registerChild(ApplicationFacade.VIEW_PICS, application.picsView);
applicationProxy.registerChild(ApplicationFacade.VIEW_FILM, application.filmView);
applicationProxy.registerChild(ApplicationFacade.VIEW_SPEAK, application.speakView);
applicationProxy.registerChild(ApplicationFacade.VIEW_READ, application.readView);
applicationProxy.registerChild(ApplicationFacade.VIEW_ART, application.artView);
applicationProxy.registerChild(ApplicationFacade.VIEW_SHOW, application.showView);
}

/**
* Get <code>ApplicationMediator</code> name.
*
* @return Name of <code>ApplicationMediator</code>.
*/
override public function getMediatorName() : String {
return ApplicationMediator.NAME;
}

/**
* List all notifications.
*
* @return Array List of Notification names.
*/
override public function listNotificationInterests() : Array {
return [ApplicationFacade.STARTUP,
ApplicationFacade.VIEW_EVENTS,
ApplicationFacade.VIEW_WORKSHOPS,
ApplicationFacade.VIEW_SEARCH,
ApplicationFacade.VIEW_NEWS,
ApplicationFacade.VIEW_AGENDA,
ApplicationFacade.VIEW_PICS,
ApplicationFacade.VIEW_FILM,
ApplicationFacade.VIEW_SPEAK,
ApplicationFacade.VIEW_READ,
ApplicationFacade.VIEW_ART,
ApplicationFacade.VIEW_SHOW];
}

/**
* Handle all Notifications.
*
* @param note Notification.
*/
override public function handleNotification(note : INotification) : void {
switch(note.getName()) {
case ApplicationFacade.STARTUP:
case ApplicationFacade.VIEW_EVENTS:
applicationProxy.selectedChild = ApplicationFacade.VIEW_EVENTS;
break;

case ApplicationFacade.VIEW_WORKSHOPS:
applicationProxy.selectedChild = ApplicationFacade.VIEW_WORKSHOPS;
break;

case ApplicationFacade.VIEW_SEARCH:
applicationProxy.selectedChild = ApplicationFacade.VIEW_SEARCH;
break;

case ApplicationFacade.VIEW_NEWS:
applicationProxy.selectedChild = ApplicationFacade.VIEW_NEWS;
break;

case ApplicationFacade.VIEW_AGENDA:
applicationProxy.selectedChild = ApplicationFacade.VIEW_AGENDA;
break;

case ApplicationFacade.VIEW_PICS:
applicationProxy.selectedChild = ApplicationFacade.VIEW_PICS;
break;

case ApplicationFacade.VIEW_FILM:
applicationProxy.selectedChild = ApplicationFacade.VIEW_FILM;
break;

case ApplicationFacade.VIEW_SPEAK:
applicationProxy.selectedChild = ApplicationFacade.VIEW_SPEAK;
break;

case ApplicationFacade.VIEW_READ:
applicationProxy.selectedChild = ApplicationFacade.VIEW_READ;
break;

case ApplicationFacade.VIEW_ART:
applicationProxy.selectedChild = ApplicationFacade.VIEW_ART;
break;

case ApplicationFacade.VIEW_SHOW:
applicationProxy.selectedChild = ApplicationFacade.VIEW_SHOW;
break;

default:
}
}

/**
* Cast the <code>viewComponent</code> to its actual type.
*
* @return viewComponent
*/
protected function get application() : MovieClip {
return viewComponent as MovieClip;
}
}
}
9  Announcements and General Discussion / Getting Started / Re: Architecture 101 Questions on: September 26, 2007, 05:19:08
Exactly.

Developers know the pattern rules. Tightening it down would only add to the complexity of the framework.

Are you still deciding or certain about porting to AS2?

Cheers,

Pascal
10  Announcements and General Discussion / Getting Started / Re: Architecture 101 Questions on: September 25, 2007, 02:17:15
I would love to see an AS2 port.

It will make it all-round applicable, as AS2 is still the dominant version, at least in project I do.

Cheers,

Pascal
11  Announcements and General Discussion / Getting Started / Re: Multi-View navigation in Flash on: September 13, 2007, 03:24:18
I don't know if I have used the right name for it, but all I want is a standardized way to navigate between multiple screen of the application, not a stand-alone component.

isn't there a pattern for navigation? (mmm.. Have to look for that). Maybe like the ViewHelper/ViewLocator pattern in Cairngorm, but I have seen people pull up their noses at this implementation.

Anyone got advise on navigation, not tying the views down and like Cliff said, not make it dependent on  pureMVC
12  Announcements and General Discussion / Getting Started / Multi-View navigation in Flash on: September 13, 2007, 12:14:52
I really like pureMVC!

I want to use it for my Flash applications and website development. One thing I am still trying to 'purify', is how to navigate shen I have multiple views (screens) in my application and still keep modularity.

I really envy the Flex's ViewStack/Workflowstate and would like to implement a, kind of, similar setup in Flash. There is only one Flash pureMVC example, which didn't help me much with this issue.

Any one got a idea for this?

Pascal
Pages: [1]