Section 1
//Drawing (as3.Drawing)
package as3 {
import flash.display.*;
import flash.geom.*;
public class Drawing {
public static function drawHeart(_arg1:Graphics, _arg2:Number, _arg3:Number){
var _local4:Number;
var _local5:Number;
var _local6:Object;
var _local7:Object;
var _local8:Object;
var _local9:Object;
var _local10:Object;
var _local11:Object;
var _local12:Object;
var _local13:Object;
var _local14:Object;
var _local15:Object;
_local4 = (_arg3 / 1.5);
_local5 = (_arg2 / 1.5);
_local6 = {x:0, y:1};
_local7 = {x:1, y:0};
_local8 = {x:0, y:-1};
_local9 = {x:1.2, y:-0.5};
_local10 = {x:1, y:-1};
_local11 = {x:0.5, y:-1.2};
_local12 = Geometry.intersectLines(_local7.x, _local7.y, (_local7.x + 1), (_local7.y - 1), _local9.x, _local9.y, _local9.x, (_local9.y + 1));
_local13 = Geometry.intersectLines(_local10.x, _local10.y, (_local10.x + 1), (_local10.y + 1), _local9.x, _local9.y, _local9.x, (_local9.y + 1));
_local14 = Geometry.intersectLines(_local10.x, _local10.y, (_local10.x + 1), (_local10.y + 1), _local11.x, _local11.y, (_local11.x + 1), _local11.y);
_local15 = Geometry.intersectLines(_local8.x, _local8.y, (_local8.x + 1), (_local8.y - 1), _local11.x, _local11.y, (_local11.x + 1), _local11.y);
_arg1.moveTo((_local5 * _local6.x), (_local4 * _local6.y));
_arg1.lineTo((_local5 * _local7.x), (_local4 * _local7.y));
_arg1.curveTo((_local5 * _local12.x), (_local4 * _local12.y), (_local5 * _local9.x), (_local4 * _local9.y));
_arg1.curveTo((_local5 * _local13.x), (_local4 * _local13.y), (_local5 * _local10.x), (_local4 * _local10.y));
_arg1.curveTo((_local5 * _local14.x), (_local4 * _local14.y), (_local5 * _local11.x), (_local4 * _local11.y));
_arg1.curveTo((_local5 * _local15.x), (_local4 * _local15.y), (_local5 * _local8.x), (_local4 * _local8.y));
_arg1.curveTo((-(_local5) * _local15.x), (_local4 * _local15.y), (-(_local5) * _local11.x), (_local4 * _local11.y));
_arg1.curveTo((-(_local5) * _local14.x), (_local4 * _local14.y), (-(_local5) * _local10.x), (_local4 * _local10.y));
_arg1.curveTo((-(_local5) * _local13.x), (_local4 * _local13.y), (-(_local5) * _local9.x), (_local4 * _local9.y));
_arg1.curveTo((-(_local5) * _local12.x), (_local4 * _local12.y), (-(_local5) * _local7.x), (_local4 * _local7.y));
_arg1.lineTo((-(_local5) * _local6.x), (_local4 * _local6.y));
}
public static function drawSparkle(_arg1:Graphics, _arg2:Number, _arg3:int, _arg4:Number, _arg5:Number=0, _arg6:Number=0, _arg7:Number=0){
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
if (_arg3 < 1){
return;
};
_local14 = ((Math.PI * 2) / _arg3);
_arg1.moveTo(((Math.cos(_arg5) * _arg2) + _arg6), (_arg7 + (Math.sin(_arg5) * _arg2)));
_local15 = 0;
while (_local15 < _arg3) {
_local8 = (Math.cos(((Number((_local15 + 1)) * _local14) + _arg5)) * _arg2);
_local9 = (Math.sin(((Number((_local15 + 1)) * _local14) + _arg5)) * _arg2);
_local10 = ((Math.cos(((Number((_local15 + 0.5)) * _local14) + _arg5)) * _arg2) * _arg4);
_local11 = ((Math.sin(((Number((_local15 + 0.5)) * _local14) + _arg5)) * _arg2) * _arg4);
_local12 = ((Math.cos(((Number((_local15 + 0.25)) * _local14) + _arg5)) * _arg2) * _arg4);
_local13 = ((Math.sin(((Number((_local15 + 0.25)) * _local14) + _arg5)) * _arg2) * _arg4);
_arg1.curveTo((_arg6 + _local12), (_arg7 + _local13), (_arg6 + _local10), (_arg7 + _local11));
_local12 = ((Math.cos(((Number((_local15 + 0.75)) * _local14) + _arg5)) * _arg2) * _arg4);
_local13 = ((Math.sin(((Number((_local15 + 0.75)) * _local14) + _arg5)) * _arg2) * _arg4);
_arg1.curveTo((_arg6 + _local12), (_arg7 + _local13), (_arg6 + _local8), (_arg7 + _local9));
_local15++;
};
}
public static function drawCurvyLine(_arg1:Graphics, _arg2:Object, _arg3:Array, _arg4:Object, _arg5:Number=0.25){
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:Object;
var _local10:Object;
_local7 = _arg3.length;
_local8 = (_local7 - 1);
if (_arg2 == null){
_arg2 = _arg3[0];
};
if (_arg4 == null){
_arg4 = _arg3[_local8];
};
_local6 = 1;
while (_local6 < _local7) {
if (_local6 < _local8){
_local9 = getLinePoint(_arg3[(_local6 - 1)], _arg3[_local6], _arg3[(_local6 + 1)]);
} else {
_local9 = _arg4;
};
if (_local6 > 1){
_local10 = getLinePoint(_arg3[(_local6 - 2)], _arg3[(_local6 - 1)], _arg3[_local6]);
} else {
_local10 = _arg2;
};
drawConnection(_arg1, _arg3[(_local6 - 1)], _arg3[_local6], _local10, _local9, _arg5);
_local6++;
};
}
public static function getLinePoint(_arg1:Object, _arg2:Object, _arg3:Object):Object{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local4 = (_arg2.x - _arg1.x);
_local5 = (_arg2.y - _arg1.y);
_local6 = Math.atan2(_local5, _local4);
_local7 = (_arg3.x - _arg2.x);
_local8 = (_arg3.y - _arg2.y);
_local9 = Math.atan2(_local8, _local7);
_local10 = Geometry.interpolateAngle(_local6, _local9, 0.5);
return ({x:(_arg2.x + (Math.cos(_local10) * 2)), y:(_arg2.y + (Math.sin(_local10) * 2))});
}
public static function drawStar(_arg1:Graphics, _arg2:Number, _arg3:uint, _arg4:Number, _arg5:Number=0, _arg6:Number=0, _arg7:Number=0){
var _local8:int;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
_local8 = 0;
if (!_arg3){
return;
};
_local9 = (_arg2 * _arg4);
_local10 = (Math.PI / _arg3);
_local11 = ((-(Math.PI) * 0.5) + _arg5);
_arg3 = (_arg3 << 1);
_local8 = 0;
while (_local8 <= _arg3) {
if ((_local8 % 2)){
_local12 = (_arg6 + (Math.cos(_local11) * _local9));
_local13 = (_arg7 + (Math.sin(_local11) * _local9));
} else {
_local12 = (_arg6 + (Math.cos(_local11) * _arg2));
_local13 = (_arg7 + (Math.sin(_local11) * _arg2));
};
if (!_local8){
_arg1.moveTo(_local12, _local13);
} else {
_arg1.lineTo(_local12, _local13);
};
_local11 = (_local11 + _local10);
_local8++;
};
}
public static function drawPoints(_arg1:Array, _arg2:Graphics){
var _local3:int;
_local3 = 0;
while (_local3 < _arg1.length) {
_arg2.moveTo(_arg1[_local3].x, (_arg1[_local3].y - 0.5));
_arg2.lineTo(_arg1[_local3].x, (_arg1[_local3].y + 0.5));
_local3++;
};
}
public static function drawConnection(_arg1:Graphics, _arg2:Object, _arg3:Object, _arg4:Object, _arg5:Object, _arg6:Number){
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Object;
var _local22:Object;
var _local23:Object;
var _local24:Object;
var _local25:Object;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Object;
var _local31:Object;
_local10 = (_arg4.x - _arg2.x);
_local11 = (_arg4.y - _arg2.y);
_local12 = (_arg5.x - _arg3.x);
_local13 = (_arg5.y - _arg3.y);
_local14 = Math.atan2(_local11, _local10);
_local15 = Math.atan2(_local13, _local12);
_local16 = Math.cos(_local14);
_local17 = Math.sin(_local14);
_local18 = Math.cos(_local15);
_local19 = Math.sin(_local15);
_local7 = (_arg3.x - _arg2.x);
_local8 = (_arg3.y - _arg2.y);
_local9 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local20 = (_arg6 * _local9);
_local21 = {x:(_arg2.x + (_local16 * _local20)), y:(_arg2.y + (_local17 * _local20))};
_local22 = {x:(_arg2.x - (_local16 * _local20)), y:(_arg2.y - (_local17 * _local20))};
_local23 = {x:(_arg3.x + (_local18 * _local20)), y:(_arg3.y + (_local19 * _local20))};
_local24 = {x:(_arg3.x - (_local18 * _local20)), y:(_arg3.y - (_local19 * _local20))};
_local25 = {x:(0.5 * (_arg2.x + _arg3.x)), y:(0.5 * (_arg2.y + _arg3.y))};
_local7 = (_local21.x - _local25.x);
_local8 = (_local21.y - _local25.y);
_local26 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local7 = (_local22.x - _local25.x);
_local8 = (_local22.y - _local25.y);
_local27 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local7 = (_local23.x - _local25.x);
_local8 = (_local23.y - _local25.y);
_local28 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local7 = (_local24.x - _local25.x);
_local8 = (_local24.y - _local25.y);
_local29 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local30 = ((_local26)<_local27) ? _local21 : _local22;
_local31 = ((_local28)<_local29) ? _local23 : _local24;
_local25.x = ((_local30.x + _local31.x) * 0.5);
_local25.y = ((_local30.y + _local31.y) * 0.5);
_arg1.curveTo(_local30.x, _local30.y, _local25.x, _local25.y);
_arg1.curveTo(_local31.x, _local31.y, _arg3.x, _arg3.y);
}
public static function controlPointIntersect(_arg1:Object, _arg2:Object, _arg3:Object, _arg4:Object):Object{
var _local5:Object;
var _local6:Object;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
_local5 = Geometry.intersectLines(_arg1.x, _arg1.y, _arg2.x, _arg2.y, _arg3.x, _arg3.y, _arg4.x, _arg4.y);
if (!_local5){
return (null);
};
_local6 = {x:((_arg2.x + _arg3.x) * 0.5), y:((_arg2.y + _arg3.y) * 0.5)};
_local7 = (_arg3.x - _arg2.x);
_local8 = (_arg3.y - _arg2.y);
_local9 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local10 = (_local5.x - _local6.x);
_local11 = (_local5.y - _local6.y);
_local12 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
if (_local12 > _local9){
return (null);
};
return ({x:(_local6.x + ((_local5.x - _local6.x) * 0.5)), y:(_local6.y + ((_local5.y - _local6.y) * 0.5))});
}
public static function drawPolygon(_arg1:Array, _arg2:Graphics){
var _local3:int;
_arg2.moveTo(_arg1[0].x, _arg1[0].y);
_local3 = 1;
while (_local3 < _arg1.length) {
_arg2.lineTo(_arg1[_local3].x, _arg1[_local3].y);
_local3++;
};
}
public static function drawClosedCurve(_arg1:Array, _arg2:Graphics):Array{
var _local3:Point;
var _local4:Point;
var _local5:Point;
var _local6:Point;
var _local7:Array;
var _local8:int;
var _local9:Object;
if (_arg1.length < 3){
return ([]);
};
_local7 = new Array();
_arg2.moveTo(_arg1[0].x, _arg1[0].y);
_local8 = 0;
while (_local8 < _arg1.length) {
_local3 = _arg1[_local8];
_local4 = _arg1[(int(((_arg1.length + _local8) - 1)) % _arg1.length)];
_local5 = _arg1[(int((_local8 + 1)) % _arg1.length)];
_local6 = _arg1[(int((_local8 + 2)) % _arg1.length)];
_local9 = controlPointIntersect(_local4, _local3, _local5, _local6);
if (_local9 == null){
_arg2.lineTo(_local5.x, _local5.y);
} else {
_local7.push(_local9);
_arg2.curveTo(_local9.x, _local9.y, _local5.x, _local5.y);
};
_local8++;
};
return (_local7);
}
}
}//package as3
Section 2
//Geometry (as3.Geometry)
package as3 {
import flash.display.*;
import flash.geom.*;
public class Geometry {
public static const DEG_TO_RAD:Number = 0.0174532925199433;
public static const RAD_TO_DEG:Number = 57.2957795130823;
public static const TOLERANCE:Number = 1E-5;
function regularPolygonArea(_arg1:Number, _arg2:int){
var _local3:Number;
var _local4:Number;
if (_arg2 < 3){
return (0);
};
_local3 = ((Math.PI * 2) / _arg2);
_local4 = (Math.sin(_local3) * _arg1);
return ((((_local4 * _arg1) * 0.5) * _arg2));
}
public static function intersectLines(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Boolean=false):Object{
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Object;
var _local19:Boolean;
var _local20:Boolean;
_local10 = (_arg1 - _arg3);
_local11 = (_arg5 - _arg7);
_local12 = (_arg2 - _arg4);
_local13 = (_arg6 - _arg8);
_local14 = ((_arg1 * _arg4) - (_arg2 * _arg3));
_local15 = ((_arg5 * _arg8) - (_arg6 * _arg7));
_local16 = ((_local10 * _local13) - (_local12 * _local11));
if (!_local16){
return (null);
};
_local17 = (1 / _local16);
_local18 = {x:(((_local14 * _local11) - (_local10 * _local15)) * _local17), y:(((_local14 * _local13) - (_local12 * _local15)) * _local17)};
if (_arg9){
_local19 = pointInsideRect(_local18.x, _local18.y, _arg1, _arg2, _arg3, _arg4);
_local20 = pointInsideRect(_local18.x, _local18.y, _arg5, _arg6, _arg7, _arg8);
if (((!(_local19)) || (!(_local20)))){
return (null);
};
};
return (_local18);
}
public static function pointFromEllipse(_arg1:Object, _arg2:Object):Object{
var _local3:Point;
var _local4:Object;
_local3 = new Point();
_local3.x = (_arg1.x + ((_arg1.radius * Math.cos(_arg2.angle)) * _arg2.distance));
_local3.y = (_arg1.y + (((_arg1.radius * _arg1.excentricity) * Math.sin(_arg2.angle)) * _arg2.distance));
_local4 = rotate(_arg1.rotation, _local3.x, _local3.y, _arg1.x, _arg1.y);
return (new Point(_local4.x, _local4.y));
}
public static function polygonArea(_arg1:Array):Number{
var _local2:Point;
var _local3:Point;
var _local4:Number;
if (_arg1.length < 3){
return (0);
};
_local4 = 0;
return (_local4);
}
public static function getEllipse(_arg1:DisplayObject):Object{
var obj:Object;
var rect:Rectangle;
var clip = _arg1;
obj = {};
rect = clip.getRect(clip);
obj.x = clip.x;
obj.y = clip.y;
obj.radius = (-(rect.x) * clip.scaleX);
obj.rotation = ((clip.rotation * Math.PI) / 180);
obj.excentricity = (clip.scaleY / clip.scaleX);
obj.toString = function (){
return ((((((((((("[ x=" + this.x) + ", y=") + this.y) + ", radius=") + this.radius) + ", rotation=") + this.rotation) + ", excentricity=") + this.excentricity) + " ]"));
};
return (obj);
}
public static function pointToEllipse(_arg1:Object, _arg2:Object):Object{
var obj:Object;
var untranslated:Point;
var unrotated:Object;
var unexcentered:Point;
var unscaled:Point;
var point = _arg1;
var ellipse = _arg2;
obj = {};
untranslated = new Point((point.x - ellipse.x), (point.y - ellipse.y));
unrotated = rotate(-(ellipse.rotation), untranslated.x, untranslated.y);
unexcentered = new Point(unrotated.x, (unrotated.y / ellipse.excentricity));
unscaled = new Point((unexcentered.x / ellipse.radius), (unexcentered.y / ellipse.radius));
obj.distance = Math.sqrt(((unscaled.x * unscaled.x) + (unscaled.y * unscaled.y)));
obj.hDist = unscaled.x;
obj.vDist = unscaled.y;
obj.normal = (Math.atan2(unscaled.y, unscaled.x) + ellipse.rotation);
obj.angle = Math.atan2(unscaled.y, unscaled.x);
obj.rotation = ellipse.rotation;
obj.toString = function (){
return ((((((((((((("[ distance=" + obj.distance) + ", normal=") + obj.normal) + ", angle=") + obj.angle) + ", hDist=") + obj.hDist) + ", vDist=") + obj.vDist) + ", rotation=") + obj.rotation) + " ]"));
};
return (obj);
}
public static function getOuterPoints(_arg1:Array):Array{
var _local2:Array;
var _local3:Point;
var _local4:int;
var _local5:Array;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Point;
var _local11:int;
var _local12:Number;
var _local13:Point;
var _local14:int;
var _local15:Number;
var _local16:Number;
_local2 = _arg1.concat();
_local3 = _local2[0];
_local4 = 1;
while (_local4 < _local2.length) {
if (_local2[_local4].y < _local3.y){
_local3 = _local2[_local4];
};
_local4++;
};
_local5 = [_local3];
_local6 = Infinity;
_local8 = 0;
_local9 = 0;
_local10 = _local5[0];
_local11 = _local2.length;
while (1) {
_local12 = (Math.PI * 2);
_local13 = null;
_local4 = 0;
while (_local4 < _local2.length) {
_local7 = Math.atan2((_local2[_local4].y - _local5[(_local5.length - 1)].y), (_local2[_local4].x - _local5[(_local5.length - 1)].x));
_local16 = getLowestPositiveAngle((_local7 - _local8));
if ((((_local16 <= _local12)) && (!((_local2[_local4] == _local5[(_local5.length - 1)]))))){
_local13 = _local2[_local4];
_local12 = _local16;
};
_local4++;
};
if ((((_local13 == null)) || ((((_local13 == _local5[0])) && ((_local5.length > 1)))))){
break;
};
_local15 = _local8;
_local8 = getLowestPositiveAngle(Math.atan2((_local13.y - _local5[(_local5.length - 1)].y), (_local13.x - _local5[(_local5.length - 1)].x)));
_local9 = (_local9 + getLowestPositiveAngle((_local8 - _local15)));
if (_local9 >= (Math.PI * 2)){
break;
};
_local5.push(_local13);
--_local11;
if (!_local11){
trace(("FAILURE: " + (_local9 - (Math.PI * 2))), "\n");
break;
};
};
if ((((_local5.length > 2)) && ((_local5[(_local5.length - 1)] == _local5[1])))){
_local5.pop();
};
return (_local5);
}
public static function getSidePoints(_arg1:Array, _arg2:Number):Array{
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:Array;
var _local7:Point;
var _local8:Point;
var _local9:Number;
var _local10:Number;
var _local11:Array;
var _local12:Number;
var _local13:Number;
_local4 = Infinity;
_local5 = -(Infinity);
_local3 = 0;
while (_local3 < _arg1.length) {
if (_arg1[_local3].y < _local4){
_local4 = _arg1[_local3].y;
};
if (_arg1[_local3].y > _local5){
_local5 = _arg1[_local3].y;
};
_local3++;
};
if (_arg2 < _local4){
_arg2 = _local4;
} else {
if (_arg2 > _local5){
_arg2 = _local5;
};
};
_local6 = [];
_local3 = 0;
while (_local3 < _arg1.length) {
_local7 = _arg1[_local3];
_local8 = _arg1[((_local3 + 1) % _arg1.length)];
if ((((((_arg2 <= _local7.y)) && ((_arg2 >= _local8.y)))) || ((((_arg2 >= _local7.y)) && ((_arg2 <= _local8.y)))))){
if (_local8.y == _local7.y){
_local6.push(new Point(_local7.x, _local7.y));
_local6.push(new Point(_local8.x, _local8.y));
} else {
_local12 = ((_arg2 - _local7.y) / (_local8.y - _local7.y));
_local13 = (_local7.x + ((_local8.x - _local7.x) * _local12));
_local6.push(new Point(_local13, _arg2));
};
};
_local3++;
};
_local9 = Infinity;
_local10 = -(Infinity);
_local3 = 0;
while (_local3 < _local6.length) {
_local7 = _local6[_local3];
if (_local7.x < _local9){
_local9 = _local7.x;
};
if (_local7.x > _local10){
_local10 = _local7.x;
};
_local3++;
};
_local11 = [];
_local3 = 0;
while (_local3 < _local6.length) {
if (_local6[_local3].x <= (_local9 + TOLERANCE)){
_local11[0] = _local6[_local3];
};
if (_local6[_local3].x >= (_local10 - TOLERANCE)){
_local11[1] = _local6[_local3];
};
_local3++;
};
return (_local11);
}
public static function projectPointOnLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Object{
var _local7:Object;
var _local8:Object;
_local7 = getNormal(_arg3, _arg4, _arg5, _arg6);
_local8 = intersectLines(_arg1, _arg2, (_arg1 + _local7.x), (_arg2 + _local7.y), _arg3, _arg4, _arg5, _arg6, false);
if (_local8 == null){
throw ("Unexpected error in Geometry::closestPointToLine. Perpendicular lines aren't intersecting!\n");
};
return (_local8);
}
private static function getLowestPositiveAngle(_arg1:Number):Number{
var _local2:Number;
_local2 = _arg1;
while (_local2 < 0) {
_local2 = (_local2 + (Math.PI * 2));
};
while (_local2 >= (Math.PI * 2)) {
_local2 = (_local2 - (Math.PI * 2));
};
return (_local2);
}
public static function generateRegularPolygon(_arg1:Number, _arg2:Number):Array{
var _local3:Array;
var _local4:Number;
var _local5:int;
_local3 = new Array(_arg1);
_local4 = ((Math.PI * 2) / _arg1);
_local5 = 0;
while (_local5 < _arg1) {
_local3[_local5] = new Point();
_local3[_local5].x = (_arg2 * Math.cos((_local5 * _local4)));
_local3[_local5].y = (_arg2 * Math.sin((_local5 * _local4)));
_local5++;
};
return (_local3);
}
public static function triangleArea(_arg1:Point, _arg2:Point, _arg3:Point):Number{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local4 = (_arg2.x - _arg1.x);
_local5 = (_arg3.x - _arg1.x);
_local6 = (_arg2.y - _arg1.y);
_local7 = (_arg3.y - _arg1.y);
return ((0.5 * Math.abs(((_local4 * _local7) - (_local5 * _local6)))));
}
public static function pointInsideRect(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number){
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
if (_arg3 < _arg5){
_local7 = _arg3;
_local9 = _arg5;
} else {
_local7 = _arg5;
_local9 = _arg3;
};
if (_arg4 < _arg6){
_local8 = _arg4;
_local10 = _arg6;
} else {
_local8 = _arg6;
_local10 = _arg4;
};
_local11 = 0.0001;
return (!((((((((_arg1 < (_local7 - _local11))) || ((_arg1 > (_local9 + _local11))))) || ((_arg2 < (_local8 - _local11))))) || ((_arg2 > (_local10 + _local11))))));
}
public static function interpolateAngle(_arg1:Number, _arg2:Number, _arg3:Number):Number{
var _local4:Number;
var _local5:Number;
while (_arg1 < 0) {
_arg1 = (_arg1 + (Math.PI * 2));
};
while (_arg2 < 0) {
_arg2 = (_arg2 + (Math.PI * 2));
};
while (_arg1 >= (Math.PI * 2)) {
_arg1 = (_arg1 - (Math.PI * 2));
};
while (_arg2 >= (Math.PI * 2)) {
_arg2 = (_arg2 - (Math.PI * 2));
};
if (_arg1 > _arg2){
if ((_arg1 - _arg2) > Math.PI){
_arg1 = (_arg1 - (Math.PI * 2));
};
} else {
if ((_arg2 - _arg1) > Math.PI){
_arg2 = (_arg2 - (Math.PI * 2));
};
};
_local5 = (_arg1 + (_arg3 * (_arg2 - _arg1)));
while (_local5 > Math.PI) {
_local5 = (_local5 - (Math.PI * 2));
};
while (_local5 < -(Math.PI)) {
_local5 = (_local5 + (Math.PI * 2));
};
return (_local5);
}
public static function rotate(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0, _arg5:Number=0):Object{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local6 = (_arg2 - _arg4);
_local7 = (_arg3 - _arg5);
_local8 = Math.cos(_arg1);
_local9 = Math.sin(_arg1);
return ({x:((_arg4 + (_local6 * _local8)) - (_local7 * _local9)), y:((_arg5 + (_local6 * _local9)) + (_local7 * _local8))});
}
public static function getNormal(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Object{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Object;
_local5 = (_arg1 - _arg3);
_local6 = (_arg2 - _arg4);
_local7 = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
if (!_local7){
return ({x:0, y:0});
};
_local8 = {x:(_local6 / _local7), y:(-(_local5) / _local7)};
return (_local8);
}
public static function intersectPolygons(_arg1:Array, _arg2:Array){
var _local3:int;
var _local4:int;
var _local5:Array;
var _local6:Point;
var _local7:Point;
var _local8:Point;
var _local9:Point;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Object;
var _local15:int;
var _local16:int;
_local3 = (_arg1.length - 1);
_local4 = (_arg2.length - 1);
_local5 = [];
if ((((_local3 < 2)) || ((_local4 < 2)))){
return;
};
_local15 = 0;
while (_local15 < _local3) {
_local6 = _arg1[_local15];
_local7 = _arg1[(_local15 + 1)];
_local10 = _local6.x;
_local11 = _local6.y;
_local12 = _local7.x;
_local13 = _local7.y;
_local16 = 0;
while (_local16 < _local4) {
_local8 = _arg2[_local16];
_local9 = _arg2[(_local16 + 1)];
_local14 = intersectLines(_local10, _local11, _local12, _local13, _local8.x, _local8.y, _local9.x, _local9.y, true);
if (_local14){
_local5[_local5.length] = new Point(_local14.x, _local14.y);
};
_local16++;
};
_local8 = _arg2[_local16];
_local9 = _arg2[0];
_local14 = intersectLines(_local10, _local11, _local12, _local13, _local8.x, _local8.y, _local9.x, _local9.y, true);
if (_local14){
_local5[_local5.length] = new Point(_local14.x, _local14.y);
};
_local15++;
};
_local6 = _arg1[_local15];
_local7 = _arg1[0];
_local10 = _local6.x;
_local11 = _local6.y;
_local12 = _local7.x;
_local13 = _local7.y;
_local16 = 0;
while (_local16 < _local4) {
_local8 = _arg2[_local16];
_local9 = _arg2[(_local16 + 1)];
_local14 = intersectLines(_local10, _local11, _local12, _local13, _local8.x, _local8.y, _local9.x, _local9.y, true);
if (_local14){
_local5[_local5.length] = new Point(_local14.x, _local14.y);
};
_local16++;
};
_local8 = _arg2[_local16];
_local9 = _arg2[0];
_local14 = intersectLines(_local10, _local11, _local12, _local13, _local8.x, _local8.y, _local9.x, _local9.y, true);
if (_local14){
_local5[_local5.length] = new Point(_local14.x, _local14.y);
};
return (_local5);
}
}
}//package as3
Section 3
//Physics (as3.Physics)
package as3 {
import flash.display.*;
import flash.geom.*;
public class Physics {
public static const ROTATION_PROP:String = "rotation";
public static const Y_PROP:String = "y";
public static const SKEWY_PROP:String = "skewY";
public static const SCALEX_PROP:String = "scaleX";
public static const X_PROP:String = "x";
public static const SCALEY_PROP:String = "scaleY";
public static const SKEWX_PROP:String = "skewX";
public static function attach(_arg1:Array, _arg2:DisplayObject, _arg3:MovieClip, _arg4:Array=null){
var _local5:Point;
var _local6:Point;
_local5 = _arg2.localToGlobal(new Point());
_local6 = _arg3.globalToLocal(_local5);
if (_arg4 == null){
_arg4 = [];
};
_arg1[_arg1.length] = {mc:_arg2, par:_arg3, point:_local6, props:_arg4};
}
public static function updateSkewY(_arg1:Object, _arg2:Point, _arg3:Matrix, _arg4:Array, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number){
_arg4[0] = (_arg4[0] + ((-(_arg9) * (_arg2.y - _arg1.position.y)) / _arg1.hWeight));
balancePoint(_arg4, _arg5, _arg6, _arg7, _arg8);
_arg3.b = _arg4[0];
}
public static function updateElastic(_arg1:Array){
var _local2:int;
var _local3:int;
_local3 = _arg1.length;
_local2 = 0;
while (_local2 < _local3) {
updateElasticClip(_arg1[_local2]);
_local2++;
};
}
public static function updateAttached(_arg1:Array){
var _local2:int;
var _local3:int;
var _local4:Object;
var _local5:Point;
var _local6:Point;
var _local7:int;
var _local8:int;
var _local9:Array;
_local3 = _arg1.length;
_local2 = 0;
while (_local2 < _local3) {
_local4 = _arg1[_local2];
if (_local4.mc.parent){
_local5 = _local4.par.localToGlobal(_local4.point);
_local6 = _local4.mc.parent.globalToLocal(_local5);
_local4.mc.x = _local6.x;
_local4.mc.y = _local6.y;
};
_local9 = _local4.props;
_local8 = _local9.length;
_local7 = 0;
while (_local7 < _local8) {
_local4.mc[_local9[_local7]] = _local4.par[_local9[_local7]];
_local7++;
};
_local2++;
};
}
public static function setElastic(_arg1:Array, _arg2:DisplayObjectContainer, _arg3:MovieClip, _arg4:Array, _arg5:Array, _arg6:Array, _arg7:Array, _arg8:Array, _arg9:Array):Object{
var _local10:Array;
var _local11:int;
var _local12:int;
var _local13:String;
var _local14:Point;
var _local15:Rectangle;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
if (!_arg3.parent){
return (null);
};
_local10 = [ROTATION_PROP];
_local12 = _arg4.length;
_local11 = 0;
while (_local11 < _local12) {
_local13 = _arg4[_local11];
_local10[_local11] = [_arg6[_local11], 0, 0];
_local11++;
};
_local14 = _arg3.localToGlobal(new Point());
_local14 = _arg2.globalToLocal(_local14);
_local15 = _arg3.getBounds(_arg3);
_local16 = (_local15.right + _local15.left);
_local17 = (_local15.bottom + _local15.top);
_local18 = ((_local16)<0) ? _local15.left : _local15.right;
_local19 = ((_local17)<0) ? _local15.top : _local15.bottom;
_arg1[_arg1.length] = {clip:_arg3, props:_arg4, position:_local14, values:_local10, topLevel:_arg2, rect:_local15, hWeight:_local18, vWeight:_local19, frictions:_arg5, dests:_arg6, multipliers:_arg7, speeds:_arg8, scales:_arg9};
return (_arg1[(_arg1.length - 1)]);
}
public static function updateSkewX(_arg1:Object, _arg2:Point, _arg3:Matrix, _arg4:Array, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number){
_arg4[0] = (_arg4[0] + ((-(_arg9) * (_arg2.x - _arg1.position.x)) / _arg1.vWeight));
balancePoint(_arg4, _arg5, _arg6, _arg7, _arg8);
_arg3.c = _arg4[0];
}
public static function balancePoint(_arg1:Array, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:int=1){
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:int;
_local6 = _arg1[0];
_local7 = _arg1[1];
_local8 = _arg1[2];
_local9 = 0;
while (_local9 < _arg5) {
_arg1[1] = ((_arg1[1] * _arg2) + _arg1[2]);
_arg1[2] = ((_arg3 - _arg1[0]) * _arg4);
_arg1[0] = (_arg1[0] + (_local7 * _arg2));
_local9++;
};
}
public static function editElastic(_arg1:Array, _arg2:MovieClip, _arg3:String, _arg4:Number){
var _local5:int;
var _local6:int;
_local6 = _arg1.length;
_local5 = 0;
while (_local5 < _local6) {
if (_arg1[_local5].clip == _arg2){
_arg1[_local5].dests[_arg3] = _arg4;
return;
};
_local5++;
};
}
public static function updateScaleX(_arg1:Object, _arg2:Point, _arg3:Matrix, _arg4:Array, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number){
var _local10:Rectangle;
var _local11:Number;
_local10 = _arg1.clip.getBounds(_arg1.topLevel);
_local11 = (_local10.right - _local10.left);
_arg4[0] = (_arg4[0] + ((-(_arg9) * (_arg2.x - _arg1.position.x)) / _local11));
balancePoint(_arg4, _arg5, _arg6, _arg7, _arg8);
_arg3.a = _arg4[0];
}
public static function updateScaleY(_arg1:Object, _arg2:Point, _arg3:Matrix, _arg4:Array, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number){
var _local10:Rectangle;
var _local11:Number;
_local10 = _arg1.clip.getBounds(_arg1.topLevel);
_local11 = (_local10.bottom - _local10.top);
_arg4[0] = (_arg4[0] + ((-(_arg9) * (_arg2.y - _arg1.position.y)) / _local11));
balancePoint(_arg4, _arg5, _arg6, _arg7, _arg8);
_arg3.d = _arg4[0];
}
public static function updateElasticClip(_arg1:Object){
var _local2:int;
var _local3:Array;
var _local4:int;
var _local5:Point;
var _local6:String;
var _local7:Matrix;
_local3 = _arg1.props;
_local4 = _local3.length;
_local5 = _arg1.clip.localToGlobal(new Point());
_local5 = _arg1.topLevel.globalToLocal(_local5);
_local7 = _arg1.clip.transform.matrix;
_local2 = 0;
while (_local2 < _local4) {
_local6 = _local3[_local2];
switch (_local6){
case SKEWX_PROP:
updateSkewX(_arg1, _local5, _local7, _arg1.values[_local2], _arg1.frictions[_local2], _arg1.dests[_local2], _arg1.multipliers[_local2], _arg1.speeds[_local2], _arg1.scales[_local2]);
break;
case SKEWY_PROP:
updateSkewY(_arg1, _local5, _local7, _arg1.values[_local2], _arg1.frictions[_local2], _arg1.dests[_local2], _arg1.multipliers[_local2], _arg1.speeds[_local2], _arg1.scales[_local2]);
break;
case SCALEX_PROP:
updateScaleX(_arg1, _local5, _local7, _arg1.values[_local2], _arg1.frictions[_local2], _arg1.dests[_local2], _arg1.multipliers[_local2], _arg1.speeds[_local2], _arg1.scales[_local2]);
break;
case SCALEY_PROP:
updateScaleY(_arg1, _local5, _local7, _arg1.values[_local2], _arg1.frictions[_local2], _arg1.dests[_local2], _arg1.multipliers[_local2], _arg1.speeds[_local2], _arg1.scales[_local2]);
break;
};
_local2++;
};
_arg1.clip.transform.matrix = _local7;
_arg1.position = _local5;
}
}
}//package as3
Section 4
//SoftBlob (as3.SoftBlob)
package as3 {
import flash.display.*;
import flash.geom.*;
import flash.events.*;
public class SoftBlob extends Sprite {
private var _points:Array;
private var _darkAlpha:Number;
private var _darkColor:uint;
private var _light:Shape;
private var _blobRadius:Number;
private var _normalizedBasePoints:Array;
private var _lineAlpha:Number;
private var _lineColor:uint;
private var _friction:Number;
private var _lineCaps:String;
private var _coverRotation:Number;
private var _deformFactor:Number;
private var _blobYRadius:Number;
private var _dark:Shape;
private var _blobPoints:Array;
private var _lightFlatness:Number;
private var _coverYRadius:Number;
private var _blobEggFactor:Number;
private var _baseYRadius:Number;
private var _topLevel:DisplayObject;
private var _coverY:Number;
private var _coverX:Number;
private var _basePoints:Array;
private var _cover:Shape;
private var _darkFlatness:Number;
private var _lineScaleMode:String;
private var _lineMiterLimit:Number;
private var _averageDistance:Number;
private var _destX:Number;
private var _lightAngle:Number;
private var _destY:Number;
private var _gravityAngle:Number;
private var _linePixelHinting:Boolean;
private var _numBlobPoints:int;
private var _lightDistance:Number;
private var _numBasePoints:int;
private var _lightSin:Number;
private var _darkRadius:Number;
private var _speed:int;
private var _coverXRadius:Number;
private var _baseXRadius:Number;
private var _darkDistance:Number;
private var _multiplier:Number;
private var _blobXRadius:Number;
private var _coverRadius:Number;
private var _lightAlpha:Number;
private var _lightRadius:Number;
private var _baseAlpha:Number;
private var _baseColor:uint;
private var _lightColor:uint;
private var _masked:Sprite;
private var _base:Shape;
private var _mask:Shape;
private var _bounceFactor:Number;
private var _lineJoints:String;
private var _lineThickness:Number;
private var _baseEggFactor:Number;
private var _oldY:Number;
private var _lightCos:Number;
private var _x:Array;
private var _y:Array;
private var _oldX:Number;
private static const RAD_TO_DEG:Number = 57.2957795130823;
public function SoftBlob(_arg1:uint, _arg2:uint){
var _local3:int;
var _local4:Number;
var _local5:Number;
super();
_cover = new Shape();
_base = new Shape();
_dark = new Shape();
_light = new Shape();
_mask = new Shape();
_masked = new Sprite();
_masked.addChild(_base);
_masked.addChild(_light);
_masked.mask = _mask;
addChild(_dark);
addChild(_cover);
addChild(_masked);
addChild(_mask);
_x = [0, 0, 0];
_y = [0, 0, 0];
_numBasePoints = _arg1;
_numBlobPoints = _arg2;
_blobPoints = new Array(_numBlobPoints);
_basePoints = new Array(_numBasePoints);
_normalizedBasePoints = new Array(_numBasePoints);
_local5 = ((Math.PI * 2) / _numBlobPoints);
_local4 = 0;
_local3 = 0;
while (_local3 < _numBlobPoints) {
_blobPoints[_local3] = new Point();
_local4 = (_local4 + _local5);
_local3++;
};
_local5 = ((Math.PI * 2) / _numBasePoints);
_local4 = 0;
_local3 = 0;
while (_local3 < _numBasePoints) {
_basePoints[_local3] = new Point();
_normalizedBasePoints[_local3] = new Point(Math.cos(_local4), Math.sin(_local4));
_local4 = (_local4 + _local5);
_local3++;
};
_points = _basePoints.concat(_blobPoints);
_oldX = (_oldY = 0);
_destX = (_destY = 0);
_lightColor = 0xFFFFFF;
_baseColor = 0xCCCCCC;
_darkColor = 0x999999;
_lightAlpha = (_baseAlpha = (_darkAlpha = 1));
_lineThickness = 1;
_lineColor = 0;
_lineAlpha = 1;
_linePixelHinting = false;
_lineScaleMode = LineScaleMode.NORMAL;
_lineCaps = null;
_lineJoints = null;
_lineMiterLimit = 3;
_lightAngle = (-(Math.PI) * 0.75);
_lightRadius = 0;
_lightDistance = 0;
_lightFlatness = 1;
_darkRadius = 0;
_darkDistance = 0;
_darkFlatness = 1;
_lightCos = Math.cos(_lightAngle);
_lightSin = Math.sin(_lightAngle);
_baseXRadius = (_baseYRadius = 1);
_baseEggFactor = 1;
_blobRadius = (_blobXRadius = (_blobYRadius = 1));
_blobEggFactor = 1;
_coverX = (_coverY = 0);
_coverRadius = (_coverXRadius = (_coverYRadius = 0));
_coverRotation = 0;
_topLevel = null;
_friction = 0.5;
_multiplier = 0.5;
_speed = 1;
_bounceFactor = 1;
_deformFactor = 0.5;
_gravityAngle = (Math.PI * 0.5);
_averageDistance = 0;
updateBasePoints();
updateBlobPoints();
lightColor = _lightColor;
baseColor = _baseColor;
darkColor = _darkColor;
updateLight();
updateDark();
updateCover();
addEventListener(Event.ADDED_TO_STAGE, addedToStage, false, 0, true);
addEventListener(Event.REMOVED_FROM_STAGE, removedFromStage, false, 0, true);
}
private function updateDark(){
_base.x = ((_x[0] + ((_x[1] * _deformFactor) * 0.5)) + (_lightCos * _darkDistance));
_base.y = ((_y[0] + ((_y[1] * _deformFactor) * 0.5)) + (_lightSin * _darkDistance));
_base.scaleX = (_darkFlatness * _darkRadius);
_base.scaleY = _darkRadius;
_base.rotation = (_lightAngle * RAD_TO_DEG);
}
public function set friction(_arg1:Number){
_friction = (isNaN(_arg1)) ? 0 : _arg1;
}
public function get destY():Number{
return (_destY);
}
public function set lineCaps(_arg1:String){
_lineCaps = _arg1;
}
public function set baseAlpha(_arg1:Number){
var _local2:Graphics;
_baseAlpha = _arg1;
_local2 = _base.graphics;
_local2.clear();
_local2.beginFill(_baseColor, _baseAlpha);
_local2.drawCircle(0, 0, 1);
_local2.endFill();
}
public function set bounceFactor(_arg1:Number){
_bounceFactor = ((_arg1)<0) ? 0 : _arg1;
}
public function get blobYRadius():Number{
return (_blobYRadius);
}
public function set baseColor(_arg1:uint){
var _local2:Graphics;
_baseColor = _arg1;
_local2 = _base.graphics;
_local2.clear();
_local2.beginFill(_baseColor, _baseAlpha);
_local2.drawCircle(0, 0, 1);
_local2.endFill();
}
public function set baseXRadius(_arg1:Number){
_baseXRadius = (isNaN(_arg1)) ? 0 : _arg1;
updateBasePoints();
}
public function set blobYRadius(_arg1:Number){
_blobYRadius = (isNaN(_arg1)) ? 0 : _arg1;
_blobRadius = ((_blobXRadius + _blobYRadius) * 0.5);
}
public function hitTestBlob(_arg1:Number, _arg2:Number):Boolean{
var _local3:Point;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
_local3 = globalToLocal(new Point(_arg1, _arg2));
_local4 = (_destX - _x[0]);
_local5 = (_destY - _y[0]);
_local6 = _x[1];
_local7 = _y[1];
_local8 = Math.atan2(_local7, _local6);
_local9 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
_local10 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
_local11 = ((_deformFactor * (_local10 - _local9)) / _blobRadius);
if (_local11 > _deformFactor){
_local11 = _deformFactor;
};
if (_local11 < -(_deformFactor)){
_local11 = -(_deformFactor);
};
_local3.x = (_local3.x - _x[0]);
_local3.y = (_local3.y - _y[0]);
_local3.x = (_local3.x / _blobXRadius);
_local3.y = (_local3.y / _blobYRadius);
_local3.x = (_local3.x / (1 + ((1 - _blobEggFactor) * _local3.y)));
return (pointWithinEllipse(_local3, 0, 0, (1 - _local11), (1 + _local11), _local8));
}
public function get lineJoints():String{
return (_lineJoints);
}
private function addedToStage(_arg1:Event){
var _local2:Point;
if (!_topLevel){
_topLevel = stage;
};
_local2 = _topLevel.globalToLocal(localToGlobal(new Point()));
_oldX = _local2.x;
_oldY = _local2.y;
}
public function set coverRadius(_arg1:Number){
_coverRadius = (_coverXRadius = (_coverYRadius = (isNaN(_arg1)) ? 0 : _arg1));
updateCover();
}
public function get speed():int{
return (_speed);
}
public function get baseYRadius():Number{
return (_baseYRadius);
}
public function set lightDistance(_arg1:Number){
_lightDistance = (isNaN(_arg1)) ? 0 : _arg1;
updateLight();
}
public function set averageDistance(_arg1:Number){
_averageDistance = (isNaN(_arg1)) ? 0 : _arg1;
_destX = (Math.cos(_gravityAngle) * _averageDistance);
_destY = (Math.sin(_gravityAngle) * _averageDistance);
}
private function updateCover(){
var _local1:Graphics;
_local1 = _cover.graphics;
_cover.x = _coverX;
_cover.y = _coverY;
_cover.rotation = _coverRotation;
_cover.scaleX = _coverXRadius;
_cover.scaleY = _coverYRadius;
}
public function stabilize(){
_x[0] = _destX;
_x[1] = (_x[2] = 0);
_y[0] = _destY;
_y[1] = (_y[2] = 0);
_oldX = x;
_oldY = y;
update(null);
}
public function get deformFactor():Number{
return (_deformFactor);
}
public function get coverRotation():Number{
return (_coverRotation);
}
public function get lineScaleMode():String{
return (_lineScaleMode);
}
public function set gravityAngle(_arg1:Number){
_gravityAngle = (isNaN(_arg1)) ? 0 : _arg1;
_destX = (Math.cos(_gravityAngle) * _averageDistance);
_destY = (Math.sin(_gravityAngle) * _averageDistance);
}
public function get lightFlatness():Number{
return (_lightFlatness);
}
public function get blobRadius():Number{
return (_blobRadius);
}
public function get blobEggFactor():Number{
return (_blobEggFactor);
}
public function set lightRadius(_arg1:Number){
_lightRadius = (isNaN(_arg1)) ? 0 : _arg1;
updateLight();
}
public function get linePixelHinting():Boolean{
return (_linePixelHinting);
}
private function updateBlobPoints(){
var _local1:int;
var _local2:Point;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local3 = (_destX - _x[0]);
_local4 = (_destY - _y[0]);
_local5 = _x[1];
_local6 = _y[1];
_local7 = Math.atan2(_local6, _local5);
_local8 = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
_local9 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
_local10 = ((_deformFactor * (_local9 - _local8)) / _blobRadius);
if (_local10 > _deformFactor){
_local10 = _deformFactor;
};
if (_local10 < -(_deformFactor)){
_local10 = -(_deformFactor);
};
mapPointsToEllipse(_blobPoints, _numBlobPoints, 0, (Math.PI * 2), 0, 0, (1 - _local10), (1 + _local10), _local7);
_local1 = 0;
while (_local1 < _numBlobPoints) {
_local2 = _blobPoints[_local1];
_local2.x = (_x[0] + ((_local2.x * _blobXRadius) * (1 + ((1 - _blobEggFactor) * _local2.y))));
_local2.y = (_y[0] + (_local2.y * _blobYRadius));
_local1++;
};
}
public function set speed(_arg1:int){
_speed = ((_arg1)<0) ? 0 : _arg1;
}
public function set lightAngle(_arg1:Number){
_lightAngle = (isNaN(_arg1)) ? 0 : _arg1;
_lightCos = Math.cos(_lightAngle);
_lightSin = Math.sin(_lightAngle);
updateLight();
updateDark();
}
private function updateBasePoints(){
var _local1:int;
var _local2:Point;
var _local3:Point;
_local1 = 0;
while (_local1 < _numBasePoints) {
_local2 = _basePoints[_local1];
_local3 = _normalizedBasePoints[_local1];
_local2.x = ((_local3.x * _baseXRadius) * (1 + ((1 - _baseEggFactor) * _local3.y)));
_local2.y = (_local3.y * _baseYRadius);
_local1++;
};
}
public function set topLevel(_arg1:DisplayObject){
var _local2:Point;
_topLevel = _arg1;
_local2 = _topLevel.globalToLocal(localToGlobal(new Point()));
_oldX = _local2.x;
_oldY = _local2.y;
}
public function set coverRotation(_arg1:Number){
_coverRotation = (isNaN(_arg1)) ? 0 : _arg1;
updateCover();
}
public function get coverYRadius():Number{
return (_coverYRadius);
}
public function update(_arg1:Event=null){
var _local2:Point;
_local2 = _topLevel.globalToLocal(localToGlobal(new Point()));
_x[0] = (_x[0] - ((_local2.x - _oldX) * _bounceFactor));
_y[0] = (_y[0] - ((_local2.y - _oldY) * _bounceFactor));
_oldX = _local2.x;
_oldY = _local2.y;
Physics.balancePoint(_x, _friction, _destX, _multiplier, _speed);
Physics.balancePoint(_y, _friction, _destY, _multiplier, _speed);
updateBlobPoints();
}
public function get lineMiterLimit():Number{
return (_lineMiterLimit);
}
public function set baseYRadius(_arg1:Number){
_baseYRadius = (isNaN(_arg1)) ? 0 : _arg1;
updateBasePoints();
}
public function get blobXRadius():Number{
return (_blobXRadius);
}
public function set lineJoints(_arg1:String){
_lineJoints = _arg1;
}
public function get darkFlatness():Number{
return (_darkFlatness);
}
public function set deformFactor(_arg1:Number){
_deformFactor = ((_arg1)<0) ? 0 : _arg1;
}
public function get points():Array{
return (_blobPoints);
}
public function set coverXRadius(_arg1:Number){
_coverXRadius = (isNaN(_arg1)) ? 0 : _arg1;
_coverRadius = ((_coverXRadius + _coverYRadius) * 0.5);
updateCover();
}
public function get lineCaps():String{
return (_lineCaps);
}
public function set lineScaleMode(_arg1:String){
_lineScaleMode = _arg1;
}
public function get friction():Number{
return (_friction);
}
public function get yValues():Array{
return (_y);
}
public function get numBlobPoints():int{
return (_numBlobPoints);
}
public function set coverX(_arg1:Number){
_coverX = (isNaN(_arg1)) ? 0 : _arg1;
updateCover();
}
public function get baseAlpha():Number{
return (_baseAlpha);
}
public function set darkAlpha(_arg1:Number){
var _local2:Graphics;
_darkAlpha = _arg1;
_local2 = _cover.graphics;
_local2.clear();
_local2.beginFill(_darkColor, _baseAlpha);
_local2.drawCircle(0, 0, 1);
_local2.endFill();
}
public function set lightFlatness(_arg1:Number){
_lightFlatness = (isNaN(_arg1)) ? 0 : _arg1;
updateLight();
}
public function get baseColor():uint{
return (_baseColor);
}
public function set darkColor(_arg1:uint){
var _local2:Graphics;
_darkColor = _arg1;
_local2 = _cover.graphics;
_local2.clear();
_local2.beginFill(_darkColor, _baseAlpha);
_local2.drawCircle(0, 0, 1);
_local2.endFill();
}
public function set blobRadius(_arg1:Number){
_blobRadius = (_blobXRadius = (_blobYRadius = (isNaN(_arg1)) ? 0 : _arg1));
}
public function get baseXRadius():Number{
return (_baseXRadius);
}
public function get gravityAngle():Number{
return (_gravityAngle);
}
public function get coverRadius():Number{
return (_coverRadius);
}
public function get lightDistance():Number{
return (_lightDistance);
}
public function set darkDistance(_arg1:Number){
_darkDistance = (isNaN(_arg1)) ? 0 : _arg1;
updateDark();
}
public function get topLevel():DisplayObject{
return (_topLevel);
}
public function set coverY(_arg1:Number){
_coverY = (isNaN(_arg1)) ? 0 : _arg1;
updateCover();
}
public function get averageDistance():Number{
return (_averageDistance);
}
public function set blobEggFactor(_arg1:Number){
_blobEggFactor = (isNaN(_arg1)) ? 0 : _arg1;
}
public function draw(_arg1:Event=null){
var _local2:Array;
var _local3:Graphics;
var _local4:Number;
var _local5:Number;
_local2 = Geometry.getOuterPoints(_points);
_local2[_local2.length] = _local2[0];
_local4 = _local2[0].x;
_local5 = _local2[0].y;
_local3 = _dark.graphics;
_local3.clear();
_local3.lineStyle(_lineThickness, _lineColor, _lineAlpha, _linePixelHinting, _lineScaleMode, _lineCaps, _lineJoints, _lineMiterLimit);
_local3.beginFill(_darkColor, _darkAlpha);
_local3.moveTo(_local4, _local5);
Drawing.drawCurvyLine(_local3, _local2[(_local2.length - 1)], _local2, _local2[0]);
_local3.endFill();
_local3 = _mask.graphics;
_local3.clear();
_local3.beginFill(0, 1);
_local3.moveTo(_local4, _local5);
Drawing.drawCurvyLine(_local3, _local2[(_local2.length - 1)], _local2, _local2[0]);
_local3.endFill();
updateLight();
updateDark();
}
public function get numBasePoints():int{
return (_numBasePoints);
}
public function set darkRadius(_arg1:Number){
_darkRadius = (isNaN(_arg1)) ? 0 : _arg1;
updateDark();
}
public function get lightRadius():Number{
return (_lightRadius);
}
public function set linePixelHinting(_arg1:Boolean){
_linePixelHinting = _arg1;
}
public function get lightAngle():Number{
return (_lightAngle);
}
public function clone():SoftBlob{
var _local1:SoftBlob;
_local1 = new SoftBlob(_numBasePoints, _numBlobPoints);
_local1.lightColor = _lightColor;
_local1.baseColor = _baseColor;
_local1.darkColor = _darkColor;
_local1.lightAlpha = _lightAlpha;
_local1.baseAlpha = _baseAlpha;
_local1.darkAlpha = _darkAlpha;
_local1.lineThickness = _lineThickness;
_local1.lineColor = _lineColor;
_local1.lineAlpha = _lineAlpha;
_local1.linePixelHinting = _linePixelHinting;
_local1.lineScaleMode = _lineScaleMode;
_local1.lineCaps = _lineCaps;
_local1.lineJoints = _lineJoints;
_local1.lineMiterLimit = _lineMiterLimit;
_local1.lightAngle = _lightAngle;
_local1.lightRadius = _lightRadius;
_local1.lightDistance = _lightDistance;
_local1.lightFlatness = _lightFlatness;
_local1.darkRadius = _darkRadius;
_local1.darkDistance = _darkDistance;
_local1.darkFlatness = _darkFlatness;
_local1.baseXRadius = _baseXRadius;
_local1.baseYRadius = _baseYRadius;
_local1.blobXRadius = _blobXRadius;
_local1.blobYRadius = _blobYRadius;
_local1.blobEggFactor = _blobEggFactor;
_local1.coverX = _coverX;
_local1.coverY = _coverY;
_local1.coverXRadius = _coverXRadius;
_local1.coverYRadius = _coverYRadius;
_local1.coverRotation = _coverRotation;
_local1.topLevel = _topLevel;
_local1.friction = _friction;
_local1.multiplier = _multiplier;
_local1.speed = _speed;
_local1.bounceFactor = _bounceFactor;
_local1.deformFactor = _deformFactor;
_local1.gravityAngle = _gravityAngle;
_local1.averageDistance = _averageDistance;
_local1.updateBasePoints();
_local1.updateBlobPoints();
return (_local1);
}
public function get coverXRadius():Number{
return (_coverXRadius);
}
public function set coverYRadius(_arg1:Number){
_coverYRadius = (isNaN(_arg1)) ? 0 : _arg1;
_coverRadius = ((_coverXRadius + _coverYRadius) * 0.5);
updateCover();
}
private function removedFromStage(_arg1:Event){
}
public function get coverX():Number{
return (_coverX);
}
public function get coverY():Number{
return (_coverY);
}
public function get darkDistance():Number{
return (_darkDistance);
}
public function get darkAlpha():Number{
return (_darkAlpha);
}
public function set multiplier(_arg1:Number){
_multiplier = (isNaN(_arg1)) ? 0 : _arg1;
}
public function set baseRadius(_arg1:Number){
_baseXRadius = (_baseYRadius = (isNaN(_arg1)) ? 0 : _arg1);
updateBasePoints();
}
public function get darkColor():uint{
return (_darkColor);
}
public function set lineColor(_arg1:uint){
_lineColor = _arg1;
}
public function set blobXRadius(_arg1:Number){
_blobXRadius = (isNaN(_arg1)) ? 0 : _arg1;
_blobRadius = ((_blobXRadius + _blobYRadius) * 0.5);
}
public function get darkRadius():Number{
return (_darkRadius);
}
public function set lineAlpha(_arg1:Number){
_lineAlpha = ((((_arg1 < 0)) || (isNaN(_arg1)))) ? 0 : _arg1;
}
public function get cover():Shape{
return (_cover);
}
public function get xValues():Array{
return (_x);
}
public function set lineThickness(_arg1:Number){
_lineThickness = ((((_arg1 < 0)) || (isNaN(_arg1)))) ? 0 : _arg1;
}
public function get multiplier():Number{
return (_multiplier);
}
public function get lineAlpha():Number{
return (_lineAlpha);
}
public function set darkFlatness(_arg1:Number){
_darkFlatness = (isNaN(_arg1)) ? 0 : _arg1;
updateDark();
}
public function set lineMiterLimit(_arg1:Number){
_lineMiterLimit = ((((_arg1 < 0)) || (isNaN(_arg1)))) ? 0 : _arg1;
}
public function get lineColor():uint{
return (_lineColor);
}
public function set lightAlpha(_arg1:Number){
var _local2:Graphics;
_lightAlpha = _arg1;
_local2 = _light.graphics;
_local2.clear();
_local2.beginFill(_lightColor, _lightAlpha);
_local2.drawCircle(0, 0, 1);
_local2.endFill();
}
private function updateLight(){
_light.x = ((_x[0] + (_x[1] * _deformFactor)) + (_lightCos * _lightDistance));
_light.y = ((_y[0] + (_y[1] * _deformFactor)) + (_lightSin * _lightDistance));
_light.scaleX = (_lightFlatness * _lightRadius);
_light.scaleY = _lightRadius;
_light.rotation = (_lightAngle * RAD_TO_DEG);
}
public function set baseEggFactor(_arg1:Number){
_baseEggFactor = (isNaN(_arg1)) ? 0 : _arg1;
updateBasePoints();
}
public function set lightColor(_arg1:uint){
var _local2:Graphics;
_lightColor = _arg1;
_local2 = _light.graphics;
_local2.clear();
_local2.beginFill(_lightColor, _lightAlpha);
_local2.drawCircle(0, 0, 1);
_local2.endFill();
}
public function get baseEggFactor():Number{
return (_baseEggFactor);
}
public function get lightAlpha():Number{
return (_lightAlpha);
}
public function get lightColor():uint{
return (_lightColor);
}
public function get lineThickness():Number{
return (_lineThickness);
}
public function get destX():Number{
return (_destX);
}
public function get bounceFactor():Number{
return (_bounceFactor);
}
public static function getEllipsePointFromAngle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Point{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
_local5 = (_arg2 * _arg2);
_local6 = (_arg3 * _arg3);
_arg1 = (_arg1 - _arg4);
_local7 = Math.tan(_arg1);
_local8 = (Math.tan(_arg1) * _local7);
_local9 = (_arg2 * _arg3);
_local10 = (1 / Math.sqrt((_local6 + (_local5 * _local8))));
_local11 = (_local9 * _local10);
_local12 = ((_local9 * _local7) * _local10);
if (Math.cos(_arg1) >= 0){
return (new Point(_local11, _local12));
};
return (new Point(-(_local11), -(_local12)));
}
public static function pointWithinEllipse(_arg1:Point, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Boolean{
var _local7:Point;
var _local8:Point;
var _local9:Number;
var _local10:Number;
_local7 = new Point((_arg1.x - _arg2), (_arg1.y - _arg3));
_local8 = rotate(_arg6, _local7);
_local9 = (_arg4 / _arg5);
_local8.x = (_local8.x * _local9);
_local10 = Math.sqrt(((_local8.x * _local8.x) + (_local8.y * _local8.y)));
if (_local10 <= _arg4){
return (true);
};
return (false);
}
public static function mapPointsToEllipse(_arg1:Array, _arg2:int, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8, _arg9:Number):Array{
var _local10:Number;
var _local11:Number;
var _local12:int;
var _local13:Point;
var _local14:Point;
if (!_arg1){
_arg1 = [];
};
_local10 = (_arg4 / _arg2);
_local11 = _arg3;
_local12 = 0;
while (_local12 < _arg2) {
_local14 = getEllipsePointFromAngle(_local11, _arg7, _arg8, _arg9);
_local14 = rotate(_arg9, _local14);
_local13 = _arg1[_local12];
if (_local13){
_local13.x = (_arg5 + _local14.x);
_local13.y = (_arg6 + _local14.y);
} else {
_arg1[_local12] = new Point((_arg5 + _local14.x), (_arg6 + _local14.y));
};
_local11 = (_local11 + _local10);
_local12++;
};
return (_arg1);
}
public static function intersectEllipses(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number, _arg11:int=100):Array{
var _local12:Array;
var _local13:Array;
var _local14:Array;
_local12 = mapPointsToEllipse(null, _arg11, 0, (Math.PI * 2), _arg1, _arg2, _arg3, _arg4, _arg5);
_local13 = mapPointsToEllipse(null, _arg11, 0, (Math.PI * 2), _arg6, _arg7, _arg8, _arg9, _arg10);
_local14 = Geometry.intersectPolygons(_local12, _local13);
return (_local14);
}
public static function rotate(_arg1:Number, _arg2:Point, _arg3:Point=null){
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
if (!_arg3){
_arg3 = new Point();
};
_local4 = (_arg2.x - _arg3.x);
_local5 = (_arg2.y - _arg3.y);
_local6 = Math.cos(_arg1);
_local7 = Math.sin(_arg1);
return (new Point(((_arg3.x + (_local4 * _local6)) - (_local5 * _local7)), ((_arg3.y + (_local4 * _local7)) + (_local5 * _local6))));
}
public static function joinEllipses(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:int, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number, _arg11:Number, _arg12:int):Array{
var _local13:Point;
var _local14:Number;
var _local15:Number;
var _local16:Point;
var _local17:Point;
var _local18:Array;
var _local19:Array;
_local13 = Point.interpolate(new Point(_arg1, _arg2), new Point(_arg7, _arg8), 0.5);
_local14 = ((((_arg3 + _arg9) + _arg4) + _arg10) * 0.25);
_local15 = (Math.atan2((_arg8 - _arg2), (_arg7 - _arg1)) - (Math.PI * 0.5));
_local16 = new Point((_local13.x + (Math.cos(_local15) * _local14)), (_local13.y + (Math.sin(_local15) * _local14)));
_local17 = new Point((_local13.x - (Math.cos(_local15) * _local14)), (_local13.y - (Math.sin(_local15) * _local14)));
_local18 = mapPointsToEllipse(null, _arg6, (_local15 + Math.PI), Math.PI, _arg1, _arg2, _arg3, _arg4, _arg5);
_local19 = mapPointsToEllipse(null, _arg12, _local15, Math.PI, _arg7, _arg8, _arg9, _arg10, _arg11);
if (((((((pointWithinEllipse(_local16, _arg1, _arg2, _arg3, _arg4, _arg5)) || (pointWithinEllipse(_local17, _arg1, _arg2, _arg3, _arg4, _arg5)))) || (pointWithinEllipse(_local16, _arg7, _arg8, _arg9, _arg10, _arg11)))) || (pointWithinEllipse(_local17, _arg7, _arg8, _arg9, _arg10, _arg11)))){
return (Geometry.getOuterPoints(_local18.concat(_local19)));
};
_local18[_local18.length] = _local16;
_local19[_local19.length] = _local17;
_local19[_local19.length] = _local18[0];
return (_local18.concat(_local19));
}
}
}//package as3
Section 5
//SoftBlobContainer (as3.SoftBlobContainer)
package as3 {
import flash.geom.*;
import flash.utils.*;
public class SoftBlobContainer {
private var _interactions:Dictionary;
public function SoftBlobContainer(){
_interactions = new Dictionary();
}
public function setFlattenFactors(_arg1:SoftBlob, _arg2:SoftBlob, _arg3:Number, _arg4:Number){
var _local5:Dictionary;
var _local6:Object;
_local5 = _interactions[_arg1];
if (_local5){
_local6 = _local5[_arg2];
if (_local6){
_local6.flattenFactor1 = _arg3;
_local6.flattenFactor2 = _arg4;
};
} else {
_local5 = _interactions[_arg2];
if (_local5){
_local6 = _local5[_arg1];
if (_local6){
_local6.flattenFactor1 = _arg4;
_local6.flattenFactor2 = _arg3;
};
};
};
}
public function setPushFactors(_arg1:SoftBlob, _arg2:SoftBlob, _arg3:Number, _arg4:Number){
var _local5:Dictionary;
var _local6:Object;
_local5 = _interactions[_arg1];
if (_local5){
_local6 = _local5[_arg2];
if (_local6){
_local6.pushFactor1 = _arg3;
_local6.pushFactor2 = _arg4;
};
} else {
_local5 = _interactions[_arg2];
if (_local5){
_local6 = _local5[_arg1];
if (_local6){
_local6.pushFactor1 = _arg4;
_local6.pushFactor2 = _arg3;
};
};
};
}
public function update(){
var _local1:Dictionary;
var _local2:Object;
var _local3:Object;
var _local4:Object;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:SoftBlob;
var _local9:SoftBlob;
var _local10:Matrix;
var _local11:Matrix;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Array;
var _local17:Array;
var _local18:Array;
var _local19:Object;
var _local20:Point;
var _local21:Point;
var _local22:Point;
var _local23:Point;
var _local24:Point;
var _local25:Point;
var _local26:Point;
var _local27:Point;
var _local28:Point;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local40:Number;
var _local41:Array;
var _local42:Array;
var _local43:Array;
var _local44:Array;
var _local45:Array;
var _local46:Array;
var _local47:Number;
var _local48:Number;
var _local49:Number;
var _local50:Number;
var _local51:Number;
var _local52:Number;
_local16 = [];
_local17 = [];
for (_local3 in _interactions) {
_local8 = (_local3 as SoftBlob);
if (!_local8){
throw (("Expected SoftBlob, found " + _local3.constructor));
};
_local41 = _local8.xValues;
_local43 = _local8.yValues;
_local25 = _local8.localToGlobal(new Point(_local41[0], _local43[0]));
_local45 = _local8.points;
_local10 = _local8.transform.matrix;
_local1 = _interactions[_local3];
for (_local4 in _local1) {
_local9 = (_local4 as SoftBlob);
if (!_local9){
throw (("Expected SoftBlob, found " + _local3.constructor));
};
_local42 = _local9.xValues;
_local44 = _local9.yValues;
_local26 = _local9.localToGlobal(new Point(_local42[0], _local44[0]));
_local46 = _local9.points;
_local11 = _local9.transform.matrix;
_local2 = _local1[_local4];
_local13 = _local2.pushFactor1;
_local15 = _local2.pushFactor2;
_local12 = _local2.flattenFactor1;
_local14 = _local2.flattenFactor2;
_local16.length = (_local17.length = 0);
_local7 = _local8.numBlobPoints;
_local5 = 0;
while (_local5 < _local7) {
_local16[_local5] = _local8.localToGlobal(_local45[_local5]);
_local5++;
};
_local7 = _local9.numBlobPoints;
_local5 = 0;
while (_local5 < _local7) {
_local17[_local5] = _local9.localToGlobal(_local46[_local5]);
_local5++;
};
_local18 = Geometry.intersectPolygons(_local16, _local17);
_local7 = _local18.length;
if (_local18.length < 2){
} else {
_local21 = null;
_local20 = _local21;
_local30 = -1;
_local29 = _local30;
_local32 = (_local26.x - _local25.x);
_local33 = (_local26.y - _local25.y);
_local34 = Math.atan2(_local33, _local32);
_local35 = Math.sqrt(((_local32 * _local32) + (_local33 * _local33)));
_local38 = (_local25.x + _local35);
_local47 = ((((_local8.blobRadius * (_local10.a + _local10.d)) * 0.5) + ((_local9.blobRadius * (_local11.a + _local11.d)) * 0.5)) - _local35);
_local36 = (Math.sin(_local34) * _local47);
_local37 = (Math.cos(_local34) * _local47);
if (_local13){
_local41[1] = (_local41[1] - (_local37 * _local13));
_local43[1] = (_local43[1] - (_local36 * _local13));
};
if (_local15){
_local42[1] = (_local42[1] + (_local37 * _local15));
_local44[1] = (_local44[1] + (_local36 * _local15));
};
_local5 = 0;
while (_local5 < _local7) {
_local27 = SoftBlob.rotate(-(_local34), _local18[_local5], _local25);
_local31 = Math.abs((_local27.x - _local38));
if ((((_local31 < _local29)) || (!(_local20)))){
_local30 = _local29;
_local21 = _local20;
_local29 = _local31;
_local20 = _local18[_local5];
} else {
if ((((_local31 < _local30)) || (!(_local21)))){
_local30 = _local31;
_local21 = _local18[_local5];
};
};
_local5++;
};
_local23 = _local8.globalToLocal(_local20);
_local24 = _local8.globalToLocal(_local21);
_local7 = _local8.numBlobPoints;
_local39 = (_local23.x - _local24.x);
_local40 = (_local23.y - _local24.y);
if (Math.abs(_local39) > Math.abs(_local40)){
_local48 = (_local40 / _local39);
_local49 = -1;
_local50 = (_local23.y - (_local48 * _local23.x));
} else {
_local48 = -1;
_local49 = (_local39 / _local40);
_local50 = (_local23.x - (_local49 * _local23.y));
};
_local52 = (((_local48 * _local41[0]) + (_local49 * _local43[0])) + _local50);
_local5 = 0;
while (_local5 < _local7) {
_local22 = _local45[_local5];
_local19 = Geometry.projectPointOnLine(_local22.x, _local22.y, _local23.x, _local23.y, _local24.x, _local24.y);
_local27 = new Point(_local19.x, _local19.y);
_local51 = (((_local48 * _local22.x) + (_local49 * _local22.y)) + _local50);
if ((_local51 * _local52) < 0){
_local28 = Point.interpolate(_local22, _local27, (1 - _local12));
_local22.x = _local28.x;
_local22.y = _local28.y;
};
_local5++;
};
_local23 = _local9.globalToLocal(_local20);
_local24 = _local9.globalToLocal(_local21);
_local7 = _local9.numBlobPoints;
_local39 = (_local23.x - _local24.x);
_local40 = (_local23.y - _local24.y);
if (Math.abs(_local39) > Math.abs(_local40)){
_local48 = (_local40 / _local39);
_local49 = -1;
_local50 = (_local23.y - (_local48 * _local23.x));
} else {
_local48 = -1;
_local49 = (_local39 / _local40);
_local50 = (_local23.x - (_local49 * _local23.y));
};
_local52 = (((_local48 * _local42[0]) + (_local49 * _local44[0])) + _local50);
_local5 = 0;
while (_local5 < _local7) {
_local22 = _local46[_local5];
_local19 = Geometry.projectPointOnLine(_local22.x, _local22.y, _local23.x, _local23.y, _local24.x, _local24.y);
_local27 = new Point(_local19.x, _local19.y);
_local51 = (((_local48 * _local22.x) + (_local49 * _local22.y)) + _local50);
if ((_local51 * _local52) < 0){
_local28 = Point.interpolate(_local22, _local27, (1 - _local14));
_local22.x = _local28.x;
_local22.y = _local28.y;
};
_local5++;
};
};
};
};
}
public function setPushFactor(_arg1:SoftBlob, _arg2:SoftBlob, _arg3:Number){
var _local4:Dictionary;
var _local5:Object;
_local4 = _interactions[_arg1];
if (_local4){
_local5 = _local4[_arg2];
if (_local5){
_local5.pushFactor1 = _arg3;
};
} else {
_local4 = _interactions[_arg2];
if (_local4){
_local5 = _local4[_arg1];
if (_local5){
_local5.pushFactor2 = _arg3;
};
};
};
}
public function removeBlobInteraction(_arg1:SoftBlob, _arg2:SoftBlob){
var _local3:Object;
var _local4:Object;
var _local5:Dictionary;
var _local6:Object;
var _local7:Boolean;
_local7 = true;
_local5 = _interactions[_arg1];
if (_local5){
delete _local5[_arg2];
for (_local3 in _local5) {
_local7 = false;
break;
};
if (_local7){
delete _interactions[_arg1];
};
} else {
_local5 = _interactions[_arg2];
if (_local5){
delete _local5[_arg1];
for (_local3 in _local5) {
_local7 = false;
break;
};
if (_local7){
delete _interactions[_arg2];
};
};
};
}
public function addBlobInteraction(_arg1:SoftBlob, _arg2:Number, _arg3:Number, _arg4:SoftBlob, _arg5:Number, _arg6:Number){
var _local7:Dictionary;
var _local8:Object;
var _local9:SoftBlob;
if (_arg1 == _arg4){
return;
};
_local7 = _interactions[_arg1];
if (!_local7){
_local7 = _interactions[_arg4];
if (!_local7){
_local7 = (_interactions[_arg1] = new Dictionary());
_local9 = _arg4;
} else {
_local7 = _interactions[_arg4];
_local9 = _arg1;
};
} else {
_local7 = _interactions[_arg1];
_local9 = _arg4;
};
if (!_local7[_local9]){
_local8 = new Object();
_local7[_local9] = _local8;
};
if (_local9 == _arg4){
_local8["flattenFactor1"] = _arg2;
_local8["flattenFactor2"] = _arg5;
_local8["pushFactor1"] = _arg3;
_local8["pushFactor2"] = _arg6;
} else {
_local8["flattenFactor1"] = _arg5;
_local8["flattenFactor2"] = _arg2;
_local8["pushFactor1"] = _arg6;
_local8["pushFactor2"] = _arg3;
};
}
public function getFlattenFactors(_arg1:SoftBlob, _arg2:SoftBlob):Array{
var _local3:Dictionary;
var _local4:Object;
_local3 = _interactions[_arg1];
if (_local3){
_local4 = _local3[_arg2];
if (_local4){
return ([_local4.flattenFactor1, _local4.flattenFactor2]);
};
} else {
_local3 = _interactions[_arg2];
if (_local3){
_local4 = _local3[_arg1];
if (_local4){
return ([_local4.flattenFactor2, _local4.flattenFactor1]);
};
};
};
return ([]);
}
public function setFlattenFactor(_arg1:SoftBlob, _arg2:SoftBlob, _arg3:Number){
var _local4:Dictionary;
var _local5:Object;
_local4 = _interactions[_arg1];
if (_local4){
_local5 = _local4[_arg2];
if (_local5){
_local5.flattenFactor1 = _arg3;
};
} else {
_local4 = _interactions[_arg2];
if (_local4){
_local5 = _local4[_arg1];
if (_local5){
_local5.flattenFactor2 = _arg3;
};
};
};
}
public function get setBlobInteraction():Function{
return (addBlobInteraction);
}
public function getPushFactors(_arg1:SoftBlob, _arg2:SoftBlob):Array{
var _local3:Dictionary;
var _local4:Object;
_local3 = _interactions[_arg1];
if (_local3){
_local4 = _local3[_arg2];
if (_local4){
return ([_local4.pushFactor1, _local4.pushFactor2]);
};
} else {
_local3 = _interactions[_arg2];
if (_local3){
_local4 = _local3[_arg1];
if (_local4){
return ([_local4.pushFactor2, _local4.pushFactor1]);
};
};
};
return ([]);
}
public function getFlattenFactor(_arg1:SoftBlob, _arg2:SoftBlob):Number{
var _local3:Dictionary;
var _local4:Object;
_local3 = _interactions[_arg1];
if (_local3){
_local4 = _local3[_arg2];
if (_local4){
return (_local4.flattenFactor1);
};
} else {
_local3 = _interactions[_arg2];
if (_local3){
_local4 = _local3[_arg1];
if (_local4){
return (_local4.flattenFactor2);
};
};
};
return (NaN);
}
public function getPushFactor(_arg1:SoftBlob, _arg2:SoftBlob):Number{
var _local3:Dictionary;
var _local4:Object;
_local3 = _interactions[_arg1];
if (_local3){
_local4 = _local3[_arg2];
if (_local4){
return (_local4.pushFactor1);
};
} else {
_local3 = _interactions[_arg2];
if (_local3){
_local4 = _local3[_arg1];
if (_local4){
return (_local4.pushFactor2);
};
};
};
return (NaN);
}
}
}//package as3
Section 6
//_btn_20 (elvira_fla._btn_20)
package elvira_fla {
import flash.display.*;
import flash.text.*;
public dynamic class _btn_20 extends MovieClip {
public var _txt:TextField;
}
}//package elvira_fla
Section 7
//eye1_10 (elvira_fla.eye1_10)
package elvira_fla {
import flash.display.*;
public dynamic class eye1_10 extends MovieClip {
public var pupil:MovieClip;
public function eye1_10(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package elvira_fla
Section 8
//eye2_7 (elvira_fla.eye2_7)
package elvira_fla {
import flash.display.*;
public dynamic class eye2_7 extends MovieClip {
public var pupil:MovieClip;
public function eye2_7(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package elvira_fla
Section 9
//head_6 (elvira_fla.head_6)
package elvira_fla {
import flash.display.*;
public dynamic class head_6 extends MovieClip {
public function head_6(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package elvira_fla
Section 10
//MainTimeline (elvira_fla.MainTimeline)
package elvira_fla {
import as3.*;
import flash.display.*;
import flash.geom.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.media.*;
import flash.net.*;
import flash.printing.*;
import flash.system.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public const STAGE_WIDTH:int = 600;
public const STAGE_HEIGHT:int = 500;
public var oldMX:int;
public var oldMY:int;
public var b1E:Object;
public var eye1:MovieClip;
public var eye2:MovieClip;
public var __IMPORTANT:String;
public var bodyGravity:Number;
public var ATTACH_LIST:Array;
public var BODY_VX:Number;
public var BODY_VY:Number;
public var hair1:MovieClip;
public var hair2:MovieClip;
public var hair3:MovieClip;
public var container:SoftBlobContainer;
public var h1E:Object;
public var p1X:Number;
public var p1Y:Number;
public var h2E:Object;
public var oldBX:Number;
public var mouth:MovieClip;
public var oldBY:Number;
public var p2X:Number;
public var p2Y:Number;
public var h3E:Object;
public var bodyX:Number;
public var bodyY:Number;
public var jumping:Boolean;
public var oldY:Number;
public var oldX:Number;
public var jump_mc:MovieClip;
public var dragging:Boolean;
public var arm1:MovieClip;
public var arm2:MovieClip;
public var info_txt:TextField;
public var softness_slider:MovieClip;
public var stageCover:MovieClip;
public var top1:MovieClip;
public var top2:MovieClip;
public var breast1:MovieClip;
public var breast2:MovieClip;
public var breastB:SoftBlob;
public var breastA:SoftBlob;
public var body:MovieClip;
public var deform_slider:MovieClip;
public var currentSlider:MovieClip;
public var bounciness_slider:MovieClip;
public var nose:MovieClip;
public var belly:SoftBlob;
public var head:MovieClip;
public var bodyVX:Number;
public var bodyVY:Number;
public var tightness_slider:MovieClip;
public var ELASTIC_LIST:Array;
public function MainTimeline(){
addFrameScript(0, frame1);
}
public function eFrame(_arg1:Event){
if (jumping){
body.y = (body.y + bodyVY);
body.x = (body.x + bodyVX);
bodyVY = (bodyVY + bodyGravity);
if (body.y > bodyY){
body.y = bodyY;
jumping = false;
eye1.gotoAndStop("medium");
eye2.gotoAndStop("medium");
eye1.pupil.y = p1Y;
eye2.pupil.y = p2Y;
eye1.pupil.x = p1X;
eye2.pupil.x = p2X;
mouth.gotoAndStop("closed");
head.gotoAndStop("closed");
bodyVY = 0;
bodyVX = 0;
};
};
Physics.updateAttached(ATTACH_LIST);
Physics.updateElastic(ELASTIC_LIST);
breastA.update();
breastB.update();
container.update();
breastA.draw();
breastB.draw();
}
public function bDown(_arg1){
oldMX = stage.mouseX;
oldMY = stage.mouseY;
oldBX = breastB.x;
oldBY = breastB.y;
stage.addEventListener("enterFrame", bFrame);
stage.addEventListener("mouseUp", bUp);
}
public function bFrame(_arg1){
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
if (breastA.hitTestBlob(stage.mouseX, stage.mouseY)){
_local2 = (breastA.mouseX - breastA.xValues[0]);
_local3 = (breastA.mouseY - breastA.yValues[0]);
_local4 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
_local5 = Math.atan2(_local3, _local2);
breastA.xValues[2] = (breastA.xValues[2] + ((-(Math.cos(_local5)) * _local4) * 10));
breastA.yValues[2] = (breastA.yValues[2] + ((-(Math.sin(_local5)) * _local4) * 10));
};
if (breastB.hitTestBlob(stage.mouseX, stage.mouseY)){
_local2 = (breastB.mouseX - breastB.xValues[0]);
_local3 = (breastB.mouseY - breastB.yValues[0]);
_local4 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
_local5 = Math.atan2(_local3, _local2);
breastB.xValues[2] = (breastB.xValues[2] + ((-(Math.cos(_local5)) * _local4) * 10));
breastB.yValues[2] = (breastB.yValues[2] + ((-(Math.sin(_local5)) * _local4) * 10));
};
}
public function updateFlattenFactor(){
container.setFlattenFactors(breastA, breastB, currentSlider.curValue, currentSlider.curValue);
}
public function startJumping(_arg1:Event){
if (jumping){
return;
};
jumping = true;
bodyVY = -(BODY_VY);
bodyVX = ((body.x)>bodyX) ? -(BODY_VX) : BODY_VX;
}
public function sliderMove(_arg1:MouseEvent){
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local2 = currentSlider.mouseX;
_local3 = currentSlider.bar.width;
_local4 = 0;
currentSlider.marker.x = Math.min(Math.max(_local2, _local4), _local3);
currentSlider.curValue = (currentSlider.min + ((currentSlider.marker.x / currentSlider.bar.width) * (currentSlider.max - currentSlider.min)));
currentSlider.value_txt.text = currentSlider.curValue.toFixed(currentSlider.prec);
if (currentSlider.move_fn){
currentSlider.move_fn();
};
}
function frame1(){
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
__IMPORTANT = "This is an experiment, don't download it. I disabled its use outside of Deviantart. \nIf you want to download this and post it all over the internet, please wait! You'll get your chance. \nJust wait until I make a proper breast physics animation and it won't have restrictions on it!";
if (new LocalConnection().domain.toLowerCase().indexOf("deviantart") < 0){
info_txt.text = "Elvira the raccoon.\nDrawn by Doom the wolf.";
info_txt.height = (info_txt.textHeight + 5);
info_txt.y = ((STAGE_HEIGHT - 5) - info_txt.height);
stage.addEventListener(Event.RESIZE, resize, false, 0, true);
stageCover = new MovieClip();
stage.addChild(stageCover);
stage.dispatchEvent(new Event(Event.RESIZE));
eye1.stop();
eye2.stop();
mouth.stop();
head.stop();
deform_slider.visible = (bounciness_slider.visible = (softness_slider.visible = (tightness_slider.visible = (jump_mc.visible = false))));
return;
};
info_txt.text = "Interactive breast physics experiment (incomplete).\nClick and drag on the breasts to rub.\nDrawn and programmed by by Doom the wolf.\nhttp://doom-the-wolf.deviantart.com";
breastA = new SoftBlob(30, 30);
container = new SoftBlobContainer();
breastA.x = (body.x - 20);
breastA.y = (body.y - 31.5);
breastA.blobRadius = 80;
breastA.blobYRadius = 85;
breastA.baseRadius = 50;
breastA.baseYRadius = 50;
breastA.averageDistance = 70;
breastA.gravityAngle = (Math.PI * 0.51);
breastA.multiplier = 0.8;
breastA.friction = 0.2;
breastA.speed = 4;
breastA.deformFactor = 0.5;
breastA.coverRadius = (breastA.baseYRadius + 4);
breastA.coverXRadius = (breastA.baseXRadius + 1);
breastA.lightAngle = (-(Math.PI) * 0.6);
breastA.lightRadius = 50;
breastA.lightDistance = 40;
breastA.lightFlatness = 0.6;
breastA.lightColor = 0xCCCCCC;
breastA.darkRadius = 75;
breastA.darkDistance = 20;
breastA.darkFlatness = 0.9;
breastA.darkColor = 0xBBBBBB;
breastA.baseColor = 0xC4C4C4;
breast1.parent.addChildAt(breastA, breast1.parent.getChildIndex(breast1));
breastB = breastA.clone();
breastB.x = (body.x + 75);
breastB.y = breastA.y;
breastB.coverYRadius = (breastB.baseYRadius + 4);
breastB.coverXRadius = (breastB.baseXRadius + 1);
breastB.gravityAngle = (Math.PI * 0.4);
breast2.parent.addChildAt(breastB, (breast2.parent.getChildIndex(breast2) + 1));
breastA.name = "breastA";
breastB.name = "breastB";
container.addBlobInteraction(breastA, 0.25, 0.5, breastB, 0.25, 0.5);
breastA.stabilize();
breastB.stabilize();
stage.addEventListener("mouseDown", bDown);
bodyVY = 0;
bodyVX = 0;
dragging = false;
bodyY = body.y;
bodyX = body.x;
bodyGravity = 14;
jumping = false;
p1X = eye1.pupil.x;
p2X = eye2.pupil.x;
p1Y = eye1.pupil.y;
p2Y = eye2.pupil.y;
ATTACH_LIST = [];
ELASTIC_LIST = [];
mouth.gotoAndStop("closed");
head.gotoAndStop("closed");
Physics.attach(ATTACH_LIST, top2, body);
Physics.attach(ATTACH_LIST, breast1, body);
Physics.attach(ATTACH_LIST, breast2, body);
Physics.attach(ATTACH_LIST, head, body);
Physics.attach(ATTACH_LIST, arm1, body);
Physics.attach(ATTACH_LIST, arm2, body);
Physics.attach(ATTACH_LIST, eye1, head, [Physics.ROTATION_PROP]);
Physics.attach(ATTACH_LIST, eye2, head, [Physics.ROTATION_PROP]);
Physics.attach(ATTACH_LIST, nose, head, [Physics.ROTATION_PROP]);
Physics.attach(ATTACH_LIST, mouth, head, [Physics.ROTATION_PROP]);
Physics.attach(ATTACH_LIST, hair1, head);
Physics.attach(ATTACH_LIST, hair2, head);
Physics.attach(ATTACH_LIST, hair3, head);
Physics.attach(ATTACH_LIST, top1, breast1);
Physics.attach(ATTACH_LIST, breastA, body);
Physics.attach(ATTACH_LIST, breastB, body);
b1E = [{type:Physics.SKEWX_PROP, friction:0.1, dest:0, mul:2, speed:2, scale:1}, {type:Physics.SCALEY_PROP, friction:0.2, dest:1, mul:0.8, speed:4, scale:1}];
h3E = [{type:Physics.SKEWX_PROP, friction:0.3, dest:0, mul:0.2, speed:8, scale:0.4}, {type:Physics.SCALEY_PROP, friction:0.1, dest:1, mul:0.3, speed:24, scale:0.4}];
h2E = [{type:Physics.SKEWX_PROP, friction:0.3, dest:0, mul:0.2, speed:8, scale:1}, {type:Physics.SKEWY_PROP, friction:0.3, dest:0, mul:0.1, speed:16, scale:1}];
h1E = [{type:Physics.SKEWX_PROP, friction:0.3, dest:0, mul:0.2, speed:8, scale:1}, {type:Physics.SKEWY_PROP, friction:0.3, dest:0, mul:0.1, speed:16, scale:1}];
Physics.setElastic(ELASTIC_LIST, stage, breast1, [b1E[0].type, b1E[1].type], [b1E[0].friction, b1E[1].friction], [b1E[0].dest, b1E[1].dest], [b1E[0].mul, b1E[1].mul], [b1E[0].speed, b1E[1].speed], [b1E[0].scale, b1E[1].scale]);
Physics.setElastic(ELASTIC_LIST, stage, breast2, [b1E[0].type, b1E[1].type], [b1E[0].friction, b1E[1].friction], [b1E[0].dest, b1E[1].dest], [b1E[0].mul, b1E[1].mul], [b1E[0].speed, b1E[1].speed], [b1E[0].scale, b1E[1].scale]);
Physics.setElastic(ELASTIC_LIST, stage, hair3, [h3E[0].type, h3E[1].type], [h3E[0].friction, h3E[1].friction], [h3E[0].dest, h3E[1].dest], [h3E[0].mul, h3E[1].mul], [h3E[0].speed, h3E[1].speed], [h3E[0].scale, h3E[1].scale]);
Physics.setElastic(ELASTIC_LIST, stage, hair2, [h2E[0].type, h2E[1].type], [h2E[0].friction, h2E[1].friction], [h2E[0].dest, h2E[1].dest], [h2E[0].mul, h2E[1].mul], [h2E[0].speed, h2E[1].speed], [h2E[0].scale, h2E[1].scale]);
Physics.setElastic(ELASTIC_LIST, stage, hair1, [h2E[0].type, h2E[1].type], [h2E[0].friction, h2E[1].friction], [h2E[0].dest, h2E[1].dest], [h2E[0].mul, h2E[1].mul], [h2E[0].speed, h2E[1].speed], [h2E[0].scale, h2E[1].scale]);
top1.visible = false;
top2.visible = false;
breast1.visible = false;
breast2.visible = false;
stage.addEventListener(Event.RESIZE, resize, false, 0, true);
stageCover = new MovieClip();
stage.addChild(stageCover);
stage.dispatchEvent(new Event(Event.RESIZE));
stage.addEventListener(Event.ENTER_FRAME, eFrame, false, -50, true);
body.addEventListener(MouseEvent.MOUSE_DOWN, mDown);
currentSlider = null;
makeSlider(deform_slider, "Jiggle", 0, 1, 2, updateDeformFactor, breastA.deformFactor);
makeSlider(bounciness_slider, "Bounciness", 0, 1, 2, updateBounceScale, breastA.bounceFactor);
makeSlider(tightness_slider, "Tightness", 0, 1, 2, updatePushFactor, container.getPushFactor(breastA, breastB));
makeSlider(softness_slider, "Softness", 0, 1, 2, updateFlattenFactor, container.getFlattenFactor(breastA, breastB));
jump_mc.addEventListener(MouseEvent.MOUSE_DOWN, startJumping);
jump_mc._txt.text = "Jump!";
BODY_VY = 42;
BODY_VX = (BODY_VY * 0.25);
}
public function makeSlider(_arg1:MovieClip, _arg2:String, _arg3:Number, _arg4:Number, _arg5:int, _arg6:Function, _arg7:Number=NaN){
_arg1.min = _arg3;
_arg1.max = _arg4;
_arg1.curValue = _arg1.min;
if (!isNaN(_arg7)){
_arg1.curValue = _arg7;
};
_arg1.prec = _arg5;
_arg1.move_fn = _arg6;
_arg1.marker.x = (_arg1.marker.y = 0);
_arg1.marker.x = ((_arg1.bar.width * (_arg1.curValue - _arg1.min)) / (_arg1.max - _arg1.min));
if (_arg1.marker.x < 0){
_arg1.marker.x = 0;
};
if (_arg1.marker.x > _arg1.bar.width){
_arg1.marker.x = _arg1.bar.width;
};
_arg1.bar.x = (_arg1.bar.y = 0);
_arg1.name_txt.text = _arg2;
_arg1.value_txt.text = _arg1.curValue.toFixed(_arg5);
_arg1.marker.addEventListener(MouseEvent.MOUSE_DOWN, sliderDown);
}
public function bUp(_arg1){
stage.removeEventListener("enterFrame", bFrame);
stage.removeEventListener("mouseMove", bMove);
stage.removeEventListener("mouseUp", bUp);
}
public function mDown(_arg1:Event){
dragging = true;
oldMX = stage.mouseX;
oldMY = stage.mouseY;
oldX = body.x;
oldY = body.y;
stage.addEventListener(MouseEvent.MOUSE_MOVE, mMove);
stage.addEventListener(MouseEvent.MOUSE_UP, mUp);
}
public function updatePushFactor(){
container.setPushFactors(breastA, breastB, currentSlider.curValue, currentSlider.curValue);
}
public function resize(_arg1:Event){
stageCover.graphics.clear();
stageCover.graphics.beginFill(0);
stageCover.graphics.drawRect(STAGE_WIDTH, 0, (stage.stageWidth - STAGE_WIDTH), stage.stageHeight);
stageCover.graphics.endFill();
stageCover.graphics.beginFill(0);
stageCover.graphics.drawRect(0, STAGE_HEIGHT, STAGE_WIDTH, (stage.stageHeight - STAGE_HEIGHT));
stageCover.graphics.endFill();
}
public function sliderDown(_arg1:MouseEvent){
var _local2:DisplayObject;
_local2 = (_arg1.currentTarget as DisplayObject);
currentSlider = (_local2.parent as MovieClip);
stage.addEventListener(MouseEvent.MOUSE_MOVE, sliderMove, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, sliderUp, false, 0, true);
}
public function updateBounceScale(){
breastA.bounceFactor = currentSlider.curValue;
breastB.bounceFactor = currentSlider.curValue;
}
public function bMove(_arg1){
breastB.x = ((oldBX + stage.mouseX) - oldMX);
breastB.y = ((oldBY + stage.mouseY) - oldMY);
}
public function sliderUp(_arg1:MouseEvent){
currentSlider = null;
stage.removeEventListener(MouseEvent.MOUSE_MOVE, sliderMove);
stage.removeEventListener(MouseEvent.MOUSE_UP, sliderUp);
}
public function mMove(_arg1:Event){
body.x = ((oldX + stage.mouseX) - oldMX);
body.y = ((oldY + stage.mouseY) - oldMY);
if (body.y < (bodyY - 100)){
body.y = (bodyY - 100);
};
if ((stage.mouseX - oldMX) < 0){
breastB.xValues[2] = (breastB.xValues[2] + 1);
breastA.xValues[2] = (breastA.xValues[2] - 1);
} else {
if ((stage.mouseX - oldMX) > 0){
breastA.xValues[2] = (breastA.xValues[2] - 1);
breastB.xValues[2] = (breastB.xValues[2] + 1);
};
};
}
public function mUp(_arg1:Event){
if (body.y < bodyY){
jumping = true;
};
dragging = false;
stage.removeEventListener(MouseEvent.MOUSE_MOVE, mMove);
stage.removeEventListener(MouseEvent.MOUSE_UP, mUp);
}
public function updateDeformFactor(){
breastA.deformFactor = currentSlider.curValue;
breastB.deformFactor = currentSlider.curValue;
}
}
}//package elvira_fla
Section 11
//mouth_11 (elvira_fla.mouth_11)
package elvira_fla {
import flash.display.*;
public dynamic class mouth_11 extends MovieClip {
public function mouth_11(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package elvira_fla
Section 12
//Slider_17 (elvira_fla.Slider_17)
package elvira_fla {
import flash.display.*;
import flash.text.*;
public dynamic class Slider_17 extends MovieClip {
public var bar:MovieClip;
public var marker:MovieClip;
public var value_txt:TextField;
public var name_txt:TextField;
}
}//package elvira_fla