Multidimensional Arrays : Array Dimension « Array « Flash / Flex / ActionScript






Multidimensional Arrays

 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){

        var row1:Array = [6, 2.99];   // Quantity 6, Price 2.99
        var row2:Array = [4, 9.99];   // Quantity 4, Price 9.99
        var row3:Array = [1, 59.99];  // Quantity 1, Price 59.99
        var spreadsheet:Array = [row1, row2, row3];
        
        for (var i:int = 0; i < spreadsheet.length; i++) {
          trace(spreadsheet[i][0]);
        }
    }
  }
}

        








Related examples in the same category

1.Working with Single-Dimension Arrays
2.Create a single array in which each element is a string containing both pieces of data, separated by a delimiter such as a colon (:)
3.The idea behind parallel arrays is to create two (or more) arrays in which the elements with the same indices are related.
4.Working with Multidimensional Arrays
5.With multidimensional arrays, concat( ) or slice( ) only duplicates the top level of the array
6.Storing Complex or Multidimensional Data
7.Working with multiple sets of data: create a multidimensional array
8.Use nested for loop to deal with multiple sets of data
9.You can specify the properties of the object in any order you like
10.Creating an Associative Array
11.Create an associative array by adding properties to object
12.Compose dynamic properties
13.Two ways to add properties to dynamic object
14.Reading Elements of an Associative Array