Показать сообщение отдельно
Старый 02.04.2007, 06:36
Pon вне форума Посмотреть профиль Отправить личное сообщение для Pon Найти все сообщения от Pon
  № 1  
Ответить с цитированием
Pon

Регистрация: Nov 2006
Сообщений: 11
По умолчанию сделал пазл по примеру, а он не работает

Код:
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;
	}
}
Вроде ошибок нет, а картинка даже не двигается, целую неделю мучался перед тем как суда написать, уже нет сил помогите.
Вложения
Тип файла: rar mona.rar (46.0 Кб, 67 просмотров)


Последний раз редактировалось etc; 02.04.2007 в 12:54.