Have you ever wanted to take an XML or generic Object and use it in your application as a typed ActionScript object?
If so, the typical approach requires the developer to create custom factories in your BDs (Business Delegate, assuming you’re using Cairngorm) or directly in the BD or in each Command (I hope not) for each property within the response XML -- the following example assumes you're a Responder object's result method:
function result(response:Object):void
{
var responseXML:XML;
var myResponse:MyResponse;
item:XMLList;
responseXML = XML(response);
myResponse = new MyResponse();
myResponse.objFoo = String(responseXML.@objFoo); // for XML attrs
myResponse.objBar = Number(responseXML.objBar); // for XML nodes
// for XML nodes that you need a Boolean from
myResponse.objBarA = (responseXML.objBarA == "true") ? true : false;
// looping through a list of nodes and create an array or
for each(item in myResponse.items)
{
myResponse.items.addItem(item);
}
//now that you have the data you need, do something
}...something like that where you map each property that you need to use in AS to a nodeValue or attribute in your XML...and that’s tedious, time-consuming, and just a pain. However, if you used the VOfactory, you could create an AS class representing your response object (as in the above and below examples with MyResponse) and then let the VOFactory do the mappings for you:
function result(response:Object):void
{
var responseXML:XML;
var myResponse:MyResponse;
// use the vo factory to map untyped objects to typed AS classes
response = this.voFactory.create(responseXML, MyResponse) as MyResponse;
//now that you have the data you need, do something
}The Visual VOFactory Explorer illustrates the capabilities best.