I need to have an instance of one common object in every other object, I have. I am doing modifications on the values of this object in every sub object I have.
For example. I have a map of tiles, and a bot moving over them in specific order. Each bot is marking tiles, which was already visited by him, as visited=true. But in general I don’t want main map to be changed…
I’ve tried to set up an example:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
applicationComplete="complete()">
<mx:Script>
<![CDATA[
private var array:Array = new Array( 1, 2, 3, 4);
public function complete():void
{
trace("here " + array);
var a:Array = array;
a[0] = 100;
trace("here " + array);
}
]]>
</mx:Script>
</mx:Application>
Can somebody help me to understand how do I copy for example the array, by value, (not by reference)
edit:
Might contain some syntax errors…