Actually you would need to do new ArrayCollection(compArrayCollection.source.concat());
Also, this won't work if the elements of compArrayCollection are also complex such as other ArrayCollections. You'd have to do a deep copy. Here is a stackoverflow that goes over it. http://stackoverflow.com/questions/7918194/how-can-i-copy-an-arraycollection-of-transfer-objects-in-actionscript Kyle McKnight Senior UI Engineer - Accesso 602.515.1444 (M) On Thu, Sep 29, 2016 at 6:19 AM, Kyle McKnight <[email protected]> wrote: > ArrayCollections are a complex data type meaning they are passed around > by reference. You are actually passing a pointer to the array. The pointer > points to the memory location. You'll have to make a copy of the array. > > Try > > Comps.dataProvider = compArrayCollection.source.concat(); > > Google passing by value and passing by reference to learn the difference > between how simple and complex data types are handled > > On Sep 29, 2016 2:17 AM, "bilbosax" <[email protected]> wrote: > >> Thanks again for the help Justin. Have another question for you regarding >> ArrayCollections. My main app loads an ArrayCollection from a service. I >> then pass it to an ArrayCollection in a component by a simple assignment: >> >> Comps.dataArrayCollection = compArrayCollection; >> >> So I am setting the dataArrayCollection in my Comps component to the >> values >> in my compArrayCollection in the main app. What is weird though is that >> whenever I change any values in the dataArrayCollection, they are also >> changing back in my compArrayCollection back in the main app. I don't >> want >> this to happen, I want their values to be independent of one another once >> the values are passed. Is there any way to make this not happen? >> >> Thanks, >> Bill >> >> >> >> -- >> View this message in context: http://apache-flex-users.23333 >> 46.n4.nabble.com/Rookie-ArrayCollection-Question-tp13649p13662.html >> Sent from the Apache Flex Users mailing list archive at Nabble.com. >> >
