Section 1
//AcrobotFrame (acrobots.AcrobotFrame)
package acrobots {
import flash.display.*;
import flash.geom.*;
public dynamic class AcrobotFrame extends SuperSprite {
var _xreg;
var roteLength;// = 10
var shell_mc;
var _fadeMax;
public var stabilizer;// = 0
var _fadeCounter;// = 0
public var yMax;
var bg;
var frameWidth;
public var speed;// = 1
var _yreg;
var _bots:Array;
var _manager:BotMaster;
public var gravity;// = 0.1
var _colorStack;
var _roteAngle;// = 0
var legLength;// = 85
var dragBo;// = null
var isRotating;// = false
public var xMin;
var roteMeter;// = 0
var _gravDir;// = 0
var _lightingState;// = 0
var frameHeight;
public var yMin;
public var touchDrag;
public var drag;// = 0
var _speed;
public var scale;
public var gravityDir;// = 1.5707963267949
var _cpuRate;// = 1
public var floorSide;// = 1
var _time;
public var stickiness;// = 0
var _currGravDir;
var mask_mc;
public var xMax;
var _run;// = true
var _transform2;
var _transform;
var contentMc:SuperSprite;
var _botStep;// = 0
public function AcrobotFrame(){
var _local1:*;
var _local2:*;
speed = 1;
gravity = 0.1;
gravityDir = (Math.PI / 2);
_gravDir = 0;
floorSide = 1;
stickiness = 0;
drag = 0;
_botStep = 0;
_colorStack = [3178751, 16724804, 47923, 13382604, 0xBB6600, 0xBBBB, 0xDD9900, 0x88AA00];
legLength = 85;
_run = true;
_cpuRate = 1;
_lightingState = 0;
_fadeCounter = 0;
_roteAngle = 0;
roteMeter = 0;
isRotating = false;
roteLength = 10;
stabilizer = 0;
dragBo = null;
super();
_xreg = x;
_yreg = y;
_bots = [];
_manager = new BotMaster(this);
shell_mc = new Sprite();
addChild(shell_mc);
bg = new Square();
shell_mc.addChild(bg);
contentMc = new SuperSprite();
shell_mc.addChild(contentMc);
mask_mc = new ContentMask();
addChild(mask_mc);
shell_mc.mask = mask_mc;
_transform = new Transform(contentMc);
_transform2 = new Transform(bg);
_local1 = new ColorTransform(0, 0, 0, 1, 0, 51, 102, 0);
_transform.colorTransform = _local1;
_transform2.colorTransform = _local1;
setMySize(450, 450);
setMyScale(1);
_local2 = 0;
_botStep = 0;
addEventListener("mouseDown", mouseDownEvent);
}
public function setStabilizer(_arg1){
stabilizer = _arg1;
}
public function setTransitionTimeMax(_arg1){
_manager.setTransitionTimeMax(_arg1);
}
function endRotate(){
isRotating = false;
}
function mouseMoveEvent(_arg1){
if (_arg1.buttonDown == false){
mouseUpEvent(_arg1);
};
}
public function removePreviousBot(){
if (_botStep == 0){
return;
};
_botStep--;
_manager.exitBot(_botStep);
}
public function setMyScale(_arg1){
scale = _arg1;
contentMc.scaleX = (contentMc.scaleY = scale);
xMax = ((frameWidth / scale) / 2);
yMax = 0;
xMin = -(xMax);
yMin = (-(frameHeight) / scale);
bg.width = frameWidth;
bg.height = frameHeight;
mask_mc.frameWidth = frameWidth;
mask_mc.frameHeight = frameHeight;
contentMc.x = (frameWidth / 2);
contentMc.y = frameHeight;
_manager.allBots("updateScale");
_manager.updateBounds();
}
function halt(){
_run = false;
}
function unveil(){
setLights(1, true);
}
function findEmptySpace(){
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:*;
var _local15:*;
var _local16:*;
var _local17:*;
var _local18:*;
_local1 = (xMax - xMin);
_local2 = (yMax - yMin);
_local3 = false;
_local4 = 0;
_local5 = _manager.getBots();
_local6 = _local5.length;
_local7 = 100;
_local8 = new Square();
contentMc.addChild(_local8);
while (((!(_local3)) && ((_local4 < 3)))) {
_local11 = [];
_local12 = Math.floor((_local1 / _local7));
_local13 = Math.floor((_local2 / _local7));
_local14 = 0;
while (_local14 < _local12) {
_local17 = 0;
while (_local17 < _local13) {
_local11.push([_local14, _local17]);
_local17++;
};
_local14++;
};
_local8.width = (_local8.height = _local7);
_local15 = Math.round(((_local12 * _local13) / 2));
_local16 = 0;
while (((!(_local3)) && ((_local11.length > 0)))) {
_local18 = _local11.splice(((_local16 == 0)) ? _local15 : Tools.getRandom(_local11.length), 1)[0];
_local8.x = ((_local18[0] * _local7) + xMin);
_local8.y = ((_local18[1] * _local7) + yMin);
_local3 = true;
_local14 = 0;
while (_local14 < _local6) {
if (_local8.hitTestObject(_local5[_local14])){
_local3 = false;
break;
};
_local14++;
};
_local16++;
};
if (!_local3){
_local7 = (_local7 / 2);
};
_local4++;
};
_local9 = (_local8.x + (_local7 / 2));
_local10 = (_local8.y + (_local7 / 2));
contentMc.removeChild(_local8);
_local8 = null;
return ({x:_local9, y:_local10});
}
function mouseUpEvent(_arg1){
if (dragBot != undefined){
dragBot.releaseDrag();
dragBot = undefined;
};
removeEventListener("mouseUp", mouseUpEvent);
stage.removeEventListener("mouseMove", mouseMoveEvent);
}
function getCpuRate(){
var _local1:*;
_local1 = new Date().getTime();
_elapsed = (((_local1 - _time) * 60) / 1000);
_time = _local1;
return ((isNaN(_elapsed)) ? 1 : (1 / _elapsed));
}
function setRotate(_arg1){
var _local2:*;
var _local3:*;
var _local4:*;
_gravDir = _arg1;
if (_gravDir >= 4){
_gravDir = (_gravDir - 4);
};
floorSide = Math.round((1 - _gravDir));
if (floorSide < 0){
floorSide = (floorSide + 4);
};
gravityDir = (Math.PI - ((Math.PI / 2) * (_gravDir + 1)));
this.rotation = (90 * _gravDir);
_local2 = (((_gravDir - 1) / 2) * Math.PI);
_local3 = (((Math.cos(_local2) + Math.sin(_local2)) + 1) / 2);
_local4 = (((Math.sin(_local2) - Math.cos(_local2)) + 1) / 2);
this.x = (_xreg + (frameWidth * _local3));
this.y = (_yreg + (frameHeight * _local4));
}
function getNearestBot(_arg1, _arg2, _arg3){
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
_local4 = _manager.getBots();
_local5 = _local4.length;
_local8 = 0;
while (_local8 < _local5) {
_local9 = _local4[_local8];
_local10 = new Between({x:_arg1, y:_arg2}, _local9).getDistance();
if ((((((_local10 < _local7)) || ((_local7 == undefined)))) && ((_local10 < _arg3)))){
_local7 = _local10;
_local6 = _local9;
};
_local8++;
};
if (_local6 != undefined){
return (_local6);
};
return (false);
}
public function toggleLights(){
_lightingState++;
if (_lightingState == 2){
_lightingState = 0;
};
setLights(_lightingState, null);
}
function fadeInControls(){
}
public function setRestlessness(_arg1){
_manager.setRestlessness(_arg1);
}
function step(){
speed = _speed;
if (_run){
_manager.step(false);
};
}
public function setMySize(_arg1, _arg2){
frameWidth = _arg1;
frameHeight = _arg2;
mask_mc.x = 0;
mask_mc.y = 0;
setMyScale(scale);
}
public function setTouchDrag(_arg1){
touchDrag = _arg1;
}
public function rotateFrame(){
if (isRotating){
return;
};
isRotating = true;
roteMeter = 0;
_currGravDir = _gravDir;
_roteDir = 1;
autoRotate();
}
function fadeInBg(_arg1, _arg2, _arg3){
_fadeCounter = -1;
_fadeMax = _arg3;
doFade(_arg1, _arg2);
}
public function setTransitionTimeMin(_arg1){
_manager.setTransitionTimeMin(_arg1);
}
function clearColorTransform(){
var _local1:*;
_local1 = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
_transform.colorTransform = _local1;
_transform2.colorTransform = _local1;
}
public function setSpeed(_arg1){
_speed = _arg1;
}
function init(_arg1, _arg2){
var _local3:*;
var _local4:*;
_local3 = _arg1.length;
_local4 = 0;
while (_local4 < _local3) {
addBot(3, _colorStack[_botStep], _arg1[_local4][0], _arg1[_local4][1], _arg1[_local4][2], 0, 0);
_botStep++;
_local4++;
};
new DelayedEvent(this, 1, "runSteps", [_arg2]);
}
function setLights(_arg1, _arg2){
var _local3:*;
_lightingState = _arg1;
if (_arg1 == 0){
clearColorTransform();
_local3 = new ColorTransform(1, 1, 1, 1, -20, -20, -20, 0);
_transform.colorTransform = _local3;
setStageColor(0xFF, 0xFF, 0xFF);
} else {
if (_arg1 == 1){
clearColorTransform();
_local3 = new ColorTransform(0, 0, 0, 1, 0, 51, 102, 0);
_transform.colorTransform = _local3;
if (_arg2){
fadeInBg([0, 51, 102], [0, 170, 0xFF], 12);
} else {
setStageColor(0, 170, 0xFF);
};
} else {
if (_arg1 == 2){
clearColorTransform();
setStageColor(0, 0, 0);
_local3 = new ColorTransform(1, 1, 1, 1, -50, -50, -50, 0);
_transform.colorTransform = _local3;
};
};
};
}
function setStageColor(_arg1, _arg2, _arg3){
var _local4:*;
_local4 = new ColorTransform(0, 0, 0, 1, _arg1, _arg2, _arg3, 0);
_transform2.colorTransform = _local4;
}
function runSteps(_arg1){
var _local2:*;
_local2 = 0;
while (_local2 < _arg1) {
_manager.step(true);
_local2++;
};
}
function addBot(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
var _local8:*;
_local8 = new Bot();
contentMc.addChild(_local8);
_local8.visible = false;
_bots.push(_local8);
_local8.init(_manager, this, _arg1, legLength, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7);
_manager.addBot(_local8);
}
public function setAttraction(_arg1){
_manager.setAttraction(_arg1);
}
function pulse(){
_manager.pulse();
}
function doFade(_arg1, _arg2){
var _local3:*;
_fadeCounter++;
_local3 = Curves.scurve((_fadeCounter / _fadeMax));
setStageColor(((_arg1[0] * (1 - _local3)) + (_arg2[0] * _local3)), ((_arg1[1] * (1 - _local3)) + (_arg2[1] * _local3)), ((_arg1[2] * (1 - _local3)) + (_arg2[2] * _local3)));
if (_fadeCounter < _fadeMax){
new DelayedEvent(this, 1, "doFade", [_arg1, _arg2]);
};
}
function get manager(){
return (_manager);
}
function autoRotate(){
var _local1:*;
var _local2:*;
roteMeter++;
_local1 = Curves.scurve((roteMeter / roteLength));
_local2 = ((_currGravDir + (_roteDir * _local1)) / 4);
setRotate((4 * _local2));
if (roteMeter == roteLength){
endRotate();
} else {
new DelayedEvent(this, 1, "autoRotate", null);
};
}
public function addNextBot(){
var _local1:*;
var _local2:*;
_local1 = _botStep;
while (_local1 >= _colorStack.length) {
_local1 = (_local1 - _colorStack.length);
};
_local2 = findEmptySpace();
addBot(3, _colorStack[_local1], _local2.x, _local2.y, (((Tools.getRandom(1000) / 1000) * Math.PI) * 2), 0, 0);
_botStep++;
}
function mouseDownEvent(_arg1){
var _local2:*;
if ((((((((mouseX > 0)) && (((mouseX * scale) < frameWidth)))) && ((mouseY > 0)))) && (((mouseY * scale) < frameHeight)))){
_local2 = getNearestBot(contentMc.mouseX, contentMc.mouseY, 120);
if (_local2 != false){
_local2.beginDrag();
dragBot = _local2;
addEventListener("mouseUp", mouseUpEvent);
stage.addEventListener("mouseMove", mouseMoveEvent);
};
};
}
}
}//package acrobots
Section 2
//Between (acrobots.Between)
package acrobots {
public class Between {
var _obj1;
var _obj2;
public function Between(_arg1, _arg2){
_obj1 = _arg1;
_obj2 = _arg2;
}
function getDy(){
return ((_obj2.y - _obj1.y));
}
function getDx(){
return ((_obj2.x - _obj1.x));
}
function getDistance(){
var _local1:*;
var _local2:*;
_local1 = (_obj2.x - _obj1.x);
_local2 = (_obj2.y - _obj1.y);
return (Math.sqrt(((_local1 * _local1) + (_local2 * _local2))));
}
function getAngle(){
var _local1:*;
var _local2:*;
_local1 = (_obj2.x - _obj1.x);
_local2 = (_obj2.y - _obj1.y);
return (Math.atan2(_local2, _local1));
}
}
}//package acrobots
Section 3
//Bot (acrobots.Bot)
package acrobots {
import flash.geom.*;
public dynamic class Bot extends SuperSprite {
var _pulseCounter;// = 0
var pulsing;// = false
var _mx;
var _my;
var _repulseDist;
var txtField;
var _interactions;
public var baseAngle;
var _pushForce;// = 4
var _px;
var _py;
var _dragging;// = false
var _exiting;
var _presenceCount;
var _vSpin;// = 0
var _legs;
public var connectedToFloor;// = false
var _legLength;
public var id;
var _dragVector;
var _addForceX;// = 0
var _addForceY;// = 0
var _entering;
var _maxPulseCounter;// = 20
public var botStage:AcrobotFrame;
var _mirrorBots;
var _numLegs;
var _strength;// = 1
public var botType;// = "bot"
var body;
public var manager;
var _dir;// = 0
public var releaseDrag;
var _vMax;// = 100
var _r;
public var _v;// = 1
public function Bot(){
botType = "bot";
_dir = 0;
_v = 1;
_vSpin = 0;
_vMax = 100;
_pushForce = 4;
_strength = 1;
connectedToFloor = false;
_dragging = false;
_addForceX = 0;
_addForceY = 0;
pulsing = false;
_pulseCounter = 0;
_maxPulseCounter = 20;
super();
_px = 200;
_py = 200;
_interactions = [];
_legs = [];
_mirrorBots = [];
buttonMode = true;
useHandCursor = true;
}
function updateScale(){
}
function get repulseDist(){
return (_repulseDist);
}
function applyForce(_arg1, _arg2){
_addForceX = (_addForceX + ((_arg1 * Math.cos(_arg2)) * botStage.speed));
_addForceY = (_addForceY + ((_arg1 * Math.sin(_arg2)) * botStage.speed));
}
function setColor(_arg1){
var _local2:*;
_local2 = new ColorTransform(1, 1, 1, 1, 0, 0, 0, 0);
_local2.color = _arg1;
this.transform.colorTransform = _local2;
}
function get interactionCount(){
return (_interactions.length);
}
function endInteraction(_arg1){
_interactions[_arg1].leg.endTrack();
_interactions.splice(_arg1, 1);
}
function doExit(){
_presenceCount--;
scaleX = (scaleY = Curves.easeOut((_presenceCount / 5)));
if (_presenceCount == 0){
_exiting = false;
removeMe();
} else {
new DelayedEvent(this, 1, "doExit", null);
};
}
function setPos(_arg1, _arg2){
_px = _arg1;
_py = _arg2;
x = _arg1;
y = _arg2;
}
public function get r(){
return (_r);
}
function applyComplexForce(_arg1, _arg2, _arg3){
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
_local4 = new Between(_arg3, this);
_local5 = _local4.getAngle();
_local6 = _local4.getDistance();
_local7 = (Math.cos((_local5 - _arg2)) * _arg1);
_local8 = (Math.sin((_local5 - _arg2)) * _arg1);
_local9 = (_local8 / _local6);
if (isNaN(_local9)){
_local9 = 0;
};
_vSpin = (_vSpin + (_local8 / _local6));
if (_vSpin < -0.3){
_vSpin = -0.3;
};
if (_vSpin > 0.3){
_vSpin = 0.3;
};
}
function getVx(){
return ((_v * cos(_dir)));
}
function getVy(){
return ((_v * sin(_dir)));
}
function step(){
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:*;
var _local15:*;
var _local16:*;
var _local17:*;
var _local18:*;
var _local19:*;
var _local20:*;
var _local21:*;
var _local22:*;
var _local23:*;
var _local24:*;
if (_entering){
_presenceCount++;
scaleX = (scaleY = Curves.easeOut((_presenceCount / 5)));
if (_presenceCount == 5){
_entering = false;
} else {
return;
};
};
applyForce(botStage.gravity, botStage.gravityDir);
sumForces();
_local1 = botStage.speed;
if (_dragging){
_local12 = _px;
_local13 = _py;
_px = (parent.mouseX - _mx);
_py = (parent.mouseY - _my);
_mx = (_mx / 2);
_my = (_my / 2);
_v = 0;
_vSpin = 0;
} else {
_px = (_px + ((Math.cos(_dir) * _v) * _local1));
_py = (_py + ((Math.sin(_dir) * _v) * _local1));
};
baseAngle = (baseAngle + (_vSpin * _local1));
_v = (_v * Math.pow((1 - botStage.drag), _local1));
if (isTouchingAnything()){
_local14 = (1 - (((pulsing) || (!(connectedToFloor)))) ? 0 : botStage.touchDrag);
_v = (_v * Math.pow(_local14, _local1));
};
_vSpin = (_vSpin * Math.pow(0.9, _local1));
_local2 = botStage.xMin;
_local3 = botStage.yMin;
_local4 = botStage.yMax;
_local5 = botStage.xMax;
if (_px < (_local2 + _r)){
_px = (_local2 + _r);
_dir = (Math.PI - _dir);
_v = (_v / 2);
};
if (_py < (_local3 + _r)){
_py = (_local3 + _r);
_dir = -(_dir);
_v = (_v / 2);
};
if (_px > (_local5 - _r)){
_px = (_local5 - _r);
_dir = (Math.PI - _dir);
_v = (_v / 2);
};
if (_py > (_local4 - _r)){
_py = (_local4 - _r);
_dir = -(_dir);
_v = (_v / 2);
};
if (_dragging){
_dragVector = new Between({x:_local12, y:_local13}, {x:_px, y:_py});
};
setPos(_px, _py);
_local6 = _interactions.length;
_local7 = (_local6 - 1);
while (_local7 >= 0) {
_local15 = _interactions[_local7].obj;
if (_local15.alive != true){
endInteraction(_local7);
};
_local7--;
};
_local8 = 0;
_local6 = _interactions.length;
_local7 = 0;
while (_local7 < _local6) {
_local16 = _interactions[_local7];
_local17 = _local16.leg;
_local8 = (_local8 + (_local17.getAngleOffset() / _local6));
if (_local16.obj.isTouching){
_local18 = (Math.sin(_local17.bendAngle) * botStage.stabilizer);
applyForce(_local18, (_local17.getTipAngle() + (Math.PI / 2)));
_local19 = _local16.obj.members;
_local20 = ((_local19[0])!=this) ? _local19[0] : _local19[1];
_local20.applyForce(-(_local18), (_local17.getTipAngle() + (Math.PI / 2)));
if (_local16.obj.touchType == "wall"){
_local21 = (-(Math.sin(_local17.twistAngle)) * botStage.stabilizer);
applyForce(_local21, (_local17.getTipAngle() + (Math.PI / 2)));
};
};
_local7++;
};
_local9 = (0.02 * botStage.speed);
if (_local8 > _local9){
_local8 = _local9;
};
if (_local8 < -(_local9)){
_local8 = -(_local9);
};
baseAngle = (baseAngle + _local8);
if (baseAngle < -(Math.PI)){
baseAngle = (baseAngle + (Math.PI * 2));
};
if (baseAngle > Math.PI){
baseAngle = (baseAngle - (Math.PI * 2));
};
_vSpin = (_vSpin + _local8);
_local7 = 0;
while (_local7 < _numLegs) {
_legs[_local7].step();
_local7++;
};
_local10 = getVx();
_local11 = getVy();
_local7 = 0;
while (_local7 < 4) {
_local22 = _mirrorBots[_local7].dir;
_local23 = ((_local22 == 0)) ? (_local5 - x) : ((_local22 == 2)) ? (x - _local2) : 0;
_local24 = ((_local22 == 1)) ? (_local4 - y) : ((_local22 == 3)) ? (y - _local3) : 0;
if (Math.abs((_local23 + _local24)) > repulseDist){
_mirrorBots[_local7].alive = false;
} else {
_mirrorBots[_local7].alive = true;
_mirrorBots[_local7].step(x, y, _local10, _local11);
};
_local7++;
};
}
function updateBounds(){
var _local1:*;
_local1 = 0;
while (_local1 < 4) {
_mirrorBots[_local1].updateBounds();
_local1++;
};
}
function initInteraction(_arg1){
var _local2:*;
_local2 = findBestLeg(new Between(this, _arg1.meetPoint).getAngle());
_interactions.push({obj:_arg1, leg:_local2});
_local2.trackPoint(_arg1.meetPoint, _arg1.transitionLength);
}
function isTouchingWall(){
var _local1:*;
var _local2:*;
_local1 = _interactions.length;
_local2 = 0;
while (_local2 < _local1) {
if (((_interactions[_local2].obj.isTouching) && ((_interactions[_local2].obj.type == "wall")))){
return (true);
};
_local2++;
};
return (false);
}
public function init(_arg1, _arg2:AcrobotFrame, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10){
var _local11:*;
manager = _arg1;
botStage = _arg2;
_numLegs = _arg3;
_repulseDist = _arg4;
_r = ((_repulseDist - 5) / 4);
_legLength = (_arg4 - 5);
baseAngle = _arg8;
_local11 = 0;
while (_local11 < _numLegs) {
_legs[_local11] = new BotLeg();
addChild(_legs[_local11]);
_legs[_local11].init(this, _legLength, (((Math.PI * 2) / _numLegs) * _local11));
_legs[_local11].id = _local11;
_local11++;
};
setColor(_arg5);
setPos(_arg6, _arg7);
_dir = _arg9;
_v = _arg10;
body = new Circle();
addChild(body);
body.width = (body.height = (_r * 2));
updateScale();
_local11 = 0;
while (_local11 < 4) {
_mirrorBots[_local11] = new MirrorBot(botStage, _local11, this);
_local11++;
};
step();
draw();
_entering = true;
_presenceCount = 0;
step();
}
function sumForces(){
var _local1:*;
var _local2:*;
_local1 = getVx();
_local2 = getVy();
_local1 = (_local1 + _addForceX);
_local2 = (_local2 + _addForceY);
_v = Math.sqrt(((_local1 * _local1) + (_local2 * _local2)));
_dir = Math.atan2(_local2, _local1);
if (_v > (_vMax / botStage.speed)){
_v = (_vMax / botStage.speed);
};
_addForceX = 0;
_addForceY = 0;
}
function exit(){
_presenceCount = 5;
doExit();
}
function setId(_arg1){
id = _arg1;
}
function isTouchingAnything(){
var _local1:*;
var _local2:*;
_local1 = _interactions.length;
_local2 = 0;
while (_local2 < _local1) {
if (_interactions[_local2].obj.isTouching){
return (true);
};
_local2++;
};
return (false);
}
function removeMe(){
manager.removeBot(this);
}
function draw(){
var _local1:*;
if (!visible){
visible = true;
};
x = _px;
y = _py;
_local1 = 0;
while (_local1 < _numLegs) {
_legs[_local1].draw();
_local1++;
};
}
function getDir(){
return (_dir);
}
function findOpenLeg(_arg1){
var _local2:*;
var _local3:*;
_local2 = 0;
while (_local2 < _numLegs) {
if (!_legs[_local2].isTracking()){
_local3 = angleDiff(_arg1, _legs[_local2].restAngle);
if (Math.abs(_local3) < (Math.PI / 1.5)){
return (_legs[_local2]);
};
};
_local2++;
};
return (false);
}
function angleDiff(_arg1, _arg2){
var _local3:*;
_local3 = Math.abs((_arg2 - _arg1));
if (_local3 > Math.PI){
_local3 = ((Math.PI * 2) - _local3);
};
return (_local3);
}
function beginDrag(){
_dragging = true;
_mx = mouseX;
_my = mouseY;
releaseDrag = function (){
var _local1:*;
_dragging = false;
_local1 = _dragVector.getAngle();
applyForce(_dragVector.getDistance(), _local1);
};
}
function setPushAngle(_arg1, _arg2){
if (_arg2 != undefined){
getLegByInteractionId(_arg2).setPushAngle(_arg1);
};
}
function findBestLeg(_arg1){
var _local2:*;
var _local3:*;
_local3 = 0;
while (_local3 < _numLegs) {
if (!_legs[_local3].isTracking()){
if ((((_local2 == undefined)) || ((Math.abs(angleDiff(_local2.restAngle, _arg1)) > Math.abs(angleDiff(_legs[_local3].restAngle, _arg1)))))){
_local2 = _legs[_local3];
};
};
_local3++;
};
return (_local2);
}
public function pulse(){
var _local1:*;
pulsing = true;
_pulseCounter++;
_local1 = ((-(Math.cos((((_pulseCounter / _maxPulseCounter) * 2) * Math.PI))) + 1) / 2);
_strength = (1 + (0.5 * _local1));
if (_pulseCounter == _maxPulseCounter){
pulsing = false;
_pulseCounter = 0;
_strength = 1;
} else {
new DelayedEvent(this, 1, "pulse", null);
};
}
function getLegByInteractionId(_arg1){
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = _interactions.length;
_local3 = (_local2 - 1);
while (_local3 >= 0) {
_local4 = _interactions[_local3].obj;
if (_local4.id == _arg1){
return (_interactions[_local3].leg);
};
_local3--;
};
}
function getLegGravCenter(){
var _local1:*;
var _local2:*;
_local1 = {x:0, y:0};
_local2 = 0;
while (_local2 < _numLegs) {
_local1.x = (_local1.x + _legs[_local2]._tip.x);
_local1.y = (_local1.y + _legs[_local2]._tip.y);
_local2++;
};
_local1.x = (_local1.x / _numLegs);
_local1.y = (_local1.y / _numLegs);
return (_local1);
}
function get mirrorBots(){
return (_mirrorBots);
}
function get pushForce(){
return ((_pushForce * _strength));
}
}
}//package acrobots
Section 4
//BotLeg (acrobots.BotLeg)
package acrobots {
import flash.display.*;
public dynamic class BotLeg extends SuperSprite {
var _tracking;// = false
var _segLength;
var _glideTimer;
var _initAngleDiff;
var _pushAngle;
var _resting;
var foot;
var _retractDist;// = -30
var _footR;// = 15
var _inMotion;
var parentBot:Bot;
var _glideMaxTime;
var tipDist;
var _rx;// = 0
var _ry;// = 0
var _initFootAngleDiff;
var tipAngle;
var id;
var _currAnchorDistance;
var _currAnchorAngle;
var _restToExtendFrac;// = 0.823
var _glidePt;
var _vy;// = 0
var _vx;// = 0
var _restLength;
var _initGlideAngle;
var _footAngle;
var _legShape;
var _currAnchorPt;
var _atRest;
var _initFootAngle;
var _tip;
var _restAngle;
public function BotLeg(){
_tracking = false;
_retractDist = -30;
_footR = 15;
_restToExtendFrac = 0.823;
_rx = 0;
_ry = 0;
_vx = 0;
_vy = 0;
super();
}
function isTracking(){
return (_tracking);
}
function getAngleOffset(){
var _local1:*;
if (_tracking){
_local1 = tipAngle;
return (Tools.getAngleDiff(_local1, restAngle));
};
return (0);
}
function gotoRestPosition(){
initTransition(getRestPoint());
_retractDist = 0;
_resting = true;
_glideMaxTime = 24;
}
function maintainDirection(_arg1, _arg2){
var _local3:*;
if (Math.abs((_arg1 - _arg2)) > Math.PI){
_local3 = (_arg1 - _arg2);
if (_local3 < 0){
_arg2 = (_arg2 - (Math.PI * 2));
} else {
if (_local3 > 0){
_arg2 = (_arg2 + (Math.PI * 2));
};
};
};
return (_arg2);
}
function getTipAngle(){
return (tipAngle);
}
function initTransition(_arg1){
var _local2:*;
var _local3:*;
var _local4:*;
setAnchor(_tip.x, _tip.y);
_initGlideAngle = _currAnchorAngle;
_initFootAngle = _footAngle;
_glidePt = _arg1;
_glideTimer = 0;
_local2 = (_glidePt.x - parentBot.x);
_local3 = (_glidePt.y - parentBot.y);
_local4 = (atan2(_local3, _local2) - parentBot.baseAngle);
_initAngleDiff = Tools.getAngleDiff(_local4, _initGlideAngle);
}
function initPushAngle(_arg1){
_pushAngle = _arg1;
_initFootAngleDiff = Tools.getAngleDiff((_pushAngle - parentBot.baseAngle), _initFootAngle);
}
function step(){
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:*;
var _local15:*;
_local1 = _tip.x;
_local2 = _tip.y;
_rx = (_rx * 0.9);
_ry = (_ry * 0.9);
if (_resting){
_glidePt = getRestPoint();
setPushAngle(((restAngle + PI) + (PI / 4)));
};
if (_glideTimer < _glideMaxTime){
_inMotion = true;
_glideTimer = (_glideTimer + parentBot.botStage.speed);
if (_glideTimer > _glideMaxTime){
_glideTimer = _glideMaxTime;
};
_local5 = (_glideTimer / _glideMaxTime);
_local6 = Curves.scurve(_local5);
_local7 = sin((_local5 * PI));
_local8 = (_glidePt.x - parentBot.x);
_local9 = (_glidePt.y - parentBot.y);
_local10 = (atan2(_local9, _local8) - parentBot.baseAngle);
_local11 = sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local12 = maintainDirection(_initAngleDiff, Tools.getAngleDiff(_local10, _initGlideAngle));
_local13 = (((_local11 * _local6) + (_currAnchorDistance * (1 - _local6))) + (_local7 * _retractDist));
_local14 = ((_initGlideAngle + (_local12 * _local6)) + parentBot.baseAngle);
_local3 = (_local13 * cos(_local14));
_local4 = (_local13 * sin(_local14));
_local15 = maintainDirection(_initFootAngleDiff, Tools.getAngleDiff((_pushAngle - parentBot.baseAngle), _initFootAngle));
_footAngle = (_initFootAngle + (_local15 * _local6));
setTip(_local3, _local4);
if (_glideTimer == _glideMaxTime){
if (_resting){
_atRest = true;
};
setAnchor(_local3, _local4);
};
} else {
_inMotion = false;
_local3 = (_glidePt.x - parentBot.x);
_local4 = (_glidePt.y - parentBot.y);
_footAngle = (_pushAngle - parentBot.baseAngle);
setTip(_local3, _local4);
setAnchor(_local3, _local4);
};
_vx = (_tip.x - _local1);
_vy = (_tip.y - _local2);
}
function setTip(_arg1, _arg2){
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:*;
var _local15:*;
var _local16:*;
var _local17:*;
_local3 = parentBot.botStage;
_local4 = parentBot.y;
_local5 = parentBot.x;
_local6 = (_local5 + _arg1);
_local7 = (_local4 + _arg2);
_local8 = _local3.xMax;
_local9 = _local3.yMax;
_local10 = _local3.xMin;
_local11 = _local3.yMin;
_local12 = (_footAngle + parentBot.baseAngle);
_local13 = sin(_local12);
_local14 = cos(_local12);
if ((_local7 + _footR) > _local9){
if (_local13 > 0){
_local15 = _footR;
} else {
_local15 = (Math.abs(_local14) * _footR);
};
if ((_local7 + _local15) > _local9){
_arg2 = ((_local9 - _local4) - _local15);
};
} else {
if ((_local7 - _footR) < _local11){
if (_local13 < 0){
_local15 = _footR;
} else {
_local15 = (Math.abs(_local14) * _footR);
};
if ((_local7 - _local15) < _local11){
_arg2 = ((_local11 - _local4) + _local15);
};
};
};
if ((_local6 + _footR) > _local8){
if (_local14 > 0){
_local15 = _footR;
} else {
_local15 = (Math.abs(_local13) * _footR);
};
if ((_local6 + _local15) > _local8){
_arg1 = ((_local8 - _local5) - _local15);
};
} else {
if ((_local6 - _footR) < _local10){
if (_local14 < 0){
_local15 = _footR;
} else {
_local15 = (Math.abs(_local13) * _footR);
};
if ((_local6 - _local15) < _local10){
_arg1 = ((_local10 - _local5) + _local15);
};
};
};
_local16 = Math.sqrt(((_arg1 * _arg1) + (_arg2 * _arg2)));
if (_local16 > parentBot.repulseDist){
_local17 = (parentBot.repulseDist / _local16);
_arg1 = (_arg1 * _local17);
_arg2 = (_arg2 * _local17);
};
_tip = {x:_arg1, y:_arg2};
cacheTipData();
}
function setResidualMotion(){
_rx = _vx;
_ry = _vy;
}
function cacheTipData(){
tipAngle = atan2(_tip.y, _tip.x);
tipDist = sqrt(((_tip.y * _tip.y) + (_tip.x * _tip.x)));
if (tipDist > (_segLength * 2)){
tipDist = (_segLength * 2);
};
}
function trackPoint(_arg1, _arg2){
var _local3:*;
var _local4:*;
initTransition(_arg1);
_tracking = true;
_local3 = new Between({x:0, y:0}, _tip).getDistance();
_local4 = new Between(parentBot, _glidePt).getDistance();
if (((!(_atRest)) && ((_local4 < (_local3 + 20))))){
_retractDist = -20;
} else {
_retractDist = 0;
};
_resting = false;
_atRest = false;
_glideMaxTime = _arg2;
}
public function get footAngle(){
return (((_footAngle + PI) + parentBot.baseAngle));
}
function init(_arg1, _arg2, _arg3){
var _local4:*;
parentBot = _arg1;
setAnchor(0, 0);
_segLength = (_arg2 / 2);
_restLength = (_arg2 * _restToExtendFrac);
_restAngle = _arg3;
_local4 = getRestPoint();
setTip((_local4.x - parentBot.x), (_local4.y - parentBot.y));
_footAngle = ((restAngle - ((PI * 3) / 4)) - parentBot.baseAngle);
_legShape = new Shape();
addChild(_legShape);
foot = new BotFoot();
addChild(foot);
foot.width = (_footR * 2);
foot.scaleY = foot.scaleX;
endTrack();
}
public function get bendAngle(){
var _local1:*;
_local1 = (getTipAngle() - restAngle);
return (_local1);
}
function endTrack(){
_tracking = false;
gotoRestPosition();
}
function bend(_arg1, _arg2, _arg3, _arg4, _arg5){
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
if (_arg5 == undefined){
_arg5 = -1;
};
_local6 = new Between(_arg3, _arg1);
_local7 = _local6.getAngle();
_local8 = _local6.getDistance();
_local9 = (sqrt(((_arg4 * _arg4) - (((_local8 / 2) * _local8) / 2))) * _arg5);
if (isNaN(_local9)){
_local9 = 0;
};
_local10 = cos(_local7);
_local11 = sin(_local7);
_arg2.x = ((_arg3.x + (_local9 * _local11)) + ((_local8 / 2) * _local10));
_arg2.y = ((_arg3.y - (_local9 * _local10)) + ((_local8 / 2) * _local11));
}
function draw(){
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
_local1 = {x:0, y:0};
_local2 = {};
_local3 = footAngle;
_local4 = _tip.x;
_local5 = _tip.y;
_local6 = {x:(_local4 - (10 * cos(_local3))), y:(_local5 - (10 * sin(_local3)))};
bend(_local6, _local2, _local1, _segLength, 1);
_local7 = _local1.x;
_local8 = _local1.y;
_local9 = _local2.x;
_local10 = _local2.y;
_local11 = _local6.x;
_local12 = _local6.y;
_legShape.graphics.clear();
_legShape.graphics.lineStyle(10, 0);
_legShape.graphics.moveTo(_local7, _local8);
_legShape.graphics.lineTo(((_local9 + (_local7 * 2)) / 3), ((_local10 + (_local8 * 2)) / 3));
_legShape.graphics.curveTo(_local9, _local10, ((_local9 + (_local11 * 2)) / 3), ((_local10 + (_local12 * 2)) / 3));
_legShape.graphics.lineTo(_local11, _local12);
foot.x = _local4;
foot.y = _local5;
foot.rotation = (((_local3 / PI) * 180) - 90);
}
function get restAngle(){
return ((_restAngle + parentBot.baseAngle));
}
function getRestPoint(){
var _local1:*;
_local1 = restAngle;
return ({x:((_restLength * cos(_local1)) + parentBot.x), y:((_restLength * sin(_local1)) + parentBot.y)});
}
function setPushAngle(_arg1){
_pushAngle = _arg1;
}
function getAnchor(){
return (_currAnchorPt);
}
function setAnchor(_arg1, _arg2){
var _local3:*;
var _local4:*;
_currAnchorPt = {x:_arg1, y:_arg2};
_local3 = _currAnchorPt.x;
_local4 = _currAnchorPt.y;
_currAnchorAngle = (atan2(_local4, _local3) - parentBot.baseAngle);
_currAnchorDistance = sqrt(((_local3 * _local3) + (_local4 * _local4)));
}
public function get twistAngle(){
var _local1:*;
_local1 = (footAngle - restAngle);
return (_local1);
}
}
}//package acrobots
Section 5
//BotMaster (acrobots.BotMaster)
package acrobots {
public class BotMaster {
var _interactions;
var _stage;
var _isPulsing;
var _transitionMinTimeBase;// = 14
var _transitionMinTime;
var _attractFactor;// = 0
var _transitionMaxTimeBase;// = 30
var _botIdCounter;// = 4
var _transitionMaxTime;
var _pulseFreq;// = 99999
var _noNewInteractionCounter;// = 0
var _pulseIndex;
var _bots;
var _idCount;// = 0
public function BotMaster(_arg1){
_idCount = 0;
_botIdCounter = 4;
_transitionMaxTimeBase = 30;
_transitionMinTimeBase = 14;
_noNewInteractionCounter = 0;
_pulseFreq = 99999;
_attractFactor = 0;
super();
_stage = _arg1;
_bots = [];
_interactions = [];
}
function getMirrorObj(_arg1, _arg2, _arg3){
}
function getNewInteractionId(){
return (_idCount++);
}
function getBots(){
return (_bots);
}
function getInteractionBetween(_arg1, _arg2){
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
_local3 = _interactions.length;
_local4 = false;
_local5 = 0;
while (_local5 < _local3) {
_local6 = _interactions[_local5];
_local7 = _local6.members;
if ((((_local7[0].id == _arg1)) && ((_local7[1].id == _arg2)))){
return (_local6);
};
_local5++;
};
return (false);
}
function getInteractionCount(_arg1){
var _local2:*;
var _local3:*;
var _local4:*;
_local2 = _interactions.length;
if (_arg1){
_local3 = 0;
_local4 = 0;
while (_local4 < _local2) {
if (_interactions[_local4].type != "wall"){
_local3++;
};
_local4++;
};
return (_local3);
};
return (_local2);
}
function endPulse(){
_isPulsing = false;
}
function pulse(){
pulseCascade();
}
function applyGravity(_arg1, _arg2, _arg3, _arg4, _arg5){
var _local6:*;
var _local7:*;
_local6 = Math.sqrt(((_arg3 * _arg3) + (_arg5 * _arg5)));
_local7 = (_attractFactor / (_local6 * _local6));
_arg1.applyForce(_local7, _arg4);
_arg2.applyForce(_local7, (_arg4 + Math.PI));
}
function getPushAngle(){
}
function updateWallContacts(){
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
_local1 = _bots.length;
_local2 = 0;
while (_local2 < _local1) {
_bots[_local2].connectedToFloor = false;
_local2++;
};
_local3 = true;
_local4 = _interactions.length;
while (_local3 == true) {
_local3 = false;
_local5 = 0;
while (_local5 < _local4) {
_local6 = _interactions[_local5].members;
if (((_interactions[_local5].isTouching) && (((_local6[0].connectedToFloor + _local6[1].connectedToFloor) == 1)))){
if (_local6[0].botType != "mirror"){
_local6[0].connectedToFloor = true;
_local3 = true;
};
_local6[1].connectedToFloor = true;
};
_local5++;
};
};
}
function removeBot(_arg1){
_arg1.parent.removeChild(_arg1);
_arg1 = null;
}
public function setTransitionTimeMax(_arg1){
_transitionMaxTimeBase = _arg1;
}
function getCollisionTimeToWall(_arg1, _arg2){
var _local3:*;
var _local4:*;
var _local5:*;
_local3 = (_arg1.repulseDist / 3);
_local4 = _arg1.getVx();
_local5 = _arg1.getVy();
if (_arg2 == 0){
return ((((_stage.xMax - _local3) - _arg1.x) / _local4));
};
if (_arg2 == 2){
return ((((_stage.xMin + _local3) - _arg1.x) / _local4));
};
if (_arg2 == 1){
return ((((_stage.yMax - _local3) - _arg1.y) / _local5));
};
if (_arg2 == 3){
return ((((_stage.yMin + _local3) - _arg1.y) / _local5));
};
}
function getCollisionTimeToObject(_arg1, _arg2, _arg3){
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:*;
var _local15:*;
var _local16:*;
_local4 = ((_arg2.repulseDist / 2) + (_arg3.repulseDist / 2));
_local5 = _arg2.getVx();
_local6 = _arg2.getVy();
_local7 = _arg3.getVx();
_local8 = _arg3.getVy();
_local9 = (_local7 - _local5);
_local10 = (_local8 - _local6);
_local11 = ((_arg3.x - _local9) - _arg2.x);
_local12 = ((_arg3.y - _local10) - _arg2.y);
_local13 = Math.sqrt(((_local11 * _local11) + (_local12 * _local12)));
_local14 = (_local13 - _arg1);
_local15 = (_arg1 - _local4);
if (_local15 < 0.001){
_local15 = 0.001;
};
_local16 = (_local15 / _local14);
return (_local16);
}
function setPushAngles(_arg1, _arg2, _arg3, _arg4){
}
function updateMeetPoint(_arg1, _arg2, _arg3, _arg4){
var _local5:*;
var _local6:*;
_local5 = (_arg3.repulseDist / _arg2);
_local6 = (_arg4.repulseDist / _arg2);
_arg1.x = ((_arg3.x * _local6) + (_arg4.x * _local5));
_arg1.y = ((_arg3.y * _local6) + (_arg4.y * _local5));
}
function setRestlessness(_arg1){
_pulseFreq = (60 / _arg1);
_noNewInteractionCounter = 0;
}
public function exitBot(_arg1){
var _local2:*;
_local2 = _bots.splice(_arg1, 1)[0];
_local2.exit();
}
function step(_arg1){
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
_transitionMaxTime = (_transitionMaxTimeBase * _stage.speed);
_transitionMinTime = (_transitionMinTimeBase * _stage.speed);
_local2 = _interactions.length;
_local3 = 0;
while (_local3 < _local2) {
_interactions[_local3].alive = false;
_local3++;
};
_local4 = _bots.length;
_local3 = 0;
while (_local3 < _local4) {
_local5 = _bots[_local3];
_local6 = 0;
while (_local6 < _local3) {
_local7 = _bots[_local6];
checkInteraction(_local5, _local7, "bot");
_local6++;
};
_local6 = 0;
while (_local6 < 4) {
if (_local5.mirrorBots[_local6].alive){
checkInteraction(_local5.mirrorBots[_local6], _local5, "wall");
};
_local6++;
};
_local3++;
};
_local3 = 0;
while (_local3 < _local4) {
_bots[_local3].step();
_local3++;
};
if (_arg1 != true){
_local3 = 0;
while (_local3 < _local4) {
_bots[_local3].draw();
_local3++;
};
};
_local3 = (_local2 - 1);
while (_local3 >= 0) {
if (!_interactions[_local3].alive){
_interactions.splice(_local3, 1);
};
_local3--;
};
if (_interactions.length == _local2){
_noNewInteractionCounter++;
if (_noNewInteractionCounter >= _pulseFreq){
_pulseIndex = 0;
_noNewInteractionCounter = 0;
pulse();
};
} else {
_noNewInteractionCounter = 0;
};
updateWallContacts();
}
function allBots(_arg1){
var _local2:*;
var _local3:*;
_local2 = _bots.length;
_local3 = 0;
while (_local3 < _local2) {
var _local4 = _bots[_local3];
_local4[_arg1]();
_local3++;
};
}
function pulseCascade(){
_bots[_pulseIndex].pulse();
_pulseIndex++;
_isPulsing = true;
if (_pulseIndex < _bots.length){
new DelayedEvent(this, (Tools.getRandom(6) + 1), "pulseCascade", null);
} else {
new DelayedEvent(this, 10, "endPulse", null);
_pulseIndex = 0;
};
}
function updateBounds(){
var _local1:*;
var _local2:*;
_local1 = _bots.length;
_local2 = 0;
while (_local2 < _local1) {
_bots[_local2].updateBounds();
_local2++;
};
}
function addBot(_arg1){
_bots.push(_arg1);
_arg1.setId(_botIdCounter++);
}
function setAttraction(_arg1){
_attractFactor = _arg1;
}
function getDistance(_arg1, _arg2, _arg3, _arg4){
return (Math.sqrt((((_arg3 - _arg1) * (_arg3 - _arg1)) + ((_arg4 - _arg2) * (_arg4 - _arg2)))));
}
public function setTransitionTimeMin(_arg1){
_transitionMinTimeBase = _arg1;
}
function checkInteraction(_arg1, _arg2, _arg3){
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
var _local13:*;
var _local14:*;
var _local15:*;
var _local16:*;
var _local17:*;
var _local18:*;
var _local19:*;
var _local20:*;
_local4 = (_arg1.repulseDist + _arg2.repulseDist);
_local5 = new Between(_arg1, _arg2);
_local6 = _local5.getDistance();
if (_local6 < _local4){
if ((((_local6 < (_arg1.r + _arg2.r))) && (!((_arg3 == "wall"))))){
_local11 = ((_arg1.r + _arg2.r) - _local6);
_local12 = _local5.getAngle();
_arg1.applyForce(_local11, (_local12 + Math.PI));
_arg2.applyForce(_local11, _local12);
};
_local7 = _local5.getAngle();
_local8 = _interactions.length;
_local9 = ((_arg3)=="bot") ? _local7 : _arg1.getForceDir();
_local10 = getInteractionBetween(_arg1.id, _arg2.id);
if (_local10 == false){
_local13 = true;
if (((((((!(_local13)) || ((_arg1.findOpenLeg(_local7) == false)))) || ((_arg2.findOpenLeg((_local7 + Math.PI)) == false)))) || (((((_arg1.pulsing) || (_arg2.pulsing))) && (!((_arg3 == "wall"))))))){
if (_arg3 == "wall"){
return;
};
if ((((_local6 < (_local4 / 2))) && (((_arg1._v + _arg2._v) < 1)))){
if (((_arg1.isTouchingWall()) && (_arg2.isTouchingWall()))){
if (!_arg1.pulsing){
_arg1.pulse();
};
if (!_arg2.pulsing){
_arg2.pulse();
};
};
};
return;
};
_local10 = {id:getNewInteractionId(), type:_arg3, age:0, members:[_arg1, _arg2], alive:false, meetPoint:{}, isTouching:false, touchType:_arg3};
if (_arg3 == "wall"){
_local14 = Math.round(getCollisionTimeToWall(_arg2, _arg1.dir));
} else {
_local14 = getCollisionTimeToObject(_local6, _arg1, _arg2);
};
if (_local14 < _transitionMinTime){
_local14 = _transitionMinTime;
};
if (_local14 > _transitionMaxTime){
_local14 = _transitionMaxTime;
};
_local10.transitionLength = _local14;
updateMeetPoint(_local10.meetPoint, _local4, _arg1, _arg2);
_arg1.initInteraction(_local10);
_arg2.initInteraction(_local10);
_interactions.push(_local10);
};
_local10.age = (_local10.age + _stage.speed);
_local10.alive = true;
updateMeetPoint(_local10.meetPoint, _local4, _arg1, _arg2);
_arg2.setPushAngle(_local9, _local10.id);
_arg1.setPushAngle((_local9 + Math.PI), _local10.id);
if (_local10.age > _local10.transitionLength){
_local10.isTouching = true;
_local15 = ((_local10.age - _local10.transitionLength) / 5);
if (_local15 > 1){
_local15 = 1;
};
_local16 = ((_arg3 == "wall")) ? 0 : (((_arg1.pulsing) || (_arg2.pulsing))) ? 0 : _stage.stickiness;
_local17 = (1 - (_local6 / (_local4 - _local16)));
_local18 = (Math.abs(_local17) / _local17);
_local19 = (_arg1.pushForce + _arg2.pushForce);
_local20 = (((_local18 * (_local17 * _local17)) * _local19) * _local15);
_arg2.applyForce((_local20 / 2), _local9);
_arg1.applyForce((_local20 / 2), (_local9 + Math.PI));
};
};
}
function getBotCount(){
return (_bots.length);
}
function approachSpeed(_arg1, _arg2){
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
_local3 = _arg1.getVx();
_local4 = _arg2.getVx();
_local5 = _arg1.getVy();
_local6 = _arg2.getVy();
return (-((getDistance((_arg1.x + _local3), (_arg1.y + _local5), (_arg2.x + _local4), (_arg2.y + _local6)) - getDistance(_arg1.x, _arg1.y, _arg2.x, _arg2.y))));
}
}
}//package acrobots
Section 6
//ContentMask (acrobots.ContentMask)
package acrobots {
import flash.display.*;
public dynamic class ContentMask extends Sprite {
var c1;
var c4;
var c2;
var c3;
var box2;
var box1;
public function ContentMask(){
box1 = new Square();
box2 = new Square();
addChild(box1);
addChild(box2);
box1.x = 0;
box1.y = 20;
box2.x = 20;
box2.y = 0;
c1 = new antiCorner();
c2 = new antiCorner();
c3 = new antiCorner();
c4 = new antiCorner();
addChild(c1);
addChild(c2);
addChild(c3);
addChild(c4);
c1.x = 0;
c1.y = 0;
c2.rotation = 90;
c3.rotation = 180;
c4.rotation = 270;
c2.y = 0;
c4.x = 0;
}
public function set frameWidth(_arg1){
box1.width = _arg1;
box2.width = (_arg1 - 40);
c2.x = _arg1;
c3.x = _arg1;
}
public function set frameHeight(_arg1){
c3.y = _arg1;
c4.y = _arg1;
box2.height = _arg1;
box1.height = (_arg1 - 40);
}
}
}//package acrobots
Section 7
//contentMask (acrobots.contentMask)
package acrobots {
import flash.display.*;
public dynamic class contentMask extends Sprite {
}
}//package acrobots
Section 8
//Curves (acrobots.Curves)
package acrobots {
public class Curves {
static function easeOut(_arg1){
return (Math.sin(((_arg1 * Math.PI) / 2)));
}
static function easeIn(_arg1){
return ((1 - Math.sin((((1 - _arg1) * Math.PI) / 2))));
}
static function scurve(_arg1){
return (((-(Math.cos((_arg1 * Math.PI))) + 1) / 2));
}
}
}//package acrobots
Section 9
//DelayedEvent (acrobots.DelayedEvent)
package acrobots {
import flash.display.*;
import flash.events.*;
public class DelayedEvent extends Sprite {
static var evtBin;
static var evtIndx = 0;
public static var _stage;
public function DelayedEvent(_arg1, _arg2, _arg3, _arg4){
var homeRef:*;
var resultFunc:*;
var myEvent:*;
var maxTime:*;
var currTime:*;
var onFrame:*;
var hr = _arg1;
var endParam = _arg2;
var rf = _arg3;
var paramArr = _arg4;
super();
homeRef = hr;
resultFunc = rf;
if (evtBin == undefined){
evtBin = new Sprite();
};
_stage.addChild(evtBin);
myEvent = new SuperSprite();
evtBin.addChild(myEvent);
maxTime = endParam;
currTime = 0;
onFrame = function (){
var _local1:*;
currTime++;
if (currTime >= maxTime){
_local1 = ((paramArr == null)) ? 0 : paramArr.length;
if (typeof(rf) == "string"){
if (_local1 == 0){
var _local2 = homeRef;
_local2[resultFunc]();
} else {
if (_local1 == 1){
_local2 = homeRef;
_local2[resultFunc](paramArr[0]);
} else {
if (_local1 == 2){
_local2 = homeRef;
_local2[resultFunc](paramArr[0], paramArr[1]);
} else {
if (_local1 == 3){
_local2 = homeRef;
_local2[resultFunc](paramArr[0], paramArr[1], paramArr[2]);
} else {
if (_local1 == 4){
_local2 = homeRef;
_local2[resultFunc](paramArr[0], paramArr[1], paramArr[2], paramArr[3]);
};
};
};
};
};
} else {
if (_local1 == 0){
resultFunc();
} else {
if (_local1 == 1){
resultFunc(paramArr[0]);
} else {
if (_local1 == 2){
resultFunc(paramArr[0], paramArr[1]);
} else {
if (_local1 == 3){
resultFunc(paramArr[0], paramArr[1], paramArr[2]);
} else {
if (_local1 == 4){
resultFunc(paramArr[0], paramArr[1], paramArr[2], paramArr[3]);
};
};
};
};
};
};
myEvent.removeEventListener(Event.ENTER_FRAME, onFrame);
myEvent = null;
};
};
myEvent.addEventListener(Event.ENTER_FRAME, onFrame);
}
}
}//package acrobots
Section 10
//EasyButton (acrobots.EasyButton)
package acrobots {
import flash.display.*;
import flash.events.*;
public class EasyButton extends MovieClip {
public var onPressEvent;
var _rolledOver;
public function EasyButton(){
stop();
buttonMode = true;
useHandCursor = true;
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler);
addEventListener(MouseEvent.MOUSE_UP, onMouseUpHandler);
addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
}
function onMouseOver(_arg1){
_rolledOver = true;
}
function onMouseDownHandler(_arg1){
onPressEvent();
}
function onMouseOut(_arg1){
_rolledOver = false;
}
function onMouseUpHandler(_arg1){
if (!_rolledOver){
};
}
}
}//package acrobots
Section 11
//MirrorBot (acrobots.MirrorBot)
package acrobots {
import acrobots.*;
class MirrorBot {
var _x;
var active;
public var dir;
var _srcObj;
public var pulsing;// = false
var id;
var _strength;// = 1
public var botType;// = "mirror"
var _reflectPt;
var _aheadScale;
var _locked;
public var manager;
public var alive;
var _interaction;
public var isTouchingWall;// = true
var _y;
public var _v;
var _stage;
function MirrorBot(_arg1, _arg2, _arg3){
botType = "mirror";
_strength = 1;
pulsing = false;
isTouchingWall = true;
super();
_stage = _arg1;
id = _arg2;
dir = _arg2;
_reflectPt = {};
_srcObj = _arg3;
manager = _srcObj.manager;
}
public function get connectedToFloor(){
return ((_stage.floorSide == dir));
}
function get repulseDist(){
return (_srcObj.repulseDist);
}
function setPushAngle(_arg1, _arg2){
}
function getForceDir(){
return ((((dir * Math.PI) / 2) + Math.PI));
}
public function pulse(){
}
function applyForce(_arg1, _arg2){
}
function applyComplexForce(_arg1, _arg2, _arg3){
}
function getVx(){
if ((((dir == 0)) || ((dir == 2)))){
return ((_srcObj.getVx() * -1));
};
return (_srcObj.getVx());
}
function getVy(){
if ((((dir == 1)) || ((dir == 3)))){
return ((_srcObj.getVy() * -1));
};
return (_srcObj.getVy());
}
function step(_arg1, _arg2, _arg3, _arg4){
_v = _srcObj._v;
if (((!((_interaction == undefined))) && (_interaction.alive))){
} else {
setReflectPoint(_arg1, _arg2, _arg3, _arg4);
};
}
function setReflectPoint(_arg1, _arg2, _arg3, _arg4){
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
_local5 = (_srcObj.repulseDist / 3);
_local6 = manager._transitionMinTime;
if (dir == 0){
_local7 = ((_stage.xMax - _local5) - _arg1);
if (_local7 < 0){
_local7 = 0;
};
_local8 = (_local7 / _arg3);
if (_local8 < 5){
_local8 = _local6;
};
_reflectPt = {x:_stage.xMax, y:(_arg2 + (_arg4 * _local8))};
} else {
if (dir == 1){
_local7 = ((_stage.yMax - _local5) - _arg2);
if (_local7 < 0){
_local7 = 0;
};
_local8 = (_local7 / _arg4);
if (_local8 < 5){
_local8 = _local6;
};
_reflectPt = {y:_stage.yMax, x:(_arg1 + (_arg3 * _local8))};
} else {
if (dir == 2){
_local7 = ((_stage.xMin + _local5) - _arg1);
if (_local7 < 0){
_local7 = 0;
};
_local8 = (_local7 / _arg3);
if (_local8 < 5){
_local8 = _local6;
};
_reflectPt = {x:_stage.xMin, y:(_arg2 + (_arg4 * _local8))};
} else {
if (dir == 3){
_local7 = ((_stage.yMin + _local5) - _arg2);
if (_local7 < 0){
_local7 = 0;
};
_local8 = (_local7 / _arg4);
if (_local8 < 5){
_local8 = _local6;
};
_reflectPt = {y:_stage.yMin, x:(_arg1 + (_arg3 * _local8))};
};
};
};
};
if (_local8 < 0){
_reflectPt = {x:9999, y:9999};
};
}
function updateBounds(){
if (dir == 0){
_reflectPt.x = _stage.xMax;
} else {
if (dir == 1){
_reflectPt.y = _stage.yMax;
} else {
if (dir == 2){
_reflectPt.x = _stage.xMin;
} else {
if (dir == 3){
_reflectPt.y = _stage.yMin;
};
};
};
};
}
function initInteraction(_arg1){
_locked = true;
_interaction = _arg1;
new DelayedEvent(this, 1, "step", [0, 0, 0, 0]);
}
function findOpenLeg(_arg1){
return (true);
}
function get pushForce(){
return (_srcObj.pushForce);
}
function get r(){
return (_srcObj.r);
}
function get x(){
return ((_reflectPt.x - (_srcObj.x - _reflectPt.x)));
}
function get y(){
return ((_reflectPt.y - (_srcObj.y - _reflectPt.y)));
}
}
}//package acrobots
Section 12
//RoutineManager (acrobots.RoutineManager)
package acrobots {
public class RoutineManager {
var _routine;
var _settingsManager;
var _frameCounter;
var _stepCounter;
var _frame;
public function RoutineManager(_arg1, _arg2, _arg3){
_routine = _arg1;
_frame = _arg2;
_settingsManager = _arg3;
}
public function begin(){
_stepCounter = 0;
_frameCounter = 0;
_settingsManager.setInitialState(_routine.initSetting);
_frame.init(_routine.initFormation, _routine.initSteps);
}
public function step(){
var _local1:*;
var _local2:*;
_frame.step();
_frameCounter++;
_local1 = _routine.steps[_stepCounter];
if (_frameCounter >= _local1.length){
_stepCounter = ((_local1.nextStep)!=undefined) ? _local1.nextStep : (_stepCounter + 1);
_frameCounter = 0;
_local2 = _routine.steps[_stepCounter];
if (_local2.action != undefined){
var _local3 = _local2.action[0];
_local3[_local2.action[1]]();
};
if (_local2.transition != undefined){
_settingsManager.gotoState(_local2.transition, _local2.length);
};
};
}
}
}//package acrobots
Section 13
//SettingsManager (acrobots.SettingsManager)
package acrobots {
public class SettingsManager {
var _currState;
var _transStack;
var _propHandler;
var _maxTransTime;
var _transCounter;
var _inTransition;// = false
var _nextState;
public function SettingsManager(_arg1){
_inTransition = false;
super();
_propHandler = _arg1;
_transStack = [];
}
function setCurrentState(_arg1){
var _local2:*;
var _local3:*;
_local2 = {};
_local2.name = _arg1.name;
_local2.props = {};
for (_local3 in _arg1.props) {
_local2.props[_local3] = _arg1.props[_local3];
};
_currState = _local2;
}
public function updateProp(_arg1, _arg2){
_currState.props[_arg1] = _arg2;
}
public function gotoState(_arg1, _arg2){
_maxTransTime = _arg2;
_nextState = _arg1;
_transCounter = 0;
_inTransition = true;
doTransition();
}
function doTransition(){
var _local1:*;
_transCounter++;
_local1 = Curves.scurve((_transCounter / _maxTransTime));
setProperties(_currState, _nextState, _local1);
if (_transCounter == _maxTransTime){
setCurrentState(_nextState);
_inTransition = false;
} else {
new DelayedEvent(this, 1, "doTransition", null);
};
}
public function setProperties(_arg1, _arg2, _arg3){
var _local4:*;
var _local5:*;
var _local6:*;
var _local7:*;
var _local8:*;
for (_local4 in _arg1.props) {
_local5 = _local4;
_local6 = _arg1.props[_local5];
_local7 = _arg2.props[_local5];
_local8 = ((_local6 * (1 - _arg3)) + (_local7 * _arg3));
_propHandler.setProp(_local5, _local8);
};
}
function setInitialState(_arg1){
setCurrentState(_arg1);
setProperties(_currState, _currState, 1);
}
}
}//package acrobots
Section 14
//Slider (acrobots.Slider)
package acrobots {
import flash.display.*;
import flash.text.*;
import flash.events.*;
public dynamic class Slider extends SuperSprite {
var bar:Sprite;
public var initFrac;// = 0.5
public var maxVal;// = 1
public var type;// = "horz"
var _val;
var labelClip:TextField;
public var minVal;// = 0
public var _valFrac;
var knob:Sprite;
public var changeHandler;
var _lblText;
public var ox;
public function Slider(){
minVal = 0;
maxVal = 1;
initFrac = 0.5;
type = "horz";
super();
knob = new sliderKnob();
knob.buttonMode = true;
knob.useHandCursor = true;
bar = new sliderBar();
addChild(bar);
addChild(knob);
}
public function showVal(_arg1){
var _local2:*;
_local2 = ((_arg1 - minVal) / (maxVal - minVal));
_valFrac = _local2;
if (type == "horz"){
knob.x = (_local2 * bar.width);
} else {
knob.y = (_local2 * (bar.height - 2));
};
}
public function init(_arg1, _arg2, _arg3, _arg4){
var w:*;
var k:*;
var o:*;
var enterFrameEvent:*;
var mouseDownEvent:*;
var mouseUpEvent:*;
var mouseMoveEvent:*;
var ch = _arg1;
var barW = _arg2;
var knobR = _arg3;
var tp = _arg4;
changeHandler = ch;
type = tp;
bar.height = barW;
if (type == "horz"){
bar.rotation = -90;
};
knob.width = (knob.height = (knobR * 2));
w = ((type)=="horz") ? bar.width : (bar.height - 2);
knob.y = 0;
bar.y = ((type)=="horz") ? 0 : 0;
knob.x = 0;
bar.x = 0;
k = knob;
o = this;
enterFrameEvent = function (_arg1){
var _local2:*;
_local2 = (((k.parent.type)=="horz") ? o.mouseX : o.mouseY - o.ox);
if (_local2 < 0){
_local2 = 0;
};
if (_local2 > w){
_local2 = w;
};
o.setValByFrac((((_local2 / w) + o._valFrac) / 2));
};
mouseDownEvent = function (_arg1){
o.ox = ((k.parent.type)=="horz") ? k.mouseX : k.mouseY;
k.addEventListener("enterFrame", enterFrameEvent);
o.addEventListener(MouseEvent.MOUSE_UP, mouseUpEvent);
stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveEvent);
};
mouseUpEvent = function (_arg1){
k.removeEventListener("enterFrame", enterFrameEvent);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveEvent);
};
mouseMoveEvent = function (_arg1){
if (_arg1.buttonDown == false){
mouseUpEvent();
};
};
knob.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownEvent);
}
public function setValByFrac(_arg1){
_val = (minVal + ((maxVal - minVal) * _arg1));
_valFrac = _arg1;
changeHandler.onChange(name, _val);
}
function get val(){
return (_val);
}
public function initValues(_arg1, _arg2, _arg3){
minVal = _arg1;
maxVal = _arg2;
initFrac = ((_arg3 - minVal) / (maxVal - minVal));
showVal(_arg3);
}
function setVal(_arg1){
setValByFrac(((_arg1 - minVal) / (maxVal - minVal)));
}
public function set labelText(_arg1){
var _local2:*;
labelClip = new TextField();
_local2 = new TextFormat();
_local2.font = "Arial";
_local2.size = 14;
_local2.bold = true;
labelClip.defaultTextFormat = _local2;
addChild(labelClip);
labelClip.text = _arg1;
labelClip.selectable = false;
labelClip.textColor = 0xFFFFFF;
labelClip.y = 14;
labelClip.height = 20;
}
}
}//package acrobots
Section 15
//SuperSprite (acrobots.SuperSprite)
package acrobots {
import flash.display.*;
public class SuperSprite extends Sprite {
var dpth;// = 0
var sqrt;
var cos;
var abs;
var atan2;
var PI;// = 3.14159265358979
var sin;
public function SuperSprite(){
PI = Math.PI;
cos = Math.cos;
sin = Math.sin;
atan2 = Math.atan2;
sqrt = Math.sqrt;
abs = Math.abs;
dpth = 0;
super();
}
public function attachClip(_arg1){
return (addChild(_arg1));
}
function set _radians(_arg1){
rotation = ((_arg1 / Math.PI) * 180);
}
function setAbsoluteRotation(_arg1){
var _local2:*;
var _local3:*;
_local2 = 0;
_local3 = this;
while (_local3._parent != undefined) {
_local2 = (_local2 + _local3._parent.rotation);
_local3 = _local3._parent;
};
rotation = (_arg1 - _local2);
}
function getAbsoluteRotation(){
var _local1:*;
var _local2:*;
_local1 = rotation;
_local2 = this;
while (_local2._parent != undefined) {
_local1 = (_local1 + _local2._parent.rotation);
_local2 = _local2._parent;
};
return (_local1);
}
function pyt(_arg1, _arg2){
return (sqrt(((_arg1 * _arg1) + (_arg2 * _arg2))));
}
function getBetween(_arg1, _arg2){
return (new Between({x:_arg1._x, y:_arg1._y}, {x:_arg2._x, y:_arg2._y}));
}
}
}//package acrobots
Section 16
//Tools (acrobots.Tools)
package acrobots {
public class Tools {
static function getRandom(_arg1){
return (Math.floor((Math.random() * _arg1)));
}
static function getAngleDiff(_arg1, _arg2){
while ((_arg1 - _arg2) > Math.PI) {
_arg1 = (_arg1 - (Math.PI * 2));
};
while ((_arg2 - _arg1) > Math.PI) {
_arg1 = (_arg1 + (Math.PI * 2));
};
return ((_arg1 - _arg2));
}
static function getIntersection(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
var _local7:*;
var _local8:*;
var _local9:*;
var _local10:*;
var _local11:*;
var _local12:*;
_local7 = Math.tan(_arg5);
_local8 = (_arg2 - (_local7 * _arg1));
_local9 = Math.tan(_arg6);
_local10 = (_arg4 - (_local9 * _arg3));
_local11 = (((_local8 - _local10) / _local9) / (1 - (_local7 / _local9)));
_local12 = ((_local7 * _local11) + _local8);
return ({x:_local11, y:_local12});
}
}
}//package acrobots
Section 17
//acrobotViewer_6 (acrobotsF9_fla.acrobotViewer_6)
package acrobotsF9_fla {
import acrobots.*;
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class acrobotViewer_6 extends MovieClip {
public var prst;
public var yPos;
public var addButton_mc:addButton;
public var settings;
public var onTitlePress;
public var c1:MovieClip;
public var c3:MovieClip;
public var c4:MovieClip;
public var c2:MovieClip;
public var settingsBlocker:MovieClip;
public var subtractButton:SubtractButton;
public var routineManager;
public var rotateButton:RotateButton;
public var master:bigSlider;
public var n;
public var frame:AcrobotFrame;
public var ll;
public var xShift2;
public var myData;
public var presetBin:SuperSprite;
public var presetButtons;
public var titleClip:MovieClip;
public var setProp;
public var routine;
public var lightButton:LightButton;
public var xShift;
public function acrobotViewer_6(){
addFrameScript(0, frame1, 1, frame2);
}
public function clearPresetHighlights(){
var _local1:*;
_local1 = 0;
while (_local1 < ll) {
presetButtons[_local1].gotoAndStop(1);
_local1++;
};
}
public function setRotation(_arg1){
var _local2:*;
var _local3:*;
rotation = _arg1;
_local2 = 540;
_local3 = 487;
x = (_local2 / 2);
y = (_local3 / 2);
parent.onViewerRotate();
}
function frame1(){
settingsAvailable = false;
}
function frame2(){
stop();
xShift = -80;
xShift2 = 0;
formations = {pyramid:[[(-80 + xShift), -56, 0], [(63 + xShift), -58, (Math.PI / 2)], [(200 + xShift), -60, 0], [(132 + xShift), -190, (Math.PI / 2)], [(10 + xShift), -200, (Math.PI / 2)], [(77 + xShift), -310, ((Math.PI / 2) - (Math.PI / 8))]], trio:[[(-90 + xShift2), -80, 0], [(73 + xShift2), -80, (Math.PI / 2)], [(10 + xShift2), -240, (Math.PI / 2)]], empty:[]};
settings = {masterMin:{name:"masterMin", props:{master:0}}, masterMax:{name:"masterMax", props:{master:1}}, masterMid:{name:"masterMid", props:{master:0.3}}, sticky:{name:"Stick", inMenu:true, props:{stable:0.999987988668549, drag:0.21043453440229, stick:19.0618151242279, scale:0.695145886311971, grav:0.201492531488523, speed:0.6, touchDrag:0, restlessness:0.02}}, superStable:{name:"Builder", inMenu:true, props:{transTimeMin:14, transTimeMax:30, restlessness:0.001, speed:1.4, stable:0.25, touchDrag:0.1, drag:0.01, stick:8.0771372868465, scale:0.65, grav:0.0606479865794586}}, balance:{name:"Balance", inMenu:true, props:{transTimeMin:14, transTimeMax:30, speed:1.15, stable:0, drag:0.01, touchDrag:0.03, stick:0, scale:0.65, grav:0.108789237058139, restlessness:0.05}}, freeForAll:{name:"Free for All", inMenu:true, props:{transTimeMin:14, transTimeMax:30, speed:0.919517790204322, stable:7.52201331143917E-5, drag:0, touchDrag:0, stick:2.38722816529942E-5, scale:0.65, grav:0.3, restlessness:1}}, weightless:{name:"Zero-G", inMenu:true, props:{speed:0.919517790204322, stable:7.52201331143917E-5, drag:0, touchDrag:0, stick:2.38722816529942E-5, scale:0.695145886311971, grav:0, restlessness:1}}};
routine = {initFormation:formations.trio, initSteps:120, initSetting:settings.masterMin, steps:[{length:1}, {transition:settings.masterMid, length:10}, {action:[frame, "unveil"], length:1}, {action:[titleClip, "play"], length:1}, {action:[settingsBlocker, "play"], length:1}, {length:90, nextStep:5}]};
if (settingsAvailable){
ll = 0;
yPos = 0;
presetButtons = [];
for (n in settings) {
if (settings[n].inMenu){
ll++;
prst = new preset();
presetBin.addChild(prst);
myData = settings[n];
prst.label.text = ll;
prst.myData = myData;
prst.msDwn = function (_arg1){
settingsManager.gotoState(_arg1.target.parent.myData, 12);
clearPresetHighlights();
gotoAndStop(2);
};
prst.addEventListener(MouseEvent.MOUSE_DOWN, prst.msDwn);
prst.y = yPos;
presetButtons.push(prst);
yPos = (yPos + 36);
};
};
};
onTitlePress = function (){
navigateToURL(new URLRequest("http://www.vectorpark.com"), "_top");
};
titleClip.addEventListener("mouseDown", onTitlePress);
titleClip.buttonMode = true;
titleClip.useHandCursor = true;
this.onChange = function (_arg1, _arg2){
setProp(_arg1, _arg2);
};
setProp = function (_arg1, _arg2){
if (isNaN(_arg2)){
return;
};
if (_arg1 == "master"){
master.showVal(_arg2);
} else {
if (settingsAvailable){
settingsPanel.showVal(_arg1, _arg2);
};
};
switch (_arg1){
case "master":
if (_arg2 < 0.5){
settingsManager.setProperties(settings.superStable, settings.balance, (_arg2 * 2));
} else {
settingsManager.setProperties(settings.balance, settings.freeForAll, ((_arg2 - 0.5) * 2));
};
break;
case "grav":
frame.gravity = _arg2;
break;
case "scale":
frame.setMyScale(_arg2);
break;
case "stick":
frame.stickiness = _arg2;
break;
case "drag":
frame.drag = _arg2;
break;
case "stable":
frame.setStabilizer(_arg2);
break;
case "speed":
frame.setSpeed((_arg2 / 2));
break;
case "restlessness":
frame.setRestlessness(_arg2);
break;
case "mass":
frame.setBotMass(_arg2);
break;
case "attraction":
frame.setAttraction(_arg2);
break;
case "touchDrag":
frame.setTouchDrag(_arg2);
break;
case "transTimeMin":
frame.setTransitionTimeMin(_arg2);
break;
case "transTimeMax":
frame.setTransitionTimeMax(_arg2);
break;
};
};
addButton_mc.onPressEvent = function (){
frame.addNextBot();
};
subtractButton.onPressEvent = function (){
frame.removePreviousBot();
};
lightButton.onPressEvent = function (){
frame.toggleLights();
};
rotateButton.onPressEvent = function (){
frame.rotateFrame();
};
master.init(this, 172, (47.7 / 2), "vert");
master.initValues(0, 1, 0.5);
if (settingsAvailable){
settingsPanel.init(this);
toolsButton.onPressEvent = function (){
settingsPanel.toggleState();
};
};
settingsManager = new SettingsManager(this);
routineManager = new RoutineManager(routine, frame, settingsManager);
routineManager.begin();
onFrame = function (){
routineManager.step();
};
this.addEventListener(Event.ENTER_FRAME, onFrame);
}
}
}//package acrobotsF9_fla
Section 18
//MainTimeline (acrobotsF9_fla.MainTimeline)
package acrobotsF9_fla {
import acrobots.*;
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class MainTimeline extends MovieClip {
public var viewer:MovieClip;
public var pct;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 3, frame4, 4, frame5);
}
function frame1(){
DelayedEvent._stage = stage;
}
function frame4(){
this.onViewerRotate = function (){
fitViewer();
};
onStageResize = function (_arg1){
fitViewer();
};
stage.scaleMode = "noScale";
stage.addEventListener(Event.RESIZE, onStageResize);
fitViewer();
}
function frame5(){
stop();
}
public function fitViewer(){
var _local1:*;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
viewer.scaleY = (viewer.scaleX = 1);
_local1 = viewer.getBounds(this);
_local2 = _local1.height;
_local3 = _local1.width;
_local4 = (_local2 / stage.stageHeight);
_local5 = (_local3 / stage.stageWidth);
_local6 = Math.max(_local4, _local5);
if (_local6 > 1){
viewer.scaleY = (viewer.scaleX = (1 / _local6));
} else {
viewer.scaleY = (viewer.scaleX = 1);
};
}
function frame2(){
pct = (URLLoader.bytesLoaded / URLLoader.bytesTotal);
if (pct < 1){
gotoAndPlay(1);
} else {
gotoAndPlay(4);
};
}
}
}//package acrobotsF9_fla
Section 19
//preLoader_1 (acrobotsF9_fla.preLoader_1)
package acrobotsF9_fla {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class preLoader_1 extends MovieClip {
public function preLoader_1(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package acrobotsF9_fla
Section 20
//settingsBlocker_15 (acrobotsF9_fla.settingsBlocker_15)
package acrobotsF9_fla {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class settingsBlocker_15 extends MovieClip {
public function settingsBlocker_15(){
addFrameScript(0, frame1, 15, frame16);
}
function frame16(){
stop();
}
function frame1(){
onPress = function (){
};
useHandCursor = false;
stop();
}
}
}//package acrobotsF9_fla
Section 21
//titleClip_17 (acrobotsF9_fla.titleClip_17)
package acrobotsF9_fla {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class titleClip_17 extends MovieClip {
public function titleClip_17(){
addFrameScript(0, frame1, 14, frame15);
}
function frame15(){
stop();
}
function frame1(){
stop();
}
}
}//package acrobotsF9_fla
Section 22
//addButton (addButton)
package {
import acrobots.*;
public dynamic class addButton extends EasyButton {
}
}//package
Section 23
//antiCorner (antiCorner)
package {
import flash.display.*;
public dynamic class antiCorner extends MovieClip {
}
}//package
Section 24
//bigSlider (bigSlider)
package {
import acrobots.*;
public dynamic class bigSlider extends Slider {
}
}//package
Section 25
//BotFoot (BotFoot)
package {
import flash.display.*;
public dynamic class BotFoot extends Sprite {
public var heel:MovieClip;
}
}//package
Section 26
//Circle (Circle)
package {
import flash.display.*;
public dynamic class Circle extends MovieClip {
}
}//package
Section 27
//LightButton (LightButton)
package {
import acrobots.*;
public dynamic class LightButton extends EasyButton {
}
}//package
Section 28
//preset (preset)
package {
import flash.display.*;
import flash.text.*;
public dynamic class preset extends MovieClip {
public var label:TextField;
}
}//package
Section 29
//PresetButton (PresetButton)
package {
import flash.display.*;
import flash.text.*;
import flash.events.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.filters.*;
import flash.media.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import flash.utils.*;
public dynamic class PresetButton extends MovieClip {
public var label:TextField;
public function PresetButton(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 30
//PulseButton (PulseButton)
package {
import acrobots.*;
public dynamic class PulseButton extends EasyButton {
}
}//package
Section 31
//RotateButton (RotateButton)
package {
import acrobots.*;
public dynamic class RotateButton extends EasyButton {
}
}//package
Section 32
//sliderBar (sliderBar)
package {
import flash.display.*;
public dynamic class sliderBar extends Sprite {
}
}//package
Section 33
//sliderKnob (sliderKnob)
package {
import flash.display.*;
public dynamic class sliderKnob extends Sprite {
}
}//package
Section 34
//Square (Square)
package {
import flash.display.*;
public dynamic class Square extends Sprite {
}
}//package
Section 35
//SubtractButton (SubtractButton)
package {
import acrobots.*;
public dynamic class SubtractButton extends EasyButton {
}
}//package
Section 36
//ToolsButton (ToolsButton)
package {
import acrobots.*;
public dynamic class ToolsButton extends EasyButton {
}
}//package