⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 focusmanager.as

📁 flash 视频聊天室源码,非常好的源码
💻 AS
📖 第 1 页 / 共 2 页
字号:
class mx.managers.FocusManager extends mx.core.UIComponent
{
    var __defaultPushButton, defPushButton, __get__defaultPushButton, form, move, tabEnabled, _height, _width, _y, _x, _alpha, _parent, tabCapture, watch, lastMouse, _visible, lastFocus, doLater, lastSelFocus, cancelAllDoLaters, _searchKey, _lastTarget, _firstNode, _nextIsNext, _nextNode, _lastx, _prevNode, _needPrev, _foundList, _prevObj, _nextObj, _firstObj, _lastObj, _lastNode, lastTabFocus, findFocusFromObject, __set__defaultPushButton, __get__nextTabIndex;
    function FocusManager()
    {
        super();
    } // End of the function
    function get defaultPushButton()
    {
        return (__defaultPushButton);
    } // End of the function
    function set defaultPushButton(x)
    {
        if (x != __defaultPushButton)
        {
            __defaultPushButton.__set__emphasized(false);
            __defaultPushButton = x;
            defPushButton = x;
            x.__set__emphasized(true);
        } // end if
        //return (this.defaultPushButton());
        null;
    } // End of the function
    function getMaxTabIndex(o)
    {
        var _loc3 = 0;
        var _loc6;
        for (var _loc6 in o)
        {
            var _loc2 = o[_loc6];
            if (_loc2._parent == o)
            {
                if (_loc2.tabIndex != undefined)
                {
                    if (_loc2.tabIndex > _loc3)
                    {
                        _loc3 = _loc2.tabIndex;
                    } // end if
                } // end if
                if (_loc2.tabChildren == true)
                {
                    var _loc4 = this.getMaxTabIndex(_loc2);
                    if (_loc4 > _loc3)
                    {
                        _loc3 = _loc4;
                    } // end if
                } // end if
            } // end if
        } // end of for...in
        return (_loc3);
    } // End of the function
    function getNextTabIndex(Void)
    {
        return (this.getMaxTabIndex(form) + 1);
    } // End of the function
    function get nextTabIndex()
    {
        return (this.getNextTabIndex());
    } // End of the function
    function relocate(Void)
    {
        var _loc2 = mx.managers.SystemManager.__get__screen();
        this.move(_loc2.x - 1, _loc2.y - 1);
    } // End of the function
    function init(Void)
    {
        super.init();
        tabEnabled = false;
        _width = _height = 1;
        _x = _y = -1;
        _alpha = 0;
        _parent.focusManager = this;
        _parent.tabChildren = true;
        _parent.tabEnabled = false;
        form = _parent;
        _parent.addEventListener("hide", this);
        _parent.addEventListener("reveal", this);
        mx.managers.SystemManager.init();
        mx.managers.SystemManager.addFocusManager(form);
        tabCapture.tabIndex = 0;
        this.watch("enabled", enabledChanged);
        Selection.addListener(this);
        lastMouse = new Object();
        _global.ASSetPropFlags(_parent, "focusManager", 1);
        _global.ASSetPropFlags(_parent, "tabChildren", 1);
        _global.ASSetPropFlags(_parent, "tabEnabled", 1);
    } // End of the function
    function enabledChanged(id, oldValue, newValue)
    {
        _visible = newValue;
        return (newValue);
    } // End of the function
    function activate(Void)
    {
        Key.addListener(this);
        activated = _visible = true;
        if (lastFocus != undefined)
        {
            bNeedFocus = true;
            if (!mx.managers.SystemManager.isMouseDown)
            {
                this.doLater(this, "restoreFocus");
            } // end if
        } // end if
    } // End of the function
    function deactivate(Void)
    {
        Key.removeListener(this);
        activated = _visible = false;
        var _loc2 = this.getSelectionFocus();
        var _loc3 = this.getActualFocus(_loc2);
        if (this.isOurFocus(_loc3))
        {
            lastSelFocus = _loc2;
            lastFocus = _loc3;
        } // end if
        this.cancelAllDoLaters();
    } // End of the function
    function isOurFocus(o)
    {
        if (o.focusManager == this)
        {
            return (true);
        } // end if
        while (o != undefined)
        {
            if (o.focusManager != undefined)
            {
                return (false);
            } // end if
            if (o._parent == _parent)
            {
                return (true);
            } // end if
            o = o._parent;
        } // end while
        return (false);
    } // End of the function
    function onSetFocus(o, n)
    {
        if (n == null)
        {
            if (activated)
            {
                bNeedFocus = true;
            } // end if
        }
        else
        {
            var _loc2 = this.getFocus();
            if (this.isOurFocus(_loc2))
            {
                bNeedFocus = false;
                lastFocus = _loc2;
                lastSelFocus = n;
            } // end if
        } // end else if
    } // End of the function
    function restoreFocus(Void)
    {
        var _loc2 = lastSelFocus.hscroll;
        if (_loc2 != undefined)
        {
            var _loc5 = lastSelFocus.scroll;
            var _loc4 = lastSelFocus.background;
        } // end if
        lastFocus.setFocus();
        var _loc3 = Selection;
        Selection.setSelection(_loc3.lastBeginIndex, _loc3.lastEndIndex);
        if (_loc2 != undefined)
        {
            lastSelFocus.scroll = _loc5;
            lastSelFocus.hscroll = _loc2;
            lastSelFocus.background = _loc4;
        } // end if
    } // End of the function
    function onUnload(Void)
    {
        mx.managers.SystemManager.removeFocusManager(form);
    } // End of the function
    function setFocus(o)
    {
        if (o == null)
        {
            Selection.setFocus(null);
        }
        else if (o.setFocus == undefined)
        {
            Selection.setFocus(o);
        }
        else
        {
            o.setFocus();
        } // end else if
    } // End of the function
    function getActualFocus(o)
    {
        for (var _loc1 = o._parent; _loc1 != undefined; _loc1 = o._parent)
        {
            if (_loc1.focusTextField != undefined)
            {
                while (_loc1.focusTextField != undefined)
                {
                    o = _loc1;
                    _loc1 = _loc1._parent;
                    if (_loc1 == undefined)
                    {
                        return;
                    } // end if
                    if (_loc1.focusTextField == undefined)
                    {
                        return (o);
                    } // end if
                } // end while
            } // end if
            if (_loc1.tabEnabled != true)
            {
                return (o);
            } // end if
            o = _loc1;
        } // end of for
        return;
    } // End of the function
    function getSelectionFocus()
    {
        var m = Selection.getFocus();
        var o = eval(m);
        return (o);
    } // End of the function
    function getFocus(Void)
    {
        var _loc2 = this.getSelectionFocus();
        return (this.getActualFocus(_loc2));
    } // End of the function
    function walkTree(p, index, groupName, dir, lookup, firstChild)
    {
        var _loc5 = true;
        var _loc11;
        for (var _loc11 in p)
        {
            var _loc2 = p[_loc11];
            if (_loc2._parent == p && _loc2.enabled != false && _loc2._visible != false && (_loc2.tabEnabled == true || _loc2.tabEnabled != false && (_loc2.onPress != undefined || _loc2.onRelease != undefined || _loc2.onReleaseOutside != undefined || _loc2.onDragOut != undefined || _loc2.onDragOver != undefined || _loc2.onRollOver != undefined || _loc2.onRollOut != undefined || _loc2 instanceof TextField)))
            {
                if (_loc2._searchKey == _searchKey)
                {
                    continue;
                } // end if
                _loc2._searchKey = _searchKey;
                if (_loc2 != _lastTarget)
                {
                    if ((_loc2.groupName != undefined || groupName != undefined) && _loc2.groupName == groupName)
                    {
                        continue;
                    } // end if
                    if (_loc2 instanceof TextField && _loc2.selectable == false)
                    {
                        continue;
                    } // end if
                    if (_loc5 || _loc2.groupName != undefined && _loc2.groupName == _firstNode.groupName && _loc2.selected == true)
                    {
                        if (firstChild)
                        {
                            _firstNode = _loc2;
                            firstChild = false;
                        } // end if
                    } // end if
                    if (_nextIsNext == true)
                    {
                        if (_loc2.groupName != undefined && _loc2.groupName == _nextNode.groupName && _loc2.selected == true || _nextNode == undefined && (_loc2.groupName == undefined || _loc2.groupName != undefined && _loc2.groupName != groupName))
                        {
                            _nextNode = _loc2;
                        } // end if
                    } // end if
                    if (_loc2.groupName == undefined || groupName != _loc2.groupName)
                    {
                        if (_lastx.groupName != undefined && _loc2.groupName == _lastx.groupName && _lastx.selected == true)
                        {
                        }
                        else
                        {
                            _lastx = _loc2;
                        } // end if
                    } // end else if
                }
                else
                {
                    _prevNode = _lastx;
                    _needPrev = false;
                    _nextIsNext = true;
                } // end else if
                if (_loc2.tabIndex != undefined)
                {
                    if (_loc2.tabIndex == index)
                    {
                        if (_foundList[_loc2._name] == undefined)
                        {
                            if (_needPrev)
                            {
                                _prevObj = _loc2;
                                _needPrev = false;
                            } // end if
                            _nextObj = _loc2;
                        } // end if
                    } // end if
                    if (dir && _loc2.tabIndex > index)
                    {
                        if (_nextObj == undefined || _nextObj.tabIndex > _loc2.tabIndex && (_loc2.groupName == undefined || _nextObj.groupName == undefined || _loc2.groupName != _nextObj.groupName) || _nextObj.groupName != undefined && _nextObj.groupName == _loc2.groupName && _nextObj.selected != true && (_loc2.selected == true || _nextObj.tabIndex > _loc2.tabIndex))
                        {
                            _nextObj = _loc2;
                        } // end if
                    }
                    else if (!dir && _loc2.tabIndex < index)
                    {
                        if (_prevObj == undefined || _prevObj.tabIndex < _loc2.tabIndex && (_loc2.groupName == undefined || _prevObj.groupName == undefined || _loc2.groupName != _prevObj.groupName) || _prevObj.groupName != undefined && _prevObj.groupName == _loc2.groupName && _prevObj.selected != true && (_loc2.selected == true || _prevObj.tabIndex < _loc2.tabIndex))
                        {
                            _prevObj = _loc2;
                        } // end if
                    } // end else if
                    if (_firstObj == undefined || _loc2.tabIndex < _firstObj.tabIndex && (_loc2.groupName == undefined || _firstObj.groupName == undefined || _loc2.groupName != _firstObj.groupName) || _firstObj.groupName != undefined && _firstObj.groupName == _loc2.groupName && _firstObj.selected != true && (_loc2.selected == true || _loc2.tabIndex < _firstObj.tabIndex))
                    {
                        _firstObj = _loc2;
                    } // end if
                    if (_lastObj == undefined || _loc2.tabIndex > _lastObj.tabIndex && (_loc2.groupName == undefined || _lastObj.groupName == undefined || _loc2.groupName != _lastObj.groupName) || _lastObj.groupName != undefined && _lastObj.groupName == _loc2.groupName && _lastObj.selected != true && (_loc2.selected == true || _loc2.tabIndex > _lastObj.tabIndex))
                    {
                        _lastObj = _loc2;
                    } // end if
                } // end if
                if (_loc2.tabChildren)
                {
                    this.getTabCandidateFromChildren(_loc2, index, groupName, dir, _loc5 && firstChild);
                } // end if
                _loc5 = false;
                continue;
            } // end if
            if (_loc2._parent == p && _loc2.tabChildren == true && _loc2._visible != false)
            {
                if (_loc2 == _lastTarget)
                {
                    if (_loc2._searchKey == _searchKey)
                    {
                        continue;
                    } // end if
                    _loc2._searchKey = _searchKey;
                    if (_prevNode == undefined)
                    {
                        var _loc3 = _lastx;
                        var _loc7 = false;
                        while (_loc3 != undefined)
                        {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -