Frame 1
Application.main();
Symbol 2 MovieClip [__Packages.Application] Frame 0
class Application extends MovieClip
{
var link, getNextHighestDepth, _xscale, _yscale, spiders;
function Application () {
super();
}
function init() {
var _local10 = 1;
var _local13 = 3355443 /* 0x333333 */;
var _local8 = 6710886 /* 0x666666 */;
var _local9 = 6710886 /* 0x666666 */;
var _local15 = 2859049 /* 0x2BA029 */;
var _local12 = 16777215 /* 0xFFFFFF */;
var _local6 = 1;
var _local4 = 1;
var _local7 = 3355443 /* 0x333333 */;
var _local5 = false;
if ((_level0.up_originalLook != null) && (_level0.up_originalLook != "")) {
if ((_level0.up_originalLook.toLowerCase() == "true") || (_level0.up_originalLook == "1")) {
_local5 = true;
}
}
if ((_level0.up_original != null) && (_level0.up_original != "")) {
if ((_level0.up_original.toLowerCase() == "true") || (_level0.up_original == "1")) {
_local5 = true;
}
}
if ((_level0.up_backgroundColor != null) && (_level0.up_backgroundColor != "")) {
_local12 = parseInt("0x" + _level0.up_backgroundColor);
}
if ((_level0.up_size != null) && (_level0.up_size != "")) {
_local6 = _level0.up_size;
}
if ((_level0.up_bellySize != null) && (_level0.up_bellySize != "")) {
_local15 = _level0.up_bellySize;
}
if ((_level0.up_bellyColor != null) && (_level0.up_bellyColor != "")) {
_local8 = parseInt("0x" + _level0.up_bellyColor);
}
if ((_level0.up_headColor != null) && (_level0.up_headColor != "")) {
_local9 = parseInt("0x" + _level0.up_headColor);
} else {
_local9 = _local8;
}
if ((_level0.up_legColor != null) && (_level0.up_legColor != "")) {
_local7 = parseInt("0x" + _level0.up_legColor);
}
if ((_level0.up_speed != null) && (_level0.up_speed != "")) {
_local4 = _level0.up_speed;
}
if (((_level0.up_backgroundImage != null) && (_level0.up_backgroundImage != "")) && (_level0.up_backgroundImage != "http://")) {
createBackgroundImage(_level0.up_backgroundImage);
}
if ((_level0.backgroundColor != null) && (_level0.backgroundColor != "")) {
_local12 = parseInt("0x" + _level0.backgroundColor);
}
if ((_level0.legColor != null) && (_level0.legColor != "")) {
_local7 = parseInt("0x" + _level0.legColor);
}
if ((_level0.headColor != null) && (_level0.headColor != "")) {
_local9 = parseInt("0x" + _level0.headColor);
}
if ((_level0.bellyColor != null) && (_level0.bellyColor != "")) {
_local8 = parseInt("0x" + _level0.bellyColor);
}
_local13 = com.abowman.graphics.Draw.calcGradient(_local12, 80);
var _local11 = new ContextMenu();
_local11.hideBuiltInItems();
var _local14 = new ContextMenuItem("Find more creatures at aBowman.com", function () {
this.getURL("http://aBowman.com/google-modules/", "_top");
});
_local11.customItems.push(_local14);
_root.menu = _local11;
link = ABowmanLink2.create(this, getNextHighestDepth(), "http://aBowman.com/google-modules/spider", _local13);
link._xscale = (link._yscale = 110);
link._x = 1;
Stage.align = "TL";
Stage.scaleMode = "noScale";
_xscale = (_yscale = 85);
spiders = new Array();
var _local3 = 0;
while (_local3 < _local10) {
spiders[_local3] = Spider.createMovie(this, getNextHighestDepth(), {size:_local6, bellyColor:_local8, headColor:_local9, speed:_local4, legColor:_local7, original:_local5});
_local3++;
}
}
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;
}
};
}
function onEnterFrame() {
var _local2 = 0;
while (_local2 < spiders.length) {
keepOnScreen(spiders[_local2]);
spiders[_local2].update();
_local2++;
}
}
function keepOnScreen(s) {
if (s.x > (Stage.width - margin)) {
s.x = margin * 0.75;
s.setLegs();
} else if (s.x < margin) {
s.x = Stage.width - (margin * 0.75);
s.setLegs();
}
if (s.y > (Stage.height - margin)) {
s.y = margin * 0.75;
s.setLegs();
} else if (s.y < margin) {
s.y = Stage.height - (margin * 0.75);
s.setLegs();
}
}
static function createMovie(parent, depth) {
var _local1 = Application(parent.attachMovie(symbolName, "Application" + depth, depth));
_local1.init();
return(_local1);
}
static function main(mc) {
createMovie(_root, _root.getNextHighestDepth());
}
static var symbolName = "__Packages.Application";
static var symbolLinked = Object.registerClass(symbolName, Application);
var getMouseAng = false;
var margin = -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, color) {
var _local1 = Logo(parent.attachMovie(symbolName, "Logo" + depth, depth));
_local1.init(color);
return(_local1);
}
function init(color) {
if (color != null) {
lineColor = color;
}
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.Spider] Frame 0
class Spider extends MovieClip
{
var bodyRadius, shadows, createEmptyMovieClip, dest, x, y, angle, bAngle, bodyHeight, angSpeed, legs, getNextHighestDepth, initStride, abdomShC, abdomSh, bodyC, body, abdomC, abdom, facingDest, legsToStop, _xmouse, _ymouse, distTo, counter, currLeg, clear, lineStyle, moveTo, lineTo;
function Spider () {
super();
}
static function createMovie(parent, depth, args) {
var _local1 = Spider(parent.attachMovie(symbolName, "Spider" + depth, depth));
_local1.init(args);
return(_local1);
}
function init(args) {
var _local7 = 5;
var _local5 = 5;
var _local4 = args.legColor;
size = _local7 + (args.size * _local5);
bodyRadius = 0.5 * size;
abdomColor = args.bellyColor;
headColor = args.headColor;
shadows = createEmptyMovieClip("shadows", -100);
dest = {x:0, y:0};
x = Math.random() * Stage.width;
y = Math.random() * Stage.height;
angle = (Math.random() * Math.PI) * 2;
bAngle = angle;
bodyHeight = 0.8 * size;
angSpeed = ((20 + int(Math.random() * 10)) * Math.PI) / 180;
legs = new Array();
var _local9 = 9 + int(Math.random() * 4);
var _local6 = 25;
var _local8 = 15;
_local9 = _local6 - (_local8 * args.speed);
wait = int(_local9 * 0.2);
legs.push(Leg.createMovie(this, getNextHighestDepth(), {length:3.1 * size, side:-1, position:2, framesPerStep:_local9, color:_local4, restAngle:1.30899693899575}));
legs.push(Leg.createMovie(this, getNextHighestDepth(), {length:3.5 * size, side:1, position:1, framesPerStep:_local9, color:_local4, restAngle:0.698131700797732}));
legs.push(Leg.createMovie(this, getNextHighestDepth(), {length:3.3 * size, side:1, position:3, framesPerStep:_local9, color:_local4, restAngle:2.00712863979348}));
legs.push(Leg.createMovie(this, getNextHighestDepth(), {length:4.2 * size, side:-1, position:4, framesPerStep:_local9, color:_local4, restAngle:2.53072741539178}));
legs.push(Leg.createMovie(this, getNextHighestDepth(), {length:3.5 * size, side:-1, position:1, framesPerStep:_local9, color:_local4, restAngle:0.698131700797732}));
legs.push(Leg.createMovie(this, getNextHighestDepth(), {length:3.1 * size, side:1, position:2, framesPerStep:_local9, color:_local4, restAngle:1.30899693899575}));
legs.push(Leg.createMovie(this, getNextHighestDepth(), {length:3.3 * size, side:-1, position:3, framesPerStep:_local9, color:_local4, restAngle:2.00712863979348}));
legs.push(Leg.createMovie(this, getNextHighestDepth(), {length:4.2 * size, side:1, position:4, framesPerStep:_local9, color:_local4, restAngle:2.53072741539178}));
initStride = (stride = 2.5 * size);
var _local2 = 0;
while (_local2 < legs.length) {
if (args.original) {
legs[_local2].render = legs[_local2].renderCurved;
} else {
legs[_local2].render = legs[_local2].renderJointed;
}
_local2++;
}
setLegs();
if (!args.original) {
createBody();
}
}
function createBody() {
var _local5 = size;
var _local3 = -1.3 * size;
var _local2 = 0;
abdomShC = createEmptyMovieClip("abdomShC", getNextHighestDepth());
abdomSh = abdomShC.createEmptyMovieClip("abdomSh", abdomShC.getNextHighestDepth());
abdomSh.beginFill(9934488, 20);
com.abowman.graphics.Draw.drawOval(abdomSh, -1.3 * size, 0, size, 0.8 * size);
abdomSh.endFill();
bodyC = createEmptyMovieClip("bodyC", getNextHighestDepth());
body = bodyC.createEmptyMovieClip("body", bodyC.getNextHighestDepth());
body.beginGradientFill("radial", [headColor, 0], [100, 100], [0, 255], {matrixType:"box", x:(-bodyRadius) * 2, y:(-bodyRadius) * 2, w:bodyRadius * 4, h:bodyRadius * 4, r:0});
com.abowman.graphics.Draw.drawOval(body, 0, 0, bodyRadius, bodyRadius);
body.endFill();
abdomC = createEmptyMovieClip("abdomC", getNextHighestDepth());
abdomC._x = (abdomC._y = 200);
abdom = abdomC.createEmptyMovieClip("abdom", abdomC.getNextHighestDepth());
_local5 = size;
_local3 = -1.3 * size;
_local2 = 0;
abdom.beginGradientFill("radial", [abdomColor, 0], [100, 100], [0, 255], {matrixType:"box", x:(-1.5 * size) - (size * 2), y:-2 * (0.8 * size), w:size * 4, h:(0.8 * size) * 4, r:0});
com.abowman.graphics.Draw.drawOval(abdom, -1.3 * size, 0, size, 0.8 * size);
abdom.endFill();
bodyC._yscale = (abdomShC._yscale = (abdomC._yscale = 90));
setLegs();
getCenter();
bodyC._x = (abdomShC._x = (abdomC._x = _local3));
abdomShC._y = _local2;
abdomC._y = (_local2 - bodyHeight) - 1;
bodyC._y = _local2 - bodyHeight;
abdomSh._rotation = (abdom._rotation = (angle * 180) / Math.PI);
}
function setDestination(dx, dy) {
dest.x = dx;
dest.y = dy;
}
function moveTowardDestination() {
var _local3 = com.abowman.math.Trig.angleTo(x, y, dest.x, dest.y);
var _local2 = com.abowman.math.Trig.fixAngle(angle - _local3);
if ((_local2 > (20 * com.abowman.math.Trig.piBy180)) && (_local2 < Math.PI)) {
angle = angle - angSpeedToM;
facingDest = false;
} else if ((_local2 < (340 * com.abowman.math.Trig.piBy180)) && (_local2 > Math.PI)) {
angle = angle + angSpeedToM;
facingDest = false;
} else {
facingDest = true;
}
}
function setLegs() {
var _local2 = 0;
while (_local2 < legs.length) {
legs[_local2].setLeg(x, y, angle);
_local2++;
}
}
function rest() {
stride = 0;
legsToStop = int(Math.random() * 2) + 4;
timeToRest = (Math.random() * 30) + 20;
walking = false;
}
function walk() {
stride = initStride;
walking = true;
numRestingLegs = 0;
restCount = 0;
}
function onMouseMove() {
setDestination(_xmouse, _ymouse);
randomMovement = false;
}
function update() {
getCenter();
if (!randomMovement) {
var _local4 = dest.x - x;
var _local3 = dest.y - y;
distTo = Math.sqrt((_local4 * _local4) + (_local3 * _local3));
if ((distTo < 20) && (walking)) {
stride = -10;
} else if ((distTo < 50) && (walking)) {
rest();
} else if ((distTo > 50) && (!walking)) {
walk();
} else if ((!walking) && (!facingDest)) {
walk();
}
}
bodyC._x = (abdomShC._x = (abdomC._x = x));
abdomShC._y = y;
abdomC._y = (y - bodyHeight) - 1;
bodyC._y = y - bodyHeight;
if (Math.abs(angle) > 21.9911486) {
if (angle > 0) {
angle = angle - 18.8495559215388;
bAngle = bAngle - 18.8495559215388;
} else {
angle = angle + 18.8495559215388;
bAngle = bAngle + 18.8495559215388;
}
}
var _local2 = angle - bAngle;
if (Math.abs(_local2) > 0.01) {
bAngle = bAngle + (_local2 * 0.05);
} else {
bAngle = angle;
}
body._rotation = (abdomSh._rotation = (abdom._rotation = (bAngle * 180) / Math.PI));
if (counter == wait) {
if (randomMovement && (numRestingLegs <= legsToStop)) {
moveRandom();
} else {
moveTowardDestination();
}
if (numRestingLegs <= legsToStop) {
currLeg = legs[legNum];
((legNum < (legs.length - 1)) ? (legNum++) : ((legNum = 0)));
currLeg.setTarget(x, y, angle, stride, bodyRadius);
if (walking == false) {
numRestingLegs++;
}
} else {
restCount++;
}
}
((counter < wait) ? (counter++) : ((counter = 0)));
if (timeToRest <= restCount) {
if (restCount > 0) {
randomMovement = true;
}
if (!walking) {
walk();
}
}
render();
}
function getCenter() {
var _local4 = 0;
var _local3 = 0;
var _local2 = 0;
while (_local2 < legs.length) {
_local4 = _local4 + legs[_local2].ftX;
_local3 = _local3 + legs[_local2].ftY;
_local2++;
}
x = _local4 / legs.length;
y = _local3 / legs.length;
}
function render() {
clear();
drawShadow();
drawLegs();
lineStyle(5, 3355443, 100);
moveTo(x, y - bodyHeight);
lineTo(x + 0.5, y - bodyHeight);
}
function drawLegs() {
var _local2 = 0;
while (_local2 <= legs.length) {
legs[_local2].render(x, y, bAngle, bodyRadius);
_local2++;
}
}
function drawShadow() {
shadows.clear();
shadows.lineStyle(6, 9934488, 20);
shadows.moveTo(x, y);
shadows.lineTo(x + 0.5, y);
shadows.lineStyle(10, 9934488, 20);
var _local2 = 0;
while (_local2 <= legs.length) {
legs[_local2].renderShadow(shadows, x, y);
_local2++;
}
}
function moveRandom() {
if (((int(Math.random() * 8) + 1) == 8) && (currLeg.position == 1)) {
(Math.round(Math.random()) ? ((angle = angle - angSpeed)) : ((angle = angle + angSpeed)));
}
}
static var symbolName = "__Packages.Spider";
static var symbolLinked = Object.registerClass(symbolName, Spider);
var wait = 5;
var legNum = 0;
var randomMovement = true;
var angSpeedToM = 0.10471975511966;
var size = 2;
var abdomColor = 16711680;
var headColor = 16711680;
var walking = true;
var numRestingLegs = 0;
var stride = 0;
var timeToRest = 0;
var restCount = 0;
}
Symbol 7 MovieClip [__Packages.Leg] Frame 0
class Leg extends MovieClip
{
var side, length, position, color, restAngle, framesPerStep, easer, ftX, ftY, ftHeight, _parent, clear, lineStyle, moveTo, lineTo, curveTo;
function Leg () {
super();
}
static function createMovie(parent, depth, args) {
var _local1 = Leg(parent.attachMovie(symbolName, "Leg" + depth, depth));
_local1.init(args);
return(_local1);
}
function init(args) {
side = args.side;
length = args.length;
position = args.position;
color = args.color;
restAngle = args.restAngle;
framesPerStep = args.framesPerStep;
easer = new com.abowman.motion.EaseInOut();
}
function onEnterFrame() {
easer.update();
ftX = easer.x;
ftY = easer.y;
ftHeight = ftY - ((0.6 * _parent.size) * Math.sin((easer.time / framesPerStep) * Math.PI));
}
function renderJointed(x, y, angle, bodyRadius) {
var _local3 = x + (Math.cos(angle - (side * restAngle)) * bodyRadius);
var _local2 = y + (Math.sin(angle - (side * restAngle)) * bodyRadius);
clear();
lineStyle(1, color, 100);
moveTo(ftX, ftHeight);
lineTo(ftX + ((_local3 - ftX) * 0.2), (ftY + ((_local2 - ftY) * 0.2)) - (1 * _parent.size));
lineStyle(2, color, 100);
lineTo(ftX + ((_local3 - ftX) * 0.6), (ftY + ((_local2 - ftY) * 0.6)) - (1.5 * _parent.size));
lineStyle(3, color, 100);
lineTo(_local3, _local2 - _parent.bodyHeight);
}
function renderCurved() {
clear();
lineStyle(1, color, 100);
moveTo(ftX, ftHeight);
curveTo(ftX, ftY - (1.5 * _parent.size), _parent.x, _parent.y - _parent.bodyHeight);
}
function renderShadow(mc, x, y) {
mc.lineStyle(3, 9934488, 25);
mc.moveTo(ftX, ftY);
mc.lineTo(x, y);
}
function setLeg(x, y, angle) {
ftX = x + (Math.cos(angle - (side * restAngle)) * length);
ftY = y + (Math.sin(angle - (side * restAngle)) * length);
ftHeight = ftY;
easer.init(ftX, ftX, ftY, ftY, framesPerStep);
}
function setTarget(x, y, angle, stride) {
var _local3 = x + (Math.cos(angle - (side * restAngle)) * length);
var _local2 = y + (Math.sin(angle - (side * restAngle)) * length);
_local3 = _local3 + (Math.cos(angle) * stride);
_local2 = _local2 + (Math.sin(angle) * stride);
easer.init(ftX, _local3, ftY, _local2, framesPerStep);
}
static var symbolName = "__Packages.Leg";
static var symbolLinked = Object.registerClass(symbolName, Leg);
var maxFtHeight = 6;
}
Symbol 8 MovieClip [__Packages.com.abowman.motion.EaseInOut] Frame 0
class com.abowman.motion.EaseInOut
{
var x, beginX, changeX, y, beginY, changeY, ease, targetX, targetY;
function EaseInOut () {
}
function init(beginX, targetX, beginY, targetY, duration) {
x = (this.beginX = beginX);
changeX = targetX - beginX;
y = (this.beginY = beginY);
changeY = targetY - beginY;
this.duration = duration;
time = 0;
ease = easeInOutQuad;
}
function update() {
if (time < duration) {
x = ease(time++, beginX, changeX, duration);
y = ease(time, beginY, changeY, duration);
}
}
function easeInOutQuad(t, b, c, d) {
t = t / (d / 2);
if (t < 1) {
return((((c / 2) * t) * t) + b);
}
t--;
return((((-c) / 2) * ((t * (t - 2)) - 1)) + b);
}
function noEase(t, b, c, d) {
t = t / d;
return(b + (c * t));
}
function isMoving() {
return(time < duration);
}
function setTarget(x, y) {
targetX = x;
targetY = y;
}
var time = 0;
var duration = 0;
}
Symbol 9 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 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);
}