Using an Object as a Lookup Key with Dictionaries
package{
import flash.display.Sprite;
import flash.utils.*
public class Main extends Sprite{
public function Main(){
var notes:Dictionary = new Dictionary();
var city:String = "New York City";
var currentConditions:String = "light showers";
var currentTemp:Number = 56;
notes[city] = "Central Park";
notes[currentTemp] = "20";
notes[currentConditions] = "70% chance of precipitation";
trace("Current Weather for", city, notes[city]);
trace("Current Temperature :", currentTemp, "degrees", notes[currentTemp]);
trace("Current Conditions :", currentConditions, "(", notes[currentConditions],")");
}
}
}
Related examples in the same category