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

📄 combobox.as

📁 flash 视频聊天室源码,非常好的源码
💻 AS
📖 第 1 页 / 共 2 页
字号:
class mx.controls.ComboBox extends mx.controls.ComboBase
{
    var editable, __set__editable, __labels, data, __dropdownWidth, __width, __set__dropdownWidth, _editable, selectedIndex, __dropdown, dataProvider, __labelFunction, owner, wrapDownArrowButton, _y, createObject, mask, border_mc, text_mc, __get__selectedLabel, __get__labels, __get__labelField, __get__labelFunction, getValue, dispatchValueChangedEvent, length, __get__rowCount, __get__dropdownWidth, selectedItem, isPressed, __set__visible, height, localToGlobal, __get__height, getStyle, dispatchEvent, _parent, __get__dropdown, width, __dataProvider, selected, __set__labelField, __set__labelFunction, __set__labels, __set__rowCount;
    function ComboBox()
    {
        super();
    } // End of the function
    function init()
    {
        super.init();
    } // End of the function
    function createChildren()
    {
        super.createChildren();
        this.__set__editable(editable);
        if (__labels.length > 0)
        {
            var _loc6 = new Array();
            for (var _loc3 = 0; _loc3 < labels.length; ++_loc3)
            {
                _loc6.addItem({label: labels[_loc3], data: data[_loc3]});
            } // end of for
            this.setDataProvider(_loc6);
        } // end if
        this.__set__dropdownWidth(typeof(__dropdownWidth) == "number" ? (__dropdownWidth) : (__width));
        if (!_editable)
        {
            selectedIndex = 0;
        } // end if
        initializing = false;
    } // End of the function
    function onKillFocus(n)
    {
        if (_showingDropdown && n != null)
        {
            this.displayDropdown(false);
        } // end if
        super.onKillFocus();
    } // End of the function
    function getDropdown()
    {
        if (initializing)
        {
            return;
        } // end if
        if (!this.hasDropdown())
        {
            var _loc3 = new Object();
            _loc3.styleName = this;
            if (dropdownBorderStyle != undefined)
            {
                _loc3.borderStyle = dropdownBorderStyle;
            } // end if
            _loc3._visible = false;
            __dropdown = mx.managers.PopUpManager.createPopUp(this, mx.controls.List, false, _loc3, true);
            __dropdown.scroller.mask.removeMovieClip();
            if (dataProvider == undefined)
            {
                dataProvider = new Array();
            } // end if
            __dropdown.setDataProvider(dataProvider);
            __dropdown.selectMultiple = false;
            __dropdown.rowCount = __rowCount;
            __dropdown.selectedIndex = selectedIndex;
            __dropdown.vScrollPolicy = "auto";
            __dropdown.labelField = __labelField;
            __dropdown.labelFunction = __labelFunction;
            __dropdown.owner = this;
            __dropdown.changeHandler = _changeHandler;
            __dropdown.scrollHandler = _scrollHandler;
            __dropdown.itemRollOverHandler = _itemRollOverHandler;
            __dropdown.itemRollOutHandler = _itemRollOutHandler;
            __dropdown.resizeHandler = _resizeHandler;
            __dropdown.mouseDownOutsideHandler = function (eventObj)
            {
                if (owner.hitTest(_root._xmouse, _root._ymouse, false))
                {
                }
                else if (!wrapDownArrowButton && owner.downArrow_mc.hitTest(_root._xmouse, _root._ymouse, false))
                {
                }
                else
                {
                    owner.displayDropdown(false);
                } // end else if
            };
            __dropdown.onTweenUpdate = function (v)
            {
                _y = v;
            };
            __dropdown.setSize(__dropdownWidth, __dropdown.height);
            this.createObject("BoundingBox", "mask", 20);
            mask._y = border_mc.height;
            mask._width = __dropdownWidth;
            mask._height = __dropdown.height;
            mask._visible = false;
            __dropdown.setMask(mask);
        } // end if
        return (__dropdown);
    } // End of the function
    function setSize(w, h, noEvent)
    {
        super.setSize(w, h, noEvent);
        __dropdownWidth = w;
        __dropdown.rowHeight = h;
        __dropdown.setSize(__dropdownWidth, __dropdown.height);
    } // End of the function
    function setEditable(e)
    {
        super.setEditable(e);
        if (e)
        {
            text_mc.setText("");
        }
        else
        {
            text_mc.setText(this.__get__selectedLabel());
        } // end else if
    } // End of the function
    function get labels()
    {
        return (__labels);
    } // End of the function
    function set labels(lbls)
    {
        __labels = lbls;
        this.setDataProvider(lbls);
        //return (this.labels());
        null;
    } // End of the function
    function getLabelField()
    {
        return (__labelField);
    } // End of the function
    function get labelField()
    {
        return (this.getLabelField());
    } // End of the function
    function setLabelField(s)
    {
        __dropdown.labelField = __labelField = s;
        text_mc.setText(this.__get__selectedLabel());
    } // End of the function
    function set labelField(s)
    {
        this.setLabelField(s);
        //return (this.labelField());
        null;
    } // End of the function
    function getLabelFunction()
    {
        return (__labelFunction);
    } // End of the function
    function get labelFunction()
    {
        return (this.getLabelFunction());
    } // End of the function
    function set labelFunction(f)
    {
        __dropdown.labelFunction = __labelFunction = f;
        text_mc.setText(this.__get__selectedLabel());
        //return (this.labelFunction());
        null;
    } // End of the function
    function setSelectedItem(v)
    {
        super.setSelectedItem(v);
        __dropdown.selectedItem = v;
        text_mc.setText(this.__get__selectedLabel());
    } // End of the function
    function setSelectedIndex(v)
    {
        super.setSelectedIndex(v);
        __dropdown.selectedIndex = v;
        text_mc.setText(this.__get__selectedLabel());
        this.dispatchValueChangedEvent(this.getValue());
    } // End of the function
    function setRowCount(count)
    {
        if (isNaN(count))
        {
            return;
        } // end if
        __rowCount = count;
        __dropdown.setRowCount(count);
    } // End of the function
    function get rowCount()
    {
        return (Math.max(1, Math.min(length, __rowCount)));
    } // End of the function
    function set rowCount(v)
    {
        this.setRowCount(v);
        //return (this.rowCount());
        null;
    } // End of the function
    function setDropdownWidth(w)
    {
        __dropdownWidth = w;
        __dropdown.setSize(w, __dropdown.height);
    } // End of the function
    function get dropdownWidth()
    {
        return (__dropdownWidth);
    } // End of the function
    function set dropdownWidth(v)
    {
        this.setDropdownWidth(v);
        //return (this.dropdownWidth());
        null;
    } // End of the function
    function get dropdown()
    {
        return (this.getDropdown());
    } // End of the function
    function setDataProvider(dp)
    {
        super.setDataProvider(dp);
        __dropdown.setDataProvider(dp);
        if (!_editable)
        {
            selectedIndex = 0;
        } // end if
    } // End of the function
    function open()
    {
        this.displayDropdown(true);
    } // End of the function
    function close()
    {
        this.displayDropdown(false);
    } // End of the function
    function get selectedLabel()
    {
        var _loc2 = selectedItem;
        if (_loc2 == undefined)
        {
            return ("");
        }
        else if (this.__get__labelFunction() != undefined)
        {

⌨️ 快捷键说明

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