Показать сообщение отдельно
Старый 27.06.2005, 16:45
Штрек вне форума Посмотреть профиль Отправить личное сообщение для Штрек Найти все сообщения от Штрек
  № 3  
Ответить с цитированием
Штрек

Регистрация: Dec 2002
Адрес: Сочи
Сообщений: 2,819
Не помню чей прототип /может Ива..../.
Взять и бросить.....

Код:
MovieClip.prototype.mouser = function() {
        var lastX = xDest=this._x;
        var lastY = yDest=this._y;
        var friction = 5;
        this.onMouseDown = function() {
                if (this.hitTest(_root._xmouse, _root._ymouse, true)) {
                        this.startDrag();
                        dragging = true;
                }
        };
        this.onMouseUp = function() {
                stopDrag();
                if (dragging) {
                        dropped = true;
                        xDir == "plus" ? xDest=_x+(xVel*friction) : xDest=_x-(xVel*friction);
                        yDir == "plus" ? yDest=_y+(yVel*friction) : yDest=_y-(yVel*friction);
                        dragging = false;
                }
        };
        xVel = Math.abs(_x-lastX);
        yVel = Math.abs(_y-lastY);
        _x>=lastX ? xDir="plus" : xDir="minus";
        _y>=lastY ? yDir="plus" : yDir="minus";
        lastX = _x;
        lastY = _y;
        if (dropped == true) {
                if (Math.abs(_x-xDest)>0.1 && Math.abs(_y-yDest)>0.1) {
                        _x += (xDest-_x)/5;
                        _y += (yDest-_y)/5;
                } else {
                        dropped = false;
                }
        }
};