AOl写了一个DataSet,是将XML转为Objcet后再转DataSet,我发现转Objcet这个步骤Flash花了很长的时间。AOL在注释中也写到考虑直接从XML to DataSet,所以就修改了这个DataSet。将DataSet性能提高了4倍。
public function set Data (value : Object) : Void
{
_data = value;
_tables = new Object ();
DataSetName = _data.nodeName;
var _oldTableName = "";
var nodes = _data.childNodes;
for (var i = 0; i < nodes.length - 1; i ++)
{
var _TableName = nodes [i].nodeName;
if (_oldTableName != _TableName)
{
var _DataTable = new DataTable ();
}
_DataTable.Add (nodes [i]);
this.Tables [_TableName] = _DataTable;
_oldTableName = _TableName;
}
}