If you're getting your result as XML data from flex, I'm guessing you're using and HTTPService that gets the xml, so you access the data in the result property of a ResultEvent.
e.g.
private function resultHandler(e:ResultEvent):void{}
You would get your data:
private function resultHandler(e:ResultEvent):void{
var tempCollection:ArrayCollection = new ArrayCollection();
tempCollection = e.result.someDataObject as ArrayCollection;
}
and this would the place you would set the data you get from xml into VO's
private function resultHandler(e:ResultEvent):void{
var tempCollection:ArrayCollection = new ArrayCollection();
tempCollection = e.result.someDataNode as ArrayCollection;
for each(var item:Object in tempCollection){
var myVO:VO = new Image();
myVO.firstProperty = item.firstProperty;
myVO.secondProperty = item.secondProperty;
myVOCollection.addItem(myVO);
}
}
The idea is simple...a VO is just a custom Object: a class you create extends Object and has the purpose to store values from an external data source( e.g. you xml result ). Since you're using a custom class that is faster than using a dynamic class and it helps a lot when reading the code and debugging( you get data type checking and all that).
They can be anything: products in a store, photos in a gallery, etc.
In the example I assumed someDataNode is a node in you xml and, myVOCollection, an ArrayCollection for your data and so on.
so a VO in this case you be something like:
package{
class VO{
private var _firstProperty:String;
private var _secondProperty:String;
public function VO(firstProp:String=null,secondProp:String=null){
_firstProperty = firstProp;
_secondProperty = secondProperty;
}
public function get firstProperty():String{
return _firstProperty;
}
public function set firstProperty(value:String):void{
_firstProperty = value;
}
public function get secondProperty():String{
return _secondProperty;
}
public function set secondProperty(value:String):void{
_secondProperty = value;
}
}
}
Your Model class would probably manage loading and parsing of data, and once that is done it will dispatch an event to let the application know the data requested is available.
In as few words as possible a valueobject in flex would be an actionscipt class that represents an item of data. Using one means mapping a generic object ( that comes in from an external source) to its actionscript representation.
Nothing fancy.
Hope it helps.