Code: Select all
object.str = event.target.data.Str;
object.dex = event.target.data.Dex;
object.vit = event.target.data.Vit;
object.mag = event.target.data.Mag;
object.x = event.target.data.X;
object.y = event.target.data.Y;
var playerskillids:Array = event.target.data.SkillIDs.split (",");
var playerskillexps:Array = event.target.data.SkillExps.split (",");
var playerskilllevels:Array = event.target.data.SkillLevels.split (",");
playerskillids.splice (0, 1);
playerskillexps.splice (0, 1);
playerskilllevels.splice (0, 1);
object.playerskillids = playerskillids;
object.playerskillexps = playerskillexps;
object.playerskilllevels = playerskilllevels;
Code: Select all
var xml:XML = new XML (event.target.data);
var xmllist:XMLList = xml.weapon;
var weaponstats:Array = new Array ();
for each (var weapon:XML in xmllist) {
weaponstats.push ({id:weapon.id, name:weapon.name, type:weapon.type, level:weapon.level, min:weapon.min, max:weapon.max});
}
object.weaponstats = weaponstats;
Then I load an XML and create an object with the values and push it into an array and set that array into my first object. Pretty much the same as the arrays in the first code except this array has objects as elements.
After I sent the object using the server method another class receives it and all the values, including the 3 arrays with the player skill info, are correct, except the XML array. When I trace the array it shows just 2 commas, so 3 elements. When I trace the length of the array it returns 3. When I trace each element's values like the id and name and level it returns undefined. So it still has the proper length but what happened to the values?