Groups | Blog | Home
all groups > flash actionscript > october 2006 >

flash actionscript : instance of myClass


Kosssakossakossa
10/30/2006 8:26:56 PM
I need to make an instance of a dynamic class called myClass by setting a
variable to "new myClass()" and then making a copy of that variable. The thing
is that when I do this the variables in myClass seems to be static and changing
a variable value in the copy changes that variable value in the original and
vice versa. The code below describes it better. The trace should return "Hello
world" but returns "world world". What have I missed? :)


var Test = new Array();
var InstanceOfTest = new Array();

Test[0] = new myClass();
Test[0].Name = "Hello";

InstanceOfTest[0] = Test[0];
InstanceOfTest.Name = "world";

trace(Test[0]+" "+InstanceOfTest[0]);
LuigiL
10/31/2006 12:00:00 AM
AddThis Social Bookmark Button