Array Function's


/ Published in: ActionScript 3
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function insertIntoArray( array:Array, itm, at:uint ):void
  2. {
  3. var i:uint = 2
  4. var b:Array = array.slice( 0, at );
  5. var c:Array = array.slice( at );
  6. b.push( itm );
  7. a = b.concat(c);
  8. }
  9. //test
  10. var a:Array = new Array( 0,1,2,3,5,6,7);
  11.  
  12. insertIntoArray( a, 4, 4 );
  13. trace( a );

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.