数组中满足条件的项 保存到另一个数组中 并移除

            var str:String = '[{"nCoins":"2000000","nLevel":1,"nPos":-1,"nickname":"guorui","username":"g858443101"},{"nCoins":"2000000","nLevel":1,"nPos":-1,"nickname":"guorui","username":"g858443101"},{"nCoins":"2000000","nLevel":1,"nPos":-1,"nickname":"guorui","username":"g858443101"},{"nCoins":"2000000","nLevel":1,"nPos":-1,"nickname":"guorui","username":"g858443101"},{"nCoins":"2000000","nLevel":1,"nPos":-1,"nickname":"guorui","username":"g858443101"},{"nCoins":"2000000","nLevel":1,"nPos":-1,"nickname":"guorui","username":"g858443101"},{"nCoins":"2000000","nLevel":1,"nPos":-1,"nickname":"guorui","username":"g858443101"},{"nCoins":"2000000","nLevel":1,"nPos":-1,"nickname":"guorui","username":"g858443101"},{"nCoins":"2000000","nLevel":1,"nPos":-1,"nickname":"guorui","username":"g858443101"},{"nCoins":"2000000","nLevel":1,"nPos":-1,"nickname":"guorui","username":"g858443101"}]';

            //var str:String = bytes.readUTFBytes(bytes.bytesAvailable);

            var obj:Array = OLDJSON.decode(str, false);

            ObjectUtils.copyValues(obj,RoomPeopleInfo,GameDataMap.roomPeopleInfo);

            GameInfo.instance.roomPeopleList = obj;

            

            for(var i:int = GameInfo.instance.roomPeopleList.length-1; i > -1; i--)

            {

                if (GameInfo.instance.roomPeopleList[i].nPos!=-1)

                {

                    GameInfo.instance.seatPeopleList.push(GameInfo.instance.roomPeopleList[i]);

                    GameInfo.instance.roomPeopleList.splice(i, 1);

                }

            }

            

 

你可能感兴趣的:(数组)