Posted by Sankar.G | Posted in AS3 | 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
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)
Post a Comment