
Код:
function getR(mc){
return {
x:Math.round(mc._x + Math.random() * mc._width),
y:Math.round(mc._y + Math.random() * mc._height)
}
}
function placeRandom(obl, z){
var r = getR(obl);
while(!obl.hitTest(r.x, r.y, true)) r = getR(obl);
z._x = r.x;
z._y = r.y;
}
//Вызов:
var t = setIntarval(placeRandom, 1000, mcOblast, mcZ);