If you want to create a copy of the array, you can create a new array and use a for statement to copy each item from arrayA to arrayB : Copy : Array Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Array » Copy »

 

If you want to create a copy of the array, you can create a new array and use a for statement to copy each item from arrayA to arrayB


 

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

        var arrayA:Array = new Array("a""b""c""d");
        var arrayB:Array = new Array();
        for(var i:int 0; i < arrayA.length; i++) {
            arrayB[i= arrayA[i];
        }
        arrayB.push("e""f""g""h");
        trace(arrayA.length)// Outputs 4
        trace(arrayB.length)// Outputs 8

    }
  }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Array
» Copy