This content has been marked as final. Show 4 replies
I don't know what version of Actionscript you are using, but that isn't the case with my version.
trace(b); // traces 50
Show your code.
Rothrock You answer, in ActionScript 3 is not work!
in ActionScript 3
The following example builds on the previous example by creating a variable named merkur (the German word for mercury) and assigning it the value of mercury. This creates two variables that reference the same object in memory, which means you can use either variable to access the object's properties. You can then change the diameter property to use kilometers instead of miles:
var merkur:Object = mercury;
merkur.diameter = 4878; // in kilometers
trace(mercury.diameter); // 4878
Okay, that is different that what you said before. The code you have provided here only generates errors. But I think I see what you are having an issue with.
In AS3, pretty much everything is assigned by reference. So the answer is to not use the direct assignment operator. Instead you need to copy each element to the new object. Other classes provide clone() methods and there are some tricks like Array.slice();
In general I haven't needed to copy objects much what are your trying to do?
Thankyou vary Much!