Compose dynamic properties : Array Dimension « Array « Flash / Flex / ActionScript






Compose dynamic properties

 

package{
  import flash.display.Sprite;
  
  public class Main extends Sprite{
    public function Main(){
        var members:Object = new Object();
        members.c1 = "B";
        members.c2 = "D";
        members.c3 = "V";
             
        for (var i:int = 1; i <= 3; i++) {
            trace(members["c" + i]);
        }
    }
  }
}

        








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.You can specify the properties of the object in any order you like
11.Creating an Associative Array
12.Create an associative array by adding properties to object
13.Two ways to add properties to dynamic object
14.Reading Elements of an Associative Array