this will work for just one level of depth. i mean, if your item has a reference to another object in the model, you will just clone the item not the object so you will have two items referencing the same object.
i had this issue and developed a system for this. All my object can be serialized to xml and deserialized from xml. by the way xml generation process is recursive.(when an item's toXML method is called it also calls it's children' toXML methods) this give 100% copy. it may be seemed a bit hard, you may start with learning XSD (xml schema definition) by the way, i just realized that the same recursive approach can be applied using byteArrays. Stephen Allison wrote On 02/04/2008 01:38 PM: > > > In my application I am using ArrayCollections to store data for series > > on a line chart. I need to be able to make a deep copy of these > > ArrayCollections so that I can make changes to the data in the copies > > without affecting the original data. > > IIRC you can write the whole lot into a ByteArray, which serialises it as > AMF in memory, and then read it back out again. Classes in your array > need > [RemoteClass] in order to get correctly typed objects back. > > ie. > var ba:ByteArray = new ByteArray(); > ba.writeObject(yourData); > var newCopy = ba.readObject(); > > Stephen > >

