Hello everybody!
I had been trying to output the result of the following code in a predictable sequence of my choice:
var arrAnimal1: Object = new Object();
var arrAnimal2: Object = new Object();
var arrAnimal3: Object = new Object();
arrAnimal1 = { animal: "Cat", sound: "Meows", pet: "Yes" };
arrAnimal2 = { animal: "Dog", sound: "Barks", pet: "Yes" };
arrAnimal3 = { animal: "Lion", sound: "Roars", pet: "No" };
var arrAnimals: Object = new Object();
arrAnimals = [ arrAnimal1, arrAnimal2, arrAnimal3 ];
for (var keyAnimals in arrAnimals)
{
[INDENT]for (var keyAnimal in arrAnimals[keyAnimals])
{
[INDENT]trace (keyAnimal + ": " + arrAnimals[keyAnimals][keyAnimal]);
[/INDENT]}
[/INDENT][INDENT]trace ("
");
[/INDENT]}
The output of the above code appears in a different sequence for every animal, each time.
pet: Yes
sound: Meows
animal: Cat
pet: Yes
sound: Barks
animal: Dog
pet: No
sound: Roars
animal: Lion
How can get the result, in the following sequence, for example:
animal: Cat
sound: Meows
pet: Yes
animal: Dog
sound: Barks
pet: Yes
Looking for the help.