Frame 1
System.security.allowDomain("bin.clearspring.com");
System.security.allowDomain("widgets.clearspring.com");
trace("fish clearspring version 2");
var up_backgroundColor;
var up_backgroundImage;
var up_numFish;
var up_fishColor1;
var up_fishColor2;
var up_fishColor3;
var up_fishColor4;
var up_fishColor5;
var up_fishColor6;
var up_fishColor7;
var up_fishColor8;
var up_fishColor9;
var up_fishColor10;
var fishColor1;
var fishColor2;
var fishColor3;
var fishColor4;
var fishColor5;
var fishColor6;
var fishColor7;
var fishColor8;
var fishColor9;
var fishColor10;
var up_foodColor;
var foodColor;
var backgroundColor;
var args = {};
args.up_backgroundColor = up_backgroundColor;
args.up_backgroundImage = up_backgroundImage;
args.up_numFish = up_numFish;
args.up_fishColor1 = up_fishColor1;
args.up_fishColor2 = up_fishColor2;
args.up_fishColor3 = up_fishColor3;
args.up_fishColor4 = up_fishColor4;
args.up_fishColor5 = up_fishColor5;
args.up_fishColor6 = up_fishColor6;
args.up_fishColor7 = up_fishColor7;
args.up_fishColor8 = up_fishColor8;
args.up_fishColor9 = up_fishColor9;
args.up_fishColor10 = up_fishColor10;
if (fishColor1 != undefined) {
args.up_fishColor1 = fishColor1;
}
if (fishColor2 != undefined) {
args.up_fishColor2 = fishColor2;
}
if (fishColor3 != undefined) {
args.up_fishColor3 = fishColor3;
}
if (fishColor4 != undefined) {
args.up_fishColor4 = fishColor4;
}
if (fishColor5 != undefined) {
args.up_fishColor5 = fishColor5;
}
if (fishColor6 != undefined) {
args.up_fishColor6 = fishColor6;
}
if (fishColor7 != undefined) {
args.up_fishColor7 = fishColor7;
}
if (fishColor8 != undefined) {
args.up_fishColor8 = fishColor8;
}
if (fishColor9 != undefined) {
args.up_fishColor9 = fishColor9;
}
if (fishColor10 != undefined) {
args.up_fishColor10 = fishColor10;
}
args.up_foodColor = up_foodColor;
if (foodColor != undefined) {
args.up_foodColor = foodColor;
}
if (backgroundColor != undefined) {
args.up_backgroundColor = backgroundColor;
}
Application.createMovie(this, getNextHighestDepth(), args);
Symbol 2 MovieClip [__Packages.Application] Frame 0
class Application extends MovieClip
{
var link, getNextHighestDepth, inactiveFlakes, activeFlakes, Fishies, water, onEnterFrame, xmouse, ymouse, pymouse, _ymouse, _xmouse;
function Application () {
super();
}
function init(args) {
_root.bgBox = _root.createEmptyMovieClip("bgBox", -1000);
_root.bgColor = 15792127 /* 0xF0F7FF */;
var _local10 = 16560967 /* 0xFCB347 */;
var _local15;
var _local3 = new Array();
var _local5 = 0;
while (_local5 < 10) {
_local3[_local5] = 16012608 /* 0xF45540 */;
_local5++;
}
if (args != undefined) {
if ((args.up_fishColor1 != undefined) && (args.up_fishColor1 != "")) {
_local3[0] = parseInt("0x" + args.up_fishColor1);
}
if ((args.up_fishColor2 != undefined) && (args.up_fishColor2 != "")) {
_local3[1] = parseInt("0x" + args.up_fishColor2);
}
if ((args.up_fishColor3 != undefined) && (args.up_fishColor3 != "")) {
_local3[2] = parseInt("0x" + args.up_fishColor3);
}
if ((args.up_fishColor4 != undefined) && (args.up_fishColor4 != "")) {
_local3[3] = parseInt("0x" + args.up_fishColor4);
}
if ((args.up_fishColor5 != undefined) && (args.up_fishColor5 != "")) {
_local3[4] = parseInt("0x" + args.up_fishColor5);
}
if ((args.up_fishColor6 != undefined) && (args.up_fishColor6 != "")) {
_local3[5] = parseInt("0x" + args.up_fishColor6);
}
if ((args.up_fishColor7 != undefined) && (args.up_fishColor7 != "")) {
_local3[6] = parseInt("0x" + args.up_fishColor7);
}
if ((args.up_fishColor8 != undefined) && (args.up_fishColor8 != "")) {
_local3[7] = parseInt("0x" + args.up_fishColor8);
}
if ((args.up_fishColor9 != undefined) && (args.up_fishColor9 != "")) {
_local3[8] = parseInt("0x" + args.up_fishColor9);
}
if ((args.up_fishColor10 != undefined) && (args.up_fishColor10 != "")) {
_local3[9] = parseInt("0x" + args.up_fishColor10);
}
if ((args.up_foodColor != undefined) && (args.up_foodColor != "")) {
_local10 = parseInt("0x" + args.up_foodColor);
}
if ((args.up_backgroundColor != undefined) && (args.up_backgroundColor != "")) {
_root.bgColor = parseInt("0x" + args.up_backgroundColor);
}
if ((args.up_numFish != undefined) && (args.up_numFish != "")) {
numFish = args.up_numFish;
}
if (((args.up_backgroundImage != undefined) && (args.up_backgroundImage != "")) && (args.up_backgroundImage != "http://")) {
createBackgroundImage(args.up_backgroundImage);
}
} else {
if ((_level0.up_fishColor1 != null) && (_level0.up_fishColor1 != "")) {
_local3[0] = parseInt("0x" + _level0.up_fishColor1);
}
if ((_level0.up_fishColor2 != null) && (_level0.up_fishColor2 != "")) {
_local3[1] = parseInt("0x" + _level0.up_fishColor2);
}
if ((_level0.up_fishColor3 != null) && (_level0.up_fishColor3 != "")) {
_local3[2] = parseInt("0x" + _level0.up_fishColor3);
}
if ((_level0.up_fishColor4 != null) && (_level0.up_fishColor4 != "")) {
_local3[3] = parseInt("0x" + _level0.up_fishColor4);
}
if ((_level0.up_fishColor5 != null) && (_level0.up_fishColor5 != "")) {
_local3[4] = parseInt("0x" + _level0.up_fishColor5);
}
if ((_level0.up_fishColor6 != null) && (_level0.up_fishColor6 != "")) {
_local3[5] = parseInt("0x" + _level0.up_fishColor6);
}
if ((_level0.up_fishColor7 != null) && (_level0.up_fishColor7 != "")) {
_local3[6] = parseInt("0x" + _level0.up_fishColor7);
}
if ((_level0.up_fishColor8 != null) && (_level0.up_fishColor8 != "")) {
_local3[7] = parseInt("0x" + _level0.up_fishColor8);
}
if ((_level0.up_fishColor9 != null) && (_level0.up_fishColor9 != "")) {
_local3[8] = parseInt("0x" + _level0.up_fishColor9);
}
if ((_level0.up_fishColor10 != null) && (_level0.up_fishColor10 != "")) {
_local3[9] = parseInt("0x" + _level0.up_fishColor10);
}
if ((_level0.up_foodColor != null) && (_level0.up_foodColor != "")) {
_local10 = parseInt("0x" + _level0.up_foodColor);
}
if ((_level0.up_backgroundColor != null) && (_level0.up_backgroundColor != "")) {
_root.bgColor = parseInt("0x" + _level0.up_backgroundColor);
}
if ((_level0.up_numFish != null) && (_level0.up_numFish != "")) {
numFish = _level0.up_numFish;
}
if (((_level0.up_backgroundImage != null) && (_level0.up_backgroundImage != "")) && (_level0.up_backgroundImage != "http://")) {
createBackgroundImage(_level0.up_backgroundImage);
}
if ((_level0.fishColor1 != null) && (_level0.fishColor1 != "")) {
_local3[0] = parseInt("0x" + _level0.fishColor1);
trace("_level0.fishColor1=" + _level0.fishColor1);
}
if ((_level0.fishColor2 != null) && (_level0.fishColor2 != "")) {
_local3[1] = parseInt("0x" + _level0.fishColor2);
}
if ((_level0.fishColor3 != null) && (_level0.fishColor3 != "")) {
_local3[2] = parseInt("0x" + _level0.fishColor3);
}
if ((_level0.fishColor4 != null) && (_level0.fishColor4 != "")) {
_local3[3] = parseInt("0x" + _level0.fishColor4);
}
if ((_level0.fishColor5 != null) && (_level0.fishColor5 != "")) {
_local3[4] = parseInt("0x" + _level0.fishColor5);
}
if ((_level0.fishColor6 != null) && (_level0.fishColor6 != "")) {
_local3[5] = parseInt("0x" + _level0.fishColor6);
}
if ((_level0.fishColor7 != null) && (_level0.fishColor7 != "")) {
_local3[6] = parseInt("0x" + _level0.fishColor7);
}
if ((_level0.fishColor8 != null) && (_level0.fishColor8 != "")) {
_local3[7] = parseInt("0x" + _level0.fishColor8);
}
if ((_level0.fishColor9 != null) && (_level0.fishColor9 != "")) {
_local3[8] = parseInt("0x" + _level0.fishColor9);
}
if ((_level0.fishColor10 != null) && (_level0.fishColor10 != "")) {
_local3[9] = parseInt("0x" + _level0.fishColor10);
}
if ((_level0.foodColor != null) && (_level0.foodColor != "")) {
_local10 = parseInt("0x" + _level0.foodColor);
}
if ((_level0.backgroundColor != null) && (_level0.backgroundColor != "")) {
_root.bgColor = parseInt("0x" + _level0.backgroundColor);
}
}
var _local12 = new ContextMenu();
_local12.hideBuiltInItems();
var _local14 = new ContextMenuItem("Find more creatures at aBowman.com", function () {
this.getURL("http://aBowman.com/google-modules/", "_top");
});
_local12.customItems.push(_local14);
_root.menu = _local12;
_local15 = com.abowman.graphics.Draw.calcGradient(_root.bgColor, 80);
link = ABowmanLink2.create(this, getNextHighestDepth(), "http://aBowman.com/google-modules/fish", _local15);
link._xscale = (link._yscale = 95);
link._x = 1;
inactiveFlakes = new Array();
activeFlakes = new Array();
Fishies = new Array();
var _local6;
_root.sw = Stage.width;
_root.sh = Stage.height;
if ((_level0.up_height != null) && (_level0.up_height != "")) {
_root.sh = _level0.up_height;
}
if ((_level0.up_width != null) && (_level0.up_width != "")) {
_root.sw = _level0.up_width;
}
_local5 = 0;
while (_local5 < numFish) {
if (_local5 < _local3.length) {
_local6 = _local3[_local5];
}
Fishies[_local5] = new Fish(this, {x:Math.random() * _root.sw, y:Math.random() * _root.sh, length:20, color:_local6});
_local5++;
}
_local5 = 0;
while (_local5 < numflakes) {
inactiveFlakes[_local5] = Food.create(this, getNextHighestDepth(), {color:_local10});
_local5++;
}
water = Water.create(this, getNextHighestDepth(), {color:_root.bgColor});
onEnterFrame = update;
var _local11 = 100;
drawBackground(-_local11, -_local11, _root.sw + (2 * _local11), _root.sh + (2 * _local11));
trace("test");
update();
var _local13 = new Object();
_local13.onResize = mx.utils.Delegate.create(this, function () {
if (Stage.height < 3) {
this.onEnterFrame = null;
} else {
this.onEnterFrame = _root.Application.update;
}
this.drawBackground(0, 0, Stage.width, Stage.height);
});
Stage.addListener(_local13);
}
function drawBackground(x, y, w, h) {
_root.bgBox.clear();
_root.bgBox.beginFill(_root.bgColor);
com.abowman.graphics.Draw.drawRect(_root.bgBox, x, y, w, h);
_root.bgBox.endFill();
trace("draw background");
}
function update() {
mouseInactiveCount++;
var _local2 = 0;
while (_local2 < numFish) {
Fishies[_local2].update();
checkCollision(Fishies[_local2]);
_local2++;
}
var _local3 = activeFlakes.length;
_local2 = 0;
while (_local2 < _local3) {
activeFlakes[_local2].update();
_local2++;
}
}
function onMouseDown() {
var _local3;
var _local4 = inactiveFlakes.length;
var _local2 = 0;
while ((_local2 < _local4) && (_local2 < numFlakesPerDrop)) {
_local3 = Food(inactiveFlakes.pop());
_local3.drop(xmouse, ymouse);
activeFlakes.push(_local3);
_local2++;
}
}
function makeFlakeInactive(flake) {
inactiveFlakes.push(flake);
water.createRipple(flake.pos.x, flake.pos.y, int((Math.random() * 2) + 2), (Math.random() * 50) + 50);
var _local4 = activeFlakes.length;
var _local2 = 0;
while (_local2 < _local4) {
if (activeFlakes[_local2] == flake) {
activeFlakes.splice(_local2, 1);
break;
}
_local2++;
}
}
function checkCollision(fish) {
var _local6;
var _local5;
var _local3;
var _local4;
_local3 = fish.pos;
var _local2 = 0;
while (_local2 < numFish) {
if (Fishies[_local2] != fish) {
_local5 = Fishies[_local2].headRadius + fish.headRadius;
_local4 = Fishies[_local2].pos;
if (com.abowman.math.Vector.length(com.abowman.math.Vector.subtraction(_local3, _local4)) < _local5) {
_local6 = com.abowman.math.Trig.angleTo(_local4.x, _local4.y, _local3.x, _local3.y);
_local3.x = _local4.x + (Math.cos(_local6) * _local5);
_local3.y = _local4.y + (Math.sin(_local6) * _local5);
}
}
_local2++;
}
if (_local3.x < 0) {
_local3.x = 0;
} else if (_local3.x > Stage.width) {
_local3.x = Stage.width;
}
if (_local3.y < 0) {
_local3.y = 0;
} else if (_local3.y > Stage.height) {
_local3.y = Stage.height;
}
}
function onMouseMove() {
mouseInactiveCount = 0;
ymouse = pymouse;
pymouse = _ymouse;
xmouse = _xmouse;
}
static function createMovie(parent, depth, args) {
var _local1 = Application(parent.attachMovie(symbolName, "Application", depth));
_local1.init(args);
return(_local1);
}
static function main(mc) {
var _local2 = createMovie(_root, _root.getNextHighestDepth());
}
function createBackgroundImage(path) {
_root.createEmptyMovieClip("backgroundImage", -200);
_root.backgroundImage.createEmptyMovieClip("container_mc", 0);
_root.backgroundImage.container_mc.loadMovie(path);
_root.backgroundImage.onEnterFrame = function () {
if (this.container_mc._width > 0) {
this._x = Math.max((Stage.width / 2) - (this.container_mc._width / 2), 0);
this._y = Math.max((Stage.height / 2) - (this.container_mc._height / 2), 0);
delete this.onEnterFrame;
}
};
}
static var symbolName = "__Packages.Application";
static var symbolLinked = Object.registerClass(symbolName, Application);
var numFish = 5;
var numflakes = 27;
var numFlakesPerDrop = 3;
var mouseInactiveCount = 100;
}
Symbol 3 MovieClip [__Packages.ABowmanLink2] Frame 0
class ABowmanLink2 extends MovieClip
{
var url, aBowmanCon, createEmptyMovieClip, getNextHighestDepth, aBowman, aBowmanMask;
function ABowmanLink2 () {
super();
}
static function create(parent, depth, url, color) {
var _local1 = ABowmanLink2(parent.attachMovie(symbolName, "Link" + depth, depth));
_local1.init(color, url);
return(_local1);
}
function init(color, url) {
this.url = url;
aBowmanCon = createEmptyMovieClip("aBowmanCon", getNextHighestDepth());
aBowman = aBowmanCon.createEmptyMovieClip("aBowman", aBowmanCon.getNextHighestDepth());
aBowmanMask = aBowmanCon.createEmptyMovieClip("aBowmanMask", aBowmanCon.getNextHighestDepth());
aBowman.onRollOver = function () {
this._parent.aBowmanMask.onEnterFrame = this._parent.aBowmanMask.expand;
};
aBowman.onRollOut = function () {
this._parent.aBowmanMask.onEnterFrame = this._parent.aBowmanMask.shrink;
};
aBowman.onRelease = function () {
this.getURL(url, "_top");
};
aBowmanMask.maxWidth = mask_maxWidth;
aBowmanMask.minWidth = mask_minWidth;
aBowmanMask.height = mask_height;
aBowmanMask.width = aBowmanMask.minWidth;
aBowmanMask.boxX = -2;
aBowmanMask.expand = function () {
this.width = this.width + ((this.maxWidth - this.width) * 0.2);
if ((this.maxWidth - this.width) < 0.1) {
delete this.onEnterFrame;
}
this.render();
};
aBowmanMask.shrink = function () {
this.width = this.width - ((this.width - this.minWidth) * 0.2);
if ((this.width - this.minWidth) < 0.1) {
delete this.onEnterFrame;
}
this.render();
};
aBowmanMask.render = function () {
this.clear();
this.beginFill(0);
this.lineTo(this.boxX, 0);
this.lineTo(this.boxX + this.width, 0);
this.lineTo(this.boxX + this.width, this.height);
this.lineTo(this.boxX, this.height);
this.lineTo(this.boxX, 0);
this.endFill();
};
aBowmanMask.render();
aBowman.setMask(aBowmanMask);
var _local2 = new TextFormat();
_local2.size = 20;
_local2.font = "Pupcat";
_local2.color = color;
aBowman.createTextField("txt", aBowman.getNextHighestDepth(), 0, 0, 50, 50);
aBowman.txt.antiAliasType = "advanced";
aBowman.txt.gridFitType = "subpixel";
aBowman.txt.autoSize = true;
aBowman.txt.text = "aBowman";
aBowman.txt.embedFonts = true;
aBowman.txt.setTextFormat(_local2);
}
static var symbolName = "__Packages.ABowmanLink2";
static var symbolLinked = Object.registerClass(symbolName, ABowmanLink2);
var mask_maxWidth = 80;
var mask_minWidth = 23;
var mask_height = 25;
}
Symbol 4 MovieClip [__Packages.Logo] Frame 0
class Logo extends MovieClip
{
var lineStyle, beginFill, endFill, moveTo, curveTo, lineTo, _rotation;
function Logo () {
super();
}
function render() {
lineStyle(4, lineColor);
beginFill(fillColor, 0);
com.abowman.graphics.Draw.drawOval(this, -13, 30, 10, 7);
com.abowman.graphics.Draw.drawOval(this, 13, 30, 10, 7);
com.abowman.graphics.Draw.drawOval(this, 0, 43, 7, 10);
endFill();
moveTo(0, 30);
curveTo(1, 16, -6, 9);
moveTo(0, 30);
curveTo(1, 16, -10, 13);
moveTo(-6, 9);
lineTo(-10, 13);
_rotation = -45;
}
static function create(parent, depth, lineColor, fillColor) {
var _local1 = Logo(parent.attachMovie(symbolName, "Logo" + depth, depth));
_local1.init(lineColor, fillColor);
return(_local1);
}
function init(lineColor, fillColor) {
if (lineColor != null) {
this.lineColor = lineColor;
}
if (fillColor != null) {
this.fillColor = fillColor;
}
render();
}
static var symbolName = "__Packages.Logo";
static var symbolLinked = Object.registerClass(symbolName, Logo);
var lineColor = 8421504;
var fillColor = 16777215;
}
Symbol 5 MovieClip [__Packages.com.abowman.graphics.Draw] Frame 0
class com.abowman.graphics.Draw
{
function Draw () {
}
static function drawOval(mc, x, y, rx, ry) {
mc.moveTo(x + rx, 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 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 6 MovieClip [__Packages.Slider] Frame 0
class Slider extends MovieClip
{
var maxVal, minVal, range, onSlide, onChange, value, obj, _parent, trackLength, handle, createEmptyMovieClip, getNextHighestDepth, lineStyle, beginFill, endFill, _xmouse, stopDrag;
function Slider () {
super();
}
static function create(target, depth, args) {
var _local1 = Slider(target.attachMovie(symbolName, "slider" + depth, depth));
_local1.init(args);
return(_local1);
}
function init(args) {
maxVal = args.max;
minVal = args.min;
range = maxVal - minVal;
onSlide = args.onSlide;
onChange = args.onChange;
value = Math.min(Math.max(minVal, args.start), maxVal);
(args.objectToCall ? ((obj = args.objectToCall)) : ((obj = _parent)));
(args.trackWidth ? ((trackWidth = args.trackWidth)) : null);
(args.trackHeight ? ((trackHeight = args.trackHeight)) : null);
(args.handleWidth ? ((handleWidth = args.handleWidth)) : null);
(args.handleHeight ? ((handleHeight = args.handleHeight)) : null);
(args.trackFill ? ((trackFill = args.trackFill)) : null);
(args.handleFill ? ((handleFill = args.handleFill)) : null);
trackLength = trackWidth - handleWidth;
createHandle();
render();
}
function createHandle() {
handle = createEmptyMovieClip("handle2", getNextHighestDepth());
handle.top = (handle._y = (trackHeight - handleHeight) / 2);
handle.right = trackWidth - handleWidth;
handle.onPress = function () {
this.startDrag(false, 0, this.top, this.right, this.top);
this.onEnterFrame = function () {
this._parent.updateValue();
};
};
handle.onReleaseOutside = (handle.onRelease = function () {
delete this.onEnterFrame;
this.stopDrag();
this._parent.updateValue();
this._parent.valueChanged();
});
handle._x = ((value - minVal) / range) * trackLength;
}
function render() {
lineStyle(1, 0);
beginFill(trackFill);
drawRect(this, 0, 0, trackWidth, trackHeight);
endFill();
handle.lineStyle(1, 0);
handle.beginFill(handleFill);
drawRect(handle, 0, 0, handleWidth, handleHeight);
handle.endFill();
}
function getValue() {
return(value);
}
function setValue(val) {
if (val != value) {
if ((val >= minVal) && (val <= maxVal)) {
value = val;
} else if (val < minVal) {
value = minVal;
} else if (val > maxVal) {
value = maxVal;
}
handle._x = ((value - minVal) / range) * trackLength;
valueChanged();
}
}
function valueChanged() {
obj[onChange](value);
}
function updateValue() {
var _local2 = (handle._x * (range / trackLength)) + minVal;
value = _local2;
obj[onSlide](value);
}
function onPress() {
var _local2 = _xmouse;
var _local3 = handleWidth / 2;
if ((_local2 >= _local3) && (_local2 <= (trackWidth - _local3))) {
handle._x = _local2 - _local3;
value = ((range * (_local2 - _local3)) / trackWidth) + minVal;
} else if (_local2 < _local3) {
handle._x = 0;
value = minVal;
} else if (_local2 > (trackWidth - _local3)) {
handle._x = trackWidth - handleWidth;
value = maxVal;
}
handle.onPress();
}
function onRelease() {
delete handle.onEnterFrame;
stopDrag();
updateValue();
valueChanged();
}
function onReleaseOutside() {
onRelease();
}
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 var symbolName = "__Packages.Slider";
static var symbolLinked = Object.registerClass(symbolName, Slider);
var trackFill = 14474460;
var trackHeight = 10;
var trackWidth = 200;
var handleFill = 10066329;
var handleWidth = 10;
var handleHeight = 10;
}
Symbol 7 MovieClip [__Packages.Water] Frame 0
class Water extends MovieClip
{
var color, wavs, createEmptyMovieClip, getNextHighestDepth;
function Water () {
super();
}
static function create(parent, depth, args) {
var _local1 = Water(parent.attachMovie(symbolName, "Water" + depth, depth));
_local1.init(args);
return(_local1);
}
function init(args) {
color = args.color;
var _local2;
wavs = new Array();
var _local3 = 0;
while (_local3 < numWavs) {
_local2 = createEmptyMovieClip("wav" + getNextHighestDepth(), getNextHighestDepth());
_local2.lineStyle(4, com.abowman.graphics.Draw.calcGradient(color, 80));
com.abowman.graphics.Draw.drawOval(_local2, 0, 0, 40, 40);
_local2.lineStyle(4, 16777215, 50);
com.abowman.graphics.Draw.drawOval(_local2, 3, 0, 40, 40);
_local2._xscale = (_local2._yscale = 0);
_local2._visible = false;
wavs.push(_local2);
_local3++;
}
}
function update() {
}
function createRipple(x, y, maxWav, alpha) {
var _local3;
_local3 = createEmptyMovieClip("ripple" + getNextHighestDepth(), getNextHighestDepth());
_local3.c = 0;
_local3.x = x;
_local3.y = y;
_local3.wc = 0;
_local3.onEnterFrame = function () {
if ((this.c % 10) == 0) {
if ((++this.wc) == maxWav) {
this.removeMovieClip();
}
var _local2 = this._parent.getWav();
if (!_local2._visible) {
_local2._x = x;
_local2._y = y;
_local2._visible = true;
_local2._alpha = alpha - (this.wc * 5);
_local2.onEnterFrame = function () {
this._xscale = (this._yscale = this._yscale + 3);
this._alpha = this._alpha - 3;
if (this._xscale > 100) {
this._visible = false;
this._xscale = (this._yscale = 0);
delete this.onEnterFrame;
}
};
}
}
this.c++;
};
}
function getWav() {
return(wavs[(++curWav) % numWavs]);
}
static var symbolName = "__Packages.Water";
static var symbolLinked = Object.registerClass(symbolName, Water);
var numWavs = 10;
var curWav = 0;
}
Symbol 8 MovieClip [__Packages.Fish] Frame 0
class Fish
{
var angle, headRadius, wigglers, segments, parentMC, targetPos, length, wiggleSpeed, tailFin, head, pos, interval, lFin, rFin, targetFood, targetIsFood, resting;
function Fish (mc, args) {
angle = Math.random() * 360;
headRadius = 5;
resetRest();
wigglers = new Array();
segments = new Array();
parentMC = mc;
targetPos = {x:args.x, y:args.y};
length = args.length;
color = args.color;
var speedFrac = ((Math.random() * 0.4) + 0.8);
_acc = (acc = 0.1 * speedFrac);
wiggleSpeed = 0.4 * speedFrac;
straightFriction = 0.03;
turnFriction = 0.06;
tailFin = parentMC.createEmptyMovieClip("tailFin" + parentMC.getNextHighestDepth(), parentMC.getNextHighestDepth());
with (tailFin) {
lineStyle(1, color, 40);
beginFill(color, 40);
lineTo(2, -5);
lineTo(-2, -5);
lineTo(0, 0);
endFill();
}
segments.push(Segment.create(parentMC, parentMC.getNextHighestDepth(), {length:length, fcPos:{x:args.x, y:args.y}, radius1:headRadius, radius2:3}));
segments.push(Segment.create(parentMC, parentMC.getNextHighestDepth(), {length:5, fcPos:segments[0].rcPos, radius1:3, radius2:2}));
segments.push(Segment.create(parentMC, parentMC.getNextHighestDepth(), {length:5, fcPos:segments[1].rcPos, radius1:2, radius2:1}));
wigglers.push(new Wiggler({range:1.5, center:segments[0].fcPos, startDelay:4}));
wigglers.push(new Wiggler({range:2, center:segments[0].rcPos, startDelay:2}));
wigglers.push(new Wiggler({range:3, center:segments[1].rcPos, startDelay:1}));
wigglers.push(new Wiggler({range:4.5, center:segments[2].rcPos, startDelay:0}));
head = segments[0];
pos = head.fcPos;
drawBody();
createFins();
drawSegment(segments[1], segments[1].radius1, segments[1].radius2, 0, 0, segments[1].length);
drawSegment(segments[2], segments[2].radius1, segments[2].radius2, 0, 0, segments[2].length);
var i = 0;
while (i < wigglers.length) {
wigglers[i].go();
i++;
}
interval = setInterval(this, "decideWhatToDo", (Math.random() * 500) + 500);
}
function drawBody() {
head.beginFill(color, 80);
com.abowman.graphics.Draw.drawOval(head, 0, 0, 5, 5);
head.endFill();
var _local2 = head;
var _local3 = head.radius1;
var _local6 = head.radius2;
var _local4 = head.length;
var _local7 = 0;
var _local5 = 1;
_local2.beginFill(color, 80);
_local2.moveTo(_local7, _local5);
_local2.lineTo(_local3, _local5);
_local2.curveTo(_local3 * 1.4, (-_local4) * 0.4, _local6, -_local4);
_local2.lineTo(-_local6, -_local4);
_local2.curveTo((-_local3) * 1.4, (-_local4) * 0.4, -_local3, _local5);
_local2.lineTo(_local7, _local5);
_local2.endFill();
}
function createFins() {
lFin = Fin.create(head, -10, {range:15, side:Fin.RIGHT, color:color, initAngle:15});
lFin._x = 4;
lFin._y = (-head.length) * 0.1;
lFin.render();
rFin = Fin.create(head, -9, {range:15, side:Fin.LEFT, color:color, initAngle:-15});
rFin._x = -4;
rFin._y = (-head.length) * 0.1;
rFin.render();
}
function drawSegment(seg, radius1, radius2, x, y, length) {
seg.beginFill(color, 50);
seg.moveTo(x, y);
seg.lineTo(radius1, y);
seg.lineTo(radius2, -length);
seg.lineTo(-radius2, -length);
seg.lineTo(-radius1, y);
seg.lineTo(x, y);
seg.endFill();
seg.beginFill(color, 30);
com.abowman.graphics.Draw.drawOval(seg, x, y, radius1, radius1);
seg.endFill();
seg.beginFill(color, 30);
com.abowman.graphics.Draw.drawOval(seg, x, -length, radius2, radius2);
seg.endFill();
}
function findFood() {
var _local5;
var _local6 = 400;
var _local9;
var _local7;
var _local8 = parentMC.activeFlakes;
var _local2;
var _local4;
var _local10 = _local8.length;
var _local3 = 0;
while (_local3 < _local10) {
_local4 = _local8[_local3].pos;
_local7 = Math.atan2(_local4.y - head._y, _local4.x - head._x);
_local2 = angle - _local7;
_local2 = _local2 % 6.28318531;
if (_local2 < 0) {
_local2 = _local2 + 6.28318531;
}
if ((_local2 < (120 * com.abowman.math.Trig.piBy180)) || (_local2 > (240 * com.abowman.math.Trig.piBy180))) {
_local5 = Math.abs(pos.y - _local4.y) + Math.abs(pos.x - _local4.x);
if (_local5 < _local6) {
_local6 = _local5;
_local9 = _local3;
}
}
_local3++;
}
if (_local9 == null) {
return(false);
}
targetFood = _local8[_local9];
return(true);
}
function decideWhatToDo() {
if (!findFood()) {
if (!findMouse()) {
findRandomTarget();
}
}
}
function findMouse() {
if (parentMC.mouseInactiveCount < timeToRest) {
var _local3 = Math.atan2(parentMC.xmouse - head._y, parentMC.xmouse - head._x);
var _local2 = angle - _local3;
_local2 = _local2 % 6.28318531;
if (_local2 < 0) {
_local2 = _local2 + 6.28318531;
}
if ((_local2 < (120 * com.abowman.math.Trig.piBy180)) || (_local2 > (240 * com.abowman.math.Trig.piBy180))) {
return((followMouse = true));
}
return((followMouse = false));
}
return((followMouse = false));
}
function update() {
if ((targetFood != null) && (targetFood.active)) {
targetPos.x = targetFood.pos.x;
targetPos.y = targetFood.pos.y;
targetIsFood = true;
} else {
if (followMouse) {
targetPos.x = parentMC.xmouse;
targetPos.y = parentMC.ymouse;
}
targetIsFood = false;
}
move();
if (targetIsFood && (distToTarget < 5)) {
eatFood();
}
}
function eatFood() {
targetFood.hide();
speed = speed * 0.75;
targetIsFood = false;
parentMC.makeFlakeInactive(targetFood);
targetFood = null;
}
function move() {
if (resting) {
restCount++;
}
turnDir = (-angleSpeed) * 400;
turnToPoint();
adjustSpeed();
wigglePos = wigglePos + wiggleSpeed;
if (speed > 0.1) {
speed = speed - friction;
}
var _local5 = angle % (Math.PI*2);
var _local9 = _local5 + Math.PI;
var _local8 = _local5 + (Math.PI/2);
var _local12 = Math.sin(_local5) * speed;
var _local13 = Math.cos(_local5) * speed;
head.fcPos.x = head.fcPos.x + _local13;
head.fcPos.y = head.fcPos.y + _local12;
var _local11 = wigglers[0];
var _local10 = wigglers[1];
var _local2;
var _local4 = _local11.pos;
var _local6 = _local10.pos;
_local11.update(_local8, wigglePos, wiggleRange);
head.rcPos.y = (Math.sin(_local9) * head.length) + head.fcPos.y;
head.rcPos.x = (Math.cos(_local9) * head.length) + head.fcPos.x;
_local10.update(_local8, wigglePos, wiggleRange);
head._x = _local4.x;
head._y = _local4.y;
head._rotation = (Math.atan2(_local6.y - _local4.y, _local6.x - _local4.x) * 57.2957795) + 90;
var _local7 = _local9;
var _local3 = 1;
while (_local3 < numSegs) {
_local5 = _local7 + (turnDir * com.abowman.math.Trig.piBy180);
_local4 = wigglers[_local3].pos;
_local6 = wigglers[_local3 + 1].pos;
_local2 = segments[_local3];
_local2.rcPos.x = _local2.fcPos.x + (Math.cos(_local5) * _local2.length);
_local2.rcPos.y = _local2.fcPos.y + (Math.sin(_local5) * _local2.length);
wigglers[_local3 + 1].update(_local8 + (turnDir * com.abowman.math.Trig.piBy180), wigglePos, wiggleRange);
_local2._rotation = (Math.atan2(_local6.y - _local4.y, _local6.x - _local4.x) * 57.2957795) + 90;
_local2._x = _local4.x;
_local2._y = _local4.y;
_local7 = _local5;
_local3++;
}
if (wigglers[3].range > 1.5) {
tailFin._xscale = Math.max(30, Math.abs(wigglers[3].xOffSet / wigglers[3].range) * 100);
} else {
tailFin._xscale = 30;
}
tailFin._rotation = segments[2]._rotation;
tailFin._x = segments[2]._x;
tailFin._y = segments[2]._y;
rFin.update(0.5, acc / _acc);
lFin.update(0.5, acc / _acc);
}
function findRandomTarget() {
if (distToTarget < 20) {
resting = true;
if (restCount > timeToRest) {
targetPos.x = Math.random() * Stage.width;
targetPos.y = Math.random() * Stage.height;
resetRest();
}
}
}
function resetRest() {
timeToRest = Math.random() * 150;
restCount = 0;
resting = false;
}
function turnToPoint() {
var _local3 = Math.atan2(targetPos.y - head._y, targetPos.x - head._x);
var _local2 = angle - _local3;
_local2 = _local2 % 6.28318531;
if (_local2 < 0) {
_local2 = _local2 + 6.28318531;
}
if (speed > 0.5) {
if ((_local2 > (15 * com.abowman.math.Trig.piBy180)) && (_local2 < Math.PI)) {
angleSpeed = angleSpeed - angleAcc;
friction = turnFriction;
} else if ((_local2 < (345 * com.abowman.math.Trig.piBy180)) && (_local2 > Math.PI)) {
angleSpeed = angleSpeed + angleAcc;
friction = turnFriction;
} else {
friction = straightFriction;
}
}
angleSpeed = Math.max(-0.08, angleSpeed);
angleSpeed = Math.min(0.08, angleSpeed);
angleSpeed = angleSpeed * angleFric;
angle = angle + angleSpeed;
}
function adjustSpeed() {
var _local4 = targetPos.x - head._x;
var _local3 = targetPos.y - head._y;
distToTarget = Math.sqrt((_local4 * _local4) + (_local3 * _local3));
var _local2 = 1;
if ((count % 20) == 0) {
if (targetIsFood) {
_local2 = 2;
} else {
_local2 = 1;
}
if ((distToTarget > 200) && (speed < (3 * _local2))) {
acc = _acc;
wiggleSpeed = 0.6;
wiggleRange = 1;
start();
} else if (((distToTarget < 200) && (distToTarget > 100)) && (speed < (2 * _local2))) {
acc = _acc * 0.95;
wiggleSpeed = 0.5;
wiggleRange = 1;
start();
} else if (((distToTarget < 100) && (distToTarget > 50)) && (speed < (1.5 * _local2))) {
acc = _acc * 0.9;
wiggleSpeed = 0.4;
wiggleRange = 1;
start();
} else if (((distToTarget < 50) && (distToTarget > 20)) && (speed < (1 * _local2))) {
acc = _acc * 0.85;
wiggleRange = 1;
wiggleSpeed = 0.3;
start();
} else if (((targetIsFood && (distToTarget < 50)) && (distToTarget > 0)) && (speed < (1 * _local2))) {
acc = (_acc * 0.85) * _local2;
wiggleRange = 1;
wiggleSpeed = 0.3;
start();
} else if (speed < 0.5) {
start();
wiggleRange = 0.2;
wiggleSpeed = 0.1;
} else {
acc = 0;
stop();
wiggleRange = 0;
}
}
count++;
speed = speed + acc;
}
function swimTo(x, y) {
targetPos.x = x;
targetPos.y = y;
}
function start(wiggleRange) {
if (wigglers[0].mustStop || (!wigglers[0].wiggling)) {
var _local2 = 0;
while (_local2 < wigglers.length) {
wigglers[_local2].go();
_local2++;
}
}
}
function stop() {
var _local2 = 0;
while (_local2 < wigglers.length) {
wigglers[_local2].stop();
_local2++;
}
}
var acc = 0.1;
var _acc = 0.1;
var speed = 0;
var friction = 0.01;
var straightFriction = 0.01;
var turnFriction = 0.06;
var turnDir = 0;
var color = 16012608;
var targetSpeed = 3;
var targetDir = 1;
var distToTarget = 0;
var angleSpeed = 0;
var angleAcc = 0.01;
var angleFric = 0.9;
var wiggleRange = 1;
var count = 0;
var wigglePos = 0;
var followMouse = false;
var restCount = 0;
var timeToRest = 0;
var numSegs = 3;
}
Symbol 9 MovieClip [__Packages.Food] Frame 0
class Food extends MovieClip
{
var color, pos, vel, _visible, active, beginFill, endFill, _x, _y;
function Food () {
super();
}
static function create(parent, depth, args) {
var _local1 = Food(parent.attachMovie(symbolName, "Food" + depth, depth));
_local1.init(args);
return(_local1);
}
function init(args) {
color = args.color;
pos = {x:0, y:0};
vel = {x:0, y:0};
draw();
_visible = false;
}
function hide() {
active = false;
_visible = false;
}
function draw() {
beginFill(color);
com.abowman.graphics.Draw.drawOval(this, 0, 0, 1 + Math.random(), 1 + Math.random());
endFill();
}
function update() {
pos.x = pos.x + vel.x;
pos.y = pos.y + vel.y;
pos.x = Math.max(pos.x, 1);
pos.x = Math.min(pos.x, Stage.width);
pos.y = Math.max(pos.y, 1);
pos.y = Math.min(pos.y, Stage.height);
_x = pos.x;
_y = pos.y;
_root.test.text = "_y=" + _y;
if (active && (!_visible)) {
_visible = true;
}
}
function drop(x, y) {
vel.x = (Math.random() - 0.5) / 5;
vel.y = (Math.random() - 0.5) / 5;
pos.x = x;
pos.y = y;
active = true;
}
static var symbolName = "__Packages.Food";
static var symbolLinked = Object.registerClass(symbolName, Food);
}
Symbol 10 MovieClip [__Packages.Fin] Frame 0
class Fin extends MovieClip
{
var initRange, range, side, prevRot, _rotation, initAngle, rotSpeed, beginFill, curveTo, lineTo, endFill;
function Fin () {
super();
}
static function create(parent, depth, args) {
var _local1 = Fin(parent.attachMovie(symbolName, "Fin" + depth, depth));
_local1.init(args);
return(_local1);
}
function init(args) {
initRange = (range = args.range);
side = args.side;
prevRot = _rotation;
color = args.color;
initAngle = args.initAngle;
}
function update(speed, fracRange) {
range = (((initRange * fracRange) - range) * 0.95) + range;
if ((side * rotSpeed) > 0) {
speed = speed * retractSpeed;
}
_rotation = (initAngle + ((Math.sin(count) * side) * range)) - (side * range);
count = count + speed;
rotSpeed = _rotation - prevRot;
prevRot = _rotation;
}
function render() {
beginFill(color, 50);
curveTo(side * 10, -8, (-side) * 2, -6);
lineTo(0, 0);
endFill();
}
static var symbolName = "__Packages.Fin";
static var symbolLinked = Object.registerClass(symbolName, Fin);
static var LEFT = -1;
static var RIGHT = 1;
var count = 0;
var color = 0;
var dir = 1;
var retractSpeed = 0.5;
}
Symbol 11 MovieClip [__Packages.Segment] Frame 0
class Segment extends MovieClip
{
var length, radius1, radius2, color, fcPos, rcPos;
function Segment () {
super();
}
static function create(parent, depth, args) {
var _local1 = Segment(parent.attachMovie(symbolName, "Segment" + depth, depth));
_local1.init(args);
return(_local1);
}
function init(args) {
length = args.length;
radius1 = args.radius1;
radius2 = args.radius2;
color = args.color;
fcPos = args.fcPos;
rcPos = {x:0, y:0};
}
static var symbolName = "__Packages.Segment";
static var symbolLinked = Object.registerClass(symbolName, Segment);
}
Symbol 12 MovieClip [__Packages.Wiggler] Frame 0
class Wiggler
{
var initRange, startDelay, range, center, pos, xOffSet, mustStop;
function Wiggler (args) {
initRange = args.range;
startDelay = args.startDelay;
range = args.range;
center = args.center;
pos = {x:0, y:0};
}
function update(angle, wigglePos, scaleRange) {
xOffSet = Math.sin(wigglePos + startDelay) * range;
pos.x = xOffSet + center.x;
pos.y = center.y;
pos.y = (Math.sin(angle) * xOffSet) + center.y;
pos.x = (Math.cos(angle) * xOffSet) + center.x;
if (mustStop) {
range = range * 0.95;
} else if (range < (initRange * scaleRange)) {
range = range * 1.5;
}
}
function stop() {
mustStop = true;
}
function go() {
mustStop = false;
}
}
Symbol 13 MovieClip [__Packages.com.abowman.math.Trig] Frame 0
class com.abowman.math.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) / piBy180);
}
static var piBy180 = (Math.PI/180);
}
Symbol 14 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 15 MovieClip [__Packages.com.abowman.math.Vector] Frame 0
class com.abowman.math.Vector
{
function Vector () {
}
static function dotProduct(v1, v2) {
return((v1.x * v2.x) + (v1.y * v2.y));
}
static function norm(v) {
var _local2 = Math.sqrt((v.x * v.x) + (v.y * v.y));
return({x:v.x / _local2, y:v.y / _local2});
}
static function normal(v) {
return({x:-v.y, y:v.x});
}
static function scale(v, k) {
return({x:v.x * k, y:v.y * k});
}
static function addition(v1, v2) {
return({x:v1.x + v2.x, y:v1.y + v2.y});
}
static function subtraction(v1, v2) {
return({x:v1.x - v2.x, y:v1.y - v2.y});
}
static function length(v) {
return(Math.sqrt(dotProduct(v, v)));
}
static function length2(v1, v2) {
return(Math.sqrt(dotProduct(v1, v2)));
}
static function distTo(v1, v2) {
var _local2 = v1.x - v2.x;
var _local1 = v1.y - v2.y;
return(Math.sqrt((_local2 * _local2) + (_local1 * _local1)));
}
static function angleTo(v, vto) {
var _local2 = vto.x - v.x;
var _local1 = vto.y - v.y;
return(Math.atan2(_local1, _local2));
}
static function rotate(v1, v2, reverse) {
var _local3 = new Object();
if (reverse) {
_local3.x = (v1.x * v2.x) + (v1.y * v2.y);
_local3.y = (v1.y * v2.x) - (v1.x * v2.y);
} else {
_local3.x = (v1.x * v2.x) - (v1.y * v2.y);
_local3.y = (v1.y * v2.x) + (v1.x * v2.y);
}
return(_local3);
}
}