I am very pleased to announce a major update to FlashMVC to version 2.0 with its OWN website at www.flashmvc.com! 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
  • Using the framework with Flash is the same exact flow you would use with Flex (or Flash Builder)
  • 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") };

Head over to www.flashmvc.com and check it out!


Author: Jonathan Dunlap
Jonathan is an experienced software engineer, sole blogger of JADBOX, author of FlashMVC, humanitarian, and has contracted work for Microsoft, Coke, and Disney.
Share and Enjoy:
  • Digg
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • email
  • Furl
  • LinkedIn
  • Pownce
  • Reddit
  • StumbleUpon
  • TwitThis
Auto-Generated Related Posts:
  1. FlashMVC 2.01 update released...
  2. FlashMVC Update: addResultListeners...