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

📄 script1.as

📁 flash 仿VISTA windows 效果 源码
💻 AS
📖 第 1 页 / 共 4 页
字号:
            this.Image._width = this.w;
            this.Image._height = this.h;
            this._visible = true;
            this._alpha = this._alpha + 4;
            if (this._alpha > 99 || this.fe != true)
            {
                this._alpha = 100;
                _root.Hourglass.hide();
                this.onEnterFrame = undefined;
            } // end if
        } // end if
    };
};
MovieClip.prototype.makeLabel = function (txt, align, tbold)
{
    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 = _root.t_height;
    this._x = int(_root.t_x);
    this._y = int(_root.t_y);
    this.createTextField("Caption", 1, 0, 0, this.w, this.h);
    this.Caption.multiline = true;
    this.Caption.wordWrap = true;
    this.Caption.autoSize = "left";
    this.Caption.selectable = false;
    this.Caption.text = txt;
    this.TextStyle_Nrm = Globals.TextStyle_Nrm.copy();
    this.TextStyle_Nrm.align = align;
    this.TextStyle_Nrm.bold = tbold;
    this.Caption.setTextFormat(this.TextStyle_Nrm);
    this.Caption._y = this.Caption._y - 4;
};
MovieClip.prototype.makeTitle = function (txt, align)
{
    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 = _root.t_height;
    this._x = int(_root.t_x);
    this._y = int(_root.t_y);
    this.createTextField("C1", 3, 0, 0, this.w, this.h);
    this.createTextField("C2", 2, 0, 0, this.w, this.h);
    this.C1.multiline = this.C2.multiline = true;
    this.C1.wordWrap = this.C2.wordWrap = true;
    this.C1.autoSize = this.C2.autoSize = "left";
    this.C1.selectable = this.C2.selectable = false;
    this.C1.text = this.C2.text = Globals.CurrentScheme.title_uppercase == "Yes" ? (txt.toUpperCase()) : (txt);
    this.TextStyle_Nrm = Globals.TextStyle_Nrm.copy();
    this.TextStyle_Hi = Globals.TextStyle_Nrm.copy();
    this.TextStyle_Nrm.align = this.TextStyle_Hi.align = align;
    this.TextStyle_Nrm.size = this.TextStyle_Hi.size = Globals.CurrentScheme.title_font_size;
    this.TextStyle_Nrm.bold = this.TextStyle_Hi.bold = true;
    this.TextStyle_Nrm.color = "0x" + Globals.CurrentScheme.title_font_color1;
    this.TextStyle_Hi.color = "0x" + Globals.CurrentScheme.title_font_color2;
    this.C1.setTextFormat(this.TextStyle_Nrm);
    this.C2.setTextFormat(this.TextStyle_Hi);
    this.C1._y = (this.h - this.C1._height) / 2;
    this.C2._y = this.C1._y + 1;
    this.C2._x = 1;
    this.createEmptyMovieClip("BG", 1);
    c1 = c2 = Number("0x" + Globals.CurrentScheme.title_bg_color);
    colors = [c1, c2];
    alphas = [0, 100];
    ratios = [0, 255];
    Matrix = {matrixType: "box", x: 0, y: 0, w: this.w, h: this.h, r: 0};
    with (this.BG)
    {
        beginGradientFill("linear", colors, alphas, ratios, Matrix);
        lineStyle(undefined);
        lineTo(this.w, 0);
        lineTo(this.w, this.h);
        lineTo(0, this.h);
        lineTo(0, 0);
        endFill();
    } // End of with
};
MovieClip.prototype.makeFrame = function ()
{
    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 = _root.t_height;
    this._x = int(_root.t_x);
    this._y = int(_root.t_y);
    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.createEmptyMovieClip("Frame1", 2);
    this.Frame1.drawFrame(this.w, this.h, true);
    this.createEmptyMovieClip("Frame2", 1);
    this.Frame2.drawFrame(this.w, this.h, false);
    this.Frame2._x = this.Frame2._y = 1;
};
MovieClip.prototype.makeButton = function (txt, auto_size, func)
{
    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 = _root.t_width > _root.t_height * 2 ? (Number(Globals.CurrentScheme.GUI_button_height)) : (_root.t_height);
    this._x = int(_root.t_x);
    this._y = int(_root.t_y);
    this.txt = txt;
    this.auto = auto_size ? (true) : (false);
    this.func = func ? (func) : (this + "_Clicked");
    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.createEmptyMovieClip("Captions", 6);
    this.Captions.createTextField("C1", 7, -1, -1, this.w, this.h + 1);
    this.Captions.createTextField("C2", 6, 0, 0, this.w, this.h + 1);
    this.Captions.C1.autoSize = this.Captions.C2.autoSize = false;
    this.Captions.C1.selectable = this.Captions.C2.selectable = false;
    this.Captions.C1.text = this.Captions.C2.text = this.auto ? (" " + this.txt + " ") : (this.txt);
    this.TextStyle_Nrm = Globals.TextStyle_Nrm.copy();
    this.TextStyle_Sel = Globals.TextStyle_Sel.copy();
    this.TextStyle_Dis = Globals.TextStyle_Dis.copy();
    this.TextStyle_Bev = Globals.TextStyle_Nrm.copy();
    this.TextStyle_Bev.color = "0x" + Globals.CurrentScheme.highbevel_color;
    this.TextStyle_Nrm.align = this.TextStyle_Sel.align = this.TextStyle_Dis.align = this.TextStyle_Bev.align = "center";
    this.TextStyle_Nrm.size = this.TextStyle_Sel.size = this.TextStyle_Dis.size = this.TextStyle_Bev.size = Globals.CurrentScheme.GUI_font_size;
    this.Captions.C1.setTextFormat(this.TextStyle_Nrm);
    this.Captions.C2.setTextFormat(this.TextStyle_Bev);
    this.Captions.C2._visible = Globals.Settings.use_3D_buttontext == "Yes" ? (true) : (false);
    this.timer_adjust = setInterval(this, "func_adjust", 1);
    this.func_adjust = function ()
    {
        if (this.auto)
        {
            this.Captions.C1._width = this.Captions.C1.textWidth + 5;
            this.Captions.C2._width = this.Captions.C2.textWidth + 5;
            this.old_w = this.w;
            this.w = this.Captions._width;
        } // end if
        this.drawButton(this.w, this.h, false);
        clearInterval(this.timer_adjust);
        if (this.auto)
        {
            this._x = this._x + this.old_w / 2 - this._width / 2;
            this._y = this._y + this.h / 2 - this._height / 2;
        } // end if
    };
    this.Captions._x = (this.w - this.Captions._width) / 2 + 2;
    this.Captions._y = (this.h - this.Captions._height) / 2;
    this.onRollOver = function ()
    {
        if (this.tooltip.length)
        {
            _root.showTooltip(this.tooltip);
        } // end if
    };
    this.onRollOut = function ()
    {
        _root.hideTooltip();
    };
    this.onPress = function ()
    {
        this.Window.focus();
        _root.hideTooltip();
        if (this.disabled)
        {
            return(undefined);
        } // end if
        eval(this + "_Pressed")();
        _root.playSound("buttonClick");
        this.drawButton(this.w, this.h, true);
        this.Captions._x++;
        this.Captions._y++;
    };
    this.onRelease = this.onReleaseOutside = function ()
    {
        if (this.disabled)
        {
            return(undefined);
        } // end if
        eval(this + "_Released")();
        this.drawButton(this.w, this.h, false);
        this.Captions._x--;
        this.Captions._y--;
    };
    this.disable = function ()
    {
        this.disabled = true;
        this.Captions.C1.setTextFormat(this.TextStyle_Dis);
        this.Captions.C2._visible = true;
    };
    this.enable = function ()
    {
        this.disabled = false;
        this.Captions.C1.setTextFormat(this.TextStyle_Nrm);
        this.Captions.C2._visible = Globals.Settings.use_3D_buttontext == "Yes" ? (true) : (false);
    };
    this.disableKey = function ()
    {
        Key.removeListener(this);
    };
    this.enableKey = function (keyCode)
    {
        this.keyCode = keyCode;
        Key.addListener(this);
        this.onUnload = function ()
        {
            Key.removeListener(this);
        };
        this.onKeyUp = function ()
        {
            if (this.keyPressed)
            {
                this.keyPressed = false;
                this.onRelease();
            } // end if
        };
        this.onKeyDown = function ()
        {
            if (!this.Window.onTop || this.keyPressed || this.disabled)
            {
                return(undefined);
            } // end if
            if (Key.getCode() == this.keyCode)
            {
                this.keyPressed = true;
                this.onPress();
            } // end if
        };
    };
};
MovieClip.prototype.makeRadioButton = function (mTxt, mVar, mVal, 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 = this.h = Number(Globals.CurrentScheme.GUI_checkbox_size) / 2;
    this._x = _root.t_x;
    this._y = _root.t_y;
    this.mTxt = mTxt;
    this.mVal = mVal;
    this.mFnc = mFnc ? (mFnc) : (this + "_Clicked");
    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.drawCircle(this.w, this.h, true);
    this.createEmptyMovieClip("Tick", 1);
    this.Tick.drawCircle(this.w, this.h, false);
    this.Tick._width = this.Tick._height = this.Tick._height / 2;
    this.Tick._x = this.Tick._y = this.w / 2;
    this.Tick._visible = this.mObj[this.mVar] == this.mVal ? (true) : (false);
    this.createTextField("Caption", 2, 0, 0, 10, 10);
    this.Caption.autoSize = "left";
    this.Caption.selectable = false;
    this.Caption.text = this.mTxt;
    this.TextStyle_Nrm = Globals.TextStyle_Nrm.copy();
    this.TextStyle_Dis = Globals.TextStyle_Dis.copy();
    this.TextStyle_Nrm.size = this.TextStyle_Dis.size = Globals.CurrentScheme.GUI_font_size;
    this.Caption.setTextFormat(this.TextStyle_Nrm);
    this.Caption._x = this.w + 6;
    this.Caption._y = -(this.Caption._height - this.h) / 2 + 2;
    this.check = function ()
    {
        this.Tick._visible = this.checked = true;
        this.mObj[this.mVar] = this.mVal;
        this.mFnc();
        for (z in this._parent)
        {
            if (this._parent[z] != this && this._parent[z].mVar == this.mVar)
            {
                this._parent[z].uncheck();
            } // end if
        } // end of for...in
    };
    this.uncheck = function ()

    {
        this.Tick._visible = this.checked = false;
    };
    this.disable = function ()
    {
        this.disabled = true;
        this._alpha = 50;
        this.Caption.setTextFormat(this.TextStyle_Dis);
    };
    this.enable = function ()
    {
        this.disabled = false;
        this._alpha = 100;
        this.Caption.setTextFormat(this.TextStyle_Nrm);
    };
    this.onRollOver = function ()
    {
        if (this.tooltip.length)
        {
            _root.showTooltip(this.tooltip);
        } // end if
    };
    this.onRollOut = function ()
    {
        _root.hideTooltip();
    };
    this.onPress = function ()
    {
        this.Window.focus();
        _root.hideTooltip();
        if (!this.disabled && !this.Tick._visible)
        {
            _root.playSound("buttonClick");
            this.check();
        } // end if
    };
};
MovieClip.prototype.makeCheckbox = function (mTxt, mVar, mVals, 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 = this.h = Number(Globals.CurrentScheme.GUI_checkbox_size);
    this._x = _root.t_x;
    this._y = _root.t_y;
    this.mTxt = mTxt;
    this.mVal1 = mVals.split("|")[0];
    this.mVal2 = mVals.split("|")[1];
    this.mFnc = mFnc ? (mFnc) : (this + "_Clicked");
    temp = mVar.split(".");
    this.mVar = temp.pop();
    this.mObj = temp.join(".");
    if (this.mObj[this.mVar] != this.mVal1)
    {
        this.mObj[this.mVar] = this.mVal2;
    } // end if
    if (this.mObj[this.mVar] == this.mVal1)
    {
        this.checked = true;
    } // end if
    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.drawCheckbox(this.w, this.h, false);
    this.createEmptyMovieClip("Tick", 1);
    this.Tick.drawCheckbox(this.w - 4, this.h - 4, true);
    this.Tick._x = this.Tick._y = 2;
    this.Tick._visible = this.mObj[this.mVar] == this.mVal1 ? (true) : (false);
    this.createTextField("Caption", 2, 0, 0, 10, 10);
    this.Caption.autoSize = "left";
    this.Caption.selectable = false;
    this.Caption.text = this.mTxt;
    this.TextStyle_Nrm = Globals.TextStyle_Nrm.copy();
    this.TextStyle_Dis = Globals.TextStyle_Dis.copy();
    this.TextStyle_Nrm.size = this.TextStyle_Dis.size = Globals.CurrentScheme.GUI_font_size;
    this.Caption.setTextFormat(this.TextStyle_Nrm);
    this.Caption._x = this.w / 2 + 6;
    this.Caption._y = -(this.Caption._height - this.h / 2) / 2 + 2;
    this.check = function ()
    {
        this.Tick._visible = this.checked = true;
        this.mObj[this.mVar] = this.mVal1;
        this.mFnc();
    };
    this.uncheck = function ()
    {
        this.Tick._visible = this.checked = false;
        this.mObj[this.mVar] = this.mVal2;

⌨️ 快捷键说明

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