Array reference : Compare « Array « Flash / Flex / ActionScript






Array reference

 


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

        var letters:Array = ["a", "b", "c"];
        
        var newLetters:Array = letters;
             
        trace(letters);        // Displays: "a,b,c"
        trace(newLetters);     // Displays: "a,b,c"
             
        letters = ["d", "e", "f"];
             
        trace(letters);        // Displays: "d,e,f"
        trace(newLetters);     // Displays: "d,e,f" (not "a,b,c")
    }
  }
}

        








Related examples in the same category

1.Create a duplicate copy of an array that is separate from the original using concat( ):
2.Using an equality operator with two array variables only checks to see if they point to the same spot in memory.
3.if two arrays are equivalent yet don't point to the same spot in memory, an equality operation returns false:
4.Loop through each of the elements of the arrays and compare them