Frame 1
function changeColor(mc, col) {
var _local1 = new flash.geom.ColorTransform();
var _local2 = new flash.geom.Transform(mc);
_local2.colorTransform = _local1;
_local1.rgb = col;
_local2.colorTransform = _local1;
}
trace("version 3");
System.security.allowDomain("bin.clearspring.com");
System.security.allowDomain("widgets.clearspring.com");
var args = {};
var up_numBalls;
if (up_numBalls == undefined) {
args.numBalls = 5;
} else {
args.numBalls = parseInt(up_numBalls);
}
var up_speakerColor;
if (up_speakerColor == undefined) {
args.speakerColor = 10066329 /* 0x999999 */;
trace("speakerColor=" + args.speakerColor);
} else {
args.speakerColor = parseInt("0x" + up_speakerColor);
}
var up_stringColor;
if (up_stringColor == undefined) {
args.stringColor = 6710886 /* 0x666666 */;
} else {
args.stringColor = parseInt("0x" + up_stringColor);
}
var up_barColor;
if (up_barColor == undefined) {
args.barColor = 3355443 /* 0x333333 */;
} else {
args.barColor = parseInt("0x" + up_barColor);
}
var up_ballColor;
if (up_ballColor == undefined) {
args.ballColor = 3947580 /* 0x3C3C3C */;
} else {
args.ballColor = parseInt("0x" + up_ballColor);
}
var up_bgColor;
args.bgColor = 16777215 /* 0xFFFFFF */;
if (up_bgColor != undefined) {
args.bgColor = parseInt("0x" + up_bgColor);
}
var up_backgroundColor;
if (up_backgroundColor != undefined) {
args.bgColor = parseInt("0x" + up_backgroundColor);
}
changeColor(mcBG, args.bgColor);
changeColor(mcSound, args.speakerColor);
trace("bgColor=" + args.bgColor);
mcBG._width = Stage.width;
mcBG._height = Stage.height;
trace("sw=" + Stage.width);
trace("sh=" + Stage.height);
var nc = NewtonsCradle.create(this, getNextHighestDepth(), args);
Symbol 9 MovieClip Frame 1
stop();
Symbol 10 MovieClip [__Packages.NewtonsCradle] Frame 0
class NewtonsCradle extends MovieClip
{
var barColor, ballColor, bgColor, stringColor, numBalls, speakerColor, soSettings, mcBalls, ballRadius, cradleWidth, len, mcStrings, createEmptyMovieClip, getNextHighestDepth, mcBar, onEnterFrame, winSound, _parent, _xmouse, _ymouse, mcBallToDrag;
function NewtonsCradle () {
super();
}
static function create(parent, depth, args) {
var _local1 = NewtonsCradle(parent.attachMovie(symbolName, "NewtonsCradle" + depth, depth));
_local1.init(args);
return(_local1);
}
function init(args) {
trace("init newton's cradle V2");
barColor = args.barColor;
ballColor = args.ballColor;
bgColor = args.bgColor;
stringColor = args.stringColor;
numBalls = args.numBalls;
speakerColor = args.speakerColor;
if (args.ballAcc != undefined) {
angAcc = args.ballAcc;
}
if (args.sw != undefined) {
sw = args.sw;
}
if (args.sh != undefined) {
sh = args.sh;
}
if (args.loss != undefined) {
loss = args.loss;
}
soSettings = SharedObject.getLocal("settings");
mcBalls = new Array();
ballRadius = getRadius(numBalls);
cradleWidth = (ballRadius * numBalls) * 2;
len = ((sw - cradleWidth) - margin) / 2;
cradleX = (sw / 2) - (cradleWidth / 2);
cradleY = (sh / 2) - ((len + (ballRadius * 2)) / 2);
mcStrings = createEmptyMovieClip("mcStrings", getNextHighestDepth());
mcBar = createEmptyMovieClip("mcBar", getNextHighestDepth());
mcBar.beginFill(barColor);
Draw.drawRoundRect(mcBar, 0, 0, cradleWidth, 5, 0);
mcBar.endFill();
mcBar._x = cradleX;
mcBar._y = cradleY - 5;
var _local2 = 0;
while (_local2 < numBalls) {
mcBalls[_local2] = createHangingBall(this, getNextHighestDepth(), ballRadius, ballColor, len);
mcBalls[_local2]._x = (cradleX + ballRadius) + ((ballRadius * 2) * _local2);
mcBalls[_local2]._y = cradleY;
_local2++;
}
initSound();
onEnterFrame = update;
}
function initSound() {
winSound = new Sound(this);
winSound.attachSound("win2");
var _local2 = _parent.mcSound;
_local2.onPress = mx.utils.Delegate.create(this, soundClick);
_local2._x = sw - 25;
_local2._y = sh - 20;
if (soSettings.data.sound || (soSettings.data.sound == undefined)) {
soundOn = true;
_parent.mcSound.gotoAndStop("on");
} else {
soundOn = false;
_parent.mcSound.gotoAndStop("off");
}
}
function createHangingBall(mcParent, depth, radius, color, len) {
var _local1 = mcParent.createEmptyMovieClip("mcHangingBall" + depth, depth);
var _local2 = _local1.createEmptyMovieClip("mcBall", _local1.getNextHighestDepth());
_local2.beginFill(color);
Draw.drawOval(_local2, 0, 0, radius, radius);
_local2.endFill();
_local1.mcBall._y = len;
_local1.angAcc = 0;
_local1.angVel = 0;
_local1.ang = (Math.PI/2);
return(_local1);
}
function getRadius(numBalls) {
return((numBalls * -0.7) + 15);
}
function update() {
mcStrings.clear();
mcStrings.lineStyle(1, stringColor);
var _local2;
var _local6 = _xmouse;
var _local5 = _ymouse;
var _local4;
var _local7;
var _local8;
if (mcBallToDrag != undefined) {
dragBall(mcBallToDrag);
}
var _local3 = 0;
while (_local3 < numBalls) {
_local2 = mcBalls[_local3];
if (!_local2.dragged) {
_local4 = Math.sin(centerAng + _local2.ang) * len;
_local2.angVel = _local2.angVel + ((_local4 / len) * angAcc);
_local2.angVel = _local2.angVel * 0.999;
_local2.ang = _local2.ang + _local2.angVel;
if (_local2.ang > 4.71238898038469) {
_local2.ang = 4.71238898038469;
_local2.angVel = (-_local2.angVel) * 0.1;
} else if (_local2.ang < -1.5707963267949) {
_local2.ang = -1.5707963267949;
_local2.angVel = (-_local2.angVel) * 0.1;
}
_local2.mcBall._x = len * Math.cos(_local2.ang);
_local2.mcBall._y = len * Math.sin(_local2.ang);
}
_local3++;
}
checkCollision();
_local3 = 0;
while (_local3 < numBalls) {
_local2 = mcBalls[_local3];
mcStrings.moveTo(_local2._x, _local2._y);
mcStrings.lineTo(_local2._x + _local2.mcBall._x, _local2._y + _local2.mcBall._y);
_local3++;
}
}
function checkCollision() {
var _local2;
var _local3;
var _local7;
var _local6;
var _local8;
var _local10 = 0;
var _local11 = -100;
var _local12 = 0;
var _local13;
var _local9 = 1;
var _local5 = numBalls - 1;
while (_local5 > 0) {
_local2 = mcBalls[_local5 - 1];
_local3 = mcBalls[_local5];
if (_local2.ang < _local3.ang) {
_local7 = _local2.ang;
_local6 = _local2.angVel;
if (!_local2.hit) {
_local10 = Math.abs(_local2.angVel - _local3.angVel);
}
if (!_local2.dragged) {
_local2.ang = _local3.ang;
_local2.angVel = _local3.angVel * _local9;
_local2.mcBall._x = len * Math.cos(_local2.ang);
_local2.mcBall._y = len * Math.sin(_local2.ang);
_local8 = false;
} else {
_local8 = true;
}
if (!_local3.dragged) {
_local3.ang = _local7;
_local3.angVel = _local6;
_local3.mcBall._x = len * Math.cos(_local3.ang);
_local3.mcBall._y = len * Math.sin(_local3.ang);
}
if (_local10 > _local11) {
_local11 = _local10;
}
var _local4 = _local5;
while (_local4 < (numBalls - 1)) {
_local2.hit = true;
_local2 = mcBalls[_local4];
_local3 = mcBalls[_local4 + 1];
if (_local2.ang < _local3.ang) {
_local7 = _local2.ang;
_local6 = _local2.angVel;
if ((!_local2.dragged) && (!_local8)) {
_local2.ang = _local3.ang;
_local2.angVel = _local3.angVel * _local9;
_local2.mcBall._x = len * Math.cos(_local2.ang);
_local2.mcBall._y = len * Math.sin(_local2.ang);
}
if (!_local3.dragged) {
_local3.ang = _local7;
_local3.angVel = _local6;
_local3.mcBall._x = len * Math.cos(_local3.ang);
_local3.mcBall._y = len * Math.sin(_local3.ang);
}
collCount++;
} else {
break;
}
_local4++;
}
_local2.hit = true;
} else {
_local2.hit = false;
}
_local5--;
}
if ((_local11 > 0) && (soundOn)) {
winSound.setVolume(Math.min(1, _local11 / loudestImpact) * 100);
winSound.start(0, 1);
}
}
function dragBall(mc) {
var _local6 = mc._x;
var _local5 = mc._y;
var _local8 = _xmouse;
var _local7 = _ymouse;
var _local2 = Trig.angleTo(_local6, _local5, _local8, _local7);
if (_local2 < -1.5707963267949) {
_local2 = Trig.fixAngle(_local2);
}
_local2 = Math.max(-1.5707963267949, Math.min(4.71238898038469, _local2));
var _local9 = mc.ang;
var _local4 = _local2 - _local9;
if (Math.abs(_local4) < (Math.PI/2)) {
mc.ang = _local2;
mc.angVel = _local4;
mc.mcBall._x = len * Math.cos(_local2);
mc.mcBall._y = len * Math.sin(_local2);
}
}
function onMouseDown() {
var _local2;
var _local7 = _xmouse;
var _local6 = _ymouse;
var _local5;
var _local4;
var _local3 = 0;
while (_local3 < numBalls) {
_local2 = mcBalls[_local3];
_local5 = _local2._x + _local2.mcBall._x;
_local4 = _local2._y + _local2.mcBall._y;
if ((Math.abs(_local7 - _local5) < ballRadius) && (Math.abs(_local6 - _local4) < ballRadius)) {
mcBallToDrag = _local2;
mcBallToDrag.dragged = true;
}
_local3++;
}
}
function onMouseUp() {
mcBallToDrag.dragged = false;
mcBallToDrag = undefined;
}
function soundClick() {
var _local2 = _parent.mcSound;
if (soundOn) {
_local2.gotoAndStop("off");
soundOn = false;
soSettings.data.sound = false;
} else {
_local2.gotoAndStop("on");
soundOn = true;
soSettings.data.sound = true;
}
}
function changeColor(mc, col) {
trace("col=" + col);
var _local1 = new flash.geom.ColorTransform();
var _local2 = new flash.geom.Transform(mc);
_local2.colorTransform = _local1;
_local1.rgb = col;
_local2.colorTransform = _local1;
}
function setCenterAngle(ang) {
centerAng = ang;
}
static var symbolName = "__Packages.NewtonsCradle";
static var symbolLinked = Object.registerClass(symbolName, NewtonsCradle);
var angAcc = 0.03;
var cradleX = 120;
var cradleY = 80;
var collCount = 0;
var loudestImpact = 0.3;
var margin = 30;
var sh = 210;
var sw = 280;
var soundOn = true;
var centerAng = (Math.PI/2);
var loss = 0;
var hitDir = 1;
}
Symbol 11 MovieClip [__Packages.Draw] Frame 0
class Draw
{
function Draw () {
}
static function drawOval(mc, x, y, rx, ry) {
mc.moveTo(rx + x, y);
mc.curveTo(rx + x, (0.4142 * ry) + y, (0.7071 * rx) + x, (0.7071 * ry) + y);
mc.curveTo((0.4142 * rx) + x, ry + y, x, ry + y);
mc.curveTo((-0.4142 * rx) + x, ry + y, (-0.7071 * rx) + x, (0.7071 * ry) + y);
mc.curveTo((-rx) + x, (0.4142 * ry) + y, (-rx) + x, y);
mc.curveTo((-rx) + x, (-0.4142 * ry) + y, (-0.7071 * rx) + x, (-0.7071 * ry) + y);
mc.curveTo((-0.4142 * rx) + x, (-ry) + y, x, (-ry) + y);
mc.curveTo((0.4142 * rx) + x, (-ry) + y, (0.7071 * rx) + x, (-0.7071 * ry) + y);
mc.curveTo(rx + x, (-0.4142 * ry) + y, rx + x, y);
}
static function drawRoundRect(mc, x, y, w, h, cornerRadius) {
if (arguments.length < 4) {
return(undefined);
}
if (cornerRadius > 0) {
var _local3;
var _local4;
var _local9;
var _local8;
var _local11;
var _local10;
if (cornerRadius > (Math.min(w, h) / 2)) {
cornerRadius = Math.min(w, h) / 2;
}
_local3 = (Math.PI/4);
mc.moveTo(x + cornerRadius, y);
mc.lineTo((x + w) - cornerRadius, y);
_local4 = -1.5707963267949;
_local9 = ((x + w) - cornerRadius) + ((Math.cos(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local8 = (y + cornerRadius) + ((Math.sin(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local11 = ((x + w) - cornerRadius) + (Math.cos(_local4 + _local3) * cornerRadius);
_local10 = (y + cornerRadius) + (Math.sin(_local4 + _local3) * cornerRadius);
mc.curveTo(_local9, _local8, _local11, _local10);
_local4 = _local4 + _local3;
_local9 = ((x + w) - cornerRadius) + ((Math.cos(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local8 = (y + cornerRadius) + ((Math.sin(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local11 = ((x + w) - cornerRadius) + (Math.cos(_local4 + _local3) * cornerRadius);
_local10 = (y + cornerRadius) + (Math.sin(_local4 + _local3) * cornerRadius);
mc.curveTo(_local9, _local8, _local11, _local10);
mc.lineTo(x + w, (y + h) - cornerRadius);
_local4 = _local4 + _local3;
_local9 = ((x + w) - cornerRadius) + ((Math.cos(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local8 = ((y + h) - cornerRadius) + ((Math.sin(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local11 = ((x + w) - cornerRadius) + (Math.cos(_local4 + _local3) * cornerRadius);
_local10 = ((y + h) - cornerRadius) + (Math.sin(_local4 + _local3) * cornerRadius);
mc.curveTo(_local9, _local8, _local11, _local10);
_local4 = _local4 + _local3;
_local9 = ((x + w) - cornerRadius) + ((Math.cos(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local8 = ((y + h) - cornerRadius) + ((Math.sin(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local11 = ((x + w) - cornerRadius) + (Math.cos(_local4 + _local3) * cornerRadius);
_local10 = ((y + h) - cornerRadius) + (Math.sin(_local4 + _local3) * cornerRadius);
mc.curveTo(_local9, _local8, _local11, _local10);
mc.lineTo(x + cornerRadius, y + h);
_local4 = _local4 + _local3;
_local9 = (x + cornerRadius) + ((Math.cos(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local8 = ((y + h) - cornerRadius) + ((Math.sin(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local11 = (x + cornerRadius) + (Math.cos(_local4 + _local3) * cornerRadius);
_local10 = ((y + h) - cornerRadius) + (Math.sin(_local4 + _local3) * cornerRadius);
mc.curveTo(_local9, _local8, _local11, _local10);
_local4 = _local4 + _local3;
_local9 = (x + cornerRadius) + ((Math.cos(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local8 = ((y + h) - cornerRadius) + ((Math.sin(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local11 = (x + cornerRadius) + (Math.cos(_local4 + _local3) * cornerRadius);
_local10 = ((y + h) - cornerRadius) + (Math.sin(_local4 + _local3) * cornerRadius);
mc.curveTo(_local9, _local8, _local11, _local10);
mc.lineTo(x, y + cornerRadius);
_local4 = _local4 + _local3;
_local9 = (x + cornerRadius) + ((Math.cos(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local8 = (y + cornerRadius) + ((Math.sin(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local11 = (x + cornerRadius) + (Math.cos(_local4 + _local3) * cornerRadius);
_local10 = (y + cornerRadius) + (Math.sin(_local4 + _local3) * cornerRadius);
mc.curveTo(_local9, _local8, _local11, _local10);
_local4 = _local4 + _local3;
_local9 = (x + cornerRadius) + ((Math.cos(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local8 = (y + cornerRadius) + ((Math.sin(_local4 + (_local3 / 2)) * cornerRadius) / Math.cos(_local3 / 2));
_local11 = (x + cornerRadius) + (Math.cos(_local4 + _local3) * cornerRadius);
_local10 = (y + cornerRadius) + (Math.sin(_local4 + _local3) * cornerRadius);
mc.curveTo(_local9, _local8, _local11, _local10);
} else {
mc.moveTo(x, y);
mc.lineTo(x + w, y);
mc.lineTo(x + w, y + h);
mc.lineTo(x, y + h);
mc.lineTo(x, y);
}
}
static function drawOval2(mc, x, y, rx, ry, ang) {
var _local17 = rx;
var _local20 = 0.7071 * rx;
var _local18 = 0.4142 * rx;
var _local16 = ry;
var _local19 = 0.7071 * ry;
var _local22 = 0.4142 * ry;
var _local14 = {x:_local17, y:_local22};
var _local13 = {x:_local20, y:_local19};
var _local12 = {x:_local18, y:_local16};
var _local11 = {x:0, y:_local16};
var _local7 = {x:-_local17, y:0};
var _local10 = {x:-_local17, y:_local22};
var _local9 = {x:-_local20, y:_local19};
var _local8 = {x:-_local18, y:_local16};
if ((ang != 0) && (ang != undefined)) {
var _local6 = Math.cos(ang);
var _local5 = Math.sin(ang);
var _local2 = _local14.x;
var _local1 = _local14.y;
_local14.x = (_local6 * _local2) - (_local5 * _local1);
_local14.y = (_local6 * _local1) + (_local5 * _local2);
_local2 = _local13.x;
_local1 = _local13.y;
_local13.x = (_local6 * _local2) - (_local5 * _local1);
_local13.y = (_local6 * _local1) + (_local5 * _local2);
_local2 = _local12.x;
_local1 = _local12.y;
_local12.x = (_local6 * _local2) - (_local5 * _local1);
_local12.y = (_local6 * _local1) + (_local5 * _local2);
_local2 = _local11.x;
_local1 = _local11.y;
_local11.x = (_local6 * _local2) - (_local5 * _local1);
_local11.y = (_local6 * _local1) + (_local5 * _local2);
_local2 = _local7.x;
_local1 = _local7.y;
_local7.x = (_local6 * _local2) - (_local5 * _local1);
_local7.y = (_local6 * _local1) + (_local5 * _local2);
_local2 = _local10.x;
_local1 = _local10.y;
_local10.x = (_local6 * _local2) - (_local5 * _local1);
_local10.y = (_local6 * _local1) + (_local5 * _local2);
_local2 = _local9.x;
_local1 = _local9.y;
_local9.x = (_local6 * _local2) - (_local5 * _local1);
_local9.y = (_local6 * _local1) + (_local5 * _local2);
_local2 = _local8.x;
_local1 = _local8.y;
_local8.x = (_local6 * _local2) - (_local5 * _local1);
_local8.y = (_local6 * _local1) + (_local5 * _local2);
}
mc.moveTo((-_local7.x) + x, (-_local7.y) + y);
mc.curveTo(_local14.x + x, _local14.y + y, _local13.x + x, _local13.y + y);
mc.curveTo(_local12.x + x, _local12.y + y, _local11.x + x, _local11.y + y);
mc.curveTo(_local8.x + x, _local8.y + y, _local9.x + x, _local9.y + y);
mc.curveTo(_local10.x + x, _local10.y + y, _local7.x + x, _local7.y + y);
mc.curveTo((-_local14.x) + x, (-_local14.y) + y, (-_local13.x) + x, (-_local13.y) + y);
mc.curveTo((-_local12.x) + x, (-_local12.y) + y, (-_local11.x) + x, (-_local11.y) + y);
mc.curveTo((-_local8.x) + x, (-_local8.y) + y, (-_local9.x) + x, (-_local9.y) + y);
mc.curveTo((-_local10.x) + x, (-_local10.y) + y, (-_local7.x) + x, (-_local7.y) + y);
}
static function drawSquare2(mc, x, y, rx, ry, ang) {
var _local12 = rx;
var _local11 = ry;
var _local1 = {x:_local12, y:0};
var _local2 = {x:0, y:_local11};
if ((ang != 0) && (ang != undefined)) {
var _local8 = Math.cos(ang);
var _local7 = Math.sin(ang);
var _local4 = _local1.x;
var _local3 = _local1.y;
_local1.x = (_local8 * _local4) - (_local7 * _local3);
_local1.y = (_local8 * _local3) + (_local7 * _local4);
_local4 = _local2.x;
_local3 = _local2.y;
_local2.x = (_local8 * _local4) - (_local7 * _local3);
_local2.y = (_local8 * _local3) + (_local7 * _local4);
}
mc.moveTo(_local1.x + x, _local1.y + y);
mc.lineTo(_local2.x + x, _local2.y + y);
mc.lineTo((-_local1.x) + x, (-_local1.y) + y);
mc.lineTo((-_local2.x) + x, (-_local2.y) + y);
mc.lineTo(_local1.x + x, _local1.y + y);
}
static function drawRect(mc, x1, y1, width, height) {
mc.moveTo(x1, y1);
mc.lineTo(x1 + width, y1);
mc.lineTo(x1 + width, y1 + height);
mc.lineTo(x1, y1 + height);
mc.lineTo(x1, y1);
}
static function drawWedge(mc, x, y, startAngle, arc, radius, yRadius) {
if (arguments.length < 5) {
return(undefined);
}
mc.moveTo(x, y);
if (yRadius == undefined) {
yRadius = radius;
}
var _local20;
var _local2;
var _local3;
var _local5;
var _local14;
var _local19;
var _local18;
var _local13;
var _local11;
var _local12;
var _local10;
if (Math.abs(arc) > 360) {
arc = 360;
}
_local14 = Math.ceil(Math.abs(arc) / 45);
_local20 = arc / _local14;
_local2 = (-(_local20 / 180)) * Math.PI;
_local3 = (-(startAngle / 180)) * Math.PI;
if (_local14 > 0) {
_local19 = x + (Math.cos((startAngle / 180) * Math.PI) * radius);
_local18 = y + (Math.sin(((-startAngle) / 180) * Math.PI) * yRadius);
mc.lineTo(_local19, _local18);
var _local4 = 0;
while (_local4 < _local14) {
_local3 = _local3 + _local2;
_local5 = _local3 - (_local2 / 2);
_local13 = x + (Math.cos(_local3) * radius);
_local11 = y + (Math.sin(_local3) * yRadius);
_local12 = x + (Math.cos(_local5) * (radius / Math.cos(_local2 / 2)));
_local10 = y + (Math.sin(_local5) * (yRadius / Math.cos(_local2 / 2)));
mc.curveTo(_local12, _local10, _local13, _local11);
_local4++;
}
mc.lineTo(x, y);
}
}
static function drawArc(mc, x, y, radius, arc, startAngle, yRadius) {
if (arguments.length < 5) {
return(null);
}
if (yRadius == undefined) {
yRadius = radius;
}
var _local17;
var _local3;
var _local2;
var _local5;
var _local14;
var _local10;
var _local8;
var _local9;
var _local7;
var _local13;
var _local12;
if (Math.abs(arc) > 360) {
arc = 360;
}
_local14 = Math.ceil(Math.abs(arc) / 45);
_local17 = arc / _local14;
_local3 = (-(_local17 / 180)) * Math.PI;
_local2 = (-(startAngle / 180)) * Math.PI;
_local10 = x - (Math.cos(_local2) * radius);
_local8 = y - (Math.sin(_local2) * yRadius);
if (_local14 > 0) {
var _local4 = 0;
while (_local4 < _local14) {
_local2 = _local2 + _local3;
_local5 = _local2 - (_local3 / 2);
_local9 = _local10 + (Math.cos(_local2) * radius);
_local7 = _local8 + (Math.sin(_local2) * yRadius);
_local13 = _local10 + (Math.cos(_local5) * (radius / Math.cos(_local3 / 2)));
_local12 = _local8 + (Math.sin(_local5) * (yRadius / Math.cos(_local3 / 2)));
mc.curveTo(_local13, _local12, _local9, _local7);
_local4++;
}
}
return({x:_local9, y:_local7});
}
static function calcGradient(hex, percent) {
var _local2 = hexToRGB(hex);
var _local1 = RGBToHLS(_local2.r, _local2.g, _local2.b);
_local1.l = _local1.l * (percent / 100);
if (_local1.l > 240) {
_local1.l = 240;
}
if (_local1.l < 0) {
_local1.l = 0;
}
_local2 = HLSToRGB(_local1.h, _local1.l, _local1.s);
return(RGBToHex(_local2.r, _local2.g, _local2.b));
}
static function hexToRGB(hex) {
var _local1 = new Object();
_local1.r = hex >> 16;
var _local2 = hex ^ (_local1.r << 16);
_local1.g = _local2 >> 8;
_local1.b = _local2 ^ (_local1.g << 8);
return(_local1);
}
static function RGBToHex(r, g, b) {
var _local1 = ((r << 16) ^ (g << 8)) ^ b;
return(_local1);
}
static function RGBToHLS(r, g, b) {
var _local9;
var _local8;
var _local7;
var _local1 = Math.max(Math.max(r, g), b) / 255;
var _local5 = Math.min(Math.min(r, g), b) / 255;
var _local2 = _local1 - _local5;
_local8 = (_local1 + _local5) / 2;
_local7 = ((_local1 == _local5) ? 0 : (((_local8 <= 0.5) ? ((_local2 / _local8) / 2) : (_local2 / (2 - (_local8 * 2))))));
if ((r / 255) == _local1) {
_local9 = ((g - b) / _local2) / 255;
} else if ((g / 255) == _local1) {
_local9 = 2 + (((b - r) / _local2) / 255);
} else if ((b / 255) == _local1) {
_local9 = 4 + (((r - g) / _local2) / 255);
}
_local9 = _local9 * 40;
if (_local9 < 0) {
_local9 = _local9 + 240;
}
_local9 = Math.round(_local9);
return({h:(isNaN(_local9) ? 0 : (_local9)), l:Math.round(_local8 * 240), s:Math.round(_local7 * 240)});
}
static function HLSToRGB(h, l, s) {
var _local10;
var _local11;
var _local9;
if (s == 0) {
_local9 = Math.round((l / 240) * 255);
_local11 = _local9;
_local10 = _local11;
} else {
h = h / 240;
l = l / 240;
s = s / 240;
var _local2;
var _local1;
var _local5 = ((l < 0.5) ? (l * (s + 1)) : ((l + s) - (l * s)));
var _local4 = (l * 2) - _local5;
var _local3 = 0;
while (_local3 < 3) {
switch (_local3) {
case 0 :
_local1 = h + 0.333333333333333;
break;
case 1 :
_local1 = h;
break;
case 2 :
_local1 = h - 0.333333333333333;
}
if (_local1 < 0) {
_local1++;
} else if (_local1 > 1) {
_local1--;
}
if ((_local1 * 6) < 1) {
_local2 = _local4 + (((_local5 - _local4) * 6) * _local1);
} else if ((_local1 * 2) < 1) {
_local2 = _local5;
} else if ((_local1 * 3) < 2) {
_local2 = _local4 + (((_local5 - _local4) * (0.666666666666667 - _local1)) * 6);
} else {
_local2 = _local4;
}
switch (_local3) {
case 0 :
_local10 = Math.round(_local2 * 255);
break;
case 1 :
_local11 = Math.round(_local2 * 255);
break;
case 2 :
_local9 = Math.round(_local2 * 255);
}
_local3++;
}
}
return({r:_local10, g:_local11, b:_local9});
}
}
Symbol 12 MovieClip [__Packages.mx.utils.Delegate] Frame 0
class mx.utils.Delegate extends Object
{
var func;
function Delegate (f) {
super();
func = f;
}
static function create(obj, func) {
var _local2 = function () {
var _local2 = arguments.callee.target;
var _local3 = arguments.callee.func;
return(_local3.apply(_local2, arguments));
};
_local2.target = obj;
_local2.func = func;
return(_local2);
}
function createDelegate(obj) {
return(create(obj, func));
}
}
Symbol 13 MovieClip [__Packages.Trig] Frame 0
class Trig
{
function Trig () {
}
static function angleTo(x, y, toX, toY) {
var _local2 = toX - x;
var _local1 = toY - y;
return(Math.atan2(_local1, _local2));
}
static function distTo(x, y, toX, toY) {
var _local2 = toX - x;
var _local1 = toY - y;
return(Math.sqrt((_local2 * _local2) + (_local1 * _local1)));
}
static function fixAngle(angle) {
angle = angle % (Math.PI*2);
return(((angle < 0) ? (angle + (Math.PI*2)) : (angle)));
}
static function fixAngleDeg(angle) {
angle = angle % 360;
return(((angle < 0) ? (angle + 360) : (angle)));
}
static function angleToDeg(x1, y1, x2, y2) {
var _local1 = y2 - y1;
var _local2 = x2 - x1;
return(Math.atan2(_local1, _local2) / (Math.PI/180));
}
static var piBy180 = (Math.PI/180);
}