7 Replies Latest reply on May 27, 2010 12:52 PM by GordonSmith

    Inline Associative Array Declaration?

    Miggl Level 1

      I would like to declare an associative array with the keys based on constants using inline method.


      The documentation shows inline associative array declarations like so:


      var assocArray:Array = {key:"value", key2:"value2", key3:"value3"};


      the problem here is that the following doesn't work:

      var assocArray:Array = {this.const1:"value", this.const2:"value2", this.const3:"value3"};


      To work around this I have had to do the following so far:

      var assocArray:Array = new Array();

      assocArray[this.const1] = "value";

      assocArray[this.const2] = "value2";

      assocArray[this.const3] = "value3";


      How can this be accomplished inline?