📄 script1.as
字号:
this.mFnc();
};
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)
{
return(undefined);
} // end if
_root.playSound("buttonClick");
if (this.checked)
{
this.uncheck();
}
else
{
this.check();
} // end if
};
};
MovieClip.prototype.makeSlider = function (mVar, mMin, mMax, mStp, 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 = _root.t_height;
this._x = _root.t_x;
this._y = _root.t_y;
this.mMin = mMin;
this.mMax = mMax;
this.mStp = mStp ? (mStp) : (1);
this.mStps = int((mMax - mMin) / mStp);
this.mFnc = mFnc ? (mFnc) : (this + "_Changed");
this.vertical = this.h > this.w ? (true) : (false);
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.bw = Number(Globals.CurrentScheme.GUI_button_height);
this.createEmptyMovieClip("BU", 1);
this.BU.drawButton(this.bw, this.bw, false);
if (this.vertical)
{
this.BU._x = this.BU._x - (this.w / 2 + 2);
this.BU._y = -this.BU._height / 2;
this.drawCheckbox(2, this.h, false);
this._x = this._x + (this.w - 1);
this.t = this.BU._y;
this.b = this.t + this.h;
this.oneValPercent = (this.mMax - this.mMin) / 100;
this.stepSpacing = this.h / this.mStps;
if (this.stepSpacing > 2)
{
for (y = 0; y <= this.mStps; y++)
{
this.moveTo(3, y * this.stepSpacing);
this.lineTo(6, y * this.stepSpacing);
} // end of for
} // end if
this.BU.Bevel.lineStyle(1, "0x" + Globals.CurrentScheme.darkbevel_color, 100);
this.BU.Bevel.moveTo(this.bw / 4, this.bw - this.bw / 3);
this.BU.Bevel.lineTo(this.bw - this.bw / 4, this.bw - this.bw / 3);
this.BU.Bevel.moveTo(this.bw / 4, this.bw / 3);
this.BU.Bevel.lineTo(this.bw - this.bw / 4, this.bw / 3);
this.BU.Bevel.lineStyle(1, "0x" + Globals.CurrentScheme.highbevel_color, 100);
this.BU.Bevel.moveTo(this.bw / 4, this.bw - this.bw / 3 + 1);
this.BU.Bevel.lineTo(this.bw - this.bw / 4, this.bw - this.bw / 3 + 1);
this.BU.Bevel.moveTo(this.bw / 4, this.bw / 3 + 1);
this.BU.Bevel.lineTo(this.bw - this.bw / 4, this.bw / 3 + 1);
}
else
{
this.BU._x = -this.BU._width / 2;
this.BU._y = this.BU._y - (this.h / 2 + 2);
this.drawCheckbox(this.w, 2, false);
this._y = this._y + (this.h - 1);
this.l = this.BU._x;
this.r = this.l + this.w;
this.oneValPercent = (this.mMax - this.mMin) / 100;
this.stepSpacing = this.w / this.mStps;
if (this.stepSpacing > 2)
{
for (x = 0; x <= this.mStps; x++)
{
this.moveTo(x * this.stepSpacing, 3);
this.lineTo(x * this.stepSpacing, 6);
} // end of for
} // end if
this.BU.Bevel.lineStyle(1, "0x" + Globals.CurrentScheme.darkbevel_color, 100);
this.BU.Bevel.moveTo(this.bw - this.bw / 3, this.bw / 4);
this.BU.Bevel.lineTo(this.bw - this.bw / 3, this.bw - this.bw / 4);
this.BU.Bevel.moveTo(this.bw / 3, this.bw / 4);
this.BU.Bevel.lineTo(this.bw / 3, this.bw - this.bw / 4);
this.BU.Bevel.lineStyle(1, "0x" + Globals.CurrentScheme.highbevel_color, 100);
this.BU.Bevel.moveTo(this.bw - this.bw / 3 + 1, this.bw / 4);
this.BU.Bevel.lineTo(this.bw - this.bw / 3 + 1, this.bw - this.bw / 4);
this.BU.Bevel.moveTo(this.bw / 3 + 1, this.bw / 4);
this.BU.Bevel.lineTo(this.bw / 3 + 1, this.bw - this.bw / 4);
} // end if
this.setSlider = function ()
{
this.mFnc();
pos = (this.mObj[this.mVar] - this.mMin) / this.mStp * this.stepSpacing;
if (this.vertical)
{
this.BU._y = this.b - pos;
}
else
{
this.BU._x = this.l + pos;
} // end if
};
this.setValue = function (val)
{
this.mObj[this.mVar] = val;
this.setSlider();
};
this.setPercent = function (val)
{
this.mObj[this.mVar] = this.mMin + val * this.oneValPercent;
this.setSlider();
};
this.getPercent = function ()
{
return(int((this.mObj[this.mVar] - this.mMin) / this.oneValPercent));
};
this.draggingY = function ()
{
this.BU._y = int(this._ymouse / this.stepSpacing) * this.stepSpacing - this.bw / 2;
if (this.BU._y < this.t)
{
this.BU._y = this.t;
}
else if (this.BU._y > this.b)
{
this.BU._y = this.b;
} // end if
this.mObj[this.mVar] = this.mMin + Math.floor((this.b - this.BU._y + this.bw / 2) / this.stepSpacing) * this.mStp;
if (this.mObj[this.mVar] != this.lastVal)
{
_root.playSound("sliderChange");
this.lastVal = this.mObj[this.mVar];
this.mFnc();
} // end if
updateAfterEvent();
};
this.draggingX = function ()
{
this.BU._x = int(this._xmouse / this.stepSpacing) * this.stepSpacing - this.bw / 2;
if (this.BU._x < this.l)
{
this.BU._x = this.l;
}
else if (this.BU._x > this.r)
{
this.BU._x = this.r;
} // end if
this.mObj[this.mVar] = this.mMin + Math.ceil((this.BU._x + this.bw / 2) / this.stepSpacing) * this.mStp;
if (this.mObj[this.mVar] != this.lastVal)
{
_root.playSound("sliderChange");
this.lastVal = this.mObj[this.mVar];
this.mFnc();
} // end if
updateAfterEvent();
};
this.disable = function ()
{
this.disabled = true;
this.BU._visible = false;
this._alpha = 50;
};
this.enable = function ()
{
this.disabled = false;
this.BU._visible = true;
this._alpha = 100;
};
this.onPress = function ()
{
this.Window.focus();
if (this.disabled)
{
return(undefined);
} // end if
this.onMouseMove = this.vertical ? (this.draggingY) : (this.draggingX);
};
this.onRelease = this.onReleaseOutside = function ()
{
this.onMouseMove = undefined;
};
if (this.mObj[this.mVar])
{
this.setValue(this.mObj[this.mVar]);
}
else
{
this.setValue(this.mMin);
} // end if
};
TextField.prototype.makeTextbox = function (TextStyle)
{
size = Globals.CurrentScheme.GUI_scrollbar_size;
bevs = Globals.CurrentScheme.GUI_bevelsize;
properties = ["_width", "_height", "_x", "_y", "_name", "_depth", "text", "html", "htmlText", "type", "selectable", "border", "borderColor", "background", "backgroundColor", "restrict", "variable", "maxChars", "multiline", "password"];
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._x = _root.t_x;
this._y = _root.t_y;
this.mFnc = this + "_Changed";
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, _root.t_width, _root.t_height);
this._parent.tabs++;
this.Textbox.tabIndex = this._parent.tabs;
this.Textbox._width = _root.t_width;
this.Textbox._height = _root.t_height;
this.Textbox.text = _root.ttext;
this.Textbox.html = _root.thtml;
this.Textbox.htmlText = _root.ttext;
this.Textbox.html = _root.thtmlText;
this.Textbox.htmlText = _root.thtmlText;
this.Textbox.type = _root.ttype;
this.Textbox.selectable = false;
this.Textbox.border = _root.tborder;
this.Textbox.borderColor = _root.tborderColor;
this.Textbox.background = _root.tbackground;
this.Textbox.backgroundColor = _root.tbackgroundColor;
this.Textbox.restrict = _root.trestrict;
this.Textbox.variable = _root.tvariable;
this.Textbox.maxChars = _root.tmaxChars;
this.Textbox.password = _root.tpassword;
this.Textbox.multiline = _root.ttype == "input" ? (_root.tmultiline) : (true);
this.Textbox.wordWrap = true;
this.Textbox.max_width = _root.t_width;
this.Textbox.min_width = _root.t_width - size;
this.Textbox._width = this.Textbox.max_width;
if (_root.ttype == "input")
{
this.Textbox.rememberVar = this._parent._parent.windowTitle + this._name + "_value";
this.Textbox.text = _root[this.Textbox.rememberVar];
this.Textbox.type = "input";
this.Textbox.selectable = true;
this.Textbox.border = true;
this.Textbox.background = true;
this.Textbox.borderColor = "0x" + Globals.CurrentScheme.darkbevel_color;
this.Textbox.backgroundColor = "0x" + Globals.CurrentScheme.input_bg_color;
this.Textbox.onUnload = function ()
{
Key.removeListener(this);
};
this.Textbox.onSetFocus = function ()
{
Key.addListener(this);
};
this.Textbox.onKillFocus = function ()
{
Key.removeListener(this);
};
this.Textbox.onChanged = function ()
{
_root[this.rememberVar] = this.text;
this.setTextFormat(this._parent.TextStyle);
_root.playSound("textWrite");
};
} // end if
this.init = function ()
{
this.Textbox.setTextFormat(this.TextStyle);
if (this.Textbox.maxscroll < 2 || !this.Bar)
{
this.Textbox._width = this.Textbox.max_width;
this.BU._visible = this.Bar._visible = this.BD._visible = this.SB._visible = false;
}
else
{
this.Textbox._width = this.Textbox.min_width;
this.BU._visible = this.Bar._visible = this.BD._visible = this.SB._visible = true;
} // end if
this.vis_lines = this.Textbox.bottomScroll - this.Textbox.scroll + 1;
this.tot_lines = this.Textbox.maxscroll + this.vis_lines;
this.view_percent = int(this.vis_lines / (this.tot_lines / 100));
this.SB.drawButton(size, this.view_percent * (this.Bar._height / 100), false);
this.SB._y = this.SB.top + (this.Textbox.scroll - 1) * (this.Bar._height / this.tot_lines);
this.setTextScroll();
};
this.setTextScroll = function ()
{
if (this.SB._y < this.SB.top)
{
this.SB._y = this.SB.top;
}
else if (this.SB._y > this.SB.bot - this.SB._height)
{
this.SB._y = this.SB.bot - this.SB._height;
} // end if
this.top_line = int((this.SB._y - this.SB.top) / (this.Bar._height / this.tot_lines)) + 1;
this.Textbox.scroll = this.top_line;
};
this.setText = function (txt)
{
this.Textbox.text = this.Textbox.type == "input" ? (txt) : (txt + "\n\n");
this.init();
};
this.getText = function ()
{
return(this.Textbox.text);
};
this.setHTML = function (txt)
{
this.Textbox.html = true;
this.Textbox.htmlText = txt + "<BR><BR>";
this.init();
};
this.getHTML = function ()
{
return(this.Textbox.htmlText);
};
this.scrollToBottom = function ()
{
this.SB._y = this.SB.bot - this.SB._height;
this.setTextScroll();
};
this.scrollToTop = function ()
{
this.SB._y = this.SB.top;
this.setTextScroll();
};
this.getNumOfLines = function ()
{
return(this.Textbox.bottomScroll - this.Textbox.scroll + 1 + (this.Textbox.maxscroll - 1));
};
if (TextStyle != undefined)
{
this.TextStyle = TextStyle.copy();
}
else
{
this.TextStyle = Globals.TextStyle_Nrm.copy();
} // end if
if (_root.ttype == "input")
{
this.TextStyle.color = "0x" + Globals.CurrentScheme.input_font_color;
} // end if
this.Textbox.setTextFormat(this.TextStyle);
if (this.Textbox.type == "input" && !this.Textbox.multiline)
{
return(undefined);
} // end if
if (this.Textbox._height < size * 4)
{
return(undefined);
} // end if
this.createEmptyMovieClip("BU", 2);
this.BU.drawButton(size, size, false);
this.BU.drawArrow(size / 2, size / 2, "up", false);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -