It supports multiple controllers in a single application. So modules can have their own controllers. It is based on event bubbling.

You can register the event and the handlers either in MXML  or in a class by extending the controller in the framework. The event and the handlers are provided to the controller as an instance of the EventMap class.

The details of these classes :-

The controller

com.fmvc.controller.FController

It registers the events and the corresponding handlers. When the event is fired the class in which the handler method exists is instantiated and the handler method is executed. There can be multiple handlers in one class. While registering the events the className, methodName and the eventName are to be given.

For registering the events either MXML or AS can be used. A reference of the component to which the controller is added is to be provided as the value of the property base when the controller is initiated. This is for adding a different controllers  for modules or a set of components. By default is will point to the main application.

Event

com.fmvc.event.FlowEvent

The event which is to be dispatched for handling in the controller. This event bubbles always and that is how it reaches the controller. 

Handlers

The event handlers will be defined in the classes (like the command classes in Cairngorm) in the application. There can be multiple methods in a single class.

The name of the method will be registered in the controller. The handler class should implement the interface  

com.fmvc.controller.IEventHandler

I am also putting an example for the same which has one module application.

[kml_flashembed publishmethod="dynamic" fversion="10.0.r2" replaceId="FrameworkTest" movie="http://www.flex4all.com/blog/wp-content/uploads/frameworkTest.swf" width="100%" height="450" targetclass="flashmovie"]

Get Adobe Flash player

[/kml_flashembed]

I am also attaching the source  code. 

 Click Here

Do let your comments for the same

 - Manoj Mathew

Share This
  • Print
  • LinkedIn
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Technorati
  • email
  • Live
  • MySpace
  • StumbleUpon
  • Yahoo! Bookmarks

No comments so far

Leave a comment