-
1. Re: Advice about my application's structure please
Gregory Lafrance Aug 11, 2009 6:36 AM (in response to nikos101)1 person found this helpfulIts usually best to keep components self-contained so they can take care of themselves, better for reuse.
That said, MVC is a powerful architecture, and to use a simple MVC pattern with custom events, see my Flex cookbook post on the topic:
http://www.adobe.com/cfusion/communityengine/index.cfm?event=showdetails&productId=2&postI d=11246
Later you could use a more formalized MVC architecture, like Mate, PureMVC, or Cairngorn:
http://www.asfusion.com/blog/entry/mate-flex-framework-in-public-alpha
If this post answers your question or helps, please mark it as such.
-
2. Re: Advice about my application's structure please
nikos101 Aug 12, 2009 9:04 AM (in response to Gregory Lafrance)Cheers Greg I'm playing with your code and its quite interesting. I want to try and use this style of yours in my next app. Then if I manage to use it I could go on to Cairngorm.
-
3. Re: Advice about my application's structure please
nikos101 Aug 12, 2009 9:12 AM (in response to nikos101)What advantages would a formal MCV give over your MVC method and how much extra work /code is required to use these others?
Keep it up dude
Your keeping me on the road to FLEX mastery _
-
4. Re: Advice about my application's structure please
nikos101 Aug 12, 2009 9:37 AM (in response to Gregory Lafrance)hmm..
the MATE one looks really tempting
-
5. Re: Advice about my application's structure please
Gregory Lafrance Aug 12, 2009 8:52 PM (in response to nikos101)1 person found this helpfulI think the MVC technology you use depends on the size and complexity of your app.
The code in my Cookbook post would be for simple apps, and Cairngorm would be for apps with a good degree of complexity.
I can't comment on Mate and PureMVC on this point, but I think they are less complex than Cairngorm, so they might be better for larger but less complex apps.
-
6. Re: Advice about my application's structure please
nikos101 Aug 14, 2009 8:52 AM (in response to Gregory Lafrance)In your MVC example
in WizardController you have a refererence to WizardModel in the following code, why didn't you use WizardModel.getInstance.wizardTitle
Your code still works though
private function wizardTitleChangeHandler(event:WizardTitleChangeEvent):void{
WizardModel.wizardTitle = WizardModel.wizardTitleBase;
for each(var titlePart:String in event.newTitleParts){
WizardModel.wizardTitle += " - " + titlePart;
}
}` -
7. Re: Advice about my application's structure please
nikos101 Aug 14, 2009 9:03 AM (in response to nikos101)I think I've got it although I'm not really sure why your doing the modifications with static variables
WizardModel.wizardTitle = WizardModel.wizardTitleBase;
Why not just use wizardTitleBase as a public var to keep consistant with the other vars in the model
-
8. Re: Advice about my application's structure please
nikos101 Aug 14, 2009 9:36 AM (in response to nikos101)I use a lot of remote objects in flex so I guesss your controller class would be the logical place to put in RPC calls, maybe something like this would be useful in your class:
import mx.controls.Alert;
import mx.rpc.remoting.RemoteObject;
import mx.rpc.events.ResultEvent;
import mx.rpc.events.FaultEvent;
public var employeeRO:RemoteObject;public function useRemoteObject(intArg:int, strArg:String):void {
employeeRO = new RemoteObject();
employeeRO.destination = "SalaryManager";
employeeRO.getList.addEventListener("result", getListResultHandler);
employeeRO.addEventListener("fault", faultHandler);
employeeRO.getList(deptComboBox.selectedItem.data);
} -
9. Re: Advice about my application's structure please
Gregory Lafrance Aug 14, 2009 9:25 PM (in response to nikos101)To tell you the truth, I can't imagine why all the model vars are not static. If there can only one instance of the model, having all static vars should be the same thing. ? .
-
10. Re: Advice about my application's structure please
nikos101 Aug 18, 2009 2:58 AM (in response to Gregory Lafrance)Guess so
-
11. Re: Advice about my application's structure please
nikos101 Aug 20, 2009 5:27 AM (in response to nikos101)A lot of my mxml components have remote object calls in them. I'm not sure how easy this would fit into the way your code works. I guess I could fire off events from the views when they need data and have a bunch of controllers that fire of remote object calls in actionscript?
-
12. Re: Advice about my application's structure please
Gregory Lafrance Aug 20, 2009 5:31 AM (in response to nikos101)I guess it depends on how the components know they need data. Don't now if its right or not, but sometimes I let components not use custom events for themselves, so a button in a component just has a click handler, not custom event, because the button is right there in the component.