One thing that Claire can simplify for a developer is creating Flex or Adobe Air applications using MVC design patterns. Claire’s approach to MVC is based on a simplified Cairngorm architecture. It is not intended to be a replacement for the popular Cairngorm architecture or the many quality MVC options programmers have available to them, it is however a very flexible approach and allows the developer to use as little or as much of the library as they see fit.
ViewModel and ViewController
The main functionality behind the MVC approach in Claire is provided by the Singleton class claire.model.ViewModel and the component claire.controller.ViewController. The ViewModel defines the
ViewController should be placed in your main application MXML file along with a ViewStack. The ViewController dispatches an event called ‘mainViewChange‘ every time the ‘currentView‘ property is updated in claire.model.ViewModel.
You’re main MXML file should contain a function which handles the event ‘mainViewChange‘ and changes the ‘selectedIndex‘ property of your ViewStack.
Because claire.model.ViewModel is a singleton class you can change the currentView at any time.
0 Responses
Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.