Use a dictionary when you want to store items that you need to reference with unique identifier keys. Arrays keep items in the order in which you put the items into the array, while dictionaries don’t guarantee any order at all. However, you can access each item based on the key that you provided when the item was originally added to the dictionary.
To create a new dictionary, you will need to specify both the data type for the key and the data type for the value (see Listing 21-1).
Listing 21-1. Declaring Dictionaries
var d1:Dictionary<String, Int>