Tuesday, July 12, 2011

convert Xml To ArrayCollection using flex

public static function convertXmlToArrayCollection( file:String, datafield:String ):ArrayCollection
{
var xml:XMLDocument = new XMLDocument( file );

var decoder:SimpleXMLDecoder = new SimpleXMLDecoder();
var data:Object = decoder.decodeXML( xml );
var array:Array = ArrayUtil.toArray( data[datafield] );
return new ArrayCollection( array );
}

Wednesday, December 23, 2009

Learn pure MVC

The Model, View and Controller application tiers are represented by three Singletons (a class where only one instance may be created).

The MVC Singletons maintain named caches of Proxies, Mediators and Commands, respectively. The Façade, also a Singleton, provides a single interface for communications throughout the application. These four Singletons are referred to as the Core Actors.

* Data objects, be they local or remote, are managed by Proxies.
* The View Components that make up the User Interface are managed by Mediators.
* Commands may interact with Proxies, Mediators, as well as trigger or execute other Commands.

All actors discover and communicate with each other via the Façade, rather than work directly with Model, View and Controller.