Flash Components      Flash Menu      Flash Gallery      Flash Slideshow      FLV Player      Flash Form      MP3 Player      PhotoFlow      Flash CMS      3D Wall      Flash Scroller

Flash / AS

Silverlight

WPF

ASP.net / PHP

Photoshop

Forums

Blog

About

 


FlashComponents
  Galleries
  Slideshows
  Menus
  Design & Effects
  Audio & Video
  User Interface
  Templates

 

 

 

 

 
Array Duplication Made Easy
       by ilyas usal

To make a duplicate of an array proves more difficult than it seems. For instance, if you try this piece of code:

It will return:

a=1,2
b=1,2

Even though you've applied the method Array.pop on a only. b is a reference to a, an alias if you prefer, not a copy, and modifying a will modify b.

So here's the little trick that solves the problem. All you have to do is use the Array.splice method (Array.concat or Array.join will work too), with no parameter to keep the whole array.

Hope this helps. Thanks to senocular and jbradley who helped contribute to this.

 

 

Hope this tutorial helped. If you have any questions, please post them on the forums at //www.kirupa.com/forum/

 

kirupa.com's fast and reliable hosting provided by Media Temple. flash components
The Text Animation Component for Flash CS3
Check out the great, high-quality flash extensions. Buy or sell stock flash, video, audio and fonts for as little as 50 cents at FlashDen.
Check out our high quality vector-based design packs! Flash Effect Components
flash menus, buttons and components Digicrafts Components
The best flash components ever! Entheos Flash Website Templates
Upload, publish, deliver. Secure hosting for your professional or academic video, presentations & more. Screencast.com Purchase & Download Flash Components
flash components Free Website | Make a Website
Streamsolutions Content Delivery Networks Learn how to advertise on kirupa.com