var Square01:Squares = createNewObject(50, 50);
var square02:Squares = createNewObject(150, 150);
var square03:Squares = createNewObject(300, 300);
function createNewObject(xValue, yValue):Squares {
var newObject:Squares = new Squares();
newObject.x = xValue;
newObject.y = yValue;
addChild(newObject);
addEventListener(MouseEvent.MOUSE_DOWN, moveObject);
return newObject;
}
function moveObject(newObject){
this.x += 10;
}
basically this little program works but my question is how can I reference the newObject var in moveObject from the createNewObject function?
Right now what it does is move the stage when I click on an object that is created.