Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 1.0/2.0 (http://www.flasher.ru/forum/forumdisplay.php?f=93)
-   -   плавное движение в рамках parent (http://www.flasher.ru/forum/showthread.php?t=116604)

dschmitz 05.10.2008 16:02

плавное движение в рамках parent
 
Вложений: 1
Подскажите, как задать мувику плавное движение в рамках его parent, чтобы он "притормаживал" к границам и двигался симметрично влево и вправо в зависимости от курсора. Исходник вот:

Flash 8, AS2

Заранее спасибо.

Wolsh 05.10.2008 17:59

clip_mc - это "парент")
mc - клип внутри
Код:

var xborder:Number = clip_mc._width-clip_mc.mc._width;
var yborder:Number = clip_mc._height-clip_mc.mc._height;
////
clip_mc.mc.onMouseMove = function  () {
    var xcell:Number = xborder-clip_mc._xmouse + this._width/(clip_mc._width/clip_mc._xmouse);
        this.cell_x = Math.min(xborder, Math.max(0, xcell));
    var ycell:Number = yborder-clip_mc._ymouse + this._height/(clip_mc._height/clip_mc._ymouse);
        this.cell_y = Math.min(yborder, Math.max(0, ycell));
}   
clip_mc.mc.onEnterFrame = function () {
    this._x = this._x + (this.cell_x - this._x)/10
    this._y = this._y + (this.cell_y - this._y)/10
}



Часовой пояс GMT +4, время: 15:37.

Copyright © 1999-2008 Flasher.ru. All rights reserved.
Работает на vBulletin®. Copyright ©2000 - 2026, Jelsoft Enterprises Ltd. Перевод: zCarot
Администрация сайта не несёт ответственности за любую предоставленную посетителями информацию. Подробнее см. Правила.