Показать сообщение отдельно
Старый 13.06.2010, 20:33
rainbowrussia вне форума Посмотреть профиль Отправить личное сообщение для rainbowrussia Найти все сообщения от rainbowrussia
  № 2  
Ответить с цитированием
rainbowrussia
 
Аватар для rainbowrussia

Регистрация: Feb 2008
Сообщений: 560
Бюджет?

В первом приближении смотрите вложение.

Код:

Код AS1/AS2:
mc.onPress = function () {
	var xm0 = this._parent._xmouse;
	var ym0 = this._parent._ymouse;
	var xm = this._xmouse;
	var ym = this._ymouse;
	this._x = xm0;
	this._y = ym0;
	this.img._x += -xm;
	this.img._y += -ym;
	this.oldax = this._parent._xmouse;
	this.olday = this._parent._ymouse;
	this.basea = 180/Math.PI * Math.atan2(-this.img._y - this.img._height/2, -this.img._x - this.img._width/2);
	this.cang = this._rotation;
	this.onMouseMove = function () {
		var ang = 180/Math.PI * Math.atan2((this._parent._ymouse - this.olday), (this._parent._xmouse - this.oldax)) - this.basea;
 
		if (Math.abs(ang + 360 - this._rotation) < Math.abs(ang - this._rotation)) {
			ang += 360;
		}
		if (Math.abs(ang - 360 - this._rotation) < Math.abs(ang - this._rotation)) {
			ang -= 360;
		}
 
		this.oldax = this._parent._xmouse;
		this.olday = this._parent._ymouse;
		var cang = this._rotation;
		var dir = (ang - cang)/20;
		var angle = cang + dir;
		this._rotation = angle;
 
		this._x = this._parent._xmouse;
		this._y = this._parent._ymouse;
	}
}
 
mc.onRelease = mc.onReleaseOutside = function () {
	delete mc.onMouseMove;
}
Вложения
Тип файла: rar move.rar (307.0 Кб, 89 просмотров)