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

Pages: [1]
Print
Author Topic: Application Skeleton - A PureMVC AS3 / Flex / WebORB Demo  (Read 28388 times)
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« on: January 01, 2008, 02:38:59 »

This demo illustrates a startup process for a PureMVC-based Flex application that displays a splash screen with a progress bar until several resources have loaded, after which the user is presented with the actual UI.

The demo has historically been located here: http://trac.puremvc.org/Demo_AS3_Flex_AppSkeleton
The project has been moved here: https://github.com/PureMVC/puremvc-as3-demo-flex-appskeleton/wiki

The author is Daniele Ugoletti.
« Last Edit: September 22, 2012, 05:27:14 by puremvc » Logged
ryebrye
Newbie
*
Posts: 7


View Profile Email
« Reply #1 on: March 28, 2008, 08:37:03 »

Overall, I like the demo - it's nice, and it's clean.

One issue I have with it is that the views are talking directly to the Facade and not to the mediator to get their proxy objects. Is there a specific reason that this is done?

From my understanding of the PureMVC best practices, it seems that views shouldn't talk directly to the facade - (but I'm still learning PureMVC stuff, so that's why I'm asking for clarification)

The specific methods I'm talking about are the getConfigProxy and getLocaleProxy methods on the facade that are bound in the views.
Logged
harmanjd
Newbie
*
Posts: 5


View Profile Email
« Reply #2 on: May 26, 2008, 01:31:40 »

I agree - in the MainScreen.mxml file you have this

      
:
<mx:Label text="{ApplicationFacade.getLocaleProxy().getText('How to read config values')}" color="#ffffff" fontSize="14" width="90%" />
<mx:Text id="configValueExample" width="90%" color="#ffffff" />
<mx:Label text="{ApplicationFacade.getLocaleProxy().getText('How to read locale text')}" color="#ffffff" fontSize="14" width="90%" />
<mx:Text id="localeValueExample" width="90%" color="#ffffff" />


Which is a mix of having the mediator give the text (for the mx:Text) controls and having the view component talk to the ApplicaitonFacade directly.  Seems it ought to be changed to this


:
<mx:Label id="configLabel" color="#ffffff" fontSize="14" width="90%" />
<mx:Text id="configValueExample" width="90%" color="#ffffff" />
<mx:Label id="localeLabel" color="#ffffff" fontSize="14" width="90%" />
<mx:Text id="localeValueExample" width="90%" color="#ffffff" />

And then in

MainScreenMediator in the handleCreationComplete function add these two lines.
:
this.mainScreen.configLabel.text= ApplicationFacade.getLocaleProxy().getText('How to read config values');
this.mainScreen.localeLabel.text = ApplicationFacade.getLocaleProxy().getText('How to read locale text');


Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #3 on: May 26, 2008, 05:32:40 »

I agree on this point. And I believe the author is actually making these and other changes to the demo right now.

-=Cliff>
Logged
GroundZero
Newbie
*
Posts: 7


Bling Bling

 - g888z  - Actionscriptdude
View Profile Email
« Reply #4 on: May 30, 2008, 09:14:50 »

Hey there all,

Wouldn't it also be good to take it another step and have the mediator use a model reference passed in with a notification so that the model is always what you think it is when accessing its properties?  Just like view to view communication I was taught it was not a good practice and should be avoided if possible. 

I just finished a project for Toyota/Scion that uses PureMVC and only had 3 weeks.  Towards the last few days I had to do some "hot wiring" like this in order to not end up in a refactoring.  In the end it worked and the code will never be looked at by others or extended.  By hot wiring I mean mediator to mediator communication without using command/notification. I also had a case where I was talking to a model proxy through the facade instead of through a view notification reference.

I simply love how PureMVC helped me make it all happen in 3 weeks.  I do not think I could have stayed on track and kept the spaghetti to a minimum without it.  I am not a heavy 'patterns' guy but have adopted as much as I can to help keep my focus on functionality and design/interaction....instead of how my application will talk to itself.

I guess I am saying that stepping outside of your pattern usage is not too bad towards the end of a project that meets certain profile, but should be avoided as much as possible in the early stages.

Thank so much for this code base, it is truly a wondrous thing.

http://www.scion.com/rsxd/

(btw I work for Solution Set in San Francisco and was the lead developer)
« Last Edit: May 30, 2008, 11:15:01 by GroundZero » Logged
pgianf
Newbie
*
Posts: 4


View Profile Email
« Reply #5 on: July 07, 2008, 09:44:55 »

Hi
i've just downloaded the Application Skeleton, it works when i create a web application project with flex if i create an air application it doesnt work.
It seems that MainScreenMediator doesnt receive the  MainScreen.CREATION_COMPLETE event or  MainScreen (as i can see while debugging)  send this event to early even before MainScreen has called addEventListener for this event (it could be some debug issue with event that changes events order)
could you help me please?
thanks
Paolo
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #6 on: July 08, 2008, 10:36:58 »

In AIR, you need to startup from the applicationComplete event handler. why this is so is a mystery to me, but it seems to be the case. Check out the AIR demos and you'll see.

This is a FAQ candidate.

-=Cliff>
Logged
pgianf
Newbie
*
Posts: 4


View Profile Email
« Reply #7 on: July 08, 2008, 02:09:10 »

Cliff,
i've tried i've put applicationComplete="facade.startup(this);" in my WindowedApplication but it's the same.
I think that MainScreen.mxml being a child of main application it is created before the overall application constuction is completed, so Main Screen dispatch a CREATION_COMPLETE event before facade.startup is called, that should mean that MainScreenMediator hasnt  called addEventListener for CREATION_COMPLET so he will not listen to the event. Indeed the application shows up without the two messages .
If I change event in MainScreen.mxml using show instead of creationComplete
(just change in show="dispatchEvent( new Event( CREATION_COMPLETE ) )" it works.
yes it's a strange behaviour I cannot understand this difference between flex and air.
Paolo
Logged
puremvc
Global Moderator
Hero Member
*****
Posts: 2871



View Profile WWW Email
« Reply #8 on: July 11, 2008, 06:01:57 »

Wait, you shouldn't be starting up from a subcomponent of the app but instead from the main app. You want the entire view hierarchy to build itself first.

Take a look at some of the AIR examples to see.

-=Cliff>
Logged
hem
Newbie
*
Posts: 1


View Profile Email
« Reply #9 on: July 22, 2008, 02:28:56 »

Friends,

Has anyone attempted to convert this to the AS3 MultiCore version of PureMVC yet?

Thanks
-Hem
Logged
Pages: [1]
Print