You can specify the properties of the object in any order you like : Array Dimension « Array « Flash / Flex / ActionScript

Home
Flash / Flex / ActionScript
1.Animation
2.Array
3.Class
4.Data Type
5.Development
6.Function
7.Graphics
8.Language
9.Network
10.Regular Expressions
11.Statement
12.String
13.TextField
14.XML
Flash / Flex / ActionScript » Array » Array Dimension 




You can specify the properties of the object in any order you like
 

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

        var cars:Array = new Array();
        
        cars.push({make: "H",    year: 1997, color: "maroon"});
        cars.push({make: "Chrysler", year: 2000, color: "beige"});
        cars.push({make: "Mercedes", year: 1985, color: "blue"});
        cars.push({make: "Fiat",     year: 1983, color: "gray"});
             
        for (var i:int 0; i < cars.length; i++) {
            trace("A " + cars[i].color + " " 
                         cars[i].year + " " 
                         cars[i].make);
        }

    }
  }
}
A maroon 1997 H
A beige 2000 Chrysler
A blue 1985 Mercedes
A gray 1983 Fiat

        














Related examples in the same category
1.Working with Single-Dimension Arrays
2.Multidimensional Arrays
3.Create a single array in which each element is a string containing both pieces of data, separated by a delimiter such as a colon (:)
4.The idea behind parallel arrays is to create two (or more) arrays in which the elements with the same indices are related.
5.Working with Multidimensional Arrays
6.With multidimensional arrays, concat( ) or slice( ) only duplicates the top level of the array
7.Storing Complex or Multidimensional Data
8.Working with multiple sets of data: create a multidimensional array
9.Use nested for loop to deal with multiple sets of data
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
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.