Flash actionscript 3.0: how to store the object X&Y values in Array using AS3.0

how to store the object X&Y values in Array using AS3.0

Posted by Sankar.G | Posted in | Posted on 3:51 PM

var objectArray:Array = new Array();
for (var i:uint = 0;i<
Objects.numChildren;i++)
{
var point:Point = new Point(Objects.getChildAt(i).x , Objects.getChildAt(i).y);
objectArray.push(point);
Objects.getChildAt(i).addEventListener(MouseEvent.MOUSE_DOWN, process);
}




reset_btn.addEventListener(MouseEvent.CLICK, resetAll);
function resetAll(event:MouseEvent):void
{
for(i = 0; i<
Objects.numChildren;i++)
{
Objects.getChildAt(i).x = objectArray[i].x;
Objects.getChildAt(i).y = objectArray[i].y;
}
}
put all the objects in one Movie clip and name it as Objects and write this script

Comments (0)