Форум Flasher.ru

Форум Flasher.ru (http://www.flasher.ru/forum/index.php)
-   ActionScript 3.0 (http://www.flasher.ru/forum/forumdisplay.php?f=83)
-   -   Помогите скрестить два скрипта (http://www.flasher.ru/forum/showthread.php?t=209129)

nuber 14.10.2014 18:49

Помогите скрестить два скрипта
 
Вложений: 1
делаю типа генплан с тултипами и есть два скрипта, если один удаляешь другой работает и наоборот, а если оба вставляю то один не работает.

этот делает масштабирование, я его применяю ко всему документу называя его all
Код AS3:

_root.myAlign = function ()
{
    if (_root.all._width <= Stage.width)
    {
      _root.all._x = (Stage.width - _root.all._width) / 2;
    }
    else if (_root.all._x > 0)
    {
        _root.all._x = 0;
    }
    else if (_root.all._x == 0)
    {
    }
    else if (_root.all._x < Stage.width - _root.all._width)
    {
        _root.all._x = Stage.width - _root.all._width;
    } // end else if
    if (_root.all._height <= Stage.height)
    {
        _root.all._y = (Stage.height - _root.all._height) / 2;
    }
    else if (_root.all._y > 0)
    {
        _root.all._y = 0;
    }
    else if (_root.all._y == 0)
    {
    }
    else if (_root.all._y < Stage.height - _root.all._height)
    {
        _root.all._y = Stage.height - _root.all._height;
    } // end else if
};
_root.myZoomTo = function (z)
{
    _root.all_zoom_to = z;
    _root.all_width_to = _root.all_width * z;
    _root.all_height_to = _root.all_height * z;
    _root.all_x_to = Stage.width / 2 - (Stage.width / 2 - _root.all._x) * _root.all_width_to / _root.all._width;
    _root.all_y_to = Stage.height / 2 - (Stage.height / 2 - _root.all._y) * _root.all_height_to / _root.all._height;
    clearInterval(_root.myZoomInterval);
    _root.myZoomInterval = setInterval(_root.myZoomStep, 3.333333E+000);
};
_root.myZoomBy = function (z)
{
    z = _root.all_zoom + z;
    if (z < _root.zoom_min)
    {
        z = _root.zoom_min;
    } // end if
    if (z > _root.zoom_max)
    {
        z = _root.zoom_max;
    } // end if
    _root.nav.scr._y = _root.thumb_max - (_root.thumb_max - _root.thumb_min) * (z - _root.zoom_min) / (_root.zoom_max - _root.zoom_min);
    _root.myZoomTo(z);
};
_root.myZoomStep = function ()
{
    var _loc2 = 3;
    var _loc3 = false;
    if (Math.abs(_root.all_width_to - _root.all._width) <= _loc2)
    {
        _root.all._width = _root.all_width_to;
    }
    else
    {
        _root.all._width = _root.all._width + (_root.all_width_to - _root.all._width) / _loc2;
        _loc3 = true;
    } // end else if
    if (Math.abs(_root.all_height_to - _root.all._height) <= _loc2)
    {
        _root.all._height = _root.all_height_to;
    }
    else
    {
        _root.all._height = _root.all._height + (_root.all_height_to - _root.all._height) / _loc2;
        _loc3 = true;
    } // end else if
    if (Math.abs(_root.all_x_to - _root.all._x) <= _loc2)
    {
        _root.all._x = _root.all_x_to;
    }
    else
    {
        _root.all._x = _root.all._x + (_root.all_x_to - _root.all._x) / _loc2;
        _loc3 = true;
    } // end else if
    if (Math.abs(_root.all_y_to - _root.all._y) <= _loc2)
    {
        _root.all._y = _root.all_y_to;
    }
    else
    {
        _root.all._y = _root.all._y + (_root.all_y_to - _root.all._y) / _loc2;
        _loc3 = true;
    } // end else if
    if (_loc3)
    {
        _root.myAlign();
    } // end if
    if (!_loc3)
    {
        clearInterval(_root.myZoomInterval);
    } // end if
    _root.all_zoom = _root.all_zoom_to;
};
 
_root.myStartDrag = function ()
{
 
    startDrag (_root.all, false, -_root.all._width + Stage.width, -_root.all._height + Stage.height, 0, 0);
    Mouse.hide();
    _root.cursorGrab._visible = true;
    _root.cursorGrab._x = _root._xmouse;
    _root.cursorGrab._y = _root._ymouse;
    _root.onMouseMove = function ()
    {
        _root.cursorGrab._x = _root._xmouse;
        _root.cursorGrab._y = _root._ymouse;
    };
};
_root.myStopDrag = function ()
{
    stopDrag ();
    Mouse.show();
    _root.cursorGrab._visible = false;
    delete _root.onMouseMove;
};
_root.myStageResize = function ()
{
    _root.nav._x = Stage.width - 60;
    _root.myAlign();
};
_root.myStageWheel = function (d)
{
    _root.myZoomBy(d > 0 ? (2.000000E-001) : (-2.000000E-001));
};
Stage.align = "TL";
Stage.scaleMode = "noScale";
Stage.addListener({onResize: _root.myStageResize});
Mouse.addListener({onMouseWheel: _root.myStageWheel});
_root.myStageResize();
_root.zoom_min = 5.000000E-001;
_root.zoom_max = 4;
_root.thumb_min = 33;
_root.thumb_max = 148;
_root.all_width = _root.all._width;
_root.all_height = _root.all._height;
_root.all_zoom = 5.000000E-001;
_root.all._width = _root.all_width * _root.all_zoom;
_root.all._height = _root.all_height * _root.all_zoom;
_root.all._x = Stage.width / 2 - _root.all._width / 2;
_root.all._y = Stage.height / 2 - _root.all._height / 2;
_root.nav.scr._y = _root.thumb_max;
_root.all.other.onPress = _root.myStartDrag;
_root.all.other.onRelease = _root.all.other.onReleaseOutside = _root.myStopDrag;
_root.nav.pb.onRelease = function ()
{
    _root.myZoomBy(2.000000E-001);
};
_root.nav.mb.onRelease = function ()
{
    _root.myZoomBy(-2.000000E-001);
};
_root.nav.dash.onRelease = function ()
{
    _root.nav.scr._y = this._ymouse + 24;
    var _loc3 = _root.zoom_min + (_root.zoom_max - _root.zoom_min) * (_root.thumb_max - _root.nav.scr._y) / (_root.thumb_max - _root.thumb_min);
    _root.myZoomTo(_loc3);
};
_root.nav.scr.onPress = function ()
{
    startDrag (this, false, this._x, _root.thumb_min, this._x, _root.thumb_max);
    this.onMouseMove = function ()
    {
        var _loc3 = _root.zoom_min + (_root.zoom_max - _root.zoom_min) * (_root.thumb_max - this._y) / (_root.thumb_max - _root.thumb_min);
        _root.myZoomTo(_loc3);
    };
};
_root.nav.scr.onRelease = _root.nav.scr.onReleaseOutside = function ()
{
    stopDrag ();
    delete this.onMouseMove;
};

а этот выводит тултипы при наведении на квадратик с присвоенным названием button1

Код AS3:

import oxylus.tooltip.Tooltip;
Tooltip.attach();
var o:Object = new Object();
 
Tooltip.setVars({tipWidth:20, imgWidth:100,
                                imgHeight:70, imgMarginRight:10,
                                tipHeight:10, radius:5, hspace:10,
                                vspace:5, borderWidth:1, tipXOffset:10,
                                cursorDist:5, cursorHeight:20});
 
button1.onRollOver = function() {
    Tooltip.show({img: "images/thumbnail11.jpg", imgWidth:100, imgHeight:70, tip:"<b>Участок №1</b> <br/> Адрес: ул.Свердловская 1<br/>Площадь:12 соток<br/>Статус: <font color='red'>Свободен</font><br/>Стоимость: <font color='red'>360 000 рублей</font>", delay:0.3, stay:10, follow:true});
};
button1.onRollOut = function() {
        Tooltip.hide(0.5);
        };

и вот масштабирование работает а тултипы не выводятся, а если удалить скрипт масштабирования то тултипы работают.

Вложение 31198

nuber 15.10.2014 19:01

Вложений: 1
вот тут фла файл

полагаю как то связано со слоями.
и что на слое all курсор палец а не стрелка:umnik2:

Вложение 31201

Gerbert 15.10.2014 19:27

Тему сейчас закроют, нельзя обсуждать код в котором пестрят свойства с названиями _loc, _root.

КорДум 15.10.2014 19:29

Цитата:

_root
Это из AS1/2. В данном случае AS1.0. Еще и разделом ошиблись =)

nuber 15.10.2014 20:12

я думал модератор все темы перед постом проверяет, прошу прощения

а помочь кто нибудь может?

nuber 19.10.2014 17:58

могу баксов десять даже подкинуть за помощь ))


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

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