The Code bellow is a simplified version of what I am trying to do. My actual code involves copying an item from one array to another (which I am able to do). Then displaying the contents of both arrays on the stage.
//blueCircle is a library object with proper linkage set up.
var ball = new blueCircle();
ball.x=100;
ball.y=100;
addChild(ball);
//This is the line that is giving me trouble.
var anotherBall= ball;
anotherBall.x=200;
anotherBall.y=200;
addChild(anotherBall);
When I run this code only 1 ball appears on the stage at (200,200).
Is there another way to assign one value to another so that it will be duplicated rather then just adding a pointer to the original variable? if not is there a way to copy the instance of ball and add it to them memory location of another ball?
I know that I could call:
var anotherBall= new blueCircle();
but this won't work for the application I am writing because the contents of the array I am trying to copy from are all different types of objects.