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

📄 textarea.as

📁 flash 视频聊天室源码,非常好的源码
💻 AS
📖 第 1 页 / 共 2 页
字号:
        hScroller.enabled = enable;
        label.type = this.__get__editable() == false || enabled == false ? ("dynamic") : ("input");
        label.selectable = enabled;
        var _loc2 = this.getStyle(enable ? ("color") : ("disabledColor"));
        if (_loc2 == undefined)
        {
            _loc2 = enable ? (0) : (8947848);
        } // end if
        this.setColor(_loc2);
    } // End of the function
    function setColor(col)
    {
        label.textColor = col;
    } // End of the function
    function setFocus(Void)
    {
        Selection.setFocus(label);
    } // End of the function
    function onSetFocus(x)
    {
        var f = Selection.getFocus();
        var o = eval(f);
        if (o != this.label)
        {
            Selection.setFocus(this.label);
            return;
        } // end if
        this.getFocusManager().defaultPushButtonEnabled = false;
        this.addEventListener("keyDown", this);
        super.onSetFocus(x);
    } // End of the function
    function onKillFocus(x)
    {
        this.getFocusManager().defaultPushButtonEnabled = true;
        this.removeEventListener("keyDown", this);
        super.onKillFocus(x);
    } // End of the function
    function restoreSelection(x)
    {
        var _loc2 = Selection;
        Selection.setSelection(_loc2.lastBeginIndex, _loc2.lastEndIndex);
        label.scroll = _vpos;
        label.hscroll = _hpos;
    } // End of the function
    function getLineOffsets(Void)
    {
        var _loc16 = this._getTextFormat();
        var _loc18 = _loc16.getTextExtent2(label.text);
        var _loc5 = _root._getTextExtent;
        _loc5.setNewTextFormat(_loc16);
        var _loc14 = label.wordWrap;
        var _loc9 = 0;
        var _loc7 = label._width - 2 - 2;
        var _loc12 = new Array();
        var _loc17 = new String(label.text);
        var _loc15 = _loc17.split("\r");
        for (var _loc11 = 0; _loc11 < _loc15.length; ++_loc11)
        {
            _loc12.push(_loc9);
            var _loc4 = _loc15[_loc11];
            _loc5.text = _loc4;
            var _loc13 = Math.ceil(_loc5.textWidth / _loc7);
            var _loc10 = Math.floor(_loc4.length / _loc13);
            var _loc3;
            while (_loc14 && _loc5.textWidth > _loc7)
            {
                _loc3 = _loc4.indexOf(" ", _loc10);
                var _loc6;
                if (_loc3 == -1)
                {
                    _loc3 = _loc4.lastIndexOf(" ");
                    if (_loc3 == -1)
                    {
                        _loc3 = _loc10;
                    } // end if
                } // end if
                _loc6 = _loc4.substr(0, _loc3);
                _loc5.text = _loc6;
                if (_loc5.textWidth > _loc7)
                {
                    while (_loc5.textWidth > _loc7)
                    {
                        var _loc8 = _loc3;
                        _loc3 = _loc4.lastIndexOf(" ", _loc3 - 1);
                        if (_loc3 == -1)
                        {
                            _loc3 = _loc8 - 1;
                        } // end if
                        _loc6 = _loc4.substr(0, _loc3);
                        _loc5.text = _loc6;
                    } // end while
                }
                else if (_loc5.textWidth < _loc7)
                {
                    _loc8 = _loc3;
                    while (_loc5.textWidth < _loc7)
                    {
                        _loc8 = _loc3;
                        _loc3 = _loc4.indexOf(" ", _loc3 + 1);
                        if (_loc3 == -1)
                        {
                            if (_loc4.indexOf(" ", 0) != -1)
                            {
                                break;
                            }
                            else
                            {
                                _loc3 = _loc8 + 1;
                            } // end if
                        } // end else if
                        _loc6 = _loc4.substr(0, _loc3);
                        _loc5.text = _loc6;
                    } // end while
                    _loc3 = _loc8;
                } // end else if
                _loc9 = _loc9 + _loc3;
                _loc12.push(_loc9 + 1);
                _loc4 = _loc4.substr(_loc3);
                if (_loc4.charAt(0) == " ")
                {
                    _loc4 = _loc4.substr(1, _loc4.length - 1);
                    _loc9 = _loc9 + 1;
                } // end if
                _loc5.text = _loc4;
            } // end while
            _loc9 = _loc9 + (_loc4.length + 1);
        } // end of for
        return (_loc12);
    } // End of the function
    function keyDown(e)
    {
        var _loc5 = e.code;
        if (_loc5 == 34)
        {
            var _loc6 = label.bottomScroll - label.scroll + 1;
            var _loc3 = this.getLineOffsets();
            var _loc2 = Math.min(label.bottomScroll + 1, label.maxscroll);
            if (_loc2 == label.maxscroll)
            {
                var _loc4 = label.length;
                Selection.setSelection(_loc4, _loc4);
            }
            else
            {
                label.scroll = _loc2;
                Selection.setSelection(_loc3[_loc2 - 1], _loc3[_loc2 - 1]);
            } // end else if
        }
        else if (_loc5 == 33)
        {
            _loc6 = label.bottomScroll - label.scroll + 1;
            _loc3 = this.getLineOffsets();
            _loc2 = label.scroll - 1;
            if (_loc2 < 1)
            {
                Selection.setSelection(0, 0);
            }
            else
            {
                Selection.setSelection(_loc3[_loc2 - 1], _loc3[_loc2 - 1]);
                label.scroll = Math.max(_loc2 - _loc6, 1);
            } // end else if
        } // end else if
    } // End of the function
    function draw(Void)
    {
        var _loc2 = label;
        var _loc4 = this.getText();
        if (initializing)
        {
            initializing = false;
            delete this.initText;
        } // end if
        var _loc3 = this._getTextFormat();
        _loc2.embedFonts = _loc3.embedFonts == true;
        if (_loc3 != undefined)
        {
            _loc2.setTextFormat(_loc3);
            _loc2.setNewTextFormat(_loc3);
        } // end if
        _loc2.multiline = true;
        _loc2.wordWrap = this.__get__wordWrap() == true;
        if (_loc2.wordWrap)
        {
            __hScrollPolicy = "off";
        } // end if
        if (_loc2.html == true)
        {
            _loc2.setTextFormat(_loc3);
            _loc2.htmlText = _loc4;
        }
        else
        {
            _loc2.text = _loc4;
        } // end else if
        _loc2.type = this.__get__editable() == true ? ("input") : ("dynamic");
        this.size();
        _loc2.background = false;
    } // End of the function
    function adjustScrollBars()
    {
        var _loc2 = label;
        var _loc4 = _loc2.bottomScroll - _loc2.scroll + 1;
        var _loc3 = _loc4 + _loc2.maxscroll - 1;
        if (_loc3 < 1)
        {
            _loc3 = 1;
        } // end if
        var _loc5 = 0;
        if (_loc2.textWidth + 5 > _loc2._width)
        {
            if (!_loc2.wordWrap)
            {
                _loc5 = _loc2._width + _loc2.maxhscroll;
            } // end if
        }
        else
        {
            _loc2.hscroll = 0;
            _loc2.background = false;
        } // end else if
        if (_loc2.height / _loc4 != Math.round(_loc2.height / _loc4))
        {
            --_loc3;
        } // end if
        this.setScrollProperties(_loc5, 1, _loc3, _loc2.height / _loc4);
    } // End of the function
    function get tabIndex()
    {
        return (label.tabIndex);
    } // End of the function
    function set tabIndex(w)
    {
        label.tabIndex = w;
        //return (this.tabIndex());
        null;
    } // End of the function
    function set _accProps(val)
    {
        label._accProps = val;
        //return (this._accProps());
        null;
    } // End of the function
    function get _accProps()
    {
        return (label._accProps);
    } // End of the function
    function get styleSheet()
    {
        return (label.styleSheet);
    } // End of the function
    function set styleSheet(v)
    {
        label.styleSheet = v;
        //return (this.styleSheet());
        null;
    } // End of the function
    static var symbolName = "TextArea";
    static var symbolOwner = mx.controls.TextArea;
    static var version = "2.0.0.360";
    var className = "TextArea";
    var initializing = true;
    var clipParameters = {text: 1, wordWrap: 1, editable: 1, maxChars: 1, restrict: 1, html: 1, password: 1};
    static var mergedClipParameters = mx.core.UIObject.mergeClipParameters(mx.controls.TextArea.prototype.clipParameters, mx.core.ScrollView.prototype.clipParameters);
    var __vScrollPolicy = "auto";
    var __hScrollPolicy = "auto";
    var __editable = true;
} // End of Class

⌨️ 快捷键说明

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