Mega Code Archive

 
Categories / Flash ActionScript / Array
 

Iterate through the key-value pairs of an object with the for in and for each in loops

package{   import flash.display.Sprite;      public class Main extends Sprite{     public function Main(){         var notes:Object = {t: 2, g: 14, s: 9};         for (var name:String in notes)         {             trace("Notes on " + name + ": " + notes[name]);         }     }   } }