Skip navigation
Currently Being Moderated

New arrayCollection not by reference

May 1, 2013 1:12 PM

I know I can make a copy of an ArrayCollection with ObjectUtil.copy  or  writing byte array and registering the type. But what happens if you take the source of an existing ArrayCollection, the Array itself, and create a new array? Is it unreferenced to the original ArrayCollection.


In code,


var myArrayCollection:ArrayCollection. // passed in value

var myNewArrayCollection = new ArrayCollection(myArrayCollection.source);


Is my original arrayCollection still affected by changes in myNewArrayCollection, like using filterfunctions?

  • Currently Being Moderated
    May 1, 2013 1:58 PM   in reply to John Hall

    You will have a new ArrayCollection , but changes to the underlying Array will affect both Array collections.


    The Array won't be copied when the ArrayCollection is constructed.


    The Array is not passed by value - it is a pointer to an Array, not the Array itself.


    Filter functions belong to the Array collection, so the Array collections will be independently filtered (filtering the same data in differrent ways).

    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points