Search code examples
arraysflash

Flash trace,dump,print Array variables


is there a way to trace an ARRAY in FLASH.

I want to have an output similar to PHPs command:print_r(myArray)

for ex: (in flash):

var event:Array = new Array();
event['name']='david';
trace(event);  // that display anything

while print_r(event) in PHP would display as string:

Array {
['name'] => david,
}

I want to achieve same kind of result in flash.


Solution

  • trace(array.join()); would work for numerically indexed arrays. For associative arrays, you have to use for..in construct.

    for(var t:Object in array)
      trace(t + " : " + array[t]);