Jul
5
2009
Here are just a couple more enhancements to FlashMVC I was able to add over the weekend. These will not only automate a few things, but it makes room for additional addons in the future. There are two new features that have been added to SuperAction:
bindVars(… REST):void
This method looks at the SuperEvent fired from a completed action class, and copies properties to the SuperModel from the SuperEvent.
lastSuperEvent : SuperEvent
[read-only] Returns the last SuperEvent fired after completing an action. (This is useful for reading a property from a SuperEvent after the event has fired and you didn’t have a listner for it yet in your view)
Check out the documentation for more info:
http://www.flashmvc.com/documentation/
no comments
Jun
13
2009
I am very pleased to announce a major update to FlashMVC to version 2.0. This version is a complete rewrite of the original version with better attention to scalability and framework usage. Since this is a dramatic upgrade, I have changed the package name to com.jadbox.flashmvc2. This version scales much higher allowing actions to relay complex messages to the view and built-in code hinting system for the view to execute an action. This is done by a new class called SuperAction. Let me start with the basics:
- action classes – these are normal classes (do not need to extent any classes) that perform an action
- SuperEvent – this class acts like a model for a specific action class, as a constructor proxy for the action class. and as an event for once the action completes.
- SuperModel – This class holds references to SuperActions which, in turn, hold references to SuperEvents and your action classes.
- SuperAction – This class is a controller proxy between your view and the action that it needs to perform. It allows the user to dispatch a SuperEvent that gets used as a model/constructor for your action class.
Benefits from version 1.0:
- The action has its own model/view (SuperEvent) to inform the view
- The SuperModel has fewer global variables as actions have their own dedicated models
- The model (SuperEvent) also mocks the constructor of the action class for code hinting
- Much more readable code for applications made with the framework.
- ActionHelper removed in place of SuperEvent
- If an action doesn’t require a unique SuperModel, you can use the base class SuperEvent or make a SuperEvent that covers multiple action classes (less recommended).
Example running an action:
SuperWebsite.instance.loginAction.dispatchEvent(new LoginEvent("test@test.com));
Example reading an action:
SuperWebsite.instance.loginAction.addEventListener(SuperEvent.COMPLETE, onComplete);
function onComplete(event:SuperLogin) { if(event.isInvalidEmail) trace("email was invalid") };
no comments