Posted By

badabam on 02/10/09


Tagged

actionscript as array duplicate clone Flex as3


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

tspitzr


Clone array (AS3)


 / Published in: ActionScript 3
 

URL: http://www.badabam.de

  1. var a:Array = [1, 2, 3, 4, 5];
  2. var b:Array;
  3.  
  4. //clone a:
  5. b = a.map(function(e:*, ...r):*{ return e });
  6.  
  7.  
  8. /*
  9. "...r" is a "rest" and stands for the two more arguments, the function in map(f:Function, target:Object = null) needs.
  10.  
  11. Full function would be: function (element:*, index:int, array:Array):*{return e};
  12. */

Report this snippet  

You need to login to post a comment.