The second function is using attachMovie to build your screen elements. You set how many elements you wanted in the variable _root.howmany now you are looping through that many times to place your targets and objects on the screen at the X Y coordinates you specified in your first function.
function placement() {
for (i = 0; i <_root.howmany; i ++) {
this._parent.attachMovie("target", "t" + i, i);
this._parent.attachMovie("object", "o" + i, i + _root.howmany);
_root["t" + i]._x = _root.targetX; setting the X placement of your target
_root["t" + i]._y = _root.targetY; setting the Y placement of your target
_root["o" + i]._x = _root.objectX; setting the X placement of your object
_root["o" + i]._y =_root.objectY; setting the Y placement of your object
The next 2 functions work together to build the arrays that hold the actual X Y positions of you targets and your objects. These arrays are used to place the objects back into position.
function x_y(my_x,my_y) {
this.my_x = my_x;
this.my_y = my_y;
}
function setcoords() {
for (var i = 0; i <_root.howmany; i++ ) {
target_array[i] = new x_y (getProperty (_root["t" + i],_x),getProperty (_root["t" + i],_y));
object_array[i] = new x_y (getProperty (_root["o" + i],_x),getProperty (_root["o" + i],_y));
cover[i] = 0
<%brk%>