📄 xplook.as
字号:
}
break;
case "left":
pseudo.Global.drawRect(movie, x + halfSize - 2, y, 2, 1, clr, alpha);
pseudo.Global.drawRect(movie, x + halfSize - 2, y + size - 1, 2, 1, clr, alpha);
for(var i:Number = 1; i < halfSize; i++)
{
pseudo.Global.drawRect(movie, x + halfSize - i - 2, y + i, 3, 1, clr, alpha);
pseudo.Global.drawRect(movie, x + halfSize - i - 2, y + size - i - 1, 3, 1, clr, alpha);
}
break;
case "right":
pseudo.Global.drawRect(movie, x, y, 2, 1, clr, alpha);
pseudo.Global.drawRect(movie, x, y + size - 1, 2, 1, clr, alpha);
for(var i:Number = 1; i < halfSize; i++)
{
pseudo.Global.drawRect(movie, x + i - 1, y + i, 3, 1, clr, alpha);
pseudo.Global.drawRect(movie, x + i - 1, y + size - i - 1, 3, 1, clr, alpha);
}
break;
}
}
private function drawResizeBtnLayer(movie:MovieClip, nW:Number, nH:Number, data:Object):Void
{
movie.clear();
drawRoundBtn(movie, 0, 0, nW, nH, 0x028af1, 0x015796, data);
var bSunken:Boolean = data.state == "sunken";
switch(data.type)
{
case "resizeRight":
case "resizeLeft":
drawSingleArrow(movie, 4, 4, nW - 8, nH - 8, (bSunken && data.type == "resizeRight" ||
!bSunken && data.type == "resizeLeft") ? "left" : "right", 0xffffff, 100);
break;
case "resizeTop":
case "resizeBottom":
drawSingleArrow(movie, 4, 4, nW - 8, nH - 8, (bSunken && data.type == "resizeTop" ||
!bSunken && data.type == "resizeBottom") ? "down" : "up", 0xffffff, 100);
break;
}
}
private function drawScroll(movie:MovieClip, nW:Number, nH:Number, col:Number, colBg:Number, data:Object):Void
{
drawRoundBtn(movie, 0, 0, nW, nH, col, colBg, data);
if(data.dir == "vert")
{
if(nH > 15)
{
var x:Number = 3;
var y:Number = Math.round((nH - 8) / 2);
var w:Number = nW - 6;
for(var i:Number = 0; i < 8; i++)
pseudo.Global.drawRect(movie, x + (i % 2 ? 1 : 0), y + i, w, 1, i % 2 ? 0x006ab8 : 0xc9e7ec);
}
}
else
{
if(nW > 15)
{
var x:Number = Math.round((nW - 8) / 2);
var y:Number = 3;
var h:Number = nH - 6;
for(var i:Number = 0; i < 8; i++)
pseudo.Global.drawRect(movie, x + i, y + (i % 2 ? 1 : 0), h, i % 2 ? 0x006ab8 : 0xc9e7ec, 1);
}
}
}
private function drawScrollLayer(movie:MovieClip, nW:Number, nH:Number, data:Object):Void
{
//change arrow box
// drawSquareBtn(movie, 0, 0, nW, nH, 0x028af1, 0x015796, data);
drawSquareBtn(movie, 0, 0, nW, nH, 0x6180AA, 0x6180AA, data);
var dir:String = "";
switch(data.dir)
{
case "vert":
switch(data.type)
{
case "scrollLow": dir="up"; break;
case "scrollHi": dir="down"; break;
}
break;
case "horz":
switch(data.type)
{
case "scrollLow": dir="left"; break;
case "scrollHi": dir="right"; break;
}
break;
}
if(dir) drawSingleArrow(movie, 3, 3, nW - 6, nH - 6, dir, 0xffffff);
}
//
// different shapes drawing routine
//
private function drawCross(movie:MovieClip, nX:Number, nY:Number, nW:Number, nH:Number, clr:Number, alpha:Number):Void
{
var size:Number = 8;
var size2:Number = Math.round(size / 2);
var x:Number = nX + Math.round((nW - size) / 2);
var y:Number = nY + Math.round((nH - size) / 2);
drawLine(movie, x, y, x + size - 1, y + size - 1, clr, alpha);
drawLine(movie, x + 1, y, x + size - 1, y + size - 2, clr, alpha);
drawLine(movie, x, y + 1, x + size - 2, y + size - 1, clr, alpha);
drawLine(movie, x, y + size - 1, x + size2 - 2, y + size2 + 1, clr, alpha);
drawLine(movie, x + 1, y + size - 1, x + size2 - 1, y + size2 + 1, clr, alpha);
drawLine(movie, x, y + size - 2, x + size2 - 2, y + size2, clr, alpha);
drawLine(movie, x + size2 + 1, y + size2 - 2, x + size - 1, y, clr, alpha);
drawLine(movie, x + size2 + 1, y + size2 - 1, x + size - 1, y + 1, clr, alpha);
drawLine(movie, x + size2, y + size2 - 2, x + size - 2, y, clr, alpha);
}
private function drawFillRect(movie:MovieClip, x:Number, y:Number, w:Number, h:Number):Void
{
movie.moveTo(x, y);
movie.lineTo(x + w, y);
movie.lineTo(x + w, y + h);
movie.lineTo(x, y + h);
movie.lineTo(x, y);
}
private function drawScrollBack(movie:MovieClip, nW:Number, nH:Number, data:Object):Void
{
movie.clear();
var bVert:Boolean = data.dir == "vert";
var colors:Array = new Array(0xe6e8ee, 0xfcfcfe);
var alphas:Array = new Array(100, 100);
var ratios:Array = new Array(0, 188);
var matrix:Object = {matrixType:"box", x:0, y:0, w:nW, h:nH, r:bVert ? 0 : Math.PI / 2};
movie.lineStyle(1, 0xe6e7ee);
movie.beginGradientFill("linear", colors, alphas, ratios, matrix);
drawFillRect(movie, 0.5, 0.5, nW - 1, nH - 1);
movie.endFill();
movie.lineStyle(undefined);
delete colors;
delete alphas;
delete ratios;
delete matrix;
}
private function drawOvalRect(movie:MovieClip, x:Number, y:Number,
w:Number, h:Number, color:Number, nAlpha:Number, nSize:Number):Void
{
var rx:Number = Math.abs(w / 2);
var ry:Number = Math.abs(h / 2);
drawOval(movie, x + rx, y + ry, rx, ry, color, nAlpha, nSize);
}
private function fillOvalRect(movie:MovieClip, x:Number, y:Number, w:Number, h:Number,
bgCol:Number, bgAlpha:Number, lineCol:Number, lineAlpha:Number):Void
{
if(!bgAlpha) bgAlpha = 100;
movie.beginFill(bgCol, bgAlpha)
drawOvalRect(movie, x, y, w, h, lineCol, lineAlpha);
movie.endFill();
}
private function drawOval(movie:MovieClip, x:Number, y:Number,
radius:Number, yRadius:Number, color:Number, nAlpha:Number, nSize:Number):Void
{
if (arguments.length < 3) return;
if(nSize == undefined || nSize == null) nSize = 1;
if(nAlpha == undefined) nAlpha = 100;
if(color != null && color != undefined) movie.lineStyle(nSize, color, nAlpha);
else movie.lineStyle(null, null, null);
// init variables
var theta, xrCtrl, yrCtrl, angle, angleMid, px, py, cx, cy:Number;
// if only yRadius is undefined, yRadius = radius
if (yRadius == undefined) yRadius = radius;
// convert 45 degrees to radians for our calculations
theta = Math.PI / 4;
// calculate the distance for the control point
xrCtrl = radius / Math.cos(theta / 2);
yrCtrl = yRadius / Math.cos(theta / 2);
// start on the right side of the circle
angle = 0;
movie.moveTo(x + radius, y);
// this loop draws the circle in 8 segments
for (var i = 0; i < 8; i++)
{
// increment our angles
angle += theta;
angleMid = angle - (theta / 2);
// calculate our control point
cx = x + Math.cos(angleMid) * xrCtrl;
cy = y + Math.sin(angleMid) * yrCtrl;
// calculate our end point
px = x + Math.cos(angle) * radius;
py = y + Math.sin(angle) * yRadius;
// draw the circle segment
movie.curveTo(cx, cy, px, py);
}
}
function drawSquareBtn(movie:MovieClip, x:Number, y:Number, w:Number, h:Number, col:Number, colBorder:Number, data:Object):Void
{
movie.clear();
var r:Number = Math.min(data.type == "scrollLow" || data.type == "scrollHi" ? 1 : 3, Math.min(w, h) / 2);
fillRoundRect(movie, x + 0.5, y + 0.5, w - 0.5, h - 0.5, r, col, 100, colBorder, 100);
var colors:Array = new Array(0xffffff, 0xffffff);
var alphas:Array = new Array(60, 0);
var ratios:Array = new Array(40, 255);
var flareH:Number = h * 2 / 3;
var matrix:Object = {a:w - 2, b:0, c:0, d:0, e:flareH, f:0, g:w / 4, h:h / 4, i:1};
movie.beginGradientFill("radial", colors, alphas, ratios, matrix);
// movie.beginGradientFill("radial", 0xFF0000, alphas, ratios, matrix);
drawRoundRect(movie, 1, 1, w - 1, flareH + 1, Math.max(0, r - 0.5));
movie.endFill();
switch(data.mode)
{
case "press": fillRoundRect(movie, x, y, w, h, r, 0, 10); break;
case "over": fillRoundRect(movie, x, y, w, h, r, 0xffffff, 20); break;
}
}
//
// round green button
//
private function drawRoundRect(movie:MovieClip, nX1:Number, nY1:Number, nX2:Number,
nY2:Number, cornerRadius:Number, color:Number, alpha:Number, nSize:Number):Void
{
if(nSize == undefined || nSize == null) nSize = 1;
if(alpha == undefined) alpha = 100;
if(color == null || color == undefined) movie.lineStyle(undefined);
else movie.lineStyle(nSize, color, alpha);
var x:Number = Math.min(nX1, nX2);
var y:Number = Math.min(nY1, nY2);
var w:Number = Math.abs(nX2 - nX1);
var h:Number = Math.abs(nY2 - nY1);
// ==============
// mc.drawRect() - by Ric Ewing (ric@formequalsfunction.com) - version 1.1 - 4.7.2002
//
// x, y = top left corner of rect
// w = width of rect
// h = height of rect
// cornerRadius = [optional] radius of rounding for corners (defaults to 0)
// ==============
if (arguments.length < 4) return;
// if the user has defined cornerRadius our task is a bit more complex. :)
if (cornerRadius > 0)
{
// init vars
var theta, angle, cx, cy, px, py;
// make sure that w + h are larger than 2*cornerRadius
var cr:Number = Math.min(w, h) / 2;
if (cornerRadius > cr)
cornerRadius = cr;
// theta = 45 degrees in radians
theta = Math.PI / 4;
// draw top line
movie.moveTo(x + cornerRadius, y);
movie.lineTo(x + w - cornerRadius, y);
//angle is currently 90 degrees
angle = -Math.PI / 2;
// draw tr corner in two parts
cx = x + w - cornerRadius + (Math.cos(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
cy = y + cornerRadius + (Math.sin(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
px = x + w - cornerRadius + (Math.cos(angle + theta) * cornerRadius);
py = y + cornerRadius + (Math.sin(angle + theta) * cornerRadius);
movie.curveTo(cx, cy, px, py);
angle += theta;
cx = x + w - cornerRadius + (Math.cos(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
cy = y + cornerRadius + (Math.sin(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
px = x + w - cornerRadius + (Math.cos(angle + theta) * cornerRadius);
py = y + cornerRadius + (Math.sin(angle + theta) * cornerRadius);
movie.curveTo(cx, cy, px, py);
// draw right line
movie.lineTo(x + w, y + h - cornerRadius);
// draw br corner
angle += theta;
cx = x + w - cornerRadius + (Math.cos(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
cy = y + h - cornerRadius + (Math.sin(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
px = x + w - cornerRadius + (Math.cos(angle + theta) * cornerRadius);
py = y + h - cornerRadius + (Math.sin(angle + theta) * cornerRadius);
movie.curveTo(cx, cy, px, py);
angle += theta;
cx = x + w - cornerRadius + (Math.cos(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
cy = y + h - cornerRadius + (Math.sin(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
px = x + w - cornerRadius + (Math.cos(angle + theta) * cornerRadius);
py = y + h - cornerRadius + (Math.sin(angle + theta) * cornerRadius);
movie.curveTo(cx, cy, px, py);
// draw bottom line
movie.lineTo(x+cornerRadius, y+h);
// draw bl corner
angle += theta;
cx = x + cornerRadius + (Math.cos(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
cy = y + h - cornerRadius + (Math.sin(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
px = x + cornerRadius + (Math.cos(angle + theta) * cornerRadius);
py = y + h - cornerRadius + (Math.sin(angle + theta) * cornerRadius);
movie.curveTo(cx, cy, px, py);
angle += theta;
cx = x + cornerRadius + (Math.cos(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
cy = y + h - cornerRadius + (Math.sin(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
px = x + cornerRadius + (Math.cos(angle + theta) * cornerRadius);
py = y + h - cornerRadius + (Math.sin(angle + theta) * cornerRadius);
movie.curveTo(cx, cy, px, py);
// draw left line
movie.lineTo(x, y + cornerRadius);
// draw tl corner
angle += theta;
cx = x + cornerRadius + (Math.cos(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
cy = y + cornerRadius + (Math.sin(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
px = x + cornerRadius + (Math.cos(angle+ theta) * cornerRadius);
py = y + cornerRadius + (Math.sin(angle + theta) * cornerRadius);
movie.curveTo(cx, cy, px, py);
angle += theta;
cx = x + cornerRadius + (Math.cos(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
cy = y + cornerRadius + (Math.sin(angle + (theta / 2)) * cornerRadius / Math.cos(theta / 2));
px = x + cornerRadius + (Math.cos(angle + theta) * cornerRadius);
py = y + cornerRadius + (Math.sin(angle + theta) * cornerRadius);
movie.curveTo(cx, cy, px, py);
}
else
{
// cornerRadius was not defined or = 0. This makes it easy.
movie.moveTo(x, y);
movie.lineTo(x + w, y);
movie.lineTo(x + w, y + h);
movie.lineTo(x, y + h);
movie.lineTo(x, y);
}
}
private function fillRoundRect(movie:MovieClip, x:Number, y:Number, w:Number, h:Number, r:Number,
bgCol:Number, bgAlpha:Number, lineCol:Number, lineAlpha:Number):Void
{
if(!bgAlpha) bgAlpha = 100;
movie.beginFill(bgCol, bgAlpha)
//Change Round Fill Color
//movie.beginFill(0xFF0000, bgAlpha)
drawRoundRect(movie, x, y, w, h, r, lineCol, lineAlpha);
movie.endFill();
}
private function drawGo(movie:MovieClip, x:Number, y:Number, w:Number, h:Number, clr:Number):Void
{
drawSingleArrow(movie, x - 1, y + 6, w - 2, h - 12, "right", clr);
drawSingleArrow(movie, x + 6, y + 6, w - 9, h - 12, "right", clr);
}
private function drawRoundBtn(movie:MovieClip, x:Number, y:Number, w:Number, h:Number, col:Number, colBorder:Number, data:Object):Void
{
movie.clear();
if(w == h) drawSquareBtn(movie, x, y, w, h, col, colBorder, data);
else
{
var r:Number = Math.min(data.type == "scroll" ? 2 : 4, Math.min(w, h) / 2);
var bVert:Boolean = w < h;
// fillRoundRect(movie, x + 0.5, y + 0.5, w - 0.5, h - 0.5, r, col, 100, colBorder, 100);
fillRoundRect(movie, x + 0.5, y + 0.5, w - 0.5, h - 0.5, r, 0xFF0000, 100, colBorder, 100);
var colors:Array = new Array(0xffffff, 0xffffff, 0xffffff, 0xffffff);
var alphas:Array = new Array(50, 65, 45, 0);
var ratios:Array = new Array(0, 60, 120, 255);
var flare:Number = (bVert ? w : h) * 2 / 3;
var matrix:Object = bVert
? {matrixType:"box", x:1, y:1, w:flare, h:h - 2, r:0}
: {matrixType:"box", x:1, y:1, w:w - 2, h:flare, r:Math.PI / 2};
movie.beginGradientFill("linear", colors, alphas, ratios, matrix);
drawRoundRect(movie, 1, 1, bVert ? flare + 1 : w - 1, bVert ? h - 1 : flare + 1, Math.max(0, r - 0.5));
movie.endFill();
switch(data.mode)
{
case "press": fillRoundRect(movie, x, y, w, h, r, 0, 10); break;
case "over": fillRoundRect(movie, x, y, w, h, r, 0xffffff, 20); break;
}
}
}
function drawArc(movie:MovieClip, x:Number, y:Number, radius:Number,
arc:Number, startAngle:Number, yRadius:Number, color:Number):Object
{
if(color != null && color != undefined) movie.lineStyle(1, color, 100);
// if yRadius is undefined, yRadius = radius
if (yRadius == undefined) yRadius = radius;
// Init vars
var segAngle, theta, angle, angleMid, segs, ax, ay, bx, by, cx, cy:Number;
// no sense in drawing more than is needed :)
if (Math.abs(arc) > 360) arc = 360;
segs = Math.ceil(Math.abs(arc) / 45);
// Now calculate the sweep of each segment
segAngle = arc / segs;
// The math requires radians rather than degrees. To convert from degrees
// use the formula (degrees/180)*Math.PI to get radians.
theta = -(segAngle / 180) * Math.PI;
// convert angle startAngle to radians
angle = -(startAngle / 180) * Math.PI;
// find our starting points (ax,ay) relative to the specified x,y
ax = x - Math.cos(angle) * radius;
ay = y - Math.sin(angle) * yRadius;
// if our arc is larger than 45 degrees, draw as 45 degree segments
// so that we match Flash's native circle routines.
if (segs > 0)
{
// Loop for drawing arc segments
for (var i = 0; i < segs; i++)
{
// increment our angle
angle += theta;
// find the angle halfway between the last angle and the new
angleMid = angle-(theta / 2);
// calculate our end point
bx = ax + Math.cos(angle) * radius;
by = ay + Math.sin(angle) * yRadius;
// calculate our control point
cx = ax + Math.cos(angleMid) * (radius / Math.cos(theta / 2));
cy = ay + Math.sin(angleMid) * (yRadius / Math.cos(theta / 2));
// draw the arc segment
movie.curveTo(cx, cy, bx, by);
}
}
return {x:bx, y:by};
};
private function getWndTitleParams():Object
{
// off1 - offset between hide and maximize buttons
// off2 - offset between maximize and close buttons
return new Object({off1:2, off2:2, h:25, btnW:18, btnH:18});
}
private function getResizeBtnParams():Object
{
return new Object({w:13, h:13, offX:16, offY:5});
}
private function getResizeLineParams(strAlign:String, data:Object):Object
{
var obj:Object = new Object();
switch(strAlign)
{
case "top":
case "bottom":
obj.btnW = 34;
obj.btnH = 12;
break;
default: // left or right
obj.btnW = 12;
obj.btnH = 34;
break;
}
return obj;
}
private function getTreeParams():Object
{
return {offStart:8, off:8, iconW:9, iconH:12};
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -