📄 script1.as
字号:
Button.prototype.useHandCursor = false;
MovieClip.prototype.useHandCursor = false;
TextField.prototype.tabIndex = undefined;
Button.prototype.tabIndex = undefined;
MovieClip.prototype.tabIndex = undefined;
String.prototype.replace = function (strng, rep)
{
var temparray = this.split(strng);
return(temparray.join(rep));
};
XML.prototype.buildObject = function (xObj, obj)
{
if (xObj == null)
{
xObj = this;
} // end if
if (obj == null)
{
obj = {};
} // end if
var a;
var c;
var nName;
var nType;
var nValue;
var cCount;
for (a in xObj.attributes)
{
obj[a] = xObj.attributes[a];
} // end of for...in
for (c in xObj.childNodes)
{
nName = xObj.childNodes[c].nodeName;
nType = xObj.childNodes[c].nodeType;
nValue = xObj.childNodes[c].nodeValue;
if (nType == 3)
{
obj._value = nValue;
obj._type = "text";
} // end if
if (nType == 1 && nName != null)
{
if (obj[nName] == null)
{
obj[nName] = this.buildObject(xObj.childNodes[c], {});
}
else if (obj[nName]._type != "array")
{
obj[nName] = [obj[nName]];
obj[nName]._type = "array";
} // end if
if (obj[nName]._type == "array")
{
obj[nName].unshift(this.buildObject(xObj.childNodes[c], {}));
} // end if
} // end if
} // end of for...in
return(obj);
};
Object.prototype.copy = function ()
{
var prop;
var obj = new this.__proto__.constructor();
for (prop in this)
{
if (typeof(this[prop]) == "object")
{
obj[prop] = this[prop].copy();
}
else
{
obj[prop] = this[prop];
} // end if
} // end of for...in
return(obj);
};
ASSetPropFlags(Object.prototype, "copy", 1);
MovieClip.prototype.setBrightness = function (offset)
{
MyColor = new Color(this);
var Trans = new Object();
Trans.rb = Trans.gb = Trans.bb = offset;
MyColor.setTransform(Trans);
};
MovieClip.prototype.blink = function (loops)
{
this.bloop = 0;
this.bloops = loops;
this.onEnterFrame = function ()
{
this._visible = this._visible ? (false) : (true);
this.bloop++;
if (this.bloop > this.bloops)
{
this._visible = true;
this.onEnterFrame = undefined;
} // end if
};
};
MovieClip.prototype.flash = function (spd, loops)
{
this.val = 0;
this.spd = spd;
this.loops = loops;
this.loop = 0;
this.dir = 0;
this.onEnterFrame = function ()
{
this.val = this.dir ? (this.val + this.spd) : (this.val - this.spd);
if (this.dir && this.val > 125)
{
this.loop++;
this.dir = false;
}
else if (!this.dir && this.val < -125)
{
this.dir = true;
} // end if
if (this.loop == this.loops)
{
this.setBrightness(0);
this.onEnterFrame = undefined;
return(undefined);
} // end if
this.setBrightness(this.val);
updateAfterEvent();
};
};
MovieClip.prototype.addProperty("_depth", getDepth, swapDepths);
TextField.prototype.addProperty("_depth", getDepth, swapDepths);
MovieClip.prototype.drawButton3D = function (w, h, pressed, draw_shadow)
{
r = Globals.CurrentScheme.GUI_rounding;
b = Globals.CurrentScheme.GUI_bevelsize;
b2 = Globals.CurrentScheme.GUI_bevelsize3D;
colB = pressed ? (Globals.CurrentScheme.GUI_inset_color) : (Globals.CurrentScheme.color_background);
colH = pressed ? (Globals.CurrentScheme.darkbevel_color) : (Globals.CurrentScheme.highbevel_color);
colD = pressed ? (Globals.CurrentScheme.highbevel_color) : (Globals.CurrentScheme.darkbevel_color);
if (draw_shadow)
{
this.createEmptyMovieClip("Shadow", 1);
with (this.Shadow)
{
beginFill("0x000000", Number(Globals.Settings.shadow_alpha));
moveTo(w - r, 0);
lineTo(w, r);
lineTo(w, h - r);
lineTo(w - r, h);
lineTo(r, h);
lineTo(0, h - r);
lineTo(0, r);
lineTo(r, 0);
lineTo(w - r, 0);
endFill();
_x = _y = Number(Globals.Settings.shadow_offset);
} // End of with
} // end if
r1 = int(b2 / (w / 100) * 2.550000);
r2 = 255 - r1;
c1 = Number("0x" + colH);
c2 = Number("0x" + colB);
c3 = Number("0x" + colD);
colors = pressed ? ([c1, c2, c2, c2]) : ([c1, c2, c2, c3]);
alphas = [100, 100, 100, 100];
ratios = [0, r1, r2, 255];
Matrix = {matrixType: "box", x: 0, y: 0, w: w, h: h, r: 0};
this.createEmptyMovieClip("Bevel", 2);
with (this.Bevel)
{
beginGradientFill("linear", colors, alphas, ratios, Matrix);
lineStyle(b, "0x" + colD, 100);
moveTo(w - r, 0);
lineTo(w, r);
lineTo(w, h - r);
lineTo(w - r, h);
lineTo(r, h);
lineStyle(b, "0x" + colH, 100);
lineTo(0, h - r);
lineTo(0, r);
lineTo(r, 0);
endFill();
} // End of with
r1 = int(b2 / (h / 100) * 2.550000);
r2 = 255 - r1;
c1 = Number("0x" + colH);
c2 = Number("0x" + colB);
c3 = Number("0x" + colD);
colors = pressed ? ([c1, c2, c2, c2]) : ([c1, c2, c2, c3]);
alphas = [64, 50, 50, 50];
ratios = [0, r1, r2, 255];
Matrix = {matrixType: "box", x: 0, y: 0, w: w, h: h, r: 1.570796};
this.createEmptyMovieClip("Bevel2", 3);
with (this.Bevel2)
{
beginGradientFill("linear", colors, alphas, ratios, Matrix);
lineStyle(b, "0x" + colD, 100);
moveTo(w - r, 0);
lineTo(w, r);
lineTo(w, h - r);
lineTo(w - r, h);
lineTo(r, h);
lineStyle(b, "0x" + colH, 100);
lineTo(0, h - r);
lineTo(0, r);
lineTo(r, 0);
endFill();
} // End of with
};
MovieClip.prototype.drawButton = function (w, h, pressed, draw_shadow)
{
if (Globals.Settings.use_3D_buttons == "Yes")
{
this.drawButton3D(w, h, pressed, draw_shadow);
return(undefined);
} // end if
r = Globals.CurrentScheme.GUI_rounding;
b = Globals.CurrentScheme.GUI_bevelsize;
colB = pressed ? (Globals.CurrentScheme.GUI_inset_color) : (Globals.CurrentScheme.color_background);
colH = pressed ? (Globals.CurrentScheme.darkbevel_color) : (Globals.CurrentScheme.highbevel_color);
colD = pressed ? (Globals.CurrentScheme.highbevel_color) : (Globals.CurrentScheme.darkbevel_color);
if (draw_shadow)
{
this.createEmptyMovieClip("Shadow", 1);
with (this.Shadow)
{
beginFill("0x000000", Number(Globals.Settings.shadow_alpha));
moveTo(w - r, 0);
lineTo(w, r);
lineTo(w, h - r);
lineTo(w - r, h);
lineTo(r, h);
lineTo(0, h - r);
lineTo(0, r);
lineTo(r, 0);
lineTo(w - r, 0);
endFill();
_x = _y = Number(Globals.Settings.shadow_offset);
} // End of with
} // end if
this.createEmptyMovieClip("Bevel", 2);
with (this.Bevel)
{
beginFill("0x" + colB, 100);
lineStyle(b, "0x" + colD, 100);
moveTo(w - r, 0);
lineTo(w, r);
lineTo(w, h - r);
lineTo(w - r, h);
lineTo(r, h);
lineStyle(b, "0x" + colH, 100);
lineTo(0, h - r);
lineTo(0, r);
lineTo(r, 0);
lineTo(w - r, 0);
endFill();
} // End of with
};
MovieClip.prototype.drawArrow = function (w, h, dir, pressed)
{
colB = pressed ? (Globals.CurrentScheme.color_background) : (Globals.CurrentScheme.GUI_inset_color);
colD = pressed ? (Globals.CurrentScheme.darkbevel_color) : (Globals.CurrentScheme.highbevel_color);
colH = pressed ? (Globals.CurrentScheme.highbevel_color) : (Globals.CurrentScheme.darkbevel_color);
cx = Math.floor(this._width / 2);
cy = Math.floor(this._height / 2);
this.createEmptyMovieClip("Arrow", 4);
with (this.Arrow)
{
if (dir == "up")
{
beginFill("0x" + colB, 100);
moveTo(cx, cy - h / 2);
lineStyle(0, "0x" + colD, 100);
lineTo(cx + w / 2, cy + h / 2);
lineTo(cx - w / 2, cy + h / 2);
lineStyle(0, "0x" + colH, 100);
lineTo(cx, cy - h / 2);
endFill();
}
else
{
beginFill("0x" + colB, 100);
moveTo(cx - w / 2, cy - h / 2);
lineStyle(0, "0x" + colH, 100);
lineTo(cx + w / 2, cy - h / 2);
lineStyle(0, "0x" + colD, 100);
lineTo(cx, cy + h / 2);
lineTo(cx - w / 2, cy - h / 2);
endFill();
} // end if
} // End of with
};
MovieClip.prototype.drawCircle = function (w, h, inset)
{
b = Globals.CurrentScheme.GUI_bevelsize;
colB = inset ? (Globals.CurrentScheme.GUI_inset_color) : (Globals.CurrentScheme.font_selected);
colD = inset ? (Globals.CurrentScheme.darkbevel_color) : (Globals.CurrentScheme.highbevel_color);
colH = inset ? (Globals.CurrentScheme.highbevel_color) : (Globals.CurrentScheme.darkbevel_color);
ls = inset ? (b) : (undefined);
a = w;
b = h;
x = a;
y = b;
j = a * 0.707110;
n = b * 0.707110;
i = j - (b - n) * a / b;
m = n - (a - j) * b / a;
with (this)
{
beginFill("0x" + colB, 100);
moveTo(x + a, y);
lineStyle(ls, "0x" + colH, 100);
curveTo(x + a, y - m, x + j, y - n);
lineStyle(ls, "0x" + colD, 100);
curveTo(x + i, y - b, x, y - b);
curveTo(x - i, y - b, x - j, y - n);
curveTo(x - a, y - m, x - a, y);
curveTo(x - a, y + m, x - j, y + n);
lineStyle(ls, "0x" + colH, 100);
curveTo(x - i, y + b, x, y + b);
curveTo(x + i, y + b, x + j, y + n);
curveTo(x + a, y + m, x + a, y);
endFill();
} // End of with
};
MovieClip.prototype.drawFrame = function (w, h, inset)
{
r = Globals.CurrentScheme.GUI_rounding;
b = Globals.CurrentScheme.GUI_bevelsize;
col = inset ? (Globals.CurrentScheme.GUI_inset_color) : (Globals.CurrentScheme.highbevel_color);
with (this)
{
lineStyle(b, "0x" + col, 100);
moveTo(w - r, 0);
lineTo(w, r);
lineTo(w, h - r);
lineTo(w - r, h);
lineTo(r, h);
lineTo(0, h - r);
lineTo(0, r);
lineTo(r, 0);
lineTo(w - r, 0);
} // End of with
};
MovieClip.prototype.drawCheckbox = function (wi, he, is_tick)
{
b = is_tick ? (2) : (Globals.CurrentScheme.GUI_bevelsize);
col = Globals.CurrentScheme.font_selected;
colB = Globals.CurrentScheme.GUI_inset_color;
colD = Globals.CurrentScheme.highbevel_color;
colH = Globals.CurrentScheme.darkbevel_color;
if (is_tick)
{
with (this)
{
lineStyle(b, "0x" + col, 100);
lineTo(wi, he);
moveTo(0, he);
lineTo(wi, 0);
return(undefined);
} // End of with
} // end if
with (this)
{
beginFill("0x" + colB, 100);
lineStyle(b, "0x" + colD, 100);
moveTo(wi, 0);
lineTo(wi, he);
lineTo(0, he);
lineStyle(b, "0x" + colH, 100);
lineTo(0, 0);
lineTo(wi, 0);
endFill();
} // End of with
};
MovieClip.prototype.loadImage = function (imageURL, fadeEffect, defaultWidth, defaultHeight)
{
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 = defaultWidth ? (defaultWidth) : (_root.t_width);
this.h = defaultHeight ? (defaultHeight) : (_root.t_height);
this.fe = fadeEffect;
this._x = int(_root.t_x);
this._y = int(_root.t_y);
_root.Hourglass.show();
this._visible = false;
this._alpha = 0;
this.createEmptyMovieClip("Image", 1);
this.Image.loadMovie(imageURL);
this.onEnterFrame = function ()
{
if (this.Image._width)
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -