Section 1
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2CircleDef extends b2ShapeDef {
public var radius:Number;
public var localPosition:b2Vec2;
public function b2CircleDef(){
localPosition = new b2Vec2(0, 0);
super();
type = b2Shape.e_circleShape;
radius = 1;
}
}
}//package Box2D.Collision.Shapes
Section 2
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape)
package Box2D.Collision.Shapes {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2CircleShape extends b2Shape {
public var m_localPosition:b2Vec2;
public var m_radius:Number;
public function b2CircleShape(_arg1:b2ShapeDef){
m_localPosition = new b2Vec2();
super(_arg1);
var _local2:b2CircleDef = (_arg1 as b2CircleDef);
m_type = e_circleShape;
m_localPosition.SetV(_local2.localPosition);
m_radius = _local2.radius;
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
var _local10:Number;
var _local6:b2Mat22 = _arg1.R;
var _local7:Number = (_arg1.position.x + ((_local6.col1.x * m_localPosition.x) + (_local6.col2.x * m_localPosition.y)));
var _local8:Number = (_arg1.position.y + ((_local6.col1.y * m_localPosition.x) + (_local6.col2.y * m_localPosition.y)));
var _local9:Number = (_arg4.p1.x - _local7);
_local10 = (_arg4.p1.y - _local8);
var _local11:Number = (((_local9 * _local9) + (_local10 * _local10)) - (m_radius * m_radius));
if (_local11 < 0){
return (false);
};
var _local12:Number = (_arg4.p2.x - _arg4.p1.x);
var _local13:Number = (_arg4.p2.y - _arg4.p1.y);
var _local14:Number = ((_local9 * _local12) + (_local10 * _local13));
var _local15:Number = ((_local12 * _local12) + (_local13 * _local13));
var _local16:Number = ((_local14 * _local14) - (_local15 * _local11));
if ((((_local16 < 0)) || ((_local15 < Number.MIN_VALUE)))){
return (false);
};
var _local17:Number = -((_local14 + Math.sqrt(_local16)));
if ((((0 <= _local17)) && ((_local17 <= (_arg5 * _local15))))){
_local17 = (_local17 / _local15);
_arg2[0] = _local17;
_arg3.x = (_local9 + (_local17 * _local12));
_arg3.y = (_local10 + (_local17 * _local13));
_arg3.Normalize();
return (true);
};
return (false);
}
override public function ComputeSubmergedArea(_arg1:b2Vec2, _arg2:Number, _arg3:b2XForm, _arg4:b2Vec2):Number{
var _local5:b2Vec2 = b2Math.b2MulX(_arg3, m_localPosition);
var _local6:Number = -((b2Math.b2Dot(_arg1, _local5) - _arg2));
if (_local6 < (-(m_radius) + Number.MIN_VALUE)){
return (0);
};
if (_local6 > m_radius){
_arg4.SetV(_local5);
return (((b2Settings.b2_pi * m_radius) * m_radius));
};
var _local7:Number = (m_radius * m_radius);
var _local8:Number = (_local6 * _local6);
var _local9:Number = ((_local7 * (Math.asin((_local6 / m_radius)) + (b2Settings.b2_pi / 2))) + (_local6 * Math.sqrt((_local7 - _local8))));
var _local10:Number = (((-2 / 3) * Math.pow((_local7 - _local8), 1.5)) / _local9);
_arg4.x = (_local5.x + (_arg1.x * _local10));
_arg4.y = (_local5.y + (_arg1.y * _local10));
return (_local9);
}
public function GetLocalPosition():b2Vec2{
return (m_localPosition);
}
public function GetRadius():Number{
return (m_radius);
}
override public function ComputeMass(_arg1:b2MassData):void{
_arg1.mass = (((m_density * b2Settings.b2_pi) * m_radius) * m_radius);
_arg1.center.SetV(m_localPosition);
_arg1.I = (_arg1.mass * (((0.5 * m_radius) * m_radius) + ((m_localPosition.x * m_localPosition.x) + (m_localPosition.y * m_localPosition.y))));
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2Mat22;
_local4 = _arg2.R;
var _local5:Number = (_arg2.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
var _local6:Number = (_arg2.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y)));
_local4 = _arg3.R;
var _local7:Number = (_arg3.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
var _local8:Number = (_arg3.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y)));
_arg1.lowerBound.Set((((_local5 < _local7)) ? _local5 : _local7 - m_radius), (((_local6 < _local8)) ? _local6 : _local8 - m_radius));
_arg1.upperBound.Set((((_local5 > _local7)) ? _local5 : _local7 + m_radius), (((_local6 > _local8)) ? _local6 : _local8 + m_radius));
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:Number = (m_localPosition.x - _arg1.x);
var _local3:Number = (m_localPosition.y - _arg1.y);
_local2 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
m_sweepRadius = ((_local2 + m_radius) - b2Settings.b2_toiSlop);
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22 = _arg2.R;
var _local4:Number = (_arg2.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
var _local5:Number = (_arg2.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y)));
_arg1.lowerBound.Set((_local4 - m_radius), (_local5 - m_radius));
_arg1.upperBound.Set((_local4 + m_radius), (_local5 + m_radius));
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Mat22 = _arg1.R;
var _local4:Number = (_arg1.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
var _local5:Number = (_arg1.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y)));
_local4 = (_arg2.x - _local4);
_local5 = (_arg2.y - _local5);
return ((((_local4 * _local4) + (_local5 * _local5)) <= (m_radius * m_radius)));
}
}
}//package Box2D.Collision.Shapes
Section 3
//b2FilterData (Box2D.Collision.Shapes.b2FilterData)
package Box2D.Collision.Shapes {
public class b2FilterData {
public var maskBits:uint;// = 0xFFFF
public var groupIndex:int;// = 0
public var categoryBits:uint;// = 1
public function Copy():b2FilterData{
var _local1:b2FilterData = new b2FilterData();
_local1.categoryBits = categoryBits;
_local1.maskBits = maskBits;
_local1.groupIndex = groupIndex;
return (_local1);
}
}
}//package Box2D.Collision.Shapes
Section 4
//b2MassData (Box2D.Collision.Shapes.b2MassData)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2MassData {
public var mass:Number;// = 0
public var center:b2Vec2;
public var I:Number;// = 0
public function b2MassData(){
center = new b2Vec2(0, 0);
super();
}
}
}//package Box2D.Collision.Shapes
Section 5
//b2PolygonDef (Box2D.Collision.Shapes.b2PolygonDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PolygonDef extends b2ShapeDef {
public var vertices:Array;
public var vertexCount:int;
private static var s_mat:b2Mat22 = new b2Mat22();
public function b2PolygonDef(){
vertices = new Array(b2Settings.b2_maxPolygonVertices);
super();
type = b2Shape.e_polygonShape;
vertexCount = 0;
var _local1:int;
while (_local1 < b2Settings.b2_maxPolygonVertices) {
vertices[_local1] = new b2Vec2();
_local1++;
};
}
public function SetAsOrientedBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2=null, _arg4:Number=0):void{
var _local5:b2Vec2;
var _local6:b2Mat22;
var _local7:int;
vertexCount = 4;
vertices[0].Set(-(_arg1), -(_arg2));
vertices[1].Set(_arg1, -(_arg2));
vertices[2].Set(_arg1, _arg2);
vertices[3].Set(-(_arg1), _arg2);
if (_arg3){
_local5 = _arg3;
_local6 = s_mat;
_local6.Set(_arg4);
_local7 = 0;
while (_local7 < vertexCount) {
_arg3 = vertices[_local7];
_arg1 = (_local5.x + ((_local6.col1.x * _arg3.x) + (_local6.col2.x * _arg3.y)));
_arg3.y = (_local5.y + ((_local6.col1.y * _arg3.x) + (_local6.col2.y * _arg3.y)));
_arg3.x = _arg1;
_local7++;
};
};
}
public function SetAsBox(_arg1:Number, _arg2:Number):void{
vertexCount = 4;
vertices[0].Set(-(_arg1), -(_arg2));
vertices[1].Set(_arg1, -(_arg2));
vertices[2].Set(_arg1, _arg2);
vertices[3].Set(-(_arg1), _arg2);
}
}
}//package Box2D.Collision.Shapes
Section 6
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape)
package Box2D.Collision.Shapes {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PolygonShape extends b2Shape {
public var m_coreVertices:Array;
public var m_vertices:Array;
private var s_supportVec:b2Vec2;
public var m_centroid:b2Vec2;
public var m_normals:Array;
public var m_obb:b2OBB;
public var m_vertexCount:int;
private static var s_computeMat:b2Mat22 = new b2Mat22();
private static var s_sweptAABB1:b2AABB = new b2AABB();
private static var s_sweptAABB2:b2AABB = new b2AABB();
public function b2PolygonShape(_arg1:b2ShapeDef){
var _local3:int;
var _local6: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;
s_supportVec = new b2Vec2();
m_obb = new b2OBB();
m_vertices = new Array(b2Settings.b2_maxPolygonVertices);
m_normals = new Array(b2Settings.b2_maxPolygonVertices);
m_coreVertices = new Array(b2Settings.b2_maxPolygonVertices);
super(_arg1);
m_type = e_polygonShape;
var _local2:b2PolygonDef = (_arg1 as b2PolygonDef);
m_vertexCount = _local2.vertexCount;
var _local4:int = _local3;
var _local5:int = _local3;
_local3 = 0;
while (_local3 < m_vertexCount) {
m_vertices[_local3] = _local2.vertices[_local3].Copy();
_local3++;
};
_local3 = 0;
while (_local3 < m_vertexCount) {
_local4 = _local3;
_local5 = (((_local3 + 1) < m_vertexCount)) ? (_local3 + 1) : 0;
_local6 = (m_vertices[_local5].x - m_vertices[_local4].x);
_local7 = (m_vertices[_local5].y - m_vertices[_local4].y);
_local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
m_normals[_local3] = new b2Vec2((_local7 / _local8), (-(_local6) / _local8));
_local3++;
};
m_centroid = ComputeCentroid(_local2.vertices, _local2.vertexCount);
ComputeOBB(m_obb, m_vertices, m_vertexCount);
_local3 = 0;
while (_local3 < m_vertexCount) {
_local4 = (((_local3 - 1) >= 0)) ? (_local3 - 1) : (m_vertexCount - 1);
_local5 = _local3;
_local9 = m_normals[_local4].x;
_local10 = m_normals[_local4].y;
_local11 = m_normals[_local5].x;
_local12 = m_normals[_local5].y;
_local13 = (m_vertices[_local3].x - m_centroid.x);
_local14 = (m_vertices[_local3].y - m_centroid.y);
_local15 = (((_local9 * _local13) + (_local10 * _local14)) - b2Settings.b2_toiSlop);
_local16 = (((_local11 * _local13) + (_local12 * _local14)) - b2Settings.b2_toiSlop);
_local17 = (1 / ((_local9 * _local12) - (_local10 * _local11)));
m_coreVertices[_local3] = new b2Vec2(((_local17 * ((_local12 * _local15) - (_local10 * _local16))) + m_centroid.x), ((_local17 * ((_local9 * _local16) - (_local11 * _local15))) + m_centroid.y));
_local3++;
};
}
override public function ComputeSubmergedArea(_arg1:b2Vec2, _arg2:Number, _arg3:b2XForm, _arg4:b2Vec2):Number{
var _local13:int;
var _local22:b2Vec2;
var _local24:Boolean;
var _local25:b2MassData;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local5:b2Vec2 = b2Math.b2MulTMV(_arg3.R, _arg1);
var _local6:Number = (_arg2 - b2Math.b2Dot(_arg1, _arg3.position));
var _local7:Array = [];
var _local8:int;
var _local9 = -1;
var _local10 = -1;
var _local11:b2Vec2;
var _local12:Boolean;
_local13 = 0;
while (_local13 < m_vertexCount) {
_local11 = m_vertices[_local13];
_local7[_local13] = (((_local5.x * _local11.x) + (_local5.y * _local11.y)) - _local6);
_local24 = (_local7[_local13] < -(Number.MIN_VALUE));
if (_local13 > 0){
if (_local24){
if (!_local12){
_local9 = (_local13 - 1);
_local8++;
};
} else {
if (_local12){
_local10 = (_local13 - 1);
_local8++;
};
};
};
_local12 = _local24;
_local13++;
};
switch (_local8){
case 0:
if (_local12){
_local25 = new b2MassData();
ComputeMass(_local25);
_arg4.SetV(b2Math.b2MulX(_arg3, _local25.center));
return ((_local25.mass / m_density));
};
return (0);
case 1:
if (_local9 == -1){
_local9 = (m_vertexCount - 1);
} else {
_local10 = (m_vertexCount - 1);
};
break;
};
var _local14:int = ((_local9 + 1) % m_vertexCount);
var _local15:int = ((_local10 + 1) % m_vertexCount);
var _local16:Number = ((0 - _local7[_local9]) / (_local7[_local14] - _local7[_local9]));
var _local17:Number = ((0 - _local7[_local10]) / (_local7[_local15] - _local7[_local10]));
var _local18:b2Vec2 = new b2Vec2(((m_vertices[_local9].x * (1 - _local16)) + (m_vertices[_local14].x * _local16)), ((m_vertices[_local9].y * (1 - _local16)) + (m_vertices[_local14].y * _local16)));
var _local19:b2Vec2 = new b2Vec2(((m_vertices[_local10].x * (1 - _local17)) + (m_vertices[_local15].x * _local17)), ((m_vertices[_local10].y * (1 - _local17)) + (m_vertices[_local15].y * _local17)));
var _local20:Number = 0;
_arg4.Set(0, 0);
var _local21:b2Vec2 = m_vertices[_local14];
var _local23:Number = (1 / 3);
_local13 = _local14;
while (_local13 != _local15) {
_local13 = ((_local13 + 1) % m_vertexCount);
if (_local13 == _local15){
_local22 = _local19;
} else {
_local22 = m_vertices[_local13];
};
_local26 = (_local21.x - _local18.x);
_local27 = (_local21.y - _local18.y);
_local28 = (_local22.x - _local18.x);
_local29 = (_local22.y - _local18.y);
_local30 = ((_local26 * _local29) - (_local27 * _local28));
_local31 = (0.5 * _local30);
_local20 = (_local20 + _local31);
_arg4.x = (_arg4.x + ((_local31 * _local23) * ((_local18.x + _local21.x) + _local22.x)));
_arg4.y = (_arg4.y + ((_local31 * _local23) * ((_local18.y + _local21.y) + _local22.y)));
_local21 = _local22;
};
_arg4.x = (_arg4.x / _local20);
_arg4.y = (_arg4.y / _local20);
_arg4.SetV(b2Math.b2MulX(_arg3, _arg4));
return (_local20);
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2AABB = s_sweptAABB1;
var _local5:b2AABB = s_sweptAABB2;
ComputeAABB(_local4, _arg2);
ComputeAABB(_local5, _arg3);
_arg1.lowerBound.Set(((_local4.lowerBound.x < _local5.lowerBound.x)) ? _local4.lowerBound.x : _local5.lowerBound.x, ((_local4.lowerBound.y < _local5.lowerBound.y)) ? _local4.lowerBound.y : _local5.lowerBound.y);
_arg1.upperBound.Set(((_local4.upperBound.x > _local5.upperBound.x)) ? _local4.upperBound.x : _local5.upperBound.x, ((_local4.upperBound.y > _local5.upperBound.y)) ? _local4.upperBound.y : _local5.upperBound.y);
}
public function GetVertices():Array{
return (m_vertices);
}
public function GetCoreVertices():Array{
return (m_coreVertices);
}
public function GetCentroid():b2Vec2{
return (m_centroid);
}
public function GetOBB():b2OBB{
return (m_obb);
}
public function GetFirstVertex(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, m_coreVertices[0]));
}
public function Centroid(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, m_centroid));
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:b2Vec2;
var _local20:Number;
var _local21:Number;
var _local6:Number = 0;
var _local7:Number = _arg5;
_local8 = (_arg4.p1.x - _arg1.position.x);
_local9 = (_arg4.p1.y - _arg1.position.y);
_local10 = _arg1.R;
var _local12:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
var _local13:Number = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
_local8 = (_arg4.p2.x - _arg1.position.x);
_local9 = (_arg4.p2.y - _arg1.position.y);
_local10 = _arg1.R;
var _local14:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
var _local15:Number = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
var _local16:Number = (_local14 - _local12);
var _local17:Number = (_local15 - _local13);
var _local18 = -1;
var _local19:int;
while (_local19 < m_vertexCount) {
_local11 = m_vertices[_local19];
_local8 = (_local11.x - _local12);
_local9 = (_local11.y - _local13);
_local11 = m_normals[_local19];
_local20 = ((_local11.x * _local8) + (_local11.y * _local9));
_local21 = ((_local11.x * _local16) + (_local11.y * _local17));
if ((((_local21 < 0)) && ((_local20 < (_local6 * _local21))))){
_local6 = (_local20 / _local21);
_local18 = _local19;
} else {
if ((((_local21 > 0)) && ((_local20 < (_local7 * _local21))))){
_local7 = (_local20 / _local21);
};
};
if (_local7 < _local6){
return (false);
};
_local19++;
};
if (_local18 >= 0){
_arg2[0] = _local6;
_local10 = _arg1.R;
_local11 = m_normals[_local18];
_arg3.x = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_arg3.y = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
return (true);
};
return (false);
}
override public function ComputeMass(_arg1:b2MassData):void{
var _local10:b2Vec2;
var _local11:b2Vec2;
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:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local2:Number = 0;
var _local3:Number = 0;
var _local4:Number = 0;
var _local5:Number = 0;
var _local6:Number = 0;
var _local7:Number = 0;
var _local8:Number = (1 / 3);
var _local9:int;
while (_local9 < m_vertexCount) {
_local10 = m_vertices[_local9];
_local11 = (((_local9 + 1) < m_vertexCount)) ? m_vertices[int((_local9 + 1))] : m_vertices[0];
_local12 = (_local10.x - _local6);
_local13 = (_local10.y - _local7);
_local14 = (_local11.x - _local6);
_local15 = (_local11.y - _local7);
_local16 = ((_local12 * _local15) - (_local13 * _local14));
_local17 = (0.5 * _local16);
_local4 = (_local4 + _local17);
_local2 = (_local2 + ((_local17 * _local8) * ((_local6 + _local10.x) + _local11.x)));
_local3 = (_local3 + ((_local17 * _local8) * ((_local7 + _local10.y) + _local11.y)));
_local18 = _local6;
_local19 = _local7;
_local20 = _local12;
_local21 = _local13;
_local22 = _local14;
_local23 = _local15;
_local24 = ((_local8 * ((0.25 * (((_local20 * _local20) + (_local22 * _local20)) + (_local22 * _local22))) + ((_local18 * _local20) + (_local18 * _local22)))) + ((0.5 * _local18) * _local18));
_local25 = ((_local8 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19));
_local5 = (_local5 + (_local16 * (_local24 + _local25)));
_local9++;
};
_arg1.mass = (m_density * _local4);
_local2 = (_local2 * (1 / _local4));
_local3 = (_local3 * (1 / _local4));
_arg1.center.Set(_local2, _local3);
_arg1.I = (m_density * _local5);
}
public function GetNormals():Array{
return (m_normals);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:b2Vec2;
var _local5:b2Mat22;
var _local11:Number;
_local5 = _arg1.R;
var _local6:Number = ((_arg2 * _local5.col1.x) + (_arg3 * _local5.col1.y));
var _local7:Number = ((_arg2 * _local5.col2.x) + (_arg3 * _local5.col2.y));
var _local8:int;
_local4 = m_coreVertices[0];
var _local9:Number = ((_local4.x * _local6) + (_local4.y * _local7));
var _local10 = 1;
while (_local10 < m_vertexCount) {
_local4 = m_coreVertices[_local10];
_local11 = ((_local4.x * _local6) + (_local4.y * _local7));
if (_local11 > _local9){
_local8 = _local10;
_local9 = _local11;
};
_local10++;
};
_local5 = _arg1.R;
_local4 = m_coreVertices[_local8];
s_supportVec.x = (_arg1.position.x + ((_local5.col1.x * _local4.x) + (_local5.col2.x * _local4.y)));
s_supportVec.y = (_arg1.position.y + ((_local5.col1.y * _local4.x) + (_local5.col2.y * _local4.y)));
return (s_supportVec);
}
public function GetVertexCount():int{
return (m_vertexCount);
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:b2Mat22 = s_computeMat;
_local3 = _arg2.R;
_local4 = m_obb.R.col1;
_local5.col1.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col1.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local4 = m_obb.R.col2;
_local5.col2.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col2.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local5.Abs();
var _local6:b2Mat22 = _local5;
_local4 = m_obb.extents;
var _local7:Number = ((_local6.col1.x * _local4.x) + (_local6.col2.x * _local4.y));
var _local8:Number = ((_local6.col1.y * _local4.x) + (_local6.col2.y * _local4.y));
_local3 = _arg2.R;
_local4 = m_obb.center;
var _local9:Number = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)));
var _local10:Number = (_arg2.position.y + ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)));
_arg1.lowerBound.Set((_local9 - _local7), (_local10 - _local8));
_arg1.upperBound.Set((_local9 + _local7), (_local10 + _local8));
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:b2Vec2;
var _local4:Number;
var _local5:Number;
m_sweepRadius = 0;
var _local3:int;
while (_local3 < m_vertexCount) {
_local2 = m_coreVertices[_local3];
_local4 = (_local2.x - _arg1.x);
_local5 = (_local2.y - _arg1.y);
_local4 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
if (_local4 > m_sweepRadius){
m_sweepRadius = _local4;
};
_local3++;
};
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Vec2;
var _local10:Number;
var _local4:b2Mat22 = _arg1.R;
var _local5:Number = (_arg2.x - _arg1.position.x);
var _local6:Number = (_arg2.y - _arg1.position.y);
var _local7:Number = ((_local5 * _local4.col1.x) + (_local6 * _local4.col1.y));
var _local8:Number = ((_local5 * _local4.col2.x) + (_local6 * _local4.col2.y));
var _local9:int;
while (_local9 < m_vertexCount) {
_local3 = m_vertices[_local9];
_local5 = (_local7 - _local3.x);
_local6 = (_local8 - _local3.y);
_local3 = m_normals[_local9];
_local10 = ((_local3.x * _local5) + (_local3.y * _local6));
if (_local10 > 0){
return (false);
};
_local9++;
};
return (true);
}
public static function ComputeCentroid(_arg1:Array, _arg2:int):b2Vec2{
var _local3:b2Vec2;
var _local7:Number;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local3 = new b2Vec2();
var _local4:Number = 0;
var _local5:Number = 0;
var _local6:Number = 0;
_local7 = (1 / 3);
var _local8:int;
while (_local8 < _arg2) {
_local9 = _arg1[_local8];
_local10 = (((_local8 + 1) < _arg2)) ? _arg1[int((_local8 + 1))] : _arg1[0];
_local11 = (_local9.x - _local5);
_local12 = (_local9.y - _local6);
_local13 = (_local10.x - _local5);
_local14 = (_local10.y - _local6);
_local15 = ((_local11 * _local14) - (_local12 * _local13));
_local16 = (0.5 * _local15);
_local4 = (_local4 + _local16);
_local3.x = (_local3.x + ((_local16 * _local7) * ((_local5 + _local9.x) + _local10.x)));
_local3.y = (_local3.y + ((_local16 * _local7) * ((_local6 + _local9.y) + _local10.y)));
_local8++;
};
_local3.x = (_local3.x * (1 / _local4));
_local3.y = (_local3.y * (1 / _local4));
return (_local3);
}
public static function ComputeOBB(_arg1:b2OBB, _arg2:Array, _arg3:int):void{
var _local4:int;
var _local7:b2Vec2;
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:int;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:b2Mat22;
var _local5:Array = new Array((b2Settings.b2_maxPolygonVertices + 1));
_local4 = 0;
while (_local4 < _arg3) {
_local5[_local4] = _arg2[_local4];
_local4++;
};
_local5[_arg3] = _local5[0];
var _local6:Number = Number.MAX_VALUE;
_local4 = 1;
while (_local4 <= _arg3) {
_local7 = _local5[int((_local4 - 1))];
_local8 = (_local5[_local4].x - _local7.x);
_local9 = (_local5[_local4].y - _local7.y);
_local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local8 = (_local8 / _local10);
_local9 = (_local9 / _local10);
_local11 = -(_local9);
_local12 = _local8;
_local13 = Number.MAX_VALUE;
_local14 = Number.MAX_VALUE;
_local15 = -(Number.MAX_VALUE);
_local16 = -(Number.MAX_VALUE);
_local17 = 0;
while (_local17 < _arg3) {
_local19 = (_local5[_local17].x - _local7.x);
_local20 = (_local5[_local17].y - _local7.y);
_local21 = ((_local8 * _local19) + (_local9 * _local20));
_local22 = ((_local11 * _local19) + (_local12 * _local20));
if (_local21 < _local13){
_local13 = _local21;
};
if (_local22 < _local14){
_local14 = _local22;
};
if (_local21 > _local15){
_local15 = _local21;
};
if (_local22 > _local16){
_local16 = _local22;
};
_local17++;
};
_local18 = ((_local15 - _local13) * (_local16 - _local14));
if (_local18 < (0.95 * _local6)){
_local6 = _local18;
_arg1.R.col1.x = _local8;
_arg1.R.col1.y = _local9;
_arg1.R.col2.x = _local11;
_arg1.R.col2.y = _local12;
_local23 = (0.5 * (_local13 + _local15));
_local24 = (0.5 * (_local14 + _local16));
_local25 = _arg1.R;
_arg1.center.x = (_local7.x + ((_local25.col1.x * _local23) + (_local25.col2.x * _local24)));
_arg1.center.y = (_local7.y + ((_local25.col1.y * _local23) + (_local25.col2.y * _local24)));
_arg1.extents.x = (0.5 * (_local15 - _local13));
_arg1.extents.y = (0.5 * (_local16 - _local14));
};
_local4++;
};
}
}
}//package Box2D.Collision.Shapes
Section 7
//b2Shape (Box2D.Collision.Shapes.b2Shape)
package Box2D.Collision.Shapes {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2Shape {
public var m_next:b2Shape;
public var m_type:int;
public var m_sweepRadius:Number;
public var m_density:Number;
public var m_filter:b2FilterData;
public var m_friction:Number;
public var m_isSensor:Boolean;
public var m_restitution:Number;
public var m_userData;
public var m_proxyId:uint;
public var m_body:b2Body;
public static const e_polygonShape:int = 1;
public static const e_unknownShape:int = -1;
public static const e_circleShape:int = 0;
public static const e_shapeTypeCount:int = 2;
private static var s_resetAABB:b2AABB = new b2AABB();
private static var s_syncAABB:b2AABB = new b2AABB();
private static var s_proxyAABB:b2AABB = new b2AABB();
public function b2Shape(_arg1:b2ShapeDef){
m_userData = _arg1.userData;
m_friction = _arg1.friction;
m_restitution = _arg1.restitution;
m_density = _arg1.density;
m_body = null;
m_sweepRadius = 0;
m_next = null;
m_proxyId = b2Pair.b2_nullProxy;
m_filter = _arg1.filter.Copy();
m_isSensor = _arg1.isSensor;
}
public function ComputeSubmergedArea(_arg1:b2Vec2, _arg2:Number, _arg3:b2XForm, _arg4:b2Vec2):Number{
return (0);
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetSweepRadius():Number{
return (m_sweepRadius);
}
public function GetNext():b2Shape{
return (m_next);
}
public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
}
public function GetType():int{
return (m_type);
}
public function GetRestitution():Number{
return (m_restitution);
}
public function GetFriction():Number{
return (m_friction);
}
public function GetFilterData():b2FilterData{
return (m_filter.Copy());
}
public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
return (false);
}
public function RefilterProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
_arg1.DestroyProxy(m_proxyId);
var _local3:b2AABB = s_resetAABB;
ComputeAABB(_local3, _arg2);
var _local4:Boolean = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function SetFilterData(_arg1:b2FilterData):void{
m_filter = _arg1.Copy();
}
public function GetUserData(){
return (m_userData);
}
public function Synchronize(_arg1:b2BroadPhase, _arg2:b2XForm, _arg3:b2XForm):Boolean{
if (m_proxyId == b2Pair.b2_nullProxy){
return (false);
};
var _local4:b2AABB = s_syncAABB;
ComputeSweptAABB(_local4, _arg2, _arg3);
if (_arg1.InRange(_local4)){
_arg1.MoveProxy(m_proxyId, _local4);
return (true);
};
return (false);
}
public function ComputeMass(_arg1:b2MassData):void{
}
public function IsSensor():Boolean{
return (m_isSensor);
}
public function DestroyProxy(_arg1:b2BroadPhase):void{
if (m_proxyId != b2Pair.b2_nullProxy){
_arg1.DestroyProxy(m_proxyId);
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function UpdateSweepRadius(_arg1:b2Vec2):void{
}
public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
}
public function GetBody():b2Body{
return (m_body);
}
public function CreateProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
var _local3:b2AABB = s_proxyAABB;
ComputeAABB(_local3, _arg2);
var _local4:Boolean = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
return (false);
}
public static function Destroy(_arg1:b2Shape, _arg2):void{
}
public static function Create(_arg1:b2ShapeDef, _arg2):b2Shape{
switch (_arg1.type){
case e_circleShape:
return (new b2CircleShape(_arg1));
case e_polygonShape:
return (new b2PolygonShape(_arg1));
default:
return (null);
};
}
}
}//package Box2D.Collision.Shapes
Section 8
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef)
package Box2D.Collision.Shapes {
public class b2ShapeDef {
public var friction:Number;// = 0.2
public var isSensor:Boolean;// = false
public var density:Number;// = 0
public var restitution:Number;// = 0
public var userData;// = null
public var filter:b2FilterData;
public var type:int;
public function b2ShapeDef(){
type = b2Shape.e_unknownShape;
filter = new b2FilterData();
super();
}
}
}//package Box2D.Collision.Shapes
Section 9
//b2AABB (Box2D.Collision.b2AABB)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2AABB {
public var upperBound:b2Vec2;
public var lowerBound:b2Vec2;
public function b2AABB(){
lowerBound = new b2Vec2();
upperBound = new b2Vec2();
super();
}
public function IsValid():Boolean{
var _local1:Number = (upperBound.x - lowerBound.x);
var _local2:Number = (upperBound.y - lowerBound.y);
var _local3:Boolean = (((_local1 >= 0)) && ((_local2 >= 0)));
_local3 = ((((_local3) && (lowerBound.IsValid()))) && (upperBound.IsValid()));
return (_local3);
}
}
}//package Box2D.Collision
Section 10
//b2Bound (Box2D.Collision.b2Bound)
package Box2D.Collision {
public class b2Bound {
public var value:uint;
public var proxyId:uint;
public var stabbingCount:uint;
public function Swap(_arg1:b2Bound):void{
var _local2:uint = value;
var _local3:uint = proxyId;
var _local4:uint = stabbingCount;
value = _arg1.value;
proxyId = _arg1.proxyId;
stabbingCount = _arg1.stabbingCount;
_arg1.value = _local2;
_arg1.proxyId = _local3;
_arg1.stabbingCount = _local4;
}
public function IsLower():Boolean{
return (((value & 1) == 0));
}
public function IsUpper():Boolean{
return (((value & 1) == 1));
}
}
}//package Box2D.Collision
Section 11
//b2BoundValues (Box2D.Collision.b2BoundValues)
package Box2D.Collision {
public class b2BoundValues {
public var lowerValues:Array;
public var upperValues:Array;
public function b2BoundValues(){
lowerValues = [0, 0];
upperValues = [0, 0];
super();
}
}
}//package Box2D.Collision
Section 12
//b2BroadPhase (Box2D.Collision.b2BroadPhase)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2BroadPhase {
public var m_bounds:Array;
public var m_quantizationFactor:b2Vec2;
public var m_worldAABB:b2AABB;
public var m_freeProxy:uint;
public var m_proxyCount:int;
public var m_proxyPool:Array;
public var m_queryResultCount:int;
public var m_pairManager:b2PairManager;
public var m_timeStamp:uint;
public var m_queryResults:Array;
public static const b2_nullEdge:uint = 0xFFFF;
public static const b2_invalid:uint = 0xFFFF;
public static var s_validate:Boolean = false;
public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){
var _local3:int;
var _local5:Number;
var _local6:b2Proxy;
var _local7:int;
m_pairManager = new b2PairManager();
m_proxyPool = new Array(b2Settings.b2_maxPairs);
m_bounds = new Array((2 * b2Settings.b2_maxProxies));
m_queryResults = new Array(b2Settings.b2_maxProxies);
m_quantizationFactor = new b2Vec2();
super();
m_pairManager.Initialize(this, _arg2);
m_worldAABB = _arg1;
m_proxyCount = 0;
_local3 = 0;
while (_local3 < b2Settings.b2_maxProxies) {
m_queryResults[_local3] = 0;
_local3++;
};
m_bounds = new Array(2);
_local3 = 0;
while (_local3 < 2) {
m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies));
_local7 = 0;
while (_local7 < (2 * b2Settings.b2_maxProxies)) {
m_bounds[_local3][_local7] = new b2Bound();
_local7++;
};
_local3++;
};
var _local4:Number = (_arg1.upperBound.x - _arg1.lowerBound.x);
_local5 = (_arg1.upperBound.y - _arg1.lowerBound.y);
m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4);
m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5);
_local3 = 0;
while (_local3 < (b2Settings.b2_maxProxies - 1)) {
_local6 = new b2Proxy();
m_proxyPool[_local3] = _local6;
_local6.SetNext((_local3 + 1));
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
_local3++;
};
_local6 = new b2Proxy();
m_proxyPool[int((b2Settings.b2_maxProxies - 1))] = _local6;
_local6.SetNext(b2Pair.b2_nullProxy);
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
m_freeProxy = 0;
m_timeStamp = 1;
m_queryResultCount = 0;
}
public function QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{
var _local6:uint;
var _local7:uint;
var _local12:b2Proxy;
var _local4:Array = new Array();
var _local5:Array = new Array();
ComputeBounds(_local4, _local5, _arg1);
var _local8:Array = [_local6];
var _local9:Array = [_local7];
Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0);
Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1);
var _local10:int;
var _local11:int;
while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) {
_local12 = m_proxyPool[m_queryResults[_local11]];
_arg2[_local11] = _local12.userData;
_local11++;
_local10++;
};
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local10);
}
public function Commit():void{
m_pairManager.Commit();
}
public function GetProxy(_arg1:int):b2Proxy{
var _local2:b2Proxy = m_proxyPool[_arg1];
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((_local2.IsValid() == false)))){
return (null);
};
return (_local2);
}
private function IncrementTimeStamp():void{
var _local1:uint;
if (m_timeStamp == b2Settings.USHRT_MAX){
_local1 = 0;
while (_local1 < b2Settings.b2_maxProxies) {
(m_proxyPool[_local1] as b2Proxy).timeStamp = 0;
_local1++;
};
m_timeStamp = 1;
} else {
m_timeStamp++;
};
}
private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{
var _local10:b2Bound;
var _local12:int;
var _local13:int;
var _local14:b2Proxy;
var _local8:uint = BinarySearch(_arg5, _arg6, _arg3);
var _local9:uint = BinarySearch(_arg5, _arg6, _arg4);
var _local11:uint = _local8;
while (_local11 < _local9) {
_local10 = _arg5[_local11];
if (_local10.IsLower()){
IncrementOverlapCount(_local10.proxyId);
};
_local11++;
};
if (_local8 > 0){
_local12 = (_local8 - 1);
_local10 = _arg5[_local12];
_local13 = _local10.stabbingCount;
while (_local13) {
_local10 = _arg5[_local12];
if (_local10.IsLower()){
_local14 = m_proxyPool[_local10.proxyId];
if (_local8 <= _local14.upperBounds[_arg7]){
IncrementOverlapCount(_local10.proxyId);
_local13--;
};
};
_local12--;
};
};
_arg1[0] = _local8;
_arg2[0] = _local9;
}
private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{
var _local4:Array;
var _local5:b2Bound;
var _local6:b2Bound;
var _local3:int;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg1.lowerBounds[_local3]];
_local6 = _local4[_arg2.upperBounds[_local3]];
if (_local5.value > _local6.value){
return (false);
};
_local5 = _local4[_arg1.upperBounds[_local3]];
_local6 = _local4[_arg2.lowerBounds[_local3]];
if (_local5.value < _local6.value){
return (false);
};
_local3++;
};
return (true);
}
private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{
var _local4:Number = _arg3.lowerBound.x;
var _local5:Number = _arg3.lowerBound.y;
_local4 = b2Math.b2Min(_local4, m_worldAABB.upperBound.x);
_local5 = b2Math.b2Min(_local5, m_worldAABB.upperBound.y);
_local4 = b2Math.b2Max(_local4, m_worldAABB.lowerBound.x);
_local5 = b2Math.b2Max(_local5, m_worldAABB.lowerBound.y);
var _local6:Number = _arg3.upperBound.x;
var _local7:Number = _arg3.upperBound.y;
_local6 = b2Math.b2Min(_local6, m_worldAABB.upperBound.x);
_local7 = b2Math.b2Min(_local7, m_worldAABB.upperBound.y);
_local6 = b2Math.b2Max(_local6, m_worldAABB.lowerBound.x);
_local7 = b2Math.b2Max(_local7, m_worldAABB.lowerBound.y);
_arg1[0] = (uint((m_quantizationFactor.x * (_local4 - m_worldAABB.lowerBound.x))) & (b2Settings.USHRT_MAX - 1));
_arg2[0] = ((uint((m_quantizationFactor.x * (_local6 - m_worldAABB.lowerBound.x))) & 0xFFFF) | 1);
_arg1[1] = (uint((m_quantizationFactor.y * (_local5 - m_worldAABB.lowerBound.y))) & (b2Settings.USHRT_MAX - 1));
_arg2[1] = ((uint((m_quantizationFactor.y * (_local7 - m_worldAABB.lowerBound.y))) & 0xFFFF) | 1);
}
public function CreateProxy(_arg1:b2AABB, _arg2):uint{
var _local3:uint;
var _local4:b2Proxy;
var _local11:Array;
var _local12:uint;
var _local13:uint;
var _local14:Array;
var _local15:Array;
var _local16:Array;
var _local17:int;
var _local18:int;
var _local19:b2Bound;
var _local20:b2Bound;
var _local21:b2Bound;
var _local22:int;
var _local23:b2Proxy;
var _local5:uint = m_freeProxy;
_local4 = m_proxyPool[_local5];
m_freeProxy = _local4.GetNext();
_local4.overlapCount = 0;
_local4.userData = _arg2;
var _local6:uint = (2 * m_proxyCount);
var _local7:Array = new Array();
var _local8:Array = new Array();
ComputeBounds(_local7, _local8, _arg1);
var _local9:int;
while (_local9 < 2) {
_local11 = m_bounds[_local9];
_local14 = [_local12];
_local15 = [_local13];
Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9);
_local12 = _local14[0];
_local13 = _local15[0];
_local16 = new Array();
_local18 = (_local6 - _local13);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local13 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local13 + 2);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local16 = new Array();
_local18 = (_local13 - _local12);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local12 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local12 + 1);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local13++;
_local19 = _local11[_local12];
_local20 = _local11[_local13];
_local19.value = _local7[_local9];
_local19.proxyId = _local5;
_local20.value = _local8[_local9];
_local20.proxyId = _local5;
_local21 = _local11[int((_local12 - 1))];
_local19.stabbingCount = ((_local12 == 0)) ? 0 : _local21.stabbingCount;
_local21 = _local11[int((_local13 - 1))];
_local20.stabbingCount = _local21.stabbingCount;
_local3 = _local12;
while (_local3 < _local13) {
_local21 = _local11[_local3];
_local21.stabbingCount++;
_local3++;
};
_local3 = _local12;
while (_local3 < (_local6 + 2)) {
_local19 = _local11[_local3];
_local23 = m_proxyPool[_local19.proxyId];
if (_local19.IsLower()){
_local23.lowerBounds[_local9] = _local3;
} else {
_local23.upperBounds[_local9] = _local3;
};
_local3++;
};
_local9++;
};
m_proxyCount++;
var _local10:int;
while (_local10 < m_queryResultCount) {
m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]);
_local10++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local5);
}
public function DestroyProxy(_arg1:uint):void{
var _local2:b2Bound;
var _local3:b2Bound;
var _local8:Array;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:Array;
var _local14:int;
var _local15:int;
var _local16:int;
var _local17:uint;
var _local18:int;
var _local19:b2Proxy;
var _local4:b2Proxy = m_proxyPool[_arg1];
var _local5:int = (2 * m_proxyCount);
var _local6:int;
while (_local6 < 2) {
_local8 = m_bounds[_local6];
_local9 = _local4.lowerBounds[_local6];
_local10 = _local4.upperBounds[_local6];
_local2 = _local8[_local9];
_local11 = _local2.value;
_local3 = _local8[_local10];
_local12 = _local3.value;
_local13 = new Array();
_local15 = ((_local10 - _local9) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local9 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = _local9;
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local13 = new Array();
_local15 = ((_local5 - _local10) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local10 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = (_local10 - 1);
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = (_local5 - 2);
_local17 = _local9;
while (_local17 < _local15) {
_local2 = _local8[_local17];
_local19 = m_proxyPool[_local2.proxyId];
if (_local2.IsLower()){
_local19.lowerBounds[_local6] = _local17;
} else {
_local19.upperBounds[_local6] = _local17;
};
_local17++;
};
_local15 = (_local10 - 1);
_local18 = _local9;
while (_local18 < _local15) {
_local2 = _local8[_local18];
_local2.stabbingCount--;
_local18++;
};
Query([0], [0], _local11, _local12, _local8, (_local5 - 2), _local6);
_local6++;
};
var _local7:int;
while (_local7 < m_queryResultCount) {
m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local7]);
_local7++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
_local4.userData = null;
_local4.overlapCount = b2_invalid;
_local4.lowerBounds[0] = b2_invalid;
_local4.lowerBounds[1] = b2_invalid;
_local4.upperBounds[0] = b2_invalid;
_local4.upperBounds[1] = b2_invalid;
_local4.SetNext(m_freeProxy);
m_freeProxy = _arg1;
m_proxyCount--;
}
public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{
var _local4:Array;
var _local5:b2Bound;
var _local3:int;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg2.upperBounds[_local3]];
if (_arg1.lowerValues[_local3] > _local5.value){
return (false);
};
_local5 = _local4[_arg2.lowerBounds[_local3]];
if (_arg1.upperValues[_local3] < _local5.value){
return (false);
};
_local3++;
};
return (true);
}
public function Validate():void{
var _local1:b2Pair;
var _local2:b2Proxy;
var _local3:b2Proxy;
var _local4:Boolean;
var _local6:b2Bound;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:b2Bound;
var _local5:int;
while (_local5 < 2) {
_local6 = m_bounds[_local5];
_local7 = (2 * m_proxyCount);
_local8 = 0;
_local9 = 0;
while (_local9 < _local7) {
_local10 = _local6[_local9];
if (_local10.IsLower() == true){
_local8++;
} else {
_local8--;
};
_local9++;
};
_local5++;
};
}
private function IncrementOverlapCount(_arg1:uint):void{
var _local2:b2Proxy = m_proxyPool[_arg1];
if (_local2.timeStamp < m_timeStamp){
_local2.timeStamp = m_timeStamp;
_local2.overlapCount = 1;
} else {
_local2.overlapCount = 2;
m_queryResults[m_queryResultCount] = _arg1;
m_queryResultCount++;
};
}
public function InRange(_arg1:b2AABB):Boolean{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = _arg1.lowerBound.x;
_local3 = _arg1.lowerBound.y;
_local2 = (_local2 - m_worldAABB.upperBound.x);
_local3 = (_local3 - m_worldAABB.upperBound.y);
_local4 = m_worldAABB.lowerBound.x;
_local5 = m_worldAABB.lowerBound.y;
_local4 = (_local4 - _arg1.upperBound.x);
_local5 = (_local5 - _arg1.upperBound.y);
_local2 = b2Math.b2Max(_local2, _local4);
_local3 = b2Math.b2Max(_local3, _local5);
return ((b2Math.b2Max(_local2, _local3) < 0));
}
public function MoveProxy(_arg1:uint, _arg2:b2AABB):void{
var _local3:Array;
var _local4:int;
var _local5:uint;
var _local6:uint;
var _local7:b2Bound;
var _local8:b2Bound;
var _local9:b2Bound;
var _local10:uint;
var _local11:b2Proxy;
var _local16:Array;
var _local17:uint;
var _local18:uint;
var _local19:uint;
var _local20:uint;
var _local21:int;
var _local22:int;
var _local23:uint;
var _local24:b2Proxy;
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= _arg1)))){
return;
};
if (_arg2.IsValid() == false){
return;
};
var _local12:uint = (2 * m_proxyCount);
var _local13:b2Proxy = m_proxyPool[_arg1];
var _local14:b2BoundValues = new b2BoundValues();
ComputeBounds(_local14.lowerValues, _local14.upperValues, _arg2);
var _local15:b2BoundValues = new b2BoundValues();
_local5 = 0;
while (_local5 < 2) {
_local7 = m_bounds[_local5][_local13.lowerBounds[_local5]];
_local15.lowerValues[_local5] = _local7.value;
_local7 = m_bounds[_local5][_local13.upperBounds[_local5]];
_local15.upperValues[_local5] = _local7.value;
_local5++;
};
_local5 = 0;
while (_local5 < 2) {
_local16 = m_bounds[_local5];
_local17 = _local13.lowerBounds[_local5];
_local18 = _local13.upperBounds[_local5];
_local19 = _local14.lowerValues[_local5];
_local20 = _local14.upperValues[_local5];
_local7 = _local16[_local17];
_local21 = (_local19 - _local7.value);
_local7.value = _local19;
_local7 = _local16[_local18];
_local22 = (_local20 - _local7.value);
_local7.value = _local20;
if (_local21 < 0){
_local6 = _local17;
while ((((_local6 > 0)) && ((_local19 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local8.proxyId];
_local8.stabbingCount++;
if (_local8.IsUpper() == true){
if (TestOverlap(_local14, _local24)){
m_pairManager.AddBufferedPair(_arg1, _local23);
};
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
if (_local22 > 0){
_local6 = _local18;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local20)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount++;
if (_local9.IsLower() == true){
if (TestOverlap(_local14, _local11)){
m_pairManager.AddBufferedPair(_arg1, _local10);
};
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local21 > 0){
_local6 = _local17;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local19)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount--;
if (_local9.IsUpper()){
if (TestOverlap(_local15, _local11)){
m_pairManager.RemoveBufferedPair(_arg1, _local10);
};
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local22 < 0){
_local6 = _local18;
while ((((_local6 > 0)) && ((_local20 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local23];
_local8.stabbingCount--;
if (_local8.IsLower() == true){
if (TestOverlap(_local15, _local24)){
m_pairManager.RemoveBufferedPair(_arg1, _local23);
};
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
_local5++;
};
}
public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{
var _local6:int;
var _local7:b2Bound;
var _local4:int;
var _local5:int = (_arg2 - 1);
while (_local4 <= _local5) {
_local6 = ((_local4 + _local5) / 2);
_local7 = _arg1[_local6];
if (_local7.value > _arg3){
_local5 = (_local6 - 1);
} else {
if (_local7.value < _arg3){
_local4 = (_local6 + 1);
} else {
return (uint(_local6));
};
};
};
return (uint(_local4));
}
}
}//package Box2D.Collision
Section 13
//b2BufferedPair (Box2D.Collision.b2BufferedPair)
package Box2D.Collision {
public class b2BufferedPair {
public var proxyId1:uint;
public var proxyId2:uint;
}
}//package Box2D.Collision
Section 14
//b2Collision (Box2D.Collision.b2Collision)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Collision {
public static const b2_nullFeature:uint = 0xFF;
private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2();
public static function EdgeSeparation(_arg1:b2PolygonShape, _arg2:b2XForm, _arg3:int, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local11:b2Mat22;
var _local12:b2Vec2;
var _local25:Number;
var _local6:int = _arg1.m_vertexCount;
var _local7:Array = _arg1.m_vertices;
var _local8:Array = _arg1.m_normals;
var _local9:int = _arg4.m_vertexCount;
var _local10:Array = _arg4.m_vertices;
_local11 = _arg2.R;
_local12 = _local8[_arg3];
var _local13:Number = ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y));
var _local14:Number = ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y));
_local11 = _arg5.R;
var _local15:Number = ((_local11.col1.x * _local13) + (_local11.col1.y * _local14));
var _local16:Number = ((_local11.col2.x * _local13) + (_local11.col2.y * _local14));
var _local17:int;
var _local18:Number = Number.MAX_VALUE;
var _local19:int;
while (_local19 < _local9) {
_local12 = _local10[_local19];
_local25 = ((_local12.x * _local15) + (_local12.y * _local16));
if (_local25 < _local18){
_local18 = _local25;
_local17 = _local19;
};
_local19++;
};
_local12 = _local7[_arg3];
_local11 = _arg2.R;
var _local20:Number = (_arg2.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
var _local21:Number = (_arg2.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local12 = _local10[_local17];
_local11 = _arg5.R;
var _local22:Number = (_arg5.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
var _local23:Number = (_arg5.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local22 = (_local22 - _local20);
_local23 = (_local23 - _local21);
var _local24:Number = ((_local22 * _local13) + (_local23 * _local14));
return (_local24);
}
public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{
var _local3:b2Vec2 = _arg2.lowerBound;
var _local4:b2Vec2 = _arg1.upperBound;
var _local5:Number = (_local3.x - _local4.x);
var _local6:Number = (_local3.y - _local4.y);
_local3 = _arg1.lowerBound;
_local4 = _arg2.upperBound;
var _local7:Number = (_local3.x - _local4.x);
var _local8:Number = (_local3.y - _local4.y);
if ((((_local5 > 0)) || ((_local6 > 0)))){
return (false);
};
if ((((_local7 > 0)) || ((_local8 > 0)))){
return (false);
};
return (true);
}
public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:int, _arg5:b2PolygonShape, _arg6:b2XForm):void{
var _local12:b2Mat22;
var _local13:b2Vec2;
var _local20:ClipVertex;
var _local23:Number;
var _local7:int = _arg2.m_vertexCount;
var _local8:Array = _arg2.m_normals;
var _local9:int = _arg5.m_vertexCount;
var _local10:Array = _arg5.m_vertices;
var _local11:Array = _arg5.m_normals;
_local12 = _arg3.R;
_local13 = _local8[_arg4];
var _local14:Number = ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y));
var _local15:Number = ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y));
_local12 = _arg6.R;
var _local16:Number = ((_local12.col1.x * _local14) + (_local12.col1.y * _local15));
_local15 = ((_local12.col2.x * _local14) + (_local12.col2.y * _local15));
_local14 = _local16;
var _local17:int;
var _local18:Number = Number.MAX_VALUE;
var _local19:int;
while (_local19 < _local9) {
_local13 = _local11[_local19];
_local23 = ((_local14 * _local13.x) + (_local15 * _local13.y));
if (_local23 < _local18){
_local18 = _local23;
_local17 = _local19;
};
_local19++;
};
var _local21:int = _local17;
var _local22:int = (((_local21 + 1) < _local9)) ? (_local21 + 1) : 0;
_local20 = _arg1[0];
_local13 = _local10[_local21];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local21;
_local20.id.features.incidentVertex = 0;
_local20 = _arg1[1];
_local13 = _local10[_local22];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local22;
_local20.id.features.incidentVertex = 1;
}
public static function b2CollidePolygons(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):void{
var _local6:ClipVertex;
var _local13:b2PolygonShape;
var _local14:b2PolygonShape;
var _local17:int;
var _local18:uint;
var _local34:int;
var _local37:b2Vec2;
var _local38:Number;
var _local39:b2ManifoldPoint;
_arg1.pointCount = 0;
var _local7:int;
var _local8:Array = [_local7];
var _local9:Number = FindMaxSeparation(_local8, _arg2, _arg3, _arg4, _arg5);
_local7 = _local8[0];
if (_local9 > 0){
return;
};
var _local10:int;
var _local11:Array = [_local10];
var _local12:Number = FindMaxSeparation(_local11, _arg4, _arg5, _arg2, _arg3);
_local10 = _local11[0];
if (_local12 > 0){
return;
};
var _local15:b2XForm = new b2XForm();
var _local16:b2XForm = new b2XForm();
var _local19:Number = 0.98;
var _local20:Number = 0.001;
if (_local12 > ((_local19 * _local9) + _local20)){
_local13 = _arg4;
_local14 = _arg2;
_local15.Set(_arg5);
_local16.Set(_arg3);
_local17 = _local10;
_local18 = 1;
} else {
_local13 = _arg2;
_local14 = _arg4;
_local15.Set(_arg3);
_local16.Set(_arg5);
_local17 = _local7;
_local18 = 0;
};
var _local21:Array = [new ClipVertex(), new ClipVertex()];
FindIncidentEdge(_local21, _local13, _local15, _local17, _local14, _local16);
var _local22:int = _local13.m_vertexCount;
var _local23:Array = _local13.m_vertices;
var _local24:b2Vec2 = _local23[_local17];
var _local25:b2Vec2 = _local24.Copy();
if ((_local17 + 1) < _local22){
_local24 = _local23[int((_local17 + 1))];
_local37 = _local24.Copy();
} else {
_local24 = _local23[0];
_local37 = _local24.Copy();
};
var _local26:b2Vec2 = b2Math.SubtractVV(_local37, _local25);
var _local27:b2Vec2 = b2Math.b2MulMV(_local15.R, b2Math.SubtractVV(_local37, _local25));
_local27.Normalize();
var _local28:b2Vec2 = b2Math.b2CrossVF(_local27, 1);
_local25 = b2Math.b2MulX(_local15, _local25);
_local37 = b2Math.b2MulX(_local15, _local37);
var _local29:Number = b2Math.b2Dot(_local28, _local25);
var _local30:Number = -(b2Math.b2Dot(_local27, _local25));
var _local31:Number = b2Math.b2Dot(_local27, _local37);
var _local32:Array = [new ClipVertex(), new ClipVertex()];
var _local33:Array = [new ClipVertex(), new ClipVertex()];
_local34 = ClipSegmentToLine(_local32, _local21, _local27.Negative(), _local30);
if (_local34 < 2){
return;
};
_local34 = ClipSegmentToLine(_local33, _local32, _local27, _local31);
if (_local34 < 2){
return;
};
_arg1.normal = (_local18) ? _local28.Negative() : _local28.Copy();
var _local35:int;
var _local36:int;
while (_local36 < b2Settings.b2_maxManifoldPoints) {
_local6 = _local33[_local36];
_local38 = (b2Math.b2Dot(_local28, _local6.v) - _local29);
if (_local38 <= 0){
_local39 = _arg1.points[_local35];
_local39.separation = _local38;
_local39.localPoint1 = b2Math.b2MulXT(_arg3, _local6.v);
_local39.localPoint2 = b2Math.b2MulXT(_arg5, _local6.v);
_local39.id.key = _local6.id._key;
_local39.id.features.flip = _local18;
_local35++;
};
_local36++;
};
_arg1.pointCount = _local35;
}
public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local8:b2Vec2;
var _local9:b2Mat22;
var _local22:int;
var _local23:Number;
var _local24:int;
var _local25:Number;
var _local6:int = _arg2.m_vertexCount;
var _local7:Array = _arg2.m_normals;
_local9 = _arg5.R;
_local8 = _arg4.m_centroid;
var _local10:Number = (_arg5.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y)));
var _local11:Number = (_arg5.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y)));
_local9 = _arg3.R;
_local8 = _arg2.m_centroid;
_local10 = (_local10 - (_arg3.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y))));
_local11 = (_local11 - (_arg3.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y))));
var _local12:Number = ((_local10 * _arg3.R.col1.x) + (_local11 * _arg3.R.col1.y));
var _local13:Number = ((_local10 * _arg3.R.col2.x) + (_local11 * _arg3.R.col2.y));
var _local14:int;
var _local15:Number = -(Number.MAX_VALUE);
var _local16:int;
while (_local16 < _local6) {
_local8 = _local7[_local16];
_local25 = ((_local8.x * _local12) + (_local8.y * _local13));
if (_local25 > _local15){
_local15 = _local25;
_local14 = _local16;
};
_local16++;
};
var _local17:Number = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
var _local18:int = (((_local14 - 1) >= 0)) ? (_local14 - 1) : (_local6 - 1);
var _local19:Number = EdgeSeparation(_arg2, _arg3, _local18, _arg4, _arg5);
if (_local19 > 0){
return (_local19);
};
var _local20:int = (((_local14 + 1) < _local6)) ? (_local14 + 1) : 0;
var _local21:Number = EdgeSeparation(_arg2, _arg3, _local20, _arg4, _arg5);
if (_local21 > 0){
return (_local21);
};
if ((((_local19 > _local17)) && ((_local19 > _local21)))){
_local24 = -1;
_local22 = _local18;
_local23 = _local19;
} else {
if (_local21 > _local17){
_local24 = 1;
_local22 = _local20;
_local23 = _local21;
} else {
_arg1[0] = _local14;
return (_local17);
};
};
while (true) {
if (_local24 == -1){
_local14 = (((_local22 - 1) >= 0)) ? (_local22 - 1) : (_local6 - 1);
} else {
_local14 = (((_local22 + 1) < _local6)) ? (_local22 + 1) : 0;
};
_local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
if (_local17 > _local23){
_local22 = _local14;
_local23 = _local17;
} else {
break;
};
};
_arg1[0] = _local22;
return (_local23);
}
public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{
var _local5:ClipVertex;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:Number;
var _local11:Number;
var _local12:b2Vec2;
var _local13:ClipVertex;
_local6 = 0;
_local5 = _arg2[0];
_local7 = _local5.v;
_local5 = _arg2[1];
_local8 = _local5.v;
_local9 = (b2Math.b2Dot(_arg3, _local7) - _arg4);
var _local10:Number = (b2Math.b2Dot(_arg3, _local8) - _arg4);
if (_local9 <= 0){
var _temp1 = _local6;
_local6 = (_local6 + 1);
var _local14 = _temp1;
_arg1[_local14] = _arg2[0];
};
if (_local10 <= 0){
var _temp2 = _local6;
_local6 = (_local6 + 1);
_local14 = _temp2;
_arg1[_local14] = _arg2[1];
};
if ((_local9 * _local10) < 0){
_local11 = (_local9 / (_local9 - _local10));
_local5 = _arg1[_local6];
_local12 = _local5.v;
_local12.x = (_local7.x + (_local11 * (_local8.x - _local7.x)));
_local12.y = (_local7.y + (_local11 * (_local8.y - _local7.y)));
_local5 = _arg1[_local6];
if (_local9 > 0){
_local13 = _arg2[0];
_local5.id = _local13.id;
} else {
_local13 = _arg2[1];
_local5.id = _local13.id;
};
_local6++;
};
return (_local6);
}
public static function b2CollideCircles(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2Mat22;
var _local7:b2Vec2;
var _local18:Number;
var _local24:Number;
var _local25:Number;
_arg1.pointCount = 0;
_local6 = _arg3.R;
_local7 = _arg2.m_localPosition;
var _local8:Number = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
var _local9:Number = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local6 = _arg5.R;
_local7 = _arg4.m_localPosition;
var _local10:Number = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
var _local11:Number = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
var _local12:Number = (_local10 - _local8);
var _local13:Number = (_local11 - _local9);
var _local14:Number = ((_local12 * _local12) + (_local13 * _local13));
var _local15:Number = _arg2.m_radius;
var _local16:Number = _arg4.m_radius;
var _local17:Number = (_local15 + _local16);
if (_local14 > (_local17 * _local17)){
return;
};
if (_local14 < Number.MIN_VALUE){
_local18 = -(_local17);
_arg1.normal.Set(0, 1);
} else {
_local24 = Math.sqrt(_local14);
_local18 = (_local24 - _local17);
_local25 = (1 / _local24);
_arg1.normal.x = (_local25 * _local12);
_arg1.normal.y = (_local25 * _local13);
};
_arg1.pointCount = 1;
var _local19:b2ManifoldPoint = _arg1.points[0];
_local19.id.key = 0;
_local19.separation = _local18;
_local8 = (_local8 + (_local15 * _arg1.normal.x));
_local9 = (_local9 + (_local15 * _arg1.normal.y));
_local10 = (_local10 - (_local16 * _arg1.normal.x));
_local11 = (_local11 - (_local16 * _arg1.normal.y));
var _local20:Number = (0.5 * (_local8 + _local10));
var _local21:Number = (0.5 * (_local9 + _local11));
var _local22:Number = (_local20 - _arg3.position.x);
var _local23:Number = (_local21 - _arg3.position.y);
_local19.localPoint1.x = ((_local22 * _arg3.R.col1.x) + (_local23 * _arg3.R.col1.y));
_local19.localPoint1.y = ((_local22 * _arg3.R.col2.x) + (_local23 * _arg3.R.col2.y));
_local22 = (_local20 - _arg5.position.x);
_local23 = (_local21 - _arg5.position.y);
_local19.localPoint2.x = ((_local22 * _arg5.R.col1.x) + (_local23 * _arg5.R.col1.y));
_local19.localPoint2.y = ((_local22 * _arg5.R.col2.x) + (_local23 * _arg5.R.col2.y));
}
public static function b2CollidePolygonAndCircle(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2ManifoldPoint;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:b2Vec2;
var _local12:b2Mat22;
var _local17:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
_arg1.pointCount = 0;
_local12 = _arg5.R;
_local11 = _arg4.m_localPosition;
var _local13:Number = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y)));
var _local14:Number = (_arg5.position.y + ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y)));
_local7 = (_local13 - _arg3.position.x);
_local8 = (_local14 - _arg3.position.y);
_local12 = _arg3.R;
var _local15:Number = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
var _local16:Number = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
var _local18:int;
var _local19:Number = -(Number.MAX_VALUE);
var _local20:Number = _arg4.m_radius;
var _local21:int = _arg2.m_vertexCount;
var _local22:Array = _arg2.m_vertices;
var _local23:Array = _arg2.m_normals;
var _local24:int;
while (_local24 < _local21) {
_local11 = _local22[_local24];
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local11 = _local23[_local24];
_local34 = ((_local11.x * _local7) + (_local11.y * _local8));
if (_local34 > _local20){
return;
};
if (_local34 > _local19){
_local19 = _local34;
_local18 = _local24;
};
_local24++;
};
if (_local19 < Number.MIN_VALUE){
_arg1.pointCount = 1;
_local11 = _local23[_local18];
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y));
_arg1.normal.y = ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y));
_local6 = _arg1.points[0];
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = b2_nullFeature;
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local19 - _local20);
return;
};
var _local25:int = _local18;
var _local26:int = (((_local25 + 1) < _local21)) ? (_local25 + 1) : 0;
_local11 = _local22[_local25];
var _local27:b2Vec2 = _local22[_local26];
var _local28:Number = (_local27.x - _local11.x);
var _local29:Number = (_local27.y - _local11.y);
var _local30:Number = Math.sqrt(((_local28 * _local28) + (_local29 * _local29)));
_local28 = (_local28 / _local30);
_local29 = (_local29 / _local30);
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
var _local31:Number = ((_local7 * _local28) + (_local8 * _local29));
_local6 = _arg1.points[0];
if (_local31 <= 0){
_local32 = _local11.x;
_local33 = _local11.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local25;
} else {
if (_local31 >= _local30){
_local32 = _local27.x;
_local33 = _local27.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local26;
} else {
_local32 = ((_local28 * _local31) + _local11.x);
_local33 = ((_local29 * _local31) + _local11.y);
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = b2_nullFeature;
};
};
_local7 = (_local15 - _local32);
_local8 = (_local16 - _local33);
_local17 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local7 = (_local7 / _local17);
_local8 = (_local8 / _local17);
if (_local17 > _local20){
return;
};
_arg1.pointCount = 1;
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local7) + (_local12.col2.x * _local8));
_arg1.normal.y = ((_local12.col1.y * _local7) + (_local12.col2.y * _local8));
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local17 - _local20);
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
}
}
}//package Box2D.Collision
Section 15
//b2ContactID (Box2D.Collision.b2ContactID)
package Box2D.Collision {
public class b2ContactID {
public var _key:uint;
public var features:Features;
public function b2ContactID(){
features = new Features();
super();
features._m_id = this;
}
public function Set(_arg1:b2ContactID):void{
key = _arg1._key;
}
public function Copy():b2ContactID{
var _local1:b2ContactID = new b2ContactID();
_local1.key = key;
return (_local1);
}
public function set key(_arg1:uint):void{
_key = _arg1;
features._referenceEdge = (_key & 0xFF);
features._incidentEdge = (((_key & 0xFF00) >> 8) & 0xFF);
features._incidentVertex = (((_key & 0xFF0000) >> 16) & 0xFF);
features._flip = (((_key & 4278190080) >> 24) & 0xFF);
}
public function get key():uint{
return (_key);
}
}
}//package Box2D.Collision
Section 16
//b2ContactPoint (Box2D.Collision.b2ContactPoint)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class b2ContactPoint {
public var friction:Number;
public var separation:Number;
public var normal:b2Vec2;
public var position:b2Vec2;
public var restitution:Number;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var id:b2ContactID;
public var velocity:b2Vec2;
public function b2ContactPoint(){
position = new b2Vec2();
velocity = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 17
//b2Distance (Box2D.Collision.b2Distance)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Distance {
private static var s_p2s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var s_p1s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var s_points:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var gPoint:b2Point = new b2Point();
public static var g_GJK_Iterations:int = 0;
public static function InPoints(_arg1:b2Vec2, _arg2:Array, _arg3:int):Boolean{
var _local6:b2Vec2;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local4:Number = (100 * Number.MIN_VALUE);
var _local5:int;
while (_local5 < _arg3) {
_local6 = _arg2[_local5];
_local7 = Math.abs((_arg1.x - _local6.x));
_local8 = Math.abs((_arg1.y - _local6.y));
_local9 = Math.max(Math.abs(_arg1.x), Math.abs(_local6.x));
_local10 = Math.max(Math.abs(_arg1.y), Math.abs(_local6.y));
if ((((_local7 < (_local4 * (_local9 + 1)))) && ((_local8 < (_local4 * (_local10 + 1)))))){
return (true);
};
_local5++;
};
return (false);
}
public static function DistanceGeneric(_arg1:b2Vec2, _arg2:b2Vec2, _arg3, _arg4:b2XForm, _arg5, _arg6:b2XForm):Number{
var _local7:b2Vec2;
var _local15:Number;
var _local16:Number;
var _local17:b2Vec2;
var _local18:b2Vec2;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:int;
var _local8:Array = s_p1s;
var _local9:Array = s_p2s;
var _local10:Array = s_points;
var _local11:int;
_arg1.SetV(_arg3.GetFirstVertex(_arg4));
_arg2.SetV(_arg5.GetFirstVertex(_arg6));
var _local12:Number = 0;
var _local13 = 20;
var _local14:int;
while (_local14 < _local13) {
_local15 = (_arg2.x - _arg1.x);
_local16 = (_arg2.y - _arg1.y);
_local17 = _arg3.Support(_arg4, _local15, _local16);
_local18 = _arg5.Support(_arg6, -(_local15), -(_local16));
_local12 = ((_local15 * _local15) + (_local16 * _local16));
_local19 = (_local18.x - _local17.x);
_local20 = (_local18.y - _local17.y);
_local21 = ((_local15 * _local19) + (_local16 * _local20));
if ((_local12 - _local21) <= (0.01 * _local12)){
if (_local11 == 0){
_arg1.SetV(_local17);
_arg2.SetV(_local18);
};
g_GJK_Iterations = _local14;
return (Math.sqrt(_local12));
};
switch (_local11){
case 0:
_local7 = _local8[0];
_local7.SetV(_local17);
_local7 = _local9[0];
_local7.SetV(_local18);
_local7 = _local10[0];
_local7.x = _local19;
_local7.y = _local20;
_arg1.SetV(_local8[0]);
_arg2.SetV(_local9[0]);
_local11++;
break;
case 1:
_local7 = _local8[1];
_local7.SetV(_local17);
_local7 = _local9[1];
_local7.SetV(_local18);
_local7 = _local10[1];
_local7.x = _local19;
_local7.y = _local20;
_local11 = ProcessTwo(_arg1, _arg2, _local8, _local9, _local10);
break;
case 2:
_local7 = _local8[2];
_local7.SetV(_local17);
_local7 = _local9[2];
_local7.SetV(_local18);
_local7 = _local10[2];
_local7.x = _local19;
_local7.y = _local20;
_local11 = ProcessThree(_arg1, _arg2, _local8, _local9, _local10);
break;
};
if (_local11 == 3){
g_GJK_Iterations = _local14;
return (0);
};
_local22 = -(Number.MAX_VALUE);
_local23 = 0;
while (_local23 < _local11) {
_local7 = _local10[_local23];
_local22 = b2Math.b2Max(_local22, ((_local7.x * _local7.x) + (_local7.y * _local7.y)));
_local23++;
};
if ((((_local11 == 3)) || ((_local12 <= ((100 * Number.MIN_VALUE) * _local22))))){
g_GJK_Iterations = _local14;
_local15 = (_arg2.x - _arg1.x);
_local16 = (_arg2.y - _arg1.y);
_local12 = ((_local15 * _local15) + (_local16 * _local16));
return (Math.sqrt(_local12));
};
_local14++;
};
g_GJK_Iterations = _local13;
return (Math.sqrt(_local12));
}
public static function DistanceCC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2CircleShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local19:Number;
var _local20:Number;
_local7 = _arg4.R;
_local8 = _arg3.m_localPosition;
var _local9:Number = (_arg4.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
var _local10:Number = (_arg4.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local7 = _arg6.R;
_local8 = _arg5.m_localPosition;
var _local11:Number = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
var _local12:Number = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
var _local13:Number = (_local11 - _local9);
var _local14:Number = (_local12 - _local10);
var _local15:Number = ((_local13 * _local13) + (_local14 * _local14));
var _local16:Number = (_arg3.m_radius - b2Settings.b2_toiSlop);
var _local17:Number = (_arg5.m_radius - b2Settings.b2_toiSlop);
var _local18:Number = (_local16 + _local17);
if (_local15 > (_local18 * _local18)){
_local19 = Math.sqrt(_local15);
_local13 = (_local13 / _local19);
_local14 = (_local14 / _local19);
_local20 = (_local19 - _local18);
_arg1.x = (_local9 + (_local16 * _local13));
_arg1.y = (_local10 + (_local16 * _local14));
_arg2.x = (_local11 - (_local17 * _local13));
_arg2.y = (_local12 - (_local17 * _local14));
return (_local20);
};
if (_local15 > (Number.MIN_VALUE * Number.MIN_VALUE)){
_local19 = Math.sqrt(_local15);
_local13 = (_local13 / _local19);
_local14 = (_local14 / _local19);
_arg1.x = (_local9 + (_local16 * _local13));
_arg1.y = (_local10 + (_local16 * _local14));
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
};
_arg1.x = _local9;
_arg1.y = _local10;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
}
public static function ProcessThree(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:b2Vec2;
var _local13:b2Vec2;
var _local35:Number;
_local6 = _arg5[0];
_local7 = _arg5[1];
_local8 = _arg5[2];
_local9 = _arg3[0];
_local10 = _arg3[1];
_local11 = _arg3[2];
_local12 = _arg4[0];
_local13 = _arg4[1];
var _local14:b2Vec2 = _arg4[2];
var _local15:Number = _local6.x;
var _local16:Number = _local6.y;
var _local17:Number = _local7.x;
var _local18:Number = _local7.y;
var _local19:Number = _local8.x;
var _local20:Number = _local8.y;
var _local21:Number = (_local17 - _local15);
var _local22:Number = (_local18 - _local16);
var _local23:Number = (_local19 - _local15);
var _local24:Number = (_local20 - _local16);
var _local25:Number = (_local19 - _local17);
var _local26:Number = (_local20 - _local18);
var _local27:Number = -(((_local15 * _local21) + (_local16 * _local22)));
var _local28:Number = ((_local17 * _local21) + (_local18 * _local22));
var _local29:Number = -(((_local15 * _local23) + (_local16 * _local24)));
var _local30:Number = ((_local19 * _local23) + (_local20 * _local24));
var _local31:Number = -(((_local17 * _local25) + (_local18 * _local26)));
var _local32:Number = ((_local19 * _local25) + (_local20 * _local26));
if ((((_local30 <= 0)) && ((_local32 <= 0)))){
_arg1.SetV(_local11);
_arg2.SetV(_local14);
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (1);
};
var _local33:Number = ((_local21 * _local24) - (_local22 * _local23));
var _local34:Number = (_local33 * ((_local15 * _local18) - (_local16 * _local17)));
var _local36:Number = (_local33 * ((_local17 * _local20) - (_local18 * _local19)));
if ((((((((_local36 <= 0)) && ((_local31 >= 0)))) && ((_local32 >= 0)))) && (((_local31 + _local32) > 0)))){
_local35 = (_local31 / (_local31 + _local32));
_arg1.x = (_local10.x + (_local35 * (_local11.x - _local10.x)));
_arg1.y = (_local10.y + (_local35 * (_local11.y - _local10.y)));
_arg2.x = (_local13.x + (_local35 * (_local14.x - _local13.x)));
_arg2.y = (_local13.y + (_local35 * (_local14.y - _local13.y)));
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (2);
};
var _local37:Number = (_local33 * ((_local19 * _local16) - (_local20 * _local15)));
if ((((((((_local37 <= 0)) && ((_local29 >= 0)))) && ((_local30 >= 0)))) && (((_local29 + _local30) > 0)))){
_local35 = (_local29 / (_local29 + _local30));
_arg1.x = (_local9.x + (_local35 * (_local11.x - _local9.x)));
_arg1.y = (_local9.y + (_local35 * (_local11.y - _local9.y)));
_arg2.x = (_local12.x + (_local35 * (_local14.x - _local12.x)));
_arg2.y = (_local12.y + (_local35 * (_local14.y - _local12.y)));
_local10.SetV(_local11);
_local13.SetV(_local14);
_local7.SetV(_local8);
return (2);
};
var _local38:Number = ((_local36 + _local37) + _local34);
_local38 = (1 / _local38);
var _local39:Number = (_local36 * _local38);
var _local40:Number = (_local37 * _local38);
var _local41:Number = ((1 - _local39) - _local40);
_arg1.x = (((_local39 * _local9.x) + (_local40 * _local10.x)) + (_local41 * _local11.x));
_arg1.y = (((_local39 * _local9.y) + (_local40 * _local10.y)) + (_local41 * _local11.y));
_arg2.x = (((_local39 * _local12.x) + (_local40 * _local13.x)) + (_local41 * _local14.x));
_arg2.y = (((_local39 * _local12.y) + (_local40 * _local13.y)) + (_local41 * _local14.y));
return (3);
}
public static function DistancePC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2PolygonShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local9:b2Point = gPoint;
_local8 = _arg5.m_localPosition;
_local7 = _arg6.R;
_local9.p.x = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local9.p.y = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
var _local10:Number = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _local9, b2Math.b2XForm_identity);
var _local11:Number = (_arg5.m_radius - b2Settings.b2_toiSlop);
if (_local10 > _local11){
_local10 = (_local10 - _local11);
_local12 = (_arg2.x - _arg1.x);
_local13 = (_arg2.y - _arg1.y);
_local14 = Math.sqrt(((_local12 * _local12) + (_local13 * _local13)));
_local12 = (_local12 / _local14);
_local13 = (_local13 / _local14);
_arg2.x = (_arg2.x - (_local11 * _local12));
_arg2.y = (_arg2.y - (_local11 * _local13));
} else {
_local10 = 0;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
};
return (_local10);
}
public static function Distance(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Shape, _arg4:b2XForm, _arg5:b2Shape, _arg6:b2XForm):Number{
var _local7:int = _arg3.m_type;
var _local8:int = _arg5.m_type;
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistanceCC(_arg1, _arg2, (_arg3 as b2CircleShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistancePC(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistancePC(_arg2, _arg1, (_arg5 as b2PolygonShape), _arg6, (_arg3 as b2CircleShape), _arg4));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistanceGeneric(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2PolygonShape), _arg6));
};
return (0);
}
public static function ProcessTwo(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local17:Number;
var _local6:b2Vec2 = _arg5[0];
var _local7:b2Vec2 = _arg5[1];
var _local8:b2Vec2 = _arg3[0];
_local9 = _arg3[1];
_local10 = _arg4[0];
_local11 = _arg4[1];
var _local12:Number = -(_local7.x);
var _local13:Number = -(_local7.y);
var _local14:Number = (_local6.x - _local7.x);
var _local15:Number = (_local6.y - _local7.y);
var _local16:Number = Math.sqrt(((_local14 * _local14) + (_local15 * _local15)));
_local14 = (_local14 / _local16);
_local15 = (_local15 / _local16);
_local17 = ((_local12 * _local14) + (_local13 * _local15));
if ((((_local17 <= 0)) || ((_local16 < Number.MIN_VALUE)))){
_arg1.SetV(_local9);
_arg2.SetV(_local11);
_local8.SetV(_local9);
_local10.SetV(_local11);
_local6.SetV(_local7);
return (1);
};
_local17 = (_local17 / _local16);
_arg1.x = (_local9.x + (_local17 * (_local8.x - _local9.x)));
_arg1.y = (_local9.y + (_local17 * (_local8.y - _local9.y)));
_arg2.x = (_local11.x + (_local17 * (_local10.x - _local11.x)));
_arg2.y = (_local11.y + (_local17 * (_local10.y - _local11.y)));
return (2);
}
}
}//package Box2D.Collision
Section 18
//b2Manifold (Box2D.Collision.b2Manifold)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Manifold {
public var pointCount:int;// = 0
public var normal:b2Vec2;
public var points:Array;
public function b2Manifold(){
points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ManifoldPoint();
_local1++;
};
normal = new b2Vec2();
}
public function Set(_arg1:b2Manifold):void{
pointCount = _arg1.pointCount;
var _local2:int;
while (_local2 < b2Settings.b2_maxManifoldPoints) {
(points[_local2] as b2ManifoldPoint).Set(_arg1.points[_local2]);
_local2++;
};
normal.SetV(_arg1.normal);
}
public function Reset():void{
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
(points[_local1] as b2ManifoldPoint).Reset();
_local1++;
};
normal.SetZero();
pointCount = 0;
}
}
}//package Box2D.Collision
Section 19
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2ManifoldPoint {
public var separation:Number;
public var localPoint2:b2Vec2;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var localPoint1:b2Vec2;
public var id:b2ContactID;
public function b2ManifoldPoint(){
localPoint1 = new b2Vec2();
localPoint2 = new b2Vec2();
id = new b2ContactID();
super();
}
public function Set(_arg1:b2ManifoldPoint):void{
localPoint1.SetV(_arg1.localPoint1);
localPoint2.SetV(_arg1.localPoint2);
separation = _arg1.separation;
normalImpulse = _arg1.normalImpulse;
tangentImpulse = _arg1.tangentImpulse;
id.key = _arg1.id.key;
}
public function Reset():void{
localPoint1.SetZero();
localPoint2.SetZero();
separation = 0;
normalImpulse = 0;
tangentImpulse = 0;
id.key = 0;
}
}
}//package Box2D.Collision
Section 20
//b2OBB (Box2D.Collision.b2OBB)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2OBB {
public var R:b2Mat22;
public var center:b2Vec2;
public var extents:b2Vec2;
public function b2OBB(){
R = new b2Mat22();
center = new b2Vec2();
extents = new b2Vec2();
super();
}
}
}//package Box2D.Collision
Section 21
//b2Pair (Box2D.Collision.b2Pair)
package Box2D.Collision {
import Box2D.Common.*;
public class b2Pair {
public var proxyId1:uint;
public var userData;// = null
public var proxyId2:uint;
public var status:uint;
public var next:uint;
public static var e_pairFinal:uint = 4;
public static var b2_tableMask:int = (b2_tableCapacity - 1);
public static var e_pairRemoved:uint = 2;
public static var b2_nullPair:uint = b2Settings.USHRT_MAX;
public static var e_pairBuffered:uint = 1;
public static var b2_nullProxy:uint = b2Settings.USHRT_MAX;
public static var b2_tableCapacity:int = b2Settings.b2_maxPairs;
public function SetBuffered():void{
status = (status | e_pairBuffered);
}
public function IsBuffered():Boolean{
return (((status & e_pairBuffered) == e_pairBuffered));
}
public function IsFinal():Boolean{
return (((status & e_pairFinal) == e_pairFinal));
}
public function ClearRemoved():void{
status = (status & ~(e_pairRemoved));
}
public function SetFinal():void{
status = (status | e_pairFinal);
}
public function IsRemoved():Boolean{
return (((status & e_pairRemoved) == e_pairRemoved));
}
public function ClearBuffered():void{
status = (status & ~(e_pairBuffered));
}
public function SetRemoved():void{
status = (status | e_pairRemoved);
}
}
}//package Box2D.Collision
Section 22
//b2PairCallback (Box2D.Collision.b2PairCallback)
package Box2D.Collision {
public class b2PairCallback {
public function PairRemoved(_arg1, _arg2, _arg3):void{
}
public function PairAdded(_arg1, _arg2){
return (null);
}
}
}//package Box2D.Collision
Section 23
//b2PairManager (Box2D.Collision.b2PairManager)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PairManager {
public var m_pairCount:int;
public var m_pairBuffer:Array;
public var m_hashTable:Array;
public var m_callback:b2PairCallback;
public var m_pairs:Array;
public var m_pairBufferCount:int;
public var m_broadPhase:b2BroadPhase;
public var m_freePair:uint;
public function b2PairManager(){
var _local1:uint;
super();
m_hashTable = new Array(b2Pair.b2_tableCapacity);
_local1 = 0;
while (_local1 < b2Pair.b2_tableCapacity) {
m_hashTable[_local1] = b2Pair.b2_nullPair;
_local1++;
};
m_pairs = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1] = new b2Pair();
_local1++;
};
m_pairBuffer = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairBuffer[_local1] = new b2BufferedPair();
_local1++;
};
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy;
m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy;
m_pairs[_local1].userData = null;
m_pairs[_local1].status = 0;
m_pairs[_local1].next = (_local1 + 1);
_local1++;
};
m_pairs[int((b2Settings.b2_maxPairs - 1))].next = b2Pair.b2_nullPair;
m_pairCount = 0;
m_pairBufferCount = 0;
}
private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{
var _local4:b2Pair;
var _local5:uint = m_hashTable[_arg3];
_local4 = m_pairs[_local5];
while (((!((_local5 == b2Pair.b2_nullPair))) && ((Equals(_local4, _arg1, _arg2) == false)))) {
_local5 = _local4.next;
_local4 = m_pairs[_local5];
};
if (_local5 == b2Pair.b2_nullPair){
return (null);
};
return (_local4);
}
private function Find(_arg1:uint, _arg2:uint):b2Pair{
var _local4:uint;
if (_arg1 > _arg2){
_local4 = _arg1;
_arg1 = _arg2;
_arg2 = _local4;
};
var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
return (FindHash(_arg1, _arg2, _local3));
}
private function ValidateBuffer():void{
}
public function Commit():void{
var _local1:b2BufferedPair;
var _local2:int;
var _local5:b2Pair;
var _local6:b2Proxy;
var _local7:b2Proxy;
var _local3:int;
var _local4:Array = m_broadPhase.m_proxyPool;
_local2 = 0;
while (_local2 < m_pairBufferCount) {
_local1 = m_pairBuffer[_local2];
_local5 = Find(_local1.proxyId1, _local1.proxyId2);
_local5.ClearBuffered();
_local6 = _local4[_local5.proxyId1];
_local7 = _local4[_local5.proxyId2];
if (_local5.IsRemoved()){
if (_local5.IsFinal() == true){
m_callback.PairRemoved(_local6.userData, _local7.userData, _local5.userData);
};
_local1 = m_pairBuffer[_local3];
_local1.proxyId1 = _local5.proxyId1;
_local1.proxyId2 = _local5.proxyId2;
_local3++;
} else {
if (_local5.IsFinal() == false){
_local5.userData = m_callback.PairAdded(_local6.userData, _local7.userData);
_local5.SetFinal();
};
};
_local2++;
};
_local2 = 0;
while (_local2 < _local3) {
_local1 = m_pairBuffer[_local2];
RemovePair(_local1.proxyId1, _local1.proxyId2);
_local2++;
};
m_pairBufferCount = 0;
if (b2BroadPhase.s_validate){
ValidateTable();
};
}
public function RemoveBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair = Find(_arg1, _arg2);
if (_local4 == null){
return;
};
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.SetRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function RemovePair(_arg1:uint, _arg2:uint){
var _local3:b2Pair;
var _local7:uint;
var _local8:uint;
var _local9:*;
if (_arg1 > _arg2){
_local7 = _arg1;
_arg1 = _arg2;
_arg2 = _local7;
};
var _local4:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
var _local5:uint = m_hashTable[_local4];
var _local6:b2Pair;
while (_local5 != b2Pair.b2_nullPair) {
if (Equals(m_pairs[_local5], _arg1, _arg2)){
_local8 = _local5;
_local3 = m_pairs[_local5];
if (_local6){
_local6.next = _local3.next;
} else {
m_hashTable[_local4] = _local3.next;
};
_local3 = m_pairs[_local8];
_local9 = _local3.userData;
_local3.next = m_freePair;
_local3.proxyId1 = b2Pair.b2_nullProxy;
_local3.proxyId2 = b2Pair.b2_nullProxy;
_local3.userData = null;
_local3.status = 0;
m_freePair = _local8;
m_pairCount--;
return (_local9);
} else {
_local6 = m_pairs[_local5];
_local5 = _local6.next;
};
};
return (null);
}
public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{
m_broadPhase = _arg1;
m_callback = _arg2;
}
public function AddBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair = AddPair(_arg1, _arg2);
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.ClearRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function AddPair(_arg1:uint, _arg2:uint):b2Pair{
var _local6:uint;
if (_arg1 > _arg2){
_local6 = _arg1;
_arg1 = _arg2;
_arg2 = _local6;
};
var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
var _local4 = FindHash(_arg1, _arg2, _local3);
if (_local4 != null){
return (_local4);
};
var _local5:uint = m_freePair;
_local4 = m_pairs[_local5];
m_freePair = _local4.next;
_local4.proxyId1 = _arg1;
_local4.proxyId2 = _arg2;
_local4.status = 0;
_local4.userData = null;
_local4.next = m_hashTable[_local3];
m_hashTable[_local3] = _local5;
m_pairCount++;
return (_local4);
}
private function ValidateTable():void{
}
public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{
return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2))));
}
public static function Hash(_arg1:uint, _arg2:uint):uint{
var _local3:uint = (((_arg2 << 16) & 4294901760) | _arg1);
_local3 = (~(_local3) + ((_local3 << 15) & 4294934528));
_local3 = (_local3 ^ ((_local3 >> 12) & 1048575));
_local3 = (_local3 + ((_local3 << 2) & 4294967292));
_local3 = (_local3 ^ ((_local3 >> 4) & 268435455));
_local3 = (_local3 * 2057);
_local3 = (_local3 ^ ((_local3 >> 16) & 0xFFFF));
return (_local3);
}
public static function Equals(_arg1:b2Pair, _arg2:uint, _arg3:uint):Boolean{
return ((((_arg1.proxyId1 == _arg2)) && ((_arg1.proxyId2 == _arg3))));
}
}
}//package Box2D.Collision
Section 24
//b2Point (Box2D.Collision.b2Point)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2Point {
public var p:b2Vec2;
public function b2Point(){
p = new b2Vec2();
super();
}
public function GetFirstVertex(_arg1:b2XForm):b2Vec2{
return (p);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
return (p);
}
}
}//package Box2D.Collision
Section 25
//b2Proxy (Box2D.Collision.b2Proxy)
package Box2D.Collision {
public class b2Proxy {
public var overlapCount:uint;
public var userData;// = null
public var lowerBounds:Array;
public var upperBounds:Array;
public var timeStamp:uint;
public function b2Proxy(){
lowerBounds = [uint(0), uint(0)];
upperBounds = [uint(0), uint(0)];
super();
}
public function GetNext():uint{
return (lowerBounds[0]);
}
public function IsValid():Boolean{
return (!((overlapCount == b2BroadPhase.b2_invalid)));
}
public function SetNext(_arg1:uint):void{
lowerBounds[0] = (_arg1 & 0xFFFF);
}
}
}//package Box2D.Collision
Section 26
//b2Segment (Box2D.Collision.b2Segment)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Segment {
public var p1:b2Vec2;
public var p2:b2Vec2;
public function b2Segment(){
p1 = new b2Vec2();
p2 = new b2Vec2();
super();
}
public function TestSegment(_arg1:Array, _arg2:b2Vec2, _arg3:b2Segment, _arg4:Number):Boolean{
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local5:b2Vec2 = _arg3.p1;
var _local6:Number = (_arg3.p2.x - _local5.x);
var _local7:Number = (_arg3.p2.y - _local5.y);
var _local8:Number = (p2.x - p1.x);
var _local9:Number = (p2.y - p1.y);
var _local10:Number = _local9;
var _local11:Number = -(_local8);
var _local12:Number = (100 * Number.MIN_VALUE);
var _local13:Number = -(((_local6 * _local10) + (_local7 * _local11)));
if (_local13 > _local12){
_local14 = (_local5.x - p1.x);
_local15 = (_local5.y - p1.y);
_local16 = ((_local14 * _local10) + (_local15 * _local11));
if ((((0 <= _local16)) && ((_local16 <= (_arg4 * _local13))))){
_local17 = ((-(_local6) * _local15) + (_local7 * _local14));
if (((((-(_local12) * _local13) <= _local17)) && ((_local17 <= (_local13 * (1 + _local12)))))){
_local16 = (_local16 / _local13);
_local18 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
_local10 = (_local10 / _local18);
_local11 = (_local11 / _local18);
_arg1[0] = _local16;
_arg2.Set(_local10, _local11);
return (true);
};
};
};
return (false);
}
}
}//package Box2D.Collision
Section 27
//b2TimeOfImpact (Box2D.Collision.b2TimeOfImpact)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2TimeOfImpact {
public static var s_xf1:b2XForm = new b2XForm();
public static var s_xf2:b2XForm = new b2XForm();
public static var s_p1:b2Vec2 = new b2Vec2();
public static var s_p2:b2Vec2 = new b2Vec2();
public static function TimeOfImpact(_arg1:b2Shape, _arg2:b2Sweep, _arg3:b2Shape, _arg4:b2Sweep):Number{
var _local5:Number;
var _local6:Number;
var _local25:Number;
var _local26:b2XForm;
var _local27:b2XForm;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local7:Number = _arg1.m_sweepRadius;
var _local8:Number = _arg3.m_sweepRadius;
var _local9:Number = _arg2.t0;
var _local10:Number = (_arg2.c.x - _arg2.c0.x);
var _local11:Number = (_arg2.c.y - _arg2.c0.y);
var _local12:Number = (_arg4.c.x - _arg4.c0.x);
var _local13:Number = (_arg4.c.y - _arg4.c0.y);
var _local14:Number = (_arg2.a - _arg2.a0);
var _local15:Number = (_arg4.a - _arg4.a0);
var _local16:Number = 0;
var _local17:b2Vec2 = s_p1;
var _local18:b2Vec2 = s_p2;
var _local19 = 20;
var _local20:int;
var _local21:Number = 0;
var _local22:Number = 0;
var _local23:Number = 0;
var _local24:Number = 0;
while (true) {
_local25 = (((1 - _local16) * _local9) + _local16);
_local26 = s_xf1;
_local27 = s_xf2;
_arg2.GetXForm(_local26, _local25);
_arg4.GetXForm(_local27, _local25);
_local23 = b2Distance.Distance(_local17, _local18, _arg1, _local26, _arg3, _local27);
if (_local20 == 0){
if (_local23 > (2 * b2Settings.b2_toiSlop)){
_local24 = (1.5 * b2Settings.b2_toiSlop);
} else {
_local5 = (0.05 * b2Settings.b2_toiSlop);
_local6 = (_local23 - (0.5 * b2Settings.b2_toiSlop));
_local24 = ((_local5 > _local6)) ? _local5 : _local6;
};
};
if (((((_local23 - _local24) < (0.05 * b2Settings.b2_toiSlop))) || ((_local20 == _local19)))){
break;
};
_local21 = (_local18.x - _local17.x);
_local22 = (_local18.y - _local17.y);
_local28 = Math.sqrt(((_local21 * _local21) + (_local22 * _local22)));
_local21 = (_local21 / _local28);
_local22 = (_local22 / _local28);
_local29 = ((((_local21 * (_local10 - _local12)) + (_local22 * (_local11 - _local13))) + (((_local14 < 0)) ? -(_local14) : _local14 * _local7)) + (((_local15 < 0)) ? -(_local15) : _local15 * _local8));
if (_local29 == 0){
_local16 = 1;
break;
};
_local30 = ((_local23 - _local24) / _local29);
_local31 = (_local16 + _local30);
if ((((_local31 < 0)) || ((1 < _local31)))){
_local16 = 1;
break;
};
if (_local31 < ((1 + (100 * Number.MIN_VALUE)) * _local16)){
break;
};
_local16 = _local31;
_local20++;
};
return (_local16);
}
}
}//package Box2D.Collision
Section 28
//ClipVertex (Box2D.Collision.ClipVertex)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class ClipVertex {
public var id:b2ContactID;
public var v:b2Vec2;
public function ClipVertex(){
v = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 29
//Features (Box2D.Collision.Features)
package Box2D.Collision {
public class Features {
public var _referenceEdge:int;
public var _incidentEdge:int;
public var _flip:int;
public var _incidentVertex:int;
public var _m_id:b2ContactID;
public function get referenceEdge():int{
return (_referenceEdge);
}
public function set incidentVertex(_arg1:int):void{
_incidentVertex = _arg1;
_m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000));
}
public function get flip():int{
return (_flip);
}
public function get incidentEdge():int{
return (_incidentEdge);
}
public function set referenceEdge(_arg1:int):void{
_referenceEdge = _arg1;
_m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF));
}
public function get incidentVertex():int{
return (_incidentVertex);
}
public function set flip(_arg1:int):void{
_flip = _arg1;
_m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080));
}
public function set incidentEdge(_arg1:int):void{
_incidentEdge = _arg1;
_m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00));
}
}
}//package Box2D.Collision
Section 30
//b2Mat22 (Box2D.Common.Math.b2Mat22)
package Box2D.Common.Math {
public class b2Mat22 {
public var col1:b2Vec2;
public var col2:b2Vec2;
public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){
var _local4:Number;
var _local5:Number;
col1 = new b2Vec2();
col2 = new b2Vec2();
super();
if (((!((_arg2 == null))) && (!((_arg3 == null))))){
col1.SetV(_arg2);
col2.SetV(_arg3);
} else {
_local4 = Math.cos(_arg1);
_local5 = Math.sin(_arg1);
col1.x = _local4;
col2.x = -(_local5);
col1.y = _local5;
col2.y = _local4;
};
}
public function SetIdentity():void{
col1.x = 1;
col2.x = 0;
col1.y = 0;
col2.y = 1;
}
public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{
col1.SetV(_arg1);
col2.SetV(_arg2);
}
public function Set(_arg1:Number):void{
var _local2:Number;
_local2 = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
col1.x = _local2;
col2.x = -(_local3);
col1.y = _local3;
col2.y = _local2;
}
public function SetZero():void{
col1.x = 0;
col2.x = 0;
col1.y = 0;
col2.y = 0;
}
public function SetM(_arg1:b2Mat22):void{
col1.SetV(_arg1.col1);
col2.SetV(_arg1.col2);
}
public function AddM(_arg1:b2Mat22):void{
col1.x = (col1.x + _arg1.col1.x);
col1.y = (col1.y + _arg1.col1.y);
col2.x = (col2.x + _arg1.col2.x);
col2.y = (col2.y + _arg1.col2.y);
}
public function Abs():void{
col1.Abs();
col2.Abs();
}
public function Copy():b2Mat22{
return (new b2Mat22(0, col1, col2));
}
public function Invert(_arg1:b2Mat22):b2Mat22{
var _local2:Number;
var _local4:Number;
var _local6:Number;
_local2 = col1.x;
var _local3:Number = col2.x;
_local4 = col1.y;
var _local5:Number = col2.y;
_local6 = ((_local2 * _local5) - (_local3 * _local4));
_local6 = (1 / _local6);
_arg1.col1.x = (_local6 * _local5);
_arg1.col2.x = (-(_local6) * _local3);
_arg1.col1.y = (-(_local6) * _local4);
_arg1.col2.y = (_local6 * _local2);
return (_arg1);
}
public function GetAngle():Number{
return (Math.atan2(col1.y, col1.x));
}
public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:Number = col1.x;
var _local5:Number = col2.x;
var _local6:Number = col1.y;
var _local7:Number = col2.y;
var _local8:Number = ((_local4 * _local7) - (_local5 * _local6));
_local8 = (1 / _local8);
_arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3)));
_arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2)));
return (_arg1);
}
}
}//package Box2D.Common.Math
Section 31
//b2Math (Box2D.Common.Math.b2Math)
package Box2D.Common.Math {
public class b2Math {
public static const b2Mat22_identity:b2Mat22 = new b2Mat22(0, new b2Vec2(1, 0), new b2Vec2(0, 1));
public static const b2XForm_identity:b2XForm = new b2XForm(b2Vec2_zero, b2Mat22_identity);
public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0);
public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x));
return (_local3);
}
public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y));
return (_local3);
}
public static function b2IsValid(_arg1:Number):Boolean{
return (isFinite(_arg1));
}
public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2MulX(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = b2MulMV(_arg1.R, _arg2);
_local3.x = (_local3.x + _arg1.position.x);
_local3.y = (_local3.y + _arg1.position.y);
return (_local3);
}
public static function b2DistanceSquared(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number = (_arg1.x - _arg2.x);
var _local4:Number = (_arg1.y - _arg2.y);
return (((_local3 * _local3) + (_local4 * _local4)));
}
public static function b2Swap(_arg1:Array, _arg2:Array):void{
var _local3:* = _arg1[0];
_arg1[0] = _arg2[0];
_arg2[0] = _local3;
}
public static function b2AbsM(_arg1:b2Mat22):b2Mat22{
var _local2:b2Mat22 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2));
return (_local2);
}
public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y));
return (_local3);
}
public static function b2MulXT(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
var _local4:Number;
_local3 = SubtractVV(_arg2, _arg1.position);
_local4 = ((_local3.x * _arg1.R.col1.x) + (_local3.y * _arg1.R.col1.y));
_local3.y = ((_local3.x * _arg1.R.col2.x) + (_local3.y * _arg1.R.col2.y));
_local3.x = _local4;
return (_local3);
}
public static function b2Abs(_arg1:Number):Number{
return (((_arg1 > 0)) ? _arg1 : -(_arg1));
}
public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (b2Max(_arg2, b2Min(_arg1, _arg3)));
}
public static function b2AbsV(_arg1:b2Vec2):b2Vec2{
var _local2:b2Vec2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y));
return (_local2);
}
public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y));
return (_local3);
}
public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x)));
}
public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x));
return (_local3);
}
public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2));
return (_local3);
}
public static function b2Distance(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number = (_arg1.x - _arg2.x);
var _local4:Number = (_arg1.y - _arg2.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1));
var _local4:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2));
var _local5:b2Mat22 = new b2Mat22(0, _local3, _local4);
return (_local5);
}
public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2IsPowerOfTwo(_arg1:uint):Boolean{
var _local2:Boolean = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0)));
return (_local2);
}
public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{
return (b2MaxV(_arg2, b2MinV(_arg1, _arg3)));
}
public static function b2RandomRange(_arg1:Number, _arg2:Number):Number{
var _local3:Number = Math.random();
_local3 = (((_arg2 - _arg1) * _local3) + _arg1);
return (_local3);
}
public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2));
return (_local3);
}
public static function b2Min(_arg1:Number, _arg2:Number):Number{
return (((_arg1 < _arg2)) ? _arg1 : _arg2);
}
public static function b2Random():Number{
return (((Math.random() * 2) - 1));
}
public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2));
return (_local3);
}
public static function b2NextPowerOfTwo(_arg1:uint):uint{
_arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647));
_arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823));
_arg1 = (_arg1 | ((_arg1 >> 4) & 268435455));
_arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF));
_arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF));
return ((_arg1 + 1));
}
public static function b2Max(_arg1:Number, _arg2:Number):Number{
return (((_arg1 > _arg2)) ? _arg1 : _arg2);
}
public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y)));
return (_local3);
}
}
}//package Box2D.Common.Math
Section 32
//b2Sweep (Box2D.Common.Math.b2Sweep)
package Box2D.Common.Math {
public class b2Sweep {
public var localCenter:b2Vec2;
public var a:Number;
public var c:b2Vec2;
public var a0:Number;
public var c0:b2Vec2;
public var t0:Number;
public function b2Sweep(){
localCenter = new b2Vec2();
c0 = new b2Vec2();
c = new b2Vec2();
super();
}
public function Advance(_arg1:Number):void{
var _local2:Number;
if ((((t0 < _arg1)) && (((1 - t0) > Number.MIN_VALUE)))){
_local2 = ((_arg1 - t0) / (1 - t0));
c0.x = (((1 - _local2) * c0.x) + (_local2 * c.x));
c0.y = (((1 - _local2) * c0.y) + (_local2 * c.y));
a0 = (((1 - _local2) * a0) + (_local2 * a));
t0 = _arg1;
};
}
public function GetXForm(_arg1:b2XForm, _arg2:Number):void{
var _local4:Number;
var _local5:Number;
if ((1 - t0) > Number.MIN_VALUE){
_local4 = ((_arg2 - t0) / (1 - t0));
_arg1.position.x = (((1 - _local4) * c0.x) + (_local4 * c.x));
_arg1.position.y = (((1 - _local4) * c0.y) + (_local4 * c.y));
_local5 = (((1 - _local4) * a0) + (_local4 * a));
_arg1.R.Set(_local5);
} else {
_arg1.position.SetV(c);
_arg1.R.Set(a);
};
var _local3:b2Mat22 = _arg1.R;
_arg1.position.x = (_arg1.position.x - ((_local3.col1.x * localCenter.x) + (_local3.col2.x * localCenter.y)));
_arg1.position.y = (_arg1.position.y - ((_local3.col1.y * localCenter.x) + (_local3.col2.y * localCenter.y)));
}
}
}//package Box2D.Common.Math
Section 33
//b2Vec2 (Box2D.Common.Math.b2Vec2)
package Box2D.Common.Math {
public class b2Vec2 {
public var y:Number;
public var x:Number;
public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Add(_arg1:b2Vec2):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function Set(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function Length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function LengthSquared():Number{
return (((x * x) + (y * y)));
}
public function MulM(_arg1:b2Mat22):void{
var _local2:Number = x;
x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y));
y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y));
}
public function SetZero():void{
x = 0;
y = 0;
}
public function MinV(_arg1:b2Vec2):void{
x = ((x < _arg1.x)) ? x : _arg1.x;
y = ((y < _arg1.y)) ? y : _arg1.y;
}
public function Normalize():Number{
var _local1:Number = Math.sqrt(((x * x) + (y * y)));
if (_local1 < Number.MIN_VALUE){
return (0);
};
var _local2:Number = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
return (_local1);
}
public function CrossVF(_arg1:Number):void{
var _local2:Number = x;
x = (_arg1 * y);
y = (-(_arg1) * _local2);
}
public function MaxV(_arg1:b2Vec2):void{
x = ((x > _arg1.x)) ? x : _arg1.x;
y = ((y > _arg1.y)) ? y : _arg1.y;
}
public function SetV(_arg1:b2Vec2):void{
x = _arg1.x;
y = _arg1.y;
}
public function Negative():b2Vec2{
return (new b2Vec2(-(x), -(y)));
}
public function CrossFV(_arg1:Number):void{
var _local2:Number = x;
x = (-(_arg1) * y);
y = (_arg1 * _local2);
}
public function Abs():void{
if (x < 0){
x = -(x);
};
if (y < 0){
y = -(y);
};
}
public function Subtract(_arg1:b2Vec2):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function Copy():b2Vec2{
return (new b2Vec2(x, y));
}
public function MulTM(_arg1:b2Mat22):void{
var _local2:Number = b2Math.b2Dot(this, _arg1.col1);
y = b2Math.b2Dot(this, _arg1.col2);
x = _local2;
}
public function IsValid():Boolean{
return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y))));
}
public static function Make(_arg1:Number, _arg2:Number):b2Vec2{
return (new b2Vec2(_arg1, _arg2));
}
}
}//package Box2D.Common.Math
Section 34
//b2XForm (Box2D.Common.Math.b2XForm)
package Box2D.Common.Math {
public class b2XForm {
public var position:b2Vec2;
public var R:b2Mat22;
public function b2XForm(_arg1:b2Vec2=null, _arg2:b2Mat22=null):void{
position = new b2Vec2();
R = new b2Mat22();
super();
if (_arg1){
position.SetV(_arg1);
R.SetM(_arg2);
};
}
public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{
position.SetV(_arg1);
R.SetM(_arg2);
}
public function Set(_arg1:b2XForm):void{
position.SetV(_arg1.position);
R.SetM(_arg1.R);
}
public function SetIdentity():void{
position.SetZero();
R.SetIdentity();
}
}
}//package Box2D.Common.Math
Section 35
//b2Color (Box2D.Common.b2Color)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Color {
private var _r:uint;// = 0
private var _g:uint;// = 0
private var _b:uint;// = 0
public function b2Color(_arg1:Number, _arg2:Number, _arg3:Number){
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function set b(_arg1:Number):void{
_b = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function get color():uint{
return (((_r | (_g << 8)) | (_b << 16)));
}
public function set r(_arg1:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function set g(_arg1:Number):void{
_g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
}
}//package Box2D.Common
Section 36
//b2Settings (Box2D.Common.b2Settings)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Settings {
public static const b2_angularSleepTolerance:Number = 0.0111111111111111;
public static const b2_linearSleepTolerance:Number = 0.01;
public static const b2_angularSlop:Number = 0.0349065850398866;
public static const b2_linearSlop:Number = 0.005;
public static const b2_pi:Number = 3.14159265358979;
public static const b2_maxProxies:int = 0x0200;
public static const b2_maxAngularVelocitySquared:Number = 62500;
public static const b2_maxPolygonVertices:int = 8;
public static const b2_velocityThreshold:Number = 1;
public static const b2_contactBaumgarte:Number = 0.2;
public static const b2_maxPairs:int = 4096;
public static const b2_maxTOIContactsPerIsland:int = 32;
public static const b2_timeToSleep:Number = 0.5;
public static const b2_maxManifoldPoints:int = 2;
public static const b2_maxAngularVelocity:Number = 250;
public static const b2_maxAngularCorrection:Number = 0.139626340159546;
public static const USHRT_MAX:int = 0xFFFF;
public static const b2_maxLinearVelocity:Number = 200;
public static const b2_maxLinearCorrection:Number = 0.2;
public static const b2_toiSlop:Number = 0.04;
public static const b2_maxLinearVelocitySquared:Number = 40000;
public static function b2Assert(_arg1:Boolean):void{
var _local2:b2Vec2;
if (!_arg1){
_local2.x++;
};
}
}
}//package Box2D.Common
Section 37
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2CircleContact extends b2Contact {
private var m_manifolds:Array;
public var m_manifold:b2Manifold;
private var m0:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
var _local3:b2ManifoldPoint = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local8:b2ManifoldPoint;
var _local5:b2Body = m_shape1.m_body;
var _local6:b2Body = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollideCircles(m_manifold, (m_shape1 as b2CircleShape), _local5.m_xf, (m_shape2 as b2CircleShape), _local6.m_xf);
var _local7:b2ContactPoint = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
m_manifoldCount = 1;
_local8 = m_manifold.points[0];
if (m0.pointCount == 0){
_local8.normalImpulse = 0;
_local8.tangentImpulse = 0;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Add(_local7);
};
} else {
_local4 = m0.points[0];
_local8.normalImpulse = _local4.normalImpulse;
_local8.tangentImpulse = _local4.tangentImpulse;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Persist(_local7);
};
};
} else {
m_manifoldCount = 0;
if ((((m0.pointCount > 0)) && (_arg1))){
_local4 = m0.points[0];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
};
}
override public function GetManifolds():Array{
return (m_manifolds);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2CircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 38
//b2Contact (Box2D.Dynamics.Contacts.b2Contact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Contact {
public var m_shape1:b2Shape;
public var m_shape2:b2Shape;
public var m_prev:b2Contact;
public var m_toi:Number;
public var m_next:b2Contact;
public var m_friction:Number;
public var m_manifoldCount:int;
public var m_node1:b2ContactEdge;
public var m_node2:b2ContactEdge;
public var m_restitution:Number;
public var m_flags:uint;
public static var e_toiFlag:uint = 8;
public static var e_nonSolidFlag:uint = 1;
public static var e_slowFlag:uint = 2;
public static var e_islandFlag:uint = 4;
public static var s_registers:Array;
public static var s_initialized:Boolean = false;
public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){
m_node1 = new b2ContactEdge();
m_node2 = new b2ContactEdge();
super();
m_flags = 0;
if (((!(_arg1)) || (!(_arg2)))){
m_shape1 = null;
m_shape2 = null;
return;
};
if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){
m_flags = (m_flags | e_nonSolidFlag);
};
m_shape1 = _arg1;
m_shape2 = _arg2;
m_manifoldCount = 0;
m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction));
m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution);
m_prev = null;
m_next = null;
m_node1.contact = null;
m_node1.prev = null;
m_node1.next = null;
m_node1.other = null;
m_node2.contact = null;
m_node2.prev = null;
m_node2.next = null;
m_node2.other = null;
}
public function IsSolid():Boolean{
return (((m_flags & e_nonSolidFlag) == 0));
}
public function GetShape1():b2Shape{
return (m_shape1);
}
public function GetShape2():b2Shape{
return (m_shape2);
}
public function GetNext():b2Contact{
return (m_next);
}
public function GetManifoldCount():int{
return (m_manifoldCount);
}
public function GetManifolds():Array{
return (null);
}
public function Update(_arg1:b2ContactListener):void{
var _local2:int = m_manifoldCount;
Evaluate(_arg1);
var _local3:int = m_manifoldCount;
var _local4:b2Body = m_shape1.m_body;
var _local5:b2Body = m_shape2.m_body;
if ((((_local3 == 0)) && ((_local2 > 0)))){
_local4.WakeUp();
_local5.WakeUp();
};
if (((((((_local4.IsStatic()) || (_local4.IsBullet()))) || (_local5.IsStatic()))) || (_local5.IsBullet()))){
m_flags = (m_flags & ~(e_slowFlag));
} else {
m_flags = (m_flags | e_slowFlag);
};
}
public function Evaluate(_arg1:b2ContactListener):void{
}
public static function InitializeRegisters():void{
var _local2:int;
s_registers = new Array(b2Shape.e_shapeTypeCount);
var _local1:int;
while (_local1 < b2Shape.e_shapeTypeCount) {
s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount);
_local2 = 0;
while (_local2 < b2Shape.e_shapeTypeCount) {
s_registers[_local1][_local2] = new b2ContactRegister();
_local2++;
};
_local1++;
};
AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape);
AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_circleShape);
AddType(b2PolygonContact.Create, b2PolygonContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_polygonShape);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
if (_arg1.m_manifoldCount > 0){
_arg1.m_shape1.m_body.WakeUp();
_arg1.m_shape2.m_body.WakeUp();
};
var _local3:int = _arg1.m_shape1.m_type;
var _local4:int = _arg1.m_shape2.m_type;
var _local5:b2ContactRegister = s_registers[_local3][_local4];
var _local6:Function = _local5.destroyFcn;
_local6(_arg1, _arg2);
}
public static function AddType(_arg1:Function, _arg2:Function, _arg3:int, _arg4:int):void{
s_registers[_arg3][_arg4].createFcn = _arg1;
s_registers[_arg3][_arg4].destroyFcn = _arg2;
s_registers[_arg3][_arg4].primary = true;
if (_arg3 != _arg4){
s_registers[_arg4][_arg3].createFcn = _arg1;
s_registers[_arg4][_arg3].destroyFcn = _arg2;
s_registers[_arg4][_arg3].primary = false;
};
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
var _local8:b2Contact;
var _local9:int;
var _local10:b2Manifold;
if (s_initialized == false){
InitializeRegisters();
s_initialized = true;
};
var _local4:int = _arg1.m_type;
var _local5:int = _arg2.m_type;
var _local6:b2ContactRegister = s_registers[_local4][_local5];
var _local7:Function = _local6.createFcn;
if (_local7 != null){
if (_local6.primary){
return (_local7(_arg1, _arg2, _arg3));
};
_local8 = _local7(_arg2, _arg1, _arg3);
_local9 = 0;
while (_local9 < _local8.m_manifoldCount) {
_local10 = _local8.GetManifolds()[_local9];
_local8.GetManifolds()[_local9].normal = _local10.normal.Negative();
_local9++;
};
return (_local8);
//unresolved jump
};
return (null);
}
}
}//package Box2D.Dynamics.Contacts
Section 39
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2ContactConstraint {
public var points:Array;
public var normal:b2Vec2;
public var restitution:Number;
public var body1:b2Body;
public var manifold:b2Manifold;
public var body2:b2Body;
public var friction:Number;
public var pointCount:int;
public function b2ContactConstraint(){
normal = new b2Vec2();
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ContactConstraintPoint();
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 40
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
public class b2ContactConstraintPoint {
public var r2:b2Vec2;
public var separation:Number;
public var positionImpulse:Number;
public var normalImpulse:Number;
public var tangentMass:Number;
public var equalizedMass:Number;
public var tangentImpulse:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var normalMass:Number;
public var velocityBias:Number;
public var r1:b2Vec2;
public function b2ContactConstraintPoint(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
r1 = new b2Vec2();
r2 = new b2Vec2();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 41
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2ContactEdge {
public var other:b2Body;
public var prev:b2ContactEdge;
public var contact:b2Contact;
public var next:b2ContactEdge;
}
}//package Box2D.Dynamics.Contacts
Section 42
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister)
package Box2D.Dynamics.Contacts {
public class b2ContactRegister {
public var primary:Boolean;
public var createFcn:Function;
public var destroyFcn:Function;
}
}//package Box2D.Dynamics.Contacts
Section 43
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class b2ContactResult {
public var position:b2Vec2;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var normalImpulse:Number;
public var normal:b2Vec2;
public var tangentImpulse:Number;
public var id:b2ContactID;
public function b2ContactResult(){
position = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 44
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2ContactSolver {
public var m_constraintCount:int;
public var m_constraints:Array;
public var m_allocator;
public var m_step:b2TimeStep;
public function b2ContactSolver(_arg1:b2TimeStep, _arg2:Array, _arg3:int, _arg4){
var _local5:b2Contact;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Mat22;
var _local10:b2Body;
var _local11:b2Body;
var _local12:int;
var _local13:Array;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:int;
var _local23:b2Manifold;
var _local24:Number;
var _local25:Number;
var _local26:b2ContactConstraint;
var _local27:uint;
var _local28:b2ManifoldPoint;
var _local29:b2ContactConstraintPoint;
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:Number;
var _local42:Number;
var _local43:Number;
var _local44:Number;
var _local45:Number;
var _local46:Number;
var _local47:Number;
m_step = new b2TimeStep();
m_constraints = new Array();
super();
m_step.dt = _arg1.dt;
m_step.inv_dt = _arg1.inv_dt;
m_step.maxIterations = _arg1.maxIterations;
m_allocator = _arg4;
m_constraintCount = 0;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
m_constraintCount = (m_constraintCount + _local5.m_manifoldCount);
_local6++;
};
_local6 = 0;
while (_local6 < m_constraintCount) {
m_constraints[_local6] = new b2ContactConstraint();
_local6++;
};
var _local9:int;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
_local10 = _local5.m_shape1.m_body;
_local11 = _local5.m_shape2.m_body;
_local12 = _local5.m_manifoldCount;
_local13 = _local5.GetManifolds();
_local14 = _local5.m_friction;
_local15 = _local5.m_restitution;
_local16 = _local10.m_linearVelocity.x;
_local17 = _local10.m_linearVelocity.y;
_local18 = _local11.m_linearVelocity.x;
_local19 = _local11.m_linearVelocity.y;
_local20 = _local10.m_angularVelocity;
_local21 = _local11.m_angularVelocity;
_local22 = 0;
while (_local22 < _local12) {
_local23 = _local13[_local22];
_local24 = _local23.normal.x;
_local25 = _local23.normal.y;
_local26 = m_constraints[_local9];
_local26.body1 = _local10;
_local26.body2 = _local11;
_local26.manifold = _local23;
_local26.normal.x = _local24;
_local26.normal.y = _local25;
_local26.pointCount = _local23.pointCount;
_local26.friction = _local14;
_local26.restitution = _local15;
_local27 = 0;
while (_local27 < _local26.pointCount) {
_local28 = _local23.points[_local27];
_local29 = _local26.points[_local27];
_local29.normalImpulse = _local28.normalImpulse;
_local29.tangentImpulse = _local28.tangentImpulse;
_local29.separation = _local28.separation;
_local29.positionImpulse = 0;
_local29.localAnchor1.SetV(_local28.localPoint1);
_local29.localAnchor2.SetV(_local28.localPoint2);
_local8 = _local10.m_xf.R;
_local32 = (_local28.localPoint1.x - _local10.m_sweep.localCenter.x);
_local33 = (_local28.localPoint1.y - _local10.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local32) + (_local8.col2.x * _local33));
_local33 = ((_local8.col1.y * _local32) + (_local8.col2.y * _local33));
_local32 = _local30;
_local29.r1.Set(_local32, _local33);
_local8 = _local11.m_xf.R;
_local34 = (_local28.localPoint2.x - _local11.m_sweep.localCenter.x);
_local35 = (_local28.localPoint2.y - _local11.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local34) + (_local8.col2.x * _local35));
_local35 = ((_local8.col1.y * _local34) + (_local8.col2.y * _local35));
_local34 = _local30;
_local29.r2.Set(_local34, _local35);
_local36 = ((_local32 * _local32) + (_local33 * _local33));
_local37 = ((_local34 * _local34) + (_local35 * _local35));
_local38 = ((_local32 * _local24) + (_local33 * _local25));
_local39 = ((_local34 * _local24) + (_local35 * _local25));
_local40 = (_local10.m_invMass + _local11.m_invMass);
_local40 = (_local40 + ((_local10.m_invI * (_local36 - (_local38 * _local38))) + (_local11.m_invI * (_local37 - (_local39 * _local39)))));
_local29.normalMass = (1 / _local40);
_local41 = ((_local10.m_mass * _local10.m_invMass) + (_local11.m_mass * _local11.m_invMass));
_local41 = (_local41 + (((_local10.m_mass * _local10.m_invI) * (_local36 - (_local38 * _local38))) + ((_local11.m_mass * _local11.m_invI) * (_local37 - (_local39 * _local39)))));
_local29.equalizedMass = (1 / _local41);
_local42 = _local25;
_local43 = -(_local24);
_local44 = ((_local32 * _local42) + (_local33 * _local43));
_local45 = ((_local34 * _local42) + (_local35 * _local43));
_local46 = (_local10.m_invMass + _local11.m_invMass);
_local46 = (_local46 + ((_local10.m_invI * (_local36 - (_local44 * _local44))) + (_local11.m_invI * (_local37 - (_local45 * _local45)))));
_local29.tangentMass = (1 / _local46);
_local29.velocityBias = 0;
if (_local29.separation > 0){
_local29.velocityBias = (-60 * _local29.separation);
};
_local30 = (((_local18 + (-(_local21) * _local35)) - _local16) - (-(_local20) * _local33));
_local31 = (((_local19 + (_local21 * _local34)) - _local17) - (_local20 * _local32));
_local47 = ((_local26.normal.x * _local30) + (_local26.normal.y * _local31));
if (_local47 < -(b2Settings.b2_velocityThreshold)){
_local29.velocityBias = (_local29.velocityBias + (-(_local26.restitution) * _local47));
};
_local27++;
};
_local9++;
_local22++;
};
_local6++;
};
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2Mat22;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
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:int;
var _local19:int;
var _local20:b2ContactConstraintPoint;
var _local21:Number;
var _local22:Number;
var _local23:b2ContactConstraintPoint;
var _local5:int;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_invMass;
_local10 = _local7.m_invI;
_local11 = _local8.m_invMass;
_local12 = _local8.m_invI;
_local13 = _local6.normal.x;
_local14 = _local6.normal.y;
_local15 = _local14;
_local16 = -(_local13);
if (_arg1.warmStarting){
_local19 = _local6.pointCount;
_local18 = 0;
while (_local18 < _local19) {
_local20 = _local6.points[_local18];
_local6.points[_local18].normalImpulse = (_local20.normalImpulse * _arg1.dtRatio);
_local20.tangentImpulse = (_local20.tangentImpulse * _arg1.dtRatio);
_local21 = ((_local20.normalImpulse * _local13) + (_local20.tangentImpulse * _local15));
_local22 = ((_local20.normalImpulse * _local14) + (_local20.tangentImpulse * _local16));
_local7.m_angularVelocity = (_local7.m_angularVelocity - (_local10 * ((_local20.r1.x * _local22) - (_local20.r1.y * _local21))));
_local7.m_linearVelocity.x = (_local7.m_linearVelocity.x - (_local9 * _local21));
_local7.m_linearVelocity.y = (_local7.m_linearVelocity.y - (_local9 * _local22));
_local8.m_angularVelocity = (_local8.m_angularVelocity + (_local12 * ((_local20.r2.x * _local22) - (_local20.r2.y * _local21))));
_local8.m_linearVelocity.x = (_local8.m_linearVelocity.x + (_local11 * _local21));
_local8.m_linearVelocity.y = (_local8.m_linearVelocity.y + (_local11 * _local22));
_local18++;
};
} else {
_local19 = _local6.pointCount;
_local18 = 0;
while (_local18 < _local19) {
_local23 = _local6.points[_local18];
_local23.normalImpulse = 0;
_local23.tangentImpulse = 0;
_local18++;
};
};
_local5++;
};
}
public function SolvePositionConstraints(_arg1:Number):Boolean{
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:b2Vec2;
var _local10:Number;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:int;
var _local20:int;
var _local21:b2ContactConstraintPoint;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
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 _local2:Number = 0;
var _local5:int;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_sweep.c;
_local10 = _local7.m_sweep.a;
_local11 = _local8.m_sweep.c;
_local12 = _local8.m_sweep.a;
_local13 = (_local7.m_mass * _local7.m_invMass);
_local14 = (_local7.m_mass * _local7.m_invI);
_local15 = (_local8.m_mass * _local8.m_invMass);
_local16 = (_local8.m_mass * _local8.m_invI);
_local17 = _local6.normal.x;
_local18 = _local6.normal.y;
_local19 = _local6.pointCount;
_local20 = 0;
while (_local20 < _local19) {
_local21 = _local6.points[_local20];
_local3 = _local7.m_xf.R;
_local4 = _local7.m_sweep.localCenter;
_local22 = (_local21.localAnchor1.x - _local4.x);
_local23 = (_local21.localAnchor1.y - _local4.y);
_local26 = ((_local3.col1.x * _local22) + (_local3.col2.x * _local23));
_local23 = ((_local3.col1.y * _local22) + (_local3.col2.y * _local23));
_local22 = _local26;
_local3 = _local8.m_xf.R;
_local4 = _local8.m_sweep.localCenter;
_local24 = (_local21.localAnchor2.x - _local4.x);
_local25 = (_local21.localAnchor2.y - _local4.y);
_local26 = ((_local3.col1.x * _local24) + (_local3.col2.x * _local25));
_local25 = ((_local3.col1.y * _local24) + (_local3.col2.y * _local25));
_local24 = _local26;
_local27 = (_local9.x + _local22);
_local28 = (_local9.y + _local23);
_local29 = (_local11.x + _local24);
_local30 = (_local11.y + _local25);
_local31 = (_local29 - _local27);
_local32 = (_local30 - _local28);
_local33 = (((_local31 * _local17) + (_local32 * _local18)) + _local21.separation);
_local2 = b2Math.b2Min(_local2, _local33);
_local34 = (_arg1 * b2Math.b2Clamp((_local33 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0));
_local35 = (-(_local21.equalizedMass) * _local34);
_local36 = _local21.positionImpulse;
_local21.positionImpulse = b2Math.b2Max((_local36 + _local35), 0);
_local35 = (_local21.positionImpulse - _local36);
_local37 = (_local35 * _local17);
_local38 = (_local35 * _local18);
_local9.x = (_local9.x - (_local13 * _local37));
_local9.y = (_local9.y - (_local13 * _local38));
_local10 = (_local10 - (_local14 * ((_local22 * _local38) - (_local23 * _local37))));
_local7.m_sweep.a = _local10;
_local7.SynchronizeTransform();
_local11.x = (_local11.x + (_local15 * _local37));
_local11.y = (_local11.y + (_local15 * _local38));
_local12 = (_local12 + (_local16 * ((_local24 * _local38) - (_local25 * _local37))));
_local8.m_sweep.a = _local12;
_local8.SynchronizeTransform();
_local20++;
};
_local5++;
};
return ((_local2 >= (-1.5 * b2Settings.b2_linearSlop)));
}
public function SolveVelocityConstraints():void{
var _local1:int;
var _local2:b2ContactConstraintPoint;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6: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:b2Mat22;
var _local18:b2Vec2;
var _local20:b2ContactConstraint;
var _local21:b2Body;
var _local22:b2Body;
var _local23:Number;
var _local24:Number;
var _local25:b2Vec2;
var _local26:b2Vec2;
var _local27:Number;
var _local28:Number;
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:int;
var _local38:Number;
var _local19:int;
while (_local19 < m_constraintCount) {
_local20 = m_constraints[_local19];
_local21 = _local20.body1;
_local22 = _local20.body2;
_local23 = _local21.m_angularVelocity;
_local24 = _local22.m_angularVelocity;
_local25 = _local21.m_linearVelocity;
_local26 = _local22.m_linearVelocity;
_local27 = _local21.m_invMass;
_local28 = _local21.m_invI;
_local29 = _local22.m_invMass;
_local30 = _local22.m_invI;
_local31 = _local20.normal.x;
_local32 = _local20.normal.y;
_local33 = _local32;
_local34 = -(_local31);
_local35 = _local20.friction;
_local37 = _local20.pointCount;
_local1 = 0;
while (_local1 < _local37) {
_local2 = _local20.points[_local1];
_local7 = (((_local26.x + (-(_local24) * _local2.r2.y)) - _local25.x) - (-(_local23) * _local2.r1.y));
_local8 = (((_local26.y + (_local24 * _local2.r2.x)) - _local25.y) - (_local23 * _local2.r1.x));
_local9 = ((_local7 * _local31) + (_local8 * _local32));
_local11 = (-(_local2.normalMass) * (_local9 - _local2.velocityBias));
_local10 = ((_local7 * _local33) + (_local8 * _local34));
_local12 = (_local2.tangentMass * -(_local10));
_local13 = b2Math.b2Max((_local2.normalImpulse + _local11), 0);
_local11 = (_local13 - _local2.normalImpulse);
_local38 = (_local35 * _local2.normalImpulse);
_local14 = b2Math.b2Clamp((_local2.tangentImpulse + _local12), -(_local38), _local38);
_local12 = (_local14 - _local2.tangentImpulse);
_local15 = ((_local11 * _local31) + (_local12 * _local33));
_local16 = ((_local11 * _local32) + (_local12 * _local34));
_local25.x = (_local25.x - (_local27 * _local15));
_local25.y = (_local25.y - (_local27 * _local16));
_local23 = (_local23 - (_local28 * ((_local2.r1.x * _local16) - (_local2.r1.y * _local15))));
_local26.x = (_local26.x + (_local29 * _local15));
_local26.y = (_local26.y + (_local29 * _local16));
_local24 = (_local24 + (_local30 * ((_local2.r2.x * _local16) - (_local2.r2.y * _local15))));
_local2.normalImpulse = _local13;
_local2.tangentImpulse = _local14;
_local1++;
};
_local21.m_angularVelocity = _local23;
_local22.m_angularVelocity = _local24;
_local19++;
};
}
public function FinalizeVelocityConstraints():void{
var _local2:b2ContactConstraint;
var _local3:b2Manifold;
var _local4:int;
var _local5:b2ManifoldPoint;
var _local6:b2ContactConstraintPoint;
var _local1:int;
while (_local1 < m_constraintCount) {
_local2 = m_constraints[_local1];
_local3 = _local2.manifold;
_local4 = 0;
while (_local4 < _local2.pointCount) {
_local5 = _local3.points[_local4];
_local6 = _local2.points[_local4];
_local5.normalImpulse = _local6.normalImpulse;
_local5.tangentImpulse = _local6.tangentImpulse;
_local4++;
};
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 45
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2NullContact extends b2Contact {
override public function Evaluate(_arg1:b2ContactListener):void{
}
override public function GetManifolds():Array{
return (null);
}
}
}//package Box2D.Dynamics.Contacts
Section 46
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2PolyAndCircleContact extends b2Contact {
private var m_manifolds:Array;
public var m_manifold:b2Manifold;
private var m0:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polygonShape));
b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape));
m_manifold.pointCount = 0;
var _local3:b2ManifoldPoint = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:int;
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2ManifoldPoint;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
var _local6:b2Body = m_shape1.m_body;
var _local7:b2Body = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygonAndCircle(m_manifold, (m_shape1 as b2PolygonShape), _local6.m_xf, (m_shape2 as b2CircleShape), _local7.m_xf);
var _local8:Array = [false, false];
var _local9:b2ContactPoint = s_evalCP;
_local9.shape1 = m_shape1;
_local9.shape2 = m_shape2;
_local9.friction = m_friction;
_local9.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local2 = 0;
while (_local2 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local2];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local8[_local13] == true){
} else {
_local5 = m0.points[_local13];
if (_local5.id._key == _local12){
_local8[_local13] = true;
_local10.normalImpulse = _local5.normalImpulse;
_local10.tangentImpulse = _local5.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Persist(_local9);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Add(_local9);
};
_local2++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local2 = 0;
while (_local2 < m0.pointCount) {
if (_local8[_local2]){
} else {
_local5 = m0.points[_local2];
_local9.position = _local6.GetWorldPoint(_local5.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local5.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local5.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m0.normal);
_local9.separation = _local5.separation;
_local9.id.key = _local5.id._key;
_arg1.Remove(_local9);
};
_local2++;
};
}
override public function GetManifolds():Array{
return (m_manifolds);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolyAndCircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 47
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2PolygonContact extends b2Contact {
private var m_manifolds:Array;
private var m0:b2Manifold;
public var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolygonContact(_arg1:b2Shape, _arg2:b2Shape):void{
m0 = new b2Manifold();
m_manifolds = [new b2Manifold()];
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local7:b2ContactPoint;
var _local8:int;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
var _local5:b2Body = m_shape1.m_body;
var _local6:b2Body = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygons(m_manifold, (m_shape1 as b2PolygonShape), _local5.m_xf, (m_shape2 as b2PolygonShape), _local6.m_xf);
var _local9:Array = [false, false];
_local7 = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local8 = 0;
while (_local8 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local8];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local9[_local13] == true){
} else {
_local4 = m0.points[_local13];
if (_local4.id._key == _local12){
_local9[_local13] = true;
_local10.normalImpulse = _local4.normalImpulse;
_local10.tangentImpulse = _local4.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Persist(_local7);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Add(_local7);
};
_local8++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local8 = 0;
while (_local8 < m0.pointCount) {
if (_local9[_local8]){
} else {
_local4 = m0.points[_local8];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
_local8++;
};
}
override public function GetManifolds():Array{
return (m_manifolds);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolygonContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 48
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2DistanceJoint extends b2Joint {
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_bias:Number;
public var m_gamma:Number;
public var m_u:b2Vec2;
public var m_mass:Number;
public var m_impulse:Number;
public var m_dampingRatio:Number;
public var m_frequencyHz:Number;
public var m_length:Number;
public function b2DistanceJoint(_arg1:b2DistanceJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_u = new b2Vec2();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_length = _arg1.length;
m_frequencyHz = _arg1.frequencyHz;
m_dampingRatio = _arg1.dampingRatio;
m_impulse = 0;
m_gamma = 0;
m_bias = 0;
m_inv_dt = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:Number;
var _local4:b2Body;
var _local5:b2Body;
var _local6:Number;
var _local8:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
m_inv_dt = _arg1.inv_dt;
_local4 = m_body1;
_local5 = m_body2;
_local2 = _local4.m_xf.R;
_local6 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local6) + (_local2.col2.x * _local7));
_local7 = ((_local2.col1.y * _local6) + (_local2.col2.y * _local7));
_local6 = _local3;
_local2 = _local5.m_xf.R;
_local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local3;
m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6);
m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7);
var _local10:Number = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y)));
if (_local10 > b2Settings.b2_linearSlop){
m_u.Multiply((1 / _local10));
} else {
m_u.SetZero();
};
var _local11:Number = ((_local6 * m_u.y) - (_local7 * m_u.x));
var _local12:Number = ((_local8 * m_u.y) - (_local9 * m_u.x));
var _local13:Number = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12));
m_mass = (1 / _local13);
if (m_frequencyHz > 0){
_local14 = (_local10 - m_length);
_local15 = ((2 * Math.PI) * m_frequencyHz);
_local16 = (((2 * m_mass) * m_dampingRatio) * _local15);
_local17 = ((m_mass * _local15) * _local15);
m_gamma = (1 / (_arg1.dt * (_local16 + (_arg1.dt * _local17))));
m_bias = (((_local14 * _arg1.dt) * _local17) * m_gamma);
m_mass = (1 / (_local13 + m_gamma));
};
if (_arg1.warmStarting){
m_impulse = (m_impulse * _arg1.dtRatio);
_local18 = (m_impulse * m_u.x);
_local19 = (m_impulse * m_u.y);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x - (_local4.m_invMass * _local18));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y - (_local4.m_invMass * _local19));
_local4.m_angularVelocity = (_local4.m_angularVelocity - (_local4.m_invI * ((_local6 * _local19) - (_local7 * _local18))));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + (_local5.m_invMass * _local18));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + (_local5.m_invMass * _local19));
_local5.m_angularVelocity = (_local5.m_angularVelocity + (_local5.m_invI * ((_local8 * _local19) - (_local9 * _local18))));
} else {
m_impulse = 0;
};
}
override public function GetReactionTorque():Number{
return (0);
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2 = new b2Vec2();
_local1.SetV(m_u);
_local1.Multiply((m_inv_dt * m_impulse));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Mat22;
if (m_frequencyHz > 0){
return (true);
};
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local1 = _local2.m_xf.R;
var _local4:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local5:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
var _local6:Number = ((_local1.col1.x * _local4) + (_local1.col2.x * _local5));
_local5 = ((_local1.col1.y * _local4) + (_local1.col2.y * _local5));
_local4 = _local6;
_local1 = _local3.m_xf.R;
var _local7:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local8:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local6 = ((_local1.col1.x * _local7) + (_local1.col2.x * _local8));
_local8 = ((_local1.col1.y * _local7) + (_local1.col2.y * _local8));
_local7 = _local6;
var _local9:Number = (((_local3.m_sweep.c.x + _local7) - _local2.m_sweep.c.x) - _local4);
var _local10:Number = (((_local3.m_sweep.c.y + _local8) - _local2.m_sweep.c.y) - _local5);
var _local11:Number = Math.sqrt(((_local9 * _local9) + (_local10 * _local10)));
_local9 = (_local9 / _local11);
_local10 = (_local10 / _local11);
var _local12:Number = (_local11 - m_length);
_local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
var _local13:Number = (-(m_mass) * _local12);
m_u.Set(_local9, _local10);
var _local14:Number = (_local13 * m_u.x);
var _local15:Number = (_local13 * m_u.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x - (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y - (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a - (_local2.m_invI * ((_local4 * _local15) - (_local5 * _local14))));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + (_local3.m_invMass * _local14));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + (_local3.m_invMass * _local15));
_local3.m_sweep.a = (_local3.m_sweep.a + (_local3.m_invI * ((_local7 * _local15) - (_local8 * _local14))));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((b2Math.b2Abs(_local12) < b2Settings.b2_linearSlop));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
_local2 = _local3.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
var _local7:Number = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6));
_local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6));
_local5 = _local7;
_local2 = _local4.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local7 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local7;
var _local10:Number = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local6));
var _local11:Number = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local5));
var _local12:Number = (_local4.m_linearVelocity.x + (-(_local4.m_angularVelocity) * _local9));
var _local13:Number = (_local4.m_linearVelocity.y + (_local4.m_angularVelocity * _local8));
var _local14:Number = ((m_u.x * (_local12 - _local10)) + (m_u.y * (_local13 - _local11)));
var _local15:Number = (-(m_mass) * ((_local14 + m_bias) + (m_gamma * m_impulse)));
m_impulse = (m_impulse + _local15);
var _local16:Number = (_local15 * m_u.x);
var _local17:Number = (_local15 * m_u.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x - (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y - (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity - (_local3.m_invI * ((_local5 * _local17) - (_local6 * _local16))));
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + (_local4.m_invMass * _local16));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + (_local4.m_invMass * _local17));
_local4.m_angularVelocity = (_local4.m_angularVelocity + (_local4.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
}
}
}//package Box2D.Dynamics.Joints
Section 49
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2DistanceJointDef extends b2JointDef {
public var localAnchor1:b2Vec2;
public var length:Number;
public var dampingRatio:Number;
public var localAnchor2:b2Vec2;
public var frequencyHz:Number;
public function b2DistanceJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_distanceJoint;
length = 1;
frequencyHz = 0;
dampingRatio = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1.SetV(body1.GetLocalPoint(_arg3));
localAnchor2.SetV(body2.GetLocalPoint(_arg4));
var _local5:Number = (_arg4.x - _arg3.x);
var _local6:Number = (_arg4.y - _arg3.y);
length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
frequencyHz = 0;
dampingRatio = 0;
}
}
}//package Box2D.Dynamics.Joints
Section 50
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2GearJoint extends b2Joint {
public var m_ground2:b2Body;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_ratio:Number;
public var m_revolute2:b2RevoluteJoint;
public var m_force:Number;
public var m_mass:Number;
public var m_prismatic2:b2PrismaticJoint;
public var m_ground1:b2Body;
public var m_revolute1:b2RevoluteJoint;
public var m_prismatic1:b2PrismaticJoint;
public var m_constant:Number;
public var m_J:b2Jacobian;
public function b2GearJoint(_arg1:b2GearJointDef){
var _local4:Number;
var _local5:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_J = new b2Jacobian();
super(_arg1);
var _local2:int = _arg1.joint1.m_type;
var _local3:int = _arg1.joint2.m_type;
m_revolute1 = null;
m_prismatic1 = null;
m_revolute2 = null;
m_prismatic2 = null;
m_ground1 = _arg1.joint1.m_body1;
m_body1 = _arg1.joint1.m_body2;
if (_local2 == b2Joint.e_revoluteJoint){
m_revolute1 = (_arg1.joint1 as b2RevoluteJoint);
m_groundAnchor1.SetV(m_revolute1.m_localAnchor1);
m_localAnchor1.SetV(m_revolute1.m_localAnchor2);
_local4 = m_revolute1.GetJointAngle();
} else {
m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint);
m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1);
m_localAnchor1.SetV(m_prismatic1.m_localAnchor2);
_local4 = m_prismatic1.GetJointTranslation();
};
m_ground2 = _arg1.joint2.m_body1;
m_body2 = _arg1.joint2.m_body2;
if (_local3 == b2Joint.e_revoluteJoint){
m_revolute2 = (_arg1.joint2 as b2RevoluteJoint);
m_groundAnchor2.SetV(m_revolute2.m_localAnchor1);
m_localAnchor2.SetV(m_revolute2.m_localAnchor2);
_local5 = m_revolute2.GetJointAngle();
} else {
m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint);
m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1);
m_localAnchor2.SetV(m_prismatic2.m_localAnchor2);
_local5 = m_prismatic2.GetJointTranslation();
};
m_ratio = _arg1.ratio;
m_constant = (_local4 + (m_ratio * _local5));
m_force = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local15:Number;
var _local2:b2Body = m_ground1;
var _local3:b2Body = m_ground2;
var _local4:b2Body = m_body1;
var _local5:b2Body = m_body2;
var _local14:Number = 0;
m_J.SetZero();
if (m_revolute1){
m_J.angular1 = -1;
_local14 = (_local14 + _local4.m_invI);
} else {
_local10 = _local2.m_xf.R;
_local11 = m_prismatic1.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local4.m_xf.R;
_local8 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linear1.Set(-(_local6), -(_local7));
m_J.angular1 = -(_local12);
_local14 = (_local14 + (_local4.m_invMass + ((_local4.m_invI * _local12) * _local12)));
};
if (m_revolute2){
m_J.angular2 = -(m_ratio);
_local14 = (_local14 + ((m_ratio * m_ratio) * _local5.m_invI));
} else {
_local10 = _local3.m_xf.R;
_local11 = m_prismatic2.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local5.m_xf.R;
_local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linear2.Set((-(m_ratio) * _local6), (-(m_ratio) * _local7));
m_J.angular2 = (-(m_ratio) * _local12);
_local14 = (_local14 + ((m_ratio * m_ratio) * (_local5.m_invMass + ((_local5.m_invI * _local12) * _local12))));
};
m_mass = (1 / _local14);
if (_arg1.warmStarting){
_local15 = (_arg1.dt * m_force);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * _local15) * m_J.linear1.x));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * _local15) * m_J.linear1.y));
_local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * _local15) * m_J.angular1));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * _local15) * m_J.linear2.x));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * _local15) * m_J.linear2.y));
_local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * _local15) * m_J.angular2));
} else {
m_force = 0;
};
}
override public function GetReactionTorque():Number{
var _local1:b2Mat22 = m_body2.m_xf.R;
var _local2:Number = (m_localAnchor1.x - m_body2.m_sweep.localCenter.x);
var _local3:Number = (m_localAnchor1.y - m_body2.m_sweep.localCenter.y);
var _local4:Number = ((_local1.col1.x * _local2) + (_local1.col2.x * _local3));
_local3 = ((_local1.col1.y * _local2) + (_local1.col2.y * _local3));
_local2 = _local4;
_local4 = ((m_force * m_J.angular2) - ((_local2 * (m_force * m_J.linear2.y)) - (_local3 * (m_force * m_J.linear2.x))));
return (_local4);
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2 = new b2Vec2((m_force * m_J.linear2.x), (m_force * m_J.linear2.y));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local4:Number;
var _local5:Number;
var _local1:Number = 0;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
if (m_revolute1){
_local4 = m_revolute1.GetJointAngle();
} else {
_local4 = m_prismatic1.GetJointTranslation();
};
if (m_revolute2){
_local5 = m_revolute2.GetJointAngle();
} else {
_local5 = m_prismatic2.GetJointTranslation();
};
var _local6:Number = (m_constant - (_local4 + (m_ratio * _local5)));
var _local7:Number = (-(m_mass) * _local6);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + ((_local2.m_invMass * _local7) * m_J.linear1.x));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + ((_local2.m_invMass * _local7) * m_J.linear1.y));
_local2.m_sweep.a = (_local2.m_sweep.a + ((_local2.m_invI * _local7) * m_J.angular1));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local3.m_invMass * _local7) * m_J.linear2.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local3.m_invMass * _local7) * m_J.linear2.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local3.m_invI * _local7) * m_J.angular2));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((_local1 < b2Settings.b2_linearSlop));
}
public function GetRatio():Number{
return (m_ratio);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
var _local4:Number = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
var _local5:Number = ((-(_arg1.inv_dt) * m_mass) * _local4);
m_force = (m_force + _local5);
var _local6:Number = (_arg1.dt * _local5);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local6) * m_J.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local6) * m_J.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local6) * m_J.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local6) * m_J.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local6) * m_J.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local6) * m_J.angular2));
}
}
}//package Box2D.Dynamics.Joints
Section 51
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef)
package Box2D.Dynamics.Joints {
public class b2GearJointDef extends b2JointDef {
public var joint1:b2Joint;
public var joint2:b2Joint;
public var ratio:Number;
public function b2GearJointDef(){
type = b2Joint.e_gearJoint;
joint1 = null;
joint2 = null;
ratio = 1;
}
}
}//package Box2D.Dynamics.Joints
Section 52
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2Jacobian {
public var linear1:b2Vec2;
public var linear2:b2Vec2;
public var angular1:Number;
public var angular2:Number;
public function b2Jacobian(){
linear1 = new b2Vec2();
linear2 = new b2Vec2();
super();
}
public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{
linear1.SetV(_arg1);
angular1 = _arg2;
linear2.SetV(_arg3);
angular2 = _arg4;
}
public function SetZero():void{
linear1.SetZero();
angular1 = 0;
linear2.SetZero();
angular2 = 0;
}
public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{
return ((((((linear1.x * _arg1.x) + (linear1.y * _arg1.y)) + (angular1 * _arg2)) + ((linear2.x * _arg3.x) + (linear2.y * _arg3.y))) + (angular2 * _arg4)));
}
}
}//package Box2D.Dynamics.Joints
Section 53
//b2Joint (Box2D.Dynamics.Joints.b2Joint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2Joint {
public var m_islandFlag:Boolean;
public var m_body1:b2Body;
public var m_prev:b2Joint;
public var m_next:b2Joint;
public var m_type:int;
public var m_collideConnected:Boolean;
public var m_node1:b2JointEdge;
public var m_node2:b2JointEdge;
public var m_inv_dt:Number;
public var m_userData;
public var m_body2:b2Body;
public static const e_unknownJoint:int = 0;
public static const e_inactiveLimit:int = 0;
public static const e_atUpperLimit:int = 2;
public static const e_atLowerLimit:int = 1;
public static const e_gearJoint:int = 6;
public static const e_revoluteJoint:int = 1;
public static const e_equalLimits:int = 3;
public static const e_distanceJoint:int = 3;
public static const e_pulleyJoint:int = 4;
public static const e_prismaticJoint:int = 2;
public static const e_mouseJoint:int = 5;
public function b2Joint(_arg1:b2JointDef){
m_node1 = new b2JointEdge();
m_node2 = new b2JointEdge();
super();
m_type = _arg1.type;
m_prev = null;
m_next = null;
m_body1 = _arg1.body1;
m_body2 = _arg1.body2;
m_collideConnected = _arg1.collideConnected;
m_islandFlag = false;
m_userData = _arg1.userData;
}
public function GetBody2():b2Body{
return (m_body2);
}
public function GetAnchor1():b2Vec2{
return (null);
}
public function GetAnchor2():b2Vec2{
return (null);
}
public function GetNext():b2Joint{
return (m_next);
}
public function GetType():int{
return (m_type);
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
}
public function GetReactionTorque():Number{
return (0);
}
public function GetUserData(){
return (m_userData);
}
public function GetReactionForce():b2Vec2{
return (null);
}
public function SolvePositionConstraints():Boolean{
return (false);
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetBody1():b2Body{
return (m_body1);
}
public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
}
public function InitPositionConstraints():void{
}
public static function Destroy(_arg1:b2Joint, _arg2):void{
}
public static function Create(_arg1:b2JointDef, _arg2):b2Joint{
var _local3:b2Joint;
switch (_arg1.type){
case e_distanceJoint:
_local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef));
break;
case e_mouseJoint:
_local3 = new b2MouseJoint((_arg1 as b2MouseJointDef));
break;
case e_prismaticJoint:
_local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef));
break;
case e_revoluteJoint:
_local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef));
break;
case e_pulleyJoint:
_local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef));
break;
case e_gearJoint:
_local3 = new b2GearJoint((_arg1 as b2GearJointDef));
break;
default:
break;
};
return (_local3);
}
}
}//package Box2D.Dynamics.Joints
Section 54
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointDef {
public var body2:b2Body;
public var type:int;
public var userData;
public var collideConnected:Boolean;
public var body1:b2Body;
public function b2JointDef(){
type = b2Joint.e_unknownJoint;
userData = null;
body1 = null;
body2 = null;
collideConnected = false;
}
}
}//package Box2D.Dynamics.Joints
Section 55
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointEdge {
public var other:b2Body;
public var next:b2JointEdge;
public var prev:b2JointEdge;
public var joint:b2Joint;
}
}//package Box2D.Dynamics.Joints
Section 56
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2MouseJoint extends b2Joint {
private var K1:b2Mat22;
private var K:b2Mat22;
public var m_beta:Number;
public var m_mass:b2Mat22;
private var K2:b2Mat22;
public var m_target:b2Vec2;
public var m_gamma:Number;
public var m_impulse:b2Vec2;
public var m_C:b2Vec2;
public var m_localAnchor:b2Vec2;
public var m_maxForce:Number;
public function b2MouseJoint(_arg1:b2MouseJointDef){
var _local3:Number;
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
m_localAnchor = new b2Vec2();
m_target = new b2Vec2();
m_impulse = new b2Vec2();
m_mass = new b2Mat22();
m_C = new b2Vec2();
super(_arg1);
m_target.SetV(_arg1.target);
var _local2:Number = (m_target.x - m_body2.m_xf.position.x);
_local3 = (m_target.y - m_body2.m_xf.position.y);
var _local4:b2Mat22 = m_body2.m_xf.R;
m_localAnchor.x = ((_local2 * _local4.col1.x) + (_local3 * _local4.col1.y));
m_localAnchor.y = ((_local2 * _local4.col2.x) + (_local3 * _local4.col2.y));
m_maxForce = _arg1.maxForce;
m_impulse.SetZero();
var _local5:Number = m_body2.m_mass;
var _local6:Number = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz);
var _local7:Number = (((2 * _local5) * _arg1.dampingRatio) * _local6);
var _local8:Number = ((_arg1.timeStep * _local5) * (_local6 * _local6));
m_gamma = (1 / (_local7 + _local8));
m_beta = (_local8 / (_local7 + _local8));
}
public function SetTarget(_arg1:b2Vec2):void{
if (m_body2.IsSleeping()){
m_body2.WakeUp();
};
m_target = _arg1;
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local7:Number;
var _local8:Number;
_local2 = m_body2;
_local3 = _local2.m_xf.R;
_local4 = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
_local5 = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local7 = _local2.m_invMass;
_local8 = _local2.m_invI;
K1.col1.x = _local7;
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = _local7;
K2.col1.x = ((_local8 * _local5) * _local5);
K2.col2.x = ((-(_local8) * _local4) * _local5);
K2.col1.y = ((-(_local8) * _local4) * _local5);
K2.col2.y = ((_local8 * _local4) * _local4);
K.SetM(K1);
K.AddM(K2);
K.col1.x = (K.col1.x + m_gamma);
K.col2.y = (K.col2.y + m_gamma);
K.Invert(m_mass);
m_C.x = ((_local2.m_sweep.c.x + _local4) - m_target.x);
m_C.y = ((_local2.m_sweep.c.y + _local5) - m_target.y);
_local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98);
var _local9:Number = (_arg1.dt * m_impulse.x);
var _local10:Number = (_arg1.dt * m_impulse.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local7 * _local9));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local7 * _local10));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local8 * ((_local4 * _local10) - (_local5 * _local9))));
}
override public function GetAnchor1():b2Vec2{
return (m_target);
}
override public function GetReactionTorque():Number{
return (0);
}
override public function GetReactionForce():b2Vec2{
return (m_impulse);
}
override public function SolvePositionConstraints():Boolean{
return (true);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local2:b2Body = m_body2;
_local3 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
_local4 = ((_local3.col1.x * _local6) + (_local3.col2.x * _local7));
_local7 = ((_local3.col1.y * _local6) + (_local3.col2.y * _local7));
_local6 = _local4;
var _local8:Number = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local7));
var _local9:Number = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local6));
_local3 = m_mass;
_local4 = ((_local8 + ((m_beta * _arg1.inv_dt) * m_C.x)) + ((m_gamma * _arg1.dt) * m_impulse.x));
_local5 = ((_local9 + ((m_beta * _arg1.inv_dt) * m_C.y)) + ((m_gamma * _arg1.dt) * m_impulse.y));
var _local10:Number = (-(_arg1.inv_dt) * ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)));
var _local11:Number = (-(_arg1.inv_dt) * ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)));
var _local12:Number = m_impulse.x;
var _local13:Number = m_impulse.y;
m_impulse.x = (m_impulse.x + _local10);
m_impulse.y = (m_impulse.y + _local11);
var _local14:Number = m_impulse.Length();
if (_local14 > m_maxForce){
m_impulse.Multiply((m_maxForce / _local14));
};
_local10 = (m_impulse.x - _local12);
_local11 = (m_impulse.y - _local13);
var _local15:Number = (_arg1.dt * _local10);
var _local16:Number = (_arg1.dt * _local11);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
}
}
}//package Box2D.Dynamics.Joints
Section 57
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2MouseJointDef extends b2JointDef {
public var timeStep:Number;
public var target:b2Vec2;
public var maxForce:Number;
public var dampingRatio:Number;
public var frequencyHz:Number;
public function b2MouseJointDef(){
target = new b2Vec2();
super();
type = b2Joint.e_mouseJoint;
maxForce = 0;
frequencyHz = 5;
dampingRatio = 0.7;
timeStep = (1 / 60);
}
}
}//package Box2D.Dynamics.Joints
Section 58
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PrismaticJoint extends b2Joint {
public var m_limitForce:Number;
public var m_lowerTranslation:Number;
public var m_localXAxis1:b2Vec2;
public var m_refAngle:Number;
public var m_torque:Number;
public var m_motorForce:Number;
public var m_enableLimit:Boolean;
public var m_angularMass:Number;
public var m_maxMotorForce:Number;
public var m_localYAxis1:b2Vec2;
public var m_force:Number;
public var m_motorMass:Number;
public var m_upperTranslation:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_limitState:int;
public var m_linearMass:Number;
public var m_motorJacobian:b2Jacobian;
public var m_limitPositionImpulse:Number;
public var m_motorSpeed:Number;
public var m_enableMotor:Boolean;
public var m_linearJacobian:b2Jacobian;
public function b2PrismaticJoint(_arg1:b2PrismaticJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_localXAxis1 = new b2Vec2();
m_localYAxis1 = new b2Vec2();
m_linearJacobian = new b2Jacobian();
m_motorJacobian = new b2Jacobian();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_localXAxis1.SetV(_arg1.localAxis1);
m_localYAxis1.x = -(m_localXAxis1.y);
m_localYAxis1.y = m_localXAxis1.x;
m_refAngle = _arg1.referenceAngle;
m_linearJacobian.SetZero();
m_linearMass = 0;
m_force = 0;
m_angularMass = 0;
m_torque = 0;
m_motorJacobian.SetZero();
m_motorMass = 0;
m_motorForce = 0;
m_limitForce = 0;
m_limitPositionImpulse = 0;
m_lowerTranslation = _arg1.lowerTranslation;
m_upperTranslation = _arg1.upperTranslation;
m_maxMotorForce = _arg1.maxMotorForce;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local8:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
var _local4:Number = _local2.m_invMass;
var _local5:Number = _local3.m_invMass;
var _local6:Number = _local2.m_invI;
var _local7:Number = _local3.m_invI;
var _local9:Number = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
var _local10:Number = ((-(_arg1.inv_dt) * m_linearMass) * _local9);
m_force = (m_force + _local10);
var _local11:Number = (_arg1.dt * _local10);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_linearJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_linearJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_linearJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_linearJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_linearJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_linearJacobian.angular2));
var _local12:Number = (_local3.m_angularVelocity - _local2.m_angularVelocity);
var _local13:Number = ((-(_arg1.inv_dt) * m_angularMass) * _local12);
m_torque = (m_torque + _local13);
var _local14:Number = (_arg1.dt * _local13);
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local6 * _local14));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local7 * _local14));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local15 = (m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - m_motorSpeed);
_local16 = ((-(_arg1.inv_dt) * m_motorMass) * _local15);
_local17 = m_motorForce;
m_motorForce = b2Math.b2Clamp((m_motorForce + _local16), -(m_maxMotorForce), m_maxMotorForce);
_local16 = (m_motorForce - _local17);
_local11 = (_arg1.dt * _local16);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local18 = m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local19 = ((-(_arg1.inv_dt) * m_motorMass) * _local18);
if (m_limitState == e_equalLimits){
m_limitForce = (m_limitForce + _local19);
} else {
if (m_limitState == e_atLowerLimit){
_local8 = m_limitForce;
m_limitForce = b2Math.b2Max((m_limitForce + _local19), 0);
_local19 = (m_limitForce - _local8);
} else {
if (m_limitState == e_atUpperLimit){
_local8 = m_limitForce;
m_limitForce = b2Math.b2Min((m_limitForce + _local19), 0);
_local19 = (m_limitForce - _local8);
};
};
};
_local11 = (_arg1.dt * _local19);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2));
};
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
public function GetUpperLimit():Number{
return (m_upperTranslation);
}
public function GetLowerLimit():Number{
return (m_lowerTranslation);
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function GetJointTranslation():Number{
var _local3:b2Mat22;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
var _local4:b2Vec2 = _local1.GetWorldPoint(m_localAnchor1);
var _local5:b2Vec2 = _local2.GetWorldPoint(m_localAnchor2);
var _local6:Number = (_local5.x - _local4.x);
var _local7:Number = (_local5.y - _local4.y);
var _local8:b2Vec2 = _local1.GetWorldVector(m_localXAxis1);
var _local9:Number = ((_local8.x * _local6) + (_local8.y * _local7));
return (_local9);
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Mat22 = m_body1.m_xf.R;
var _local2:Number = (m_limitForce * ((_local1.col1.x * m_localXAxis1.x) + (_local1.col2.x * m_localXAxis1.y)));
var _local3:Number = (m_limitForce * ((_local1.col1.y * m_localXAxis1.x) + (_local1.col2.y * m_localXAxis1.y)));
var _local4:Number = (m_force * ((_local1.col1.x * m_localYAxis1.x) + (_local1.col2.x * m_localYAxis1.y)));
var _local5:Number = (m_force * ((_local1.col1.y * m_localYAxis1.x) + (_local1.col2.y * m_localYAxis1.y)));
return (new b2Vec2(((m_limitForce * _local2) + (m_force * _local4)), ((m_limitForce * _local3) + (m_force * _local5))));
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local9:b2Mat22;
var _local10:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
var _local5:Number = _local3.m_invMass;
var _local6:Number = _local4.m_invMass;
var _local7:Number = _local3.m_invI;
var _local8:Number = _local4.m_invI;
_local9 = _local3.m_xf.R;
var _local11:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local12:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
var _local13:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local14:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
var _local15:Number = (_local3.m_sweep.c.x + _local11);
var _local16:Number = (_local3.m_sweep.c.y + _local12);
var _local17:Number = (_local4.m_sweep.c.x + _local13);
var _local18:Number = (_local4.m_sweep.c.y + _local14);
var _local19:Number = (_local17 - _local15);
var _local20:Number = (_local18 - _local16);
_local9 = _local3.m_xf.R;
var _local21:Number = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y));
var _local22:Number = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y));
var _local23:Number = ((_local21 * _local19) + (_local22 * _local20));
_local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
var _local24:Number = (-(m_linearMass) * _local23);
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local24) * m_linearJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local24) * m_linearJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local24) * m_linearJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local24) * m_linearJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local24) * m_linearJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local24) * m_linearJacobian.angular2));
var _local25:Number = b2Math.b2Abs(_local23);
var _local26:Number = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_refAngle);
_local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
var _local27:Number = (-(m_angularMass) * _local26);
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local27));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local27));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
var _local28:Number = b2Math.b2Abs(_local26);
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local9 = _local3.m_xf.R;
_local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
_local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
_local15 = (_local3.m_sweep.c.x + _local11);
_local16 = (_local3.m_sweep.c.y + _local12);
_local17 = (_local4.m_sweep.c.x + _local13);
_local18 = (_local4.m_sweep.c.y + _local14);
_local19 = (_local17 - _local15);
_local20 = (_local18 - _local16);
_local9 = _local3.m_xf.R;
_local29 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y));
_local30 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y));
_local31 = ((_local29 * _local19) + (_local30 * _local20));
_local32 = 0;
if (m_limitState == e_equalLimits){
_local1 = b2Math.b2Clamp(_local31, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local25 = b2Math.b2Max(_local25, b2Math.b2Abs(_local26));
} else {
if (m_limitState == e_atLowerLimit){
_local1 = (_local31 - m_lowerTranslation);
_local25 = b2Math.b2Max(_local25, -(_local1));
_local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
} else {
if (m_limitState == e_atUpperLimit){
_local1 = (_local31 - m_upperTranslation);
_local25 = b2Math.b2Max(_local25, _local1);
_local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
};
};
};
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local32) * m_motorJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local32) * m_motorJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local32) * m_motorJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local32) * m_motorJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local32) * m_motorJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local32) * m_motorJacobian.angular2));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local25 <= b2Settings.b2_linearSlop)) && ((_local28 <= b2Settings.b2_angularSlop))));
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function GetJointSpeed():Number{
var _local3:b2Mat22;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
_local3 = _local1.m_xf.R;
var _local4:Number = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
var _local5:Number = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local3 = _local2.m_xf.R;
var _local7:Number = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
var _local8:Number = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local7) + (_local3.col2.x * _local8));
_local8 = ((_local3.col1.y * _local7) + (_local3.col2.y * _local8));
_local7 = _local6;
var _local9:Number = (_local1.m_sweep.c.x + _local4);
var _local10:Number = (_local1.m_sweep.c.y + _local5);
var _local11:Number = (_local2.m_sweep.c.x + _local7);
var _local12:Number = (_local2.m_sweep.c.y + _local8);
var _local13:Number = (_local11 - _local9);
var _local14:Number = (_local12 - _local10);
var _local15:b2Vec2 = _local1.GetWorldVector(m_localXAxis1);
var _local16:b2Vec2 = _local1.m_linearVelocity;
var _local17:b2Vec2 = _local2.m_linearVelocity;
var _local18:Number = _local1.m_angularVelocity;
var _local19:Number = _local2.m_angularVelocity;
var _local20:Number = (((_local13 * (-(_local18) * _local15.y)) + (_local14 * (_local18 * _local15.x))) + ((_local15.x * (((_local17.x + (-(_local19) * _local8)) - _local16.x) - (-(_local18) * _local5))) + (_local15.y * (((_local17.y + (_local19 * _local7)) - _local16.y) - (_local18 * _local4)))));
return (_local20);
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local5:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
var _local10:Number = _local2.m_invMass;
var _local11:Number = _local3.m_invMass;
var _local12:Number = _local2.m_invI;
var _local13:Number = _local3.m_invI;
_local4 = _local2.m_xf.R;
var _local14:Number = ((_local4.col1.x * m_localYAxis1.x) + (_local4.col2.x * m_localYAxis1.y));
var _local15:Number = ((_local4.col1.y * m_localYAxis1.x) + (_local4.col2.y * m_localYAxis1.y));
var _local16:Number = ((_local3.m_sweep.c.x + _local8) - _local2.m_sweep.c.x);
var _local17:Number = ((_local3.m_sweep.c.y + _local9) - _local2.m_sweep.c.y);
m_linearJacobian.linear1.x = -(_local14);
m_linearJacobian.linear1.y = -(_local15);
m_linearJacobian.linear2.x = _local14;
m_linearJacobian.linear2.y = _local15;
m_linearJacobian.angular1 = -(((_local16 * _local15) - (_local17 * _local14)));
m_linearJacobian.angular2 = ((_local8 * _local15) - (_local9 * _local14));
m_linearMass = (((_local10 + ((_local12 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local11) + ((_local13 * m_linearJacobian.angular2) * m_linearJacobian.angular2));
m_linearMass = (1 / m_linearMass);
m_angularMass = (_local12 + _local13);
if (m_angularMass > Number.MIN_VALUE){
m_angularMass = (1 / m_angularMass);
};
if (((m_enableLimit) || (m_enableMotor))){
_local4 = _local2.m_xf.R;
_local18 = ((_local4.col1.x * m_localXAxis1.x) + (_local4.col2.x * m_localXAxis1.y));
_local19 = ((_local4.col1.y * m_localXAxis1.x) + (_local4.col2.y * m_localXAxis1.y));
m_motorJacobian.linear1.x = -(_local18);
m_motorJacobian.linear1.y = -(_local19);
m_motorJacobian.linear2.x = _local18;
m_motorJacobian.linear2.y = _local19;
m_motorJacobian.angular1 = -(((_local16 * _local19) - (_local17 * _local18)));
m_motorJacobian.angular2 = ((_local8 * _local19) - (_local9 * _local18));
m_motorMass = (((_local10 + ((_local12 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local11) + ((_local13 * m_motorJacobian.angular2) * m_motorJacobian.angular2));
m_motorMass = (1 / m_motorMass);
if (m_enableLimit){
_local20 = (_local16 - _local6);
_local21 = (_local17 - _local7);
_local22 = ((_local18 * _local20) + (_local19 * _local21));
if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){
m_limitState = e_equalLimits;
} else {
if (_local22 <= m_lowerTranslation){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local22 >= m_upperTranslation){
if (m_limitState != e_atUpperLimit){
m_limitForce = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitForce = 0;
};
};
};
};
};
if (m_enableMotor == false){
m_motorForce = 0;
};
if (m_enableLimit == false){
m_limitForce = 0;
};
if (_arg1.warmStarting){
_local23 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.x)));
_local24 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.y)));
_local25 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.x)));
_local26 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.y)));
_local27 = (_arg1.dt * (((m_force * m_linearJacobian.angular1) - m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular1)));
_local28 = (_arg1.dt * (((m_force * m_linearJacobian.angular2) + m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular2)));
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local10 * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local10 * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local12 * _local27));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local11 * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local11 * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local13 * _local28));
} else {
m_force = 0;
m_torque = 0;
m_limitForce = 0;
m_motorForce = 0;
};
m_limitPositionImpulse = 0;
}
public function GetMotorForce():Number{
return (m_motorForce);
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
public function SetMaxMotorForce(_arg1:Number):void{
m_maxMotorForce = _arg1;
}
override public function GetReactionTorque():Number{
return (m_torque);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerTranslation = _arg1;
m_upperTranslation = _arg2;
}
}
}//package Box2D.Dynamics.Joints
Section 59
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2PrismaticJointDef extends b2JointDef {
public var motorSpeed:Number;
public var localAxis1:b2Vec2;
public var referenceAngle:Number;
public var upperTranslation:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var enableLimit:Boolean;
public var enableMotor:Boolean;
public var maxMotorForce:Number;
public var lowerTranslation:Number;
public function b2PrismaticJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
localAxis1 = new b2Vec2();
super();
type = b2Joint.e_prismaticJoint;
localAxis1.Set(1, 0);
referenceAngle = 0;
enableLimit = false;
lowerTranslation = 0;
upperTranslation = 0;
enableMotor = false;
maxMotorForce = 0;
motorSpeed = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1 = body1.GetLocalPoint(_arg3);
localAnchor2 = body2.GetLocalPoint(_arg3);
localAxis1 = body1.GetLocalVector(_arg4);
referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 60
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PulleyJoint extends b2Joint {
public var m_limitState1:int;
public var m_limitState2:int;
public var m_ground:b2Body;
public var m_maxLength2:Number;
public var m_maxLength1:Number;
public var m_limitPositionImpulse1:Number;
public var m_limitPositionImpulse2:Number;
public var m_force:Number;
public var m_constant:Number;
public var m_positionImpulse:Number;
public var m_state:int;
public var m_ratio:Number;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_limitMass1:Number;
public var m_limitMass2:Number;
public var m_pulleyMass:Number;
public var m_u1:b2Vec2;
public var m_limitForce1:Number;
public var m_limitForce2:Number;
public var m_u2:b2Vec2;
public static const b2_minPulleyLength:Number = 2;
public function b2PulleyJoint(_arg1:b2PulleyJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_u1 = new b2Vec2();
m_u2 = new b2Vec2();
super(_arg1);
m_ground = m_body1.m_world.m_groundBody;
m_groundAnchor1.x = (_arg1.groundAnchor1.x - m_ground.m_xf.position.x);
m_groundAnchor1.y = (_arg1.groundAnchor1.y - m_ground.m_xf.position.y);
m_groundAnchor2.x = (_arg1.groundAnchor2.x - m_ground.m_xf.position.x);
m_groundAnchor2.y = (_arg1.groundAnchor2.y - m_ground.m_xf.position.y);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_ratio = _arg1.ratio;
m_constant = (_arg1.length1 + (m_ratio * _arg1.length2));
m_maxLength1 = b2Math.b2Min(_arg1.maxLength1, (m_constant - (m_ratio * b2_minPulleyLength)));
m_maxLength2 = b2Math.b2Min(_arg1.maxLength2, ((m_constant - b2_minPulleyLength) / m_ratio));
m_force = 0;
m_limitForce1 = 0;
m_limitForce2 = 0;
}
public function GetGroundAnchor2():b2Vec2{
var _local1:b2Vec2 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor2);
return (_local1);
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2 = m_u2.Copy();
_local1.Multiply(m_force);
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local3:b2Mat22;
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:Number;
var _local22:Number;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
var _local4:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x);
var _local5:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y);
var _local6:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x);
var _local7:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y);
var _local23:Number = 0;
if (m_state == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local16 = m_u1.Length();
_local17 = m_u2.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local16));
} else {
m_u1.SetZero();
};
if (_local17 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = ((m_constant - _local16) - (m_ratio * _local17));
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_pulleyMass) * _local18);
_local20 = m_positionImpulse;
m_positionImpulse = b2Math.b2Max(0, (m_positionImpulse + _local19));
_local19 = (m_positionImpulse - _local20);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local14 = ((-(m_ratio) * _local19) * m_u2.x);
_local15 = ((-(m_ratio) * _local19) * m_u2.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local1.SynchronizeTransform();
_local2.SynchronizeTransform();
};
if (m_limitState1 == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
_local16 = m_u1.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.x = (m_u1.x * (1 / _local16));
m_u1.y = (m_u1.y * (1 / _local16));
} else {
m_u1.SetZero();
};
_local18 = (m_maxLength1 - _local16);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass1) * _local18);
_local21 = m_limitPositionImpulse1;
m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + _local19));
_local19 = (m_limitPositionImpulse1 - _local21);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local1.SynchronizeTransform();
};
if (m_limitState2 == e_atUpperLimit){
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local17 = m_u2.Length();
if (_local17 > b2Settings.b2_linearSlop){
m_u2.x = (m_u2.x * (1 / _local17));
m_u2.y = (m_u2.y * (1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = (m_maxLength2 - _local17);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass2) * _local18);
_local21 = m_limitPositionImpulse2;
m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19));
_local19 = (m_limitPositionImpulse2 - _local21);
_local14 = (-(_local19) * m_u2.x);
_local15 = (-(_local19) * m_u2.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local2.SynchronizeTransform();
};
return ((_local23 < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
var _local10:Number = (_local2.m_sweep.c.x + _local5);
var _local11:Number = (_local2.m_sweep.c.y + _local6);
var _local12:Number = (_local3.m_sweep.c.x + _local8);
var _local13:Number = (_local3.m_sweep.c.y + _local9);
var _local14:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x);
var _local15:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y);
var _local16:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x);
var _local17:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y);
m_u1.Set((_local10 - _local14), (_local11 - _local15));
m_u2.Set((_local12 - _local16), (_local13 - _local17));
var _local18:Number = m_u1.Length();
var _local19:Number = m_u2.Length();
if (_local18 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local18));
} else {
m_u1.SetZero();
};
if (_local19 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local19));
} else {
m_u2.SetZero();
};
var _local20:Number = ((m_constant - _local18) - (m_ratio * _local19));
if (_local20 > 0){
m_state = e_inactiveLimit;
m_force = 0;
} else {
m_state = e_atUpperLimit;
m_positionImpulse = 0;
};
if (_local18 < m_maxLength1){
m_limitState1 = e_inactiveLimit;
m_limitForce1 = 0;
} else {
m_limitState1 = e_atUpperLimit;
m_limitPositionImpulse1 = 0;
};
if (_local19 < m_maxLength2){
m_limitState2 = e_inactiveLimit;
m_limitForce2 = 0;
} else {
m_limitState2 = e_atUpperLimit;
m_limitPositionImpulse2 = 0;
};
var _local21:Number = ((_local5 * m_u1.y) - (_local6 * m_u1.x));
var _local22:Number = ((_local8 * m_u2.y) - (_local9 * m_u2.x));
m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21));
m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22));
m_pulleyMass = (m_limitMass1 + ((m_ratio * m_ratio) * m_limitMass2));
m_limitMass1 = (1 / m_limitMass1);
m_limitMass2 = (1 / m_limitMass2);
m_pulleyMass = (1 / m_pulleyMass);
if (_arg1.warmStarting){
_local23 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.x);
_local24 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.y);
_local25 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.x);
_local26 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local24) - (_local6 * _local23))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local26) - (_local9 * _local25))));
} else {
m_force = 0;
m_limitForce1 = 0;
m_limitForce2 = 0;
};
}
override public function GetReactionTorque():Number{
return (0);
}
public function GetRatio():Number{
return (m_ratio);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
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 _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
if (m_state == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = (-(((m_u1.x * _local10) + (m_u1.y * _local11))) - (m_ratio * ((m_u2.x * _local12) + (m_u2.y * _local13))));
_local19 = ((-(_arg1.inv_dt) * m_pulleyMass) * _local18);
_local20 = m_force;
m_force = b2Math.b2Max(0, (m_force + _local19));
_local19 = (m_force - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * m_u1.y);
_local16 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.x);
_local17 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
if (m_limitState1 == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local18 = -(((m_u1.x * _local10) + (m_u1.y * _local11)));
_local19 = ((-(_arg1.inv_dt) * m_limitMass1) * _local18);
_local20 = m_limitForce1;
m_limitForce1 = b2Math.b2Max(0, (m_limitForce1 + _local19));
_local19 = (m_limitForce1 - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * m_u1.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
};
if (m_limitState2 == e_atUpperLimit){
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = -(((m_u2.x * _local12) + (m_u2.y * _local13)));
_local19 = ((-(_arg1.inv_dt) * m_limitMass2) * _local18);
_local20 = m_limitForce2;
m_limitForce2 = b2Math.b2Max(0, (m_limitForce2 + _local19));
_local19 = (m_limitForce2 - _local20);
_local16 = ((-(_arg1.dt) * _local19) * m_u2.x);
_local17 = ((-(_arg1.dt) * _local19) * m_u2.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
}
public function GetLength1():Number{
var _local1:b2Vec2 = m_body1.GetWorldPoint(m_localAnchor1);
var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x);
var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y);
var _local4:Number = (_local1.x - _local2);
var _local5:Number = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
public function GetLength2():Number{
var _local1:b2Vec2 = m_body2.GetWorldPoint(m_localAnchor2);
var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x);
var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y);
var _local4:Number = (_local1.x - _local2);
var _local5:Number = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
public function GetGroundAnchor1():b2Vec2{
var _local1:b2Vec2 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor1);
return (_local1);
}
}
}//package Box2D.Dynamics.Joints
Section 61
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2PulleyJointDef extends b2JointDef {
public var maxLength1:Number;
public var maxLength2:Number;
public var length1:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var groundAnchor1:b2Vec2;
public var groundAnchor2:b2Vec2;
public var ratio:Number;
public var length2:Number;
public function b2PulleyJointDef(){
groundAnchor1 = new b2Vec2();
groundAnchor2 = new b2Vec2();
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_pulleyJoint;
groundAnchor1.Set(-1, 1);
groundAnchor2.Set(1, 1);
localAnchor1.Set(-1, 0);
localAnchor2.Set(1, 0);
length1 = 0;
maxLength1 = 0;
length2 = 0;
maxLength2 = 0;
ratio = 1;
collideConnected = true;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2, _arg5:b2Vec2, _arg6:b2Vec2, _arg7:Number):void{
body1 = _arg1;
body2 = _arg2;
groundAnchor1.SetV(_arg3);
groundAnchor2.SetV(_arg4);
localAnchor1 = body1.GetLocalPoint(_arg5);
localAnchor2 = body2.GetLocalPoint(_arg6);
var _local8:Number = (_arg5.x - _arg3.x);
var _local9:Number = (_arg5.y - _arg3.y);
length1 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
var _local10:Number = (_arg6.x - _arg4.x);
var _local11:Number = (_arg6.y - _arg4.y);
length2 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
ratio = _arg7;
var _local12:Number = (length1 + (ratio * length2));
maxLength1 = (_local12 - (ratio * b2PulleyJoint.b2_minPulleyLength));
maxLength2 = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / ratio);
}
}
}//package Box2D.Dynamics.Joints
Section 62
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2RevoluteJoint extends b2Joint {
public var m_limitForce:Number;
public var m_pivotMass:b2Mat22;
public var m_motorForce:Number;
public var m_enableLimit:Boolean;
public var m_limitState:int;
public var m_motorMass:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K3:b2Mat22;
private var K:b2Mat22;
public var m_pivotForce:b2Vec2;
public var m_enableMotor:Boolean;
public var m_referenceAngle:Number;
public var m_limitPositionImpulse:Number;
public var m_motorSpeed:Number;
public var m_upperAngle:Number;
public var m_lowerAngle:Number;
public var m_maxMotorTorque:Number;
public static var tImpulse:b2Vec2 = new b2Vec2();
public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
K3 = new b2Mat22();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_pivotForce = new b2Vec2();
m_pivotMass = new b2Mat22();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_referenceAngle = _arg1.referenceAngle;
m_pivotForce.Set(0, 0);
m_motorForce = 0;
m_limitForce = 0;
m_limitPositionImpulse = 0;
m_lowerAngle = _arg1.lowerAngle;
m_upperAngle = _arg1.upperAngle;
m_maxMotorTorque = _arg1.maxMotorTorque;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local5:Number;
var _local10:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
var _local11:Number = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local7));
var _local12:Number = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local6));
var _local13:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.x * _local11) + (m_pivotMass.col2.x * _local12)));
var _local14:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.y * _local11) + (m_pivotMass.col2.y * _local12)));
m_pivotForce.x = (m_pivotForce.x + _local13);
m_pivotForce.y = (m_pivotForce.y + _local14);
var _local15:Number = (_arg1.dt * _local13);
_local16 = (_arg1.dt * _local14);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local16) - (_local9 * _local15))));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local17 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - m_motorSpeed);
_local18 = ((-(_arg1.inv_dt) * m_motorMass) * _local17);
_local19 = m_motorForce;
m_motorForce = b2Math.b2Clamp((m_motorForce + _local18), -(m_maxMotorTorque), m_maxMotorTorque);
_local18 = (m_motorForce - _local19);
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local18));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local18));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local20 = (_local3.m_angularVelocity - _local2.m_angularVelocity);
_local21 = ((-(_arg1.inv_dt) * m_motorMass) * _local20);
if (m_limitState == e_equalLimits){
m_limitForce = (m_limitForce + _local21);
} else {
if (m_limitState == e_atLowerLimit){
_local10 = m_limitForce;
m_limitForce = b2Math.b2Max((m_limitForce + _local21), 0);
_local21 = (m_limitForce - _local10);
} else {
if (m_limitState == e_atUpperLimit){
_local10 = m_limitForce;
m_limitForce = b2Math.b2Min((m_limitForce + _local21), 0);
_local21 = (m_limitForce - _local10);
};
};
};
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local21));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local21));
};
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
public function GetUpperLimit():Number{
return (m_upperAngle);
}
public function GetLowerLimit():Number{
return (m_lowerAngle);
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
override public function GetReactionForce():b2Vec2{
return (m_pivotForce);
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local6:b2Mat22;
var _local25:Number;
var _local26:Number;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
var _local5:Number = 0;
_local6 = _local3.m_xf.R;
var _local7:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local8:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
var _local9:Number = ((_local6.col1.x * _local7) + (_local6.col2.x * _local8));
_local8 = ((_local6.col1.y * _local7) + (_local6.col2.y * _local8));
_local7 = _local9;
_local6 = _local4.m_xf.R;
var _local10:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local11:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local9 = ((_local6.col1.x * _local10) + (_local6.col2.x * _local11));
_local11 = ((_local6.col1.y * _local10) + (_local6.col2.y * _local11));
_local10 = _local9;
var _local12:Number = (_local3.m_sweep.c.x + _local7);
var _local13:Number = (_local3.m_sweep.c.y + _local8);
var _local14:Number = (_local4.m_sweep.c.x + _local10);
var _local15:Number = (_local4.m_sweep.c.y + _local11);
var _local16:Number = (_local14 - _local12);
var _local17:Number = (_local15 - _local13);
_local5 = Math.sqrt(((_local16 * _local16) + (_local17 * _local17)));
var _local18:Number = _local3.m_invMass;
var _local19:Number = _local4.m_invMass;
var _local20:Number = _local3.m_invI;
var _local21:Number = _local4.m_invI;
K1.col1.x = (_local18 + _local19);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local18 + _local19);
K2.col1.x = ((_local20 * _local8) * _local8);
K2.col2.x = ((-(_local20) * _local7) * _local8);
K2.col1.y = ((-(_local20) * _local7) * _local8);
K2.col2.y = ((_local20 * _local7) * _local7);
K3.col1.x = ((_local21 * _local11) * _local11);
K3.col2.x = ((-(_local21) * _local10) * _local11);
K3.col1.y = ((-(_local21) * _local10) * _local11);
K3.col2.y = ((_local21 * _local10) * _local10);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Solve(tImpulse, -(_local16), -(_local17));
var _local22:Number = tImpulse.x;
var _local23:Number = tImpulse.y;
_local3.m_sweep.c.x = (_local3.m_sweep.c.x - (_local3.m_invMass * _local22));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y - (_local3.m_invMass * _local23));
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * ((_local7 * _local23) - (_local8 * _local22))));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + (_local4.m_invMass * _local22));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + (_local4.m_invMass * _local23));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * ((_local10 * _local23) - (_local11 * _local22))));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
var _local24:Number = 0;
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local25 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_referenceAngle);
_local26 = 0;
if (m_limitState == e_equalLimits){
_local2 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local24 = b2Math.b2Abs(_local2);
} else {
if (m_limitState == e_atLowerLimit){
_local2 = (_local25 - m_lowerAngle);
_local24 = b2Math.b2Max(0, -(_local2));
_local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
} else {
if (m_limitState == e_atUpperLimit){
_local2 = (_local25 - m_upperAngle);
_local24 = b2Math.b2Max(0, _local2);
_local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
};
};
};
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local26));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local26));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local24 <= b2Settings.b2_angularSlop))));
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function GetJointSpeed():Number{
return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity));
}
public function SetMaxMotorTorque(_arg1:Number):void{
m_maxMotorTorque = _arg1;
}
public function GetJointAngle():Number{
return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - m_referenceAngle));
}
public function GetMotorTorque():Number{
return (m_motorForce);
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local7:Number;
var _local14:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
var _local10:Number = _local2.m_invMass;
var _local11:Number = _local3.m_invMass;
var _local12:Number = _local2.m_invI;
var _local13:Number = _local3.m_invI;
K1.col1.x = (_local10 + _local11);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local10 + _local11);
K2.col1.x = ((_local12 * _local7) * _local7);
K2.col2.x = ((-(_local12) * _local6) * _local7);
K2.col1.y = ((-(_local12) * _local6) * _local7);
K2.col2.y = ((_local12 * _local6) * _local6);
K3.col1.x = ((_local13 * _local9) * _local9);
K3.col2.x = ((-(_local13) * _local8) * _local9);
K3.col1.y = ((-(_local13) * _local8) * _local9);
K3.col2.y = ((_local13 * _local8) * _local8);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Invert(m_pivotMass);
m_motorMass = (1 / (_local12 + _local13));
if (m_enableMotor == false){
m_motorForce = 0;
};
if (m_enableLimit){
_local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - m_referenceAngle);
if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){
m_limitState = e_equalLimits;
} else {
if (_local14 <= m_lowerAngle){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local14 >= m_upperAngle){
if (m_limitState != e_atUpperLimit){
m_limitForce = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitForce = 0;
};
};
};
} else {
m_limitForce = 0;
};
if (_arg1.warmStarting){
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - ((_arg1.dt * _local10) * m_pivotForce.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - ((_arg1.dt * _local10) * m_pivotForce.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_arg1.dt * _local12) * ((((_local6 * m_pivotForce.y) - (_local7 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_arg1.dt * _local11) * m_pivotForce.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_arg1.dt * _local11) * m_pivotForce.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_arg1.dt * _local13) * ((((_local8 * m_pivotForce.y) - (_local9 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
} else {
m_pivotForce.SetZero();
m_motorForce = 0;
m_limitForce = 0;
};
m_limitPositionImpulse = 0;
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
override public function GetReactionTorque():Number{
return (m_limitForce);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerAngle = _arg1;
m_upperAngle = _arg2;
}
}
}//package Box2D.Dynamics.Joints
Section 63
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2RevoluteJointDef extends b2JointDef {
public var upperAngle:Number;
public var enableMotor:Boolean;
public var referenceAngle:Number;
public var motorSpeed:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var enableLimit:Boolean;
public var lowerAngle:Number;
public var maxMotorTorque:Number;
public function b2RevoluteJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_revoluteJoint;
localAnchor1.Set(0, 0);
localAnchor2.Set(0, 0);
referenceAngle = 0;
lowerAngle = 0;
upperAngle = 0;
maxMotorTorque = 0;
motorSpeed = 0;
enableLimit = false;
enableMotor = false;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1 = body1.GetLocalPoint(_arg3);
localAnchor2 = body2.GetLocalPoint(_arg3);
referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 64
//b2Body (Box2D.Dynamics.b2Body)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
public class b2Body {
public var m_next:b2Body;
public var m_xf:b2XForm;
public var m_contactList:b2ContactEdge;
public var m_angularVelocity:Number;
public var m_shapeList:b2Shape;
public var m_force:b2Vec2;
public var m_mass:Number;
public var m_sweep:b2Sweep;
public var m_torque:Number;
public var m_userData;
public var m_flags:uint;
public var m_world:b2World;
public var m_prev:b2Body;
public var m_invMass:Number;
public var m_type:int;
public var m_linearDamping:Number;
public var m_shapeCount:int;
public var m_angularDamping:Number;
public var m_invI:Number;
public var m_linearVelocity:b2Vec2;
public var m_sleepTime:Number;
public var m_jointList:b2JointEdge;
public var m_I:Number;
public static var e_fixedRotationFlag:uint = 64;
public static var e_frozenFlag:uint = 2;
public static var e_maxTypes:uint = 3;
public static var e_sleepFlag:uint = 8;
private static var s_massData:b2MassData = new b2MassData();
public static var e_bulletFlag:uint = 32;
public static var e_staticType:uint = 1;
public static var e_islandFlag:uint = 4;
public static var e_allowSleepFlag:uint = 16;
private static var s_xf1:b2XForm = new b2XForm();
public static var e_dynamicType:uint = 2;
public function b2Body(_arg1:b2BodyDef, _arg2:b2World){
m_xf = new b2XForm();
m_sweep = new b2Sweep();
m_linearVelocity = new b2Vec2();
m_force = new b2Vec2();
super();
m_flags = 0;
if (_arg1.isBullet){
m_flags = (m_flags | e_bulletFlag);
};
if (_arg1.fixedRotation){
m_flags = (m_flags | e_fixedRotationFlag);
};
if (_arg1.allowSleep){
m_flags = (m_flags | e_allowSleepFlag);
};
if (_arg1.isSleeping){
m_flags = (m_flags | e_sleepFlag);
};
m_world = _arg2;
m_xf.position.SetV(_arg1.position);
m_xf.R.Set(_arg1.angle);
m_sweep.localCenter.SetV(_arg1.massData.center);
m_sweep.t0 = 1;
m_sweep.a0 = (m_sweep.a = _arg1.angle);
var _local3:b2Mat22 = m_xf.R;
var _local4:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_jointList = null;
m_contactList = null;
m_prev = null;
m_next = null;
m_linearDamping = _arg1.linearDamping;
m_angularDamping = _arg1.angularDamping;
m_force.Set(0, 0);
m_torque = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_sleepTime = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.massData.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.massData.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
m_userData = _arg1.userData;
m_shapeList = null;
m_shapeCount = 0;
}
public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{
return (new b2Vec2((m_linearVelocity.x - (m_angularVelocity * (_arg1.y - m_sweep.c.y))), (m_linearVelocity.y + (m_angularVelocity * (_arg1.x - m_sweep.c.x)))));
}
public function SetLinearVelocity(_arg1:b2Vec2):void{
m_linearVelocity.SetV(_arg1);
}
public function WakeUp():void{
m_flags = (m_flags & ~(e_sleepFlag));
m_sleepTime = 0;
}
public function GetLocalCenter():b2Vec2{
return (m_sweep.localCenter);
}
public function ApplyTorque(_arg1:Number):void{
if (IsSleeping()){
WakeUp();
};
m_torque = (m_torque + _arg1);
}
public function IsFrozen():Boolean{
return (((m_flags & e_frozenFlag) == e_frozenFlag));
}
public function IsDynamic():Boolean{
return ((m_type == e_dynamicType));
}
public function GetLinearVelocity():b2Vec2{
return (m_linearVelocity);
}
public function SynchronizeTransform():void{
m_xf.R.Set(m_sweep.a);
var _local1:b2Mat22 = m_xf.R;
var _local2:b2Vec2 = m_sweep.localCenter;
m_xf.position.x = (m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y)));
m_xf.position.y = (m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y)));
}
public function GetInertia():Number{
return (m_I);
}
public function IsSleeping():Boolean{
return (((m_flags & e_sleepFlag) == e_sleepFlag));
}
public function SetMassFromShapes():void{
var _local1:b2Shape;
if (m_world.m_lock == true){
return;
};
m_mass = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
var _local2:Number = 0;
var _local3:Number = 0;
var _local4:b2MassData = s_massData;
_local1 = m_shapeList;
while (_local1) {
_local1.ComputeMass(_local4);
m_mass = (m_mass + _local4.mass);
_local2 = (_local2 + (_local4.mass * _local4.center.x));
_local3 = (_local3 + (_local4.mass * _local4.center.y));
m_I = (m_I + _local4.I);
_local1 = _local1.m_next;
};
if (m_mass > 0){
m_invMass = (1 / m_mass);
_local2 = (_local2 * m_invMass);
_local3 = (_local3 * m_invMass);
};
if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){
m_I = (m_I - (m_mass * ((_local2 * _local2) + (_local3 * _local3))));
m_invI = (1 / m_I);
} else {
m_I = 0;
m_invI = 0;
};
m_sweep.localCenter.Set(_local2, _local3);
var _local5:b2Mat22 = m_xf.R;
var _local6:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y));
m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
_local1 = m_shapeList;
while (_local1) {
_local1.UpdateSweepRadius(m_sweep.localCenter);
_local1 = _local1.m_next;
};
var _local7:int = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local7 != m_type){
_local1 = m_shapeList;
while (_local1) {
_local1.RefilterProxy(m_world.m_broadPhase, m_xf);
_local1 = _local1.m_next;
};
};
}
public function PutToSleep():void{
m_flags = (m_flags | e_sleepFlag);
m_sleepTime = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_force.SetZero();
m_torque = 0;
}
public function GetJointList():b2JointEdge{
return (m_jointList);
}
public function SetXForm(_arg1:b2Vec2, _arg2:Number):Boolean{
var _local3:b2Shape;
var _local7:Boolean;
if (m_world.m_lock == true){
return (true);
};
if (IsFrozen()){
return (false);
};
m_xf.R.Set(_arg2);
m_xf.position.SetV(_arg1);
var _local4:b2Mat22 = m_xf.R;
var _local5:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y));
m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_sweep.a0 = (m_sweep.a = _arg2);
var _local6:Boolean;
_local3 = m_shapeList;
while (_local3) {
_local7 = _local3.Synchronize(m_world.m_broadPhase, m_xf, m_xf);
if (_local7 == false){
_local6 = true;
break;
};
_local3 = _local3.m_next;
};
if (_local6 == true){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local3 = m_shapeList;
while (_local3) {
_local3.DestroyProxy(m_world.m_broadPhase);
_local3 = _local3.m_next;
};
return (false);
};
m_world.m_broadPhase.Commit();
return (true);
}
public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulXT(m_xf, _arg1));
}
public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
m_force.x = (m_force.x + _arg1.x);
m_force.y = (m_force.y + _arg1.y);
m_torque = (m_torque + (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x)));
}
public function SynchronizeShapes():Boolean{
var _local4:b2Shape;
var _local1:b2XForm = s_xf1;
_local1.R.Set(m_sweep.a0);
var _local2:b2Mat22 = _local1.R;
var _local3:b2Vec2 = m_sweep.localCenter;
_local1.position.x = (m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y)));
_local1.position.y = (m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y)));
var _local5:Boolean;
_local4 = m_shapeList;
while (_local4) {
_local5 = _local4.Synchronize(m_world.m_broadPhase, _local1, m_xf);
if (_local5 == false){
break;
};
_local4 = _local4.m_next;
};
if (_local5 == false){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local4 = m_shapeList;
while (_local4) {
_local4.DestroyProxy(m_world.m_broadPhase);
_local4 = _local4.m_next;
};
return (false);
};
return (true);
}
public function GetAngle():Number{
return (m_sweep.a);
}
public function GetXForm():b2XForm{
return (m_xf);
}
public function GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22 = m_xf.R;
var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_local3.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_local3.x - m_sweep.c.x)))));
}
public function GetNext():b2Body{
return (m_next);
}
public function GetMass():Number{
return (m_mass);
}
public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
m_linearVelocity.x = (m_linearVelocity.x + (m_invMass * _arg1.x));
m_linearVelocity.y = (m_linearVelocity.y + (m_invMass * _arg1.y));
m_angularVelocity = (m_angularVelocity + (m_invI * (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x))));
}
public function GetAngularVelocity():Number{
return (m_angularVelocity);
}
public function SetAngularVelocity(_arg1:Number):void{
m_angularVelocity = _arg1;
}
public function SetMass(_arg1:b2MassData):void{
var _local2:b2Shape;
if (m_world.m_lock == true){
return;
};
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
m_sweep.localCenter.SetV(_arg1.center);
var _local3:b2Mat22 = m_xf.R;
var _local4:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
_local2 = m_shapeList;
while (_local2) {
_local2.UpdateSweepRadius(m_sweep.localCenter);
_local2 = _local2.m_next;
};
var _local5:int = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local5 != m_type){
_local2 = m_shapeList;
while (_local2) {
_local2.RefilterProxy(m_world.m_broadPhase, m_xf);
_local2 = _local2.m_next;
};
};
}
public function IsStatic():Boolean{
return ((m_type == e_staticType));
}
public function GetWorldVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulMV(m_xf.R, _arg1));
}
public function GetShapeList():b2Shape{
return (m_shapeList);
}
public function Advance(_arg1:Number):void{
m_sweep.Advance(_arg1);
m_sweep.c.SetV(m_sweep.c0);
m_sweep.a = m_sweep.a0;
SynchronizeTransform();
}
public function SetBullet(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_bulletFlag);
} else {
m_flags = (m_flags & ~(e_bulletFlag));
};
}
public function CreateShape(_arg1:b2ShapeDef):b2Shape{
var _local2:b2Shape;
if (m_world.m_lock == true){
return (null);
};
_local2 = b2Shape.Create(_arg1, m_world.m_blockAllocator);
_local2.m_next = m_shapeList;
m_shapeList = _local2;
m_shapeCount++;
_local2.m_body = this;
_local2.CreateProxy(m_world.m_broadPhase, m_xf);
_local2.UpdateSweepRadius(m_sweep.localCenter);
return (_local2);
}
public function IsConnected(_arg1:b2Body):Boolean{
var _local2:b2JointEdge = m_jointList;
while (_local2) {
if (_local2.other == _arg1){
return ((_local2.joint.m_collideConnected == false));
};
_local2 = _local2.next;
};
return (false);
}
public function DestroyShape(_arg1:b2Shape):void{
if (m_world.m_lock == true){
return;
};
_arg1.DestroyProxy(m_world.m_broadPhase);
var _local2:b2Shape = m_shapeList;
var _local3:b2Shape;
var _local4:Boolean;
while (_local2 != null) {
if (_local2 == _arg1){
if (_local3){
_local3.m_next = _arg1.m_next;
} else {
m_shapeList = _arg1.m_next;
};
_local4 = true;
break;
};
_local3 = _local2;
_local2 = _local2.m_next;
};
_arg1.m_body = null;
_arg1.m_next = null;
m_shapeCount--;
b2Shape.Destroy(_arg1, m_world.m_blockAllocator);
}
public function GetUserData(){
return (m_userData);
}
public function IsBullet():Boolean{
return (((m_flags & e_bulletFlag) == e_bulletFlag));
}
public function GetWorldCenter():b2Vec2{
return (m_sweep.c);
}
public function AllowSleeping(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_allowSleepFlag);
} else {
m_flags = (m_flags & ~(e_allowSleepFlag));
WakeUp();
};
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetLocalVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_xf.R, _arg1));
}
public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22 = m_xf.R;
var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (_local3);
}
public function GetWorld():b2World{
return (m_world);
}
public function GetPosition():b2Vec2{
return (m_xf.position);
}
}
}//package Box2D.Dynamics
Section 65
//b2BodyDef (Box2D.Dynamics.b2BodyDef)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class b2BodyDef {
public var angularDamping:Number;
public var angle:Number;
public var isSleeping:Boolean;
public var position:b2Vec2;
public var isBullet:Boolean;
public var allowSleep:Boolean;
public var userData;
public var fixedRotation:Boolean;
public var linearDamping:Number;
public var massData:b2MassData;
public function b2BodyDef(){
massData = new b2MassData();
position = new b2Vec2();
super();
massData.center.SetZero();
massData.mass = 0;
massData.I = 0;
userData = null;
position.Set(0, 0);
angle = 0;
linearDamping = 0;
angularDamping = 0;
allowSleep = true;
isSleeping = false;
fixedRotation = false;
isBullet = false;
}
}
}//package Box2D.Dynamics
Section 66
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener)
package Box2D.Dynamics {
public class b2BoundaryListener {
public function Violation(_arg1:b2Body):void{
}
}
}//package Box2D.Dynamics
Section 67
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
public class b2ContactFilter {
public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter);
;
public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{
var _local3:b2FilterData = _arg1.GetFilterData();
var _local4:b2FilterData = _arg2.GetFilterData();
if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){
return ((_local3.groupIndex > 0));
};
var _local5:Boolean = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0))));
return (_local5);
}
}
}//package Box2D.Dynamics
Section 68
//b2ContactListener (Box2D.Dynamics.b2ContactListener)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactListener {
public function Add(_arg1:b2ContactPoint):void{
}
public function Remove(_arg1:b2ContactPoint):void{
}
public function Persist(_arg1:b2ContactPoint):void{
}
public function Result(_arg1:b2ContactResult):void{
}
}
}//package Box2D.Dynamics
Section 69
//b2ContactManager (Box2D.Dynamics.b2ContactManager)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactManager extends b2PairCallback {
public var m_world:b2World;
public var m_destroyImmediate:Boolean;
public var m_nullContact:b2NullContact;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2ContactManager(){
m_nullContact = new b2NullContact();
super();
m_world = null;
m_destroyImmediate = false;
}
override public function PairRemoved(_arg1, _arg2, _arg3):void{
if (_arg3 == null){
return;
};
var _local4:b2Contact = (_arg3 as b2Contact);
if (_local4 == m_nullContact){
return;
};
Destroy(_local4);
}
public function Destroy(_arg1:b2Contact):void{
var _local7:b2Body;
var _local8:b2Body;
var _local9:Array;
var _local10:b2ContactPoint;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2Vec2;
var _local16:b2Vec2;
var _local2:b2Shape = _arg1.m_shape1;
var _local3:b2Shape = _arg1.m_shape2;
var _local4:int = _arg1.m_manifoldCount;
if ((((_local4 > 0)) && (m_world.m_contactListener))){
_local7 = _local2.m_body;
_local8 = _local3.m_body;
_local9 = _arg1.GetManifolds();
_local10 = s_evalCP;
_local10.shape1 = _arg1.m_shape1;
_local10.shape2 = _arg1.m_shape2;
_local10.friction = _arg1.m_friction;
_local10.restitution = _arg1.m_restitution;
_local11 = 0;
while (_local11 < _local4) {
_local12 = _local9[_local11];
_local10.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local10.position = _local7.GetWorldPoint(_local14.localPoint1);
_local15 = _local7.GetLinearVelocityFromLocalPoint(_local14.localPoint1);
_local16 = _local8.GetLinearVelocityFromLocalPoint(_local14.localPoint2);
_local10.velocity.Set((_local16.x - _local15.x), (_local16.y - _local15.y));
_local10.separation = _local14.separation;
_local10.id.key = _local14.id._key;
m_world.m_contactListener.Remove(_local10);
_local13++;
};
_local11++;
};
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_world.m_contactList){
m_world.m_contactList = _arg1.m_next;
};
var _local5:b2Body = _local2.m_body;
var _local6:b2Body = _local3.m_body;
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local5.m_contactList){
_local5.m_contactList = _arg1.m_node1.next;
};
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local6.m_contactList){
_local6.m_contactList = _arg1.m_node2.next;
};
b2Contact.Destroy(_arg1, m_world.m_blockAllocator);
m_world.m_contactCount--;
}
override public function PairAdded(_arg1, _arg2){
var _local3:b2Shape = (_arg1 as b2Shape);
var _local4:b2Shape = (_arg2 as b2Shape);
var _local5:b2Body = _local3.m_body;
var _local6:b2Body = _local4.m_body;
if (((_local5.IsStatic()) && (_local6.IsStatic()))){
return (m_nullContact);
};
if (_local3.m_body == _local4.m_body){
return (m_nullContact);
};
if (_local6.IsConnected(_local5)){
return (m_nullContact);
};
if (((!((m_world.m_contactFilter == null))) && ((m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){
return (m_nullContact);
};
var _local7:b2Contact = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator);
if (_local7 == null){
return (m_nullContact);
};
_local3 = _local7.m_shape1;
_local4 = _local7.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local7.m_prev = null;
_local7.m_next = m_world.m_contactList;
if (m_world.m_contactList != null){
m_world.m_contactList.m_prev = _local7;
};
m_world.m_contactList = _local7;
_local7.m_node1.contact = _local7;
_local7.m_node1.other = _local6;
_local7.m_node1.prev = null;
_local7.m_node1.next = _local5.m_contactList;
if (_local5.m_contactList != null){
_local5.m_contactList.prev = _local7.m_node1;
};
_local5.m_contactList = _local7.m_node1;
_local7.m_node2.contact = _local7;
_local7.m_node2.other = _local5;
_local7.m_node2.prev = null;
_local7.m_node2.next = _local6.m_contactList;
if (_local6.m_contactList != null){
_local6.m_contactList.prev = _local7.m_node2;
};
_local6.m_contactList = _local7.m_node2;
m_world.m_contactCount++;
return (_local7);
}
public function Collide():void{
var _local2:b2Body;
var _local3:b2Body;
var _local1:b2Contact = m_world.m_contactList;
while (_local1) {
_local2 = _local1.m_shape1.m_body;
_local3 = _local1.m_shape2.m_body;
if (((_local2.IsSleeping()) && (_local3.IsSleeping()))){
} else {
_local1.Update(m_world.m_contactListener);
};
_local1 = _local1.m_next;
};
}
}
}//package Box2D.Dynamics
Section 70
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw)
package Box2D.Dynamics {
import flash.display.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2DebugDraw {
public var m_xformScale:Number;// = 1
public var m_fillAlpha:Number;// = 1
public var m_alpha:Number;// = 1
public var m_drawFlags:uint;
public var m_lineThickness:Number;// = 1
public var m_drawScale:Number;// = 1
public var m_sprite:Sprite;
public static var e_coreShapeBit:uint = 4;
public static var e_shapeBit:uint = 1;
public static var e_centerOfMassBit:uint = 64;
public static var e_aabbBit:uint = 8;
public static var e_obbBit:uint = 16;
public static var e_pairBit:uint = 32;
public static var e_jointBit:uint = 2;
public function b2DebugDraw(){
m_drawFlags = 0;
}
public function ClearFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags & ~(_arg1));
}
public function SetFlags(_arg1:uint):void{
m_drawFlags = _arg1;
}
public function AppendFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags | _arg1);
}
public function DrawSegment(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
m_sprite.graphics.lineTo((_arg2.x * m_drawScale), (_arg2.y * m_drawScale));
}
public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.beginFill(_arg3.color, m_fillAlpha);
var _local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.endFill();
}
public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
}
public function DrawPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
var _local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
}
public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha);
m_sprite.graphics.moveTo(0, 0);
m_sprite.graphics.beginFill(_arg4.color, m_fillAlpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
m_sprite.graphics.endFill();
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.x + (_arg3.x * _arg2)) * m_drawScale), ((_arg1.y + (_arg3.y * _arg2)) * m_drawScale));
}
public function GetFlags():uint{
return (m_drawFlags);
}
public function DrawXForm(_arg1:b2XForm):void{
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF0000, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col1.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col1.y)) * m_drawScale));
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF00, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col2.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col2.y)) * m_drawScale));
}
}
}//package Box2D.Dynamics
Section 71
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener)
package Box2D.Dynamics {
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
public class b2DestructionListener {
public function SayGoodbyeShape(_arg1:b2Shape):void{
}
public function SayGoodbyeJoint(_arg1:b2Joint):void{
}
}
}//package Box2D.Dynamics
Section 72
//b2Island (Box2D.Dynamics.b2Island)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2Island {
public var m_listener:b2ContactListener;
public var m_positionIterationCount:int;
public var m_bodyCapacity:int;
public var m_bodies:Array;
public var m_joints:Array;
public var m_jointCapacity:int;
public var m_contactCount:int;
public var m_contacts:Array;
public var m_contactCapacity:int;
public var m_jointCount:int;
public var m_allocator;
public var m_bodyCount:int;
private static var s_reportCR:b2ContactResult = new b2ContactResult();
public function b2Island(_arg1:int, _arg2:int, _arg3:int, _arg4, _arg5:b2ContactListener){
var _local6:int;
super();
m_bodyCapacity = _arg1;
m_contactCapacity = _arg2;
m_jointCapacity = _arg3;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_allocator = _arg4;
m_listener = _arg5;
m_bodies = new Array(_arg1);
_local6 = 0;
while (_local6 < _arg1) {
m_bodies[_local6] = null;
_local6++;
};
m_contacts = new Array(_arg2);
_local6 = 0;
while (_local6 < _arg2) {
m_contacts[_local6] = null;
_local6++;
};
m_joints = new Array(_arg3);
_local6 = 0;
while (_local6 < _arg3) {
m_joints[_local6] = null;
_local6++;
};
m_positionIterationCount = 0;
}
public function AddBody(_arg1:b2Body):void{
var _local2 = m_bodyCount++;
m_bodies[_local2] = _arg1;
}
public function AddJoint(_arg1:b2Joint):void{
var _local2 = m_jointCount++;
m_joints[_local2] = _arg1;
}
public function Report(_arg1:Array):void{
var _local2:b2Mat22;
var _local3:b2Vec2;
var _local5:b2Contact;
var _local6:b2ContactConstraint;
var _local7:b2ContactResult;
var _local8:b2Body;
var _local9:int;
var _local10:Array;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2ContactConstraintPoint;
if (m_listener == null){
return;
};
var _local4:int;
while (_local4 < m_contactCount) {
_local5 = m_contacts[_local4];
_local6 = _arg1[_local4];
_local7 = s_reportCR;
_local7.shape1 = _local5.m_shape1;
_local7.shape2 = _local5.m_shape2;
_local8 = _local7.shape1.m_body;
_local9 = _local5.m_manifoldCount;
_local10 = _local5.GetManifolds();
_local11 = 0;
while (_local11 < _local9) {
_local12 = _local10[_local11];
_local7.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local15 = _local6.points[_local13];
_local7.position = _local8.GetWorldPoint(_local14.localPoint1);
_local7.normalImpulse = _local15.normalImpulse;
_local7.tangentImpulse = _local15.tangentImpulse;
_local7.id.key = _local14.id.key;
m_listener.Result(_local7);
_local13++;
};
_local11++;
};
_local4++;
};
}
public function AddContact(_arg1:b2Contact):void{
var _local2 = m_contactCount++;
m_contacts[_local2] = _arg1;
}
public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2, _arg3:Boolean, _arg4:Boolean):void{
var _local5:int;
var _local6:b2Body;
var _local7:b2Joint;
var _local9:int;
var _local10:Boolean;
var _local11:Boolean;
var _local12:Boolean;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x))));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y))));
_local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque));
_local6.m_force.SetZero();
_local6.m_torque = 0;
_local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1));
_local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1));
if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){
_local6.m_linearVelocity.Normalize();
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity);
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity);
};
if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){
if (_local6.m_angularVelocity < 0){
_local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity);
} else {
_local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity;
};
};
};
_local5++;
};
var _local8:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local8.InitVelocityConstraints(_arg1);
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitVelocityConstraints(_arg1);
_local5++;
};
_local5 = 0;
while (_local5 < _arg1.maxIterations) {
_local8.SolveVelocityConstraints();
_local9 = 0;
while (_local9 < m_jointCount) {
_local7 = m_joints[_local9];
_local7.SolveVelocityConstraints(_arg1);
_local9++;
};
_local5++;
};
_local8.FinalizeVelocityConstraints();
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_sweep.c0.SetV(_local6.m_sweep.c);
_local6.m_sweep.a0 = _local6.m_sweep.a;
_local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_arg1.dt * _local6.m_linearVelocity.x));
_local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_arg1.dt * _local6.m_linearVelocity.y));
_local6.m_sweep.a = (_local6.m_sweep.a + (_arg1.dt * _local6.m_angularVelocity));
_local6.SynchronizeTransform();
};
_local5++;
};
if (_arg3){
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitPositionConstraints();
_local5++;
};
m_positionIterationCount = 0;
while (m_positionIterationCount < (_arg1.maxIterations * 3)) {
_local10 = _local8.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
_local11 = true;
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local12 = _local7.SolvePositionConstraints();
_local11 = ((_local11) && (_local12));
_local5++;
};
if (((_local10) && (_local11))){
break;
};
m_positionIterationCount++;
};
};
Report(_local8.m_constraints);
if (_arg4){
_local13 = Number.MAX_VALUE;
_local14 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance);
_local15 = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance);
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.m_invMass == 0){
} else {
if ((_local6.m_flags & b2Body.e_allowSleepFlag) == 0){
_local6.m_sleepTime = 0;
_local13 = 0;
};
if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local15)))) || ((b2Math.b2Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local14)))){
_local6.m_sleepTime = 0;
_local13 = 0;
} else {
_local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt);
_local13 = b2Math.b2Min(_local13, _local6.m_sleepTime);
};
};
_local5++;
};
if (_local13 >= b2Settings.b2_timeToSleep){
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
m_bodies[_local5].m_flags = (_local6.m_flags | b2Body.e_sleepFlag);
_local6.m_linearVelocity.SetZero();
_local6.m_angularVelocity = 0;
_local5++;
};
};
};
}
public function Clear():void{
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:int;
var _local5:b2Body;
var _local6:Boolean;
var _local3:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local3.SolveVelocityConstraints();
_local2++;
};
_local2 = 0;
while (_local2 < m_bodyCount) {
_local5 = m_bodies[_local2];
if (_local5.IsStatic()){
} else {
_local5.m_sweep.c0.SetV(_local5.m_sweep.c);
_local5.m_sweep.a0 = _local5.m_sweep.a;
_local5.m_sweep.c.x = (_local5.m_sweep.c.x + (_arg1.dt * _local5.m_linearVelocity.x));
_local5.m_sweep.c.y = (_local5.m_sweep.c.y + (_arg1.dt * _local5.m_linearVelocity.y));
_local5.m_sweep.a = (_local5.m_sweep.a + (_arg1.dt * _local5.m_angularVelocity));
_local5.SynchronizeTransform();
};
_local2++;
};
var _local4:Number = 0.75;
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local6 = _local3.SolvePositionConstraints(_local4);
if (_local6){
break;
};
_local2++;
};
Report(_local3.m_constraints);
}
}
}//package Box2D.Dynamics
Section 73
//b2TimeStep (Box2D.Dynamics.b2TimeStep)
package Box2D.Dynamics {
public class b2TimeStep {
public var warmStarting:Boolean;
public var positionCorrection:Boolean;
public var dt:Number;
public var maxIterations:int;
public var dtRatio:Number;
public var inv_dt:Number;
}
}//package Box2D.Dynamics
Section 74
//b2World (Box2D.Dynamics.b2World)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2World {
public var m_inv_dt0:Number;
public var m_boundaryListener:b2BoundaryListener;
public var m_contactList:b2Contact;
public var m_blockAllocator;
public var m_contactListener:b2ContactListener;
public var m_allowSleep:Boolean;
public var m_broadPhase:b2BroadPhase;
public var m_destructionListener:b2DestructionListener;
public var m_jointCount:int;
public var m_bodyCount:int;
public var m_lock:Boolean;
public var m_positionIterationCount:int;
public var m_groundBody:b2Body;
public var m_contactCount:int;
public var m_debugDraw:b2DebugDraw;
public var m_contactFilter:b2ContactFilter;
public var m_bodyList:b2Body;
public var m_stackAllocator;
public var m_jointList:b2Joint;
public var m_gravity:b2Vec2;
public var m_contactManager:b2ContactManager;
private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8);
public static var m_continuousPhysics:Boolean;
public static var m_warmStarting:Boolean;
private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6);
public static var m_positionCorrection:Boolean;
private static var s_xf:b2XForm = new b2XForm();
public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){
m_contactManager = new b2ContactManager();
super();
m_destructionListener = null;
m_boundaryListener = null;
m_contactFilter = b2ContactFilter.b2_defaultFilter;
m_contactListener = null;
m_debugDraw = null;
m_bodyList = null;
m_contactList = null;
m_jointList = null;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_positionCorrection = true;
m_warmStarting = true;
m_continuousPhysics = true;
m_allowSleep = _arg3;
m_gravity = _arg2;
m_lock = false;
m_inv_dt0 = 0;
m_contactManager.m_world = this;
m_broadPhase = new b2BroadPhase(_arg1, m_contactManager);
var _local4:b2BodyDef = new b2BodyDef();
m_groundBody = CreateBody(_local4);
}
public function DrawJoint(_arg1:b2Joint):void{
var _local11:b2PulleyJoint;
var _local12:b2Vec2;
var _local13:b2Vec2;
var _local2:b2Body = _arg1.m_body1;
var _local3:b2Body = _arg1.m_body2;
var _local4:b2XForm = _local2.m_xf;
var _local5:b2XForm = _local3.m_xf;
var _local6:b2Vec2 = _local4.position;
var _local7:b2Vec2 = _local5.position;
var _local8:b2Vec2 = _arg1.GetAnchor1();
var _local9:b2Vec2 = _arg1.GetAnchor2();
var _local10:b2Color = s_jointColor;
switch (_arg1.m_type){
case b2Joint.e_distanceJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
case b2Joint.e_pulleyJoint:
_local11 = (_arg1 as b2PulleyJoint);
_local12 = _local11.GetGroundAnchor1();
_local13 = _local11.GetGroundAnchor2();
m_debugDraw.DrawSegment(_local12, _local8, _local10);
m_debugDraw.DrawSegment(_local13, _local9, _local10);
m_debugDraw.DrawSegment(_local12, _local13, _local10);
break;
case b2Joint.e_mouseJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
default:
if (_local2 != m_groundBody){
m_debugDraw.DrawSegment(_local6, _local8, _local10);
};
m_debugDraw.DrawSegment(_local8, _local9, _local10);
if (_local3 != m_groundBody){
m_debugDraw.DrawSegment(_local7, _local9, _local10);
};
};
}
public function Refilter(_arg1:b2Shape):void{
_arg1.RefilterProxy(m_broadPhase, _arg1.m_body.m_xf);
}
public function SetDebugDraw(_arg1:b2DebugDraw):void{
m_debugDraw = _arg1;
}
public function SetContinuousPhysics(_arg1:Boolean):void{
m_continuousPhysics = _arg1;
}
public function GetProxyCount():int{
return (m_broadPhase.m_proxyCount);
}
public function DrawDebugData():void{
var _local2:int;
var _local3:b2Body;
var _local4:b2Shape;
var _local5:b2Joint;
var _local6:b2BroadPhase;
var _local11:b2XForm;
var _local15:Boolean;
var _local16:uint;
var _local17:b2Pair;
var _local18:b2Proxy;
var _local19:b2Proxy;
var _local20:b2Vec2;
var _local21:b2Vec2;
var _local22:b2Proxy;
var _local23:b2PolygonShape;
var _local24:b2OBB;
var _local25:b2Vec2;
var _local26:b2Mat22;
var _local27:b2Vec2;
var _local28:Number;
if (m_debugDraw == null){
return;
};
m_debugDraw.m_sprite.graphics.clear();
var _local1:uint = m_debugDraw.GetFlags();
var _local7:b2Vec2 = new b2Vec2();
var _local8:b2Vec2 = new b2Vec2();
var _local9:b2Vec2 = new b2Vec2();
var _local10:b2Color = new b2Color(0, 0, 0);
var _local12:b2AABB = new b2AABB();
var _local13:b2AABB = new b2AABB();
var _local14:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()];
if ((_local1 & b2DebugDraw.e_shapeBit)){
_local15 = ((_local1 & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local3.IsStatic()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.9, 0.5), _local15);
} else {
if (_local3.IsSleeping()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.5, 0.9), _local15);
} else {
DrawShape(_local4, _local11, new b2Color(0.9, 0.9, 0.9), _local15);
};
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_jointBit)){
_local5 = m_jointList;
while (_local5) {
DrawJoint(_local5);
_local5 = _local5.m_next;
};
};
if ((_local1 & b2DebugDraw.e_pairBit)){
_local6 = m_broadPhase;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.9, 0.3);
_local2 = 0;
while (_local2 < b2Pair.b2_tableCapacity) {
_local16 = _local6.m_pairManager.m_hashTable[_local2];
while (_local16 != b2Pair.b2_nullPair) {
_local17 = _local6.m_pairManager.m_pairs[_local16];
_local18 = _local6.m_proxyPool[_local17.proxyId1];
_local19 = _local6.m_proxyPool[_local17.proxyId2];
_local12.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.lowerBounds[0]].value));
_local12.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.lowerBounds[1]].value));
_local12.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.upperBounds[0]].value));
_local12.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.upperBounds[1]].value));
_local13.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.lowerBounds[0]].value));
_local13.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.lowerBounds[1]].value));
_local13.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.upperBounds[0]].value));
_local13.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.upperBounds[1]].value));
_local8.x = (0.5 * (_local12.lowerBound.x + _local12.upperBound.x));
_local8.y = (0.5 * (_local12.lowerBound.y + _local12.upperBound.y));
_local9.x = (0.5 * (_local13.lowerBound.x + _local13.upperBound.x));
_local9.y = (0.5 * (_local13.lowerBound.y + _local13.upperBound.y));
m_debugDraw.DrawSegment(_local8, _local9, _local10);
_local16 = _local17.next;
};
_local2++;
};
};
if ((_local1 & b2DebugDraw.e_aabbBit)){
_local6 = m_broadPhase;
_local20 = _local6.m_worldAABB.lowerBound;
_local21 = _local6.m_worldAABB.upperBound;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.3, 0.9);
_local2 = 0;
while (_local2 < b2Settings.b2_maxProxies) {
_local22 = _local6.m_proxyPool[_local2];
if (_local22.IsValid() == false){
} else {
_local12.lowerBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.lowerBounds[0]].value));
_local12.lowerBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.lowerBounds[1]].value));
_local12.upperBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.upperBounds[0]].value));
_local12.upperBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.upperBounds[1]].value));
_local14[0].Set(_local12.lowerBound.x, _local12.lowerBound.y);
_local14[1].Set(_local12.upperBound.x, _local12.lowerBound.y);
_local14[2].Set(_local12.upperBound.x, _local12.upperBound.y);
_local14[3].Set(_local12.lowerBound.x, _local12.upperBound.y);
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local2++;
};
_local14[0].Set(_local20.x, _local20.y);
_local14[1].Set(_local21.x, _local20.y);
_local14[2].Set(_local21.x, _local21.y);
_local14[3].Set(_local20.x, _local21.y);
m_debugDraw.DrawPolygon(_local14, 4, new b2Color(0.3, 0.9, 0.9));
};
if ((_local1 & b2DebugDraw.e_obbBit)){
_local10.Set(0.5, 0.3, 0.5);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local4.m_type != b2Shape.e_polygonShape){
} else {
_local23 = (_local4 as b2PolygonShape);
_local24 = _local23.GetOBB();
_local25 = _local24.extents;
_local14[0].Set(-(_local25.x), -(_local25.y));
_local14[1].Set(_local25.x, -(_local25.y));
_local14[2].Set(_local25.x, _local25.y);
_local14[3].Set(-(_local25.x), _local25.y);
_local2 = 0;
while (_local2 < 4) {
_local26 = _local24.R;
_local27 = _local14[_local2];
_local28 = (_local24.center.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local24.center.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local26 = _local11.R;
_local28 = (_local11.position.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local11.position.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local2++;
};
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_centerOfMassBit)){
_local3 = m_bodyList;
while (_local3) {
_local11 = s_xf;
_local11.R = _local3.m_xf.R;
_local11.position = _local3.GetWorldCenter();
m_debugDraw.DrawXForm(_local11);
_local3 = _local3.m_next;
};
};
}
public function DestroyBody(_arg1:b2Body):void{
var _local4:b2JointEdge;
var _local5:b2Shape;
if (m_lock == true){
return;
};
var _local2:b2JointEdge = _arg1.m_jointList;
while (_local2) {
_local4 = _local2;
_local2 = _local2.next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeJoint(_local4.joint);
};
DestroyJoint(_local4.joint);
};
var _local3:b2Shape = _arg1.m_shapeList;
while (_local3) {
_local5 = _local3;
_local3 = _local3.m_next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeShape(_local5);
};
_local5.DestroyProxy(m_broadPhase);
b2Shape.Destroy(_local5, m_blockAllocator);
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_bodyList){
m_bodyList = _arg1.m_next;
};
m_bodyCount--;
}
public function SetContactFilter(_arg1:b2ContactFilter):void{
m_contactFilter = _arg1;
}
public function GetGroundBody():b2Body{
return (m_groundBody);
}
public function DrawShape(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{
var _local6:b2CircleShape;
var _local7:b2Vec2;
var _local8:Number;
var _local9:b2Vec2;
var _local10:int;
var _local11:b2PolygonShape;
var _local12:int;
var _local13:Array;
var _local14:Array;
var _local15:Array;
var _local5:b2Color = s_coreColor;
switch (_arg1.m_type){
case b2Shape.e_circleShape:
_local6 = (_arg1 as b2CircleShape);
_local7 = b2Math.b2MulX(_arg2, _local6.m_localPosition);
_local8 = _local6.m_radius;
_local9 = _arg2.R.col1;
m_debugDraw.DrawSolidCircle(_local7, _local8, _local9, _arg3);
if (_arg4){
m_debugDraw.DrawCircle(_local7, (_local8 - b2Settings.b2_toiSlop), _local5);
};
break;
case b2Shape.e_polygonShape:
_local11 = (_arg1 as b2PolygonShape);
_local12 = _local11.GetVertexCount();
_local13 = _local11.GetVertices();
_local14 = new Array(b2Settings.b2_maxPolygonVertices);
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local13[_local10]);
_local10++;
};
m_debugDraw.DrawSolidPolygon(_local14, _local12, _arg3);
if (_arg4){
_local15 = _local11.GetCoreVertices();
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]);
_local10++;
};
m_debugDraw.DrawPolygon(_local14, _local12, _local5);
};
break;
};
}
public function GetContactCount():int{
return (m_contactCount);
}
public function Solve(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local9:int;
var _local10:int;
var _local11:b2Body;
var _local12:b2ContactEdge;
var _local13:b2JointEdge;
var _local14:Boolean;
m_positionIterationCount = 0;
var _local3:b2Island = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator, m_contactListener);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2 = _local2.m_next;
};
var _local4:b2Contact = m_contactList;
while (_local4) {
_local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag));
_local4 = _local4.m_next;
};
var _local5:b2Joint = m_jointList;
while (_local5) {
_local5.m_islandFlag = false;
_local5 = _local5.m_next;
};
var _local6:int = m_bodyCount;
var _local7:Array = new Array(_local6);
var _local8:b2Body = m_bodyList;
while (_local8) {
if ((_local8.m_flags & ((b2Body.e_islandFlag | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){
} else {
if (_local8.IsStatic()){
} else {
_local3.Clear();
_local9 = 0;
var _temp1 = _local9;
_local9 = (_local9 + 1);
var _local15 = _temp1;
_local7[_local15] = _local8;
_local8.m_flags = (_local8.m_flags | b2Body.e_islandFlag);
while (_local9 > 0) {
--_local9;
_local2 = _local7[_local9];
_local3.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local12 = _local2.m_contactList;
while (_local12) {
if ((_local12.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag))){
} else {
if (_local12.contact.m_manifoldCount == 0){
} else {
_local3.AddContact(_local12.contact);
_local12.contact.m_flags = (_local12.contact.m_flags | b2Contact.e_islandFlag);
_local11 = _local12.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp2 = _local9;
_local9 = (_local9 + 1);
var _local16 = _temp2;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
};
_local12 = _local12.next;
};
_local13 = _local2.m_jointList;
while (_local13) {
if (_local13.joint.m_islandFlag == true){
} else {
_local3.AddJoint(_local13.joint);
_local13.joint.m_islandFlag = true;
_local11 = _local13.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp3 = _local9;
_local9 = (_local9 + 1);
_local16 = _temp3;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
_local13 = _local13.next;
};
};
};
_local3.Solve(_arg1, m_gravity, m_positionCorrection, m_allowSleep);
if (_local3.m_positionIterationCount > m_positionIterationCount){
m_positionIterationCount = _local3.m_positionIterationCount;
};
_local10 = 0;
while (_local10 < _local3.m_bodyCount) {
_local2 = _local3.m_bodies[_local10];
if (_local2.IsStatic()){
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
};
_local10++;
};
};
};
_local8 = _local8.m_next;
};
_local2 = m_bodyList;
while (_local2) {
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local14 = _local2.SynchronizeShapes();
if ((((_local14 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
};
};
_local2 = _local2.m_next;
};
m_broadPhase.Commit();
}
public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{
var _local4:Array = new Array(_arg3);
var _local5:int = m_broadPhase.QueryAABB(_arg1, _local4, _arg3);
var _local6:int;
while (_local6 < _local5) {
_arg2[_local6] = _local4[_local6];
_local6++;
};
return (_local5);
}
public function SetGravity(_arg1:b2Vec2):void{
m_gravity = _arg1;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactEdge;
var _local11:b2Contact;
var _local12:b2Contact;
var _local13:Number;
var _local14:b2Body;
var _local15:int;
var _local16:b2TimeStep;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:b2Body;
var _local21:Boolean;
var _local8:b2Island = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener);
var _local9:int = m_bodyCount;
var _local10:Array = new Array(_local9);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2.m_sweep.t0 = 0;
_local2 = _local2.m_next;
};
_local11 = m_contactList;
while (_local11) {
_local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local11 = _local11.m_next;
};
while (true) {
_local12 = null;
_local13 = 1;
_local11 = m_contactList;
for (;_local11;(_local11 = _local11.m_next)) {
if ((_local11.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){
} else {
_local18 = 1;
if ((_local11.m_flags & b2Contact.e_toiFlag)){
_local18 = _local11.m_toi;
} else {
_local3 = _local11.m_shape1;
_local4 = _local11.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((((_local5.IsStatic()) || (_local5.IsSleeping()))) && (((_local6.IsStatic()) || (_local6.IsSleeping()))))){
continue;
};
_local19 = _local5.m_sweep.t0;
if (_local5.m_sweep.t0 < _local6.m_sweep.t0){
_local19 = _local6.m_sweep.t0;
_local5.m_sweep.Advance(_local19);
} else {
if (_local6.m_sweep.t0 < _local5.m_sweep.t0){
_local19 = _local5.m_sweep.t0;
_local6.m_sweep.Advance(_local19);
};
};
_local18 = b2TimeOfImpact.TimeOfImpact(_local11.m_shape1, _local5.m_sweep, _local11.m_shape2, _local6.m_sweep);
if ((((_local18 > 0)) && ((_local18 < 1)))){
_local18 = (((1 - _local18) * _local19) + _local18);
if (_local18 > 1){
_local18 = 1;
};
};
_local11.m_toi = _local18;
_local11.m_flags = (_local11.m_flags | b2Contact.e_toiFlag);
};
if ((((Number.MIN_VALUE < _local18)) && ((_local18 < _local13)))){
_local12 = _local11;
_local13 = _local18;
};
};
};
if ((((_local12 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local13)))){
break;
};
_local3 = _local12.m_shape1;
_local4 = _local12.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local5.Advance(_local13);
_local6.Advance(_local13);
_local12.Update(m_contactListener);
_local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag));
if (_local12.m_manifoldCount == 0){
} else {
_local14 = _local5;
if (_local14.IsStatic()){
_local14 = _local6;
};
_local8.Clear();
_local15 = 0;
var _temp1 = _local15;
_local15 = (_local15 + 1);
var _local22 = _temp1;
_local10[_local22] = _local14;
_local14.m_flags = (_local14.m_flags | b2Body.e_islandFlag);
while (_local15 > 0) {
--_local15;
_local2 = _local10[_local15];
_local8.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local7 = _local2.m_contactList;
while (_local7) {
if (_local8.m_contactCount == _local8.m_contactCapacity){
} else {
if ((_local7.contact.m_flags & ((b2Contact.e_islandFlag | b2Contact.e_slowFlag) | b2Contact.e_nonSolidFlag))){
} else {
if (_local7.contact.m_manifoldCount == 0){
} else {
_local8.AddContact(_local7.contact);
_local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag);
_local20 = _local7.other;
if ((_local20.m_flags & b2Body.e_islandFlag)){
} else {
if (_local20.IsStatic() == false){
_local20.Advance(_local13);
_local20.WakeUp();
};
var _temp2 = _local15;
_local15 = (_local15 + 1);
var _local23 = _temp2;
_local10[_local23] = _local20;
_local20.m_flags = (_local20.m_flags | b2Body.e_islandFlag);
};
};
};
};
_local7 = _local7.next;
};
};
};
_local16 = new b2TimeStep();
_local16.dt = ((1 - _local13) * _arg1.dt);
_local16.inv_dt = (1 / _local16.dt);
_local16.maxIterations = _arg1.maxIterations;
_local8.SolveTOI(_local16);
_local17 = 0;
while (_local17 < _local8.m_bodyCount) {
_local2 = _local8.m_bodies[_local17];
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local21 = _local2.SynchronizeShapes();
if ((((_local21 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
_local7 = _local2.m_contactList;
while (_local7) {
_local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag));
_local7 = _local7.next;
};
};
};
_local17++;
};
_local17 = 0;
while (_local17 < _local8.m_contactCount) {
_local11 = _local8.m_contacts[_local17];
_local8.m_contacts[_local17].m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local17++;
};
m_broadPhase.Commit();
};
};
}
public function GetJointList():b2Joint{
return (m_jointList);
}
public function GetBodyList():b2Body{
return (m_bodyList);
}
public function GetPairCount():int{
return (m_broadPhase.m_pairManager.m_pairCount);
}
public function Validate():void{
m_broadPhase.Validate();
}
public function SetWarmStarting(_arg1:Boolean):void{
m_warmStarting = _arg1;
}
public function SetPositionCorrection(_arg1:Boolean):void{
m_positionCorrection = _arg1;
}
public function CreateJoint(_arg1:b2JointDef):b2Joint{
var _local3:b2Body;
var _local4:b2Shape;
var _local2:b2Joint = b2Joint.Create(_arg1, m_blockAllocator);
_local2.m_prev = null;
_local2.m_next = m_jointList;
if (m_jointList){
m_jointList.m_prev = _local2;
};
m_jointList = _local2;
m_jointCount++;
_local2.m_node1.joint = _local2;
_local2.m_node1.other = _local2.m_body2;
_local2.m_node1.prev = null;
_local2.m_node1.next = _local2.m_body1.m_jointList;
if (_local2.m_body1.m_jointList){
_local2.m_body1.m_jointList.prev = _local2.m_node1;
};
_local2.m_body1.m_jointList = _local2.m_node1;
_local2.m_node2.joint = _local2;
_local2.m_node2.other = _local2.m_body1;
_local2.m_node2.prev = null;
_local2.m_node2.next = _local2.m_body2.m_jointList;
if (_local2.m_body2.m_jointList){
_local2.m_body2.m_jointList.prev = _local2.m_node2;
};
_local2.m_body2.m_jointList = _local2.m_node2;
if (_arg1.collideConnected == false){
_local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2;
_local4 = _local3.m_shapeList;
while (_local4) {
_local4.RefilterProxy(m_broadPhase, _local3.m_xf);
_local4 = _local4.m_next;
};
};
return (_local2);
}
public function DestroyJoint(_arg1:b2Joint):void{
var _local5:b2Body;
var _local6:b2Shape;
var _local2:Boolean = _arg1.m_collideConnected;
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_jointList){
m_jointList = _arg1.m_next;
};
var _local3:b2Body = _arg1.m_body1;
var _local4:b2Body = _arg1.m_body2;
_local3.WakeUp();
_local4.WakeUp();
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local3.m_jointList){
_local3.m_jointList = _arg1.m_node1.next;
};
_arg1.m_node1.prev = null;
_arg1.m_node1.next = null;
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local4.m_jointList){
_local4.m_jointList = _arg1.m_node2.next;
};
_arg1.m_node2.prev = null;
_arg1.m_node2.next = null;
b2Joint.Destroy(_arg1, m_blockAllocator);
m_jointCount--;
if (_local2 == false){
_local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4;
_local6 = _local5.m_shapeList;
while (_local6) {
_local6.RefilterProxy(m_broadPhase, _local5.m_xf);
_local6 = _local6.m_next;
};
};
}
public function SetContactListener(_arg1:b2ContactListener):void{
m_contactListener = _arg1;
}
public function CreateBody(_arg1:b2BodyDef):b2Body{
if (m_lock == true){
return (null);
};
var _local2:b2Body = new b2Body(_arg1, this);
_local2.m_prev = null;
_local2.m_next = m_bodyList;
if (m_bodyList){
m_bodyList.m_prev = _local2;
};
m_bodyList = _local2;
m_bodyCount++;
return (_local2);
}
public function SetBoundaryListener(_arg1:b2BoundaryListener):void{
m_boundaryListener = _arg1;
}
public function SetDestructionListener(_arg1:b2DestructionListener):void{
m_destructionListener = _arg1;
}
public function Step(_arg1:Number, _arg2:int):void{
m_lock = true;
var _local3:b2TimeStep = new b2TimeStep();
_local3.dt = _arg1;
_local3.maxIterations = _arg2;
if (_arg1 > 0){
_local3.inv_dt = (1 / _arg1);
} else {
_local3.inv_dt = 0;
};
_local3.dtRatio = (m_inv_dt0 * _arg1);
_local3.positionCorrection = m_positionCorrection;
_local3.warmStarting = m_warmStarting;
m_contactManager.Collide();
if (_local3.dt > 0){
Solve(_local3);
};
if (((m_continuousPhysics) && ((_local3.dt > 0)))){
SolveTOI(_local3);
};
DrawDebugData();
m_inv_dt0 = _local3.inv_dt;
m_lock = false;
}
public function GetBodyCount():int{
return (m_bodyCount);
}
public function GetJointCount():int{
return (m_jointCount);
}
}
}//package Box2D.Dynamics
Section 75
//bblogo_4 (bubblebox_submit_score_fla.bblogo_4)
package bubblebox_submit_score_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.media.*;
import flash.filters.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
public dynamic class bblogo_4 extends MovieClip {
public function bblogo_4(){
addFrameScript(0, frame1);
}
function frame1(){
this.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.bubblebox.com/"), "_blank");
});
}
}
}//package bubblebox_submit_score_fla
Section 76
//bubblebox_saving_5 (bubblebox_submit_score_fla.bubblebox_saving_5)
package bubblebox_submit_score_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.media.*;
import flash.filters.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
public dynamic class bubblebox_saving_5 extends MovieClip {
public function bubblebox_saving_5(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package bubblebox_submit_score_fla
Section 77
//bubblebox_send_btn_2 (bubblebox_submit_score_fla.bubblebox_send_btn_2)
package bubblebox_submit_score_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.media.*;
import flash.filters.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
public dynamic class bubblebox_send_btn_2 extends MovieClip {
public function bubblebox_send_btn_2(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
this.mouseChildren = false;
this.useHandCursor = true;
this.buttonMode = true;
this.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:MouseEvent){
_arg1.currentTarget.gotoAndStop(2);
});
this.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:MouseEvent){
_arg1.currentTarget.gotoAndStop(1);
});
}
}
}//package bubblebox_submit_score_fla
Section 78
//bubblebox_try_again_10 (bubblebox_submit_score_fla.bubblebox_try_again_10)
package bubblebox_submit_score_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.media.*;
import flash.filters.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
public dynamic class bubblebox_try_again_10 extends MovieClip {
public function bubblebox_try_again_10(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
this.mouseChildren = false;
this.useHandCursor = true;
this.buttonMode = true;
this.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:MouseEvent){
_arg1.currentTarget.gotoAndStop(2);
});
this.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:MouseEvent){
_arg1.currentTarget.gotoAndStop(1);
});
}
}
}//package bubblebox_submit_score_fla
Section 79
//bubblebox_view_scores_8 (bubblebox_submit_score_fla.bubblebox_view_scores_8)
package bubblebox_submit_score_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.media.*;
import flash.filters.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
public dynamic class bubblebox_view_scores_8 extends MovieClip {
public function bubblebox_view_scores_8(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
this.mouseChildren = false;
this.useHandCursor = true;
this.buttonMode = true;
this.addEventListener(MouseEvent.MOUSE_OVER, function (_arg1:MouseEvent){
_arg1.currentTarget.gotoAndStop(2);
});
this.addEventListener(MouseEvent.MOUSE_OUT, function (_arg1:MouseEvent){
_arg1.currentTarget.gotoAndStop(1);
});
}
}
}//package bubblebox_submit_score_fla
Section 80
//b2BuoyancyController (com.boristhebrave.Box2D.Controllers.b2BuoyancyController)
package com.boristhebrave.Box2D.Controllers {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2BuoyancyController extends b2MultiController {
public var useDensity:Boolean;// = false
public var useWorldGravity:Boolean;// = true
public var normal:b2Vec2;
public var density:Number;// = 0
public var offset:Number;// = 0
public var gravity:b2Vec2;// = null
public var angularDrag:Number;// = 1
public var linearDrag:Number;// = 2
public var velocity:b2Vec2;
public function b2BuoyancyController(){
normal = new b2Vec2(0, -1);
velocity = new b2Vec2(0, 0);
super();
}
override public function Draw(_arg1:b2DebugDraw):void{
var _local2:Number = 1000;
var _local3:b2Vec2 = new b2Vec2();
var _local4:b2Vec2 = new b2Vec2();
_local3.x = ((normal.x * offset) + (normal.y * _local2));
_local3.y = ((normal.y * offset) - (normal.x * _local2));
_local4.x = ((normal.x * offset) - (normal.y * _local2));
_local4.y = ((normal.y * offset) + (normal.x * _local2));
var _local5:b2Color = new b2Color(0, 0, 1);
_arg1.DrawSegment(_local3, _local4, _local5);
}
override public function Step(_arg1:Number):void{
var _local3:b2Body;
var _local4:b2Vec2;
var _local5:b2Vec2;
var _local6:Number;
var _local7:Number;
var _local8:b2Shape;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
if (m_bodies.length == 0){
return;
};
if (useWorldGravity){
gravity = b2Body(m_bodies[0]).GetWorld().m_gravity.Copy();
};
var _local2:int;
while (_local2 < m_bodies.length) {
_local3 = m_bodies[_local2];
if (_local3.IsSleeping()){
} else {
_local4 = new b2Vec2();
_local5 = new b2Vec2();
_local6 = 0;
_local7 = 0;
_local8 = _local3.GetShapeList();
while (_local8) {
_local11 = new b2Vec2();
_local12 = _local8.ComputeSubmergedArea(normal, offset, _local3.GetXForm(), _local11);
_local6 = (_local6 + _local12);
_local4.x = (_local4.x + (_local12 * _local11.x));
_local4.y = (_local4.y + (_local12 * _local11.y));
if (useDensity){
_local13 = _local8.m_density;
} else {
_local13 = 1;
};
_local7 = (_local7 + (_local12 * _local13));
_local5.x = (_local5.x + ((_local12 * _local11.x) * _local13));
_local5.y = (_local5.y + ((_local12 * _local11.y) * _local13));
_local8 = _local8.GetNext();
};
_local4.x = (_local4.x / _local6);
_local4.y = (_local4.y / _local6);
_local5.x = (_local5.x / _local7);
_local5.y = (_local5.y / _local7);
if (_local6 < Number.MIN_VALUE){
} else {
_local9 = gravity.Negative();
_local9.Multiply((density * _local6));
_local3.ApplyForce(_local9, _local5);
_local10 = _local3.GetLinearVelocityFromWorldPoint(_local4);
_local10.Subtract(velocity);
_local10.Multiply((-(linearDrag) * _local6));
_local3.ApplyForce(_local10, _local4);
_local3.ApplyTorque(((((-(_local3.GetInertia()) / _local3.GetMass()) * _local6) * _local3.GetAngularVelocity()) * angularDrag));
};
};
_local2++;
};
}
public static function FromBodies(_arg1:Array, _arg2:b2Vec2=null, _arg3:Number=0, _arg4:Number=0):b2BuoyancyController{
var _local5:b2BuoyancyController = new (b2BuoyancyController);
var _local6:int;
while (_local6 < _arg1.length) {
_local5.AddBody(_arg1[_local6]);
_local6++;
};
if (_arg2 != null){
_local5.normal.SetV(_arg2);
_local5.offset = _arg3;
};
if (_arg4 > 0){
_local5.density = _arg4;
};
return (_local5);
}
}
}//package com.boristhebrave.Box2D.Controllers
Section 81
//b2Controller (com.boristhebrave.Box2D.Controllers.b2Controller)
package com.boristhebrave.Box2D.Controllers {
import Box2D.Dynamics.*;
public class b2Controller {
public var m_prev:b2Controller;
public var m_next:b2Controller;
public function GetPrev():b2Controller{
return (m_prev);
}
public function Step(_arg1:Number):void{
}
public function Draw(_arg1:b2DebugDraw):void{
}
public function GetNext():b2Controller{
return (m_next);
}
}
}//package com.boristhebrave.Box2D.Controllers
Section 82
//b2MultiController (com.boristhebrave.Box2D.Controllers.b2MultiController)
package com.boristhebrave.Box2D.Controllers {
import Box2D.Dynamics.*;
public class b2MultiController extends b2Controller {
public var m_bodies:Array;
public function b2MultiController(){
m_bodies = [];
super();
}
public function AddBodies(_arg1:Array):void{
var _local2:int;
while (_local2 < _arg1.length) {
AddBody(_arg1[_local2]);
_local2++;
};
}
public function AddBody(_arg1:b2Body):void{
m_bodies.push(_arg1);
}
public function WakeBodies():void{
var _local1:int;
while (_local1 < m_bodies.length) {
m_bodies[_local1].WakeUp();
_local1++;
};
}
public function RemoveBody(_arg1:b2Body):void{
var body = _arg1;
m_bodies = m_bodies.filter(function (_arg1:Object, _arg2:int, _arg3:Array):Boolean{
return (!((_arg1 == body)));
});
}
public function GetBodies():Array{
return (m_bodies);
}
public static function FromBodies(_arg1:Array):b2MultiController{
var _local2:b2MultiController = new (b2MultiController);
var _local3:int;
while (_local3 < _arg1.length) {
_local2.AddBody(_arg1[_local3]);
_local3++;
};
return (_local2);
}
}
}//package com.boristhebrave.Box2D.Controllers
Section 83
//CampaignInfo (com.google.analytics.campaign.CampaignInfo)
package com.google.analytics.campaign {
import com.google.analytics.utils.*;
public class CampaignInfo {
private var _new:Boolean;
private var _empty:Boolean;
public function CampaignInfo(_arg1:Boolean=true, _arg2:Boolean=false){
_empty = _arg1;
_new = _arg2;
}
public function isEmpty():Boolean{
return (_empty);
}
public function toURLString():String{
var _local1:Variables;
_local1 = toVariables();
return (_local1.toString());
}
public function toVariables():Variables{
var _local1:Variables;
_local1 = new Variables();
_local1.URIencode = true;
if (((!(isEmpty())) && (isNew()))){
_local1.utmcn = utmcn;
};
if (((!(isEmpty())) && (!(isNew())))){
_local1.utmcr = utmcr;
};
return (_local1);
}
public function isNew():Boolean{
return (_new);
}
public function get utmcn():String{
return ("1");
}
public function get utmcr():String{
return ("1");
}
}
}//package com.google.analytics.campaign
Section 84
//CampaignKey (com.google.analytics.campaign.CampaignKey)
package com.google.analytics.campaign {
public class CampaignKey {
public var UCMD:String;// = "utm_medium"
public var UCID:String;// = "utm_id"
public var UCTR:String;// = "utm_term"
public var UCSR:String;// = "utm_source"
public var UCNO:String;// = "utm_nooverride"
public var UCCN:String;// = "utm_campaign"
public var UGCLID:String;// = "gclid"
public var UCCT:String;// = "utm_content"
}
}//package com.google.analytics.campaign
Section 85
//CampaignManager (com.google.analytics.campaign.CampaignManager)
package com.google.analytics.campaign {
import com.google.analytics.core.*;
import com.google.analytics.v4.*;
import com.google.analytics.debug.*;
import com.google.analytics.utils.*;
public class CampaignManager {
private var _config:Configuration;
private var _domainHash:Number;
private var _debug:DebugConfiguration;
private var _timeStamp:Number;
private var _referrer:String;
private var _buffer:Buffer;
public static const trackingDelimiter:String = "|";
public function CampaignManager(_arg1:Configuration, _arg2:DebugConfiguration, _arg3:Buffer, _arg4:Number, _arg5:String, _arg6:Number){
_config = _arg1;
_debug = _arg2;
_buffer = _arg3;
_domainHash = _arg4;
_referrer = _arg5;
_timeStamp = _arg6;
}
public function hasNoOverride(_arg1:String):Boolean{
var _local2:CampaignKey;
var _local3:Variables;
var _local4:String;
_local2 = _config.campaignKey;
if (_arg1 == ""){
return (false);
};
_local3 = new Variables(_arg1);
_local4 = "";
if (_local3.hasOwnProperty(_local2.UCNO)){
_local4 = _local3[_local2.UCNO];
switch (_local4){
case "1":
return (true);
case "":
case "0":
default:
return (false);
};
};
return (false);
}
public function getCampaignInformation(_arg1:String, _arg2:Boolean):CampaignInfo{
var _local3:CampaignInfo;
var _local4:CampaignTracker;
var _local5:Boolean;
var _local6:Boolean;
var _local7:int;
var _local8:CampaignTracker;
var _local9:int;
_local3 = new CampaignInfo();
_local5 = false;
_local6 = false;
_local7 = 0;
if (((_config.allowLinker) && (_buffer.isGenuine()))){
if (!_buffer.hasUTMZ()){
return (_local3);
};
};
_local4 = getTrackerFromSearchString(_arg1);
if (isValid(_local4)){
_local6 = hasNoOverride(_arg1);
if (((_local6) && (!(_buffer.hasUTMZ())))){
return (_local3);
};
};
if (!isValid(_local4)){
_local4 = getOrganicCampaign();
if (((!(_buffer.hasUTMZ())) && (isIgnoredKeyword(_local4)))){
return (_local3);
};
};
if (((!(isValid(_local4))) && (_arg2))){
_local4 = getReferrerCampaign();
if (((!(_buffer.hasUTMZ())) && (isIgnoredReferral(_local4)))){
return (_local3);
};
};
if (!isValid(_local4)){
if (((!(_buffer.hasUTMZ())) && (_arg2))){
_local4 = getDirectCampaign();
};
};
if (!isValid(_local4)){
return (_local3);
};
if (((_buffer.hasUTMZ()) && (!(_buffer.utmz.isEmpty())))){
_local8 = new CampaignTracker();
_local8.fromTrackerString(_buffer.utmz.campaignTracking);
_local5 = (_local8.toTrackerString() == _local4.toTrackerString());
_local7 = _buffer.utmz.responseCount;
};
if (((!(_local5)) || (_arg2))){
_local9 = _buffer.utma.sessionCount;
_local7++;
if (_local9 == 0){
_local9 = 1;
};
_buffer.utmz.domainHash = _domainHash;
_buffer.utmz.campaignCreation = _timeStamp;
_buffer.utmz.campaignSessions = _local9;
_buffer.utmz.responseCount = _local7;
_buffer.utmz.campaignTracking = _local4.toTrackerString();
_debug.info(_buffer.utmz.toString(), VisualDebugMode.geek);
_local3 = new CampaignInfo(false, true);
} else {
_local3 = new CampaignInfo(false, false);
};
return (_local3);
}
public function isValid(_arg1:CampaignTracker):Boolean{
if (((_arg1) && (_arg1.isValid()))){
return (true);
};
return (false);
}
public function getTrackerFromSearchString(_arg1:String):CampaignTracker{
var _local2:CampaignTracker;
var _local3:CampaignTracker;
var _local4:CampaignKey;
var _local5:Variables;
_local2 = getOrganicCampaign();
_local3 = new CampaignTracker();
_local4 = _config.campaignKey;
if (_arg1 == ""){
return (_local3);
};
_local5 = new Variables(_arg1);
if (_local5.hasOwnProperty(_local4.UCID)){
_local3.id = _local5[_local4.UCID];
};
if (_local5.hasOwnProperty(_local4.UCSR)){
_local3.source = _local5[_local4.UCSR];
};
if (_local5.hasOwnProperty(_local4.UGCLID)){
_local3.clickId = _local5[_local4.UGCLID];
};
if (_local5.hasOwnProperty(_local4.UCCN)){
_local3.name = _local5[_local4.UCCN];
} else {
_local3.name = "(not set)";
};
if (_local5.hasOwnProperty(_local4.UCMD)){
_local3.medium = _local5[_local4.UCMD];
} else {
_local3.medium = "(not set)";
};
if (_local5.hasOwnProperty(_local4.UCTR)){
_local3.term = _local5[_local4.UCTR];
} else {
if (((_local2) && (!((_local2.term == ""))))){
_local3.term = _local2.term;
};
};
if (_local5.hasOwnProperty(_local4.UCCT)){
_local3.content = _local5[_local4.UCCT];
};
return (_local3);
}
public function getOrganicCampaign():CampaignTracker{
var _local1:CampaignTracker;
var _local2:URL;
var _local3:String;
var _local4:Array;
var _local5:OrganicReferrer;
var _local6:String;
if (((isInvalidReferrer(_referrer)) || (isFromGoogleCSE(_referrer, _config)))){
return (_local1);
};
_local2 = new URL(_referrer);
_local3 = "";
if (_local2.hostName != ""){
if (_local2.hostName.indexOf(".") > -1){
_local4 = _local2.hostName.split(".");
switch (_local4.length){
case 2:
_local3 = _local4[0];
break;
case 3:
_local3 = _local4[1];
break;
};
};
};
if (_config.organic.match(_local3)){
_local5 = _config.organic.getReferrerByName(_local3);
_local6 = _config.organic.getKeywordValue(_local5, _local2.search);
_local1 = new CampaignTracker();
_local1.source = _local5.engine;
_local1.name = "(organic)";
_local1.medium = "organic";
_local1.term = _local6;
};
return (_local1);
}
public function isIgnoredReferral(_arg1:CampaignTracker):Boolean{
if (((_arg1) && ((_arg1.medium == "referral")))){
return (_config.organic.isIgnoredReferral(_arg1.source));
};
return (false);
}
public function getDirectCampaign():CampaignTracker{
var _local1:CampaignTracker;
_local1 = new CampaignTracker();
_local1.source = "(direct)";
_local1.name = "(direct)";
_local1.medium = "(none)";
return (_local1);
}
public function isIgnoredKeyword(_arg1:CampaignTracker):Boolean{
if (((_arg1) && ((_arg1.medium == "organic")))){
return (_config.organic.isIgnoredKeyword(_arg1.term));
};
return (false);
}
public function getReferrerCampaign():CampaignTracker{
var _local1:CampaignTracker;
var _local2:URL;
var _local3:String;
var _local4:String;
if (((isInvalidReferrer(_referrer)) || (isFromGoogleCSE(_referrer, _config)))){
return (_local1);
};
_local2 = new URL(_referrer);
_local3 = _local2.hostName;
_local4 = _local2.path;
if (_local3.indexOf("www.") == 0){
_local3 = _local3.substr(4);
};
_local1 = new CampaignTracker();
_local1.source = _local3;
_local1.name = "(referral)";
_local1.medium = "referral";
_local1.content = _local4;
return (_local1);
}
public static function isInvalidReferrer(_arg1:String):Boolean{
var _local2:URL;
if ((((((_arg1 == "")) || ((_arg1 == "-")))) || ((_arg1 == "0")))){
return (true);
};
if (_arg1.indexOf("://") > -1){
_local2 = new URL(_arg1);
if ((((_local2.protocol == Protocols.file)) || ((_local2.protocol == Protocols.none)))){
return (true);
};
};
return (false);
}
public static function isFromGoogleCSE(_arg1:String, _arg2:Configuration):Boolean{
var _local3:URL;
_local3 = new URL(_arg1);
if (_local3.hostName.indexOf(_arg2.google) > -1){
if (_local3.search.indexOf((_arg2.googleSearchParam + "=")) > -1){
if (_local3.path == ("/" + _arg2.googleCsePath)){
return (true);
};
};
};
return (false);
}
}
}//package com.google.analytics.campaign
Section 86
//CampaignTracker (com.google.analytics.campaign.CampaignTracker)
package com.google.analytics.campaign {
import com.google.analytics.utils.*;
public class CampaignTracker {
public var content:String;
public var source:String;
public var clickId:String;
public var name:String;
public var term:String;
public var medium:String;
public var id:String;
public function CampaignTracker(_arg1:String="", _arg2:String="", _arg3:String="", _arg4:String="", _arg5:String="", _arg6:String="", _arg7:String=""){
this.id = _arg1;
this.source = _arg2;
this.clickId = _arg3;
this.name = _arg4;
this.medium = _arg5;
this.term = _arg6;
this.content = _arg7;
}
public function isValid():Boolean{
if (((((!((id == ""))) || (!((source == ""))))) || (!((clickId == ""))))){
return (true);
};
return (false);
}
public function toTrackerString():String{
var _local1:Array = [];
_addIfNotEmpty(_local1, "utmcsr=", source);
_addIfNotEmpty(_local1, "utmccn=", name);
_addIfNotEmpty(_local1, "utmcmd=", medium);
_addIfNotEmpty(_local1, "utmctr=", term);
_addIfNotEmpty(_local1, "utmcct=", content);
_addIfNotEmpty(_local1, "utmcid=", id);
_addIfNotEmpty(_local1, "utmgclid=", clickId);
return (_local1.join(CampaignManager.trackingDelimiter));
}
private function _addIfNotEmpty(_arg1:Array, _arg2:String, _arg3:String):void{
if (_arg3 != ""){
_arg3 = _arg3.split("+").join("%20");
_arg3 = _arg3.split(" ").join("%20");
_arg1.push((_arg2 + _arg3));
};
}
public function fromTrackerString(_arg1:String):void{
var _local2:String = _arg1.split(CampaignManager.trackingDelimiter).join("&");
var _local3:Variables = new Variables(_local2);
if (_local3.hasOwnProperty("utmcid")){
this.id = _local3["utmcid"];
};
if (_local3.hasOwnProperty("utmcsr")){
this.source = _local3["utmcsr"];
};
if (_local3.hasOwnProperty("utmccn")){
this.name = _local3["utmccn"];
};
if (_local3.hasOwnProperty("utmcmd")){
this.medium = _local3["utmcmd"];
};
if (_local3.hasOwnProperty("utmctr")){
this.term = _local3["utmctr"];
};
if (_local3.hasOwnProperty("utmcct")){
this.content = _local3["utmcct"];
};
if (_local3.hasOwnProperty("utmgclid")){
this.clickId = _local3["utmgclid"];
};
}
}
}//package com.google.analytics.campaign
Section 87
//BrowserInfo (com.google.analytics.core.BrowserInfo)
package com.google.analytics.core {
import com.google.analytics.v4.*;
import com.google.analytics.utils.*;
public class BrowserInfo {
private var _config:Configuration;
private var _info:Environment;
public function BrowserInfo(_arg1:Configuration, _arg2:Environment){
_config = _arg1;
_info = _arg2;
}
public function get utmul():String{
return (_info.language.toLowerCase());
}
public function get utmje():String{
return ("0");
}
public function toURLString():String{
var _local1:Variables;
_local1 = toVariables();
return (_local1.toString());
}
public function get utmsr():String{
return (((_info.screenWidth + "x") + _info.screenHeight));
}
public function get utmcs():String{
return (_info.languageEncoding);
}
public function get utmfl():String{
var _local1:Version;
if (_config.detectFlash){
_local1 = _info.flashVersion;
return (((((_local1.major + ".") + _local1.minor) + " r") + _local1.build));
};
return ("-");
}
public function toVariables():Variables{
var _local1:Variables;
_local1 = new Variables();
_local1.URIencode = true;
_local1.utmcs = utmcs;
_local1.utmsr = utmsr;
_local1.utmsc = utmsc;
_local1.utmul = utmul;
_local1.utmje = utmje;
_local1.utmfl = utmfl;
return (_local1);
}
public function get utmsc():String{
return ((_info.screenColorDepth + "-bit"));
}
}
}//package com.google.analytics.core
Section 88
//Buffer (com.google.analytics.core.Buffer)
package com.google.analytics.core {
import flash.events.*;
import com.google.analytics.v4.*;
import com.google.analytics.debug.*;
import flash.net.*;
import com.google.analytics.data.*;
public dynamic class Buffer {
private var _SO:SharedObject;
private var _OBJ:Object;
private var _utma:UTMA;
private var _utmb:UTMB;
private var _utmc:UTMC;
private var _debug:DebugConfiguration;
private var _utmk:UTMK;
private var _config:Configuration;
private var _utmv:UTMV;
private var _utmz:UTMZ;
private var _volatile:Boolean;
public function Buffer(_arg1:Configuration, _arg2:DebugConfiguration, _arg3:Boolean=false, _arg4:Object=null){
var _local5:Boolean;
var _local6:String;
super();
_config = _arg1;
_debug = _arg2;
UTMB.defaultTimespan = _config.sessionTimeout;
UTMZ.defaultTimespan = _config.conversionTimeout;
if (!_arg3){
_SO = SharedObject.getLocal(_config.cookieName, _config.cookiePath);
_local5 = false;
if (_SO.data.utma){
if (!hasUTMA()){
_createUMTA();
};
_utma.fromSharedObject(_SO.data.utma);
if (_debug.verbose){
_debug.info(("found: " + _utma.toString(true)), VisualDebugMode.geek);
};
if (_utma.isExpired()){
if (_debug.verbose){
_debug.warning("UTMA has expired", VisualDebugMode.advanced);
};
_clearUTMA();
_local5 = true;
};
};
if (_SO.data.utmb){
if (!hasUTMB()){
_createUMTB();
};
_utmb.fromSharedObject(_SO.data.utmb);
if (_debug.verbose){
_debug.info(("found: " + _utmb.toString(true)), VisualDebugMode.geek);
};
if (_utmb.isExpired()){
if (_debug.verbose){
_debug.warning("UTMB has expired", VisualDebugMode.advanced);
};
_clearUTMB();
_local5 = true;
};
};
if (_SO.data.utmc){
delete _SO.data.utmc;
_local5 = true;
};
if (_SO.data.utmk){
if (!hasUTMK()){
_createUMTK();
};
_utmk.fromSharedObject(_SO.data.utmk);
if (_debug.verbose){
_debug.info(("found: " + _utmk.toString()), VisualDebugMode.geek);
};
};
if (_SO.data.utmv){
if (!hasUTMV()){
_createUMTV();
};
_utmv.fromSharedObject(_SO.data.utmv);
if (_debug.verbose){
_debug.info(("found: " + _utmv.toString(true)), VisualDebugMode.geek);
};
if (_utmv.isExpired()){
if (_debug.verbose){
_debug.warning("UTMV has expired", VisualDebugMode.advanced);
};
_clearUTMV();
_local5 = true;
};
};
if (_SO.data.utmz){
if (!hasUTMZ()){
_createUMTZ();
};
_utmz.fromSharedObject(_SO.data.utmz);
if (_debug.verbose){
_debug.info(("found: " + _utmz.toString(true)), VisualDebugMode.geek);
};
if (_utmz.isExpired()){
if (_debug.verbose){
_debug.warning("UTMZ has expired", VisualDebugMode.advanced);
};
_clearUTMZ();
_local5 = true;
};
};
if (_local5){
save();
};
} else {
_OBJ = new Object();
if (_arg4){
for (_local6 in _arg4) {
_OBJ[_local6] = _arg4[_local6];
};
};
};
_volatile = _arg3;
}
public function clearCookies():void{
utma.reset();
utmb.reset();
utmc.reset();
utmz.reset();
utmv.reset();
utmk.reset();
}
public function save():void{
var flushStatus:String;
if (!isVolatile()){
flushStatus = null;
try {
flushStatus = _SO.flush();
} catch(e:Error) {
_debug.warning("Error...Could not write SharedObject to disk");
};
switch (flushStatus){
case SharedObjectFlushStatus.PENDING:
_debug.info("Requesting permission to save object...");
_SO.addEventListener(NetStatusEvent.NET_STATUS, _onFlushStatus);
break;
case SharedObjectFlushStatus.FLUSHED:
_debug.info("Value flushed to disk.");
break;
};
};
}
public function get utmv():UTMV{
if (!hasUTMV()){
_createUMTV();
};
return (_utmv);
}
public function get utmz():UTMZ{
if (!hasUTMZ()){
_createUMTZ();
};
return (_utmz);
}
public function hasUTMA():Boolean{
if (_utma){
return (true);
};
return (false);
}
public function hasUTMB():Boolean{
if (_utmb){
return (true);
};
return (false);
}
public function hasUTMC():Boolean{
if (_utmc){
return (true);
};
return (false);
}
public function isGenuine():Boolean{
if (!hasUTMK()){
return (true);
};
return ((utmk.hash == generateCookiesHash()));
}
public function resetCurrentSession():void{
_clearUTMB();
_clearUTMC();
save();
}
public function hasUTMK():Boolean{
if (_utmk){
return (true);
};
return (false);
}
public function generateCookiesHash():Number{
var _local1 = "";
_local1 = (_local1 + utma.valueOf());
_local1 = (_local1 + utmb.valueOf());
_local1 = (_local1 + utmc.valueOf());
_local1 = (_local1 + utmz.valueOf());
_local1 = (_local1 + utmv.valueOf());
return (Utils.generateHash(_local1));
}
private function _createUMTB():void{
_utmb = new UTMB();
_utmb.proxy = this;
}
private function _createUMTC():void{
_utmc = new UTMC();
}
private function _createUMTA():void{
_utma = new UTMA();
_utma.proxy = this;
}
public function hasUTMV():Boolean{
if (_utmv){
return (true);
};
return (false);
}
private function _createUMTK():void{
_utmk = new UTMK();
_utmk.proxy = this;
}
public function hasUTMZ():Boolean{
if (_utmz){
return (true);
};
return (false);
}
private function _createUMTV():void{
_utmv = new UTMV();
_utmv.proxy = this;
}
private function _onFlushStatus(_arg1:NetStatusEvent):void{
_debug.info("User closed permission dialog...");
switch (_arg1.info.code){
case "SharedObject.Flush.Success":
_debug.info("User granted permission -- value saved.");
break;
case "SharedObject.Flush.Failed":
_debug.info("User denied permission -- value not saved.");
break;
};
_SO.removeEventListener(NetStatusEvent.NET_STATUS, _onFlushStatus);
}
private function _createUMTZ():void{
_utmz = new UTMZ();
_utmz.proxy = this;
}
public function updateUTMA(_arg1:Number):void{
if (_debug.verbose){
_debug.info((("updateUTMA( " + _arg1) + " )"), VisualDebugMode.advanced);
};
if (!utma.isEmpty()){
if (isNaN(utma.sessionCount)){
utma.sessionCount = 1;
} else {
utma.sessionCount = (utma.sessionCount + 1);
};
utma.lastTime = utma.currentTime;
utma.currentTime = _arg1;
};
}
private function _clearUTMA():void{
_utma = null;
if (!isVolatile()){
_SO.data.utma = null;
delete _SO.data.utma;
};
}
private function _clearUTMC():void{
_utmc = null;
}
private function _clearUTMB():void{
_utmb = null;
if (!isVolatile()){
_SO.data.utmb = null;
delete _SO.data.utmb;
};
}
public function update(_arg1:String, _arg2):void{
if (isVolatile()){
_OBJ[_arg1] = _arg2;
} else {
_SO.data[_arg1] = _arg2;
};
}
private function _clearUTMZ():void{
_utmz = null;
if (!isVolatile()){
_SO.data.utmz = null;
delete _SO.data.utmz;
};
}
private function _clearUTMV():void{
_utmv = null;
if (!isVolatile()){
_SO.data.utmv = null;
delete _SO.data.utmv;
};
}
public function isVolatile():Boolean{
return (_volatile);
}
public function get utma():UTMA{
if (!hasUTMA()){
_createUMTA();
};
return (_utma);
}
public function get utmb():UTMB{
if (!hasUTMB()){
_createUMTB();
};
return (_utmb);
}
public function get utmc():UTMC{
if (!hasUTMC()){
_createUMTC();
};
return (_utmc);
}
public function get utmk():UTMK{
if (!hasUTMK()){
_createUMTK();
};
return (_utmk);
}
}
}//package com.google.analytics.core
Section 89
//DocumentInfo (com.google.analytics.core.DocumentInfo)
package com.google.analytics.core {
import com.google.analytics.v4.*;
import com.google.analytics.external.*;
import com.google.analytics.utils.*;
public class DocumentInfo {
private var _config:Configuration;
private var _utmr:String;
private var _adSense:AdSenseGlobals;
private var _info:Environment;
private var _pageURL:String;
public function DocumentInfo(_arg1:Configuration, _arg2:Environment, _arg3:String, _arg4:String=null, _arg5:AdSenseGlobals=null){
_config = _arg1;
_info = _arg2;
_utmr = _arg3;
_pageURL = _arg4;
_adSense = _arg5;
}
public function get utmr():String{
if (!_utmr){
return ("-");
};
return (_utmr);
}
public function toURLString():String{
var _local1:Variables;
_local1 = toVariables();
return (_local1.toString());
}
private function _renderPageURL(_arg1:String=""):String{
var _local2:String;
var _local3:String;
_local2 = _info.locationPath;
_local3 = _info.locationSearch;
if (((!(_arg1)) || ((_arg1 == "")))){
_arg1 = (_local2 + unescape(_local3));
};
return (_arg1);
}
public function get utmp():String{
return (_renderPageURL(_pageURL));
}
private function _generateHitId():Number{
var _local1:Number;
if (((_adSense.hid) && (!((_adSense.hid == ""))))){
_local1 = Number(_adSense.hid);
} else {
_local1 = Math.round((Math.random() * 2147483647));
_adSense.hid = String(_local1);
};
return (_local1);
}
public function get utmhid():String{
return (String(_generateHitId()));
}
public function toVariables():Variables{
var _local1:Variables;
_local1 = new Variables();
_local1.URIencode = true;
if (((_config.detectTitle) && (!((utmdt == ""))))){
_local1.utmdt = utmdt;
};
_local1.utmhid = utmhid;
_local1.utmr = utmr;
_local1.utmp = utmp;
return (_local1);
}
public function get utmdt():String{
return (_info.documentTitle);
}
}
}//package com.google.analytics.core
Section 90
//Domain (com.google.analytics.core.Domain)
package com.google.analytics.core {
import com.google.analytics.debug.*;
public class Domain {
private var _mode:DomainNameMode;
private var _debug:DebugConfiguration;
private var _name:String;
public function Domain(_arg1:DomainNameMode=null, _arg2:String="", _arg3:DebugConfiguration=null){
_debug = _arg3;
if (_arg1 == null){
_arg1 = DomainNameMode.auto;
};
_mode = _arg1;
if (_arg1 == DomainNameMode.custom){
this.name = _arg2;
} else {
_name = _arg2;
};
}
public function get mode():DomainNameMode{
return (_mode);
}
public function set mode(_arg1:DomainNameMode):void{
_mode = _arg1;
if (_mode == DomainNameMode.none){
_name = "";
};
}
public function get name():String{
return (_name);
}
public function set name(_arg1:String):void{
if (((!((_arg1.charAt(0) == "."))) && (_debug))){
_debug.warning(("missing leading period \".\", cookie will only be accessible on " + _arg1), VisualDebugMode.geek);
};
_name = _arg1;
}
}
}//package com.google.analytics.core
Section 91
//DomainNameMode (com.google.analytics.core.DomainNameMode)
package com.google.analytics.core {
public class DomainNameMode {
private var _value:int;
private var _name:String;
public static const custom:DomainNameMode = new DomainNameMode(2, "custom");
;
public static const none:DomainNameMode = new DomainNameMode(0, "none");
;
public static const auto:DomainNameMode = new DomainNameMode(1, "auto");
;
public function DomainNameMode(_arg1:int=0, _arg2:String=""){
_value = _arg1;
_name = _arg2;
}
public function valueOf():int{
return (_value);
}
public function toString():String{
return (_name);
}
}
}//package com.google.analytics.core
Section 92
//EventInfo (com.google.analytics.core.EventInfo)
package com.google.analytics.core {
import com.google.analytics.utils.*;
import com.google.analytics.data.*;
public class EventInfo {
private var _isEventHit:Boolean;
private var _ext10:X10;
private var _x10:X10;
public function EventInfo(_arg1:Boolean, _arg2:X10, _arg3:X10=null){
_isEventHit = _arg1;
_x10 = _arg2;
_ext10 = _arg3;
}
public function toURLString():String{
var _local1:Variables;
_local1 = toVariables();
return (_local1.toString());
}
public function get utmt():String{
return ("event");
}
public function get utme():String{
return (_x10.renderMergedUrlString(_ext10));
}
public function toVariables():Variables{
var _local1:Variables;
_local1 = new Variables();
_local1.URIencode = true;
if (_isEventHit){
_local1.utmt = utmt;
};
_local1.utme = utme;
return (_local1);
}
}
}//package com.google.analytics.core
Section 93
//EventTracker (com.google.analytics.core.EventTracker)
package com.google.analytics.core {
import com.google.analytics.v4.*;
public class EventTracker {
private var _parent:GoogleAnalyticsAPI;
public var name:String;
public function EventTracker(_arg1:String, _arg2:GoogleAnalyticsAPI){
this.name = _arg1;
_parent = _arg2;
}
public function trackEvent(_arg1:String, _arg2:String=null, _arg3:Number=NaN):Boolean{
return (_parent.trackEvent(name, _arg1, _arg2, _arg3));
}
}
}//package com.google.analytics.core
Section 94
//ga_internal (com.google.analytics.core.ga_internal)
package com.google.analytics.core {
public namespace ga_internal;
}//package com.google.analytics.core
Section 95
//GIFRequest (com.google.analytics.core.GIFRequest)
package com.google.analytics.core {
import flash.events.*;
import flash.system.*;
import flash.display.*;
import com.google.analytics.v4.*;
import com.google.analytics.debug.*;
import flash.net.*;
import com.google.analytics.utils.*;
public class GIFRequest {
private var _info:Environment;
private var _count:int;
private var _utmac:String;
private var _alertcount:int;
private var _debug:DebugConfiguration;
private var _lastRequest:URLRequest;
private var _buffer:Buffer;
private var _config:Configuration;
private var _requests:Array;
public function GIFRequest(_arg1:Configuration, _arg2:DebugConfiguration, _arg3:Buffer, _arg4:Environment){
_config = _arg1;
_debug = _arg2;
_buffer = _arg3;
_info = _arg4;
_count = 0;
_alertcount = 0;
_requests = [];
}
public function get utmn():String{
return ((Utils.generate32bitRandom() as String));
}
public function onIOError(_arg1:IOErrorEvent):void{
var _local2:String = _lastRequest.url;
var _local3:String = String((_requests.length - 1));
var _local4 = (("Gif Request #" + _local3) + " failed");
if (_debug.GIFRequests){
if (!_debug.verbose){
if (_local2.indexOf("?") > -1){
_local2 = _local2.split("?")[0];
};
_local2 = _shortenURL(_local2);
};
if (int(_debug.mode) > int(VisualDebugMode.basic)){
_local4 = (_local4 + ((" \"" + _local2) + "\" does not exists or is unreachable"));
};
_debug.failure(_local4);
} else {
_debug.warning(_local4);
};
_removeListeners(_arg1.target);
}
public function send(_arg1:String, _arg2:Variables=null, _arg3:Boolean=false, _arg4:Boolean=false):void{
var _local5:String;
var _local6:URLRequest;
var _local7:URLRequest;
_utmac = _arg1;
if (!_arg2){
_arg2 = new Variables();
};
_arg2.URIencode = false;
_arg2.pre = ["utmwv", "utmn", "utmhn", "utmt", "utme", "utmcs", "utmsr", "utmsc", "utmul", "utmje", "utmfl", "utmdt", "utmhid", "utmr", "utmp"];
_arg2.post = ["utmcc"];
if (_debug.verbose){
_debug.info(((("tracking: " + _buffer.utmb.trackCount) + "/") + _config.trackingLimitPerSession), VisualDebugMode.geek);
};
if ((((_buffer.utmb.trackCount < _config.trackingLimitPerSession)) || (_arg3))){
if (_arg4){
updateToken();
};
if (((((_arg3) || (!(_arg4)))) || ((_buffer.utmb.token >= 1)))){
if (((!(_arg3)) && (_arg4))){
_buffer.utmb.token = (_buffer.utmb.token - 1);
};
_buffer.utmb.trackCount = (_buffer.utmb.trackCount + 1);
if (_debug.verbose){
_debug.info(_buffer.utmb.toString(), VisualDebugMode.geek);
};
_arg2.utmwv = utmwv;
_arg2.utmn = Utils.generate32bitRandom();
if (_info.domainName != ""){
_arg2.utmhn = _info.domainName;
};
if (_config.sampleRate < 1){
_arg2.utmsp = (_config.sampleRate * 100);
};
if ((((_config.serverMode == ServerOperationMode.local)) || ((_config.serverMode == ServerOperationMode.both)))){
_local5 = _info.locationSWFPath;
if (_local5.lastIndexOf("/") > 0){
_local5 = _local5.substring(0, _local5.lastIndexOf("/"));
};
_local6 = new URLRequest();
if (_config.localGIFpath.indexOf("http") == 0){
_local6.url = _config.localGIFpath;
} else {
_local6.url = (_local5 + _config.localGIFpath);
};
_local6.url = (_local6.url + ("?" + _arg2.toString()));
if (((_debug.active) && (_debug.GIFRequests))){
_debugSend(_local6);
} else {
sendRequest(_local6);
};
};
if ((((_config.serverMode == ServerOperationMode.remote)) || ((_config.serverMode == ServerOperationMode.both)))){
_local7 = new URLRequest();
if (_info.protocol == Protocols.HTTPS){
_local7.url = _config.secureRemoteGIFpath;
} else {
if (_info.protocol == Protocols.HTTP){
_local7.url = _config.remoteGIFpath;
} else {
_local7.url = _config.remoteGIFpath;
};
};
_arg2.utmac = utmac;
_arg2.utmcc = encodeURIComponent(utmcc);
_local7.url = (_local7.url + ("?" + _arg2.toString()));
if (((_debug.active) && (_debug.GIFRequests))){
_debugSend(_local7);
} else {
sendRequest(_local7);
};
};
};
};
}
public function onSecurityError(_arg1:SecurityErrorEvent):void{
if (_debug.GIFRequests){
_debug.failure(_arg1.text);
};
}
public function get utmsp():String{
return (((_config.sampleRate * 100) as String));
}
public function get utmcc():String{
var _local1:Array = [];
if (_buffer.hasUTMA()){
_local1.push((_buffer.utma.toURLString() + ";"));
};
if (_buffer.hasUTMZ()){
_local1.push((_buffer.utmz.toURLString() + ";"));
};
if (_buffer.hasUTMV()){
_local1.push((_buffer.utmv.toURLString() + ";"));
};
return (_local1.join("+"));
}
public function get utmac():String{
return (_utmac);
}
public function get utmwv():String{
return (_config.version);
}
public function sendRequest(_arg1:URLRequest):void{
var request = _arg1;
var loader:Loader = new Loader();
loader.name = String(_count++);
var context:LoaderContext = new LoaderContext(false);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
_lastRequest = request;
_requests[loader.name] = new RequestObject(request);
try {
loader.load(request, context);
} catch(e:Error) {
_debug.failure("\"Loader.load()\" could not instanciate Gif Request");
};
}
private function _removeListeners(_arg1:Object):void{
_arg1.removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
_arg1.removeEventListener(Event.COMPLETE, onComplete);
}
public function updateToken():void{
var _local2:Number;
var _local1:Number = new Date().getTime();
_local2 = ((_local1 - _buffer.utmb.lastTime) * (_config.tokenRate / 1000));
if (_debug.verbose){
_debug.info(("tokenDelta: " + _local2), VisualDebugMode.geek);
};
if (_local2 >= 1){
_buffer.utmb.token = Math.min(Math.floor((_buffer.utmb.token + _local2)), _config.bucketCapacity);
_buffer.utmb.lastTime = _local1;
if (_debug.verbose){
_debug.info(_buffer.utmb.toString(), VisualDebugMode.geek);
};
};
}
public function get utmhn():String{
return (_info.domainName);
}
private function _shortenURL(_arg1:String):String{
var _local2:Array;
if (_arg1.length > 60){
_local2 = _arg1.split("/");
while (_arg1.length > 60) {
_local2.shift();
_arg1 = ("../" + _local2.join("/"));
};
};
return (_arg1);
}
private function _debugSend(_arg1:URLRequest):void{
var _local3:String;
var _local2 = "";
switch (_debug.mode){
case VisualDebugMode.geek:
_local2 = ((("Gif Request #" + _alertcount) + ":\n") + _arg1.url);
break;
case VisualDebugMode.advanced:
_local3 = _arg1.url;
if (_local3.indexOf("?") > -1){
_local3 = _local3.split("?")[0];
};
_local3 = _shortenURL(_local3);
_local2 = (((("Send Gif Request #" + _alertcount) + ":\n") + _local3) + " ?");
break;
case VisualDebugMode.basic:
default:
_local2 = (((("Send " + _config.serverMode.toString()) + " Gif Request #") + _alertcount) + " ?");
};
_debug.alertGifRequest(_local2, _arg1, this);
_alertcount++;
}
public function onComplete(_arg1:Event):void{
var _local2:String = _arg1.target.loader.name;
_requests[_local2].complete();
var _local3 = (("Gif Request #" + _local2) + " sent");
var _local4:String = _requests[_local2].request.url;
if (_debug.GIFRequests){
if (!_debug.verbose){
if (_local4.indexOf("?") > -1){
_local4 = _local4.split("?")[0];
};
_local4 = _shortenURL(_local4);
};
if (int(_debug.mode) > int(VisualDebugMode.basic)){
_local3 = (_local3 + ((" to \"" + _local4) + "\""));
};
_debug.success(_local3);
} else {
_debug.info(_local3);
};
_removeListeners(_arg1.target);
}
}
}//package com.google.analytics.core
Section 96
//IdleTimer (com.google.analytics.core.IdleTimer)
package com.google.analytics.core {
import flash.events.*;
import flash.display.*;
import com.google.analytics.v4.*;
import com.google.analytics.debug.*;
import flash.utils.*;
public class IdleTimer {
private var _loop:Timer;
private var _stage:Stage;
private var _lastMove:int;
private var _debug:DebugConfiguration;
private var _session:Timer;
private var _inactivity:Number;
private var _buffer:Buffer;
public function IdleTimer(_arg1:Configuration, _arg2:DebugConfiguration, _arg3:DisplayObject, _arg4:Buffer){
var _local5:Number;
var _local6:Number;
var _local7:Number;
super();
_local5 = _arg1.idleLoop;
_local6 = _arg1.idleTimeout;
_local7 = _arg1.sessionTimeout;
_loop = new Timer((_local5 * 1000));
_session = new Timer((_local7 * 1000), 1);
_debug = _arg2;
_stage = _arg3.stage;
_buffer = _arg4;
_lastMove = getTimer();
_inactivity = (_local6 * 1000);
_loop.addEventListener(TimerEvent.TIMER, checkForIdle);
_session.addEventListener(TimerEvent.TIMER_COMPLETE, endSession);
_stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
_debug.info(((((("delay: " + _local5) + "sec , inactivity: ") + _local6) + "sec, sessionTimeout: ") + _local7), VisualDebugMode.geek);
_loop.start();
}
private function onMouseMove(_arg1:MouseEvent):void{
_lastMove = getTimer();
if (_session.running){
_debug.info("session timer reset", VisualDebugMode.geek);
_session.reset();
};
}
public function endSession(_arg1:TimerEvent):void{
_session.removeEventListener(TimerEvent.TIMER_COMPLETE, endSession);
_debug.info("session timer end session", VisualDebugMode.geek);
_session.reset();
_buffer.resetCurrentSession();
_debug.info(_buffer.utmb.toString(), VisualDebugMode.geek);
_debug.info(_buffer.utmc.toString(), VisualDebugMode.geek);
_session.addEventListener(TimerEvent.TIMER_COMPLETE, endSession);
}
public function checkForIdle(_arg1:TimerEvent):void{
var _local2:int;
_local2 = getTimer();
if ((_local2 - _lastMove) >= _inactivity){
if (!_session.running){
_debug.info("session timer start", VisualDebugMode.geek);
_session.start();
};
};
}
}
}//package com.google.analytics.core
Section 97
//Organic (com.google.analytics.core.Organic)
package com.google.analytics.core {
import com.google.analytics.utils.*;
public class Organic {
private var _sourcesCache:Array;
private var _sourcesEngine:Array;
private var _ignoredKeywords:Array;
private var _ignoredReferralsCache:Object;
private var _ignoredReferrals:Array;
private var _ignoredKeywordsCache:Object;
private var _sources:Array;
public static var throwErrors:Boolean = false;
public function Organic(){
_sources = [];
_sourcesCache = [];
_sourcesEngine = [];
_ignoredReferrals = [];
_ignoredReferralsCache = {};
_ignoredKeywords = [];
_ignoredKeywordsCache = {};
}
public function getKeywordValue(_arg1:OrganicReferrer, _arg2:String):String{
var _local3:String;
_local3 = _arg1.keyword;
return (getKeywordValueFromPath(_local3, _arg2));
}
public function isIgnoredKeyword(_arg1:String):Boolean{
if (_ignoredKeywordsCache.hasOwnProperty(_arg1)){
return (true);
};
return (false);
}
public function isIgnoredReferral(_arg1:String):Boolean{
if (_ignoredReferralsCache.hasOwnProperty(_arg1)){
return (true);
};
return (false);
}
public function clear():void{
clearEngines();
clearIgnoredReferrals();
clearIgnoredKeywords();
}
public function get ignoredKeywordsCount():int{
return (_ignoredKeywords.length);
}
public function match(_arg1:String):Boolean{
if (_arg1 == ""){
return (false);
};
_arg1 = _arg1.toLowerCase();
if (_sourcesEngine[_arg1] != undefined){
return (true);
};
return (false);
}
public function get count():int{
return (_sources.length);
}
public function addSource(_arg1:String, _arg2:String):void{
var _local3:OrganicReferrer;
_local3 = new OrganicReferrer(_arg1, _arg2);
if (_sourcesCache[_local3.toString()] == undefined){
_sources.push(_local3);
_sourcesCache[_local3.toString()] = (_sources.length - 1);
if (_sourcesEngine[_local3.engine] == undefined){
_sourcesEngine[_local3.engine] = [(_sources.length - 1)];
} else {
_sourcesEngine[_local3.engine].push((_sources.length - 1));
};
} else {
if (throwErrors){
throw (new Error((_local3.toString() + " already exists, we don't add it.")));
};
};
}
public function clearIgnoredKeywords():void{
_ignoredKeywords = [];
_ignoredKeywordsCache = {};
}
public function clearEngines():void{
_sources = [];
_sourcesCache = [];
_sourcesEngine = [];
}
public function get ignoredReferralsCount():int{
return (_ignoredReferrals.length);
}
public function addIgnoredReferral(_arg1:String):void{
if (_ignoredReferralsCache[_arg1] == undefined){
_ignoredReferrals.push(_arg1);
_ignoredReferralsCache[_arg1] = (_ignoredReferrals.length - 1);
} else {
if (throwErrors){
throw (new Error((("\"" + _arg1) + "\" already exists, we don't add it.")));
};
};
}
public function clearIgnoredReferrals():void{
_ignoredReferrals = [];
_ignoredReferralsCache = {};
}
public function getReferrerByName(_arg1:String):OrganicReferrer{
var _local2:int;
if (match(_arg1)){
_local2 = _sourcesEngine[_arg1][0];
return (_sources[_local2]);
};
return (null);
}
public function addIgnoredKeyword(_arg1:String):void{
if (_ignoredKeywordsCache[_arg1] == undefined){
_ignoredKeywords.push(_arg1);
_ignoredKeywordsCache[_arg1] = (_ignoredKeywords.length - 1);
} else {
if (throwErrors){
throw (new Error((("\"" + _arg1) + "\" already exists, we don't add it.")));
};
};
}
public function get sources():Array{
return (_sources);
}
public static function getKeywordValueFromPath(_arg1:String, _arg2:String):String{
var _local3:String;
var _local4:Variables;
if (_arg2.indexOf((_arg1 + "=")) > -1){
if (_arg2.charAt(0) == "?"){
_arg2 = _arg2.substr(1);
};
_arg2 = _arg2.split("+").join("%20");
_local4 = new Variables(_arg2);
_local3 = _local4[_arg1];
};
return (_local3);
}
}
}//package com.google.analytics.core
Section 98
//OrganicReferrer (com.google.analytics.core.OrganicReferrer)
package com.google.analytics.core {
public class OrganicReferrer {
private var _engine:String;
private var _keyword:String;
public function OrganicReferrer(_arg1:String, _arg2:String){
this.engine = _arg1;
this.keyword = _arg2;
}
public function set engine(_arg1:String):void{
_engine = _arg1.toLowerCase();
}
public function get keyword():String{
return (_keyword);
}
public function toString():String{
return (((engine + "?") + keyword));
}
public function get engine():String{
return (_engine);
}
public function set keyword(_arg1:String):void{
_keyword = _arg1.toLowerCase();
}
}
}//package com.google.analytics.core
Section 99
//RequestObject (com.google.analytics.core.RequestObject)
package com.google.analytics.core {
import flash.net.*;
import flash.utils.*;
public class RequestObject {
public var start:int;
public var request:URLRequest;
public var end:int;
public function RequestObject(_arg1:URLRequest){
start = getTimer();
this.request = _arg1;
}
public function toString():String{
var _local1:Array;
_local1 = [];
_local1.push((("duration: " + duration) + "ms"));
_local1.push(("url: " + request.url));
return ((("{ " + _local1.join(", ")) + " }"));
}
public function get duration():int{
if (!hasCompleted()){
return (0);
};
return ((end - start));
}
public function hasCompleted():Boolean{
return ((end > 0));
}
public function complete():void{
end = getTimer();
}
}
}//package com.google.analytics.core
Section 100
//ServerOperationMode (com.google.analytics.core.ServerOperationMode)
package com.google.analytics.core {
public class ServerOperationMode {
private var _value:int;
private var _name:String;
public static const both:ServerOperationMode = new ServerOperationMode(2, "both");
;
public static const remote:ServerOperationMode = new ServerOperationMode(1, "remote");
;
public static const local:ServerOperationMode = new ServerOperationMode(0, "local");
;
public function ServerOperationMode(_arg1:int=0, _arg2:String=""){
_value = _arg1;
_name = _arg2;
}
public function valueOf():int{
return (_value);
}
public function toString():String{
return (_name);
}
}
}//package com.google.analytics.core
Section 101
//TrackerCache (com.google.analytics.core.TrackerCache)
package com.google.analytics.core {
import com.google.analytics.v4.*;
import flash.errors.*;
public class TrackerCache implements GoogleAnalyticsAPI {
public var tracker:GoogleAnalyticsAPI;
private var _ar:Array;
public static var CACHE_THROW_ERROR:Boolean;
public function TrackerCache(_arg1:GoogleAnalyticsAPI=null){
this.tracker = _arg1;
_ar = [];
}
public function size():uint{
return (_ar.length);
}
public function flush():void{
var _local1:Object;
var _local2:String;
var _local3:Array;
var _local4:int;
var _local5:int;
if (tracker == null){
return;
};
if (size() > 0){
_local4 = _ar.length;
while (_local5 < _local4) {
_local1 = _ar.shift();
_local2 = (_local1.name as String);
_local3 = (_local1.args as Array);
if (((!((_local2 == null))) && ((_local2 in tracker)))){
(tracker[_local2] as Function).apply(tracker, _local3);
};
_local5++;
};
};
}
public function enqueue(_arg1:String, ... _args):Boolean{
if (_arg1 == null){
return (false);
};
_ar.push({name:_arg1, args:_args});
return (true);
}
public function link(_arg1:String, _arg2:Boolean=false):void{
enqueue("link", _arg1, _arg2);
}
public function addOrganic(_arg1:String, _arg2:String):void{
enqueue("addOrganic", _arg1, _arg2);
}
public function setAllowLinker(_arg1:Boolean):void{
enqueue("setAllowLinker", _arg1);
}
public function trackEvent(_arg1:String, _arg2:String, _arg3:String=null, _arg4:Number=NaN):Boolean{
enqueue("trackEvent", _arg1, _arg2, _arg3, _arg4);
return (true);
}
public function getClientInfo():Boolean{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getClientInfo' method for the moment."));
};
return (false);
}
public function trackTrans():void{
enqueue("trackTrans");
}
public function trackPageview(_arg1:String=""):void{
enqueue("trackPageview", _arg1);
}
public function setClientInfo(_arg1:Boolean):void{
enqueue("setClientInfo", _arg1);
}
public function linkByPost(_arg1:Object, _arg2:Boolean=false):void{
enqueue("linkByPost", _arg1, _arg2);
}
public function setCookieTimeout(_arg1:int):void{
enqueue("setCookieTimeout", _arg1);
}
public function isEmpty():Boolean{
return ((_ar.length == 0));
}
public function getDetectTitle():Boolean{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getDetectTitle' method for the moment."));
};
return (false);
}
public function resetSession():void{
enqueue("resetSession");
}
public function setDetectFlash(_arg1:Boolean):void{
enqueue("setDetectFlash", _arg1);
}
public function clear():void{
_ar = [];
}
public function setCampNameKey(_arg1:String):void{
enqueue("setCampNameKey", _arg1);
}
public function addItem(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:Number, _arg6:int):void{
enqueue("addItem", _arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
}
public function createEventTracker(_arg1:String):EventTracker{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'createEventTracker' method for the moment."));
};
return (null);
}
public function setVar(_arg1:String):void{
enqueue("setVar", _arg1);
}
public function clearIgnoredOrganic():void{
enqueue("clearIgnoredOrganic");
}
public function setDomainName(_arg1:String):void{
enqueue("setDomainName", _arg1);
}
public function setCampSourceKey(_arg1:String):void{
enqueue("setCampSourceKey", _arg1);
}
public function addTrans(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:String, _arg8:String):Object{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'addTrans' method for the moment."));
};
return (null);
}
public function setCampContentKey(_arg1:String):void{
enqueue("setCampContentKey", _arg1);
}
public function setLocalServerMode():void{
enqueue("setLocalServerMode");
}
public function getLocalGifPath():String{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getLocalGifPath' method for the moment."));
};
return ("");
}
public function setAllowAnchor(_arg1:Boolean):void{
enqueue("setAllowAnchor", _arg1);
}
public function clearIgnoredRef():void{
enqueue("clearIgnoredRef");
}
public function setLocalGifPath(_arg1:String):void{
enqueue("setLocalGifPath", _arg1);
}
public function getVersion():String{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getVersion' method for the moment."));
};
return ("");
}
public function setCookiePath(_arg1:String):void{
enqueue("setCookiePath", _arg1);
}
public function setSampleRate(_arg1:Number):void{
enqueue("setSampleRate", _arg1);
}
public function setDetectTitle(_arg1:Boolean):void{
enqueue("setDetectTitle", _arg1);
}
public function setAllowHash(_arg1:Boolean):void{
enqueue("setAllowHash", _arg1);
}
public function addIgnoredOrganic(_arg1:String):void{
enqueue("addIgnoredOrganic", _arg1);
}
public function setCampNOKey(_arg1:String):void{
enqueue("setCampNOKey", _arg1);
}
public function getServiceMode():ServerOperationMode{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getServiceMode' method for the moment."));
};
return (null);
}
public function setLocalRemoteServerMode():void{
enqueue("setLocalRemoteServerMode");
}
public function cookiePathCopy(_arg1:String):void{
enqueue("cookiePathCopy", _arg1);
}
public function getDetectFlash():Boolean{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getDetectFlash' method for the moment."));
};
return (false);
}
public function setCampaignTrack(_arg1:Boolean):void{
enqueue("setCampaignTrack", _arg1);
}
public function clearOrganic():void{
enqueue("clearOrganic");
}
public function setCampTermKey(_arg1:String):void{
enqueue("setCampTermKey", _arg1);
}
public function addIgnoredRef(_arg1:String):void{
enqueue("addIgnoredRef", _arg1);
}
public function setCampMediumKey(_arg1:String):void{
enqueue("setCampMediumKey", _arg1);
}
public function setSessionTimeout(_arg1:int):void{
enqueue("setSessionTimeout", _arg1);
}
public function setRemoteServerMode():void{
enqueue("setRemoteServerMode");
}
public function element(){
return (_ar[0]);
}
public function getAccount():String{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getAccount' method for the moment."));
};
return ("");
}
}
}//package com.google.analytics.core
Section 102
//TrackerMode (com.google.analytics.core.TrackerMode)
package com.google.analytics.core {
public class TrackerMode {
public static const BRIDGE:String = "Bridge";
public static const AS3:String = "AS3";
}
}//package com.google.analytics.core
Section 103
//Utils (com.google.analytics.core.Utils)
package com.google.analytics.core {
public class Utils {
public static function trim(_arg1:String, _arg2:Boolean=false):String{
var _local3:Array;
var _local4:String;
var _local5:int;
var _local6:int;
var _local7:int;
if (_arg1 == ""){
return ("");
};
_local3 = [" ", "\n", "\r", "\t"];
_local4 = _arg1;
if (_arg2){
_local5 = 0;
while ((((_local5 < _local3.length)) && ((_local4.indexOf(_local3[_local5]) > -1)))) {
_local4 = _local4.split(_local3[_local5]).join("");
_local5++;
};
} else {
_local6 = 0;
while ((((_local6 < _local4.length)) && ((_local3.indexOf(_local4.charAt(_local6)) > -1)))) {
_local6++;
};
_local4 = _local4.substr(_local6);
_local7 = (_local4.length - 1);
while ((((_local7 >= 0)) && ((_local3.indexOf(_local4.charAt(_local7)) > -1)))) {
_local7--;
};
_local4 = _local4.substring(0, (_local7 + 1));
};
return (_local4);
}
public static function generateHash(_arg1:String):int{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = 1;
_local3 = 0;
if (((!((_arg1 == null))) && (!((_arg1 == ""))))){
_local2 = 0;
_local4 = (_arg1.length - 1);
while (_local4 >= 0) {
_local5 = _arg1.charCodeAt(_local4);
_local2 = ((((_local2 << 6) & 268435455) + _local5) + (_local5 << 14));
_local3 = (_local2 & 266338304);
if (_local3 != 0){
_local2 = (_local2 ^ (_local3 >> 21));
};
_local4--;
};
};
return (_local2);
}
public static function generate32bitRandom():int{
return (Math.round((Math.random() * 2147483647)));
}
public static function validateAccount(_arg1:String):Boolean{
var _local2:RegExp;
_local2 = /^UA-[0-9]*-[0-9]*$/;
return (_local2.test(_arg1));
}
}
}//package com.google.analytics.core
Section 104
//Cookie (com.google.analytics.data.Cookie)
package com.google.analytics.data {
public interface Cookie {
function fromSharedObject(_arg1:Object):void;
function toURLString():String;
function get creation():Date;
function toSharedObject():Object;
function isExpired():Boolean;
function set creation(_arg1:Date):void;
function set expiration(_arg1:Date):void;
function get expiration():Date;
}
}//package com.google.analytics.data
Section 105
//UTMA (com.google.analytics.data.UTMA)
package com.google.analytics.data {
import com.google.analytics.utils.*;
public class UTMA extends UTMCookie {
private var _sessionId:Number;
private var _domainHash:Number;
private var _firstTime:Number;
private var _currentTime:Number;
private var _lastTime:Number;
private var _sessionCount:Number;
public function UTMA(_arg1:Number=NaN, _arg2:Number=NaN, _arg3:Number=NaN, _arg4:Number=NaN, _arg5:Number=NaN, _arg6:Number=NaN){
super("utma", "__utma", ["domainHash", "sessionId", "firstTime", "lastTime", "currentTime", "sessionCount"], (Timespan.twoyears * 1000));
this.domainHash = _arg1;
this.sessionId = _arg2;
this.firstTime = _arg3;
this.lastTime = _arg4;
this.currentTime = _arg5;
this.sessionCount = _arg6;
}
public function get lastTime():Number{
return (_lastTime);
}
public function set lastTime(_arg1:Number):void{
_lastTime = _arg1;
update();
}
public function set currentTime(_arg1:Number):void{
_currentTime = _arg1;
update();
}
public function get sessionId():Number{
return (_sessionId);
}
public function get sessionCount():Number{
return (_sessionCount);
}
public function get firstTime():Number{
return (_firstTime);
}
public function get currentTime():Number{
return (_currentTime);
}
public function set domainHash(_arg1:Number):void{
_domainHash = _arg1;
update();
}
public function set sessionId(_arg1:Number):void{
_sessionId = _arg1;
update();
}
public function set sessionCount(_arg1:Number):void{
_sessionCount = _arg1;
update();
}
public function get domainHash():Number{
return (_domainHash);
}
public function set firstTime(_arg1:Number):void{
_firstTime = _arg1;
update();
}
}
}//package com.google.analytics.data
Section 106
//UTMB (com.google.analytics.data.UTMB)
package com.google.analytics.data {
import com.google.analytics.utils.*;
public class UTMB extends UTMCookie {
private var _trackCount:Number;
private var _lastTime:Number;
private var _domainHash:Number;
private var _token:Number;
public static var defaultTimespan:Number = Timespan.thirtyminutes;
public function UTMB(_arg1:Number=NaN, _arg2:Number=NaN, _arg3:Number=NaN, _arg4:Number=NaN){
super("utmb", "__utmb", ["domainHash", "trackCount", "token", "lastTime"], (defaultTimespan * 1000));
this.domainHash = _arg1;
this.trackCount = _arg2;
this.token = _arg3;
this.lastTime = _arg4;
}
public function set token(_arg1:Number):void{
_token = _arg1;
update();
}
public function set trackCount(_arg1:Number):void{
_trackCount = _arg1;
update();
}
public function get lastTime():Number{
return (_lastTime);
}
public function set domainHash(_arg1:Number):void{
_domainHash = _arg1;
update();
}
public function set lastTime(_arg1:Number):void{
_lastTime = _arg1;
update();
}
public function get domainHash():Number{
return (_domainHash);
}
public function get token():Number{
return (_token);
}
public function get trackCount():Number{
return (_trackCount);
}
}
}//package com.google.analytics.data
Section 107
//UTMC (com.google.analytics.data.UTMC)
package com.google.analytics.data {
public class UTMC extends UTMCookie {
private var _domainHash:Number;
public function UTMC(_arg1:Number=NaN){
super("utmc", "__utmc", ["domainHash"]);
this.domainHash = _arg1;
}
public function set domainHash(_arg1:Number):void{
_domainHash = _arg1;
update();
}
public function get domainHash():Number{
return (_domainHash);
}
}
}//package com.google.analytics.data
Section 108
//UTMCookie (com.google.analytics.data.UTMCookie)
package com.google.analytics.data {
import com.google.analytics.core.*;
public class UTMCookie implements Cookie {
protected var inURL:String;
protected var name:String;
private var _creation:Date;
private var _expiration:Date;
public var proxy:Buffer;
private var _timespan:Number;
protected var fields:Array;
public function UTMCookie(_arg1:String, _arg2:String, _arg3:Array, _arg4:Number=0){
this.name = _arg1;
this.inURL = _arg2;
this.fields = _arg3;
_timestamp(_arg4);
}
public function isEmpty():Boolean{
var _local1:int;
var _local2:String;
var _local3:int;
_local1 = 0;
_local3 = 0;
while (_local3 < fields.length) {
_local2 = fields[_local3];
if ((((this[_local2] is Number)) && (isNaN(this[_local2])))){
_local1++;
} else {
if ((((this[_local2] is String)) && ((this[_local2] == "")))){
_local1++;
};
};
_local3++;
};
if (_local1 == fields.length){
return (true);
};
return (false);
}
protected function update():void{
resetTimestamp();
if (proxy){
proxy.update(name, toSharedObject());
};
}
public function fromSharedObject(_arg1:Object):void{
var _local2:String;
var _local3:int;
var _local4:int;
_local3 = fields.length;
_local4 = 0;
while (_local4 < _local3) {
_local2 = fields[_local4];
if (_arg1[_local2]){
this[_local2] = _arg1[_local2];
};
_local4++;
};
if (_arg1.creation){
this.creation = _arg1.creation;
};
if (_arg1.expiration){
this.expiration = _arg1.expiration;
};
}
private function _timestamp(_arg1:Number):void{
creation = new Date();
_timespan = _arg1;
if (_arg1 > 0){
expiration = new Date((creation.valueOf() + _arg1));
};
}
public function isExpired():Boolean{
var _local1:Date;
var _local2:Number;
_local1 = new Date();
_local2 = (expiration.valueOf() - _local1.valueOf());
if (_local2 <= 0){
return (true);
};
return (false);
}
public function set expiration(_arg1:Date):void{
_expiration = _arg1;
}
public function get creation():Date{
return (_creation);
}
public function reset():void{
var _local1:String;
var _local2:int;
_local2 = 0;
while (_local2 < fields.length) {
_local1 = fields[_local2];
if ((this[_local1] is Number)){
this[_local1] = NaN;
} else {
if ((this[_local1] is String)){
this[_local1] = "";
};
};
_local2++;
};
resetTimestamp();
update();
}
public function valueOf():String{
var _local1:Array;
var _local2:String;
var _local3:*;
var _local4:int;
_local1 = [];
_local4 = 0;
while (_local4 < fields.length) {
_local2 = fields[_local4];
_local3 = this[_local2];
if ((_local3 is String)){
if (_local3 == ""){
_local3 = "-";
_local1.push(_local3);
} else {
_local1.push(_local3);
};
} else {
if ((_local3 is Number)){
if (_local3 == 0){
_local1.push(_local3);
} else {
if (isNaN(_local3)){
_local3 = "-";
_local1.push(_local3);
} else {
_local1.push(_local3);
};
};
};
};
_local4++;
};
return (("" + _local1.join(".")));
}
public function resetTimestamp(_arg1:Number=NaN):void{
if (!isNaN(_arg1)){
_timespan = _arg1;
};
_creation = null;
_expiration = null;
_timestamp(_timespan);
}
public function get expiration():Date{
if (_expiration){
return (_expiration);
};
return (new Date((new Date().valueOf() + 1000)));
}
public function toURLString():String{
return (((inURL + "=") + valueOf()));
}
public function toSharedObject():Object{
var _local1:Object;
var _local2:String;
var _local3:*;
var _local4:int;
_local1 = {};
_local4 = 0;
for (;_local4 < fields.length;_local4++) {
_local2 = fields[_local4];
_local3 = this[_local2];
if ((_local3 is String)){
_local1[_local2] = _local3;
} else {
if (_local3 == 0){
_local1[_local2] = _local3;
} else {
if (isNaN(_local3)){
continue;
} else {
_local1[_local2] = _local3;
};
};
};
};
_local1.creation = creation;
_local1.expiration = expiration;
return (_local1);
}
public function toString(_arg1:Boolean=false):String{
var _local2:Array;
var _local3:String;
var _local4:*;
var _local5:int;
var _local6:int;
var _local7:String;
_local2 = [];
_local5 = fields.length;
_local6 = 0;
for (;_local6 < _local5;_local6++) {
_local3 = fields[_local6];
_local4 = this[_local3];
if ((_local4 is String)){
_local2.push((((_local3 + ": \"") + _local4) + "\""));
} else {
if (_local4 == 0){
_local2.push(((_local3 + ": ") + _local4));
} else {
if (isNaN(_local4)){
continue;
} else {
_local2.push(((_local3 + ": ") + _local4));
};
};
};
};
_local7 = (((name.toUpperCase() + " {") + _local2.join(", ")) + "}");
if (_arg1){
_local7 = (_local7 + (((" creation:" + creation) + ", expiration:") + expiration));
};
return (_local7);
}
public function set creation(_arg1:Date):void{
_creation = _arg1;
}
}
}//package com.google.analytics.data
Section 109
//UTMK (com.google.analytics.data.UTMK)
package com.google.analytics.data {
public class UTMK extends UTMCookie {
private var _hash:Number;
public function UTMK(_arg1:Number=NaN){
super("utmk", "__utmk", ["hash"]);
this.hash = _arg1;
}
public function set hash(_arg1:Number):void{
_hash = _arg1;
update();
}
public function get hash():Number{
return (_hash);
}
}
}//package com.google.analytics.data
Section 110
//UTMV (com.google.analytics.data.UTMV)
package com.google.analytics.data {
import com.google.analytics.utils.*;
public class UTMV extends UTMCookie {
private var _domainHash:Number;
private var _value:String;
public function UTMV(_arg1:Number=NaN, _arg2:String=""){
super("utmv", "__utmv", ["domainHash", "value"], (Timespan.twoyears * 1000));
this.domainHash = _arg1;
this.value = _arg2;
}
override public function toURLString():String{
return (((inURL + "=") + encodeURI(valueOf())));
}
public function get value():String{
return (_value);
}
public function get domainHash():Number{
return (_domainHash);
}
public function set domainHash(_arg1:Number):void{
_domainHash = _arg1;
update();
}
public function set value(_arg1:String):void{
_value = _arg1;
update();
}
}
}//package com.google.analytics.data
Section 111
//UTMZ (com.google.analytics.data.UTMZ)
package com.google.analytics.data {
import com.google.analytics.utils.*;
public class UTMZ extends UTMCookie {
private var _campaignTracking:String;
private var _campaignCreation:Number;
private var _responseCount:Number;
private var _domainHash:Number;
private var _campaignSessions:Number;
public static var defaultTimespan:Number = Timespan.sixmonths;
public function UTMZ(_arg1:Number=NaN, _arg2:Number=NaN, _arg3:Number=NaN, _arg4:Number=NaN, _arg5:String=""){
super("utmz", "__utmz", ["domainHash", "campaignCreation", "campaignSessions", "responseCount", "campaignTracking"], (defaultTimespan * 1000));
this.domainHash = _arg1;
this.campaignCreation = _arg2;
this.campaignSessions = _arg3;
this.responseCount = _arg4;
this.campaignTracking = _arg5;
}
public function set responseCount(_arg1:Number):void{
_responseCount = _arg1;
update();
}
public function set domainHash(_arg1:Number):void{
_domainHash = _arg1;
update();
}
public function set campaignCreation(_arg1:Number):void{
_campaignCreation = _arg1;
update();
}
public function get campaignTracking():String{
return (_campaignTracking);
}
public function get campaignSessions():Number{
return (_campaignSessions);
}
public function get domainHash():Number{
return (_domainHash);
}
public function get responseCount():Number{
return (_responseCount);
}
public function get campaignCreation():Number{
return (_campaignCreation);
}
public function set campaignSessions(_arg1:Number):void{
_campaignSessions = _arg1;
update();
}
public function set campaignTracking(_arg1:String):void{
_campaignTracking = _arg1;
update();
}
}
}//package com.google.analytics.data
Section 112
//X10 (com.google.analytics.data.X10)
package com.google.analytics.data {
public class X10 {
private var _delimEnd:String;// = ")"
private var _delimSet:String;// = "*"
private var _escapeChar:String;// = "'"
private var _delimBegin:String;// = "("
private var _delimNumValue:String;// = "!"
private var _key:String;// = "k"
private var _set:Array;
private var _projectData:Object;
private var _hasData:int;
private var _escapeCharMap:Object;
private var _minimum:int;
private var _value:String;// = "v"
public function X10(){
_key = "k";
_value = "v";
_set = [_key, _value];
_delimBegin = "(";
_delimEnd = ")";
_delimSet = "*";
_delimNumValue = "!";
_escapeChar = "'";
super();
_projectData = {};
_escapeCharMap = {};
_escapeCharMap[_escapeChar] = "'0";
_escapeCharMap[_delimEnd] = "'1";
_escapeCharMap[_delimSet] = "'2";
_escapeCharMap[_delimNumValue] = "'3";
_minimum = 1;
}
private function _clearInternal(_arg1:Number, _arg2:String):void{
var _local3:Boolean;
var _local4:int;
var _local5:int;
if (((hasProject(_arg1)) && (!((_projectData[_arg1][_arg2] == undefined))))){
_projectData[_arg1][_arg2] = undefined;
_local3 = true;
_local5 = _set.length;
_local4 = 0;
while (_local4 < _local5) {
if (_projectData[_arg1][_set[_local4]] != undefined){
_local3 = false;
break;
};
_local4++;
};
if (_local3){
_projectData[_arg1] = undefined;
_hasData = (_hasData - 1);
};
};
}
public function hasData():Boolean{
return ((_hasData > 0));
}
private function _setInternal(_arg1:Number, _arg2:String, _arg3:Number, _arg4:String):void{
if (!hasProject(_arg1)){
_projectData[_arg1] = {};
};
if (_projectData[_arg1][_arg2] == undefined){
_projectData[_arg1][_arg2] = [];
};
_projectData[_arg1][_arg2][_arg3] = _arg4;
_hasData = (_hasData + 1);
}
public function hasProject(_arg1:Number):Boolean{
return (_projectData[_arg1]);
}
public function clearKey(_arg1:Number):void{
_clearInternal(_arg1, _key);
}
private function _renderDataType(_arg1:Array):String{
var _local2:Array;
var _local3:String;
var _local4:int;
_local2 = [];
_local4 = 0;
while (_local4 < _arg1.length) {
if (_arg1[_local4] != undefined){
_local3 = "";
if (((!((_local4 == _minimum))) && ((_arg1[(_local4 - 1)] == undefined)))){
_local3 = (_local3 + _local4.toString());
_local3 = (_local3 + _delimNumValue);
};
_local3 = (_local3 + _escapeExtensibleValue(_arg1[_local4]));
_local2.push(_local3);
};
_local4++;
};
return (((_delimBegin + _local2.join(_delimSet)) + _delimEnd));
}
public function getKey(_arg1:Number, _arg2:Number):String{
return ((_getInternal(_arg1, _key, _arg2) as String));
}
public function clearValue(_arg1:Number):void{
_clearInternal(_arg1, _value);
}
public function renderMergedUrlString(_arg1:X10=null):String{
var _local2:Array;
var _local3:String;
if (!_arg1){
return (renderUrlString());
};
_local2 = [_arg1.renderUrlString()];
for (_local3 in _projectData) {
if (((hasProject(Number(_local3))) && (!(_arg1.hasProject(Number(_local3)))))){
_local2.push((_local3 + _renderProject(_projectData[_local3])));
};
};
return (_local2.join(""));
}
public function setValue(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
if (((((!((Math.round(_arg3) == _arg3))) || (isNaN(_arg3)))) || ((_arg3 == Infinity)))){
return (false);
};
_setInternal(_arg1, _value, _arg2, _arg3.toString());
return (true);
}
public function renderUrlString():String{
var _local1:Array;
var _local2:String;
_local1 = [];
for (_local2 in _projectData) {
if (hasProject(Number(_local2))){
_local1.push((_local2 + _renderProject(_projectData[_local2])));
};
};
return (_local1.join(""));
}
private function _getInternal(_arg1:Number, _arg2:String, _arg3:Number):Object{
if (((hasProject(_arg1)) && (!((_projectData[_arg1][_arg2] == undefined))))){
return (_projectData[_arg1][_arg2][_arg3]);
};
return (undefined);
}
public function setKey(_arg1:Number, _arg2:Number, _arg3:String):Boolean{
_setInternal(_arg1, _key, _arg2, _arg3);
return (true);
}
public function getValue(_arg1:Number, _arg2:Number){
var _local3:*;
_local3 = _getInternal(_arg1, _value, _arg2);
if (_local3 == null){
return (null);
};
return (Number(_local3));
}
private function _renderProject(_arg1:Object):String{
var _local2:String;
var _local3:Boolean;
var _local4:int;
var _local5:Array;
var _local6:int;
_local2 = "";
_local3 = false;
_local6 = _set.length;
_local4 = 0;
while (_local4 < _local6) {
_local5 = _arg1[_set[_local4]];
if (_local5){
if (_local3){
_local2 = (_local2 + _set[_local4]);
};
_local2 = (_local2 + _renderDataType(_local5));
_local3 = false;
} else {
_local3 = true;
};
_local4++;
};
return (_local2);
}
private function _escapeExtensibleValue(_arg1:String):String{
var _local2:String;
var _local3:int;
var _local4:String;
var _local5:String;
_local2 = "";
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = _arg1.charAt(_local3);
_local5 = _escapeCharMap[_local4];
if (_local5){
_local2 = (_local2 + _local5);
} else {
_local2 = (_local2 + _local4);
};
_local3++;
};
return (_local2);
}
}
}//package com.google.analytics.data
Section 113
//_Style (com.google.analytics.debug._Style)
package com.google.analytics.debug {
import flash.net.*;
import flash.text.*;
public class _Style {
public var borderColor:uint;
public var backgroundColor:uint;
private var _sheet:StyleSheet;
public var roundedCorner:uint;
public var alertColor:uint;
public var infoColor:uint;
public var successColor:uint;
private var _loader:URLLoader;
public var failureColor:uint;
private var _defaultSheet:String;
public var warningColor:uint;
public function _Style(){
_sheet = new StyleSheet();
_loader = new URLLoader();
_init();
}
private function _parseSheet(_arg1:String):void{
_sheet.parseCSS(_arg1);
}
public function get sheet():StyleSheet{
return (_sheet);
}
private function _init():void{
_defaultSheet = "";
_defaultSheet = (_defaultSheet + "a{text-decoration: underline;}\n");
_defaultSheet = (_defaultSheet + ".uiLabel{color: #000000;font-family: Arial;font-size: 12;margin-left: 2;margin-right: 2;}\n");
_defaultSheet = (_defaultSheet + ".uiWarning{color: #ffffff;font-family: Arial;font-size: 14;font-weight: bold;margin-left: 6;margin-right: 6;}\n");
_defaultSheet = (_defaultSheet + ".uiAlert{color: #ffffff;font-family: Arial;font-size: 14;font-weight: bold;margin-left: 6;margin-right: 6;}\n");
_defaultSheet = (_defaultSheet + ".uiInfo{color: #000000;font-family: Arial;font-size: 14;font-weight: bold;margin-left: 6;margin-right: 6;}\n");
_defaultSheet = (_defaultSheet + ".uiSuccess{color: #ffffff;font-family: Arial;font-size: 12;font-weight: bold;margin-left: 6;margin-right: 6;}\n");
_defaultSheet = (_defaultSheet + ".uiFailure{color: #ffffff;font-family: Arial;font-size: 12;font-weight: bold;margin-left: 6;margin-right: 6;}\n");
_defaultSheet = (_defaultSheet + ".uiAlertAction{color: #ffffff;text-align: center;font-family: Arial;font-size: 12;font-weight: bold;margin-left: 6;margin-right: 6;}\n");
_defaultSheet = (_defaultSheet + ".uiAlertTitle{color: #ffffff;font-family: Arial;font-size: 16;font-weight: bold;margin-left: 6;margin-right: 6;}\n");
_defaultSheet = (_defaultSheet + "\n");
roundedCorner = 6;
backgroundColor = 0xCCCCCC;
borderColor = 0x555555;
infoColor = 16777113;
alertColor = 0xFFCC00;
warningColor = 0xCC0000;
successColor = 0xFF00;
failureColor = 0xFF0000;
_parseSheet(_defaultSheet);
}
}
}//package com.google.analytics.debug
Section 114
//Alert (com.google.analytics.debug.Alert)
package com.google.analytics.debug {
import flash.events.*;
public class Alert extends Label {
public var actionOnNextLine:Boolean;// = true
public var autoClose:Boolean;// = true
private var _actions:Array;
public function Alert(_arg1:String, _arg2:Array, _arg3:String="uiAlert", _arg4:uint=0, _arg5:Align=null, _arg6:Boolean=false, _arg7:Boolean=true){
var _local8:int;
autoClose = true;
actionOnNextLine = true;
if (_arg4 == 0){
_arg4 = Style.alertColor;
};
if (_arg5 == null){
_arg5 = Align.center;
};
super(_arg1, _arg3, _arg4, _arg5, _arg6);
this.selectable = true;
super.mouseChildren = true;
this.buttonMode = true;
this.mouseEnabled = true;
this.useHandCursor = true;
this.actionOnNextLine = _arg7;
_actions = [];
_local8 = 0;
while (_local8 < _arg2.length) {
_arg2[_local8].container = this;
_actions.push(_arg2[_local8]);
_local8++;
};
}
protected function getAction(_arg1:String):AlertAction{
var _local2:int;
_local2 = 0;
while (_local2 < _actions.length) {
if (_arg1 == _actions[_local2].activator){
return (_actions[_local2]);
};
_local2++;
};
return (null);
}
override protected function layout():void{
super.layout();
_defineActions();
}
protected function spaces(_arg1:int):String{
var _local2:String;
var _local3:String;
var _local4:int;
_local2 = "";
_local3 = " ";
_local4 = 0;
while (_local4 < (_arg1 + 1)) {
_local2 = (_local2 + _local3);
_local4++;
};
return (_local2);
}
override public function onLink(_arg1:TextEvent):void{
var _local2:AlertAction;
if (isValidAction(_arg1.text)){
_local2 = getAction(_arg1.text);
if (_local2){
_local2.execute();
};
};
if (autoClose){
close();
};
}
protected function isValidAction(_arg1:String):Boolean{
var _local2:int;
_local2 = 0;
while (_local2 < _actions.length) {
if (_arg1 == _actions[_local2].activator){
return (true);
};
_local2++;
};
return (false);
}
private function _defineActions():void{
var _local1:String;
var _local2:Array;
var _local3:AlertAction;
var _local4:int;
_local1 = "";
if (actionOnNextLine){
_local1 = (_local1 + "\n");
} else {
_local1 = (_local1 + " |");
};
_local1 = (_local1 + " ");
_local2 = [];
_local4 = 0;
while (_local4 < _actions.length) {
_local3 = _actions[_local4];
_local2.push((((("<a href=\"event:" + _local3.activator) + "\">") + _local3.name) + "</a>"));
_local4++;
};
_local1 = (_local1 + _local2.join(" | "));
appendText(_local1, "uiAlertAction");
}
public function close():void{
if (parent != null){
parent.removeChild(this);
};
}
}
}//package com.google.analytics.debug
Section 115
//AlertAction (com.google.analytics.debug.AlertAction)
package com.google.analytics.debug {
public class AlertAction {
public var container:Alert;
private var _callback;
public var name:String;
public var activator:String;
public function AlertAction(_arg1:String, _arg2:String, _arg3){
this.name = _arg1;
this.activator = _arg2;
_callback = _arg3;
}
public function execute():void{
if (_callback){
if ((_callback is Function)){
(_callback as Function)();
} else {
if ((_callback is String)){
var _local1 = container;
_local1[_callback]();
};
};
};
}
}
}//package com.google.analytics.debug
Section 116
//Align (com.google.analytics.debug.Align)
package com.google.analytics.debug {
public class Align {
private var _value:int;
private var _name:String;
public static const bottomRight:Align = new Align(18, "bottomRight");
;
public static const right:Align = new Align(16, "right");
;
public static const left:Align = new Align(32, "left");
;
public static const topRight:Align = new Align(17, "topRight");
;
public static const bottom:Align = new Align(2, "bottom");
;
public static const bottomLeft:Align = new Align(34, "bottomLeft");
;
public static const topLeft:Align = new Align(33, "topLeft");
;
public static const center:Align = new Align(0x0100, "center");
;
public static const none:Align = new Align(0, "none");
;
public static const top:Align = new Align(1, "top");
;
public function Align(_arg1:int=0, _arg2:String=""){
_value = _arg1;
_name = _arg2;
}
public function valueOf():int{
return (_value);
}
public function toString():String{
return (_name);
}
}
}//package com.google.analytics.debug
Section 117
//Background (com.google.analytics.debug.Background)
package com.google.analytics.debug {
import flash.display.*;
public class Background {
public static function drawRounded(_arg1, _arg2:Graphics, _arg3:uint=0, _arg4:uint=0):void{
var _local5:uint;
var _local6:uint;
var _local7:uint;
_local7 = Style.roundedCorner;
if ((((_arg3 > 0)) && ((_arg4 > 0)))){
_local5 = _arg3;
_local6 = _arg4;
} else {
_local5 = _arg1.width;
_local6 = _arg1.height;
};
if (((_arg1.stickToEdge) && (!((_arg1.alignement == Align.none))))){
switch (_arg1.alignement){
case Align.top:
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, 0, 0, _local7, _local7);
break;
case Align.topLeft:
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, 0, 0, 0, _local7);
break;
case Align.topRight:
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, 0, 0, _local7, 0);
break;
case Align.bottom:
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, _local7, _local7, 0, 0);
break;
case Align.bottomLeft:
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, 0, _local7, 0, 0);
break;
case Align.bottomRight:
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, _local7, 0, 0, 0);
break;
case Align.left:
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, 0, _local7, 0, _local7);
break;
case Align.right:
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, _local7, 0, _local7, 0);
break;
case Align.center:
_arg2.drawRoundRect(0, 0, _local5, _local6, _local7, _local7);
break;
};
} else {
_arg2.drawRoundRect(0, 0, _local5, _local6, _local7, _local7);
};
}
}
}//package com.google.analytics.debug
Section 118
//Debug (com.google.analytics.debug.Debug)
package com.google.analytics.debug {
import flash.events.*;
import flash.ui.*;
public class Debug extends Label {
private var _lines:Array;
private var _preferredForcedWidth:uint;// = 540
private var _linediff:int;// = 0
public var maxLines:uint;// = 16
public static var count:uint = 0;
public function Debug(_arg1:uint=0, _arg2:Align=null, _arg3:Boolean=false){
if (_arg2 == null){
_arg2 = Align.bottom;
};
super("", "uiLabel", _arg1, _arg2, _arg3);
this.name = ("Debug" + count++);
_lines = [];
selectable = true;
addEventListener(KeyboardEvent.KEY_DOWN, onKey);
}
public function writeBold(_arg1:String):void{
write(_arg1, true);
}
private function _getLinesToDisplay(_arg1:int=0):Array{
var _local2:Array;
var _local3:uint;
var _local4:uint;
if ((_lines.length - 1) > maxLines){
if ((_linediff <= 0)){
_linediff = (_linediff + _arg1);
} else {
if ((((_linediff > 0)) && ((_arg1 < 0)))){
_linediff = (_linediff + _arg1);
};
};
_local3 = ((_lines.length - maxLines) + _linediff);
_local4 = (_local3 + maxLines);
_local2 = _lines.slice(_local3, _local4);
} else {
_local2 = _lines;
};
return (_local2);
}
private function onKey(_arg1:KeyboardEvent=null):void{
var _local2:Array;
switch (_arg1.keyCode){
case Keyboard.DOWN:
_local2 = _getLinesToDisplay(1);
break;
case Keyboard.UP:
_local2 = _getLinesToDisplay(-1);
break;
default:
_local2 = null;
};
if (_local2 == null){
return;
};
text = _local2.join("\n");
}
override public function get forcedWidth():uint{
if (this.parent){
if (UISprite(this.parent).forcedWidth > _preferredForcedWidth){
return (_preferredForcedWidth);
};
return (UISprite(this.parent).forcedWidth);
//unresolved jump
};
return (super.forcedWidth);
}
public function write(_arg1:String, _arg2:Boolean=false):void{
var _local3:Array;
if (_arg1.indexOf("") > -1){
_local3 = _arg1.split("\n");
} else {
_local3 = [_arg1];
};
var _local4 = "";
var _local5 = "";
if (_arg2){
_local4 = "<b>";
_local5 = "</b>";
};
var _local6:int;
while (_local6 < _local3.length) {
_lines.push(((_local4 + _local3[_local6]) + _local5));
_local6++;
};
var _local7:Array = _getLinesToDisplay();
text = _local7.join("\n");
}
public function close():void{
dispose();
}
override protected function dispose():void{
removeEventListener(KeyboardEvent.KEY_DOWN, onKey);
super.dispose();
}
}
}//package com.google.analytics.debug
Section 119
//DebugConfiguration (com.google.analytics.debug.DebugConfiguration)
package com.google.analytics.debug {
import com.google.analytics.core.*;
import flash.net.*;
import flash.utils.*;
import flash.ui.*;
public class DebugConfiguration {
public var showHideKey:Number;
private var _mode:VisualDebugMode;
private var _verbose:Boolean;// = false
public var destroyKey:Number;
public var GIFRequests:Boolean;// = false
public var showInfos:Boolean;// = true
public var infoTimeout:Number;// = 1000
public var minimizedOnStart:Boolean;// = false
private var _active:Boolean;// = false
public var traceOutput:Boolean;// = false
public var layout:ILayout;
public var warningTimeout:Number;// = 1500
public var javascript:Boolean;// = false
public var showWarnings:Boolean;// = true
private var _visualInitialized:Boolean;// = false
public function DebugConfiguration(){
_mode = VisualDebugMode.basic;
showHideKey = Keyboard.SPACE;
destroyKey = Keyboard.BACKSPACE;
super();
}
public function get verbose():Boolean{
return (_verbose);
}
public function set verbose(_arg1:Boolean):void{
_verbose = _arg1;
}
public function set mode(_arg1):void{
if ((_arg1 is String)){
switch (_arg1){
case "geek":
_arg1 = VisualDebugMode.geek;
break;
case "advanced":
_arg1 = VisualDebugMode.advanced;
break;
case "basic":
default:
_arg1 = VisualDebugMode.basic;
};
};
_mode = _arg1;
}
public function success(_arg1:String):void{
if (layout){
layout.createSuccessAlert(_arg1);
};
if (traceOutput){
trace((("[+] " + _arg1) + " !!"));
};
}
public function get active():Boolean{
return (_active);
}
private function _initializeVisual():void{
if (layout){
layout.init();
_visualInitialized = true;
};
}
private function _destroyVisual():void{
if (((layout) && (_visualInitialized))){
layout.destroy();
};
}
public function warning(_arg1:String, _arg2:VisualDebugMode=null):void{
if (_filter(_arg2)){
return;
};
if (((layout) && (showWarnings))){
layout.createWarning(_arg1);
};
if (traceOutput){
trace((("## " + _arg1) + " ##"));
};
}
private function _filter(_arg1:VisualDebugMode=null):Boolean{
return (((_arg1) && ((int(_arg1) >= int(this.mode)))));
}
public function failure(_arg1:String):void{
if (layout){
layout.createFailureAlert(_arg1);
};
if (traceOutput){
trace((("[-] " + _arg1) + " !!"));
};
}
public function get mode(){
return (_mode);
}
public function set active(_arg1:Boolean):void{
_active = _arg1;
if (_active){
_initializeVisual();
} else {
_destroyVisual();
};
}
protected function trace(_arg1:String):void{
var _local7:Array;
var _local8:int;
var _local2:Array = [];
var _local3 = "";
var _local4 = "";
if (this.mode == VisualDebugMode.geek){
_local3 = (getTimer() + " - ");
_local4 = (new Array(_local3.length).join(" ") + " ");
};
if (_arg1.indexOf("\n") > -1){
_local7 = _arg1.split("\n");
_local8 = 0;
while (_local8 < _local7.length) {
if (_local7[_local8] == ""){
} else {
if (_local8 == 0){
_local2.push((_local3 + _local7[_local8]));
} else {
_local2.push((_local4 + _local7[_local8]));
};
};
_local8++;
};
} else {
_local2.push((_local3 + _arg1));
};
var _local5:int = _local2.length;
var _local6:int;
while (_local6 < _local5) {
trace(_local2[_local6]);
_local6++;
};
}
public function alert(_arg1:String):void{
if (layout){
layout.createAlert(_arg1);
};
if (traceOutput){
trace((("!! " + _arg1) + " !!"));
};
}
public function info(_arg1:String, _arg2:VisualDebugMode=null):void{
if (_filter(_arg2)){
return;
};
if (((layout) && (showInfos))){
layout.createInfo(_arg1);
};
if (traceOutput){
trace(_arg1);
};
}
public function alertGifRequest(_arg1:String, _arg2:URLRequest, _arg3:GIFRequest):void{
if (layout){
layout.createGIFRequestAlert(_arg1, _arg2, _arg3);
};
if (traceOutput){
trace(((">> " + _arg1) + " <<"));
};
}
}
}//package com.google.analytics.debug
Section 120
//FailureAlert (com.google.analytics.debug.FailureAlert)
package com.google.analytics.debug {
public class FailureAlert extends Alert {
public function FailureAlert(_arg1:DebugConfiguration, _arg2:String, _arg3:Array){
var _local4:Align;
var _local5:Boolean;
var _local6:Boolean;
_local4 = Align.bottomLeft;
_local5 = true;
_local6 = false;
if (_arg1.verbose){
_arg2 = ((("<u><span class=\"uiAlertTitle\">Failure</span>" + spaces(18)) + "</u>\n\n") + _arg2);
_local4 = Align.center;
_local5 = false;
_local6 = true;
};
super(_arg2, _arg3, "uiFailure", Style.failureColor, _local4, _local5, _local6);
}
}
}//package com.google.analytics.debug
Section 121
//GIFRequestAlert (com.google.analytics.debug.GIFRequestAlert)
package com.google.analytics.debug {
public class GIFRequestAlert extends Alert {
public function GIFRequestAlert(_arg1:String, _arg2:Array){
super(_arg1, _arg2);
}
}
}//package com.google.analytics.debug
Section 122
//ILayout (com.google.analytics.debug.ILayout)
package com.google.analytics.debug {
import flash.display.*;
import com.google.analytics.core.*;
import flash.net.*;
public interface ILayout {
function createWarning(_arg1:String):void;
function addToStage(_arg1:DisplayObject):void;
function createGIFRequestAlert(_arg1:String, _arg2:URLRequest, _arg3:GIFRequest):void;
function createPanel(_arg1:String, _arg2:uint, _arg3:uint):void;
function createInfo(_arg1:String):void;
function createFailureAlert(_arg1:String):void;
function addToPanel(_arg1:String, _arg2:DisplayObject):void;
function init():void;
function createSuccessAlert(_arg1:String):void;
function createVisualDebug():void;
function createAlert(_arg1:String):void;
function destroy():void;
function bringToFront(_arg1:DisplayObject):void;
function isAvailable():Boolean;
}
}//package com.google.analytics.debug
Section 123
//Info (com.google.analytics.debug.Info)
package com.google.analytics.debug {
import flash.events.*;
import flash.utils.*;
public class Info extends Label {
private var _timer:Timer;
public function Info(_arg1:String="", _arg2:uint=3000){
super(_arg1, "uiInfo", Style.infoColor, Align.top, true);
if (_arg2 > 0){
_timer = new Timer(_arg2, 1);
_timer.start();
_timer.addEventListener(TimerEvent.TIMER_COMPLETE, onComplete, false, 0, true);
};
}
public function onComplete(_arg1:TimerEvent):void{
close();
}
override public function onLink(_arg1:TextEvent):void{
switch (_arg1.text){
case "hide":
close();
break;
};
}
public function close():void{
if (parent != null){
parent.removeChild(this);
};
}
}
}//package com.google.analytics.debug
Section 124
//Label (com.google.analytics.debug.Label)
package com.google.analytics.debug {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class Label extends UISprite {
private var _color:uint;
private var _background:Shape;
private var _textField:TextField;
public var stickToEdge:Boolean;
private var _text:String;
protected var selectable:Boolean;
private var _tag:String;
public static var count:uint = 0;
public function Label(_arg1:String="", _arg2:String="uiLabel", _arg3:uint=0, _arg4:Align=null, _arg5:Boolean=false){
this.name = ("Label" + count++);
selectable = false;
_background = new Shape();
_textField = new TextField();
_text = _arg1;
_tag = _arg2;
if (_arg4 == null){
_arg4 = Align.none;
};
this.alignement = _arg4;
this.stickToEdge = _arg5;
if (_arg3 == 0){
_arg3 = Style.backgroundColor;
};
_color = _arg3;
_textField.addEventListener(TextEvent.LINK, onLink);
}
public function get tag():String{
return (_tag);
}
private function _draw():void{
var _local1:Graphics = _background.graphics;
_local1.clear();
_local1.beginFill(_color);
var _local2:uint = _textField.width;
var _local3:uint = _textField.height;
if (forcedWidth > 0){
_local2 = forcedWidth;
};
Background.drawRounded(this, _local1, _local2, _local3);
_local1.endFill();
}
public function get text():String{
return (_textField.text);
}
public function appendText(_arg1:String, _arg2:String=""):void{
if (_arg1 == ""){
return;
};
if (_arg2 == ""){
_arg2 = tag;
};
_textField.htmlText = (_textField.htmlText + (((("<span class=\"" + _arg2) + "\">") + _arg1) + "</span>"));
_text = (_text + _arg1);
_draw();
resize();
}
public function set text(_arg1:String):void{
if (_arg1 == ""){
_arg1 = _text;
};
_textField.htmlText = (((("<span class=\"" + tag) + "\">") + _arg1) + "</span>");
_text = _arg1;
_draw();
resize();
}
override protected function layout():void{
_textField.type = TextFieldType.DYNAMIC;
_textField.autoSize = TextFieldAutoSize.LEFT;
_textField.background = false;
_textField.selectable = selectable;
_textField.multiline = true;
_textField.styleSheet = Style.sheet;
this.text = _text;
addChild(_background);
addChild(_textField);
}
public function set tag(_arg1:String):void{
_tag = _arg1;
text = "";
}
public function onLink(_arg1:TextEvent):void{
}
override protected function dispose():void{
_textField.removeEventListener(TextEvent.LINK, onLink);
super.dispose();
}
}
}//package com.google.analytics.debug
Section 125
//Layout (com.google.analytics.debug.Layout)
package com.google.analytics.debug {
import flash.events.*;
import flash.display.*;
import com.google.analytics.core.*;
import flash.net.*;
import com.google.analytics.*;
public class Layout implements ILayout {
private var _display:DisplayObject;
private var _infoQueue:Array;
private var _maxCharPerLine:int;// = 85
private var _hasInfo:Boolean;
private var _warningQueue:Array;
private var _hasDebug:Boolean;
private var _hasWarning:Boolean;
private var _mainPanel:Panel;
private var _GRAlertQueue:Array;
private var _debug:DebugConfiguration;
public var visualDebug:Debug;
private var _hasGRAlert:Boolean;
public function Layout(_arg1:DebugConfiguration, _arg2:DisplayObject){
_display = _arg2;
_debug = _arg1;
_hasWarning = false;
_hasInfo = false;
_hasDebug = false;
_hasGRAlert = false;
_warningQueue = [];
_infoQueue = [];
_GRAlertQueue = [];
}
private function onKey(_arg1:KeyboardEvent=null):void{
switch (_arg1.keyCode){
case _debug.showHideKey:
_mainPanel.visible = !(_mainPanel.visible);
break;
case _debug.destroyKey:
destroy();
break;
};
}
public function createWarning(_arg1:String):void{
if (((_hasWarning) || (!(isAvailable())))){
_warningQueue.push(_arg1);
return;
};
_arg1 = _filterMaxChars(_arg1);
_hasWarning = true;
var _local2:Warning = new Warning(_arg1, _debug.warningTimeout);
addToPanel("analytics", _local2);
_local2.addEventListener(Event.REMOVED_FROM_STAGE, _clearWarning, false, 0, true);
if (_hasDebug){
visualDebug.writeBold(_arg1);
};
}
public function bringToFront(_arg1:DisplayObject):void{
_display.stage.setChildIndex(_arg1, (_display.stage.numChildren - 1));
}
public function createFailureAlert(_arg1:String):void{
var _local2:AlertAction;
if (_debug.verbose){
_arg1 = _filterMaxChars(_arg1);
_local2 = new AlertAction("Close", "close", "close");
} else {
_local2 = new AlertAction("X", "close", "close");
};
var _local3:Alert = new FailureAlert(_debug, _arg1, [_local2]);
addToPanel("analytics", _local3);
if (_hasDebug){
if (_debug.verbose){
_arg1 = _arg1.split("\n").join("");
_arg1 = _filterMaxChars(_arg1, 66);
};
visualDebug.writeBold(_arg1);
};
}
public function init():void{
var _local1 = 10;
var _local2:uint = (_display.stage.stageWidth - (_local1 * 2));
var _local3:uint = (_display.stage.stageHeight - (_local1 * 2));
var _local4:Panel = new Panel("analytics", _local2, _local3);
_local4.alignement = Align.top;
_local4.stickToEdge = false;
_local4.title = ("Google Analytics v" + GATracker.version);
_mainPanel = _local4;
addToStage(_local4);
bringToFront(_local4);
if (_debug.minimizedOnStart){
_mainPanel.onToggle();
};
createVisualDebug();
_display.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKey, false, 0, true);
}
public function addToPanel(_arg1:String, _arg2:DisplayObject):void{
var _local4:Panel;
var _local3:DisplayObject = _display.stage.getChildByName(_arg1);
if (_local3){
_local4 = (_local3 as Panel);
_local4.addData(_arg2);
} else {
trace((("panel \"" + _arg1) + "\" not found"));
};
}
private function _clearInfo(_arg1:Event):void{
_hasInfo = false;
if (_infoQueue.length > 0){
createInfo(_infoQueue.shift());
};
}
private function _filterMaxChars(_arg1:String, _arg2:int=0):String{
var _local6:String;
var _local3 = "\n";
var _local4:Array = [];
var _local5:Array = _arg1.split(_local3);
if (_arg2 == 0){
_arg2 = _maxCharPerLine;
};
var _local7:int;
while (_local7 < _local5.length) {
_local6 = _local5[_local7];
while (_local6.length > _arg2) {
_local4.push(_local6.substr(0, _arg2));
_local6 = _local6.substring(_arg2);
};
_local4.push(_local6);
_local7++;
};
return (_local4.join(_local3));
}
private function _clearGRAlert(_arg1:Event):void{
_hasGRAlert = false;
if (_GRAlertQueue.length > 0){
createGIFRequestAlert.apply(this, _GRAlertQueue.shift());
};
}
public function createSuccessAlert(_arg1:String):void{
var _local2:AlertAction;
if (_debug.verbose){
_arg1 = _filterMaxChars(_arg1);
_local2 = new AlertAction("Close", "close", "close");
} else {
_local2 = new AlertAction("X", "close", "close");
};
var _local3:Alert = new SuccessAlert(_debug, _arg1, [_local2]);
addToPanel("analytics", _local3);
if (_hasDebug){
if (_debug.verbose){
_arg1 = _arg1.split("\n").join("");
_arg1 = _filterMaxChars(_arg1, 66);
};
visualDebug.writeBold(_arg1);
};
}
public function isAvailable():Boolean{
return (!((_display.stage == null)));
}
public function createAlert(_arg1:String):void{
_arg1 = _filterMaxChars(_arg1);
var _local2:Alert = new Alert(_arg1, [new AlertAction("Close", "close", "close")]);
addToPanel("analytics", _local2);
if (_hasDebug){
visualDebug.writeBold(_arg1);
};
}
public function createInfo(_arg1:String):void{
if (((_hasInfo) || (!(isAvailable())))){
_infoQueue.push(_arg1);
return;
};
_arg1 = _filterMaxChars(_arg1);
_hasInfo = true;
var _local2:Info = new Info(_arg1, _debug.infoTimeout);
addToPanel("analytics", _local2);
_local2.addEventListener(Event.REMOVED_FROM_STAGE, _clearInfo, false, 0, true);
if (_hasDebug){
visualDebug.write(_arg1);
};
}
public function createGIFRequestAlert(_arg1:String, _arg2:URLRequest, _arg3:GIFRequest):void{
var message = _arg1;
var request = _arg2;
var ref = _arg3;
if (_hasGRAlert){
_GRAlertQueue.push([message, request, ref]);
return;
};
_hasGRAlert = true;
var f:Function = function ():void{
ref.sendRequest(request);
};
message = _filterMaxChars(message);
var gra:GIFRequestAlert = new GIFRequestAlert(message, [new AlertAction("OK", "ok", f), new AlertAction("Cancel", "cancel", "close")]);
addToPanel("analytics", gra);
gra.addEventListener(Event.REMOVED_FROM_STAGE, _clearGRAlert, false, 0, true);
if (_hasDebug){
if (_debug.verbose){
message = message.split("\n").join("");
message = _filterMaxChars(message, 66);
};
visualDebug.write(message);
};
}
public function createVisualDebug():void{
if (!visualDebug){
visualDebug = new Debug();
visualDebug.alignement = Align.bottom;
visualDebug.stickToEdge = true;
addToPanel("analytics", visualDebug);
_hasDebug = true;
};
}
public function addToStage(_arg1:DisplayObject):void{
_display.stage.addChild(_arg1);
}
private function _clearWarning(_arg1:Event):void{
_hasWarning = false;
if (_warningQueue.length > 0){
createWarning(_warningQueue.shift());
};
}
public function createPanel(_arg1:String, _arg2:uint, _arg3:uint):void{
var _local4:Panel = new Panel(_arg1, _arg2, _arg3);
_local4.alignement = Align.center;
_local4.stickToEdge = false;
addToStage(_local4);
bringToFront(_local4);
}
public function destroy():void{
_mainPanel.close();
_debug.layout = null;
}
}
}//package com.google.analytics.debug
Section 126
//Margin (com.google.analytics.debug.Margin)
package com.google.analytics.debug {
public class Margin {
public var bottom:int;
public var top:int;
public var right:int;
public var left:int;
public function Margin(_arg1:int=0, _arg2:int=0, _arg3:int=0, _arg4:int=0){
this.top = _arg1;
this.bottom = _arg2;
this.left = _arg3;
this.right = _arg4;
}
}
}//package com.google.analytics.debug
Section 127
//Panel (com.google.analytics.debug.Panel)
package com.google.analytics.debug {
import flash.events.*;
import flash.display.*;
public class Panel extends UISprite {
private var _savedH:uint;
private var _data:UISprite;
private var _mask:Sprite;
private var _background:Shape;
private var _savedW:uint;
private var _stickToEdge:Boolean;
private var _border:Shape;
private var _borderColor:uint;
protected var baseAlpha:Number;
private var _backgroundColor:uint;
private var _title:Label;
private var _colapsed:Boolean;
private var _name:String;
public function Panel(_arg1:String, _arg2:uint, _arg3:uint, _arg4:uint=0, _arg5:uint=0, _arg6:Number=0.3, _arg7:Align=null, _arg8:Boolean=false){
_name = _arg1;
this.name = _arg1;
this.mouseEnabled = false;
_colapsed = false;
forcedWidth = _arg2;
forcedHeight = _arg3;
this.baseAlpha = _arg6;
_background = new Shape();
_data = new UISprite();
_data.forcedWidth = _arg2;
_data.forcedHeight = _arg3;
_data.mouseEnabled = false;
_title = new Label(_arg1, "uiLabel", 0xFFFFFF, Align.topLeft, _arg8);
_title.buttonMode = true;
_title.margin.top = 0.6;
_title.margin.left = 0.6;
_title.addEventListener(MouseEvent.CLICK, onToggle);
_title.mouseChildren = false;
_border = new Shape();
_mask = new Sprite();
_mask.useHandCursor = false;
_mask.mouseEnabled = false;
_mask.mouseChildren = false;
if (_arg7 == null){
_arg7 = Align.none;
};
this.alignement = _arg7;
this.stickToEdge = _arg8;
if (_arg4 == 0){
_arg4 = Style.backgroundColor;
};
_backgroundColor = _arg4;
if (_arg5 == 0){
_arg5 = Style.borderColor;
};
_borderColor = _arg5;
}
public function get stickToEdge():Boolean{
return (_stickToEdge);
}
public function onToggle(_arg1:MouseEvent=null):void{
if (_colapsed){
_data.visible = true;
} else {
_data.visible = false;
};
_colapsed = !(_colapsed);
_update();
resize();
}
public function set stickToEdge(_arg1:Boolean):void{
_stickToEdge = _arg1;
_title.stickToEdge = _arg1;
}
override protected function dispose():void{
_title.removeEventListener(MouseEvent.CLICK, onToggle);
super.dispose();
}
private function _draw():void{
var _local1:uint;
var _local2:uint;
if (((_savedW) && (_savedH))){
forcedWidth = _savedW;
forcedHeight = _savedH;
};
if (!_colapsed){
_local1 = forcedWidth;
_local2 = forcedHeight;
} else {
_local1 = _title.width;
_local2 = _title.height;
_savedW = forcedWidth;
_savedH = forcedHeight;
forcedWidth = _local1;
forcedHeight = _local2;
};
var _local3:Graphics = _background.graphics;
_local3.clear();
_local3.beginFill(_backgroundColor);
Background.drawRounded(this, _local3, _local1, _local2);
_local3.endFill();
var _local4:Graphics = _data.graphics;
_local4.clear();
_local4.beginFill(_backgroundColor, 0);
Background.drawRounded(this, _local4, _local1, _local2);
_local4.endFill();
var _local5:Graphics = _border.graphics;
_local5.clear();
_local5.lineStyle(0.1, _borderColor);
Background.drawRounded(this, _local5, _local1, _local2);
_local5.endFill();
var _local6:Graphics = _mask.graphics;
_local6.clear();
_local6.beginFill(_backgroundColor);
Background.drawRounded(this, _local6, (_local1 + 1), (_local2 + 1));
_local6.endFill();
}
public function get title():String{
return (_title.text);
}
private function _update():void{
_draw();
if (baseAlpha < 1){
_background.alpha = baseAlpha;
_border.alpha = baseAlpha;
};
}
public function addData(_arg1:DisplayObject):void{
_data.addChild(_arg1);
}
override protected function layout():void{
_update();
addChild(_background);
addChild(_data);
addChild(_title);
addChild(_border);
addChild(_mask);
mask = _mask;
}
public function set title(_arg1:String):void{
_title.text = _arg1;
}
public function close():void{
dispose();
if (parent != null){
parent.removeChild(this);
};
}
}
}//package com.google.analytics.debug
Section 128
//Style (com.google.analytics.debug.Style)
package com.google.analytics.debug {
public const Style:_Style = new _Style();
}//package com.google.analytics.debug
Section 129
//SuccessAlert (com.google.analytics.debug.SuccessAlert)
package com.google.analytics.debug {
public class SuccessAlert extends Alert {
public function SuccessAlert(_arg1:DebugConfiguration, _arg2:String, _arg3:Array){
var _local4:Align;
var _local5:Boolean;
var _local6:Boolean;
_local4 = Align.bottomLeft;
_local5 = true;
_local6 = false;
if (_arg1.verbose){
_arg2 = ((("<u><span class=\"uiAlertTitle\">Success</span>" + spaces(18)) + "</u>\n\n") + _arg2);
_local4 = Align.center;
_local5 = false;
_local6 = true;
};
super(_arg2, _arg3, "uiSuccess", Style.successColor, _local4, _local5, _local6);
}
}
}//package com.google.analytics.debug
Section 130
//UISprite (com.google.analytics.debug.UISprite)
package com.google.analytics.debug {
import flash.events.*;
import flash.display.*;
public class UISprite extends Sprite {
private var _forcedHeight:uint;
protected var listenResize:Boolean;
public var alignement:Align;
private var _forcedWidth:uint;
public var margin:Margin;
protected var alignTarget:DisplayObject;
public function UISprite(_arg1:DisplayObject=null){
listenResize = false;
alignement = Align.none;
this.alignTarget = _arg1;
margin = new Margin();
addEventListener(Event.ADDED_TO_STAGE, _onAddedToStage);
addEventListener(Event.REMOVED_FROM_STAGE, _onRemovedFromStage);
}
protected function dispose():void{
var _local1:DisplayObject;
var _local2:int;
_local2 = 0;
while (_local2 < numChildren) {
_local1 = getChildAt(_local2);
if (_local1){
removeChild(_local1);
};
_local2++;
};
}
protected function layout():void{
}
public function get forcedHeight():uint{
if (_forcedHeight){
return (_forcedHeight);
};
return (height);
}
public function alignTo(_arg1:Align, _arg2:DisplayObject=null):void{
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:UISprite;
if (_arg2 == null){
if ((parent is Stage)){
_arg2 = this.stage;
} else {
_arg2 = parent;
};
};
if (_arg2 == this.stage){
if (this.stage == null){
return;
};
_local3 = this.stage.stageHeight;
_local4 = this.stage.stageWidth;
_local5 = 0;
_local6 = 0;
} else {
_local7 = (_arg2 as UISprite);
if (_local7.forcedHeight){
_local3 = _local7.forcedHeight;
} else {
_local3 = _local7.height;
};
if (_local7.forcedWidth){
_local4 = _local7.forcedWidth;
} else {
_local4 = _local7.width;
};
_local5 = 0;
_local6 = 0;
};
switch (_arg1){
case Align.top:
x = ((_local4 / 2) - (forcedWidth / 2));
y = (_local6 + margin.top);
break;
case Align.bottom:
x = ((_local4 / 2) - (forcedWidth / 2));
y = (((_local6 + _local3) - forcedHeight) - margin.bottom);
break;
case Align.left:
x = (_local5 + margin.left);
y = ((_local3 / 2) - (forcedHeight / 2));
break;
case Align.right:
x = (((_local5 + _local4) - forcedWidth) - margin.right);
y = ((_local3 / 2) - (forcedHeight / 2));
break;
case Align.center:
x = ((_local4 / 2) - (forcedWidth / 2));
y = ((_local3 / 2) - (forcedHeight / 2));
break;
case Align.topLeft:
x = (_local5 + margin.left);
y = (_local6 + margin.top);
break;
case Align.topRight:
x = (((_local5 + _local4) - forcedWidth) - margin.right);
y = (_local6 + margin.top);
break;
case Align.bottomLeft:
x = (_local5 + margin.left);
y = (((_local6 + _local3) - forcedHeight) - margin.bottom);
break;
case Align.bottomRight:
x = (((_local5 + _local4) - forcedWidth) - margin.right);
y = (((_local6 + _local3) - forcedHeight) - margin.bottom);
break;
};
if (((!(listenResize)) && (!((_arg1 == Align.none))))){
_arg2.addEventListener(Event.RESIZE, onResize, false, 0, true);
listenResize = true;
};
this.alignement = _arg1;
this.alignTarget = _arg2;
}
public function get forcedWidth():uint{
if (_forcedWidth){
return (_forcedWidth);
};
return (width);
}
protected function onResize(_arg1:Event):void{
resize();
}
private function _onRemovedFromStage(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, _onAddedToStage);
removeEventListener(Event.REMOVED_FROM_STAGE, _onRemovedFromStage);
dispose();
}
public function resize():void{
if (alignement != Align.none){
alignTo(alignement, alignTarget);
};
}
private function _onAddedToStage(_arg1:Event):void{
layout();
resize();
}
public function set forcedHeight(_arg1:uint):void{
_forcedHeight = _arg1;
}
public function set forcedWidth(_arg1:uint):void{
_forcedWidth = _arg1;
}
}
}//package com.google.analytics.debug
Section 131
//Warning (com.google.analytics.debug.Warning)
package com.google.analytics.debug {
import flash.events.*;
import flash.utils.*;
public class Warning extends Label {
private var _timer:Timer;
public function Warning(_arg1:String="", _arg2:uint=3000){
super(_arg1, "uiWarning", Style.warningColor, Align.top, false);
margin.top = 32;
if (_arg2 > 0){
_timer = new Timer(_arg2, 1);
_timer.start();
_timer.addEventListener(TimerEvent.TIMER_COMPLETE, onComplete, false, 0, true);
};
}
public function onComplete(_arg1:TimerEvent):void{
close();
}
override public function onLink(_arg1:TextEvent):void{
switch (_arg1.text){
case "hide":
close();
break;
};
}
public function close():void{
if (parent != null){
parent.removeChild(this);
};
}
}
}//package com.google.analytics.debug
Section 132
//VisualDebugMode (com.google.analytics.debug.VisualDebugMode)
package com.google.analytics.debug {
public class VisualDebugMode {
private var _value:int;
private var _name:String;
public static const advanced:VisualDebugMode = new VisualDebugMode(1, "advanced");
;
public static const geek:VisualDebugMode = new VisualDebugMode(2, "geek");
;
public static const basic:VisualDebugMode = new VisualDebugMode(0, "basic");
;
public function VisualDebugMode(_arg1:int=0, _arg2:String=""){
_value = _arg1;
_name = _arg2;
}
public function valueOf():int{
return (_value);
}
public function toString():String{
return (_name);
}
}
}//package com.google.analytics.debug
Section 133
//AnalyticsEvent (com.google.analytics.events.AnalyticsEvent)
package com.google.analytics.events {
import flash.events.*;
import com.google.analytics.*;
public class AnalyticsEvent extends Event {
public var tracker:AnalyticsTracker;
public static const READY:String = "ready";
public function AnalyticsEvent(_arg1:String, _arg2:AnalyticsTracker, _arg3:Boolean=false, _arg4:Boolean=false){
super(_arg1, _arg3, _arg4);
this.tracker = _arg2;
}
override public function clone():Event{
return (new AnalyticsEvent(type, tracker, bubbles, cancelable));
}
}
}//package com.google.analytics.events
Section 134
//AdSenseGlobals (com.google.analytics.external.AdSenseGlobals)
package com.google.analytics.external {
import com.google.analytics.debug.*;
public class AdSenseGlobals extends JavascriptProxy {
private var _gaGlobalVerified:Boolean;// = false
public static var gaGlobal_js:XML = <script>
<![CDATA[
function()
{
try
{
gaGlobal
}
catch(e)
{
gaGlobal = {} ;
}
}
]]>
</script>
;
public function AdSenseGlobals(_arg1:DebugConfiguration){
_gaGlobalVerified = false;
super(_arg1);
}
public function set vid(_arg1:String):void{
if (!isAvailable()){
return;
};
_verify();
setProperty("gaGlobal.vid", _arg1);
}
public function get hid():String{
if (!isAvailable()){
return (null);
};
_verify();
return (getProperty("gaGlobal.hid"));
}
public function get dh():String{
if (!isAvailable()){
return (null);
};
_verify();
return (getProperty("gaGlobal.dh"));
}
public function get gaGlobal():Object{
if (!isAvailable()){
return (null);
};
_verify();
return (getProperty("gaGlobal"));
}
public function set hid(_arg1:String):void{
if (!isAvailable()){
return;
};
_verify();
setProperty("gaGlobal.hid", _arg1);
}
public function get sid():String{
if (!isAvailable()){
return (null);
};
_verify();
return (getProperty("gaGlobal.sid"));
}
private function _verify():void{
if (!_gaGlobalVerified){
executeBlock(gaGlobal_js);
_gaGlobalVerified = true;
};
}
public function get vid():String{
if (!isAvailable()){
return (null);
};
_verify();
return (getProperty("gaGlobal.vid"));
}
public function set sid(_arg1:String):void{
if (!isAvailable()){
return;
};
_verify();
setProperty("gaGlobal.sid", _arg1);
}
}
}//package com.google.analytics.external
Section 135
//HTMLDOM (com.google.analytics.external.HTMLDOM)
package com.google.analytics.external {
import com.google.analytics.debug.*;
public class HTMLDOM extends JavascriptProxy {
private var _referrer:String;
private var _protocol:String;
private var _host:String;
private var _location:String;
private var _pathname:String;
private var _title:String;
private var _characterSet:String;
private var _search:String;
private var _language:String;
private var _colorDepth:String;
public static var cache_properties_js:XML = <script>
<![CDATA[
function()
{
var obj = {};
obj.host = document.location.host;
obj.language = navigator.language ? navigator.language : navigator.browserLanguage;
obj.characterSet = document.characterSet ? document.characterSet : document.charset;
obj.colorDepth = window.screen.colorDepth;
obj.location = document.location.toString();
obj.pathname = document.location.pathname;
obj.protocol = document.location.protocol;
obj.search = document.location.search;
obj.referrer = document.referrer;
obj.title = document.title;
return obj;
}
]]>
</script>
;
public function HTMLDOM(_arg1:DebugConfiguration){
super(_arg1);
}
public function get search():String{
if (_search){
return (_search);
};
if (!isAvailable()){
return (null);
};
_search = getProperty("document.location.search");
return (_search);
}
public function get location():String{
if (_location){
return (_location);
};
if (!isAvailable()){
return (null);
};
_location = getPropertyString("document.location");
return (_location);
}
public function get pathname():String{
if (_pathname){
return (_pathname);
};
if (!isAvailable()){
return (null);
};
_pathname = getProperty("document.location.pathname");
return (_pathname);
}
public function get referrer():String{
if (_referrer){
return (_referrer);
};
if (!isAvailable()){
return (null);
};
_referrer = getProperty("document.referrer");
return (_referrer);
}
public function get protocol():String{
if (_protocol){
return (_protocol);
};
if (!isAvailable()){
return (null);
};
_protocol = getProperty("document.location.protocol");
return (_protocol);
}
public function cacheProperties():void{
var _local1:Object;
if (!isAvailable()){
return;
};
_local1 = call(cache_properties_js);
if (_local1){
_host = _local1.host;
_language = _local1.language;
_characterSet = _local1.characterSet;
_colorDepth = _local1.colorDepth;
_location = _local1.location;
_pathname = _local1.pathname;
_protocol = _local1.protocol;
_search = _local1.search;
_referrer = _local1.referrer;
_title = _local1.title;
};
}
public function get colorDepth():String{
if (_colorDepth){
return (_colorDepth);
};
if (!isAvailable()){
return (null);
};
_colorDepth = getProperty("window.screen.colorDepth");
return (_colorDepth);
}
public function get title():String{
if (_title){
return (_title);
};
if (!isAvailable()){
return (null);
};
_title = getProperty("document.title");
return (_title);
}
public function get host():String{
if (_host){
return (_host);
};
if (!isAvailable()){
return (null);
};
_host = getProperty("document.location.host");
return (_host);
}
public function get characterSet():String{
var _local1:String;
if (_characterSet){
return (_characterSet);
};
if (!isAvailable()){
return (null);
};
_local1 = getProperty("document.characterSet");
if (_local1 == null){
_local1 = getProperty("document.charset");
};
_characterSet = _local1;
return (_characterSet);
}
public function get language():String{
var _local1:String;
if (_language){
return (_language);
};
if (!isAvailable()){
return (null);
};
_local1 = getProperty("navigator.language");
if (_local1 == null){
_local1 = getProperty("navigator.browserLanguage");
};
_language = _local1;
return (_language);
}
}
}//package com.google.analytics.external
Section 136
//JavascriptProxy (com.google.analytics.external.JavascriptProxy)
package com.google.analytics.external {
import flash.system.*;
import com.google.analytics.debug.*;
import flash.external.*;
public class JavascriptProxy {
private var _notAvailableWarning:Boolean;// = true
private var _debug:DebugConfiguration;
public static var setProperty_js:XML = <script>
<![CDATA[
function( path , value )
{
var paths;
var prop;
if( path.indexOf(".") > 0 )
{
paths = path.split(".");
prop = paths.pop() ;
}
else
{
paths = [];
prop = path;
}
var target = window ;
var len = paths.length ;
for( var i = 0 ; i < len ; i++ )
{
target = target[ paths[i] ] ;
}
target[ prop ] = value ;
}
]]>
</script>
;
public static var hasProperty_js:XML = <script>
<![CDATA[
function( path )
{
var paths;
if( path.indexOf(".") > 0 )
{
paths = path.split(".");
}
else
{
paths = [path];
}
var target = window ;
var len = paths.length ;
for( var i = 0 ; i < len ; i++ )
{
target = target[ paths[i] ] ;
}
if( target )
{
return true;
}
else
{
return false;
}
}
]]>
</script>
;
public static var setPropertyRef_js:XML = <script>
<![CDATA[
function( path , target )
{
var paths;
var prop;
if( path.indexOf(".") > 0 )
{
paths = path.split(".");
prop = paths.pop() ;
}
else
{
paths = [];
prop = path;
}
alert( "paths:"+paths.length+", prop:"+prop );
var targets;
var name;
if( target.indexOf(".") > 0 )
{
targets = target.split(".");
name = targets.pop();
}
else
{
targets = [];
name = target;
}
alert( "targets:"+targets.length+", name:"+name );
var root = window;
var len = paths.length;
for( var i = 0 ; i < len ; i++ )
{
root = root[ paths[i] ] ;
}
var ref = window;
var depth = targets.length;
for( var j = 0 ; j < depth ; j++ )
{
ref = ref[ targets[j] ] ;
}
root[ prop ] = ref[name] ;
}
]]>
</script>
;
public function JavascriptProxy(_arg1:DebugConfiguration){
_notAvailableWarning = true;
super();
_debug = _arg1;
}
public function getProperty(_arg1:String){
return (call((_arg1 + ".valueOf")));
}
public function hasProperty(_arg1:String):Boolean{
return (call(hasProperty_js, _arg1));
}
public function setProperty(_arg1:String, _arg2):void{
call(setProperty_js, _arg1, _arg2);
}
public function executeBlock(_arg1:String):void{
var data = _arg1;
if (isAvailable()){
try {
ExternalInterface.call(data);
} catch(e:SecurityError) {
if (_debug.javascript){
_debug.warning("ExternalInterface is not allowed.\nEnsure that allowScriptAccess is set to \"always\" in the Flash embed HTML.");
};
} catch(e:Error) {
if (_debug.javascript){
_debug.warning(("ExternalInterface failed to make the call\nreason: " + e.message));
};
};
};
}
public function getPropertyString(_arg1:String):String{
return (call((_arg1 + ".toString")));
}
public function setPropertyByReference(_arg1:String, _arg2:String):void{
call(setPropertyRef_js, _arg1, _arg2);
}
public function call(_arg1:String, ... _args){
var output:String;
var functionName = _arg1;
var args = _args;
if (isAvailable()){
try {
if (((_debug.javascript) && (_debug.verbose))){
output = "";
output = ("Flash->JS: " + functionName);
output = (output + "( ");
if (args.length > 0){
output = (output + args.join(","));
};
output = (output + " )");
_debug.info(output);
};
args.unshift(functionName);
return (ExternalInterface.call.apply(ExternalInterface, args));
} catch(e:SecurityError) {
if (_debug.javascript){
_debug.warning("ExternalInterface is not allowed.\nEnsure that allowScriptAccess is set to \"always\" in the Flash embed HTML.");
};
} catch(e:Error) {
if (_debug.javascript){
_debug.warning(("ExternalInterface failed to make the call\nreason: " + e.message));
};
};
};
return (null);
}
public function isAvailable():Boolean{
var _local1:Boolean;
_local1 = ExternalInterface.available;
if (((_local1) && ((Capabilities.playerType == "External")))){
_local1 = false;
};
if (((((!(_local1)) && (_debug.javascript))) && (_notAvailableWarning))){
_debug.warning("ExternalInterface is not available.");
_notAvailableWarning = false;
};
return (_local1);
}
}
}//package com.google.analytics.external
Section 137
//Environment (com.google.analytics.utils.Environment)
package com.google.analytics.utils {
import flash.system.*;
import com.google.analytics.core.*;
import com.google.analytics.debug.*;
import com.google.analytics.external.*;
public class Environment {
private var _dom:HTMLDOM;
private var _appName:String;
private var _debug:DebugConfiguration;
private var _appVersion:Version;
private var _url:String;
private var _protocol:Protocols;
private var _userAgent:UserAgent;
public function Environment(_arg1:String="", _arg2:String="", _arg3:String="", _arg4:DebugConfiguration=null, _arg5:HTMLDOM=null){
var _local6:Version;
super();
if (_arg2 == ""){
if (isAIR()){
_arg2 = "AIR";
} else {
_arg2 = "Flash";
};
};
if (_arg3 == ""){
_local6 = flashVersion;
} else {
_local6 = Version.fromString(_arg3);
};
_url = _arg1;
_appName = _arg2;
_appVersion = _local6;
_debug = _arg4;
_dom = _arg5;
}
public function isAIR():Boolean{
return ((((playerType == "Desktop")) && ((Security.sandboxType.toString() == "application"))));
}
public function get playerType():String{
return (Capabilities.playerType);
}
public function get locationSearch():String{
var _local1:String;
_local1 = _dom.search;
if (_local1){
return (_local1);
};
return ("");
}
public function get protocol():Protocols{
if (!_protocol){
_findProtocol();
};
return (_protocol);
}
public function get flashVersion():Version{
var _local1:Version;
_local1 = Version.fromString(Capabilities.version.split(" ")[1], ",");
return (_local1);
}
public function get screenWidth():Number{
return (Capabilities.screenResolutionX);
}
public function get languageEncoding():String{
var _local1:String;
if (System.useCodePage){
_local1 = _dom.characterSet;
if (_local1){
return (_local1);
};
return ("-");
};
return ("UTF-8");
}
public function get appName():String{
return (_appName);
}
public function get screenColorDepth():String{
var _local1:String;
var _local2:String;
switch (Capabilities.screenColor){
case "bw":
_local1 = "1";
break;
case "gray":
_local1 = "2";
break;
case "color":
default:
_local1 = "24";
};
_local2 = _dom.colorDepth;
if (_local2){
_local1 = _local2;
};
return (_local1);
}
private function _findProtocol():void{
var _local1:Protocols;
var _local2:String;
var _local3:String;
var _local4:String;
var _local5:String;
_local1 = Protocols.none;
if (_url != ""){
_local4 = _url.toLowerCase();
_local5 = _local4.substr(0, 5);
switch (_local5){
case "file:":
_local1 = Protocols.file;
break;
case "http:":
_local1 = Protocols.HTTP;
break;
case "https":
if (_local4.charAt(5) == ":"){
_local1 = Protocols.HTTPS;
};
break;
default:
_protocol = Protocols.none;
};
};
_local2 = _dom.protocol;
_local3 = (_local1.toString() + ":").toLowerCase();
if (((((_local2) && (!((_local2 == _local3))))) && (_debug))){
_debug.warning(((("Protocol mismatch: SWF=" + _local3) + ", DOM=") + _local2));
};
_protocol = _local1;
}
public function get locationSWFPath():String{
return (_url);
}
public function get platform():String{
var _local1:String;
_local1 = Capabilities.manufacturer;
return (_local1.split("Adobe ")[1]);
}
public function get operatingSystem():String{
return (Capabilities.os);
}
public function set appName(_arg1:String):void{
_appName = _arg1;
userAgent.applicationProduct = _arg1;
}
public function get userAgent():UserAgent{
if (!_userAgent){
_userAgent = new UserAgent(this, appName, appVersion.toString(4));
};
return (_userAgent);
}
ga_internal function set url(_arg1:String):void{
_url = _arg1;
}
public function get referrer():String{
var _local1:String;
_local1 = _dom.referrer;
if (_local1){
return (_local1);
};
if (protocol == Protocols.file){
return ("localhost");
};
return ("");
}
public function isInHTML():Boolean{
return ((Capabilities.playerType == "PlugIn"));
}
public function get language():String{
var _local1:String;
var _local2:String;
_local1 = _dom.language;
_local2 = Capabilities.language;
if (_local1){
if ((((_local1.length > _local2.length)) && ((_local1.substr(0, _local2.length) == _local2)))){
_local2 = _local1;
};
};
return (_local2);
}
public function get domainName():String{
var _local1:String;
var _local2:String;
var _local3:int;
if ((((protocol == Protocols.HTTP)) || ((protocol == Protocols.HTTPS)))){
_local1 = _url.toLowerCase();
if (protocol == Protocols.HTTP){
_local2 = _local1.split("http://").join("");
} else {
if (protocol == Protocols.HTTPS){
_local2 = _local1.split("https://").join("");
};
};
_local3 = _local2.indexOf("/");
if (_local3 > -1){
_local2 = _local2.substring(0, _local3);
};
return (_local2);
};
if (protocol == Protocols.file){
return ("localhost");
};
return ("");
}
public function set userAgent(_arg1:UserAgent):void{
_userAgent = _arg1;
}
public function set appVersion(_arg1:Version):void{
_appVersion = _arg1;
userAgent.applicationVersion = _arg1.toString(4);
}
public function get screenHeight():Number{
return (Capabilities.screenResolutionY);
}
public function get locationPath():String{
var _local1:String;
_local1 = _dom.pathname;
if (_local1){
return (_local1);
};
return ("");
}
public function get documentTitle():String{
var _local1:String;
_local1 = _dom.title;
if (_local1){
return (_local1);
};
return ("");
}
public function get appVersion():Version{
return (_appVersion);
}
}
}//package com.google.analytics.utils
Section 138
//Protocols (com.google.analytics.utils.Protocols)
package com.google.analytics.utils {
public class Protocols {
private var _value:int;
private var _name:String;
public static const none:Protocols = new Protocols(0, "none");
;
public static const HTTPS:Protocols = new Protocols(3, "HTTPS");
;
public static const file:Protocols = new Protocols(1, "file");
;
public static const HTTP:Protocols = new Protocols(2, "HTTP");
;
public function Protocols(_arg1:int=0, _arg2:String=""){
_value = _arg1;
_name = _arg2;
}
public function valueOf():int{
return (_value);
}
public function toString():String{
return (_name);
}
}
}//package com.google.analytics.utils
Section 139
//Timespan (com.google.analytics.utils.Timespan)
package com.google.analytics.utils {
public class Timespan {
public static var sixmonths:Number = 15768000;
public static var twoyears:Number = 63072000;
public static var thirtyminutes:Number = 1800;
}
}//package com.google.analytics.utils
Section 140
//URL (com.google.analytics.utils.URL)
package com.google.analytics.utils {
public class URL {
private var _url:String;
public function URL(_arg1:String=""){
_url = _arg1.toLowerCase();
}
public function get domain():String{
var _local1:Array;
if (((!((hostName == ""))) && ((hostName.indexOf(".") > -1)))){
_local1 = hostName.split(".");
switch (_local1.length){
case 2:
return (hostName);
case 3:
if (_local1[1] == "co"){
return (hostName);
};
_local1.shift();
return (_local1.join("."));
case 4:
_local1.shift();
return (_local1.join("."));
};
};
return ("");
}
public function get path():String{
var _local1:String = _url;
if (_local1.indexOf("://") > -1){
_local1 = _local1.split("://")[1];
};
if (_local1.indexOf(hostName) == 0){
_local1 = _local1.substr(hostName.length);
};
if (_local1.indexOf("?") > -1){
_local1 = _local1.split("?")[0];
};
if (_local1.charAt(0) != "/"){
_local1 = ("/" + _local1);
};
return (_local1);
}
public function get protocol():Protocols{
var _local1:String = _url.split("://")[0];
switch (_local1){
case "file":
return (Protocols.file);
case "http":
return (Protocols.HTTP);
case "https":
return (Protocols.HTTPS);
default:
return (Protocols.none);
};
}
public function get hostName():String{
var _local1:String = _url;
if (_local1.indexOf("://") > -1){
_local1 = _local1.split("://")[1];
};
if (_local1.indexOf("/") > -1){
_local1 = _local1.split("/")[0];
};
if (_local1.indexOf("?") > -1){
_local1 = _local1.split("?")[0];
};
if ((((protocol == Protocols.file)) || ((protocol == Protocols.none)))){
return ("");
};
return (_local1);
}
public function get subDomain():String{
if (((!((domain == ""))) && (!((domain == hostName))))){
return (hostName.split(("." + domain)).join(""));
};
return ("");
}
public function get search():String{
var _local1:String = _url;
if (_local1.indexOf("://") > -1){
_local1 = _local1.split("://")[1];
};
if (_local1.indexOf(hostName) == 0){
_local1 = _local1.substr(hostName.length);
};
if (_local1.indexOf("?") > -1){
_local1 = _local1.split("?")[1];
} else {
_local1 = "";
};
return (_local1);
}
}
}//package com.google.analytics.utils
Section 141
//UserAgent (com.google.analytics.utils.UserAgent)
package com.google.analytics.utils {
import flash.system.*;
import com.google.analytics.core.*;
public class UserAgent {
private var _version:Version;
private var _localInfo:Environment;
private var _applicationProduct:String;
public static var minimal:Boolean = false;
public function UserAgent(_arg1:Environment, _arg2:String="", _arg3:String=""){
_localInfo = _arg1;
applicationProduct = _arg2;
_version = Version.fromString(_arg3);
}
public function get tamarinProductToken():String{
if (UserAgent.minimal){
return ("");
};
if (System.vmVersion){
return (("Tamarin/" + Utils.trim(System.vmVersion, true)));
};
return ("");
}
public function set applicationProduct(_arg1:String):void{
_applicationProduct = _arg1;
}
public function get applicationVersion():String{
return (_version.toString(2));
}
public function get applicationProductToken():String{
var _local1:String;
_local1 = applicationProduct;
if (applicationVersion != ""){
_local1 = (_local1 + ("/" + applicationVersion));
};
return (_local1);
}
public function get vendorProductToken():String{
var _local1:String;
_local1 = "";
if (_localInfo.isAIR()){
_local1 = (_local1 + "AIR");
} else {
_local1 = (_local1 + "FlashPlayer");
};
_local1 = (_local1 + "/");
_local1 = (_local1 + _version.toString(3));
return (_local1);
}
public function toString():String{
var _local1:String;
_local1 = "";
_local1 = (_local1 + applicationProductToken);
if (applicationComment != ""){
_local1 = (_local1 + (" " + applicationComment));
};
if (tamarinProductToken != ""){
_local1 = (_local1 + (" " + tamarinProductToken));
};
if (vendorProductToken != ""){
_local1 = (_local1 + (" " + vendorProductToken));
};
return (_local1);
}
public function get applicationComment():String{
var _local1:Array;
_local1 = [];
_local1.push(_localInfo.platform);
_local1.push(_localInfo.playerType);
if (!UserAgent.minimal){
_local1.push(_localInfo.operatingSystem);
_local1.push(_localInfo.language);
};
if (Capabilities.isDebugger){
_local1.push("DEBUG");
};
if (_local1.length > 0){
return ((("(" + _local1.join("; ")) + ")"));
};
return ("");
}
public function set applicationVersion(_arg1:String):void{
_version = Version.fromString(_arg1);
}
public function get applicationProduct():String{
return (_applicationProduct);
}
}
}//package com.google.analytics.utils
Section 142
//Variables (com.google.analytics.utils.Variables)
package com.google.analytics.utils {
import flash.net.*;
public dynamic class Variables {
public var post:Array;
public var URIencode:Boolean;
public var pre:Array;
public var sort:Boolean;// = true
public function Variables(_arg1:String=null, _arg2:Array=null, _arg3:Array=null){
pre = [];
post = [];
super();
if (_arg1){
decode(_arg1);
};
if (_arg2){
this.pre = _arg2;
};
if (_arg3){
this.post = _arg3;
};
}
private function _join(_arg1:Variables):void{
var _local2:String;
if (!_arg1){
return;
};
for (_local2 in _arg1) {
this[_local2] = _arg1[_local2];
};
}
public function join(... _args):void{
var _local2:int = _args.length;
var _local3:int;
while (_local3 < _local2) {
if (!(_args[_local3] is Variables)){
} else {
_join(_args[_local3]);
};
_local3++;
};
}
public function toString():String{
var _local2:String;
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:int;
var _local7:String;
var _local8:String;
var _local1:Array = [];
for (_local3 in this) {
_local2 = this[_local3];
if (URIencode){
_local2 = encodeURI(_local2);
};
_local1.push(((_local3 + "=") + _local2));
};
if (sort){
_local1.sort();
};
if (pre.length > 0){
pre.reverse();
_local5 = 0;
while (_local5 < pre.length) {
_local7 = pre[_local5];
_local6 = 0;
while (_local6 < _local1.length) {
_local4 = _local1[_local6];
if (_local4.indexOf(_local7) == 0){
_local1.unshift(_local1.splice(_local6, 1)[0]);
};
_local6++;
};
_local5++;
};
pre.reverse();
};
if (post.length > 0){
_local5 = 0;
while (_local5 < post.length) {
_local8 = post[_local5];
_local6 = 0;
while (_local6 < _local1.length) {
_local4 = _local1[_local6];
if (_local4.indexOf(_local8) == 0){
_local1.push(_local1.splice(_local6, 1)[0]);
};
_local6++;
};
_local5++;
};
};
return (_local1.join("&"));
}
public function decode(_arg1:String):void{
var _local2:Array;
var _local3:String;
var _local4:String;
var _local5:String;
var _local6:Array;
if (_arg1 == ""){
return;
};
if (_arg1.indexOf("&") > -1){
_local2 = _arg1.split("&");
} else {
_local2 = [_arg1];
};
var _local7:int;
while (_local7 < _local2.length) {
_local3 = _local2[_local7];
if (_local3.indexOf("=") > -1){
_local6 = _local3.split("=");
_local4 = _local6[0];
_local5 = decodeURI(_local6[1]);
this[_local4] = _local5;
};
_local7++;
};
}
public function toURLVariables():URLVariables{
var _local2:String;
var _local1:URLVariables = new URLVariables();
for (_local2 in this) {
_local1[_local2] = this[_local2];
};
return (_local1);
}
}
}//package com.google.analytics.utils
Section 143
//Version (com.google.analytics.utils.Version)
package com.google.analytics.utils {
public class Version {
private var _maxBuild:uint;// = 0xFF
private var _maxMinor:uint;// = 15
private var _maxMajor:uint;// = 15
private var _revision:uint;
private var _separator:String;// = "."
private var _maxRevision:uint;// = 0xFFFF
private var _build:uint;
private var _minor:uint;
private var _major:uint;
public function Version(_arg1:uint=0, _arg2:uint=0, _arg3:uint=0, _arg4:uint=0){
var _local5:Version;
_maxMajor = 15;
_maxMinor = 15;
_maxBuild = 0xFF;
_maxRevision = 0xFFFF;
_separator = ".";
super();
if ((((((((_arg1 > _maxMajor)) && ((_arg2 == 0)))) && ((_arg3 == 0)))) && ((_arg4 == 0)))){
_local5 = Version.fromNumber(_arg1);
_arg1 = _local5.major;
_arg2 = _local5.minor;
_arg3 = _local5.build;
_arg4 = _local5.revision;
};
this.major = _arg1;
this.minor = _arg2;
this.build = _arg3;
this.revision = _arg4;
}
public function toString(_arg1:int=0):String{
var _local2:Array;
if ((((_arg1 <= 0)) || ((_arg1 > 4)))){
_arg1 = getFields();
};
switch (_arg1){
case 1:
_local2 = [major];
break;
case 2:
_local2 = [major, minor];
break;
case 3:
_local2 = [major, minor, build];
break;
case 4:
default:
_local2 = [major, minor, build, revision];
};
return (_local2.join(_separator));
}
public function get revision():uint{
return (_revision);
}
public function set build(_arg1:uint):void{
_build = Math.min(_arg1, _maxBuild);
}
public function set minor(_arg1:uint):void{
_minor = Math.min(_arg1, _maxMinor);
}
public function get build():uint{
return (_build);
}
public function set major(_arg1:uint):void{
_major = Math.min(_arg1, _maxMajor);
}
public function get minor():uint{
return (_minor);
}
public function valueOf():uint{
return (((((major << 28) | (minor << 24)) | (build << 16)) | revision));
}
public function get major():uint{
return (_major);
}
public function set revision(_arg1:uint):void{
_revision = Math.min(_arg1, _maxRevision);
}
private function getFields():int{
var _local1:int;
_local1 = 4;
if (revision == 0){
_local1--;
};
if ((((_local1 == 3)) && ((build == 0)))){
_local1--;
};
if ((((_local1 == 2)) && ((minor == 0)))){
_local1--;
};
return (_local1);
}
public function equals(_arg1):Boolean{
if (!(_arg1 is Version)){
return (false);
};
if ((((((((_arg1.major == major)) && ((_arg1.minor == minor)))) && ((_arg1.build == build)))) && ((_arg1.revision == revision)))){
return (true);
};
return (false);
}
public static function fromString(_arg1:String="", _arg2:String="."):Version{
var _local3:Version;
var _local4:Array;
_local3 = new (Version);
if ((((_arg1 == "")) || ((_arg1 == null)))){
return (_local3);
};
if (_arg1.indexOf(_arg2) > -1){
_local4 = _arg1.split(_arg2);
_local3.major = parseInt(_local4[0]);
_local3.minor = parseInt(_local4[1]);
_local3.build = parseInt(_local4[2]);
_local3.revision = parseInt(_local4[3]);
} else {
_local3.major = parseInt(_arg1);
};
return (_local3);
}
public static function fromNumber(_arg1:Number=0):Version{
var _local2:Version;
_local2 = new (Version);
if (((((((((((isNaN(_arg1)) || ((_arg1 == 0)))) || ((_arg1 < 0)))) || ((_arg1 == Number.MAX_VALUE)))) || ((_arg1 == Number.POSITIVE_INFINITY)))) || ((_arg1 == Number.NEGATIVE_INFINITY)))){
return (_local2);
};
_local2.major = (_arg1 >>> 28);
_local2.minor = ((_arg1 & 251658240) >>> 24);
_local2.build = ((_arg1 & 0xFF0000) >>> 16);
_local2.revision = (_arg1 & 0xFFFF);
return (_local2);
}
}
}//package com.google.analytics.utils
Section 144
//Bridge (com.google.analytics.v4.Bridge)
package com.google.analytics.v4 {
import com.google.analytics.core.*;
import com.google.analytics.debug.*;
import com.google.analytics.external.*;
public class Bridge implements GoogleAnalyticsAPI {
private var _debug:DebugConfiguration;
private var _proxy:JavascriptProxy;
private var _jsContainer:String;// = "_GATracker"
private var _hasGATracker:Boolean;// = false
private var _account:String;
private static var _linkTrackingObject_js:XML = <script>
<![CDATA[
function( container , target )
{
var targets ;
var name ;
if( target.indexOf(".") > 0 )
{
targets = target.split(".");
name = targets.pop();
}
else
{
targets = [];
name = target;
}
var ref = window;
var depth = targets.length;
for( var j = 0 ; j < depth ; j++ )
{
ref = ref[ targets[j] ] ;
}
window[container][target] = ref[name] ;
}
]]>
</script>
;
private static var _createTrackingObject_js:XML = <script>
<![CDATA[
function( acct )
{
_GATracker[acct] = _gat._getTracker(acct);
}
]]>
</script>
;
private static var _injectTrackingObject_js:XML = <script>
<![CDATA[
function()
{
try
{
_GATracker
}
catch(e)
{
_GATracker = {};
}
}
]]>
</script>
;
private static var _checkGAJS_js:XML = <script>
<![CDATA[
function()
{
if( _gat && _gat._getTracker )
{
return true;
}
return false;
}
]]>
</script>
;
private static var _checkValidTrackingObject_js:XML = <script>
<![CDATA[
function(acct)
{
if( _GATracker[acct] && (_GATracker[acct]._getAccount) )
{
return true ;
}
else
{
return false;
}
}
]]>
</script>
;
public function Bridge(_arg1:String, _arg2:DebugConfiguration, _arg3:JavascriptProxy){
var _local4:String;
var _local5:String;
var _local6:String;
super();
_account = _arg1;
_debug = _arg2;
_proxy = _arg3;
if (!_checkGAJS()){
_local4 = "";
_local4 = (_local4 + "ga.js not found, be sure to check if\n");
_local4 = (_local4 + "<script src=\"http://www.google-analytics.com/ga.js\"></script>\n");
_local4 = (_local4 + "is included in the HTML.");
_debug.warning(_local4);
throw (new Error(_local4));
};
if (!_hasGATracker){
if (((_debug.javascript) && (_debug.verbose))){
_local5 = "";
_local5 = (_local5 + "The Google Analytics tracking code was not found on the container page\n");
_local5 = (_local5 + "we create it");
_debug.info(_local5, VisualDebugMode.advanced);
};
_injectTrackingObject();
};
if (Utils.validateAccount(_arg1)){
_createTrackingObject(_arg1);
} else {
if (_checkTrackingObject(_arg1)){
_linkTrackingObject(_arg1);
} else {
_local6 = "";
_local6 = (_local6 + (("JS Object \"" + _arg1) + "\" doesn't exist in DOM\n"));
_local6 = (_local6 + "Bridge object not created.");
_debug.warning(_local6);
throw (new Error(_local6));
};
};
}
public function link(_arg1:String, _arg2:Boolean=false):void{
_debug.info((((("link( " + _arg1) + ", ") + _arg2) + " )"));
_call("_link", _arg1, _arg2);
}
public function addOrganic(_arg1:String, _arg2:String):void{
_debug.info((("addOrganic( " + [_arg1, _arg2].join(", ")) + " )"));
_call("_addOrganic", _arg1);
}
public function setAllowLinker(_arg1:Boolean):void{
_debug.info((("setAllowLinker( " + _arg1) + " )"));
_call("_setAllowLinker", _arg1);
}
private function _linkTrackingObject(_arg1:String):void{
_proxy.call(_linkTrackingObject_js, _jsContainer, _arg1);
}
public function trackEvent(_arg1:String, _arg2:String, _arg3:String=null, _arg4:Number=NaN):Boolean{
var _local5 = 2;
if (((_arg3) && (!((_arg3 == ""))))){
_local5 = 3;
};
if ((((_local5 == 3)) && (!(isNaN(_arg4))))){
_local5 = 4;
};
switch (_local5){
case 4:
_debug.info((("trackEvent( " + [_arg1, _arg2, _arg3, _arg4].join(", ")) + " )"));
return (_call("_trackEvent", _arg1, _arg2, _arg3, _arg4));
case 3:
_debug.info((("trackEvent( " + [_arg1, _arg2, _arg3].join(", ")) + " )"));
return (_call("_trackEvent", _arg1, _arg2, _arg3));
case 2:
default:
_debug.info((("trackEvent( " + [_arg1, _arg2].join(", ")) + " )"));
return (_call("_trackEvent", _arg1, _arg2));
};
}
public function setClientInfo(_arg1:Boolean):void{
_debug.info((("setClientInfo( " + _arg1) + " )"));
_call("_setClientInfo", _arg1);
}
public function trackTrans():void{
_debug.info("trackTrans()");
_call("_trackTrans");
}
public function setCookieTimeout(_arg1:int):void{
_debug.info((("setCookieTimeout( " + _arg1) + " )"));
_call("_setCookieTimeout", _arg1);
}
public function trackPageview(_arg1:String=""):void{
_debug.info((("trackPageview( " + _arg1) + " )"));
_call("_trackPageview", _arg1);
}
public function getClientInfo():Boolean{
_debug.info("getClientInfo()");
return (_call("_getClientInfo"));
}
private function _checkValidTrackingObject(_arg1:String):Boolean{
return (_proxy.call(_checkValidTrackingObject_js, _arg1));
}
private function _checkGAJS():Boolean{
return (_proxy.call(_checkGAJS_js));
}
public function linkByPost(_arg1:Object, _arg2:Boolean=false):void{
_debug.warning((((("linkByPost( " + _arg1) + ", ") + _arg2) + " ) not implemented"));
}
private function _call(_arg1:String, ... _args){
_args.unshift(((((("window." + _jsContainer) + "[\"") + _account) + "\"].") + _arg1));
return (_proxy.call.apply(_proxy, _args));
}
public function hasGAJS():Boolean{
return (_checkGAJS());
}
private function _checkTrackingObject(_arg1:String):Boolean{
var _local2:Boolean = _proxy.hasProperty(_arg1);
var _local3:Boolean = _proxy.hasProperty((_arg1 + "._getAccount"));
return (((_local2) && (_local3)));
}
public function resetSession():void{
_debug.warning("resetSession() not implemented");
}
public function getDetectTitle():Boolean{
_debug.info("getDetectTitle()");
return (_call("_getDetectTitle"));
}
public function setCampNameKey(_arg1:String):void{
_debug.info((("setCampNameKey( " + _arg1) + " )"));
_call("_setCampNameKey", _arg1);
}
public function setDetectFlash(_arg1:Boolean):void{
_debug.info((("setDetectFlash( " + _arg1) + " )"));
_call("_setDetectFlash", _arg1);
}
public function createEventTracker(_arg1:String):EventTracker{
_debug.info((("createEventTracker( " + _arg1) + " )"));
return (new EventTracker(_arg1, this));
}
public function addItem(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:Number, _arg6:int):void{
_debug.info((("addItem( " + [_arg1, _arg2, _arg3, _arg4, _arg5, _arg6].join(", ")) + " )"));
_call("_addItem", _arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
}
public function clearIgnoredOrganic():void{
_debug.info("clearIgnoredOrganic()");
_call("_clearIgnoreOrganic");
}
public function setVar(_arg1:String):void{
_debug.info((("setVar( " + _arg1) + " )"));
_call("_setVar", _arg1);
}
public function setDomainName(_arg1:String):void{
_debug.info((("setDomainName( " + _arg1) + " )"));
_call("_setDomainName", _arg1);
}
public function hasTrackingAccount(_arg1:String):Boolean{
if (Utils.validateAccount(_arg1)){
return (_checkValidTrackingObject(_arg1));
};
return (_checkTrackingObject(_arg1));
}
public function setCampSourceKey(_arg1:String):void{
_debug.info((("setCampSourceKey( " + _arg1) + " )"));
_call("_setCampSourceKey", _arg1);
}
public function addTrans(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:String, _arg8:String):Object{
_debug.info((("addTrans( " + [_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8].join(", ")) + " )"));
_call("_addTrans", _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
return (null);
}
public function setCampContentKey(_arg1:String):void{
_debug.info((("setCampContentKey( " + _arg1) + " )"));
_call("_setCampContentKey", _arg1);
}
public function setLocalServerMode():void{
_debug.info("setLocalServerMode()");
_call("_setLocalServerMode");
}
public function getLocalGifPath():String{
_debug.info("getLocalGifPath()");
return (_call("_getLocalGifPath"));
}
public function clearIgnoredRef():void{
_debug.info("clearIgnoredRef()");
_call("_clearIgnoreRef");
}
public function setAllowAnchor(_arg1:Boolean):void{
_debug.info((("setAllowAnchor( " + _arg1) + " )"));
_call("_setAllowAnchor", _arg1);
}
public function setLocalGifPath(_arg1:String):void{
_debug.info((("setLocalGifPath( " + _arg1) + " )"));
_call("_setLocalGifPath", _arg1);
}
public function getVersion():String{
_debug.info("getVersion()");
return (_call("_getVersion"));
}
private function _injectTrackingObject():void{
_proxy.executeBlock(_injectTrackingObject_js);
_hasGATracker = true;
}
public function setCookiePath(_arg1:String):void{
_debug.info((("setCookiePath( " + _arg1) + " )"));
_call("_setCookiePath", _arg1);
}
public function setSampleRate(_arg1:Number):void{
_debug.info((("setSampleRate( " + _arg1) + " )"));
_call("_setSampleRate", _arg1);
}
public function setAllowHash(_arg1:Boolean):void{
_debug.info((("setAllowHash( " + _arg1) + " )"));
_call("_setAllowHash", _arg1);
}
public function addIgnoredOrganic(_arg1:String):void{
_debug.info((("addIgnoredOrganic( " + _arg1) + " )"));
_call("_addIgnoredOrganic", _arg1);
}
public function setCampNOKey(_arg1:String):void{
_debug.info((("setCampNOKey( " + _arg1) + " )"));
_call("_setCampNOKey", _arg1);
}
public function cookiePathCopy(_arg1:String):void{
_debug.info((("cookiePathCopy( " + _arg1) + " )"));
_call("_cookiePathCopy", _arg1);
}
public function setLocalRemoteServerMode():void{
_debug.info("setLocalRemoteServerMode()");
_call("_setLocalRemoteServerMode");
}
public function getServiceMode():ServerOperationMode{
_debug.info("getServiceMode()");
return (_call("_getServiceMode"));
}
public function setDetectTitle(_arg1:Boolean):void{
_debug.info((("setDetectTitle( " + _arg1) + " )"));
_call("_setDetectTitle", _arg1);
}
private function _createTrackingObject(_arg1:String):void{
_proxy.call(_createTrackingObject_js, _arg1);
}
public function setCampaignTrack(_arg1:Boolean):void{
_debug.info((("setCampaignTrack( " + _arg1) + " )"));
_call("_setCampaignTrack", _arg1);
}
public function clearOrganic():void{
_debug.info("clearOrganic()");
_call("_clearOrganic");
}
public function setCampTermKey(_arg1:String):void{
_debug.info((("setCampTermKey( " + _arg1) + " )"));
_call("_setCampTermKey", _arg1);
}
public function getDetectFlash():Boolean{
_debug.info("getDetectFlash()");
return (_call("_getDetectFlash"));
}
public function setCampMediumKey(_arg1:String):void{
_debug.info((("setCampMediumKey( " + _arg1) + " )"));
_call("_setCampMediumKey", _arg1);
}
public function addIgnoredRef(_arg1:String):void{
_debug.info((("addIgnoredRef( " + _arg1) + " )"));
_call("_addIgnoredRef", _arg1);
}
public function setSessionTimeout(_arg1:int):void{
_debug.info((("setSessionTimeout( " + _arg1) + " )"));
_call("_setSessionTimeout", _arg1);
}
public function setRemoteServerMode():void{
_debug.info("setRemoteServerMode()");
_call("_setRemoteServerMode");
}
public function getAccount():String{
_debug.info("getAccount()");
return (_call("_getAccount"));
}
}
}//package com.google.analytics.v4
Section 145
//Configuration (com.google.analytics.v4.Configuration)
package com.google.analytics.v4 {
import com.google.analytics.core.*;
import com.google.analytics.debug.*;
import com.google.analytics.utils.*;
import com.google.analytics.campaign.*;
public class Configuration {
public var serverMode:ServerOperationMode;
public var detectFlash:Boolean;// = true
public var allowLocalTracking:Boolean;// = true
public var secureRemoteGIFpath:String;// = "https://ssl.google-analytics.com/__utm.gif"
public var hasSiteOverlay:Boolean;// = false
private var _version:String;// = "4.3as"
public var allowDomainHash:Boolean;// = true
public var detectClientInfo:Boolean;// = true
public var idleLoop:Number;// = 30
public var isTrackOutboundSubdomains:Boolean;// = false
public var cookiePath:String;// = "/"
public var transactionFieldDelim:String;// = "|"
private var _organic:Organic;
private var _cookieName:String;// = "analytics"
public var campaignKey:CampaignKey;
public var google:String;// = "google"
public var googleCsePath:String;// = "cse"
public var bucketCapacity:Number;// = 10
private var _sampleRate:Number;// = 1
public var remoteGIFpath:String;// = "http://www.google-analytics.com/__utm.gif"
public var googleSearchParam:String;// = "q"
public var allowLinker:Boolean;// = false
public var maxOutboundLinkExamined:Number;// = 1000
private var _debug:DebugConfiguration;
private var _trackingLimitPerSession:int;// = 500
private var _domain:Domain;
public var allowAnchor:Boolean;// = false
public var tokenCliff:int;// = 10
public var sessionTimeout:Number;
public var idleTimeout:Number;// = 60
public var campaignTracking:Boolean;// = true
public var domainName:String;// = ""
public var detectTitle:Boolean;// = true
public var tokenRate:Number;// = 0.2
public var conversionTimeout:Number;
public var localGIFpath:String;// = "/__utm.gif"
public function Configuration(_arg1:DebugConfiguration=null){
_version = "4.3as";
_sampleRate = 1;
_trackingLimitPerSession = 500;
_organic = new Organic();
googleCsePath = "cse";
googleSearchParam = "q";
google = "google";
_cookieName = "analytics";
allowDomainHash = true;
allowAnchor = false;
allowLinker = false;
hasSiteOverlay = false;
tokenRate = 0.2;
conversionTimeout = Timespan.sixmonths;
sessionTimeout = Timespan.thirtyminutes;
idleLoop = 30;
idleTimeout = 60;
maxOutboundLinkExamined = 1000;
tokenCliff = 10;
bucketCapacity = 10;
detectClientInfo = true;
detectFlash = true;
detectTitle = true;
campaignKey = new CampaignKey();
campaignTracking = true;
isTrackOutboundSubdomains = false;
serverMode = ServerOperationMode.remote;
localGIFpath = "/__utm.gif";
remoteGIFpath = "http://www.google-analytics.com/__utm.gif";
secureRemoteGIFpath = "https://ssl.google-analytics.com/__utm.gif";
cookiePath = "/";
transactionFieldDelim = "|";
domainName = "";
allowLocalTracking = true;
super();
_debug = _arg1;
_domain = new Domain(DomainNameMode.auto, "", _debug);
serverMode = ServerOperationMode.remote;
_initOrganicSources();
}
public function get organic():Organic{
return (_organic);
}
public function get trackingLimitPerSession():int{
return (_trackingLimitPerSession);
}
private function _initOrganicSources():void{
addOrganicSource(google, googleSearchParam);
addOrganicSource("yahoo", "p");
addOrganicSource("msn", "q");
addOrganicSource("aol", "query");
addOrganicSource("aol", "encquery");
addOrganicSource("lycos", "query");
addOrganicSource("ask", "q");
addOrganicSource("altavista", "q");
addOrganicSource("netscape", "query");
addOrganicSource("cnn", "query");
addOrganicSource("looksmart", "qt");
addOrganicSource("about", "terms");
addOrganicSource("mamma", "query");
addOrganicSource("alltheweb", "q");
addOrganicSource("gigablast", "q");
addOrganicSource("voila", "rdata");
addOrganicSource("virgilio", "qs");
addOrganicSource("live", "q");
addOrganicSource("baidu", "wd");
addOrganicSource("alice", "qs");
addOrganicSource("yandex", "text");
addOrganicSource("najdi", "q");
addOrganicSource("aol", "q");
addOrganicSource("club-internet", "q");
addOrganicSource("mama", "query");
addOrganicSource("seznam", "q");
addOrganicSource("search", "q");
addOrganicSource("wp", "szukaj");
addOrganicSource("onet", "qt");
addOrganicSource("netsprint", "q");
addOrganicSource("google.interia", "q");
addOrganicSource("szukacz", "q");
addOrganicSource("yam", "k");
addOrganicSource("pchome", "q");
addOrganicSource("kvasir", "searchExpr");
addOrganicSource("sesam", "q");
addOrganicSource("ozu", "q");
addOrganicSource("terra", "query");
addOrganicSource("nostrum", "query");
addOrganicSource("mynet", "q");
addOrganicSource("ekolay", "q");
addOrganicSource("search.ilse", "search_for");
}
public function get sampleRate():Number{
return (_sampleRate);
}
public function get cookieName():String{
return (_cookieName);
}
public function addOrganicSource(_arg1:String, _arg2:String):void{
var engine = _arg1;
var keyword = _arg2;
try {
_organic.addSource(engine, keyword);
} catch(e:Error) {
if (((_debug) && (_debug.active))){
_debug.warning(e.message);
};
};
}
public function get domain():Domain{
return (_domain);
}
public function set sampleRate(_arg1:Number):void{
if (_arg1 <= 0){
_arg1 = 0.1;
};
if (_arg1 > 1){
_arg1 = 1;
};
_arg1 = Number(_arg1.toFixed(2));
_sampleRate = _arg1;
}
public function get version():String{
return (_version);
}
}
}//package com.google.analytics.v4
Section 146
//GoogleAnalyticsAPI (com.google.analytics.v4.GoogleAnalyticsAPI)
package com.google.analytics.v4 {
import com.google.analytics.core.*;
public interface GoogleAnalyticsAPI {
function setCampSourceKey(_arg1:String):void;
function getServiceMode():ServerOperationMode;
function resetSession():void;
function setLocalServerMode():void;
function setCampContentKey(_arg1:String):void;
function addOrganic(_arg1:String, _arg2:String):void;
function setDetectFlash(_arg1:Boolean):void;
function addTrans(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:String, _arg8:String):Object;
function trackEvent(_arg1:String, _arg2:String, _arg3:String=null, _arg4:Number=NaN):Boolean;
function setCampTermKey(_arg1:String):void;
function setCampNameKey(_arg1:String):void;
function addIgnoredOrganic(_arg1:String):void;
function addItem(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:Number, _arg6:int):void;
function setAllowLinker(_arg1:Boolean):void;
function getClientInfo():Boolean;
function getDetectFlash():Boolean;
function setCampaignTrack(_arg1:Boolean):void;
function createEventTracker(_arg1:String):EventTracker;
function setCookieTimeout(_arg1:int):void;
function setAllowAnchor(_arg1:Boolean):void;
function trackTrans():void;
function clearOrganic():void;
function trackPageview(_arg1:String=""):void;
function setLocalGifPath(_arg1:String):void;
function getVersion():String;
function getLocalGifPath():String;
function setVar(_arg1:String):void;
function clearIgnoredOrganic():void;
function setCampMediumKey(_arg1:String):void;
function addIgnoredRef(_arg1:String):void;
function setClientInfo(_arg1:Boolean):void;
function setCookiePath(_arg1:String):void;
function setSampleRate(_arg1:Number):void;
function setSessionTimeout(_arg1:int):void;
function setRemoteServerMode():void;
function clearIgnoredRef():void;
function setDomainName(_arg1:String):void;
function setDetectTitle(_arg1:Boolean):void;
function setAllowHash(_arg1:Boolean):void;
function getAccount():String;
function linkByPost(_arg1:Object, _arg2:Boolean=false):void;
function link(_arg1:String, _arg2:Boolean=false):void;
function setCampNOKey(_arg1:String):void;
function setLocalRemoteServerMode():void;
function cookiePathCopy(_arg1:String):void;
function getDetectTitle():Boolean;
}
}//package com.google.analytics.v4
Section 147
//Tracker (com.google.analytics.v4.Tracker)
package com.google.analytics.v4 {
import com.google.analytics.core.*;
import com.google.analytics.debug.*;
import com.google.analytics.external.*;
import com.google.analytics.utils.*;
import com.google.analytics.data.*;
import com.google.analytics.campaign.*;
public class Tracker implements GoogleAnalyticsAPI {
private const EVENT_TRACKER_LABEL_KEY_NUM:int = 3;
private const EVENT_TRACKER_VALUE_VALUE_NUM:int = 1;
private const EVENT_TRACKER_PROJECT_ID:int = 5;
private const EVENT_TRACKER_OBJECT_NAME_KEY_NUM:int = 1;
private const EVENT_TRACKER_TYPE_KEY_NUM:int = 2;
private var _adSense:AdSenseGlobals;
private var _eventTracker:X10;
private var _noSessionInformation:Boolean;// = false
private var _browserInfo:BrowserInfo;
private var _debug:DebugConfiguration;
private var _isNewVisitor:Boolean;// = false
private var _buffer:Buffer;
private var _config:Configuration;
private var _x10Module:X10;
private var _campaign:CampaignManager;
private var _formatedReferrer:String;
private var _timeStamp:Number;
private var _info:Environment;
private var _domainHash:Number;
private var _campaignInfo:CampaignInfo;
private var _gifRequest:GIFRequest;
private var _hasInitData:Boolean;// = false
private var _account:String;
public function Tracker(_arg1:String, _arg2:Configuration, _arg3:DebugConfiguration, _arg4:Environment, _arg5:Buffer, _arg6:GIFRequest, _arg7:AdSenseGlobals){
var _local8:String;
super();
_account = _arg1;
_config = _arg2;
_debug = _arg3;
_info = _arg4;
_buffer = _arg5;
_gifRequest = _arg6;
_adSense = _arg7;
if (!Utils.validateAccount(_arg1)){
_local8 = (("Account \"" + _arg1) + "\" is not valid.");
_debug.warning(_local8);
throw (new Error(_local8));
};
_initData();
}
private function _doTracking():Boolean{
if (((((!((_info.protocol == Protocols.file))) && (!((_info.protocol == Protocols.none))))) && (_isNotGoogleSearch()))){
return (true);
};
if (_config.allowLocalTracking){
return (true);
};
return (false);
}
public function addOrganic(_arg1:String, _arg2:String):void{
_debug.info((("addOrganic( " + [_arg1, _arg2].join(", ")) + " )"));
_config.organic.addSource(_arg1, _arg2);
}
public function setAllowLinker(_arg1:Boolean):void{
_config.allowLinker = _arg1;
_debug.info((("setAllowLinker( " + _config.allowLinker) + " )"));
}
public function trackEvent(_arg1:String, _arg2:String, _arg3:String=null, _arg4:Number=NaN):Boolean{
var _local5:Boolean;
var _local6 = 2;
if (((!((_arg1 == ""))) && (!((_arg2 == ""))))){
_eventTracker.clearKey(EVENT_TRACKER_PROJECT_ID);
_eventTracker.clearValue(EVENT_TRACKER_PROJECT_ID);
_local5 = _eventTracker.setKey(EVENT_TRACKER_PROJECT_ID, EVENT_TRACKER_OBJECT_NAME_KEY_NUM, _arg1);
_local5 = _eventTracker.setKey(EVENT_TRACKER_PROJECT_ID, EVENT_TRACKER_TYPE_KEY_NUM, _arg2);
if (((_arg3) && (!((_arg3 == ""))))){
_local5 = _eventTracker.setKey(EVENT_TRACKER_PROJECT_ID, EVENT_TRACKER_LABEL_KEY_NUM, _arg3);
_local6 = 3;
if (!isNaN(_arg4)){
_local5 = _eventTracker.setValue(EVENT_TRACKER_PROJECT_ID, EVENT_TRACKER_VALUE_VALUE_NUM, _arg4);
_local6 = 4;
};
};
if (_local5){
_debug.info(((("valid event tracking call\ncategory: " + _arg1) + "\naction: ") + _arg2), VisualDebugMode.geek);
_sendXEvent(_eventTracker);
};
} else {
_debug.warning(((("event tracking call is not valid, failed!\ncategory: " + _arg1) + "\naction: ") + _arg2), VisualDebugMode.geek);
_local5 = false;
};
switch (_local6){
case 4:
_debug.info((("trackEvent( " + [_arg1, _arg2, _arg3, _arg4].join(", ")) + " )"));
break;
case 3:
_debug.info((("trackEvent( " + [_arg1, _arg2, _arg3].join(", ")) + " )"));
break;
case 2:
default:
_debug.info((("trackEvent( " + [_arg1, _arg2].join(", ")) + " )"));
};
return (_local5);
}
public function trackPageview(_arg1:String=""):void{
_debug.info((("trackPageview( " + _arg1) + " )"));
if (_doTracking()){
_initData();
_trackMetrics(_arg1);
_noSessionInformation = false;
} else {
_debug.warning((("trackPageview( " + _arg1) + " ) failed"));
};
}
public function setCookieTimeout(_arg1:int):void{
_config.conversionTimeout = _arg1;
_debug.info((("setCookieTimeout( " + _config.conversionTimeout) + " )"));
}
public function trackTrans():void{
_debug.warning("trackTrans() not implemented");
}
public function setClientInfo(_arg1:Boolean):void{
_config.detectClientInfo = _arg1;
_debug.info((("setClientInfo( " + _config.detectClientInfo) + " )"));
}
public function linkByPost(_arg1:Object, _arg2:Boolean=false):void{
_debug.warning((("linkByPost( " + [_arg1, _arg2].join(", ")) + " ) not implemented"));
}
private function _initData():void{
var _local1:String;
var _local2:String;
if (!_hasInitData){
_updateDomainName();
_domainHash = _getDomainHash();
_timeStamp = Math.round((new Date().getTime() / 1000));
if (_debug.verbose){
_local1 = "";
_local1 = (_local1 + "_initData 0");
_local1 = (_local1 + ("\ndomain name: " + _config.domainName));
_local1 = (_local1 + ("\ndomain hash: " + _domainHash));
_local1 = (_local1 + (((("\ntimestamp: " + _timeStamp) + " (") + new Date((_timeStamp * 1000))) + ")"));
_debug.info(_local1, VisualDebugMode.geek);
};
};
if (_doTracking()){
_handleCookie();
};
if (!_hasInitData){
if (_doTracking()){
_formatedReferrer = _formatReferrer();
_browserInfo = new BrowserInfo(_config, _info);
_debug.info(("browserInfo: " + _browserInfo.toURLString()), VisualDebugMode.advanced);
if (_config.campaignTracking){
_campaign = new CampaignManager(_config, _debug, _buffer, _domainHash, _formatedReferrer, _timeStamp);
_campaignInfo = _campaign.getCampaignInformation(_info.locationSearch, _noSessionInformation);
_debug.info(("campaignInfo: " + _campaignInfo.toURLString()), VisualDebugMode.advanced);
};
};
_x10Module = new X10();
_eventTracker = new X10();
_hasInitData = true;
};
if (_config.hasSiteOverlay){
_debug.warning("Site Overlay is not supported");
};
if (_debug.verbose){
_local2 = "";
_local2 = (_local2 + "_initData (misc)");
_local2 = (_local2 + ("\nflash version: " + _info.flashVersion.toString(4)));
_local2 = (_local2 + ("\nprotocol: " + _info.protocol));
_local2 = (_local2 + (("\ndefault domain name (auto): \"" + _info.domainName) + "\""));
_local2 = (_local2 + ("\nlanguage: " + _info.language));
_local2 = (_local2 + ("\ndomain hash: " + _getDomainHash()));
_local2 = (_local2 + ("\nuser-agent: " + _info.userAgent));
_debug.info(_local2, VisualDebugMode.geek);
};
}
public function getDetectTitle():Boolean{
_debug.info("getDetectTitle()");
return (_config.detectTitle);
}
public function resetSession():void{
_debug.info("resetSession()");
_buffer.resetCurrentSession();
}
public function getClientInfo():Boolean{
_debug.info("getClientInfo()");
return (_config.detectClientInfo);
}
private function _sendXEvent(_arg1:X10=null):void{
var _local2:Variables;
var _local3:EventInfo;
var _local4:Variables;
var _local5:Variables;
_initData();
if (_takeSample()){
_local2 = new Variables();
_local2.URIencode = true;
_local3 = new EventInfo(true, _x10Module, _arg1);
_local4 = _local3.toVariables();
_local5 = _renderMetricsSearchVariables();
_local2.join(_local4, _local5);
_gifRequest.send(_account, _local2, false, true);
};
}
public function setDetectFlash(_arg1:Boolean):void{
_config.detectFlash = _arg1;
_debug.info((("setDetectFlash( " + _config.detectFlash) + " )"));
}
public function setCampNameKey(_arg1:String):void{
_config.campaignKey.UCCN = _arg1;
var _local2 = (("setCampNameKey( " + _config.campaignKey.UCCN) + " )");
if (_debug.mode == VisualDebugMode.geek){
_debug.info((_local2 + " [UCCN]"));
} else {
_debug.info(_local2);
};
}
private function _formatReferrer():String{
var _local2:String;
var _local3:URL;
var _local4:URL;
var _local1:String = _info.referrer;
if ((((_local1 == "")) || ((_local1 == "localhost")))){
_local1 = "-";
} else {
_local2 = _info.domainName;
_local3 = new URL(_local1);
_local4 = new URL(("http://" + _local2));
if (_local3.hostName == _local2){
return ("-");
};
if (_local4.domain == _local3.domain){
if (_local4.subDomain != _local3.subDomain){
_local1 = "0";
};
};
if ((((_local1.charAt(0) == "[")) && (_local1.charAt((_local1.length - 1))))){
_local1 = "-";
};
};
_debug.info(("formated referrer: " + _local1), VisualDebugMode.advanced);
return (_local1);
}
private function _visitCode():Number{
if (_debug.verbose){
_debug.info(("visitCode: " + _buffer.utma.sessionId), VisualDebugMode.geek);
};
return (_buffer.utma.sessionId);
}
public function createEventTracker(_arg1:String):EventTracker{
_debug.info((("createEventTracker( " + _arg1) + " )"));
return (new EventTracker(_arg1, this));
}
public function addItem(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:Number, _arg6:int):void{
_debug.warning((("addItem( " + [_arg1, _arg2, _arg3, _arg4, _arg5, _arg6].join(", ")) + " ) not implemented"));
}
public function clearIgnoredOrganic():void{
_debug.info("clearIgnoredOrganic()");
_config.organic.clearIgnoredKeywords();
}
public function setVar(_arg1:String):void{
var _local2:Variables;
if (((!((_arg1 == ""))) && (_isNotGoogleSearch()))){
_initData();
_buffer.utmv.domainHash = _domainHash;
_buffer.utmv.value = _arg1;
if (_debug.verbose){
_debug.info(_buffer.utmv.toString(), VisualDebugMode.geek);
};
_debug.info((("setVar( " + _arg1) + " )"));
if (_takeSample()){
_local2 = new Variables();
_local2.utmt = "var";
_gifRequest.send(_account, _local2);
};
} else {
_debug.warning((("setVar \"" + _arg1) + "\" is ignored"));
};
}
public function setDomainName(_arg1:String):void{
if (_arg1 == "auto"){
_config.domain.mode = DomainNameMode.auto;
} else {
if (_arg1 == "none"){
_config.domain.mode = DomainNameMode.none;
} else {
_config.domain.mode = DomainNameMode.custom;
_config.domain.name = _arg1;
};
};
_updateDomainName();
_debug.info((("setDomainName( " + _config.domainName) + " )"));
}
private function _updateDomainName():void{
var _local1:String;
if (_config.domain.mode == DomainNameMode.auto){
_local1 = _info.domainName;
if (_local1.substring(0, 4) == "www."){
_local1 = _local1.substring(4);
};
_config.domain.name = _local1;
};
_config.domainName = _config.domain.name.toLowerCase();
_debug.info(("domain name: " + _config.domainName), VisualDebugMode.advanced);
}
public function addTrans(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:String, _arg8:String):Object{
_debug.warning((("addTrans( " + [_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8].join(", ")) + " ) not implemented"));
return (null);
}
private function _renderMetricsSearchVariables(_arg1:String=""):Variables{
var _local4:Variables;
var _local2:Variables = new Variables();
_local2.URIencode = true;
var _local3:DocumentInfo = new DocumentInfo(_config, _info, _formatedReferrer, _arg1, _adSense);
_debug.info(("docInfo: " + _local3.toURLString()), VisualDebugMode.geek);
if (_config.campaignTracking){
_local4 = _campaignInfo.toVariables();
};
var _local5:Variables = _browserInfo.toVariables();
_local2.join(_local3.toVariables(), _local5, _local4);
return (_local2);
}
public function setCampContentKey(_arg1:String):void{
_config.campaignKey.UCCT = _arg1;
var _local2 = (("setCampContentKey( " + _config.campaignKey.UCCT) + " )");
if (_debug.mode == VisualDebugMode.geek){
_debug.info((_local2 + " [UCCT]"));
} else {
_debug.info(_local2);
};
}
private function _handleCookie():void{
var _local1:String;
var _local2:String;
var _local3:Array;
var _local4:String;
if (_config.allowLinker){
};
if (((_buffer.hasUTMA()) && (!(_buffer.utma.isEmpty())))){
if (((!(_buffer.hasUTMB())) || (!(_buffer.hasUTMC())))){
_buffer.updateUTMA(_timeStamp);
_noSessionInformation = true;
};
if (_debug.verbose){
_debug.info(("from cookie " + _buffer.utma.toString()), VisualDebugMode.geek);
};
} else {
_debug.info("create a new utma", VisualDebugMode.advanced);
_buffer.utma.domainHash = _domainHash;
_buffer.utma.sessionId = _getUniqueSessionId();
_buffer.utma.firstTime = _timeStamp;
_buffer.utma.lastTime = _timeStamp;
_buffer.utma.currentTime = _timeStamp;
_buffer.utma.sessionCount = 1;
if (_debug.verbose){
_debug.info(_buffer.utma.toString(), VisualDebugMode.geek);
};
_noSessionInformation = true;
_isNewVisitor = true;
};
if (((_adSense.gaGlobal) && ((_adSense.dh == String(_domainHash))))){
if (_adSense.sid){
_buffer.utma.currentTime = Number(_adSense.sid);
if (_debug.verbose){
_local1 = "";
_local1 = (_local1 + "AdSense sid found\n");
_local1 = (_local1 + (((("Override currentTime(" + _buffer.utma.currentTime) + ") from AdSense sid(") + Number(_adSense.sid)) + ")"));
_debug.info(_local1, VisualDebugMode.geek);
};
};
if (_isNewVisitor){
if (_adSense.sid){
_buffer.utma.lastTime = Number(_adSense.sid);
if (_debug.verbose){
_local2 = "";
_local2 = (_local2 + "AdSense sid found (new visitor)\n");
_local2 = (_local2 + (((("Override lastTime(" + _buffer.utma.lastTime) + ") from AdSense sid(") + Number(_adSense.sid)) + ")"));
_debug.info(_local2, VisualDebugMode.geek);
};
};
if (_adSense.vid){
_local3 = _adSense.vid.split(".");
_buffer.utma.sessionId = Number(_local3[0]);
_buffer.utma.firstTime = Number(_local3[1]);
if (_debug.verbose){
_local4 = "";
_local4 = (_local4 + "AdSense vid found (new visitor)\n");
_local4 = (_local4 + (((("Override sessionId(" + _buffer.utma.sessionId) + ") from AdSense vid(") + Number(_local3[0])) + ")\n"));
_local4 = (_local4 + (((("Override firstTime(" + _buffer.utma.firstTime) + ") from AdSense vid(") + Number(_local3[1])) + ")"));
_debug.info(_local4, VisualDebugMode.geek);
};
};
if (_debug.verbose){
_debug.info(("AdSense modified : " + _buffer.utma.toString()), VisualDebugMode.geek);
};
};
};
_buffer.utmb.domainHash = _domainHash;
if (isNaN(_buffer.utmb.trackCount)){
_buffer.utmb.trackCount = 0;
};
if (isNaN(_buffer.utmb.token)){
_buffer.utmb.token = _config.tokenCliff;
};
if (isNaN(_buffer.utmb.lastTime)){
_buffer.utmb.lastTime = _buffer.utma.currentTime;
};
_buffer.utmc.domainHash = _domainHash;
if (_debug.verbose){
_debug.info(_buffer.utmb.toString(), VisualDebugMode.advanced);
_debug.info(_buffer.utmc.toString(), VisualDebugMode.advanced);
};
}
public function setLocalServerMode():void{
_config.serverMode = ServerOperationMode.local;
_debug.info("setLocalServerMode()");
}
public function clearIgnoredRef():void{
_debug.info("clearIgnoredRef()");
_config.organic.clearIgnoredReferrals();
}
public function setCampSourceKey(_arg1:String):void{
_config.campaignKey.UCSR = _arg1;
var _local2 = (("setCampSourceKey( " + _config.campaignKey.UCSR) + " )");
if (_debug.mode == VisualDebugMode.geek){
_debug.info((_local2 + " [UCSR]"));
} else {
_debug.info(_local2);
};
}
public function getLocalGifPath():String{
_debug.info("getLocalGifPath()");
return (_config.localGIFpath);
}
public function setLocalGifPath(_arg1:String):void{
_config.localGIFpath = _arg1;
_debug.info((("setLocalGifPath( " + _config.localGIFpath) + " )"));
}
public function getVersion():String{
_debug.info("getVersion()");
return (_config.version);
}
public function setAllowAnchor(_arg1:Boolean):void{
_config.allowAnchor = _arg1;
_debug.info((("setAllowAnchor( " + _config.allowAnchor) + " )"));
}
private function _isNotGoogleSearch():Boolean{
var _local1:String = _config.domainName;
var _local2 = (_local1.indexOf("www.google.") < 0);
var _local3 = (_local1.indexOf(".google.") < 0);
var _local4 = (_local1.indexOf("google.") < 0);
var _local5 = (_local1.indexOf("google.org") > -1);
return (((((((((_local2) || (_local3))) || (_local4))) || (!((_config.cookiePath == "/"))))) || (_local5)));
}
public function setSampleRate(_arg1:Number):void{
if (_arg1 < 0){
_debug.warning("sample rate can not be negative, ignoring value.");
} else {
_config.sampleRate = _arg1;
};
_debug.info((("setSampleRate( " + _config.sampleRate) + " )"));
}
private function _takeSample():Boolean{
if (_debug.verbose){
_debug.info((((("takeSample: (" + (_visitCode() % 10000)) + ") < (") + (_config.sampleRate * 10000)) + ")"), VisualDebugMode.geek);
};
return (((_visitCode() % 10000) < (_config.sampleRate * 10000)));
}
public function setCookiePath(_arg1:String):void{
_config.cookiePath = _arg1;
_debug.info((("setCookiePath( " + _config.cookiePath) + " )"));
}
public function setAllowHash(_arg1:Boolean):void{
_config.allowDomainHash = _arg1;
_debug.info((("setAllowHash( " + _config.allowDomainHash) + " )"));
}
private function _generateUserDataHash():Number{
var _local1 = "";
_local1 = (_local1 + _info.appName);
_local1 = (_local1 + _info.appVersion);
_local1 = (_local1 + _info.language);
_local1 = (_local1 + _info.platform);
_local1 = (_local1 + _info.userAgent.toString());
_local1 = (_local1 + (((_info.screenWidth + "x") + _info.screenHeight) + _info.screenColorDepth));
_local1 = (_local1 + _info.referrer);
return (Utils.generateHash(_local1));
}
public function setCampNOKey(_arg1:String):void{
_config.campaignKey.UCNO = _arg1;
var _local2 = (("setCampNOKey( " + _config.campaignKey.UCNO) + " )");
if (_debug.mode == VisualDebugMode.geek){
_debug.info((_local2 + " [UCNO]"));
} else {
_debug.info(_local2);
};
}
public function addIgnoredOrganic(_arg1:String):void{
_debug.info((("addIgnoredOrganic( " + _arg1) + " )"));
_config.organic.addIgnoredKeyword(_arg1);
}
public function setLocalRemoteServerMode():void{
_config.serverMode = ServerOperationMode.both;
_debug.info("setLocalRemoteServerMode()");
}
public function cookiePathCopy(_arg1:String):void{
_debug.warning((("cookiePathCopy( " + _arg1) + " ) not implemented"));
}
public function setDetectTitle(_arg1:Boolean):void{
_config.detectTitle = _arg1;
_debug.info((("setDetectTitle( " + _config.detectTitle) + " )"));
}
public function setCampTermKey(_arg1:String):void{
_config.campaignKey.UCTR = _arg1;
var _local2 = (("setCampTermKey( " + _config.campaignKey.UCTR) + " )");
if (_debug.mode == VisualDebugMode.geek){
_debug.info((_local2 + " [UCTR]"));
} else {
_debug.info(_local2);
};
}
public function getServiceMode():ServerOperationMode{
_debug.info("getServiceMode()");
return (_config.serverMode);
}
private function _trackMetrics(_arg1:String=""):void{
var _local2:Variables;
var _local3:Variables;
var _local4:Variables;
var _local5:EventInfo;
if (_takeSample()){
_local2 = new Variables();
_local2.URIencode = true;
if (((_x10Module) && (_x10Module.hasData()))){
_local5 = new EventInfo(false, _x10Module);
_local3 = _local5.toVariables();
};
_local4 = _renderMetricsSearchVariables(_arg1);
_local2.join(_local3, _local4);
_gifRequest.send(_account, _local2);
};
}
public function setCampaignTrack(_arg1:Boolean):void{
_config.campaignTracking = _arg1;
_debug.info((("setCampaignTrack( " + _config.campaignTracking) + " )"));
}
public function addIgnoredRef(_arg1:String):void{
_debug.info((("addIgnoredRef( " + _arg1) + " )"));
_config.organic.addIgnoredReferral(_arg1);
}
public function clearOrganic():void{
_debug.info("clearOrganic()");
_config.organic.clearEngines();
}
public function getDetectFlash():Boolean{
_debug.info("getDetectFlash()");
return (_config.detectFlash);
}
public function setCampMediumKey(_arg1:String):void{
_config.campaignKey.UCMD = _arg1;
var _local2 = (("setCampMediumKey( " + _config.campaignKey.UCMD) + " )");
if (_debug.mode == VisualDebugMode.geek){
_debug.info((_local2 + " [UCMD]"));
} else {
_debug.info(_local2);
};
}
private function _getUniqueSessionId():Number{
var _local1:Number = ((Utils.generate32bitRandom() ^ _generateUserDataHash()) * 2147483647);
_debug.info(("Session ID: " + _local1), VisualDebugMode.geek);
return (_local1);
}
private function _getDomainHash():Number{
if (((((!(_config.domainName)) || ((_config.domainName == "")))) || ((_config.domain.mode == DomainNameMode.none)))){
_config.domainName = "";
return (1);
};
_updateDomainName();
if (_config.allowDomainHash){
return (Utils.generateHash(_config.domainName));
};
return (1);
}
public function setSessionTimeout(_arg1:int):void{
_config.sessionTimeout = _arg1;
_debug.info((("setSessionTimeout( " + _config.sessionTimeout) + " )"));
}
public function getAccount():String{
_debug.info("getAccount()");
return (_account);
}
public function link(_arg1:String, _arg2:Boolean=false):void{
_debug.warning((("link( " + [_arg1, _arg2].join(", ")) + " ) not implemented"));
}
public function setRemoteServerMode():void{
_config.serverMode = ServerOperationMode.remote;
_debug.info("setRemoteServerMode()");
}
}
}//package com.google.analytics.v4
Section 148
//AnalyticsTracker (com.google.analytics.AnalyticsTracker)
package com.google.analytics {
import flash.events.*;
import com.google.analytics.v4.*;
import com.google.analytics.debug.*;
public interface AnalyticsTracker extends GoogleAnalyticsAPI, IEventDispatcher {
function set config(_arg1:Configuration):void;
function isReady():Boolean;
function get mode():String;
function set debug(_arg1:DebugConfiguration):void;
function get account():String;
function set mode(_arg1:String):void;
function get config():Configuration;
function get debug():DebugConfiguration;
function set account(_arg1:String):void;
function get visualDebug():Boolean;
function set visualDebug(_arg1:Boolean):void;
}
}//package com.google.analytics
Section 149
//API (com.google.analytics.API)
package com.google.analytics {
import com.google.analytics.utils.*;
public class API {
public static var version:Version = new Version();
version.major = 1;
version.minor = 0;
version.build = 1;
version.revision = "$Rev: 319 $ ".split(" ")[1];
}
}//package com.google.analytics
Section 150
//GATracker (com.google.analytics.GATracker)
package com.google.analytics {
import flash.events.*;
import flash.display.*;
import com.google.analytics.core.*;
import com.google.analytics.v4.*;
import com.google.analytics.debug.*;
import com.google.analytics.external.*;
import com.google.analytics.utils.*;
import com.google.analytics.events.*;
public class GATracker implements AnalyticsTracker {
private var _adSense:AdSenseGlobals;
private var _env:Environment;
private var _visualDebug:Boolean;
private var _idleTimer:IdleTimer;
private var _debug:DebugConfiguration;
private var _buffer:Buffer;
private var _config:Configuration;
private var _mode:String;
private var _display:DisplayObject;
private var _jsproxy:JavascriptProxy;
private var _dom:HTMLDOM;
private var _eventDispatcher:EventDispatcher;
private var _ready:Boolean;// = false
private var _gifRequest:GIFRequest;
private var _account:String;
private var _tracker:GoogleAnalyticsAPI;
public static var version:Version = API.version;
public static var autobuild:Boolean = true;
public function GATracker(_arg1:DisplayObject, _arg2:String, _arg3:String="AS3", _arg4:Boolean=false, _arg5:Configuration=null, _arg6:DebugConfiguration=null){
_ready = false;
super();
_display = _arg1;
_eventDispatcher = new EventDispatcher(this);
_tracker = new TrackerCache();
this.account = _arg2;
this.mode = _arg3;
this.visualDebug = _arg4;
if (!_arg6){
this.debug = new DebugConfiguration();
};
if (!_arg5){
this.config = new Configuration(_arg6);
};
if (autobuild){
_factory();
};
}
public function link(_arg1:String, _arg2:Boolean=false):void{
_tracker.link(_arg1, _arg2);
}
public function addOrganic(_arg1:String, _arg2:String):void{
_tracker.addOrganic(_arg1, _arg2);
}
public function setAllowLinker(_arg1:Boolean):void{
_tracker.setAllowLinker(_arg1);
}
public function trackEvent(_arg1:String, _arg2:String, _arg3:String=null, _arg4:Number=NaN):Boolean{
return (_tracker.trackEvent(_arg1, _arg2, _arg3, _arg4));
}
public function setCookieTimeout(_arg1:int):void{
_tracker.setCookieTimeout(_arg1);
}
public function trackTrans():void{
_tracker.trackTrans();
}
public function trackPageview(_arg1:String=""):void{
_tracker.trackPageview(_arg1);
}
public function getClientInfo():Boolean{
return (_tracker.getClientInfo());
}
public function setClientInfo(_arg1:Boolean):void{
_tracker.setClientInfo(_arg1);
}
public function get account():String{
return (_account);
}
public function linkByPost(_arg1:Object, _arg2:Boolean=false):void{
_tracker.linkByPost(_arg1, _arg2);
}
public function getDetectTitle():Boolean{
return (_tracker.getDetectTitle());
}
public function dispatchEvent(_arg1:Event):Boolean{
return (_eventDispatcher.dispatchEvent(_arg1));
}
public function get config():Configuration{
return (_config);
}
public function set mode(_arg1:String):void{
_mode = _arg1;
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
_eventDispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
public function setDetectFlash(_arg1:Boolean):void{
_tracker.setDetectFlash(_arg1);
}
public function resetSession():void{
_tracker.resetSession();
}
public function setCampNameKey(_arg1:String):void{
_tracker.setCampNameKey(_arg1);
}
public function get debug():DebugConfiguration{
return (_debug);
}
public function addItem(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:Number, _arg6:int):void{
_tracker.addItem(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
}
private function _bridgeFactory():GoogleAnalyticsAPI{
debug.info(((("GATracker (Bridge) v" + version) + "\naccount: ") + account));
return (new Bridge(account, _debug, _jsproxy));
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
_eventDispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public function clearIgnoredOrganic():void{
_tracker.clearIgnoredOrganic();
}
public function set account(_arg1:String):void{
_account = _arg1;
}
public function setVar(_arg1:String):void{
_tracker.setVar(_arg1);
}
public function build():void{
if (!isReady()){
_factory();
};
}
public function setDomainName(_arg1:String):void{
_tracker.setDomainName(_arg1);
}
public function createEventTracker(_arg1:String):EventTracker{
return (_tracker.createEventTracker(_arg1));
}
public function set config(_arg1:Configuration):void{
_config = _arg1;
}
public function addTrans(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:String, _arg8:String):Object{
return (_tracker.addTrans(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8));
}
public function setCampSourceKey(_arg1:String):void{
_tracker.setCampSourceKey(_arg1);
}
public function setCampContentKey(_arg1:String):void{
_tracker.setCampContentKey(_arg1);
}
public function willTrigger(_arg1:String):Boolean{
return (_eventDispatcher.willTrigger(_arg1));
}
public function setLocalServerMode():void{
_tracker.setLocalServerMode();
}
public function isReady():Boolean{
return (_ready);
}
public function getLocalGifPath():String{
return (_tracker.getLocalGifPath());
}
public function setAllowAnchor(_arg1:Boolean):void{
_tracker.setAllowAnchor(_arg1);
}
public function clearIgnoredRef():void{
_tracker.clearIgnoredRef();
}
public function get mode():String{
return (_mode);
}
public function set debug(_arg1:DebugConfiguration):void{
_debug = _arg1;
}
public function setLocalGifPath(_arg1:String):void{
_tracker.setLocalGifPath(_arg1);
}
public function getVersion():String{
return (_tracker.getVersion());
}
public function setSampleRate(_arg1:Number):void{
_tracker.setSampleRate(_arg1);
}
public function setCookiePath(_arg1:String):void{
_tracker.setCookiePath(_arg1);
}
public function setAllowHash(_arg1:Boolean):void{
_tracker.setAllowHash(_arg1);
}
public function setCampNOKey(_arg1:String):void{
_tracker.setCampNOKey(_arg1);
}
public function addIgnoredOrganic(_arg1:String):void{
_tracker.addIgnoredOrganic(_arg1);
}
public function setLocalRemoteServerMode():void{
_tracker.setLocalRemoteServerMode();
}
public function cookiePathCopy(_arg1:String):void{
_tracker.cookiePathCopy(_arg1);
}
private function _factory():void{
var _local1:GoogleAnalyticsAPI;
var _local2:TrackerCache;
_jsproxy = new JavascriptProxy(debug);
if (visualDebug){
debug.layout = new Layout(debug, _display);
debug.active = visualDebug;
};
_local2 = (_tracker as TrackerCache);
switch (mode){
case TrackerMode.BRIDGE:
_local1 = _bridgeFactory();
break;
case TrackerMode.AS3:
default:
_local1 = _trackerFactory();
};
if (!_local2.isEmpty()){
_local2.tracker = _local1;
_local2.flush();
};
_tracker = _local1;
_ready = true;
dispatchEvent(new AnalyticsEvent(AnalyticsEvent.READY, this));
}
public function setCampTermKey(_arg1:String):void{
_tracker.setCampTermKey(_arg1);
}
private function _trackerFactory():GoogleAnalyticsAPI{
debug.info(((("GATracker (AS3) v" + version) + "\naccount: ") + account));
_adSense = new AdSenseGlobals(debug);
_dom = new HTMLDOM(debug);
_dom.cacheProperties();
_env = new Environment("", "", "", debug, _dom);
_buffer = new Buffer(config, debug, false);
_gifRequest = new GIFRequest(config, debug, _buffer, _env);
_idleTimer = new IdleTimer(config, debug, _display, _buffer);
_env.url = _display.stage.loaderInfo.url;
return (new Tracker(account, config, debug, _env, _buffer, _gifRequest, _adSense));
}
public function setDetectTitle(_arg1:Boolean):void{
_tracker.setDetectTitle(_arg1);
}
public function getServiceMode():ServerOperationMode{
return (_tracker.getServiceMode());
}
public function clearOrganic():void{
_tracker.clearOrganic();
}
public function setCampaignTrack(_arg1:Boolean):void{
_tracker.setCampaignTrack(_arg1);
}
public function addIgnoredRef(_arg1:String):void{
_tracker.addIgnoredRef(_arg1);
}
public function set visualDebug(_arg1:Boolean):void{
_visualDebug = _arg1;
}
public function setCampMediumKey(_arg1:String):void{
_tracker.setCampMediumKey(_arg1);
}
public function setSessionTimeout(_arg1:int):void{
_tracker.setSessionTimeout(_arg1);
}
public function getDetectFlash():Boolean{
return (_tracker.getDetectFlash());
}
public function get visualDebug():Boolean{
return (_visualDebug);
}
public function getAccount():String{
return (_tracker.getAccount());
}
public function hasEventListener(_arg1:String):Boolean{
return (_eventDispatcher.hasEventListener(_arg1));
}
public function setRemoteServerMode():void{
_tracker.setRemoteServerMode();
}
}
var _local1:* = ServerOperationMode;
return (_local1);
}//package com.google.analytics
Section 151
//ColorMatrix (com.gskinner.geom.ColorMatrix)
package com.gskinner.geom {
public dynamic class ColorMatrix extends Array {
private static const IDENTITY_MATRIX:Array = [1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1];
private static const LENGTH:Number = IDENTITY_MATRIX.length;
private static const DELTA_INDEX:Array = [0, 0.01, 0.02, 0.04, 0.05, 0.06, 0.07, 0.08, 0.1, 0.11, 0.12, 0.14, 0.15, 0.16, 0.17, 0.18, 0.2, 0.21, 0.22, 0.24, 0.25, 0.27, 0.28, 0.3, 0.32, 0.34, 0.36, 0.38, 0.4, 0.42, 0.44, 0.46, 0.48, 0.5, 0.53, 0.56, 0.59, 0.62, 0.65, 0.68, 0.71, 0.74, 0.77, 0.8, 0.83, 0.86, 0.89, 0.92, 0.95, 0.98, 1, 1.06, 1.12, 1.18, 1.24, 1.3, 1.36, 1.42, 1.48, 1.54, 1.6, 1.66, 1.72, 1.78, 1.84, 1.9, 1.96, 2, 2.12, 2.25, 2.37, 2.5, 2.62, 2.75, 2.87, 3, 3.2, 3.4, 3.6, 3.8, 4, 4.3, 4.7, 4.9, 5, 5.5, 6, 6.5, 6.8, 7, 7.3, 7.5, 7.8, 8, 8.4, 8.7, 9, 9.4, 9.6, 9.8, 10];
public function ColorMatrix(_arg1:Array=null){
_arg1 = fixMatrix(_arg1);
copyMatrix(((_arg1.length)==LENGTH) ? _arg1 : IDENTITY_MATRIX);
}
public function adjustBrightness(_arg1:Number):void{
_arg1 = cleanValue(_arg1, 100);
if ((((_arg1 == 0)) || (isNaN(_arg1)))){
return;
};
multiplyMatrix([1, 0, 0, 0, _arg1, 0, 1, 0, 0, _arg1, 0, 0, 1, 0, _arg1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
}
public function adjustSaturation(_arg1:Number):void{
_arg1 = cleanValue(_arg1, 100);
if ((((_arg1 == 0)) || (isNaN(_arg1)))){
return;
};
var _local2:Number = (1 + ((_arg1)>0) ? ((3 * _arg1) / 100) : (_arg1 / 100));
var _local3:Number = 0.3086;
var _local4:Number = 0.6094;
var _local5:Number = 0.082;
multiplyMatrix([((_local3 * (1 - _local2)) + _local2), (_local4 * (1 - _local2)), (_local5 * (1 - _local2)), 0, 0, (_local3 * (1 - _local2)), ((_local4 * (1 - _local2)) + _local2), (_local5 * (1 - _local2)), 0, 0, (_local3 * (1 - _local2)), (_local4 * (1 - _local2)), ((_local5 * (1 - _local2)) + _local2), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
}
protected function multiplyMatrix(_arg1:Array):void{
var _local4:uint;
var _local5:Number;
var _local6:Number;
var _local2:Array = [];
var _local3:uint;
while (_local3 < 5) {
_local4 = 0;
while (_local4 < 5) {
_local2[_local4] = this[(_local4 + (_local3 * 5))];
_local4++;
};
_local4 = 0;
while (_local4 < 5) {
_local5 = 0;
_local6 = 0;
while (_local6 < 5) {
_local5 = (_local5 + (_arg1[(_local4 + (_local6 * 5))] * _local2[_local6]));
_local6++;
};
this[(_local4 + (_local3 * 5))] = _local5;
_local4++;
};
_local3++;
};
}
protected function cleanValue(_arg1:Number, _arg2:Number):Number{
return (Math.min(_arg2, Math.max(-(_arg2), _arg1)));
}
public function adjustHue(_arg1:Number):void{
_arg1 = ((cleanValue(_arg1, 180) / 180) * Math.PI);
if ((((_arg1 == 0)) || (isNaN(_arg1)))){
return;
};
var _local2:Number = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
var _local4:Number = 0.213;
var _local5:Number = 0.715;
var _local6:Number = 0.072;
multiplyMatrix([((_local4 + (_local2 * (1 - _local4))) + (_local3 * -(_local4))), ((_local5 + (_local2 * -(_local5))) + (_local3 * -(_local5))), ((_local6 + (_local2 * -(_local6))) + (_local3 * (1 - _local6))), 0, 0, ((_local4 + (_local2 * -(_local4))) + (_local3 * 0.143)), ((_local5 + (_local2 * (1 - _local5))) + (_local3 * 0.14)), ((_local6 + (_local2 * -(_local6))) + (_local3 * -0.283)), 0, 0, ((_local4 + (_local2 * -(_local4))) + (_local3 * -((1 - _local4)))), ((_local5 + (_local2 * -(_local5))) + (_local3 * _local5)), ((_local6 + (_local2 * (1 - _local6))) + (_local3 * _local6)), 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
}
public function toString():String{
return ((("ColorMatrix [ " + this.join(" , ")) + " ]"));
}
protected function fixMatrix(_arg1:Array=null):Array{
if (_arg1 == null){
return (IDENTITY_MATRIX);
};
if ((_arg1 is ColorMatrix)){
_arg1 = _arg1.slice(0);
};
if (_arg1.length < LENGTH){
_arg1 = _arg1.slice(0, _arg1.length).concat(IDENTITY_MATRIX.slice(_arg1.length, LENGTH));
} else {
if (_arg1.length > LENGTH){
_arg1 = _arg1.slice(0, LENGTH);
};
};
return (_arg1);
}
public function reset():void{
var _local1:uint;
while (_local1 < LENGTH) {
this[_local1] = IDENTITY_MATRIX[_local1];
_local1++;
};
}
public function adjustContrast(_arg1:Number):void{
var _local2:Number;
_arg1 = cleanValue(_arg1, 100);
if ((((_arg1 == 0)) || (isNaN(_arg1)))){
return;
};
if (_arg1 < 0){
_local2 = (127 + ((_arg1 / 100) * 127));
} else {
_local2 = (_arg1 % 1);
if (_local2 == 0){
_local2 = DELTA_INDEX[_arg1];
} else {
_local2 = ((DELTA_INDEX[(_arg1 << 0)] * (1 - _local2)) + (DELTA_INDEX[((_arg1 << 0) + 1)] * _local2));
};
_local2 = ((_local2 * 127) + 127);
};
multiplyMatrix([(_local2 / 127), 0, 0, 0, (0.5 * (127 - _local2)), 0, (_local2 / 127), 0, 0, (0.5 * (127 - _local2)), 0, 0, (_local2 / 127), 0, (0.5 * (127 - _local2)), 0, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
}
public function adjustColor(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
adjustHue(_arg4);
adjustContrast(_arg2);
adjustBrightness(_arg1);
adjustSaturation(_arg3);
}
protected function copyMatrix(_arg1:Array):void{
var _local2:Number = LENGTH;
var _local3:uint;
while (_local3 < _local2) {
this[_local3] = _arg1[_local3];
_local3++;
};
}
public function concat(_arg1:Array):void{
_arg1 = fixMatrix(_arg1);
if (_arg1.length != LENGTH){
return;
};
multiplyMatrix(_arg1);
}
public function clone():ColorMatrix{
return (new ColorMatrix(this));
}
public function toArray():Array{
return (slice(0, 20));
}
}
}//package com.gskinner.geom
Section 152
//ArrayList (com.kavalok.collections.ArrayList)
package com.kavalok.collections {
import com.kavalok.interfaces.*;
import flash.net.*;
import com.kavalok.utils.*;
import com.kavalok.utils.sorting.*;
public dynamic class ArrayList extends Array {
public function ArrayList(_arg1:Array=null){
var _local2:Object;
super();
if (_arg1){
for each (_local2 in _arg1) {
push(_local2);
};
};
}
public function get random(){
return (getItemAt(Maths.random(length)));
}
public function setItems(_arg1:Array, _arg2:int):void{
var _local4:Object;
if ((((_arg2 < 0)) || ((_arg1.length > (length - _arg2))))){
throw (new RangeError((((((("Argument 'beginIndex' [" + _arg2) + "] is out of range, this is less than 0 or the 'beginIndex' plus the length of the given 'list' [") + _arg1.length) + "] is greater than this ArrayList's length [") + length) + "].")));
};
var _local3:int = _arg2;
for each (_local4 in _arg1) {
var _temp1 = _local3;
_local3 = (_local3 + 1);
var _local7 = _temp1;
this[_local7] = _local4;
};
}
public function getItemIndex(_arg1:Object):int{
return (indexOf(_arg1));
}
public function removeItemAt(_arg1:uint):Object{
return (splice(_arg1, 1)[0]);
}
public function removeFirst(){
return (removeItemAt(0));
}
public function addFirst(_arg1:Object):void{
unshift(_arg1);
}
public function addItem(_arg1:Object):void{
push(_arg1);
}
public function sortBy(_arg1:IComparer):void{
new QuickSorter().sort(this, _arg1);
}
public function get last(){
return (getItemAt((length - 1)));
}
public function addLast(_arg1:Object):void{
addItem(_arg1);
}
public function removeItems(_arg1:Array):void{
var _local2:Object;
for each (_local2 in _arg1) {
removeItem(_local2);
};
}
public function clone():Object{
var _local1:ArrayList = new ArrayList();
_local1.addItems(this);
return (_local1);
}
public function getItemIndices(_arg1:Object):ArrayList{
var _local2:ArrayList = new ArrayList();
var _local3:uint;
while (_local3 < length) {
if (getItemAt(_local3) == _arg1){
_local2.addItem(_local3);
};
_local3++;
};
return (_local2);
}
public function addItems(_arg1:Array):void{
Arrays.insertAll(this, _arg1);
}
public function containsItems(_arg1:Array):Boolean{
var _local3:Object;
var _local2:Boolean;
for each (_local3 in _arg1) {
if (!contains(_local3)){
_local2 = false;
break;
};
};
return (_local2);
}
public function getItemAt(_arg1:uint){
return (this[_arg1]);
}
public function contains(_arg1:Object):Boolean{
return (!((indexOf(_arg1) == -1)));
}
public function addItemAt(_arg1:uint, _arg2:Object):void{
splice(_arg1, 0, _arg2);
}
public function setItemAt(_arg1:Object, _arg2:uint){
var _local3:* = this[_arg2];
this[_arg2] = _arg1;
return (_local3);
}
public function replaceItems(_arg1:int, _arg2:int):void{
Arrays.replaceItems(this, _arg1, _arg2);
}
public function replaceItem(_arg1:Object, _arg2:Object):void{
var _local3:uint = indexOf(_arg1);
this[_local3] = _arg2;
}
public function get first(){
return (getItemAt(0));
}
public function removeItem(_arg1:Object):void{
removeItemAt(indexOf(_arg1));
}
public function removeLast(){
return (removeItemAt((this.length - 1)));
}
public function retainItems(_arg1:ArrayList):void{
var _local2:int;
while ((((_local2 < length)) && ((length > 0)))) {
if (_arg1.contains(getItemAt(_local2))){
_local2++;
} else {
removeItemAt(_local2);
};
};
}
public function subList(_arg1:int, _arg2:int):Array{
return (slice(_arg1, (_arg1 + _arg2)));
}
public static function initialize():void{
registerClassAlias("com.kavalok.collections.ArrayList", ArrayList);
}
}
}//package com.kavalok.collections
Section 153
//Locations (com.kavalok.constants.Locations)
package com.kavalok.constants {
import com.kavalok.utils.*;
public class Locations {
public static const GAME_WORMS:String = "gameSweetBattle";
public static const MISSION_FARM:String = "missionFarm";
public static const LOC_ECO_SHOP:String = "locEcoShop";
public static const LOC_GAMES:String = "locGames";
public static const LOC_0:String = "loc0";
public static const LOC_1:String = "loc1";
public static const LOC_ACC_SHOP:String = "locAccShop";
public static const LOC_3:String = "loc3";
public static const LOC_5:String = "loc5";
public static const LOC_2:String = "loc2";
public static const LOC_CAFE:String = "locCafe";
public static const LOC_GRAPHITY:String = "locGraphity";
public static const LOC_GRAPHITY_A:String = "locGraphityA";
public static const LOC_MISSIONS:String = "locMissions";
public static const LOC_MAGIC_SHOP:String = "locMagicShop";
public static const LOC_ECO:String = "locEco";
public static const LOC_MUSIC:String = "locMusic";
public static const LOC_PARK:String = "locPark";
public static const LOC_ROPE:String = "locationRope";
public static const LOC_ACADEMY:String = "locAcademy";
public static const GAME_MONEY:String = "gameMoney";
public static const LOC_ACADEMY_ROOM:String = "locAcademyRoom";
public static const GAME_GARBAGE_COLLECTOR:String = "gameGarbageCollector";
public static function getRandomLocation():String{
return (Arrays.randomItem(list));
}
public static function get list():Array{
var _local1:Array = [LOC_0, LOC_1, LOC_2, LOC_3, LOC_5, LOC_ROPE, LOC_CAFE, LOC_PARK, LOC_ACC_SHOP, LOC_ECO_SHOP, LOC_ECO, LOC_MAGIC_SHOP, LOC_ACADEMY, LOC_ACADEMY_ROOM, LOC_GAMES, LOC_MUSIC, LOC_GRAPHITY, LOC_GRAPHITY_A, LOC_MISSIONS];
return (_local1);
}
public static function isLocation(_arg1:String):Boolean{
return ((_arg1.indexOf("loc") == 0));
}
}
}//package com.kavalok.constants
Section 154
//IllegalArgumentError (com.kavalok.errors.IllegalArgumentError)
package com.kavalok.errors {
public class IllegalArgumentError extends Error {
public function IllegalArgumentError(_arg1:String){
super(_arg1);
}
}
}//package com.kavalok.errors
Section 155
//IllegalStateError (com.kavalok.errors.IllegalStateError)
package com.kavalok.errors {
public class IllegalStateError extends Error {
public function IllegalStateError(_arg1:String=""){
super(_arg1);
}
}
}//package com.kavalok.errors
Section 156
//ArgumentRemover (com.kavalok.events.ArgumentRemover)
package com.kavalok.events {
public class ArgumentRemover {
private var _handler:Function;
public function ArgumentRemover(_arg1:Function){
_handler = _arg1;
}
public function handle(_arg1:Object=null):void{
_handler();
}
}
}//package com.kavalok.events
Section 157
//ArgumentReplacer (com.kavalok.events.ArgumentReplacer)
package com.kavalok.events {
public class ArgumentReplacer {
private var _handler:Function;
private var _newArgument:Object;
public function ArgumentReplacer(_arg1:Function, _arg2:Object){
_handler = _arg1;
_newArgument = _arg2;
}
public function handle(_arg1:Object=null):void{
_handler(_newArgument);
}
}
}//package com.kavalok.events
Section 158
//EventSender (com.kavalok.events.EventSender)
package com.kavalok.events {
import com.kavalok.utils.*;
public class EventSender {
private var _listeners:Array;
private var _type:Class;
public static var errorHandler:Function;
public function EventSender(_arg1:Class=null){
_listeners = [];
super();
_type = _arg1;
}
public function removeListenerIfHas(_arg1:Function):void{
if (_listeners.indexOf(_arg1) != -1){
_listeners.splice(_listeners.indexOf(_arg1), 1);
};
}
public function addListenerIfHasNot(_arg1:Function):void{
if (!hasListener(_arg1)){
addListener(_arg1);
};
}
public function hasListeners():Boolean{
return ((_listeners.length > 0));
}
public function hasListener(_arg1:Function):Boolean{
return (!((_listeners.indexOf(_arg1) == -1)));
}
public function sendEvent(_arg1=undefined):void{
var i:int;
var listener:Function;
var eventObject = _arg1;
var listenersCopy:Array = _listeners.slice();
if ((((_type == null)) || (((!((_type == null))) && ((eventObject is _type)))))){
i = 0;
while (i < listenersCopy.length) {
listener = Objects.castToFunction(listenersCopy[i]);
if (eventObject == undefined){
if (errorHandler != null){
try {
listener();
} catch(e:Error) {
errorHandler(e);
};
} else {
listener();
};
} else {
if (errorHandler != null){
try {
listener(eventObject);
} catch(e:Error) {
errorHandler(e);
};
} else {
listener(eventObject);
};
};
i = (i + 1);
};
} else {
throw (new TypeError("The eventObject has incorrect event type!"));
};
}
public function addListener(_arg1:Function):void{
_listeners.push(_arg1);
}
public function setListener(_arg1:Function):void{
removeListeners();
_listeners.push(_arg1);
}
public function removeListener(_arg1:Function):void{
if (_listeners.indexOf(_arg1) == -1){
throw (new Error("List doesn't contain such listener"));
};
_listeners.splice(_listeners.indexOf(_arg1), 1);
}
public function removeListeners():void{
_listeners = new Array();
}
}
}//package com.kavalok.events
Section 159
//ButtonBase (com.kavalok.gameplay.controls.ButtonBase)
package com.kavalok.gameplay.controls {
import flash.events.*;
import flash.display.*;
public class ButtonBase {
public var highliteOnOver:Boolean;// = true
private var _content:MovieClip;
protected var over:Boolean;
public function ButtonBase(_arg1:MovieClip){
_content = _arg1;
_content.mouseChildren = false;
_content.useHandCursor = true;
_content.buttonMode = true;
_content.addEventListener(MouseEvent.ROLL_OVER, onRollOver);
_content.addEventListener(MouseEvent.ROLL_OUT, onRollOut);
_content.gotoAndStop(1);
}
protected function invalidate():void{
if (((over) && (highliteOnOver))){
_content.gotoAndStop(2);
_content.addEventListener(Event.ENTER_FRAME, onEnterFrame);
} else {
_content.gotoAndStop(1);
if (_content.hasEventListener(Event.ENTER_FRAME)){
_content.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
};
};
}
protected function onEnterFrame(_arg1:Event):void{
if (_content.stage == null){
_content.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
return;
};
if (!_content.hitTestPoint(_content.stage.mouseX, _content.stage.mouseY)){
onMouseOut();
};
}
protected function onMouseOut():void{
over = false;
invalidate();
}
private function onRollOver(_arg1:MouseEvent):void{
over = true;
invalidate();
}
private function onRollOut(_arg1:MouseEvent):void{
over = false;
invalidate();
}
public function get content():MovieClip{
return (_content);
}
}
}//package com.kavalok.gameplay.controls
Section 160
//FlashViewBase (com.kavalok.gameplay.controls.FlashViewBase)
package com.kavalok.gameplay.controls {
import flash.display.*;
public class FlashViewBase implements IFlashView {
private var _content:Sprite;
public function FlashViewBase(_arg1:Sprite){
_content = _arg1;
}
public function get content():Sprite{
return (_content);
}
}
}//package com.kavalok.gameplay.controls
Section 161
//IFlashView (com.kavalok.gameplay.controls.IFlashView)
package com.kavalok.gameplay.controls {
import flash.display.*;
public interface IFlashView {
function get content():Sprite;
}
}//package com.kavalok.gameplay.controls
Section 162
//ToggleButton (com.kavalok.gameplay.controls.ToggleButton)
package com.kavalok.gameplay.controls {
import flash.events.*;
import flash.display.*;
public class ToggleButton extends ButtonBase {
private var _toggle:Boolean;// = false
public function ToggleButton(_arg1:MovieClip){
super(_arg1);
_arg1.addEventListener(MouseEvent.CLICK, onClick);
_arg1.buttonMode = true;
_arg1.mouseChildren = false;
_arg1.useHandCursor = true;
}
public function get toggle():Boolean{
return (_toggle);
}
public function set toggle(_arg1:Boolean):void{
_toggle = _arg1;
invalidate();
}
private function onClick(_arg1:MouseEvent):void{
toggle = !(toggle);
}
override protected function invalidate():void{
super.invalidate();
if (((((over) && (highliteOnOver))) || (_toggle))){
if (((_toggle) && ((content.totalFrames > 2)))){
content.gotoAndStop(3);
} else {
content.gotoAndStop(2);
};
} else {
content.gotoAndStop(1);
};
}
}
}//package com.kavalok.gameplay.controls
Section 163
//KavalokConstants (com.kavalok.gameplay.KavalokConstants)
package com.kavalok.gameplay {
import flash.geom.*;
import com.kavalok.constants.*;
public class KavalokConstants {
public static const PRICE_12_M:String = "57.99";
public static const LOGIN_PATTERN:RegExp = /[a-zA-Z0-9_]+/g;
public static const PASSWORD_LENGTH:uint = 64;
public static const SCREEN_WIDTH:Number = 900;
public static const MONEY_CHAR:String = "";
public static const ANALYTICS_ID:String = "UA-5914122-1";
public static const LOGIN_LENGTH:uint = 16;
public static const TIPS_COUNT:int = 29;
public static const OTHERS_MESSAGE_FORMAT:String = "<font color='#DD5E14'><b>{0}:</b></font> {1}";
public static const DEFAULT_FONT:String = "Tahoma";
public static const PRICE_1_M:String = "6.99";
public static const PRICE_3_M:String = "16.99";
public static const LOCALES:Array = ["uaUA", "enUS", "ruRU"];
public static const EMAIL_EXP:RegExp = /[a-zA-Z0-9._%-]+@[a-zA-Z0-9-.]+\.[a-zA-Z]{2,255}/;
public static const MAX_TEXT_LENGTH:uint = 150;
public static const MY_MESSAGE_FORMAT:String = "<font color='#4785C4'><b>{0}:</b></font> {1}";
public static const LOGIN_CHARS:String = "a-zA-Z0-9_";
public static const MESSAGES_RESTRICT:String = "^~@$%&*+{}[]"|\/<>\^";
public static const MODAL_SHADOW_ALPHA:Number = 0.5;
public static const STARTUP_LOCS:Array = [Locations.LOC_0, Locations.LOC_3, Locations.LOC_PARK];
public static const MODAL_SHADOW_COLOR:Number = 0;
public static const CITIZEN_MONEY_MULTIPLIER:Number = 2;
public static const SCREEN_HEIGHT:Number = 510;
public static const LOCATION_PREFIX:String = "loc";
public static const SCREEN_RECT:Rectangle = new Rectangle(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
public static const MAX_CHAT_WORD:uint = 30;
public static const MAX_CHAT_CHARS:uint = 150;
public static const PRICE_6_M:String = "29.99";
public static const WIDGET_CHAR:String = "widgetChar";
public static const PET_CHARS:String = "a-zA-Z0-9_";
public static var LOCALIZATION_URL_FORMAT:String = "resources/localization/{0}.{1}.xml";
}
}//package com.kavalok.gameplay
Section 164
//ICommand (com.kavalok.interfaces.ICommand)
package com.kavalok.interfaces {
public interface ICommand {
function execute():void;
}
}//package com.kavalok.interfaces
Section 165
//IComparer (com.kavalok.interfaces.IComparer)
package com.kavalok.interfaces {
public interface IComparer {
function compare(_arg1:Object, _arg2:Object):int;
}
}//package com.kavalok.interfaces
Section 166
//IConverter (com.kavalok.interfaces.IConverter)
package com.kavalok.interfaces {
public interface IConverter {
function convert(_arg1:Object):Object;
}
}//package com.kavalok.interfaces
Section 167
//IRequirement (com.kavalok.interfaces.IRequirement)
package com.kavalok.interfaces {
public interface IRequirement {
function meet(_arg1:Object):Boolean;
}
}//package com.kavalok.interfaces
Section 168
//ISorter (com.kavalok.interfaces.ISorter)
package com.kavalok.interfaces {
import com.kavalok.collections.*;
public interface ISorter {
function sort(_arg1:ArrayList, _arg2:IComparer):void;
}
}//package com.kavalok.interfaces
Section 169
//FieldDescription (com.kavalok.utils.common.FieldDescription)
package com.kavalok.utils.common {
public class FieldDescription extends MemberDescription {
public function FieldDescription(_arg1:String, _arg2:Class){
super(_arg1, _arg2);
}
}
}//package com.kavalok.utils.common
Section 170
//MemberDescription (com.kavalok.utils.common.MemberDescription)
package com.kavalok.utils.common {
public class MemberDescription {
private var _clazz:Class;
private var _name:String;
public function MemberDescription(_arg1:String, _arg2:Class){
_name = _arg1;
_clazz = _arg2;
}
public function get clazz():Class{
return (_clazz);
}
public function get name():String{
return (_name);
}
}
}//package com.kavalok.utils.common
Section 171
//ClassRequirement (com.kavalok.utils.comparing.ClassRequirement)
package com.kavalok.utils.comparing {
import com.kavalok.interfaces.*;
public class ClassRequirement implements IRequirement {
private var _class:Class;
public function ClassRequirement(_arg1:Class){
_class = _arg1;
}
public function set clazz(_arg1:Class):void{
_class = _arg1;
}
public function meet(_arg1:Object):Boolean{
return ((_arg1 is _class));
}
public function get clazz():Class{
return (_class);
}
}
}//package com.kavalok.utils.comparing
Section 172
//ComparingResult (com.kavalok.utils.comparing.ComparingResult)
package com.kavalok.utils.comparing {
public final class ComparingResult {
public static const SMALLER:int = -1;
public static const GREATER:int = 1;
public static const EQUALS:int = 0;
}
}//package com.kavalok.utils.comparing
Section 173
//PropertyCompareRequirement (com.kavalok.utils.comparing.PropertyCompareRequirement)
package com.kavalok.utils.comparing {
import com.kavalok.interfaces.*;
import com.kavalok.utils.*;
public class PropertyCompareRequirement implements IRequirement {
private var _propertyValue:Object;
private var _propertyName:String;
public function PropertyCompareRequirement(_arg1:String, _arg2:Object){
_propertyName = _arg1;
_propertyValue = _arg2;
}
public function get propertyName():String{
return (_propertyName);
}
public function meet(_arg1:Object):Boolean{
return ((Objects.getProperty(_arg1, _propertyName) === propertyValue));
}
public function set propertyName(_arg1:String):void{
_propertyName = _arg1;
}
public function set propertyValue(_arg1:Object):void{
_propertyValue = _arg1;
}
public function get propertyValue():Object{
return (_propertyValue);
}
}
}//package com.kavalok.utils.comparing
Section 174
//ToPropertyValueConverter (com.kavalok.utils.converting.ToPropertyValueConverter)
package com.kavalok.utils.converting {
import com.kavalok.interfaces.*;
import com.kavalok.utils.*;
public class ToPropertyValueConverter implements IConverter {
private var _propertyName:String;
public function ToPropertyValueConverter(_arg1:String){
_propertyName = _arg1;
}
public function convert(_arg1:Object):Object{
return (Objects.getProperty(_arg1, _propertyName));
}
}
}//package com.kavalok.utils.converting
Section 175
//QuickSorter (com.kavalok.utils.sorting.QuickSorter)
package com.kavalok.utils.sorting {
import com.kavalok.collections.*;
import com.kavalok.interfaces.*;
import com.kavalok.utils.comparing.*;
public class QuickSorter implements ISorter {
private var _comparer:IComparer;
private var _list:ArrayList;
private function executeSort(_arg1:uint, _arg2:uint):void{
var _local5:Object;
var _local6:Object;
var _local3:Number = _arg1;
var _local4:Number = ((_arg1 + _arg2) - 1);
var _local7:uint = uint((_arg1 + (_arg2 / 2)));
_local5 = _list.getItemAt(_local7);
do {
while (_comparer.compare(_list.getItemAt(_local3), _local5) == ComparingResult.SMALLER) {
_local3++;
};
while (_comparer.compare(_list.getItemAt(_local4), _local5) == ComparingResult.GREATER) {
_local4--;
};
if (_local3 <= _local4){
_local6 = _list.getItemAt(_local3);
_list.setItemAt(_list.getItemAt(_local4), _local3);
_list.setItemAt(_local6, _local4);
_local3++;
_local4--;
};
} while (_local3 <= _local4);
if (_local4 > _arg1){
executeSort(_arg1, ((_local4 - _arg1) + 1));
};
if ((_arg1 + _arg2) > _local3){
executeSort(_local3, ((_arg1 + _arg2) - _local3));
};
}
public function sort(_arg1:ArrayList, _arg2:IComparer):void{
_list = _arg1;
_comparer = _arg2;
executeSort(0, _arg1.length);
}
}
}//package com.kavalok.utils.sorting
Section 176
//CallFunctionAction (com.kavalok.utils.timers.CallFunctionAction)
package com.kavalok.utils.timers {
import flash.events.*;
import flash.utils.*;
import com.kavalok.interfaces.*;
public class CallFunctionAction implements ICommand {
private var _timer:Timer;
private var _function:Function;
private var _thisObject:Object;
private var _args:Array;
public function CallFunctionAction(_arg1:Function, _arg2:uint=100, _arg3:Object=null, _arg4:Array=null){
_timer = new Timer(_arg2, 1);
_timer.addEventListener(TimerEvent.TIMER, onTimer);
_function = _arg1;
_args = _arg4;
_thisObject = _arg3;
}
public function execute():void{
_timer.start();
}
private function onTimer(_arg1:TimerEvent):void{
if ((((_args == null)) && ((_thisObject == null)))){
_function();
} else {
_function.apply(_thisObject, _args);
};
}
}
}//package com.kavalok.utils.timers
Section 177
//Arrays (com.kavalok.utils.Arrays)
package com.kavalok.utils {
import com.kavalok.collections.*;
import com.kavalok.interfaces.*;
import com.kavalok.utils.comparing.*;
public class Arrays {
public static function lastItem(_arg1:Array):Object{
return (_arg1[(_arg1.length - 1)]);
}
public static function removeItems(_arg1:ArrayList, _arg2:uint, _arg3:uint):void{
var _local4:uint;
while (_local4 < _arg3) {
_arg1.removeItemAt(_arg2);
_local4++;
};
}
public static function removeAll(_arg1:Array, _arg2:Array):void{
var _local3:uint;
while (_local3 < _arg2.length) {
_arg1.removeItemAt(_arg1.getItemIndex(_arg2[_local3]));
_local3++;
};
}
public static function getByRequirement(_arg1:Object, _arg2:IRequirement):ArrayList{
var _local4:Object;
var _local3:ArrayList = new ArrayList();
for each (_local4 in _arg1) {
if (_arg2.meet(_local4)){
_local3.addItem(_local4);
};
};
return (_local3);
}
public static function objectToArray(_arg1:Object):Array{
var _local3:String;
var _local2:Array = new Array();
for (_local3 in _arg1) {
_local2.push(_arg1[_local3]);
};
return (_local2);
}
public static function findByProperty(_arg1:Object, _arg2:String, _arg3):Array{
return (getByRequirement(_arg1, new PropertyCompareRequirement(_arg2, _arg3)));
}
public static function insertAll(_arg1:Array, _arg2:Array):Array{
var _local3:uint;
while (_local3 < _arg2.length) {
_arg1.push(_arg2[_local3]);
_local3++;
};
return (_arg1);
}
public static function safeFirstByRequirement(_arg1:Array, _arg2:IRequirement):Object{
var collection = _arg1;
var requirement = _arg2;
var result:Object;
try {
result = firstByRequirement(collection, requirement);
} catch(e:Error) {
};
return (result);
}
public static function getConverted(_arg1:Array, _arg2:IConverter):ArrayList{
var _local3:ArrayList = new ArrayList();
var _local4:Number = 0;
while (_local4 < _arg1.length) {
_local3.addItem(_arg2.convert(_arg1[_local4]));
_local4++;
};
return (_local3);
}
public static function replaceItems(_arg1:ArrayList, _arg2:int, _arg3:int):void{
var _local4:Object = _arg1.getItemAt(_arg2);
var _local5:Object = _arg1.setItemAt(_local4, _arg3);
_arg1.setItemAt(_local5, _arg2);
}
public static function containsByRequirement(_arg1:Array, _arg2:IRequirement):Boolean{
var _local3:ArrayList = getByRequirement(_arg1, _arg2);
return ((_local3.length > 0));
}
public static function forceArray(_arg1:Object):Array{
return (((_arg1 == null)) ? [] : Objects.castToArray(_arg1));
}
public static function removeByRequirement(_arg1:Array, _arg2:IRequirement):Array{
var _local3:ArrayList = getByRequirement(_arg1, _arg2);
removeAll(_arg1, _local3);
return (_local3);
}
public static function findSimilarElements(_arg1:ArrayList, _arg2:ArrayList):ArrayList{
var _local5:Number;
var _local3:ArrayList = new ArrayList();
var _local4:Number = 0;
while (_local4 < _arg1.length) {
if (_arg2.contains(_arg1.getItemAt(_local4))){
_local5 = _arg2.getItemIndex(_arg1.getItemAt(_local4));
_local3.addItem(_arg2.getItemAt(_local5));
};
_local4++;
};
return (_local3);
}
public static function itemsEqual(_arg1:ArrayList, _arg2:ArrayList):Boolean{
if (_arg1 == _arg2){
return (true);
};
if (_arg1.length != _arg2.length){
return (false);
};
var _local3:Boolean;
var _local4:int;
while (_local4 < _arg1.length) {
if (_arg1.getItemAt(_local4) != _arg2.getItemAt(_local4)){
_local3 = false;
break;
};
_local4++;
};
return (_local3);
}
public static function firstByRequirement(_arg1:Array, _arg2:IRequirement):Object{
return (getByRequirement(_arg1, _arg2).getItemAt(0));
}
public static function randomItem(_arg1:Array){
return (_arg1[Maths.random(_arg1.length)]);
}
public static function removeItem(_arg1:Object, _arg2:Array):void{
_arg2.splice(_arg2.indexOf(_arg1), 1);
}
public static function merge(_arg1:Array, _arg2:Array):ArrayList{
var _local3:ArrayList = new ArrayList();
insertAll(_local3, _arg1);
insertAll(_local3, _arg2);
return (_local3);
}
public static function indexByRequirement(_arg1:Array, _arg2:IRequirement):int{
var _local3:Object = firstByRequirement(_arg1, _arg2);
return (_arg1.indexOf(_local3));
}
public static function mix(_arg1:ArrayList):ArrayList{
var _local2:uint;
while (_local2 < _arg1.length) {
replaceItems(_arg1, int((Math.random() * _arg1.length)), int((Math.random() * _arg1.length)));
_local2++;
};
return (_arg1);
}
public static function randomItems(_arg1:Array, _arg2:int):Array{
var _local6:int;
var _local3:Array = [];
var _local4:Array = [];
var _local5:int;
while (_local5 < _arg2) {
_local6 = Maths.random(_arg1.length);
while (_local4.indexOf(_local6) >= 0) {
_local6++;
if (_local6 == _arg1.length){
_local6 = 0;
};
};
_local3.push(_arg1[_local6]);
_local4.push(_local6);
_local5++;
};
return (_local3);
}
public static function subList(_arg1:ArrayList, _arg2:uint, _arg3:uint):ArrayList{
var _local4:ArrayList = new ArrayList();
var _local5:Number = 0;
while (_local5 < _arg3) {
_local4.addItem(_arg1.getItemAt((_arg2 + _local5)));
_local5++;
};
return (_local4);
}
public static function clone(_arg1:Array):Array{
var _local2:Array = new Array();
var _local3:int;
while (_local3 < _arg1.length) {
_local2[_local3] = _arg1[_local3];
_local3++;
};
return (_local2);
}
}
}//package com.kavalok.utils
Section 178
//DragManager (com.kavalok.utils.DragManager)
package com.kavalok.utils {
import flash.events.*;
import flash.display.*;
import com.kavalok.events.*;
import flash.geom.*;
public class DragManager {
public var enabled:Boolean;// = true
private var _dragEvent:EventSender;
private var _finishEvent:EventSender;
public var dragAlpha:Number;// = 1
private var _finished:Boolean;
private var _bounds:Rectangle;
private var _x0:Number;
private var _hitArea:InteractiveObject;
public var tag;
private var _xDiff:Number;
private var _yDiff:Number;
private var _previousAlpha:Number;
private var _y0:Number;
private var _startEvent:EventSender;
private var _content:Sprite;
public function DragManager(_arg1:Sprite, _arg2:InteractiveObject=null, _arg3:Rectangle=null){
_startEvent = new EventSender();
_finishEvent = new EventSender();
_dragEvent = new EventSender();
super();
if (_arg1 == null){
throw (new Error("Value cannot be null"));
};
_content = _arg1;
_hitArea = (_arg2) ? _arg2 : _arg1;
_bounds = _arg3;
_hitArea.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
_x0 = _arg1.x;
_y0 = _arg1.y;
}
public function get content():Sprite{
return (_content);
}
public function get bounds():Rectangle{
return (_bounds);
}
private function onMouseMove(_arg1:MouseEvent):void{
var _local2:Rectangle = _content.getBounds(_content.parent);
var _local3:Number = ((_content.parent.mouseX - _xDiff) - _content.x);
var _local4:Number = ((_content.parent.mouseY - _yDiff) - _content.y);
if (((!((_local3 == 0))) || (!((_local4 == 0))))){
_content.x = (_content.x + _local3);
_content.y = (_content.y + _local4);
if (_bounds){
GraphUtils.claimBounds(_content, _bounds);
};
_content.x = int(_content.x);
_content.y = int(_content.y);
_arg1.updateAfterEvent();
_dragEvent.sendEvent(this);
};
}
public function get dragEvent():EventSender{
return (_dragEvent);
}
private function onMouseDown(_arg1:MouseEvent):void{
if (!enabled){
return;
};
_previousAlpha = _content.alpha;
_content.alpha = dragAlpha;
_content.cacheAsBitmap = true;
_startEvent.sendEvent(this);
_x0 = _content.x;
_y0 = _content.y;
_xDiff = (_content.parent.mouseX - _content.x);
_yDiff = (_content.parent.mouseY - _content.y);
_hitArea.stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
_hitArea.stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
}
public function get finishEvent():EventSender{
return (_finishEvent);
}
public function get startEvent():EventSender{
return (_startEvent);
}
private function onMouseUp(_arg1:MouseEvent):void{
stop();
_finishEvent.sendEvent(this);
}
public function stop():void{
_hitArea.stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
_hitArea.stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
_content.alpha = _previousAlpha;
_content.cacheAsBitmap = false;
_finished = true;
}
public function set bounds(_arg1:Rectangle):void{
_bounds = _arg1;
}
public function undoDrag():void{
_content.x = _x0;
_content.y = _y0;
}
public function get finished():Boolean{
return (_finished);
}
}
}//package com.kavalok.utils
Section 179
//EventManager (com.kavalok.utils.EventManager)
package com.kavalok.utils {
import flash.events.*;
public class EventManager {
private var _eventList:Array;
public function EventManager(){
_eventList = [];
super();
}
private function getEventIndex(_arg1:EventDispatcher, _arg2:String, _arg3:Function, _arg4:Boolean):int{
var _local6:EventItem;
var _local5:int;
while (_local5 < _eventList.length) {
_local6 = _eventList[_local5];
if ((((((((_local6.object == _arg1)) && ((_local6.type == _arg2)))) && ((_local6.listener == _arg3)))) && ((_local6.useCapture == _arg4)))){
return (_local5);
};
_local5++;
};
return (-1);
}
public function removeEvent(_arg1:EventDispatcher, _arg2:String, _arg3:Function=null, _arg4:Boolean=false):void{
var _local5:int;
var _local6:int;
var _local7:EventItem;
if (_arg3 != null){
_arg1.removeEventListener(_arg2, _arg3, _arg4);
_local5 = getEventIndex(_arg1, _arg2, _arg3, _arg4);
if (_local5 >= 0){
_eventList.splice(_local5, 1);
};
} else {
_local6 = 0;
while (_local6 < _eventList.length) {
_local7 = _eventList[_local6];
if ((((_local7.object == _arg1)) && ((_local7.type == _arg2)))){
_arg1.removeEventListener(_local7.type, _local7.listener, _local7.useCapture);
_eventList.splice(_local6, 1);
} else {
_local6++;
};
};
};
}
public function clearEvents():void{
var _local2:EventItem;
var _local1:int;
while (_local1 < _eventList.length) {
_local2 = _eventList[_local1];
_local2.object.removeEventListener(_local2.type, _local2.listener, _local2.useCapture);
_local1++;
};
_eventList = [];
}
public function registerEvent(_arg1:EventDispatcher, _arg2:String, _arg3:Function, _arg4:Boolean=false):void{
_arg1.addEventListener(_arg2, _arg3, _arg4);
if (getEventIndex(_arg1, _arg2, _arg3, _arg4) == -1){
_eventList.push(new EventItem(_arg1, _arg2, _arg3, _arg4));
};
}
public function removeEvents(_arg1:EventDispatcher):void{
var _local3:EventItem;
var _local2:int;
while (_local2 < _eventList.length) {
_local3 = _eventList[_local2];
if (_local3.object == _arg1){
_arg1.removeEventListener(_local3.type, _local3.listener, _local3.useCapture);
_eventList.splice(_local2, 1);
} else {
_local2++;
};
};
}
public function eventExists(_arg1:EventDispatcher, _arg2:String, _arg3:Function, _arg4:Boolean=false):Boolean{
return ((getEventIndex(_arg1, _arg2, _arg3, _arg4) >= 0));
}
}
}//package com.kavalok.utils
import flash.events.*;
class EventItem {
public var listener:Function;
public var useCapture:Boolean;
public var type:String;
public var object:EventDispatcher;
private function EventItem(_arg1:EventDispatcher, _arg2:String, _arg3:Function, _arg4:Boolean):void{
this.object = _arg1;
this.type = _arg2;
this.listener = _arg3;
this.useCapture = _arg4;
}
}
Section 180
//GraphUtils (com.kavalok.utils.GraphUtils)
package com.kavalok.utils {
import com.kavalok.interfaces.*;
import flash.geom.*;
import flash.display.*;
import com.gskinner.geom.*;
import flash.text.*;
import com.kavalok.gameplay.*;
import com.kavalok.utils.comparing.*;
import flash.filters.*;
public class GraphUtils {
public static const CONFIG_ID:String = "config";
public static var stage:Stage;
public static function setButtonText(_arg1:SimpleButton, _arg2:String=null):void{
var _local4:DisplayObject;
var _local5:TextField;
var _local3:Array = [_arg1.upState, _arg1.downState, _arg1.overState];
for each (_local4 in _local3) {
if ((_local4 is Sprite)){
_local5 = TextField(findInstance(Sprite(_local4), TextField));
if (_local5 != null){
_local5.text = _arg2;
};
} else {
if ((_local4 is TextField)){
TextField(_local4).text = _arg2;
};
};
};
}
public static function optimizeSprite(_arg1:Sprite):void{
_arg1.cacheAsBitmap = true;
_arg1.mouseEnabled = false;
_arg1.mouseChildren = false;
}
public static function getAllChildren(_arg1:DisplayObjectContainer, _arg2:IRequirement=null):Array{
var child:DisplayObject;
var object = _arg1;
var requirement = _arg2;
var result:Array = [];
var i:int;
while (i < object.numChildren) {
try {
child = object.getChildAt(i);
} catch(e:SecurityError) {
};
if (((child) && ((((requirement == null)) || (requirement.meet(child)))))){
result.push(child);
};
if ((child is DisplayObjectContainer)){
result = result.concat(getAllChildren(DisplayObjectContainer(child), requirement));
};
i = (i + 1);
};
return (result);
}
public static function getRandomZonePoint(_arg1:Sprite, _arg2:Sprite=null):Point{
var _local5:Point;
var _local6:Point;
if (!_arg2){
_arg2 = _arg1;
};
var _local3:Rectangle = _arg1.getBounds(_arg2);
var _local4:Point;
while (!(_local4)) {
_local5 = new Point((_local3.left + (Math.random() * _local3.width)), (_local3.top + (Math.random() * _local3.height)));
_local6 = _arg2.localToGlobal(_local5);
if (_arg1.hitTestPoint(_local6.x, _local6.y, true)){
_local4 = _local5;
};
};
return (_local4);
}
public static function claimBounds(_arg1:DisplayObject, _arg2:Rectangle):void{
var _local3:Rectangle = _arg1.getBounds(_arg1.parent);
if (_local3.left < _arg2.left){
_arg1.x = (_arg1.x + (_arg2.left - _local3.left));
} else {
if (_local3.right > _arg2.right){
_arg1.x = (_arg1.x + (_arg2.right - _local3.right));
};
};
if (_local3.top < _arg2.top){
_arg1.y = (_arg1.y + (_arg2.top - _local3.top));
} else {
if (_local3.bottom > _arg2.bottom){
_arg1.y = (_arg1.y + (_arg2.bottom - _local3.bottom));
};
};
}
public static function textToParameters(_arg1:String):Object{
var _local5:String;
var _local6:Array;
var _local2:Array = _arg1.split("\r");
var _local3:Object = {};
var _local4:int;
while (_local4 < _local2.length) {
_local5 = _local2[_local4];
_local6 = _local5.split("=");
if (Strings.trim(_local5).length > 0){
_local3[Strings.trim(_local6[0])] = Strings.trim(_local6[1]);
};
_local4++;
};
return (_local3);
}
public static function attachAfter(_arg1:DisplayObject, _arg2:DisplayObject):void{
_arg2.parent.addChildAt(_arg1, (_arg2.parent.getChildIndex(_arg2) + 1));
}
public static function addFilters(_arg1:Sprite, _arg2:Array):void{
_arg1.filters = _arg1.filters.concat(_arg2);
}
public static function addChildAtCenter(_arg1:DisplayObject, _arg2:DisplayObjectContainer):void{
var _local3:Rectangle = _arg2.getBounds(_arg2);
_arg2.addChild(_arg1);
var _local4:Rectangle = _arg1.getBounds(_arg2);
_arg1.x = (_arg1.x + (0.5 * (((_local3.left + _local3.right) - _local4.left) - _local4.right)));
_arg1.y = (_arg1.y + (0.5 * (((_local3.top + _local3.bottom) - _local4.top) - _local4.bottom)));
}
public static function removeAllChildren(_arg1:DisplayObjectContainer, _arg2:IRequirement=null):void{
var _local4:DisplayObject;
var _local3:Array = getAllChildren(_arg1, _arg2);
for each (_local4 in _local3) {
if (_local4.parent){
_local4.parent.removeChild(_local4);
};
};
}
public static function disableMouse(_arg1:Sprite):void{
_arg1.mouseEnabled = false;
_arg1.mouseChildren = false;
}
public static function setCoords(_arg1:DisplayObject, _arg2:Object):void{
_arg1.x = _arg2.x;
_arg1.y = _arg2.y;
}
public static function removeChildren(_arg1:DisplayObjectContainer):void{
while (_arg1.numChildren > 0) {
_arg1.removeChildAt(0);
};
}
public static function hasParameters(_arg1:Sprite, _arg2:String="config"):Boolean{
return (!((getConfigString(_arg1, _arg2) == null)));
}
public static function replaceContent(_arg1:DisplayObjectContainer, _arg2:DisplayObject):void{
removeChildren(_arg1);
_arg1.addChild(_arg2);
}
public static function getLocationId(_arg1:Sprite):String{
var _local2:String = getConfigString(_arg1);
var _local3:Array = _local2.split("\r");
return (Strings.trim(_local3[0]));
}
public static function attachModalShadow(_arg1:Sprite, _arg2:Boolean=false):void{
var _local4:Number;
var _local5:Number;
var _local6:uint;
var _local7:DisplayObject;
if (_arg2){
_local4 = ((KavalokConstants.SCREEN_WIDTH - _arg1.width) / 2);
_local5 = ((KavalokConstants.SCREEN_HEIGHT - _arg1.height) / 2);
_local6 = 0;
while (_local6 < _arg1.numChildren) {
_local7 = _arg1.getChildAt(_local6);
_arg1.getChildAt(_local6).x = (_local7.x + _local4);
_local7.y = (_local7.y + _local5);
_local6++;
};
};
var _local3:Sprite = createRectSprite(KavalokConstants.SCREEN_WIDTH, KavalokConstants.SCREEN_HEIGHT, KavalokConstants.MODAL_SHADOW_COLOR, KavalokConstants.MODAL_SHADOW_ALPHA);
_arg1.addChildAt(_local3, 0);
}
public static function sendToBack(_arg1:DisplayObject):void{
var _local2:DisplayObjectContainer = _arg1.parent;
_local2.setChildIndex(_arg1, 0);
}
public static function attachBefore(_arg1:DisplayObject, _arg2:DisplayObject):void{
_arg2.parent.addChildAt(_arg1, _arg2.parent.getChildIndex(_arg2));
}
public static function detachFromDisplay(_arg1:DisplayObject):void{
if (((!((_arg1 == null))) && (!((_arg1.parent == null))))){
_arg1.parent.removeChild(_arg1);
};
}
public static function framesToTime(_arg1:int):Date{
var _local2:Number = (_arg1 / stage.frameRate);
var _local3:int = int(_local2);
var _local4:int = (_local3 / 60);
var _local5:int = (_local3 / 3600);
var _local6:int = ((_local2 - _local3) * 1000);
return (new Date(0, 0, 0, _local5, _local4, _local3, _local6));
}
public static function transformCoords(_arg1:Point, _arg2:DisplayObject, _arg3:DisplayObject):Point{
var _local4:Point = _arg3.globalToLocal(_arg2.localToGlobal(_arg1));
_arg1.x = _local4.x;
_arg1.y = _local4.y;
return (_arg1);
}
public static function enableDoubleClick(_arg1:DisplayObjectContainer, _arg2:Boolean=true):void{
var _local4:InteractiveObject;
var _local3:Array = GraphUtils.getAllChildren(_arg1, new ClassRequirement(InteractiveObject));
for each (_local4 in _local3) {
_local4.doubleClickEnabled = _arg2;
};
}
public static function addBoundsRect(_arg1:Sprite, _arg2:int=0, _arg3:Number=0):Sprite{
var _local4:Rectangle = _arg1.getBounds(_arg1);
var _local5:Sprite = createRectSprite(_local4.width, _local4.height, _arg2, _arg3);
_arg1.addChild(_local5);
_local5.x = _local4.x;
_local5.y = _local4.y;
return (_local5);
}
public static function sign(_arg1:Number):int{
if (_arg1 > 0){
return (1);
};
if (_arg1 < 0){
return (-1);
};
return (0);
}
public static function makeButton(_arg1:Sprite):void{
_arg1.useHandCursor = true;
_arg1.buttonMode = true;
_arg1.mouseChildren = false;
}
public static function adjustSaturation(_arg1:Sprite, _arg2:int=0):void{
var _local3:ColorMatrix = new ColorMatrix();
_local3.adjustSaturation(_arg2);
addFilters(_arg1, [new ColorMatrixFilter(_local3)]);
}
public static function getFirstChild(_arg1:DisplayObjectContainer, _arg2:IRequirement=null):DisplayObject{
var _local3:Array = getAllChildren(_arg1, _arg2);
return (((_local3.length)>0) ? _local3[0] : null);
}
public static function fromRGB(_arg1:uint, _arg2:uint, _arg3:uint):uint{
return ((((_arg1 << 16) | (_arg2 << 8)) | _arg3));
}
public static function getFilters(_arg1:Class):Array{
var _local2:Sprite = new (_arg1);
return (Sprite(_local2.getChildAt(0)).filters);
}
public static function setBtnEnabled(_arg1:SimpleButton, _arg2:Boolean):void{
_arg1.mouseEnabled = _arg2;
_arg1.enabled = _arg2;
_arg1.alpha = (_arg2) ? 1 : 0.3;
}
public static function alignCenter(_arg1:DisplayObject, _arg2:Rectangle):void{
var _local3:Rectangle = _arg1.getBounds(_arg1.parent);
_arg1.x = (_arg1.x + ((0.5 * (_arg2.left + _arg2.right)) - (0.5 * (_local3.left + _local3.right))));
_arg1.y = (_arg1.y + ((0.5 * (_arg2.top + _arg2.bottom)) - (0.5 * (_local3.top + _local3.bottom))));
}
public static function scale(_arg1:DisplayObject, _arg2:Number, _arg3:Number):Number{
var _local4:Number = Math.min((_arg2 / _arg1.height), (_arg3 / _arg1.width));
_arg1.height = (_arg1.height * _local4);
_arg1.width = (_arg1.width * _local4);
return (_local4);
}
public static function fitToObject(_arg1:DisplayObject, _arg2:DisplayObject):void{
scale(_arg1, _arg2.height, _arg2.width);
var _local3:Rectangle = _arg2.getBounds(_arg1.parent);
var _local4:Rectangle = _arg1.getBounds(_arg1.parent);
_arg1.x = (_arg1.x + ((_local3.x + (0.5 * _local3.width)) - (_local4.x + (0.5 * _local4.width))));
_arg1.y = (_arg1.y + ((_local3.y + (0.5 * _local3.height)) - (_local4.y + (0.5 * _local4.height))));
}
public static function roundCoords(_arg1:DisplayObject):void{
_arg1.x = Math.round(_arg1.x);
_arg1.y = Math.round(_arg1.y);
}
public static function hideConfigs(_arg1:DisplayObjectContainer, _arg2:String="config"):void{
setChildrenVisibility(_arg1, new PropertyCompareRequirement("name", _arg2), false);
}
public static function getPixel(_arg1:DisplayObject, _arg2:int, _arg3:int):int{
var _local4:BitmapData = new BitmapData(4, 4);
var _local5:Matrix = new Matrix();
_local5.tx = -(_arg2);
_local5.ty = -(_arg3);
_local4.draw(_arg1, _local5, _arg1.transform.colorTransform, _arg1.blendMode);
return (_local4.getPixel(1, 1));
}
public static function simplifyAngle(_arg1:Number):Number{
while (_arg1 >= 360) {
_arg1 = (_arg1 - 360);
};
while (_arg1 < 0) {
_arg1 = (_arg1 + 360);
};
return (_arg1);
}
public static function toRGB(_arg1:uint):Object{
return ({r:(_arg1 >> 16), g:((_arg1 >> 8) & 0xFF), b:(_arg1 & 0xFF)});
}
public static function removeFilters(_arg1:Sprite, _arg2:Array):void{
var _local3:Array = _arg1.filters;
_local3.splice((_local3.length - _arg2.length), _arg2.length);
_arg1.filters = _local3;
}
public static function applySepiaEffect(_arg1:Sprite):void{
adjustSaturation(_arg1, -100);
var _local2:ColorTransform = new ColorTransform(1, 1, 1, 1, 35, 25, 0);
_arg1.transform.colorTransform = _local2;
}
public static function distance2(_arg1:Point, _arg2:Point):Number{
var _local3:Number = (_arg2.x - _arg1.x);
var _local4:Number = (_arg2.y - _arg1.y);
return (((_local3 * _local3) + (_local4 * _local4)));
}
public static function stopAllChildren(_arg1:Sprite, _arg2:int=-1):void{
var _local4:MovieClip;
var _local3:Array = getAllChildren(_arg1, new TypeRequirement(MovieClip));
for each (_local4 in _local3) {
if (_local4.totalFrames > 1){
if (_arg2 > 0){
_local4.gotoAndStop(_arg2);
} else {
_local4.stop();
};
};
};
}
public static function getParameters(_arg1:Sprite, _arg2:String="config"):Object{
var _local3:String = getConfigString(_arg1, _arg2);
return (textToParameters(_local3));
}
public static function claimRange(_arg1:Number, _arg2:Number, _arg3:Number):Number{
if (_arg1 < _arg2){
return (_arg2);
};
if (_arg1 > _arg3){
return (_arg3);
};
return (_arg1);
}
public static function enableMouse(_arg1:Sprite):void{
_arg1.mouseEnabled = true;
_arg1.mouseChildren = true;
}
public static function createRectSprite(_arg1:Number, _arg2:Number, _arg3:int=0, _arg4:Number=1):Sprite{
var _local5:Sprite = new Sprite();
_local5.graphics.beginFill(_arg3, _arg4);
_local5.graphics.drawRect(0, 0, _arg1, _arg2);
_local5.graphics.endFill();
return (_local5);
}
public static function getConfigString(_arg1:DisplayObjectContainer, _arg2:String="config"):String{
var _local3:TextField = TextField(_arg1.getChildByName(_arg2));
if (_local3){
_local3.visible = false;
return (Strings.trim(_local3.text));
};
return (null);
}
public static function optimizeBackground(_arg1:Sprite):void{
_arg1.opaqueBackground = true;
_arg1.cacheAsBitmap = true;
_arg1.mouseEnabled = false;
_arg1.mouseChildren = false;
}
public static function playAllChildren(_arg1:MovieClip):void{
var _local3:MovieClip;
_arg1.play();
var _local2:Array = getAllChildren(_arg1, new TypeRequirement(MovieClip));
for each (_local3 in _local2) {
if (_local3.totalFrames > 1){
_local3.play();
};
};
}
public static function objToPoint(_arg1:DisplayObject):Point{
return (new Point(_arg1.x, _arg1.y));
}
public static function findInstance(_arg1:DisplayObjectContainer, _arg2:Class):DisplayObject{
var _local3:DisplayObject;
var _local4:int;
while (_local4 < _arg1.numChildren) {
_local3 = _arg1.getChildAt(_local4);
if ((_local3 is _arg2)){
return (_local3);
};
if ((_local3 is DisplayObjectContainer)){
_local3 = findInstance(DisplayObjectContainer(_local3), _arg2);
if (_local3 != null){
return (_local3);
};
};
_local4++;
};
return (null);
}
public static function makeGray(_arg1:Sprite):void{
var _local2:ColorMatrix = new ColorMatrix();
_local2.adjustSaturation(-100);
var _local3:ColorMatrixFilter = new ColorMatrixFilter(_local2);
_arg1.filters = [_local3];
}
public static function setChildrenVisibility(_arg1:DisplayObjectContainer, _arg2:IRequirement=null, _arg3:Boolean=false):void{
var _local5:DisplayObject;
var _local4:Array = getAllChildren(_arg1, _arg2);
for each (_local5 in _local4) {
_local5.visible = _arg3;
};
}
public static function distance(_arg1:Object, _arg2:Object):Number{
var _local3:Number = (_arg2.x - _arg1.x);
var _local4:Number = (_arg2.y - _arg1.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
public static function randomItem(_arg1:Array):Object{
return (_arg1[int((Math.random() * _arg1.length))]);
}
public static function angleDiff(_arg1:Number, _arg2:Number):Number{
_arg1 = (_arg1 % (2 * Math.PI));
_arg2 = (_arg2 % (2 * Math.PI));
if (_arg1 < 0){
_arg1 = (_arg1 + (2 * Math.PI));
};
if (_arg2 < 0){
_arg2 = (_arg2 + (2 * Math.PI));
};
var _local3:Number = (_arg2 - _arg1);
if (_local3 < -(Math.PI)){
_local3 = (_local3 + (2 * Math.PI));
};
if (_local3 > Math.PI){
_local3 = (_local3 - (2 * Math.PI));
};
return (_local3);
}
public static function getChildrenRect(_arg1:DisplayObjectContainer):Rectangle{
var _local7:DisplayObject;
if (_arg1.numChildren == 0){
return (new Rectangle(0, 0, 0, 0));
};
var _local2:Number = Number.MAX_VALUE;
var _local3:Number = Number.MIN_VALUE;
var _local4:Number = Number.MAX_VALUE;
var _local5:Number = Number.MIN_VALUE;
var _local6:uint;
while (_local6 < _arg1.numChildren) {
_local7 = _arg1.getChildAt(_local6);
_local2 = Math.min(_local2, _local7.x);
_local4 = Math.min(_local4, _local7.y);
_local3 = Math.max(_local3, (_local7.x + _local7.width));
_local5 = Math.max(_local5, (_local7.y + _local7.height));
_local6++;
};
return (new Rectangle(_local2, _local4, (_local3 - _local2), (_local5 - _local4)));
}
public static function changeParent(_arg1:DisplayObject, _arg2:Sprite):void{
var _local3:Point = GraphUtils.objToPoint(_arg1);
GraphUtils.transformCoords(_local3, _arg1.parent, _arg2);
_arg1.x = _local3.x;
_arg1.y = _local3.y;
_arg2.addChild(_arg1);
}
public static function bringToFront(_arg1:DisplayObject):void{
var _local2:DisplayObjectContainer = _arg1.parent;
_local2.setChildIndex(_arg1, (_local2.numChildren - 1));
}
}
}//package com.kavalok.utils
Section 181
//Maths (com.kavalok.utils.Maths)
package com.kavalok.utils {
import com.kavalok.collections.*;
import flash.geom.*;
import com.kavalok.utils.converting.*;
public class Maths {
public static function degreesToRadians(_arg1:Number):Number{
return (((_arg1 * Math.PI) / 180));
}
public static function randomRange(_arg1:Number, _arg2:Number):Number{
return ((_arg1 + (Math.random() * (_arg2 - _arg1))));
}
public static function random(_arg1:Number):Number{
return (((_arg1 > 0)) ? Math.floor((Math.random() * _arg1)) : Math.ceil((Math.random() * _arg1)));
}
public static function normalizeValue(_arg1:Number, _arg2:Number, _arg3:Number):Number{
_arg1 = Math.max(_arg1, _arg2);
_arg1 = Math.min(_arg1, _arg3);
return (_arg1);
}
public static function distance(_arg1:Point, _arg2:Point):Number{
var _local3:Point = _arg1.clone();
_local3.offset(-(_arg2.x), -(_arg2.y));
return (_local3.length);
}
public static function getInterpolatedValue(_arg1:Array, _arg2:Number):Number{
var _local6:int;
var _local7:Point;
var _local8:Point;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local3:Number = 0;
var _local4:ArrayList = Arrays.getConverted(_arg1, new ToPropertyValueConverter("y"));
var _local5:int;
while (_local5 < (_arg1.length - 1)) {
_local6 = (_local5 + 1);
while (_local6 < _arg1.length) {
_local7 = Point(_arg1.getItemAt(_local6));
_local8 = Point(_arg1.getItemAt(_local5));
_local9 = Objects.castToNumber(_local4.getItemAt(_local6));
_local10 = Objects.castToNumber(_local4.getItemAt(_local5));
_local11 = ((((_arg2 - _local8.x) * _local9) - ((_arg2 - _local7.x) * _local10)) / (_local7.x - _local8.x));
_local4.setItemAt(_local11, _local6);
_local6++;
};
_local5++;
};
return (Objects.castToNumber(_local4.getItemAt((_arg1.length - 1))));
}
public static function radiansToDegrees(_arg1:Number):Number{
return (((_arg1 * 180) / Math.PI));
}
public static function getAxisAngle(_arg1:Point, _arg2:Point):Number{
var _local3:Number = (_arg2.x - _arg1.x);
var _local4:Number = (_arg2.y - _arg1.y);
var _local5:Number = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
var _local6:Number = Math.acos((_local3 / _local5));
if (_arg1.y < _arg2.y){
_local6 = -(_local6);
};
return (radiansToDegrees(_local6));
}
}
}//package com.kavalok.utils
Section 182
//Objects (com.kavalok.utils.Objects)
package com.kavalok.utils {
import flash.utils.*;
public class Objects {
public static const TYPE_BOOLEAN:String = "boolean";
public static const FALSE_STRING:String = "false";
public static const TRUE_STRING:String = "true";
public static const TYPE_OBJECT:String = "object";
public static const TYPE_NULL:String = "null";
public static const TYPE_NUMBER:String = "number";
public static const TYPE_STRING:String = "string";
public static function castToNumber(_arg1:Object):Number{
return ((castToType(_arg1, Number) as Number));
}
public static function castToString(_arg1:Object):String{
return ((castToType(_arg1, String) as String));
}
public static function parseToRightType(_arg1:Object):Object{
if ((_arg1 is String)){
if (_arg1.toLowerCase() == "true"){
return (true);
};
if (_arg1.toLowerCase() == "false"){
return (false);
};
return (_arg1);
//unresolved jump
};
return (_arg1);
}
public static function getProperty(_arg1:Object, _arg2:String):Object{
var _local5:String;
var _local3:Array = _arg2.split(".");
var _local4:Object = _arg1;
for each (_local5 in _local3) {
_local4 = _local4[_local5];
};
return (_local4);
}
public static function isPrimitiveClassName(_arg1:String):Boolean{
var _local2:String = _arg1.toLowerCase();
return ((((((_local2 == TYPE_NUMBER)) || ((_local2 == TYPE_BOOLEAN)))) || ((_local2 == TYPE_STRING))));
}
public static function castToFunction(_arg1:Object):Function{
return ((castToType(_arg1, Function) as Function));
}
public static function castToXMLList(_arg1:Object):XMLList{
return ((castToType(_arg1, XMLList) as XMLList));
}
public static function isPrimitive(_arg1:Object):Boolean{
var _local2 = typeof(_arg1);
return ((((((((_local2 == TYPE_NUMBER)) || ((_local2 == TYPE_BOOLEAN)))) || ((_local2 == TYPE_STRING)))) || ((_arg1 is Class))));
}
public static function isSet(_arg1:Object):Boolean{
return (!((_arg1 == null)));
}
public static function getPropertiesCount(_arg1:Object):Number{
var _local3:String;
var _local2:Number = 0;
for (_local3 in _arg1) {
_local2++;
};
return (_local2);
}
public static function castToDate(_arg1:Object):Date{
return ((castToType(_arg1, Date) as Date));
}
public static function getFieldName(_arg1:String):String{
var _local2:Array = _arg1.split(".");
var _local3:String = _local2[(_local2.length - 1)];
return (_local3);
}
private static function castToType(_arg1:Object, _arg2:Class):Object{
if ((((_arg1 is _arg2)) || ((_arg1 == null)))){
return ((_arg1 as _arg2));
};
throw (TypeError((((("[" + getQualifiedClassName(new (_arg2))) + "] was expected but [") + getQualifiedClassName(_arg1)) + "] was found")));
}
public static function castToInt(_arg1:Object):Number{
return ((castToType(_arg1, Number) as int));
}
public static function castToArray(_arg1:Object):Array{
return ((castToType(_arg1, Array) as Array));
}
public static function isSimple(_arg1:Object):Boolean{
var _local2 = typeof(_arg1);
switch (_local2){
case "number":
case "string":
case "boolean":
return (true);
case "object":
return ((((_arg1 is Date)) || ((_arg1 is Array))));
};
return (false);
}
public static function castToBoolean(_arg1:Object):Boolean{
return ((castToType(_arg1, Boolean) as Boolean));
}
public static function castToClass(_arg1:Object):Class{
return ((castToType(_arg1, Class) as Class));
}
public static function castToXML(_arg1:Object):XML{
return ((castToType(_arg1, XML) as XML));
}
}
}//package com.kavalok.utils
Section 183
//ReflectUtil (com.kavalok.utils.ReflectUtil)
package com.kavalok.utils {
import flash.system.*;
import com.kavalok.collections.*;
import com.kavalok.interfaces.*;
import com.kavalok.utils.common.*;
import flash.utils.*;
public class ReflectUtil {
public static function getFieldsDescriptionsByInstance(_arg1:Object, _arg2:ApplicationDomain=null):Array{
var _local4:XML;
if (_arg2 == null){
_arg2 = ApplicationDomain.currentDomain;
};
var _local3:Array = new Array();
if (!Objects.isSimple(_arg1)){
_local4 = describeType(_arg1);
_local3 = getFieldsDescriptions(_arg1, _local4, _arg2);
};
return (_local3);
}
private static function getMethods(_arg1:Object, _arg2:XML):Array{
var _local4:XML;
var _local5:XML;
var _local3:Array = new Array();
for each (_local4 in _arg2.method) {
_local3.push(XMLList(_local4.@name).toString());
};
for each (_local5 in _arg2.factory) {
_local3.concat(getMethods(_arg1, _local5));
};
return (_local3);
}
public static function getPropertiesByInstance(_arg1:Object):Array{
var _local3:XML;
var _local2:Array = new Array();
if (!Objects.isSimple(_arg1)){
_local3 = describeType(_arg1);
_local2 = getAccessors(_arg1, _local3);
};
return (_local2);
}
private static function getFieldsDescriptions(_arg1:Object, _arg2:XML, _arg3:ApplicationDomain=null):Array{
var _local5:String;
var _local6:XML;
var _local7:XML;
var _local8:String;
var _local9:String;
if (_arg3 == null){
_arg3 = ApplicationDomain.currentDomain;
};
var _local4:Array = new Array();
if (XMLList(_arg2.@name).toString() != "Object"){
for each (_local6 in _arg2.variable) {
_local8 = XMLList(_local6.@name).toString();
_local9 = XMLList(_local6.@type).toString();
_local4.push(new FieldDescription(_local8, getTypeByName(_local9, _arg3)));
};
for each (_local7 in _arg2.factory) {
_local4.concat(getFieldsDescriptions(_arg1, _local7, _arg3));
};
};
for (_local5 in _arg1) {
_local4.push(new FieldDescription(_local5, getType(_arg1[_local5], _arg3)));
};
return (_local4);
}
public static function hasMethodByInstance(_arg1:Object, _arg2:String):Boolean{
return (getMethodsByInstance(_arg1).contains(_arg2));
}
public static function getMethodsByInstance(_arg1:Object):Array{
var _local3:XML;
var _local2:Array = new Array();
if (!Objects.isSimple(_arg1)){
_local3 = describeType(_arg1);
_local2 = getMethods(_arg1, _local3);
};
return (_local2);
}
public static function getFullTypeName(_arg1:Object):String{
var _local2:XML = describeType(_arg1);
var _local3:String = _local2.@name;
return (normalizeTypeName(_local3));
}
public static function hasFieldByInstance(_arg1:Object, _arg2:String):Boolean{
return (getFieldsByInstance(_arg1).contains(_arg2));
}
public static function getFieldsAndPropertiesByInstance(_arg1:Object):ArrayList{
var _local2:ArrayList = new ArrayList();
_local2.addItems(getFieldsByInstance(_arg1));
_local2.addItems(getPropertiesByInstance(_arg1));
return (_local2);
}
private static function getFields(_arg1:Object, _arg2:XML):Array{
var _local4:String;
var _local5:XML;
var _local6:XML;
var _local3:Array = new Array();
if (XMLList(_arg2.@name).toString() != "Object"){
for each (_local5 in _arg2.variable) {
_local3.push(XMLList(_local5.@name).toString());
};
for each (_local6 in _arg2.factory) {
_local3.concat(getFields(_arg1, _local6));
};
};
for (_local4 in _arg1) {
_local3.push(_local4);
};
return (_local3);
}
public static function getType(_arg1:Object, _arg2:ApplicationDomain=null):Class{
if (_arg2 == null){
_arg2 = ApplicationDomain.currentDomain;
};
return (getTypeByName(getQualifiedClassName(_arg1), _arg2));
}
public static function normalizeTypeName(_arg1:String):String{
return (_arg1.replace("::", "."));
}
public static function hasPropertyByInstance(_arg1:Object, _arg2:String):Boolean{
return (getPropertiesByInstance(_arg1).contains(_arg2));
}
public static function isDynamic(_arg1:Object):Boolean{
var _local2:XML = describeType(_arg1);
return ((String(_local2.@isDynamic) == Objects.TRUE_STRING));
}
private static function getAccessors(_arg1:Object, _arg2:XML, _arg3:IRequirement=null):Array{
var _local5:XML;
var _local6:XML;
var _local4:Array = new Array();
for each (_local5 in _arg2.accessor) {
if ((((_arg3 == null)) || (_arg3.meet(_local5)))){
_local4.push(XMLList(_local5.@name).toString());
};
};
for each (_local6 in _arg2.factory) {
_local4.concat(getAccessors(_arg1, _local6, _arg3));
};
return (_local4);
}
public static function getTypeByName(_arg1:String, _arg2:ApplicationDomain=null):Class{
var _local3:Class;
if (_arg2 == null){
_arg2 = ApplicationDomain.currentDomain;
};
if (_arg1 == "null"){
_local3 = null;
} else {
_local3 = Objects.castToClass(_arg2.getDefinition(_arg1));
};
return (_local3);
}
public static function getTypeName(_arg1:Object):String{
var _local2:String = getFullTypeName(_arg1);
return (_local2.substr((_local2.lastIndexOf(".") + 1)));
}
public static function copyFieldsAndProperties(_arg1:Object, _arg2:Object):void{
var property:String;
var source = _arg1;
var target = _arg2;
var sourceMembers:ArrayList = getFieldsAndPropertiesByInstance(source);
for each (property in sourceMembers) {
try {
target[property] = source[property];
} catch(e:Error) {
};
};
}
public static function getFieldsByInstance(_arg1:Object):Array{
var _local3:XML;
var _local2:Array = new Array();
if (!Objects.isSimple(_arg1)){
_local3 = describeType(_arg1);
_local2 = getFields(_arg1, _local3);
};
return (_local2);
}
}
}//package com.kavalok.utils
Section 184
//SpriteTweaner (com.kavalok.utils.SpriteTweaner)
package com.kavalok.utils {
import flash.events.*;
import flash.display.*;
import com.kavalok.events.*;
public class SpriteTweaner {
public var updateHandler:Function;
private var _sprite:Object;
private var _em:EventManager;
private var _eventDispatcher:DisplayObject;
private var _completeHandler:Function;
private var _incr:Object;
private var _complete:EventSender;
private var _properties:Object;
private var _counter:Number;
public function SpriteTweaner(_arg1:Object, _arg2:Object, _arg3:int, _arg4:EventManager=null, _arg5:Function=null, _arg6:DisplayObject=null){
var _local7:String;
_incr = {};
_complete = new EventSender();
super();
_em = ((_arg4)==null) ? new EventManager() : _arg4;
_sprite = _arg1;
_properties = _arg2;
_counter = _arg3;
_completeHandler = _arg5;
for (_local7 in _arg2) {
_incr[_local7] = ((_properties[_local7] - _arg1[_local7]) / _counter);
};
_eventDispatcher = ((_arg6) || (DisplayObject(_arg1)));
_em.registerEvent(_eventDispatcher, Event.ENTER_FRAME, onEnterFrame);
}
public function stop():void{
var _local1:String;
for (_local1 in _properties) {
_sprite[_local1] = _properties[_local1];
};
_em.removeEvent(_eventDispatcher, Event.ENTER_FRAME, onEnterFrame);
}
public function get complete():EventSender{
return (_complete);
}
private function onEnterFrame(_arg1:Event):void{
var _local2:String;
for (_local2 in _incr) {
_sprite[_local2] = (_sprite[_local2] + _incr[_local2]);
if (updateHandler != null){
updateHandler(_local2, _incr[_local2]);
};
};
if (--_counter == 0){
stop();
complete.sendEvent();
if (_completeHandler != null){
_completeHandler(_sprite);
};
};
}
}
}//package com.kavalok.utils
Section 185
//Strings (com.kavalok.utils.Strings)
package com.kavalok.utils {
import flash.text.*;
import com.kavalok.errors.*;
public class Strings {
protected static const RETURN_EXPRESSION:RegExp = /\r\n/gm;
protected static const SPACE_EXPRESSION:RegExp = /[ ]/g;
private static const ID_CHARS:String = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM_";
public static const DELIMITER:String = " `~!@#$%^&*()-_=+[]{};:'",<.>/?\|";
private static const KB_SIZE:Number = 0x0400;
public static const WHITESPACE:String = "
";
public static function escapeSpecialCharacters(_arg1:String):String{
return (replaceCharacters(_arg1, ["<", ">", "\"", "'", "&"], ["<", ">", """, "'", "&"]));
}
public static function trim(_arg1:String):String{
if (_arg1 == null){
return ("");
};
var _local2:int;
var _local3:int = (_arg1.length - 1);
var _local4:int = _arg1.length;
while ((((_local2 < _local4)) && ((WHITESPACE.indexOf(_arg1.charAt(_local2)) >= 0)))) {
_local2++;
};
while ((((_local3 > 0)) && ((WHITESPACE.indexOf(_arg1.charAt(_local3)) >= 0)))) {
_local3--;
};
return (((_local3)>=_local2) ? _arg1.slice(_local2, (_local3 + 1)) : "");
}
public static function addRandomParameter(_arg1:String):String{
return (substitute("{0}?{1}", _arg1, generateRandomId()));
}
public static function removeSymbols(_arg1:String, _arg2:String):String{
var _local3:String = _arg1;
var _local4:Number = 0;
while (_local4 < _arg2.length) {
_local3 = _local3.split(_arg2.charAt(_local4)).join("");
_local4++;
};
return (_local3);
}
public static function removeStringAt(_arg1:String, _arg2:Number, _arg3:Number):String{
if (_arg2 > _arg3){
throw (new IllegalArgumentError("endIndex must be greater than startIndex"));
};
var _local4:String = _arg1.substring(0, _arg2);
var _local5:String = _arg1.substr(_arg3, _arg1.length);
return ((_local4 + _local5));
}
public static function isBlank(_arg1:String):Boolean{
return ((((_arg1 == null)) || ((_arg1.length == 0))));
}
public static function insertStringAt(_arg1:String, _arg2:String, _arg3:Number):String{
var _local4:String = _arg1.substring(0, _arg3);
var _local5:String = _arg1.substring(_arg3, _arg1.length);
return (((_local4 + _arg2) + _local5));
}
public static function getParameters(_arg1:String):Object{
var _local4:String;
var _local5:Array;
var _local2:Object = {};
var _local3:Array = _arg1.split(";");
for each (_local4 in _local3) {
_local5 = safeSplit(_local4, "=");
if (_local5.length == 2){
_local2[_local5[0]] = _local5[1];
};
};
return (_local2);
}
public static function generateRandomId(_arg1:uint=10):String{
var _local4:uint;
var _local2 = "";
var _local3:uint;
while (_local3 < _arg1) {
_local4 = uint((Math.random() * ID_CHARS.length));
_local2 = (_local2 + ID_CHARS.charAt(_local4));
_local3++;
};
return (_local2);
}
public static function safeSplit(_arg1:String, _arg2:String=","):Array{
var _local4:Array;
var _local5:String;
var _local6:String;
var _local3:Array = [];
if (_arg1){
_local4 = _arg1.split(_arg2);
for each (_local5 in _local4) {
_local6 = trim(_local5);
if (_local6.length > 0){
_local3.push(_local6);
};
};
};
return (_local3);
}
public static function substitute(_arg1:String, ... _args):String{
var _local3:String = _arg1;
var _local4:int;
while (_local4 < _args.length) {
_local3 = _local3.replace(new RegExp((("\\{" + _local4) + "\\}"), "g"), _args[_local4]);
_local4++;
};
return (_local3);
}
public static function contains(_arg1:String, _arg2:String):Boolean{
return (!((_arg1.indexOf(_arg2) == -1)));
}
public static function getFileSizeText(_arg1:Number, _arg2:uint):String{
var _local3:Number = 0;
var _local4:Array = ["", "K", "M", "G"];
while ((((_arg1 > KB_SIZE)) && ((_local4.length > (_local3 + 1))))) {
_arg1 = (_arg1 / KB_SIZE);
_local3++;
};
return ((_arg1.toFixed(_arg2) + _local4[_local3]));
}
public static function removeWhiteSpaces(_arg1:String):String{
return (_arg1.split(" ").join(""));
}
public static function removeReturns(_arg1:String):String{
return (((_arg1)!=null) ? _arg1.replace(RETURN_EXPRESSION, "\n") : null);
}
public static function isDelimiter(_arg1:String):Boolean{
var _local2:Boolean;
if (_arg1.length == 1){
_local2 = contains(DELIMITER, _arg1);
} else {
throw (new Error("You can input only one character"));
};
return (_local2);
}
public static function removeHTML(_arg1:String):String{
var _local2:TextField = new TextField();
_local2.htmlText = _arg1;
return (_local2.text);
}
public static function reverse(_arg1:String):String{
var _local2 = "";
var _local3:Number = (_arg1.length - 1);
while (_local3 >= 0) {
_local2 = (_local2 + _arg1[_local3]);
_local3--;
};
return (_local2);
}
public static function startsWidth(_arg1:String, _arg2:String):Boolean{
return ((((_arg1.length >= _arg2.length)) && ((_arg1.indexOf(_arg2) == 0))));
}
public static function replacePatterns(_arg1:String, _arg2:Array, _arg3:Array):String{
var _local4:String = _arg1;
var _local5:int;
while (_local5 < _arg2.length) {
_local4 = _local4.replace(_arg2[_local5], _arg3[_local5]);
_local5++;
};
return (_local4);
}
public static function removeDuplications(_arg1:String, _arg2:String):String{
var _local3:int = _arg1.indexOf(_arg2);
var _local4:int = _arg1.lastIndexOf(_arg2);
while (_local3 != _local4) {
_arg1 = removeStringAt(_arg1, _local4, (_local4 + _arg2.length));
_local3 = _arg1.indexOf(_arg2);
_local4 = _arg1.lastIndexOf(_arg2);
};
return (_arg1);
}
public static function replaceCharacters(_arg1:String, _arg2:Array, _arg3:Array):String{
var _local6:int;
var _local4 = "";
var _local5:int;
while (_local5 < _arg1.length) {
_local6 = _arg2.indexOf(_arg1.charAt(_local5));
if (_local6 != -1){
_local4 = (_local4 + _arg3[_local6]);
} else {
_local4 = (_local4 + _arg1.charAt(_local5));
};
_local5++;
};
return (_local4);
}
}
}//package com.kavalok.utils
Section 186
//Timers (com.kavalok.utils.Timers)
package com.kavalok.utils {
import com.kavalok.utils.timers.*;
public final class Timers {
public static var errorHandler:Function;
private static function getHandledDelegate(_arg1:Function, _arg2:Object, _arg3:Array):Function{
var func = _arg1;
var thisObject = _arg2;
var args = _arg3;
return (function ():void{
try {
func.apply(thisObject, args);
} catch(e:Error) {
errorHandler(e);
};
});
}
public static function callAfter(_arg1:Function, _arg2:uint=100, _arg3:Object=null, _arg4:Array=null):void{
var _local5:CallFunctionAction = ((errorHandler)==null) ? new CallFunctionAction(_arg1, _arg2, _arg3, _arg4) : new CallFunctionAction(getHandledDelegate(_arg1, _arg3, _arg4), _arg2);
_local5.execute();
}
}
}//package com.kavalok.utils
Section 187
//TimeUtils (com.kavalok.utils.TimeUtils)
package com.kavalok.utils {
public class TimeUtils {
public static function getTimeString(_arg1:Number):String{
var _local2:Number = int((_arg1 / 3600000));
_arg1 = (_arg1 - (_local2 * 3600000));
var _local3:Number = int((_arg1 / 60000));
_arg1 = (_arg1 - (_local3 * 60000));
var _local4:Number = int((_arg1 / 1000));
var _local5:String = ((_local2 == 0)) ? Strings.substitute("{1}:{2}", _local2, getTimeSubstring(_local3), getTimeSubstring(_local4)) : Strings.substitute("{0}:{1}:{2}", _local2, getTimeSubstring(_local3), getTimeSubstring(_local4));
var _local6:Array = _local5.match(/0\d.*/);
if (((!((_local6 == null))) && ((_local6[0] == _local5)))){
_local5 = _local5.substr(1, (_local5.length - 1));
};
return (_local5);
}
public static function getTimeSubstring(_arg1:uint):String{
var _local2:String = String(_arg1);
if (_local2.length == 1){
_local2 = ("0" + _local2);
};
return (_local2);
}
}
}//package com.kavalok.utils
Section 188
//TypeRequirement (com.kavalok.utils.TypeRequirement)
package com.kavalok.utils {
import com.kavalok.interfaces.*;
public class TypeRequirement implements IRequirement {
private var _type:Class;
public function TypeRequirement(_arg1:Class){
_type = _arg1;
}
public function meet(_arg1:Object):Boolean{
return ((_arg1 is _type));
}
}
}//package com.kavalok.utils
Section 189
//URLUtil (com.kavalok.utils.URLUtil)
package com.kavalok.utils {
public class URLUtil {
public static function getServerNameWithPort(_arg1:String):String{
var _local2:int = (_arg1.indexOf("/") + 2);
var _local3:int = _arg1.indexOf("/", _local2);
return (((_local3 == -1)) ? _arg1.substring(_local2) : _arg1.substring(_local2, _local3));
}
public static function getServerName(_arg1:String):String{
var _local2:String = getServerNameWithPort(_arg1);
var _local3:int = _local2.indexOf("]");
_local3 = ((_local3)>-1) ? _local2.indexOf(":", _local3) : _local2.indexOf(":");
if (_local3 > 0){
_local2 = _local2.substring(0, _local3);
};
return (_local2);
}
}
}//package com.kavalok.utils
Section 190
//AngelAction (com.mokus.suiciders.chars.actions.AngelAction)
package com.mokus.suiciders.chars.actions {
import flash.events.*;
import com.mokus.suiciders.chars.*;
public class AngelAction extends CharActionBase {
private var _clip:McBallAngel;
public function AngelAction(_arg1:CharController){
super(_arg1);
}
private function onEnterFrame(_arg1:Event):void{
if (_clip.currentFrame == _clip.totalFrames){
_clip.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
_clip.parent.removeChild(_clip);
_clip.stop();
};
}
override public function execute():void{
_clip = new McBallAngel();
_clip.x = char.clip.x;
_clip.y = char.clip.y;
char.charsManager.charContainer.addChild(_clip);
_clip.addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
}
}//package com.mokus.suiciders.chars.actions
Section 191
//CharActionBase (com.mokus.suiciders.chars.actions.CharActionBase)
package com.mokus.suiciders.chars.actions {
import com.mokus.suiciders.chars.*;
import com.kavalok.interfaces.*;
public class CharActionBase implements ICommand {
protected var char:CharController;
public function CharActionBase(_arg1:CharController){
this.char = _arg1;
}
public function execute():void{
}
}
}//package com.mokus.suiciders.chars.actions
Section 192
//EyesAction (com.mokus.suiciders.chars.actions.EyesAction)
package com.mokus.suiciders.chars.actions {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import com.kavalok.collections.*;
import com.kavalok.utils.*;
public class EyesAction {
private var _eyes:MovieClip;
private var _clip:MovieClip;
private static const DEGREES_IN_FRAME:int = 4;
private static const ANGLE_OFFSET:int = 90;
public function EyesAction(_arg1:MovieClip){
_clip = _arg1;
}
private function get clip():MovieClip{
return (_clip);
}
private function onEnterFrame(_arg1:Event):void{
var _local3:Array;
var _local4:MovieClip;
var _local5:Point;
var _local6:Number;
var _local7:int;
var _local2:DisplayObject = _eyes.root;
if ((((_eyes.currentFrame == _eyes.totalFrames)) || ((_local2 == null)))){
_eyes.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
clip.removeChild(_eyes);
clip.eyes.visible = true;
} else {
if (_eyes.content){
_local3 = [_eyes.content.leftEye, _eyes.content.rightEye];
for each (_local4 in _local3) {
_local5 = _local4.localToGlobal(new Point());
_local6 = Math.atan2((_local2.mouseY - _local5.y), (_local2.mouseX - _local5.x));
_local6 = Maths.radiansToDegrees(_local6);
_local6 = GraphUtils.simplifyAngle(((_local6 + ANGLE_OFFSET) - clip.rotation));
_local7 = ((_local6 / DEGREES_IN_FRAME) + 1);
_local4.gotoAndStop(_local7);
};
};
};
}
public function execute():void{
var _local1:ArrayList;
if (clipEyes){
_local1 = new ArrayList([McEyesWow2, McEyesWow, McEyesBlink, McEyesSmile, McEyesBlink1, McEyesBlink2]);
_eyes = new _local1.random();
_eyes.transform.matrix = clipEyes.transform.matrix;
clip.addChild(_eyes);
_eyes.play();
_eyes.addEventListener(Event.ENTER_FRAME, onEnterFrame);
clipEyes.visible = false;
} else {
if (staticEyes){
staticEyes.play();
};
};
}
private function get staticEyes():MovieClip{
return (clip.staticEyes);
}
private function get clipEyes():MovieClip{
return ((((clip.eyes) && (clip.eyes.visible))) ? clip.eyes : null);
}
}
}//package com.mokus.suiciders.chars.actions
Section 193
//CharController (com.mokus.suiciders.chars.CharController)
package com.mokus.suiciders.chars {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import com.kavalok.collections.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.gamePlay.*;
import com.mokus.suiciders.physix.*;
import Box2D.Dynamics.Contacts.*;
import com.boristhebrave.Box2D.Controllers.*;
import flash.utils.*;
import com.mokus.util.*;
import com.mokus.suiciders.*;
import com.mokus.suiciders.chars.actions.*;
public class CharController extends BodyClip implements IJoinable {
private var _sleepGroup:String;
private var _sticky:Boolean;
public var charsManager:CharsManager;
private var _world:b2World;
private var _destroyed:Boolean;
public var stoped:Boolean;
private var _linkedGroup:String;
private var _linked:Boolean;// = false
private var _controller:b2MultiController;
private var _timer:Timer;
private var _reusable:Boolean;
private var _sleep:Boolean;
private var _jointClips:ArrayList;
private var _config:Object;
private var _force:b2Vec2;
private var _manager:CharsManager;
private var _sticked:Boolean;
private var _w:Number;
private static const FRICTION:Number = 0.05;
private static const DENSITY:Number = 1;
private static const RESTITUTION:Number = 0;
private static const ACTION_DELAY_MIN:int = 1000;
private static const FLY_SCALE_X:Number = 0.7;
private static const FLY_SCALE_Y:Number = 1.3;
private static const ACTION_DELAY:int = 1500;
private static const STICKED_FRAME:int = 10;
private static const LINKED_FRICTION:Number = 20;
private static const ANGULAR_DAMPING:Number = 15;
private static const LINKED_FRAME:int = 30;
private static const BALL_ANGULAR_DAMPING:Number = 1000;
private static const FLY_SCALE_X_DIFF:Number = -0.05;
private static const FLY_SPEED:int = 150;
public function CharController(_arg1:b2World, _arg2:b2MultiController, _arg3:MovieClip, _arg4:CharsManager, _arg5:Object){
var _local8:Array;
var _local10:Array;
_timer = new Timer(Maths.randomRange(ACTION_DELAY_MIN, ACTION_DELAY));
_config = _arg5;
_world = _arg1;
_controller = _arg2;
_manager = _arg4;
_sticky = _arg5.sticky;
_reusable = _arg5.reusable;
_w = _arg5.w;
_arg5.w = 0;
var _local6:MovieClip = createClip();
var _local7:int = (Maths.random(_local6.totalFrames) + 1);
_local6.gotoAndPlay(_local7);
super(createBall(new Point((_arg3.x * SuicidersConstants.X_MULT), (_arg3.y * SuicidersConstants.X_MULT))), _local6, _arg5, null);
_local6.cacheAsBitmap = false;
_timer.addEventListener(TimerEvent.TIMER, onTimer);
_timer.start();
_local6.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
_local6.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
_manager.register(this);
if (_config.force){
_local10 = _config.force.split(",");
_force = new b2Vec2((_local10[0] * SuicidersConstants.X_MULT), (_local10[1] * SuicidersConstants.X_MULT));
_arg5.linkedFriction = 0.0001;
body.m_angularDamping = BALL_ANGULAR_DAMPING;
body.SetAngularVelocity(0);
};
var _local9:MovieClip = _local6.sleepAnimation;
if (Strings.startsWidth(_arg3.name, SuicidersConstants.SLEEP)){
_sleep = true;
_local8 = _arg3.name.split("_");
if (_local8.length > 1){
_sleepGroup = _local8[1];
};
if (_local9){
_local9.gotoAndPlay((Maths.random(_local9.totalFrames) + 1));
_local9.visible = true;
};
} else {
wake();
};
if (((_arg5.linked) || (Strings.startsWidth(_arg3.name, SuicidersConstants.LINKED)))){
_local8 = _arg3.name.split("_");
if (_local8.length > 1){
_linkedGroup = _local8[1];
};
_arg4.addJoints(this, _linkedGroup, true);
linked = true;
};
}
private function setDefaultValues(_arg1:b2Body):void{
var _local2:b2MassData = new b2MassData();
_local2.mass = (((_config.mass * SuicidersConstants.MASS_COEF)) || (SuicidersConstants.NOT_LINKED_MASS));
_local2.mass = (_local2.mass * SuicidersConstants.MASS_MULT);
_arg1.SetMass(_local2);
setFricition(_arg1, FRICTION);
}
public function get joinable():Boolean{
return (!((_config.joinable == "false")));
}
private function tryWake(_arg1:b2Body):void{
var _local2:CharController;
if (_sleep){
_local2 = (_arg1.GetUserData() as CharController);
if (((_local2) && (!(_local2.sleep)))){
if (_local2.linked){
wake();
};
if (((!(_local2.sleep)) && ((((sleepGroup == null)) || ((_local2.sleepGroup == sleepGroup)))))){
wake();
};
};
};
}
private function onMouseOver(_arg1:MouseEvent):void{
if (!_sleep){
new EyesAction(MovieClip(clip)).execute();
};
}
private function trySticky(_arg1:b2Body):void{
var _local3:b2RevoluteJointDef;
if (((((!(_sticky)) || (_sticked))) || (!(linked)))){
return;
};
var _local2:BodyClip = _arg1.GetUserData();
if (((_local2.config) && (_local2.config.stickable))){
_local3 = new b2RevoluteJointDef();
_local3.Initialize(body, _arg1, body.GetWorldCenter());
body.GetWorld().CreateJoint(_local3);
sticked = true;
};
}
public function set isSensor(_arg1:Boolean):void{
var _local2:b2Shape = body.GetShapeList();
while (_local2) {
_local2.m_isSensor = true;
_local2 = _local2.GetNext();
};
}
private function setFricition(_arg1:b2Body, _arg2:Number):void{
var _local3:b2Shape = _arg1.GetShapeList();
while (_local3) {
_local3.m_friction = _arg2;
_local3 = _local3.GetNext();
};
}
public function get linked():Boolean{
return (_linked);
}
public function get minJoints():uint{
var _local1:uint = ((_config.minJoints) || (SuicidersConstants.MIN_JOINTS));
return (((_local1)>maxJoints) ? maxJoints : _local1);
}
private function setLinkedValues():void{
var _local1:b2MassData;
if (config.mass){
_local1 = new b2MassData();
_local1.mass = (config.mass * SuicidersConstants.MASS_MULT);
body.SetMass(_local1);
} else {
body.SetMassFromShapes();
};
setFricition(body, (isNaN(config.linkedFriction)) ? LINKED_FRICTION : config.linkedFriction);
}
private function wake():void{
if (_sleep){
new EyesAction(MovieClip(clip)).execute();
};
_sleep = false;
var _local1:MovieClip = MovieClip(clip).sleepAnimation;
if (_local1){
_local1.visible = false;
_local1.stop();
};
}
override public function onCollision(_arg1:b2Body, _arg2:b2ContactPoint):void{
trySticky(_arg1);
tryDestroy(_arg1);
tryDestroyJoints(_arg1);
tryWake(_arg1);
}
public function get maxJoints():uint{
return (((_config.maxJoints) || (SuicidersConstants.MAX_JOINTS)));
}
public function set linked(_arg1:Boolean):void{
var _local2:MovieClip;
var _local3:int;
if (_linked != _arg1){
_linked = _arg1;
if (_force){
body.m_angularDamping = BALL_ANGULAR_DAMPING;
body.SetAngularVelocity(0);
} else {
body.m_angularDamping = (_linked) ? ANGULAR_DAMPING : 0;
};
_local2 = MovieClip(clip).linked;
if (_local2){
_local3 = (_linked) ? 1 : LINKED_FRAME;
_local2.gotoAndPlay((_local3 + 1));
};
if (!_linked){
sticked = false;
setDefaultValues(body);
_timer.start();
} else {
setLinkedValues();
_timer.stop();
};
};
}
private function onTimer(_arg1:TimerEvent):void{
if (_sleep){
return;
};
if (Math.random() > 0.95){
new EyesAction(MovieClip(clip)).execute();
};
}
private function createBall(_arg1:Point):b2Body{
var _local4:b2Body;
var _local2:b2CircleDef = new b2CircleDef();
var _local3:b2BodyDef = new b2BodyDef();
_local2.density = DENSITY;
_local2.friction = FRICTION;
_local2.restitution = RESTITUTION;
_local2.radius = (_w) ? SuicidersConstants.W_CHAR_RADIUS : SuicidersConstants.CHAR_RADIUS;
_local2.radius = (_local2.radius * SuicidersConstants.X_MULT);
_local3.position.Set(_arg1.x, _arg1.y);
_local4 = _world.CreateBody(_local3);
_local4.CreateShape(_local2);
_local4.SetMassFromShapes();
setDefaultValues(_local4);
return (_local4);
}
private function tryDestroy(_arg1:b2Body):void{
if (_destroyed){
return;
};
var _local2:BodyClip = (_arg1.GetUserData() as BodyClip);
if (((_local2) && (_local2.config.killer))){
new AngelAction(this).execute();
SoundManager.instance.playRandomSound(Sounds.KILL);
destroy();
_destroyed = true;
};
}
public function get jointClips():ArrayList{
return (_jointClips);
}
protected function destroyJoints():void{
var _local2:JointClip;
var _local3:b2Joint;
var _local4:b2Body;
var _local5:CharController;
var _local6:b2World;
var _local1:b2JointEdge = body.GetJointList();
linked = false;
while (_local1) {
_local2 = _local1.joint.GetUserData();
_local3 = _local1.joint;
_local1 = _local1.next;
if (_local2){
_local4 = ((_local3.GetBody1() == body)) ? _local3.GetBody2() : _local3.GetBody1();
_local5 = _local4.GetUserData();
_local2.clip.parent.removeChild(_local2.clip);
_local2.destroy();
_local5.updateJoints();
} else {
sticked = false;
_local6 = _local3.GetBody1().GetWorld();
_local6.DestroyJoint(_local3);
};
};
}
public function processMouseDown():Boolean{
if (((((linked) && (!(_reusable)))) || (sleep))){
return (false);
};
clip.scaleX = 1;
clip.scaleY = 1;
stoped = true;
destroyPhysics();
body = null;
clip.x = _manager.charContainer.mouseX;
clip.y = _manager.charContainer.mouseY;
clip.stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
clip.stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
clip.addEventListener(Event.ENTER_FRAME, onEnterFrame);
_manager.beginMove(this);
if (Math.random() < 0.3){
if (_force){
SoundManager.instance.playRandomSound(Sounds.FLY);
} else {
if ((clip is McStrongBall)){
SoundManager.instance.playRandomSound(Sounds.STRONG);
} else {
SoundManager.instance.playRandomSound(Sounds.GENERAL);
};
};
};
return (true);
}
private function tryDestroyJoints(_arg1:b2Body):void{
if (!linked){
return;
};
var _local2:BodyClip = (_arg1.GetUserData() as BodyClip);
if (((((_local2) && (_local2.config.destroyer))) && (!(config.unbreakable)))){
destroyJoints();
};
}
private function onEnterFrame(_arg1:Event):void{
processMouseMove();
}
private function onMouseDown(_arg1:MouseEvent):void{
_arg1.stopPropagation();
processMouseDown();
}
override public function update():void{
super.update();
if (body){
if (((!(linked)) && ((body.GetLinearVelocity().Length() > (FLY_SPEED * SuicidersConstants.X_MULT))))){
if ((((clip.scaleX == 1)) && ((Math.random() < 0.04)))){
SoundManager.instance.playRandomSound(Sounds.FALL);
};
if (clip.scaleX > FLY_SCALE_X){
clip.scaleX = (clip.scaleX + FLY_SCALE_X_DIFF);
};
clip.scaleY = FLY_SCALE_Y;
} else {
clip.scaleX = 1;
clip.scaleY = 1;
};
};
if (linked){
if (((_force) && (_manager.physixEnabled))){
body.ApplyForce(new b2Vec2((_force.x * body.GetMass()), (_force.y * body.GetMass())), body.GetLocalCenter());
clip.rotation = 0;
};
if (_w){
body.SetAngularVelocity(_w);
};
};
}
public function updateJoints():void{
if (config.unbreakable){
return;
};
var _local1:b2JointEdge = body.GetJointList();
var _local2:uint;
while (_local1) {
_local2++;
_local1 = _local1.next;
};
if (_sticked){
_local2--;
};
if (_local2 == 0){
destroyJoints();
linked = false;
if (_w){
body.SetAngularVelocity(0);
};
};
}
private function endMove(_arg1:Boolean):void{
stoped = false;
_manager.register(this);
body = createBall(new Point((clip.x * SuicidersConstants.X_MULT), (clip.y * SuicidersConstants.X_MULT)));
if (_controller){
_controller.AddBody(body);
};
clip.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
clip.stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
clip.stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
_manager.endMove(this, _arg1);
}
public function get sleep():Boolean{
return (_sleep);
}
private function onMouseUp(_arg1:MouseEvent):void{
endMove(true);
}
private function trySkip(_arg1:b2ContactPoint, _arg2:b2Body):void{
var _local3:b2ContactEdge;
var _local4:b2Contact;
if (((((_force) && (linked))) && ((_arg2.GetUserData() is CharController)))){
_local3 = body.m_contactList;
while (((_local3) && (!((((((_local3.contact.m_shape1 == _arg1.shape1)) && ((_local3.contact.m_shape2 == _arg1.shape2)))) || ((((_local3.contact.m_shape1 == _arg1.shape2)) && ((_local3.contact.m_shape2 == _arg1.shape1))))))))) {
_local3 = _local3.next;
};
if (_local3.prev){
_local3.prev.next = _local3.next;
};
if (_local3.next){
_local3.next.prev = _local3.prev;
};
_local4 = _local3.contact;
_local4.m_flags = 0;
_local4.m_flags = (_local4.m_flags | b2Contact.e_nonSolidFlag);
};
}
private function set sticked(_arg1:Boolean):void{
var _local2:int;
var _local3:MovieClip;
if (_sticked != _arg1){
_sticked = _arg1;
_local2 = (_sticked) ? 1 : STICKED_FRAME;
_local3 = MovieClip(clip).sticky;
if (_local3){
_local3.gotoAndPlay(_local2);
};
if (_sticked){
SoundManager.instance.playRandomSound(Sounds.STICK);
};
};
}
public function createJointClip():MovieClip{
var _local1:String = ((_config.jointClass) || ("McJoint"));
var _local2:Class = ReflectUtil.getTypeByName(_local1);
return (new (_local2));
}
public function get linkedGroup():String{
return (_linkedGroup);
}
public function get sleepGroup():String{
return (_sleepGroup);
}
private function processMouseMove():void{
PhysixTool.apply(clip);
if (!charsManager.canMove(new Point(clip.stage.mouseX, clip.stage.mouseY), new Point(clip.x, clip.y))){
endMove(false);
} else {
clip.x = _manager.charContainer.mouseX;
clip.y = _manager.charContainer.mouseY;
};
}
private function destroyPhysics():void{
_manager.unregister(this);
destroyJoints();
Timers.callAfter(_world.DestroyBody, 1, _world, [body]);
if (_controller){
_controller.RemoveBody(body);
};
}
private function createClip():MovieClip{
var _local1:String = ((_config.viewClass) || ("McBall"));
var _local2:Class = ReflectUtil.getTypeByName(_local1);
return (new (_local2));
}
public function set jointClips(_arg1:ArrayList):void{
_jointClips = _arg1;
}
private function destroy():void{
if (clip.parent){
clip.parent.removeChild(clip);
};
destroyPhysics();
}
public function get distance():Number{
return ((((_config.distance) || (SuicidersConstants.DEFAULT_MAX_DISTANCE)) * SuicidersConstants.X_MULT));
}
public function createJoint():b2DistanceJointDef{
var _local1:b2DistanceJointDef = new b2DistanceJointDef();
_local1.frequencyHz = ((_config.jointFreq) || (SuicidersConstants.DEFAULT_JOINT_FREQ));
_local1.dampingRatio = SuicidersConstants.DEFAULT_DAMPING;
return (_local1);
}
private function onMouseMove(_arg1:MouseEvent):void{
processMouseMove();
}
}
}//package com.mokus.suiciders.chars
Section 194
//CharsManager (com.mokus.suiciders.chars.CharsManager)
package com.mokus.suiciders.chars {
import flash.events.*;
import flash.display.*;
import com.mokus.suiciders.ui.*;
import com.kavalok.events.*;
import flash.geom.*;
import com.kavalok.collections.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.gamePlay.*;
import com.mokus.suiciders.physix.*;
import com.mokus.suiciders.*;
public class CharsManager {
public var physixEnabled:Boolean;
private var _moveEvent:EventSender;
private var _charContainer:Sprite;
private var _chars:ArrayList;
private var _physix:PhysixClips;
private var _bullet:Boolean;// = false
private var _world:b2World;
private var _mouseDown:Boolean;// = false
private var _jointsSprite:Sprite;
private var _currentChar:CharController;
public var moveAreas:Array;
public var scroller:StageScroller;
private var _levelSize:Point;
public static const JOINT_OFFSET:Number = 0;
public static const QUERY_OFFSET:Number = 30;
public static const MOVE_STEP:Number = 10;
public static const CHAR_RADIUS:Number = 10;
public static const MAX_SIZE:Point = new Point(2000, 3000);
public static const QUERY_COUNT:Number = 10;
public function CharsManager(_arg1:PhysixClips, _arg2:Sprite, _arg3:Object, _arg4:Point){
moveAreas = [];
_moveEvent = new EventSender();
_chars = new ArrayList();
_jointsSprite = new Sprite();
super();
_world = _arg1.world;
_levelSize = _arg4;
_physix = _arg1;
_charContainer = _arg2;
_charContainer.addChild(_jointsSprite);
_charContainer.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
_charContainer.graphics.beginFill(0, 0);
_charContainer.graphics.drawRect(0, (SuicidersConstants.SCREEN_HEIGHT - MAX_SIZE.y), MAX_SIZE.x, MAX_SIZE.y);
_charContainer.graphics.endFill();
}
public function canMove(_arg1:Point, _arg2:Point):Boolean{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:DisplayObject;
var _local3:Point = _charContainer.globalToLocal(_arg1);
if ((((((((_local3.x < 0)) || ((_local3.y > SuicidersConstants.SCREEN_HEIGHT)))) || ((_local3.x > _levelSize.x)))) || ((_local3.y < (SuicidersConstants.SCREEN_HEIGHT - _levelSize.y))))){
return (false);
};
var _local4:Number = (_local3.x - _arg2.x);
var _local5:Number = (_local3.y - _arg2.y);
if (Math.abs(_local4) > Math.abs(_local5)){
_local6 = (Math.abs(_local4) / MOVE_STEP);
} else {
_local6 = (Math.abs(_local5) / MOVE_STEP);
};
_local4 = (_local4 / _local6);
_local5 = (_local5 / _local6);
if (((_local4) || (_local5))){
_local7 = _arg2.y;
_local8 = _arg2.x;
while (((((_arg2.x <= _local3.x)) ? (_local8 <= _local3.x) : (_local8 >= _local3.x)) && (((_arg2.y <= _local3.y)) ? (_local7 <= _local3.y) : (_local7 >= _local3.y)))) {
for each (_local9 in moveAreas) {
if (_local9.hitTestPoint((_arg1.x + (_local8 - _arg2.x)), (_arg1.y + (_local7 - _arg2.y)), true)){
return (false);
};
};
_local7 = (_local7 + _local5);
_local8 = (_local8 + _local4);
};
};
return (true);
}
public function unregister(_arg1:CharController):void{
_chars.removeItem(_arg1);
}
public function addForeground(_arg1:DisplayObject):void{
if (_arg1){
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, onForegroundMouseDown);
};
}
private function onForegroundMouseDown(_arg1:MouseEvent):void{
var _local3:b2Shape;
var _local4:CharController;
var _local2:Array = getShapes();
for each (_local3 in _local2) {
_local4 = (_local3.GetBody().GetUserData() as CharController);
if (((_local4) && (_local4.clip.hitTestPoint(_arg1.stageX, _arg1.stageY, true)))){
_local4.processMouseDown();
break;
};
};
}
private function onMouseDown(_arg1:MouseEvent):void{
var _local3:b2Shape;
var _local4:CharController;
var _local2:Array = getShapes();
for each (_local3 in _local2) {
_local4 = (_local3.GetBody().GetUserData() as CharController);
if (((((_local4) && (!(_local4.linked)))) && (_local4.processMouseDown()))){
return;
};
};
}
public function get moveEvent():EventSender{
return (_moveEvent);
}
public function get charContainer():DisplayObjectContainer{
return (_charContainer);
}
public function get bullet():Boolean{
return (_bullet);
}
public function canAddJoints(_arg1:IJoinable, _arg2:String=null, _arg3:Boolean=false):Boolean{
var _local4:Array = getJoints(_arg1, _arg1.body.GetPosition(), _arg2, _arg3);
return ((_local4.length > 0));
}
private function createJointClips(_arg1:IJoinable):void{
var _local4:MovieClip;
var _local2:ArrayList = new ArrayList();
var _local3:int;
while (_local3 < _arg1.maxJoints) {
_local4 = _arg1.createJointClip();
_local2.push(_local4);
_jointsSprite.addChild(_local4);
_local4.visible = false;
_local3++;
};
_arg1.jointClips = _local2;
}
public function get minHeight():Number{
var _local2:CharController;
var _local1:Number = SuicidersConstants.SCREEN_HEIGHT;
for each (_local2 in _chars) {
if (_local2.linked){
_local1 = Math.min(_local1, (_local2.body.GetPosition().y + (CHAR_RADIUS * SuicidersConstants.X_MULT)));
};
};
return ((_local1 / SuicidersConstants.X_MULT));
}
public function endMove(_arg1:CharController, _arg2:Boolean):void{
var _local3:MovieClip;
if (scroller){
scroller.offsetMult = 1;
};
_currentChar.clip.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
if (_arg2){
if (addJoints(_arg1)){
moveEvent.sendEvent();
};
} else {
for each (_local3 in _arg1.jointClips) {
_jointsSprite.removeChild(_local3);
};
_arg1.jointClips = null;
};
CursorManager.instance.release();
}
private function getJoints(_arg1:IJoinable, _arg2:b2Vec2, _arg3:String, _arg4:Boolean):Array{
var _local6:CharController;
var _local7:b2Vec2;
var _local8:Number;
var _local5:ArrayList = new ArrayList();
for each (_local6 in _chars) {
if (((!(_local6.linked)) || (((!(_local6.joinable)) && (!(_arg4)))))){
} else {
if (((!((_arg3 == null))) && (!((_arg3 == _local6.linkedGroup))))){
} else {
_local7 = _local6.body.GetPosition();
_local8 = new Point((_arg2.x - _local7.x), (_arg2.y - _local7.y)).length;
if (_local8 < _arg1.distance){
_local5.push(new PossibleJoint(_local6.body, _local8, _local6.joinable));
};
};
};
};
_local5.sortOn(["joinable", "distance"], [Array.DESCENDING, Array.NUMERIC]);
if (_local5.length > _arg1.maxJoints){
_local5 = new ArrayList(_local5.slice(0, _arg1.maxJoints));
};
return (((((_local5.length >= _arg1.minJoints)) || (_arg4))) ? _local5 : []);
}
public function register(_arg1:CharController):void{
_chars.push(_arg1);
}
public function beginMove(_arg1:CharController):void{
if (scroller){
scroller.offsetMult = 3;
Timers.callAfter(scroller.unMuteScrolling);
};
_currentChar = _arg1;
createJointClips(_arg1);
CursorManager.instance.press();
_currentChar.clip.addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function getShapes():Array{
var _local1:Array = [];
var _local2:b2AABB = new b2AABB();
_local2.lowerBound = new b2Vec2(((_charContainer.mouseX - QUERY_OFFSET) * SuicidersConstants.X_MULT), ((_charContainer.mouseY - QUERY_OFFSET) * SuicidersConstants.X_MULT));
_local2.upperBound = new b2Vec2(((_charContainer.mouseX + QUERY_OFFSET) * SuicidersConstants.X_MULT), ((_charContainer.mouseY + QUERY_OFFSET) * SuicidersConstants.X_MULT));
_world.Query(_local2, _local1, QUERY_COUNT);
return (_local1);
}
public function addJoints(_arg1:IJoinable, _arg2:String=null, _arg3:Boolean=false, _arg4:Boolean=true):Boolean{
var _local8:b2Joint;
var _local5:Boolean;
var _local6:Array = getJoints(_arg1, _arg1.body.GetPosition(), _arg2, _arg3);
if (_arg1.jointClips == null){
createJointClips(_arg1);
};
var _local7:int;
while (_local7 < _arg1.jointClips.length) {
if (_local6.length > _local7){
_local8 = addJoint(_arg1, _local6[_local7].body, _local6[_local7].distance);
_physix.registerJoint(_local8, _arg1.jointClips[_local7]);
_arg1.linked = true;
_local5 = true;
if (((!(_arg3)) && (_arg4))){
SoundManager.instance.playRandomSound(Sounds.LINK);
};
} else {
_jointsSprite.removeChild(_arg1.jointClips[_local7]);
};
_local7++;
};
_arg1.jointClips = null;
return (_local5);
}
private function addJoint(_arg1:IJoinable, _arg2:b2Body, _arg3:Number):b2Joint{
var _local4:b2DistanceJointDef = _arg1.createJoint();
_local4.body1 = _arg1.body;
_local4.body2 = _arg2;
_local4.length = _arg3;
return (_world.CreateJoint(_local4));
}
private function onEnterFrame(_arg1:Event):void{
var _local4:MovieClip;
var _local5:PossibleJoint;
var _local6:b2Vec2;
var _local7:Number;
var _local2:Array = getJoints(_currentChar, new b2Vec2((_charContainer.mouseX * SuicidersConstants.X_MULT), (_charContainer.mouseY * SuicidersConstants.X_MULT)), null, false);
if (_currentChar.jointClips == null){
return;
};
var _local3:int;
while (_local3 < _currentChar.jointClips.length) {
_local4 = _currentChar.jointClips[_local3];
if (_local2.length > _local3){
_local5 = _local2[_local3];
if (!_local4.visible){
_local4.visible = true;
_local4.gotoAndPlay(1);
};
_local4.x = _charContainer.mouseX;
_local4.y = _charContainer.mouseY;
_local6 = _local5.body.GetPosition();
_local4.rotation = 0;
_local4.width = ((_local5.distance + (JOINT_OFFSET * SuicidersConstants.X_MULT)) / SuicidersConstants.X_MULT);
_local7 = Math.atan2(((_local6.y / SuicidersConstants.X_MULT) - _charContainer.mouseY), ((_local6.x / SuicidersConstants.X_MULT) - _charContainer.mouseX));
_local4.rotation = Maths.radiansToDegrees(_local7);
} else {
_local4.visible = false;
};
_local3++;
};
}
public function addMoveArea(_arg1:DisplayObject):void{
if (_arg1){
moveAreas.push(_arg1);
_arg1.alpha = 0;
};
}
}
}//package com.mokus.suiciders.chars
Section 195
//HeroController (com.mokus.suiciders.chars.HeroController)
package com.mokus.suiciders.chars {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import com.kavalok.collections.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.physix.*;
import com.mokus.suiciders.*;
import flash.ui.*;
public class HeroController extends BodyClip implements IJoinable {
private var _down:Boolean;
private var _up:Boolean;
private var _jointClips:ArrayList;
private var _right:Boolean;
private var _left:Boolean;
private var _manager:CharsManager;
private var _linkEnabled:Boolean;// = true
private var _jumpEnabled:Boolean;// = true
private var _linked:Boolean;
private static const MAX_JOINTS:Number = 3;
private static const MIN_JOINTS:Number = 1;
private static const ANGULAR_VELOCITY:Number = 5;
private static const VELOCITY:Number = 0.125;
public function HeroController(_arg1:b2World, _arg2:CharsManager, _arg3:MovieClip, _arg4:Sprite){
_manager = _arg2;
super(createBody(_arg1, _arg3), new McHero(), {}, null);
_arg4.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
_arg4.stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
}
public function get jointClips():ArrayList{
return (_jointClips);
}
private function destroyJoints():void{
var _local2:JointClip;
var _local3:b2Joint;
var _local1:b2JointEdge = body.GetJointList();
_linked = false;
while (_local1) {
_local2 = _local1.joint.GetUserData();
_local3 = _local1.joint;
_local1 = _local1.next;
_local2.clip.parent.removeChild(_local2.clip);
_local2.destroy();
};
}
private function onKeyUp(_arg1:KeyboardEvent):void{
processButtons(_arg1, false);
}
private function onKeyDown(_arg1:KeyboardEvent):void{
processButtons(_arg1, true);
if ((((((_arg1.keyCode == Keyboard.UP)) && (_jumpEnabled))) && (!(_linked)))){
_jumpEnabled = false;
body.ApplyImpulse(new b2Vec2(0, -5), body.GetWorldCenter());
};
}
private function processButtons(_arg1:KeyboardEvent, _arg2:Boolean):void{
if (_arg1.keyCode == Keyboard.LEFT){
_left = _arg2;
};
if (_arg1.keyCode == Keyboard.RIGHT){
_right = _arg2;
};
if (_arg1.keyCode == Keyboard.UP){
_up = _arg2;
};
if (_arg1.keyCode == Keyboard.DOWN){
_down = _arg2;
};
}
override public function onCollision(_arg1:b2Body, _arg2:b2ContactPoint):void{
super.onCollision(_arg1, _arg2);
_jumpEnabled = true;
}
public function set linked(_arg1:Boolean):void{
_linked = _arg1;
}
public function get minJoints():uint{
return (MIN_JOINTS);
}
public function createJointClip():MovieClip{
return (new McWJoint());
}
private function enableJump():void{
_jumpEnabled = true;
}
override public function update():void{
var _local3:Point;
super.update();
var _local1:Boolean = _linked;
if (!_linked){
body.SetAngularVelocity(0);
};
destroyJoints();
var _local2:Boolean = ((_linkEnabled) && (_manager.canAddJoints(this, null, false)));
if (_local2){
_local3 = new Point();
if (_left){
_local3.x = (_local3.x - VELOCITY);
};
if (_up){
_local3.y = (_local3.y - VELOCITY);
};
if (_down){
_local3.y = (_local3.y + VELOCITY);
};
if (_right){
_local3.x = (_local3.x + VELOCITY);
};
body.GetXForm().position.x = (body.GetXForm().position.x + _local3.x);
body.GetXForm().position.y = (body.GetXForm().position.y + _local3.y);
_manager.addJoints(this, null, false, false);
};
if (!_linked){
if (((_left) && (!(_right)))){
body.SetAngularVelocity(-(ANGULAR_VELOCITY));
};
if (((_right) && (!(_left)))){
body.SetAngularVelocity(ANGULAR_VELOCITY);
};
if (_local1){
_linkEnabled = false;
Timers.callAfter(enableLink, 500);
};
};
}
private function enableLink():void{
_linkEnabled = true;
}
public function get maxJoints():uint{
return (MAX_JOINTS);
}
public function set jointClips(_arg1:ArrayList):void{
_jointClips = _arg1;
}
public function get distance():Number{
return ((SuicidersConstants.DEFAULT_MAX_DISTANCE * SuicidersConstants.X_MULT));
}
public function createJoint():b2DistanceJointDef{
var _local1:b2DistanceJointDef = new b2DistanceJointDef();
_local1.frequencyHz = SuicidersConstants.DEFAULT_JOINT_FREQ;
_local1.dampingRatio = SuicidersConstants.DEFAULT_DAMPING;
return (_local1);
}
private function createBody(_arg1:b2World, _arg2:MovieClip):b2Body{
var _local3:b2BodyDef = new b2BodyDef();
_local3.position.Set((_arg2.x * SuicidersConstants.X_MULT), (_arg2.y * SuicidersConstants.X_MULT));
var _local4:b2Body = _arg1.CreateBody(_local3);
var _local5:b2CircleDef = new b2CircleDef();
_local5.radius = (SuicidersConstants.HERO_RADIUS * SuicidersConstants.X_MULT);
_local5.density = SuicidersConstants.DENSITY;
_local5.friction = SuicidersConstants.HERO_FRICTION;
_local5.restitution = SuicidersConstants.RESTITUTION;
_local4.CreateShape(_local5);
_local4.SetMassFromShapes();
return (_local4);
}
}
}//package com.mokus.suiciders.chars
Section 196
//IJoinable (com.mokus.suiciders.chars.IJoinable)
package com.mokus.suiciders.chars {
import flash.display.*;
import com.kavalok.collections.*;
import Box2D.Dynamics.*;
import Box2D.Dynamics.Joints.*;
public interface IJoinable {
function get jointClips():ArrayList;
function set jointClips(_arg1:ArrayList):void;
function set linked(_arg1:Boolean):void;
function get distance():Number;
function createJoint():b2DistanceJointDef;
function get body():b2Body;
function get minJoints():uint;
function get maxJoints():uint;
function createJointClip():MovieClip;
}
}//package com.mokus.suiciders.chars
Section 197
//UserData (com.mokus.suiciders.data.UserData)
package com.mokus.suiciders.data {
import com.mokus.suiciders.ui.*;
import flash.net.*;
public class UserData {
private static var _sharedObject:SharedObject;
public function UserData(){
if (_sharedObject == null){
_sharedObject = SharedObject.getLocal("hujeTower");
};
}
public function set highScore(_arg1:int):void{
_sharedObject.data.highScore = _arg1;
}
public function completeLevel(_arg1:int, _arg2:int, _arg3:int, _arg4:int):void{
var _local5:Object;
if ((((((_arg1 >= completeLevels)) || ((getLevelData(_arg1) == null)))) || ((getLevelData(_arg1).score < _arg2)))){
_local5 = {};
_local5.index = _arg1;
_local5.score = _arg2;
_local5.time = _arg3;
_local5.moves = _arg4;
_sharedObject.data[("level" + _arg1)] = _local5;
};
completeLevels = Math.max(completeLevels, (_arg1 + 1));
}
public function get completeLevels():int{
return (((_sharedObject.data.completedLevels) || (0)));
}
public function calculateHighScore():int{
var _local3:Object;
var _local1:int;
var _local2:int;
while (_local2 < completeLevels) {
_local3 = ((getLevelData(_local2)) || ({}));
_local1 = (_local1 + ((_local3.score) || (0)));
_local2++;
};
return (_local1);
}
public function get gameComplete():Boolean{
return ((completeLevels == LevelsView.levels.length));
}
public function get newHighScore():Boolean{
return ((calculateHighScore() > highScore));
}
public function newGame():void{
completeLevels = 0;
highScore = 0;
}
public function set soundDisabled(_arg1:Boolean):void{
_sharedObject.data.soundDisabled = _arg1;
}
public function set completeLevels(_arg1:int):void{
_sharedObject.data.completedLevels = _arg1;
}
public function getLevelData(_arg1:int):Object{
return (_sharedObject.data[("level" + _arg1)]);
}
public function get soundDisabled():Boolean{
return (_sharedObject.data.soundDisabled);
}
public function get highScore():int{
return (((_sharedObject.data.highScore) || (0)));
}
}
}//package com.mokus.suiciders.data
Section 198
//WaterEffect (com.mokus.suiciders.effects.WaterEffect)
package com.mokus.suiciders.effects {
import flash.events.*;
import flash.display.*;
import com.mokus.suiciders.ui.*;
import flash.geom.*;
import flash.filters.*;
public class WaterEffect {
private var _lastCount:int;
private var _firstFramerate:Boolean;// = true
private var _perlinOffset:Array;
private var _time:Date;
private var _framerate:Number;
private var _filter:DisplacementMapFilter;
private var _bitmapData:BitmapData;
private var _scroller:StageScroller;
private var _source:Sprite;
private var _count:int;// = 0
private static const MIN_FRAMERATE:int = 18;
public function WaterEffect(_arg1:Sprite, _arg2:StageScroller){
_perlinOffset = [new Point(0, 0), new Point(0, 0)];
super();
_scroller = _arg2;
_source = _arg1;
_arg2.zoomEvent.addListener(onZoom);
_bitmapData = new BitmapData(_arg1.width, _arg1.height);
_filter = new DisplacementMapFilter(_bitmapData, new Point(0, 0), 1, 2, 10, 60);
_source.addEventListener(Event.ENTER_FRAME, onEnterFrame);
_time = new Date();
}
private function updateFramerate():void{
var _local1:Date = new Date();
if ((_local1.time - _time.time) >= 1000){
_time = _local1;
_framerate = (_count - _lastCount);
_lastCount = _count;
if ((((_framerate < MIN_FRAMERATE)) && (!(_firstFramerate)))){
_source.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
_source.filters = [];
_source.cacheAsBitmap = true;
};
_firstFramerate = false;
};
}
private function onZoom():void{
_bitmapData = new BitmapData((_source.width * _scroller.zoom), (_source.height * _scroller.zoom));
_filter = new DisplacementMapFilter(_bitmapData, new Point(0, 0), 1, 2, 10, 60);
}
private function onEnterFrame(_arg1:Event):void{
_count++;
updateFramerate();
if (((_scroller.scrolling) || (!(((_count % 3) == 0))))){
return;
};
_perlinOffset[0].x = (_perlinOffset[0].x + 1);
_perlinOffset[1].y = (_perlinOffset[1].y + 0.1);
_bitmapData.perlinNoise(45, 9, 2, 50, true, true, 7, true, _perlinOffset);
_source.filters = [_filter];
}
}
}//package com.mokus.suiciders.effects
Section 199
//ControlPointsPlayer (com.mokus.suiciders.gamePlay.ControlPointsPlayer)
package com.mokus.suiciders.gamePlay {
import flash.events.*;
import flash.display.*;
import com.mokus.suiciders.ui.*;
import com.kavalok.events.*;
import flash.geom.*;
import com.kavalok.collections.*;
import com.kavalok.utils.*;
public class ControlPointsPlayer {
private var _points:ArrayList;
private var _level:MovieClip;
private var _finishEvent:EventSender;
private var _scroller:StageScroller;
private var _lastPoint:ControlPoint;
private var _previousPosition:Point;
public static const POINT_PREFIX:String = "point_";
private static const SCROLL_STEPS:int = 20;
private static const ZOOM_STEPS:int = 10;
private static const PAUSE_STEPS:int = 20;
public function ControlPointsPlayer(_arg1:MovieClip, _arg2:StageScroller){
var _local6:MovieClip;
var _local7:Point;
_points = new ArrayList();
_finishEvent = new EventSender();
super();
_level = _arg1;
_scroller = _arg2;
var _local3:ArrayList = new ArrayList();
var _local4:MovieClip = _arg1.controlPoints;
if (_local4 == null){
return;
};
_local4.visible = false;
var _local5:int;
_lastPoint = new ControlPoint(new Point(_local4.point_0.x, _local4.point_0.y), _scroller.zoom);
_scroller.center = _lastPoint.position;
while (_local4[(POINT_PREFIX + _local5)]) {
_local6 = _local4[(POINT_PREFIX + _local5)];
_local7 = GraphUtils.transformCoords(new Point(_local6.x, _local6.y), _local4, _arg1);
addPoint(_local7);
_local5++;
};
}
private function onEnterFrame(_arg1:Event):void{
var _local2:ControlPoint;
if (_points.length == 0){
_level.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
finishEvent.sendEvent();
finishEvent.removeListeners();
} else {
_local2 = _points.shift();
_scroller.zoom = _local2.zoom;
_scroller.center = _local2.position;
_previousPosition = _local2.position;
};
}
public function get finishEvent():EventSender{
return (_finishEvent);
}
private function addPoint(_arg1:Point):void{
var _local2:int;
var _local3:Point;
var _local4:Number;
_local2 = 0;
while (_local2 <= SCROLL_STEPS) {
_local3 = new Point();
_local3.x = (_lastPoint.position.x + (((_arg1.x - _lastPoint.position.x) * _local2) / SCROLL_STEPS));
_local3.y = (_lastPoint.position.y + (((_arg1.y - _lastPoint.position.y) * _local2) / SCROLL_STEPS));
_points.addItem(new ControlPoint(_local3, _lastPoint.zoom));
_local2++;
};
_local2 = 0;
while (_local2 <= ZOOM_STEPS) {
_local4 = (_lastPoint.zoom + (((StageScroller.MAX_ZOOM - _lastPoint.zoom) * _local2) / ZOOM_STEPS));
_points.addItem(new ControlPoint(_local3.clone(), _local4));
_local2++;
};
_local2 = 0;
while (_local2 <= PAUSE_STEPS) {
_points.addItem(new ControlPoint(_local3.clone(), _local4));
_local2++;
};
_local2 = 1;
while (_local2 < ZOOM_STEPS) {
_local4 = (StageScroller.MAX_ZOOM + (((1 - StageScroller.MAX_ZOOM) * _local2) / ZOOM_STEPS));
_lastPoint = new ControlPoint(_local3.clone(), _local4);
_points.addItem(_lastPoint);
_local2++;
};
}
public function play():void{
_level.addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
}
}//package com.mokus.suiciders.gamePlay
import flash.geom.*;
class ControlPoint {
public var position:Point;
public var zoom:Number;
private function ControlPoint(_arg1:Point, _arg2:Number){
this.zoom = _arg2;
this.position = _arg1;
}
}
Section 200
//CursorManager (com.mokus.suiciders.gamePlay.CursorManager)
package com.mokus.suiciders.gamePlay {
import flash.events.*;
import flash.display.*;
import flash.ui.*;
public class CursorManager {
private var _root:Sprite;
private var _cursor:McCursor;
private var _cursorVisible:Boolean;// = false
public static var instance:CursorManager = new (CursorManager);
;
public function CursorManager(){
_cursor = new McCursor();
super();
_cursor.alpha = 0.7;
_cursor.stop();
_cursor.cacheAsBitmap = true;
}
public function press():void{
_cursor.gotoAndStop(2);
}
private function applyCursor():void{
Mouse.hide();
_root.addChildAt(_cursor, (_root.numChildren - 1));
_root.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove, true);
_root.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
_root.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
}
public function release():void{
_cursor.gotoAndStop(1);
}
private function onMouseUp(_arg1:MouseEvent):void{
release();
}
private function removeCursor():void{
_root.removeChild(_cursor);
_root.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
Mouse.show();
_root.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
_root.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
}
private function onMouseDown(_arg1:MouseEvent):void{
press();
}
public function initialize(_arg1:Sprite):void{
_root = _arg1;
}
private function onMouseMove(_arg1:MouseEvent):void{
_cursor.x = _root.mouseX;
_cursor.y = _root.mouseY;
}
public function set cursorVisible(_arg1:Boolean):void{
if (_cursorVisible != _arg1){
_cursorVisible = _arg1;
if (_arg1){
applyCursor();
} else {
removeCursor();
};
};
}
public function get cursorVisible():Boolean{
return (_cursorVisible);
}
}
}//package com.mokus.suiciders.gamePlay
Section 201
//GarbageManager (com.mokus.suiciders.gamePlay.GarbageManager)
package com.mokus.suiciders.gamePlay {
import flash.events.*;
import flash.display.*;
import com.mokus.suiciders.ui.*;
import flash.geom.*;
import com.kavalok.collections.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.*;
public class GarbageManager {
private var _size:Point;
private var _windController:WindController;
private var _level:Sprite;
private var _chapter:int;
private var _gravity:Number;
private var _garbage:ArrayList;
private var _content:Sprite;
private static const INITIAL_GARBAGE_COUNT:Number = 100;
private static const GARBAGE_SPEED_MULT:Number = 0.005;
private static const GARBAGE_ALPHA:Number = 0.8;
private static const GARBAGE_QUANTITY:Number = 0.1;
private static const GARBAGE_PREFIX:String = "McGarbage";
private static const WIND_SPEED_MULT:Number = 1;
public function GarbageManager(_arg1:MovieClip, _arg2:Point, _arg3:Number, _arg4:WindController, _arg5:MovieClip){
var _local7:Number;
_content = new Sprite();
_garbage = new ArrayList();
super();
_windController = _arg4;
_chapter = LevelsView.getChapter(_arg1);
_size = _arg2;
_gravity = _arg3;
_level = _arg1;
_arg1.addChildAt(_content, (_arg1.getChildIndex(_arg5) - 1));
_arg1.addEventListener(Event.ENTER_FRAME, onEnterFrame);
var _local6:int;
while (_local6 < INITIAL_GARBAGE_COUNT) {
_local7 = Maths.randomRange(SuicidersConstants.SCREEN_HEIGHT, (SuicidersConstants.SCREEN_HEIGHT - _size.y));
addGarbage(_local7);
_local6++;
};
}
private function onEnterFrame(_arg1:Event):void{
var _local3:GarbageItem;
var _local4:Number;
if (Math.random() < GARBAGE_QUANTITY){
_local4 = ((_gravity > 0)) ? (SuicidersConstants.SCREEN_HEIGHT - _size.y) : SuicidersConstants.SCREEN_HEIGHT;
addGarbage(_local4);
};
var _local2:ArrayList = new ArrayList();
for each (_local3 in _garbage) {
_local3.clip.x = (_local3.clip.x + ((_windController.wind * WIND_SPEED_MULT) / SuicidersConstants.X_MULT));
_local3.clip.y = (_local3.clip.y + (_gravity * GARBAGE_SPEED_MULT));
_local3.clip.rotation = (_local3.clip.rotation + _local3.w);
if ((((_local3.clip.y > SuicidersConstants.SCREEN_HEIGHT)) || ((_local3.clip.y < (SuicidersConstants.SCREEN_HEIGHT - _size.y))))){
_local2.addItem(_local3);
_content.removeChild(_local3.clip);
};
};
_garbage.removeItems(_local2);
}
private function addGarbage(_arg1:Number):void{
var _local2:String = ((GARBAGE_PREFIX + _chapter) + int(Maths.random(4)));
var _local3:Class = ReflectUtil.getTypeByName(_local2);
var _local4:MovieClip = new (_local3);
_garbage.addFirst(new GarbageItem(_local4));
_local4.alpha = GARBAGE_ALPHA;
_local4.x = Maths.randomRange((-(_size.x) * 2), (_size.x * 3));
_local4.y = _arg1;
_content.addChild(_local4);
}
public function dispose():void{
_level.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
}
}
}//package com.mokus.suiciders.gamePlay
import flash.display.*;
import com.kavalok.utils.*;
class GarbageItem {
public var clip:MovieClip;
public var w:Number;
private static const MAX_W:Number = 10;
private function GarbageItem(_arg1:MovieClip){
this.clip = _arg1;
w = Maths.randomRange(-(MAX_W), MAX_W);
}
}
Section 202
//Scroller (com.mokus.suiciders.gamePlay.Scroller)
package com.mokus.suiciders.gamePlay {
import flash.events.*;
import flash.display.*;
import com.mokus.suiciders.ui.*;
import com.kavalok.events.*;
import flash.geom.*;
import com.kavalok.utils.*;
public class Scroller {
protected var _content:McScroller;
protected var _position:Number;
private var _changeEvent:EventSender;
private var _changeCompleteEvent:EventSender;
protected var _line:Sprite;
protected var _scrollStep:Number;// = 0.05
private var _dm:DragManager;
private var _scrollCounter:int;
private var _scrollDirection:int;
protected var _pointer:Sprite;
private static const SCROLL_DELAY:int = 1;
public function Scroller(_arg1:McScroller){
_changeEvent = new EventSender(Scroller);
_changeCompleteEvent = new EventSender(Scroller);
super();
_content = _arg1;
_pointer = _content.pointer;
_line = _content.line;
var _local2:int = Math.max(_arg1.width, _arg1.height);
_content.upButton.addEventListener(MouseEvent.MOUSE_DOWN, onUpClick);
_content.downButton.addEventListener(MouseEvent.MOUSE_DOWN, onDownClick);
initContent();
new ButtonCursorRemover(_content);
}
public function setPosition(_arg1:Number):void{
_position = GraphUtils.claimRange(_arg1, 0, 1);
_pointer.y = (_line.y + (_line.height * _position));
}
private function initContent():void{
_pointer.buttonMode = true;
_dm = new DragManager(_pointer);
_dm.bounds = new Rectangle((_line.x - (0.5 * _pointer.width)), (_line.y - (_pointer.height / 2)), _pointer.width, (_line.height + _pointer.height));
_dm.dragEvent.addListener(onDrag);
_dm.finishEvent.addListener(onFinishDrag);
position = 0;
}
public function get changeEvent():EventSender{
return (_changeEvent);
}
protected function onUpClick(_arg1:MouseEvent):void{
startScrolling(-1);
_arg1.stopPropagation();
}
public function get changeCompleteEvent():EventSender{
return (_changeCompleteEvent);
}
private function onDrag(_arg1:DragManager):void{
_position = ((_pointer.y - _line.y) / _line.height);
_position = GraphUtils.claimRange(_position, 0, 1);
_changeEvent.sendEvent(this);
}
public function set position(_arg1:Number):void{
setPosition(_arg1);
changeEvent.sendEvent(this);
}
private function stopScrolling(_arg1:Event):void{
_content.removeEventListener(Event.ENTER_FRAME, doScrollStep);
_content.stage.removeEventListener(MouseEvent.MOUSE_UP, stopScrolling);
}
protected function onDownClick(_arg1:MouseEvent):void{
startScrolling(1);
_arg1.stopPropagation();
}
public function get position():Number{
return (_position);
}
private function doScrollStep(_arg1:Event=null):void{
if (++_scrollCounter == SCROLL_DELAY){
_scrollCounter = 0;
position = (position + (_scrollStep * _scrollDirection));
changeEvent.sendEvent(this);
changeCompleteEvent.sendEvent(this);
};
}
public function set scrollStep(_arg1:Number):void{
_scrollStep = _arg1;
}
private function startScrolling(_arg1:int):void{
_scrollDirection = _arg1;
_scrollCounter = 0;
_content.addEventListener(Event.ENTER_FRAME, doScrollStep);
_content.stage.addEventListener(MouseEvent.MOUSE_UP, stopScrolling);
doScrollStep();
}
private function onFinishDrag(_arg1:DragManager):void{
_changeCompleteEvent.sendEvent(this);
}
public function set scrollerVisible(_arg1:Boolean):void{
_content.visible = _arg1;
}
}
}//package com.mokus.suiciders.gamePlay
Section 203
//SoundManager (com.mokus.suiciders.gamePlay.SoundManager)
package com.mokus.suiciders.gamePlay {
import flash.events.*;
import com.kavalok.collections.*;
import com.kavalok.utils.*;
import flash.media.*;
public class SoundManager {
private var _musicType:Class;
private var _enabled:Boolean;// = true
private var _music:SoundChannel;
private var _loudness:Number;
public var volume:Number;// = 1
private static const CHAPTER_PREFIX:String = "SoundChapter";
private static const LOUDNESS:Number = 0.6;
public static var instance:SoundManager = new (SoundManager);
;
private function onSoundComplete(_arg1:Event):void{
_enabled = true;
}
public function stopMusic():void{
if (_music){
_music.stop();
_music = null;
};
}
public function set enabled(_arg1:Boolean):void{
volume = (_arg1) ? 1 : 0;
if (_music){
_music.soundTransform = new SoundTransform((volume * LOUDNESS));
};
}
public function playSound(_arg1:Class, _arg2:Boolean=false):void{
if (((!(_enabled)) && (!(_arg2)))){
return;
};
var _local3:Sound = new (_arg1);
var _local4:SoundChannel = _local3.play(0, 0, new SoundTransform((volume * LOUDNESS)));
_local4.addEventListener(Event.SOUND_COMPLETE, onSoundComplete);
_enabled = false;
}
public function playMusic(_arg1:Class, _arg2:int=0):void{
var _local3:Sound;
_arg2 = ((_arg2) || (int.MAX_VALUE));
if (((!((_music == null))) && (!((_musicType == _arg1))))){
stopMusic();
};
if (_music == null){
_local3 = new (_arg1);
_music = _local3.play(0, _arg2, new SoundTransform((volume * LOUDNESS)));
_musicType = _arg1;
};
}
public function playRandomSound(_arg1:ArrayList):void{
playSound(_arg1.random);
}
public function playChapterMusic(_arg1:int):void{
var _local2:Class = ReflectUtil.getTypeByName((CHAPTER_PREFIX + _arg1));
playMusic(_local2);
}
}
}//package com.mokus.suiciders.gamePlay
Section 204
//WindController (com.mokus.suiciders.gamePlay.WindController)
package com.mokus.suiciders.gamePlay {
import flash.events.*;
import Box2D.Dynamics.*;
import com.kavalok.utils.*;
import flash.utils.*;
import com.mokus.suiciders.*;
public class WindController {
private var _world:b2World;
private var _timer:Timer;
private var _windMax:Number;
public function WindController(_arg1:b2World, _arg2:String){
_world = _arg1;
_windMax = ((_arg2 == null)) ? SuicidersConstants.DEFAULT_WIND_MAX : Number(_arg2);
_windMax = (_windMax * SuicidersConstants.X_MULT);
_timer = new Timer(SuicidersConstants.WIND_CHANGE_TIME);
_timer.addEventListener(TimerEvent.TIMER, onTimer);
_timer.start();
this.wind = Maths.randomRange(-(_windMax), _windMax);
}
public function set wind(_arg1:Number):void{
_world.m_gravity.x = _arg1;
}
public function get wind():Number{
return (_world.m_gravity.x);
}
private function onTimer(_arg1:Number):void{
var _local2:Number = (_windMax * SuicidersConstants.WIND_CHANGE_COEFF);
wind = Maths.normalizeValue((wind + Maths.randomRange(-(_local2), _local2)), -(_windMax), _windMax);
}
public function dispose():void{
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, onTimer);
_timer = null;
}
}
}//package com.mokus.suiciders.gamePlay
Section 205
//BodyProcessor (com.mokus.suiciders.levels.BodyProcessor)
package com.mokus.suiciders.levels {
import flash.display.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.*;
public class BodyProcessor extends ShapeProcessor {
private var _processors:Object;
public function BodyProcessor(_arg1:b2World){
_processors = {};
super(_arg1);
_processors.square = new SquareProcessor(_arg1);
_processors.triangle = new TriangleProcessor(_arg1);
_processors.circle = new CircleProcessor(_arg1);
}
override protected function addShapes(_arg1:b2Body, _arg2:Object, _arg3:MovieClip):void{
var _local5:MovieClip;
var _local6:Object;
var _local7:ShapeProcessor;
var _local8:b2ShapeDef;
var _local4:uint;
while (_local4 < _arg3.numChildren) {
_local5 = (_arg3.getChildAt(_local4) as MovieClip);
if (((_local5) && (GraphUtils.hasParameters(_local5, SuicidersConstants.CONFIG_ID)))){
_local6 = GraphUtils.getParameters(_local5, SuicidersConstants.CONFIG_ID);
_local7 = _processors[_local6.type];
_local8 = _local7.createShape(_local5, _arg3);
addShape(_arg1, _arg2, _local8);
};
_local4++;
};
}
}
}//package com.mokus.suiciders.levels
Section 206
//CharProcessor (com.mokus.suiciders.levels.CharProcessor)
package com.mokus.suiciders.levels {
import flash.display.*;
import Box2D.Dynamics.*;
import com.mokus.suiciders.chars.*;
import com.boristhebrave.Box2D.Controllers.*;
import flash.utils.*;
public class CharProcessor extends LevelItemProcessorBase {
public function CharProcessor(_arg1:b2World){
super(_arg1);
}
override public function process(_arg1:b2MultiController, _arg2:MovieClip, _arg3:Object, _arg4:Dictionary, _arg5:MovieClip, _arg6:CharsManager):b2Body{
var _local7:CharController = new CharController(world, _arg1, _arg2, _arg6, _arg3);
_arg5.addChild(_local7.clip);
_local7.charsManager = _arg6;
return (_local7.body);
}
}
}//package com.mokus.suiciders.levels
Section 207
//CircleProcessor (com.mokus.suiciders.levels.CircleProcessor)
package com.mokus.suiciders.levels {
import flash.display.*;
import flash.geom.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import com.mokus.suiciders.*;
public class CircleProcessor extends ShapeProcessor {
public static var POINT:Point = new Point(0, 50);
public function CircleProcessor(_arg1:b2World){
super(_arg1);
}
override public function createShape(_arg1:MovieClip, _arg2:MovieClip):b2ShapeDef{
var _local3:b2CircleDef = new b2CircleDef();
var _local4:Point = _arg1.localToGlobal(POINT);
_local4 = new Point((_local4.x * SuicidersConstants.X_MULT), (_local4.y * SuicidersConstants.X_MULT));
var _local5:Point = _arg1.localToGlobal(new Point());
_local5 = new Point((_local5.x * SuicidersConstants.X_MULT), (_local5.y * SuicidersConstants.X_MULT));
var _local6:Point = _arg2.localToGlobal(new Point());
_local6 = new Point((_local6.x * SuicidersConstants.X_MULT), (_local6.y * SuicidersConstants.X_MULT));
var _local7:Point = _local5.subtract(_local4);
_local3.radius = _local7.length;
_local3.localPosition = new b2Vec2((_local5.x - _local6.x), (_local5.y - _local6.y));
return (_local3);
}
}
}//package com.mokus.suiciders.levels
Section 208
//DistanceJointProcessor (com.mokus.suiciders.levels.DistanceJointProcessor)
package com.mokus.suiciders.levels {
import flash.display.*;
import flash.geom.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Dynamics.Joints.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.chars.*;
import com.mokus.suiciders.physix.*;
import com.boristhebrave.Box2D.Controllers.*;
import flash.utils.*;
public class DistanceJointProcessor extends JointProcessorBase {
public function DistanceJointProcessor(_arg1:b2World){
super(_arg1);
}
override public function process(_arg1:b2MultiController, _arg2:MovieClip, _arg3:Object, _arg4:Dictionary, _arg5:MovieClip, _arg6:CharsManager):b2Body{
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2DistanceJointDef;
var _local14:Class;
var _local15:MovieClip;
var _local7:b2Body = getBodies(_arg2.point1, _arg4).first;
var _local8:b2Body = getBodies(_arg2.point2, _arg4).first;
_local9 = PhysixUtil.pointToVec(_arg2.point1.localToGlobal(new Point()));
_local10 = PhysixUtil.pointToVec(_arg2.point2.localToGlobal(new Point()));
_local11 = new b2DistanceJointDef();
_local11.body1 = _local7;
_local11.body2 = _local8;
var _local12:b2Vec2 = _local10.Copy();
_local12.Subtract(_local9);
_local9.Subtract(_local7.GetPosition());
_local10.Subtract(_local8.GetPosition());
_local11.localAnchor1 = _local9;
_local11.localAnchor2 = _local10;
_local11.length = _local12.Length();
_local11.collideConnected = false;
var _local13:b2Joint = world.CreateJoint(_local11);
if (_arg3.viewClass){
_local14 = ReflectUtil.getTypeByName(_arg3.viewClass);
_local15 = new (_local14);
new JointClip(_local13, _local15, _arg3.addWidth);
_arg5.addChild(_local15);
};
return (null);
}
}
}//package com.mokus.suiciders.levels
Section 209
//HeroProcessor (com.mokus.suiciders.levels.HeroProcessor)
package com.mokus.suiciders.levels {
import flash.display.*;
import Box2D.Dynamics.*;
import com.mokus.suiciders.chars.*;
import com.boristhebrave.Box2D.Controllers.*;
import flash.utils.*;
public class HeroProcessor extends LevelItemProcessorBase {
public function HeroProcessor(_arg1:b2World){
super(_arg1);
}
override public function process(_arg1:b2MultiController, _arg2:MovieClip, _arg3:Object, _arg4:Dictionary, _arg5:MovieClip, _arg6:CharsManager):b2Body{
var _local7:HeroController = new HeroController(world, _arg6, _arg2, _arg5);
_arg5.addChild(_local7.clip);
return (_local7.body);
}
}
}//package com.mokus.suiciders.levels
Section 210
//JointProcessorBase (com.mokus.suiciders.levels.JointProcessorBase)
package com.mokus.suiciders.levels {
import flash.display.*;
import flash.geom.*;
import com.kavalok.collections.*;
import Box2D.Dynamics.*;
import flash.utils.*;
public class JointProcessorBase extends LevelItemProcessorBase {
public function JointProcessorBase(_arg1:b2World){
super(_arg1);
}
protected function getBodies(_arg1:MovieClip, _arg2:Dictionary):ArrayList{
var _local4:Object;
var _local5:Point;
var _local3:ArrayList = new ArrayList();
for (_local4 in _arg2) {
_local5 = _arg1.localToGlobal(new Point());
if (_local4.hitTestPoint(_local5.x, _local5.y, true)){
_local3.addItem(_arg2[_local4]);
};
};
return (_local3);
}
}
}//package com.mokus.suiciders.levels
Section 211
//LevelBuilder (com.mokus.suiciders.levels.LevelBuilder)
package com.mokus.suiciders.levels {
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.chars.*;
import com.boristhebrave.Box2D.Controllers.*;
import flash.utils.*;
import com.mokus.suiciders.*;
public class LevelBuilder {
private var _processors:Object;
private var _root:DisplayObjectContainer;
private var _level:MovieClip;
private var _createdBodies:Dictionary;
private var _jointProcessors:Object;
private var _world:b2World;
private var _controller:b2MultiController;
public static const CONTROLLER_CONFIG:String = "controllerConfig";
public function LevelBuilder(_arg1:b2World, _arg2:DisplayObjectContainer){
_processors = {};
_jointProcessors = {};
_createdBodies = new Dictionary();
super();
_world = _arg1;
_root = _arg2;
_processors.square = new SquareProcessor(_arg1);
_processors.triangle = new TriangleProcessor(_arg1);
_processors.circle = new CircleProcessor(_arg1);
_processors.char = new CharProcessor(_arg1);
_processors.body = new BodyProcessor(_arg1);
_processors.hero = new HeroProcessor(_arg1);
_jointProcessors.revoluteJoint = new RevoluteJointProcessor(_arg1);
_jointProcessors.pulleyJoint = new PulleyJointProcessor(_arg1);
_jointProcessors.distanceJoint = new DistanceJointProcessor(_arg1);
}
public function step(_arg1:Number):void{
if (_controller){
_controller.Step(_arg1);
};
}
private function processChild(_arg1:Object, _arg2:MovieClip, _arg3:MovieClip, _arg4:CharsManager, _arg5:DisplayObject):void{
var _local9:b2Body;
var _local6:Object = GraphUtils.getParameters(_arg2, SuicidersConstants.CONFIG_ID);
var _local7:String = _local6.type;
var _local8:LevelItemProcessorBase = _arg1[_local7];
if (_local8){
_arg4.addMoveArea(_arg5);
_local9 = _local8.process(_controller, _arg2, _local6, _createdBodies, _arg3, _arg4);
if (_local9){
_createdBodies[_arg2] = _local9;
if (_controller){
_controller.AddBody(_local9);
};
};
};
}
private function processChildren(_arg1:Object, _arg2:MovieClip, _arg3:MovieClip, _arg4:CharsManager, _arg5:DisplayObject):void{
var _local7:MovieClip;
var _local6:int;
while (_local6 < _arg2.numChildren) {
_local7 = MovieClip(_arg2.getChildAt(_local6));
processChild(_arg1, _local7, _arg3, _arg4, _arg5);
_local6++;
};
}
public function process(_arg1:MovieClip, _arg2:CharsManager, _arg3:Object):void{
_level = _arg1;
var _local4:MovieClip = _arg1.physixContent;
var _local5:MovieClip = _arg1.charsContainer;
_local4.visible = false;
_root.addChild(_arg1);
createController(_arg1);
_world.SetGravity(new b2Vec2(0, (((_arg3.gravity) || (SuicidersConstants.GRAVITY)) * SuicidersConstants.X_MULT)));
var _local6:DisplayObject = _arg1.getChildByName("moveArea");
if (_local6){
_local6.visible = false;
};
processChildren(_processors, _local4, _local5, _arg2, _local6);
processChildren(_jointProcessors, _local4, _local5, _arg2, _local6);
}
private function createController(_arg1:MovieClip):void{
var _local2:Object;
var _local3:Class;
var _local4:String;
if (GraphUtils.hasParameters(_arg1, CONTROLLER_CONFIG)){
_local2 = GraphUtils.getParameters(_arg1, CONTROLLER_CONFIG);
_local3 = ReflectUtil.getTypeByName(_local2.type);
_controller = new (_local3);
for (_local4 in _local2) {
if (_local4 != "type"){
_controller[_local4] = _local2[_local4];
if (_local4 == "offset"){
_controller[_local4] = (_controller[_local4] * SuicidersConstants.X_MULT);
};
};
};
};
}
public function dispose():void{
_root.removeChild(_level);
}
}
}//package com.mokus.suiciders.levels
Section 212
//LevelItemProcessorBase (com.mokus.suiciders.levels.LevelItemProcessorBase)
package com.mokus.suiciders.levels {
import flash.display.*;
import Box2D.Dynamics.*;
import com.mokus.suiciders.chars.*;
import com.boristhebrave.Box2D.Controllers.*;
import flash.utils.*;
public class LevelItemProcessorBase {
protected var world:b2World;
public function LevelItemProcessorBase(_arg1:b2World){
this.world = _arg1;
}
public function process(_arg1:b2MultiController, _arg2:MovieClip, _arg3:Object, _arg4:Dictionary, _arg5:MovieClip, _arg6:CharsManager):b2Body{
return (null);
}
}
}//package com.mokus.suiciders.levels
Section 213
//LevelLoader (com.mokus.suiciders.levels.LevelLoader)
package com.mokus.suiciders.levels {
import flash.events.*;
import flash.display.*;
import com.mokus.suiciders.ui.*;
import com.kavalok.events.*;
import flash.geom.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.chars.*;
import com.mokus.suiciders.gamePlay.*;
import com.mokus.suiciders.physix.*;
import com.mokus.util.*;
import com.mokus.suiciders.data.*;
import com.mokus.suiciders.*;
public class LevelLoader {
protected var _level:MovieClip;
public var world:b2World;
private var _physixClips:PhysixClips;
private var _debugDraw:b2DebugDraw;
protected var physixEnabled:Boolean;
protected var _root:Sprite;
private var _stageView:StageView;
private var _line:McLine;
private var _levelIndex:int;
private var _levelPlayer:ControlPointsPlayer;
private var _levelBuilder:LevelBuilder;
private var _garbageManager:GarbageManager;
protected var _stageScroller:StageScroller;
private var _config:Object;
private var _windController:WindController;
private var _iterations:Number;
private var _levelCompleteEvent:EventSender;
private var _levelBackEvent:EventSender;
private var _charsManager:CharsManager;
protected var _levelClass:Class;
public static const TIME_STEP:Number = 0;
public static const ITERATIONS:int = 4;
public function LevelLoader(){
_line = new McLine();
_levelBackEvent = new EventSender();
_levelCompleteEvent = new EventSender();
super();
}
public function playLevelIntro():void{
_levelPlayer.finishEvent.addListener(onControlPointsFinish);
_levelPlayer.play();
if (_stageScroller){
_stageScroller.enabled = false;
};
}
public function dispose():void{
if (_stageScroller){
_stageScroller.dispose();
};
_garbageManager.dispose();
_windController.dispose();
if (_stageView){
_root.removeChild(_stageView.content);
};
_root.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
_levelBuilder.dispose();
CursorManager.instance.cursorVisible = false;
}
protected function playLevel():void{
createWorld();
_root.addEventListener(Event.ENTER_FRAME, onEnterFrame);
createStage(_level, _config);
CursorManager.instance.cursorVisible = true;
if (_level.controlPoints){
_level.controlPoints.visible = false;
};
playMusic();
}
private function onEnterFrame(_arg1:Event):void{
if (physixEnabled){
_levelBuilder.step(TIME_STEP);
world.Step(TIME_STEP, _iterations);
};
if (_stageView){
_stageView.update();
};
_physixClips.update();
}
private function onRestart():void{
Analytics.track((("level" + _levelIndex) + "/restart"));
dispose();
playLevel();
physixEnabled = true;
_charsManager.physixEnabled = true;
_stageScroller.enabled = true;
}
private function initDebug(_arg1:Sprite):void{
_debugDraw = new b2DebugDraw();
_debugDraw.m_sprite = _arg1;
_debugDraw.m_fillAlpha = 0.3;
_debugDraw.m_lineThickness = 1;
_debugDraw.m_drawFlags = (b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit);
world.SetDebugDraw(_debugDraw);
}
public function get levelCompleteEvent():EventSender{
return (_levelCompleteEvent);
}
public function loadLevel(_arg1:Sprite, _arg2:Class):void{
_root = _arg1;
_levelClass = _arg2;
_levelIndex = LevelsView.levels.indexOf(_arg2);
playLevel();
physixEnabled = false;
_levelPlayer = new ControlPointsPlayer(_level, _stageScroller);
if (_levelIndex >= 0){
Analytics.track((("level" + _levelIndex) + "/load"));
};
}
protected function stopMusic():void{
SoundManager.instance.stopMusic();
}
private function onLevelComplete():void{
_stageView.backEvent.removeListener(onLevelBack);
_stageView.restartEvent.removeListener(onRestart);
Analytics.track((("level" + _levelIndex) + "/complete"));
var _local1:UserData = new UserData();
_local1.completeLevel(_levelIndex, _stageView.score, _stageView.seconds, _stageView.moves);
levelCompleteEvent.sendEvent(_levelIndex);
levelCompleteEvent.removeListeners();
}
public function get levelBackEvent():EventSender{
return (_levelBackEvent);
}
protected function playMusic():void{
var _local1:int = LevelsView.getChapter(_level);
SoundManager.instance.playChapterMusic(_local1);
}
protected function createStage(_arg1:MovieClip, _arg2:Object):void{
_stageScroller = new StageScroller(_arg1, _arg2);
_stageView = new StageView(_stageScroller, _charsManager, _windController);
_stageView.levelCompleteEvent.addListener(onLevelComplete);
_stageView.backEvent.addListener(onLevelBack);
_stageView.restartEvent.addListener(onRestart);
_stageView.neededHeight = _arg2.height;
_charsManager.addForeground(_stageView.content);
_charsManager.scroller = _stageScroller;
_root.addChild(_stageView.content);
}
private function onLevelBack():void{
Analytics.track((("level" + _levelIndex) + "/back"));
levelBackEvent.sendEvent();
}
private function onControlPointsFinish():void{
physixEnabled = true;
_charsManager.physixEnabled = true;
if (_stageScroller){
_stageScroller.enabled = true;
};
}
protected function createWorld():void{
_level = new _levelClass();
var _local1:b2AABB = new b2AABB();
_local1.lowerBound.Set(-1000, -2000);
_local1.upperBound.Set(3000, 2000);
var _local2:b2Vec2 = new b2Vec2(0, SuicidersConstants.GRAVITY);
world = new b2World(_local1, _local2, true);
_physixClips = new PhysixClips(world);
world.SetContactListener(_physixClips);
_levelBuilder = new LevelBuilder(world, _root);
_config = GraphUtils.getParameters(_level, SuicidersConstants.CONFIG_ID);
_iterations = ((_config.iterations) || (ITERATIONS));
var _local3:Point = new Point(_config.levelWidth, _config.levelHeight);
GraphUtils.removeAllChildren(_level.charsContainer);
_charsManager = new CharsManager(_physixClips, _level.charsContainer, _config, _local3);
_windController = new WindController(world, _config.wind);
_garbageManager = new GarbageManager(_level, _local3, _local2.y, _windController, _level.charsContainer);
_level.addChild(_line);
_charsManager.addForeground(_level.foreground);
_line.y = (SuicidersConstants.SCREEN_HEIGHT - _config.height);
_levelBuilder.process(_level, _charsManager, _config);
}
}
}//package com.mokus.suiciders.levels
Section 214
//MenuLoader (com.mokus.suiciders.levels.MenuLoader)
package com.mokus.suiciders.levels {
import flash.events.*;
import flash.display.*;
import com.mokus.suiciders.ui.*;
import com.kavalok.events.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.gamePlay.*;
import com.kavalok.gameplay.controls.*;
import com.mokus.util.*;
import com.mokus.suiciders.data.*;
import com.mokus.suiciders.*;
public class MenuLoader extends LevelLoader {
private var _data:UserData;
private var _window:YesNoWindow;
private var _credits:EventSender;
private var _newGameEvent:EventSender;
private var _bubbleBoxButton:ButtonBase;
private var _continueEvent:EventSender;
private var _highScoresEvent:EventSender;
public function MenuLoader(){
_data = new UserData();
_credits = new EventSender();
_continueEvent = new EventSender();
_newGameEvent = new EventSender();
_highScoresEvent = new EventSender();
super();
}
private function onContinueClick(_arg1:MouseEvent):void{
Analytics.track("continue");
continueEvent.sendEvent();
}
override protected function stopMusic():void{
}
private function onHighScoresClick(_arg1:MouseEvent):void{
new HighScoreUtil(true).trySubmit(_root.stage);
}
public function get newGameEvent():EventSender{
return (_newGameEvent);
}
private function onCreditsClick(_arg1:MouseEvent):void{
Analytics.track("credits");
credits.sendEvent();
}
override protected function playMusic():void{
SoundManager.instance.playMusic(SoundMenuNew);
}
private function onNewGameYes():void{
_root.removeChild(_window.content);
_data.newGame();
newGameEvent.sendEvent();
}
public function get credits():EventSender{
return (_credits);
}
override public function dispose():void{
super.dispose();
credits.removeListeners();
continueEvent.removeListeners();
highScoresEvent.removeListeners();
newGameEvent.removeListeners();
}
override protected function createStage(_arg1:MovieClip, _arg2:Object):void{
var _local3:LevelMenu = LevelMenu(_arg1);
var _local4:UserData = new UserData();
_local3.continueButton.visible = (_local4.completeLevels > 0);
_local3.creditsButton.addEventListener(MouseEvent.CLICK, onCreditsClick);
_local3.continueButton.addEventListener(MouseEvent.CLICK, onContinueClick);
_local3.newGameButton.addEventListener(MouseEvent.CLICK, onNewGameClick);
_local3.highScoresButton.addEventListener(MouseEvent.CLICK, onHighScoresClick);
if (SuicidersConstants.MINDJOLT){
_local3.highScoresButton.visible = false;
_local3.continueButton.y = _local3.newGameButton.y;
_local3.newGameButton.y = _local3.highScoresButton.y;
};
_bubbleBoxButton = new ButtonBase(_local3.bubbleBox);
GraphUtils.makeButton(_bubbleBoxButton.content);
GraphUtils.makeButton(_local3.iphone);
_bubbleBoxButton.content.addEventListener(MouseEvent.CLICK, new ArgumentReplacer(SponsorUtil.navigateToSponsor, "menu").handle);
_local3.iphone.addEventListener(MouseEvent.CLICK, SponsorUtil.navigateToIphone);
}
public function get continueEvent():EventSender{
return (_continueEvent);
}
private function onNewGameClick(_arg1:MouseEvent):void{
Analytics.track("newGame");
if (_data.completeLevels == 0){
newGameEvent.sendEvent();
} else {
_window = new YesNoWindow(new McNewGameWindow());
_window.yes.addListener(onNewGameYes);
_window.no.addListener(onNewGameNo);
_root.addChild(_window.content);
};
}
public function get highScoresEvent():EventSender{
return (_highScoresEvent);
}
private function onNewGameNo():void{
_root.removeChild(_window.content);
}
override protected function playLevel():void{
super.playLevel();
CursorManager.instance.cursorVisible = false;
}
}
}//package com.mokus.suiciders.levels
Section 215
//PulleyJointProcessor (com.mokus.suiciders.levels.PulleyJointProcessor)
package com.mokus.suiciders.levels {
import flash.display.*;
import flash.geom.*;
import Box2D.Dynamics.*;
import Box2D.Dynamics.Joints.*;
import com.mokus.suiciders.chars.*;
import com.boristhebrave.Box2D.Controllers.*;
import flash.utils.*;
import com.mokus.util.*;
public class PulleyJointProcessor extends JointProcessorBase {
public function PulleyJointProcessor(_arg1:b2World){
super(_arg1);
}
override public function process(_arg1:b2MultiController, _arg2:MovieClip, _arg3:Object, _arg4:Dictionary, _arg5:MovieClip, _arg6:CharsManager):b2Body{
var _local7:b2Body = getBodies(_arg2.point1, _arg4).first;
var _local8:b2Body = getBodies(_arg2.point2, _arg4).first;
var _local9:Point = _arg2.point1.localToGlobal(new Point());
var _local10:Point = _arg2.point2.localToGlobal(new Point());
var _local11:Point = _arg2.anchor1.localToGlobal(new Point());
var _local12:Point = _arg2.anchor2.localToGlobal(new Point());
var _local13:b2PulleyJointDef = new b2PulleyJointDef();
_local13.Initialize(_local7, _local8, Box2dUtil.toB2Vec2(_local11), Box2dUtil.toB2Vec2(_local12), Box2dUtil.toB2Vec2(_local9), Box2dUtil.toB2Vec2(_local10), 1);
_local13.collideConnected = false;
world.CreateJoint(_local13);
return (null);
}
}
}//package com.mokus.suiciders.levels
Section 216
//RevoluteJointProcessor (com.mokus.suiciders.levels.RevoluteJointProcessor)
package com.mokus.suiciders.levels {
import flash.display.*;
import com.kavalok.collections.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Dynamics.Joints.*;
import com.mokus.suiciders.chars.*;
import com.boristhebrave.Box2D.Controllers.*;
import flash.utils.*;
import com.mokus.suiciders.*;
import com.kavalok.errors.*;
public class RevoluteJointProcessor extends JointProcessorBase {
public function RevoluteJointProcessor(_arg1:b2World){
super(_arg1);
}
override public function process(_arg1:b2MultiController, _arg2:MovieClip, _arg3:Object, _arg4:Dictionary, _arg5:MovieClip, _arg6:CharsManager):b2Body{
var _local9:b2Body;
var _local7:ArrayList = getBodies(_arg2, _arg4);
if (_local7.length > 2){
throw (new IllegalStateError("too much bodies in joint"));
};
var _local8:b2RevoluteJointDef = new b2RevoluteJointDef();
if (_local7[0].IsDynamic()){
_local9 = _local7.shift();
_local7.push(_local9);
};
_local8.Initialize(_local7[0], _local7[1], new b2Vec2((_arg2.x * SuicidersConstants.X_MULT), (_arg2.y * SuicidersConstants.X_MULT)));
if (_arg3.upperAngle){
_local8.enableLimit = true;
_local8.lowerAngle = _arg3.lowerAngle;
_local8.upperAngle = _arg3.upperAngle;
};
_local8.collideConnected = false;
world.CreateJoint(_local8);
return (null);
}
}
}//package com.mokus.suiciders.levels
Section 217
//ShapeProcessor (com.mokus.suiciders.levels.ShapeProcessor)
package com.mokus.suiciders.levels {
import flash.display.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.chars.*;
import com.mokus.suiciders.physix.*;
import com.boristhebrave.Box2D.Controllers.*;
import flash.utils.*;
import com.mokus.suiciders.*;
public class ShapeProcessor extends LevelItemProcessorBase {
public function ShapeProcessor(_arg1:b2World){
super(_arg1);
}
protected function addShape(_arg1:b2Body, _arg2:Object, _arg3:b2ShapeDef):void{
_arg3.restitution = ((_arg2.restitution) || (SuicidersConstants.RESTITUTION));
_arg3.friction = ((_arg2.friction) || (SuicidersConstants.FRICTION));
if (_arg2.dynamic){
_arg3.density = ((_arg2.density) || (SuicidersConstants.DENSITY));
};
_arg1.CreateShape(_arg3);
}
private function createView(_arg1:String, _arg2:MovieClip, _arg3:MovieClip):MovieClip{
var _local4:MovieClip;
var _local5:Class;
if (_arg1){
_local5 = ReflectUtil.getTypeByName(_arg1);
_local4 = new (_local5);
_local4.transform.matrix = _arg2.transform.matrix;
_arg3.addChild(_local4);
};
return (_local4);
}
protected function addShapes(_arg1:b2Body, _arg2:Object, _arg3:MovieClip):void{
var _local4:b2ShapeDef = createShape(_arg3, _arg3);
addShape(_arg1, _arg2, _local4);
}
public function createShape(_arg1:MovieClip, _arg2:MovieClip):b2ShapeDef{
return (null);
}
override public function process(_arg1:b2MultiController, _arg2:MovieClip, _arg3:Object, _arg4:Dictionary, _arg5:MovieClip, _arg6:CharsManager):b2Body{
var _local12:b2MassData;
var _local7:b2BodyDef = new b2BodyDef();
_local7.position.Set((_arg2.x * SuicidersConstants.X_MULT), (_arg2.y * SuicidersConstants.X_MULT));
var _local8:b2Body = world.CreateBody(_local7);
addShapes(_local8, _arg3, _arg2);
var _local9:MovieClip = createView(_arg3.viewClass, _arg2, _arg5);
var _local10:MovieClip = createView(_arg3.moveArea, _arg2, _arg5);
if (_local10){
_arg6.addMoveArea(_local10);
};
var _local11:BodyClip = new BodyClip(_local8, _local9, _arg3, _local10);
_local11.rotationOffset = _arg2.rotation;
_local8.SetMassFromShapes();
if (((!((_arg3.mass == null))) || (!((_arg3.i == null))))){
_local12 = new b2MassData();
_local12.mass = (_arg3.mass * SuicidersConstants.MASS_MULT);
_local12.I = ((_arg3.i == null)) ? (_arg3.mass * _arg3.mass) : _arg3.i;
_local8.SetMass(_local12);
};
return (_local8);
}
}
}//package com.mokus.suiciders.levels
Section 218
//SquareProcessor (com.mokus.suiciders.levels.SquareProcessor)
package com.mokus.suiciders.levels {
import flash.display.*;
import flash.geom.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import com.mokus.suiciders.*;
public class SquareProcessor extends ShapeProcessor {
public function SquareProcessor(_arg1:b2World){
super(_arg1);
}
protected function get points():Array{
return ([new Point(-50, -50), new Point(50, -50), new Point(50, 50), new Point(-50, 50)]);
}
override public function createShape(_arg1:MovieClip, _arg2:MovieClip):b2ShapeDef{
var _local6:Point;
var _local3:b2PolygonDef = new b2PolygonDef();
_local3.vertexCount = points.length;
var _local4:Point = _arg2.localToGlobal(new Point());
var _local5:int;
while (_local5 < points.length) {
_local6 = _arg1.localToGlobal(points[_local5]);
_local3.vertices[_local5].Set(((_local6.x - _local4.x) * SuicidersConstants.X_MULT), ((_local6.y - _local4.y) * SuicidersConstants.X_MULT));
_local5++;
};
return (_local3);
}
}
}//package com.mokus.suiciders.levels
Section 219
//TriangleProcessor (com.mokus.suiciders.levels.TriangleProcessor)
package com.mokus.suiciders.levels {
import flash.geom.*;
import Box2D.Dynamics.*;
public class TriangleProcessor extends SquareProcessor {
public function TriangleProcessor(_arg1:b2World){
super(_arg1);
}
override protected function get points():Array{
return ([new Point(-50, -50), new Point(50, 50), new Point(-50, 50)]);
}
}
}//package com.mokus.suiciders.levels
Section 220
//Loader (com.mokus.suiciders.loader.Loader)
package com.mokus.suiciders.loader {
import flash.events.*;
import flash.display.*;
import com.mokus.util.*;
import com.kavalok.events.*;
import com.kavalok.utils.*;
import com.kavalok.gameplay.controls.*;
public class Loader extends Sprite {
private var _loader:McLoader;
public function Loader(){
_loader = new McLoader();
super();
addChild(_loader);
Analytics.initialize(stage, "hujeTower");
_loader.stop();
addEventListener(Event.ENTER_FRAME, onEnterFrame);
new ButtonBase(_loader.bubbleBox);
GraphUtils.makeButton(_loader.bboygames);
_loader.bubbleBox.addEventListener(MouseEvent.CLICK, new ArgumentReplacer(SponsorUtil.navigateToSponsor, "loader").handle);
_loader.bboygames.addEventListener(MouseEvent.CLICK, SponsorUtil.navigateToIphone);
}
private function onEnterFrame(_arg1:Event):void{
var _local3:Class;
var _local4:MovieClip;
var _local2:int = ((loaderInfo.bytesLoaded / loaderInfo.bytesTotal) * 100);
if (_local2 > _loader.currentFrame){
_loader.play();
} else {
_loader.stop();
};
if ((((_local2 == 100)) && ((_loader.currentFrame == _loader.totalFrames)))){
_loader.stop();
_local3 = ReflectUtil.getTypeByName("Suiciders");
_local4 = new (_local3);
stage.addChild(_local4);
stage.removeChild(this);
_local4.initialize();
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
};
}
}
}//package com.mokus.suiciders.loader
Section 221
//BodyClip (com.mokus.suiciders.physix.BodyClip)
package com.mokus.suiciders.physix {
import flash.display.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.chars.*;
import com.mokus.suiciders.*;
public class BodyClip {
private var _config:Object;
private var _body:b2Body;
private var _charCollisionForce:b2Vec2;
private var _clip:DisplayObject;
public var rotationOffset:Number;// = 0
private var _collisionForce:b2Vec2;
private var _moveArea:DisplayObject;
public function BodyClip(_arg1:b2Body, _arg2:DisplayObject, _arg3:Object, _arg4:MovieClip){
var _local5:Array;
super();
_config = ((_arg3) || ({}));
if (_arg2){
_clip = _arg2;
_clip.cacheAsBitmap = true;
};
_moveArea = _arg4;
this.body = _arg1;
if (_arg3.collisionForce){
_local5 = _arg3.collisionForce.split(",");
_collisionForce = new b2Vec2((_local5[0] * SuicidersConstants.X_MULT), (_local5[1] * SuicidersConstants.X_MULT));
};
if (_arg3.charCollisionForce){
_local5 = _arg3.charCollisionForce.split(",");
_charCollisionForce = new b2Vec2((_local5[0] * SuicidersConstants.X_MULT), (_local5[1] * SuicidersConstants.X_MULT));
};
update();
}
public function get config():Object{
return (_config);
}
public function set body(_arg1:b2Body):void{
_body = _arg1;
if (_body){
_body.SetUserData(this);
};
}
public function onCollision(_arg1:b2Body, _arg2:b2ContactPoint):void{
if (((_charCollisionForce) && ((_arg1.GetUserData() is CharController)))){
body.ApplyForce(new b2Vec2((_charCollisionForce.x * body.GetMass()), (_charCollisionForce.y * body.GetMass())), _arg2.position);
};
if (_collisionForce){
_arg1.ApplyForce(new b2Vec2((_collisionForce.x * _arg1.GetMass()), (_collisionForce.y * _arg1.GetMass())), _arg2.position);
};
}
public function update():void{
var _local1:Number;
if (_body){
if (_moveArea){
_moveArea.x = (_body.GetPosition().x / SuicidersConstants.X_MULT);
_moveArea.y = (_body.GetPosition().y / SuicidersConstants.X_MULT);
_moveArea.rotation = (Maths.radiansToDegrees(_body.GetAngle()) + rotationOffset);
};
if (_clip){
_clip.x = (_body.GetPosition().x / SuicidersConstants.X_MULT);
_clip.y = (_body.GetPosition().y / SuicidersConstants.X_MULT);
_local1 = (body.GetAngle() - ((int(((_body.GetAngle() / Math.PI) / 2)) * Math.PI) * 2));
_clip.rotation = (Maths.radiansToDegrees(_local1) + rotationOffset);
};
if (_config.w){
_body.SetAngularVelocity(_config.w);
};
if (_config.torque){
_body.ApplyTorque(_config.torque);
};
};
}
public function get clip():DisplayObject{
return (_clip);
}
public function get body():b2Body{
return (_body);
}
public function dispose():void{
}
}
}//package com.mokus.suiciders.physix
Section 222
//JointClip (com.mokus.suiciders.physix.JointClip)
package com.mokus.suiciders.physix {
import flash.display.*;
import Box2D.Dynamics.Joints.*;
import com.mokus.suiciders.chars.*;
import com.mokus.suiciders.*;
public class JointClip {
private var _addWidth:Number;
private var _joint:b2Joint;
private var _clip:DisplayObject;
public function JointClip(_arg1:b2Joint, _arg2:DisplayObject, _arg3:Number=0){
_addWidth = ((_arg3) || (0));
_arg1.SetUserData(this);
_joint = _arg1;
_clip = _arg2;
}
public function get clip():DisplayObject{
return (_clip);
}
public function update():void{
_clip.rotation = 0;
_clip.width = (((PhysixUtil.getDistance(_joint.GetAnchor2(), _joint.GetAnchor1()) / SuicidersConstants.X_MULT) + CharsManager.JOINT_OFFSET) + _addWidth);
_clip.rotation = PhysixUtil.getAngle(_joint.GetAnchor2(), _joint.GetAnchor1());
_clip.x = (_joint.GetAnchor1().x / SuicidersConstants.X_MULT);
_clip.y = (_joint.GetAnchor1().y / SuicidersConstants.X_MULT);
}
public function destroy():void{
if (clip.parent){
clip.parent.removeChild(clip);
};
_joint.GetBody1().GetWorld().DestroyJoint(_joint);
}
}
}//package com.mokus.suiciders.physix
Section 223
//PhysixClips (com.mokus.suiciders.physix.PhysixClips)
package com.mokus.suiciders.physix {
import flash.display.*;
import Box2D.Collision.*;
import Box2D.Dynamics.*;
import Box2D.Dynamics.Joints.*;
public class PhysixClips extends b2ContactListener {
private var _world:b2World;
public function PhysixClips(_arg1:b2World){
_world = _arg1;
}
override public function Add(_arg1:b2ContactPoint):void{
callCollision(_arg1);
}
public function get world():b2World{
return (_world);
}
override public function Persist(_arg1:b2ContactPoint):void{
callCollision(_arg1);
}
public function registerJoint(_arg1:b2Joint, _arg2:DisplayObject):void{
_arg2.visible = true;
new JointClip(_arg1, _arg2);
}
public function update():void{
var _local3:BodyClip;
var _local4:JointClip;
var _local1:b2Body = _world.GetBodyList();
while (_local1) {
_local3 = (_local1.GetUserData() as BodyClip);
if (_local3){
_local3.update();
};
_local1 = _local1.GetNext();
};
var _local2:b2Joint = _world.GetJointList();
while (_local2) {
_local4 = (_local2.GetUserData() as JointClip);
if (_local4){
_local4.update();
};
_local2 = _local2.GetNext();
};
}
override public function Remove(_arg1:b2ContactPoint):void{
}
private function callCollision(_arg1:b2ContactPoint):void{
var _local2:BodyClip = (_arg1.shape1.GetBody().GetUserData() as BodyClip);
var _local3:BodyClip = (_arg1.shape2.GetBody().GetUserData() as BodyClip);
if (_local2){
_local2.onCollision(_arg1.shape2.GetBody(), _arg1);
};
if (_local3){
_local3.onCollision(_arg1.shape1.GetBody(), _arg1);
};
}
}
}//package com.mokus.suiciders.physix
Section 224
//PhysixUtil (com.mokus.suiciders.physix.PhysixUtil)
package com.mokus.suiciders.physix {
import flash.geom.*;
import Box2D.Common.Math.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.*;
public class PhysixUtil {
public static function pointToVec(_arg1:Point):b2Vec2{
return (new b2Vec2((_arg1.x * SuicidersConstants.X_MULT), (_arg1.y * SuicidersConstants.X_MULT)));
}
public static function getDistance(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (new Point((_arg1.x - _arg2.x), (_arg1.y - _arg2.y)).length);
}
public static function getAngle(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number = Math.atan2((_arg1.y - _arg2.y), (_arg1.x - _arg2.x));
return (Maths.radiansToDegrees(_local3));
}
}
}//package com.mokus.suiciders.physix
Section 225
//PossibleJoint (com.mokus.suiciders.physix.PossibleJoint)
package com.mokus.suiciders.physix {
import Box2D.Dynamics.*;
public class PossibleJoint {
public var body:b2Body;
public var joinable:Boolean;
public var distance:Number;
public function PossibleJoint(_arg1:b2Body, _arg2:Number, _arg3:Boolean){
this.body = _arg1;
this.distance = _arg2;
this.joinable = _arg3;
}
}
}//package com.mokus.suiciders.physix
Section 226
//LevelChar (com.mokus.suiciders.ui.levels.LevelChar)
package com.mokus.suiciders.ui.levels {
import flash.events.*;
import flash.display.*;
import com.kavalok.events.*;
import com.kavalok.utils.*;
import com.kavalok.gameplay.controls.*;
import com.mokus.suiciders.chars.actions.*;
public class LevelChar extends FlashViewBase {
private var _levelSelect:EventSender;
public var level:Class;
public var levelIndex:int;
private var _out:EventSender;
private var _over:EventSender;
private var _sleep:Boolean;// = true
private var _content:MovieClip;
public function LevelChar(_arg1:MovieClip, _arg2:Boolean){
_levelSelect = new EventSender();
_over = new EventSender();
_out = new EventSender();
_content = _arg1;
super(_arg1);
sleepAnimation.visible = _arg2;
if (_arg2){
sleepAnimation.gotoAndPlay((Maths.random(sleepAnimation.totalFrames) + 1));
} else {
_content.addEventListener(MouseEvent.CLICK, onClick);
_content.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
_content.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
_content.buttonMode = true;
_content.mouseChildren = false;
_content.useHandCursor = true;
};
}
public function get levelSelect():EventSender{
return (_levelSelect);
}
private function onClick(_arg1:MouseEvent):void{
levelSelect.sendEvent(level);
}
private function get sleepAnimation():MovieClip{
return (_content.sleepAnimation);
}
private function onMouseOver(_arg1:MouseEvent):void{
new EyesAction(_content).execute();
over.sendEvent(levelIndex);
}
public function get out():EventSender{
return (_out);
}
private function onMouseOut(_arg1:MouseEvent):void{
out.sendEvent();
}
public function get over():EventSender{
return (_over);
}
}
}//package com.mokus.suiciders.ui.levels
Section 227
//LevelDataView (com.mokus.suiciders.ui.levels.LevelDataView)
package com.mokus.suiciders.ui.levels {
import flash.events.*;
import com.mokus.suiciders.ui.*;
import flash.geom.*;
import com.kavalok.utils.*;
import com.kavalok.gameplay.controls.*;
import com.mokus.suiciders.data.*;
import com.mokus.suiciders.*;
public class LevelDataView extends FlashViewBase {
private var _userData:UserData;
private var _content:McLevelDescription1;
private static const OFFSET:int = 20;
private static const FRAMES:int = 5;
private static const ALPHA:Number = 0.8;
public function LevelDataView(_arg1:McLevelDescription1){
_userData = new UserData();
_content = _arg1;
super(_content);
_content.alpha = 0;
_content.parent.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
}
public function hide():void{
new SpriteTweaner(_content, {alpha:0}, FRAMES);
}
private function onMouseMove(_arg1:MouseEvent):void{
_content.x = (_content.parent.mouseX + OFFSET);
var _local2:Point = _content.parent.globalToLocal(new Point(_arg1.stageX, _arg1.stageY));
_content.y = _content.parent.mouseY;
if ((_arg1.stageY + (_content.height / 2)) > SuicidersConstants.SCREEN_HEIGHT){
_content.y = (_content.y - ((_arg1.stageY + (_content.height / 2)) - SuicidersConstants.SCREEN_HEIGHT));
};
if ((_arg1.stageY - (_content.height / 2)) < 0){
_content.y = (_content.y - (_arg1.stageY - (_content.height / 2)));
};
if ((_content.x + _content.width) > SuicidersConstants.SCREEN_WIDTH){
_content.x = ((_content.parent.mouseX - OFFSET) - _content.width);
};
}
public function show(_arg1:int):void{
var _local3:Object;
new SpriteTweaner(_content, {alpha:ALPHA}, FRAMES);
var _local2:int = int((_arg1 / SuicidersConstants.LEVELS_IN_CHAPTER));
_content.chapterField.text = Strings.substitute(Messages.CHAPTER, (_local2 + 1), Messages.CHAPTERS[_local2]);
_content.levelField.text = Strings.substitute(Messages.LEVEL, (_arg1 + 1));
if (_arg1 < _userData.completeLevels){
_local3 = _userData.getLevelData(_arg1);
if (_local3 == null){
return;
};
_content.scoreField.text = Strings.substitute(Messages.SCORE, _local3.score);
_content.movesField.text = Strings.substitute(Messages.MOVES, _local3.moves);
_content.timeField.text = Strings.substitute(Messages.TIME, TimeUtils.getTimeString((_local3.time * 1000)));
} else {
_content.scoreField.text = Messages.NOT_COMPLETED_YET;
_content.movesField.text = "";
_content.timeField.text = "";
};
}
public function dispose():void{
_content.parent.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
}
}
}//package com.mokus.suiciders.ui.levels
Section 228
//ButtonCursorRemover (com.mokus.suiciders.ui.ButtonCursorRemover)
package com.mokus.suiciders.ui {
import flash.events.*;
import flash.display.*;
import com.mokus.suiciders.gamePlay.*;
public class ButtonCursorRemover {
private var _cursorVisible:Boolean;
public function ButtonCursorRemover(_arg1:DisplayObject){
_arg1.addEventListener(MouseEvent.MOUSE_OVER, onMouseOver);
_arg1.addEventListener(MouseEvent.MOUSE_OUT, onMouseOut);
}
private function onMouseOut(_arg1:MouseEvent):void{
CursorManager.instance.cursorVisible = _cursorVisible;
}
private function onMouseOver(_arg1:MouseEvent):void{
_cursorVisible = CursorManager.instance.cursorVisible;
CursorManager.instance.cursorVisible = false;
}
}
}//package com.mokus.suiciders.ui
Section 229
//CreditsView (com.mokus.suiciders.ui.CreditsView)
package com.mokus.suiciders.ui {
import flash.events.*;
import com.kavalok.events.*;
import com.mokus.suiciders.gamePlay.*;
import com.kavalok.gameplay.controls.*;
public class CreditsView extends FlashViewBase {
private var _back:EventSender;
private var _content:McCreditsContainer;
public function CreditsView(){
_content = new McCreditsContainer();
_back = new EventSender();
super(_content);
_content.content.backButton.addEventListener(MouseEvent.CLICK, onBackClick);
SoundManager.instance.playMusic(SoundTimmy);
}
private function onBackClick(_arg1:MouseEvent):void{
back.sendEvent();
back.removeListeners();
}
public function get back():EventSender{
return (_back);
}
}
}//package com.mokus.suiciders.ui
Section 230
//HighscoresWindow (com.mokus.suiciders.ui.HighscoresWindow)
package com.mokus.suiciders.ui {
import flash.events.*;
import com.mokus.util.*;
import com.mokus.suiciders.data.*;
public class HighscoresWindow extends YesNoWindow {
private var _data:UserData;
private var _content:McHighScoresWindow;
public function HighscoresWindow(){
_data = new UserData();
_content = new McHighScoresWindow();
_content.bubbleBoxSender.setScore(_data.calculateHighScore(), SponsorUtil.GAME_ID);
_content.bubbleBoxSender.addEventListener("viewScores", onViewScores);
_content.bubbleBoxSender.addEventListener("sendScores", onSendScores);
super(_content);
}
private function onViewScores(_arg1:Event):void{
Analytics.track("highScores");
no.sendEvent();
}
private function onSendScores(_arg1:Event):void{
_data.highScore = _data.calculateHighScore();
}
}
}//package com.mokus.suiciders.ui
Section 231
//KeyboardDirectionListener (com.mokus.suiciders.ui.KeyboardDirectionListener)
package com.mokus.suiciders.ui {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.ui.*;
public class KeyboardDirectionListener {
public var down:Boolean;
private var _stage:Stage;
public var left:Boolean;
public var up:Boolean;
public var right:Boolean;
private static const A:int = 65;
private static const S:int = 83;
private static const D:int = 68;
private static const W:int = 87;
public function KeyboardDirectionListener(_arg1:Stage){
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
_arg1.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
_stage = _arg1;
}
private function updateValue(_arg1:KeyboardEvent, _arg2:Boolean):void{
if ((((_arg1.keyCode == Keyboard.LEFT)) || ((_arg1.keyCode == A)))){
left = _arg2;
};
if ((((_arg1.keyCode == Keyboard.RIGHT)) || ((_arg1.keyCode == D)))){
right = _arg2;
};
if ((((_arg1.keyCode == Keyboard.UP)) || ((_arg1.keyCode == W)))){
up = _arg2;
};
if ((((_arg1.keyCode == Keyboard.DOWN)) || ((_arg1.keyCode == S)))){
down = _arg2;
};
}
private function onKeyDown(_arg1:KeyboardEvent):void{
updateValue(_arg1, true);
}
private function onKeyUp(_arg1:KeyboardEvent):void{
updateValue(_arg1, false);
}
public function dispose():void{
_stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
_stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
}
public function get direction():Point{
var _local1:Point = new Point();
if (left){
_local1.x--;
};
if (right){
_local1.x++;
};
if (up){
_local1.y--;
};
if (down){
_local1.y++;
};
return (_local1);
}
}
}//package com.mokus.suiciders.ui
Section 232
//LevelsStageView (com.mokus.suiciders.ui.LevelsStageView)
package com.mokus.suiciders.ui {
import flash.events.*;
import com.kavalok.events.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.gamePlay.*;
import com.kavalok.gameplay.controls.*;
import com.mokus.util.*;
public class LevelsStageView extends FlashViewBase {
private var _backEvent:EventSender;
private var _content:McLevelsStage;
public function LevelsStageView(_arg1:StageScroller){
_content = new McLevelsStage();
_backEvent = new EventSender();
super(_content);
new ScrollerToZoomer(_arg1, new Scroller(_content.scroller));
_content.backButton.addEventListener(MouseEvent.CLICK, new ArgumentRemover(backEvent.sendEvent).handle);
GraphUtils.makeButton(_content.bubblebox);
_content.bubblebox.addEventListener(MouseEvent.CLICK, new ArgumentRemover(SponsorUtil.navigateToSponsor).handle);
}
public function get backEvent():EventSender{
return (_backEvent);
}
}
}//package com.mokus.suiciders.ui
Section 233
//LevelsView (com.mokus.suiciders.ui.LevelsView)
package com.mokus.suiciders.ui {
import flash.display.*;
import com.kavalok.events.*;
import flash.geom.*;
import com.kavalok.collections.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.gamePlay.*;
import com.kavalok.gameplay.controls.*;
import com.mokus.suiciders.data.*;
import com.mokus.suiciders.ui.levels.*;
import com.mokus.suiciders.*;
public class LevelsView extends FlashViewBase {
private var _levelSelect:EventSender;
private var _backEvent:EventSender;
private var _arrow:McArrow;
private var _levelDataView:LevelDataView;
private var _levelChars:ArrayList;
private var _scroller:StageScroller;
private var _content:McLevels;
public var levelStageView:LevelsStageView;
private static const JOINT_PREFIX:String = "joint_";
private static const LEVEL_PREFIX:String = "level_";
public static var levels:Array = [Level0, Level3, Level4, Level42, Level7, Level10, Level24, Level38, Level9, Level11, Level13, Level22, Level27, Level30, Level32, Level26, Level34, Level41, Level39, Level17, Level19, Level5, Level18, Level16, Level1, Level15, Level28, Level20, Level29, Level23, Level36, Level12, Level21, Level31, Level25, Level33, Level40, Level14, Level35, Level37];
public function LevelsView(){
_content = new McLevels();
_levelChars = new ArrayList();
_levelSelect = new EventSender();
_backEvent = new EventSender();
_arrow = new McArrow();
super(_content);
_content.addChild(_arrow);
SoundManager.instance.playMusic(SoundMenuNew);
}
public function get levelSelect():EventSender{
return (_levelSelect);
}
public function dispose():void{
_scroller.dispose();
_levelDataView.dispose();
_content.removeChild(_levelDataView.content);
levelSelect.removeListeners();
backEvent.removeListeners();
}
public function get backEvent():EventSender{
return (_backEvent);
}
private function onBack():void{
backEvent.sendEvent();
dispose();
}
private function onLevelSelect(_arg1:Class):void{
levelSelect.sendEvent(_arg1);
dispose();
}
public function initialize(_arg1:Sprite):void{
_scroller = new StageScroller(_content, {levelWidth:SuicidersConstants.SCREEN_WIDTH, levelHeight:(SuicidersConstants.SCREEN_HEIGHT * 2)});
levelStageView = new LevelsStageView(_scroller);
levelStageView.backEvent.addListener(onBack);
_arg1.addChild(levelStageView.content);
}
public function refresh():void{
var _local4:MovieClip;
var _local5:Boolean;
var _local6:LevelChar;
var _local7:MovieClip;
var _local1:McLevelDescription1 = new McLevelDescription1();
_content.addChild(_local1);
_levelDataView = new LevelDataView(_local1);
var _local2:UserData = new UserData();
var _local3:int;
while (_local3 < levels.length) {
_local4 = _content[(LEVEL_PREFIX + _local3)];
_local5 = (_local3 <= _local2.completeLevels);
_local6 = new LevelChar(_local4, !(_local5));
_local6.level = levels[_local3];
_local6.levelIndex = _local3;
_local6.levelSelect.addListener(onLevelSelect);
_local6.over.addListener(_levelDataView.show);
_local6.out.addListener(_levelDataView.hide);
_local7 = _content[(JOINT_PREFIX + _local3)];
if (_local7){
_local7.visible = _local5;
};
_levelChars.addItem(_local6);
if (_local3 == _local2.completeLevels){
_arrow.x = _local4.x;
_arrow.y = (_local4.y - (_local4.height / 2));
_scroller.center = new Point(_local4.x, _local4.y);
};
_local3++;
};
if (_local2.completeLevels == LevelsView.levels.length){
_arrow.visible = false;
};
}
public static function getChapter(_arg1:MovieClip):int{
var _local2:Class = ReflectUtil.getType(_arg1);
return (int((levels.indexOf(_local2) / SuicidersConstants.LEVELS_IN_CHAPTER)));
}
}
}//package com.mokus.suiciders.ui
Section 234
//Messages (com.mokus.suiciders.ui.Messages)
package com.mokus.suiciders.ui {
public class Messages {
public static const HEIGHT_REACHED:String = "Height reached!";
public static const MOVES:String = "{0} moves";
public static const TIME:String = "Time: {0}";
public static const CHAPTERS:Array = ["System Of A Climbing", "City vs City", "Sky is Over", "Out of Space"];
public static const WIND:String = "wind: {0}";
public static const NOT_COMPLETED_YET:String = "Not completed yet";
public static const CHAPTER:String = "Ch.{0}: {1}";
public static const MOVE:String = "{0} move";
public static const LEVEL:String = "Level {0}";
public static const METERS_TO_GO:String = "{0} meters to go!";
public static const SCORE:String = "Score: {0}";
public static const DONE:String = "Done!!!";
}
}//package com.mokus.suiciders.ui
Section 235
//MoviePlayer (com.mokus.suiciders.ui.MoviePlayer)
package com.mokus.suiciders.ui {
import flash.events.*;
import flash.display.*;
import com.kavalok.events.*;
import com.kavalok.gameplay.controls.*;
import com.mokus.util.*;
public class MoviePlayer extends FlashViewBase {
private var _completeEvent:EventSender;
private var _content:MovieClip;
public function MoviePlayer(_arg1:MovieClip){
_completeEvent = new EventSender();
_content = _arg1;
super(_arg1);
_arg1.addEventListener(Event.ENTER_FRAME, onEnterFrame);
if (_arg1.animation.skipButton){
_arg1.animation.skipButton.addEventListener(MouseEvent.CLICK, onSkipClick);
};
}
public function get completeEvent():EventSender{
return (_completeEvent);
}
private function finish():void{
content.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
_content.animation.stop();
completeEvent.sendEvent(this);
}
private function onSkipClick(_arg1:MouseEvent):void{
Analytics.track("intro/skip");
finish();
}
private function onEnterFrame(_arg1:Event):void{
if (_content.animation.currentFrame == _content.animation.totalFrames){
finish();
};
}
}
}//package com.mokus.suiciders.ui
Section 236
//ScrollerToZoomer (com.mokus.suiciders.ui.ScrollerToZoomer)
package com.mokus.suiciders.ui {
import com.mokus.suiciders.gamePlay.*;
public class ScrollerToZoomer {
private var _scroller:StageScroller;
private var _zoomer:Scroller;
public function ScrollerToZoomer(_arg1:StageScroller, _arg2:Scroller){
_scroller = _arg1;
_zoomer = _arg2;
_arg1.zoomEvent.addListener(onZoom);
_arg2.changeEvent.addListener(onZoomChange);
_arg2.position = zoomPosition;
}
private function onZoom():void{
_zoomer.setPosition(zoomPosition);
}
private function onZoomChange(_arg1:Scroller):void{
_scroller.zoom = (_scroller.minZoom + ((StageScroller.MAX_ZOOM - _scroller.minZoom) * (1 - _arg1.position)));
}
private function get zoomPosition():Number{
return ((1 - ((_scroller.zoom - _scroller.minZoom) / (StageScroller.MAX_ZOOM - _scroller.minZoom))));
}
}
}//package com.mokus.suiciders.ui
Section 237
//StageScroller (com.mokus.suiciders.ui.StageScroller)
package com.mokus.suiciders.ui {
import flash.events.*;
import flash.display.*;
import com.kavalok.events.*;
import flash.geom.*;
import com.kavalok.utils.*;
import com.kavalok.gameplay.controls.*;
import com.mokus.suiciders.*;
public class StageScroller extends FlashViewBase {
public var enabled:Boolean;// = true
private var _width:Number;
private var _zoomEvent:EventSender;
private var _backgrounds:Array;
private var _height:Number;
private var _startScrollPosition:Point;
private var _keyboardListener:KeyboardDirectionListener;
private var _muteScrolling:Boolean;
public var offsetMult:Number;// = 1
public var scrolling:Boolean;
private var _zoom:Number;// = 1
private var _clickCenter:Point;
private var _stage:Stage;
private static const MIN_ZOOM:Number = 0.1;
private static const SCROLL_OFFSET:Number = 30;
public static const MAX_ZOOM:Number = 1.5;
private static const SCROLL_STEP:Number = 15;
public function StageScroller(_arg1:MovieClip, _arg2:Object){
_backgrounds = [];
_zoomEvent = new EventSender();
super(_arg1);
_height = _arg2.levelHeight;
_width = _arg2.levelWidth;
_arg1.addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheel);
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
_arg1.addEventListener(Event.ENTER_FRAME, onEnterFrame);
processGround(_arg1.background);
processGround(_arg1.foreground);
_keyboardListener = new KeyboardDirectionListener(_arg1.stage);
_arg1.stage.focus = _arg1.stage;
}
public function unMuteScrolling():void{
if (!_muteScrolling){
return;
};
_stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
_stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
_muteScrolling = false;
}
private function onMouseWheel(_arg1:MouseEvent):void{
if (!enabled){
return;
};
zoom = (zoom + (_arg1.delta / 100));
}
private function onMouseDown(_arg1:MouseEvent):void{
_stage = content.stage;
_stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
_stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
_clickCenter = center;
_startScrollPosition = new Point(content.stage.mouseX, content.stage.mouseY);
_muteScrolling = true;
}
private function scrollHorizontal(_arg1:int):void{
var _local3:BackgroundItem;
var _local2:Number = (content.x + (_arg1 * SCROLL_STEP));
_local2 = Maths.normalizeValue(_local2, (SuicidersConstants.SCREEN_WIDTH - (_width * zoom)), 0);
if (_local2 != content.x){
scrolling = true;
};
content.x = int(_local2);
for each (_local3 in _backgrounds) {
_local3.clip.x = int((_local3.startPosition.x - ((_local2 * (1 - _local3.mult)) / zoom)));
};
}
public function get minZoom():Number{
var _local1:Number = Math.max((SuicidersConstants.SCREEN_HEIGHT / _height), (SuicidersConstants.SCREEN_WIDTH / _width));
return (Math.max(MIN_ZOOM, _local1));
}
public function get zoomEvent():EventSender{
return (_zoomEvent);
}
public function get center():Point{
var _local1:Point = new Point((SuicidersConstants.SCREEN_WIDTH / 2), (SuicidersConstants.SCREEN_HEIGHT / 2));
return (content.globalToLocal(_local1));
}
public function dispose():void{
_keyboardListener.dispose();
content.removeEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheel);
content.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function get zoom():Number{
return (_zoom);
}
private function processGround(_arg1:Sprite):void{
var _local3:MovieClip;
if (_arg1 == null){
return;
};
var _local2:int;
while (_local2 < _arg1.numChildren) {
_local3 = (_arg1.getChildAt(_local2) as MovieClip);
if (((_local3) && (GraphUtils.hasParameters(_local3, SuicidersConstants.CONFIG_ID)))){
_backgrounds.push(new BackgroundItem(_local3, this));
};
_local2++;
};
}
public function set zoom(_arg1:Number):void{
var _local2:Point;
var _local3:BackgroundItem;
_arg1 = Maths.normalizeValue(_arg1, minZoom, MAX_ZOOM);
if (_zoom != _arg1){
_local2 = center;
_zoom = _arg1;
content.scaleX = _arg1;
content.scaleY = _arg1;
for each (_local3 in _backgrounds) {
if ((((_local3.mult < 1)) && ((_arg1 < 1)))){
_local3.clip.scaleX = ((1 / _arg1) * _local3.scale);
_local3.clip.scaleY = ((1 / _arg1) * _local3.scale);
} else {
_local3.clip.scaleX = _local3.scale;
_local3.clip.scaleY = _local3.scale;
};
};
center = _local2;
scrollHorizontal(0);
scrollVertical(0);
zoomEvent.sendEvent();
};
}
private function scrollVertical(_arg1:int):void{
var _local3:BackgroundItem;
var _local2:Number = (content.y + (_arg1 * SCROLL_STEP));
_local2 = Maths.normalizeValue(_local2, (SuicidersConstants.SCREEN_HEIGHT * (1 - zoom)), ((_height * zoom) - (SuicidersConstants.SCREEN_HEIGHT * zoom)));
if (_local2 != content.y){
scrolling = true;
};
content.y = _local2;
for each (_local3 in _backgrounds) {
_local3.clip.y = int((_local3.startPosition.y - ((_local2 * (1 - _local3.mult)) / zoom)));
};
}
private function onMouseUp(_arg1:MouseEvent):void{
unMuteScrolling();
}
public function set center(_arg1:Point):void{
var _local2:Point = center;
content.x = (content.x + (_local2.x - _arg1.x));
content.y = (content.y + (_local2.y - _arg1.y));
scrollVertical(0);
scrollHorizontal(0);
}
private function onMouseMove(_arg1:MouseEvent):void{
var _local2:Point = new Point(_stage.mouseX, _stage.mouseY);
center = new Point((_clickCenter.x - (_local2.x - _startScrollPosition.x)), (_clickCenter.y - (_local2.y - _startScrollPosition.y)));
}
private function onEnterFrame(_arg1:Event):void{
if (((!(enabled)) || (_muteScrolling))){
return;
};
if (!_muteScrolling){
scrollHorizontal(-(_keyboardListener.direction.x));
scrollVertical(-(_keyboardListener.direction.y));
};
var _local2:Number = content.stage.mouseX;
var _local3:Number = (SCROLL_OFFSET * offsetMult);
scrolling = false;
if (_local2 < _local3){
scrollHorizontal(1);
} else {
if (_local2 > (SuicidersConstants.SCREEN_WIDTH - _local3)){
scrollHorizontal(-1);
};
};
var _local4:Number = content.stage.mouseY;
if (_local4 < _local3){
scrollVertical(1);
} else {
if (_local4 > (SuicidersConstants.SCREEN_HEIGHT - _local3)){
scrollVertical(-1);
};
};
}
}
}//package com.mokus.suiciders.ui
import flash.display.*;
import flash.geom.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.*;
import com.mokus.suiciders.effects.*;
class BackgroundItem {
public var clip:MovieClip;
public var mult:Number;
public var scale:Number;
public var startPosition:Point;
private function BackgroundItem(_arg1:MovieClip, _arg2:StageScroller){
this.clip = _arg1;
var _local3:Object = GraphUtils.getParameters(_arg1, SuicidersConstants.CONFIG_ID);
this.mult = _local3.mult;
this.startPosition = new Point(_arg1.x, _arg1.y);
scale = _arg1.scaleX;
_arg1.cacheAsBitmap = true;
_arg1.mouseChildren = false;
_arg1.mouseEnabled = false;
_arg1.opaqueBackground = _local3.opaque;
if (_local3.water){
_arg1.cacheAsBitmap = false;
new WaterEffect(_arg1, _arg2);
};
}
}
Section 238
//StageView (com.mokus.suiciders.ui.StageView)
package com.mokus.suiciders.ui {
import flash.events.*;
import com.kavalok.events.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.chars.*;
import com.mokus.suiciders.gamePlay.*;
import flash.utils.*;
import com.kavalok.gameplay.controls.*;
import com.mokus.util.*;
import com.mokus.suiciders.*;
import flash.net.*;
public class StageView extends FlashViewBase {
private var _score:int;
private var _complete:Boolean;// = false
private var _scroller:StageScroller;
private var _neededHeight:Number;// = 0
private var _restartEvent:EventSender;
private var _content:McStage;
private var _charManager:CharsManager;
private var _seconds:int;
private var _moves:int;// = -1
private var _timer:Timer;
private var _startTime:Date;
private var _levelCompleteEvent:EventSender;
private var _zoomer:Scroller;
private var _windController:WindController;
private var _frame:int;// = 20
private var _backEvent:EventSender;
private static const UPDATE_FRAMES:int = 20;
private static const TIME_PREFIX:String = "McTimeCounter";
private static const ZOOM_DIFF:Number = 0.1;
private static const NEEDED_SECONDS:int = 5;
private static const SCORE_START:int = 10;
private static const SCORE_MULT:int = 10;
public function StageView(_arg1:StageScroller, _arg2:CharsManager, _arg3:WindController){
_content = new McStage();
_startTime = new Date();
_levelCompleteEvent = new EventSender();
_backEvent = new EventSender();
_restartEvent = new EventSender();
super(_content);
_scroller = _arg1;
_charManager = _arg2;
_charManager.moveEvent.addListener(addMove);
_windController = _arg3;
GraphUtils.removeAllChildren(_content.timer);
_content.timer.stop();
updateWind();
addMove();
_zoomer = new Scroller(_content.scroller);
new ScrollerToZoomer(_scroller, _zoomer);
_content.backButton.addEventListener(MouseEvent.CLICK, new ArgumentRemover(backEvent.sendEvent).handle);
_content.restartButton.addEventListener(MouseEvent.CLICK, new ArgumentRemover(restartEvent.sendEvent).handle);
_content.walkthroughButton.addEventListener(MouseEvent.CLICK, onWalkthroughClick);
new ButtonCursorRemover(_content.backButton);
new ButtonCursorRemover(_content.restartButton);
new ButtonCursorRemover(_content.walkthroughButton);
}
private function startTimer():void{
if (((_timer) || (_complete))){
return;
};
_timer = new Timer(1000, NEEDED_SECONDS);
_seconds = NEEDED_SECONDS;
_timer.addEventListener(TimerEvent.TIMER, onTimer);
_timer.addEventListener(TimerEvent.TIMER_COMPLETE, onTimerComplete);
updateSeconds();
_timer.start();
}
private function onWalkthroughClick(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.bubblebox.com/clickreg.php?type=gamestats&id=1506&subid=walkthrough&action=walkthrough_hujetower"));
Analytics.track("walkthrough");
}
private function onTimerComplete(_arg1:TimerEvent):void{
_complete = true;
GraphUtils.removeAllChildren(_content.timer);
_content.timer.addChild(new McTimeCounter0());
Timers.callAfter(levelCompleteEvent.sendEvent, 3000);
SoundManager.instance.playSound(SoundWin, true);
}
public function get score():int{
return (_score);
}
private function get timeFromStart():Number{
var _local1:Date = new Date();
return ((_local1.time - _startTime.time));
}
public function addMove():void{
_moves++;
_content.movesField.text = ((_moves == 1)) ? Strings.substitute(Messages.MOVE, _moves) : Strings.substitute(Messages.MOVES, _moves);
}
private function get height():Number{
return ((((-(_charManager.minHeight) + SuicidersConstants.SCREEN_HEIGHT) + SuicidersConstants.CHAR_RADIUS) + 10));
}
private function onTimer(_arg1:TimerEvent):void{
_seconds--;
updateSeconds();
}
private function updateTime():void{
_content.timeFromStartField.text = TimeUtils.getTimeString(timeFromStart);
}
public function get moves():int{
return (_moves);
}
public function get levelCompleteEvent():EventSender{
return (_levelCompleteEvent);
}
public function update():void{
var _local2:String;
_frame++;
if (_frame < UPDATE_FRAMES){
return;
};
_frame = 0;
var _local1:Number = (_neededHeight - height);
if (_local1 > 0){
_local2 = (_local1 / 100).toFixed(2);
_content.heightField.text = Strings.substitute(Messages.METERS_TO_GO, _local2);
stopTimer();
} else {
_content.heightField.text = Messages.HEIGHT_REACHED;
startTimer();
};
updateWind();
updateTime();
updateScore();
}
public function get restartEvent():EventSender{
return (_restartEvent);
}
private function updateScore():void{
_score = ((SCORE_MULT * Math.min(height, _neededHeight)) / Math.sqrt(((_moves + SCORE_START) + (timeFromStart / 10000))));
_content.scoreField.text = String(score);
}
private function stopTimer():void{
if ((((_timer == null)) || (_complete))){
return;
};
_timer.stop();
_timer = null;
GraphUtils.removeAllChildren(_content.timer);
}
private function updateWind():void{
_content.windField.text = Strings.substitute(Messages.WIND, (_windController.wind / SuicidersConstants.X_MULT).toFixed(1));
}
public function get backEvent():EventSender{
return (_backEvent);
}
private function updateSeconds():void{
GraphUtils.removeAllChildren(_content.timer);
var _local1:Class = ReflectUtil.getTypeByName((TIME_PREFIX + _seconds));
_content.timer.addChild(new (_local1));
}
public function set neededHeight(_arg1:Number):void{
_neededHeight = _arg1;
}
public function get seconds():int{
return ((timeFromStart / 1000));
}
}
}//package com.mokus.suiciders.ui
Section 239
//YesNoWindow (com.mokus.suiciders.ui.YesNoWindow)
package com.mokus.suiciders.ui {
import flash.events.*;
import flash.display.*;
import com.kavalok.events.*;
import com.kavalok.utils.*;
import com.kavalok.gameplay.controls.*;
import com.mokus.suiciders.*;
public class YesNoWindow extends FlashViewBase {
private var _no:EventSender;
private var _yes:EventSender;
public function YesNoWindow(_arg1:MovieClip){
_yes = new EventSender();
_no = new EventSender();
super(_arg1);
attachModalShadow(_arg1);
if (_arg1.yesButton){
_arg1.yesButton.addEventListener(MouseEvent.CLICK, new ArgumentRemover(yes.sendEvent).handle);
};
if (_arg1.noButton){
_arg1.noButton.addEventListener(MouseEvent.CLICK, new ArgumentRemover(no.sendEvent).handle);
};
}
public function get no():EventSender{
return (_no);
}
private function attachModalShadow(_arg1:Sprite):void{
var _local6:DisplayObject;
var _local2:Number = ((SuicidersConstants.SCREEN_WIDTH - _arg1.width) / 2);
var _local3:Number = ((SuicidersConstants.SCREEN_HEIGHT - _arg1.height) / 2);
var _local4:uint;
while (_local4 < _arg1.numChildren) {
_local6 = _arg1.getChildAt(_local4);
_arg1.getChildAt(_local4).x = (_local6.x + _local2);
_local6.y = (_local6.y + _local3);
_local4++;
};
var _local5:Sprite = GraphUtils.createRectSprite(SuicidersConstants.SCREEN_WIDTH, SuicidersConstants.SCREEN_HEIGHT, 0, 0.5);
_arg1.addChildAt(_local5, 0);
}
public function get yes():EventSender{
return (_yes);
}
}
}//package com.mokus.suiciders.ui
Section 240
//Sounds (com.mokus.suiciders.Sounds)
package com.mokus.suiciders {
import com.kavalok.collections.*;
public class Sounds {
public static const GENERAL:ArrayList = new ArrayList([SoundVoice0, SoundVoice1, SoundVoice2, SoundVoice3, SoundVoice4, SoundVoice5, SoundVoice6, SoundVoice7, SoundVoice8, SoundVoice9, SoundVoice10, SoundVoice11, SoundVoice12, SoundVoice13, SoundVoice14, SoundVoice15, SoundVoice16, SoundVoice17]);
public static const FLY:ArrayList = new ArrayList([SoundHigh]);
public static const STRONG:ArrayList = new ArrayList([SoundSparta, SoundVoice18]);
public static const LINK:ArrayList = new ArrayList([SoundVyup]);
public static const FALL:ArrayList = new ArrayList([SoundHelp]);
public static const KILL:ArrayList = new ArrayList([SoundSuicide]);
public static const STICK:ArrayList = new ArrayList([SoundGotcha]);
}
}//package com.mokus.suiciders
Section 241
//SuicidersConstants (com.mokus.suiciders.SuicidersConstants)
package com.mokus.suiciders {
public class SuicidersConstants {
public static const MAX_JOINTS:int = 3;
public static const DEFAULT_JOINT_FREQ:Number = 8;
public static const LOCKED:Boolean = false;
public static const SCREEN_WIDTH:Number = 640;
public static const LINKED:String = "linked";
public static const CHAR_RADIUS:Number = 10;
public static const HERO_FRICTION:int = 20;
public static const MASS_MULT:Number = 0.000653333333333333;
public static const X_MULT_SQR:Number = 0.000625;
public static const GRAVITY:Number = 400;
public static const X_MULT:Number = 0.025;
public static const CONFIG_ID:String = "config";
public static const W_CHAR_RADIUS:Number = 18;
public static const TYPE_CHAR:String = "char";
public static const SLEEP:String = "sleep";
public static const DEFAULT_DAMPING:Number = 1;
public static const WIND_CHANGE_TIME:Number = 500;
public static const DENSITY:Number = 1;
public static const RESTITUTION:Number = 0.1;
public static const NOT_LINKED_MASS:Number = 30;
public static const MIN_JOINTS:int = 2;
public static const SCREEN_HEIGHT:Number = 480;
public static const MINDJOLT:Boolean = false;
public static const WIND_CHANGE_COEFF:Number = 0.1;
public static const LEVELS_IN_CHAPTER:int = 10;
public static const DEFAULT_WIND_MAX:Number = 3;
public static const HERO_RADIUS:int = 20;
public static const MASS_COEF:Number = 0.1;
public static const FRICTION:Number = 0.01;
public static const DEFAULT_MAX_DISTANCE:Number = 100;
private function exports():void{
}
}
}//package com.mokus.suiciders
Section 242
//Analytics (com.mokus.util.Analytics)
package com.mokus.util {
import flash.display.*;
import com.google.analytics.*;
public class Analytics {
private static var _game:String;
private static var _tracker:AnalyticsTracker;
public static function initialize(_arg1:DisplayObject, _arg2:String):void{
_tracker = new GATracker(_arg1, "UA-9770672-1", "AS3", false);
_game = _arg2;
}
public static function track(_arg1:String):void{
_tracker.trackPageview(((_game + "/") + _arg1));
}
}
}//package com.mokus.util
Section 243
//Box2dUtil (com.mokus.util.Box2dUtil)
package com.mokus.util {
import flash.geom.*;
import Box2D.Common.Math.*;
public class Box2dUtil {
public static function toB2Vec2(_arg1:Point):b2Vec2{
return (new b2Vec2(_arg1.x, _arg1.y));
}
}
}//package com.mokus.util
Section 244
//HighScoreUtil (com.mokus.util.HighScoreUtil)
package com.mokus.util {
import flash.display.*;
import com.mokus.suiciders.ui.*;
import com.mokus.suiciders.data.*;
import flash.net.*;
public class HighScoreUtil {
private var _callback:Function;
private var _showHighScores:Boolean;
private var _window:YesNoWindow;
private var _userData:UserData;
private var _stage:DisplayObjectContainer;
public function HighScoreUtil(_arg1:Boolean){
_userData = new UserData();
super();
_showHighScores = _arg1;
}
private function onNo():void{
_stage.removeChild(_window.content);
}
private function get boardId():String{
var o:Object = {n:[6, 9, 1, 5, 12, 2, 0, 2, 6, 8, 8, 2, 0, 4, 5, 4], f:function (_arg1:Number, _arg2:String):String{
if (_arg2.length == 16){
return (_arg2);
};
return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16))));
}};
var boardID:String = o.f(0, "");
return (boardID);
}
private function onYes():void{
_stage.removeChild(_window.content);
_userData.highScore = _userData.calculateHighScore();
}
private function tryShowScores():void{
if (_showHighScores){
Analytics.track("highScores");
navigateToURL(new URLRequest("http://www.bubblebox.com/clickreg.php?type=gamestats&id=1506&subid=scores&action=viewscores"));
};
}
public function trySubmit(_arg1:Stage):void{
_stage = _arg1;
if (_userData.newHighScore){
_window = new HighscoresWindow();
_window.yes.addListener(onYes);
_window.no.addListener(onNo);
_arg1.addChild(_window.content);
} else {
tryShowScores();
};
}
}
}//package com.mokus.util
Section 245
//PhysixTool (com.mokus.util.PhysixTool)
package com.mokus.util {
import flash.display.*;
import com.kavalok.collections.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.*;
public class PhysixTool {
public static function apply(_arg1:DisplayObject):void{
var _local2:String = _arg1.loaderInfo.loaderURL;
var _local3:String = URLUtil.getServerName(_local2);
var _local4:ArrayList = new ArrayList(["bubblebox.com", "www.bubblebox.com", "", "localhost"]);
if (((SuicidersConstants.LOCKED) && (!(_local4.contains(_local3))))){
_arg1.stage.addChild(new McInfo());
};
}
}
}//package com.mokus.util
Section 246
//SponsorUtil (com.mokus.util.SponsorUtil)
package com.mokus.util {
import flash.events.*;
import flash.net.*;
import com.kavalok.utils.*;
public class SponsorUtil {
public static const GAME_ID:int = 1506;
public static function navigateToIphone(_arg1:Event=null):void{
navigateToURL(new URLRequest("http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=330473888&mt=8"));
Analytics.track("iphone");
}
public static function navigateToBboygames(_arg1:Event=null):void{
navigateToURL(new URLRequest("http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewArtist?id=330473892"));
Analytics.track("bboygames");
}
public static function navigateToSponsor(_arg1:String):void{
var _local2 = "http://www.bubblebox.com/clickreg.php?type=gamestats&id=1506&subid={0}";
navigateToURL(new URLRequest(Strings.substitute(_local2, _arg1)));
Analytics.track("bubblebox");
}
}
}//package com.mokus.util
Section 247
//McJoint2_59 (content2_fla.McJoint2_59)
package content2_fla {
import flash.display.*;
public dynamic class McJoint2_59 extends MovieClip {
public function McJoint2_59(){
addFrameScript(29, this.frame30);
}
function frame30(){
stop();
}
}
}//package content2_fla
Section 248
//McOneJointJointMap_66 (content2_fla.McOneJointJointMap_66)
package content2_fla {
import flash.display.*;
public dynamic class McOneJointJointMap_66 extends MovieClip {
public function McOneJointJointMap_66(){
addFrameScript(29, this.frame30);
}
function frame30(){
stop();
}
}
}//package content2_fla
Section 249
//McReusableJointMap_62 (content2_fla.McReusableJointMap_62)
package content2_fla {
import flash.display.*;
public dynamic class McReusableJointMap_62 extends MovieClip {
public function McReusableJointMap_62(){
addFrameScript(29, this.frame30);
}
function frame30(){
stop();
}
}
}//package content2_fla
Section 250
//McStickyAnimation_56 (content2_fla.McStickyAnimation_56)
package content2_fla {
import flash.display.*;
public dynamic class McStickyAnimation_56 extends MovieClip {
public function McStickyAnimation_56(){
addFrameScript(0, this.frame1, 9, this.frame10);
}
function frame10(){
stop();
}
function frame1(){
stop();
}
}
}//package content2_fla
Section 251
//McStickyJointMap_61 (content2_fla.McStickyJointMap_61)
package content2_fla {
import flash.display.*;
public dynamic class McStickyJointMap_61 extends MovieClip {
public function McStickyJointMap_61(){
addFrameScript(29, this.frame30);
}
function frame30(){
stop();
}
}
}//package content2_fla
Section 252
//McStrongJointMap_65 (content2_fla.McStrongJointMap_65)
package content2_fla {
import flash.display.*;
public dynamic class McStrongJointMap_65 extends MovieClip {
public function McStrongJointMap_65(){
addFrameScript(29, this.frame30);
}
function frame30(){
stop();
}
}
}//package content2_fla
Section 253
//bubblebox_submit_score (bubblebox_submit_score)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.media.*;
import flash.filters.*;
import flash.net.*;
import flash.system.*;
import flash.ui.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
public dynamic class bubblebox_submit_score extends BubbleboxScores {
public var hexArray_chr;
public var vartext;
public var validWeeklyScore;
public var validScore;
public function bubblebox_submit_score(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4);
}
public function ii(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
return (cmn((_arg3 ^ (_arg2 | ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public function gg(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
return (cmn((MathbitAND(_arg2, _arg4) | MathbitAND(_arg3, ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public function cmn(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6){
return (addme(rol(addme(addme(_arg2, _arg1), addme(_arg4, _arg6)), _arg5), _arg3));
}
function frame2(){
stop();
}
function frame3(){
this.bubblebox_view_score.addEventListener(MouseEvent.CLICK, function (_arg1:Event){
navigateToURL(new URLRequest((("http://www.bubblebox.com/highscores/" + _arg1.currentTarget.parent.bubbleboxGameID) + ".htm")), "_blank");
_arg1.target.parent.dispatchEvent(new Event("viewScores"));
});
vartext = "";
validScore = true;
validWeeklyScore = true;
if (isNaN(this.result_scorepos)){
validScore = false;
};
if (isNaN(this.result_scorepos)){
validWeeklyScore = false;
};
if ((((validScore == true)) && ((this.result_scorepos <= 1000)))){
vartext = (("Congratulations, you're ranked nr " + this.result_scorepos) + " in the alltime highscores!!");
} else {
if ((((validWeeklyScore == true)) && ((this.result_weeklyScorepos <= 1000)))){
vartext = (("Congratulations, you're ranked nr " + this.result_weeklyScorepos) + " in the weekly highscores.");
} else {
vartext = "Sorry, you did not make it into the weekly or alltime top 1000.";
};
};
this.postext.text = vartext;
}
public function hh(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
return (cmn(((_arg2 ^ _arg3) ^ _arg4), _arg1, _arg2, _arg5, _arg6, _arg7));
}
function frame1(){
MathbitAND = function (_arg1, _arg2){
var _local3:*;
var _local4:*;
if ((((_arg1 < 0)) && ((_arg2 < 0)))){
_local3 = ((_arg1 & 1) & (_arg2 & 1));
_local4 = ((_arg1 >>> 1) & (_arg2 >>> 1));
return (((_local4 << 1) | _local3));
};
return ((_arg1 & _arg2));
};
hexArray_chr = "0123456789abcdef";
String.prototype.MD5 = function (){
var _local1:* = this;
xArray = str2blks_MD5(_local1);
a = 1732584193;
b = -271733879;
c = -1732584194;
d = 271733878;
i = 0;
while (i < xArray.length) {
olda = a;
oldb = b;
oldc = c;
oldd = d;
a = ff(a, b, c, d, xArray[(i + 0)], 7, -680876936);
d = ff(d, a, b, c, xArray[(i + 1)], 12, -389564586);
c = ff(c, d, a, b, xArray[(i + 2)], 17, 606105819);
b = ff(b, c, d, a, xArray[(i + 3)], 22, -1044525330);
a = ff(a, b, c, d, xArray[(i + 4)], 7, -176418897);
d = ff(d, a, b, c, xArray[(i + 5)], 12, 1200080426);
c = ff(c, d, a, b, xArray[(i + 6)], 17, -1473231341);
b = ff(b, c, d, a, xArray[(i + 7)], 22, -45705983);
a = ff(a, b, c, d, xArray[(i + 8)], 7, 1770035416);
d = ff(d, a, b, c, xArray[(i + 9)], 12, -1958414417);
c = ff(c, d, a, b, xArray[(i + 10)], 17, -42063);
b = ff(b, c, d, a, xArray[(i + 11)], 22, -1990404162);
a = ff(a, b, c, d, xArray[(i + 12)], 7, 1804603682);
d = ff(d, a, b, c, xArray[(i + 13)], 12, -40341101);
c = ff(c, d, a, b, xArray[(i + 14)], 17, -1502002290);
b = ff(b, c, d, a, xArray[(i + 15)], 22, 1236535329);
a = gg(a, b, c, d, xArray[(i + 1)], 5, -165796510);
d = gg(d, a, b, c, xArray[(i + 6)], 9, -1069501632);
c = gg(c, d, a, b, xArray[(i + 11)], 14, 643717713);
b = gg(b, c, d, a, xArray[(i + 0)], 20, -373897302);
a = gg(a, b, c, d, xArray[(i + 5)], 5, -701558691);
d = gg(d, a, b, c, xArray[(i + 10)], 9, 38016083);
c = gg(c, d, a, b, xArray[(i + 15)], 14, -660478335);
b = gg(b, c, d, a, xArray[(i + 4)], 20, -405537848);
a = gg(a, b, c, d, xArray[(i + 9)], 5, 568446438);
d = gg(d, a, b, c, xArray[(i + 14)], 9, -1019803690);
c = gg(c, d, a, b, xArray[(i + 3)], 14, -187363961);
b = gg(b, c, d, a, xArray[(i + 8)], 20, 1163531501);
a = gg(a, b, c, d, xArray[(i + 13)], 5, -1444681467);
d = gg(d, a, b, c, xArray[(i + 2)], 9, -51403784);
c = gg(c, d, a, b, xArray[(i + 7)], 14, 1735328473);
b = gg(b, c, d, a, xArray[(i + 12)], 20, -1926607734);
a = hh(a, b, c, d, xArray[(i + 5)], 4, -378558);
d = hh(d, a, b, c, xArray[(i + 8)], 11, -2022574463);
c = hh(c, d, a, b, xArray[(i + 11)], 16, 1839030562);
b = hh(b, c, d, a, xArray[(i + 14)], 23, -35309556);
a = hh(a, b, c, d, xArray[(i + 1)], 4, -1530992060);
d = hh(d, a, b, c, xArray[(i + 4)], 11, 1272893353);
c = hh(c, d, a, b, xArray[(i + 7)], 16, -155497632);
b = hh(b, c, d, a, xArray[(i + 10)], 23, -1094730640);
a = hh(a, b, c, d, xArray[(i + 13)], 4, 681279174);
d = hh(d, a, b, c, xArray[(i + 0)], 11, -358537222);
c = hh(c, d, a, b, xArray[(i + 3)], 16, -722521979);
b = hh(b, c, d, a, xArray[(i + 6)], 23, 76029189);
a = hh(a, b, c, d, xArray[(i + 9)], 4, -640364487);
d = hh(d, a, b, c, xArray[(i + 12)], 11, -421815835);
c = hh(c, d, a, b, xArray[(i + 15)], 16, 530742520);
b = hh(b, c, d, a, xArray[(i + 2)], 23, -995338651);
a = ii(a, b, c, d, xArray[(i + 0)], 6, -198630844);
d = ii(d, a, b, c, xArray[(i + 7)], 10, 1126891415);
c = ii(c, d, a, b, xArray[(i + 14)], 15, -1416354905);
b = ii(b, c, d, a, xArray[(i + 5)], 21, -57434055);
a = ii(a, b, c, d, xArray[(i + 12)], 6, 1700485571);
d = ii(d, a, b, c, xArray[(i + 3)], 10, -1894986606);
c = ii(c, d, a, b, xArray[(i + 10)], 15, -1051523);
b = ii(b, c, d, a, xArray[(i + 1)], 21, -2054922799);
a = ii(a, b, c, d, xArray[(i + 8)], 6, 1873313359);
d = ii(d, a, b, c, xArray[(i + 15)], 10, -30611744);
c = ii(c, d, a, b, xArray[(i + 6)], 15, -1560198380);
b = ii(b, c, d, a, xArray[(i + 13)], 21, 1309151649);
a = ii(a, b, c, d, xArray[(i + 4)], 6, -145523070);
d = ii(d, a, b, c, xArray[(i + 11)], 10, -1120210379);
c = ii(c, d, a, b, xArray[(i + 2)], 15, 718787259);
b = ii(b, c, d, a, xArray[(i + 9)], 21, -343485551);
a = addme(a, olda);
b = addme(b, oldb);
c = addme(c, oldc);
d = addme(d, oldd);
i = (i + 16);
};
return ((((rhexArray(a) + rhexArray(b)) + rhexArray(c)) + rhexArray(d)));
};
stop();
scoreMc = this;
sendBubbleBoxScore = function (_arg1, _arg2:Sprite){
var gameID = _arg1;
var root = _arg2;
userData = new URLLoader();
var sendStr:* = ((((gameID + "_") + root.score) + "_") + root.bubblebox_name.text);
var preHashStr:* = ((((((((((gameID + "_") + "4234232143214421") + "_") + root.score) + "_") + "2537625476251") + "_") + root.bubblebox_name.text) + "_") + "desleutelistessa");
var hashStr:* = preHashStr.MD5();
var data:URLVariables = new URLVariables(((("datastring=" + sendStr) + "&hashstring=") + hashStr));
userData.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:Event){
scoreMc.gotoAndStop("tryagain");
});
userData.addEventListener(Event.COMPLETE, function (_arg1:Event){
var _local5:String;
var _local6:Array;
var _local2:* = _arg1.target;
var _local3:Array = _local2.data.split("&");
var _local4:Object = {};
for each (_local5 in _local3) {
_local6 = _local5.split("=");
if (_local6.length == 2){
_local4[_local6[0]] = _local6[1];
};
};
scoreMc.result_scoreID = _local4.id;
scoreMc.result_weeklyID = _local4.weekly_id;
scoreMc.result_scorepos = _local4.scorepos;
scoreMc.result_weeklyScorepos = _local4.weeklyScorepos;
scoreMc.gotoAndStop("success");
});
var request:URLRequest = new URLRequest("http://www.bubblebox.com/scripts/insertscore2009.php");
request.method = URLRequestMethod.POST;
request.data = data;
userData.load(request);
};
this.send_btn.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
var _local2:Sprite = _arg1.target.parent;
if (((!((_local2.bubblebox_name.text == "YOUR NAME"))) && ((_local2.bubblebox_name.text.length > 0)))){
trace(_local2.bubbleboxGameID);
sendBubbleBoxScore(_local2.bubbleboxGameID, _local2);
_local2.gotoAndStop("saving");
_local2.dispatchEvent(new Event("sendScores"));
};
});
}
function frame4(){
this.try_again.addEventListener(MouseEvent.CLICK, function (_arg1:MouseEvent){
_arg1.currentTarget.parent.gotoAndStop(1);
});
}
public function ff(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7){
return (cmn((MathbitAND(_arg2, _arg3) | MathbitAND(~(_arg2), _arg4)), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public function rhexArray(_arg1){
str = "";
j = 0;
while (j <= 3) {
str = (str + (hexArray_chr.charAt(MathbitAND((_arg1 >> ((j * 8) + 4)), 15)) + hexArray_chr.charAt(MathbitAND((_arg1 >> (j * 8)), 15))));
j++;
};
return (str);
}
public function str2blks_MD5(_arg1){
_arg1 = String(_arg1);
nblk = (((_arg1.length + 8) >> 6) + 1);
blks = new Array((nblk * 16));
i = 0;
while (i < (nblk * 16)) {
blks[i] = 0;
i++;
};
i = 0;
while (i < _arg1.length) {
blks[(i >> 2)] = (blks[(i >> 2)] | (_arg1.charCodeAt(i) << ((i % 4) * 8)));
i++;
};
blks[(i >> 2)] = (blks[(i >> 2)] | (128 << ((i % 4) * 8)));
blks[((nblk * 16) - 2)] = (_arg1.length * 8);
return (blks);
}
public function rol(_arg1, _arg2){
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
public function addme(_arg1, _arg2){
var _local3:* = (MathbitAND(_arg1, 0xFFFF) + MathbitAND(_arg2, 0xFFFF));
var _local4:* = (((_arg1 >> 16) + (_arg2 >> 16)) + (_local3 >> 16));
return (((_local4 << 16) | MathbitAND(_local3, 0xFFFF)));
}
}
}//package
Section 254
//BubbleboxScores (BubbleboxScores)
package {
import flash.display.*;
public dynamic class BubbleboxScores extends MovieClip {
public function setScore(_arg1:Number, _arg2:int):void{
this.bubbleboxGameID = _arg2;
this.score = _arg1;
this.gotoAndStop(1);
}
}
}//package
Section 255
//Flubber (Flubber)
package {
import flash.text.*;
public dynamic class Flubber extends Font {
}
}//package
Section 256
//Level0 (Level0)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level0 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var charsContainer:MovieClip;
public var background:MovieClip;
public var physixContent:MovieClip;
public var moveArea:MovieClip;
}
}//package
Section 257
//Level1 (Level1)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level1 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var foreground:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
public var physixContent:MovieClip;
public var controllerConfig:TextField;
}
}//package
Section 258
//Level10 (Level10)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level10 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 259
//Level11 (Level11)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level11 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 260
//Level12 (Level12)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level12 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var foreground:MovieClip;
public var background:MovieClip;
public var charsContainer:MovieClip;
public var physixContent:MovieClip;
public var moveArea:MovieClip;
}
}//package
Section 261
//Level13 (Level13)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level13 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var foreground:MovieClip;
public var background:MovieClip;
public var charsContainer:MovieClip;
public var physixContent:MovieClip;
public var moveArea:MovieClip;
}
}//package
Section 262
//Level14 (Level14)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level14 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 263
//Level15 (Level15)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level15 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var charsContainer:MovieClip;
public var background:MovieClip;
public var physixContent:MovieClip;
public var moveArea:MovieClip;
}
}//package
Section 264
//Level16 (Level16)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level16 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 265
//Level17 (Level17)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level17 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 266
//Level18 (Level18)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level18 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var foreground:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
public var physixContent:MovieClip;
public var controllerConfig:TextField;
}
}//package
Section 267
//Level19 (Level19)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level19 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var foreground:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
public var physixContent:MovieClip;
public var controllerConfig:TextField;
}
}//package
Section 268
//Level20 (Level20)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level20 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var foreground:MovieClip;
public var background:MovieClip;
public var charsContainer:MovieClip;
public var physixContent:MovieClip;
public var moveArea:MovieClip;
}
}//package
Section 269
//Level21 (Level21)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level21 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 270
//Level22 (Level22)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level22 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 271
//Level23 (Level23)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level23 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 272
//Level24 (Level24)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level24 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 273
//Level25 (Level25)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level25 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var foreground:MovieClip;
public var background:MovieClip;
public var charsContainer:MovieClip;
public var physixContent:MovieClip;
public var moveArea:MovieClip;
}
}//package
Section 274
//Level26 (Level26)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level26 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 275
//Level27 (Level27)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level27 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 276
//Level28 (Level28)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level28 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var foreground:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
public var physixContent:MovieClip;
public var controllerConfig:TextField;
}
}//package
Section 277
//Level29 (Level29)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level29 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var foreground:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
public var physixContent:MovieClip;
public var controllerConfig:TextField;
}
}//package
Section 278
//Level3 (Level3)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level3 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var charsContainer:MovieClip;
public var background:MovieClip;
public var physixContent:MovieClip;
public var moveArea:MovieClip;
}
}//package
Section 279
//Level30 (Level30)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level30 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 280
//Level31 (Level31)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level31 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 281
//Level32 (Level32)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level32 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 282
//Level33 (Level33)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level33 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 283
//Level34 (Level34)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level34 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var charsContainer:MovieClip;
public var background:MovieClip;
public var physixContent:MovieClip;
public var moveArea:MovieClip;
}
}//package
Section 284
//Level35 (Level35)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level35 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var charsContainer:MovieClip;
public var background:MovieClip;
public var physixContent:MovieClip;
public var moveArea:MovieClip;
}
}//package
Section 285
//Level36 (Level36)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level36 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 286
//Level37 (Level37)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level37 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 287
//Level38 (Level38)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level38 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var charsContainer:MovieClip;
public var background:MovieClip;
public var physixContent:MovieClip;
public var moveArea:MovieClip;
}
}//package
Section 288
//Level39 (Level39)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level39 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 289
//Level4 (Level4)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level4 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var charsContainer:MovieClip;
public var background:MovieClip;
public var physixContent:MovieClip;
public var moveArea:MovieClip;
}
}//package
Section 290
//Level40 (Level40)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level40 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 291
//Level41 (Level41)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level41 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 292
//Level42 (Level42)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level42 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var charsContainer:MovieClip;
public var background:MovieClip;
public var physixContent:MovieClip;
public var moveArea:MovieClip;
}
}//package
Section 293
//Level5 (Level5)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level5 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var charsContainer:MovieClip;
public var background:MovieClip;
public var physixContent:MovieClip;
public var moveArea:MovieClip;
}
}//package
Section 294
//Level7 (Level7)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level7 extends MovieClip {
public var config:TextField;
public var controlPoints:MovieClip;
public var physixContent:MovieClip;
public var charsContainer:MovieClip;
public var background:MovieClip;
}
}//package
Section 295
//Level9 (Level9)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Level9 extends MovieClip {
public var controlPoints:MovieClip;
public var config:TextField;
public var foreground:MovieClip;
public var background:MovieClip;
public var charsContainer:MovieClip;
public var physixContent:MovieClip;
public var moveArea:MovieClip;
}
}//package
Section 296
//LevelMenu (LevelMenu)
package {
import flash.display.*;
import flash.text.*;
public dynamic class LevelMenu extends MovieClip {
public var config:TextField;
public var iphone:MovieClip;
public var newGameButton:SimpleButton;
public var creditsButton:SimpleButton;
public var background:MovieClip;
public var charsContainer:MovieClip;
public var highScoresButton:SimpleButton;
public var physixContent:MovieClip;
public var continueButton:SimpleButton;
public var bubbleBox:MovieClip;
}
}//package
Section 297
//McArrow (McArrow)
package {
import flash.display.*;
public dynamic class McArrow extends MovieClip {
}
}//package
Section 298
//McAsteroid1 (McAsteroid1)
package {
import flash.display.*;
public dynamic class McAsteroid1 extends MovieClip {
}
}//package
Section 299
//McAsteroid2 (McAsteroid2)
package {
import flash.display.*;
public dynamic class McAsteroid2 extends MovieClip {
}
}//package
Section 300
//McAsteroid3 (McAsteroid3)
package {
import flash.display.*;
public dynamic class McAsteroid3 extends MovieClip {
}
}//package
Section 301
//McAsteroid4 (McAsteroid4)
package {
import flash.display.*;
public dynamic class McAsteroid4 extends MovieClip {
}
}//package
Section 302
//McAsteroidBox (McAsteroidBox)
package {
import flash.display.*;
public dynamic class McAsteroidBox extends MovieClip {
}
}//package
Section 303
//McAsteroidBox40 (McAsteroidBox40)
package {
import flash.display.*;
public dynamic class McAsteroidBox40 extends MovieClip {
}
}//package
Section 304
//McBall (McBall)
package {
import flash.display.*;
public dynamic class McBall extends MovieClip {
public var eyes:McEyes;
public var sleepAnimation:MovieClip;
}
}//package
Section 305
//McBallAngel (McBallAngel)
package {
import flash.display.*;
public dynamic class McBallAngel extends MovieClip {
}
}//package
Section 306
//McBlackSquare (McBlackSquare)
package {
import flash.display.*;
public dynamic class McBlackSquare extends MovieClip {
}
}//package
Section 307
//McBoxView2 (McBoxView2)
package {
import flash.display.*;
public dynamic class McBoxView2 extends MovieClip {
}
}//package
Section 308
//McBoxView3 (McBoxView3)
package {
import flash.display.*;
public dynamic class McBoxView3 extends MovieClip {
}
}//package
Section 309
//McBridgeView (McBridgeView)
package {
import flash.display.*;
public dynamic class McBridgeView extends MovieClip {
}
}//package
Section 310
//McChetvernaAsteroid (McChetvernaAsteroid)
package {
import flash.display.*;
public dynamic class McChetvernaAsteroid extends MovieClip {
}
}//package
Section 311
//McCircle28 (McCircle28)
package {
import flash.display.*;
public dynamic class McCircle28 extends MovieClip {
}
}//package
Section 312
//McCircle29 (McCircle29)
package {
import flash.display.*;
public dynamic class McCircle29 extends MovieClip {
}
}//package
Section 313
//McCircleView (McCircleView)
package {
import flash.display.*;
public dynamic class McCircleView extends MovieClip {
}
}//package
Section 314
//McCircleView20 (McCircleView20)
package {
import flash.display.*;
public dynamic class McCircleView20 extends MovieClip {
}
}//package
Section 315
//McCredits (McCredits)
package {
import flash.display.*;
public dynamic class McCredits extends MovieClip {
public var backButton:SimpleButton;
public function McCredits(){
addFrameScript(169, this.frame170);
}
function frame170(){
stop();
}
}
}//package
Section 316
//McCreditsContainer (McCreditsContainer)
package {
import flash.display.*;
public dynamic class McCreditsContainer extends MovieClip {
public var content:McCredits;
}
}//package
Section 317
//McCursor (McCursor)
package {
import flash.display.*;
public dynamic class McCursor extends MovieClip {
}
}//package
Section 318
//McEyes (McEyes)
package {
import flash.display.*;
public dynamic class McEyes extends MovieClip {
public var content:MovieClip;
public function McEyes(){
addFrameScript(0, this.frame1);
}
function frame1(){
stop();
}
}
}//package
Section 319
//McEyesBlink (McEyesBlink)
package {
import flash.display.*;
public dynamic class McEyesBlink extends MovieClip {
public var content:MovieClip;
}
}//package
Section 320
//McEyesBlink1 (McEyesBlink1)
package {
import flash.display.*;
public dynamic class McEyesBlink1 extends MovieClip {
public var content:MovieClip;
}
}//package
Section 321
//McEyesBlink2 (McEyesBlink2)
package {
import flash.display.*;
public dynamic class McEyesBlink2 extends MovieClip {
public var content:MovieClip;
}
}//package
Section 322
//McEyesSmile (McEyesSmile)
package {
import flash.display.*;
public dynamic class McEyesSmile extends MovieClip {
public var rightEye:MovieClip;
public var content:MovieClip;
public var leftEye:MovieClip;
}
}//package
Section 323
//McEyesWow (McEyesWow)
package {
import flash.display.*;
public dynamic class McEyesWow extends MovieClip {
public var content:MovieClip;
}
}//package
Section 324
//McEyesWow2 (McEyesWow2)
package {
import flash.display.*;
public dynamic class McEyesWow2 extends MovieClip {
public var content:MovieClip;
}
}//package
Section 325
//McFinal (McFinal)
package {
import flash.display.*;
public dynamic class McFinal extends MovieClip {
public var animation:MovieClip;
}
}//package
Section 326
//McFlyBall (McFlyBall)
package {
import flash.display.*;
public dynamic class McFlyBall extends MovieClip {
public var linked:McFlyBody;
public var sleepAnimation:MovieClip;
}
}//package
Section 327
//McFlyBody (McFlyBody)
package {
import flash.display.*;
public dynamic class McFlyBody extends MovieClip {
public function McFlyBody(){
addFrameScript(0, this.frame1, 29, this.frame30);
}
function frame30(){
stop();
}
function frame1(){
stop();
}
}
}//package
Section 328
//McFlyJoint (McFlyJoint)
package {
import flash.display.*;
public dynamic class McFlyJoint extends MovieClip {
}
}//package
Section 329
//McGarbage00 (McGarbage00)
package {
import flash.display.*;
public dynamic class McGarbage00 extends MovieClip {
}
}//package
Section 330
//McGarbage01 (McGarbage01)
package {
import flash.display.*;
public dynamic class McGarbage01 extends MovieClip {
}
}//package
Section 331
//McGarbage02 (McGarbage02)
package {
import flash.display.*;
public dynamic class McGarbage02 extends MovieClip {
}
}//package
Section 332
//McGarbage03 (McGarbage03)
package {
import flash.display.*;
public dynamic class McGarbage03 extends MovieClip {
}
}//package
Section 333
//McGarbage10 (McGarbage10)
package {
import flash.display.*;
public dynamic class McGarbage10 extends MovieClip {
}
}//package
Section 334
//McGarbage11 (McGarbage11)
package {
import flash.display.*;
public dynamic class McGarbage11 extends MovieClip {
}
}//package
Section 335
//McGarbage12 (McGarbage12)
package {
import flash.display.*;
public dynamic class McGarbage12 extends MovieClip {
}
}//package
Section 336
//McGarbage13 (McGarbage13)
package {
import flash.display.*;
public dynamic class McGarbage13 extends MovieClip {
}
}//package
Section 337
//McGarbage20 (McGarbage20)
package {
import flash.display.*;
public dynamic class McGarbage20 extends MovieClip {
}
}//package
Section 338
//McGarbage21 (McGarbage21)
package {
import flash.display.*;
public dynamic class McGarbage21 extends MovieClip {
}
}//package
Section 339
//McGarbage22 (McGarbage22)
package {
import flash.display.*;
public dynamic class McGarbage22 extends MovieClip {
}
}//package
Section 340
//McGarbage23 (McGarbage23)
package {
import flash.display.*;
public dynamic class McGarbage23 extends MovieClip {
}
}//package
Section 341
//McGarbage30 (McGarbage30)
package {
import flash.display.*;
public dynamic class McGarbage30 extends MovieClip {
}
}//package
Section 342
//McGarbage31 (McGarbage31)
package {
import flash.display.*;
public dynamic class McGarbage31 extends MovieClip {
}
}//package
Section 343
//McGarbage32 (McGarbage32)
package {
import flash.display.*;
public dynamic class McGarbage32 extends MovieClip {
}
}//package
Section 344
//McGarbage33 (McGarbage33)
package {
import flash.display.*;
public dynamic class McGarbage33 extends MovieClip {
}
}//package
Section 345
//McHero (McHero)
package {
import flash.display.*;
public dynamic class McHero extends MovieClip {
}
}//package
Section 346
//McHighScoresWindow (McHighScoresWindow)
package {
import flash.display.*;
public dynamic class McHighScoresWindow extends MovieClip {
public var noButton:SimpleButton;
public var bubbleBoxSender:bubblebox_submit_score;
}
}//package
Section 347
//McHnaLeftGraphics (McHnaLeftGraphics)
package {
import flash.display.*;
public dynamic class McHnaLeftGraphics extends MovieClip {
}
}//package
Section 348
//McHnaRightGraphics (McHnaRightGraphics)
package {
import flash.display.*;
public dynamic class McHnaRightGraphics extends MovieClip {
}
}//package
Section 349
//McHujok (McHujok)
package {
import flash.display.*;
public dynamic class McHujok extends MovieClip {
}
}//package
Section 350
//McInfo (McInfo)
package {
import flash.display.*;
public dynamic class McInfo extends MovieClip {
}
}//package
Section 351
//McIntro (McIntro)
package {
import flash.display.*;
public dynamic class McIntro extends MovieClip {
public var skipButton:SimpleButton;
public var rightEye:MovieClip;
public var content:MovieClip;
public var leftEye:MovieClip;
}
}//package
Section 352
//McIntroContainer (McIntroContainer)
package {
import flash.display.*;
public dynamic class McIntroContainer extends MovieClip {
public var animation:McIntro;
}
}//package
Section 353
//McJoint (McJoint)
package {
import flash.display.*;
public dynamic class McJoint extends MovieClip {
public function McJoint(){
addFrameScript(29, this.frame30);
}
function frame30(){
stop();
}
}
}//package
Section 354
//McKran (McKran)
package {
import flash.display.*;
public dynamic class McKran extends MovieClip {
}
}//package
Section 355
//McKranMass (McKranMass)
package {
import flash.display.*;
public dynamic class McKranMass extends MovieClip {
}
}//package
Section 356
//McKriplenna (McKriplenna)
package {
import flash.display.*;
public dynamic class McKriplenna extends MovieClip {
}
}//package
Section 357
//McLevelDescription1 (McLevelDescription1)
package {
import flash.display.*;
import flash.text.*;
public dynamic class McLevelDescription1 extends MovieClip {
public var timeField:TextField;
public var levelField:TextField;
public var movesField:TextField;
public var chapterField:TextField;
public var scoreField:TextField;
}
}//package
Section 358
//McLevels (McLevels)
package {
import flash.display.*;
public dynamic class McLevels extends MovieClip {
public var joint_15:MovieClip;
public var level_32:MovieClip;
public var joint_17:MovieClip;
public var joint_19:MovieClip;
public var joint_12:MovieClip;
public var level_37:McReusableBall;
public var joint_14:MovieClip;
public var level_39:McBall;
public var joint_18:MovieClip;
public var level_36:McReusableBall;
public var level_38:McStickyBall;
public var joint_20:MovieClip;
public var joint_21:MovieClip;
public var joint_22:MovieClip;
public var joint_23:MovieClip;
public var joint_24:MovieClip;
public var joint_25:MovieClip;
public var joint_26:MovieClip;
public var joint_27:McFlyJoint;
public var joint_28:MovieClip;
public var joint_29:MovieClip;
public var joint_31:MovieClip;
public var joint_33:MovieClip;
public var joint_34:MovieClip;
public var joint_35:MovieClip;
public var joint_36:MovieClip;
public var level_4:McBall;
public var level_5:McReusableBall;
public var joint_39:MovieClip;
public var level_7:MovieClip;
public var level_8:McBall;
public var level_9:McFlyBall;
public var level_3:McWBall;
public var joint_37:MovieClip;
public var joint_30:MovieClip;
public var level_6:McStickyBall;
public var joint_32:MovieClip;
public var level_0:McBall;
public var level_1:McBall;
public var level_2:MovieClip;
public var joint_38:MovieClip;
public var level_10:McReusableBall;
public var level_11:McFlyBall;
public var level_12:McReusableBall;
public var level_13:McReusableBall;
public var joint_3:MovieClip;
public var joint_4:MovieClip;
public var level_16:McWBall;
public var level_17:MovieClip;
public var level_18:McReusableBall;
public var joint_8:MovieClip;
public var joint_9:McFlyJoint;
public var level_15:McStickyBall;
public var joint_5:MovieClip;
public var joint_6:MovieClip;
public var level_19:McReusableBall;
public var joint_2:MovieClip;
public var level_14:MovieClip;
public var joint_7:MovieClip;
public var joint_1:MovieClip;
public var level_20:McReusableBall;
public var level_21:McLongBall;
public var level_22:McBall;
public var level_23:MovieClip;
public var level_24:McBall;
public var level_25:McReusableBall;
public var level_26:McBall;
public var level_27:McFlyBall;
public var level_28:McReusableBall;
public var level_29:McBall;
public var joint_10:MovieClip;
public var joint_11:McFlyJoint;
public var level_31:McBall;
public var joint_16:MovieClip;
public var level_33:McLongBall;
public var level_34:McStickyBall;
public var level_35:McWBall;
public var joint_13:MovieClip;
public var level_30:McReusableBall;
}
}//package
Section 359
//McLevelsStage (McLevelsStage)
package {
import flash.display.*;
public dynamic class McLevelsStage extends MovieClip {
public var backButton:SimpleButton;
public var scroller:McScroller;
public var bubblebox:MovieClip;
}
}//package
Section 360
//McLine (McLine)
package {
import flash.display.*;
public dynamic class McLine extends MovieClip {
}
}//package
Section 361
//McLoader (McLoader)
package {
import flash.display.*;
public dynamic class McLoader extends MovieClip {
public var bboygames:MovieClip;
public var bubbleBox:MovieClip;
}
}//package
Section 362
//McLongBall (McLongBall)
package {
import flash.display.*;
public dynamic class McLongBall extends MovieClip {
public var eyes:McEyes;
public var sleepAnimation:MovieClip;
}
}//package
Section 363
//McLongJoint (McLongJoint)
package {
import flash.display.*;
public dynamic class McLongJoint extends MovieClip {
}
}//package
Section 364
//McMoveSquare (McMoveSquare)
package {
import flash.display.*;
public dynamic class McMoveSquare extends MovieClip {
}
}//package
Section 365
//McMoveSquare2 (McMoveSquare2)
package {
import flash.display.*;
public dynamic class McMoveSquare2 extends MovieClip {
}
}//package
Section 366
//McNewGameWindow (McNewGameWindow)
package {
import flash.display.*;
public dynamic class McNewGameWindow extends MovieClip {
public var yesButton:SimpleButton;
public var noButton:SimpleButton;
}
}//package
Section 367
//McOneJointBall (McOneJointBall)
package {
import flash.display.*;
public dynamic class McOneJointBall extends MovieClip {
}
}//package
Section 368
//McOneJointJoint (McOneJointJoint)
package {
import flash.display.*;
public dynamic class McOneJointJoint extends MovieClip {
public function McOneJointJoint(){
addFrameScript(29, this.frame30);
}
function frame30(){
stop();
}
}
}//package
Section 369
//McPatyk (McPatyk)
package {
import flash.display.*;
public dynamic class McPatyk extends MovieClip {
}
}//package
Section 370
//McPorshenView (McPorshenView)
package {
import flash.display.*;
public dynamic class McPorshenView extends MovieClip {
}
}//package
Section 371
//McPorshenView2 (McPorshenView2)
package {
import flash.display.*;
public dynamic class McPorshenView2 extends MovieClip {
}
}//package
Section 372
//McProbka (McProbka)
package {
import flash.display.*;
public dynamic class McProbka extends MovieClip {
}
}//package
Section 373
//McRelsa (McRelsa)
package {
import flash.display.*;
public dynamic class McRelsa extends MovieClip {
}
}//package
Section 374
//McReusableBall (McReusableBall)
package {
import flash.display.*;
public dynamic class McReusableBall extends MovieClip {
public var eyes:McEyes;
public var sleepAnimation:MovieClip;
}
}//package
Section 375
//McReusableJoint (McReusableJoint)
package {
import flash.display.*;
public dynamic class McReusableJoint extends MovieClip {
public function McReusableJoint(){
addFrameScript(29, this.frame30);
}
function frame30(){
stop();
}
}
}//package
Section 376
//McRogatkaView (McRogatkaView)
package {
import flash.display.*;
public dynamic class McRogatkaView extends MovieClip {
}
}//package
Section 377
//McRootFrame (McRootFrame)
package {
import flash.display.*;
public dynamic class McRootFrame extends MovieClip {
public var soundButton:MovieClip;
}
}//package
Section 378
//McRopeJoint (McRopeJoint)
package {
import flash.display.*;
public dynamic class McRopeJoint extends MovieClip {
}
}//package
Section 379
//McRotatingBox (McRotatingBox)
package {
import flash.display.*;
public dynamic class McRotatingBox extends MovieClip {
}
}//package
Section 380
//McScroller (McScroller)
package {
import flash.display.*;
public dynamic class McScroller extends MovieClip {
public var downButton:MovieClip;
public var line:MovieClip;
public var upButton:MovieClip;
public var pointer:MovieClip;
}
}//package
Section 381
//McShesternaAsteroid (McShesternaAsteroid)
package {
import flash.display.*;
public dynamic class McShesternaAsteroid extends MovieClip {
}
}//package
Section 382
//McShesternaView (McShesternaView)
package {
import flash.display.*;
public dynamic class McShesternaView extends MovieClip {
}
}//package
Section 383
//McShypy20 (McShypy20)
package {
import flash.display.*;
public dynamic class McShypy20 extends MovieClip {
}
}//package
Section 384
//McShypyBox (McShypyBox)
package {
import flash.display.*;
public dynamic class McShypyBox extends MovieClip {
}
}//package
Section 385
//McSplash (McSplash)
package {
import flash.display.*;
public dynamic class McSplash extends MovieClip {
public var animation:MovieClip;
}
}//package
Section 386
//McSquare25 (McSquare25)
package {
import flash.display.*;
public dynamic class McSquare25 extends MovieClip {
}
}//package
Section 387
//McSquareView (McSquareView)
package {
import flash.display.*;
public dynamic class McSquareView extends MovieClip {
}
}//package
Section 388
//McStage (McStage)
package {
import flash.display.*;
import flash.text.*;
public dynamic class McStage extends MovieClip {
public var restartButton:SimpleButton;
public var timer:McTimeCounter5;
public var scoreField:TextField;
public var walkthroughButton:SimpleButton;
public var timeFromStartField:TextField;
public var windField:TextField;
public var heightField:TextField;
public var movesField:TextField;
public var backButton:SimpleButton;
public var scroller:McScroller;
}
}//package
Section 389
//McStickyBall (McStickyBall)
package {
import flash.display.*;
public dynamic class McStickyBall extends MovieClip {
public var eyes:McEyes;
public var sticky:MovieClip;
public var sleepAnimation:MovieClip;
}
}//package
Section 390
//McStickyJoint (McStickyJoint)
package {
import flash.display.*;
public dynamic class McStickyJoint extends MovieClip {
public function McStickyJoint(){
addFrameScript(29, this.frame30);
}
function frame30(){
stop();
}
}
}//package
Section 391
//McStrongBall (McStrongBall)
package {
import flash.display.*;
public dynamic class McStrongBall extends MovieClip {
public var staticEyes:McStrongEyes;
}
}//package
Section 392
//McStrongEyes (McStrongEyes)
package {
import flash.display.*;
public dynamic class McStrongEyes extends MovieClip {
public function McStrongEyes(){
addFrameScript(0, this.frame1);
}
function frame1(){
stop();
}
}
}//package
Section 393
//McStrongJoint (McStrongJoint)
package {
import flash.display.*;
public dynamic class McStrongJoint extends MovieClip {
public function McStrongJoint(){
addFrameScript(29, this.frame30);
}
function frame30(){
stop();
}
}
}//package
Section 394
//McTimeCounter0 (McTimeCounter0)
package {
import flash.display.*;
public dynamic class McTimeCounter0 extends MovieClip {
public function McTimeCounter0(){
addFrameScript(13, this.frame14);
}
function frame14(){
stop();
}
}
}//package
Section 395
//McTimeCounter1 (McTimeCounter1)
package {
import flash.display.*;
public dynamic class McTimeCounter1 extends MovieClip {
public function McTimeCounter1(){
addFrameScript(13, this.frame14);
}
function frame14(){
stop();
}
}
}//package
Section 396
//McTimeCounter2 (McTimeCounter2)
package {
import flash.display.*;
public dynamic class McTimeCounter2 extends MovieClip {
public function McTimeCounter2(){
addFrameScript(13, this.frame14);
}
function frame14(){
stop();
}
}
}//package
Section 397
//McTimeCounter3 (McTimeCounter3)
package {
import flash.display.*;
public dynamic class McTimeCounter3 extends MovieClip {
public function McTimeCounter3(){
addFrameScript(13, this.frame14);
}
function frame14(){
stop();
}
}
}//package
Section 398
//McTimeCounter4 (McTimeCounter4)
package {
import flash.display.*;
public dynamic class McTimeCounter4 extends MovieClip {
public function McTimeCounter4(){
addFrameScript(13, this.frame14);
}
function frame14(){
stop();
}
}
}//package
Section 399
//McTimeCounter5 (McTimeCounter5)
package {
import flash.display.*;
public dynamic class McTimeCounter5 extends MovieClip {
public function McTimeCounter5(){
addFrameScript(13, this.frame14);
}
function frame14(){
stop();
}
}
}//package
Section 400
//McTriangleView (McTriangleView)
package {
import flash.display.*;
public dynamic class McTriangleView extends MovieClip {
}
}//package
Section 401
//McWBall (McWBall)
package {
import flash.display.*;
public dynamic class McWBall extends MovieClip {
public var sleepAnimation:MovieClip;
}
}//package
Section 402
//McWheel (McWheel)
package {
import flash.display.*;
public dynamic class McWheel extends MovieClip {
}
}//package
Section 403
//McWheelPad (McWheelPad)
package {
import flash.display.*;
public dynamic class McWheelPad extends MovieClip {
}
}//package
Section 404
//McVitrakGraphics (McVitrakGraphics)
package {
import flash.display.*;
public dynamic class McVitrakGraphics extends MovieClip {
}
}//package
Section 405
//McWJoint (McWJoint)
package {
import flash.display.*;
public dynamic class McWJoint extends MovieClip {
}
}//package
Section 406
//SoundChapter0 (SoundChapter0)
package {
import flash.media.*;
public dynamic class SoundChapter0 extends Sound {
}
}//package
Section 407
//SoundChapter1 (SoundChapter1)
package {
import flash.media.*;
public dynamic class SoundChapter1 extends Sound {
}
}//package
Section 408
//SoundChapter2 (SoundChapter2)
package {
import flash.media.*;
public dynamic class SoundChapter2 extends Sound {
}
}//package
Section 409
//SoundChapter3 (SoundChapter3)
package {
import flash.media.*;
public dynamic class SoundChapter3 extends Sound {
}
}//package
Section 410
//SoundGotcha (SoundGotcha)
package {
import flash.media.*;
public dynamic class SoundGotcha extends Sound {
}
}//package
Section 411
//SoundHelp (SoundHelp)
package {
import flash.media.*;
public dynamic class SoundHelp extends Sound {
}
}//package
Section 412
//SoundHigh (SoundHigh)
package {
import flash.media.*;
public dynamic class SoundHigh extends Sound {
}
}//package
Section 413
//SoundIntro (SoundIntro)
package {
import flash.media.*;
public dynamic class SoundIntro extends Sound {
}
}//package
Section 414
//SoundMenuNew (SoundMenuNew)
package {
import flash.media.*;
public dynamic class SoundMenuNew extends Sound {
}
}//package
Section 415
//SoundOutro (SoundOutro)
package {
import flash.media.*;
public dynamic class SoundOutro extends Sound {
}
}//package
Section 416
//SoundSparta (SoundSparta)
package {
import flash.media.*;
public dynamic class SoundSparta extends Sound {
}
}//package
Section 417
//SoundSuicide (SoundSuicide)
package {
import flash.media.*;
public dynamic class SoundSuicide extends Sound {
}
}//package
Section 418
//SoundTimmy (SoundTimmy)
package {
import flash.media.*;
public dynamic class SoundTimmy extends Sound {
}
}//package
Section 419
//SoundWin (SoundWin)
package {
import flash.media.*;
public dynamic class SoundWin extends Sound {
}
}//package
Section 420
//SoundVoice0 (SoundVoice0)
package {
import flash.media.*;
public dynamic class SoundVoice0 extends Sound {
}
}//package
Section 421
//SoundVoice1 (SoundVoice1)
package {
import flash.media.*;
public dynamic class SoundVoice1 extends Sound {
}
}//package
Section 422
//SoundVoice10 (SoundVoice10)
package {
import flash.media.*;
public dynamic class SoundVoice10 extends Sound {
}
}//package
Section 423
//SoundVoice11 (SoundVoice11)
package {
import flash.media.*;
public dynamic class SoundVoice11 extends Sound {
}
}//package
Section 424
//SoundVoice12 (SoundVoice12)
package {
import flash.media.*;
public dynamic class SoundVoice12 extends Sound {
}
}//package
Section 425
//SoundVoice13 (SoundVoice13)
package {
import flash.media.*;
public dynamic class SoundVoice13 extends Sound {
}
}//package
Section 426
//SoundVoice14 (SoundVoice14)
package {
import flash.media.*;
public dynamic class SoundVoice14 extends Sound {
}
}//package
Section 427
//SoundVoice15 (SoundVoice15)
package {
import flash.media.*;
public dynamic class SoundVoice15 extends Sound {
}
}//package
Section 428
//SoundVoice16 (SoundVoice16)
package {
import flash.media.*;
public dynamic class SoundVoice16 extends Sound {
}
}//package
Section 429
//SoundVoice17 (SoundVoice17)
package {
import flash.media.*;
public dynamic class SoundVoice17 extends Sound {
}
}//package
Section 430
//SoundVoice18 (SoundVoice18)
package {
import flash.media.*;
public dynamic class SoundVoice18 extends Sound {
}
}//package
Section 431
//SoundVoice2 (SoundVoice2)
package {
import flash.media.*;
public dynamic class SoundVoice2 extends Sound {
}
}//package
Section 432
//SoundVoice3 (SoundVoice3)
package {
import flash.media.*;
public dynamic class SoundVoice3 extends Sound {
}
}//package
Section 433
//SoundVoice4 (SoundVoice4)
package {
import flash.media.*;
public dynamic class SoundVoice4 extends Sound {
}
}//package
Section 434
//SoundVoice5 (SoundVoice5)
package {
import flash.media.*;
public dynamic class SoundVoice5 extends Sound {
}
}//package
Section 435
//SoundVoice6 (SoundVoice6)
package {
import flash.media.*;
public dynamic class SoundVoice6 extends Sound {
}
}//package
Section 436
//SoundVoice7 (SoundVoice7)
package {
import flash.media.*;
public dynamic class SoundVoice7 extends Sound {
}
}//package
Section 437
//SoundVoice8 (SoundVoice8)
package {
import flash.media.*;
public dynamic class SoundVoice8 extends Sound {
}
}//package
Section 438
//SoundVoice9 (SoundVoice9)
package {
import flash.media.*;
public dynamic class SoundVoice9 extends Sound {
}
}//package
Section 439
//SoundVyup (SoundVyup)
package {
import flash.media.*;
public dynamic class SoundVyup extends Sound {
}
}//package
Section 440
//Suiciders (Suiciders)
package {
import flash.events.*;
import flash.display.*;
import com.mokus.suiciders.ui.*;
import com.kavalok.events.*;
import Box2D.Dynamics.*;
import com.kavalok.utils.*;
import com.mokus.suiciders.gamePlay.*;
import com.mokus.suiciders.levels.*;
import com.kavalok.gameplay.controls.*;
import com.mokus.util.*;
import com.mokus.suiciders.data.*;
import flash.system.*;
public dynamic class Suiciders extends MovieClip {
private var _levelLoader:LevelLoader;
private var _completeHandler:Function;
public var world:b2World;
private var _creditsView:CreditsView;
private var _movie:DisplayObject;
private var _callback:Function;
private var _square:McBlackSquare;
private var _rootFrame:McRootFrame;
private var _levelsView:LevelsView;
private var _levelBuilder:LevelBuilder;
private var _stageScroller:StageScroller;
private var _soundButton:ToggleButton;
private var _levelClass:Class;
public static const BALLS_COUNT:Number = 20;
public static const INITIAL_Y:Number = 300;
public static const WIDTH:Number = 500;
public static const JOINT_ITERATIONS:int = 20;
public static const IMPACT_ITERATIONS:int = 3;
public static const EFFECT_FRAMES:int = 20;
public function Suiciders(){
_rootFrame = new McRootFrame();
super();
Security.allowDomain("*");
Security.allowInsecureDomain("*");
}
private function movieComplete():void{
removeChild(_movie);
if (_callback != null){
_callback();
};
_callback = null;
}
public function initialize():void{
CursorManager.instance.initialize(this);
var _local1:McBlackSquare = new McBlackSquare();
stage.addChild(_local1);
this.mask = _local1;
var _local2:MovieClip = new McSplash();
GraphUtils.makeButton(_local2);
_local2.addEventListener(MouseEvent.CLICK, new ArgumentReplacer(SponsorUtil.navigateToSponsor, "splash").handle);
playMovie(_local2, null, showMenu);
stage.addChild(_rootFrame);
var _local3:UserData = new UserData();
_soundButton = new ToggleButton(_rootFrame.soundButton);
_soundButton.content.addEventListener(MouseEvent.CLICK, onSoundClick);
if (_local3.soundDisabled){
_soundButton.toggle = true;
SoundManager.instance.enabled = false;
};
_rootFrame.visible = false;
new ButtonCursorRemover(_soundButton.content);
PhysixTool.apply(this);
Analytics.track("initialize");
}
private function effect(_arg1:Function, _arg2:Number, _arg3:Number):void{
_completeHandler = _arg1;
_square = new McBlackSquare();
addChild(_square);
_square.alpha = _arg2;
new SpriteTweaner(_square, {alpha:_arg3}, EFFECT_FRAMES, null, onEffectEnd);
}
private function playLevelIntro():void{
_levelLoader.playLevelIntro();
}
private function disposeLevel():void{
if (_levelLoader){
_levelLoader.dispose();
_levelLoader = null;
};
}
private function playFinalMovie():void{
Analytics.track("finalMovie");
disposeLevel();
playMovie(new McFinal(), SoundOutro, submitScores);
}
private function trySubmitScores():void{
var _local1:UserData = new UserData();
if (((_local1.gameComplete) && (_local1.newHighScore))){
new HighScoreUtil(false).trySubmit(stage);
};
}
private function onCredits():void{
hideEffect(showCredits);
}
private function onConnectError(_arg1:Object):void{
}
private function loadLevel():void{
_levelLoader = new LevelLoader();
initLoader();
}
private function onLevelSelect(_arg1:Class):void{
_levelsView.levelSelect.removeListener(onLevelSelect);
_levelClass = _arg1;
hideEffect(loadLevel);
}
private function onCreditsBack():void{
removeChild(_creditsView.content);
_creditsView = null;
showMenu();
}
private function initLoader():void{
if (_levelsView){
removeChild(_levelsView.content);
removeChild(_levelsView.levelStageView.content);
_levelsView = null;
};
_levelLoader.loadLevel(this, _levelClass);
showEffect(playLevelIntro);
_levelLoader.levelCompleteEvent.addListener(onLevelComplete);
_levelLoader.levelBackEvent.addListener(onLevelBack);
}
private function onLevelComplete(_arg1:int):void{
if (_arg1 == (LevelsView.levels.length - 1)){
hideEffect(playFinalMovie);
} else {
hideEffect(showLevels);
trySubmitScores();
};
}
private function showLevels():void{
Analytics.track("levels");
disposeLevel();
_levelsView = new LevelsView();
_levelsView.levelSelect.addListener(onLevelSelect);
_levelsView.backEvent.addListener(new ArgumentReplacer(hideEffect, showMenu).handle);
addChild(_levelsView.content);
_levelsView.initialize(this);
_levelsView.refresh();
showEffect(null);
}
private function playMovie(_arg1:MovieClip, _arg2:Class, _arg3:Function):void{
if (_arg2){
SoundManager.instance.playMusic(_arg2, 1);
};
_callback = _arg3;
addChild(_arg1);
var _local4:MoviePlayer = new MoviePlayer(_arg1);
_local4.completeEvent.addListener(onMovieComplete);
showEffect(null);
}
private function showCredits():void{
_levelLoader.dispose();
_levelLoader = null;
_creditsView = new CreditsView();
addChild(_creditsView.content);
_creditsView.back.addListener(onCreditsBack);
}
private function submitScores():void{
trySubmitScores();
showMenu();
}
private function onMovieComplete(_arg1:MoviePlayer):void{
_movie = _arg1.content;
hideEffect(movieComplete);
}
private function onEffectEnd(_arg1:McBlackSquare):void{
if (_square){
removeChild(_square);
};
if (_completeHandler != null){
_completeHandler();
};
}
private function onLevelBack():void{
hideEffect(showLevels);
}
private function showEffect(_arg1:Function):void{
effect(_arg1, 1, 0);
}
private function showIntro():void{
Analytics.track("intro");
disposeLevel();
playMovie(new McIntroContainer(), SoundIntro, showLevels);
}
private function hideEffect(_arg1:Function):void{
effect(_arg1, 0, 1.3);
}
private function onSoundClick(_arg1:MouseEvent):void{
SoundManager.instance.enabled = !(_soundButton.toggle);
if (!_soundButton.toggle){
Analytics.track("soundOn");
} else {
Analytics.track("soundOff");
};
new UserData().soundDisabled = _soundButton.toggle;
}
private function showMenu():void{
_rootFrame.visible = true;
Analytics.track("menu");
_levelClass = LevelMenu;
var _local1:MenuLoader = new MenuLoader();
_local1.credits.addListener(onCredits);
_local1.continueEvent.addListener(new ArgumentReplacer(hideEffect, showLevels).handle);
_local1.newGameEvent.addListener(new ArgumentReplacer(hideEffect, showIntro).handle);
_levelLoader = _local1;
initLoader();
}
}
}//package