This content has been marked as final. Show 4 replies
I'm a bit confused by your terminology. I think maybe you want to copy or clone an object?
"This method is designed for copying data objects, such as elements of a collection. It is not intended for copying a UIComponent object, such as a TextInput control. If you want to create copies of specific UIComponent objects, you can create a subclass of the component and implement a clone() method, or other method to perform the copy."
thanks for the reply dazweeja. i intentionally did not use words like "clone" or "copy", because i wanted to keep it more general. i read about the function you quoted and tbh it was what kind of caused my question.
Yes i basically want to copy and object and i wanted to confirm my understanding that if you assign an object (e.g. myHBox1 = myOldHBox) you always assign not only the value but a reference to the object. If you do something like "myHBox2 = myOldHBox" afterwards, it will cause an error when "myHBox1" is used again, because it will basically be empty.
Now talking of the quote you posted. If i have a custom class that is e.g. a HBox with some VBoxes in it and maybe a Grid and a Chart. How do i copy this? Even if I recursively go down into sub objects, every time I assign a value again i will run into the same problem, won't I?
It's all really confusing for me, because I can't put my finger on the point where assigning a value will not cause an error.
Yes, I see - not as easy as it sounds. I haven't tried this but maybe you could try writing the object into a ByteArray and then returning the new object?
var myBA:ByteArray = new ByteArray();
myBA.position = 0;
thanks dazweeja, i appreciate your help. in fact that last post sounds kinda interresting.
i wonder why something like that isn't implemented by Adobe.