Working with Associative Arrays : Dictionary « Array « Flash / Flex / ActionScript






Working with Associative Arrays

 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        var lotto:Array = new Array(12, 30, 42, 6, 29, 75);
        lotto.description = "This week's lotto picks.";
        trace(lotto[3]); // Displays: 6
        trace(lotto["description"]); // Displays: This week's lotto picks.

    }
  }
}

        








Related examples in the same category

1.Using an Object as a Lookup Key with Dictionaries
2.When using delete on an item in an Array, the length property is not updated.
3.Iterate through the key-value pairs of an object with the for..in and for each..in loops.