Tuesday, July 12, 2011

convert Xml To ArrayCollection in flex

here datafield is your xml tag

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 );

Saturday, July 2, 2011

serach index in flex

private function removeBracket(strNo:String):Number
var reg:RegExp = new RegExp("[\(]","i");
var int_no:int = strNo.search(reg);
var retNo:Number;
if (int_no >= 0)
strNo = strNo.replace("(","");
strNo = strNo.replace(")","");
strNo = strNo.replace(",","");
retNo = Number(strNo);
// do some thing
return retNo;

Tuesday, July 21, 2009

Best Links for Cairngorm Architecture

To learn cairngorm architecture these links are very helpful please read ones.
Very easy Step 1
Very easy Step 2

Sunday, June 14, 2009


Introduction to cairngorm:-Cairngorm is based on the MVC Model. It is specifically designed to facilitate complex state and data synchronization between the client and the server, while keeping the programming of the View layer detached from the data implementation.
The role of the View layer in a Cairngorm application is to throw events and bind to data stored in the Model. Components on the View can bind to Value Objects or other properties in the Model (data) layer.
In a Cairngorm Model, related data are stored in Value Objects (VOs), while simple variables can be stored as direct properties of the ModelLocator class. A static reference to the ModelLocator singleton instance is used by the View layers to locate the required data.
The Controller is the most sophisticated part of the Cairngorm architecture. The Controller layer is implemented as a singleton Front Controller. The FrontController instance, which receives every View-generated event, dispatches the events to the assigned Command class based on the event's declared type.
The Command class then processes the event by running the Command class' execute() method, which is an ICommand interface method. The event object may include additional data Like VO objects. The execute() method can update the central Model, as well as invoke a Service class which typically involves communication with a remote server. The IResponder interface, which is also implemented by the Command class, includes onResult and onFault methods to handle responses returned from the invoked remote service.