I\'ve been trying to get JSON working with AS3 for a while now, but to no avail. I keep getting the following error when I get the JSON back:
TypeError: Error #1034
You were correct when you had the jsonData
variable as an Object
. To iterate through all the properties of that variable you could just do something like this:
var jsonData:Object = JSON.decode(loader.data);
for (var i:String in jsonData)
{
trace(i + ": " + jsonData[i]);
}
If you wanted to check if the object contained a specific property you could use something like:
var hasFooProperty:Boolean = jsonData.hasOwnProperty("fooProperty");