Using an Object as a Lookup Key with Dictionaries : Dictionary : Array Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Array » Dictionary »

 

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],")");
    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Array
» Dictionary