从数组集合创建值对象、类或接口,确保属性名称相同,并为其创建相关的访问器
public class DataObject
{
protected var _classDescription:String;
public function get classDescription():String
{
return _classDescription;
}
public function set classDescription(value:String):void
{
_classDescription = value;
}
}
从ArrayCollection检索对象时,可以循环遍历对象的属性以将它们指定给值对象
var dataObj:DataObject = new DataObject();
for each ( var prop:String in collectionObject )
if( dataObj.hasOwnProperty(prop) )
dataObj[prop] = collectionObject[prop] ;
private function mouseClickHandler(event:MouseEvent ):void
{
var target:YourValueObject = event.currentTarget as YourValueObject;
trace ( target.classDescription );
}