使用拼接的属性来访问Object
1.VO:Objectt有这些属性:
public var avatarId1:int;
public var avatarId2:int;
public var avatarId3:int;
public var avatarId4:int;
public var avatarId5:int;
public var avatarId6:int;
public var avatarId7:int;
public var avatarId8:int;
public var avatarId9:int;
public var avatarId10:int;
2.可以这样访问:
var avatarList:Array = [];
for(var i:int = 1; i <= 10; i++){
if(vo["avatarId" + i] != undefined && vo["avatarId" + i] != 0){
avatarList.push({"slot":i, "itemId":vo["avatarId" + i]});
}
}