
Код:
onClipEvent(mouseDown) {
// get mouse location
mx = _root._xmouse;
my = _root._ymouse;
// loop through pieces looking for hit
piece = _root[x+"-"+y];
// see whether the piece is under the cursor
// and if it has not yet been placed
if (piece.hitTest(mx,my) and (piece._alpha < 100)) {
// this is the piece clicked
piece.startDrag();
}
}
onClipEvent(mouseUp) {
// stop piece from moving
stopDrag();
// get distance from center of piece
// to center of outline
dx = _root.outline._x - piece._x;
dy = _root.outline._y - piece._y;
dist = Math.sqrt(dx*dx+dy*dy);
// if close enough, then set it in place
if (dist < 10 ) {
piece._x = _root.outline._x;
piece._y = _root.outline._y;
// set to full color
piece._alpha = 100;
}
}
Вроде ошибок нет, а картинка даже не двигается, целую неделю мучался перед тем как суда написать, уже нет сил помогите.