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

📄 script1.as

📁 flash 仿VISTA windows 效果 源码
💻 AS
📖 第 1 页 / 共 4 页
字号:
    this.BU._x = this.Textbox.min_width;
    this.BU._y = 1;
    this.createEmptyMovieClip("Bar", 3);
    this.Bar.drawButton(size, _root.t_height - size * 2 - bevs * 5, true);
    this.Bar._x = this.Textbox.min_width;
    this.Bar._y = this.BU._height;
    this.createEmptyMovieClip("BD", 4);
    this.BD.drawButton(size, size, false);
    this.BD.drawArrow(size / 2, size / 2, "down", false);
    this.BD._x = this.Textbox.min_width;
    this.BD._y = this.Bar._y + this.Bar._height;
    this.createEmptyMovieClip("SB", 5);
    this.SB.drawButton(size, size * 2, false);
    this.SB._x = this.Textbox.min_width;
    this.SB._y = this.Bar._y;
    this.SB.top = this.SB._y;
    this.SB.bot = this.SB._y + this.Bar._height;
    this.BU.onPress = function ()
    {
        this._parent.Window.focus();
        _root.playSound("buttonClick");
        this.drawButton(size, size, true);
        this.drawArrow(size / 2, size / 2, "up", true);
        this._parent.SB.onEnterFrame = function ()
        {
            this._y = this._y - 5;
            this._parent.setTextScroll();
        };
    };
    this.BD.onPress = function ()
    {
        this._parent.Window.focus();
        _root.playSound("buttonClick");
        this.drawButton(size, size, true);
        this.drawArrow(size / 2, size / 2, "down", true);
        this._parent.SB.onEnterFrame = function ()
        {
            this._y = this._y + 5;
            this._parent.setTextScroll();
        };
    };
    this.BU.onRelease = this.BU.onReleaseOutside = function ()
    {
        this.drawButton(size, size, false);
        this.drawArrow(size / 2, size / 2, "up", false);
        this._parent.SB.onEnterFrame = undefined;
    };
    this.BD.onRelease = this.BD.onReleaseOutside = function ()
    {
        this.drawButton(size, size, false);
        this.drawArrow(size / 2, size / 2, "down", false);
        this._parent.SB.onEnterFrame = undefined;
    };
    this.SB.onPress = function ()
    {
        this._parent.Window.focus();
        this.offy = this._ymouse;
        this.onMouseMove = function ()
        {
            this._y = this._parent._ymouse - this.offy;
            this._parent.setTextScroll();
            updateAfterEvent();
        };
    };
    this.SB.onRelease = this.SB.onReleaseOutside = function ()
    {
        this.onMouseMove = undefined;
    };
    this.Bar.onPress = function ()
    {
        this._parent.Window.focus();
        _root.playSound("buttonClick");
        this._parent.SB._y = this._parent._ymouse;
        this._parent.setTextScroll();
    };
    this.init();
};
MovieClip.prototype.makeDropList = function (mCaps, mVals, mVar, mView, mFnc)
{
    properties = ["_width", "_height", "_x", "_y", "_name", "_depth"];
    for (i = 0; i < properties.length; i++)
    {
        _root["t" + properties[i]] = this[properties[i]];
    } // end of for
    this._parent.createEmptyMovieClip(_root.t_name, _root.t_depth);
    this.w = _root.t_width;
    this.h = Number(Globals.CurrentScheme.GUI_button_height) + 1;
    this._x = _root.t_x;
    this._y = _root.t_y;
    this.mCaps = mCaps;
    this.mVals = mVals;
    this.mView = mView;
    this.mFnc = mFnc ? (mFnc) : (this + "_Changed");
    this.bSize = Number(Globals.CurrentScheme.GUI_button_height);
    this.offset = 0;
    this.col_bg = "0x" + Globals.CurrentScheme.input_bg_color;
    this.col_sel = "0x" + Globals.CurrentScheme.color_selected;
    this.col_scr = "0x" + Globals.CurrentScheme.GUI_list_scrollcolor;
    temp = mVar.split(".");
    this.mVar = temp.pop();
    this.mObj = temp.join(".");
    c = 0;
    for (i = "._parent._parent"; c < 100 && eval(this + i + "._name").substring(0, 3) != "Win"; i = i + "._parent")
    {
        c++;
    } // end of for
    this.Window = eval(this + i);
    this.createTextField("Textbox", 1, 0, 0, this.w - this.bSize - 2, this.bSize);
    this.Textbox.selectable = false;
    this.Textbox.background = true;
    this.Textbox.border = true;
    this.Textbox.backgroundColor = this.col_bg;
    this.Textbox.borderColor = "0x" + Globals.CurrentScheme.darkbevel_color;
    this.TextStyle_Nrm = Globals.TextStyle_Nrm.copy();
    this.TextStyle_Dis = Globals.TextStyle_Dis.copy();
    this.TextStyle_Sel = Globals.TextStyle_Sel.copy();
    this.TextStyle_Nrm.size = this.TextStyle_Dis.size = this.TextStyle_Sel.size = Globals.CurrentScheme.GUI_font_size;
    this.setValue = function (val)
    {
        if (this.List._visible)
        {
            this.hideList();
        } // end if
        for (i = 0; i < this.mVals.length; i++)
        {
            if (this.mVals[i] == val)
            {
                this.index = i;
                this.mObj[this.mVar] = val;
                this.Textbox.text = this.mCaps[i];
                this.Textbox.setTextFormat(this.TextStyle_Nrm);
                break;
            } // end if
        } // end of for
        this.mFnc();
    };
    this.initItems = function ()
    {
        for (i = 0; i < this.mView; i++)
        {
            Item = this.List["Item" + i];
            Item.Caption.text = this.mCaps[this.offset + i];
            Item.Caption.setTextFormat(this.TextStyle_Nrm);
            Item.myValue = this.mVals[this.offset + i];
        } // end of for
    };
    this.scrollItems = function ()
    {
        this.w++;
        if (this.w < 3)
        {
            return(undefined);
        } // end if
        this.w = 0;
        if (this.dir == "up" && this.offset > 0)
        {
            this.offset--;
            this.initItems();
        }
        else if (this.dir == "down" && this.offset < this.mVals.length - this.mView)
        {
            this.offset++;
            this.initItems();
        } // end if
    };
    this.hideList = function ()
    {
        _root.playSound("menuClose");
        this.List._xscale = this.List._yscale = 0;
        this.List._visible = false;
        Mouse.removeListener(this);
    };
    this.showList = function ()
    {
        _root.playSound("menuOpen");
        this.List._xscale = this.List._yscale = 100;
        this.List._visible = true;
        Mouse.addListener(this);
    };
    this.onMouseDown = function ()
    {
        if (this.List._visible && !this.hitTest(_root._xmouse, _root._ymouse))
        {
            this.hideList();
        } // end if
    };
    this.disable = function ()
    {
        if (this.List._visible)
        {
            this.hideList();
        } // end if
        this.Textbox.setTextFormat(this.TextStyle_Dis);
        this.BU._alpha = 50;
        this.disabled = true;
    };
    this.enable = function ()
    {
        if (this.List._visible)
        {
            this.hideList();
        } // end if
        this.Textbox.setTextFormat(this.TextStyle_Nrm);
        this.BU._alpha = 100;
        this.disabled = false;
    };
    if (this.mObj[this.mVar] != undefined)
    {
        this.setValue(this.mObj[this.mVar]);
    }
    else
    {
        this.setValue(0);
    } // end if
    this.createEmptyMovieClip("BU", 2);
    this.BU.drawButton(this.bSize - 2, this.bSize - 2, false);
    this.BU._x = this.Textbox._width + 2;
    this.BU._y = 1;
    this.BU.bSize = this.bSize;
    this.BU.drawArrow(this.bSize / 2, this.bSize / 2, "down", false);
    this.pressed = function ()
    {
        _root.playSound("buttonClick");
        this.Window.focus();
        if (this.List._visible)
        {
            this.hideList();
        }
        else if (!this.List._visible)
        {
            this.showList();
        } // end if
    };
    this.BU.onPress = function ()
    {
        if (this._parent.disabled)
        {
            return(undefined);
        } // end if
        this.drawButton(this.bSize - 2, this.bSize - 2, true);
        this._parent.pressed();
    };
    this.BU.onRelease = this.BU.onReleaseOutside = function ()
    {
        if (this._parent.disabled)
        {
            return(undefined);
        } // end if
        this.drawButton(this.bSize - 2, this.bSize - 2, false);
    };
    this.createEmptyMovieClip("OP", 9998);
    with (this.OP)
    {
        beginFill("0xFFFFFF", 0);
        lineTo(10, 0);
        lineTo(10, 10);
        lineTo(0, 10);
        lineTo(0, 0);
        endFill();
    } // End of with
    this.OP._width = this.BU._x;
    this.OP._height = this.BU._height;
    this.OP.onPress = function ()
    {
        if (this._parent.disabled)
        {
            return(undefined);
        } // end if
        this._parent.pressed();
    };
    this.createEmptyMovieClip("List", 4);
    this.List._y = 2 + this.h;
    if (this.mVals.length > this.mView)
    {
        this.List.createEmptyMovieClip("UpScroll", 1);
        Clip = this.List.UpScroll;
        Clip.createTextField("Textbox", 1, 0, 0, this.w, this.bSize);
        Clip.Textbox.selectable = false;
        Clip.Textbox.background = true;
        Clip.Textbox.backgroundColor = this.col_scr;
        Clip.createEmptyMovieClip("ArrowUp", 2);
        Clip.ArrowUp.drawArrow(this.bSize / 2, this.bSize / 2, "up", false);
        Clip.ArrowUp._x = Clip._x + Clip._width / 2;
        Clip.ArrowUp._y = Clip._height / 2 - 2;
        Clip.onPress = function ()
        {
            this._parent._parent.dir = "up";
            this._parent._parent.onEnterFrame = this._parent._parent.scrollItems;
        };
        Clip.onRollOver = function ()
        {
            this.Textbox.backgroundColor = this._parent._parent.col_sel;
        };
        Clip.onRollOut = Clip.onDragOut = function ()
        {
            this._parent._parent.onEnterFrame = undefined;
            this.Textbox.backgroundColor = this._parent._parent.col_scr;
        };
        Clip.onRelease = Clip.onReleaseOutside = function ()
        {
            this._parent._parent.onEnterFrame = undefined;
        };
        this.List.createEmptyMovieClip("DownScroll", 2);
        Clip = this.List.DownScroll;
        Clip.createTextField("Textbox", 1, 0, 0, this.w, this.bSize);
        Clip.Textbox.selectable = false;
        Clip.Textbox.background = true;
        Clip.Textbox.backgroundColor = this.col_scr;
        Clip.createEmptyMovieClip("ArrowDown", 2);
        Clip.ArrowDown.drawArrow(this.bSize / 2, this.bSize / 2, "down", false);
        Clip.ArrowDown._x = Clip._x + Clip._width / 2;
        Clip.ArrowDown._y = Clip._y + Clip._height / 2 - 2;
        Clip.onPress = function ()
        {
            this._parent._parent.dir = "down";
            this._parent._parent.onEnterFrame = this._parent._parent.scrollItems;
        };
        Clip.onRollOver = function ()
        {
            this.Textbox.backgroundColor = this._parent._parent.col_sel;
        };
        Clip.onRollOut = Clip.onDragOut = function ()
        {
            this._parent._parent.onEnterFrame = undefined;
            this.Textbox.backgroundColor = this._parent._parent.col_scr;
        };
        Clip.onRelease = Clip.onReleaseOutside = function ()
        {
            this._parent._parent.onEnterFrame = undefined;
        };
    } // end if
    iy = this.List.UpScroll ? (this.List.UpScroll._height - 1) : (0);
    for (i = 0; i < this.mView; i++)
    {
        if (i >= this.mCaps.length)
        {
            break;
        } // end if
        this.List.createEmptyMovieClip("Item" + i, 5 + i);
        this.List["Item" + i].createTextField("Caption", 1, 0, 0, this.w, this.bSize);
        Item = this.List["Item" + i];
        Caption = this.List["Item" + i].Caption;
        Caption.selectable = false;
        Caption.background = true;
        Caption.backgroundColor = this.col_bg;
        Caption.text = this.mCaps[this.offset + i];
        Caption.setTextFormat(this.TextStyle_Nrm);
        Caption._height = this.item_height = Caption.textHeight + 4;
        Item._y = iy;
        iy = iy + (this.item_height - 1);
        Item.onRollOver = function ()
        {
            this.Caption.backgroundColor = this._parent._parent.col_sel;
            this.Caption.setTextFormat(this._parent._parent.TextStyle_Sel);
        };
        Item.onRollOut = Item.onDragOut = function ()
        {
            this.Caption.backgroundColor = this._parent._parent.col_bg;
            this.Caption.setTextFormat(this._parent._parent.TextStyle_Nrm);
        };
        Item.onPress = function ()
        {
            this._parent._parent.Window.focus();
            this._parent._parent.setValue(this.myValue);
            _root.playSound("buttonClick");
        };
    } // end of for
    this.initItems();
    this.hideList();
    if (this.List.DownScroll)
    {
        this.List.DownScroll._y = Item._y + Item._height - 1;
    } // end if
    this.List.createEmptyMovieClip("Frame", 9999);
    w = Item._width;
    h = iy + this.List.DownScroll._height;
    with (this.List.Frame)
    {
        lineStyle(1, "0x" + Globals.CurrentScheme.darkbevel_color, 100);
        lineTo(w, 0);
        lineTo(w, h);
        lineTo(0, h);
        lineTo(0, 0);
    } // End of with
    this.List.createEmptyMovieClip("Shadow", 0);
    this.List.Shadow._x = this.List.Shadow._y = 3;
    with (this.List.Shadow)
    {
        beginFill("0x000000", Globals.CurrentScheme.shadow_alpha);
        lineStyle(undefined);
        lineTo(w, 0);
        lineTo(w, h);
        lineTo(0, h);
        lineTo(0, 0);
    } // End of with
};

⌨️ 快捷键说明

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