Creating a Separate Copy of an variable : Value Reference « Data Type « Flash / Flex / ActionScript






Creating a Separate Copy of an variable

 


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

        var quantity:int = 5;
        
        var newQuantity:int = quantity;
        
        quantity = 29;
             
        trace(quantity);        // Displays: 29
        trace(newQuantity);     // Displays: 5

    }
  }
}

        








Related examples in the same category