1 Reply Latest reply on May 18, 2007 12:38 PM by kglad

    Multidimensional associative array

    panayotisk
      Hi,
      This is my first post in these forums and I greet you all!

      I would like to create a multidimensional associative array so that I can refer to items using two keys i.e.:
      aChessBoard["A"]["5"] = "Knight";
      aChessBoard["A"]["3"] = null;
      aChessBoard["B"]["5"] = "Bishop";

      I have already tried


      but this does not print anything. Any suggestions?
        • 1. Re: Multidimensional associative array
          kglad Adobe Community Professional & MVP
          i'm unable to use the attach code option, but try:

          var _aBoard:Object = new Object();
          _aBoard.A = new Object();

          _aBoard["A"]["1"] = "N";
          _aBoard["A"]["2"] = "o";

          for (var sKey:String in _aBoard) {;
          trace("KEY = "+sKey);
          for (var sKey2:String in _aBoard[sKey]) {;
          trace(" KEY 2 = "+sKey2+"ITEM = "+_aBoard[sKey][sKey2]);
          }
          }