Section 1
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2CircleDef extends b2ShapeDef {
public var localPosition:b2Vec2;
public var radius:Number;
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 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)));
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):int{
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){
_arg2[0] = 0;
return (e_startsInsideCollide);
};
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 (e_missCollide);
};
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 (e_hitCollide);
};
return (e_missCollide);
}
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 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 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))));
}
public function GetLocalPosition():b2Vec2{
return (m_localPosition);
}
public function GetRadius():Number{
return (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);
}
}
}//package Box2D.Collision.Shapes
Section 3
//b2FilterData (Box2D.Collision.Shapes.b2FilterData)
package Box2D.Collision.Shapes {
public class b2FilterData {
public var categoryBits:uint;// = 1
public var maskBits:uint;// = 0xFFFF
public var groupIndex:int;// = 0
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 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);
}
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++;
};
};
}
}
}//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 {
private var s_supportVec:b2Vec2;
public var m_centroid:b2Vec2;
public var m_obb:b2OBB;
public var m_vertices:Array;
public var m_normals:Array;
public var m_coreVertices:Array;
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 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);
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):int{
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 (e_missCollide);
};
_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 (e_hitCollide);
};
_arg2[0] = 0;
return (e_startsInsideCollide);
}
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 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);
}
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 GetOBB():b2OBB{
return (m_obb);
}
public function GetCentroid():b2Vec2{
return (m_centroid);
}
public function GetVertexCount():int{
return (m_vertexCount);
}
public function GetVertices():Array{
return (m_vertices);
}
public function GetCoreVertices():Array{
return (m_coreVertices);
}
public function GetNormals():Array{
return (m_normals);
}
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));
}
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);
}
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++;
};
}
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_type:int;
public var m_next:b2Shape;
public var m_body:b2Body;
public var m_sweepRadius:Number;
public var m_density:Number;
public var m_friction:Number;
public var m_restitution:Number;
public var m_proxyId:uint;
public var m_filter:b2FilterData;
public var m_isSensor:Boolean;
public var m_userData;
public static const e_hitCollide:int = 1;
public static const e_missCollide:int = 0;
public static const e_startsInsideCollide:int = -1;
public static const e_unknownShape:int = -1;
public static const e_circleShape:int = 0;
public static const e_polygonShape:int = 1;
public static const e_shapeTypeCount:int = 2;
private static var s_proxyAABB:b2AABB = new b2AABB();
private static var s_syncAABB:b2AABB = new b2AABB();
private static var s_resetAABB: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 GetType():int{
return (m_type);
}
public function IsSensor():Boolean{
return (m_isSensor);
}
public function SetFilterData(_arg1:b2FilterData):void{
m_filter = _arg1.Copy();
}
public function GetFilterData():b2FilterData{
return (m_filter.Copy());
}
public function GetBody():b2Body{
return (m_body);
}
public function GetNext():b2Shape{
return (m_next);
}
public function GetUserData(){
return (m_userData);
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
return (false);
}
public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):int{
return (e_missCollide);
}
public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
}
public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
}
public function ComputeMass(_arg1:b2MassData):void{
}
public function GetSweepRadius():Number{
return (m_sweepRadius);
}
public function GetFriction():Number{
return (m_friction);
}
public function GetRestitution():Number{
return (m_restitution);
}
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 DestroyProxy(_arg1:b2BroadPhase):void{
if (m_proxyId != b2Pair.b2_nullProxy){
_arg1.DestroyProxy(m_proxyId);
m_proxyId = b2Pair.b2_nullProxy;
};
}
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 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 UpdateSweepRadius(_arg1:b2Vec2):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);
};
}
public static function Destroy(_arg1:b2Shape, _arg2):void{
}
}
}//package Box2D.Collision.Shapes
Section 8
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef)
package Box2D.Collision.Shapes {
public class b2ShapeDef {
public var type:int;
public var userData;// = null
public var friction:Number;// = 0.2
public var restitution:Number;// = 0
public var density:Number;// = 0
public var isSensor:Boolean;// = false
public var filter:b2FilterData;
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 lowerBound:b2Vec2;
public var upperBound: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 IsLower():Boolean{
return (((value & 1) == 0));
}
public function IsUpper():Boolean{
return (((value & 1) == 1));
}
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;
}
}
}//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_pairManager:b2PairManager;
public var m_proxyPool:Array;
public var m_freeProxy:uint;
public var m_bounds:Array;
public var m_querySortKeys:Array;
public var m_queryResults:Array;
public var m_queryResultCount:int;
public var m_worldAABB:b2AABB;
public var m_quantizationFactor:b2Vec2;
public var m_proxyCount:int;
public var m_timeStamp:uint;
public static const b2_invalid:uint = b2Settings.USHRT_MAX;
public static const b2_nullEdge:uint = b2Settings.USHRT_MAX;
public static var s_validate:Boolean = false;
public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){
var _local3:int;
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_querySortKeys = new Array(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;
m_querySortKeys[_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);
var _local5:Number = (_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 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 GetProxy(_arg1:int):b2Proxy{
var _local2:b2Proxy = m_proxyPool[_arg1];
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((_local2.IsValid() == false)))){
return (null);
};
return (_local2);
}
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 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 function Commit():void{
m_pairManager.Commit();
}
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 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 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);
}
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);
}
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);
}
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 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++;
};
}
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++;
};
}
public function QuerySegment(_arg1:b2Segment, _arg2, _arg3:int, _arg4:Function):int{
var _local15:int;
var _local16:int;
var _local17:uint;
var _local18:b2Proxy;
var _local19:uint;
var _local20:uint;
var _local23:int;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:uint;
var _local28:Number;
var _local29:Number;
var _local5:Number = 1;
var _local6:Number = ((_arg1.p2.x - _arg1.p1.x) * m_quantizationFactor.x);
var _local7:Number = ((_arg1.p2.y - _arg1.p1.y) * m_quantizationFactor.y);
var _local8:int = ((_local6 < -(Number.MIN_VALUE))) ? -1 : ((_local6 > Number.MIN_VALUE)) ? 1 : 0;
var _local9:int = ((_local7 < -(Number.MIN_VALUE))) ? -1 : ((_local7 > Number.MIN_VALUE)) ? 1 : 0;
var _local10:Number = (m_quantizationFactor.x * (_arg1.p1.x - m_worldAABB.lowerBound.x));
var _local11:Number = (m_quantizationFactor.y * (_arg1.p1.y - m_worldAABB.lowerBound.y));
var _local12:Array = new Array();
var _local13:Array = new Array();
_local12[0] = (uint(_local10) & (b2Settings.USHRT_MAX - 1));
_local12[1] = (uint(_local11) & (b2Settings.USHRT_MAX - 1));
_local13[0] = (_local12[0] + 1);
_local13[1] = (_local12[1] + 1);
var _local14:Array = new Array();
var _local21:Array = [_local19];
var _local22:Array = [_local20];
Query(_local21, _local22, _local12[0], _local13[0], m_bounds[0], (2 * m_proxyCount), 0);
if (_local8 >= 0){
_local15 = (_local22[0] - 1);
} else {
_local15 = _local21[0];
};
Query(_local21, _local22, _local12[1], _local13[1], m_bounds[1], (2 * m_proxyCount), 1);
if (_local9 >= 0){
_local16 = (_local22[0] - 1);
} else {
_local16 = _local21[0];
};
if (_arg4 != null){
_local24 = 0;
while (_local24 < m_queryResultCount) {
m_querySortKeys[_local24] = _arg4(m_proxyPool[m_queryResults[_local24]].userData);
_local24++;
};
_local24 = 0;
while (_local24 < (m_queryResultCount - 1)) {
_local25 = m_querySortKeys[_local24];
_local26 = m_querySortKeys[(_local24 + 1)];
if (((_local25)<0) ? (_local26 >= 0) : (((_local25 > _local26)) && ((_local26 >= 0)))){
m_querySortKeys[(_local24 + 1)] = _local25;
m_querySortKeys[_local24] = _local26;
_local27 = m_queryResults[(_local24 + 1)];
m_queryResults[(_local24 + 1)] = m_queryResults[_local24];
m_queryResults[_local24] = _local27;
--_local24;
if (_local24 == -1){
_local24 = 1;
};
} else {
_local24++;
};
};
while ((((m_queryResultCount > 0)) && ((m_querySortKeys[(m_queryResultCount - 1)] < 0)))) {
m_queryResultCount--;
};
};
while (true) {
_local28 = 0;
_local29 = 0;
_local15 = (_local15 + ((_local8 >= 0)) ? 1 : -1);
if ((((_local15 < 0)) || ((_local15 >= (m_proxyCount * 2))))){
break;
};
if (_local8 != 0){
_local28 = ((m_bounds[0][_local15].value - _local10) / _local6);
};
_local16 = (_local16 + ((_local9 >= 0)) ? 1 : -1);
if ((((_local16 < 0)) || ((_local16 >= (m_proxyCount * 2))))){
break;
};
if (_local9 != 0){
_local29 = ((m_bounds[1][_local16].value - _local11) / _local7);
};
while (true) {
if ((((_local9 == 0)) || (((!((_local8 == 0))) && ((_local28 < _local29)))))){
if (_local28 > _local5){
break;
};
if (((_local8 > 0)) ? m_bounds[0][_local15].IsLower() : m_bounds[0][_local15].IsUpper()){
_local17 = m_bounds[0][_local15].proxyId;
_local18 = m_proxyPool[_local17];
if (_local9 >= 0){
if ((((_local18.lowerBounds[1] <= (_local16 - 1))) && ((_local18.upperBounds[1] >= _local16)))){
if (_arg4 != null){
AddProxyResult(_local17, _local18, _arg3, _arg4);
} else {
m_queryResults[m_queryResultCount] = _local17;
m_queryResultCount++;
};
};
} else {
if ((((_local18.lowerBounds[1] <= _local16)) && ((_local18.upperBounds[1] >= (_local16 + 1))))){
if (_arg4 != null){
AddProxyResult(_local17, _local18, _arg3, _arg4);
} else {
m_queryResults[m_queryResultCount] = _local17;
m_queryResultCount++;
};
};
};
};
if (((((((!((_arg4 == null))) && ((m_queryResultCount == _arg3)))) && ((m_queryResultCount > 0)))) && ((_local28 > m_querySortKeys[(m_queryResultCount - 1)])))){
break;
};
if (_local8 > 0){
_local15++;
if (_local15 == (m_proxyCount * 2)){
break;
};
} else {
--_local15;
if (_local15 < 0){
break;
};
};
_local28 = ((m_bounds[0][_local15].value - _local10) / _local6);
} else {
if (_local29 > _local5){
break;
};
if (((_local9 > 0)) ? m_bounds[1][_local16].IsLower() : m_bounds[1][_local16].IsUpper()){
_local17 = m_bounds[1][_local16].proxyId;
_local18 = m_proxyPool[_local17];
if (_local8 >= 0){
if ((((_local18.lowerBounds[0] <= (_local15 - 1))) && ((_local18.upperBounds[0] >= _local15)))){
if (_arg4 != null){
AddProxyResult(_local17, _local18, _arg3, _arg4);
} else {
m_queryResults[m_queryResultCount] = _local17;
m_queryResultCount++;
};
};
} else {
if ((((_local18.lowerBounds[0] <= _local15)) && ((_local18.upperBounds[0] >= (_local15 + 1))))){
if (_arg4 != null){
AddProxyResult(_local17, _local18, _arg3, _arg4);
} else {
m_queryResults[m_queryResultCount] = _local17;
m_queryResultCount++;
};
};
};
};
if (((((((!((_arg4 == null))) && ((m_queryResultCount == _arg3)))) && ((m_queryResultCount > 0)))) && ((_local29 > m_querySortKeys[(m_queryResultCount - 1)])))){
break;
};
if (_local9 > 0){
_local16++;
if (_local16 == (m_proxyCount * 2)){
break;
};
} else {
--_local16;
if (_local16 < 0){
break;
};
};
_local29 = ((m_bounds[1][_local16].value - _local11) / _local7);
};
};
break;
};
_local23 = 0;
_local24 = 0;
while ((((_local24 < m_queryResultCount)) && ((_local23 < _arg3)))) {
_local18 = m_proxyPool[m_queryResults[_local24]];
_arg2[_local24] = _local18.userData;
_local24++;
_local23++;
};
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local23);
}
private function AddProxyResult(_arg1:uint, _arg2:b2Proxy, _arg3:Number, _arg4:Function):void{
var _local9:Number;
var _local10:uint;
var _local5:Number = _arg4(_arg2.userData);
if (_local5 < 0){
return;
};
var _local6:Number = 0;
while ((((_local6 < m_queryResultCount)) && ((m_querySortKeys[_local6] < _local5)))) {
_local6++;
};
var _local7:Number = _local5;
var _local8:uint = _arg1;
m_queryResultCount = (m_queryResultCount + 1);
if (m_queryResultCount > _arg3){
m_queryResultCount = _arg3;
};
while (_local6 < m_queryResultCount) {
_local9 = m_querySortKeys[_local6];
_local10 = m_queryResults[_local6];
m_querySortKeys[_local6] = _local7;
m_queryResults[_local6] = _local8;
_local7 = _local9;
_local8 = _local10;
_local6++;
};
}
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 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 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 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 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 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;
}
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);
}
}
}//package Box2D.Collision
Section 15
//b2ContactID (Box2D.Collision.b2ContactID)
package Box2D.Collision {
public class b2ContactID {
public var features:Features;
public var _key:uint;
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 get key():uint{
return (_key);
}
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);
}
}
}//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 shape1:b2Shape;
public var shape2:b2Shape;
public var position:b2Vec2;
public var velocity:b2Vec2;
public var normal:b2Vec2;
public var separation:Number;
public var friction:Number;
public var restitution:Number;
public var id:b2ContactID;
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_p1s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var s_p2s: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 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);
}
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 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 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);
}
}
}//package Box2D.Collision
Section 18
//b2Manifold (Box2D.Collision.b2Manifold)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Manifold {
public var points:Array;
public var normal:b2Vec2;
public var pointCount:int;// = 0
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 Reset():void{
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
(points[_local1] as b2ManifoldPoint).Reset();
_local1++;
};
normal.SetZero();
pointCount = 0;
}
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);
}
}
}//package Box2D.Collision
Section 19
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2ManifoldPoint {
public var localPoint1:b2Vec2;
public var localPoint2:b2Vec2;
public var separation:Number;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var id:b2ContactID;
public function b2ManifoldPoint(){
localPoint1 = new b2Vec2();
localPoint2 = new b2Vec2();
id = new b2ContactID();
super();
}
public function Reset():void{
localPoint1.SetZero();
localPoint2.SetZero();
separation = 0;
normalImpulse = 0;
tangentImpulse = 0;
id.key = 0;
}
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;
}
}
}//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 userData;// = null
public var proxyId1:uint;
public var proxyId2:uint;
public var next:uint;
public var status:uint;
public static var b2_nullPair:uint = b2Settings.USHRT_MAX;
public static var b2_nullProxy:uint = b2Settings.USHRT_MAX;
public static var b2_tableCapacity:int = b2Settings.b2_maxPairs;
public static var b2_tableMask:int = (b2_tableCapacity - 1);
public static var e_pairBuffered:uint = 1;
public static var e_pairRemoved:uint = 2;
public static var e_pairFinal:uint = 4;
public function SetBuffered():void{
status = (status | e_pairBuffered);
}
public function ClearBuffered():void{
status = (status & ~(e_pairBuffered));
}
public function IsBuffered():Boolean{
return (((status & e_pairBuffered) == e_pairBuffered));
}
public function SetRemoved():void{
status = (status | e_pairRemoved);
}
public function ClearRemoved():void{
status = (status & ~(e_pairRemoved));
}
public function IsRemoved():Boolean{
return (((status & e_pairRemoved) == e_pairRemoved));
}
public function SetFinal():void{
status = (status | e_pairFinal);
}
public function IsFinal():Boolean{
return (((status & e_pairFinal) == e_pairFinal));
}
}
}//package Box2D.Collision
Section 22
//b2PairCallback (Box2D.Collision.b2PairCallback)
package Box2D.Collision {
public class b2PairCallback {
public function PairAdded(_arg1, _arg2){
return (null);
}
public function PairRemoved(_arg1, _arg2, _arg3):void{
}
}
}//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_broadPhase:b2BroadPhase;
public var m_callback:b2PairCallback;
public var m_pairs:Array;
public var m_freePair:uint;
public var m_pairCount:int;
public var m_pairBuffer:Array;
public var m_pairBufferCount:int;
public var m_hashTable:Array;
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;
}
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();
};
}
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();
};
}
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();
};
}
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 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);
}
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 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 ValidateBuffer():void{
}
private function ValidateTable():void{
}
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))));
}
public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{
return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2))));
}
}
}//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 Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
return (p);
}
public function GetFirstVertex(_arg1:b2XForm):b2Vec2{
return (p);
}
}
}//package Box2D.Collision
Section 25
//b2Proxy (Box2D.Collision.b2Proxy)
package Box2D.Collision {
public class b2Proxy {
public var lowerBounds:Array;
public var upperBounds:Array;
public var overlapCount:uint;
public var timeStamp:uint;
public var userData;// = null
public function b2Proxy(){
lowerBounds = [uint(0), uint(0)];
upperBounds = [uint(0), uint(0)];
super();
}
public function GetNext():uint{
return (lowerBounds[0]);
}
public function SetNext(_arg1:uint):void{
lowerBounds[0] = (_arg1 & 0xFFFF);
}
public function IsValid():Boolean{
return (!((overlapCount == b2BroadPhase.b2_invalid)));
}
}
}//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);
}
public function Extend(_arg1:b2AABB):void{
ExtendForward(_arg1);
ExtendBackward(_arg1);
}
public function ExtendForward(_arg1:b2AABB):void{
var _local4:Number;
var _local2:Number = (p2.x - p1.x);
var _local3:Number = (p2.y - p1.y);
_local4 = Math.min(((_local2 > 0)) ? ((_arg1.upperBound.x - p1.x) / _local2) : ((_local2 < 0)) ? ((_arg1.lowerBound.x - p1.x) / _local2) : Number.POSITIVE_INFINITY, ((_local3 > 0)) ? ((_arg1.upperBound.y - p1.y) / _local3) : ((_local3 < 0)) ? ((_arg1.lowerBound.y - p1.y) / _local3) : Number.POSITIVE_INFINITY);
p2.x = (p1.x + (_local2 * _local4));
p2.y = (p1.y + (_local3 * _local4));
}
public function ExtendBackward(_arg1:b2AABB):void{
var _local4:Number;
var _local2:Number = (-(p2.x) + p1.x);
var _local3:Number = (-(p2.y) + p1.y);
_local4 = Math.min(((_local2 > 0)) ? ((_arg1.upperBound.x - p2.x) / _local2) : ((_local2 < 0)) ? ((_arg1.lowerBound.x - p2.x) / _local2) : Number.POSITIVE_INFINITY, ((_local3 > 0)) ? ((_arg1.upperBound.y - p2.y) / _local3) : ((_local3 < 0)) ? ((_arg1.lowerBound.y - p2.y) / _local3) : Number.POSITIVE_INFINITY);
p1.x = (p2.x + (_local2 * _local4));
p1.y = (p2.y + (_local3 * _local4));
}
}
}//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_p1:b2Vec2 = new b2Vec2();
public static var s_p2:b2Vec2 = new b2Vec2();
public static var s_xf1:b2XForm = new b2XForm();
public static var s_xf2:b2XForm = new b2XForm();
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 v:b2Vec2;
public var id:b2ContactID;
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 _incidentVertex:int;
public var _flip:int;
public var _m_id:b2ContactID;
public function set referenceEdge(_arg1:int):void{
_referenceEdge = _arg1;
_m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF));
}
public function get referenceEdge():int{
return (_referenceEdge);
}
public function set incidentEdge(_arg1:int):void{
_incidentEdge = _arg1;
_m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00));
}
public function get incidentEdge():int{
return (_incidentEdge);
}
public function set incidentVertex(_arg1:int):void{
_incidentVertex = _arg1;
_m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000));
}
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 get flip():int{
return (_flip);
}
}
}//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 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 SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{
col1.SetV(_arg1);
col2.SetV(_arg2);
}
public function Copy():b2Mat22{
return (new b2Mat22(0, col1, col2));
}
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 SetIdentity():void{
col1.x = 1;
col2.x = 0;
col1.y = 0;
col2.y = 1;
}
public function SetZero():void{
col1.x = 0;
col2.x = 0;
col1.y = 0;
col2.y = 0;
}
public function GetAngle():Number{
return (Math.atan2(col1.y, col1.x));
}
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 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);
}
public function Abs():void{
col1.Abs();
col2.Abs();
}
}
}//package Box2D.Common.Math
Section 31
//b2Math (Box2D.Common.Math.b2Math)
package Box2D.Common.Math {
public class b2Math {
public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0);
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 function b2IsValid(_arg1:Number):Boolean{
return (isFinite(_arg1));
}
public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x)));
}
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 b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x));
return (_local3);
}
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);
}
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 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 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 AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y));
return (_local3);
}
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 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 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 MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y));
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 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 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 b2Abs(_arg1:Number):Number{
return (((_arg1 > 0)) ? _arg1 : -(_arg1));
}
public static function b2AbsV(_arg1:b2Vec2):b2Vec2{
var _local2:b2Vec2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y));
return (_local2);
}
public static function b2AbsM(_arg1:b2Mat22):b2Mat22{
var _local2:b2Mat22 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2));
return (_local2);
}
public static function b2Min(_arg1:Number, _arg2:Number):Number{
return (((_arg1 < _arg2)) ? _arg1 : _arg2);
}
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 b2Max(_arg1:Number, _arg2:Number):Number{
return (((_arg1 > _arg2)) ? _arg1 : _arg2);
}
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 b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (b2Max(_arg2, b2Min(_arg1, _arg3)));
}
public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{
return (b2MaxV(_arg2, b2MinV(_arg1, _arg3)));
}
public static function b2Swap(_arg1:Array, _arg2:Array):void{
var _local3:* = _arg1[0];
_arg1[0] = _arg2[0];
_arg2[0] = _local3;
}
public static function b2Random():Number{
return (((Math.random() * 2) - 1));
}
public static function b2RandomRange(_arg1:Number, _arg2:Number):Number{
var _local3:Number = Math.random();
_local3 = (((_arg2 - _arg1) * _local3) + _arg1);
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 b2IsPowerOfTwo(_arg1:uint):Boolean{
var _local2:Boolean = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0)));
return (_local2);
}
}
}//package Box2D.Common.Math
Section 32
//b2Sweep (Box2D.Common.Math.b2Sweep)
package Box2D.Common.Math {
public class b2Sweep {
public var localCenter:b2Vec2;
public var c0:b2Vec2;
public var c:b2Vec2;
public var a0:Number;
public var a:Number;
public var t0:Number;
public function b2Sweep(){
localCenter = new b2Vec2();
c0 = new b2Vec2();
c = new b2Vec2();
super();
}
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)));
}
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;
};
}
}
}//package Box2D.Common.Math
Section 33
//b2Vec2 (Box2D.Common.Math.b2Vec2)
package Box2D.Common.Math {
public class b2Vec2 {
public var x:Number;
public var y:Number;
public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function SetZero():void{
x = 0;
y = 0;
}
public function Set(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function SetV(_arg1:b2Vec2):void{
x = _arg1.x;
y = _arg1.y;
}
public function Negative():b2Vec2{
return (new b2Vec2(-(x), -(y)));
}
public function Copy():b2Vec2{
return (new b2Vec2(x, y));
}
public function Add(_arg1:b2Vec2):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function Subtract(_arg1:b2Vec2):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function Multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
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 MulTM(_arg1:b2Mat22):void{
var _local2:Number = b2Math.b2Dot(this, _arg1.col1);
y = b2Math.b2Dot(this, _arg1.col2);
x = _local2;
}
public function CrossVF(_arg1:Number):void{
var _local2:Number = x;
x = (_arg1 * y);
y = (-(_arg1) * _local2);
}
public function CrossFV(_arg1:Number):void{
var _local2:Number = x;
x = (-(_arg1) * y);
y = (_arg1 * _local2);
}
public function MinV(_arg1:b2Vec2):void{
x = ((x < _arg1.x)) ? x : _arg1.x;
y = ((y < _arg1.y)) ? y : _arg1.y;
}
public function MaxV(_arg1:b2Vec2):void{
x = ((x > _arg1.x)) ? x : _arg1.x;
y = ((y > _arg1.y)) ? y : _arg1.y;
}
public function Abs():void{
if (x < 0){
x = -(x);
};
if (y < 0){
y = -(y);
};
}
public function Length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function LengthSquared():Number{
return (((x * x) + (y * 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 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 SetIdentity():void{
position.SetZero();
R.SetIdentity();
}
public function Set(_arg1:b2XForm):void{
position.SetV(_arg1.position);
R.SetM(_arg1.R);
}
}
}//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 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)));
}
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)));
}
}
}//package Box2D.Common
Section 36
//b2Settings (Box2D.Common.b2Settings)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Settings {
public static const USHRT_MAX:int = 0xFFFF;
public static const b2_pi:Number = 3.14159265358979;
public static const b2_maxManifoldPoints:int = 2;
public static const b2_maxPolygonVertices:int = 16;
public static const b2_maxProxies:int = 0x0200;
public static const b2_maxPairs:int = 4096;
public static const b2_linearSlop:Number = 0.005;
public static const b2_angularSlop:Number = 0.0349065850398866;
public static const b2_toiSlop:Number = 0.04;
public static const b2_maxTOIContactsPerIsland:int = 32;
public static const b2_velocityThreshold:Number = 1;
public static const b2_maxLinearCorrection:Number = 0.2;
public static const b2_maxAngularCorrection:Number = 0.139626340159546;
public static const b2_maxLinearVelocity:Number = 200;
public static const b2_maxLinearVelocitySquared:Number = 40000;
public static const b2_maxAngularVelocity:Number = 250;
public static const b2_maxAngularVelocitySquared:Number = 62500;
public static const b2_contactBaumgarte:Number = 0.2;
public static const b2_timeToSleep:Number = 0.5;
public static const b2_linearSleepTolerance:Number = 0.1;
public static const b2_angularSleepTolerance:Number = 0.0222222222222222;
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 Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2CircleContact(_arg1, _arg2));
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
}
}//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_flags:uint;
public var m_prev:b2Contact;
public var m_next:b2Contact;
public var m_node1:b2ContactEdge;
public var m_node2:b2ContactEdge;
public var m_shape1:b2Shape;
public var m_shape2:b2Shape;
public var m_manifoldCount:int;
public var m_friction:Number;
public var m_restitution:Number;
public var m_toi:Number;
public static var e_nonSolidFlag:uint = 1;
public static var e_slowFlag:uint = 2;
public static var e_islandFlag:uint = 4;
public static var e_toiFlag:uint = 8;
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 GetManifolds():Array{
return (null);
}
public function GetManifoldCount():int{
return (m_manifoldCount);
}
public function IsSolid():Boolean{
return (((m_flags & e_nonSolidFlag) == 0));
}
public function GetNext():b2Contact{
return (m_next);
}
public function GetShape1():b2Shape{
return (m_shape1);
}
public function GetShape2():b2Shape{
return (m_shape2);
}
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 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 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 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);
}
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);
}
}
}//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 manifold:b2Manifold;
public var body1:b2Body;
public var body2:b2Body;
public var friction:Number;
public var restitution: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 localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var r1:b2Vec2;
public var r2:b2Vec2;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var positionImpulse:Number;
public var normalMass:Number;
public var tangentMass:Number;
public var equalizedMass:Number;
public var separation:Number;
public var velocityBias:Number;
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 contact:b2Contact;
public var prev:b2ContactEdge;
public var next:b2ContactEdge;
}
}//package Box2D.Dynamics.Contacts
Section 42
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister)
package Box2D.Dynamics.Contacts {
public class b2ContactRegister {
public var createFcn:Function;
public var destroyFcn:Function;
public var primary:Boolean;
}
}//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 shape1:b2Shape;
public var shape2:b2Shape;
public var position:b2Vec2;
public var normal:b2Vec2;
public var normalImpulse:Number;
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_step:b2TimeStep;
public var m_allocator;
public var m_constraints:Array;
public var m_constraintCount:int;
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 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++;
};
}
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)));
}
}
}//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 Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolyAndCircleContact(_arg1, _arg2));
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
}
}//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 m0:b2Manifold;
private var m_manifolds:Array;
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 Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolygonContact(_arg1, _arg2));
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
}
}//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_u:b2Vec2;
public var m_frequencyHz:Number;
public var m_dampingRatio:Number;
public var m_gamma:Number;
public var m_bias:Number;
public var m_impulse:Number;
public var m_mass: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 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 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))));
}
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 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 = new b2Vec2();
_local1.SetV(m_u);
_local1.Multiply((m_inv_dt * m_impulse));
return (_local1);
}
override public function GetReactionTorque():Number{
return (0);
}
}
}//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 localAnchor2:b2Vec2;
public var length:Number;
public var frequencyHz:Number;
public var dampingRatio: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_ground1:b2Body;
public var m_ground2:b2Body;
public var m_revolute1:b2RevoluteJoint;
public var m_prismatic1:b2PrismaticJoint;
public var m_revolute2:b2RevoluteJoint;
public var m_prismatic2:b2PrismaticJoint;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_J:b2Jacobian;
public var m_constant:Number;
public var m_ratio:Number;
public var m_mass:Number;
public var m_force:Number;
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 GetReactionForce():b2Vec2{
var _local1:b2Vec2 = new b2Vec2((m_force * m_J.linear2.x), (m_force * m_J.linear2.y));
return (_local1);
}
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);
}
public function GetRatio():Number{
return (m_ratio);
}
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 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));
}
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));
}
}
}//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 angular1:Number;
public var linear2:b2Vec2;
public var angular2:Number;
public function b2Jacobian(){
linear1 = new b2Vec2();
linear2 = new b2Vec2();
super();
}
public function SetZero():void{
linear1.SetZero();
angular1 = 0;
linear2.SetZero();
angular2 = 0;
}
public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{
linear1.SetV(_arg1);
angular1 = _arg2;
linear2.SetV(_arg3);
angular2 = _arg4;
}
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_type:int;
public var m_prev:b2Joint;
public var m_next:b2Joint;
public var m_node1:b2JointEdge;
public var m_node2:b2JointEdge;
public var m_body1:b2Body;
public var m_body2:b2Body;
public var m_inv_dt:Number;
public var m_islandFlag:Boolean;
public var m_collideConnected:Boolean;
public var m_userData;
public static const e_unknownJoint:int = 0;
public static const e_revoluteJoint:int = 1;
public static const e_prismaticJoint:int = 2;
public static const e_distanceJoint:int = 3;
public static const e_pulleyJoint:int = 4;
public static const e_mouseJoint:int = 5;
public static const e_gearJoint:int = 6;
public static const e_inactiveLimit:int = 0;
public static const e_atLowerLimit:int = 1;
public static const e_atUpperLimit:int = 2;
public static const e_equalLimits:int = 3;
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 GetType():int{
return (m_type);
}
public function GetAnchor1():b2Vec2{
return (null);
}
public function GetAnchor2():b2Vec2{
return (null);
}
public function GetReactionForce():b2Vec2{
return (null);
}
public function GetReactionTorque():Number{
return (0);
}
public function GetBody1():b2Body{
return (m_body1);
}
public function GetBody2():b2Body{
return (m_body2);
}
public function GetNext():b2Joint{
return (m_next);
}
public function GetUserData(){
return (m_userData);
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
}
public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
}
public function InitPositionConstraints():void{
}
public function SolvePositionConstraints():Boolean{
return (false);
}
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);
}
public static function Destroy(_arg1:b2Joint, _arg2):void{
}
}
}//package Box2D.Dynamics.Joints
Section 54
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointDef {
public var type:int;
public var userData;
public var body1:b2Body;
public var body2:b2Body;
public var collideConnected:Boolean;
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 joint:b2Joint;
public var prev:b2JointEdge;
public var next:b2JointEdge;
}
}//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 K:b2Mat22;
private var K1:b2Mat22;
private var K2:b2Mat22;
public var m_localAnchor:b2Vec2;
public var m_target:b2Vec2;
public var m_impulse:b2Vec2;
public var m_mass:b2Mat22;
public var m_C:b2Vec2;
public var m_maxForce:Number;
public var m_beta:Number;
public var m_gamma: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));
}
override public function GetAnchor1():b2Vec2{
return (m_target);
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor));
}
override public function GetReactionForce():b2Vec2{
return (m_impulse);
}
override public function GetReactionTorque():Number{
return (0);
}
public function SetTarget(_arg1:b2Vec2):void{
if (m_body2.IsSleeping()){
m_body2.WakeUp();
};
m_target = _arg1;
}
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 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))));
}
override public function SolvePositionConstraints():Boolean{
return (true);
}
}
}//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 target:b2Vec2;
public var maxForce:Number;
public var frequencyHz:Number;
public var dampingRatio:Number;
public var timeStep: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_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_localXAxis1:b2Vec2;
public var m_localYAxis1:b2Vec2;
public var m_refAngle:Number;
public var m_linearJacobian:b2Jacobian;
public var m_linearMass:Number;
public var m_force:Number;
public var m_angularMass:Number;
public var m_torque:Number;
public var m_motorJacobian:b2Jacobian;
public var m_motorMass:Number;
public var m_motorForce:Number;
public var m_limitForce:Number;
public var m_limitPositionImpulse:Number;
public var m_lowerTranslation:Number;
public var m_upperTranslation:Number;
public var m_maxMotorForce:Number;
public var m_motorSpeed:Number;
public var m_enableLimit:Boolean;
public var m_enableMotor:Boolean;
public var m_limitState:int;
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 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: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 GetReactionTorque():Number{
return (m_torque);
}
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 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);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
public function GetLowerLimit():Number{
return (m_lowerTranslation);
}
public function GetUpperLimit():Number{
return (m_upperTranslation);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerTranslation = _arg1;
m_upperTranslation = _arg2;
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
public function SetMaxMotorForce(_arg1:Number):void{
m_maxMotorForce = _arg1;
}
public function GetMotorForce():Number{
return (m_motorForce);
}
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;
}
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 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))));
}
}
}//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 localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var localAxis1:b2Vec2;
public var referenceAngle:Number;
public var enableLimit:Boolean;
public var lowerTranslation:Number;
public var upperTranslation:Number;
public var enableMotor:Boolean;
public var maxMotorForce:Number;
public var motorSpeed: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_ground:b2Body;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_u1:b2Vec2;
public var m_u2:b2Vec2;
public var m_constant:Number;
public var m_ratio:Number;
public var m_maxLength1:Number;
public var m_maxLength2:Number;
public var m_pulleyMass:Number;
public var m_limitMass1:Number;
public var m_limitMass2:Number;
public var m_force:Number;
public var m_limitForce1:Number;
public var m_limitForce2:Number;
public var m_positionImpulse:Number;
public var m_limitPositionImpulse1:Number;
public var m_limitPositionImpulse2:Number;
public var m_state:int;
public var m_limitState1:int;
public var m_limitState2:int;
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;
}
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 GetReactionTorque():Number{
return (0);
}
public function GetGroundAnchor1():b2Vec2{
var _local1:b2Vec2 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor1);
return (_local1);
}
public function GetGroundAnchor2():b2Vec2{
var _local1:b2Vec2 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor2);
return (_local1);
}
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 GetRatio():Number{
return (m_ratio);
}
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 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))));
};
}
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));
}
}
}//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 groundAnchor1:b2Vec2;
public var groundAnchor2:b2Vec2;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var length1:Number;
public var maxLength1:Number;
public var length2:Number;
public var maxLength2:Number;
public var ratio: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 {
private var K:b2Mat22;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K3:b2Mat22;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_pivotForce:b2Vec2;
public var m_motorForce:Number;
public var m_limitForce:Number;
public var m_limitPositionImpulse:Number;
public var m_pivotMass:b2Mat22;
public var m_motorMass:Number;
public var m_enableMotor:Boolean;
public var m_maxMotorTorque:Number;
public var m_motorSpeed:Number;
public var m_enableLimit:Boolean;
public var m_referenceAngle:Number;
public var m_lowerAngle:Number;
public var m_upperAngle:Number;
public var m_limitState:int;
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 GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
return (m_pivotForce);
}
override public function GetReactionTorque():Number{
return (m_limitForce);
}
public function GetJointAngle():Number{
return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - m_referenceAngle));
}
public function GetJointSpeed():Number{
return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity));
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
public function GetLowerLimit():Number{
return (m_lowerAngle);
}
public function GetUpperLimit():Number{
return (m_upperAngle);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerAngle = _arg1;
m_upperAngle = _arg2;
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
public function SetMaxMotorTorque(_arg1:Number):void{
m_maxMotorTorque = _arg1;
}
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;
}
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 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))));
}
}
}//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 localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var referenceAngle:Number;
public var enableLimit:Boolean;
public var lowerAngle:Number;
public var upperAngle:Number;
public var enableMotor:Boolean;
public var motorSpeed: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_flags:uint;
public var m_type:int;
public var m_xf:b2XForm;
public var m_sweep:b2Sweep;
public var m_linearVelocity:b2Vec2;
public var m_angularVelocity:Number;
public var m_force:b2Vec2;
public var m_torque:Number;
public var m_world:b2World;
public var m_prev:b2Body;
public var m_next:b2Body;
public var m_shapeList:b2Shape;
public var m_shapeCount:int;
public var m_jointList:b2JointEdge;
public var m_contactList:b2ContactEdge;
public var m_mass:Number;
public var m_invMass:Number;
public var m_I:Number;
public var m_invI:Number;
public var m_linearDamping:Number;
public var m_angularDamping:Number;
public var m_sleepTime:Number;
public var m_userData;
public var m_applyGravity:Boolean;
private static var s_massData:b2MassData = new b2MassData();
private static var s_xf1:b2XForm = new b2XForm();
public static var e_frozenFlag:uint = 2;
public static var e_islandFlag:uint = 4;
public static var e_sleepFlag:uint = 8;
public static var e_allowSleepFlag:uint = 16;
public static var e_bulletFlag:uint = 32;
public static var e_fixedRotationFlag:uint = 64;
public static var e_staticType:uint = 1;
public static var e_dynamicType:uint = 2;
public static var e_maxTypes:uint = 3;
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;
m_applyGravity = _arg1.applyGravity;
}
public function CreateShape(_arg1:b2ShapeDef):b2Shape{
if (m_world.m_lock == true){
return (null);
};
var _local2:b2Shape = 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 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 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 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 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 GetXForm():b2XForm{
return (m_xf);
}
public function GetPosition():b2Vec2{
return (m_xf.position);
}
public function GetAngle():Number{
return (m_sweep.a);
}
public function GetWorldCenter():b2Vec2{
return (m_sweep.c);
}
public function GetLocalCenter():b2Vec2{
return (m_sweep.localCenter);
}
public function SetLinearVelocity(_arg1:b2Vec2):void{
m_linearVelocity.SetV(_arg1);
}
public function GetLinearVelocity():b2Vec2{
return (m_linearVelocity);
}
public function SetAngularVelocity(_arg1:Number):void{
m_angularVelocity = _arg1;
}
public function GetAngularVelocity():Number{
return (m_angularVelocity);
}
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 ApplyTorque(_arg1:Number):void{
if (IsSleeping()){
WakeUp();
};
m_torque = (m_torque + _arg1);
}
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 GetMass():Number{
return (m_mass);
}
public function GetInertia():Number{
return (m_I);
}
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 GetWorldVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulMV(m_xf.R, _arg1));
}
public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulXT(m_xf, _arg1));
}
public function GetLocalVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_xf.R, _arg1));
}
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 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 IsBullet():Boolean{
return (((m_flags & e_bulletFlag) == e_bulletFlag));
}
public function SetBullet(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_bulletFlag);
} else {
m_flags = (m_flags & ~(e_bulletFlag));
};
}
public function IsStatic():Boolean{
return ((m_type == e_staticType));
}
public function IsDynamic():Boolean{
return ((m_type == e_dynamicType));
}
public function IsFrozen():Boolean{
return (((m_flags & e_frozenFlag) == e_frozenFlag));
}
public function IsSleeping():Boolean{
return (((m_flags & e_sleepFlag) == e_sleepFlag));
}
public function AllowSleeping(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_allowSleepFlag);
} else {
m_flags = (m_flags & ~(e_allowSleepFlag));
WakeUp();
};
}
public function WakeUp():void{
m_flags = (m_flags & ~(e_sleepFlag));
m_sleepTime = 0;
}
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 GetShapeList():b2Shape{
return (m_shapeList);
}
public function GetJointList():b2JointEdge{
return (m_jointList);
}
public function GetNext():b2Body{
return (m_next);
}
public function GetUserData(){
return (m_userData);
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetWorld():b2World{
return (m_world);
}
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 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 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 Advance(_arg1:Number):void{
m_sweep.Advance(_arg1);
m_sweep.c.SetV(m_sweep.c0);
m_sweep.a = m_sweep.a0;
SynchronizeTransform();
}
}
}//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 massData:b2MassData;
public var userData;
public var position:b2Vec2;
public var angle:Number;
public var linearDamping:Number;
public var angularDamping:Number;
public var allowSleep:Boolean;
public var isSleeping:Boolean;
public var fixedRotation:Boolean;
public var isBullet:Boolean;
public var applyGravity:Boolean;
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;
applyGravity = true;
}
}
}//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);
}
public function RayCollide(_arg1, _arg2:b2Shape):Boolean{
if (!_arg1){
return (true);
};
return (ShouldCollide((_arg1 as b2Shape), _arg2));
}
}
}//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 Persist(_arg1:b2ContactPoint):void{
}
public function Remove(_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_nullContact:b2NullContact;
public var m_destroyImmediate:Boolean;
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 PairAdded(_arg1, _arg2){
var _local5:b2Body;
var _local3:b2Shape = (_arg1 as b2Shape);
var _local4:b2Shape = (_arg2 as b2Shape);
_local5 = _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);
}
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--;
}
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_drawFlags:uint;
public var m_sprite:Sprite;
public var m_drawScale:Number;// = 1
public var m_lineThickness:Number;// = 1
public var m_alpha:Number;// = 1
public var m_fillAlpha:Number;// = 1
public var m_xformScale:Number;// = 1
public static var e_shapeBit:uint = 1;
public static var e_jointBit:uint = 2;
public static var e_coreShapeBit:uint = 4;
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_centerOfMassBit:uint = 64;
public function b2DebugDraw(){
m_drawFlags = 0;
}
public function SetFlags(_arg1:uint):void{
m_drawFlags = _arg1;
}
public function GetFlags():uint{
return (m_drawFlags);
}
public function AppendFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags | _arg1);
}
public function ClearFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags & ~(_arg1));
}
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 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 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 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 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 SayGoodbyeJoint(_arg1:b2Joint):void{
}
public function SayGoodbyeShape(_arg1:b2Shape):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_allocator;
public var m_listener:b2ContactListener;
public var m_bodies:Array;
public var m_contacts:Array;
public var m_joints:Array;
public var m_bodyCount:int;
public var m_jointCount:int;
public var m_contactCount:int;
public var m_bodyCapacity:int;
public var m_contactCapacity:int;
public var m_jointCapacity:int;
public var m_positionIterationCount: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 Clear():void{
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
}
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 {
if (_local6.m_applyGravity){
_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))));
} else {
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + ((_arg1.dt * _local6.m_invMass) * _local6.m_force.x));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + ((_arg1.dt * _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) {
_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 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);
}
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 AddBody(_arg1:b2Body):void{
var _local2 = m_bodyCount++;
m_bodies[_local2] = _arg1;
}
public function AddContact(_arg1:b2Contact):void{
var _local2 = m_contactCount++;
m_contacts[_local2] = _arg1;
}
public function AddJoint(_arg1:b2Joint):void{
var _local2 = m_jointCount++;
m_joints[_local2] = _arg1;
}
}
}//package Box2D.Dynamics
Section 73
//b2TimeStep (Box2D.Dynamics.b2TimeStep)
package Box2D.Dynamics {
public class b2TimeStep {
public var dt:Number;
public var inv_dt:Number;
public var dtRatio:Number;
public var maxIterations:int;
public var warmStarting:Boolean;
public var positionCorrection:Boolean;
}
}//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_raycastUserData;
public var m_raycastSegment:b2Segment;
public var m_raycastNormal:b2Vec2;
public var m_blockAllocator;
public var m_stackAllocator;
public var m_lock:Boolean;
public var m_broadPhase:b2BroadPhase;
public var m_contactManager:b2ContactManager;
public var m_bodyList:b2Body;
public var m_jointList:b2Joint;
public var m_contactList:b2Contact;
public var m_bodyCount:int;
public var m_contactCount:int;
public var m_jointCount:int;
public var m_gravity:b2Vec2;
public var m_allowSleep:Boolean;
public var m_groundBody:b2Body;
public var m_destructionListener:b2DestructionListener;
public var m_boundaryListener:b2BoundaryListener;
public var m_contactFilter:b2ContactFilter;
public var m_contactListener:b2ContactListener;
public var m_debugDraw:b2DebugDraw;
public var m_inv_dt0:Number;
public var m_positionIterationCount:int;
private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8);
private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6);
private static var s_xf:b2XForm = new b2XForm();
public static var m_positionCorrection:Boolean;
public static var m_warmStarting:Boolean;
public static var m_continuousPhysics:Boolean;
public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){
m_raycastNormal = new b2Vec2();
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 SetDestructionListener(_arg1:b2DestructionListener):void{
m_destructionListener = _arg1;
}
public function SetBoundaryListener(_arg1:b2BoundaryListener):void{
m_boundaryListener = _arg1;
}
public function SetContactFilter(_arg1:b2ContactFilter):void{
m_contactFilter = _arg1;
}
public function SetContactListener(_arg1:b2ContactListener):void{
m_contactListener = _arg1;
}
public function SetDebugDraw(_arg1:b2DebugDraw):void{
m_debugDraw = _arg1;
}
public function Validate():void{
m_broadPhase.Validate();
}
public function GetProxyCount():int{
return (m_broadPhase.m_proxyCount);
}
public function GetPairCount():int{
return (m_broadPhase.m_pairManager.m_pairCount);
}
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 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 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:b2Body = _arg1.m_body1;
var _local3:b2Body = _arg1.m_body2;
if (!_arg1.m_body1){
throw (new Error("You cannot delete a joint twice."));
};
_arg1.m_body1 = null;
_arg1.m_body2 = null;
var _local4: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;
};
_local2.WakeUp();
_local3.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 == _local2.m_jointList){
_local2.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 == _local3.m_jointList){
_local3.m_jointList = _arg1.m_node2.next;
};
_arg1.m_node2.prev = null;
_arg1.m_node2.next = null;
b2Joint.Destroy(_arg1, m_blockAllocator);
m_jointCount--;
if (_local4 == false){
_local5 = ((_local2.m_shapeCount < _local3.m_shapeCount)) ? _local2 : _local3;
_local6 = _local5.m_shapeList;
while (_local6) {
_local6.RefilterProxy(m_broadPhase, _local5.m_xf);
_local6 = _local6.m_next;
};
};
}
public function Refilter(_arg1:b2Shape):void{
_arg1.RefilterProxy(m_broadPhase, _arg1.m_body.m_xf);
}
public function SetWarmStarting(_arg1:Boolean):void{
m_warmStarting = _arg1;
}
public function SetPositionCorrection(_arg1:Boolean):void{
m_positionCorrection = _arg1;
}
public function SetContinuousPhysics(_arg1:Boolean):void{
m_continuousPhysics = _arg1;
}
public function GetBodyCount():int{
return (m_bodyCount);
}
public function GetJointCount():int{
return (m_jointCount);
}
public function GetContactCount():int{
return (m_contactCount);
}
public function SetGravity(_arg1:b2Vec2):void{
m_gravity = _arg1;
}
public function GetGroundBody():b2Body{
return (m_groundBody);
}
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 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 GetBodyList():b2Body{
return (m_bodyList);
}
public function GetJointList():b2Joint{
return (m_jointList);
}
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 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 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 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 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 Raycast(_arg1:b2Segment, _arg2:Array, _arg3:int, _arg4:Boolean, _arg5):int{
var _local7:int;
var _local6:Array = new Array(_arg3);
m_raycastSegment = _arg1;
m_raycastUserData = _arg5;
if (_arg4){
_local7 = m_broadPhase.QuerySegment(_arg1, _local6, _arg3, RaycastSortKey);
} else {
_local7 = m_broadPhase.QuerySegment(_arg1, _local6, _arg3, RaycastSortKey2);
};
var _local8:int;
while (_local8 < _local7) {
_arg2[_local8] = _local6[_local8];
_local8++;
};
return (_local7);
}
public function RaycastOne(_arg1:b2Segment, _arg2:Array, _arg3:b2Vec2, _arg4:Boolean, _arg5):b2Shape{
var _local6:Array = new Array(1);
var _local7:Number = Raycast(_arg1, _local6, 1, _arg4, _arg5);
if (_local7 == 0){
return (null);
};
if (_local7 > 1){
trace(_local7);
};
var _local8:b2Shape = _local6[0];
var _local9:b2XForm = _local8.GetBody().GetXForm();
_local8.TestSegment(_local9, _arg2, _arg3, _arg1, 1);
return (_local8);
}
public function RaycastSortKey(_arg1:b2Shape):Number{
if (((m_contactFilter) && (!(m_contactFilter.RayCollide(m_raycastUserData, _arg1))))){
return (-1);
};
var _local2:b2Body = _arg1.GetBody();
var _local3:b2XForm = _local2.GetXForm();
var _local4:Array = [0];
if (_arg1.TestSegment(_local3, _local4, m_raycastNormal, m_raycastSegment, 1) == b2Shape.e_missCollide){
return (-1);
};
return (_local4[0]);
}
public function RaycastSortKey2(_arg1:b2Shape):Number{
if (((m_contactFilter) && (!(m_contactFilter.RayCollide(m_raycastUserData, _arg1))))){
return (-1);
};
var _local2:b2Body = _arg1.GetBody();
var _local3:b2XForm = _local2.GetXForm();
var _local4:Array = [0];
if (_arg1.TestSegment(_local3, _local4, m_raycastNormal, m_raycastSegment, 1) != b2Shape.e_hitCollide){
return (-1);
};
return (_local4[0]);
}
}
}//package Box2D.Dynamics
Section 75
//Base64 (com.dynamicflash.util.Base64)
package com.dynamicflash.util {
import flash.utils.*;
public class Base64 {
public static const BASE64_CHARS:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
public static const version:String = "1.1.0";
public function Base64(){
throw (new Error("Base64 class is static container only"));
}
public static function encode(_arg1:String):String{
var _local2:ByteArray = new ByteArray();
_local2.writeUTFBytes(_arg1);
return (encodeByteArray(_local2));
}
public static function encodeByteArray(_arg1:ByteArray):String{
var _local3:Array;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local2 = "";
var _local4:Array = new Array(4);
_arg1.position = 0;
while (_arg1.bytesAvailable > 0) {
_local3 = new Array();
_local5 = 0;
while ((((_local5 < 3)) && ((_arg1.bytesAvailable > 0)))) {
_local3[_local5] = _arg1.readUnsignedByte();
_local5++;
};
_local4[0] = ((_local3[0] & 252) >> 2);
_local4[1] = (((_local3[0] & 3) << 4) | (_local3[1] >> 4));
_local4[2] = (((_local3[1] & 15) << 2) | (_local3[2] >> 6));
_local4[3] = (_local3[2] & 63);
_local6 = _local3.length;
while (_local6 < 3) {
_local4[(_local6 + 1)] = 64;
_local6++;
};
_local7 = 0;
while (_local7 < _local4.length) {
_local2 = (_local2 + BASE64_CHARS.charAt(_local4[_local7]));
_local7++;
};
};
return (_local2);
}
public static function decode(_arg1:String):String{
var _local2:ByteArray = decodeToByteArray(_arg1);
return (_local2.readUTFBytes(_local2.length));
}
public static function decodeToByteArray(_arg1:String):ByteArray{
var _local6:uint;
var _local7:uint;
var _local2:ByteArray = new ByteArray();
var _local3:Array = new Array(4);
var _local4:Array = new Array(3);
var _local5:uint;
while (_local5 < _arg1.length) {
_local6 = 0;
while ((((_local6 < 4)) && (((_local5 + _local6) < _arg1.length)))) {
_local3[_local6] = BASE64_CHARS.indexOf(_arg1.charAt((_local5 + _local6)));
_local6++;
};
_local4[0] = ((_local3[0] << 2) + ((_local3[1] & 48) >> 4));
_local4[1] = (((_local3[1] & 15) << 4) + ((_local3[2] & 60) >> 2));
_local4[2] = (((_local3[2] & 3) << 6) + _local3[3]);
_local7 = 0;
while (_local7 < _local4.length) {
if (_local3[(_local7 + 1)] == 64){
break;
};
_local2.writeByte(_local4[_local7]);
_local7++;
};
_local5 = (_local5 + 4);
};
_local2.position = 0;
return (_local2);
}
}
}//package com.dynamicflash.util
Section 76
//PropTween (com.greensock.core.PropTween)
package com.greensock.core {
public final class PropTween {
public var priority:int;
public var start:Number;
public var prevNode:PropTween;
public var change:Number;
public var target:Object;
public var name:String;
public var property:String;
public var nextNode:PropTween;
public var isPlugin:Boolean;
public function PropTween(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Boolean, _arg7:PropTween=null, _arg8:int=0){
this.target = _arg1;
this.property = _arg2;
this.start = _arg3;
this.change = _arg4;
this.name = _arg5;
this.isPlugin = _arg6;
if (_arg7){
_arg7.prevNode = this;
this.nextNode = _arg7;
};
this.priority = _arg8;
}
}
}//package com.greensock.core
Section 77
//SimpleTimeline (com.greensock.core.SimpleTimeline)
package com.greensock.core {
public class SimpleTimeline extends TweenCore {
public var autoRemoveChildren:Boolean;
protected var _lastChild:TweenCore;
protected var _firstChild:TweenCore;
public function SimpleTimeline(_arg1:Object=null){
super(0, _arg1);
}
public function get rawTime():Number{
return (this.cachedTotalTime);
}
public function insert(_arg1:TweenCore, _arg2=0):TweenCore{
var _local3:SimpleTimeline = _arg1.timeline;
if (((!(_arg1.cachedOrphan)) && (_local3))){
_local3.remove(_arg1, true);
};
_arg1.timeline = this;
_arg1.cachedStartTime = (Number(_arg2) + _arg1.delay);
if (_arg1.gc){
_arg1.setEnabled(true, true);
};
if (((_arg1.cachedPaused) && (!((_local3 == this))))){
_arg1.cachedPauseTime = (_arg1.cachedStartTime + ((this.rawTime - _arg1.cachedStartTime) / _arg1.cachedTimeScale));
};
if (_lastChild){
_lastChild.nextNode = _arg1;
} else {
_firstChild = _arg1;
};
_arg1.prevNode = _lastChild;
_lastChild = _arg1;
_arg1.nextNode = null;
_arg1.cachedOrphan = false;
return (_arg1);
}
override public function renderTime(_arg1:Number, _arg2:Boolean=false, _arg3:Boolean=false):void{
var _local5:Number;
var _local6:TweenCore;
var _local4:TweenCore = _firstChild;
this.cachedTotalTime = _arg1;
this.cachedTime = _arg1;
while (_local4) {
_local6 = _local4.nextNode;
if (((_local4.active) || ((((((_arg1 >= _local4.cachedStartTime)) && (!(_local4.cachedPaused)))) && (!(_local4.gc)))))){
if (!_local4.cachedReversed){
_local4.renderTime(((_arg1 - _local4.cachedStartTime) * _local4.cachedTimeScale), _arg2, false);
} else {
_local5 = (_local4.cacheIsDirty) ? _local4.totalDuration : _local4.cachedTotalDuration;
_local4.renderTime((_local5 - ((_arg1 - _local4.cachedStartTime) * _local4.cachedTimeScale)), _arg2, false);
};
};
_local4 = _local6;
};
}
public function remove(_arg1:TweenCore, _arg2:Boolean=false):void{
if (_arg1.cachedOrphan){
return;
};
if (!_arg2){
_arg1.setEnabled(false, true);
};
if (_arg1.nextNode){
_arg1.nextNode.prevNode = _arg1.prevNode;
} else {
if (_lastChild == _arg1){
_lastChild = _arg1.prevNode;
};
};
if (_arg1.prevNode){
_arg1.prevNode.nextNode = _arg1.nextNode;
} else {
if (_firstChild == _arg1){
_firstChild = _arg1.nextNode;
};
};
_arg1.cachedOrphan = true;
}
}
}//package com.greensock.core
Section 78
//TweenCore (com.greensock.core.TweenCore)
package com.greensock.core {
import com.greensock.*;
public class TweenCore {
public var initted:Boolean;
protected var _hasUpdate:Boolean;
public var active:Boolean;
protected var _delay:Number;
public var cachedReversed:Boolean;
public var nextNode:TweenCore;
public var cachedTime:Number;
protected var _rawPrevTime:Number;// = -1
public var vars:Object;
public var cachedTotalTime:Number;
public var data;
public var timeline:SimpleTimeline;
public var cachedOrphan:Boolean;
public var cachedStartTime:Number;
public var prevNode:TweenCore;
public var cachedDuration:Number;
public var gc:Boolean;
public var cachedPauseTime:Number;
public var cacheIsDirty:Boolean;
public var cachedPaused:Boolean;
public var cachedTimeScale:Number;
public var cachedTotalDuration:Number;
public static const version:Number = 1.693;
protected static var _classInitted:Boolean;
public function TweenCore(_arg1:Number=0, _arg2:Object=null){
this.vars = ((_arg2)!=null) ? _arg2 : {};
if (this.vars.isGSVars){
this.vars = this.vars.vars;
};
this.cachedDuration = (this.cachedTotalDuration = _arg1);
_delay = (this.vars.delay) ? Number(this.vars.delay) : 0;
this.cachedTimeScale = (this.vars.timeScale) ? Number(this.vars.timeScale) : 1;
this.active = Boolean((((((_arg1 == 0)) && ((_delay == 0)))) && (!((this.vars.immediateRender == false)))));
this.cachedTotalTime = (this.cachedTime = 0);
this.data = this.vars.data;
if (!_classInitted){
if (isNaN(TweenLite.rootFrame)){
TweenLite.initClass();
_classInitted = true;
} else {
return;
};
};
var _local3:SimpleTimeline = ((this.vars.timeline is SimpleTimeline)) ? this.vars.timeline : (this.vars.useFrames) ? TweenLite.rootFramesTimeline : TweenLite.rootTimeline;
_local3.insert(this, _local3.cachedTotalTime);
if (this.vars.reversed){
this.cachedReversed = true;
};
if (this.vars.paused){
this.paused = true;
};
}
public function renderTime(_arg1:Number, _arg2:Boolean=false, _arg3:Boolean=false):void{
}
public function get delay():Number{
return (_delay);
}
public function get duration():Number{
return (this.cachedDuration);
}
public function set reversed(_arg1:Boolean):void{
if (_arg1 != this.cachedReversed){
this.cachedReversed = _arg1;
setTotalTime(this.cachedTotalTime, true);
};
}
public function set startTime(_arg1:Number):void{
if (((!((this.timeline == null))) && (((!((_arg1 == this.cachedStartTime))) || (this.gc))))){
this.timeline.insert(this, (_arg1 - _delay));
} else {
this.cachedStartTime = _arg1;
};
}
public function restart(_arg1:Boolean=false, _arg2:Boolean=true):void{
this.reversed = false;
this.paused = false;
this.setTotalTime((_arg1) ? -(_delay) : 0, _arg2);
}
public function set delay(_arg1:Number):void{
this.startTime = (this.startTime + (_arg1 - _delay));
_delay = _arg1;
}
public function resume():void{
this.paused = false;
}
public function get paused():Boolean{
return (this.cachedPaused);
}
public function play():void{
this.reversed = false;
this.paused = false;
}
public function set duration(_arg1:Number):void{
var _local2:Number = (_arg1 / this.cachedDuration);
this.cachedDuration = (this.cachedTotalDuration = _arg1);
setDirtyCache(true);
if (((((this.active) && (!(this.cachedPaused)))) && (!((_arg1 == 0))))){
this.setTotalTime((this.cachedTotalTime * _local2), true);
};
}
public function invalidate():void{
}
public function complete(_arg1:Boolean=false, _arg2:Boolean=false):void{
if (!_arg1){
renderTime(this.totalDuration, _arg2, false);
return;
};
if (this.timeline.autoRemoveChildren){
this.setEnabled(false, false);
} else {
this.active = false;
};
if (!_arg2){
if (((((this.vars.onComplete) && ((this.cachedTotalTime >= this.cachedTotalDuration)))) && (!(this.cachedReversed)))){
this.vars.onComplete.apply(null, this.vars.onCompleteParams);
} else {
if (((((this.cachedReversed) && ((this.cachedTotalTime == 0)))) && (this.vars.onReverseComplete))){
this.vars.onReverseComplete.apply(null, this.vars.onReverseCompleteParams);
};
};
};
}
public function get totalTime():Number{
return (this.cachedTotalTime);
}
public function get startTime():Number{
return (this.cachedStartTime);
}
public function get reversed():Boolean{
return (this.cachedReversed);
}
public function set currentTime(_arg1:Number):void{
setTotalTime(_arg1, false);
}
protected function setDirtyCache(_arg1:Boolean=true):void{
var _local2:TweenCore = (_arg1) ? this : this.timeline;
while (_local2) {
_local2.cacheIsDirty = true;
_local2 = _local2.timeline;
};
}
public function reverse(_arg1:Boolean=true):void{
this.reversed = true;
if (_arg1){
this.paused = false;
} else {
if (this.gc){
this.setEnabled(true, false);
};
};
}
public function set paused(_arg1:Boolean):void{
if (((!((_arg1 == this.cachedPaused))) && (this.timeline))){
if (_arg1){
this.cachedPauseTime = this.timeline.rawTime;
} else {
this.cachedStartTime = (this.cachedStartTime + (this.timeline.rawTime - this.cachedPauseTime));
this.cachedPauseTime = NaN;
setDirtyCache(false);
};
this.cachedPaused = _arg1;
this.active = Boolean(((((!(this.cachedPaused)) && ((this.cachedTotalTime > 0)))) && ((this.cachedTotalTime < this.cachedTotalDuration))));
};
if (((!(_arg1)) && (this.gc))){
this.setEnabled(true, false);
};
}
public function kill():void{
setEnabled(false, false);
}
public function set totalTime(_arg1:Number):void{
setTotalTime(_arg1, false);
}
public function get currentTime():Number{
return (this.cachedTime);
}
protected function setTotalTime(_arg1:Number, _arg2:Boolean=false):void{
var _local3:Number;
var _local4:Number;
if (this.timeline){
_local3 = (this.cachedPaused) ? this.cachedPauseTime : this.timeline.cachedTotalTime;
if (this.cachedReversed){
_local4 = (this.cacheIsDirty) ? this.totalDuration : this.cachedTotalDuration;
this.cachedStartTime = (_local3 - ((_local4 - _arg1) / this.cachedTimeScale));
} else {
this.cachedStartTime = (_local3 - (_arg1 / this.cachedTimeScale));
};
if (!this.timeline.cacheIsDirty){
setDirtyCache(false);
};
if (this.cachedTotalTime != _arg1){
renderTime(_arg1, _arg2, false);
};
};
}
public function pause():void{
this.paused = true;
}
public function set totalDuration(_arg1:Number):void{
this.duration = _arg1;
}
public function get totalDuration():Number{
return (this.cachedTotalDuration);
}
public function setEnabled(_arg1:Boolean, _arg2:Boolean=false):Boolean{
this.gc = !(_arg1);
if (_arg1){
this.active = Boolean(((((!(this.cachedPaused)) && ((this.cachedTotalTime > 0)))) && ((this.cachedTotalTime < this.cachedTotalDuration))));
if (((!(_arg2)) && (this.cachedOrphan))){
this.timeline.insert(this, (this.cachedStartTime - _delay));
};
} else {
this.active = false;
if (((!(_arg2)) && (!(this.cachedOrphan)))){
this.timeline.remove(this, true);
};
};
return (false);
}
}
}//package com.greensock.core
Section 79
//OverwriteManager (com.greensock.OverwriteManager)
package com.greensock {
import com.greensock.core.*;
public final class OverwriteManager {
public static const ALL_ONSTART:int = 4;
public static const CONCURRENT:int = 3;
public static const ALL_IMMEDIATE:int = 1;
public static const PREEXISTING:int = 5;
public static const AUTO:int = 2;
public static const version:Number = 6.1;
public static const NONE:int = 0;
public static var enabled:Boolean;
public static var mode:int;
public static function getGlobalPaused(_arg1:TweenCore):Boolean{
var _local2:Boolean;
while (_arg1) {
if (_arg1.cachedPaused){
_local2 = true;
break;
};
_arg1 = _arg1.timeline;
};
return (_local2);
}
public static function init(_arg1:int=2):int{
if (TweenLite.version < 11.6){
throw (new Error("Warning: Your TweenLite class needs to be updated to work with OverwriteManager (or you may need to clear your ASO files). Please download and install the latest version from http://www.tweenlite.com."));
};
TweenLite.overwriteManager = OverwriteManager;
mode = _arg1;
enabled = true;
return (mode);
}
public static function manageOverwrites(_arg1:TweenLite, _arg2:Object, _arg3:Array, _arg4:int):Boolean{
var _local5:int;
var _local6:Boolean;
var _local7:TweenLite;
var _local13:int;
var _local14:Number;
var _local15:Number;
var _local16:TweenCore;
var _local17:Number;
var _local18:SimpleTimeline;
if (_arg4 >= 4){
_local13 = _arg3.length;
_local5 = 0;
while (_local5 < _local13) {
_local7 = _arg3[_local5];
if (_local7 != _arg1){
if (_local7.setEnabled(false, false)){
_local6 = true;
};
} else {
if (_arg4 == 5){
break;
};
};
_local5++;
};
return (_local6);
};
var _local8:Number = (_arg1.cachedStartTime + 1E-10);
var _local9:Array = [];
var _local10:Array = [];
var _local11:int;
var _local12:int;
_local5 = _arg3.length;
while (--_local5 > -1) {
_local7 = _arg3[_local5];
if ((((((_local7 == _arg1)) || (_local7.gc))) || (((!(_local7.initted)) && (((_local8 - _local7.cachedStartTime) <= 2E-10)))))){
} else {
if (_local7.timeline != _arg1.timeline){
if (!getGlobalPaused(_local7)){
var _temp1 = _local11;
_local11 = (_local11 + 1);
var _local19 = _temp1;
_local10[_local19] = _local7;
};
} else {
if ((((((((_local7.cachedStartTime <= _local8)) && ((((_local7.cachedStartTime + _local7.totalDuration) + 1E-10) > _local8)))) && (!(_local7.cachedPaused)))) && (!((((_arg1.cachedDuration == 0)) && (((_local8 - _local7.cachedStartTime) <= 2E-10))))))){
var _temp2 = _local12;
_local12 = (_local12 + 1);
_local19 = _temp2;
_local9[_local19] = _local7;
};
};
};
};
if (_local11 != 0){
_local14 = _arg1.cachedTimeScale;
_local15 = _local8;
_local18 = _arg1.timeline;
while (_local18) {
_local14 = (_local14 * _local18.cachedTimeScale);
_local15 = (_local15 + _local18.cachedStartTime);
_local18 = _local18.timeline;
};
_local8 = (_local14 * _local15);
_local5 = _local11;
while (--_local5 > -1) {
_local16 = _local10[_local5];
_local14 = _local16.cachedTimeScale;
_local15 = _local16.cachedStartTime;
_local18 = _local16.timeline;
while (_local18) {
_local14 = (_local14 * _local18.cachedTimeScale);
_local15 = (_local15 + _local18.cachedStartTime);
_local18 = _local18.timeline;
};
_local17 = (_local14 * _local15);
if ((((_local17 <= _local8)) && ((((((_local17 + (_local16.totalDuration * _local14)) + 1E-10) > _local8)) || ((_local16.cachedDuration == 0)))))){
var _temp3 = _local12;
_local12 = (_local12 + 1);
_local19 = _temp3;
_local9[_local19] = _local16;
};
};
};
if (_local12 == 0){
return (_local6);
};
_local5 = _local12;
if (_arg4 == 2){
while (--_local5 > -1) {
_local7 = _local9[_local5];
if (_local7.killVars(_arg2)){
_local6 = true;
};
if ((((_local7.cachedPT1 == null)) && (_local7.initted))){
_local7.setEnabled(false, false);
};
};
} else {
while (--_local5 > -1) {
if (TweenLite(_local9[_local5]).setEnabled(false, false)){
_local6 = true;
};
};
};
return (_local6);
}
}
}//package com.greensock
Section 80
//TimelineLite (com.greensock.TimelineLite)
package com.greensock {
import com.greensock.core.*;
public class TimelineLite extends SimpleTimeline {
protected var _endCaps:Array;
protected var _labels:Object;
public static const version:Number = 1.695;
private static var _overwriteMode:int = (OverwriteManager.enabled) ? OverwriteManager.mode : OverwriteManager.init(2);
;
public function TimelineLite(_arg1:Object=null){
super(_arg1);
_endCaps = [null, null];
_labels = {};
this.autoRemoveChildren = Boolean((this.vars.autoRemoveChildren == true));
_hasUpdate = Boolean((typeof(this.vars.onUpdate) == "function"));
if ((this.vars.tweens is Array)){
this.insertMultiple(this.vars.tweens, 0, ((this.vars.align)!=null) ? this.vars.align : "normal", (this.vars.stagger) ? Number(this.vars.stagger) : 0);
};
}
public function set timeScale(_arg1:Number):void{
if (_arg1 == 0){
_arg1 = 0.0001;
};
var _local2:Number = (((this.cachedPauseTime) || ((this.cachedPauseTime == 0)))) ? this.cachedPauseTime : this.timeline.cachedTotalTime;
this.cachedStartTime = (_local2 - (((_local2 - this.cachedStartTime) * this.cachedTimeScale) / _arg1));
this.cachedTimeScale = _arg1;
setDirtyCache(false);
}
public function stop():void{
this.paused = true;
}
override public function renderTime(_arg1:Number, _arg2:Boolean=false, _arg3:Boolean=false):void{
var _local8:TweenCore;
var _local9:Boolean;
var _local10:Boolean;
var _local11:TweenCore;
var _local12:Number;
if (this.gc){
this.setEnabled(true, false);
} else {
if (((!(this.active)) && (!(this.cachedPaused)))){
this.active = true;
};
};
var _local4:Number = (this.cacheIsDirty) ? this.totalDuration : this.cachedTotalDuration;
var _local5:Number = this.cachedTime;
var _local6:Number = this.cachedStartTime;
var _local7:Number = this.cachedTimeScale;
var _local13:Boolean = this.cachedPaused;
if (_arg1 >= _local4){
if (((!((_local5 == _local4))) && (!((_rawPrevTime == _arg1))))){
this.cachedTotalTime = (this.cachedTime = _local4);
forceChildrenToEnd(_local4, _arg2);
_local9 = ((!(this.hasPausedChild())) && (!(this.cachedReversed)));
_local10 = true;
if ((((((this.cachedDuration == 0)) && (_local9))) && ((((_arg1 == 0)) || ((_rawPrevTime < 0)))))){
_arg3 = true;
};
};
} else {
if (_arg1 <= 0){
if (_arg1 < 0){
this.active = false;
if ((((this.cachedDuration == 0)) && ((_rawPrevTime > 0)))){
_arg3 = true;
_local9 = true;
};
} else {
if ((((_arg1 == 0)) && (!(this.initted)))){
_arg3 = true;
};
};
if (((!((_local5 == 0))) && (!((_rawPrevTime == _arg1))))){
this.cachedTotalTime = 0;
this.cachedTime = 0;
forceChildrenToBeginning(0, _arg2);
_local10 = true;
if (this.cachedReversed){
_local9 = true;
};
};
} else {
this.cachedTotalTime = (this.cachedTime = _arg1);
};
};
_rawPrevTime = _arg1;
if ((((this.cachedTime == _local5)) && (!(_arg3)))){
return;
};
if (!this.initted){
this.initted = true;
};
if ((((((((_local5 == 0)) && (this.vars.onStart))) && (!((this.cachedTime == 0))))) && (!(_arg2)))){
this.vars.onStart.apply(null, this.vars.onStartParams);
};
if (_local10){
} else {
if ((this.cachedTime - _local5) > 0){
_local8 = _firstChild;
while (_local8) {
_local11 = _local8.nextNode;
if (((this.cachedPaused) && (!(_local13)))){
break;
} else {
if (((_local8.active) || (((((!(_local8.cachedPaused)) && ((_local8.cachedStartTime <= this.cachedTime)))) && (!(_local8.gc)))))){
if (!_local8.cachedReversed){
_local8.renderTime(((this.cachedTime - _local8.cachedStartTime) * _local8.cachedTimeScale), _arg2, false);
} else {
_local12 = (_local8.cacheIsDirty) ? _local8.totalDuration : _local8.cachedTotalDuration;
_local8.renderTime((_local12 - ((this.cachedTime - _local8.cachedStartTime) * _local8.cachedTimeScale)), _arg2, false);
};
};
};
_local8 = _local11;
};
} else {
_local8 = _lastChild;
while (_local8) {
_local11 = _local8.prevNode;
if (((this.cachedPaused) && (!(_local13)))){
break;
} else {
if (((_local8.active) || (((((!(_local8.cachedPaused)) && ((_local8.cachedStartTime <= _local5)))) && (!(_local8.gc)))))){
if (!_local8.cachedReversed){
_local8.renderTime(((this.cachedTime - _local8.cachedStartTime) * _local8.cachedTimeScale), _arg2, false);
} else {
_local12 = (_local8.cacheIsDirty) ? _local8.totalDuration : _local8.cachedTotalDuration;
_local8.renderTime((_local12 - ((this.cachedTime - _local8.cachedStartTime) * _local8.cachedTimeScale)), _arg2, false);
};
};
};
_local8 = _local11;
};
};
};
if (((_hasUpdate) && (!(_arg2)))){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (((((_local9) && ((((_local6 == this.cachedStartTime)) || (!((_local7 == this.cachedTimeScale))))))) && ((((_local4 >= this.totalDuration)) || ((this.cachedTime == 0)))))){
complete(true, _arg2);
};
}
override public function remove(_arg1:TweenCore, _arg2:Boolean=false):void{
if (_arg1.cachedOrphan){
return;
};
if (!_arg2){
_arg1.setEnabled(false, true);
};
var _local3:TweenCore = (this.gc) ? _endCaps[0] : _firstChild;
var _local4:TweenCore = (this.gc) ? _endCaps[1] : _lastChild;
if (_arg1.nextNode){
_arg1.nextNode.prevNode = _arg1.prevNode;
} else {
if (_local4 == _arg1){
_local4 = _arg1.prevNode;
};
};
if (_arg1.prevNode){
_arg1.prevNode.nextNode = _arg1.nextNode;
} else {
if (_local3 == _arg1){
_local3 = _arg1.nextNode;
};
};
if (this.gc){
_endCaps[0] = _local3;
_endCaps[1] = _local4;
} else {
_firstChild = _local3;
_lastChild = _local4;
};
_arg1.cachedOrphan = true;
setDirtyCache(true);
}
public function get currentProgress():Number{
return ((this.cachedTime / this.duration));
}
override public function get totalDuration():Number{
var _local1:Number;
var _local2:Number;
var _local3:TweenCore;
var _local4:Number;
var _local5:TweenCore;
if (this.cacheIsDirty){
_local1 = 0;
_local3 = (this.gc) ? _endCaps[0] : _firstChild;
_local4 = -(Infinity);
while (_local3) {
_local5 = _local3.nextNode;
if (_local3.cachedStartTime < _local4){
this.insert(_local3, (_local3.cachedStartTime - _local3.delay));
} else {
_local4 = _local3.cachedStartTime;
};
if (_local3.cachedStartTime < 0){
_local1 = (_local1 - _local3.cachedStartTime);
this.shiftChildren(-(_local3.cachedStartTime), false, -9999999999);
};
_local2 = (_local3.cachedStartTime + (_local3.totalDuration / _local3.cachedTimeScale));
if (_local2 > _local1){
_local1 = _local2;
};
_local3 = _local5;
};
this.cachedDuration = (this.cachedTotalDuration = _local1);
this.cacheIsDirty = false;
};
return (this.cachedTotalDuration);
}
public function gotoAndPlay(_arg1, _arg2:Boolean=true):void{
setTotalTime(parseTimeOrLabel(_arg1), _arg2);
play();
}
public function appendMultiple(_arg1:Array, _arg2:Number=0, _arg3:String="normal", _arg4:Number=0):Array{
return (insertMultiple(_arg1, (this.duration + _arg2), _arg3, _arg4));
}
public function set currentProgress(_arg1:Number):void{
setTotalTime((this.duration * _arg1), false);
}
public function clear(_arg1:Array=null):void{
if (_arg1 == null){
_arg1 = getChildren(false, true, true);
};
var _local2:int = _arg1.length;
while (--_local2 > -1) {
TweenCore(_arg1[_local2]).setEnabled(false, false);
};
}
public function prepend(_arg1:TweenCore, _arg2:Boolean=false):TweenCore{
shiftChildren(((_arg1.totalDuration / _arg1.cachedTimeScale) + _arg1.delay), _arg2, 0);
return (insert(_arg1, 0));
}
public function removeLabel(_arg1:String):Number{
var _local2:Number = _labels[_arg1];
delete _labels[_arg1];
return (_local2);
}
protected function parseTimeOrLabel(_arg1):Number{
if (typeof(_arg1) == "string"){
if (!(_arg1 in _labels)){
throw (new Error((("TimelineLite error: the " + _arg1) + " label was not found.")));
};
return (getLabelTime(String(_arg1)));
};
return (Number(_arg1));
}
public function addLabel(_arg1:String, _arg2:Number):void{
_labels[_arg1] = _arg2;
}
public function hasPausedChild():Boolean{
var _local1:TweenCore = (this.gc) ? _endCaps[0] : _firstChild;
while (_local1) {
if (((_local1.cachedPaused) || ((((_local1 is TimelineLite)) && ((_local1 as TimelineLite).hasPausedChild()))))){
return (true);
};
_local1 = _local1.nextNode;
};
return (false);
}
public function getTweensOf(_arg1:Object, _arg2:Boolean=true):Array{
var _local5:int;
var _local3:Array = getChildren(_arg2, true, false);
var _local4:Array = [];
var _local6:int = _local3.length;
var _local7:int;
_local5 = 0;
while (_local5 < _local6) {
if (TweenLite(_local3[_local5]).target == _arg1){
var _temp1 = _local7;
_local7 = (_local7 + 1);
var _local8 = _temp1;
_local4[_local8] = _local3[_local5];
};
_local5 = (_local5 + 1);
};
return (_local4);
}
public function gotoAndStop(_arg1, _arg2:Boolean=true):void{
setTotalTime(parseTimeOrLabel(_arg1), _arg2);
this.paused = true;
}
public function append(_arg1:TweenCore, _arg2:Number=0):TweenCore{
return (insert(_arg1, (this.duration + _arg2)));
}
override public function get duration():Number{
var _local1:Number;
if (this.cacheIsDirty){
_local1 = this.totalDuration;
};
return (this.cachedDuration);
}
public function get useFrames():Boolean{
var _local1:SimpleTimeline = this.timeline;
while (_local1.timeline) {
_local1 = _local1.timeline;
};
return (Boolean((_local1 == TweenLite.rootFramesTimeline)));
}
public function shiftChildren(_arg1:Number, _arg2:Boolean=false, _arg3:Number=0):void{
var _local5:String;
var _local4:TweenCore = (this.gc) ? _endCaps[0] : _firstChild;
while (_local4) {
if (_local4.cachedStartTime >= _arg3){
_local4.cachedStartTime = (_local4.cachedStartTime + _arg1);
};
_local4 = _local4.nextNode;
};
if (_arg2){
for (_local5 in _labels) {
if (_labels[_local5] >= _arg3){
_labels[_local5] = (_labels[_local5] + _arg1);
};
};
};
this.setDirtyCache(true);
}
public function goto(_arg1, _arg2:Boolean=true):void{
setTotalTime(parseTimeOrLabel(_arg1), _arg2);
}
public function killTweensOf(_arg1:Object, _arg2:Boolean=true, _arg3:Object=null):Boolean{
var _local6:TweenLite;
var _local4:Array = getTweensOf(_arg1, _arg2);
var _local5:int = _local4.length;
while (--_local5 > -1) {
_local6 = _local4[_local5];
if (_arg3 != null){
_local6.killVars(_arg3);
};
if ((((_arg3 == null)) || ((((_local6.cachedPT1 == null)) && (_local6.initted))))){
_local6.setEnabled(false, false);
};
};
return (Boolean((_local4.length > 0)));
}
override public function set duration(_arg1:Number):void{
if (((!((this.duration == 0))) && (!((_arg1 == 0))))){
this.timeScale = (this.duration / _arg1);
};
}
public function insertMultiple(_arg1:Array, _arg2=0, _arg3:String="normal", _arg4:Number=0):Array{
var _local5:int;
var _local6:TweenCore;
var _local7:Number = ((Number(_arg2)) || (0));
var _local8:int = _arg1.length;
if (typeof(_arg2) == "string"){
if (!(_arg2 in _labels)){
addLabel(_arg2, this.duration);
};
_local7 = _labels[_arg2];
};
_local5 = 0;
while (_local5 < _local8) {
_local6 = (_arg1[_local5] as TweenCore);
insert(_local6, _local7);
if (_arg3 == "sequence"){
_local7 = (_local6.cachedStartTime + (_local6.totalDuration / _local6.cachedTimeScale));
} else {
if (_arg3 == "start"){
_local6.cachedStartTime = (_local6.cachedStartTime - _local6.delay);
};
};
_local7 = (_local7 + _arg4);
_local5 = (_local5 + 1);
};
return (_arg1);
}
public function getLabelTime(_arg1:String):Number{
return (((_arg1 in _labels)) ? Number(_labels[_arg1]) : -1);
}
override public function get rawTime():Number{
if (((this.cachedPaused) || (((!((this.cachedTotalTime == 0))) && (!((this.cachedTotalTime == this.cachedTotalDuration))))))){
return (this.cachedTotalTime);
};
return (((this.timeline.rawTime - this.cachedStartTime) * this.cachedTimeScale));
}
override public function set totalDuration(_arg1:Number):void{
if (((!((this.totalDuration == 0))) && (!((_arg1 == 0))))){
this.timeScale = (this.totalDuration / _arg1);
};
}
public function getChildren(_arg1:Boolean=true, _arg2:Boolean=true, _arg3:Boolean=true, _arg4:Number=-9999999999):Array{
var _local5:Array = [];
var _local6:int;
var _local7:TweenCore = (this.gc) ? _endCaps[0] : _firstChild;
while (_local7) {
if (_local7.cachedStartTime < _arg4){
} else {
if ((_local7 is TweenLite)){
if (_arg2){
var _temp1 = _local6;
_local6 = (_local6 + 1);
var _local8 = _temp1;
_local5[_local8] = _local7;
};
} else {
if (_arg3){
var _temp2 = _local6;
_local6 = (_local6 + 1);
_local8 = _temp2;
_local5[_local8] = _local7;
};
if (_arg1){
_local5 = _local5.concat(TimelineLite(_local7).getChildren(true, _arg2, _arg3));
_local6 = _local5.length;
};
};
};
_local7 = _local7.nextNode;
};
return (_local5);
}
protected function forceChildrenToEnd(_arg1:Number, _arg2:Boolean=false):Number{
var _local4:TweenCore;
var _local5:Number;
var _local3:TweenCore = _firstChild;
var _local6:Boolean = this.cachedPaused;
while (_local3) {
_local4 = _local3.nextNode;
if (((this.cachedPaused) && (!(_local6)))){
break;
} else {
if (((_local3.active) || (((((!(_local3.cachedPaused)) && (!(_local3.gc)))) && (((!((_local3.cachedTotalTime == _local3.cachedTotalDuration))) || ((_local3.cachedDuration == 0)))))))){
if ((((_arg1 == this.cachedDuration)) && (((!((_local3.cachedDuration == 0))) || ((_local3.cachedStartTime == this.cachedDuration)))))){
_local3.renderTime((_local3.cachedReversed) ? 0 : _local3.cachedTotalDuration, _arg2, false);
} else {
if (!_local3.cachedReversed){
_local3.renderTime(((_arg1 - _local3.cachedStartTime) * _local3.cachedTimeScale), _arg2, false);
} else {
_local5 = (_local3.cacheIsDirty) ? _local3.totalDuration : _local3.cachedTotalDuration;
_local3.renderTime((_local5 - ((_arg1 - _local3.cachedStartTime) * _local3.cachedTimeScale)), _arg2, false);
};
};
};
};
_local3 = _local4;
};
return (_arg1);
}
protected function forceChildrenToBeginning(_arg1:Number, _arg2:Boolean=false):Number{
var _local4:TweenCore;
var _local5:Number;
var _local3:TweenCore = _lastChild;
var _local6:Boolean = this.cachedPaused;
while (_local3) {
_local4 = _local3.prevNode;
if (((this.cachedPaused) && (!(_local6)))){
break;
} else {
if (((_local3.active) || (((((!(_local3.cachedPaused)) && (!(_local3.gc)))) && (((!((_local3.cachedTotalTime == 0))) || ((_local3.cachedDuration == 0)))))))){
if ((((_arg1 == 0)) && (((!((_local3.cachedDuration == 0))) || ((_local3.cachedStartTime == 0)))))){
_local3.renderTime((_local3.cachedReversed) ? _local3.cachedTotalDuration : 0, _arg2, false);
} else {
if (!_local3.cachedReversed){
_local3.renderTime(((_arg1 - _local3.cachedStartTime) * _local3.cachedTimeScale), _arg2, false);
} else {
_local5 = (_local3.cacheIsDirty) ? _local3.totalDuration : _local3.cachedTotalDuration;
_local3.renderTime((_local5 - ((_arg1 - _local3.cachedStartTime) * _local3.cachedTimeScale)), _arg2, false);
};
};
};
};
_local3 = _local4;
};
return (_arg1);
}
override public function insert(_arg1:TweenCore, _arg2=0):TweenCore{
var _local6:TweenCore;
var _local7:Number;
var _local8:SimpleTimeline;
if (typeof(_arg2) == "string"){
if (!(_arg2 in _labels)){
addLabel(_arg2, this.duration);
};
_arg2 = Number(_labels[_arg2]);
};
var _local3:SimpleTimeline = _arg1.timeline;
if (((!(_arg1.cachedOrphan)) && (_local3))){
_local3.remove(_arg1, true);
};
_arg1.timeline = this;
_arg1.cachedStartTime = (Number(_arg2) + _arg1.delay);
if (((_arg1.cachedPaused) && (!((_local3 == this))))){
_arg1.cachedPauseTime = (_arg1.cachedStartTime + ((this.rawTime - _arg1.cachedStartTime) / _arg1.cachedTimeScale));
};
if (_arg1.gc){
_arg1.setEnabled(true, true);
};
setDirtyCache(true);
var _local4:TweenCore = (this.gc) ? _endCaps[0] : _firstChild;
var _local5:TweenCore = (this.gc) ? _endCaps[1] : _lastChild;
if (_local5 == null){
_local5 = _arg1;
_local4 = _local5;
_arg1.nextNode = (_arg1.prevNode = null);
} else {
_local6 = _local5;
_local7 = _arg1.cachedStartTime;
while (((!((_local6 == null))) && ((_local7 < _local6.cachedStartTime)))) {
_local6 = _local6.prevNode;
};
if (_local6 == null){
_local4.prevNode = _arg1;
_arg1.nextNode = _local4;
_arg1.prevNode = null;
_local4 = _arg1;
} else {
if (_local6.nextNode){
_local6.nextNode.prevNode = _arg1;
} else {
if (_local6 == _local5){
_local5 = _arg1;
};
};
_arg1.prevNode = _local6;
_arg1.nextNode = _local6.nextNode;
_local6.nextNode = _arg1;
};
};
_arg1.cachedOrphan = false;
if (this.gc){
_endCaps[0] = _local4;
_endCaps[1] = _local5;
} else {
_firstChild = _local4;
_lastChild = _local5;
};
if (((((this.gc) && (!(this.cachedPaused)))) && (((this.cachedStartTime + ((_arg1.cachedStartTime + (_arg1.cachedTotalDuration / _arg1.cachedTimeScale)) / this.cachedTimeScale)) > this.timeline.cachedTime)))){
if ((((this.timeline == TweenLite.rootTimeline)) || ((this.timeline == TweenLite.rootFramesTimeline)))){
this.setTotalTime(this.cachedTotalTime, true);
};
this.setEnabled(true, false);
_local8 = this.timeline;
while (((_local8.gc) && (_local8.timeline))) {
if ((_local8.cachedStartTime + (_local8.totalDuration / _local8.cachedTimeScale)) > _local8.timeline.cachedTime){
_local8.setEnabled(true, false);
};
_local8 = _local8.timeline;
};
};
return (_arg1);
}
override public function invalidate():void{
var _local1:TweenCore = (this.gc) ? _endCaps[0] : _firstChild;
while (_local1) {
_local1.invalidate();
_local1 = _local1.nextNode;
};
}
public function get timeScale():Number{
return (this.cachedTimeScale);
}
public function prependMultiple(_arg1:Array, _arg2:String="normal", _arg3:Number=0, _arg4:Boolean=false):Array{
var _local5:TimelineLite = new TimelineLite({tweens:_arg1, align:_arg2, stagger:_arg3});
shiftChildren(_local5.duration, _arg4, 0);
insertMultiple(_arg1, 0, _arg2, _arg3);
_local5.kill();
return (_arg1);
}
override public function setEnabled(_arg1:Boolean, _arg2:Boolean=false):Boolean{
var _local3:TweenCore;
if (_arg1 == this.gc){
if (_arg1){
_local3 = _endCaps[0];
_firstChild = _local3;
_lastChild = _endCaps[1];
_endCaps = [null, null];
} else {
_local3 = _firstChild;
_endCaps = [_firstChild, _lastChild];
_firstChild = (_lastChild = null);
};
while (_local3) {
_local3.setEnabled(_arg1, true);
_local3 = _local3.nextNode;
};
};
return (super.setEnabled(_arg1, _arg2));
}
}
}//package com.greensock
Section 81
//TweenLite (com.greensock.TweenLite)
package com.greensock {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import com.greensock.core.*;
import com.greensock.plugins.*;
public class TweenLite extends TweenCore {
protected var _hasPlugins:Boolean;
public var propTweenLookup:Object;
public var cachedPT1:PropTween;
protected var _overwrite:int;
protected var _ease:Function;
public var target:Object;
public var ratio:Number;// = 0
protected var _overwrittenProps:Object;
protected var _notifyPluginsOfEnabled:Boolean;
public static const version:Number = 11.695;
public static var rootTimeline:SimpleTimeline;
public static var fastEaseLookup:Dictionary = new Dictionary(false);
public static var onPluginEvent:Function;
public static var rootFramesTimeline:SimpleTimeline;
public static var defaultEase:Function = TweenLite.easeOut;
public static var plugins:Object = {};
public static var masterList:Dictionary = new Dictionary(false);
public static var overwriteManager:Object;
public static var rootFrame:Number;
public static var killDelayedCallsTo:Function = TweenLite.killTweensOf;
private static var _shape:Shape = new Shape();
protected static var _reservedProps:Object = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, useFrames:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, onStart:1, onStartParams:1, onInit:1, onInitParams:1, onReverseComplete:1, onReverseCompleteParams:1, onRepeat:1, onRepeatParams:1, proxiedEase:1, easeParams:1, yoyo:1, onCompleteListener:1, onUpdateListener:1, onStartListener:1, onReverseCompleteListener:1, onRepeatListener:1, orientToBezier:1, timeScale:1, immediateRender:1, repeat:1, repeatDelay:1, timeline:1, data:1, paused:1};
public function TweenLite(_arg1:Object, _arg2:Number, _arg3:Object){
var _local5:TweenLite;
super(_arg2, _arg3);
if (_arg1 == null){
throw (new Error("Cannot tween a null object."));
};
this.target = _arg1;
if ((((this.target is TweenCore)) && (this.vars.timeScale))){
this.cachedTimeScale = 1;
};
propTweenLookup = {};
_ease = defaultEase;
_overwrite = (((!((Number(_arg3.overwrite) > -1))) || (((!(overwriteManager.enabled)) && ((_arg3.overwrite > 1)))))) ? overwriteManager.mode : int(_arg3.overwrite);
var _local4:Array = masterList[_arg1];
if (!_local4){
masterList[_arg1] = [this];
} else {
if (_overwrite == 1){
for each (_local5 in _local4) {
if (!_local5.gc){
_local5.setEnabled(false, false);
};
};
masterList[_arg1] = [this];
} else {
_local4[_local4.length] = this;
};
};
if (((this.active) || (this.vars.immediateRender))){
renderTime(0, false, true);
};
}
protected function easeProxy(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (this.vars.proxiedEase.apply(null, arguments.concat(this.vars.easeParams)));
}
override public function renderTime(_arg1:Number, _arg2:Boolean=false, _arg3:Boolean=false):void{
var _local4:Boolean;
var _local5:Number = this.cachedTime;
if (_arg1 >= this.cachedDuration){
this.cachedTotalTime = (this.cachedTime = this.cachedDuration);
this.ratio = 1;
_local4 = !(this.cachedReversed);
if (this.cachedDuration == 0){
if ((((((_arg1 == 0)) || ((_rawPrevTime < 0)))) && (!((_rawPrevTime == _arg1))))){
_arg3 = true;
};
_rawPrevTime = _arg1;
};
} else {
if (_arg1 <= 0){
this.cachedTotalTime = (this.cachedTime = (this.ratio = 0));
if (_arg1 < 0){
this.active = false;
if (this.cachedDuration == 0){
if (_rawPrevTime > 0){
_arg3 = true;
_local4 = true;
};
_rawPrevTime = _arg1;
};
};
if (((this.cachedReversed) && (!((_local5 == 0))))){
_local4 = true;
};
} else {
this.cachedTotalTime = (this.cachedTime = _arg1);
this.ratio = _ease(_arg1, 0, 1, this.cachedDuration);
};
};
if ((((this.cachedTime == _local5)) && (!(_arg3)))){
return;
};
if (!this.initted){
init();
if (((!(_local4)) && (this.cachedTime))){
this.ratio = _ease(this.cachedTime, 0, 1, this.cachedDuration);
};
};
if (((!(this.active)) && (!(this.cachedPaused)))){
this.active = true;
};
if ((((((((_local5 == 0)) && (this.vars.onStart))) && (((!((this.cachedTime == 0))) || ((this.cachedDuration == 0)))))) && (!(_arg2)))){
this.vars.onStart.apply(null, this.vars.onStartParams);
};
var _local6:PropTween = this.cachedPT1;
while (_local6) {
_local6.target[_local6.property] = (_local6.start + (this.ratio * _local6.change));
_local6 = _local6.nextNode;
};
if (((_hasUpdate) && (!(_arg2)))){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (((_local4) && (!(this.gc)))){
if (((_hasPlugins) && (this.cachedPT1))){
onPluginEvent("onComplete", this);
};
complete(true, _arg2);
};
}
override public function setEnabled(_arg1:Boolean, _arg2:Boolean=false):Boolean{
var _local3:Array;
if (_arg1){
_local3 = TweenLite.masterList[this.target];
if (!_local3){
TweenLite.masterList[this.target] = [this];
} else {
if (_local3.indexOf(this) == -1){
_local3[_local3.length] = this;
};
};
};
super.setEnabled(_arg1, _arg2);
if (((_notifyPluginsOfEnabled) && (this.cachedPT1))){
return (onPluginEvent((_arg1) ? "onEnable" : "onDisable", this));
};
return (false);
}
protected function init():void{
var _local1:String;
var _local2:int;
var _local3:*;
var _local4:Boolean;
var _local5:Array;
var _local6:PropTween;
if (this.vars.onInit){
this.vars.onInit.apply(null, this.vars.onInitParams);
};
if (typeof(this.vars.ease) == "function"){
_ease = this.vars.ease;
};
if (this.vars.easeParams){
this.vars.proxiedEase = _ease;
_ease = easeProxy;
};
this.cachedPT1 = null;
this.propTweenLookup = {};
for (_local1 in this.vars) {
if ((((_local1 in _reservedProps)) && (!((((_local1 == "timeScale")) && ((this.target is TweenCore))))))){
} else {
if ((((_local1 in plugins)) && (new ((plugins[_local1] as Class)).onInitTween(this.target, this.vars[_local1], this)))){
this.cachedPT1 = new PropTween(_local3, "changeFactor", 0, 1, ((_local3.overwriteProps.length)==1) ? _local3.overwriteProps[0] : "_MULTIPLE_", true, this.cachedPT1);
if (this.cachedPT1.name == "_MULTIPLE_"){
_local2 = _local3.overwriteProps.length;
while (--_local2 > -1) {
this.propTweenLookup[_local3.overwriteProps[_local2]] = this.cachedPT1;
};
} else {
this.propTweenLookup[this.cachedPT1.name] = this.cachedPT1;
};
if (_local3.priority){
this.cachedPT1.priority = _local3.priority;
_local4 = true;
};
if (((_local3.onDisable) || (_local3.onEnable))){
_notifyPluginsOfEnabled = true;
};
_hasPlugins = true;
} else {
this.cachedPT1 = new PropTween(this.target, _local1, Number(this.target[_local1]), ((typeof(this.vars[_local1]))=="number") ? (Number(this.vars[_local1]) - this.target[_local1]) : Number(this.vars[_local1]), _local1, false, this.cachedPT1);
this.propTweenLookup[_local1] = this.cachedPT1;
};
};
};
if (_local4){
onPluginEvent("onInitAllProps", this);
};
if (this.vars.runBackwards){
_local6 = this.cachedPT1;
while (_local6) {
_local6.start = (_local6.start + _local6.change);
_local6.change = -(_local6.change);
_local6 = _local6.nextNode;
};
};
_hasUpdate = Boolean(!((this.vars.onUpdate == null)));
if (_overwrittenProps){
killVars(_overwrittenProps);
if (this.cachedPT1 == null){
this.setEnabled(false, false);
};
};
if ((((((((_overwrite > 1)) && (this.cachedPT1))) && (masterList[this.target]))) && ((_local5.length > 1)))){
if (overwriteManager.manageOverwrites(this, this.propTweenLookup, _local5, _overwrite)){
init();
};
};
this.initted = true;
}
public function killVars(_arg1:Object, _arg2:Boolean=true):Boolean{
var _local3:String;
var _local4:PropTween;
var _local5:Boolean;
if (_overwrittenProps == null){
_overwrittenProps = {};
};
for (_local3 in _arg1) {
if ((_local3 in propTweenLookup)){
_local4 = propTweenLookup[_local3];
if (((_local4.isPlugin) && ((_local4.name == "_MULTIPLE_")))){
_local4.target.killProps(_arg1);
if (_local4.target.overwriteProps.length == 0){
_local4.name = "";
};
if (((!((_local3 == _local4.target.propName))) || ((_local4.name == "")))){
delete propTweenLookup[_local3];
};
};
if (_local4.name != "_MULTIPLE_"){
if (_local4.nextNode){
_local4.nextNode.prevNode = _local4.prevNode;
};
if (_local4.prevNode){
_local4.prevNode.nextNode = _local4.nextNode;
} else {
if (this.cachedPT1 == _local4){
this.cachedPT1 = _local4.nextNode;
};
};
if (((_local4.isPlugin) && (_local4.target.onDisable))){
_local4.target.onDisable();
if (_local4.target.activeDisable){
_local5 = true;
};
};
delete propTweenLookup[_local3];
};
};
if (((_arg2) && (!((_arg1 == _overwrittenProps))))){
_overwrittenProps[_local3] = 1;
};
};
return (_local5);
}
override public function invalidate():void{
if (((_notifyPluginsOfEnabled) && (this.cachedPT1))){
onPluginEvent("onDisable", this);
};
this.cachedPT1 = null;
_overwrittenProps = null;
_hasUpdate = (this.initted = (this.active = (_notifyPluginsOfEnabled = false)));
this.propTweenLookup = {};
}
public static function initClass():void{
rootFrame = 0;
rootTimeline = new SimpleTimeline(null);
rootFramesTimeline = new SimpleTimeline(null);
rootTimeline.cachedStartTime = (getTimer() * 0.001);
rootFramesTimeline.cachedStartTime = rootFrame;
rootTimeline.autoRemoveChildren = true;
rootFramesTimeline.autoRemoveChildren = true;
_shape.addEventListener(Event.ENTER_FRAME, updateAll, false, 0, true);
if (overwriteManager == null){
overwriteManager = {mode:1, enabled:false};
};
}
public static function killTweensOf(_arg1:Object, _arg2:Boolean=false, _arg3:Object=null):void{
var _local4:Array;
var _local5:int;
var _local6:TweenLite;
if ((_arg1 in masterList)){
_local4 = masterList[_arg1];
_local5 = _local4.length;
while (--_local5 > -1) {
_local6 = _local4[_local5];
if (!_local6.gc){
if (_arg2){
_local6.complete(false, false);
};
if (_arg3 != null){
_local6.killVars(_arg3);
};
if ((((_arg3 == null)) || ((((_local6.cachedPT1 == null)) && (_local6.initted))))){
_local6.setEnabled(false, false);
};
};
};
if (_arg3 == null){
delete masterList[_arg1];
};
};
}
public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
if (_arg3.isGSVars){
_arg3 = _arg3.vars;
};
_arg3.runBackwards = true;
if (!("immediateRender" in _arg3)){
_arg3.immediateRender = true;
};
return (new TweenLite(_arg1, _arg2, _arg3));
}
protected static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (1 - (_arg1 / _arg4));
return ((1 - (_arg1 * _arg1)));
}
public static function delayedCall(_arg1:Number, _arg2:Function, _arg3:Array=null, _arg4:Boolean=false):TweenLite{
return (new TweenLite(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, immediateRender:false, useFrames:_arg4, overwrite:0}));
}
protected static function updateAll(_arg1:Event=null):void{
var _local2:Dictionary;
var _local3:Object;
var _local4:Array;
var _local5:int;
rootTimeline.renderTime((((getTimer() * 0.001) - rootTimeline.cachedStartTime) * rootTimeline.cachedTimeScale), false, false);
rootFrame = (rootFrame + 1);
rootFramesTimeline.renderTime(((rootFrame - rootFramesTimeline.cachedStartTime) * rootFramesTimeline.cachedTimeScale), false, false);
if (!(rootFrame % 60)){
_local2 = masterList;
for (_local3 in _local2) {
_local4 = _local2[_local3];
_local5 = _local4.length;
while (--_local5 > -1) {
if (TweenLite(_local4[_local5]).gc){
_local4.splice(_local5, 1);
};
};
if (_local4.length == 0){
delete _local2[_local3];
};
};
};
}
public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
return (new TweenLite(_arg1, _arg2, _arg3));
}
}
}//package com.greensock
Section 82
//getCollisionRect (com.troygilbert.getCollisionRect)
package com.troygilbert {
import flash.geom.*;
import flash.display.*;
public function getCollisionRect(_arg1:DisplayObject, _arg2:DisplayObject, _arg3:DisplayObjectContainer, _arg4:Boolean=false, _arg5:int=0xFF):Rectangle{
var _local6:Rectangle = _arg1.getBounds(_arg3);
var _local7:Rectangle = _arg2.getBounds(_arg3);
var _local8:Rectangle = _local6.intersection(_local7);
if (!_arg4){
return (_local8);
};
_local8.x = Math.floor(_local8.x);
_local8.y = Math.floor(_local8.y);
_local8.width = Math.ceil(_local8.width);
_local8.height = Math.ceil(_local8.height);
if (_local8.isEmpty()){
return (_local8);
};
var _local9:Matrix = _arg3.transform.concatenatedMatrix.clone();
_local9.invert();
var _local10:Matrix = _arg1.transform.concatenatedMatrix.clone();
_local10.concat(_local9);
var _local11:Matrix = _arg2.transform.concatenatedMatrix.clone();
_local11.concat(_local9);
_local10.translate(-(_local8.x), -(_local8.y));
_local11.translate(-(_local8.x), -(_local8.y));
var _local12:BitmapData = new BitmapData(_local8.width, _local8.height, false);
_local12.draw(_arg1, _local10, new ColorTransform(1, 1, 1, 1, 0xFF, -255, -255, _arg5), BlendMode.NORMAL);
_local12.draw(_arg2, _local11, new ColorTransform(1, 1, 1, 1, 0xFF, 0xFF, 0xFF, _arg5), BlendMode.DIFFERENCE);
var _local13:Rectangle = _local12.getColorBoundsRect(4294967295, 4278255615);
_local13.offset(_local8.x, _local8.y);
return (_local13);
}
}//package com.troygilbert
Section 83
//AdLoader (CPMStar.AdLoader)
package CPMStar {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class AdLoader extends Sprite {
private var cpmstarLoader:Loader;
private var contentspotid:String;
public static const LOADED:String = "loaded";
public function AdLoader(_arg1:String){
this.contentspotid = _arg1;
addEventListener(Event.ADDED, addedHandler);
}
private function addedHandler(_arg1:Event):void{
removeEventListener(Event.ADDED, addedHandler);
Security.allowDomain("server.cpmstar.com");
var _local2 = "http://server.cpmstar.com/adviewas3.swf";
var _local3:DisplayObjectContainer = parent;
cpmstarLoader = new Loader();
cpmstarLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dispatchHandler);
cpmstarLoader.load(new URLRequest(((_local2 + "?contentspotid=") + contentspotid)));
addChild(cpmstarLoader);
}
private function dispatchHandler(_arg1:Event):void{
cpmstarLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, dispatchHandler);
dispatchEvent(new Event(LOADED));
}
}
}//package CPMStar
Section 84
//BaseScrollPane (fl.containers.BaseScrollPane)
package fl.containers {
import flash.geom.*;
import flash.display.*;
import fl.core.*;
import fl.controls.*;
import flash.events.*;
import fl.events.*;
public class BaseScrollPane extends UIComponent {
protected var _verticalScrollBar:ScrollBar;
protected var _horizontalScrollBar:ScrollBar;
protected var contentScrollRect:Rectangle;
protected var disabledOverlay:Shape;
protected var background:DisplayObject;
protected var contentWidth:Number;// = 0
protected var contentHeight:Number;// = 0
protected var _horizontalScrollPolicy:String;
protected var _verticalScrollPolicy:String;
protected var contentPadding:Number;// = 0
protected var availableWidth:Number;
protected var availableHeight:Number;
protected var vOffset:Number;// = 0
protected var vScrollBar:Boolean;
protected var hScrollBar:Boolean;
protected var _maxHorizontalScrollPosition:Number;// = 0
protected var _horizontalPageScrollSize:Number;// = 0
protected var _verticalPageScrollSize:Number;// = 0
protected var defaultLineScrollSize:Number;// = 4
protected var useFixedHorizontalScrolling:Boolean;// = false
protected var _useBitmpScrolling:Boolean;// = false
protected static const SCROLL_BAR_STYLES:Object = {upArrowDisabledSkin:"upArrowDisabledSkin", upArrowDownSkin:"upArrowDownSkin", upArrowOverSkin:"upArrowOverSkin", upArrowUpSkin:"upArrowUpSkin", downArrowDisabledSkin:"downArrowDisabledSkin", downArrowDownSkin:"downArrowDownSkin", downArrowOverSkin:"downArrowOverSkin", downArrowUpSkin:"downArrowUpSkin", thumbDisabledSkin:"thumbDisabledSkin", thumbDownSkin:"thumbDownSkin", thumbOverSkin:"thumbOverSkin", thumbUpSkin:"thumbUpSkin", thumbIcon:"thumbIcon", trackDisabledSkin:"trackDisabledSkin", trackDownSkin:"trackDownSkin", trackOverSkin:"trackOverSkin", trackUpSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {repeatDelay:500, repeatInterval:35, skin:"ScrollPane_upSkin", contentPadding:0, disabledAlpha:0.5};
override public function set enabled(_arg1:Boolean):void{
if (enabled == _arg1){
return;
};
_verticalScrollBar.enabled = _arg1;
_horizontalScrollBar.enabled = _arg1;
super.enabled = _arg1;
}
public function get horizontalScrollPolicy():String{
return (_horizontalScrollPolicy);
}
public function set horizontalScrollPolicy(_arg1:String):void{
_horizontalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get verticalScrollPolicy():String{
return (_verticalScrollPolicy);
}
public function set verticalScrollPolicy(_arg1:String):void{
_verticalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get horizontalLineScrollSize():Number{
return (_horizontalScrollBar.lineScrollSize);
}
public function set horizontalLineScrollSize(_arg1:Number):void{
_horizontalScrollBar.lineScrollSize = _arg1;
}
public function get verticalLineScrollSize():Number{
return (_verticalScrollBar.lineScrollSize);
}
public function set verticalLineScrollSize(_arg1:Number):void{
_verticalScrollBar.lineScrollSize = _arg1;
}
public function get horizontalScrollPosition():Number{
return (_horizontalScrollBar.scrollPosition);
}
public function set horizontalScrollPosition(_arg1:Number):void{
drawNow();
_horizontalScrollBar.scrollPosition = _arg1;
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, false);
}
public function get verticalScrollPosition():Number{
return (_verticalScrollBar.scrollPosition);
}
public function set verticalScrollPosition(_arg1:Number):void{
drawNow();
_verticalScrollBar.scrollPosition = _arg1;
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, false);
}
public function get maxHorizontalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentWidth - availableWidth)));
}
public function get maxVerticalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentHeight - availableHeight)));
}
public function get useBitmapScrolling():Boolean{
return (_useBitmpScrolling);
}
public function set useBitmapScrolling(_arg1:Boolean):void{
_useBitmpScrolling = _arg1;
invalidate(InvalidationType.STATE);
}
public function get horizontalPageScrollSize():Number{
if (isNaN(availableWidth)){
drawNow();
};
return (((((_horizontalPageScrollSize == 0)) && (!(isNaN(availableWidth))))) ? availableWidth : _horizontalPageScrollSize);
}
public function set horizontalPageScrollSize(_arg1:Number):void{
_horizontalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get verticalPageScrollSize():Number{
if (isNaN(availableHeight)){
drawNow();
};
return (((((_verticalPageScrollSize == 0)) && (!(isNaN(availableHeight))))) ? availableHeight : _verticalPageScrollSize);
}
public function set verticalPageScrollSize(_arg1:Number):void{
_verticalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get horizontalScrollBar():ScrollBar{
return (_horizontalScrollBar);
}
public function get verticalScrollBar():ScrollBar{
return (_verticalScrollBar);
}
override protected function configUI():void{
super.configUI();
contentScrollRect = new Rectangle(0, 0, 85, 85);
_verticalScrollBar = new ScrollBar();
_verticalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
_verticalScrollBar.visible = false;
_verticalScrollBar.lineScrollSize = defaultLineScrollSize;
addChild(_verticalScrollBar);
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
_horizontalScrollBar = new ScrollBar();
_horizontalScrollBar.direction = ScrollBarDirection.HORIZONTAL;
_horizontalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
_horizontalScrollBar.visible = false;
_horizontalScrollBar.lineScrollSize = defaultLineScrollSize;
addChild(_horizontalScrollBar);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
disabledOverlay = new Shape();
var _local1:Graphics = disabledOverlay.graphics;
_local1.beginFill(0xFFFFFF);
_local1.drawRect(0, 0, width, height);
_local1.endFill();
addEventListener(MouseEvent.MOUSE_WHEEL, handleWheel, false, 0, true);
}
protected function setContentSize(_arg1:Number, _arg2:Number):void{
if ((((((contentWidth == _arg1)) || (useFixedHorizontalScrolling))) && ((contentHeight == _arg2)))){
return;
};
contentWidth = _arg1;
contentHeight = _arg2;
invalidate(InvalidationType.SIZE);
}
protected function handleScroll(_arg1:ScrollEvent):void{
if (_arg1.target == _verticalScrollBar){
setVerticalScrollPosition(_arg1.position);
} else {
setHorizontalScrollPosition(_arg1.position);
};
}
protected function handleWheel(_arg1:MouseEvent):void{
if (((((!(enabled)) || (!(_verticalScrollBar.visible)))) || ((contentHeight <= availableHeight)))){
return;
};
_verticalScrollBar.scrollPosition = (_verticalScrollBar.scrollPosition - (_arg1.delta * verticalLineScrollSize));
setVerticalScrollPosition(_verticalScrollBar.scrollPosition);
dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL, _arg1.delta, horizontalScrollPosition));
}
protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
setStyles();
drawBackground();
if (contentPadding != getStyleValue("contentPadding")){
invalidate(InvalidationType.SIZE, false);
};
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STATE)){
drawLayout();
};
updateChildren();
super.draw();
}
protected function setStyles():void{
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
}
protected function drawBackground():void{
var _local1:DisplayObject = background;
background = getDisplayObjectInstance(getStyleValue("skin"));
background.width = width;
background.height = height;
addChildAt(background, 0);
if (((!((_local1 == null))) && (!((_local1 == background))))){
removeChild(_local1);
};
}
protected function drawLayout():void{
calculateAvailableSize();
calculateContentWidth();
background.width = width;
background.height = height;
if (vScrollBar){
_verticalScrollBar.visible = true;
_verticalScrollBar.x = ((width - ScrollBar.WIDTH) - contentPadding);
_verticalScrollBar.y = contentPadding;
_verticalScrollBar.height = availableHeight;
} else {
_verticalScrollBar.visible = false;
};
_verticalScrollBar.setScrollProperties(availableHeight, 0, (contentHeight - availableHeight), verticalPageScrollSize);
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, false);
if (hScrollBar){
_horizontalScrollBar.visible = true;
_horizontalScrollBar.x = contentPadding;
_horizontalScrollBar.y = ((height - ScrollBar.WIDTH) - contentPadding);
_horizontalScrollBar.width = availableWidth;
} else {
_horizontalScrollBar.visible = false;
};
_horizontalScrollBar.setScrollProperties(availableWidth, 0, (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - availableWidth), horizontalPageScrollSize);
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, false);
drawDisabledOverlay();
}
protected function drawDisabledOverlay():void{
if (enabled){
if (contains(disabledOverlay)){
removeChild(disabledOverlay);
};
} else {
disabledOverlay.x = (disabledOverlay.y = contentPadding);
disabledOverlay.width = availableWidth;
disabledOverlay.height = availableHeight;
disabledOverlay.alpha = (getStyleValue("disabledAlpha") as Number);
addChild(disabledOverlay);
};
}
protected function calculateAvailableSize():void{
var _local1:Number = ScrollBar.WIDTH;
var _local2:Number = (contentPadding = Number(getStyleValue("contentPadding")));
var _local3:Number = ((height - (2 * _local2)) - vOffset);
vScrollBar = (((_verticalScrollPolicy == ScrollPolicy.ON)) || ((((_verticalScrollPolicy == ScrollPolicy.AUTO)) && ((contentHeight > _local3)))));
var _local4:Number = ((width - (vScrollBar) ? _local1 : 0) - (2 * _local2));
var _local5:Number = (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - _local4);
hScrollBar = (((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_local5 > 0)))));
if (hScrollBar){
_local3 = (_local3 - _local1);
};
if (((((((hScrollBar) && (!(vScrollBar)))) && ((_verticalScrollPolicy == ScrollPolicy.AUTO)))) && ((contentHeight > _local3)))){
vScrollBar = true;
_local4 = (_local4 - _local1);
};
availableHeight = (_local3 + vOffset);
availableWidth = _local4;
}
protected function calculateContentWidth():void{
}
protected function updateChildren():void{
_verticalScrollBar.enabled = (_horizontalScrollBar.enabled = enabled);
_verticalScrollBar.drawNow();
_horizontalScrollBar.drawNow();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, ScrollBar.getStyleDefinition()));
}
}
}//package fl.containers
Section 85
//DataGridCellEditor (fl.controls.dataGridClasses.DataGridCellEditor)
package fl.controls.dataGridClasses {
import fl.controls.listClasses.*;
import fl.controls.*;
public class DataGridCellEditor extends TextInput implements ICellRenderer {
protected var _listData:ListData;
protected var _data:Object;
private static var defaultStyles:Object = {textPadding:1, textFormat:null, upSkin:"DataGridCellEditor_skin"};
public function DataGridCellEditor():void{
}
public function get listData():ListData{
return (_listData);
}
public function set listData(_arg1:ListData):void{
_listData = _arg1;
text = _listData.label;
}
public function get data():Object{
return (_data);
}
public function set data(_arg1:Object):void{
_data = _arg1;
}
public function get selected():Boolean{
return (false);
}
public function set selected(_arg1:Boolean):void{
}
public function setMouseState(_arg1:String):void{
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls.dataGridClasses
Section 86
//DataGridColumn (fl.controls.dataGridClasses.DataGridColumn)
package fl.controls.dataGridClasses {
import fl.core.*;
import fl.controls.*;
public class DataGridColumn {
private var _columnName:String;
private var _headerText:String;
private var _minWidth:Number;// = 20
private var _width:Number;// = 100
private var _visible:Boolean;// = true
private var _cellRenderer:Object;
private var _headerRenderer:Object;
private var _labelFunction:Function;
private var _sortCompareFunction:Function;
private var _imeMode:String;
public var owner:DataGrid;
public var colNum:Number;
public var explicitWidth:Number;
public var sortable:Boolean;// = true
public var resizable:Boolean;// = true
public var editable:Boolean;// = true
public var itemEditor:Object;// = "fl.controls.dataGridClasses.DataGridCellEditor"
public var editorDataField:String;// = "text"
public var dataField:String;
public var sortDescending:Boolean;// = false
public var sortOptions:uint;// = 0
private var forceImport:DataGridCellEditor;
public function DataGridColumn(_arg1:String=null){
if (_arg1){
dataField = _arg1;
headerText = _arg1;
};
}
public function get cellRenderer():Object{
return (_cellRenderer);
}
public function set cellRenderer(_arg1:Object):void{
_cellRenderer = _arg1;
if (owner){
owner.invalidate(InvalidationType.DATA);
};
}
public function get headerRenderer():Object{
return (_headerRenderer);
}
public function set headerRenderer(_arg1:Object):void{
_headerRenderer = _arg1;
if (owner){
owner.invalidate(InvalidationType.DATA);
};
}
public function get headerText():String{
return (((_headerText)!=null) ? _headerText : dataField);
}
public function set headerText(_arg1:String):void{
_headerText = _arg1;
if (owner){
owner.invalidate(InvalidationType.DATA);
};
}
public function get imeMode():String{
return (_imeMode);
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
public function get labelFunction():Function{
return (_labelFunction);
}
public function set labelFunction(_arg1:Function):void{
if (_labelFunction == _arg1){
return;
};
_labelFunction = _arg1;
if (owner){
owner.invalidate(InvalidationType.DATA);
};
}
public function get minWidth():Number{
return (_minWidth);
}
public function set minWidth(_arg1:Number):void{
_minWidth = _arg1;
if (_width < _arg1){
_width = _arg1;
};
if (owner){
owner.invalidate(InvalidationType.SIZE);
};
}
public function get sortCompareFunction():Function{
return (_sortCompareFunction);
}
public function set sortCompareFunction(_arg1:Function):void{
_sortCompareFunction = _arg1;
}
public function get visible():Boolean{
return (_visible);
}
public function set visible(_arg1:Boolean):void{
if (_visible != _arg1){
_visible = _arg1;
if (owner){
owner.invalidate(InvalidationType.SIZE);
};
};
}
public function get width():Number{
return (_width);
}
public function set width(_arg1:Number):void{
var _local2:Boolean;
explicitWidth = _arg1;
if (owner != null){
_local2 = resizable;
resizable = false;
owner.resizeColumn(colNum, _arg1);
resizable = _local2;
} else {
_width = _arg1;
};
}
public function setWidth(_arg1:Number):void{
_width = _arg1;
}
public function itemToLabel(_arg1:Object):String{
var data = _arg1;
if (!data){
return (" ");
};
if (labelFunction != null){
return (labelFunction(data));
};
if (owner.labelFunction != null){
return (owner.labelFunction(data, this));
};
if ((((typeof(data) == "object")) || ((typeof(data) == "xml")))){
try {
data = data[dataField];
} catch(e:Error) {
data = null;
};
};
if ((data is String)){
return (String(data));
};
try {
return (data.toString());
} catch(e:Error) {
};
return (" ");
}
public function toString():String{
return ("[object DataGridColumn]");
}
}
}//package fl.controls.dataGridClasses
Section 87
//HeaderRenderer (fl.controls.dataGridClasses.HeaderRenderer)
package fl.controls.dataGridClasses {
import fl.controls.*;
public class HeaderRenderer extends LabelButton {
public var _column:uint;
private static var defaultStyles:Object = {upSkin:"HeaderRenderer_upSkin", downSkin:"HeaderRenderer_downSkin", overSkin:"HeaderRenderer_overSkin", disabledSkin:"HeaderRenderer_disabledSkin", selectedDisabledSkin:"HeaderRenderer_selectedDisabledSkin", selectedUpSkin:"HeaderRenderer_selectedUpSkin", selectedDownSkin:"HeaderRenderer_selectedDownSkin", selectedOverSkin:"HeaderRenderer_selectedOverSkin", textFormat:null, disabledTextFormat:null, textPadding:5};
public function HeaderRenderer():void{
focusEnabled = false;
}
public function get column():uint{
return (_column);
}
public function set column(_arg1:uint):void{
_column = _arg1;
}
override protected function drawLayout():void{
var _local1:Number = Number(getStyleValue("textPadding"));
textField.height = (textField.textHeight + 4);
textField.visible = (label.length > 0);
var _local2:Number = (textField.textWidth + 4);
var _local3:Number = (textField.textHeight + 4);
var _local4:Number = ((icon)==null) ? 0 : (icon.width + 4);
var _local5:Number = Math.max(0, Math.min(_local2, ((width - (2 * _local1)) - _local4)));
if (icon != null){
icon.x = (((width - _local1) - icon.width) - 2);
icon.y = Math.round(((height - icon.height) / 2));
};
textField.width = _local5;
textField.x = _local1;
textField.y = Math.round(((height - textField.height) / 2));
background.width = width;
background.height = height;
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls.dataGridClasses
Section 88
//CellRenderer (fl.controls.listClasses.CellRenderer)
package fl.controls.listClasses {
import fl.controls.*;
import flash.events.*;
public class CellRenderer extends LabelButton implements ICellRenderer {
protected var _listData:ListData;
protected var _data:Object;
private static var defaultStyles:Object = {upSkin:"CellRenderer_upSkin", downSkin:"CellRenderer_downSkin", overSkin:"CellRenderer_overSkin", disabledSkin:"CellRenderer_disabledSkin", selectedDisabledSkin:"CellRenderer_selectedDisabledSkin", selectedUpSkin:"CellRenderer_selectedUpSkin", selectedDownSkin:"CellRenderer_selectedDownSkin", selectedOverSkin:"CellRenderer_selectedOverSkin", textFormat:null, disabledTextFormat:null, embedFonts:null, textPadding:5};
public function CellRenderer():void{
toggle = true;
focusEnabled = false;
}
override public function setSize(_arg1:Number, _arg2:Number):void{
super.setSize(_arg1, _arg2);
}
public function get listData():ListData{
return (_listData);
}
public function set listData(_arg1:ListData):void{
_listData = _arg1;
label = _listData.label;
setStyle("icon", _listData.icon);
}
public function get data():Object{
return (_data);
}
public function set data(_arg1:Object):void{
_data = _arg1;
}
override public function get selected():Boolean{
return (super.selected);
}
override public function set selected(_arg1:Boolean):void{
super.selected = _arg1;
}
override protected function toggleSelected(_arg1:MouseEvent):void{
}
override protected function drawLayout():void{
var _local3:Number;
var _local1:Number = Number(getStyleValue("textPadding"));
var _local2:Number = 0;
if (icon != null){
icon.x = _local1;
icon.y = Math.round(((height - icon.height) >> 1));
_local2 = (icon.width + _local1);
};
if (label.length > 0){
textField.visible = true;
_local3 = Math.max(0, ((width - _local2) - (_local1 * 2)));
textField.width = _local3;
textField.height = (textField.textHeight + 4);
textField.x = (_local2 + _local1);
textField.y = Math.round(((height - textField.height) >> 1));
} else {
textField.visible = false;
};
background.width = width;
background.height = height;
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls.listClasses
Section 89
//ICellRenderer (fl.controls.listClasses.ICellRenderer)
package fl.controls.listClasses {
public interface ICellRenderer {
function set y(_arg1:Number):void;
function set x(_arg1:Number):void;
function setSize(_arg1:Number, _arg2:Number):void;
function get listData():ListData;
function set listData(_arg1:ListData):void;
function get data():Object;
function set data(_arg1:Object):void;
function get selected():Boolean;
function set selected(_arg1:Boolean):void;
function setMouseState(_arg1:String):void;
}
}//package fl.controls.listClasses
Section 90
//ListData (fl.controls.listClasses.ListData)
package fl.controls.listClasses {
import fl.core.*;
public class ListData {
protected var _icon:Object;// = null
protected var _label:String;
protected var _owner:UIComponent;
protected var _index:uint;
protected var _row:uint;
protected var _column:uint;
public function ListData(_arg1:String, _arg2:Object, _arg3:UIComponent, _arg4:uint, _arg5:uint, _arg6:uint=0){
_label = _arg1;
_icon = _arg2;
_owner = _arg3;
_index = _arg4;
_row = _arg5;
_column = _arg6;
}
public function get label():String{
return (_label);
}
public function get icon():Object{
return (_icon);
}
public function get owner():UIComponent{
return (_owner);
}
public function get index():uint{
return (_index);
}
public function get row():uint{
return (_row);
}
public function get column():uint{
return (_column);
}
}
}//package fl.controls.listClasses
Section 91
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.events.*;
import flash.utils.*;
public class BaseButton extends UIComponent {
protected var background:DisplayObject;
protected var mouseState:String;
protected var _selected:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
protected var pressTimer:Timer;
private var _mouseStateLocked:Boolean;// = false
private var unlockedMouseState:String;
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function endPress():void{
pressTimer.reset();
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function drawBackground():void{
var _local1:String = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
var _local2:DisplayObject = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 92
//Button (fl.controls.Button)
package fl.controls {
import flash.display.*;
import fl.core.*;
import fl.managers.*;
public class Button extends LabelButton implements IFocusManagerComponent {
protected var _emphasized:Boolean;// = false
protected var emphasizedBorder:DisplayObject;
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function get emphasized():Boolean{
return (_emphasized);
}
public function set emphasized(_arg1:Boolean):void{
_emphasized = _arg1;
invalidate(InvalidationType.STYLES);
}
override protected function draw():void{
if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
drawEmphasized();
};
super.draw();
if (emphasizedBorder != null){
setChildIndex(emphasizedBorder, (numChildren - 1));
};
}
protected function drawEmphasized():void{
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
var _local1:Object = getStyleValue("emphasizedSkin");
if (_local1 != null){
emphasizedBorder = getDisplayObjectInstance(_local1);
};
if (emphasizedBorder != null){
addChildAt(emphasizedBorder, 0);
_local2 = Number(getStyleValue("emphasizedPadding"));
emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
emphasizedBorder.width = (width + (_local2 * 2));
emphasizedBorder.height = (height + (_local2 * 2));
};
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
var _local3:*;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("emphasizedPadding"));
if ((((_local2 < 0)) || (!(_emphasized)))){
_local2 = 0;
};
_local3 = getStyleValue("focusRectPadding");
_local3 = ((_local3)==null) ? 2 : _local3;
_local3 = (_local3 + _local2);
uiFocusRect.x = -(_local3);
uiFocusRect.y = -(_local3);
uiFocusRect.width = (width + (_local3 * 2));
uiFocusRect.height = (height + (_local3 * 2));
};
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 93
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement)
package fl.controls {
public class ButtonLabelPlacement {
public static const BOTTOM:String = "bottom";
public static const TOP:String = "top";
public static const LEFT:String = "left";
public static const RIGHT:String = "right";
}
}//package fl.controls
Section 94
//CheckBox (fl.controls.CheckBox)
package fl.controls {
import flash.display.*;
public class CheckBox extends LabelButton {
private static var defaultStyles:Object = {icon:null, upIcon:"CheckBox_upIcon", downIcon:"CheckBox_downIcon", overIcon:"CheckBox_overIcon", disabledIcon:"CheckBox_disabledIcon", selectedDisabledIcon:"CheckBox_selectedDisabledIcon", focusRectSkin:null, focusRectPadding:null, selectedUpIcon:"CheckBox_selectedUpIcon", selectedDownIcon:"CheckBox_selectedDownIcon", selectedOverIcon:"CheckBox_selectedOverIcon", textFormat:null, disabledTextFormat:null, embedFonts:null, textPadding:5};
public static var createAccessibilityImplementation:Function;
override public function get toggle():Boolean{
return (true);
}
override public function set toggle(_arg1:Boolean):void{
throw (new Error("Warning: You cannot change a CheckBox's toggle."));
}
override public function get autoRepeat():Boolean{
return (false);
}
override public function set autoRepeat(_arg1:Boolean):void{
}
override protected function drawLayout():void{
super.drawLayout();
var _local1:Number = Number(getStyleValue("textPadding"));
switch (_labelPlacement){
case ButtonLabelPlacement.RIGHT:
icon.x = _local1;
textField.x = (icon.x + (icon.width + _local1));
background.width = ((textField.x + textField.width) + _local1);
background.height = (Math.max(textField.height, icon.height) + (_local1 * 2));
break;
case ButtonLabelPlacement.LEFT:
icon.x = ((width - icon.width) - _local1);
textField.x = (((width - icon.width) - (_local1 * 2)) - textField.width);
background.width = ((textField.width + icon.width) + (_local1 * 3));
background.height = (Math.max(textField.height, icon.height) + (_local1 * 2));
break;
case ButtonLabelPlacement.TOP:
case ButtonLabelPlacement.BOTTOM:
background.width = (Math.max(textField.width, icon.width) + (_local1 * 2));
background.height = ((textField.height + icon.height) + (_local1 * 3));
break;
};
background.x = Math.min((icon.x - _local1), (textField.x - _local1));
background.y = Math.min((icon.y - _local1), (textField.y - _local1));
}
override protected function drawBackground():void{
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = (background.x - _local2);
uiFocusRect.y = (background.y - _local2);
uiFocusRect.width = (background.width + (_local2 << 1));
uiFocusRect.height = (background.height + (_local2 << 1));
};
}
override protected function initializeAccessibility():void{
if (CheckBox.createAccessibilityImplementation != null){
CheckBox.createAccessibilityImplementation(this);
};
}
override protected function configUI():void{
super.configUI();
super.toggle = true;
var _local1:Shape = new Shape();
var _local2:Graphics = _local1.graphics;
_local2.beginFill(0, 0);
_local2.drawRect(0, 0, 100, 100);
_local2.endFill();
background = (_local1 as DisplayObject);
addChildAt(background, 0);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 95
//ComboBox (fl.controls.ComboBox)
package fl.controls {
import flash.geom.*;
import flash.display.*;
import fl.controls.listClasses.*;
import fl.core.*;
import flash.events.*;
import fl.data.*;
import fl.events.*;
import fl.managers.*;
import flash.text.*;
import flash.ui.*;
public class ComboBox extends UIComponent implements IFocusManagerComponent {
protected var inputField:TextInput;
protected var background:BaseButton;
protected var list:List;
protected var _rowCount:uint;// = 5
protected var _editable:Boolean;// = false
protected var isOpen:Boolean;// = false
protected var highlightedCell:int;// = -1
protected var editableValue:String;
protected var _prompt:String;
protected var isKeyDown:Boolean;// = false
protected var currentIndex:int;
protected var listOverIndex:uint;
protected var _dropdownWidth:Number;
protected var _labels:Array;
private var collectionItemImport:SimpleCollectionItem;
protected static const LIST_STYLES:Object = {upSkin:"comboListUpSkin", overSkin:"comboListOverSkin", downSkin:"comobListDownSkin", disabledSkin:"comboListDisabledSkin", downArrowDisabledSkin:"downArrowDisabledSkin", downArrowDownSkin:"downArrowDownSkin", downArrowOverSkin:"downArrowOverSkin", downArrowUpSkin:"downArrowUpSkin", upArrowDisabledSkin:"upArrowDisabledSkin", upArrowDownSkin:"upArrowDownSkin", upArrowOverSkin:"upArrowOverSkin", upArrowUpSkin:"upArrowUpSkin", thumbDisabledSkin:"thumbDisabledSkin", thumbDownSkin:"thumbDownSkin", thumbOverSkin:"thumbOverSkin", thumbUpSkin:"thumbUpSkin", thumbIcon:"thumbIcon", trackDisabledSkin:"trackDisabledSkin", trackDownSkin:"trackDownSkin", trackOverSkin:"trackOverSkin", trackUpSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval", textFormat:"textFormat", disabledAlpha:"disabledAlpha", skin:"listSkin"};
protected static const BACKGROUND_STYLES:Object = {overSkin:"overSkin", downSkin:"downSkin", upSkin:"upSkin", disabledSkin:"disabledSkin", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {upSkin:"ComboBox_upSkin", downSkin:"ComboBox_downSkin", overSkin:"ComboBox_overSkin", disabledSkin:"ComboBox_disabledSkin", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, textPadding:3, buttonWidth:24, disabledAlpha:null, listSkin:null};
public static var createAccessibilityImplementation:Function;
public function get editable():Boolean{
return (_editable);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
drawTextField();
}
public function get rowCount():uint{
return (_rowCount);
}
public function set rowCount(_arg1:uint):void{
_rowCount = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get restrict():String{
return (inputField.restrict);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
if (!_editable){
return;
};
inputField.restrict = _arg1;
}
public function get selectedIndex():int{
return (list.selectedIndex);
}
public function set selectedIndex(_arg1:int):void{
list.selectedIndex = _arg1;
highlightCell();
invalidate(InvalidationType.SELECTED);
}
public function get text():String{
return (inputField.text);
}
public function set text(_arg1:String):void{
if (!editable){
return;
};
inputField.text = _arg1;
}
public function get labelField():String{
return (list.labelField);
}
public function set labelField(_arg1:String):void{
list.labelField = _arg1;
invalidate(InvalidationType.DATA);
}
public function get labelFunction():Function{
return (list.labelFunction);
}
public function set labelFunction(_arg1:Function):void{
list.labelFunction = _arg1;
invalidate(InvalidationType.DATA);
}
public function itemToLabel(_arg1:Object):String{
if (_arg1 == null){
return ("");
};
return (list.itemToLabel(_arg1));
}
public function get selectedItem():Object{
return (list.selectedItem);
}
public function set selectedItem(_arg1:Object):void{
list.selectedItem = _arg1;
invalidate(InvalidationType.SELECTED);
}
public function get dropdown():List{
return (list);
}
public function get length():int{
return (list.length);
}
public function get textField():TextInput{
return (inputField);
}
public function get value():String{
var _local1:Object;
if (editableValue != null){
return (editableValue);
};
_local1 = selectedItem;
if (((!(_editable)) && (!((_local1.data == null))))){
return (_local1.data);
};
return (itemToLabel(_local1));
}
public function get dataProvider():DataProvider{
return (list.dataProvider);
}
public function set dataProvider(_arg1:DataProvider):void{
_arg1.addEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange, false, 0, true);
list.dataProvider = _arg1;
invalidate(InvalidationType.DATA);
}
public function get dropdownWidth():Number{
return (list.width);
}
public function set dropdownWidth(_arg1:Number):void{
_dropdownWidth = _arg1;
invalidate(InvalidationType.SIZE);
}
public function addItem(_arg1:Object):void{
list.addItem(_arg1);
invalidate(InvalidationType.DATA);
}
public function get prompt():String{
return (_prompt);
}
public function set prompt(_arg1:String):void{
if (_arg1 == ""){
_prompt = null;
} else {
_prompt = _arg1;
};
invalidate(InvalidationType.STATE);
}
public function get imeMode():String{
return (inputField.imeMode);
}
public function set imeMode(_arg1:String):void{
inputField.imeMode = _arg1;
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
list.addItemAt(_arg1, _arg2);
invalidate(InvalidationType.DATA);
}
public function removeAll():void{
list.removeAll();
inputField.text = "";
invalidate(InvalidationType.DATA);
}
public function removeItem(_arg1:Object):Object{
return (list.removeItem(_arg1));
}
public function removeItemAt(_arg1:uint):void{
list.removeItemAt(_arg1);
invalidate(InvalidationType.DATA);
}
public function getItemAt(_arg1:uint):Object{
return (list.getItemAt(_arg1));
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
return (list.replaceItemAt(_arg1, _arg2));
}
public function sortItems(... _args){
return (list.sortItems.apply(list, _args));
}
public function sortItemsOn(_arg1:String, _arg2:Object=null){
return (list.sortItemsOn(_arg1, _arg2));
}
public function open():void{
currentIndex = selectedIndex;
if (((isOpen) || ((length == 0)))){
return;
};
dispatchEvent(new Event(Event.OPEN));
isOpen = true;
addEventListener(Event.ENTER_FRAME, addCloseListener, false, 0, true);
positionList();
list.scrollToSelected();
stage.addChild(list);
}
public function close():void{
highlightCell();
highlightedCell = -1;
if (!isOpen){
return;
};
dispatchEvent(new Event(Event.CLOSE));
stage.removeEventListener(MouseEvent.MOUSE_DOWN, onStageClick);
isOpen = false;
stage.removeChild(list);
}
public function get selectedLabel():String{
if (editableValue != null){
return (editableValue);
};
if (selectedIndex == -1){
return (null);
};
return (itemToLabel(selectedItem));
}
override protected function configUI():void{
super.configUI();
background = new BaseButton();
background.focusEnabled = false;
copyStylesToChild(background, BACKGROUND_STYLES);
background.addEventListener(MouseEvent.MOUSE_DOWN, onToggleListVisibility, false, 0, true);
addChild(background);
inputField = new TextInput();
inputField.focusTarget = (this as IFocusManagerComponent);
inputField.focusEnabled = false;
inputField.addEventListener(Event.CHANGE, onTextInput, false, 0, true);
addChild(inputField);
list = new List();
list.focusEnabled = false;
copyStylesToChild(list, LIST_STYLES);
list.addEventListener(Event.CHANGE, onListChange, false, 0, true);
list.addEventListener(ListEvent.ITEM_CLICK, onListChange, false, 0, true);
list.addEventListener(ListEvent.ITEM_ROLL_OUT, passEvent, false, 0, true);
list.addEventListener(ListEvent.ITEM_ROLL_OVER, passEvent, false, 0, true);
list.verticalScrollBar.addEventListener(Event.SCROLL, passEvent, false, 0, true);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
super.focusInHandler(_arg1);
if (editable){
stage.focus = inputField.textField;
};
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
isKeyDown = false;
if (isOpen){
if (((!(_arg1.relatedObject)) || (!(list.contains(_arg1.relatedObject))))){
if (((!((highlightedCell == -1))) && (!((highlightedCell == selectedIndex))))){
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
close();
};
};
super.focusOutHandler(_arg1);
}
protected function handleDataChange(_arg1:DataChangeEvent):void{
invalidate(InvalidationType.DATA);
}
override protected function draw():void{
var _local1:* = selectedIndex;
if ((((_local1 == -1)) && (((((!((prompt == null))) || (editable))) || ((length == 0)))))){
_local1 = Math.max(-1, Math.min(_local1, (length - 1)));
} else {
editableValue = null;
_local1 = Math.max(0, Math.min(_local1, (length - 1)));
};
if (list.selectedIndex != _local1){
list.selectedIndex = _local1;
invalidate(InvalidationType.SELECTED, false);
};
if (isInvalid(InvalidationType.STYLES)){
setStyles();
setEmbedFonts();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.DATA, InvalidationType.STATE)){
drawTextFormat();
drawLayout();
invalidate(InvalidationType.DATA);
};
if (isInvalid(InvalidationType.DATA)){
drawList();
invalidate(InvalidationType.SELECTED, true);
};
if (isInvalid(InvalidationType.SELECTED)){
if ((((_local1 == -1)) && (!((editableValue == null))))){
inputField.text = editableValue;
} else {
if (_local1 > -1){
if (length > 0){
inputField.horizontalScrollPosition = 0;
inputField.text = itemToLabel(list.selectedItem);
};
} else {
if ((((_local1 == -1)) && (!((_prompt == null))))){
showPrompt();
} else {
inputField.text = "";
};
};
};
if (((((editable) && ((selectedIndex > -1)))) && ((stage.focus == inputField.textField)))){
inputField.setSelection(0, inputField.length);
};
};
drawTextField();
super.draw();
}
protected function setEmbedFonts():void{
var _local1:Object = getStyleValue("embedFonts");
if (_local1 != null){
inputField.textField.embedFonts = _local1;
};
}
protected function showPrompt():void{
inputField.text = _prompt;
}
protected function setStyles():void{
copyStylesToChild(background, BACKGROUND_STYLES);
copyStylesToChild(list, LIST_STYLES);
}
protected function drawLayout():void{
var _local1:Number = (getStyleValue("buttonWidth") as Number);
var _local2:Number = (getStyleValue("textPadding") as Number);
background.setSize(width, height);
inputField.x = (inputField.y = _local2);
inputField.setSize(((width - _local1) - _local2), (height - _local2));
list.width = (isNaN(_dropdownWidth)) ? width : _dropdownWidth;
background.enabled = enabled;
background.drawNow();
}
protected function drawTextFormat():void{
var _local1:TextFormat = (getStyleValue((_enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local1 == null){
_local1 = new TextFormat();
};
inputField.textField.defaultTextFormat = _local1;
inputField.textField.setTextFormat(_local1);
setEmbedFonts();
}
protected function drawList():void{
list.rowCount = Math.max(0, Math.min(_rowCount, list.dataProvider.length));
}
protected function positionList():void{
var _local1:Point = localToGlobal(new Point(0, 0));
list.x = _local1.x;
if (((_local1.y + height) + list.height) > stage.stageHeight){
list.y = (_local1.y - list.height);
} else {
list.y = (_local1.y + height);
};
}
protected function drawTextField():void{
inputField.setStyle("upSkin", "");
inputField.setStyle("disabledSkin", "");
inputField.enabled = enabled;
inputField.editable = _editable;
inputField.textField.selectable = ((enabled) && (_editable));
inputField.mouseEnabled = (inputField.mouseChildren = ((enabled) && (_editable)));
inputField.focusEnabled = false;
if (_editable){
inputField.addEventListener(FocusEvent.FOCUS_IN, onInputFieldFocus, false, 0, true);
inputField.addEventListener(FocusEvent.FOCUS_OUT, onInputFieldFocusOut, false, 0, true);
} else {
inputField.removeEventListener(FocusEvent.FOCUS_IN, onInputFieldFocus);
inputField.removeEventListener(FocusEvent.FOCUS_OUT, onInputFieldFocusOut);
};
}
protected function onInputFieldFocus(_arg1:FocusEvent):void{
inputField.addEventListener(ComponentEvent.ENTER, onEnter, false, 0, true);
close();
}
protected function onInputFieldFocusOut(_arg1:FocusEvent):void{
inputField.removeEventListener(ComponentEvent.ENTER, onEnter);
selectedIndex = selectedIndex;
}
protected function onEnter(_arg1:ComponentEvent):void{
_arg1.stopPropagation();
}
protected function onToggleListVisibility(_arg1:MouseEvent):void{
_arg1.stopPropagation();
dispatchEvent(_arg1);
if (isOpen){
close();
} else {
open();
stage.addEventListener(MouseEvent.MOUSE_UP, onListItemUp, false, 0, true);
};
}
protected function onListItemUp(_arg1:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_UP, onListItemUp);
if (((!((_arg1.target is ICellRenderer))) || (!(list.contains((_arg1.target as DisplayObject)))))){
return;
};
editableValue = null;
var _local2:* = selectedIndex;
selectedIndex = _arg1.target.listData.index;
if (_local2 != selectedIndex){
dispatchEvent(new Event(Event.CHANGE));
};
close();
}
protected function onListChange(_arg1:Event):void{
editableValue = null;
dispatchEvent(_arg1);
invalidate(InvalidationType.SELECTED);
if (isKeyDown){
return;
};
close();
}
protected function onStageClick(_arg1:MouseEvent):void{
if (!isOpen){
return;
};
if (((!(contains((_arg1.target as DisplayObject)))) && (!(list.contains((_arg1.target as DisplayObject)))))){
if (highlightedCell != -1){
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
close();
};
}
protected function passEvent(_arg1:Event):void{
dispatchEvent(_arg1);
}
private function addCloseListener(_arg1:Event){
removeEventListener(Event.ENTER_FRAME, addCloseListener);
if (!isOpen){
return;
};
stage.addEventListener(MouseEvent.MOUSE_DOWN, onStageClick, false, 0, true);
}
protected function onTextInput(_arg1:Event):void{
_arg1.stopPropagation();
if (!_editable){
return;
};
editableValue = inputField.text;
selectedIndex = -1;
dispatchEvent(new Event(Event.CHANGE));
}
protected function calculateAvailableHeight():Number{
var _local1:Number = Number(getStyleValue("contentPadding"));
return ((list.height - (_local1 * 2)));
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
isKeyDown = true;
if (_arg1.ctrlKey){
switch (_arg1.keyCode){
case Keyboard.UP:
if (highlightedCell > -1){
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
close();
break;
case Keyboard.DOWN:
open();
break;
};
return;
};
_arg1.stopPropagation();
var _local2:int = Math.max(((calculateAvailableHeight() / list.rowHeight) << 0), 1);
var _local3:uint = selectedIndex;
var _local4:Number = ((highlightedCell)==-1) ? selectedIndex : highlightedCell;
var _local5 = -1;
switch (_arg1.keyCode){
case Keyboard.SPACE:
if (isOpen){
close();
} else {
open();
};
return;
case Keyboard.ESCAPE:
if (isOpen){
if (highlightedCell > -1){
selectedIndex = selectedIndex;
};
close();
};
return;
case Keyboard.UP:
_local5 = Math.max(0, (_local4 - 1));
break;
case Keyboard.DOWN:
_local5 = Math.min((length - 1), (_local4 + 1));
break;
case Keyboard.PAGE_UP:
_local5 = Math.max((_local4 - _local2), 0);
break;
case Keyboard.PAGE_DOWN:
_local5 = Math.min((_local4 + _local2), (length - 1));
break;
case Keyboard.HOME:
_local5 = 0;
break;
case Keyboard.END:
_local5 = (length - 1);
break;
case Keyboard.ENTER:
if (((_editable) && ((highlightedCell == -1)))){
editableValue = inputField.text;
selectedIndex = -1;
} else {
if (((isOpen) && ((highlightedCell > -1)))){
editableValue = null;
selectedIndex = highlightedCell;
dispatchEvent(new Event(Event.CHANGE));
};
};
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER));
close();
return;
default:
if (editable){
break;
};
_local5 = list.getNextIndexAtLetter(String.fromCharCode(_arg1.keyCode), _local4);
break;
};
if (_local5 > -1){
if (isOpen){
highlightCell(_local5);
inputField.text = list.itemToLabel(getItemAt(_local5));
} else {
highlightCell();
selectedIndex = _local5;
dispatchEvent(new Event(Event.CHANGE));
};
};
}
protected function highlightCell(_arg1:int=-1):void{
var _local2:ICellRenderer;
if (highlightedCell > -1){
_local2 = list.itemToCellRenderer(getItemAt(highlightedCell));
if (_local2 != null){
_local2.setMouseState("up");
};
};
if (_arg1 == -1){
return;
};
list.scrollToIndex(_arg1);
list.drawNow();
_local2 = list.itemToCellRenderer(getItemAt(_arg1));
if (_local2 != null){
_local2.setMouseState("over");
highlightedCell = _arg1;
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
isKeyDown = false;
}
override protected function initializeAccessibility():void{
if (ComboBox.createAccessibilityImplementation != null){
ComboBox.createAccessibilityImplementation(this);
};
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, List.getStyleDefinition()));
}
}
}//package fl.controls
Section 96
//DataGrid (fl.controls.DataGrid)
package fl.controls {
import flash.geom.*;
import flash.display.*;
import fl.controls.listClasses.*;
import fl.core.*;
import flash.events.*;
import fl.data.*;
import fl.events.*;
import fl.managers.*;
import fl.controls.dataGridClasses.*;
import flash.utils.*;
import flash.ui.*;
public class DataGrid extends SelectableList implements IFocusManagerComponent {
protected var _rowHeight:Number;// = 20
protected var _headerHeight:Number;// = 25
protected var _showHeaders:Boolean;// = true
protected var _columns:Array;
protected var _minColumnWidth:Number;
protected var header:Sprite;
protected var headerMask:Sprite;
protected var headerSortArrow:Sprite;
protected var _cellRenderer:Object;
protected var _headerRenderer:Object;
protected var _labelFunction:Function;
protected var visibleColumns:Array;
protected var displayableColumns:Array;
protected var columnsInvalid:Boolean;// = true
protected var minColumnWidthInvalid:Boolean;// = false
protected var activeCellRenderersMap:Dictionary;
protected var availableCellRenderersMap:Dictionary;
protected var dragHandlesMap:Dictionary;
protected var columnStretchIndex:Number;// = -1
protected var columnStretchStartX:Number;
protected var columnStretchStartWidth:Number;
protected var columnStretchCursor:Sprite;
protected var _sortIndex:int;// = -1
protected var lastSortIndex:int;// = -1
protected var _sortDescending:Boolean;// = false
protected var _editedItemPosition:Object;
protected var editedItemPositionChanged:Boolean;// = false
protected var proposedEditedItemPosition;
protected var actualRowIndex:int;
protected var actualColIndex:int;
protected var isPressed:Boolean;// = false
protected var losingFocus:Boolean;// = false
protected var maxHeaderHeight:Number;// = 25
protected var currentHoveredRow:int;// = -1
public var editable:Boolean;// = false
public var resizableColumns:Boolean;// = true
public var sortableColumns:Boolean;// = true
public var itemEditorInstance:Object;
protected static const HEADER_STYLES:Object = {disabledSkin:"headerDisabledSkin", downSkin:"headerDownSkin", overSkin:"headerOverSkin", upSkin:"headerUpSkin", textFormat:"headerTextFormat", disabledTextFormat:"headerDisabledTextFormat", textPadding:"headerTextPadding"};
private static var defaultStyles:Object = {headerUpSkin:"HeaderRenderer_upSkin", headerDownSkin:"HeaderRenderer_downSkin", headerOverSkin:"HeaderRenderer_overSkin", headerDisabledSkin:"HeaderRenderer_disabledSkin", headerSortArrowDescSkin:"HeaderSortArrow_descIcon", headerSortArrowAscSkin:"HeaderSortArrow_ascIcon", columnStretchCursorSkin:"ColumnStretch_cursor", columnDividerSkin:null, headerTextFormat:null, headerDisabledTextFormat:null, headerTextPadding:5, headerRenderer:HeaderRenderer, focusRectSkin:null, focusRectPadding:null, skin:"DataGrid_skin"};
public static var createAccessibilityImplementation:Function;
public function DataGrid(){
if (_columns == null){
_columns = [];
};
_horizontalScrollPolicy = ScrollPolicy.OFF;
activeCellRenderersMap = new Dictionary(true);
availableCellRenderersMap = new Dictionary(true);
addEventListener(DataGridEvent.ITEM_EDIT_BEGINNING, itemEditorItemEditBeginningHandler, false, -50);
addEventListener(DataGridEvent.ITEM_EDIT_BEGIN, itemEditorItemEditBeginHandler, false, -50);
addEventListener(DataGridEvent.ITEM_EDIT_END, itemEditorItemEditEndHandler, false, -50);
addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
}
override public function set dataProvider(_arg1:DataProvider):void{
super.dataProvider = _arg1;
if (_columns == null){
_columns = [];
};
if (_columns.length == 0){
createColumnsFromDataProvider();
};
removeCellRenderers();
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
header.mouseChildren = _enabled;
}
override public function setSize(_arg1:Number, _arg2:Number):void{
super.setSize(_arg1, _arg2);
columnsInvalid = true;
}
override public function get horizontalScrollPolicy():String{
return (_horizontalScrollPolicy);
}
override public function set horizontalScrollPolicy(_arg1:String):void{
super.horizontalScrollPolicy = _arg1;
columnsInvalid = true;
}
public function get columns():Array{
return (_columns.slice(0));
}
public function set columns(_arg1:Array):void{
removeCellRenderers();
_columns = [];
var _local2:uint;
while (_local2 < _arg1.length) {
addColumn(_arg1[_local2]);
_local2++;
};
}
public function get minColumnWidth():Number{
return (_minColumnWidth);
}
public function set minColumnWidth(_arg1:Number):void{
_minColumnWidth = _arg1;
columnsInvalid = true;
minColumnWidthInvalid = true;
invalidate(InvalidationType.SIZE);
}
public function get labelFunction():Function{
return (_labelFunction);
}
public function set labelFunction(_arg1:Function):void{
if (_labelFunction == _arg1){
return;
};
_labelFunction = _arg1;
invalidate(InvalidationType.DATA);
}
override public function get rowCount():uint{
return (Math.ceil((calculateAvailableHeight() / rowHeight)));
}
public function set rowCount(_arg1:uint):void{
var _local2:Number = Number(getStyleValue("contentPadding"));
var _local3:Number = ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && (hScrollBar))))) ? 15 : 0;
height = ((((rowHeight * _arg1) + (2 * _local2)) + _local3) + (showHeaders) ? headerHeight : 0);
}
public function get rowHeight():Number{
return (_rowHeight);
}
public function set rowHeight(_arg1:Number):void{
_rowHeight = Math.max(0, _arg1);
invalidate(InvalidationType.SIZE);
}
public function get headerHeight():Number{
return (_headerHeight);
}
public function set headerHeight(_arg1:Number):void{
maxHeaderHeight = _arg1;
_headerHeight = Math.max(0, _arg1);
invalidate(InvalidationType.SIZE);
}
public function get showHeaders():Boolean{
return (_showHeaders);
}
public function set showHeaders(_arg1:Boolean):void{
_showHeaders = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get sortIndex():int{
return (_sortIndex);
}
public function get sortDescending():Boolean{
return (_sortDescending);
}
public function get imeMode():String{
return (_imeMode);
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
public function get editedItemRenderer():ICellRenderer{
if (!itemEditorInstance){
return (null);
};
return (getCellRendererAt(actualRowIndex, actualColIndex));
}
public function get editedItemPosition():Object{
if (_editedItemPosition){
return ({rowIndex:_editedItemPosition.rowIndex, columnIndex:_editedItemPosition.columnIndex});
};
return (_editedItemPosition);
}
public function set editedItemPosition(_arg1:Object):void{
var _local2:Object = {rowIndex:_arg1.rowIndex, columnIndex:_arg1.columnIndex};
setEditedItemPosition(_local2);
}
protected function calculateAvailableHeight():Number{
var _local1:Number = Number(getStyleValue("contentPadding"));
var _local2:Number = ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0;
return ((((height - (_local1 * 2)) - _local2) - (showHeaders) ? headerHeight : 0));
}
public function addColumn(_arg1):DataGridColumn{
return (addColumnAt(_arg1, _columns.length));
}
public function addColumnAt(_arg1, _arg2:uint):DataGridColumn{
var _local3:DataGridColumn;
var _local5:uint;
if (_arg2 < _columns.length){
_columns.splice(_arg2, 0, "");
_local5 = (_arg2 + 1);
while (_local5 < _columns.length) {
_local3 = (_columns[_local5] as DataGridColumn);
_local3.colNum = _local5;
_local5++;
};
};
var _local4:* = _arg1;
if (!(_local4 is DataGridColumn)){
if ((_local4 is String)){
_local4 = new DataGridColumn(_local4);
} else {
_local4 = new DataGridColumn();
};
};
_local3 = (_local4 as DataGridColumn);
_local3.owner = this;
_local3.colNum = _arg2;
_columns[_arg2] = _local3;
invalidate(InvalidationType.SIZE);
columnsInvalid = true;
return (_local3);
}
public function removeColumnAt(_arg1:uint):DataGridColumn{
var _local3:uint;
var _local2:DataGridColumn = (_columns[_arg1] as DataGridColumn);
if (_local2 != null){
removeCellRenderersByColumn(_local2);
_columns.splice(_arg1, 1);
_local3 = _arg1;
while (_local3 < _columns.length) {
_local2 = (_columns[_local3] as DataGridColumn);
if (_local2){
_local2.colNum = _local3;
};
_local3++;
};
invalidate(InvalidationType.SIZE);
columnsInvalid = true;
};
return (_local2);
}
public function removeAllColumns():void{
if (_columns.length > 0){
removeCellRenderers();
_columns = [];
invalidate(InvalidationType.SIZE);
columnsInvalid = true;
};
}
public function getColumnAt(_arg1:uint):DataGridColumn{
return ((_columns[_arg1] as DataGridColumn));
}
public function getColumnIndex(_arg1:String):int{
var _local3:DataGridColumn;
var _local2:uint;
while (_local2 < _columns.length) {
_local3 = (_columns[_local2] as DataGridColumn);
if (_local3.dataField == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
}
public function getColumnCount():uint{
return (_columns.length);
}
public function spaceColumnsEqually():void{
var _local1:Number;
var _local2:int;
var _local3:DataGridColumn;
drawNow();
if (displayableColumns.length > 0){
_local1 = (availableWidth / displayableColumns.length);
_local2 = 0;
while (_local2 < displayableColumns.length) {
_local3 = (displayableColumns[_local2] as DataGridColumn);
_local3.width = _local1;
_local2++;
};
invalidate(InvalidationType.SIZE);
columnsInvalid = true;
};
}
public function editField(_arg1:uint, _arg2:String, _arg3:Object):void{
var _local4:Object = getItemAt(_arg1);
_local4[_arg2] = _arg3;
replaceItemAt(_local4, _arg1);
}
override public function itemToCellRenderer(_arg1:Object):ICellRenderer{
return (null);
}
override protected function configUI():void{
useFixedHorizontalScrolling = false;
super.configUI();
headerMask = new Sprite();
var _local1:Graphics = headerMask.graphics;
_local1.beginFill(0, 0.3);
_local1.drawRect(0, 0, 100, 100);
_local1.endFill();
headerMask.visible = false;
addChild(headerMask);
header = new Sprite();
addChild(header);
header.mask = headerMask;
_horizontalScrollPolicy = ScrollPolicy.OFF;
_verticalScrollPolicy = ScrollPolicy.AUTO;
}
override protected function draw():void{
var _local1 = !((contentHeight == (rowHeight * length)));
contentHeight = (rowHeight * length);
if (isInvalid(InvalidationType.STYLES)){
setStyles();
drawBackground();
if (contentPadding != getStyleValue("contentPadding")){
invalidate(InvalidationType.SIZE, false);
};
if (((!((_cellRenderer == getStyleValue("cellRenderer")))) || (!((_headerRenderer == getStyleValue("headerRenderer")))))){
_invalidateList();
_cellRenderer = getStyleValue("cellRenderer");
_headerRenderer = getStyleValue("headerRenderer");
};
};
if (isInvalid(InvalidationType.SIZE)){
columnsInvalid = true;
};
if (((isInvalid(InvalidationType.SIZE, InvalidationType.STATE)) || (_local1))){
drawLayout();
drawDisabledOverlay();
};
if (isInvalid(InvalidationType.RENDERER_STYLES)){
updateRendererStyles();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.SIZE, InvalidationType.DATA, InvalidationType.SCROLL, InvalidationType.SELECTED)){
drawList();
};
updateChildren();
validate();
}
override protected function drawLayout():void{
vOffset = (showHeaders) ? headerHeight : 0;
super.drawLayout();
contentScrollRect = listHolder.scrollRect;
if (showHeaders){
headerHeight = maxHeaderHeight;
if (Math.floor((availableHeight - headerHeight)) <= 0){
_headerHeight = availableHeight;
};
list.y = headerHeight;
contentScrollRect = listHolder.scrollRect;
contentScrollRect.y = (contentPadding + headerHeight);
contentScrollRect.height = (availableHeight - headerHeight);
listHolder.y = (contentPadding + headerHeight);
headerMask.x = contentPadding;
headerMask.y = contentPadding;
headerMask.width = availableWidth;
headerMask.height = headerHeight;
} else {
contentScrollRect.y = contentPadding;
listHolder.y = 0;
};
listHolder.scrollRect = contentScrollRect;
}
override protected function drawList():void{
var _local3:Number;
var _local4:Number;
var _local5:uint;
var _local6:Object;
var _local7:ICellRenderer;
var _local8:Array;
var _local9:DataGridColumn;
var _local13:Sprite;
var _local14:UIComponent;
var _local18:Number;
var _local19:DataGridColumn;
var _local20:Object;
var _local21:Array;
var _local22:Dictionary;
var _local23:Object;
var _local24:HeaderRenderer;
var _local25:Sprite;
var _local26:Graphics;
var _local27:Boolean;
var _local28:String;
if (showHeaders){
header.visible = true;
header.x = (contentPadding - _horizontalScrollPosition);
header.y = contentPadding;
listHolder.y = (contentPadding + headerHeight);
_local18 = Math.floor((availableHeight - headerHeight));
_verticalScrollBar.setScrollProperties(_local18, 0, (contentHeight - _local18), _verticalScrollBar.pageScrollSize);
} else {
header.visible = false;
listHolder.y = contentPadding;
};
listHolder.x = contentPadding;
contentScrollRect = listHolder.scrollRect;
contentScrollRect.x = _horizontalScrollPosition;
contentScrollRect.y = (vOffset + (Math.floor(_verticalScrollPosition) % rowHeight));
listHolder.scrollRect = contentScrollRect;
listHolder.cacheAsBitmap = useBitmapScrolling;
var _local1:uint = Math.min(Math.max((length - 1), 0), Math.floor((_verticalScrollPosition / rowHeight)));
var _local2:uint = Math.min(Math.max((length - 1), 0), ((_local1 + rowCount) + 1));
var _local10:Boolean = list.hitTestPoint(stage.mouseX, stage.mouseY);
calculateColumnSizes();
var _local11:Dictionary = (renderedItems = new Dictionary(true));
if (length > 0){
_local5 = _local1;
while (_local5 <= _local2) {
_local11[_dataProvider.getItemAt(_local5)] = true;
_local5++;
};
};
_local3 = 0;
var _local12:DataGridColumn = (visibleColumns[0] as DataGridColumn);
_local5 = 0;
while (_local5 < displayableColumns.length) {
_local19 = (displayableColumns[_local5] as DataGridColumn);
if (_local19 != _local12){
_local3 = (_local3 + _local19.width);
} else {
break;
};
_local5++;
};
while (header.numChildren > 0) {
header.removeChildAt(0);
};
dragHandlesMap = new Dictionary(true);
var _local15:Array = [];
var _local16:uint = visibleColumns.length;
var _local17:uint;
while (_local17 < _local16) {
_local9 = (visibleColumns[_local17] as DataGridColumn);
_local15.push(_local9.colNum);
if (showHeaders){
_local23 = ((_local9.headerRenderer)!=null) ? _local9.headerRenderer : _headerRenderer;
_local24 = (getDisplayObjectInstance(_local23) as HeaderRenderer);
if (_local24 != null){
_local24.addEventListener(MouseEvent.CLICK, handleHeaderRendererClick, false, 0, true);
_local24.x = _local3;
_local24.y = 0;
_local24.setSize(_local9.width, headerHeight);
_local24.column = _local9.colNum;
_local24.label = _local9.headerText;
header.addChildAt(_local24, _local17);
copyStylesToChild(_local24, HEADER_STYLES);
if ((((((sortIndex == -1)) && ((lastSortIndex == -1)))) || (!((_local9.colNum == sortIndex))))){
_local24.setStyle("icon", null);
} else {
_local24.setStyle("icon", (sortDescending) ? getStyleValue("headerSortArrowAscSkin") : getStyleValue("headerSortArrowDescSkin"));
};
if ((((((_local17 < (_local16 - 1))) && (resizableColumns))) && (_local9.resizable))){
_local25 = new Sprite();
_local26 = _local25.graphics;
_local26.beginFill(0, 0);
_local26.drawRect(0, 0, 3, headerHeight);
_local26.endFill();
_local25.x = ((_local3 + _local9.width) - 2);
_local25.y = 0;
_local25.alpha = 0;
_local25.addEventListener(MouseEvent.MOUSE_OVER, handleHeaderResizeOver, false, 0, true);
_local25.addEventListener(MouseEvent.MOUSE_OUT, handleHeaderResizeOut, false, 0, true);
_local25.addEventListener(MouseEvent.MOUSE_DOWN, handleHeaderResizeDown, false, 0, true);
header.addChild(_local25);
dragHandlesMap[_local25] = _local9.colNum;
};
if ((((((_local17 == (_local16 - 1))) && ((_horizontalScrollPosition == 0)))) && ((availableWidth > (_local3 + _local9.width))))){
_local4 = Math.floor((availableWidth - _local3));
_local24.setSize(_local4, headerHeight);
} else {
_local4 = _local9.width;
};
_local24.drawNow();
};
};
_local20 = ((_local9.cellRenderer)!=null) ? _local9.cellRenderer : _cellRenderer;
_local21 = availableCellRenderersMap[_local9];
_local8 = activeCellRenderersMap[_local9];
if (_local8 == null){
_local8 = [];
activeCellRenderersMap[_local9] = _local8;
};
if (_local21 == null){
_local21 = [];
availableCellRenderersMap[_local9] = _local21;
};
_local22 = new Dictionary(true);
while (_local8.length > 0) {
_local7 = _local8.pop();
_local6 = _local7.data;
if ((((_local11[_local6] == null)) || ((invalidItems[_local6] == true)))){
_local21.push(_local7);
} else {
_local22[_local6] = _local7;
invalidItems[_local6] = true;
};
list.removeChild((_local7 as DisplayObject));
};
if (length > 0){
_local5 = _local1;
while (_local5 <= _local2) {
_local27 = false;
_local6 = _dataProvider.getItemAt(_local5);
if (_local22[_local6] != null){
_local27 = true;
_local7 = _local22[_local6];
delete _local22[_local6];
} else {
if (_local21.length > 0){
_local7 = (_local21.pop() as ICellRenderer);
} else {
_local7 = (getDisplayObjectInstance(_local20) as ICellRenderer);
_local13 = (_local7 as Sprite);
if (_local13 != null){
_local13.addEventListener(MouseEvent.CLICK, handleCellRendererClick, false, 0, true);
_local13.addEventListener(MouseEvent.ROLL_OVER, handleCellRendererMouseEvent, false, 0, true);
_local13.addEventListener(MouseEvent.ROLL_OUT, handleCellRendererMouseEvent, false, 0, true);
_local13.addEventListener(Event.CHANGE, handleCellRendererChange, false, 0, true);
_local13.doubleClickEnabled = true;
_local13.addEventListener(MouseEvent.DOUBLE_CLICK, handleCellRendererDoubleClick, false, 0, true);
if (_local13["setStyle"] != null){
for (_local28 in rendererStyles) {
var _local31 = _local13;
_local31["setStyle"](_local28, rendererStyles[_local28]);
};
};
};
};
};
list.addChild((_local7 as Sprite));
_local8.push(_local7);
_local7.x = _local3;
_local7.y = (rowHeight * (_local5 - _local1));
_local7.setSize(((_local17)==(_local16 - 1)) ? _local4 : _local9.width, rowHeight);
if (!_local27){
_local7.data = _local6;
};
_local7.listData = new ListData(columnItemToLabel(_local9.colNum, _local6), null, this, _local5, _local5, _local9.colNum);
if (((_local10) && (isHovered(_local7)))){
_local7.setMouseState("over");
currentHoveredRow = _local5;
} else {
_local7.setMouseState("up");
};
_local7.selected = !((_selectedIndices.indexOf(_local5) == -1));
if ((_local7 is UIComponent)){
_local14 = (_local7 as UIComponent);
_local14.drawNow();
};
_local5++;
};
};
_local3 = (_local3 + _local9.width);
_local17++;
};
_local5 = 0;
while (_local5 < _columns.length) {
if (_local15.indexOf(_local5) == -1){
removeCellRenderersByColumn((_columns[_local5] as DataGridColumn));
};
_local5++;
};
if (editedItemPositionChanged){
editedItemPositionChanged = false;
commitEditedItemPosition(proposedEditedItemPosition);
proposedEditedItemPosition = undefined;
};
invalidItems = new Dictionary(true);
}
override protected function updateRendererStyles():void{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:String;
var _local1:Array = [];
for (_local2 in availableCellRenderersMap) {
_local1 = _local1.concat(availableCellRenderersMap[_local2]);
};
for (_local2 in activeCellRenderersMap) {
_local1 = _local1.concat(activeCellRenderersMap[_local2]);
};
_local3 = _local1.length;
_local4 = 0;
while (_local4 < _local3) {
if (_local1[_local4]["setStyle"] == null){
} else {
for (_local5 in updatedRendererStyles) {
_local1[_local4].setStyle(_local5, updatedRendererStyles[_local5]);
};
_local1[_local4].drawNow();
};
_local4++;
};
updatedRendererStyles = {};
}
protected function removeCellRenderers():void{
var _local1:uint;
while (_local1 < _columns.length) {
removeCellRenderersByColumn((_columns[_local1] as DataGridColumn));
_local1++;
};
}
protected function removeCellRenderersByColumn(_arg1:DataGridColumn):void{
if (_arg1 == null){
return;
};
var _local2:Array = activeCellRenderersMap[_arg1];
if (_local2 != null){
while (_local2.length > 0) {
list.removeChild((_local2.pop() as DisplayObject));
};
};
}
override protected function handleCellRendererMouseEvent(_arg1:MouseEvent):void{
var _local3:int;
var _local4:String;
var _local5:uint;
var _local6:DataGridColumn;
var _local7:ICellRenderer;
var _local2:ICellRenderer = (_arg1.target as ICellRenderer);
if (_local2){
_local3 = _local2.listData.row;
if (_arg1.type == MouseEvent.ROLL_OVER){
_local4 = "over";
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
_local4 = "up";
};
};
if (_local4){
_local5 = 0;
while (_local5 < visibleColumns.length) {
_local6 = (visibleColumns[_local5] as DataGridColumn);
_local7 = getCellRendererAt(_local3, _local6.colNum);
if (_local7){
_local7.setMouseState(_local4);
};
if (_local3 != currentHoveredRow){
_local7 = getCellRendererAt(currentHoveredRow, _local6.colNum);
if (_local7){
_local7.setMouseState("up");
};
};
_local5++;
};
};
};
super.handleCellRendererMouseEvent(_arg1);
}
protected function isHovered(_arg1:ICellRenderer):Boolean{
var _local2:uint = Math.min(Math.max((length - 1), 0), Math.floor((_verticalScrollPosition / rowHeight)));
var _local3:Number = ((_arg1.listData.row - _local2) * rowHeight);
var _local4:Point = list.globalToLocal(new Point(0, stage.mouseY));
return ((((_local4.y > _local3)) && ((_local4.y < (_local3 + rowHeight)))));
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
if (_arg1 == _horizontalScrollPosition){
return;
};
contentScrollRect = listHolder.scrollRect;
contentScrollRect.x = _arg1;
listHolder.scrollRect = contentScrollRect;
list.x = 0;
header.x = -(_arg1);
super.setHorizontalScrollPosition(_arg1, true);
invalidate(InvalidationType.SCROLL);
columnsInvalid = true;
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
if (itemEditorInstance){
endEdit(DataGridEventReason.OTHER);
};
invalidate(InvalidationType.SCROLL);
super.setVerticalScrollPosition(_arg1, true);
}
public function columnItemToLabel(_arg1:uint, _arg2:Object):String{
var _local3:DataGridColumn = (_columns[_arg1] as DataGridColumn);
if (_local3 != null){
return (_local3.itemToLabel(_arg2));
};
return (" ");
}
protected function calculateColumnSizes():void{
var _local1:Number;
var _local2:int;
var _local3:int;
var _local5:DataGridColumn;
var _local6:DataGridColumn;
var _local7:Number;
var _local8:int;
var _local9:Number;
var _local10:int;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local4:Number = 0;
if (_columns.length == 0){
visibleColumns = [];
displayableColumns = [];
return;
};
if (columnsInvalid){
columnsInvalid = false;
visibleColumns = [];
if (minColumnWidthInvalid){
_local2 = _columns.length;
_local3 = 0;
while (_local3 < _local2) {
_columns[_local3].minWidth = minColumnWidth;
_local3++;
};
minColumnWidthInvalid = false;
};
displayableColumns = null;
_local2 = _columns.length;
_local3 = 0;
while (_local3 < _local2) {
if (((displayableColumns) && (_columns[_local3].visible))){
displayableColumns.push(_columns[_local3]);
} else {
if (((!(displayableColumns)) && (!(_columns[_local3].visible)))){
displayableColumns = new Array(_local3);
_local8 = 0;
while (_local8 < _local3) {
displayableColumns[_local8] = _columns[_local8];
_local8++;
};
};
};
_local3++;
};
if (!displayableColumns){
displayableColumns = _columns;
};
if (horizontalScrollPolicy == ScrollPolicy.OFF){
_local2 = displayableColumns.length;
_local3 = 0;
while (_local3 < _local2) {
visibleColumns.push(displayableColumns[_local3]);
_local3++;
};
} else {
_local2 = displayableColumns.length;
_local9 = 0;
_local3 = 0;
while (_local3 < _local2) {
_local5 = (displayableColumns[_local3] as DataGridColumn);
if (((((_local9 + _local5.width) > _horizontalScrollPosition)) && ((_local9 < (_horizontalScrollPosition + availableWidth))))){
visibleColumns.push(_local5);
};
_local9 = (_local9 + _local5.width);
_local3++;
};
};
};
if (horizontalScrollPolicy == ScrollPolicy.OFF){
_local10 = 0;
_local11 = 0;
_local2 = visibleColumns.length;
_local3 = 0;
while (_local3 < _local2) {
_local5 = (visibleColumns[_local3] as DataGridColumn);
if (_local5.resizable){
if (!isNaN(_local5.explicitWidth)){
_local11 = (_local11 + _local5.width);
} else {
_local10++;
_local11 = (_local11 + _local5.minWidth);
};
} else {
_local11 = (_local11 + _local5.width);
};
_local4 = (_local4 + _local5.width);
_local3++;
};
_local13 = availableWidth;
if ((((availableWidth > _local11)) && (_local10))){
_local2 = visibleColumns.length;
_local3 = 0;
while (_local3 < _local2) {
_local5 = (visibleColumns[_local3] as DataGridColumn);
if (((_local5.resizable) && (isNaN(_local5.explicitWidth)))){
_local6 = _local5;
if (_local4 > availableWidth){
_local12 = ((_local6.width - _local6.minWidth) / (_local4 - _local11));
} else {
_local12 = (_local6.width / _local4);
};
_local7 = (_local6.width - ((_local4 - availableWidth) * _local12));
_local14 = _local5.minWidth;
_local5.setWidth(Math.max(_local7, _local14));
};
_local13 = (_local13 - _local5.width);
_local3++;
};
if (((_local13) && (_local6))){
_local6.setWidth((_local6.width + _local13));
};
} else {
_local2 = visibleColumns.length;
_local3 = 0;
while (_local3 < _local2) {
_local6 = (visibleColumns[_local3] as DataGridColumn);
_local12 = (_local6.width / _local4);
_local7 = (availableWidth * _local12);
_local6.setWidth(_local7);
_local6.explicitWidth = NaN;
_local13 = (_local13 - _local7);
_local3++;
};
if (((_local13) && (_local6))){
_local6.setWidth((_local6.width + _local13));
};
};
};
}
override protected function calculateContentWidth():void{
var _local1:int;
var _local2:int;
var _local3:DataGridColumn;
if (_columns.length == 0){
contentWidth = 0;
return;
};
if (minColumnWidthInvalid){
_local1 = _columns.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = (_columns[_local2] as DataGridColumn);
_local3.minWidth = minColumnWidth;
_local2++;
};
minColumnWidthInvalid = false;
};
if (horizontalScrollPolicy == ScrollPolicy.OFF){
contentWidth = availableWidth;
} else {
contentWidth = 0;
_local1 = _columns.length;
_local2 = 0;
while (_local2 < _local1) {
_local3 = (_columns[_local2] as DataGridColumn);
if (_local3.visible){
contentWidth = (contentWidth + _local3.width);
};
_local2++;
};
if (((!(isNaN(_horizontalScrollPosition))) && (((_horizontalScrollPosition + availableWidth) > contentWidth)))){
setHorizontalScrollPosition((contentWidth - availableWidth));
};
};
}
protected function handleHeaderRendererClick(_arg1:MouseEvent):void{
var _local5:uint;
var _local6:DataGridEvent;
if (!_enabled){
return;
};
var _local2:HeaderRenderer = (_arg1.currentTarget as HeaderRenderer);
var _local3:uint = _local2.column;
var _local4:DataGridColumn = (_columns[_local3] as DataGridColumn);
if (((sortableColumns) && (_local4.sortable))){
_local5 = _sortIndex;
_sortIndex = _local3;
_local6 = new DataGridEvent(DataGridEvent.HEADER_RELEASE, false, true, _local3, -1, _local2, (_local4) ? _local4.dataField : null);
if (((!(dispatchEvent(_local6))) || (!(_selectable)))){
_sortIndex = lastSortIndex;
return;
};
lastSortIndex = _local5;
sortByColumn(_local3);
invalidate(InvalidationType.DATA);
};
}
public function resizeColumn(_arg1:int, _arg2:Number):void{
var _local4:int;
var _local5:Number;
var _local6:int;
var _local7:DataGridColumn;
var _local8:DataGridColumn;
var _local9:int;
var _local10:Number;
var _local11:Number;
var _local12:Number;
if (_columns.length == 0){
return;
};
var _local3:DataGridColumn = (_columns[_arg1] as DataGridColumn);
if (!_local3){
return;
};
if (((!(visibleColumns)) || ((visibleColumns.length == 0)))){
_local3.setWidth(_arg2);
return;
};
if (_arg2 < _local3.minWidth){
_arg2 = _local3.minWidth;
};
if ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((_horizontalScrollPolicy == ScrollPolicy.AUTO)))){
_local3.setWidth(_arg2);
_local3.explicitWidth = _arg2;
} else {
_local4 = getVisibleColumnIndex(_local3);
if (_local4 != -1){
_local5 = 0;
_local6 = visibleColumns.length;
_local9 = (_local4 + 1);
while (_local9 < _local6) {
_local7 = (visibleColumns[_local9] as DataGridColumn);
if (((_local7) && (_local7.resizable))){
_local5 = (_local5 + _local7.width);
};
_local9++;
};
_local11 = ((_local3.width - _arg2) + _local5);
if (_local5){
_local3.setWidth(_arg2);
_local3.explicitWidth = _arg2;
};
_local12 = 0;
_local9 = (_local4 + 1);
while (_local9 < _local6) {
_local7 = (visibleColumns[_local9] as DataGridColumn);
if (_local7.resizable){
_local10 = ((_local7.width * _local11) / _local5);
if (_local10 < _local7.minWidth){
_local10 = _local7.minWidth;
};
_local7.setWidth(_local10);
_local12 = (_local12 + _local7.width);
_local8 = _local7;
};
_local9++;
};
if (_local12 > _local11){
_local10 = ((_local3.width - _local12) + _local11);
if (_local10 < _local3.minWidth){
_local10 = _local3.minWidth;
};
_local3.setWidth(_local10);
} else {
if (_local8){
_local8.setWidth(((_local8.width - _local12) + _local11));
};
};
} else {
_local3.setWidth(_arg2);
_local3.explicitWidth = _arg2;
};
};
columnsInvalid = true;
invalidate(InvalidationType.SIZE);
}
protected function sortByColumn(_arg1:int):void{
var _local2:DataGridColumn = (columns[_arg1] as DataGridColumn);
if (((((!(enabled)) || (!(_local2)))) || (!(_local2.sortable)))){
return;
};
var _local3:Boolean = _local2.sortDescending;
var _local4:uint = _local2.sortOptions;
if (_local3){
_local4 = (_local4 | Array.DESCENDING);
} else {
_local4 = (_local4 & ~(Array.DESCENDING));
};
if (_local2.sortCompareFunction != null){
sortItems(_local2.sortCompareFunction, _local4);
} else {
sortItemsOn(_local2.dataField, _local4);
};
_sortDescending = (_local2.sortDescending = !(_local3));
if ((((lastSortIndex >= 0)) && (!((lastSortIndex == sortIndex))))){
_local2 = (columns[lastSortIndex] as DataGridColumn);
if (_local2 != null){
_local2.sortDescending = false;
};
};
}
protected function createColumnsFromDataProvider():void{
var _local1:Object;
var _local2:String;
_columns = [];
if (length > 0){
_local1 = _dataProvider.getItemAt(0);
for (_local2 in _local1) {
addColumn(_local2);
};
};
}
protected function getVisibleColumnIndex(_arg1:DataGridColumn):int{
var _local2:uint;
while (_local2 < visibleColumns.length) {
if (_arg1 == visibleColumns[_local2]){
return (_local2);
};
_local2++;
};
return (-1);
}
protected function handleHeaderResizeOver(_arg1:MouseEvent):void{
if (columnStretchIndex == -1){
showColumnStretchCursor();
};
}
protected function handleHeaderResizeOut(_arg1:MouseEvent):void{
if (columnStretchIndex == -1){
showColumnStretchCursor(false);
};
}
protected function handleHeaderResizeDown(_arg1:MouseEvent):void{
var _local2:Sprite = (_arg1.currentTarget as Sprite);
var _local3:Number = dragHandlesMap[_local2];
var _local4:DataGridColumn = getColumnAt(_local3);
columnStretchIndex = _local3;
columnStretchStartX = _arg1.stageX;
columnStretchStartWidth = _local4.width;
stage.addEventListener(MouseEvent.MOUSE_MOVE, handleHeaderResizeMove, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, handleHeaderResizeUp, false, 0, true);
}
protected function handleHeaderResizeMove(_arg1:MouseEvent):void{
var _local2:Number = (_arg1.stageX - columnStretchStartX);
var _local3:Number = (columnStretchStartWidth + _local2);
resizeColumn(columnStretchIndex, _local3);
}
protected function handleHeaderResizeUp(_arg1:MouseEvent):void{
var _local4:HeaderRenderer;
var _local2:Sprite = (_arg1.currentTarget as Sprite);
var _local3:DataGridColumn = (_columns[columnStretchIndex] as DataGridColumn);
var _local5:uint;
while (_local5 < header.numChildren) {
_local4 = (header.getChildAt(_local5) as HeaderRenderer);
if (((_local4) && ((_local4.column == columnStretchIndex)))){
break;
};
_local5++;
};
var _local6:DataGridEvent = new DataGridEvent(DataGridEvent.COLUMN_STRETCH, false, true, columnStretchIndex, -1, _local4, (_local3) ? _local3.dataField : null);
dispatchEvent(_local6);
columnStretchIndex = -1;
showColumnStretchCursor(false);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, handleHeaderResizeMove, false);
stage.removeEventListener(MouseEvent.MOUSE_UP, handleHeaderResizeUp, false);
}
protected function showColumnStretchCursor(_arg1:Boolean=true):void{
if (columnStretchCursor == null){
columnStretchCursor = (getDisplayObjectInstance(getStyleValue("columnStretchCursorSkin")) as Sprite);
columnStretchCursor.mouseEnabled = false;
};
if (_arg1){
Mouse.hide();
stage.addChild(columnStretchCursor);
stage.addEventListener(MouseEvent.MOUSE_MOVE, positionColumnStretchCursor, false, 0, true);
columnStretchCursor.x = stage.mouseX;
columnStretchCursor.y = stage.mouseY;
} else {
stage.removeEventListener(MouseEvent.MOUSE_MOVE, positionColumnStretchCursor, false);
if (stage.contains(columnStretchCursor)){
stage.removeChild(columnStretchCursor);
};
Mouse.show();
};
}
protected function positionColumnStretchCursor(_arg1:MouseEvent):void{
columnStretchCursor.x = _arg1.stageX;
columnStretchCursor.y = _arg1.stageY;
}
protected function setEditedItemPosition(_arg1:Object):void{
editedItemPositionChanged = true;
proposedEditedItemPosition = _arg1;
if (((_arg1) && (!((_arg1.rowIndex == selectedIndex))))){
selectedIndex = _arg1.rowIndex;
};
invalidate(InvalidationType.DATA);
}
protected function commitEditedItemPosition(_arg1:Object):void{
var _local4:String;
var _local5:int;
if (((!(enabled)) || (!(editable)))){
return;
};
if (((((((((itemEditorInstance) && (_arg1))) && ((itemEditorInstance is IFocusManagerComponent)))) && ((_editedItemPosition.rowIndex == _arg1.rowIndex)))) && ((_editedItemPosition.columnIndex == _arg1.columnIndex)))){
IFocusManagerComponent(itemEditorInstance).setFocus();
return;
};
if (itemEditorInstance){
if (!_arg1){
_local4 = DataGridEventReason.OTHER;
} else {
if (((!(editedItemPosition)) || ((_arg1.rowIndex == editedItemPosition.rowIndex)))){
_local4 = DataGridEventReason.NEW_COLUMN;
} else {
_local4 = DataGridEventReason.NEW_ROW;
};
};
if (((!(endEdit(_local4))) && (!((_local4 == DataGridEventReason.OTHER))))){
return;
};
};
_editedItemPosition = _arg1;
if (!_arg1){
return;
};
actualRowIndex = _arg1.rowIndex;
actualColIndex = _arg1.columnIndex;
if (displayableColumns.length != _columns.length){
_local5 = 0;
while (_local5 < displayableColumns.length) {
if (displayableColumns[_local5].colNum >= actualColIndex){
actualColIndex = displayableColumns[_local5].colNum;
break;
};
_local5++;
};
if (_local5 == displayableColumns.length){
actualColIndex = 0;
};
};
scrollToPosition(actualRowIndex, actualColIndex);
var _local2:ICellRenderer = getCellRendererAt(actualRowIndex, actualColIndex);
var _local3:DataGridEvent = new DataGridEvent(DataGridEvent.ITEM_EDIT_BEGIN, false, true, actualColIndex, actualRowIndex, _local2);
dispatchEvent(_local3);
if (editedItemPositionChanged){
editedItemPositionChanged = false;
commitEditedItemPosition(proposedEditedItemPosition);
proposedEditedItemPosition = undefined;
};
if (!itemEditorInstance){
commitEditedItemPosition(null);
};
}
protected function itemEditorItemEditBeginningHandler(_arg1:DataGridEvent):void{
if (!_arg1.isDefaultPrevented()){
setEditedItemPosition({columnIndex:_arg1.columnIndex, rowIndex:uint(_arg1.rowIndex)});
} else {
if (!itemEditorInstance){
_editedItemPosition = null;
editable = false;
setFocus();
editable = true;
};
};
}
protected function itemEditorItemEditBeginHandler(_arg1:DataGridEvent):void{
var _local2:IFocusManager;
if (stage){
stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
};
if (!_arg1.isDefaultPrevented()){
createItemEditor(_arg1.columnIndex, uint(_arg1.rowIndex));
ICellRenderer(itemEditorInstance).listData = ICellRenderer(editedItemRenderer).listData;
ICellRenderer(itemEditorInstance).data = editedItemRenderer.data;
itemEditorInstance.imeMode = ((columns[_arg1.columnIndex].imeMode)==null) ? _imeMode : columns[_arg1.columnIndex].imeMode;
_local2 = focusManager;
if ((itemEditorInstance is IFocusManagerComponent)){
_local2.setFocus(InteractiveObject(itemEditorInstance));
};
_local2.defaultButtonEnabled = false;
_arg1 = new DataGridEvent(DataGridEvent.ITEM_FOCUS_IN, false, false, _editedItemPosition.columnIndex, _editedItemPosition.rowIndex, itemEditorInstance);
dispatchEvent(_arg1);
};
}
protected function itemEditorItemEditEndHandler(_arg1:DataGridEvent):void{
var _local2:Boolean;
var _local3:Object;
var _local4:String;
var _local5:Object;
var _local6:String;
var _local7:XML;
var _local8:IFocusManager;
if (!_arg1.isDefaultPrevented()){
_local2 = false;
if (((itemEditorInstance) && (!((_arg1.reason == DataGridEventReason.CANCELLED))))){
_local3 = itemEditorInstance[_columns[_arg1.columnIndex].editorDataField];
_local4 = _columns[_arg1.columnIndex].dataField;
_local5 = _arg1.itemRenderer.data;
_local6 = "";
for each (_local7 in describeType(_local5).variable) {
if (_local4 == _local7.@name.toString()){
_local6 = _local7.@type.toString();
break;
};
};
switch (_local6){
case "String":
if (!(_local3 is String)){
_local3 = _local3.toString();
};
break;
case "uint":
if (!(_local3 is uint)){
_local3 = uint(_local3);
};
break;
case "int":
if (!(_local3 is int)){
_local3 = int(_local3);
};
break;
case "Number":
if (!(_local3 is Number)){
_local3 = Number(_local3);
};
break;
};
if (_local5[_local4] != _local3){
_local2 = true;
_local5[_local4] = _local3;
};
_arg1.itemRenderer.data = _local5;
};
} else {
if (_arg1.reason != DataGridEventReason.OTHER){
if (((itemEditorInstance) && (_editedItemPosition))){
if (selectedIndex != _editedItemPosition.rowIndex){
selectedIndex = _editedItemPosition.rowIndex;
};
_local8 = focusManager;
if ((itemEditorInstance is IFocusManagerComponent)){
_local8.setFocus(InteractiveObject(itemEditorInstance));
};
};
};
};
if ((((_arg1.reason == DataGridEventReason.OTHER)) || (!(_arg1.isDefaultPrevented())))){
destroyItemEditor();
};
}
override protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:Boolean;
var _local3:DataGridColumn;
if (_arg1.target != this){
return;
};
if (losingFocus){
losingFocus = false;
return;
};
setIMEMode(true);
super.focusInHandler(_arg1);
if (((editable) && (!(isPressed)))){
_local2 = !((editedItemPosition == null));
if (!_editedItemPosition){
_editedItemPosition = {rowIndex:0, columnIndex:0};
while (_editedItemPosition.columnIndex < _columns.length) {
_local3 = (_columns[_editedItemPosition.columnIndex] as DataGridColumn);
if (((_local3.editable) && (_local3.visible))){
_local2 = true;
break;
};
_editedItemPosition.columnIndex++;
};
};
if (_local2){
setEditedItemPosition(_editedItemPosition);
};
};
if (editable){
addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
addEventListener(MouseEvent.MOUSE_DOWN, mouseFocusChangeHandler);
};
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
setIMEMode(false);
if (_arg1.target == this){
super.focusOutHandler(_arg1);
};
if ((((_arg1.relatedObject == this)) && (itemRendererContains(itemEditorInstance, DisplayObject(_arg1.target))))){
return;
};
if ((((_arg1.relatedObject == null)) && (itemRendererContains(editedItemRenderer, DisplayObject(_arg1.target))))){
return;
};
if ((((_arg1.relatedObject == null)) && (itemRendererContains(itemEditorInstance, DisplayObject(_arg1.target))))){
return;
};
if (((itemEditorInstance) && (((!(_arg1.relatedObject)) || (!(itemRendererContains(itemEditorInstance, _arg1.relatedObject))))))){
endEdit(DataGridEventReason.OTHER);
removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
removeEventListener(MouseEvent.MOUSE_DOWN, mouseFocusChangeHandler);
};
}
protected function editorMouseDownHandler(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:uint;
if (!itemRendererContains(itemEditorInstance, DisplayObject(_arg1.target))){
if ((((_arg1.target is ICellRenderer)) && (contains(DisplayObject(_arg1.target))))){
_local2 = (_arg1.target as ICellRenderer);
_local3 = _local2.listData.row;
if (_editedItemPosition.rowIndex == _local3){
endEdit(DataGridEventReason.NEW_COLUMN);
} else {
endEdit(DataGridEventReason.NEW_ROW);
};
} else {
endEdit(DataGridEventReason.OTHER);
};
};
}
protected function editorKeyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ESCAPE){
endEdit(DataGridEventReason.CANCELLED);
} else {
if (((_arg1.ctrlKey) && ((_arg1.charCode == 46)))){
endEdit(DataGridEventReason.CANCELLED);
} else {
if ((((_arg1.charCode == Keyboard.ENTER)) && (!((_arg1.keyCode == 229))))){
if (endEdit(DataGridEventReason.NEW_ROW)){
findNextEnterItemRenderer(_arg1);
};
};
};
};
}
protected function findNextItemRenderer(_arg1:Boolean):Boolean{
var _local7:String;
var _local8:DataGridEvent;
if (!_editedItemPosition){
return (false);
};
if (proposedEditedItemPosition !== undefined){
return (false);
};
var _local2:int = _editedItemPosition.rowIndex;
var _local3:int = _editedItemPosition.columnIndex;
var _local4:Boolean;
var _local5:int = (_arg1) ? -1 : 1;
var _local6:int = (length - 1);
while (!(_local4)) {
_local3 = (_local3 + _local5);
if ((((_local3 < 0)) || ((_local3 >= _columns.length)))){
_local3 = ((_local3)<0) ? (_columns.length - 1) : 0;
_local2 = (_local2 + _local5);
if ((((_local2 < 0)) || ((_local2 > _local6)))){
setEditedItemPosition(null);
losingFocus = true;
setFocus();
return (false);
};
};
if (((_columns[_local3].editable) && (_columns[_local3].visible))){
_local4 = true;
if (_local2 == _editedItemPosition.rowIndex){
_local7 = DataGridEventReason.NEW_COLUMN;
} else {
_local7 = DataGridEventReason.NEW_ROW;
};
if (((!(itemEditorInstance)) || (endEdit(_local7)))){
_local8 = new DataGridEvent(DataGridEvent.ITEM_EDIT_BEGINNING, false, true, _local3, _local2);
_local8.dataField = _columns[_local3].dataField;
dispatchEvent(_local8);
};
};
};
return (_local4);
}
protected function findNextEnterItemRenderer(_arg1:KeyboardEvent):void{
if (proposedEditedItemPosition !== undefined){
return;
};
var _local2:int = _editedItemPosition.rowIndex;
var _local3:int = _editedItemPosition.columnIndex;
var _local4:int = (_editedItemPosition.rowIndex + (_arg1.shiftKey) ? -1 : 1);
if ((((_local4 >= 0)) && ((_local4 < length)))){
_local2 = _local4;
};
var _local5:DataGridEvent = new DataGridEvent(DataGridEvent.ITEM_EDIT_BEGINNING, false, true, _local3, _local2);
_local5.dataField = _columns[_local3].dataField;
dispatchEvent(_local5);
}
protected function mouseFocusChangeHandler(_arg1:MouseEvent):void{
if (((((itemEditorInstance) && (!(_arg1.isDefaultPrevented())))) && (itemRendererContains(itemEditorInstance, DisplayObject(_arg1.target))))){
_arg1.preventDefault();
};
}
protected function keyFocusChangeHandler(_arg1:FocusEvent):void{
if ((((((_arg1.keyCode == Keyboard.TAB)) && (!(_arg1.isDefaultPrevented())))) && (findNextItemRenderer(_arg1.shiftKey)))){
_arg1.preventDefault();
};
}
private function itemEditorFocusOutHandler(_arg1:FocusEvent):void{
if (((_arg1.relatedObject) && (contains(_arg1.relatedObject)))){
return;
};
if (!_arg1.relatedObject){
return;
};
if (itemEditorInstance){
endEdit(DataGridEventReason.OTHER);
};
}
protected function deactivateHandler(_arg1:Event):void{
if (itemEditorInstance){
endEdit(DataGridEventReason.OTHER);
losingFocus = true;
setFocus();
};
}
protected function mouseDownHandler(_arg1:MouseEvent):void{
if (((!(enabled)) || (!(selectable)))){
return;
};
isPressed = true;
}
protected function mouseUpHandler(_arg1:MouseEvent):void{
if (((!(enabled)) || (!(selectable)))){
return;
};
isPressed = false;
}
override protected function handleCellRendererClick(_arg1:MouseEvent):void{
var _local3:DataGridColumn;
var _local4:DataGridEvent;
super.handleCellRendererClick(_arg1);
var _local2:ICellRenderer = (_arg1.currentTarget as ICellRenderer);
if (((((_local2) && (_local2.data))) && (!((_local2 == itemEditorInstance))))){
_local3 = (_columns[_local2.listData.column] as DataGridColumn);
if (((((editable) && (_local3))) && (_local3.editable))){
_local4 = new DataGridEvent(DataGridEvent.ITEM_EDIT_BEGINNING, false, true, _local2.listData.column, _local2.listData.row, _local2, _local3.dataField);
dispatchEvent(_local4);
};
};
}
public function createItemEditor(_arg1:uint, _arg2:uint):void{
var _local6:int;
if (displayableColumns.length != _columns.length){
_local6 = 0;
while (_local6 < displayableColumns.length) {
if (displayableColumns[_local6].colNum >= _arg1){
_arg1 = displayableColumns[_local6].colNum;
break;
};
_local6++;
};
if (_local6 == displayableColumns.length){
_arg1 = 0;
};
};
var _local3:DataGridColumn = (_columns[_arg1] as DataGridColumn);
var _local4:ICellRenderer = getCellRendererAt(_arg2, _arg1);
if (!itemEditorInstance){
itemEditorInstance = getDisplayObjectInstance(_local3.itemEditor);
itemEditorInstance.tabEnabled = false;
list.addChild(DisplayObject(itemEditorInstance));
};
list.setChildIndex(DisplayObject(itemEditorInstance), (list.numChildren - 1));
var _local5:Sprite = (_local4 as Sprite);
itemEditorInstance.visible = true;
itemEditorInstance.move(_local5.x, _local5.y);
itemEditorInstance.setSize(_local3.width, rowHeight);
itemEditorInstance.drawNow();
DisplayObject(itemEditorInstance).addEventListener(FocusEvent.FOCUS_OUT, itemEditorFocusOutHandler);
_local5.visible = false;
DisplayObject(itemEditorInstance).addEventListener(KeyboardEvent.KEY_DOWN, editorKeyDownHandler);
stage.addEventListener(MouseEvent.MOUSE_DOWN, editorMouseDownHandler, true, 0, true);
}
public function destroyItemEditor():void{
var _local1:DataGridEvent;
if (itemEditorInstance){
DisplayObject(itemEditorInstance).removeEventListener(KeyboardEvent.KEY_DOWN, editorKeyDownHandler);
stage.removeEventListener(MouseEvent.MOUSE_DOWN, editorMouseDownHandler, true);
_local1 = new DataGridEvent(DataGridEvent.ITEM_FOCUS_OUT, false, false, _editedItemPosition.columnIndex, _editedItemPosition.rowIndex, itemEditorInstance);
dispatchEvent(_local1);
if (((itemEditorInstance) && ((itemEditorInstance is UIComponent)))){
UIComponent(itemEditorInstance).drawFocus(false);
};
list.removeChild(DisplayObject(itemEditorInstance));
DisplayObject(editedItemRenderer).visible = true;
itemEditorInstance = null;
};
}
protected function endEdit(_arg1:String):Boolean{
if (!editedItemRenderer){
return (true);
};
var _local2:DataGridEvent = new DataGridEvent(DataGridEvent.ITEM_EDIT_END, false, true, editedItemPosition.columnIndex, editedItemPosition.rowIndex, editedItemRenderer, _columns[editedItemPosition.columnIndex].dataField, _arg1);
dispatchEvent(_local2);
return (!(_local2.isDefaultPrevented()));
}
public function getCellRendererAt(_arg1:uint, _arg2:uint):ICellRenderer{
var _local4:Array;
var _local5:uint;
var _local6:ICellRenderer;
var _local3:DataGridColumn = (_columns[_arg2] as DataGridColumn);
if (_local3 != null){
_local4 = (activeCellRenderersMap[_local3] as Array);
if (_local4 != null){
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = (_local4[_local5] as ICellRenderer);
if (_local6.listData.row == _arg1){
return (_local6);
};
_local5++;
};
};
};
return (null);
}
protected function itemRendererContains(_arg1:Object, _arg2:DisplayObject):Boolean{
if (((((!(_arg2)) || (!(_arg1)))) || (!((_arg1 is DisplayObjectContainer))))){
return (false);
};
return (DisplayObjectContainer(_arg1).contains(_arg2));
}
override protected function handleDataChange(_arg1:DataChangeEvent):void{
super.handleDataChange(_arg1);
if (_columns == null){
_columns = [];
};
if (_columns.length == 0){
createColumnsFromDataProvider();
};
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (((!(selectable)) || (itemEditorInstance))){
return;
};
switch (_arg1.keyCode){
case Keyboard.UP:
case Keyboard.DOWN:
case Keyboard.END:
case Keyboard.HOME:
case Keyboard.PAGE_UP:
case Keyboard.PAGE_DOWN:
moveSelectionVertically(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
break;
case Keyboard.LEFT:
case Keyboard.RIGHT:
moveSelectionHorizontally(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
break;
case Keyboard.SPACE:
if (caretIndex == -1){
caretIndex = 0;
};
scrollToIndex(caretIndex);
doKeySelection(caretIndex, _arg1.shiftKey, _arg1.ctrlKey);
break;
default:
break;
};
_arg1.stopPropagation();
}
override protected function moveSelectionHorizontally(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
override protected function moveSelectionVertically(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
var _local4:int = Math.max(Math.floor((calculateAvailableHeight() / rowHeight)), 1);
var _local5 = -1;
var _local6:int;
switch (_arg1){
case Keyboard.UP:
if (caretIndex > 0){
_local5 = (caretIndex - 1);
};
break;
case Keyboard.DOWN:
if (caretIndex < (length - 1)){
_local5 = (caretIndex + 1);
};
break;
case Keyboard.PAGE_UP:
if (caretIndex > 0){
_local5 = Math.max((caretIndex - _local4), 0);
};
break;
case Keyboard.PAGE_DOWN:
if (caretIndex < (length - 1)){
_local5 = Math.min((caretIndex + _local4), (length - 1));
};
break;
case Keyboard.HOME:
if (caretIndex > 0){
_local5 = 0;
};
break;
case Keyboard.END:
if (caretIndex < (length - 1)){
_local5 = (length - 1);
};
break;
};
if (_local5 >= 0){
doKeySelection(_local5, _arg2, _arg3);
scrollToSelected();
};
}
override public function scrollToIndex(_arg1:int):void{
var _local4:Number;
drawNow();
var _local2:int = (Math.floor(((_verticalScrollPosition + availableHeight) / rowHeight)) - 1);
var _local3:int = Math.ceil((_verticalScrollPosition / rowHeight));
if (_arg1 < _local3){
verticalScrollPosition = (_arg1 * rowHeight);
} else {
if (_arg1 >= _local2){
_local4 = ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && (hScrollBar))))) ? 15 : 0;
verticalScrollPosition = (((((_arg1 + 1) * rowHeight) - availableHeight) + _local4) + (showHeaders) ? headerHeight : 0);
};
};
}
protected function scrollToPosition(_arg1:int, _arg2:int):void{
var _local5:uint;
var _local8:DataGridColumn;
var _local3:Number = verticalScrollPosition;
var _local4:Number = horizontalScrollPosition;
scrollToIndex(_arg1);
var _local6:Number = 0;
var _local7:DataGridColumn = (_columns[_arg2] as DataGridColumn);
_local5 = 0;
while (_local5 < displayableColumns.length) {
_local8 = (displayableColumns[_local5] as DataGridColumn);
if (_local8 != _local7){
_local6 = (_local6 + _local8.width);
} else {
break;
};
_local5++;
};
if (horizontalScrollPosition > _local6){
horizontalScrollPosition = _local6;
} else {
if ((horizontalScrollPosition + availableWidth) < (_local6 + _local7.width)){
horizontalScrollPosition = -((availableWidth - (_local6 + _local7.width)));
};
};
if (((!((_local3 == verticalScrollPosition))) || (!((_local4 == horizontalScrollPosition))))){
drawNow();
};
}
protected function doKeySelection(_arg1:int, _arg2:Boolean, _arg3:Boolean):void{
var _local5:int;
var _local6:Array;
var _local7:int;
var _local8:int;
var _local4:Boolean;
if (_arg2){
_local6 = [];
_local7 = lastCaretIndex;
_local8 = _arg1;
if (_local7 == -1){
_local7 = ((caretIndex)!=-1) ? caretIndex : _arg1;
};
if (_local7 > _local8){
_local8 = _local7;
_local7 = _arg1;
};
_local5 = _local7;
while (_local5 <= _local8) {
_local6.push(_local5);
_local5++;
};
selectedIndices = _local6;
caretIndex = _arg1;
_local4 = true;
} else {
if (_arg3){
caretIndex = _arg1;
} else {
selectedIndex = _arg1;
caretIndex = (lastCaretIndex = _arg1);
_local4 = true;
};
};
if (_local4){
dispatchEvent(new Event(Event.CHANGE));
};
invalidate(InvalidationType.DATA);
}
override protected function initializeAccessibility():void{
if (DataGrid.createAccessibilityImplementation != null){
DataGrid.createAccessibilityImplementation(this);
};
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, SelectableList.getStyleDefinition(), ScrollBar.getStyleDefinition()));
}
}
}//package fl.controls
Section 97
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.events.*;
import fl.managers.*;
import flash.text.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
public var textField:TextField;
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var _label:String;// = "Label"
protected var mode:String;// = "center"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function get label():String{
return (_label);
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
public function get labelPlacement():String{
return (_labelPlacement);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get toggle():Boolean{
return (_toggle);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function drawIcon():void{
var _local1:DisplayObject = icon;
var _local2:String = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
var _local3:Object = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
protected function drawTextFormat():void{
var _local1:Object = UIComponent.getStyleDefinition();
var _local2:TextFormat = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
var _local3:TextFormat = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
protected function setEmbedFont(){
var _local1:Object = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function drawLayout():void{
var _local7:Number;
var _local8:Number;
var _local1:Number = Number(getStyleValue("textPadding"));
var _local2:String = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
var _local3:Number = (textField.textWidth + 4);
var _local4:Number = (textField.textHeight + 4);
var _local5:Number = ((icon)==null) ? 0 : (icon.width + _local1);
var _local6:Number = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 98
//List (fl.controls.List)
package fl.controls {
import flash.geom.*;
import flash.display.*;
import fl.controls.listClasses.*;
import fl.core.*;
import flash.events.*;
import fl.managers.*;
import flash.utils.*;
import flash.ui.*;
public class List extends SelectableList implements IFocusManagerComponent {
protected var _rowHeight:Number;// = 20
protected var _cellRenderer:Object;
protected var _labelField:String;// = "label"
protected var _labelFunction:Function;
protected var _iconField:String;// = "icon"
protected var _iconFunction:Function;
private static var defaultStyles:Object = {focusRectSkin:null, focusRectPadding:null};
public static var createAccessibilityImplementation:Function;
public function get labelField():String{
return (_labelField);
}
public function set labelField(_arg1:String):void{
if (_arg1 == _labelField){
return;
};
_labelField = _arg1;
invalidate(InvalidationType.DATA);
}
public function get labelFunction():Function{
return (_labelFunction);
}
public function set labelFunction(_arg1:Function):void{
if (_labelFunction == _arg1){
return;
};
_labelFunction = _arg1;
invalidate(InvalidationType.DATA);
}
public function get iconField():String{
return (_iconField);
}
public function set iconField(_arg1:String):void{
if (_arg1 == _iconField){
return;
};
_iconField = _arg1;
invalidate(InvalidationType.DATA);
}
public function get iconFunction():Function{
return (_iconFunction);
}
public function set iconFunction(_arg1:Function):void{
if (_iconFunction == _arg1){
return;
};
_iconFunction = _arg1;
invalidate(InvalidationType.DATA);
}
override public function get rowCount():uint{
return (Math.ceil((calculateAvailableHeight() / rowHeight)));
}
public function set rowCount(_arg1:uint):void{
var _local2:Number = Number(getStyleValue("contentPadding"));
var _local3:Number = ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0;
height = (((rowHeight * _arg1) + (2 * _local2)) + _local3);
}
public function get rowHeight():Number{
return (_rowHeight);
}
public function set rowHeight(_arg1:Number):void{
_rowHeight = _arg1;
invalidate(InvalidationType.SIZE);
}
override public function scrollToIndex(_arg1:int):void{
drawNow();
var _local2:uint = (Math.floor(((_verticalScrollPosition + availableHeight) / rowHeight)) - 1);
var _local3:uint = Math.ceil((_verticalScrollPosition / rowHeight));
if (_arg1 < _local3){
verticalScrollPosition = (_arg1 * rowHeight);
} else {
if (_arg1 > _local2){
verticalScrollPosition = (((_arg1 + 1) * rowHeight) - availableHeight);
};
};
}
override protected function configUI():void{
useFixedHorizontalScrolling = true;
_horizontalScrollPolicy = ScrollPolicy.AUTO;
_verticalScrollPolicy = ScrollPolicy.AUTO;
super.configUI();
}
protected function calculateAvailableHeight():Number{
var _local1:Number = Number(getStyleValue("contentPadding"));
return (((height - (_local1 * 2)) - ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0));
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
list.x = -(_arg1);
super.setHorizontalScrollPosition(_arg1, true);
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
invalidate(InvalidationType.SCROLL);
super.setVerticalScrollPosition(_arg1, true);
}
override protected function draw():void{
var _local1 = !((contentHeight == (rowHeight * length)));
contentHeight = (rowHeight * length);
if (isInvalid(InvalidationType.STYLES)){
setStyles();
drawBackground();
if (contentPadding != getStyleValue("contentPadding")){
invalidate(InvalidationType.SIZE, false);
};
if (_cellRenderer != getStyleValue("cellRenderer")){
_invalidateList();
_cellRenderer = getStyleValue("cellRenderer");
};
};
if (((isInvalid(InvalidationType.SIZE, InvalidationType.STATE)) || (_local1))){
drawLayout();
};
if (isInvalid(InvalidationType.RENDERER_STYLES)){
updateRendererStyles();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.SIZE, InvalidationType.DATA, InvalidationType.SCROLL, InvalidationType.SELECTED)){
drawList();
};
updateChildren();
validate();
}
override protected function drawList():void{
var _local4:uint;
var _local5:Object;
var _local6:ICellRenderer;
var _local9:Boolean;
var _local10:String;
var _local11:Object;
var _local12:Sprite;
var _local13:String;
listHolder.x = (listHolder.y = contentPadding);
var _local1:Rectangle = listHolder.scrollRect;
_local1.x = _horizontalScrollPosition;
_local1.y = (Math.floor(_verticalScrollPosition) % rowHeight);
listHolder.scrollRect = _local1;
listHolder.cacheAsBitmap = useBitmapScrolling;
var _local2:uint = Math.floor((_verticalScrollPosition / rowHeight));
var _local3:uint = Math.min(length, ((_local2 + rowCount) + 1));
var _local7:Dictionary = (renderedItems = new Dictionary(true));
_local4 = _local2;
while (_local4 < _local3) {
_local7[_dataProvider.getItemAt(_local4)] = true;
_local4++;
};
var _local8:Dictionary = new Dictionary(true);
while (activeCellRenderers.length > 0) {
_local6 = (activeCellRenderers.pop() as ICellRenderer);
_local5 = _local6.data;
if ((((_local7[_local5] == null)) || ((invalidItems[_local5] == true)))){
availableCellRenderers.push(_local6);
} else {
_local8[_local5] = _local6;
invalidItems[_local5] = true;
};
list.removeChild((_local6 as DisplayObject));
};
invalidItems = new Dictionary(true);
_local4 = _local2;
while (_local4 < _local3) {
_local9 = false;
_local5 = _dataProvider.getItemAt(_local4);
if (_local8[_local5] != null){
_local9 = true;
_local6 = _local8[_local5];
delete _local8[_local5];
} else {
if (availableCellRenderers.length > 0){
_local6 = (availableCellRenderers.pop() as ICellRenderer);
} else {
_local6 = (getDisplayObjectInstance(getStyleValue("cellRenderer")) as ICellRenderer);
_local12 = (_local6 as Sprite);
if (_local12 != null){
_local12.addEventListener(MouseEvent.CLICK, handleCellRendererClick, false, 0, true);
_local12.addEventListener(MouseEvent.ROLL_OVER, handleCellRendererMouseEvent, false, 0, true);
_local12.addEventListener(MouseEvent.ROLL_OUT, handleCellRendererMouseEvent, false, 0, true);
_local12.addEventListener(Event.CHANGE, handleCellRendererChange, false, 0, true);
_local12.doubleClickEnabled = true;
_local12.addEventListener(MouseEvent.DOUBLE_CLICK, handleCellRendererDoubleClick, false, 0, true);
if (_local12.hasOwnProperty("setStyle")){
for (_local13 in rendererStyles) {
var _local16 = _local12;
_local16["setStyle"](_local13, rendererStyles[_local13]);
};
};
};
};
};
list.addChild((_local6 as Sprite));
activeCellRenderers.push(_local6);
_local6.y = (rowHeight * (_local4 - _local2));
_local6.setSize((availableWidth + _maxHorizontalScrollPosition), rowHeight);
_local10 = itemToLabel(_local5);
_local11 = null;
if (_iconFunction != null){
_local11 = _iconFunction(_local5);
} else {
if (_iconField != null){
_local11 = _local5[_iconField];
};
};
if (!_local9){
_local6.data = _local5;
};
_local6.listData = new ListData(_local10, _local11, this, _local4, _local4, 0);
_local6.selected = !((_selectedIndices.indexOf(_local4) == -1));
if ((_local6 is UIComponent)){
(_local6 as UIComponent).drawNow();
};
_local4++;
};
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:int;
if (!selectable){
return;
};
switch (_arg1.keyCode){
case Keyboard.UP:
case Keyboard.DOWN:
case Keyboard.END:
case Keyboard.HOME:
case Keyboard.PAGE_UP:
case Keyboard.PAGE_DOWN:
moveSelectionVertically(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
break;
case Keyboard.LEFT:
case Keyboard.RIGHT:
moveSelectionHorizontally(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
break;
case Keyboard.SPACE:
if (caretIndex == -1){
caretIndex = 0;
};
doKeySelection(caretIndex, _arg1.shiftKey, _arg1.ctrlKey);
scrollToSelected();
break;
default:
_local2 = getNextIndexAtLetter(String.fromCharCode(_arg1.keyCode), selectedIndex);
if (_local2 > -1){
selectedIndex = _local2;
scrollToSelected();
};
break;
};
_arg1.stopPropagation();
}
override protected function moveSelectionHorizontally(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
override protected function moveSelectionVertically(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
var _local4:int = Math.max(Math.floor((calculateAvailableHeight() / rowHeight)), 1);
var _local5 = -1;
var _local6:int;
switch (_arg1){
case Keyboard.UP:
if (caretIndex > 0){
_local5 = (caretIndex - 1);
};
break;
case Keyboard.DOWN:
if (caretIndex < (length - 1)){
_local5 = (caretIndex + 1);
};
break;
case Keyboard.PAGE_UP:
if (caretIndex > 0){
_local5 = Math.max((caretIndex - _local4), 0);
};
break;
case Keyboard.PAGE_DOWN:
if (caretIndex < (length - 1)){
_local5 = Math.min((caretIndex + _local4), (length - 1));
};
break;
case Keyboard.HOME:
if (caretIndex > 0){
_local5 = 0;
};
break;
case Keyboard.END:
if (caretIndex < (length - 1)){
_local5 = (length - 1);
};
break;
};
if (_local5 >= 0){
doKeySelection(_local5, _arg2, _arg3);
scrollToSelected();
};
}
protected function doKeySelection(_arg1:int, _arg2:Boolean, _arg3:Boolean):void{
var _local5:int;
var _local6:Array;
var _local7:int;
var _local8:int;
var _local4:Boolean;
if (_arg2){
_local6 = [];
_local7 = lastCaretIndex;
_local8 = _arg1;
if (_local7 == -1){
_local7 = ((caretIndex)!=-1) ? caretIndex : _arg1;
};
if (_local7 > _local8){
_local8 = _local7;
_local7 = _arg1;
};
_local5 = _local7;
while (_local5 <= _local8) {
_local6.push(_local5);
_local5++;
};
selectedIndices = _local6;
caretIndex = _arg1;
_local4 = true;
} else {
selectedIndex = _arg1;
caretIndex = (lastCaretIndex = _arg1);
_local4 = true;
};
if (_local4){
dispatchEvent(new Event(Event.CHANGE));
};
invalidate(InvalidationType.DATA);
}
override public function itemToLabel(_arg1:Object):String{
if (_labelFunction != null){
return (String(_labelFunction(_arg1)));
};
return (((_arg1[_labelField])!=null) ? String(_arg1[_labelField]) : "");
}
override protected function initializeAccessibility():void{
if (List.createAccessibilityImplementation != null){
List.createAccessibilityImplementation(this);
};
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, SelectableList.getStyleDefinition()));
}
}
}//package fl.controls
Section 99
//ScrollBar (fl.controls.ScrollBar)
package fl.controls {
import fl.core.*;
import flash.events.*;
import fl.events.*;
public class ScrollBar extends UIComponent {
private var _pageSize:Number;// = 10
private var _pageScrollSize:Number;// = 0
private var _lineScrollSize:Number;// = 1
private var _minScrollPosition:Number;// = 0
private var _maxScrollPosition:Number;// = 0
private var _scrollPosition:Number;// = 0
private var _direction:String;// = "vertical"
private var thumbScrollOffset:Number;
protected var inDrag:Boolean;// = false
protected var upArrow:BaseButton;
protected var downArrow:BaseButton;
protected var thumb:LabelButton;
protected var track:BaseButton;
public static const WIDTH:Number = 15;
protected static const DOWN_ARROW_STYLES:Object = {disabledSkin:"downArrowDisabledSkin", downSkin:"downArrowDownSkin", overSkin:"downArrowOverSkin", upSkin:"downArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const THUMB_STYLES:Object = {disabledSkin:"thumbDisabledSkin", downSkin:"thumbDownSkin", overSkin:"thumbOverSkin", upSkin:"thumbUpSkin", icon:"thumbIcon", textPadding:0};
protected static const TRACK_STYLES:Object = {disabledSkin:"trackDisabledSkin", downSkin:"trackDownSkin", overSkin:"trackOverSkin", upSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const UP_ARROW_STYLES:Object = {disabledSkin:"upArrowDisabledSkin", downSkin:"upArrowDownSkin", overSkin:"upArrowOverSkin", upSkin:"upArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {downArrowDisabledSkin:"ScrollArrowDown_disabledSkin", downArrowDownSkin:"ScrollArrowDown_downSkin", downArrowOverSkin:"ScrollArrowDown_overSkin", downArrowUpSkin:"ScrollArrowDown_upSkin", thumbDisabledSkin:"ScrollThumb_upSkin", thumbDownSkin:"ScrollThumb_downSkin", thumbOverSkin:"ScrollThumb_overSkin", thumbUpSkin:"ScrollThumb_upSkin", trackDisabledSkin:"ScrollTrack_skin", trackDownSkin:"ScrollTrack_skin", trackOverSkin:"ScrollTrack_skin", trackUpSkin:"ScrollTrack_skin", upArrowDisabledSkin:"ScrollArrowUp_disabledSkin", upArrowDownSkin:"ScrollArrowUp_downSkin", upArrowOverSkin:"ScrollArrowUp_overSkin", upArrowUpSkin:"ScrollArrowUp_upSkin", thumbIcon:"ScrollBar_thumbIcon", repeatDelay:500, repeatInterval:35};
public function ScrollBar(){
setStyles();
focusEnabled = false;
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if (_direction == ScrollBarDirection.HORIZONTAL){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
}
override public function get width():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.height : super.width);
}
override public function get height():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.width : super.height);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
downArrow.enabled = (track.enabled = (thumb.enabled = (upArrow.enabled = ((enabled) && ((_maxScrollPosition > _minScrollPosition))))));
updateThumb();
}
public function setScrollProperties(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0):void{
this.pageSize = _arg1;
_minScrollPosition = _arg2;
_maxScrollPosition = _arg3;
if (_arg4 >= 0){
_pageScrollSize = _arg4;
};
enabled = (_maxScrollPosition > _minScrollPosition);
setScrollPosition(_scrollPosition, false);
updateThumb();
}
public function get scrollPosition():Number{
return (_scrollPosition);
}
public function set scrollPosition(_arg1:Number):void{
setScrollPosition(_arg1, true);
}
public function get minScrollPosition():Number{
return (_minScrollPosition);
}
public function set minScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _arg1, _maxScrollPosition);
}
public function get maxScrollPosition():Number{
return (_maxScrollPosition);
}
public function set maxScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _minScrollPosition, _arg1);
}
public function get pageSize():Number{
return (_pageSize);
}
public function set pageSize(_arg1:Number):void{
if (_arg1 > 0){
_pageSize = _arg1;
};
}
public function get pageScrollSize():Number{
return (((_pageScrollSize)==0) ? _pageSize : _pageScrollSize);
}
public function set pageScrollSize(_arg1:Number):void{
if (_arg1 >= 0){
_pageScrollSize = _arg1;
};
}
public function get lineScrollSize():Number{
return (_lineScrollSize);
}
public function set lineScrollSize(_arg1:Number):void{
if (_arg1 > 0){
_lineScrollSize = _arg1;
};
}
public function get direction():String{
return (_direction);
}
public function set direction(_arg1:String):void{
if (_direction == _arg1){
return;
};
_direction = _arg1;
if (isLivePreview){
return;
};
setScaleY(1);
var _local2 = (_direction == ScrollBarDirection.HORIZONTAL);
if (((_local2) && (componentInspectorSetting))){
if (rotation == 90){
return;
};
setScaleX(-1);
rotation = -90;
};
if (!componentInspectorSetting){
if (((_local2) && ((rotation == 0)))){
rotation = -90;
setScaleX(-1);
} else {
if (((!(_local2)) && ((rotation == -90)))){
rotation = 0;
setScaleX(1);
};
};
};
invalidate(InvalidationType.SIZE);
}
override protected function configUI():void{
super.configUI();
track = new BaseButton();
track.move(0, 14);
track.useHandCursor = false;
track.autoRepeat = true;
track.focusEnabled = false;
addChild(track);
thumb = new LabelButton();
thumb.label = "";
thumb.setSize(WIDTH, 15);
thumb.move(0, 15);
thumb.focusEnabled = false;
addChild(thumb);
downArrow = new BaseButton();
downArrow.setSize(WIDTH, 14);
downArrow.autoRepeat = true;
downArrow.focusEnabled = false;
addChild(downArrow);
upArrow = new BaseButton();
upArrow.setSize(WIDTH, 14);
upArrow.move(0, 0);
upArrow.autoRepeat = true;
upArrow.focusEnabled = false;
addChild(upArrow);
upArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
downArrow.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
track.addEventListener(ComponentEvent.BUTTON_DOWN, scrollPressHandler, false, 0, true);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true);
enabled = false;
}
override protected function draw():void{
var _local1:Number;
if (isInvalid(InvalidationType.SIZE)){
_local1 = super.height;
downArrow.move(0, Math.max(upArrow.height, (_local1 - downArrow.height)));
track.setSize(WIDTH, Math.max(0, (_local1 - (downArrow.height + upArrow.height))));
updateThumb();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
setStyles();
};
downArrow.drawNow();
upArrow.drawNow();
track.drawNow();
thumb.drawNow();
validate();
}
protected function scrollPressHandler(_arg1:ComponentEvent):void{
var _local2:Number;
var _local3:Number;
_arg1.stopImmediatePropagation();
if (_arg1.currentTarget == upArrow){
setScrollPosition((_scrollPosition - _lineScrollSize));
} else {
if (_arg1.currentTarget == downArrow){
setScrollPosition((_scrollPosition + _lineScrollSize));
} else {
_local2 = (((track.mouseY / track.height) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition);
_local3 = ((pageScrollSize)==0) ? pageSize : pageScrollSize;
if (_scrollPosition < _local2){
setScrollPosition(Math.min(_local2, (_scrollPosition + _local3)));
} else {
if (_scrollPosition > _local2){
setScrollPosition(Math.max(_local2, (_scrollPosition - _local3)));
};
};
};
};
}
protected function thumbPressHandler(_arg1:MouseEvent):void{
inDrag = true;
thumbScrollOffset = (mouseY - thumb.y);
thumb.mouseStateLocked = true;
mouseChildren = false;
stage.addEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true);
}
protected function handleThumbDrag(_arg1:MouseEvent):void{
var _local2:Number = Math.max(0, Math.min((track.height - thumb.height), ((mouseY - track.y) - thumbScrollOffset)));
setScrollPosition((((_local2 / (track.height - thumb.height)) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition));
}
protected function thumbReleaseHandler(_arg1:MouseEvent):void{
inDrag = false;
mouseChildren = true;
thumb.mouseStateLocked = false;
stage.removeEventListener(MouseEvent.MOUSE_MOVE, handleThumbDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler);
}
public function setScrollPosition(_arg1:Number, _arg2:Boolean=true):void{
var _local3:Number = scrollPosition;
_scrollPosition = Math.max(_minScrollPosition, Math.min(_maxScrollPosition, _arg1));
if (_local3 == _scrollPosition){
return;
};
if (_arg2){
dispatchEvent(new ScrollEvent(_direction, (scrollPosition - _local3), scrollPosition));
};
updateThumb();
}
protected function setStyles():void{
copyStylesToChild(downArrow, DOWN_ARROW_STYLES);
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
copyStylesToChild(upArrow, UP_ARROW_STYLES);
}
protected function updateThumb():void{
var _local1:Number = ((_maxScrollPosition - _minScrollPosition) + _pageSize);
if ((((((track.height <= 12)) || ((_maxScrollPosition <= _minScrollPosition)))) || ((((_local1 == 0)) || (isNaN(_local1)))))){
thumb.height = 12;
thumb.visible = false;
} else {
thumb.height = Math.max(13, ((_pageSize / _local1) * track.height));
thumb.y = (track.y + ((track.height - thumb.height) * ((_scrollPosition - _minScrollPosition) / (_maxScrollPosition - _minScrollPosition))));
thumb.visible = enabled;
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 100
//ScrollBarDirection (fl.controls.ScrollBarDirection)
package fl.controls {
public class ScrollBarDirection {
public static const VERTICAL:String = "vertical";
public static const HORIZONTAL:String = "horizontal";
}
}//package fl.controls
Section 101
//ScrollPolicy (fl.controls.ScrollPolicy)
package fl.controls {
public class ScrollPolicy {
public static const ON:String = "on";
public static const AUTO:String = "auto";
public static const OFF:String = "off";
}
}//package fl.controls
Section 102
//SelectableList (fl.controls.SelectableList)
package fl.controls {
import flash.display.*;
import fl.controls.listClasses.*;
import fl.core.*;
import flash.events.*;
import fl.data.*;
import fl.events.*;
import fl.managers.*;
import flash.utils.*;
import fl.containers.*;
import flash.ui.*;
public class SelectableList extends BaseScrollPane implements IFocusManagerComponent {
protected var listHolder:Sprite;
protected var list:Sprite;
protected var _dataProvider:DataProvider;
protected var activeCellRenderers:Array;
protected var availableCellRenderers:Array;
protected var renderedItems:Dictionary;
protected var invalidItems:Dictionary;
protected var _horizontalScrollPosition:Number;
protected var _verticalScrollPosition:Number;
protected var _allowMultipleSelection:Boolean;// = false
protected var _selectable:Boolean;// = true
protected var _selectedIndices:Array;
protected var caretIndex:int;// = -1
protected var lastCaretIndex:int;// = -1
protected var preChangeItems:Array;
private var collectionItemImport:SimpleCollectionItem;
protected var rendererStyles:Object;
protected var updatedRendererStyles:Object;
private static var defaultStyles:Object = {skin:"List_skin", cellRenderer:CellRenderer, contentPadding:null, disabledAlpha:null};
public static var createAccessibilityImplementation:Function;
public function SelectableList(){
activeCellRenderers = [];
availableCellRenderers = [];
invalidItems = new Dictionary(true);
renderedItems = new Dictionary(true);
_selectedIndices = [];
if (dataProvider == null){
dataProvider = new DataProvider();
};
verticalScrollPolicy = ScrollPolicy.AUTO;
rendererStyles = {};
updatedRendererStyles = {};
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
list.mouseChildren = _enabled;
}
public function get dataProvider():DataProvider{
return (_dataProvider);
}
public function set dataProvider(_arg1:DataProvider):void{
if (_dataProvider != null){
_dataProvider.removeEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange);
_dataProvider.removeEventListener(DataChangeEvent.PRE_DATA_CHANGE, onPreChange);
};
_dataProvider = _arg1;
_dataProvider.addEventListener(DataChangeEvent.DATA_CHANGE, handleDataChange, false, 0, true);
_dataProvider.addEventListener(DataChangeEvent.PRE_DATA_CHANGE, onPreChange, false, 0, true);
clearSelection();
invalidateList();
}
override public function get maxHorizontalScrollPosition():Number{
return (_maxHorizontalScrollPosition);
}
public function set maxHorizontalScrollPosition(_arg1:Number):void{
_maxHorizontalScrollPosition = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get length():uint{
return (_dataProvider.length);
}
public function get allowMultipleSelection():Boolean{
return (_allowMultipleSelection);
}
public function set allowMultipleSelection(_arg1:Boolean):void{
if (_arg1 == _allowMultipleSelection){
return;
};
_allowMultipleSelection = _arg1;
if (((!(_arg1)) && ((_selectedIndices.length > 1)))){
_selectedIndices = [_selectedIndices.pop()];
invalidate(InvalidationType.DATA);
};
}
public function get selectable():Boolean{
return (_selectable);
}
public function set selectable(_arg1:Boolean):void{
if (_arg1 == _selectable){
return;
};
if (!_arg1){
selectedIndices = [];
};
_selectable = _arg1;
}
public function get selectedIndex():int{
return (((_selectedIndices.length)==0) ? -1 : _selectedIndices[(_selectedIndices.length - 1)]);
}
public function set selectedIndex(_arg1:int):void{
selectedIndices = ((_arg1)==-1) ? null : [_arg1];
}
public function get selectedIndices():Array{
return (_selectedIndices.concat());
}
public function set selectedIndices(_arg1:Array):void{
if (!_selectable){
return;
};
_selectedIndices = ((_arg1)==null) ? [] : _arg1.concat();
invalidate(InvalidationType.SELECTED);
}
public function get selectedItem():Object{
return (((_selectedIndices.length)==0) ? null : _dataProvider.getItemAt(selectedIndex));
}
public function set selectedItem(_arg1:Object):void{
var _local2:int = _dataProvider.getItemIndex(_arg1);
selectedIndex = _local2;
}
public function get selectedItems():Array{
var _local1:Array = [];
var _local2:uint;
while (_local2 < _selectedIndices.length) {
_local1.push(_dataProvider.getItemAt(_selectedIndices[_local2]));
_local2++;
};
return (_local1);
}
public function set selectedItems(_arg1:Array):void{
var _local4:int;
if (_arg1 == null){
selectedIndices = null;
return;
};
var _local2:Array = [];
var _local3:uint;
while (_local3 < _arg1.length) {
_local4 = _dataProvider.getItemIndex(_arg1[_local3]);
if (_local4 != -1){
_local2.push(_local4);
};
_local3++;
};
selectedIndices = _local2;
}
public function get rowCount():uint{
return (0);
}
public function clearSelection():void{
selectedIndex = -1;
}
public function itemToCellRenderer(_arg1:Object):ICellRenderer{
var _local2:*;
var _local3:ICellRenderer;
if (_arg1 != null){
for (_local2 in activeCellRenderers) {
_local3 = (activeCellRenderers[_local2] as ICellRenderer);
if (_local3.data == _arg1){
return (_local3);
};
};
};
return (null);
}
public function addItem(_arg1:Object):void{
_dataProvider.addItem(_arg1);
invalidateList();
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
_dataProvider.addItemAt(_arg1, _arg2);
invalidateList();
}
public function removeAll():void{
_dataProvider.removeAll();
}
public function getItemAt(_arg1:uint):Object{
return (_dataProvider.getItemAt(_arg1));
}
public function removeItem(_arg1:Object):Object{
return (_dataProvider.removeItem(_arg1));
}
public function removeItemAt(_arg1:uint):Object{
return (_dataProvider.removeItemAt(_arg1));
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
return (_dataProvider.replaceItemAt(_arg1, _arg2));
}
public function invalidateList():void{
_invalidateList();
invalidate(InvalidationType.DATA);
}
public function invalidateItem(_arg1:Object):void{
if (renderedItems[_arg1] == null){
return;
};
invalidItems[_arg1] = true;
invalidate(InvalidationType.DATA);
}
public function invalidateItemAt(_arg1:uint):void{
var _local2:Object = _dataProvider.getItemAt(_arg1);
if (_local2 != null){
invalidateItem(_local2);
};
}
public function sortItems(... _args){
return (_dataProvider.sort.apply(_dataProvider, _args));
}
public function sortItemsOn(_arg1:String, _arg2:Object=null){
return (_dataProvider.sortOn(_arg1, _arg2));
}
public function isItemSelected(_arg1:Object):Boolean{
return ((selectedItems.indexOf(_arg1) > -1));
}
public function scrollToSelected():void{
scrollToIndex(selectedIndex);
}
public function scrollToIndex(_arg1:int):void{
}
public function getNextIndexAtLetter(_arg1:String, _arg2:int=-1):int{
var _local5:Number;
var _local6:Object;
var _local7:String;
if (length == 0){
return (-1);
};
_arg1 = _arg1.toUpperCase();
var _local3:int = (length - 1);
var _local4:Number = 0;
while (_local4 < _local3) {
_local5 = ((_arg2 + 1) + _local4);
if (_local5 > (length - 1)){
_local5 = (_local5 - length);
};
_local6 = getItemAt(_local5);
if (_local6 == null){
break;
};
_local7 = itemToLabel(_local6);
if (_local7 == null){
} else {
if (_local7.charAt(0).toUpperCase() == _arg1){
return (_local5);
};
};
_local4++;
};
return (-1);
}
public function itemToLabel(_arg1:Object):String{
return (_arg1["label"]);
}
public function setRendererStyle(_arg1:String, _arg2:Object, _arg3:uint=0):void{
if (rendererStyles[_arg1] == _arg2){
return;
};
updatedRendererStyles[_arg1] = _arg2;
rendererStyles[_arg1] = _arg2;
invalidate(InvalidationType.RENDERER_STYLES);
}
public function getRendererStyle(_arg1:String, _arg2:int=-1):Object{
return (rendererStyles[_arg1]);
}
public function clearRendererStyle(_arg1:String, _arg2:int=-1):void{
delete rendererStyles[_arg1];
updatedRendererStyles[_arg1] = null;
invalidate(InvalidationType.RENDERER_STYLES);
}
override protected function configUI():void{
super.configUI();
listHolder = new Sprite();
addChild(listHolder);
listHolder.scrollRect = contentScrollRect;
list = new Sprite();
listHolder.addChild(list);
}
protected function _invalidateList():void{
availableCellRenderers = [];
while (activeCellRenderers.length > 0) {
list.removeChild((activeCellRenderers.pop() as DisplayObject));
};
}
protected function handleDataChange(_arg1:DataChangeEvent):void{
var _local5:uint;
var _local2:int = _arg1.startIndex;
var _local3:int = _arg1.endIndex;
var _local4:String = _arg1.changeType;
if (_local4 == DataChangeType.INVALIDATE_ALL){
clearSelection();
invalidateList();
} else {
if (_local4 == DataChangeType.INVALIDATE){
_local5 = 0;
while (_local5 < _arg1.items.length) {
invalidateItem(_arg1.items[_local5]);
_local5++;
};
} else {
if (_local4 == DataChangeType.ADD){
_local5 = 0;
while (_local5 < _selectedIndices.length) {
if (_selectedIndices[_local5] >= _local2){
_selectedIndices[_local5] = (_selectedIndices[_local5] + (_local2 - _local3));
};
_local5++;
};
} else {
if (_local4 == DataChangeType.REMOVE){
_local5 = 0;
while (_local5 < _selectedIndices.length) {
if (_selectedIndices[_local5] >= _local2){
if (_selectedIndices[_local5] <= _local3){
delete _selectedIndices[_local5];
} else {
_selectedIndices[_local5] = (_selectedIndices[_local5] - ((_local2 - _local3) + 1));
};
};
_local5++;
};
} else {
if (_local4 == DataChangeType.REMOVE_ALL){
clearSelection();
} else {
if (_local4 == DataChangeType.REPLACE){
} else {
selectedItems = preChangeItems;
preChangeItems = null;
};
};
};
};
};
};
invalidate(InvalidationType.DATA);
}
protected function handleCellRendererMouseEvent(_arg1:MouseEvent):void{
var _local2:ICellRenderer = (_arg1.target as ICellRenderer);
var _local3:String = ((_arg1.type)==MouseEvent.ROLL_OVER) ? ListEvent.ITEM_ROLL_OVER : ListEvent.ITEM_ROLL_OUT;
dispatchEvent(new ListEvent(_local3, false, false, _local2.listData.column, _local2.listData.row, _local2.listData.index, _local2.data));
}
protected function handleCellRendererClick(_arg1:MouseEvent):void{
var _local5:int;
var _local6:uint;
if (!_enabled){
return;
};
var _local2:ICellRenderer = (_arg1.currentTarget as ICellRenderer);
var _local3:uint = _local2.listData.index;
if (((!(dispatchEvent(new ListEvent(ListEvent.ITEM_CLICK, false, true, _local2.listData.column, _local2.listData.row, _local3, _local2.data)))) || (!(_selectable)))){
return;
};
var _local4:int = selectedIndices.indexOf(_local3);
if (!_allowMultipleSelection){
if (_local4 != -1){
return;
};
_local2.selected = true;
_selectedIndices = [_local3];
lastCaretIndex = (caretIndex = _local3);
} else {
if (_arg1.shiftKey){
_local6 = ((_selectedIndices.length)>0) ? _selectedIndices[0] : _local3;
_selectedIndices = [];
if (_local6 > _local3){
_local5 = _local6;
while (_local5 >= _local3) {
_selectedIndices.push(_local5);
_local5--;
};
} else {
_local5 = _local6;
while (_local5 <= _local3) {
_selectedIndices.push(_local5);
_local5++;
};
};
caretIndex = _local3;
} else {
if (_arg1.ctrlKey){
if (_local4 != -1){
_local2.selected = false;
_selectedIndices.splice(_local4, 1);
} else {
_local2.selected = true;
_selectedIndices.push(_local3);
};
caretIndex = _local3;
} else {
_selectedIndices = [_local3];
lastCaretIndex = (caretIndex = _local3);
};
};
};
dispatchEvent(new Event(Event.CHANGE));
invalidate(InvalidationType.DATA);
}
protected function handleCellRendererChange(_arg1:Event):void{
var _local2:ICellRenderer = (_arg1.currentTarget as ICellRenderer);
var _local3:uint = _local2.listData.index;
_dataProvider.invalidateItemAt(_local3);
}
protected function handleCellRendererDoubleClick(_arg1:MouseEvent):void{
if (!_enabled){
return;
};
var _local2:ICellRenderer = (_arg1.currentTarget as ICellRenderer);
var _local3:uint = _local2.listData.index;
dispatchEvent(new ListEvent(ListEvent.ITEM_DOUBLE_CLICK, false, true, _local2.listData.column, _local2.listData.row, _local3, _local2.data));
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
if (_arg1 == _horizontalScrollPosition){
return;
};
var _local3:Number = (_arg1 - _horizontalScrollPosition);
_horizontalScrollPosition = _arg1;
if (_arg2){
dispatchEvent(new ScrollEvent(ScrollBarDirection.HORIZONTAL, _local3, _arg1));
};
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
if (_arg1 == _verticalScrollPosition){
return;
};
var _local3:Number = (_arg1 - _verticalScrollPosition);
_verticalScrollPosition = _arg1;
if (_arg2){
dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL, _local3, _arg1));
};
}
override protected function draw():void{
super.draw();
}
override protected function drawLayout():void{
super.drawLayout();
contentScrollRect = listHolder.scrollRect;
contentScrollRect.width = availableWidth;
contentScrollRect.height = availableHeight;
listHolder.scrollRect = contentScrollRect;
}
protected function updateRendererStyles():void{
var _local4:String;
var _local1:Array = availableCellRenderers.concat(activeCellRenderers);
var _local2:uint = _local1.length;
var _local3:uint;
while (_local3 < _local2) {
if (_local1[_local3].setStyle == null){
} else {
for (_local4 in updatedRendererStyles) {
_local1[_local3].setStyle(_local4, updatedRendererStyles[_local4]);
};
_local1[_local3].drawNow();
};
_local3++;
};
updatedRendererStyles = {};
}
protected function drawList():void{
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!selectable){
return;
};
switch (_arg1.keyCode){
case Keyboard.UP:
case Keyboard.DOWN:
case Keyboard.END:
case Keyboard.HOME:
case Keyboard.PAGE_UP:
case Keyboard.PAGE_DOWN:
moveSelectionVertically(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
_arg1.stopPropagation();
break;
case Keyboard.LEFT:
case Keyboard.RIGHT:
moveSelectionHorizontally(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
_arg1.stopPropagation();
break;
};
}
protected function moveSelectionHorizontally(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
protected function moveSelectionVertically(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
override protected function initializeAccessibility():void{
if (SelectableList.createAccessibilityImplementation != null){
SelectableList.createAccessibilityImplementation(this);
};
}
protected function onPreChange(_arg1:DataChangeEvent):void{
switch (_arg1.changeType){
case DataChangeType.REMOVE:
case DataChangeType.ADD:
case DataChangeType.INVALIDATE:
case DataChangeType.REMOVE_ALL:
case DataChangeType.REPLACE:
case DataChangeType.INVALIDATE_ALL:
break;
default:
preChangeItems = selectedItems;
break;
};
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseScrollPane.getStyleDefinition()));
}
}
}//package fl.controls
Section 103
//Slider (fl.controls.Slider)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.events.*;
import fl.managers.*;
import flash.ui.*;
public class Slider extends UIComponent implements IFocusManagerComponent {
protected var _direction:String;
protected var _minimum:Number;// = 0
protected var _maximum:Number;// = 10
protected var _value:Number;// = 0
protected var _tickInterval:Number;// = 0
protected var _snapInterval:Number;// = 0
protected var _liveDragging:Boolean;// = false
protected var tickContainer:Sprite;
protected var thumb:BaseButton;
protected var track:BaseButton;
protected static const TRACK_STYLES:Object = {upSkin:"sliderTrackSkin", overSkin:"sliderTrackSkin", downSkin:"sliderTrackSkin", disabledSkin:"sliderTrackDisabledSkin"};
protected static const THUMB_STYLES:Object = {upSkin:"thumbUpSkin", overSkin:"thumbOverSkin", downSkin:"thumbDownSkin", disabledSkin:"thumbDisabledSkin"};
protected static const TICK_STYLES:Object = {upSkin:"tickSkin"};
protected static var defaultStyles:Object = {thumbUpSkin:"SliderThumb_upSkin", thumbOverSkin:"SliderThumb_overSkin", thumbDownSkin:"SliderThumb_downSkin", thumbDisabledSkin:"SliderThumb_disabledSkin", sliderTrackSkin:"SliderTrack_skin", sliderTrackDisabledSkin:"SliderTrack_disabledSkin", tickSkin:"SliderTick_skin", focusRectSkin:null, focusRectPadding:null};
public function Slider(){
_direction = SliderDirection.HORIZONTAL;
super();
setStyles();
}
public function get direction():String{
return (_direction);
}
public function set direction(_arg1:String):void{
_direction = _arg1;
var _local2 = (_direction == SliderDirection.VERTICAL);
if (isLivePreview){
if (_local2){
setScaleY(-1);
y = track.height;
} else {
setScaleY(1);
y = 0;
};
positionThumb();
return;
};
if (((_local2) && (componentInspectorSetting))){
if ((rotation % 90) == 0){
setScaleY(-1);
};
};
if (!componentInspectorSetting){
rotation = (_local2) ? 90 : 0;
};
}
public function get minimum():Number{
return (_minimum);
}
public function set minimum(_arg1:Number):void{
_minimum = _arg1;
this.value = Math.max(_arg1, this.value);
invalidate(InvalidationType.DATA);
}
public function get maximum():Number{
return (_maximum);
}
public function set maximum(_arg1:Number):void{
_maximum = _arg1;
this.value = Math.min(_arg1, this.value);
invalidate(InvalidationType.DATA);
}
public function get tickInterval():Number{
return (_tickInterval);
}
public function set tickInterval(_arg1:Number):void{
_tickInterval = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get snapInterval():Number{
return (_snapInterval);
}
public function set snapInterval(_arg1:Number):void{
_snapInterval = _arg1;
}
public function set liveDragging(_arg1:Boolean):void{
_liveDragging = _arg1;
}
public function get liveDragging():Boolean{
return (_liveDragging);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override public function set enabled(_arg1:Boolean):void{
if (enabled == _arg1){
return;
};
super.enabled = _arg1;
track.enabled = (thumb.enabled = _arg1);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if ((((_direction == SliderDirection.VERTICAL)) && (!(isLivePreview)))){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
invalidate(InvalidationType.SIZE);
}
public function get value():Number{
return (_value);
}
public function set value(_arg1:Number):void{
doSetValue(_arg1);
}
protected function doSetValue(_arg1:Number, _arg2:String=null, _arg3:String=null, _arg4:int=undefined):void{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local5:Number = _value;
if (((!((_snapInterval == 0))) && (!((_snapInterval == 1))))){
_local6 = Math.pow(10, getPrecision(snapInterval));
_local7 = (_snapInterval * _local6);
_local8 = Math.round((_arg1 * _local6));
_local9 = (Math.round((_local8 / _local7)) * _local7);
_arg1 = (_local9 / _local6);
_value = Math.max(minimum, Math.min(maximum, _arg1));
} else {
_value = Math.max(minimum, Math.min(maximum, Math.round(_arg1)));
};
if (((!((_local5 == _value))) && (((((liveDragging) && (!((_arg3 == null))))) || ((_arg2 == InteractionInputType.KEYBOARD)))))){
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, _arg3, _arg2, _arg4));
};
positionThumb();
}
protected function setStyles():void{
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
setStyles();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
track.setSize(_width, track.height);
track.drawNow();
thumb.drawNow();
};
if (tickInterval > 0){
drawTicks();
} else {
clearTicks();
};
positionThumb();
super.draw();
}
protected function positionThumb():void{
thumb.x = ((((_direction)==SliderDirection.VERTICAL) ? (maximum - value) : (value - minimum) / (maximum - minimum)) * _width);
}
protected function drawTicks():void{
var _local5:DisplayObject;
clearTicks();
tickContainer = new Sprite();
var _local1:Number = ((maximum)<1) ? (tickInterval / 100) : tickInterval;
var _local2:Number = ((maximum - minimum) / _local1);
var _local3:Number = (_width / _local2);
var _local4:uint;
while (_local4 <= _local2) {
_local5 = getDisplayObjectInstance(getStyleValue("tickSkin"));
_local5.x = (_local3 * _local4);
_local5.y = ((track.y - _local5.height) - 2);
tickContainer.addChild(_local5);
_local4++;
};
addChild(tickContainer);
}
protected function clearTicks():void{
if (((!(tickContainer)) || (!(tickContainer.parent)))){
return;
};
removeChild(tickContainer);
}
protected function calculateValue(_arg1:Number, _arg2:String, _arg3:String, _arg4:int=undefined):void{
var _local5:Number = ((_arg1 / _width) * (maximum - minimum));
if (_direction == SliderDirection.VERTICAL){
_local5 = (maximum - _local5);
} else {
_local5 = (minimum + _local5);
};
doSetValue(_local5, _arg2, _arg3, _arg4);
}
protected function doDrag(_arg1:MouseEvent):void{
var _local2:Number = (_width / snapInterval);
var _local3:Number = track.mouseX;
calculateValue(_local3, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_DRAG, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
protected function thumbPressHandler(_arg1:MouseEvent):void{
stage.addEventListener(MouseEvent.MOUSE_MOVE, doDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_PRESS, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
protected function thumbReleaseHandler(_arg1:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, doDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_RELEASE, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
protected function onTrackClick(_arg1:MouseEvent):void{
calculateValue(track.mouseX, InteractionInputType.MOUSE, SliderEventClickTarget.TRACK);
if (!liveDragging){
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.TRACK, InteractionInputType.MOUSE));
};
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local3:Number;
if (!enabled){
return;
};
var _local2:Number = ((snapInterval)>0) ? snapInterval : 1;
var _local4 = (direction == SliderDirection.HORIZONTAL);
if ((((((_arg1.keyCode == Keyboard.DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.LEFT)) && (_local4))))){
_local3 = (value - _local2);
} else {
if ((((((_arg1.keyCode == Keyboard.UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.RIGHT)) && (_local4))))){
_local3 = (value + _local2);
} else {
if ((((((_arg1.keyCode == Keyboard.PAGE_DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.HOME)) && (_local4))))){
_local3 = minimum;
} else {
if ((((((_arg1.keyCode == Keyboard.PAGE_UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.END)) && (_local4))))){
_local3 = maximum;
};
};
};
};
if (!isNaN(_local3)){
_arg1.stopPropagation();
doSetValue(_local3, InteractionInputType.KEYBOARD, null, _arg1.keyCode);
};
}
override protected function configUI():void{
super.configUI();
thumb = new BaseButton();
thumb.setSize(13, 13);
thumb.autoRepeat = false;
addChild(thumb);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true);
track = new BaseButton();
track.move(0, 0);
track.setSize(80, 4);
track.autoRepeat = false;
track.useHandCursor = false;
track.addEventListener(MouseEvent.CLICK, onTrackClick, false, 0, true);
addChildAt(track, 0);
}
protected function getPrecision(_arg1:Number):Number{
var _local2:String = _arg1.toString();
if (_local2.indexOf(".") == -1){
return (0);
};
return (_local2.split(".").pop().length);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 104
//SliderDirection (fl.controls.SliderDirection)
package fl.controls {
public class SliderDirection {
public static var HORIZONTAL:String = "horizontal";
public static var VERTICAL:String = "vertical";
}
}//package fl.controls
Section 105
//TextArea (fl.controls.TextArea)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.events.*;
import fl.managers.*;
import flash.text.*;
import flash.ui.*;
import flash.system.*;
public class TextArea extends UIComponent implements IFocusManagerComponent {
public var textField:TextField;
protected var _editable:Boolean;// = true
protected var _wordWrap:Boolean;// = true
protected var _horizontalScrollPolicy:String;// = "auto"
protected var _verticalScrollPolicy:String;// = "auto"
protected var _horizontalScrollBar:UIScrollBar;
protected var _verticalScrollBar:UIScrollBar;
protected var background:DisplayObject;
protected var _html:Boolean;// = false
protected var _savedHTML:String;
protected var textHasChanged:Boolean;// = false
protected static const SCROLL_BAR_STYLES:Object = {downArrowDisabledSkin:"downArrowDisabledSkin", downArrowDownSkin:"downArrowDownSkin", downArrowOverSkin:"downArrowOverSkin", downArrowUpSkin:"downArrowUpSkin", upArrowDisabledSkin:"upArrowDisabledSkin", upArrowDownSkin:"upArrowDownSkin", upArrowOverSkin:"upArrowOverSkin", upArrowUpSkin:"upArrowUpSkin", thumbDisabledSkin:"thumbDisabledSkin", thumbDownSkin:"thumbDownSkin", thumbOverSkin:"thumbOverSkin", thumbUpSkin:"thumbUpSkin", thumbIcon:"thumbIcon", trackDisabledSkin:"trackDisabledSkin", trackDownSkin:"trackDownSkin", trackOverSkin:"trackOverSkin", trackUpSkin:"trackUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
private static var defaultStyles:Object = {upSkin:"TextArea_upSkin", disabledSkin:"TextArea_disabledSkin", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, textPadding:3, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function get horizontalScrollBar():UIScrollBar{
return (_horizontalScrollBar);
}
public function get verticalScrollBar():UIScrollBar{
return (_verticalScrollBar);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseChildren = enabled;
invalidate(InvalidationType.STATE);
}
public function get text():String{
return (textField.text);
}
public function set text(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
return;
};
textField.text = _arg1;
_html = false;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
textHasChanged = true;
}
public function get htmlText():String{
return (textField.htmlText);
}
public function set htmlText(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
return;
};
if (_arg1 == ""){
text = "";
return;
};
_html = true;
_savedHTML = _arg1;
textField.htmlText = _arg1;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
textHasChanged = true;
}
public function get condenseWhite():Boolean{
return (textField.condenseWhite);
}
public function set condenseWhite(_arg1:Boolean):void{
textField.condenseWhite = _arg1;
invalidate(InvalidationType.DATA);
}
public function get horizontalScrollPolicy():String{
return (_horizontalScrollPolicy);
}
public function set horizontalScrollPolicy(_arg1:String):void{
_horizontalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get verticalScrollPolicy():String{
return (_verticalScrollPolicy);
}
public function set verticalScrollPolicy(_arg1:String):void{
_verticalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get horizontalScrollPosition():Number{
return (textField.scrollH);
}
public function set horizontalScrollPosition(_arg1:Number):void{
drawNow();
textField.scrollH = _arg1;
}
public function get verticalScrollPosition():Number{
return (textField.scrollV);
}
public function set verticalScrollPosition(_arg1:Number):void{
drawNow();
textField.scrollV = _arg1;
}
public function get textWidth():Number{
drawNow();
return (textField.textWidth);
}
public function get textHeight():Number{
drawNow();
return (textField.textHeight);
}
public function get length():Number{
return (textField.text.length);
}
public function get restrict():String{
return (textField.restrict);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
textField.restrict = _arg1;
}
public function get maxChars():int{
return (textField.maxChars);
}
public function set maxChars(_arg1:int):void{
textField.maxChars = _arg1;
}
public function get maxHorizontalScrollPosition():int{
return (textField.maxScrollH);
}
public function get maxVerticalScrollPosition():int{
return (textField.maxScrollV);
}
public function get wordWrap():Boolean{
return (_wordWrap);
}
public function set wordWrap(_arg1:Boolean):void{
_wordWrap = _arg1;
invalidate(InvalidationType.STATE);
}
public function get selectionBeginIndex():int{
return (textField.selectionBeginIndex);
}
public function get selectionEndIndex():int{
return (textField.selectionEndIndex);
}
public function get displayAsPassword():Boolean{
return (textField.displayAsPassword);
}
public function set displayAsPassword(_arg1:Boolean):void{
textField.displayAsPassword = _arg1;
}
public function get editable():Boolean{
return (_editable);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
invalidate(InvalidationType.STATE);
}
public function get imeMode():String{
return (IME.conversionMode);
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
public function get alwaysShowSelection():Boolean{
return (textField.alwaysShowSelection);
}
public function set alwaysShowSelection(_arg1:Boolean):void{
textField.alwaysShowSelection = _arg1;
}
override public function drawFocus(_arg1:Boolean):void{
if (focusTarget != null){
focusTarget.drawFocus(_arg1);
return;
};
super.drawFocus(_arg1);
}
public function getLineMetrics(_arg1:int):TextLineMetrics{
return (textField.getLineMetrics(_arg1));
}
public function setSelection(_arg1:int, _arg2:int):void{
textField.setSelection(_arg1, _arg2);
}
public function appendText(_arg1:String):void{
textField.appendText(_arg1);
invalidate(InvalidationType.DATA);
}
override protected function configUI():void{
super.configUI();
tabChildren = true;
textField = new TextField();
addChild(textField);
updateTextFieldType();
_verticalScrollBar = new UIScrollBar();
_verticalScrollBar.name = "V";
_verticalScrollBar.visible = false;
_verticalScrollBar.focusEnabled = false;
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
_verticalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
addChild(_verticalScrollBar);
_horizontalScrollBar = new UIScrollBar();
_horizontalScrollBar.name = "H";
_horizontalScrollBar.visible = false;
_horizontalScrollBar.focusEnabled = false;
_horizontalScrollBar.direction = ScrollBarDirection.HORIZONTAL;
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
_horizontalScrollBar.addEventListener(ScrollEvent.SCROLL, handleScroll, false, 0, true);
addChild(_horizontalScrollBar);
textField.addEventListener(TextEvent.TEXT_INPUT, handleTextInput, false, 0, true);
textField.addEventListener(Event.CHANGE, handleChange, false, 0, true);
textField.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown, false, 0, true);
_horizontalScrollBar.scrollTarget = textField;
_verticalScrollBar.scrollTarget = textField;
addEventListener(MouseEvent.MOUSE_WHEEL, handleWheel, false, 0, true);
}
protected function updateTextFieldType():void{
textField.type = (((enabled) && (_editable))) ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
textField.selectable = enabled;
textField.wordWrap = _wordWrap;
textField.multiline = true;
}
protected function handleKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ENTER){
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER, true));
};
}
protected function handleChange(_arg1:Event):void{
_arg1.stopPropagation();
dispatchEvent(new Event(Event.CHANGE, true));
invalidate(InvalidationType.DATA);
}
protected function handleTextInput(_arg1:TextEvent):void{
_arg1.stopPropagation();
dispatchEvent(new TextEvent(TextEvent.TEXT_INPUT, true, false, _arg1.text));
}
protected function handleScroll(_arg1:ScrollEvent):void{
dispatchEvent(_arg1);
}
protected function handleWheel(_arg1:MouseEvent):void{
if (((!(enabled)) || (!(_verticalScrollBar.visible)))){
return;
};
_verticalScrollBar.scrollPosition = (_verticalScrollBar.scrollPosition - (_arg1.delta * _verticalScrollBar.lineScrollSize));
dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL, (_arg1.delta * _verticalScrollBar.lineScrollSize), _verticalScrollBar.scrollPosition));
}
protected function setEmbedFont(){
var _local1:Object = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function draw():void{
if (isInvalid(InvalidationType.STATE)){
updateTextFieldType();
};
if (isInvalid(InvalidationType.STYLES)){
setStyles();
setEmbedFont();
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawTextFormat();
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.DATA)){
drawLayout();
};
super.draw();
}
protected function setStyles():void{
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
}
protected function drawTextFormat():void{
var _local1:Object = UIComponent.getStyleDefinition();
var _local2:TextFormat = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
var _local3:TextFormat = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
if (_html){
textField.htmlText = _savedHTML;
};
}
protected function drawBackground():void{
var _local1:DisplayObject = background;
var _local2:String = (enabled) ? "upSkin" : "disabledSkin";
background = getDisplayObjectInstance(getStyleValue(_local2));
if (background != null){
addChildAt(background, 0);
};
if (((((!((_local1 == null))) && (!((_local1 == background))))) && (contains(_local1)))){
removeChild(_local1);
};
}
protected function drawLayout():void{
var _local1:Number = Number(getStyleValue("textPadding"));
textField.x = (textField.y = _local1);
background.width = width;
background.height = height;
var _local2:Number = height;
var _local3:Boolean = needVScroll();
var _local4:Number = (width - (_local3) ? _verticalScrollBar.width : 0);
var _local5:Boolean = needHScroll();
if (_local5){
_local2 = (_local2 - _horizontalScrollBar.height);
};
setTextSize(_local4, _local2, _local1);
if (((((_local5) && (!(_local3)))) && (needVScroll()))){
_local3 = true;
_local4 = (_local4 - _verticalScrollBar.width);
setTextSize(_local4, _local2, _local1);
};
if (_local3){
_verticalScrollBar.visible = true;
_verticalScrollBar.x = (width - _verticalScrollBar.width);
_verticalScrollBar.height = _local2;
_verticalScrollBar.visible = true;
_verticalScrollBar.enabled = enabled;
} else {
_verticalScrollBar.visible = false;
};
if (_local5){
_horizontalScrollBar.visible = true;
_horizontalScrollBar.y = (height - _horizontalScrollBar.height);
_horizontalScrollBar.width = _local4;
_horizontalScrollBar.visible = true;
_horizontalScrollBar.enabled = enabled;
} else {
_horizontalScrollBar.visible = false;
};
updateScrollBars();
addEventListener(Event.ENTER_FRAME, delayedLayoutUpdate, false, 0, true);
}
protected function delayedLayoutUpdate(_arg1:Event):void{
if (textHasChanged){
textHasChanged = false;
drawLayout();
return;
};
removeEventListener(Event.ENTER_FRAME, delayedLayoutUpdate);
}
protected function updateScrollBars(){
_horizontalScrollBar.update();
_verticalScrollBar.update();
_verticalScrollBar.enabled = enabled;
_horizontalScrollBar.enabled = enabled;
_horizontalScrollBar.drawNow();
_verticalScrollBar.drawNow();
}
protected function needVScroll():Boolean{
if (_verticalScrollPolicy == ScrollPolicy.OFF){
return (false);
};
if (_verticalScrollPolicy == ScrollPolicy.ON){
return (true);
};
return ((textField.maxScrollV > 1));
}
protected function needHScroll():Boolean{
if (_horizontalScrollPolicy == ScrollPolicy.OFF){
return (false);
};
if (_horizontalScrollPolicy == ScrollPolicy.ON){
return (true);
};
return ((textField.maxScrollH > 0));
}
protected function setTextSize(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:Number = (_arg1 - (_arg3 * 2));
var _local5:Number = (_arg2 - (_arg3 * 2));
if (_local4 != textField.width){
textField.width = _local4;
};
if (_local5 != textField.height){
textField.height = _local5;
};
}
override protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((((_arg1 == textField)) || (super.isOurFocus(_arg1))));
}
override protected function focusInHandler(_arg1:FocusEvent):void{
setIMEMode(true);
if (_arg1.target == this){
stage.focus = textField;
};
var _local2:IFocusManager = focusManager;
if (_local2){
if (editable){
_local2.showFocusIndicator = true;
};
_local2.defaultButtonEnabled = false;
};
super.focusInHandler(_arg1);
if (editable){
setIMEMode(true);
};
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager = focusManager;
if (_local2){
_local2.defaultButtonEnabled = true;
};
setSelection(0, 0);
super.focusOutHandler(_arg1);
if (editable){
setIMEMode(false);
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(defaultStyles, ScrollBar.getStyleDefinition()));
}
}
}//package fl.controls
Section 106
//TextInput (fl.controls.TextInput)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.events.*;
import fl.managers.*;
import flash.text.*;
import flash.ui.*;
public class TextInput extends UIComponent implements IFocusManagerComponent {
public var textField:TextField;
protected var _editable:Boolean;// = true
protected var background:DisplayObject;
protected var _html:Boolean;// = false
protected var _savedHTML:String;
private static var defaultStyles:Object = {upSkin:"TextInput_upSkin", disabledSkin:"TextInput_disabledSkin", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, textPadding:0, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function get text():String{
return (textField.text);
}
public function set text(_arg1:String):void{
textField.text = _arg1;
_html = false;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
updateTextFieldType();
}
public function get imeMode():String{
return (_imeMode);
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
public function get alwaysShowSelection():Boolean{
return (textField.alwaysShowSelection);
}
public function set alwaysShowSelection(_arg1:Boolean):void{
textField.alwaysShowSelection = _arg1;
}
override public function drawFocus(_arg1:Boolean):void{
if (focusTarget != null){
focusTarget.drawFocus(_arg1);
return;
};
super.drawFocus(_arg1);
}
public function get editable():Boolean{
return (_editable);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
updateTextFieldType();
}
public function get horizontalScrollPosition():int{
return (textField.scrollH);
}
public function set horizontalScrollPosition(_arg1:int):void{
textField.scrollH = _arg1;
}
public function get maxHorizontalScrollPosition():int{
return (textField.maxScrollH);
}
public function get length():int{
return (textField.length);
}
public function get maxChars():int{
return (textField.maxChars);
}
public function set maxChars(_arg1:int):void{
textField.maxChars = _arg1;
}
public function get displayAsPassword():Boolean{
return (textField.displayAsPassword);
}
public function set displayAsPassword(_arg1:Boolean):void{
textField.displayAsPassword = _arg1;
}
public function get restrict():String{
return (textField.restrict);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
textField.restrict = _arg1;
}
public function get selectionBeginIndex():int{
return (textField.selectionBeginIndex);
}
public function get selectionEndIndex():int{
return (textField.selectionEndIndex);
}
public function get condenseWhite():Boolean{
return (textField.condenseWhite);
}
public function set condenseWhite(_arg1:Boolean):void{
textField.condenseWhite = _arg1;
}
public function get htmlText():String{
return (textField.htmlText);
}
public function set htmlText(_arg1:String):void{
if (_arg1 == ""){
text = "";
return;
};
_html = true;
_savedHTML = _arg1;
textField.htmlText = _arg1;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
public function get textHeight():Number{
return (textField.textHeight);
}
public function get textWidth():Number{
return (textField.textWidth);
}
public function setSelection(_arg1:int, _arg2:int):void{
textField.setSelection(_arg1, _arg2);
}
public function getLineMetrics(_arg1:int):TextLineMetrics{
return (textField.getLineMetrics(_arg1));
}
public function appendText(_arg1:String):void{
textField.appendText(_arg1);
}
protected function updateTextFieldType():void{
textField.type = (((enabled) && (editable))) ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
textField.selectable = enabled;
}
protected function handleKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ENTER){
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER, true));
};
}
protected function handleChange(_arg1:Event):void{
_arg1.stopPropagation();
dispatchEvent(new Event(Event.CHANGE, true));
}
protected function handleTextInput(_arg1:TextEvent):void{
_arg1.stopPropagation();
dispatchEvent(new TextEvent(TextEvent.TEXT_INPUT, true, false, _arg1.text));
}
protected function setEmbedFont(){
var _local1:Object = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function draw():void{
var _local1:Object;
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawTextFormat();
drawBackground();
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function drawBackground():void{
var _local1:DisplayObject = background;
var _local2:String = (enabled) ? "upSkin" : "disabledSkin";
background = getDisplayObjectInstance(getStyleValue(_local2));
if (background == null){
return;
};
addChildAt(background, 0);
if (((((!((_local1 == null))) && (!((_local1 == background))))) && (contains(_local1)))){
removeChild(_local1);
};
}
protected function drawTextFormat():void{
var _local1:Object = UIComponent.getStyleDefinition();
var _local2:TextFormat = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
var _local3:TextFormat = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
if (_html){
textField.htmlText = _savedHTML;
};
}
protected function drawLayout():void{
var _local1:Number = Number(getStyleValue("textPadding"));
if (background != null){
background.width = width;
background.height = height;
};
textField.width = (width - (2 * _local1));
textField.height = (height - (2 * _local1));
textField.x = (textField.y = _local1);
}
override protected function configUI():void{
super.configUI();
tabChildren = true;
textField = new TextField();
addChild(textField);
updateTextFieldType();
textField.addEventListener(TextEvent.TEXT_INPUT, handleTextInput, false, 0, true);
textField.addEventListener(Event.CHANGE, handleChange, false, 0, true);
textField.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown, false, 0, true);
}
override public function setFocus():void{
stage.focus = textField;
}
override protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((((_arg1 == textField)) || (super.isOurFocus(_arg1))));
}
override protected function focusInHandler(_arg1:FocusEvent):void{
if (_arg1.target == this){
stage.focus = textField;
};
var _local2:IFocusManager = focusManager;
if (((editable) && (_local2))){
_local2.showFocusIndicator = true;
if (((textField.selectable) && ((textField.selectionBeginIndex == textField.selectionBeginIndex)))){
setSelection(0, textField.length);
};
};
super.focusInHandler(_arg1);
if (editable){
setIMEMode(true);
};
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
super.focusOutHandler(_arg1);
if (editable){
setIMEMode(false);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 107
//UIScrollBar (fl.controls.UIScrollBar)
package fl.controls {
import flash.display.*;
import fl.core.*;
import flash.events.*;
import fl.events.*;
public class UIScrollBar extends ScrollBar {
protected var _scrollTarget:DisplayObject;
protected var inEdit:Boolean;// = false
protected var inScroll:Boolean;// = false
protected var _targetScrollProperty:String;
protected var _targetMaxScrollProperty:String;
private static var defaultStyles:Object = {};
override public function set minScrollPosition(_arg1:Number):void{
super.minScrollPosition = ((_arg1)<0) ? 0 : _arg1;
}
override public function set maxScrollPosition(_arg1:Number):void{
var _local2:Number = _arg1;
if (_scrollTarget != null){
_local2 = Math.min(_local2, _scrollTarget[_targetMaxScrollProperty]);
};
super.maxScrollPosition = _local2;
}
public function get scrollTarget():DisplayObject{
return (_scrollTarget);
}
public function set scrollTarget(_arg1:DisplayObject):void{
var target = _arg1;
if (_scrollTarget != null){
_scrollTarget.removeEventListener(Event.CHANGE, handleTargetChange, false);
_scrollTarget.removeEventListener(TextEvent.TEXT_INPUT, handleTargetChange, false);
_scrollTarget.removeEventListener(Event.SCROLL, handleTargetScroll, false);
};
_scrollTarget = target;
var blockProg:String;
var textDir:String;
if (_scrollTarget != null){
try {
if (_scrollTarget.hasOwnProperty("blockProgression")){
blockProg = _scrollTarget["blockProgression"];
};
if (_scrollTarget.hasOwnProperty("direction")){
textDir = _scrollTarget["direction"];
};
} catch(e:Error) {
blockProg = null;
textDir = null;
};
};
var scrollHoriz = (this.direction == ScrollBarDirection.HORIZONTAL);
var rot:Number = Math.abs(this.rotation);
if (((scrollHoriz) && ((((blockProg == "rl")) || ((textDir == "rtl")))))){
if ((((getScaleY() > 0)) && ((rotation == 90)))){
x = (x + width);
};
setScaleY(-1);
} else {
if (((((!(scrollHoriz)) && ((blockProg == "rl")))) && ((textDir == "rtl")))){
if ((((getScaleY() > 0)) && (!((rotation == 90))))){
y = (y + height);
};
setScaleY(-1);
} else {
if (getScaleY() < 0){
if (scrollHoriz){
if (rotation == 90){
x = (x - width);
};
} else {
if (rotation != 90){
y = (y - height);
};
};
};
setScaleY(1);
};
};
setTargetScrollProperties(scrollHoriz, blockProg);
if (_scrollTarget != null){
_scrollTarget.addEventListener(Event.CHANGE, handleTargetChange, false, 0, true);
_scrollTarget.addEventListener(TextEvent.TEXT_INPUT, handleTargetChange, false, 0, true);
_scrollTarget.addEventListener(Event.SCROLL, handleTargetScroll, false, 0, true);
};
invalidate(InvalidationType.DATA);
}
public function get scrollTargetName():String{
return (_scrollTarget.name);
}
public function set scrollTargetName(_arg1:String):void{
var target = _arg1;
try {
scrollTarget = parent.getChildByName(target);
} catch(error:Error) {
throw (new Error("ScrollTarget not found, or is not a valid target"));
};
}
override public function get direction():String{
return (super.direction);
}
override public function set direction(_arg1:String):void{
var _local2:DisplayObject;
if (isLivePreview){
return;
};
if (((!(componentInspectorSetting)) && (!((_scrollTarget == null))))){
_local2 = _scrollTarget;
scrollTarget = null;
};
super.direction = _arg1;
if (_local2 != null){
scrollTarget = _local2;
} else {
updateScrollTargetProperties();
};
}
public function update():void{
inEdit = true;
updateScrollTargetProperties();
inEdit = false;
}
override protected function draw():void{
if (isInvalid(InvalidationType.DATA)){
updateScrollTargetProperties();
};
super.draw();
}
protected function updateScrollTargetProperties():void{
var blockProg:String;
var pageSize:Number;
var minScroll:Number;
var minScrollVValue:*;
if (_scrollTarget == null){
setScrollProperties(pageSize, minScrollPosition, maxScrollPosition);
scrollPosition = 0;
} else {
blockProg = null;
try {
if (_scrollTarget.hasOwnProperty("blockProgression")){
blockProg = _scrollTarget["blockProgression"];
};
} catch(e1:Error) {
};
setTargetScrollProperties((this.direction == ScrollBarDirection.HORIZONTAL), blockProg);
if (_targetScrollProperty == "scrollH"){
minScroll = 0;
try {
if (((_scrollTarget.hasOwnProperty("controller")) && (_scrollTarget["controller"].hasOwnProperty("compositionWidth")))){
pageSize = _scrollTarget["controller"]["compositionWidth"];
} else {
pageSize = _scrollTarget.width;
};
} catch(e2:Error) {
pageSize = _scrollTarget.width;
};
} else {
try {
if (blockProg != null){
minScrollVValue = _scrollTarget["minScrollV"];
if ((minScrollVValue is int)){
minScroll = minScrollVValue;
} else {
minScroll = 1;
};
} else {
minScroll = 1;
};
} catch(e3:Error) {
minScroll = 1;
};
pageSize = 10;
};
setScrollProperties(pageSize, minScroll, scrollTarget[_targetMaxScrollProperty]);
scrollPosition = _scrollTarget[_targetScrollProperty];
};
}
override public function setScrollProperties(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0):void{
var _local5:Number = _arg3;
var _local6:Number = ((_arg2)<0) ? 0 : _arg2;
if (_scrollTarget != null){
_local5 = Math.min(_arg3, _scrollTarget[_targetMaxScrollProperty]);
};
super.setScrollProperties(_arg1, _local6, _local5, _arg4);
}
override public function setScrollPosition(_arg1:Number, _arg2:Boolean=true):void{
super.setScrollPosition(_arg1, _arg2);
if (!_scrollTarget){
inScroll = false;
return;
};
updateTargetScroll();
}
protected function updateTargetScroll(_arg1:ScrollEvent=null):void{
if (inEdit){
return;
};
_scrollTarget[_targetScrollProperty] = scrollPosition;
}
protected function handleTargetChange(_arg1:Event):void{
inEdit = true;
setScrollPosition(_scrollTarget[_targetScrollProperty], true);
updateScrollTargetProperties();
inEdit = false;
}
protected function handleTargetScroll(_arg1:Event):void{
if (inDrag){
return;
};
if (!enabled){
return;
};
inEdit = true;
updateScrollTargetProperties();
scrollPosition = _scrollTarget[_targetScrollProperty];
inEdit = false;
}
private function setTargetScrollProperties(_arg1:Boolean, _arg2:String):void{
if (_arg2 == "rl"){
if (_arg1){
_targetScrollProperty = "scrollV";
_targetMaxScrollProperty = "maxScrollV";
} else {
_targetScrollProperty = "scrollH";
_targetMaxScrollProperty = "maxScrollH";
};
} else {
if (_arg1){
_targetScrollProperty = "scrollH";
_targetMaxScrollProperty = "maxScrollH";
} else {
_targetScrollProperty = "scrollV";
_targetMaxScrollProperty = "maxScrollV";
};
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(defaultStyles, ScrollBar.getStyleDefinition()));
}
}
}//package fl.controls
Section 108
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 109
//InvalidationType (fl.core.InvalidationType)
package fl.core {
public class InvalidationType {
public static const ALL:String = "all";
public static const SIZE:String = "size";
public static const STYLES:String = "styles";
public static const RENDERER_STYLES:String = "rendererStyles";
public static const STATE:String = "state";
public static const DATA:String = "data";
public static const SCROLL:String = "scroll";
public static const SELECTED:String = "selected";
}
}//package fl.core
Section 110
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import fl.events.*;
import fl.managers.*;
import flash.text.*;
import flash.utils.*;
import flash.system.*;
public class UIComponent extends Sprite {
public const version:String = "3.0.2.3";
public var focusTarget:IFocusManagerComponent;
protected var isLivePreview:Boolean;// = false
private var tempText:TextField;
protected var instanceStyles:Object;
protected var sharedStyles:Object;
protected var callLaterMethods:Dictionary;
protected var invalidateFlag:Boolean;// = false
protected var _enabled:Boolean;// = true
protected var invalidHash:Object;
protected var uiFocusRect:DisplayObject;
protected var isFocused:Boolean;// = false
private var _focusEnabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var _width:Number;
protected var _height:Number;
protected var _x:Number;
protected var _y:Number;
protected var startWidth:Number;
protected var startHeight:Number;
protected var _imeMode:String;// = null
protected var _oldIMEMode:String;// = null
protected var errorCaught:Boolean;// = false
protected var _inspector:Boolean;// = false
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
private static var focusManagers:Dictionary = new Dictionary(true);
private static var focusManagerUsers:Dictionary = new Dictionary(true);
public static var createAccessibilityImplementation:Function;
public function UIComponent(){
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
protected function beforeComponentParameters():void{
}
protected function afterComponentParameters():void{
}
public function get enabled():Boolean{
return (_enabled);
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function get width():Number{
return (_width);
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
override public function get height():Number{
return (_height);
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getScaleY():Number{
return (super.scaleY);
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
override public function get visible():Boolean{
return (super.visible);
}
override public function set visible(_arg1:Boolean):void{
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
var _local2:String = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function drawNow():void{
draw();
}
protected function configUI():void{
isLivePreview = checkLivePreview();
var _local1:Number = rotation;
rotation = 0;
var _local2:Number = super.width;
var _local3:Number = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
protected function validate():void{
invalidHash = {};
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var skin = _arg1;
var classDef:Object;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function callLater(_arg1:Function):void{
if (inCallLaterPhase){
return;
};
callLaterMethods[_arg1] = true;
if (stage != null){
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local3:Object;
if (_arg1.type == Event.ADDED_TO_STAGE){
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
};
_arg1.target.removeEventListener(Event.RENDER, callLaterDispatcher);
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
inCallLaterPhase = true;
var _local2:Dictionary = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function initializeFocusManager():void{
var _local1:IFocusManager;
var _local2:Dictionary;
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
_local1 = focusManager;
if (_local1 != null){
_local2 = focusManagerUsers[_local1];
if (_local2 == null){
_local2 = new Dictionary(true);
focusManagerUsers[_local1] = _local2;
};
_local2[this] = true;
};
};
addEventListener(Event.REMOVED_FROM_STAGE, removedHandler);
}
private function addedHandler(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, addedHandler);
initializeFocusManager();
}
private function removedHandler(_arg1:Event):void{
var _local3:Dictionary;
var _local4:Boolean;
var _local5:*;
var _local6:*;
var _local7:IFocusManager;
removeEventListener(Event.REMOVED_FROM_STAGE, removedHandler);
addEventListener(Event.ADDED_TO_STAGE, addedHandler);
var _local2:IFocusManager = focusManager;
if (_local2 != null){
_local3 = focusManagerUsers[_local2];
if (_local3 != null){
delete _local3[this];
_local4 = true;
for (_local5 in _local3) {
_local4 = false;
break;
};
if (_local4){
delete focusManagerUsers[_local2];
_local3 = null;
};
};
if (_local3 == null){
_local2.deactivate();
for (_local6 in focusManagers) {
_local7 = focusManagers[_local6];
if (_local2 == _local7){
delete focusManagers[_local6];
};
};
};
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local5:Object;
var _local6:String;
var _local2:Object = {};
var _local3:uint = _args.length;
var _local4:uint;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 111
//DataProvider (fl.data.DataProvider)
package fl.data {
import flash.events.*;
import fl.events.*;
public class DataProvider extends EventDispatcher {
protected var data:Array;
public function DataProvider(_arg1:Object=null){
if (_arg1 == null){
data = [];
} else {
data = getDataFromObject(_arg1);
};
}
public function get length():uint{
return (data.length);
}
public function invalidateItemAt(_arg1:int):void{
checkIndex(_arg1, (data.length - 1));
dispatchChangeEvent(DataChangeType.INVALIDATE, [data[_arg1]], _arg1, _arg1);
}
public function invalidateItem(_arg1:Object):void{
var _local2:uint = getItemIndex(_arg1);
if (_local2 == -1){
return;
};
invalidateItemAt(_local2);
}
public function invalidate():void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.DATA_CHANGE, DataChangeType.INVALIDATE_ALL, data.concat(), 0, data.length));
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
checkIndex(_arg2, data.length);
dispatchPreChangeEvent(DataChangeType.ADD, [_arg1], _arg2, _arg2);
data.splice(_arg2, 0, _arg1);
dispatchChangeEvent(DataChangeType.ADD, [_arg1], _arg2, _arg2);
}
public function addItem(_arg1:Object):void{
dispatchPreChangeEvent(DataChangeType.ADD, [_arg1], (data.length - 1), (data.length - 1));
data.push(_arg1);
dispatchChangeEvent(DataChangeType.ADD, [_arg1], (data.length - 1), (data.length - 1));
}
public function addItemsAt(_arg1:Object, _arg2:uint):void{
checkIndex(_arg2, data.length);
var _local3:Array = getDataFromObject(_arg1);
dispatchPreChangeEvent(DataChangeType.ADD, _local3, _arg2, ((_arg2 + _local3.length) - 1));
data.splice.apply(data, [_arg2, 0].concat(_local3));
dispatchChangeEvent(DataChangeType.ADD, _local3, _arg2, ((_arg2 + _local3.length) - 1));
}
public function addItems(_arg1:Object):void{
addItemsAt(_arg1, data.length);
}
public function concat(_arg1:Object):void{
addItems(_arg1);
}
public function merge(_arg1:Object):void{
var _local6:Object;
var _local2:Array = getDataFromObject(_arg1);
var _local3:uint = _local2.length;
var _local4:uint = data.length;
dispatchPreChangeEvent(DataChangeType.ADD, data.slice(_local4, data.length), _local4, (this.data.length - 1));
var _local5:uint;
while (_local5 < _local3) {
_local6 = _local2[_local5];
if (getItemIndex(_local6) == -1){
data.push(_local6);
};
_local5++;
};
if (data.length > _local4){
dispatchChangeEvent(DataChangeType.ADD, data.slice(_local4, data.length), _local4, (this.data.length - 1));
} else {
dispatchChangeEvent(DataChangeType.ADD, [], -1, -1);
};
}
public function getItemAt(_arg1:uint):Object{
checkIndex(_arg1, (data.length - 1));
return (data[_arg1]);
}
public function getItemIndex(_arg1:Object):int{
return (data.indexOf(_arg1));
}
public function removeItemAt(_arg1:uint):Object{
checkIndex(_arg1, (data.length - 1));
dispatchPreChangeEvent(DataChangeType.REMOVE, data.slice(_arg1, (_arg1 + 1)), _arg1, _arg1);
var _local2:Array = data.splice(_arg1, 1);
dispatchChangeEvent(DataChangeType.REMOVE, _local2, _arg1, _arg1);
return (_local2[0]);
}
public function removeItem(_arg1:Object):Object{
var _local2:int = getItemIndex(_arg1);
if (_local2 != -1){
return (removeItemAt(_local2));
};
return (null);
}
public function removeAll():void{
var _local1:Array = data.concat();
dispatchPreChangeEvent(DataChangeType.REMOVE_ALL, _local1, 0, _local1.length);
data = [];
dispatchChangeEvent(DataChangeType.REMOVE_ALL, _local1, 0, _local1.length);
}
public function replaceItem(_arg1:Object, _arg2:Object):Object{
var _local3:int = getItemIndex(_arg2);
if (_local3 != -1){
return (replaceItemAt(_arg1, _local3));
};
return (null);
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
checkIndex(_arg2, (data.length - 1));
var _local3:Array = [data[_arg2]];
dispatchPreChangeEvent(DataChangeType.REPLACE, _local3, _arg2, _arg2);
data[_arg2] = _arg1;
dispatchChangeEvent(DataChangeType.REPLACE, _local3, _arg2, _arg2);
return (_local3[0]);
}
public function sort(... _args){
dispatchPreChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
var _local2:Array = data.sort.apply(data, _args);
dispatchChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
return (_local2);
}
public function sortOn(_arg1:Object, _arg2:Object=null){
dispatchPreChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
var _local3:Array = data.sortOn(_arg1, _arg2);
dispatchChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
return (_local3);
}
public function clone():DataProvider{
return (new DataProvider(data));
}
public function toArray():Array{
return (data.concat());
}
override public function toString():String{
return ((("DataProvider [" + data.join(" , ")) + "]"));
}
protected function getDataFromObject(_arg1:Object):Array{
var _local2:Array;
var _local3:Array;
var _local4:uint;
var _local5:Object;
var _local6:XML;
var _local7:XMLList;
var _local8:XML;
var _local9:XMLList;
var _local10:XML;
var _local11:XMLList;
var _local12:XML;
if ((_arg1 is Array)){
_local3 = (_arg1 as Array);
if (_local3.length > 0){
if ((((_local3[0] is String)) || ((_local3[0] is Number)))){
_local2 = [];
_local4 = 0;
while (_local4 < _local3.length) {
_local5 = {label:String(_local3[_local4]), data:_local3[_local4]};
_local2.push(_local5);
_local4++;
};
return (_local2);
};
};
return (_arg1.concat());
} else {
if ((_arg1 is DataProvider)){
return (_arg1.toArray());
};
if ((_arg1 is XML)){
_local6 = (_arg1 as XML);
_local2 = [];
_local7 = _local6.*;
for each (_local8 in _local7) {
_arg1 = {};
_local9 = _local8.attributes();
for each (_local10 in _local9) {
_arg1[_local10.localName()] = _local10.toString();
};
_local11 = _local8.*;
for each (_local12 in _local11) {
if (_local12.hasSimpleContent()){
_arg1[_local12.localName()] = _local12.toString();
};
};
_local2.push(_arg1);
};
return (_local2);
//unresolved jump
};
};
throw (new ((!NULL! + !NULL!) + " to Array or DataProvider.").TypeError(!NULL!));
}
protected function checkIndex(_arg1:int, _arg2:int):void{
if ((((_arg1 > _arg2)) || ((_arg1 < 0)))){
throw (new RangeError((((("DataProvider index (" + _arg1) + ") is not in acceptable range (0 - ") + _arg2) + ")")));
};
}
protected function dispatchChangeEvent(_arg1:String, _arg2:Array, _arg3:int, _arg4:int):void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.DATA_CHANGE, _arg1, _arg2, _arg3, _arg4));
}
protected function dispatchPreChangeEvent(_arg1:String, _arg2:Array, _arg3:int, _arg4:int):void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.PRE_DATA_CHANGE, _arg1, _arg2, _arg3, _arg4));
}
}
}//package fl.data
Section 112
//SimpleCollectionItem (fl.data.SimpleCollectionItem)
package fl.data {
public dynamic class SimpleCollectionItem {
public var label:String;
public var data:String;
public function toString():String{
return ((((("[SimpleCollectionItem: " + label) + ",") + data) + "]"));
}
}
}//package fl.data
Section 113
//ComponentEvent (fl.events.ComponentEvent)
package fl.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const BUTTON_DOWN:String = "buttonDown";
public static const LABEL_CHANGE:String = "labelChange";
public static const HIDE:String = "hide";
public static const SHOW:String = "show";
public static const RESIZE:String = "resize";
public static const MOVE:String = "move";
public static const ENTER:String = "enter";
public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("ComponentEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ComponentEvent(type, bubbles, cancelable));
}
}
}//package fl.events
Section 114
//DataChangeEvent (fl.events.DataChangeEvent)
package fl.events {
import flash.events.*;
public class DataChangeEvent extends Event {
protected var _startIndex:uint;
protected var _endIndex:uint;
protected var _changeType:String;
protected var _items:Array;
public static const DATA_CHANGE:String = "dataChange";
public static const PRE_DATA_CHANGE:String = "preDataChange";
public function DataChangeEvent(_arg1:String, _arg2:String, _arg3:Array, _arg4:int=-1, _arg5:int=-1):void{
super(_arg1);
_changeType = _arg2;
_startIndex = _arg4;
_items = _arg3;
_endIndex = ((_arg5)==-1) ? _startIndex : _arg5;
}
public function get changeType():String{
return (_changeType);
}
public function get items():Array{
return (_items);
}
public function get startIndex():uint{
return (_startIndex);
}
public function get endIndex():uint{
return (_endIndex);
}
override public function toString():String{
return (formatToString("DataChangeEvent", "type", "changeType", "startIndex", "endIndex", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new DataChangeEvent(type, _changeType, _items, _startIndex, _endIndex));
}
}
}//package fl.events
Section 115
//DataChangeType (fl.events.DataChangeType)
package fl.events {
public class DataChangeType {
public static const CHANGE:String = "change";
public static const INVALIDATE:String = "invalidate";
public static const INVALIDATE_ALL:String = "invalidateAll";
public static const ADD:String = "add";
public static const REMOVE:String = "remove";
public static const REMOVE_ALL:String = "removeAll";
public static const REPLACE:String = "replace";
public static const SORT:String = "sort";
}
}//package fl.events
Section 116
//DataGridEvent (fl.events.DataGridEvent)
package fl.events {
import flash.events.*;
public class DataGridEvent extends ListEvent {
protected var _dataField:String;
protected var _itemRenderer:Object;
protected var _reason:String;
public static const COLUMN_STRETCH:String = "columnStretch";
public static const HEADER_RELEASE:String = "headerRelease";
public static const ITEM_EDIT_BEGINNING:String = "itemEditBeginning";
public static const ITEM_EDIT_BEGIN:String = "itemEditBegin";
public static const ITEM_EDIT_END:String = "itemEditEnd";
public static const ITEM_FOCUS_IN:String = "itemFocusIn";
public static const ITEM_FOCUS_OUT:String = "itemFocusOut";
public function DataGridEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:int=-1, _arg5:int=-1, _arg6:Object=null, _arg7:String=null, _arg8:String=null){
super(_arg1, _arg2, _arg3, _arg4, _arg5);
_itemRenderer = _arg6;
_dataField = _arg7;
_reason = _arg8;
}
public function get itemRenderer():Object{
return (_itemRenderer);
}
public function get dataField():String{
return (_dataField);
}
public function set dataField(_arg1:String):void{
_dataField = _arg1;
}
public function get reason():String{
return (_reason);
}
override public function toString():String{
return (formatToString("DataGridEvent", "type", "bubbles", "cancelable", "columnIndex", "rowIndex", "itemRenderer", "dataField", "reason"));
}
override public function clone():Event{
return (new DataGridEvent(type, bubbles, cancelable, columnIndex, int(rowIndex), _itemRenderer, _dataField, _reason));
}
}
}//package fl.events
Section 117
//DataGridEventReason (fl.events.DataGridEventReason)
package fl.events {
public final class DataGridEventReason {
public static const CANCELLED:String = "cancelled";
public static const OTHER:String = "other";
public static const NEW_COLUMN:String = "newColumn";
public static const NEW_ROW:String = "newRow";
}
}//package fl.events
Section 118
//InteractionInputType (fl.events.InteractionInputType)
package fl.events {
public class InteractionInputType {
public static const MOUSE:String = "mouse";
public static const KEYBOARD:String = "keyboard";
}
}//package fl.events
Section 119
//ListEvent (fl.events.ListEvent)
package fl.events {
import flash.events.*;
public class ListEvent extends Event {
protected var _rowIndex:int;
protected var _columnIndex:int;
protected var _index:int;
protected var _item:Object;
public static const ITEM_ROLL_OUT:String = "itemRollOut";
public static const ITEM_ROLL_OVER:String = "itemRollOver";
public static const ITEM_CLICK:String = "itemClick";
public static const ITEM_DOUBLE_CLICK:String = "itemDoubleClick";
public function ListEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:int=-1, _arg5:int=-1, _arg6:int=-1, _arg7:Object=null){
super(_arg1, _arg2, _arg3);
_rowIndex = _arg5;
_columnIndex = _arg4;
_index = _arg6;
_item = _arg7;
}
public function get rowIndex():Object{
return (_rowIndex);
}
public function get columnIndex():int{
return (_columnIndex);
}
public function get index():int{
return (_index);
}
public function get item():Object{
return (_item);
}
override public function toString():String{
return (formatToString("ListEvent", "type", "bubbles", "cancelable", "columnIndex", "rowIndex", "index", "item"));
}
override public function clone():Event{
return (new ListEvent(type, bubbles, cancelable, _columnIndex, _rowIndex));
}
}
}//package fl.events
Section 120
//ScrollEvent (fl.events.ScrollEvent)
package fl.events {
import flash.events.*;
public class ScrollEvent extends Event {
private var _direction:String;
private var _delta:Number;
private var _position:Number;
public static const SCROLL:String = "scroll";
public function ScrollEvent(_arg1:String, _arg2:Number, _arg3:Number){
super(ScrollEvent.SCROLL, false, false);
_direction = _arg1;
_delta = _arg2;
_position = _arg3;
}
public function get direction():String{
return (_direction);
}
public function get delta():Number{
return (_delta);
}
public function get position():Number{
return (_position);
}
override public function toString():String{
return (formatToString("ScrollEvent", "type", "bubbles", "cancelable", "direction", "delta", "position"));
}
override public function clone():Event{
return (new ScrollEvent(_direction, _delta, _position));
}
}
}//package fl.events
Section 121
//SliderEvent (fl.events.SliderEvent)
package fl.events {
import flash.events.*;
public class SliderEvent extends Event {
protected var _triggerEvent:String;
protected var _value:Number;
protected var _keyCode:Number;
protected var _clickTarget:String;
public static const CHANGE:String = "change";
public static const THUMB_DRAG:String = "thumbDrag";
public static const THUMB_PRESS:String = "thumbPress";
public static const THUMB_RELEASE:String = "thumbRelease";
public function SliderEvent(_arg1:String, _arg2:Number, _arg3:String, _arg4:String, _arg5:int=0){
_value = _arg2;
_keyCode = _arg5;
_triggerEvent = _arg4;
_clickTarget = _arg3;
super(_arg1);
}
public function get value():Number{
return (_value);
}
public function get keyCode():Number{
return (_keyCode);
}
public function get triggerEvent():String{
return (_triggerEvent);
}
public function get clickTarget():String{
return (_clickTarget);
}
override public function toString():String{
return (formatToString("SliderEvent", "type", "value", "bubbles", "cancelable", "keyCode", "triggerEvent", "clickTarget"));
}
override public function clone():Event{
return (new SliderEvent(type, _value, _clickTarget, _triggerEvent, _keyCode));
}
}
}//package fl.events
Section 122
//SliderEventClickTarget (fl.events.SliderEventClickTarget)
package fl.events {
public class SliderEventClickTarget {
public static const THUMB:String = "thumb";
public static const TRACK:String = "track";
}
}//package fl.events
Section 123
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import flash.display.*;
import fl.core.*;
import fl.controls.*;
import flash.events.*;
import flash.text.*;
import flash.utils.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var _form:DisplayObjectContainer;
private var focusableObjects:Dictionary;
private var focusableCandidates:Array;
private var activated:Boolean;// = false
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var _showFocusIndicator:Boolean;// = true
private var lastAction:String;
private var defButton:Button;
private var _defaultButton:Button;
private var _defaultButtonEnabled:Boolean;// = true
public function FocusManager(_arg1:DisplayObjectContainer){
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
activate();
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local4:InteractiveObject;
var _local3:DisplayObject = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler, false);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler, false, 0, true);
};
};
removeFocusables(_local3);
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler, false, 0, true);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler, false, 0, true);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler, false, 0, true);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler, false, 0, true);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler, false, 0, true);
if ((((((doc is Stage)) || ((doc.parent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler, false);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler, false);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler, false);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local3:TextField;
var _local4:SimpleButton;
var _local2:DisplayObjectContainer = DisplayObject(form).parent;
while (_arg1 != _local2) {
if ((_arg1 is UIComponent)){
if (!UIComponent(_arg1).enabled){
return (false);
};
} else {
if ((_arg1 is TextField)){
_local3 = TextField(_arg1);
if ((((_local3.type == TextFieldType.DYNAMIC)) || (!(_local3.selectable)))){
return (false);
};
} else {
if ((_arg1 is SimpleButton)){
_local4 = SimpleButton(_arg1);
if (!_local4.enabled){
return (false);
};
};
};
};
if (!_arg1.visible){
return (false);
};
_arg1 = _arg1.parent;
};
return (true);
}
private function tabEnabledChangeHandler(_arg1:Event):void{
calculateCandidates = true;
var _local2:InteractiveObject = InteractiveObject(_arg1.target);
var _local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function tabChildrenChangeHandler(_arg1:Event):void{
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
var _local2:DisplayObjectContainer = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function activate():void{
if (activated){
return;
};
addFocusables(form);
form.addEventListener(Event.ADDED, addedHandler, false, 0, true);
form.addEventListener(Event.REMOVED, removedHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true, 0, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true, 0, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler, false, 0, true);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true, 0, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
if (!activated){
return;
};
focusableObjects = new Dictionary(true);
focusableCandidates = null;
lastFocus = null;
defButton = null;
form.removeEventListener(Event.ADDED, addedHandler, false);
form.removeEventListener(Event.REMOVED, removedHandler, false);
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler, false);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler, false);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler, false);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local3:Button;
if (!activated){
return;
};
var _local2:InteractiveObject = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function focusOutHandler(_arg1:FocusEvent):void{
if (!activated){
return;
};
var _local2:InteractiveObject = (_arg1.target as InteractiveObject);
}
private function activateHandler(_arg1:Event):void{
if (!activated){
return;
};
var _local2:InteractiveObject = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
private function deactivateHandler(_arg1:Event):void{
if (!activated){
return;
};
var _local2:InteractiveObject = InteractiveObject(_arg1.target);
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if (!activated){
return;
};
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
if (!activated){
return;
};
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (!activated){
return;
};
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function mouseDownHandler(_arg1:MouseEvent):void{
if (!activated){
return;
};
if (_arg1.isDefaultPrevented()){
return;
};
var _local2:InteractiveObject = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
public function get defaultButton():Button{
return (_defaultButton);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
if (!hasFocusableObjects()){
return;
};
var _local2:InteractiveObject = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
var _local2:DisplayObject = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
var _local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
var _local4:int = getIndexOfFocusedObject(_local2);
var _local5:Boolean;
var _local6:int = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
var _local7:int = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int = focusableCandidates.length;
var _local3:int;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
var _local5:int = focusableCandidates.length;
var _local6:int = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local5:int;
var _local6:String;
var _local7:String;
var _local3 = "";
var _local4 = "";
var _local8 = "0000";
var _local9:DisplayObject = DisplayObject(_arg1);
var _local10:DisplayObject = DisplayObject(_arg2);
while (((!((_local9 == DisplayObject(form)))) && (_local9.parent))) {
_local5 = getChildIndex(_local9.parent, _local9);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local3 = (_local7 + _local3);
_local9 = _local9.parent;
};
while (((!((_local10 == DisplayObject(form)))) && (_local10.parent))) {
_local5 = getChildIndex(_local10.parent, _local10);
_local6 = _local5.toString(16);
if (_local6.length < 4){
_local7 = (_local8.substring(0, (4 - _local6.length)) + _local6);
};
_local4 = (_local7 + _local4);
_local10 = _local10.parent;
};
return (((_local3 > _local4)) ? 1 : ((_local3 < _local4)) ? -1 : 0);
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function get nextTabIndex():int{
return (0);
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
public function showFocus():void{
}
public function hideFocus():void{
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
while (_arg1 != InteractiveObject(form)) {
if ((((((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))) && (IFocusManagerComponent(_arg1).mouseFocusEnabled))) && (UIComponent(_arg1).enabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
if (_arg1 == null){
break;
};
};
return (null);
}
}
}//package fl.managers
Section 124
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import flash.display.*;
import fl.controls.*;
public interface IFocusManager {
function get defaultButton():Button;
function set defaultButton(_arg1:Button):void;
function get defaultButtonEnabled():Boolean;
function set defaultButtonEnabled(_arg1:Boolean):void;
function get nextTabIndex():int;
function get showFocusIndicator():Boolean;
function set showFocusIndicator(_arg1:Boolean):void;
function getFocus():InteractiveObject;
function setFocus(_arg1:InteractiveObject):void;
function showFocus():void;
function hideFocus():void;
function activate():void;
function deactivate():void;
function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
}
}//package fl.managers
Section 125
//IFocusManagerComponent (fl.managers.IFocusManagerComponent)
package fl.managers {
public interface IFocusManagerComponent {
function get focusEnabled():Boolean;
function set focusEnabled(_arg1:Boolean):void;
function get mouseFocusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function setFocus():void;
function drawFocus(_arg1:Boolean):void;
}
}//package fl.managers
Section 126
//IFocusManagerGroup (fl.managers.IFocusManagerGroup)
package fl.managers {
public interface IFocusManagerGroup {
function get groupName():String;
function set groupName(_arg1:String):void;
function get selected():Boolean;
function set selected(_arg1:Boolean):void;
}
}//package fl.managers
Section 127
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.text.*;
import flash.utils.*;
public class StyleManager {
private var styleToClassesHash:Object;
private var classToInstancesDict:Dictionary;
private var classToStylesDict:Dictionary;
private var classToDefaultStylesDict:Dictionary;
private var globalStyles:Object;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
public static function registerInstance(_arg1:UIComponent):void{
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
var inst:StyleManager = getInstance();
var classDef:Class = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
if (inst.classToStylesDict[classDef] == null){
inst.classToStylesDict[classDef] = {};
};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local5:String;
var _local2:StyleManager = getInstance();
var _local3:Class = getClassDef(_arg1);
var _local4:Object = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class = getClassDef(_arg1);
var _local4:StyleManager = getInstance();
var _local5:Object = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class = getClassDef(_arg1);
var _local4:Object = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class = getClassDef(_arg1);
var _local4:Object = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class = getClassDef(_arg1);
var _local5:Object = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
private static function invalidateStyle(_arg1:String):void{
var _local3:Object;
var _local2:Dictionary = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local4:Object;
var _local5:UIComponent;
var _local3:Dictionary = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
}
}//package fl.managers
Section 128
//Cubic (fl.motion.easing.Cubic)
package fl.motion.easing {
public class Cubic {
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * _arg1) + 2)) + _arg2));
}
}
}//package fl.motion.easing
Section 129
//Elastic (fl.motion.easing.Elastic)
package fl.motion.easing {
public class Elastic {
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
--_arg1;
return ((-(((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6)))) + _arg2));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
return (((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6))) + _arg3) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 == 2){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * (0.3 * 1.5));
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
if (_arg1 < 1){
--_arg1;
return (((-0.5 * ((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6)))) + _arg2));
};
--_arg1;
return ((((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6))) * 0.5) + _arg3) + _arg2));
}
}
}//package fl.motion.easing
Section 130
//Linear (fl.motion.easing.Linear)
package fl.motion.easing {
public class Linear {
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
}
}//package fl.motion.easing
Section 131
//DefaultPreloader (gg.app.branding.DefaultPreloader)
package gg.app.branding {
import flash.display.*;
public class DefaultPreloader extends MovieClip {
protected var _playCallback:Function;
public function DefaultPreloader(){
visible = false;
}
public function init(_arg1:Function):void{
visible = true;
_playCallback = _arg1;
}
}
}//package gg.app.branding
Section 132
//GodvilGamesPreloader (gg.app.branding.GodvilGamesPreloader)
package gg.app.branding {
import flash.events.*;
import flash.display.*;
import com.greensock.*;
import gg.engine.utils.*;
import com.dynamicflash.util.*;
import gg.engine.utils.graphicsFill.*;
import CPMStar.*;
import flash.text.*;
public class GodvilGamesPreloader extends DefaultPreloader {
public var background:MovieClip;
public var adBox:MovieClip;
public var progressBar:MovieClip;
public var txtLoading:MovieClip;
public var btnSponsorLogo:SimpleButton;
public var gameIcon1:MovieClip;
public var txtProgress:TextField;
public var gameIcon2:MovieClip;
public var btnPlay:SimpleButton;
public var btnFacebook:SimpleButton;
public var btnTwitter:SimpleButton;
private var _liteBranded:Boolean;
private var _adLoader:AdLoader;
private var _adLoaderComplete:Boolean;
public function GodvilGamesPreloader(){
stop();
BrandingSettings.BLOCKED_DOMAINS = Base64.decode(BrandingSettings.BLOCKED_DOMAINS[0]).split(",");
BrandingSettings.LITE_BRANDED_DOMAINS = Base64.decode(BrandingSettings.LITE_BRANDED_DOMAINS[0]).split(",");
}
override public function init(_arg1:Function):void{
super.init(_arg1);
setupBranding();
root.loaderInfo.addEventListener(Event.COMPLETE, onRoot_LoaderInfo_Complete);
root.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onRoot_LoaderInfo_Progress);
btnPlay.addEventListener(MouseEvent.CLICK, onPlay_Click);
btnSponsorLogo.addEventListener(MouseEvent.CLICK, onSponsorLogo_Click);
background.addEventListener(MouseEvent.CLICK, onBackground_Click);
btnFacebook.addEventListener(MouseEvent.CLICK, onFacebook_Click);
btnTwitter.addEventListener(MouseEvent.CLICK, onTwitter_Click);
btnPlay.visible = false;
adBox.alpha = 0;
adBox.mouseEnabled = false;
}
private function setupGameIcons():void{
gameIcon1.gotoAndStop((1 + int(((4 * Math.random()) + 0.5))));
gameIcon2.gotoAndStop(int(((Math.random() * gameIcon2.totalFrames) + 0.5)));
while (gameIcon1.currentFrame == gameIcon2.currentFrame) {
gameIcon2.gotoAndStop(int(((Math.random() * gameIcon2.totalFrames) + 0.5)));
};
gameIcon1.buttonMode = (gameIcon2.buttonMode = true);
gameIcon1.addEventListener(MouseEvent.CLICK, onGameIcon_Click);
gameIcon2.addEventListener(MouseEvent.CLICK, onGameIcon_Click);
}
private function setupBranding():void{
_liteBranded = UDomain.checkDomain(BrandingSettings.LITE_BRANDED_DOMAINS);
if (_liteBranded){
gameIcon1.visible = (gameIcon2.visible = false);
} else {
setupGameIcons();
_adLoader = new AdLoader(BrandingSettings.CPMSTAR_CONTENT_SPOT_ID);
_adLoader.addEventListener(AdLoader.LOADED, onAdLoader_Loaded);
adBox.addChild(_adLoader);
};
}
private function showPlayButton():void{
btnPlay.visible = true;
removeChild(txtProgress);
removeChild(txtLoading);
}
private function tryToShowCPMStar():void{
if ((((((progressBar.currentFrame >= 50)) && (_adLoaderComplete))) && (!(adBox.alpha)))){
adBox.alpha = 1;
};
}
private function onRoot_LoaderInfo_Complete(_arg1:Event):void{
root.loaderInfo.removeEventListener(Event.COMPLETE, onRoot_LoaderInfo_Complete);
root.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, onRoot_LoaderInfo_Progress);
if (_liteBranded){
showPlayButton();
} else {
TweenLite.delayedCall(3, showPlayButton);
};
progressBar.gotoAndStop(100);
txtProgress.text = "100%";
tryToShowCPMStar();
}
private function onRoot_LoaderInfo_Progress(_arg1:ProgressEvent):void{
progressBar.gotoAndStop(int(((100 * _arg1.bytesLoaded) / _arg1.bytesTotal)));
txtProgress.text = (String(progressBar.currentFrame) + "%");
tryToShowCPMStar();
}
private function onPlay_Click(_arg1:MouseEvent):void{
var onTween_Complete:Function;
var e = _arg1;
onTween_Complete = function ():void{
TweenLite.delayedCall(0.5, toApp);
};
btnPlay.removeEventListener(MouseEvent.CLICK, onPlay_Click);
btnFacebook.removeEventListener(MouseEvent.CLICK, onFacebook_Click);
btnTwitter.removeEventListener(MouseEvent.CLICK, onTwitter_Click);
if (!_liteBranded){
gameIcon1.removeEventListener(MouseEvent.CLICK, onGameIcon_Click);
gameIcon2.removeEventListener(MouseEvent.CLICK, onGameIcon_Click);
ShowHide.hide(gameIcon1, 1, {filler:Bubbles});
ShowHide.hide(gameIcon2, 1, {filler:Bubbles});
if (adBox.alpha){
ShowHide.hide(adBox, 1, {filler:Bubbles});
};
};
ShowHide.hide(btnPlay, 1, {filler:Bubbles});
ShowHide.hide(progressBar, 1, {filler:Bubbles});
ShowHide.hide(btnFacebook, 1, {filler:Bubbles});
ShowHide.hide(btnTwitter, 1, {filler:Bubbles});
TweenLite.to(btnSponsorLogo, 1, {y:(0.5 * (BrandingSettings.HEIGHT - btnSponsorLogo.height)), delay:1, onComplete:onTween_Complete});
}
private function toApp():void{
btnSponsorLogo.removeEventListener(MouseEvent.CLICK, onSponsorLogo_Click);
background.removeEventListener(MouseEvent.CLICK, onBackground_Click);
if (((!(_liteBranded)) && ((adBox.numChildren > 1)))){
adBox.removeChildAt(0);
adBox.removeChildAt(0);
};
if (!UDomain.checkDomain(BrandingSettings.LOCKED_DOMAINS, BrandingSettings.BLOCKED_DOMAINS)){
gotoAndStop(2);
return;
};
_playCallback();
}
private function onSponsorLogo_Click(_arg1:MouseEvent):void{
openURL(BrandingSettings.PRELOADER_SPONSOR_LOGO_URL);
}
private function onBackground_Click(_arg1:MouseEvent):void{
openURL(BrandingSettings.PRELOADER_BACKGROUND_URL);
}
private function onGameIcon_Click(_arg1:MouseEvent):void{
var _local2:MovieClip = (_arg1.target as MovieClip);
openURL(((BrandingSettings.ANY_GAME_URL_START + _local2.currentLabel) + BrandingSettings.PRELOADER_GAME_ICON_URL_END));
}
private function onFacebook_Click(_arg1:MouseEvent):void{
openURL(BrandingSettings.FACEBOOK_PAGE_URL);
}
private function onTwitter_Click(_arg1:MouseEvent):void{
openURL(BrandingSettings.TWITTER_PAGE_URL);
}
private function onAdLoader_Loaded(_arg1:Event):void{
_adLoader.removeEventListener(AdLoader.LOADED, onAdLoader_Loaded);
_adLoaderComplete = true;
tryToShowCPMStar();
}
}
}//package gg.app.branding
Section 133
//Y8Preloader (gg.app.branding.Y8Preloader)
package gg.app.branding {
import flash.events.*;
import flash.display.*;
import com.greensock.*;
import gg.engine.utils.*;
import CPMStar.*;
public class Y8Preloader extends DefaultPreloader {
public var adBox:MovieClip;
public var progressBar:MovieClip;
public var btnSponsorLogo:SimpleButton;
public var btnPlay:SimpleButton;
private var _adLoader:AdLoader;
private var _adLoaderComplete:Boolean;
override public function init(_arg1:Function):void{
super.init(_arg1);
setupBranding();
root.loaderInfo.addEventListener(Event.COMPLETE, onRoot_LoaderInfo_Complete);
root.loaderInfo.addEventListener(ProgressEvent.PROGRESS, onRoot_LoaderInfo_Progress);
btnPlay.addEventListener(MouseEvent.CLICK, onPlay_Click);
btnSponsorLogo.addEventListener(MouseEvent.CLICK, onSponsorLogo_Click);
btnPlay.visible = false;
adBox.alpha = 0;
}
private function setupBranding():void{
_adLoader = new AdLoader(BrandingSettings.CPMSTAR_CONTENT_SPOT_ID);
_adLoader.addEventListener(AdLoader.LOADED, onAdLoader_Loaded);
adBox.addChild(_adLoader);
}
private function showPlayButton():void{
btnPlay.visible = true;
}
private function tryToShowCPMStar():void{
if ((((((progressBar.bar.scaleX >= 0.5)) && (_adLoaderComplete))) && (!(adBox.alpha)))){
adBox.alpha = 1;
};
}
private function onRoot_LoaderInfo_Complete(_arg1:Event):void{
root.loaderInfo.removeEventListener(Event.COMPLETE, onRoot_LoaderInfo_Complete);
root.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, onRoot_LoaderInfo_Progress);
progressBar.bar.scaleX = 1;
tryToShowCPMStar();
TweenLite.delayedCall(3, showPlayButton);
}
private function onRoot_LoaderInfo_Progress(_arg1:ProgressEvent):void{
progressBar.bar.scaleX = (_arg1.bytesLoaded / _arg1.bytesTotal);
tryToShowCPMStar();
}
private function onPlay_Click(_arg1:MouseEvent):void{
btnPlay.removeEventListener(MouseEvent.CLICK, onPlay_Click);
toApp();
}
private function toApp():void{
btnSponsorLogo.removeEventListener(MouseEvent.CLICK, onSponsorLogo_Click);
if (!(adBox.numChildren) > 1){
adBox.removeChildAt(0);
adBox.removeChildAt(0);
};
_playCallback();
}
private function onSponsorLogo_Click(_arg1:MouseEvent):void{
openURL(BrandingSettings.Y8_URL);
}
private function onAdLoader_Loaded(_arg1:Event):void{
_adLoader.removeEventListener(AdLoader.LOADED, onAdLoader_Loaded);
_adLoaderComplete = true;
tryToShowCPMStar();
}
}
}//package gg.app.branding
Section 134
//Cloud (gg.app.display.backgroundAssets.Cloud)
package gg.app.display.backgroundAssets {
import flash.display.*;
public dynamic class Cloud extends MovieClip {
}
}//package gg.app.display.backgroundAssets
Section 135
//BtnBack (gg.app.display.buttons.BtnBack)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnBack extends Sprite {
}
}//package gg.app.display.buttons
Section 136
//BtnCancel (gg.app.display.buttons.BtnCancel)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnCancel extends Sprite {
}
}//package gg.app.display.buttons
Section 137
//BtnClear (gg.app.display.buttons.BtnClear)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnClear extends Sprite {
}
}//package gg.app.display.buttons
Section 138
//BtnHint (gg.app.display.buttons.BtnHint)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnHint extends Sprite {
}
}//package gg.app.display.buttons
Section 139
//BtnLoad (gg.app.display.buttons.BtnLoad)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnLoad extends Sprite {
}
}//package gg.app.display.buttons
Section 140
//BtnMainMenu (gg.app.display.buttons.BtnMainMenu)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnMainMenu extends Sprite {
}
}//package gg.app.display.buttons
Section 141
//BtnMoreGames1 (gg.app.display.buttons.BtnMoreGames1)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnMoreGames1 extends Sprite {
}
}//package gg.app.display.buttons
Section 142
//BtnMoreGames2 (gg.app.display.buttons.BtnMoreGames2)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnMoreGames2 extends Sprite {
}
}//package gg.app.display.buttons
Section 143
//BtnNext (gg.app.display.buttons.BtnNext)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnNext extends Sprite {
}
}//package gg.app.display.buttons
Section 144
//BtnNo (gg.app.display.buttons.BtnNo)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnNo extends Sprite {
}
}//package gg.app.display.buttons
Section 145
//BtnOk (gg.app.display.buttons.BtnOk)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnOk extends Sprite {
}
}//package gg.app.display.buttons
Section 146
//BtnRestart (gg.app.display.buttons.BtnRestart)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnRestart extends Sprite {
}
}//package gg.app.display.buttons
Section 147
//BtnRestart2 (gg.app.display.buttons.BtnRestart2)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnRestart2 extends Sprite {
}
}//package gg.app.display.buttons
Section 148
//BtnSaveLoad (gg.app.display.buttons.BtnSaveLoad)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnSaveLoad extends Sprite {
}
}//package gg.app.display.buttons
Section 149
//BtnSettings (gg.app.display.buttons.BtnSettings)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnSettings extends Sprite {
}
}//package gg.app.display.buttons
Section 150
//BtnStep (gg.app.display.buttons.BtnStep)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnStep extends Sprite {
}
}//package gg.app.display.buttons
Section 151
//BtnSubmit (gg.app.display.buttons.BtnSubmit)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnSubmit extends Sprite {
}
}//package gg.app.display.buttons
Section 152
//BtnTest (gg.app.display.buttons.BtnTest)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnTest extends Sprite {
}
}//package gg.app.display.buttons
Section 153
//BtnUp (gg.app.display.buttons.BtnUp)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnUp extends Sprite {
}
}//package gg.app.display.buttons
Section 154
//BtnYes (gg.app.display.buttons.BtnYes)
package gg.app.display.buttons {
import flash.display.*;
public dynamic class BtnYes extends Sprite {
}
}//package gg.app.display.buttons
Section 155
//Facebook (gg.app.display.buttons.Facebook)
package gg.app.display.buttons {
import flash.display.*;
import gg.engine.utils.*;
import flash.events.*;
public class Facebook extends SimpleButton {
public function Facebook(){
addEventListener(MouseEvent.CLICK, onClick);
}
private function onClick(_arg1:MouseEvent):void{
openURL(BrandingSettings.FACEBOOK_PAGE_URL);
}
}
}//package gg.app.display.buttons
Section 156
//Twitter (gg.app.display.buttons.Twitter)
package gg.app.display.buttons {
import flash.display.*;
import gg.engine.utils.*;
import flash.events.*;
public class Twitter extends SimpleButton {
public function Twitter(){
addEventListener(MouseEvent.CLICK, onClick);
}
private function onClick(_arg1:MouseEvent):void{
openURL(BrandingSettings.TWITTER_PAGE_URL);
}
}
}//package gg.app.display.buttons
Section 157
//SoundOnOff (gg.app.display.hudAssets.SoundOnOff)
package gg.app.display.hudAssets {
import flash.display.*;
public dynamic class SoundOnOff extends MovieClip {
}
}//package gg.app.display.hudAssets
Section 158
//AchievementObtained (gg.app.display.windows.dialogs.AchievementObtained)
package gg.app.display.windows.dialogs {
import com.greensock.*;
import gg.engine.display.windows.*;
public class AchievementObtained extends Dialog {
override public function postInitialize():void{
TweenLite.delayedCall((_openTweenTime + _closeTweenTime), close);
}
}
}//package gg.app.display.windows.dialogs
Section 159
//CustomLevelComplete (gg.app.display.windows.dialogs.CustomLevelComplete)
package gg.app.display.windows.dialogs {
import flash.display.*;
import flash.events.*;
import gg.engine.display.windows.*;
import gg.app.display.buttons.*;
public class CustomLevelComplete extends ModalDialog {
public var btnSaveLoad:BtnSaveLoad;
public var btnMainMenu:BtnMainMenu;
public var btnEditLevel:MovieClip;
override public function postInitialize():void{
btnEditLevel.addEventListener(MouseEvent.CLICK, onEditLevel_Click);
btnSaveLoad.addEventListener(MouseEvent.CLICK, onSaveLoad_Click);
btnMainMenu.addEventListener(MouseEvent.CLICK, onMainMenu_Click);
}
override public function shutdown():void{
btnEditLevel.removeEventListener(MouseEvent.CLICK, onEditLevel_Click);
btnSaveLoad.removeEventListener(MouseEvent.CLICK, onSaveLoad_Click);
btnMainMenu.removeEventListener(MouseEvent.CLICK, onMainMenu_Click);
}
private function onEditLevel_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("LevelEditor", {levelCode:_initOptions.levelCode});
}
private function onSaveLoad_Click(_arg1:MouseEvent):void{
var loadCallback:Function;
var e = _arg1;
loadCallback = function (_arg1:String):void{
guiMgr.openWindow("Game", {levelCode:_arg1});
};
guiMgr.openWindow("SaveLoadLevel", {levelCode:_initOptions.levelCode, loadCallback:loadCallback});
}
private function onMainMenu_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("MainMenu", {});
}
}
}//package gg.app.display.windows.dialogs
Section 160
//CustomLevelFailed (gg.app.display.windows.dialogs.CustomLevelFailed)
package gg.app.display.windows.dialogs {
import flash.display.*;
import flash.events.*;
import gg.engine.display.windows.*;
import gg.app.display.buttons.*;
public class CustomLevelFailed extends ModalDialog {
public var btnMainMenu:BtnMainMenu;
public var btnEditLevel:MovieClip;
public var btnRestart:BtnRestart;
override public function postInitialize():void{
btnRestart.addEventListener(MouseEvent.CLICK, onRestart_Click);
btnEditLevel.addEventListener(MouseEvent.CLICK, onEditLevel_Click);
btnMainMenu.addEventListener(MouseEvent.CLICK, onMainMenu_Click);
}
override public function shutdown():void{
btnRestart.removeEventListener(MouseEvent.CLICK, onRestart_Click);
btnEditLevel.removeEventListener(MouseEvent.CLICK, onEditLevel_Click);
btnMainMenu.removeEventListener(MouseEvent.CLICK, onMainMenu_Click);
}
private function onRestart_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("Game", {levelCode:_initOptions.levelCode});
}
private function onEditLevel_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("LevelEditor", {levelCode:_initOptions.levelCode});
}
private function onMainMenu_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("MainMenu", {});
}
}
}//package gg.app.display.windows.dialogs
Section 161
//LevelEditorPanel (gg.app.display.windows.dialogs.LevelEditorPanel)
package gg.app.display.windows.dialogs {
import fl.controls.*;
import fl.data.*;
import gg.engine.display.windows.*;
import gg.app.display.buttons.*;
public class LevelEditorPanel extends Dialog {
public var btnClear:BtnClear;
public var checkCrashBall:CheckBox;
public var checkBangBall:CheckBox;
public var btnLeft:BtnUp;
public var btnSaveLoad:BtnSaveLoad;
public var btnStep:BtnStep;
public var cbActors:ComboBox;
public var btnUp:BtnUp;
public var btnTest:BtnTest;
public var btnDown:BtnUp;
public var btnMainMenu:BtnMainMenu;
public var checkBoomBall:CheckBox;
public var btnSettings:BtnSettings;
public var btnRight:BtnUp;
public function LevelEditorPanel(){
__setProp_cbActors_LevelEditorPanel_Layer2_0();
__setProp_checkCrashBall_LevelEditorPanel_Layer2_0();
__setProp_checkBoomBall_LevelEditorPanel_Layer2_0();
__setProp_checkBangBall_LevelEditorPanel_Layer2_0();
}
function __setProp_cbActors_LevelEditorPanel_Layer2_0(){
var itemObj0:SimpleCollectionItem;
var collProps0:Array;
var collProp0:Object;
var i0:int;
var j0:*;
try {
cbActors["componentInspectorSetting"] = true;
} catch(e:Error) {
};
var collObj0:DataProvider = new DataProvider();
collProps0 = [{label:"---", data:"---"}, {label:"RevoluteJoint", data:"AF"}, {label:"MovingPlatform", data:"AP"}, {label:"Evil", data:"AA"}, {label:"---Shapes---", data:"---"}, {label:"Rectangle", data:"AB"}, {label:"Triangle", data:"AC"}, {label:"Circle", data:"AD"}];
i0 = 0;
while (i0 < collProps0.length) {
itemObj0 = new SimpleCollectionItem();
collProp0 = collProps0[i0];
for (j0 in collProp0) {
itemObj0[j0] = collProp0[j0];
};
collObj0.addItem(itemObj0);
i0 = (i0 + 1);
};
cbActors.dataProvider = collObj0;
cbActors.editable = false;
cbActors.enabled = true;
cbActors.prompt = "";
cbActors.restrict = "";
cbActors.rowCount = 25;
cbActors.visible = true;
try {
cbActors["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_checkCrashBall_LevelEditorPanel_Layer2_0(){
try {
checkCrashBall["componentInspectorSetting"] = true;
} catch(e:Error) {
};
checkCrashBall.enabled = true;
checkCrashBall.label = "Crash";
checkCrashBall.labelPlacement = "left";
checkCrashBall.selected = false;
checkCrashBall.visible = true;
try {
checkCrashBall["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_checkBoomBall_LevelEditorPanel_Layer2_0(){
try {
checkBoomBall["componentInspectorSetting"] = true;
} catch(e:Error) {
};
checkBoomBall.enabled = true;
checkBoomBall.label = "Boom";
checkBoomBall.labelPlacement = "left";
checkBoomBall.selected = false;
checkBoomBall.visible = true;
try {
checkBoomBall["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_checkBangBall_LevelEditorPanel_Layer2_0(){
try {
checkBangBall["componentInspectorSetting"] = true;
} catch(e:Error) {
};
checkBangBall.enabled = true;
checkBangBall.label = "Bang";
checkBangBall.labelPlacement = "left";
checkBangBall.selected = false;
checkBangBall.visible = true;
try {
checkBangBall["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package gg.app.display.windows.dialogs
Section 162
//LevelEditorSettings (gg.app.display.windows.dialogs.LevelEditorSettings)
package gg.app.display.windows.dialogs {
import gg.engine.utils.*;
import flash.events.*;
import gg.engine.theater.edit.*;
import gg.engine.display.windows.*;
import flash.text.*;
public class LevelEditorSettings extends Dialog {
public var txtGridStep:TextField;
public var txtDragStep:TextField;
private var _theater:EditableTheater;
override public function initialize():void{
_theater = _initOptions.theater;
txtDragStep.text = String(_theater.dragStep);
txtGridStep.text = String(_theater.gridStep);
}
override public function postInitialize():void{
txtDragStep.addEventListener(Event.CHANGE, onDragStep_Change);
txtGridStep.addEventListener(Event.CHANGE, onGridStep_Change);
}
override public function shutdown():void{
txtDragStep.removeEventListener(Event.CHANGE, onDragStep_Change);
txtGridStep.removeEventListener(Event.CHANGE, onGridStep_Change);
}
private function onDragStep_Change(_arg1:Event):void{
txtDragStep.text = UString.repairStrWithPositiveReal(txtDragStep.text);
_theater.dragStep = Number(txtDragStep.text);
}
private function onGridStep_Change(_arg1:Event):void{
txtGridStep.text = UString.repairStrWithPositiveReal(txtGridStep.text);
_theater.gridStep = Number(txtGridStep.text);
}
}
}//package gg.app.display.windows.dialogs
Section 163
//Message (gg.app.display.windows.dialogs.Message)
package gg.app.display.windows.dialogs {
import flash.events.*;
import gg.engine.display.windows.*;
import flash.text.*;
import gg.app.display.buttons.*;
public class Message extends ModalDialog {
public var txtMessage:TextField;
public var btnYes:BtnYes;
public var btnOk:BtnOk;
public var txtTitle:TextField;
public var btnNo:BtnNo;
private var _yesCallback:Function;
private var _noCallback:Function;
override public function initialize():void{
txtTitle.text = _initOptions.title.toUpperCase();
txtMessage.htmlText = _initOptions.message;
_yesCallback = _initOptions.yesCallback;
_noCallback = _initOptions.noCallback;
btnYes.visible = Boolean(_yesCallback);
btnNo.visible = btnYes.visible;
btnOk.visible = !(btnYes.visible);
}
override public function postInitialize():void{
if (Boolean(_yesCallback)){
btnYes.addEventListener(MouseEvent.CLICK, onYes_Click);
btnNo.addEventListener(MouseEvent.CLICK, onNo_Click);
} else {
btnOk.addEventListener(MouseEvent.CLICK, onOk_Click);
};
}
override public function shutdown():void{
if (Boolean(_yesCallback)){
btnYes.removeEventListener(MouseEvent.CLICK, onYes_Click);
btnNo.removeEventListener(MouseEvent.CLICK, onNo_Click);
} else {
btnOk.addEventListener(MouseEvent.CLICK, onOk_Click);
};
}
private function onOk_Click(_arg1:MouseEvent):void{
close();
}
private function onYes_Click(_arg1:MouseEvent):void{
close();
if (Boolean(_yesCallback)){
_yesCallback();
};
}
private function onNo_Click(_arg1:MouseEvent):void{
close();
if (Boolean(_noCallback)){
_noCallback();
};
}
}
}//package gg.app.display.windows.dialogs
Section 164
//OfficialLevelComplete (gg.app.display.windows.dialogs.OfficialLevelComplete)
package gg.app.display.windows.dialogs {
import flash.display.*;
import gg.engine.utils.*;
import flash.events.*;
import gg.engine.display.windows.*;
import flash.text.*;
import gg.app.display.buttons.*;
public class OfficialLevelComplete extends ModalDialog {
public var txtScore:TextField;
public var btnTryIt:SimpleButton;
public var btnMoreGames:BtnMoreGames1;
public var btnNext:BtnNext;
override public function initialize():void{
txtScore.text = ("Score: " + _initOptions.score);
btnTryIt.visible = (_initOptions.levelIndex > 4);
}
override public function postInitialize():void{
btnMoreGames.addEventListener(MouseEvent.CLICK, onMoreGames_Click);
btnNext.addEventListener(MouseEvent.CLICK, onNext_Click);
btnTryIt.addEventListener(MouseEvent.CLICK, onTry_Click);
}
override public function shutdown():void{
btnMoreGames.removeEventListener(MouseEvent.CLICK, onMoreGames_Click);
btnNext.removeEventListener(MouseEvent.CLICK, onNext_Click);
btnTryIt.removeEventListener(MouseEvent.CLICK, onTry_Click);
}
private function onMoreGames_Click(_arg1:MouseEvent):void{
openURL(BrandingSettings.MORE_GAMES_URL);
}
private function onTry_Click(_arg1:MouseEvent):void{
openURL(BrandingSettings.TRY_IT_URL);
}
private function onNext_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("Game", {levelIndex:(_initOptions.levelIndex + 1), levelPack:_initOptions.levelPack});
}
}
}//package gg.app.display.windows.dialogs
Section 165
//Options (gg.app.display.windows.dialogs.Options)
package gg.app.display.windows.dialogs {
import fl.controls.*;
import flash.events.*;
import gg.engine.display.windows.*;
import gg.app.display.buttons.*;
public class Options extends ModalDialog {
public var cbSFX:CheckBox;
public var sliderMusicVol:Slider;
public var btnOk:BtnOk;
public var sliderSFXVol:Slider;
public var cbMusic:CheckBox;
public var sliderQuality:Slider;
public function Options(){
__setProp_cbSFX_Options_Layer2_0();
__setProp_cbMusic_Options_Layer2_0();
__setProp_sliderQuality_Options_Layer2_0();
__setProp_sliderSFXVol_Options_Layer2_0();
__setProp_sliderMusicVol_Options_Layer2_0();
}
override public function initialize():void{
updateParamsValues();
}
override public function postInitialize():void{
btnOk.addEventListener(MouseEvent.CLICK, onOk_Click);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
cbMusic.addEventListener(MouseEvent.CLICK, onMusic_Click);
sliderMusicVol.addEventListener(Event.CHANGE, onMusicVol_Change);
cbSFX.addEventListener(MouseEvent.CLICK, onSFX_Click);
sliderSFXVol.addEventListener(Event.CHANGE, onSFXVol_Change);
sliderQuality.addEventListener(Event.CHANGE, onQuality_Change);
}
override public function shutdown():void{
btnOk.removeEventListener(MouseEvent.CLICK, onOk_Click);
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
cbMusic.removeEventListener(MouseEvent.CLICK, onMusic_Click);
sliderMusicVol.removeEventListener(Event.CHANGE, onMusicVol_Change);
cbSFX.removeEventListener(MouseEvent.CLICK, onSFX_Click);
sliderSFXVol.removeEventListener(Event.CHANGE, onSFXVol_Change);
sliderQuality.removeEventListener(Event.CHANGE, onQuality_Change);
}
private function onOk_Click(_arg1:MouseEvent):void{
close();
}
private function updateParamsValues():void{
cbMusic.selected = !(Main.engine.soundMgr.musicMuting);
sliderMusicVol.value = Main.engine.soundMgr.musicVol;
cbSFX.selected = !(Main.engine.soundMgr.sfxMuting);
sliderSFXVol.value = Main.engine.soundMgr.sfxVol;
sliderQuality.value = Main.engine.guiMgr.graphicsLevel;
}
private function onEnterFrame(_arg1:Event):void{
updateParamsValues();
}
private function onMusic_Click(_arg1:MouseEvent):void{
Main.engine.soundMgr.musicMuting = !(cbMusic.selected);
}
private function onMusicVol_Change(_arg1:Event):void{
Main.engine.soundMgr.musicVol = sliderMusicVol.value;
}
private function onSFX_Click(_arg1:MouseEvent):void{
Main.engine.soundMgr.sfxMuting = !(cbSFX.selected);
}
private function onSFXVol_Change(_arg1:Event):void{
Main.engine.soundMgr.sfxVol = sliderSFXVol.value;
}
private function onQuality_Change(_arg1:Event):void{
Main.engine.guiMgr.graphicsLevel = sliderQuality.value;
}
function __setProp_cbSFX_Options_Layer2_0(){
try {
cbSFX["componentInspectorSetting"] = true;
} catch(e:Error) {
};
cbSFX.enabled = true;
cbSFX.label = "";
cbSFX.labelPlacement = "left";
cbSFX.selected = false;
cbSFX.visible = true;
try {
cbSFX["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_cbMusic_Options_Layer2_0(){
try {
cbMusic["componentInspectorSetting"] = true;
} catch(e:Error) {
};
cbMusic.enabled = true;
cbMusic.label = "";
cbMusic.labelPlacement = "left";
cbMusic.selected = false;
cbMusic.visible = true;
try {
cbMusic["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_sliderQuality_Options_Layer2_0(){
try {
sliderQuality["componentInspectorSetting"] = true;
} catch(e:Error) {
};
sliderQuality.direction = "horizontal";
sliderQuality.enabled = true;
sliderQuality.liveDragging = true;
sliderQuality.maximum = 3;
sliderQuality.minimum = 0;
sliderQuality.snapInterval = 1;
sliderQuality.tickInterval = 1;
sliderQuality.value = 0;
sliderQuality.visible = true;
try {
sliderQuality["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_sliderSFXVol_Options_Layer2_0(){
try {
sliderSFXVol["componentInspectorSetting"] = true;
} catch(e:Error) {
};
sliderSFXVol.direction = "horizontal";
sliderSFXVol.enabled = true;
sliderSFXVol.liveDragging = true;
sliderSFXVol.maximum = 1;
sliderSFXVol.minimum = 0;
sliderSFXVol.snapInterval = 0.01;
sliderSFXVol.tickInterval = 0.1;
sliderSFXVol.value = 0;
sliderSFXVol.visible = true;
try {
sliderSFXVol["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_sliderMusicVol_Options_Layer2_0(){
try {
sliderMusicVol["componentInspectorSetting"] = true;
} catch(e:Error) {
};
sliderMusicVol.direction = "horizontal";
sliderMusicVol.enabled = true;
sliderMusicVol.liveDragging = true;
sliderMusicVol.maximum = 1;
sliderMusicVol.minimum = 0;
sliderMusicVol.snapInterval = 0.01;
sliderMusicVol.tickInterval = 0.1;
sliderMusicVol.value = 0;
sliderMusicVol.visible = true;
try {
sliderMusicVol["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package gg.app.display.windows.dialogs
Section 166
//SaveLoadLevel (gg.app.display.windows.dialogs.SaveLoadLevel)
package gg.app.display.windows.dialogs {
import fl.controls.*;
import flash.events.*;
import gg.engine.common.*;
import gg.engine.display.windows.*;
import gg.app.display.buttons.*;
public class SaveLoadLevel extends ModalDialog {
public var txtLevelCode:TextArea;
public var btnLoad:BtnLoad;
public var btnCancel:BtnCancel;
override public function initialize():void{
txtLevelCode.text = "";
if (_initOptions.hasOwnProperty("levelCode")){
txtLevelCode.text = _initOptions.levelCode;
};
}
override public function postInitialize():void{
btnCancel.addEventListener(MouseEvent.CLICK, onCancel_Click);
btnLoad.addEventListener(MouseEvent.CLICK, onLoad_Click);
}
override public function shutdown():void{
btnCancel.removeEventListener(MouseEvent.CLICK, onCancel_Click);
btnLoad.removeEventListener(MouseEvent.CLICK, onLoad_Click);
}
private function onCancel_Click(_arg1:MouseEvent):void{
close();
}
private function onLoad_Click(_arg1:MouseEvent):void{
var _local2:Array = txtLevelCode.text.match(LevelCode.CODE_REG_EXP);
if (!_local2){
if (!txtLevelCode.text.length){
guiMgr.openWindow("Message", {title:"MESSAGE", message:"Level code is empty."});
} else {
guiMgr.openWindow("Message", {title:"MESSAGE", message:"Level code is wrong."});
};
return;
};
close();
if (_initOptions.loadCallback){
_initOptions.loadCallback(_local2[0]);
};
}
}
}//package gg.app.display.windows.dialogs
Section 167
//SprintFinished (gg.app.display.windows.dialogs.SprintFinished)
package gg.app.display.windows.dialogs {
import flash.events.*;
import gg.engine.display.windows.*;
import flash.text.*;
import mochi.as3.*;
import gg.app.display.buttons.*;
public class SprintFinished extends ModalDialog {
public var txtLevelsBeaten:TextField;
public var btnSubmit:BtnSubmit;
public var btnOk:BtnOk;
override public function initialize():void{
txtLevelsBeaten.text = ("Levels Beaten: " + _initOptions.levelsBeaten);
if (_initOptions.levelsBeaten > 9){
Main.engine.achievementMgr.obtainAchievement("Beat 10 levels in sprint");
};
}
override public function postInitialize():void{
btnSubmit.addEventListener(MouseEvent.CLICK, onSubmit_Click);
btnOk.addEventListener(MouseEvent.CLICK, onOk_Click);
}
override public function shutdown():void{
btnSubmit.removeEventListener(MouseEvent.CLICK, onSubmit_Click);
btnOk.removeEventListener(MouseEvent.CLICK, onOk_Click);
}
private function onSubmit_Click(_arg1:MouseEvent):void{
var onClose:Function;
var e = _arg1;
onClose = function ():void{
guiMgr.frozen = false;
};
if (!_initOptions.levelsBeaten){
return;
};
guiMgr.frozen = true;
MochiScores.showLeaderboard({boardID:BrandingSettings.SPRINT_LEADERBOARD_ID, score:_initOptions.levelsBeaten, onClose:onClose});
}
private function onOk_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("MainMenu", {});
}
}
}//package gg.app.display.windows.dialogs
Section 168
//Level0Hint1 (gg.app.display.windows.sheets.gameAssets.Level0Hint1)
package gg.app.display.windows.sheets.gameAssets {
import flash.display.*;
public dynamic class Level0Hint1 extends MovieClip {
}
}//package gg.app.display.windows.sheets.gameAssets
Section 169
//Level0Hint2 (gg.app.display.windows.sheets.gameAssets.Level0Hint2)
package gg.app.display.windows.sheets.gameAssets {
import flash.display.*;
public dynamic class Level0Hint2 extends MovieClip {
}
}//package gg.app.display.windows.sheets.gameAssets
Section 170
//Level0Hint3 (gg.app.display.windows.sheets.gameAssets.Level0Hint3)
package gg.app.display.windows.sheets.gameAssets {
import flash.display.*;
public dynamic class Level0Hint3 extends MovieClip {
}
}//package gg.app.display.windows.sheets.gameAssets
Section 171
//Level1Hint1 (gg.app.display.windows.sheets.gameAssets.Level1Hint1)
package gg.app.display.windows.sheets.gameAssets {
import flash.display.*;
public dynamic class Level1Hint1 extends MovieClip {
}
}//package gg.app.display.windows.sheets.gameAssets
Section 172
//Level2Hint1 (gg.app.display.windows.sheets.gameAssets.Level2Hint1)
package gg.app.display.windows.sheets.gameAssets {
import flash.display.*;
public dynamic class Level2Hint1 extends MovieClip {
}
}//package gg.app.display.windows.sheets.gameAssets
Section 173
//Theater (gg.app.display.windows.sheets.levelEditorAssets.Theater)
package gg.app.display.windows.sheets.levelEditorAssets {
import gg.engine.theater.edit.*;
public dynamic class Theater extends EditableTheater {
}
}//package gg.app.display.windows.sheets.levelEditorAssets
Section 174
//LevelSelector (gg.app.display.windows.sheets.levelSelectionAssets.LevelSelector)
package gg.app.display.windows.sheets.levelSelectionAssets {
import flash.display.*;
import flash.text.*;
public class LevelSelector extends MovieClip {
public var txtNumber:TextField;
public var levelIndex:int;
}
}//package gg.app.display.windows.sheets.levelSelectionAssets
Section 175
//LevelSelectorSprint (gg.app.display.windows.sheets.levelSelectionAssets.LevelSelectorSprint)
package gg.app.display.windows.sheets.levelSelectionAssets {
import flash.display.*;
public dynamic class LevelSelectorSprint extends MovieClip {
public function LevelSelectorSprint(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gg.app.display.windows.sheets.levelSelectionAssets
Section 176
//AnimatedStar (gg.app.display.windows.sheets.LevelSelectionAssets.levelSelectorAssets.AnimatedStar)
package gg.app.display.windows.sheets.LevelSelectionAssets.levelSelectorAssets {
import flash.display.*;
public dynamic class AnimatedStar extends MovieClip {
}
}//package gg.app.display.windows.sheets.LevelSelectionAssets.levelSelectorAssets
Section 177
//Achievements (gg.app.display.windows.sheets.Achievements)
package gg.app.display.windows.sheets {
import flash.display.*;
import flash.events.*;
import com.greensock.*;
import gg.engine.display.windows.*;
import flash.utils.*;
import fl.motion.easing.*;
import gg.app.display.buttons.*;
public class Achievements extends Sheet {
public var star1:MovieClip;
public var star2:MovieClip;
public var star3:MovieClip;
public var star4:MovieClip;
public var star5:MovieClip;
public var star6:MovieClip;
public var star7:MovieClip;
public var btnMainMenu:BtnMainMenu;
private var _stars:Dictionary;
public function Achievements(){
_stars = new Dictionary();
_stars["Beat 5 levels"] = star1;
_stars["Beat 10 levels"] = star2;
_stars["Beat the game"] = star3;
_stars["Beat 10 levels in sprint"] = star4;
_stars["Beat a custom level"] = star5;
_stars["Submit highscores"] = star6;
_stars["Click on more games"] = star7;
}
override public function initialize():void{
var _local1:String;
var _local2:MovieClip;
guiMgr.hud.state = "Achievements";
for (_local1 in _stars) {
_local2 = _stars[_local1];
if (Main.engine.achievementMgr.isAchievementObtained(_local1)){
_local2.gotoAndStop("obtained");
_local2.addEventListener(MouseEvent.MOUSE_OVER, onStar_MouseOver);
_local2.addEventListener(MouseEvent.MOUSE_OUT, onStar_MouseOut);
};
};
}
override public function postInitialize():void{
btnMainMenu.addEventListener(MouseEvent.CLICK, onMainMenu_Click);
}
override public function shutdown():void{
var _local1:String;
var _local2:MovieClip;
btnMainMenu.removeEventListener(MouseEvent.CLICK, onMainMenu_Click);
for (_local1 in _stars) {
_local2 = _stars[_local1];
if (Main.engine.achievementMgr.isAchievementObtained(_local1)){
_local2.removeEventListener(MouseEvent.MOUSE_OVER, onStar_MouseOver);
_local2.removeEventListener(MouseEvent.MOUSE_OUT, onStar_MouseOut);
};
};
}
private function onMainMenu_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("MainMenu", {});
}
private function onStar_MouseOver(_arg1:MouseEvent):void{
var _local2:DisplayObject = (_arg1.currentTarget as DisplayObject);
setChildIndex(_local2, (numChildren - 1));
TweenLite.to(_local2, 1, {scaleX:1.5, scaleY:1.5, rotation:20, ease:Elastic.easeOut});
}
private function onStar_MouseOut(_arg1:MouseEvent):void{
TweenLite.to(_arg1.currentTarget, 1, {scaleX:1, scaleY:1, rotation:0, ease:Elastic.easeOut});
}
}
}//package gg.app.display.windows.sheets
Section 178
//Game (gg.app.display.windows.sheets.Game)
package gg.app.display.windows.sheets {
import flash.geom.*;
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import gg.engine.utils.*;
import gg.engine.theater.*;
import flash.events.*;
import gg.engine.common.*;
import gg.engine.display.windows.*;
import flash.utils.*;
import gg.engine.ui.*;
import gg.app.theater.*;
import gg.app.display.windows.sheets.gameAssets.*;
import gg.app.theater.actors.*;
import com.troygilbert.*;
public class Game extends Sheet {
private var _hintMgr:HintManager;
private var _theater:Theater;
private var _bound:Rectangle;
private var _mode:int;
private var _tickedTimer:TickedTimer;
private var _levelPack:LevelPack;
private var _score:int;
private var _sprintLevels:Array;
private var _levelsBeaten:int;
private var _time:Number;
private var _addingBallHolder:Sprite;
private var _arrow:MovieClip;
private var _addingBall:BallShape;
private var _canAdd:Boolean;
private var _ballInTheaterTime:Number;
private var _ballsDesc:int;
private var _ballPanelExpanded:Boolean;// = true
private var _ballPanelWait:Boolean;// = false
private var _gameOverDelay:Number;
private static const _NONE:int = 0;
private static const _CUSTOM:int = 1;
private static const _OFFICIAL:int = 2;
private static const _SPRINT:int = 3;
public static var instance:Game;
public function Game(){
_hintMgr = new HintManager();
_theater = new Theater();
_bound = new Rectangle(0, 0, Settings.WIDTH, Settings.HEIGHT);
_tickedTimer = new TickedTimer();
_addingBallHolder = new Sprite();
var _local1:Class = (getDefinitionByName("arrow") as Class);
_arrow = MovieClip(new (_local1));
_addingBallHolder.mouseChildren = false;
_addingBallHolder.mouseEnabled = false;
_arrow.mouseEnabled = false;
_arrow.mouseChildren = false;
addChild(_hintMgr);
addChild(_theater);
addChild(_addingBallHolder);
_addingBallHolder.addChild(_arrow);
_theater.world.SetContactListener(new ContactListener());
_theater.world.SetBoundaryListener(new BoundListener());
_hintMgr.add(0, [new Level0Hint1(), new Level0Hint2(), new Level0Hint3()]);
_hintMgr.add(1, [new Level1Hint1()]);
_hintMgr.add(2, [new Level2Hint1()]);
}
public function isDangerForEvil():Boolean{
return ((((((_ballInTheaterTime > 0)) || (_addingBall))) || (!(_ballPanelExpanded))));
}
override public function initialize():void{
var _local1:Object;
instance = this;
selectMode();
if (_mode == _CUSTOM){
guiMgr.hud.state = "GameCustomLevel";
_local1 = LevelCode.decode(_initOptions.levelCode);
_score = (Settings.GAME_INIT_SCORE + 1);
} else {
if (_mode == _OFFICIAL){
guiMgr.hud.state = "GameOfficialLevel";
_levelPack = _initOptions.levelPack;
_local1 = LevelCode.decode(_levelPack.getLevelCode(_initOptions.levelIndex));
_score = ((Settings.GAME_INIT_SCORE + 1) + (Settings.GAME_ADDITION_SCORE * _initOptions.levelIndex));
guiMgr.hud.txtLevelIndex.text = (((_initOptions.levelIndex + 1) + "/") + _levelPack.numLevels);
} else {
if (_mode == _SPRINT){
guiMgr.hud.state = "GameSprint";
_levelPack = _initOptions.levelPack;
if (!_sprintLevels){
startSprint();
};
_local1 = LevelCode.decode(_levelPack.getLevelCode(_sprintLevels[0]));
guiMgr.hud.txtLevelsBeaten.text = ("Beaten: " + _levelsBeaten);
guiMgr.hud.txtTime.text = ("Time: " + secondsToMinutes(_time));
} else {
close();
};
};
};
_theater.code = _local1.theater;
_ballsDesc = int(_local1.balls);
_ballPanelExpanded = false;
guiMgr.hud.ballPanel.crashBall.visible = true;
guiMgr.hud.ballPanel.boomBall.visible = true;
guiMgr.hud.ballPanel.bangBall.visible = true;
updateBallsPanel();
updateHUD();
_canAdd = true;
_ballInTheaterTime = 0;
_gameOverDelay = 0;
_arrow.visible = false;
}
override public function postInitialize():void{
addEventListener(Event.ENTER_FRAME, onEnterFrame);
guiMgr.hud.btnBack.addEventListener(MouseEvent.CLICK, onHUD_Back_Click);
guiMgr.hud.btnRestart.addEventListener(MouseEvent.CLICK, onHUD_Restart_Click);
guiMgr.hud.btnHint.addEventListener(MouseEvent.CLICK, onHUD_Hint_Click);
guiMgr.hud.ballPanel.crashBall.addEventListener(MouseEvent.CLICK, onHUD_CrashBall_Click);
guiMgr.hud.ballPanel.boomBall.addEventListener(MouseEvent.CLICK, onHUD_BoomBall_Click);
guiMgr.hud.ballPanel.bangBall.addEventListener(MouseEvent.CLICK, onHUD_BangBall_Click);
_theater.addEventListener(MouseEvent.CLICK, onTheater_Click);
if (_mode == _OFFICIAL){
_hintMgr.show(_initOptions.levelIndex);
};
_tickedTimer.tick();
}
override public function shutdown():void{
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
guiMgr.hud.btnBack.removeEventListener(MouseEvent.CLICK, onHUD_Back_Click);
guiMgr.hud.btnRestart.removeEventListener(MouseEvent.CLICK, onHUD_Restart_Click);
guiMgr.hud.btnHint.removeEventListener(MouseEvent.CLICK, onHUD_Hint_Click);
guiMgr.hud.ballPanel.crashBall.removeEventListener(MouseEvent.CLICK, onHUD_CrashBall_Click);
guiMgr.hud.ballPanel.boomBall.removeEventListener(MouseEvent.CLICK, onHUD_BoomBall_Click);
guiMgr.hud.ballPanel.bangBall.removeEventListener(MouseEvent.CLICK, onHUD_BangBall_Click);
_theater.removeEventListener(MouseEvent.CLICK, onTheater_Click);
}
override public function postShutdown():void{
setAddingBall(null);
_theater.removeAllActors();
_hintMgr.hide();
}
public function setAddingBall(_arg1:String):void{
if (((_addingBall) && (!(_arg1)))){
_addingBallHolder.removeChild(_addingBall);
ActorPool.release(_addingBall);
_addingBall = null;
};
if (((!(_addingBall)) && (_arg1))){
_addingBall = (ActorPool.acquire(_arg1) as BallShape);
_addingBall.x = mouseX;
_addingBall.y = mouseY;
_addingBallHolder.addChild(_addingBall);
};
_ballPanelWait = true;
}
private function selectMode():void{
if (_initOptions.hasOwnProperty("levelCode")){
_mode = _CUSTOM;
} else {
if (((_initOptions.hasOwnProperty("levelPack")) && (_initOptions.hasOwnProperty("levelIndex")))){
_mode = _OFFICIAL;
} else {
if (((_initOptions.hasOwnProperty("levelPack")) && (_initOptions.hasOwnProperty("sprint")))){
_mode = _SPRINT;
} else {
_mode = _NONE;
};
};
};
}
private function startSprint():void{
var _local1:int;
_sprintLevels = new Array();
while (_local1 < _levelPack.numLevels) {
_sprintLevels.push(_local1);
_local1++;
};
UArray.shuffle(_sprintLevels);
_levelsBeaten = 0;
_time = 180;
guiMgr.openWindow("Message", {title:"MESSAGE", message:"You are in the \"Sprint Mode\".\n\nTry to beat as many levels, as you can for 180 seconds!\n\nGood luck!"});
}
private function finishSprint():void{
_sprintLevels = null;
guiMgr.openWindow("SprintFinished", {levelsBeaten:_levelsBeaten});
}
private function levelFailed():void{
Main.engine.soundMgr.playSFX("Fail");
if (_mode == _CUSTOM){
guiMgr.openWindow("CustomLevelFailed", {levelCode:_initOptions.levelCode});
} else {
if (_mode == _OFFICIAL){
restart();
} else {
if (_mode == _SPRINT){
restart();
};
};
};
}
private function levelComplete():void{
Main.engine.soundMgr.playSFX("Win");
if (_mode == _CUSTOM){
guiMgr.openWindow("CustomLevelComplete", {levelCode:_initOptions.levelCode});
Main.engine.achievementMgr.obtainAchievement("Beat a custom level");
} else {
if (_mode == _OFFICIAL){
if (_initOptions.levelIndex == _levelPack.levelsBeaten){
_levelPack.levelsBeaten++;
};
if (_score > _levelPack.getScore(_initOptions.levelIndex)){
_levelPack.setScore(_initOptions.levelIndex, _score);
};
if (_initOptions.levelIndex < (_levelPack.numLevels - 1)){
guiMgr.openWindow("OfficialLevelComplete", {levelIndex:_initOptions.levelIndex, score:_score, levelPack:_levelPack});
if (_levelPack.levelsBeaten == 5){
Main.engine.achievementMgr.obtainAchievement("Beat 5 levels");
} else {
if (_levelPack.levelsBeaten == 10){
Main.engine.achievementMgr.obtainAchievement("Beat 10 levels");
};
};
} else {
if (!_levelPack.beaten){
_levelPack.beaten = true;
guiMgr.openWindow("LevelSelection", {levelPack:_levelPack});
guiMgr.openWindow("Message", {title:"MESSAGE", message:"Congratulations! You finished all levels!\n\nCreate your own levels and share them with friends with our editor! Also, try sprint mode.\n\nThanks for the game!"});
Main.engine.achievementMgr.obtainAchievement("Beat the game");
return;
};
guiMgr.openWindow("LevelSelection", {levelPack:_levelPack});
};
} else {
if (_mode == _SPRINT){
_sprintLevels.shift();
_levelsBeaten++;
if (_sprintLevels.length){
restart();
} else {
finishSprint();
};
};
};
};
}
private function checkWin():void{
var _local2:Actor;
var _local3:BallShape;
var _local8:Evil;
var _local1:Boolean;
if (_ballInTheaterTime){
_ballInTheaterTime = (_ballInTheaterTime - Settings.PHYS_DT);
if (_ballInTheaterTime <= 0){
_ballInTheaterTime = 0;
_local1 = true;
};
};
var _local4:int = (_theater.actors.length - 1);
while (_local4 > -1) {
_local2 = _theater.actors[_local4];
if (_local2.y > _bound.bottom){
//unresolved if
_theater.removeActor(_local2);
} else {
_local3 = (_local2 as BallShape);
if (((_local3) && (((_local3.body.IsSleeping()) || (_local1))))){
_local3.dissapear();
};
};
_local4--;
};
var _local5:Boolean;
var _local6:int;
var _local7:int;
for each (_local2 in _theater.actors) {
_local8 = (_local2 as Evil);
_local3 = (_local2 as BallShape);
if (_local8){
_local8.updateFaceFrame();
_local6++;
if (!_local8.body.IsSleeping()){
_local7++;
};
};
if (_local3){
_local5 = true;
};
};
if (!_local5){
_ballInTheaterTime = 0;
};
if (_gameOverDelay > 0){
_gameOverDelay = (_gameOverDelay - Settings.PHYS_DT);
if (_gameOverDelay <= 0){
_gameOverDelay = 0;
};
};
if (_local6 == 0){
levelComplete();
} else {
if ((((((((((_ballsDesc == 0)) && ((_ballInTheaterTime == 0)))) && (!(_addingBall)))) && ((_local7 == 0)))) && ((_gameOverDelay <= 0)))){
levelFailed();
};
};
}
private function updateHUD():void{
if ((((_mode == _OFFICIAL)) || ((_mode == _CUSTOM)))){
if (_score != 0){
_score--;
guiMgr.hud.txtScore.text = ("Score: " + _score);
};
} else {
if (_mode == _SPRINT){
_time = (_time - (0.001 * _tickedTimer.duration));
if (_time <= 0){
guiMgr.hud.txtTime.text = "Time: 0:00";
finishSprint();
} else {
guiMgr.hud.txtTime.text = ("Time: " + secondsToMinutes(_time));
};
};
};
updateBallsPanelPos();
}
private function onEnterFrame(_arg1:Event):void{
_tickedTimer.tick();
if (guiMgr.sheetOverlapping){
return;
};
if (Main.engine.keyboardMgr.isKeyDown(KeyboardManager.R)){
restart();
};
_theater.step();
if (_arrow.visible){
updateArrow();
} else {
updateAddingBallPos();
};
updateHUD();
checkWin();
}
private function onHUD_CrashBall_Click(_arg1:MouseEvent):void{
if ((((((_ballsDesc & 1)) && ((_ballInTheaterTime == 0)))) && (!(_addingBall)))){
_ballsDesc = (_ballsDesc - 1);
updateBallsPanel();
setAddingBall("BA");
guiMgr.hud.ballPanel.crashBall.visible = false;
Main.engine.soundMgr.playSFX("Click");
};
}
private function onHUD_BoomBall_Click(_arg1:MouseEvent):void{
if ((((((_ballsDesc & 2)) && ((_ballInTheaterTime == 0)))) && (!(_addingBall)))){
_ballsDesc = (_ballsDesc - 2);
updateBallsPanel();
setAddingBall("BB");
guiMgr.hud.ballPanel.boomBall.visible = false;
Main.engine.soundMgr.playSFX("Click");
};
}
private function onHUD_BangBall_Click(_arg1:MouseEvent):void{
if ((((((_ballsDesc & 4)) && ((_ballInTheaterTime == 0)))) && (!(_addingBall)))){
_ballsDesc = (_ballsDesc - 4);
updateBallsPanel();
setAddingBall("BC");
guiMgr.hud.ballPanel.bangBall.visible = false;
Main.engine.soundMgr.playSFX("Click");
};
}
private function onTheater_Click(_arg1:MouseEvent):void{
var _local2:Point;
var _local3:b2Vec2;
var _local4:BallShape;
var _local5:b2Body;
if (_addingBall){
if (!_arrow.visible){
if (_canAdd){
_arrow.visible = true;
_arrow.x = _addingBall.x;
_arrow.y = _addingBall.y;
updateArrow();
};
} else {
_local2 = Point.polar(1, (((_arrow.rotation - 90) / 180) * Math.PI));
_local3 = new b2Vec2(_local2.x, _local2.y);
_local4 = (_theater.addActor(_addingBall.className, {x:_addingBall.x, y:_addingBall.y, type:1}) as BallShape);
_local5 = _local4.body;
_local3.Multiply(_local4.launchVelocity);
_local5.ApplyImpulse(_local3, _local5.GetWorldCenter());
_arrow.visible = false;
setAddingBall(null);
_ballInTheaterTime = Settings.BALL_LIFETIME;
_gameOverDelay = Settings.GAME_OVER_MIN_DELAY;
};
};
}
private function updateArrow():void{
_arrow.rotation = ((-(Math.atan2((_arrow.x - mouseX), (_arrow.y - mouseY))) * 180) / Math.PI);
}
private function updateAddingBallPos():void{
var _local2:int;
if (!_addingBall){
return;
};
_addingBall.x = mouseX;
_addingBall.y = mouseY;
var _local1:Boolean;
while (_local2 < _theater.actors.length) {
if (!getCollisionRect(_addingBall, _theater.actors[_local2], this, true).isEmpty()){
_local1 = false;
};
_local2++;
};
if (_local1){
_addingBallHolder.alpha = 1;
};
if (!_local1){
_addingBallHolder.alpha = 0.5;
};
_canAdd = _local1;
}
private function updateBallsPanel():void{
var _local1:MovieClip = (guiMgr.hud.ballPanel as MovieClip);
if (_local1.crashBall.visible){
_local1.crashBall.gotoAndStop(((_ballsDesc & 1)) ? 1 : 2);
_local1.crashBall.buttonMode = (_ballsDesc & 1);
};
if (_local1.boomBall.visible){
_local1.boomBall.gotoAndStop(((_ballsDesc & 2)) ? 1 : 2);
_local1.boomBall.buttonMode = (_ballsDesc & 2);
};
if (_local1.bangBall.visible){
_local1.bangBall.gotoAndStop(((_ballsDesc & 4)) ? 1 : 2);
_local1.bangBall.buttonMode = (_ballsDesc & 4);
};
}
private function updateBallsPanelPos(){
if (_ballPanelWait){
_ballPanelWait = false;
return;
};
if (((((_addingBall) || ((_ballInTheaterTime > 0)))) && (_ballPanelExpanded))){
guiMgr.hud.hideItem("ballPanel", 0.5);
_ballPanelExpanded = false;
} else {
if (((((((!(_addingBall)) && ((_ballInTheaterTime == 0)))) && (!(_ballPanelExpanded)))) && ((_ballsDesc > 0)))){
guiMgr.hud.showItem("ballPanel", 0.5);
_ballPanelExpanded = true;
};
};
}
private function onHUD_Restart_Click(_arg1:MouseEvent):void{
restart();
}
private function onHUD_Hint_Click(_arg1:MouseEvent):void{
openURL(BrandingSettings.HINT_URL);
}
private function onHUD_Back_Click(_arg1:MouseEvent):void{
var e = _arg1;
if (_mode == _CUSTOM){
guiMgr.openWindow("LevelEditor", {levelCode:_initOptions.levelCode});
} else {
if (_mode == _OFFICIAL){
guiMgr.openWindow("LevelSelection", {levelPack:_levelPack});
} else {
if (_mode == _SPRINT){
var yesCallback:Function = function ():void{
_sprintLevels = null;
guiMgr.openWindow("MainMenu", {});
};
guiMgr.openWindow("Message", {title:"MESSAGE", message:"Do you really want to finish sprint?", yesCallback:yesCallback});
};
};
};
}
}
}//package gg.app.display.windows.sheets
Section 179
//LevelEditor (gg.app.display.windows.sheets.LevelEditor)
package gg.app.display.windows.sheets {
import flash.events.*;
import gg.engine.common.*;
import gg.engine.display.windows.*;
import gg.app.display.windows.dialogs.*;
import gg.app.display.windows.sheets.levelEditorAssets.*;
public class LevelEditor extends Sheet {
public var theater:Theater;
private var _panel:LevelEditorPanel;
private var _needSyncTheater:Boolean;
public function LevelEditor(){
theater.dragStep = 1;
theater.gridStep = 0;
}
override public function initialize():void{
var _local1:Object;
guiMgr.hud.state = "LevelEditor";
_panel = (guiMgr.openWindow("LevelEditorPanel", {}) as LevelEditorPanel);
balls = ((1 + 2) + 4);
if (_initOptions.hasOwnProperty("levelCode")){
_local1 = LevelCode.decode(_initOptions.levelCode);
theater.code = _local1.theater;
balls = int(_local1.balls);
};
}
override public function postInitialize():void{
_panel.btnMainMenu.addEventListener(MouseEvent.CLICK, onMainMenu_Click);
_panel.btnSaveLoad.addEventListener(MouseEvent.CLICK, onSaveLoad_Click);
_panel.btnClear.addEventListener(MouseEvent.CLICK, onClear_Click);
_panel.cbActors.dropdown.addEventListener(MouseEvent.CLICK, onActors_Dropdown_Click);
_panel.btnTest.addEventListener(MouseEvent.CLICK, onTest_Click);
_panel.btnStep.addEventListener(MouseEvent.CLICK, onStep_Click);
_panel.btnSettings.addEventListener(MouseEvent.CLICK, onSettings_Click);
theater.addEventListener(MouseEvent.CLICK, onTheater_Click);
_panel.btnUp.addEventListener(MouseEvent.CLICK, onUp_Click);
_panel.btnDown.addEventListener(MouseEvent.CLICK, onDown_Click);
_panel.btnRight.addEventListener(MouseEvent.CLICK, onRight_Click);
_panel.btnLeft.addEventListener(MouseEvent.CLICK, onLeft_Click);
}
override public function shutdown():void{
_panel.btnMainMenu.removeEventListener(MouseEvent.CLICK, onMainMenu_Click);
_panel.btnSaveLoad.removeEventListener(MouseEvent.CLICK, onSaveLoad_Click);
_panel.btnClear.removeEventListener(MouseEvent.CLICK, onClear_Click);
_panel.cbActors.dropdown.removeEventListener(MouseEvent.CLICK, onActors_Dropdown_Click);
_panel.btnTest.removeEventListener(MouseEvent.CLICK, onTest_Click);
_panel.btnStep.removeEventListener(MouseEvent.CLICK, onStep_Click);
_panel.btnSettings.removeEventListener(MouseEvent.CLICK, onSettings_Click);
theater.removeEventListener(MouseEvent.CLICK, onTheater_Click);
_panel.btnUp.removeEventListener(MouseEvent.CLICK, onUp_Click);
_panel.btnDown.removeEventListener(MouseEvent.CLICK, onDown_Click);
_panel.btnRight.removeEventListener(MouseEvent.CLICK, onRight_Click);
_panel.btnLeft.removeEventListener(MouseEvent.CLICK, onLeft_Click);
}
private function get balls():int{
var _local1:int;
_local1 = (_local1 + (_panel.checkCrashBall.selected) ? 1 : 0);
_local1 = (_local1 + (_panel.checkBoomBall.selected) ? 2 : 0);
_local1 = (_local1 + (_panel.checkBangBall.selected) ? 4 : 0);
return (_local1);
}
private function set balls(_arg1:int):void{
_panel.checkCrashBall.selected = !(((_arg1 & 1) == 0));
_panel.checkBoomBall.selected = !(((_arg1 & 2) == 0));
_panel.checkBangBall.selected = !(((_arg1 & 4) == 0));
}
private function onMainMenu_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("MainMenu", {});
}
private function onSaveLoad_Click(_arg1:MouseEvent):void{
var loadCallback:Function;
var e = _arg1;
loadCallback = function (_arg1:String):void{
var _local2:Object = LevelCode.decode(_arg1);
theater.code = _local2.theater;
balls = int(_local2.balls);
};
guiMgr.openWindow("SaveLoadLevel", {levelCode:LevelCode.encode({theater:theater.code, balls:balls}), loadCallback:loadCallback});
}
private function onClear_Click(_arg1:MouseEvent):void{
var yesCallback:Function;
var e = _arg1;
yesCallback = function ():void{
theater.removeAllActors();
};
guiMgr.openWindow("Message", {title:"MESSAGE", message:"Are you sure you want to clear this level?", yesCallback:yesCallback});
}
private function onActors_Dropdown_Click(_arg1:MouseEvent):void{
if (_panel.cbActors.selectedItem.data == "---"){
theater.setAddingActor(null);
} else {
theater.setAddingActor(_panel.cbActors.selectedItem.data);
};
}
private function onTest_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("Game", {levelCode:LevelCode.encode({theater:theater.code, balls:balls})});
}
private function onStep_Click(_arg1:MouseEvent):void{
theater.setEditingActor(null);
if (_needSyncTheater){
theater.syncPhys();
_needSyncTheater = false;
};
theater.stopAllActors();
theater.wakeUp();
theater.step();
}
private function onSettings_Click(_arg1:MouseEvent):void{
if (!guiMgr.getWindow("LevelEditorSettings").opened){
guiMgr.openWindow("LevelEditorSettings", {theater:theater});
} else {
guiMgr.closeWindow("LevelEditorSettings");
};
}
private function onTheater_Click(_arg1:MouseEvent):void{
_needSyncTheater = true;
}
private function onUp_Click(_arg1:MouseEvent):void{
theater.translateActors(0, -(theater.dragStep));
}
private function onDown_Click(_arg1:MouseEvent):void{
theater.translateActors(0, theater.dragStep);
}
private function onRight_Click(_arg1:MouseEvent):void{
theater.translateActors(theater.dragStep, 0);
}
private function onLeft_Click(_arg1:MouseEvent):void{
theater.translateActors(-(theater.dragStep), 0);
}
}
}//package gg.app.display.windows.sheets
Section 180
//LevelSelection (gg.app.display.windows.sheets.LevelSelection)
package gg.app.display.windows.sheets {
import flash.events.*;
import gg.engine.common.*;
import com.greensock.*;
import gg.engine.display.windows.*;
import flash.text.*;
import fl.motion.easing.*;
import mochi.as3.*;
import gg.app.display.buttons.*;
import gg.app.display.windows.sheets.levelSelectionAssets.*;
public class LevelSelection extends Sheet {
private const _LS_NUM:int = 20;
public var ls17:LevelSelector;
public var txtScore:TextField;
public var ls18:LevelSelector;
public var lsSprint:LevelSelectorSprint;
public var ls19:LevelSelector;
public var ls1:LevelSelector;
public var txtTotalScore:TextField;
public var ls2:LevelSelector;
public var ls3:LevelSelector;
public var btnSubmit:BtnSubmit;
public var ls4:LevelSelector;
public var ls10:LevelSelector;
public var ls5:LevelSelector;
public var btnMainMenu:BtnMainMenu;
public var ls11:LevelSelector;
public var ls6:LevelSelector;
public var ls20:LevelSelector;
public var ls12:LevelSelector;
public var ls7:LevelSelector;
public var ls13:LevelSelector;
public var ls8:LevelSelector;
public var ls14:LevelSelector;
public var ls9:LevelSelector;
public var ls15:LevelSelector;
public var ls16:LevelSelector;
private var _levelSelectors:Array;
private var _levelPack:LevelPack;
public function LevelSelection(){
var _local2:LevelSelector;
super();
_levelSelectors = new Array();
var _local1 = 1;
while (_local1 <= _LS_NUM) {
_local2 = (this[("ls" + _local1)] as LevelSelector);
_local2.levelIndex = (_local1 - 1);
_local2.txtNumber.mouseEnabled = false;
_local2.txtNumber.text = String(_local1);
_levelSelectors.push(_local2);
_local1++;
};
}
override public function initialize():void{
var _local1:int;
var _local2:LevelSelector;
guiMgr.hud.state = "LevelSelection";
_levelPack = _initOptions.levelPack;
while (_local1 < _LS_NUM) {
if (_local1 < _levelPack.numLevels){
_local2 = _levelSelectors[_local1];
if (_local1 <= _levelPack.levelsBeaten){
_local2.gotoAndStop("beaten");
if (_local1 == _levelPack.levelsBeaten){
_local2.gotoAndStop("opened");
};
_local2.buttonMode = true;
_local2.addEventListener(MouseEvent.MOUSE_OVER, onLevelSelector_MouseOver);
_local2.addEventListener(MouseEvent.MOUSE_OUT, onLevelSelector_MouseOut);
} else {
_local2.buttonMode = false;
_local2.gotoAndStop("closed");
};
} else {
_levelSelectors[_local1].visible = false;
};
_local1++;
};
if (_levelPack.beaten){
lsSprint.gotoAndStop("opened");
lsSprint.buttonMode = true;
} else {
lsSprint.gotoAndStop("closed");
};
txtTotalScore.text = ("Total Score: " + _levelPack.totalScore);
}
override public function postInitialize():void{
var _local1:int;
var _local2:LevelSelector;
btnMainMenu.addEventListener(MouseEvent.CLICK, onMainMenu_Click);
btnSubmit.addEventListener(MouseEvent.CLICK, onSubmit_Click);
while (_local1 < _LS_NUM) {
if (_local1 < _levelPack.numLevels){
_local2 = _levelSelectors[_local1];
if (_local1 <= _levelPack.levelsBeaten){
_local2.addEventListener(MouseEvent.CLICK, onLevelSelector_Click);
};
};
_local1++;
};
if (_levelPack.beaten){
lsSprint.addEventListener(MouseEvent.MOUSE_OVER, onLevelSelector_MouseOver);
lsSprint.addEventListener(MouseEvent.MOUSE_OUT, onLevelSelector_MouseOut);
lsSprint.addEventListener(MouseEvent.CLICK, onLevelSelector_Click);
};
}
override public function shutdown():void{
btnMainMenu.removeEventListener(MouseEvent.CLICK, onMainMenu_Click);
btnSubmit.removeEventListener(MouseEvent.CLICK, onSubmit_Click);
}
override public function postShutdown():void{
var _local1:int;
while (_local1 < _LS_NUM) {
if (_local1 <= _levelPack.levelsBeaten){
_levelSelectors[_local1].removeEventListener(MouseEvent.MOUSE_OVER, onLevelSelector_MouseOver);
_levelSelectors[_local1].removeEventListener(MouseEvent.MOUSE_OUT, onLevelSelector_MouseOut);
_levelSelectors[_local1].removeEventListener(MouseEvent.CLICK, onLevelSelector_Click);
};
_local1++;
};
if (_levelPack.beaten){
lsSprint.removeEventListener(MouseEvent.MOUSE_OVER, onLevelSelector_MouseOver);
lsSprint.removeEventListener(MouseEvent.MOUSE_OUT, onLevelSelector_MouseOut);
lsSprint.removeEventListener(MouseEvent.CLICK, onLevelSelector_Click);
};
}
private function onLevelSelector_MouseOver(_arg1:MouseEvent):void{
var _local2:* = _arg1.currentTarget;
setChildIndex(_local2, (numChildren - 1));
TweenLite.to(_local2, 1, {scaleX:1.5, scaleY:1.5, ease:Elastic.easeOut});
if (_local2 != lsSprint){
txtScore.text = ("Score: " + _levelPack.getScore(_local2.levelIndex));
};
}
private function onLevelSelector_MouseOut(_arg1:MouseEvent):void{
var _local2:* = _arg1.currentTarget;
TweenLite.to(_local2, 1, {scaleX:1, scaleY:1, ease:Elastic.easeOut});
txtScore.text = "";
}
private function onLevelSelector_Click(_arg1:MouseEvent):void{
var _local2:* = _arg1.currentTarget;
TweenLite.to(_local2, 1, {scaleX:1, scaleY:1, ease:Elastic.easeOut});
if (_local2 != lsSprint){
guiMgr.openWindow("Game", {levelIndex:_local2.levelIndex, levelPack:_levelPack});
txtScore.text = "";
} else {
guiMgr.openWindow("Game", {levelPack:_levelPack, sprint:true});
};
}
private function onMainMenu_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("MainMenu", {});
}
private function onSubmit_Click(_arg1:MouseEvent):void{
var onClose:Function;
var e = _arg1;
onClose = function ():void{
guiMgr.frozen = false;
};
if (!_levelPack.totalScore){
return;
};
guiMgr.frozen = true;
MochiScores.showLeaderboard({boardID:BrandingSettings.HIGHSCORES_LEADERBOARD_ID, score:_levelPack.totalScore, onClose:onClose});
Main.engine.achievementMgr.obtainAchievement("Submit highscores");
}
}
}//package gg.app.display.windows.sheets
Section 181
//MainMenu (gg.app.display.windows.sheets.MainMenu)
package gg.app.display.windows.sheets {
import flash.display.*;
import gg.engine.utils.*;
import flash.events.*;
import gg.engine.display.windows.*;
import flash.text.*;
import mochi.as3.*;
public class MainMenu extends Sheet {
public var btnCustomLevel:MovieClip;
public var btnMoreGames:MovieClip;
public var btnStart:MovieClip;
public var btnAchievements:MovieClip;
public var btnHighscores:MovieClip;
public var btnLevelEditor:MovieClip;
private var _ad:Boolean;
override public function initialize():void{
var addButton:Function = function (_arg1:String, _arg2:String, _arg3:Number):void{
var text = _arg1;
var url = _arg2;
var transition = _arg3;
var tf:TextField = new TextField();
tf.text = text;
var tb:SimpleButton = new SimpleButton(tf, tf, tf, tf);
addChild(tb);
tb.addEventListener(MouseEvent.CLICK, function (){
openURL(url);
});
tb.y = (tb.y - transition);
};
guiMgr.hud.state = "MainMenu";
if (!_ad){
addButton("free online games", "http://beplayed.com/", 100);
addButton("online games", "http://beplayed.com/", 200);
addButton("free games", "http://beplayed.com/", 300);
_ad = true;
};
}
override public function postInitialize():void{
btnStart.addEventListener(MouseEvent.CLICK, onStart_Click);
btnCustomLevel.addEventListener(MouseEvent.CLICK, onCustomLevel_Click);
btnHighscores.addEventListener(MouseEvent.CLICK, onHighscores_Click);
btnLevelEditor.addEventListener(MouseEvent.CLICK, onLevelEditor_Click);
btnMoreGames.addEventListener(MouseEvent.CLICK, onMoreGames_Click);
btnAchievements.addEventListener(MouseEvent.CLICK, onAchievements_Click);
}
override public function shutdown():void{
btnStart.removeEventListener(MouseEvent.CLICK, onStart_Click);
btnCustomLevel.removeEventListener(MouseEvent.CLICK, onCustomLevel_Click);
btnHighscores.removeEventListener(MouseEvent.CLICK, onHighscores_Click);
btnLevelEditor.removeEventListener(MouseEvent.CLICK, onLevelEditor_Click);
btnMoreGames.removeEventListener(MouseEvent.CLICK, onMoreGames_Click);
btnAchievements.removeEventListener(MouseEvent.CLICK, onAchievements_Click);
}
private function onStart_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("LevelSelection", {levelPack:Main.engine.levelMgr.getLevelPack("First")});
}
private function onCustomLevel_Click(_arg1:MouseEvent):void{
var loadCallback:Function;
var e = _arg1;
loadCallback = function (_arg1:String):void{
guiMgr.openWindow("Game", {levelCode:_arg1});
};
guiMgr.openWindow("SaveLoadLevel", {loadCallback:loadCallback});
}
private function onHighscores_Click(_arg1:MouseEvent):void{
var onClose:Function;
var e = _arg1;
onClose = function ():void{
guiMgr.frozen = false;
};
guiMgr.frozen = true;
MochiScores.showLeaderboard({boardID:BrandingSettings.HIGHSCORES_LEADERBOARD_ID, onClose:onClose});
}
private function onLevelEditor_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("LevelEditor", {});
}
private function onMoreGames_Click(_arg1:MouseEvent):void{
Main.engine.achievementMgr.obtainAchievement("Click on more games");
openURL(BrandingSettings.MORE_GAMES_URL);
}
private function onAchievements_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("Achievements", {});
}
}
}//package gg.app.display.windows.sheets
Section 182
//Background (gg.app.display.Background)
package gg.app.display {
import flash.display.*;
import com.greensock.*;
import fl.motion.easing.*;
import gg.app.display.backgroundAssets.*;
public class Background extends Sprite {
private const _SPEED:Number = 35;
public var cloudHolder:MovieClip;
private var _cloud:Cloud;
public function Background(){
var onComplete:Function;
super();
onComplete = function ():void{
cloudHolder.visible = !(((Main.engine.guiMgr.currentSheet) && ((Main.engine.guiMgr.currentSheet.name == "MainMenu"))));
_cloud.gotoAndStop(Math.ceil((_cloud.totalFrames * Math.random())));
_cloud.scaleX = (1 - (0.6 * Math.random()));
_cloud.scaleY = _cloud.scaleX;
_cloud.x = (-(_cloud.width) - 5);
_cloud.y = ((((Settings.HEIGHT - _cloud.height) - 200) * Math.random()) + 50);
var _local1:Object = new Object();
_local1.x = (Settings.WIDTH + 5);
_local1.ease = Linear.easeNone;
_local1.onComplete = onComplete;
var _local2:Number = ((_local1.x - _cloud.x) / _SPEED);
_local2 = (_local2 - ((0.5 * _local2) * Math.random()));
TweenLite.to(_cloud, _local2, _local1);
};
_cloud = new Cloud();
_cloud.cacheAsBitmap = true;
_cloud.gotoAndStop(Math.ceil((_cloud.totalFrames * Math.random())));
_cloud.scaleX = (1 - (0.4 * Math.random()));
_cloud.scaleY = _cloud.scaleX;
_cloud.x = ((((Settings.WIDTH - _cloud.width) + 10) * Math.random()) - 5);
_cloud.y = ((((Settings.HEIGHT - _cloud.height) - 200) * Math.random()) + 50);
cloudHolder.addChild(_cloud);
var vars:Object = new Object();
vars.x = (Settings.WIDTH + 5);
vars.ease = Linear.easeNone;
vars.onComplete = onComplete;
var duration:Number = ((vars.x - _cloud.x) / _SPEED);
duration = (duration - ((0.5 * duration) * Math.random()));
TweenLite.to(_cloud, duration, vars);
}
}
}//package gg.app.display
Section 183
//EasterEgg (gg.app.display.EasterEgg)
package gg.app.display {
import flash.display.*;
import flash.events.*;
import com.greensock.*;
import flash.utils.*;
import fl.motion.easing.*;
public class EasterEgg extends MovieClip {
private static const SHOW_TIME:Number = 1;
private static var _instance:EasterEgg;
public function EasterEgg(){
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
x = (-(width) / 2);
y = (Settings.HEIGHT / 2);
}
private function onAddedToStage(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
TweenLite.to(this, SHOW_TIME, {x:(Settings.WIDTH + (width / 2)), onComplete:onAnimationComplete, ease:Linear.easeInOut});
}
private function onAnimationComplete(){
if (parent){
parent.removeChild(this);
};
_instance = null;
}
public static function toggleEgg(_arg1:DisplayObjectContainer){
if (_instance){
return;
};
var _local2:Class = (getDefinitionByName("egg") as Class);
_instance = EasterEgg(new (_local2));
_arg1.addChild(_instance);
}
}
}//package gg.app.display
Section 184
//Eye (gg.app.display.Eye)
package gg.app.display {
import flash.display.*;
import flash.events.*;
public class Eye extends MovieClip {
private var ANIMATION_DURATION:Number;// = 4
private var _time:Number;// = 0
public function Eye(){
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage, false, 0, true);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage, false, 0, true);
}
private function onAddedToStage(_arg1:Event):void{
addEventListener(Event.ENTER_FRAME, showNextFrame, false, 0, true);
}
private function onRemovedFromStage(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, showNextFrame);
}
private function showNextFrame(_arg1:Event=null){
_time = (_time - Settings.PHYS_DT);
if (_time > 0){
return;
};
var _local2:Number = (ANIMATION_DURATION / totalFrames);
var _local3:Number = ((_local2 * Math.random()) + (_local2 / 2));
_time = _local2;
if (currentFrame < totalFrames){
gotoAndStop((currentFrame + 1));
} else {
gotoAndStop(1);
};
}
}
}//package gg.app.display
Section 185
//HUD (gg.app.display.HUD)
package gg.app.display {
import flash.display.*;
import gg.engine.display.*;
import flash.text.*;
import gg.app.display.buttons.*;
import gg.app.display.hudAssets.*;
public class HUD extends HUD {
public var txtScore:TextField;
public var soundOnOff:SoundOnOff;
public var btnHint:BtnHint;
public var txtLevelIndex:TextField;
public var ballPanel:MovieClip;
public var txtLevelsBeaten:TextField;
public var txtTime:TextField;
public var btnMoreGames:BtnMoreGames2;
public var btnCredits:SimpleButton;
public var btnAddToYourSite:SimpleButton;
public var btnRestart:BtnRestart2;
public var btnBack:BtnBack;
public function HUD(_arg1:Array=null){
super(_arg1);
}
}
}//package gg.app.display
Section 186
//BallShape (gg.app.theater.actors.BallShape)
package gg.app.theater.actors {
import gg.engine.utils.*;
import Box2D.Dynamics.Contacts.*;
import gg.engine.theater.actors.*;
import gg.engine.utils.graphicsFill.*;
public class BallShape extends Shape {
protected var _dead:Boolean;// = false
protected var _disappearing:Boolean;// = false
override protected function constructor():void{
super.constructor();
cacheAsBitmap = true;
}
public function get launchVelocity():Number{
return (0);
}
override protected function build():void{
_dead = false;
_disappearing = false;
stop();
super.build();
}
override protected function destroy():void{
_dead = true;
if (_disappearing){
ShowHide.cancel(this);
_disappearing = false;
};
super.destroy();
}
override public function step():void{
super.step();
if (!_dead){
updateFaceFrame();
};
}
override public function get code():String{
var _local1:String = ((((((UNumber.round2str(x, 2) + ",") + UNumber.round2str(y, 2)) + ",") + UNumber.round2str(rotation, 2)) + ",") + _bitParams.getValue());
if (((!((scaleX == 1))) || (!((scaleY == 1))))){
_local1 = (_local1 + ((("," + UNumber.round2str(scaleX, 4)) + ",") + UNumber.round2str(scaleY, 4)));
};
return (_local1);
}
override public function decode(_arg1:String):Object{
var _local2:Array = _arg1.split(",");
var _local3:Object = new Object();
_local3.x = Number(_local2[0]);
_local3.y = Number(_local2[1]);
_local3.rotation = Number(_local2[2]);
_local3.bitParams = int(_local2[3]);
if (_local2.length > 7){
_local3.scaleX = Number(_local2[4]);
_local3.scaleY = Number(_local2[5]);
};
return (_local3);
}
public function processContact(_arg1:b2ContactResult){
}
public function dissapear():void{
if (_dead){
return;
};
ShowHide.hide(this, 1, {filler:Bubbles, onComplete:onDisappearComplete});
_dead = true;
_disappearing = true;
}
private function onDisappearComplete():void{
_disappearing = false;
if (_theater){
_theater.removeActor(this);
};
}
private function updateFaceFrame(){
if (!body){
gotoAndStop(1);
return;
};
if (((body.IsSleeping()) && ((currentFrame == 2)))){
gotoAndStop(1);
};
if (((!(body.IsSleeping())) && ((currentFrame == 1)))){
gotoAndStop(2);
};
}
}
}//package gg.app.theater.actors
Section 187
//BangBall (gg.app.theater.actors.BangBall)
package gg.app.theater.actors {
public class BangBall extends BallShape {
override public function get launchVelocity():Number{
return (Settings.BANG_LAUNCH_VELOCITY);
}
override protected function restore2default():void{
super.restore2default();
_buildingParams.friction = Settings.BANG_FRICTION;
_buildingParams.density = Settings.BANG_DENSITY;
_buildingParams.restitution = Settings.BANG_RESTITUTION;
}
}
}//package gg.app.theater.actors
Section 188
//BoomBall (gg.app.theater.actors.BoomBall)
package gg.app.theater.actors {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import gg.engine.utils.*;
import gg.engine.theater.*;
import Box2D.Dynamics.Contacts.*;
public class BoomBall extends BallShape {
public var sensitivity:Number;// = 8.5
public var power:Number;// = 3200
public var deadArea:Number;// = 2
public var explosionImpulseDependsOnMass:Boolean;// = false
protected var _detonate:Boolean;
protected var _explosionAnimation:String;// = "AQ"
public static const DEFAULT_POWER:Number = 3200;
protected static const _NUM_RAYS:int = 360;
protected static const _MAX_RAY_LENGTH:Number = 8192;
override public function get launchVelocity():Number{
return (Settings.BOOM_LAUNCH_VELOCITY);
}
override public function processContact(_arg1:b2ContactResult){
_detonate = true;
}
override public function step():void{
super.step();
if (_detonate){
explosion();
};
}
protected function explosion():void{
makeExplosionAnimation();
makeExplosion();
_theater.removeActor(this);
}
protected function getRealDeadArea():Number{
var _local1:Number = (((0.4 * deadArea) * power) / DEFAULT_POWER);
return (((_local1 > 1)) ? _local1 : 1);
}
protected function makeExplosionAnimation():void{
var _local1:Number = getRealDeadArea();
var _local2:Actor = _theater.addActor(_explosionAnimation, {x:x, y:y});
if (_local2.width > _local2.height){
_local2.width = (_local1 * width);
_local2.scaleY = _local2.scaleX;
} else {
_local2.height = (_local1 * height);
_local2.scaleX = _local2.scaleY;
};
}
protected function makeExplosion():void{
var _local1:b2Segment;
var _local4:b2Vec2;
var _local6:b2Vec2;
var _local9:Array;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:Number;
var _local16:b2Shape;
var _local17:b2Body;
var _local18:BoomBall;
_local1 = new b2Segment();
var _local2:b2Vec2 = _local1.p1;
var _local3:b2Vec2 = _local1.p2;
_local4 = new b2Vec2();
var _local5:b2Segment = new b2Segment();
_local6 = _local5.p1;
var _local7:b2Vec2 = _local5.p2;
var _local8:b2Vec2 = new b2Vec2();
_local9 = new Array();
_local10 = new b2Vec2();
_local11 = new b2Vec2();
_local12 = (power * _body.GetMass());
_local2.SetV(_body.GetPosition());
_local7.SetV(_local2);
var _local13:Number = UMath.PI2;
var _local14:Number = (_local13 / _NUM_RAYS);
var _local15:Number = 0;
while (_local15 < _local13) {
_local3.x = (_local2.x + (_MAX_RAY_LENGTH * Math.cos(_local15)));
_local3.y = (_local2.y + (_MAX_RAY_LENGTH * Math.sin(_local15)));
_local16 = _theater.world.RaycastOne(_local1, _local9, _local10, false, null);
if (_local16){
_local17 = _local16.GetBody();
if (!_local17.IsDynamic()){
} else {
_local18 = (_local17.GetUserData() as BoomBall);
if (((_local18) && (_local18._detonate))){
} else {
_local4.x = (_local2.x + ((_local3.x - _local2.x) * _local9[0]));
_local4.y = (_local2.y + ((_local3.y - _local2.y) * _local9[0]));
_local6.SetV(_local4);
_local16 = _theater.world.RaycastOne(_local5, _local9, _local10, false, null);
if (!_local16){
} else {
_local8.x = (_local6.x + ((_local7.x - _local6.x) * _local9[0]));
_local8.y = (_local6.y + ((_local7.y - _local6.y) * _local9[0]));
_local11.x = (_local4.x - _local8.x);
_local11.y = (_local4.y - _local8.y);
_local11.Multiply((_local12 / (1 + _local11.Normalize())));
_local17.ApplyForce(_local11, _local4);
};
};
};
};
_local15 = (_local15 + _local14);
};
}
override protected function restore2default():void{
super.restore2default();
_buildingParams.friction = Settings.BOOM_FRICTION;
_buildingParams.density = Settings.BOOM_DENSITY;
_buildingParams.restitution = Settings.BOOM_RESTITUTION;
_detonate = false;
}
override protected function setupBodyDef(_arg1:b2BodyDef):void{
super.setupBodyDef(_arg1);
_arg1.isBullet = true;
}
}
}//package gg.app.theater.actors
Section 189
//CrashBall (gg.app.theater.actors.CrashBall)
package gg.app.theater.actors {
public class CrashBall extends BallShape {
override public function get launchVelocity():Number{
return (Settings.CRASH_LAUNCH_VELOCITY);
}
override protected function restore2default():void{
super.restore2default();
_buildingParams.friction = Settings.CRASH_FRICTION;
_buildingParams.density = Settings.CRASH_DENSITY;
_buildingParams.restitution = Settings.CRASH_RESTITUTION;
}
}
}//package gg.app.theater.actors
Section 190
//Evil (gg.app.theater.actors.Evil)
package gg.app.theater.actors {
import flash.display.*;
import gg.engine.theater.edit.params.*;
import gg.engine.utils.*;
import gg.engine.theater.edit.*;
import gg.engine.theater.actors.*;
import gg.app.display.windows.sheets.*;
public class Evil extends Shape {
protected var _color:int;// = 0
protected var _faceState:int;// = 0
protected var _faceDelay:Number;// = 1
public var faceHolder:MovieClip;
protected static const FACE_NOT_SET:int = 0;
protected static const FACE_IDLE:int = 1;
protected static const FACE_DANGER:int = 2;
protected static const FACE_PANIC:int = 3;
override protected function constructor():void{
super.constructor();
cacheAsBitmap = true;
}
public function get color():int{
return (_color);
}
public function set color(_arg1:int):void{
_color = _arg1;
gotoAndStop((_color + 1));
var _local2:int;
while (_local2 < faceHolder.numChildren) {
faceHolder.getChildAt(_local2).visible = false;
_local2++;
};
var _local3:MovieClip = (faceHolder.getChildByName(("face" + (_color + 1))) as MovieClip);
_local3.visible = true;
_faceState = FACE_NOT_SET;
faceState = FACE_IDLE;
}
public function get faceState():int{
return (_faceState);
}
public function set faceState(_arg1:int):void{
if (_faceState == _arg1){
return;
};
_faceState = _arg1;
var _local2:MovieClip = (faceHolder.getChildByName(("face" + (_color + 1))) as MovieClip);
if (((((!(_theater)) || ((_theater is EditableTheater)))) || ((_faceDelay > 0)))){
_local2.gotoAndStop("idle");
updateFaceScale();
return;
};
switch (_faceState){
case FACE_IDLE:
_local2.gotoAndPlay("idle");
break;
case FACE_DANGER:
_local2.gotoAndPlay("danger");
break;
case FACE_PANIC:
_local2.gotoAndPlay("panic");
break;
};
updateFaceScale();
}
override public function get code():String{
var _local1:String = ((((((((UNumber.round2str(x, 2) + ",") + UNumber.round2str(y, 2)) + ",") + UNumber.round2str(rotation, 2)) + ",") + _bitParams.getValue()) + ",") + _color);
if (((!((scaleX == 1))) || (!((scaleY == 1))))){
_local1 = (_local1 + ((("," + UNumber.round2str(scaleX, 4)) + ",") + UNumber.round2str(scaleY, 4)));
};
return (_local1);
}
override public function decode(_arg1:String):Object{
var _local2:Array = _arg1.split(",");
var _local3:Object = new Object();
_local3.x = Number(_local2[0]);
_local3.y = Number(_local2[1]);
_local3.rotation = Number(_local2[2]);
_local3.bitParams = int(_local2[3]);
_local3.color = int(_local2[4]);
if (_local2.length > 5){
_local3.scaleX = Number(_local2[5]);
_local3.scaleY = Number(_local2[6]);
};
return (_local3);
}
override protected function setupBitParams():void{
super.setupBitParams();
_bitParams.removeBit("static");
}
override protected function setupEditableParams():void{
super.setupEditableParams();
_editableParams.removeParam("static");
_editableParams.addParam(new NumericParam("color", "color", NumericParam.POSITIVE_INTEGER, 0, 6));
}
override protected function restore2default():void{
_faceDelay = 1;
super.restore2default();
resetType2default();
}
protected function resetType2default():void{
color = 0;
_buildingParams.color = 0;
}
override protected function build():void{
super.build();
color = _buildingParams.color;
_body.SetMassFromShapes();
}
override public function step():void{
if (_faceDelay > 0){
_faceDelay = (_faceDelay - Settings.PHYS_DT);
};
super.step();
}
public function updateFaceFrame(){
var _local1:MovieClip = (faceHolder.getChildByName(("face" + (_color + 1))) as MovieClip);
var _local2:int = (Game.instance.isDangerForEvil()) ? FACE_DANGER : FACE_IDLE;
if (!body){
faceState = _local2;
return;
};
if (((body.IsSleeping()) && (!((faceState == _local2))))){
faceState = _local2;
};
if (((!(body.IsSleeping())) && (!((faceState == FACE_PANIC))))){
faceState = FACE_PANIC;
};
}
private function updateFaceScale():void{
if (physWidth < physHeight){
faceHolder.scaleX = 1;
faceHolder.scaleY = (scaleX / scaleY);
} else {
faceHolder.scaleY = 1;
faceHolder.scaleX = (scaleY / scaleX);
};
}
override public function set physWidth(_arg1:Number):void{
super.physWidth = _arg1;
updateFaceScale();
}
override public function set physHeight(_arg1:Number):void{
super.physHeight = _arg1;
updateFaceScale();
}
}
}//package gg.app.theater.actors
Section 191
//ExplosionAnimation (gg.app.theater.actors.ExplosionAnimation)
package gg.app.theater.actors {
import gg.engine.theater.*;
public class ExplosionAnimation extends Actor {
public function ExplosionAnimation():void{
_layer = 2;
}
override protected function build():void{
super.build();
Main.engine.soundMgr.playSFX("Explosion");
if (totalFrames > 1){
addFrameScript((totalFrames - 1), lastFrameScript);
play();
};
}
override protected function destroy():void{
super.destroy();
if (totalFrames > 1){
addFrameScript((totalFrames - 1), null);
stop();
};
}
protected function lastFrameScript():void{
_theater.removeActor(this);
}
}
}//package gg.app.theater.actors
Section 192
//Shape (gg.app.theater.actors.Shape)
package gg.app.theater.actors {
import flash.geom.*;
import flash.display.*;
import flash.utils.*;
import gg.engine.theater.actors.*;
public class Shape extends Shape {
private var _updateLines:Boolean;
private var _lines:Bitmap;
override protected function constructor():void{
super.constructor();
cacheAsBitmap = true;
}
override protected function build():void{
super.build();
updateLinesBitmap();
}
override protected function destroy():void{
super.destroy();
if (_lines){
removeChild(_lines);
_lines = null;
};
}
override public function step():void{
super.step();
if (_updateLines){
updateLinesBitmap();
};
}
override protected function onBitParams_Static_Change(_arg1:Boolean, _arg2:Boolean):void{
super.onBitParams_Static_Change(_arg1, _arg2);
gotoAndStop((_arg2) ? 2 : 1);
_updateLines = true;
}
protected function updateLinesBitmap():void{
if (_lines){
removeChild(_lines);
_lines = null;
};
var _local1:Class = (getDefinitionByName("Waves") as Class);
var _local2:Class = (getDefinitionByName(className) as Class);
var _local3:MovieClip = MovieClip(new (_local1));
var _local4:MovieClip = MovieClip(new (_local2));
var _local5:Sprite = new Sprite();
_local5.addChild(_local4);
_local5.addChild(_local3);
_local3.mask = _local4;
_local4.scaleX = scaleX;
_local4.scaleY = scaleY;
var _local6:Rectangle = _local4.getBounds(_local5);
_lines = new Bitmap(RenderSprite(_local5, _local6));
_lines.smoothing = true;
_local6 = _local4.getBounds(_local4);
_lines.x = _local6.left;
_lines.y = _local6.top;
_lines.scaleX = (1 / scaleX);
_lines.scaleY = (1 / scaleY);
addChild(_lines);
_updateLines = false;
}
private function RenderSprite(_arg1:Sprite, _arg2:Rectangle):BitmapData{
var bd:BitmapData;
var sprite = _arg1;
var r = _arg2;
var m:Matrix = new Matrix();
try {
bd = new BitmapData(Math.max(1, r.width), Math.max(1, r.height), true, 0);
m.identity();
m.translate(-(r.x), -(r.y));
bd.draw(sprite, m);
} catch(e) {
};
return (bd);
}
}
}//package gg.app.theater.actors
Section 193
//BoundListener (gg.app.theater.BoundListener)
package gg.app.theater {
import Box2D.Dynamics.*;
import gg.engine.theater.*;
public class BoundListener extends b2BoundaryListener {
override public function Violation(_arg1:b2Body):void{
var _local2:Actor = (_arg1.m_userData as Actor);
if (_local2){
_local2.theater.removeActor(_local2);
};
}
}
}//package gg.app.theater
Section 194
//ContactListener (gg.app.theater.ContactListener)
package gg.app.theater {
import Box2D.Dynamics.*;
import Box2D.Dynamics.Contacts.*;
import gg.app.theater.actors.*;
public class ContactListener extends b2ContactListener {
override public function Result(_arg1:b2ContactResult):void{
var _local2:BallShape;
_local2 = (_arg1.shape1.GetUserData() as BallShape);
if (_local2){
_local2.processContact(_arg1);
};
_local2 = (_arg1.shape2.GetUserData() as BallShape);
if (_local2){
_local2.processContact(_arg1);
};
}
}
}//package gg.app.theater
Section 195
//BrandedPreloader (gg.app.BrandedPreloader)
package gg.app {
import flash.display.*;
import gg.engine.utils.*;
import gg.app.branding.*;
public class BrandedPreloader extends MovieClip {
public var y8:Y8Preloader;
public var godvilgames:GodvilGamesPreloader;
private var _0;
private var _2;
public function BrandedPreloader(){
stop();
}
public function init(_arg1:Function):void{
var _local2 = "godvilgames";
if (UDomain.checkDomain([BrandingSettings.Y8])){
_local2 = BrandingSettings.Y8;
};
var _local3:DefaultPreloader = (getChildByName(_local2) as DefaultPreloader);
_0 = UDomain.checkDomain;
_2 = root;
_local3.init(_arg1);
}
public function _1():void{
if (_0(["p"], ["c"], ["d"])){
root.visible = false;
};
}
}
}//package gg.app
Section 196
//Achievement (gg.engine.common.Achievement)
package gg.engine.common {
class Achievement {
var name:String;
var obtained:Boolean;
function Achievement(_arg1:String){
name = _arg1;
}
}
}//package gg.engine.common
Section 197
//AchievementManager (gg.engine.common.AchievementManager)
package gg.engine.common {
import gg.engine.utils.*;
public class AchievementManager {
protected var _achievements:Array;
protected var _onObtain:GGEvent;
public function AchievementManager(){
_achievements = new Array();
_onObtain = new GGEvent();
}
public function get onObtain():GGEvent{
return (_onObtain);
}
public function get code():String{
var _local2:int;
var _local1 = "";
while (_local2 < _achievements.length) {
_local1 = (_local1 + int(_achievements[_local2].obtained));
if (_local2 < (_achievements.length - 1)){
_local1 = (_local1 + ",");
};
_local2++;
};
return (_local1);
}
public function set code(_arg1:String):void{
var _local3:int;
if (!_arg1){
return;
};
var _local2:Array = _arg1.split(",");
while (_local3 < _local2.length) {
_achievements[_local3].obtained = Boolean(int(_local2[_local3]));
_local3++;
};
}
public function registerAchievement(_arg1:String):void{
if (!hasAchievement(_arg1)){
_achievements.push(new Achievement(_arg1));
};
}
public function obtainAchievement(_arg1:String):void{
var _local2:int = getAchievementIndex(_arg1);
if (_local2 > -1){
if (!_achievements[_local2].obtained){
_achievements[_local2].obtained = true;
_onObtain.dispatch();
};
};
}
public function isAchievementObtained(_arg1:String):Boolean{
var _local2:int = getAchievementIndex(_arg1);
if (_local2 > -1){
return (_achievements[_local2].obtained);
};
return (false);
}
public function hasAchievement(_arg1:String):Boolean{
return ((getAchievementIndex(_arg1) > -1));
}
protected function getAchievementIndex(_arg1:String):int{
var _local2:int;
while (_local2 < _achievements.length) {
if (_achievements[_local2].name == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
}
}
}//package gg.engine.common
Section 198
//LevelCode (gg.engine.common.LevelCode)
package gg.engine.common {
import gg.engine.utils.*;
import com.dynamicflash.util.*;
public class LevelCode {
public static const CODE_REG_EXP:RegExp = new RegExp((("[" + Base64.BASE64_CHARS) + "]+"));
public static var paramNames:Array = new Array("theater");
public static var delimiter:String = "_";
public static function encode(_arg1:Object):String{
return (GGCode.encodeObject(_arg1, paramNames, delimiter));
}
public static function decode(_arg1:String):Object{
return (GGCode.decodeObject(_arg1, paramNames, delimiter));
}
}
}//package gg.engine.common
Section 199
//LevelManager (gg.engine.common.LevelManager)
package gg.engine.common {
import gg.engine.utils.*;
public class LevelManager {
protected var _levelPacks:Array;
protected var _onChange:GGEvent;
public function LevelManager(){
_levelPacks = new Array();
_onChange = new GGEvent();
}
public function get onChange():GGEvent{
return (_onChange);
}
public function get numPacks():int{
return (_levelPacks.length);
}
public function get totalScore():int{
var _local1:int;
var _local2:int;
while (_local2 < _levelPacks.length) {
_local1 = (_local1 + _levelPacks[_local2].totalScore);
_local2++;
};
return (_local1);
}
public function get code():String{
var _local2:int;
var _local1 = "";
while (_local2 < _levelPacks.length) {
_local1 = (_local1 + _levelPacks[_local2].code);
if (_local2 < (_levelPacks.length - 1)){
_local1 = (_local1 + "|");
};
_local2++;
};
return (_local1);
}
public function set code(_arg1:String):void{
var _local3:int;
var _local2:Array = _arg1.split("|");
while (_local3 < _local2.length) {
_levelPacks[_local3].code = _local2[_local3];
_local3++;
};
}
public function load(_arg1:XML):void{
var _local3:XML;
var _local4:LevelPack;
unload();
var _local2:XMLList = _arg1.elements();
for each (_local3 in _local2) {
_local4 = new LevelPack();
_local4.load(_local3);
_local4.onChange.addListener(_onChange.dispatch);
_levelPacks.push(_local4);
};
}
public function unload():void{
while (_levelPacks.length) {
_levelPacks[0].unload();
_levelPacks[0].onChange.removeAllListeners();
_levelPacks.shift();
};
}
public function getLevelPack(_arg1:String):LevelPack{
var _local2:int;
while (_local2 < _levelPacks.length) {
if (_levelPacks[_local2].name == _arg1){
return (_levelPacks[_local2]);
};
_local2++;
};
return (null);
}
public function getLevelPackAt(_arg1:int):LevelPack{
if ((((_arg1 > -1)) && ((_arg1 < _levelPacks.length)))){
return (_levelPacks[_arg1]);
};
return (null);
}
}
}//package gg.engine.common
Section 200
//LevelPack (gg.engine.common.LevelPack)
package gg.engine.common {
import gg.engine.utils.*;
public class LevelPack {
protected var _name:String;
protected var _levelCodes:Array;
protected var _scores:Array;
protected var _levelsBeaten:int;
protected var _beaten:Boolean;
protected var _onChange:GGEvent;
public function LevelPack(){
_levelCodes = new Array();
_scores = new Array();
_onChange = new GGEvent();
}
public function get name():String{
return (_name);
}
public function get levelsBeaten():int{
return (_levelsBeaten);
}
public function set levelsBeaten(_arg1:int):void{
if (_levelsBeaten != _arg1){
_levelsBeaten = _arg1;
_onChange.dispatch();
};
}
public function get beaten():Boolean{
return (_beaten);
}
public function set beaten(_arg1:Boolean):void{
if (_beaten != _arg1){
_beaten = _arg1;
_onChange.dispatch();
};
}
public function get onChange():GGEvent{
return (_onChange);
}
public function get numLevels():int{
return (_levelCodes.length);
}
public function get totalScore():int{
var _local1:int;
var _local2:int;
while (_local2 < _levelCodes.length) {
_local1 = (_local1 + _scores[_local2]);
_local2++;
};
return (_local1);
}
public function get code():String{
var _local2:int;
var _local1 = "";
_local1 = (_local1 + (_levelsBeaten + ","));
_local1 = (_local1 + (int(_beaten) + ","));
while (_local2 < _scores.length) {
_local1 = (_local1 + _scores[_local2]);
if (_local2 < (_scores.length - 1)){
_local1 = (_local1 + ",");
};
_local2++;
};
return (_local1);
}
public function set code(_arg1:String):void{
var _local3:int;
var _local2:Array = _arg1.split(",");
_levelsBeaten = int(_local2.shift());
_beaten = Boolean(int(_local2.shift()));
while (_local3 < _local2.length) {
_scores[_local3] = int(_local2[_local3]);
_local3++;
};
}
public function load(_arg1:XML):void{
var _local3:XML;
unload();
_name = _arg1.@Name;
var _local2:XMLList = _arg1.elements();
for each (_local3 in _local2) {
_levelCodes.push(_local3.Code);
_scores.push(0);
};
}
public function beat():void{
var _local1:int;
while (_local1 < _levelCodes.length) {
setScore(_local1, (1000 + (100 * _local1)));
_local1++;
};
levelsBeaten = _levelCodes.length;
beaten = true;
}
public function unload():void{
_name = "";
UArray.clear(_levelCodes);
UArray.clear(_scores);
_levelsBeaten = 0;
_beaten = false;
}
public function getScore(_arg1:int):int{
return (_scores[_arg1]);
}
public function setScore(_arg1:int, _arg2:int):void{
if (_scores[_arg1] != _arg2){
_scores[_arg1] = _arg2;
_onChange.dispatch();
};
}
public function getLevelCode(_arg1:int):String{
if ((((_arg1 > -1)) && ((_arg1 < _levelCodes.length)))){
return (_levelCodes[_arg1]);
};
return (null);
}
}
}//package gg.engine.common
Section 201
//Dialog (gg.engine.display.windows.Dialog)
package gg.engine.display.windows {
import gg.engine.display.*;
public class Dialog extends Window {
public function Dialog(){
_openTweenTime = Settings.DIALOG_OPEN_TWEEN_TIME;
_closeTweenTime = Settings.DIALOG_CLOSE_TWEEN_TIME;
}
}
}//package gg.engine.display.windows
Section 202
//ModalDialog (gg.engine.display.windows.ModalDialog)
package gg.engine.display.windows {
import gg.engine.display.*;
public class ModalDialog extends Dialog {
protected var _dummy:Dummy;
public function ModalDialog(){
_openTweenTime = Settings.MODAL_DIALOG_CLOSE_TWEEN_TIME;
_closeTweenTime = Settings.MODAL_DIALOG_CLOSE_TWEEN_TIME;
_dummy = new Dummy();
addChildAt(_dummy, 0);
}
}
}//package gg.engine.display.windows
Section 203
//Sheet (gg.engine.display.windows.Sheet)
package gg.engine.display.windows {
import flash.geom.*;
import gg.engine.display.*;
public class Sheet extends Window {
protected var _dummy:Dummy;
protected var _ease:Function;
protected var _openPos:Point;
protected var _showPos:Point;
protected var _closePos:Point;
protected var _alphaTweening:Boolean;
public function Sheet(){
_ease = Settings.SHEET_EASE;
_openTweenTime = Settings.SHEET_OPEN_TWEEN_TIME;
_openPos = new Point(Settings.SHEET_OPEN_POS_X, Settings.SHEET_OPEN_POS_Y);
_showPos = new Point(Settings.SHEET_SHOW_POS_X, Settings.SHEET_OPEN_POS_Y);
_closeTweenTime = Settings.SHEET_CLOSE_TWEEN_TIME;
_closePos = new Point(Settings.SHEET_CLOSE_POS_X, Settings.SHEET_CLOSE_POS_Y);
_alphaTweening = Settings.SHEET_ALPHA_TWEENING;
_dummy = new Dummy();
addChildAt(_dummy, 0);
}
public function get ease():Function{
return (_ease);
}
public function get openPos():Point{
return (_openPos);
}
public function get showPos():Point{
return (_showPos);
}
public function get closePos():Point{
return (_closePos);
}
public function get alphaTweening():Boolean{
return (_alphaTweening);
}
}
}//package gg.engine.display.windows
Section 204
//Dummy (gg.engine.display.Dummy)
package gg.engine.display {
import flash.display.*;
public class Dummy extends Shape {
public function Dummy(_arg1:Number=700, _arg2:Number=525){
graphics.beginFill(0, 0);
graphics.drawRect(0, 0, _arg1, _arg2);
graphics.endFill();
}
}
}//package gg.engine.display
Section 205
//GUIManager (gg.engine.display.GUIManager)
package gg.engine.display {
import flash.display.*;
import gg.engine.utils.*;
import com.greensock.*;
import gg.engine.display.windows.*;
import flash.utils.*;
import gg.engine.utils.graphicsFill.*;
public class GUIManager extends Sprite {
protected var _backgroundHolder:Sprite;
protected var _sheetsHolder:Sprite;
protected var _dialogsHolder:Sprite;
protected var _hudHolder:Sprite;
protected var _dummy:Dummy;
protected var _background;
protected var _hud;
protected var _windows:Dictionary;
protected var _onChange:GGEvent;
protected var _onSheetOpening:GGEvent;
public function GUIManager(_arg1:DisplayObjectContainer){
_backgroundHolder = new Sprite();
_sheetsHolder = new Sprite();
_dialogsHolder = new Sprite();
_hudHolder = new Sprite();
_dummy = new Dummy();
_windows = new Dictionary();
_onChange = new GGEvent();
_onSheetOpening = new GGEvent();
addChild(_backgroundHolder);
addChild(_sheetsHolder);
addChild(_dialogsHolder);
addChild(_hudHolder);
_arg1.addChild(this);
}
public function get background(){
return (_background);
}
public function set background(_arg1):void{
if ((((_background == _arg1)) || (!((_arg1 is DisplayObject))))){
return;
};
if (_background){
_backgroundHolder.removeChild(_background);
};
_background = _arg1;
_backgroundHolder.addChild(_background);
}
public function get hud(){
return (_hud);
}
public function set hud(_arg1):void{
if ((((_hud == _arg1)) || (!((_arg1 is DisplayObject))))){
return;
};
if (_hud){
_hudHolder.removeChild(_hud);
};
_hud = _arg1;
_hudHolder.addChild(_hud);
}
public function get onChange():GGEvent{
return (_onChange);
}
public function get onSheetOpening():GGEvent{
return (_onSheetOpening);
}
public function get frozen():Boolean{
return (contains(_dummy));
}
public function set frozen(_arg1:Boolean):void{
if (((!(_arg1)) && (contains(_dummy)))){
removeChild(_dummy);
};
if (((_arg1) && (!(contains(_dummy))))){
addChild(_dummy);
};
}
public function get code():String{
return (stage.quality);
}
public function set code(_arg1:String):void{
stage.quality = _arg1;
}
public function get graphicsQuality():String{
return (stage.quality);
}
public function set graphicsQuality(_arg1:String):void{
if (stage.quality != _arg1){
stage.quality = _arg1;
_onChange.dispatch();
};
}
public function get graphicsLevel():Number{
switch (stage.quality){
case "LOW":
return (0);
case "MEDIUM":
return (1);
case "HIGH":
return (2);
case "BEST":
return (3);
};
return (2);
}
public function set graphicsLevel(_arg1:Number):void{
switch (_arg1){
case 0:
graphicsQuality = "LOW";
return;
case 1:
graphicsQuality = "MEDIUM";
return;
case 2:
graphicsQuality = "HIGH";
return;
case 3:
graphicsQuality = "BEST";
return;
default:
graphicsQuality = "HIGH";
};
}
public function get currentSheet():Sheet{
var _local1:Window;
var _local2:Sheet;
for each (_local1 in _windows) {
_local2 = (_local1 as Sheet);
if (((_local2) && (_local2.opened))){
return (_local2);
};
};
return (null);
}
public function get sheetOverlapping():Boolean{
var _local1:Window;
var _local2:ModalDialog;
for each (_local1 in _windows) {
_local2 = (_local1 as ModalDialog);
if (((_local2) && (!(_local2.closed)))){
return (true);
};
};
return (false);
}
public function registerWindow(_arg1:Class, _arg2:String):void{
var _local3:Window;
if (!_windows[_arg2]){
_local3 = (new (_arg1) as Window);
if (_local3){
_windows[_arg2] = _local3;
_local3.name = _arg2;
_local3._guiMgr = this;
};
};
}
public function getWindow(_arg1:String):Window{
return (_windows[_arg1]);
}
public function openWindow(_arg1:String, _arg2:Object):Window{
var _local3:Window = _windows[_arg1];
if (!_local3){
return (_local3);
};
if (((_local3.closed) || (_local3.opened))){
if ((_local3 as Sheet)){
closeAllDialogs();
if (_local3.opened){
onSheet_ReopenRequest(_local3, _arg2);
return (_local3);
};
onSheet_CloseRequest(currentSheet);
onSheet_OpenRequest(_local3, _arg2);
} else {
if ((_local3 as Dialog)){
if (_local3.opened){
_local3._nextAction.type = WindowAction.OPEN;
_local3._nextAction.openingOptions = _arg2;
onDialog_CloseRequest(_local3);
return (_local3);
};
onDialog_OpenRequest(_local3, _arg2);
};
};
} else {
if (_local3.closing){
_local3._nextAction.type = WindowAction.OPEN;
_local3._nextAction.openingOptions = _arg2;
};
};
return (_local3);
}
public function closeWindow(_arg1:String):void{
var _local2:Window = _windows[_arg1];
if (!_local2){
return;
};
if (_local2.opened){
if ((_local2 as Sheet)){
closeAllDialogs();
onSheet_CloseRequest(_local2);
} else {
if ((_local2 as Dialog)){
onDialog_CloseRequest(_local2);
};
};
} else {
if (_local2.opening){
_local2._nextAction.type = WindowAction.CLOSE;
};
};
}
public function closeAllDialogs():void{
var _local1:Window;
for each (_local1 in _windows) {
if ((_local1 as Dialog)){
if (_local1.opened){
onDialog_CloseRequest(_local1);
} else {
if (_local1.opening){
_local1._nextAction.type = WindowAction.CLOSE;
};
};
};
};
}
public function doNextActionFor(_arg1:String):void{
var _local2:Window = _windows[_arg1];
if (((_local2) && (!((_local2._nextAction.type == WindowAction.NOTHING))))){
if (_local2._nextAction.type == WindowAction.OPEN){
openWindow(_arg1, _local2._nextAction.openingOptions);
} else {
closeWindow(_arg1);
};
_local2._nextAction.type = WindowAction.NOTHING;
};
}
protected function onSheet_OpenRequest(_arg1:Window, _arg2:Object):void{
var sheet:Sheet;
var onSheet_OpeningTween_Complete:Function;
var window = _arg1;
var options = _arg2;
onSheet_OpeningTween_Complete = function ():void{
sheet.postInitialize();
sheet._state = Window._OPENED;
doNextActionFor(sheet.name);
};
sheet = (window as Sheet);
if (!sheet){
return;
};
stage.focus = stage;
sheet._state = Window._OPENING;
sheet.preInitialize(options);
_sheetsHolder.addChild(sheet);
sheet.x = sheet.openPos.x;
sheet.y = sheet.openPos.y;
var tweenParams:Object = {x:sheet.showPos.x, y:sheet.showPos.y, ease:sheet.ease, onComplete:onSheet_OpeningTween_Complete};
if (sheet.alphaTweening){
sheet.alpha = 0;
tweenParams.alpha = 1;
};
TweenLite.to(sheet, sheet.openTweenTime, tweenParams);
sheet.initialize();
_onSheetOpening.dispatch();
}
protected function onSheet_ReopenRequest(_arg1:Window, _arg2:Object):void{
var bitmap:Bitmap;
var onSheet_ClosingTween_Complete:Function;
var window = _arg1;
var options = _arg2;
onSheet_ClosingTween_Complete = function ():void{
_sheetsHolder.removeChild(bitmap);
};
var sheet:Sheet = (window as Sheet);
if (!sheet){
return;
};
var bitmapData:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight, true, 0xFFFFFF);
bitmapData.draw(sheet);
sheet._state = Window._CLOSING;
sheet.preShutdown();
sheet.shutdown();
_sheetsHolder.removeChild(sheet);
sheet.postShutdown();
sheet._state = Window._CLOSED;
bitmap = new Bitmap(bitmapData, "auto", true);
_sheetsHolder.addChild(bitmap);
var tweenParams:Object = {x:sheet.closePos.x, y:sheet.closePos.y, ease:sheet.ease, onComplete:onSheet_ClosingTween_Complete};
if (sheet.alphaTweening){
tweenParams.alpha = 0;
};
TweenLite.to(bitmap, sheet.closeTweenTime, tweenParams);
onSheet_OpenRequest(sheet, options);
}
protected function onSheet_CloseRequest(_arg1:Window):void{
var sheet:Sheet;
var onSheet_ClosingTween_Complete:Function;
var window = _arg1;
onSheet_ClosingTween_Complete = function ():void{
_sheetsHolder.removeChild(sheet);
sheet.postShutdown();
sheet._state = Window._CLOSED;
doNextActionFor(sheet.name);
};
sheet = (window as Sheet);
if (!sheet){
return;
};
sheet._state = Window._CLOSING;
sheet.preShutdown();
var tweenParams:Object = {x:sheet.closePos.x, y:sheet.closePos.y, ease:sheet.ease, onComplete:onSheet_ClosingTween_Complete};
if (sheet.alphaTweening){
tweenParams.alpha = 0;
};
TweenLite.to(sheet, sheet.closeTweenTime, tweenParams);
sheet.shutdown();
}
protected function onDialog_OpenRequest(_arg1:Window, _arg2:Object):void{
var dialog:Dialog;
var onDialog_OpeningTween_Complete:Function;
var window = _arg1;
var options = _arg2;
onDialog_OpeningTween_Complete = function ():void{
dialog.postInitialize();
dialog._state = Window._OPENED;
doNextActionFor(dialog.name);
};
dialog = (window as Dialog);
if (!dialog){
return;
};
dialog._state = Window._OPENING;
dialog.preInitialize(options);
_dialogsHolder.addChild(dialog);
ShowHide.show(dialog, dialog.openTweenTime, {filler:Bubbles, onComplete:onDialog_OpeningTween_Complete});
dialog.initialize();
}
protected function onDialog_CloseRequest(_arg1:Window):void{
var dialog:Dialog;
var onDialog_ClosingTween_Complete:Function;
var window = _arg1;
onDialog_ClosingTween_Complete = function ():void{
_dialogsHolder.removeChild(dialog);
dialog.postShutdown();
dialog._state = Window._CLOSED;
doNextActionFor(dialog.name);
};
dialog = (window as Dialog);
if (!dialog){
return;
};
dialog._state = Window._CLOSING;
dialog.preShutdown();
ShowHide.hide(dialog, dialog.openTweenTime, {filler:Bubbles, onComplete:onDialog_ClosingTween_Complete});
dialog.shutdown();
}
}
}//package gg.engine.display
Section 206
//HUD (gg.engine.display.HUD)
package gg.engine.display {
import flash.display.*;
import gg.engine.utils.*;
import flash.utils.*;
import gg.engine.utils.graphicsFill.*;
public class HUD extends Sprite {
protected var _state:String;
protected var _states:Dictionary;
protected var _showingItems:Array;
public function HUD(_arg1:Array=null){
constructor(_arg1);
}
public function get state():String{
return (_state);
}
public function set state(_arg1:String):void{
var _local3:int;
var _local4:int;
if (!_states[_arg1]){
state = "Default";
return;
};
var _local2:Array = UArray.clone(_states[_arg1]);
while (_local3 < _showingItems.length) {
_local4 = 0;
while (_local4 < _local2.length) {
if (_showingItems[_local3] == _local2[_local4]){
_showingItems.splice(_local3, 1);
_local2.splice(_local4, 1);
_local3--;
break;
};
_local4++;
};
_local3++;
};
_local3 = 0;
while (_local3 < _showingItems.length) {
hideItem(_showingItems[_local3], (0.5 * Settings.SHEET_OPEN_TWEEN_TIME));
_local3++;
};
_local3 = 0;
while (_local3 < _local2.length) {
showItem(_local2[_local3], (0.5 * Settings.SHEET_OPEN_TWEEN_TIME), (0.5 * Settings.SHEET_OPEN_TWEEN_TIME));
_local3++;
};
_state = _arg1;
_showingItems = UArray.clone(_states[_state]);
_local3 = 0;
while (_local3 < _showingItems.length) {
setChildIndex(this[_showingItems[_local3]], _local3);
_local3++;
};
}
public function addState(_arg1:String, _arg2:Array):void{
if (!_states[_arg1]){
_states[_arg1] = _arg2;
};
}
public function showItem(_arg1:String, _arg2:Number, _arg3:Number=0):void{
var _local4:DisplayObject = (this[_arg1] as DisplayObject);
if (((_local4) && (!(contains(_local4))))){
addChild(_local4);
ShowHide.show(_local4, _arg2, {filler:Bubbles, delay:_arg3});
_showingItems.push(_arg1);
};
}
public function hideItem(_arg1:String, _arg2:Number, _arg3:Number=0):void{
var item:DisplayObject;
var onComplete:Function;
var name = _arg1;
var duration = _arg2;
var delay = _arg3;
onComplete = function ():void{
removeChild(item);
UArray.remove(_showingItems, name);
};
item = (this[name] as DisplayObject);
if (((item) && (contains(item)))){
ShowHide.hide(item, duration, {filler:Bubbles, delay:delay, onComplete:onComplete});
};
}
protected function constructor(_arg1:Array=null):void{
var _local2:int;
_states = new Dictionary(true);
while (numChildren) {
removeChildAt(0).visible = false;
};
if (!_arg1){
_arg1 = new Array();
};
addState("Default", _arg1);
while (_local2 < _arg1.length) {
addChild(this[_arg1[_local2]]).visible = true;
_local2++;
};
_state = "Default";
_showingItems = UArray.clone(_arg1);
}
}
}//package gg.engine.display
Section 207
//Window (gg.engine.display.Window)
package gg.engine.display {
import flash.display.*;
public class Window extends Sprite {
var _state:int;
var _guiMgr:GUIManager;
var _nextAction:WindowAction;
protected var _initOptions:Object;
protected var _openTweenTime:Number;
protected var _closeTweenTime:Number;
static const _CLOSED:int = 0;
static const _OPENING:int = 1;
static const _OPENED:int = 2;
static const _CLOSING:int = 3;
public function Window(){
_nextAction = new WindowAction();
}
public function get guiMgr():GUIManager{
return (_guiMgr);
}
public function get openTweenTime():Number{
return (_openTweenTime);
}
public function get closeTweenTime():Number{
return (_closeTweenTime);
}
public function get closed():Boolean{
return ((_state == _CLOSED));
}
public function get opening():Boolean{
return ((_state == _OPENING));
}
public function get opened():Boolean{
return ((_state == _OPENED));
}
public function get closing():Boolean{
return ((_state == _CLOSING));
}
public function preInitialize(_arg1:Object):void{
_initOptions = _arg1;
}
public function initialize():void{
}
public function postInitialize():void{
}
public function preShutdown():void{
}
public function shutdown():void{
}
public function postShutdown():void{
}
public function close():void{
_guiMgr.closeWindow(name);
}
public function restart():void{
_guiMgr.openWindow(name, _initOptions);
}
}
}//package gg.engine.display
Section 208
//WindowAction (gg.engine.display.WindowAction)
package gg.engine.display {
class WindowAction {
var type:int;
var openingOptions:Object;
static const NOTHING:int = 0;
static const OPEN:int = 1;
static const CLOSE:int = 2;
}
}//package gg.engine.display
Section 209
//MusicPlayListItem (gg.engine.sound.MusicPlayListItem)
package gg.engine.sound {
public class MusicPlayListItem {
public var name:String;
public var startTime:Number;
public var loops:int;
public function MusicPlayListItem(_arg1:String, _arg2:Number, _arg3:int){
name = _arg1;
startTime = _arg2;
loops = _arg3;
}
}
}//package gg.engine.sound
Section 210
//SoundManager (gg.engine.sound.SoundManager)
package gg.engine.sound {
import gg.engine.utils.*;
import flash.events.*;
import flash.utils.*;
import flash.media.*;
public class SoundManager {
protected var _music:Dictionary;
protected var _sfx:Dictionary;
protected var _musicPlayList:Array;
protected var _playingMusic:String;
protected var _musicTransform:SoundTransform;
protected var _sfxTransform:SoundTransform;
protected var _musicChannel:SoundChannel;
protected var _sfxChannels:Dictionary;
protected var _musicMuting:Boolean;
protected var _musicVol:Number;
protected var _sfxMuting:Boolean;
protected var _sfxVol:Number;
protected var _onChange:GGEvent;
public function SoundManager(){
_sfx = new Dictionary();
_music = new Dictionary();
_musicPlayList = new Array();
_musicTransform = new SoundTransform();
_sfxTransform = new SoundTransform();
_sfxChannels = new Dictionary();
_musicMuting = false;
_musicVol = 1;
_sfxMuting = false;
_sfxVol = 1;
_onChange = new GGEvent();
}
public function get playingMusic():String{
return (_playingMusic);
}
public function get musicMuting():Boolean{
return (_musicMuting);
}
public function set musicMuting(_arg1:Boolean):void{
if (_musicMuting != _arg1){
setMusicMuting(_arg1);
_onChange.dispatch();
};
}
public function get musicVol():Number{
return (_musicVol);
}
public function set musicVol(_arg1:Number):void{
if (_musicVol != _arg1){
setMusicVol(_arg1);
_onChange.dispatch();
};
}
public function get sfxMuting():Boolean{
return (_sfxMuting);
}
public function set sfxMuting(_arg1:Boolean):void{
if (_sfxMuting != _arg1){
setSFXMuting(_arg1);
_onChange.dispatch();
};
}
public function get sfxVol():Number{
return (_sfxVol);
}
public function set sfxVol(_arg1:Number):void{
if (_sfxVol != _arg1){
setSFXVol(_arg1);
_onChange.dispatch();
};
}
public function get onChange():GGEvent{
return (_onChange);
}
public function get code():String{
var _local1 = "";
_local1 = (_local1 + (_sfxVol + ","));
_local1 = (_local1 + (int(_sfxMuting) + ","));
_local1 = (_local1 + (_musicVol + ","));
_local1 = (_local1 + (int(_musicMuting) + ","));
return (_local1);
}
public function set code(_arg1:String):void{
var _local2:Array = _arg1.split(",");
setSFXVol(Number(_local2[0]));
setSFXMuting(Boolean(int(_local2[1])));
setMusicVol(Number(_local2[2]));
setMusicMuting(Boolean(int(_local2[3])));
}
public function registerMusic(_arg1:Class, _arg2:String):void{
var _local3:Sound;
if (!_music[_arg2]){
_local3 = (new (_arg1) as Sound);
if (_local3){
_music[_arg2] = _local3;
};
};
}
public function registerSFX(_arg1:Class, _arg2:String):void{
var _local3:Sound;
if (!_sfx[_arg2]){
_local3 = (new (_arg1) as Sound);
if (_local3){
_sfx[_arg2] = _local3;
};
};
}
public function pushMusicToPlayList(_arg1:String, _arg2:Number=0, _arg3:int=0):void{
var _local4:Sound = _music[_arg1];
if (_local4){
_musicPlayList.push(new MusicPlayListItem(_arg1, _arg2, _arg3));
if (!_playingMusic){
playNextMusic();
};
};
}
public function playNextMusic():void{
var _local1:MusicPlayListItem;
if (_playingMusic){
_musicChannel.stop();
_musicChannel.removeEventListener(Event.SOUND_COMPLETE, onMusicChannel_SoundComplete);
_playingMusic = "";
};
if (_musicPlayList.length){
_local1 = _musicPlayList[(_musicPlayList.length - 1)];
_musicChannel = _music[_local1.name].play(_local1.startTime, _local1.loops, _musicTransform);
_musicChannel.addEventListener(Event.SOUND_COMPLETE, onMusicChannel_SoundComplete);
_playingMusic = _local1.name;
_musicPlayList.pop();
};
}
public function clearMusicPlayList():void{
if (_playingMusic){
_musicChannel.stop();
_musicChannel.removeEventListener(Event.SOUND_COMPLETE, onMusicChannel_SoundComplete);
_playingMusic = "";
};
UArray.clear(_musicPlayList);
}
public function playSFX(_arg1:String, _arg2:Number=0, _arg3:int=0):void{
var _local4:Sound = _sfx[_arg1];
if (_local4){
_sfxChannels[_arg1] = _local4.play(_arg2, _arg3, _sfxTransform);
};
}
public function stopSFX(_arg1:String):void{
var _local2:SoundChannel = _sfxChannels[_arg1];
if (_local2){
_local2.stop();
};
}
public function stopAllSFX():void{
var _local1:String;
var _local2:SoundChannel;
for (_local1 in _sfxChannels) {
_local2 = _sfxChannels[_local1];
if (_local2){
_local2.stop();
};
};
}
protected function setMusicMuting(_arg1:Boolean):void{
if (_arg1){
_musicTransform.volume = 0;
} else {
_musicTransform.volume = _musicVol;
};
if (_musicChannel){
_musicChannel.soundTransform = _musicTransform;
};
_musicMuting = _arg1;
}
protected function setMusicVol(_arg1:Number):void{
if (!_musicMuting){
_musicTransform.volume = _arg1;
if (_musicChannel){
_musicChannel.soundTransform = _musicTransform;
};
};
_musicVol = _arg1;
}
protected function setSFXMuting(_arg1:Boolean):void{
var _local2:String;
var _local3:SoundChannel;
if (_arg1){
_sfxTransform.volume = 0;
} else {
_sfxTransform.volume = _sfxVol;
};
for (_local2 in _sfxChannels) {
_local3 = _sfxChannels[_local2];
if (_local3){
_local3.soundTransform = _sfxTransform;
};
};
_sfxMuting = _arg1;
}
protected function setSFXVol(_arg1:Number):void{
var _local2:String;
var _local3:SoundChannel;
if (!_sfxMuting){
_sfxTransform.volume = _arg1;
for (_local2 in _sfxChannels) {
_local3 = _sfxChannels[_local2];
if (_local3){
_local3.soundTransform = _sfxTransform;
};
};
};
_sfxVol = _arg1;
}
protected function onMusicChannel_SoundComplete(_arg1:Event):void{
_musicChannel.removeEventListener(Event.SOUND_COMPLETE, onMusicChannel_SoundComplete);
_playingMusic = "";
playNextMusic();
}
}
}//package gg.engine.sound
Section 211
//MovingPlatform (gg.engine.theater.actors.MovingPlatform)
package gg.engine.theater.actors {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import gg.engine.theater.edit.params.*;
import gg.engine.utils.*;
public class MovingPlatform extends Shape {
protected var _joint:b2Joint;
protected var _direction:Number;
protected var _speed:Number;
protected var _velocity:b2Vec2;
protected var _alternateRequest:int;
public function MovingPlatform(){
_velocity = new b2Vec2();
}
public function get direction():Number{
return (_direction);
}
public function set direction(_arg1:Number):void{
_direction = _arg1;
if (inTheater){
_velocity.x = (_speed * Math.cos((_deg2rad * _direction)));
_velocity.y = (_speed * Math.sin((_deg2rad * _direction)));
};
}
public function get speed():Number{
return (_speed);
}
public function set speed(_arg1:Number):void{
_speed = _arg1;
if (inTheater){
_velocity.Normalize();
_velocity.Multiply(_speed);
};
}
override public function get code():String{
var _local1:String = ((((((((((UNumber.round2str(x, 2) + ",") + UNumber.round2str(y, 2)) + ",") + UNumber.round2str(rotation, 2)) + ",") + _bitParams.getValue()) + ",") + UNumber.round2str(speed, 2)) + ",") + UNumber.round2str(direction, 2));
if (((!((scaleX == 1))) || (!((scaleY == 1))))){
_local1 = (_local1 + ((("," + UNumber.round2str(scaleX, 4)) + ",") + UNumber.round2str(scaleY, 4)));
};
return (_local1);
}
override public function decode(_arg1:String):Object{
var _local2:Array = _arg1.split(",");
var _local3:Object = new Object();
_local3.x = Number(_local2[0]);
_local3.y = Number(_local2[1]);
_local3.rotation = Number(_local2[2]);
_local3.bitParams = int(_local2[3]);
_local3.speed = Number(_local2[4]);
_local3.direction = Number(_local2[5]);
if (_local2.length > 6){
_local3.scaleX = Number(_local2[6]);
_local3.scaleY = Number(_local2[7]);
};
return (_local3);
}
override public function step():void{
super.step();
if (_body.GetLinearVelocity().Length() < (0.98 * _speed)){
_alternateRequest++;
} else {
_alternateRequest = 0;
};
if (_alternateRequest > 1){
alternate();
_alternateRequest = 0;
};
_body.SetLinearVelocity(_velocity);
}
override public function syncPhys():void{
if (!syncPhysAllowed){
return;
};
theater.readdActor(this, {code:code});
}
public function alternate():void{
if (direction < 360){
direction = (direction + 180);
} else {
direction = (direction - 180);
};
}
override protected function setupBitParams():void{
super.setupEditableParams();
_bitParams.removeBit("static");
}
override protected function setupEditableParams():void{
super.setupEditableParams();
_editableParams.removeParam("static");
_editableParams.addParam(new NumericParam("speed", "speed", NumericParam.REAL, 1));
_editableParams.addParam(new NumericParam("direction", "direction"));
}
override protected function restore2default():void{
super.restore2default();
_direction = 0;
_speed = 1;
_buildingParams.applyGravity = false;
_buildingParams.density = 5000;
_buildingParams.direction = 0;
_buildingParams.speed = 1;
}
override protected function build():void{
var _local1:b2PrismaticJointDef;
super.build();
_direction = _buildingParams.direction;
_speed = _buildingParams.speed;
_velocity.x = Math.cos((_deg2rad * _direction));
_velocity.y = Math.sin((_deg2rad * _direction));
_local1 = new b2PrismaticJointDef();
_local1.Initialize(_body, _theater.world.GetGroundBody(), _body.GetWorldCenter(), _velocity);
_velocity.x = (_velocity.x * _speed);
_velocity.y = (_velocity.y * _speed);
_joint = _theater.world.CreateJoint(_local1);
_body.SetLinearVelocity(_velocity);
}
override protected function destroy():void{
super.destroy();
_joint = null;
}
}
}//package gg.engine.theater.actors
Section 212
//RevoluteJoint (gg.engine.theater.actors.RevoluteJoint)
package gg.engine.theater.actors {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Dynamics.Joints.*;
import gg.engine.theater.edit.params.*;
import gg.engine.utils.*;
import gg.engine.theater.*;
public class RevoluteJoint extends Actor {
protected var _joint:b2RevoluteJoint;
protected var _motorSpeed:Number;
protected var _maxMotorTorque:Number;
public function get joint():b2RevoluteJoint{
return (_joint);
}
public function get motorSpeed():Number{
return (_motorSpeed);
}
public function set motorSpeed(_arg1:Number):void{
if (_joint){
_joint.SetMotorSpeed(_arg1);
};
_motorSpeed = _arg1;
}
public function get maxMotorTorque():Number{
return (_maxMotorTorque);
}
public function set maxMotorTorque(_arg1:Number):void{
if (_joint){
_joint.SetMaxMotorTorque(_arg1);
};
_maxMotorTorque = _arg1;
}
override public function get code():String{
return (((((((((UNumber.round2str(x, 2) + ",") + UNumber.round2str(y, 2)) + ",") + _motorSpeed) + ",") + _maxMotorTorque) + ",") + bitParams.getValue()));
}
override public function decode(_arg1:String):Object{
var _local2:Array = _arg1.split(",");
var _local3:Object = new Object();
_local3.x = Number(_local2[0]);
_local3.y = Number(_local2[1]);
_local3.motorSpeed = Number(_local2[2]);
_local3.maxMotorTorque = Number(_local2[3]);
_local3.bitParams = int(_local2[4]);
return (_local3);
}
override public function step():void{
if (_joint){
x = (_physScale * _joint.GetAnchor1().x);
y = (_physScale * _joint.GetAnchor2().y);
};
}
override public function syncPhys():void{
var _local1:Boolean;
if (!syncPhysAllowed){
return;
};
if (!_joint){
_theater.readdActor(this, {code:code});
return;
};
var _local2:Actor = (_joint.GetBody1().GetUserData() as Actor);
if (((_local2) && (!(_theater.hasActor(_local2))))){
_local1 = true;
};
_local2 = (_joint.GetBody2().GetUserData() as Actor);
if (((_local2) && (!(_theater.hasActor(_local2))))){
_local1 = true;
};
if (((!((int(x) == int((_physScale * _joint.GetAnchor1().x))))) || (!((int(x) == int((_physScale * _joint.GetAnchor2().x))))))){
_local1 = true;
};
if (((!((int(y) == int((_physScale * _joint.GetAnchor1().y))))) || (!((int(y) == int((_physScale * _joint.GetAnchor2().y))))))){
_local1 = true;
};
if (_local1){
_theater.readdActor(this, {code:code});
return;
};
var _local3:Array = _theater.getBodyListAtPoint(x, y);
var _local4:b2Body = _theater.world.GetGroundBody();
if ((((((_local3.length == 1)) && (!((_joint.GetBody1() == _local4))))) && (!((_joint.GetBody2() == _local4))))){
_local1 = true;
} else {
if ((((_local3.length > 1)) && ((((_joint.GetBody1() == _local4)) || ((_joint.GetBody2() == _local4)))))){
_local1 = true;
};
};
if (_local1){
_theater.readdActor(this, {code:code});
};
}
override protected function constructor():void{
super.constructor();
_layer = 2;
}
override protected function setupBitParams():void{
_bitParams.addBit("fixed", false, onBitParams_Fixed_Change);
_bitParams.addBit("enableMotor", false, onBitParams_EnableMotor_Change);
}
override protected function setupEditableParams():void{
_editableParams.addParam(new NumericParam("x", "x", NumericParam.REAL, 0, Settings.WIDTH));
_editableParams.addParam(new NumericParam("y", "y", NumericParam.REAL, 0, Settings.HEIGHT));
_editableParams.addParam(new BooleanParam("fixed", "fixed", true));
_editableParams.addParam(new BooleanParam("motor", "enableMotor", true));
_editableParams.addParam(new NumericParam("speed", "motorSpeed"));
_editableParams.addParam(new NumericParam("max torque", "maxMotorTorque"));
}
override protected function setupTransformToolPolicy():void{
super.setupTransformToolPolicy();
_transformToolPolicy.setBit("rotate", false);
}
override protected function restore2default():void{
super.restore2default();
_motorSpeed = 0;
_maxMotorTorque = 0;
_buildingParams.motorSpeed = 0;
_buildingParams.maxMotorTorque = 0;
}
override protected function build():void{
var _local2:b2RevoluteJointDef;
var _local3:b2Vec2;
var _local1:Array = _theater.getBodyListAtPoint(_buildingParams.x, _buildingParams.y);
if (_local1.length){
_local2 = new b2RevoluteJointDef();
_local3 = new b2Vec2((_invPhysScale * _buildingParams.x), (_invPhysScale * _buildingParams.y));
if (_local1.length == 1){
_local2.Initialize(_local1[0], _theater.world.GetGroundBody(), _local3);
} else {
if (_local1.length > 1){
_local2.Initialize(_local1[0], _local1[1], _local3);
};
};
_local2.userData = this;
_joint = (_theater.world.CreateJoint(_local2) as b2RevoluteJoint);
};
motorSpeed = _buildingParams.motorSpeed;
maxMotorTorque = _buildingParams.maxMotorTorque;
if (_bitParams.getDefaultValue("fixed")){
onBitParams_Fixed_Change(false, true);
};
if (_bitParams.getDefaultValue("enableMotor")){
onBitParams_EnableMotor_Change(false, true);
};
}
override protected function destroy():void{
if (_joint){
_theater.world.DestroyJoint(_joint);
_joint = null;
};
}
protected function onBitParams_Fixed_Change(_arg1:Boolean, _arg2:Boolean):void{
if (_joint){
_joint.EnableLimit(_arg2);
};
}
protected function onBitParams_EnableMotor_Change(_arg1:Boolean, _arg2:Boolean):void{
if (_joint){
_joint.EnableMotor(_arg2);
};
}
}
}//package gg.engine.theater.actors
Section 213
//Shape (gg.engine.theater.actors.Shape)
package gg.engine.theater.actors {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import gg.engine.theater.edit.params.*;
import gg.engine.utils.*;
import gg.engine.theater.*;
import Box2D.Dynamics.Contacts.*;
public class Shape extends Actor {
protected var _body:b2Body;
protected var _originalWidth:Number;
protected var _originalHeight:Number;
public function get body():b2Body{
return (_body);
}
override public function get code():String{
var _local1:String = ((((((UNumber.round2str(x, 2) + ",") + UNumber.round2str(y, 2)) + ",") + UNumber.round2str(rotation, 2)) + ",") + _bitParams.getValue());
if (((!((scaleX == 1))) || (!((scaleY == 1))))){
_local1 = (_local1 + ((("," + UNumber.round2str(scaleX, 4)) + ",") + UNumber.round2str(scaleY, 4)));
};
return (_local1);
}
public function get physWidth():Number{
return ((scaleX * _originalWidth));
}
public function set physWidth(_arg1:Number):void{
scaleX = (_arg1 / _originalWidth);
if (_coreParams.fixedScale){
scaleY = scaleX;
};
if (inTheater){
_theater.readdActor(this, {code:code});
};
}
public function get physHeight():Number{
return ((scaleY * _originalHeight));
}
public function set physHeight(_arg1:Number):void{
scaleY = (_arg1 / _originalHeight);
if (_coreParams.fixedScale){
scaleX = scaleY;
};
if (inTheater){
_theater.readdActor(this, {code:code});
};
}
override public function decode(_arg1:String):Object{
var _local2:Array = _arg1.split(",");
var _local3:Object = new Object();
_local3.x = Number(_local2[0]);
_local3.y = Number(_local2[1]);
_local3.rotation = Number(_local2[2]);
_local3.bitParams = int(_local2[3]);
if (_local2.length > 4){
_local3.scaleX = Number(_local2[4]);
_local3.scaleY = Number(_local2[5]);
};
return (_local3);
}
override public function step():void{
if (((_body) && (!(_bitParams.getBit("static"))))){
x = (_physScale * _body.GetPosition().x);
y = (_physScale * _body.GetPosition().y);
rotation = (_rad2deg * _body.GetAngle());
};
}
override public function syncPhys():void{
if (syncPhysAllowed){
_body.SetXForm(new b2Vec2((_invPhysScale * x), (_invPhysScale * y)), (_deg2rad * rotation));
};
}
public function inContactWith(_arg1:Class):Boolean{
var _local2:b2ContactEdge = _body.m_contactList;
while (_local2) {
if ((_local2.other.GetUserData() is _arg1)){
return (true);
};
_local2 = _local2.next;
};
return (false);
}
override protected function constructor():void{
super.constructor();
_originalWidth = width;
_originalHeight = height;
}
override protected function setupBitParams():void{
_bitParams.addBit("static", false, onBitParams_Static_Change);
}
override protected function setupEditableParams():void{
_editableParams.addParam(new NumericParam("x", "x", NumericParam.REAL, 0, Settings.WIDTH));
_editableParams.addParam(new NumericParam("y", "y", NumericParam.REAL, 0, Settings.HEIGHT));
_editableParams.addParam(new NumericParam("width", "physWidth", NumericParam.POSITIVE_REAL, 15, Settings.WIDTH));
_editableParams.addParam(new NumericParam("height", "physHeight", NumericParam.POSITIVE_REAL, 15, Settings.HEIGHT));
_editableParams.addParam(new NumericParam("rotation", "rotation"));
_editableParams.addParam(new BooleanParam("static", "static", true));
}
override protected function restore2default():void{
super.restore2default();
_buildingParams.density = Settings.DEFAULT_DENSITY;
_buildingParams.friction = Settings.DEFAULT_FRICTION;
_buildingParams.restitution = Settings.DEFAULT_RESTITUTION;
_buildingParams.applyGravity = true;
_buildingParams.scaleX = 1;
_buildingParams.scaleY = 1;
}
override protected function build():void{
var _local1:b2BodyDef;
var _local2:int;
scaleX = _buildingParams.scaleX;
scaleY = _buildingParams.scaleY;
_local1 = new b2BodyDef();
_local1.position.x = (_invPhysScale * _buildingParams.x);
_local1.position.y = (_invPhysScale * _buildingParams.y);
_local1.angle = (_deg2rad * _buildingParams.rotation);
setupBodyDef(_local1);
_body = _theater.world.CreateBody(_local1);
if (_buildingParams.physModel == "Rectangle"){
_body.CreateShape(createRectangleDef());
} else {
if (_buildingParams.physModel == "Circle"){
_body.CreateShape(createCircleDef());
} else {
if (_buildingParams.physModel == "Convex"){
_body.CreateShape(createPolygonDef(_buildingParams.vertices));
} else {
if (_buildingParams.physModel == "Concave"){
while (_local2 < _buildingParams.polygons.length) {
_body.CreateShape(createPolygonDef(_buildingParams.polygons[_local2]));
_local2++;
};
};
};
};
};
if (!_bitParams.getDefaultValue("static")){
onBitParams_Static_Change(true, false);
};
}
override protected function destroy():void{
var _local2:b2JointEdge;
var _local1:b2JointEdge = _body.GetJointList();
while (_local1) {
_local2 = _local1;
_local1 = _local1.next;
_theater.removeActor(_local2.joint.GetUserData());
};
_theater.world.DestroyBody(_body);
_body = null;
}
override protected function setupShapeDef(_arg1:b2ShapeDef):void{
super.setupShapeDef(_arg1);
_arg1.density = _buildingParams.density;
_arg1.friction = _buildingParams.friction;
_arg1.restitution = _buildingParams.restitution;
}
protected function setupBodyDef(_arg1:b2BodyDef):void{
_arg1.userData = this;
_arg1.applyGravity = _buildingParams.applyGravity;
}
protected function onBitParams_Static_Change(_arg1:Boolean, _arg2:Boolean):void{
if (_body){
if (_arg2){
_body.SetMass(new b2MassData());
} else {
_body.SetMassFromShapes();
};
};
}
}
}//package gg.engine.theater.actors
Section 214
//BooleanParam (gg.engine.theater.edit.params.BooleanParam)
package gg.engine.theater.edit.params {
import gg.engine.theater.*;
public class BooleanParam extends Param {
private var _fromBitParams:Boolean;
public function BooleanParam(_arg1:String, _arg2:String, _arg3:Boolean=false){
super(_arg1, _arg2);
_fromBitParams = _arg3;
}
public function get fromBitParams():Boolean{
return (_fromBitParams);
}
override public function checkAndRepair(_arg1:String):String{
if ((((_arg1 == "false")) && (!((_arg1 == "true"))))){
return ("false");
};
return (_arg1);
}
override public function getFromActor(_arg1:Actor):String{
if (_fromBitParams){
return (String(_arg1.bitParams.getBit(variable)));
};
return (String(_arg1[variable]));
}
override public function setToActor(_arg1:Actor, _arg2:String):void{
if (_fromBitParams){
_arg1.bitParams.setBit(variable, ((_arg2 == "true")) ? true : false);
} else {
_arg1[variable] = ((_arg2 == "true")) ? true : false;
};
}
}
}//package gg.engine.theater.edit.params
Section 215
//NumericParam (gg.engine.theater.edit.params.NumericParam)
package gg.engine.theater.edit.params {
import gg.engine.utils.*;
import gg.engine.theater.*;
public class NumericParam extends Param {
private var _type:int;
private var _minVal:Number;
private var _maxVal:Number;
public static const REAL:int = 0;
public static const POSITIVE_REAL:int = 1;
public static const INTEGER:int = 2;
public static const POSITIVE_INTEGER:int = 3;
public function NumericParam(_arg1:String, _arg2:String, _arg3:int=0, _arg4:Number=-1000000000, _arg5:Number=1000000000){
var _local6:Number;
super(_arg1, _arg2);
_type = _arg3;
_minVal = _arg4;
_maxVal = _arg5;
if ((((_type < REAL)) || ((_type > POSITIVE_INTEGER)))){
_type = REAL;
};
if (_maxVal < _minVal){
_local6 = _minVal;
_minVal = _maxVal;
_maxVal = _local6;
} else {
if (_maxVal == _minVal){
_maxVal++;
};
};
if (integer){
_minVal = Math.floor(_minVal);
_maxVal = Math.ceil(_maxVal);
};
}
public function get type():int{
return (_type);
}
public function get positive():Boolean{
return ((((_type == POSITIVE_REAL)) || ((_type == POSITIVE_INTEGER))));
}
public function get real():Boolean{
return ((((_type == REAL)) || ((_type == POSITIVE_REAL))));
}
public function get integer():Boolean{
return ((((_type == INTEGER)) || ((_type == POSITIVE_INTEGER))));
}
public function get maxVal():Number{
return (_maxVal);
}
public function get minVal():Number{
return (_minVal);
}
override public function checkAndRepair(_arg1:String):String{
var _local2:String;
switch (_type){
case REAL:
_local2 = UString.repairStrWithReal(_arg1);
break;
case POSITIVE_REAL:
_local2 = UString.repairStrWithPositiveReal(_arg1);
break;
case INTEGER:
_local2 = UString.repairStrWithInt(_arg1);
break;
case POSITIVE_INTEGER:
_local2 = UString.repairStrWithPositiveInt(_arg1);
break;
};
if ((((_local2 == "")) || ((_local2 == "-")))){
_local2 = "0";
};
var _local3:Number = Number(_local2);
if (_local3 < _minVal){
_local3 = _minVal;
} else {
if (_local3 > _maxVal){
_local3 = _maxVal;
} else {
if (real){
return (UNumber.round2str(_local3, 2));
};
};
};
return (_local3.toString());
}
override public function getFromActor(_arg1:Actor):String{
var _local2:Number = _arg1[variable];
if (real){
return (UNumber.round2str(_local2, 2));
};
return (_local2.toString());
}
override public function setToActor(_arg1:Actor, _arg2:String):void{
_arg1[variable] = Number(_arg2);
}
}
}//package gg.engine.theater.edit.params
Section 216
//Param (gg.engine.theater.edit.params.Param)
package gg.engine.theater.edit.params {
import gg.engine.theater.*;
public class Param {
private var _name:String;
private var _var:String;
public function Param(_arg1:String, _arg2:String){
_name = _arg1;
_var = _arg2;
}
public function get name():String{
return (_name);
}
public function get variable():String{
return (_var);
}
public function checkAndRepair(_arg1:String):String{
return ("");
}
public function getFromActor(_arg1:Actor):String{
return (String(_arg1[variable]));
}
public function setToActor(_arg1:Actor, _arg2:String):void{
}
}
}//package gg.engine.theater.edit.params
Section 217
//Border (gg.engine.theater.edit.paramsEditorAssets.Border)
package gg.engine.theater.edit.paramsEditorAssets {
import flash.display.*;
public dynamic class Border extends Sprite {
}
}//package gg.engine.theater.edit.paramsEditorAssets
Section 218
//BtnClose (gg.engine.theater.edit.paramsEditorAssets.BtnClose)
package gg.engine.theater.edit.paramsEditorAssets {
import flash.display.*;
public dynamic class BtnClose extends Sprite {
}
}//package gg.engine.theater.edit.paramsEditorAssets
Section 219
//Title (gg.engine.theater.edit.paramsEditorAssets.Title)
package gg.engine.theater.edit.paramsEditorAssets {
import flash.display.*;
public dynamic class Title extends MovieClip {
public function Title(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gg.engine.theater.edit.paramsEditorAssets
Section 220
//BtnCopy (gg.engine.theater.edit.transformToolAssets.BtnCopy)
package gg.engine.theater.edit.transformToolAssets {
import flash.display.*;
public dynamic class BtnCopy extends Sprite {
}
}//package gg.engine.theater.edit.transformToolAssets
Section 221
//BtnDelete (gg.engine.theater.edit.transformToolAssets.BtnDelete)
package gg.engine.theater.edit.transformToolAssets {
import flash.display.*;
public dynamic class BtnDelete extends Sprite {
}
}//package gg.engine.theater.edit.transformToolAssets
Section 222
//BtnProps (gg.engine.theater.edit.transformToolAssets.BtnProps)
package gg.engine.theater.edit.transformToolAssets {
import flash.display.*;
public dynamic class BtnProps extends Sprite {
}
}//package gg.engine.theater.edit.transformToolAssets
Section 223
//Circle (gg.engine.theater.edit.transformToolAssets.Circle)
package gg.engine.theater.edit.transformToolAssets {
import flash.display.*;
public dynamic class Circle extends Sprite {
}
}//package gg.engine.theater.edit.transformToolAssets
Section 224
//Rotator (gg.engine.theater.edit.transformToolAssets.Rotator)
package gg.engine.theater.edit.transformToolAssets {
import flash.display.*;
public dynamic class Rotator extends MovieClip {
public function Rotator(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package gg.engine.theater.edit.transformToolAssets
Section 225
//EditableParams (gg.engine.theater.edit.EditableParams)
package gg.engine.theater.edit {
import gg.engine.theater.edit.params.*;
public class EditableParams {
private var _params:Array;
public function EditableParams(){
_params = new Array();
}
public function get numParams():int{
return (_params.length);
}
public function addParam(_arg1:Param):void{
if (!hasParam(_arg1.name)){
_params.push(_arg1);
};
}
public function removeParamAt(_arg1:int):void{
if ((((_arg1 > -1)) && ((_arg1 < _params.length)))){
_params.splice(_arg1, 1);
};
}
public function removeParam(_arg1:String):void{
var _local2:int = getParamIndexByName(_arg1);
if (_local2 > -1){
_params.splice(_local2, 1);
};
}
public function replaceParam(_arg1, _arg2:Param):void{
var _local3:int = getParamIndexByName(_arg1);
if (_local3 > -1){
_params[_local3] = _arg2;
};
}
public function getParamAt(_arg1:int):Param{
if ((((_arg1 > -1)) && ((_arg1 < _params.length)))){
return (_params[_arg1]);
};
return (null);
}
public function getParam(_arg1:String):Param{
var _local2:int;
while (_local2 < _params.length) {
if (_params[_local2].name == _arg1){
return (_params[_local2]);
};
_local2++;
};
return (null);
}
public function getParamIndexByName(_arg1:String):int{
var _local2:int;
while (_local2 < _params.length) {
if (_params[_local2].name == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
}
public function hasParam(_arg1:String):Boolean{
return ((getParamIndexByName(_arg1) > -1));
}
}
}//package gg.engine.theater.edit
Section 226
//EditableTheater (gg.engine.theater.edit.EditableTheater)
package gg.engine.theater.edit {
import flash.geom.*;
import flash.display.*;
import gg.engine.theater.*;
import flash.events.*;
import flash.filters.*;
public class EditableTheater extends Theater {
var transformTool:TransformTool;
var paramsEditor:ParamsEditor;
protected var _gridHolder:Shape;
protected var _addingActorHolder:Sprite;
protected var _editingActor:Actor;
protected var _addingActor:Actor;
protected var _showParamsEditor:Boolean;
protected var _paramsEditorShown:Boolean;
protected var _gridStep:Number;
public function EditableTheater(){
transformTool = new TransformTool(this);
paramsEditor = new ParamsEditor(this);
_gridHolder = new Shape();
_addingActorHolder = new Sprite();
_gridStep = 0;
_addingActorHolder.mouseChildren = false;
_addingActorHolder.mouseEnabled = false;
_addingActorHolder.alpha = 0.75;
transformTool.visible = false;
paramsEditor.visible = _showParamsEditor;
transformTool.filters = [new GlowFilter(0, 1, 5, 5, 1, 3)];
paramsEditor.filters = [new GlowFilter(0, 1, 5, 5, 1, 3)];
addChildAt(_gridHolder, 0);
addChild(_addingActorHolder);
addChild(transformTool);
addChild(paramsEditor);
_background.addEventListener(MouseEvent.MOUSE_DOWN, onBackground_MouseDown);
_actorsHolder.addEventListener(MouseEvent.MOUSE_DOWN, onActorsHolder_MouseDown);
}
public function get editingActor():Actor{
return (_editingActor);
}
public function setEditingActor(_arg1:Actor, _arg2:Boolean=false):void{
if (_editingActor == _arg1){
return;
};
if (_editingActor){
if (_addingActor){
addListeners2ActorsHolder();
};
transformTool.stopEdit();
paramsEditor.stopEdit();
transformTool.visible = false;
paramsEditor.visible = false;
_editingActor = null;
};
if (_arg1){
if (_addingActor){
removeListenersFromActorsHolder();
};
transformTool.startEdit(_arg1, _arg2);
paramsEditor.startEdit(_arg1);
transformTool.visible = true;
paramsEditor.visible = _showParamsEditor;
_editingActor = _arg1;
};
}
public function get addingActor():Actor{
return (_addingActor);
}
public function setAddingActor(_arg1:String, _arg2:String=null):void{
if (_addingActor){
if (_addingActor.className == _arg1){
if (_arg2){
_addingActor.code = _arg2;
};
setEditingActor(null);
return;
} else {
if (!_editingActor){
removeListenersFromActorsHolder();
};
_addingActorHolder.removeChild(_addingActor);
ActorPool.release(_addingActor);
_addingActor = null;
};
};
if (_arg1){
_addingActor = ActorPool.acquire(_arg1);
_addingActorHolder.addChild(_addingActor);
if (_arg2){
_addingActor.code = _arg2;
};
if (_editingActor){
setEditingActor(null);
} else {
addListeners2ActorsHolder();
};
};
}
public function get showParamsEditor():Boolean{
return (_showParamsEditor);
}
public function set showParamsEditor(_arg1:Boolean):void{
var _local2:Point;
_showParamsEditor = _arg1;
if (((_editingActor) && (((!(_addingActor)) || (((_addingActor) && (!(_addingActorHolder.visible)))))))){
paramsEditor.visible = _showParamsEditor;
if (!_paramsEditorShown){
_local2 = new Point(transformTool.btnProps.x, transformTool.btnProps.y);
_local2 = transformTool.localToGlobal(_local2);
_local2 = globalToLocal(_local2);
paramsEditor.x = _local2.x;
paramsEditor.y = _local2.y;
_paramsEditorShown = true;
};
};
}
public function get gridStep():Number{
return (_gridStep);
}
public function set gridStep(_arg1:Number):void{
var _local2:Number;
_gridStep = _arg1;
_gridHolder.graphics.clear();
if (_gridStep > 0){
_gridHolder.graphics.lineStyle(1);
_local2 = 0;
while (_local2 <= _bounds.width) {
_gridHolder.graphics.moveTo(_local2, 0);
_gridHolder.graphics.lineTo(_local2, _bounds.height);
_local2 = (_local2 + _gridStep);
};
_local2 = 0;
while (_local2 <= _bounds.height) {
_gridHolder.graphics.moveTo(0, _local2);
_gridHolder.graphics.lineTo(_bounds.width, _local2);
_local2 = (_local2 + _gridStep);
};
};
}
override public function removeActor(_arg1:Actor):void{
if (_editingActor == _arg1){
setEditingActor(null);
};
super.removeActor(_arg1);
}
override public function removeAllActors():void{
setEditingActor(null);
super.removeAllActors();
}
private function addListeners2ActorsHolder():void{
_addingActorHolder.visible = true;
startDragActor(_addingActor, true);
_actorsHolder.getLayer(_addingActor.layer).addEventListener(MouseEvent.MOUSE_OVER, onActorsHolder_Layer_MouseOver);
_actorsHolder.getLayer(_addingActor.layer).addEventListener(MouseEvent.MOUSE_OUT, onActorsHolder_Layer_MouseOut);
}
private function removeListenersFromActorsHolder():void{
_addingActorHolder.visible = false;
stopDragActor(_addingActor);
_actorsHolder.getLayer(_addingActor.layer).removeEventListener(MouseEvent.MOUSE_OVER, onActorsHolder_Layer_MouseOver);
_actorsHolder.getLayer(_addingActor.layer).removeEventListener(MouseEvent.MOUSE_OUT, onActorsHolder_Layer_MouseOut);
}
protected function onBackground_MouseDown(_arg1:MouseEvent):void{
if (_addingActor){
if (!_addingActorHolder.visible){
if (_editingActor){
if (_addingActor.className == _editingActor.className){
_addingActor.code = _editingActor.code;
};
setEditingActor(null);
};
} else {
setEditingActor(addActor(_addingActor.className, {code:_addingActor.code}), true);
};
} else {
setEditingActor(null);
};
}
protected function onActorsHolder_MouseDown(_arg1:MouseEvent):void{
var _local2:Actor = (_arg1.target as Actor);
if (((_addingActor) && (_local2))){
if (_addingActor.layer != _local2.layer){
onBackground_MouseDown(new MouseEvent(MouseEvent.MOUSE_DOWN, _arg1.bubbles, _arg1.cancelable, _arg1.localX, _arg1.localY));
return;
};
};
if (_editingActor != _local2){
setEditingActor(_local2, true);
};
}
private function onActorsHolder_Layer_MouseOver(_arg1:MouseEvent):void{
stopDragActor(_addingActor);
_addingActorHolder.visible = false;
}
private function onActorsHolder_Layer_MouseOut(_arg1:MouseEvent):void{
_addingActorHolder.visible = true;
startDragActor(_addingActor, true);
}
}
}//package gg.engine.theater.edit
Section 227
//ParamsEditor (gg.engine.theater.edit.ParamsEditor)
package gg.engine.theater.edit {
import flash.display.*;
import fl.controls.*;
import gg.engine.theater.edit.params.*;
import gg.engine.theater.*;
import flash.events.*;
import fl.data.*;
import fl.events.*;
import gg.engine.theater.edit.paramsEditorAssets.*;
public class ParamsEditor extends Sprite {
public var btnClose:BtnClose;
public var border:Border;
public var title:Title;
public var grid:DataGrid;
private var _theater:EditableTheater;
private var _actor:Actor;
private var _dragging:Boolean;
public function ParamsEditor(_arg1:EditableTheater){
_theater = _arg1;
btnClose.buttonMode = true;
title.buttonMode = true;
btnClose.tabEnabled = false;
title.tabEnabled = false;
grid.columns = ["param", "value"];
grid.getColumnAt(0).editable = false;
__setProp_grid_ParamsEditor_Layer2_0();
__setTab_grid_ParamsEditor_Layer2_0();
}
public function get theater():EditableTheater{
return (_theater);
}
public function startEdit(_arg1:Actor):void{
var _local3:int;
var _local5:Object;
_actor = _arg1;
btnClose.addEventListener(MouseEvent.CLICK, onClose_Click);
title.addEventListener(MouseEvent.MOUSE_DOWN, onTitle_MouseDown);
stage.addEventListener(MouseEvent.MOUSE_UP, onStage_MouseUp);
grid.addEventListener(DataGridEvent.ITEM_EDIT_END, onGrid_ItemEditEnd);
var _local2:DataProvider = new DataProvider();
while (_local3 < _actor.editableParams.numParams) {
_local5 = new Object();
_local5.description = _actor.editableParams.getParamAt(_local3);
_local5.param = _local5.description.name;
_local5.value = _local5.description.getFromActor(_actor);
_local2.addItem(_local5);
_local3++;
};
grid.dataProvider = _local2;
var _local4:Number = (((_actor.editableParams.numParams * grid.rowHeight) + grid.headerHeight) + title.height);
border.height = _local4;
grid.height = (_local4 - title.height);
}
public function stopEdit():void{
btnClose.removeEventListener(MouseEvent.CLICK, onClose_Click);
title.removeEventListener(MouseEvent.MOUSE_DOWN, onTitle_MouseDown);
stage.removeEventListener(MouseEvent.MOUSE_UP, onStage_MouseUp);
grid.removeEventListener(DataGridEvent.ITEM_EDIT_END, onGrid_ItemEditEnd);
_actor = null;
grid.removeAll();
}
function update():void{
var _local1:int;
var _local2:Object;
if (!visible){
return;
};
while (_local1 < grid.dataProvider.length) {
_local2 = grid.dataProvider.getItemAt(_local1);
_local2.value = _local2.description.getFromActor(_actor);
_local1++;
};
grid.validateNow();
}
private function onClose_Click(_arg1:MouseEvent):void{
_theater.showParamsEditor = false;
}
private function onTitle_MouseDown(_arg1:MouseEvent):void{
if (!_dragging){
_dragging = true;
startDrag(false, _theater.dragBounds);
title.gotoAndStop(2);
};
}
private function onStage_MouseUp(_arg1:MouseEvent):void{
if (_dragging){
_dragging = false;
stopDrag();
title.gotoAndStop(1);
};
}
private function onGrid_ItemEditEnd(_arg1:DataGridEvent):void{
var _local2:Object = grid.getItemAt(int(_arg1.rowIndex));
var _local3:Param = _local2.description;
var _local4:String = grid.itemEditorInstance.text;
if (_local2.value == _local4){
return;
};
_local4 = _local3.checkAndRepair(_local4);
_local2.value = _local4;
grid.itemEditorInstance.text = _local4;
grid.validateNow();
_local3.setToActor(_actor, _local4);
_theater.transformTool.updatePosition();
_theater.transformTool.updateRotation();
}
function __setProp_grid_ParamsEditor_Layer2_0(){
try {
grid["componentInspectorSetting"] = true;
} catch(e:Error) {
};
grid.allowMultipleSelection = false;
grid.editable = true;
grid.headerHeight = 20;
grid.horizontalLineScrollSize = 4;
grid.horizontalPageScrollSize = 0;
grid.horizontalScrollPolicy = "off";
grid.resizableColumns = true;
grid.rowHeight = 20;
grid.showHeaders = true;
grid.sortableColumns = false;
grid.verticalLineScrollSize = 4;
grid.verticalPageScrollSize = 0;
grid.verticalScrollPolicy = "auto";
try {
grid["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setTab_grid_ParamsEditor_Layer2_0(){
grid.tabIndex = 0;
}
}
}//package gg.engine.theater.edit
Section 228
//TransformTool (gg.engine.theater.edit.TransformTool)
package gg.engine.theater.edit {
import flash.display.*;
import gg.engine.utils.*;
import gg.engine.theater.*;
import flash.events.*;
import gg.engine.theater.edit.transformToolAssets.*;
public class TransformTool extends Sprite {
public var circle:Circle;
public var btnProps:BtnProps;
public var btnCopy:BtnCopy;
public var btnDelete:BtnDelete;
public var rotator:Rotator;
private var _theater:EditableTheater;
private var _actor:Actor;
private var _dragging:Boolean;
private var _rotating:Boolean;
public function TransformTool(_arg1:EditableTheater){
_theater = _arg1;
rotator.buttonMode = true;
btnDelete.buttonMode = true;
btnCopy.buttonMode = true;
btnProps.buttonMode = true;
rotator.tabEnabled = false;
btnDelete.tabEnabled = false;
btnCopy.tabEnabled = false;
btnProps.tabEnabled = false;
}
public function startEdit(_arg1:Actor, _arg2:Boolean=false):void{
_actor = _arg1;
btnCopy.visible = _actor.transformToolPolicy.getBit("copy");
btnDelete.visible = _actor.transformToolPolicy.getBit("delete");
btnProps.visible = _actor.transformToolPolicy.getBit("params");
rotator.visible = _actor.transformToolPolicy.getBit("rotate");
if (_actor.transformToolPolicy.getBit("drag")){
_actor.addEventListener(MouseEvent.MOUSE_DOWN, onActor_MouseDown);
};
addEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.addEventListener(MouseEvent.MOUSE_UP, onStage_MouseUp);
rotator.addEventListener(MouseEvent.MOUSE_DOWN, onRotator_MouseDown);
btnDelete.addEventListener(MouseEvent.MOUSE_DOWN, onDelete_MouseDown);
btnCopy.addEventListener(MouseEvent.MOUSE_DOWN, onCopy_MouseDown);
btnProps.addEventListener(MouseEvent.MOUSE_DOWN, onProps_MouseDown);
_actor.parent.setChildIndex(_actor, (_actor.parent.numChildren - 1));
updatePosition();
updateRotation();
if (_arg2){
onActor_MouseDown(new MouseEvent(MouseEvent.MOUSE_DOWN));
};
}
public function stopEdit():void{
if (_actor.transformToolPolicy.getBit("drag")){
_actor.removeEventListener(MouseEvent.MOUSE_DOWN, onActor_MouseDown);
};
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
stage.removeEventListener(MouseEvent.MOUSE_UP, onStage_MouseUp);
rotator.removeEventListener(MouseEvent.MOUSE_DOWN, onRotator_MouseDown);
btnDelete.removeEventListener(MouseEvent.MOUSE_DOWN, onDelete_MouseDown);
btnCopy.removeEventListener(MouseEvent.MOUSE_DOWN, onCopy_MouseDown);
btnProps.removeEventListener(MouseEvent.MOUSE_DOWN, onProps_MouseDown);
_actor = null;
}
function updateRotation():void{
rotation = _actor.rotation;
btnDelete.rotation = -(_actor.rotation);
btnCopy.rotation = -(_actor.rotation);
btnProps.rotation = -(_actor.rotation);
_theater.paramsEditor.update();
}
function updatePosition():void{
x = _actor.x;
y = _actor.y;
_theater.paramsEditor.update();
}
private function onEnterFrame(_arg1:Event):void{
var _local2:Number;
if (_dragging){
updatePosition();
};
if (_rotating){
_local2 = Math.round(UMath.rad2Deg(Math.asin((((rotator.x * mouseY) - (rotator.y * mouseX)) / Math.sqrt((((rotator.x * rotator.x) + (rotator.y * rotator.y)) * ((mouseX * mouseX) + (mouseY * mouseY))))))));
if (!isNaN(_local2)){
_actor.rotation = (_actor.rotation + _local2);
};
updateRotation();
};
}
private function onActor_MouseDown(_arg1:MouseEvent):void{
if (!_dragging){
_dragging = true;
_theater.startDragActor(_actor);
};
}
private function onStage_MouseUp(_arg1:MouseEvent):void{
if (_dragging){
_dragging = false;
_theater.stopDragActor(_actor);
updatePosition();
};
if (_rotating){
_rotating = false;
rotator.gotoAndStop("off");
};
}
private function onRotator_MouseDown(_arg1:MouseEvent):void{
_rotating = true;
rotator.gotoAndStop("on");
}
private function onDelete_MouseDown(_arg1:MouseEvent):void{
_theater.removeActor(_actor);
}
private function onCopy_MouseDown(_arg1:MouseEvent):void{
_theater.setAddingActor(_actor.className, _actor.code);
}
private function onProps_MouseDown(_arg1:MouseEvent):void{
_theater.showParamsEditor = !(_theater.showParamsEditor);
}
}
}//package gg.engine.theater.edit
Section 229
//Actor (gg.engine.theater.Actor)
package gg.engine.theater {
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import gg.engine.utils.*;
import gg.engine.theater.edit.*;
import flash.utils.*;
public class Actor extends MovieClip {
protected const _physScale:Number = 30;
protected const _invPhysScale:Number = 0.0333333333333333;
protected const _halfInvPhysScale:Number = 0.0166666666666667;
protected const _deg2rad:Number = 0.0174532925199433;
protected const _rad2deg:Number = 57.2957795130823;
var dragging:Boolean;
var dragOffsetX:Number;
var dragOffsetY:Number;
var _className:String;
protected var _coreParams:Object;
protected var _buildingParams:Object;
protected var _bitParams:BitField;
protected var _editableParams:EditableParams;
protected var _transformToolPolicy:BitField;
protected var _layer:int;
protected var _theater:Theater;
public function Actor(){
constructor();
restore2default();
}
public function get className():String{
if (!_className){
_className = getQualifiedClassName(this);
};
return (_className);
}
public function get bitParams():BitField{
return (_bitParams);
}
public function get editableParams():EditableParams{
return (_editableParams);
}
public function get transformToolPolicy():BitField{
return (_transformToolPolicy);
}
public function get layer():int{
return (_layer);
}
public function get theater():Theater{
return (_theater);
}
public function get inTheater():Boolean{
return (Boolean(_theater));
}
public function get code():String{
return ("");
}
public function set code(_arg1:String):void{
var _local3:String;
var _local2:Object = decode(_arg1);
for (_local3 in _local2) {
if (_local3 == "bitParams"){
_bitParams.setValue(_local2[_local3]);
} else {
if (this.hasOwnProperty(_local3)){
this[_local3] = _local2[_local3];
};
};
};
}
public function get syncPhysAllowed():Boolean{
return (((inTheater) && (!(dragging))));
}
public function decode(_arg1:String):Object{
return (new Object());
}
public function step():void{
}
public function syncPhys():void{
}
public function onAddingToTheater(_arg1:Theater, _arg2:Object):void{
var _local3:String;
var _local4:Object;
if (inTheater){
throw (new Error("already added to theater"));
};
_theater = _arg1;
UObject.copyParams(_coreParams, _buildingParams);
if (_arg2.hasOwnProperty("code")){
_local4 = decode(_arg2.code);
if (_local4.hasOwnProperty("bitParams")){
UObject.copyParams(_bitParams.decode(_local4.bitParams), _buildingParams);
delete _local4.bitParams;
};
UObject.copyParams(_local4, _buildingParams);
delete _arg2.code;
};
if (_arg2.hasOwnProperty("bitParams")){
UObject.copyParams(_bitParams.decode(_arg2.bitParams), _buildingParams);
delete _arg2.bitParams;
};
UObject.copyParams(_arg2, _buildingParams);
build();
x = _buildingParams.x;
y = _buildingParams.y;
rotation = _buildingParams.rotation;
for (_local3 in _buildingParams) {
if (_bitParams.hasBit(_local3)){
bitParams.setBit(_local3, _buildingParams[_local3]);
};
};
}
public function onRemovingFromTheater():void{
if (!inTheater){
throw (new Error("already removed from theater"));
};
destroy();
_theater = null;
}
function setupCoreParams():void{
_coreParams = actorCoreParams(_className);
}
function onRelease():void{
restore2default();
}
protected function constructor():void{
mouseChildren = false;
_buildingParams = new Object();
_bitParams = new BitField();
_editableParams = new EditableParams();
_transformToolPolicy = new BitField();
setupBitParams();
setupEditableParams();
setupTransformToolPolicy();
}
protected function setupBitParams():void{
}
protected function setupEditableParams():void{
}
protected function setupTransformToolPolicy():void{
_transformToolPolicy.addBit("copy", true);
_transformToolPolicy.addBit("delete", true);
_transformToolPolicy.addBit("drag", true);
_transformToolPolicy.addBit("params", true);
_transformToolPolicy.addBit("rotate", true);
}
protected function restore2default():void{
gotoAndStop(1);
visible = true;
alpha = 1;
rotation = 0;
scaleX = 1;
scaleY = 1;
x = 0;
y = 0;
filters = [];
_bitParams.restore2default();
UObject.clear(_buildingParams);
_buildingParams.x = 0;
_buildingParams.y = 0;
_buildingParams.rotation = 0;
_buildingParams.bitParams = _bitParams.getValue();
}
protected function build():void{
}
protected function destroy():void{
}
protected function setupShapeDef(_arg1:b2ShapeDef):void{
_arg1.userData = this;
}
protected function createRectangleDef(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0):b2PolygonDef{
if (!_arg1){
_arg1 = this.width;
};
if (!_arg2){
_arg2 = this.height;
};
var _local6:b2PolygonDef = new b2PolygonDef();
setupShapeDef(_local6);
if (((((_arg3) || (_arg4))) || (_arg5))){
_local6.SetAsOrientedBox((_halfInvPhysScale * _arg1), (_halfInvPhysScale * _arg2), new b2Vec2((_invPhysScale * _arg3), (_invPhysScale * _arg4)), (_deg2rad * _arg5));
} else {
_local6.SetAsBox((_halfInvPhysScale * _arg1), (_halfInvPhysScale * _arg2));
};
return (_local6);
}
protected function createCircleDef(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0):b2CircleDef{
if (!_arg1){
_arg1 = (0.25 * (width + height));
};
var _local4:b2CircleDef = new b2CircleDef();
setupShapeDef(_local4);
_local4.radius = (_invPhysScale * _arg1);
if (((_arg2) || (_arg3))){
_local4.localPosition.Set((_invPhysScale * _arg2), (_invPhysScale * _arg3));
};
return (_local4);
}
protected function createPolygonDef(_arg1:Array):b2PolygonDef{
var _local3:int;
var _local2:b2PolygonDef = new b2PolygonDef();
setupShapeDef(_local2);
while (_local3 < _arg1.length) {
_local2.vertices[_local3].Set(((scaleX * _invPhysScale) * _arg1[_local3][0]), ((scaleY * _invPhysScale) * _arg1[_local3][1]));
_local3++;
};
_local2.vertexCount = _arg1.length;
return (_local2);
}
}
}//package gg.engine.theater
Section 230
//ActorPool (gg.engine.theater.ActorPool)
package gg.engine.theater {
import gg.engine.utils.*;
import flash.utils.*;
public class ActorPool {
private static var _actors:Array = new Array();
public static function acquire(_arg1:String):Actor{
var _local4:int;
var _local2:Actor;
var _local3:int = _actors.length;
while (_local4 < _local3) {
if (_actors[_local4].className == _arg1){
_local2 = _actors[_local4];
_actors.splice(_local4, 1);
break;
};
_local4++;
};
if (!_local2){
_local2 = new ((getDefinitionByName(_arg1) as Class));
_local2._className = _arg1;
_local2.setupCoreParams();
};
return (_local2);
}
public static function release(_arg1:Actor):void{
_arg1.onRelease();
UArray.pushUnique(_actors, _arg1);
}
}
}//package gg.engine.theater
Section 231
//ActorsHolder (gg.engine.theater.ActorsHolder)
package gg.engine.theater {
import flash.display.*;
public class ActorsHolder extends Sprite {
private var _layers:Array;
private static const _DEFAULT_NUM_LAYERS:int = 3;
public function ActorsHolder(){
var _local1:int;
var _local2:Sprite;
super();
_layers = new Array();
while (_local1 < _DEFAULT_NUM_LAYERS) {
_local2 = new Sprite();
_layers.push(_local2);
addChild(_local2);
_local1++;
};
}
public function get numLayers():int{
return (_layers.length);
}
public function addActor(_arg1:Actor):void{
_layers[_arg1.layer].addChild(_arg1);
}
public function removeActor(_arg1:Actor):void{
_layers[_arg1.layer].removeChild(_arg1);
}
public function getLayer(_arg1:int):Sprite{
if ((((_arg1 < 0)) || ((_arg1 >= _layers.length)))){
return (null);
};
return (_layers[_arg1]);
}
}
}//package gg.engine.theater
Section 232
//Theater (gg.engine.theater.Theater)
package gg.engine.theater {
import flash.geom.*;
import flash.display.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import gg.engine.utils.*;
import flash.events.*;
import gg.engine.display.*;
import gg.engine.theater.actors.*;
public class Theater extends Sprite {
protected const _invPhysScale:Number = 0.0333333333333333;
protected const _physIterations:int = 10;
public var dragBounds:Rectangle;
protected var _actors:Array;
protected var _world:b2World;
protected var _bounds:Rectangle;
protected var _background:Sprite;
protected var _actorsHolder:ActorsHolder;
protected var _draggingActors:Array;
protected var _dragStep:Number;
protected static var _someVec2:b2Vec2 = new b2Vec2();
protected static var _someAABB:b2AABB = new b2AABB();
public function Theater(){
var _local3:Dummy;
super();
_actors = new Array();
_background = new Sprite();
_actorsHolder = new ActorsHolder();
_draggingActors = new Array();
_dragStep = 0;
while (numChildren) {
_background.addChild(removeChildAt(0));
};
addChild(_background);
addChild(_actorsHolder);
if (!((width) && (height))){
_local3 = new Dummy(Settings.THEATER_WIDTH, Settings.THEATER_HEIGHT);
_local3.x = (-0.5 * _local3.width);
_local3.y = (-0.5 * _local3.height);
_background.addChild(_local3);
};
_bounds = _background.getBounds(this);
dragBounds = _bounds.clone();
var _local1:Number = 0x0200;
var _local2:b2AABB = new b2AABB();
_local2.lowerBound.Set((_invPhysScale * (_bounds.x - _local1)), (_invPhysScale * (_bounds.y - _local1)));
_local2.upperBound.Set((_invPhysScale * (_bounds.right + _local1)), (_invPhysScale * (_bounds.bottom + _local1)));
_world = new b2World(_local2, new b2Vec2(Settings.DEFAULT_GRAVITY_X, Settings.DEFAULT_GRAVITY_Y), true);
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
public function get actors():Array{
return (_actors);
}
public function get world():b2World{
return (_world);
}
public function get bounds():Rectangle{
return (_bounds);
}
public function get background():Sprite{
return (_background);
}
public function get actorsHolder():ActorsHolder{
return (_actorsHolder);
}
public function get dragStep():Number{
return (_dragStep);
}
public function set dragStep(_arg1:Number):void{
if (_arg1 < 0){
_arg1 = 0;
};
_dragStep = _arg1;
}
public function get code():String{
var _local2:int;
sortActors();
var _local1 = "";
while (_local2 < _actors.length) {
_local1 = (_local1 + ((_actors[_local2].className + ":") + _actors[_local2].code));
if (_local2 < (_actors.length - 1)){
_local1 = (_local1 + "|");
};
_local2++;
};
return (_local1);
}
public function set code(_arg1:String):void{
var _local2:Array;
var _local3:int;
var _local4:Array;
if (((_arg1) && (!((_arg1 == code))))){
removeAllActors();
_local2 = _arg1.split("|");
while (_local3 < _local2.length) {
_local4 = _local2[_local3].split(":", 2);
addActor(_local4[0], {code:_local4[1]});
_local3++;
};
};
}
public function addActor(_arg1:String, _arg2:Object):Actor{
var _local3:Actor = ActorPool.acquire(_arg1);
_local3.onAddingToTheater(this, _arg2);
_actorsHolder.addActor(_local3);
_actors.push(_local3);
sortActors();
return (_local3);
}
public function removeActor(_arg1:Actor):void{
var _local2:int;
while (_local2 < _actors.length) {
if (_actors[_local2] == _arg1){
if (_arg1.dragging){
stopDragActor(_arg1);
};
_arg1.onRemovingFromTheater();
_actorsHolder.removeActor(_arg1);
ActorPool.release(_arg1);
_actors.splice(_local2, 1);
return;
};
_local2++;
};
}
public function removeActors(_arg1:Array):void{
var _local2:Actor;
for each (_local2 in _arg1) {
removeActor(_local2);
};
}
public function removeAllActors():void{
var _local1:Actor;
while (_actors.length) {
_local1 = _actors[(_actors.length - 1)];
if (_local1.dragging){
stopDragActor(_local1);
};
_local1.onRemovingFromTheater();
_actorsHolder.removeActor(_local1);
ActorPool.release(_local1);
_actors.pop();
};
}
public function readdActor(_arg1:Actor, _arg2:Object):void{
_arg1.onRemovingFromTheater();
_arg1.onRelease();
_arg1.onAddingToTheater(this, _arg2);
}
public function hasActor(_arg1:Actor):Boolean{
var _local2:int;
while (_local2 < _actors.length) {
if (_actors[_local2] == _arg1){
return (true);
};
_local2++;
};
return (false);
}
public function hasActorOf(_arg1:Class):Boolean{
var _local2:int;
while (_local2 < _actors.length) {
if ((_actors[_local2] is _arg1)){
return (true);
};
_local2++;
};
return (false);
}
public function getActorsOf(_arg1:Class, _arg2:int=2147483647):Array{
var _local4:int;
var _local3:Array = new Array();
if (_arg2 <= 0){
return (_local3);
};
while (_local4 < _actors.length) {
if ((_actors[_local4] is _arg1)){
_local3.push(_actors[_local4]);
if (_local3.length == _arg2){
break;
};
};
_local4++;
};
return (_local3);
}
public function numActorsOf(_arg1:Class):uint{
return (getActorsOf(_arg1).length);
}
public function sortActors():void{
var compareFunction:Function;
compareFunction = function (_arg1:Actor, _arg2:Actor):int{
if (_arg1.layer < _arg2.layer){
return (-1);
};
if (_arg1.layer > _arg2.layer){
return (1);
};
return (((_arg1.parent.getChildIndex(_arg1) < _arg2.parent.getChildIndex(_arg2))) ? -1 : 1);
};
_actors.sort(compareFunction);
}
public function step(_arg1:Number=0.0333333333333333):void{
var _local3:int;
world.Step(_arg1, _physIterations);
var _local2:int = _actors.length;
while (_local3 < _local2) {
_actors[_local3].step();
_local3++;
};
}
public function syncPhys():void{
var _local1:int;
while (_local1 < _actors.length) {
_actors[_local1].syncPhys();
_local1++;
};
}
public function stopAllActors():void{
var _local1:b2Body = world.GetBodyList();
while (_local1) {
if (!(_local1.GetUserData() as MovingPlatform)){
_local1.SetLinearVelocity(b2Math.b2Vec2_zero);
_local1.SetAngularVelocity(0);
};
_local1 = _local1.GetNext();
};
}
public function translateActors(_arg1:Number, _arg2:Number):void{
var _local4:uint;
var _local3:uint = _actors.length;
while (_local4 < _local3) {
_actors[_local4].x = (_actors[_local4].x + _arg1);
_actors[_local4].y = (_actors[_local4].y + _arg2);
_local4++;
};
syncPhys();
}
public function put2sleep():void{
var _local1:b2Body = world.GetBodyList();
while (_local1) {
_local1.PutToSleep();
_local1 = _local1.GetNext();
};
}
public function wakeUp():void{
var _local1:b2Body = world.GetBodyList();
while (_local1) {
_local1.WakeUp();
_local1 = _local1.GetNext();
};
}
public function getBodyAtPoint(_arg1:Number, _arg2:Number):b2Body{
var _local3:b2Body;
_someVec2.Set((_invPhysScale * _arg1), (_invPhysScale * _arg2));
_someAABB.lowerBound.Set((_someVec2.x - 0.001), (_someVec2.y - 0.001));
_someAABB.upperBound.Set((_someVec2.x + 0.001), (_someVec2.y + 0.001));
var _local4:Array = new Array();
world.Query(_someAABB, _local4, int.MAX_VALUE);
var _local5:int = (_local4.length - 1);
while (_local5 > -1) {
if (_local4[_local5].TestPoint(_local4[_local5].GetBody().GetXForm(), _someVec2)){
_local3 = _local4[_local5].GetBody();
break;
};
_local5--;
};
return (_local3);
}
public function getBodyAtMouse():b2Body{
return (getBodyAtPoint(mouseX, mouseY));
}
public function getBodyListAtPoint(_arg1:Number, _arg2:Number):Array{
var _local3:Array = new Array();
_someVec2.Set((_invPhysScale * _arg1), (_invPhysScale * _arg2));
_someAABB.lowerBound.Set((_someVec2.x - 0.001), (_someVec2.y - 0.001));
_someAABB.upperBound.Set((_someVec2.x + 0.001), (_someVec2.y + 0.001));
var _local4:Array = new Array();
world.Query(_someAABB, _local4, int.MAX_VALUE);
var _local5:int = (_local4.length - 1);
while (_local5 > -1) {
if (_local4[_local5].TestPoint(_local4[_local5].GetBody().GetXForm(), _someVec2)){
_local3.push(_local4[_local5].GetBody());
};
_local5--;
};
return (_local3);
}
public function getBodyListAtMouse():Array{
return (getBodyListAtPoint(mouseX, mouseY));
}
public function getActorAtPoint(_arg1:Number, _arg2:Number):Actor{
var _local3:b2Body = getBodyAtPoint(_arg1, _arg2);
if (_local3){
return ((_local3.GetUserData() as Actor));
};
return (null);
}
public function getActorAtMouse():Actor{
return (getActorAtPoint(mouseX, mouseY));
}
public function startDragActor(_arg1:Actor, _arg2:Boolean=false):void{
if (_arg1.dragging){
return;
};
_arg1.dragging = true;
if (_arg2){
_arg1.dragOffsetX = 0;
_arg1.dragOffsetY = 0;
} else {
_arg1.dragOffsetX = (_arg1.x - mouseX);
_arg1.dragOffsetY = (_arg1.y - mouseY);
};
_draggingActors.push(_arg1);
}
public function stopDragActor(_arg1:Actor):void{
var _local2:int;
if (!_arg1.dragging){
return;
};
while (_local2 < _draggingActors.length) {
if (_draggingActors[_local2] == _arg1){
_arg1.dragging = false;
_draggingActors.splice(_local2, 1);
return;
};
_local2++;
};
}
protected function onAddedToStage(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
protected function onRemovedFromStage(_arg1:Event):void{
removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
protected function onEnterFrame(_arg1:Event):void{
var _local2:int;
var _local3:Actor;
var _local4:Number;
var _local5:Number;
while (_local2 < _draggingActors.length) {
_local3 = _draggingActors[_local2];
_local4 = (mouseX + _local3.dragOffsetX);
_local5 = (mouseY + _local3.dragOffsetY);
if ((((_local3.x == _local4)) && ((_local3.y == _local5)))){
return;
};
if (_dragStep){
_local4 = (_dragStep * Math.round((_local4 / _dragStep)));
_local5 = (_dragStep * Math.round((_local5 / _dragStep)));
};
_local3.x = _local4;
_local3.y = _local5;
URectangle.syncObjPos(_local3, dragBounds);
_local2++;
};
}
}
}//package gg.engine.theater
Section 233
//KeyboardManager (gg.engine.ui.KeyboardManager)
package gg.engine.ui {
import flash.display.*;
import gg.engine.utils.*;
import flash.events.*;
public class KeyboardManager {
private var _isKeyDown:Array;
private var _onKeyDown:GGEvent;
private var _onKeyUp:GGEvent;
public static const A:int = 65;
public static const B:int = 66;
public static const C:int = 67;
public static const D:int = 68;
public static const E:int = 69;
public static const F:int = 70;
public static const G:int = 71;
public static const H:int = 72;
public static const I:int = 73;
public static const J:int = 74;
public static const K:int = 75;
public static const L:int = 76;
public static const M:int = 77;
public static const N:int = 78;
public static const O:int = 79;
public static const P:int = 80;
public static const Q:int = 81;
public static const R:int = 82;
public static const S:int = 83;
public static const T:int = 84;
public static const U:int = 85;
public static const V:int = 86;
public static const W:int = 87;
public static const X:int = 88;
public static const Y:int = 89;
public static const Z:int = 90;
public static const KEYB0:int = 48;
public static const KEYB1:int = 49;
public static const KEYB2:int = 50;
public static const KEYB3:int = 51;
public static const KEYB4:int = 52;
public static const KEYB5:int = 53;
public static const KEYB6:int = 54;
public static const KEYB7:int = 55;
public static const KEYB8:int = 56;
public static const KEYB9:int = 57;
public static const NUMPAD0:int = 96;
public static const NUMPAD1:int = 97;
public static const NUMPAD2:int = 98;
public static const NUMPAD3:int = 99;
public static const NUMPAD4:int = 100;
public static const NUMPAD5:int = 101;
public static const NUMPAD6:int = 102;
public static const NUMPAD7:int = 103;
public static const NUMPAD8:int = 104;
public static const NUMPAD9:int = 105;
public static const NUMPAD_STAR:int = 106;
public static const NUMPAD_PLUS:int = 107;
public static const NUMPAD_MINUS:int = 109;
public static const NUMPAD_PERIOD:int = 110;
public static const NUMPAD_SLASH:int = 111;
public static const F1:int = 112;
public static const F2:int = 113;
public static const F3:int = 114;
public static const F4:int = 115;
public static const F5:int = 116;
public static const F6:int = 117;
public static const F7:int = 118;
public static const F8:int = 119;
public static const F9:int = 120;
public static const F11:int = 122;
public static const F12:int = 123;
public static const F13:int = 124;
public static const F14:int = 125;
public static const F15:int = 126;
public static const BACKSPACE:int = 8;
public static const TAB:int = 9;
public static const ENTER:int = 13;
public static const SHIFT:int = 16;
public static const CONTROL:int = 17;
public static const PAUSE_BREAK:int = 19;
public static const CAPS_LOCK:int = 20;
public static const ESC:int = 27;
public static const SPACEBAR:int = 32;
public static const PAGE_UP:int = 33;
public static const PAGE_DOWN:int = 34;
public static const END:int = 35;
public static const HOME:int = 36;
public static const LEFT:int = 37;
public static const UP:int = 38;
public static const RIGHT = 39;
public static const DOWN:int = 40;
public static const INSERT:int = 45;
public static const DELETE:int = 46;
public static const NUM_LCK:int = 144;
public static const SCR_LCK:int = 145;
public static const SEMI_COLON:int = 186;
public static const EQUAL:int = 187;
public static const COMMA:int = 188;
public static const MINUS:int = 189;
public static const PERIOD:int = 190;
public static const QUESTION:int = 191;
public static const BACK_QUOTE:int = 192;
public static const LEFT_BRACE:int = 219;
public static const PIPE:int = 220;
public static const RIGHT_BRACE:int = 221;
public static const SINGLE_QUOTE:int = 222;
private static const _KEYS_NUM:int = 0x0100;
public function KeyboardManager(_arg1:Stage){
var _local2:int;
super();
_isKeyDown = new Array(_KEYS_NUM);
_onKeyDown = new GGEvent();
_onKeyUp = new GGEvent();
while (_local2 < _KEYS_NUM) {
_isKeyDown[_local2] = false;
_local2++;
};
_arg1.addEventListener(KeyboardEvent.KEY_DOWN, onStage_KeyDown);
_arg1.addEventListener(KeyboardEvent.KEY_UP, onStage_KeyUp);
}
public function get onKeyDown():GGEvent{
return (_onKeyDown);
}
public function get onKeyUp():GGEvent{
return (_onKeyUp);
}
public function isKeyDown(_arg1:int):Boolean{
if (_arg1 < _isKeyDown.length){
return (_isKeyDown[_arg1]);
};
return (false);
}
private function onStage_KeyDown(_arg1:KeyboardEvent):void{
_isKeyDown[_arg1.keyCode] = true;
onKeyDown.dispatch(_arg1.keyCode);
}
private function onStage_KeyUp(_arg1:KeyboardEvent):void{
_isKeyDown[_arg1.keyCode] = false;
onKeyUp.dispatch(_arg1.keyCode);
}
}
}//package gg.engine.ui
Section 234
//BasicFiller (gg.engine.utils.graphicsFill.BasicFiller)
package gg.engine.utils.graphicsFill {
import flash.display.*;
import flash.geom.*;
import gg.engine.utils.*;
public class BasicFiller implements IClearable {
protected var _inited:Boolean;
protected var _level:Number;
protected var _graphics:Graphics;
protected var _bound:Rectangle;
protected var _boundCenterX:Number;
protected var _boundCenterY:Number;
protected var _color:uint;
public static const MIN_LEVEL:Number = 0;
public static const MAX_LEVEL:Number = 1;
public function BasicFiller(){
_level = MIN_LEVEL;
}
public function get inited():Boolean{
return (_inited);
}
public function get level():Number{
return (_level);
}
public function set level(_arg1:Number):void{
if (_arg1 < MIN_LEVEL){
_arg1 = MIN_LEVEL;
} else {
if (_arg1 > MAX_LEVEL){
_arg1 = MAX_LEVEL;
};
};
_level = _arg1;
_graphics.clear();
if (_level > MIN_LEVEL){
draw();
};
}
public function init(_arg1:Graphics, _arg2:Rectangle, _arg3:uint=0):void{
if (_inited){
clear();
};
_graphics = _arg1;
_bound = _arg2;
_boundCenterX = (_bound.x + (0.5 * _bound.width));
_boundCenterY = (_bound.y + (0.5 * _bound.height));
_color = _arg3;
_inited = true;
}
public function clear():void{
_graphics.clear();
_graphics = null;
_bound = null;
_level = MIN_LEVEL;
_inited = false;
}
protected function draw():void{
}
}
}//package gg.engine.utils.graphicsFill
Section 235
//Bubble (gg.engine.utils.graphicsFill.Bubble)
package gg.engine.utils.graphicsFill {
class Bubble {
public var toX:Number;
public var toY:Number;
public var fromX:Number;
public var fromY:Number;
public var toFromDeltaX:Number;
public var toFromDeltaY:Number;
public var delay:Number;
public var duration:Number;
}
}//package gg.engine.utils.graphicsFill
Section 236
//Bubbles (gg.engine.utils.graphicsFill.Bubbles)
package gg.engine.utils.graphicsFill {
import flash.display.*;
import flash.geom.*;
import gg.engine.utils.*;
public class Bubbles extends BasicFiller {
protected var _bubbleDiameter:Number;
protected var _bubbleRadius:Number;
protected var _bubbles:Array;
protected static const _BUBBLE_POOL:ObjectPool = new ObjectPool(Bubble);
public function Bubbles(){
_bubbles = new Array();
}
override public function init(_arg1:Graphics, _arg2:Rectangle, _arg3:uint=0):void{
var _local4:int;
var _local5:int;
var _local6:Number;
var _local7:Number;
var _local10:int;
var _local11:int;
var _local12:Bubble;
super.init(_arg1, _arg2, _arg3);
_bubbleDiameter = (0.6 * Math.max(_bound.width, _bound.height));
_bubbleRadius = (0.5 * _bubbleDiameter);
_local4 = Math.ceil((_bound.width / (0.64 * _bubbleDiameter)));
_local5 = Math.ceil((_bound.height / (0.64 * _bubbleDiameter)));
_local6 = (_bound.width / _local4);
_local7 = (_bound.height / _local5);
var _local8:Number = (0.5 * _local6);
var _local9:Number = (0.5 * _local7);
while (_local10 < _local4) {
_local11 = 0;
while (_local11 < _local5) {
_local12 = (_BUBBLE_POOL.acquire() as Bubble);
_local12.toX = ((_bound.x + (_local10 * _local6)) + _local8);
_local12.toY = ((_bound.y + (_local11 * _local7)) + _local9);
_local12.toFromDeltaX = (_boundCenterX - _local12.toX);
_local12.toFromDeltaY = (_boundCenterY - _local12.toY);
_local12.fromX = (_boundCenterX + ((0.4 * _local12.toFromDeltaX) * ((2 * Math.random()) - 1)));
_local12.fromY = (_boundCenterY + ((0.4 * _local12.toFromDeltaY) * ((2 * Math.random()) - 1)));
_local12.toFromDeltaX = (_local12.fromX - _local12.toX);
_local12.toFromDeltaY = (_local12.fromY - _local12.toY);
_local12.delay = (0.4 * Math.random());
_local12.duration = (1 - _local12.delay);
_bubbles.push(_local12);
_local11++;
};
_local10++;
};
_local12 = _bubbles[((_local5 * int((0.5 * _local4))) + int((0.5 * _local5)))];
_local12.fromX = _boundCenterX;
_local12.fromY = _boundCenterY;
_local12.toFromDeltaX = (_local12.fromX - _local12.toX);
_local12.toFromDeltaY = (_local12.fromY - _local12.toY);
_local12.delay = 0;
}
override public function clear():void{
super.clear();
var _local1:int = _bubbles.length;
while (_local1--) {
_BUBBLE_POOL.release(_bubbles.pop());
};
}
override protected function draw():void{
var _local2:int;
var _local3:Bubble;
var _local4:Number;
var _local5:Number;
var _local1:int = _bubbles.length;
while (_local2 < _local1) {
_local3 = _bubbles[_local2];
_local4 = (Math.max(0, Math.min((_level - _local3.delay), _local3.duration)) / _local3.duration);
_local5 = (_local4 * _bubbleRadius);
if (_local5 >= 1){
_graphics.beginFill(_color);
_graphics.drawCircle((_local3.fromX - (_local4 * _local3.toFromDeltaX)), (_local3.fromY - (_local4 * _local3.toFromDeltaY)), _local5);
_graphics.endFill();
};
_local2++;
};
}
}
}//package gg.engine.utils.graphicsFill
Section 237
//Left2Right (gg.engine.utils.graphicsFill.Left2Right)
package gg.engine.utils.graphicsFill {
public class Left2Right extends BasicFiller {
override protected function draw():void{
_graphics.beginFill(_color);
_graphics.drawRect(_bound.x, _bound.y, (_level * _bound.width), _bound.height);
_graphics.endFill();
}
}
}//package gg.engine.utils.graphicsFill
Section 238
//Bit (gg.engine.utils.Bit)
package gg.engine.utils {
class Bit {
var name:String;
var defaultValue:Boolean;
var callback:Function;
function Bit(_arg1:String, _arg2:Boolean, _arg3:Function){
name = _arg1;
defaultValue = _arg2;
callback = _arg3;
}
}
}//package gg.engine.utils
Section 239
//BitField (gg.engine.utils.BitField)
package gg.engine.utils {
public class BitField {
protected var _bits:Array;
protected var _val:int;
public function BitField(){
_bits = new Array();
}
public function getValue():int{
return (_val);
}
public function setValue(_arg1:int, _arg2:Boolean=true):void{
var _local3:int;
while (_local3 < _bits.length) {
setBitByIndex(_local3, Boolean((_arg1 & (1 << _local3))), _arg2);
_local3++;
};
}
public function addBit(_arg1:String, _arg2:Boolean=false, _arg3:Function=null):void{
if (_bits.length < 32){
_bits.push(new Bit(_arg1, _arg2, _arg3));
setBit(_arg1, _arg2, false);
};
}
public function removeBit(_arg1:String):void{
var _local3:int;
var _local4:int;
var _local5:int;
var _local2:int = findBitIndex(_arg1);
if (_local2 > -1){
while (_local5 < _bits.length) {
if (_local5 == _local2){
_local5++;
} else {
if (Boolean((_val & (1 << _local5)))){
_local3 = (_local3 | (1 << _local4));
} else {
_local3 = (_local3 & ~((1 << _local4)));
};
_local4++;
_local5++;
};
};
_val = _local3;
_bits.splice(_local2, 1);
};
}
public function hasBit(_arg1:String):Boolean{
return ((findBitIndex(_arg1) > -1));
}
public function getBit(_arg1:String):Boolean{
var _local2:int = findBitIndex(_arg1);
if (_local2 > -1){
return (Boolean((_val & (1 << _local2))));
};
return (false);
}
public function setBit(_arg1:String, _arg2:Boolean, _arg3:Boolean=true):void{
var _local4:int = findBitIndex(_arg1);
if (_local4 > -1){
setBitByIndex(_local4, _arg2, _arg3);
};
}
public function setBitByIndex(_arg1:int, _arg2:Boolean, _arg3:Boolean=true):void{
var _local4:Boolean;
if (_arg1 < _bits.length){
_local4 = Boolean((_val & (1 << _arg1)));
if (_arg2){
_val = (_val | (1 << _arg1));
} else {
_val = (_val & ~((1 << _arg1)));
};
if (((_arg3) && (!((_bits[_arg1].callback == null))))){
_bits[_arg1].callback(_local4, _arg2);
};
};
}
public function getDefaultValue(_arg1:String):Boolean{
var _local2:int = findBitIndex(_arg1);
if (_local2 > -1){
return (_bits[_local2].defaultValue);
};
return (false);
}
public function setBitDefaultValue(_arg1:String, _arg2:Boolean):void{
var _local3:int = findBitIndex(_arg1);
if (_local3 > -1){
_bits[_local3].defaultValue = _arg2;
};
}
public function restore2default(_arg1:Boolean=true):void{
var _local2:int;
while (_local2 < _bits.length) {
setBitByIndex(_local2, _bits[_local2].defaultValue, _arg1);
_local2++;
};
}
public function decode(_arg1:int):Object{
var _local3:int;
var _local2:Object = new Object();
while (_local3 < _bits.length) {
_local2[_bits[_local3].name] = Boolean((_arg1 & (1 << _local3)));
_local3++;
};
return (_local2);
}
protected function findBitIndex(_arg1:String):int{
var _local3:int;
var _local2 = -1;
while (_local3 < _bits.length) {
if (_bits[_local3].name == _arg1){
_local2 = _local3;
break;
};
_local3++;
};
return (_local2);
}
}
}//package gg.engine.utils
Section 240
//Cookie (gg.engine.utils.Cookie)
package gg.engine.utils {
import flash.net.*;
public class Cookie {
private var _sharedObject:SharedObject;
private var _name:String;
private var _paramNames:Array;
private var _delimiter:String;
public function Cookie(_arg1:String, _arg2:Array, _arg3:String="_"){
_name = _arg1;
_paramNames = _arg2;
_delimiter = _arg3;
}
public function load():Object{
_sharedObject = SharedObject.getLocal(_name);
if (((_sharedObject) && (_sharedObject.data.hasOwnProperty("code")))){
return (GGCode.decodeObject(_sharedObject.data["code"], _paramNames, _delimiter));
};
return (null);
}
public function save(_arg1:Object):void{
if (!_sharedObject){
_sharedObject = SharedObject.getLocal(_name);
};
if (_sharedObject){
_sharedObject.data["code"] = GGCode.encodeObject(_arg1, _paramNames, _delimiter);
_sharedObject.flush();
};
}
}
}//package gg.engine.utils
Section 241
//GGCode (gg.engine.utils.GGCode)
package gg.engine.utils {
import flash.utils.*;
import com.dynamicflash.util.*;
public class GGCode {
public static function encodeString(_arg1:String):String{
var _local2:ByteArray = new ByteArray();
_local2.writeUTF(_arg1);
_local2.compress();
return (Base64.encodeByteArray(_local2));
}
public static function decodeString(_arg1:String):String{
var code = _arg1;
var byteArr:ByteArray = Base64.decodeToByteArray(code);
try {
byteArr.uncompress();
} catch(err:Error) {
return ("");
};
return (byteArr.readUTF());
}
public static function encodeObject(_arg1:Object, _arg2:Array, _arg3:String="_"):String{
var _local5:Boolean;
var _local6:int;
var _local7:String;
var _local4 = "";
while (_local6 < _arg2.length) {
if (_arg1.hasOwnProperty(_arg2[_local6])){
_local7 = String(_arg1[_arg2[_local6]]);
if (!_local5){
_local5 = !((_local7.length == 0));
};
_local4 = (_local4 + _local7);
};
if (_local6 < (_arg2.length - 1)){
_local4 = (_local4 + _arg3);
};
_local6++;
};
if (_local5){
return (encodeString(_local4));
};
return ("");
}
public static function decodeObject(_arg1:String, _arg2:Array, _arg3:String="_"):Object{
var _local5:int;
var _local6:Array;
var _local4:Object = new Object();
while (_local5 < _arg2.length) {
_local4[_arg2[_local5]] = "";
_local5++;
};
if (_arg1.length){
_local6 = decodeString(_arg1).split(_arg3);
_local5 = 0;
while (_local5 < _arg2.length) {
_local4[_arg2[_local5]] = _local6[_local5];
_local5++;
};
};
return (_local4);
}
}
}//package gg.engine.utils
Section 242
//GGEvent (gg.engine.utils.GGEvent)
package gg.engine.utils {
public class GGEvent {
protected var _listeners:Array;
public function GGEvent(){
_listeners = new Array();
}
public function addListener(_arg1:Function):void{
UArray.pushUnique(_listeners, _arg1);
}
public function removeListener(_arg1:Function):void{
UArray.remove(_listeners, _arg1);
}
public function removeAllListeners():void{
UArray.clear(_listeners);
}
public function dispatch(... _args):void{
var _local2:int;
while (_local2 < _listeners.length) {
_listeners[_local2].apply(null, _args);
_local2++;
};
}
}
}//package gg.engine.utils
Section 243
//HintGroup (gg.engine.utils.HintGroup)
package gg.engine.utils {
import flash.display.*;
import gg.engine.utils.*;
import com.greensock.*;
import fl.motion.easing.*;
class HintGroup extends Sprite {
var id:Object;
private var _hints:Array;
private var _timeline:TimelineLite;
function HintGroup(_arg1:Object, _arg2:Array){
var _local3:int;
var _local4:DisplayObject;
super();
id = _arg1;
_hints = new Array();
_timeline = new TimelineLite();
while (_local3 < _arg2.length) {
_local4 = (_arg2[_local3] as DisplayObject);
if (_local4){
_timeline.append(new TweenLite(_local4, 0.1, {alpha:1, delay:0.4, ease:Linear.easeNone}));
_timeline.append(new TweenLite(_local4, 0.1, {alpha:0, delay:2.6, ease:Linear.easeNone}));
_timeline.stop();
_local4.alpha = 0;
_hints.push(_local4);
addChild(_local4);
};
_local3++;
};
}
function show(_arg1:Function=null):void{
_timeline.gotoAndPlay(0);
_timeline.vars["onComplete"] = _arg1;
}
function hide():void{
var _local1:int;
_timeline.stop();
while (_local1 < _hints.length) {
_hints[_local1].alpha = 0;
_local1++;
};
}
}
}//package gg.engine.utils
Section 244
//HintManager (gg.engine.utils.HintManager)
package gg.engine.utils {
import flash.display.*;
public class HintManager extends Sprite {
private var _groups:Array;
private var _showingGroup:HintGroup;
public function HintManager(){
_groups = new Array();
}
public function add(_arg1:Object, _arg2:Array):void{
if (!hasGroup(_arg1)){
_groups.push(new HintGroup(_arg1, _arg2));
};
}
public function show(_arg1:Object):void{
var _local2:int = getGroupIndexByID(_arg1);
if (_local2 > -1){
_showingGroup = _groups[_local2];
addChild(_showingGroup);
_showingGroup.show(onGroup_Show_Complete);
};
}
public function hide():void{
if (_showingGroup){
_showingGroup.hide();
removeChild(_showingGroup);
_showingGroup = null;
};
}
public function getGroupIndexByID(_arg1:Object):int{
var _local2:int;
while (_local2 < _groups.length) {
if (_groups[_local2].id == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
}
public function hasGroup(_arg1:Object):Boolean{
return ((getGroupIndexByID(_arg1) > -1));
}
private function onGroup_Show_Complete():void{
removeChild(_showingGroup);
_showingGroup = null;
}
}
}//package gg.engine.utils
Section 245
//IClearable (gg.engine.utils.IClearable)
package gg.engine.utils {
public interface IClearable {
function clear():void;
}
}//package gg.engine.utils
Section 246
//MultiObjectPool (gg.engine.utils.MultiObjectPool)
package gg.engine.utils {
import flash.utils.*;
public class MultiObjectPool {
private var _pools:Dictionary;
public function MultiObjectPool(){
constructor();
}
public function acquire(_arg1:Class):Object{
var _local2:ObjectPool = _pools[_arg1];
if (!_local2){
_local2 = new ObjectPool(_arg1);
_pools[_arg1] = _local2;
};
return (_local2.acquire());
}
public function release(_arg1:Object):void{
var _local2:Class = (_arg1.constructor as Class);
var _local3:ObjectPool = _pools[_local2];
if (!_local3){
_local3 = new ObjectPool(_local2);
_pools[_local2] = _local3;
};
return (_local3.release(_arg1));
}
private function constructor():void{
_pools = new Dictionary();
}
}
}//package gg.engine.utils
Section 247
//ObjectPool (gg.engine.utils.ObjectPool)
package gg.engine.utils {
public class ObjectPool {
private var _objectClass:Class;
private var _objects:Array;
private var _lastObjectIndex:int;
public function ObjectPool(_arg1:Class){
constructor(_arg1);
}
public function acquire():Object{
if (_lastObjectIndex >= 0){
return (_objects[_lastObjectIndex--]);
};
return (new _objectClass());
}
public function release(_arg1:Object):void{
var _local2:IClearable = (_arg1 as IClearable);
if (_local2){
_local2.clear();
};
_lastObjectIndex++;
if (_lastObjectIndex == _objects.length){
_objects.push(_arg1);
} else {
_objects[_lastObjectIndex] = _arg1;
};
}
private function constructor(_arg1:Class):void{
_objectClass = _arg1;
_objects = new Array();
_objects.push(new _objectClass());
}
}
}//package gg.engine.utils
Section 248
//openURL (gg.engine.utils.openURL)
package gg.engine.utils {
import flash.net.*;
public function openURL(_arg1:String, _arg2:String="_blank"):void{
navigateToURL(new URLRequest(_arg1), _arg2);
}
}//package gg.engine.utils
Section 249
//secondsToMinutes (gg.engine.utils.secondsToMinutes)
package gg.engine.utils {
public function secondsToMinutes(_arg1:Number):String{
var _local2:Number = Math.floor((_arg1 / 60));
_arg1 = Math.floor((_arg1 % 60));
if (_arg1 < 10){
return (((_local2 + ":0") + _arg1));
};
return (((_local2 + ":") + _arg1));
}
}//package gg.engine.utils
Section 250
//ShowHide (gg.engine.utils.ShowHide)
package gg.engine.utils {
import flash.display.*;
import flash.utils.*;
import com.greensock.*;
import flash.geom.*;
import fl.motion.easing.*;
import gg.engine.utils.graphicsFill.*;
public class ShowHide extends Sprite implements IClearable {
private var _target:DisplayObject;
private var _targetAsContainer:DisplayObjectContainer;
private var _mask:DisplayObjectContainer;
private var _fillerClass:Class;
private var _filler:BasicFiller;
private var _tweenLite:TweenLite;
private var _userOnUpdate:Function;
private var _userOnComplete:Function;
public static const DEFAULT_FILLER_CLASS:Class = Left2Right;
public static const DEFAULT_EASE:Function = Linear.easeNone;
private static const _activeInstances:Dictionary = new Dictionary();
private static const _showHidePool:ObjectPool = new ObjectPool(ShowHide);
private static const _fillerPool:MultiObjectPool = new MultiObjectPool();
public function ShowHide(){
mouseChildren = false;
mouseEnabled = false;
}
public function clear():void{
_tweenLite.kill();
if (_mask == this){
_target.mask = null;
if (_targetAsContainer){
if (this.parent){
_targetAsContainer.removeChild(this);
};
};
} else {
_mask.removeChild(this);
};
_fillerPool.release(_filler);
_target = null;
_targetAsContainer = null;
_mask = null;
_filler = null;
_fillerClass = null;
_tweenLite = null;
_userOnUpdate = null;
_userOnComplete = null;
}
private function init(_arg1:DisplayObject, _arg2:Number, _arg3:Object, _arg4:Boolean=true):void{
_target = _arg1;
_arg3 = UObject.clone(_arg3);
if (_target.mask){
_mask = (_target.mask as DisplayObjectContainer);
if (_mask){
_mask.addChild(this);
} else {
return;
};
} else {
_mask = this;
_targetAsContainer = (_target as DisplayObjectContainer);
if (_targetAsContainer){
_targetAsContainer.addChild(this);
};
};
if (!_targetAsContainer){
if (_arg3.hasOwnProperty("onUpdate")){
_userOnUpdate = _arg3["onUpdate"];
};
_arg3["onUpdate"] = onUpdate;
};
_fillerClass = DEFAULT_FILLER_CLASS;
if (_arg3.hasOwnProperty("filler")){
_fillerClass = _arg3["filler"];
delete _arg3["filler"];
};
_filler = (_fillerPool.acquire(_fillerClass) as BasicFiller);
var _local5:Rectangle = _target.getBounds(this);
_target.getBounds(this).x = (_local5.x - 1);
_local5.y = (_local5.y - 1);
_local5.width = (_local5.width + 2);
_local5.height = (_local5.height + 2);
_filler.init(graphics, _local5);
if (_arg4){
_arg3["level"] = BasicFiller.MAX_LEVEL;
} else {
_filler.level = BasicFiller.MAX_LEVEL;
_arg3["level"] = BasicFiller.MIN_LEVEL;
};
_target.mask = _mask;
_target.visible = true;
if (!_arg3.hasOwnProperty("ease")){
_arg3["ease"] = DEFAULT_EASE;
};
if (_arg3.hasOwnProperty("onComplete")){
_userOnComplete = _arg3["onComplete"];
};
_arg3["onComplete"] = onComplete;
_tweenLite = TweenLite.to(_filler, _arg2, _arg3);
}
private function reverse(_arg1:Function=null, _arg2:Array=null):void{
_userOnComplete = _arg1;
if (_tweenLite.reversed){
if (_arg2){
_tweenLite.vars["onCompleteParams"] = _arg2;
} else {
if (_tweenLite.vars.hasOwnProperty("onCompleteParams")){
delete _tweenLite.vars["onCompleteParams"];
};
};
_tweenLite.play();
} else {
_tweenLite.vars["onReverseComplete"] = this.onComplete;
if (_arg2){
_tweenLite.vars["onReverseCompleteParams"] = _arg2;
} else {
if (_tweenLite.vars.hasOwnProperty("onReverseCompleteParams")){
delete _tweenLite.vars["onReverseCompleteParams"];
};
};
_tweenLite.reverse();
};
}
private function onUpdate(... _args):void{
_target.mask = _mask;
if (Boolean(_userOnUpdate)){
_userOnUpdate.apply(null, _args);
};
}
private function onComplete(... _args):void{
if (_filler.level == BasicFiller.MIN_LEVEL){
_target.visible = false;
};
var _local2:Function = _userOnComplete;
_activeInstances[_target] = null;
_showHidePool.release(this);
if (Boolean(_local2)){
_local2.apply(null, _args);
};
}
public static function show(_arg1:DisplayObject, _arg2:Number, _arg3:Object):void{
if (!nullDurationCheck(_arg1, _arg2, _arg3)){
return;
};
prepareTarget(_arg1);
var _local4:ShowHide = (_showHidePool.acquire() as ShowHide);
_activeInstances[_arg1] = _local4;
_local4.init(_arg1, _arg2, _arg3);
}
public static function hide(_arg1:DisplayObject, _arg2:Number=0, _arg3:Object=null):void{
if (!nullDurationCheck(_arg1, _arg2, _arg3)){
return;
};
prepareTarget(_arg1);
var _local4:ShowHide = (_showHidePool.acquire() as ShowHide);
_activeInstances[_arg1] = _local4;
_local4.init(_arg1, _arg2, _arg3, false);
}
public static function reverse(_arg1:DisplayObject, _arg2:Function=null, _arg3:Array=null):void{
if (!_arg1.mask){
return;
};
var _local4:ShowHide = _activeInstances[_arg1];
if (_local4){
_local4.reverse(_arg2, _arg3);
};
}
public static function cancel(_arg1:DisplayObject){
var _local2:ShowHide = _activeInstances[_arg1];
if (_local2){
_local2.clear();
_activeInstances[_arg1] = null;
};
}
private static function prepareTarget(_arg1:DisplayObject):void{
var _local2:ShowHide = _activeInstances[_arg1];
if (_local2){
_showHidePool.release(_local2);
};
}
private static function nullDurationCheck(_arg1:DisplayObject, _arg2:Number, _arg3:Object):Boolean{
var _local4:Function;
var _local5:Object;
if (!_arg2){
if (_arg3.hasOwnProperty("onComplete")){
_local4 = _arg3["onComplete"];
};
if (_arg3.hasOwnProperty("onCompleteParams")){
_local5 = _arg3["onCompleteParams"];
};
if (Boolean(_local4)){
_local4.apply(null, _local5);
};
return (false);
};
return (true);
}
}
}//package gg.engine.utils
Section 251
//TickedTimer (gg.engine.utils.TickedTimer)
package gg.engine.utils {
import flash.utils.*;
public class TickedTimer {
protected var _lastGetTimer:int;
protected var _duration:int;
protected var _time:int;
public function TickedTimer(){
_lastGetTimer = getTimer();
}
public function get duration():int{
return (_duration);
}
public function get time():int{
return (_time);
}
public function tick():void{
_duration = (getTimer() - _lastGetTimer);
_lastGetTimer = (_lastGetTimer + _duration);
_time = (_time + _duration);
}
public function resetTime():void{
_time = 0;
}
}
}//package gg.engine.utils
Section 252
//UArray (gg.engine.utils.UArray)
package gg.engine.utils {
public class UArray {
public static function clear(_arg1:Array):void{
while (_arg1.length) {
_arg1.pop();
};
}
public static function clone(_arg1:Array):Array{
var _local3:int;
var _local2:Array = new Array(_arg1.length);
while (_local3 < _arg1.length) {
_local2[_local3] = _arg1[_local3];
_local3++;
};
return (_local2);
}
public static function pushUnique(_arg1:Array, _arg2:Object):void{
var _local3:int;
while (_local3 < _arg1.length) {
if (_arg1[_local3] == _arg2){
return;
};
_local3++;
};
_arg1.push(_arg2);
}
public static function remove(_arg1:Array, _arg2:Object):void{
var _local3:int;
while (_local3 < _arg1.length) {
if (_arg1[_local3] == _arg2){
_arg1.splice(_local3, 1);
return;
};
_local3++;
};
}
public static function shuffle(_arg1:Array):void{
var _local2:int;
while (_local2 < _arg1.length) {
_arg1.push(_arg1.splice(int((Math.random() * _arg1.length)), 1));
_local2++;
};
}
public static function getItemIndex(_arg1:Array, _arg2:Object):int{
var _local3:int;
while (_local3 < _arg1.length) {
if (_arg1[_local3] == _arg2){
return (_local3);
};
_local3++;
};
return (-1);
}
public static function hasItem(_arg1:Array, _arg2:Object):Boolean{
var _local3:int;
while (_local3 < _arg1.length) {
if (_arg1[_local3] == _arg2){
return (true);
};
_local3++;
};
return (false);
}
}
}//package gg.engine.utils
Section 253
//UDomain (gg.engine.utils.UDomain)
package gg.engine.utils {
import flash.net.*;
public class UDomain {
private static var _localConnection:LocalConnection;
public static function get domain():String{
if (!_localConnection){
_localConnection = new LocalConnection();
};
return (_localConnection.domain);
}
public static function checkDomain(_arg1:Array, _arg2:Array=null, _arg3:String=""):Boolean{
var _local5:String;
var _local6:String;
var _local4:Boolean;
if (!((_arg3) && (_arg3.length))){
_arg3 = domain;
};
_arg3 = _arg3.toLowerCase();
if (!((_arg1) && (_arg1.length))){
_local4 = true;
} else {
for each (_local5 in _arg1) {
if (!(_arg3.indexOf(_local5.toLowerCase()) > -1)){
} else {
_local4 = true;
break;
};
};
};
if (((_arg2) && (_arg2.length))){
for each (_local6 in _arg2) {
if (!(_arg3.indexOf(_local6.toLowerCase()) > -1)){
} else {
_local4 = false;
break;
};
};
};
return (_local4);
}
}
}//package gg.engine.utils
Section 254
//UMath (gg.engine.utils.UMath)
package gg.engine.utils {
public class UMath {
public static const DEG_2_RAD:Number = 0.0174532925199433;
public static const RAD_2_DEG:Number = 57.2957795130823;
public static const PI2:Number = 6.28318530717959;
public static function deg2Rad(_arg1:Number):Number{
return ((DEG_2_RAD * _arg1));
}
public static function rad2Deg(_arg1:Number):Number{
return ((RAD_2_DEG * _arg1));
}
public static function randomBoolean():Boolean{
return (((Math.random() >= 0.5)) ? false : true);
}
public static function randomPositiveNegative():int{
return ((randomBoolean()) ? 1 : -1);
}
public static function rangeRandom(_arg1:Number, _arg2:Number):Number{
return ((_arg1 + ((_arg2 - _arg1) * Math.random())));
}
public static function randomItem(_arg1:Array){
return (_arg1[int(rangeRandom(0, _arg1.length))]);
}
}
}//package gg.engine.utils
Section 255
//UNumber (gg.engine.utils.UNumber)
package gg.engine.utils {
public class UNumber {
public static function round(_arg1:Number, _arg2:int=0):Number{
_arg2 = Math.pow(10, _arg2);
return ((Math.round((_arg1 * _arg2)) / _arg2));
}
public static function round2str(_arg1:Number, _arg2:int=0):String{
_arg2 = Math.pow(10, _arg2);
_arg1 = (Math.round((_arg1 * _arg2)) / _arg2);
return (_arg1.toString());
}
}
}//package gg.engine.utils
Section 256
//UObject (gg.engine.utils.UObject)
package gg.engine.utils {
public class UObject {
public static function clone(_arg1:Object):Object{
var _local3:String;
var _local2:Object = new Object();
for (_local3 in _arg1) {
_local2[_local3] = _arg1[_local3];
};
return (_local2);
}
public static function clear(_arg1:Object):void{
var _local2:String;
for (_local2 in _arg1) {
delete _arg1[_local2];
};
}
public static function copyParams(_arg1:Object, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg1) {
_arg2[_local3] = _arg1[_local3];
};
}
public static function toString(_arg1:Object):String{
var _local3:String;
var _local2 = "{\n";
for (_local3 in _arg1) {
_local2 = (_local2 + (((_local3 + ": ") + _arg1[_local3]) + "\n"));
};
_local2 = (_local2 + "}");
return (_local2);
}
}
}//package gg.engine.utils
Section 257
//URectangle (gg.engine.utils.URectangle)
package gg.engine.utils {
import flash.geom.*;
import flash.display.*;
public class URectangle {
public static function syncObjPos(_arg1:DisplayObject, _arg2:Rectangle):void{
if (_arg1.x < _arg2.x){
_arg1.x = _arg2.x;
} else {
if (_arg1.x > _arg2.right){
_arg1.x = _arg2.right;
};
};
if (_arg1.y < _arg2.y){
_arg1.y = _arg2.y;
} else {
if (_arg1.y > _arg2.bottom){
_arg1.y = _arg2.bottom;
};
};
}
public static function syncObjSize(_arg1:DisplayObject, _arg2:Rectangle):void{
var _local4:Number;
var _local5:Number;
var _local3:Number = (_arg2.width / Math.sqrt(2));
_local4 = _arg1.rotation;
_arg1.rotation = 0;
if ((((_arg1.width > _local3)) || ((_arg1.height > _local3)))){
if (_arg1.width > _arg1.height){
_local5 = (_local3 / _arg1.width);
_arg1.width = _local3;
_arg1.height = (_local5 * _arg1.height);
} else {
_local5 = (_local3 / _arg1.height);
_arg1.height = _local3;
_arg1.width = (_local5 * _arg1.width);
};
};
_arg1.rotation = _local4;
}
}
}//package gg.engine.utils
Section 258
//UString (gg.engine.utils.UString)
package gg.engine.utils {
public class UString {
private static const _NUM_CHARS:String = "0123456789";
public static function repairStrWithInt(_arg1:String):String{
var _local2:String;
var _local3 = "";
if (_arg1.charAt(0) == "-"){
_local3 = "-";
};
var _local4:int = ((_local3.charAt(0) == "-")) ? 1 : 0;
while (_local4 < _arg1.length) {
_local2 = _arg1.charAt(_local4);
if (_NUM_CHARS.indexOf(_local2) != -1){
_local3 = (_local3 + _local2);
};
_local4++;
};
return (_local3);
}
public static function repairStrWithPositiveInt(_arg1:String):String{
var _local2:String;
var _local4:int;
var _local3 = "";
while (_local4 < _arg1.length) {
_local2 = _arg1.charAt(_local4);
if (_NUM_CHARS.indexOf(_local2) != -1){
_local3 = (_local3 + _local2);
};
_local4++;
};
return (_local3);
}
public static function repairStrWithPositiveReal(_arg1:String):String{
var _local2:String;
var _local4:Boolean;
var _local5:int;
var _local3 = "";
while (_local5 < _arg1.length) {
_local2 = _arg1.charAt(_local5);
if (((!((_NUM_CHARS.indexOf(_local2) == -1))) || ((((((_local2 == ".")) && (!(_local4)))) && ((_local5 > 0)))))){
if (_local2 == "."){
_local4 = true;
};
_local3 = (_local3 + _local2);
};
_local5++;
};
return (_local3);
}
public static function repairStrWithReal(_arg1:String):String{
var _local2:String;
var _local4:Boolean;
var _local3 = "";
if (_arg1.charAt(0) == "-"){
_local3 = "-";
};
var _local5:int = ((_local3.charAt(0) == "-")) ? 1 : 0;
while (_local5 < _arg1.length) {
_local2 = _arg1.charAt(_local5);
if (((!((_NUM_CHARS.indexOf(_local2) == -1))) || ((((((_local2 == ".")) && (!(_local4)))) && (((((!((_local3.charAt(0) == "-"))) && ((_local5 > 0)))) || ((((_local3.charAt(0) == "-")) && ((_local5 > 1)))))))))){
if (_local2 == "."){
_local4 = true;
};
_local3 = (_local3 + _local2);
};
_local5++;
};
return (_local3);
}
}
}//package gg.engine.utils
Section 259
//Engine (gg.engine.Engine)
package gg.engine {
import flash.display.*;
import gg.engine.utils.*;
import gg.engine.common.*;
import gg.engine.display.*;
import gg.engine.sound.*;
import gg.engine.ui.*;
public class Engine {
public var guiMgr:GUIManager;
public var soundMgr:SoundManager;
public var keyboardMgr:KeyboardManager;
public var levelMgr:LevelManager;
public var achievementMgr:AchievementManager;
protected var _cookie:Cookie;
public function Engine(_arg1:DisplayObjectContainer, _arg2:String){
if (!_arg1.stage){
throw (new Error("container must be added to the stage"));
};
guiMgr = new GUIManager(_arg1);
soundMgr = new SoundManager();
keyboardMgr = new KeyboardManager(_arg1.stage);
levelMgr = new LevelManager();
achievementMgr = new AchievementManager();
_cookie = new Cookie(_arg2, ["guiMgr", "soundMgr", "levelMgr", "achievementMgr"]);
guiMgr.onChange.addListener(save);
soundMgr.onChange.addListener(save);
levelMgr.onChange.addListener(save);
achievementMgr.onObtain.addListener(save);
}
public function load():Boolean{
var _local1:Object = _cookie.load();
if (_local1){
guiMgr.code = _local1["guiMgr"];
soundMgr.code = _local1["soundMgr"];
levelMgr.code = _local1["levelMgr"];
achievementMgr.code = _local1["achievementMgr"];
return (true);
};
return (false);
}
public function save():void{
var _local1:Object = new Object();
_local1["guiMgr"] = guiMgr.code;
_local1["soundMgr"] = soundMgr.code;
_local1["levelMgr"] = levelMgr.code;
_local1["achievementMgr"] = achievementMgr.code;
_cookie.save(_local1);
}
}
}//package gg.engine
Section 260
//BangBallBtn_60 (HitTheTroll_fla.BangBallBtn_60)
package HitTheTroll_fla {
import flash.display.*;
public dynamic class BangBallBtn_60 extends MovieClip {
public function BangBallBtn_60(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package HitTheTroll_fla
Section 261
//BoomBallBtn_72 (HitTheTroll_fla.BoomBallBtn_72)
package HitTheTroll_fla {
import flash.display.*;
public dynamic class BoomBallBtn_72 extends MovieClip {
public function BoomBallBtn_72(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package HitTheTroll_fla
Section 262
//CrashBallBtn_66 (HitTheTroll_fla.CrashBallBtn_66)
package HitTheTroll_fla {
import flash.display.*;
public dynamic class CrashBallBtn_66 extends MovieClip {
public function CrashBallBtn_66(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package HitTheTroll_fla
Section 263
//Face_191 (HitTheTroll_fla.Face_191)
package HitTheTroll_fla {
import flash.display.*;
public dynamic class Face_191 extends MovieClip {
public function Face_191(){
addFrameScript(0, frame1, 65, frame66, 66, frame67);
}
function frame1(){
stop();
}
function frame66(){
gotoAndPlay("danger");
}
function frame67(){
stop();
}
}
}//package HitTheTroll_fla
Section 264
//Face_192 (HitTheTroll_fla.Face_192)
package HitTheTroll_fla {
import flash.display.*;
public dynamic class Face_192 extends MovieClip {
public function Face_192(){
addFrameScript(0, frame1, 64, frame65, 65, frame66);
}
function frame1(){
stop();
}
function frame65(){
gotoAndPlay("danger");
}
function frame66(){
stop();
}
}
}//package HitTheTroll_fla
Section 265
//Face_194 (HitTheTroll_fla.Face_194)
package HitTheTroll_fla {
import flash.display.*;
public dynamic class Face_194 extends MovieClip {
public function Face_194(){
addFrameScript(0, frame1, 64, frame65, 65, frame66);
}
function frame1(){
stop();
}
function frame65(){
gotoAndPlay("danger");
}
function frame66(){
stop();
}
}
}//package HitTheTroll_fla
Section 266
//Face_195 (HitTheTroll_fla.Face_195)
package HitTheTroll_fla {
import flash.display.*;
public dynamic class Face_195 extends MovieClip {
public function Face_195(){
addFrameScript(0, frame1, 65, frame66, 66, frame67);
}
function frame1(){
stop();
}
function frame66(){
gotoAndPlay("danger");
}
function frame67(){
stop();
}
}
}//package HitTheTroll_fla
Section 267
//Face_196 (HitTheTroll_fla.Face_196)
package HitTheTroll_fla {
import flash.display.*;
public dynamic class Face_196 extends MovieClip {
public function Face_196(){
addFrameScript(0, frame1, 65, frame66, 66, frame67);
}
function frame1(){
stop();
}
function frame66(){
gotoAndPlay("danger");
}
function frame67(){
stop();
}
}
}//package HitTheTroll_fla
Section 268
//Face_197 (HitTheTroll_fla.Face_197)
package HitTheTroll_fla {
import flash.display.*;
public dynamic class Face_197 extends MovieClip {
public function Face_197(){
addFrameScript(0, frame1, 65, frame66, 66, frame67);
}
function frame1(){
stop();
}
function frame66(){
gotoAndPlay("danger");
}
function frame67(){
stop();
}
}
}//package HitTheTroll_fla
Section 269
//Face_54 (HitTheTroll_fla.Face_54)
package HitTheTroll_fla {
import flash.display.*;
public dynamic class Face_54 extends MovieClip {
public function Face_54(){
addFrameScript(1, frame2, 71, frame72, 73, frame74);
}
function frame2(){
stop();
}
function frame72(){
gotoAndPlay("danger");
}
function frame74(){
stop();
}
}
}//package HitTheTroll_fla
Section 270
//Star_153 (HitTheTroll_fla.Star_153)
package HitTheTroll_fla {
import flash.display.*;
public dynamic class Star_153 extends MovieClip {
public function Star_153(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package HitTheTroll_fla
Section 271
//MochiCoins (mochi.as3.MochiCoins)
package mochi.as3 {
public class MochiCoins {
public static const STORE_SHOW:String = "StoreShow";
public static const STORE_HIDE:String = "StoreHide";
public static const ITEM_OWNED:String = "ItemOwned";
public static const ITEM_NEW:String = "ItemNew";
public static const STORE_ITEMS:String = "StoreItems";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IOError";
public static const NO_USER:String = "NoUser";
public static var _inventory:MochiInventory;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function get inventory():MochiInventory{
return (_inventory);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showStore(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showStore", {options:_arg1}, null, null);
}
public static function showItem(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showItem call must pass an Object with an item key");
return;
};
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showItem", {options:_arg1}, null, null);
}
public static function showVideo(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showVideo call must pass an Object with an item key");
return;
};
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showVideo", {options:_arg1}, null, null);
}
public static function getStoreItems():void{
MochiServices.send("coins_getStoreItems");
}
public static function requestFunding(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestFunding", _arg1);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_inventory = new MochiInventory();
});
addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_inventory = null;
});
}
}//package mochi.as3
Section 272
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Fragment:Number;
private var Sibling:MochiDigits;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function get value():Number{
return (Number(this.toString()));
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
Fragment = (_local3.charCodeAt(_temp1) ^ Encoder);
if (_arg2 < _local3.length){
Sibling = new MochiDigits(_arg1, _arg2);
} else {
Sibling = null;
};
reencode();
}
public function reencode():void{
var _local1:uint = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function toString():String{
var _local1:String = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
}
}//package mochi.as3
Section 273
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher)
package mochi.as3 {
public class MochiEventDispatcher {
private var eventTable:Object;
public function MochiEventDispatcher():void{
eventTable = {};
}
public function addEventListener(_arg1:String, _arg2:Function):void{
removeEventListener(_arg1, _arg2);
eventTable[_arg1].push(_arg2);
}
public function removeEventListener(_arg1:String, _arg2:Function):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
eventTable[_arg1] = [];
return;
};
for (_local3 in eventTable[_arg1]) {
if (eventTable[_arg1][_local3] != _arg2){
} else {
eventTable[_arg1].splice(Number(_local3), 1);
};
};
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
return;
};
for (_local3 in eventTable[_arg1]) {
var _local6 = eventTable[_arg1];
_local6[_local3](_arg2);
};
}
}
}//package mochi.as3
Section 274
//MochiEvents (mochi.as3.MochiEvents)
package mochi.as3 {
public class MochiEvents {
public static const ACHIEVEMENTS_OWNED:String = "AchievementOwned";
public static const ACHIEVEMENT_NEW:String = "AchievementReceived";
public static const GAME_ACHIEVEMENTS:String = "GameAchievements";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IOError";
public static const IO_PENDING:String = "IOPending";
public static const ALIGN_TOP_LEFT:String = "ALIGN_TL";
public static const ALIGN_TOP:String = "ALIGN_T";
public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR";
public static const ALIGN_LEFT:String = "ALIGN_L";
public static const ALIGN_CENTER:String = "ALIGN_C";
public static const ALIGN_RIGHT:String = "ALIGN_R";
public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL";
public static const ALIGN_BOTTOM:String = "ALIGN_B";
public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR";
public static const FORMAT_SHORT:String = "ShortForm";
public static const FORMAT_LONG:String = "LongForm";
public static const FORMAT_NONE:String = "NoForm";
private static var gameStart:Number;
private static var levelStart:Number;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function getAchievements(_arg1:Object=null):void{
MochiServices.send("events_getAchievements", _arg1);
}
public static function unlockAchievement(_arg1:Object):void{
MochiServices.send("events_unlockAchievement", _arg1);
}
public static function startSession(_arg1:String):void{
MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null);
}
public static function showAwards(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.stayOnTop();
MochiServices.send("events_showAwards", _arg1);
}
public static function setNotifications(_arg1:Object):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("events_setNotifications", _arg1, null, null);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function startPlay(_arg1:String="gameplay"):void{
MochiServices.send("events_setRoundID", {tag:String(_arg1)}, null, null);
}
public static function endPlay():void{
MochiServices.send("events_clearRoundID", null, null, null);
}
public static function trackEvent(_arg1:String, _arg2=null):void{
MochiServices.send("events_trackEvent", {tag:_arg1, value:_arg2}, null, null);
}
}
}//package mochi.as3
Section 275
//MochiInventory (mochi.as3.MochiInventory)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
public dynamic class MochiInventory extends Proxy {
private var _timer:Timer;
private var _consumableProperties:Object;
private var _syncPending:Boolean;
private var _outstandingID:Number;
private var _syncID:Number;
private var _names:Array;
private var _storeSync:Object;
private static const CONSUMER_KEY:String = "MochiConsumables";
private static const KEY_SALT:String = " syncMaint";
public static const READY:String = "InvReady";
public static const WRITTEN:String = "InvWritten";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IoError";
public static const VALUE_ERROR:String = "InvValueError";
public static const NOT_READY:String = "InvNotReady";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public function MochiInventory():void{
MochiCoins.addEventListener(MochiCoins.ITEM_OWNED, itemOwned);
MochiCoins.addEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, loggedOut);
_storeSync = new Object();
_syncPending = false;
_outstandingID = 0;
_syncID = 0;
_timer = new Timer(1000);
_timer.addEventListener(TimerEvent.TIMER, sync);
_timer.start();
if (MochiSocial.loggedIn){
loggedIn();
} else {
loggedOut();
};
}
public function release():void{
MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, loggedOut);
}
private function loggedOut(_arg1:Object=null):void{
_consumableProperties = null;
}
private function loggedIn(_arg1:Object=null):void{
MochiUserData.get(CONSUMER_KEY, getConsumableBag);
}
private function newItems(_arg1:Object):void{
if (!this[(_arg1.id + KEY_SALT)]){
this[(_arg1.id + KEY_SALT)] = 0;
};
if (!this[_arg1.id]){
this[_arg1.id] = 0;
};
this[(_arg1.id + KEY_SALT)] = (this[(_arg1.id + KEY_SALT)] + _arg1.count);
this[_arg1.id] = (this[_arg1.id] + _arg1.count);
if (((_arg1.privateProperties) && (_arg1.privateProperties.consumable))){
if (!this[_arg1.privateProperties.tag]){
this[_arg1.privateProperties.tag] = 0;
};
this[_arg1.privateProperties.tag] = (this[_arg1.privateProperties.tag] + (_arg1.privateProperties.inc * _arg1.count));
};
}
private function itemOwned(_arg1:Object):void{
_storeSync[_arg1.id] = {properties:_arg1.properties, count:_arg1.count};
}
private function getConsumableBag(_arg1:MochiUserData):void{
var _local2:String;
var _local3:Number;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
return;
};
_consumableProperties = {};
_names = new Array();
if (_arg1.data){
for (_local2 in _arg1.data) {
_names.push(_local2);
_consumableProperties[_local2] = new MochiDigits(_arg1.data[_local2]);
};
};
for (_local2 in _storeSync) {
_local3 = _storeSync[_local2].count;
if (_consumableProperties[(_local2 + KEY_SALT)]){
_local3 = (_local3 - _consumableProperties[(_local2 + KEY_SALT)].value);
};
if (_local3 == 0){
} else {
newItems({id:_local2, count:_local3, properties:_storeSync[_local2].properties});
};
};
triggerEvent(READY, {});
}
private function putConsumableBag(_arg1:MochiUserData):void{
_syncPending = false;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
_outstandingID = -1;
};
triggerEvent(WRITTEN, {});
}
private function sync(_arg1:Event=null):void{
var _local3:String;
if (((_syncPending) || ((_syncID == _outstandingID)))){
return;
};
_outstandingID = _syncID;
var _local2:Object = {};
for (_local3 in _consumableProperties) {
_local2[_local3] = MochiDigits(_consumableProperties[_local3]).value;
};
MochiUserData.put(CONSUMER_KEY, _local2, putConsumableBag);
_syncPending = true;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (-1);
};
if (_consumableProperties[_arg1]){
return (MochiDigits(_consumableProperties[_arg1]).value);
};
return (undefined);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{
if (!_consumableProperties[_arg1]){
return (false);
};
_names.splice(_names.indexOf(_arg1), 1);
delete _consumableProperties[_arg1];
return (true);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (false);
};
if (_consumableProperties[_arg1] == undefined){
return (false);
};
return (true);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:MochiDigits;
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return;
};
if (!(_arg2 is Number)){
triggerEvent(ERROR, {type:VALUE_ERROR, error:"Invalid type", arg:_arg2});
return;
};
if (_consumableProperties[_arg1]){
_local3 = MochiDigits(_consumableProperties[_arg1]);
if (_local3.value == _arg2){
return;
};
_local3.value = _arg2;
} else {
_names.push(_arg1);
_consumableProperties[_arg1] = new MochiDigits(_arg2);
};
_syncID++;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
return (((_arg1)>=_names.length) ? 0 : (_arg1 + 1));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return (_names[(_arg1 - 1)]);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
}
}//package mochi.as3
Section 276
//MochiScores (mochi.as3.MochiScores)
package mochi.as3 {
import flash.display.*;
import flash.text.*;
public class MochiScores {
public static var onCloseHandler:Object;
public static var onErrorHandler:Object;
private static var boardID:String;
public static function onClose(_arg1:Object=null):void{
if (((((_arg1) && ((_arg1.error == true)))) && (onErrorHandler))){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiServices.warnID(_arg1, true);
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
public static function showLeaderboard(_arg1:Object=null):void{
var n:Number;
var options = _arg1;
if (options != null){
delete options.clip;
MochiServices.setContainer();
MochiServices.bringToTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
} else {
if ((options.score is MochiDigits)){
options.score = options.score.value;
};
};
n = Number(options.score);
if (isNaN(n)){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(n) != n){
trace((("WARNING: Submitted score '" + options.score) + "' will be truncated"));
};
options.score = n;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.warnID(options.boardID, true);
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
_arg1 = Number(_arg1);
if (isNaN(_arg1)){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((_arg1 == Number.NEGATIVE_INFINITY)) || ((_arg1 == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(_arg1) != _arg1){
trace((("WARNING: Submitted score '" + String(_arg1)) + "' will be truncated"));
};
_arg1 = Number(_arg1);
};
};
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
var _local2:Object = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
}
}//package mochi.as3
Section 277
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.system.*;
public class MochiServices {
public static const CONNECTED:String = "onConnected";
private static var _id:String;
private static var _container:Object;
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _timer:Timer;
private static var _preserved:Object;
private static var _servURL:String = "http://www.mochiads.com/static/lib/services/";
private static var _services:String = "services.swf";
private static var _mochiLC:String = "MochiLC.swf";
private static var _swfVersion:String;
private static var _listenChannelName:String = "__ms_";
private static var _sendChannel:LocalConnection;
private static var _sendChannelName:String;
private static var _connecting:Boolean = false;
private static var _connected:Boolean = false;
public static var netup:Boolean = true;
public static var netupAttempted:Boolean = false;
public static var onError:Object;
public static var widget:Boolean = false;
private static var _mochiLocalConnection:MovieClip;
private static var _queue:Array;
private static var _nextCallbackID:Number;
private static var _callbacks:Object;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function get id():String{
return (_id);
}
public static function get clip():Object{
return (_container);
}
public static function get childClip():Object{
return (_clip);
}
public static function getVersion():String{
return ("3.9.4 as3");
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
public static function get connected():Boolean{
return (_connected);
}
public static function warnID(_arg1:String, _arg2:Boolean):void{
_arg1 = _arg1.toLowerCase();
if (_arg1.length != 16){
trace((("WARNING: " + (_arg2) ? "board" : "game") + " ID is not the appropriate length"));
return;
} else {
if (_arg1 == "1e113c7239048b3f"){
if (_arg2){
trace("WARNING: Using testing board ID");
} else {
trace("WARNING: Using testing board ID as game ID");
};
return;
} else {
if (_arg1 == "84993a1de4031cd8"){
if (_arg2){
trace("WARNING: Using testing game ID as board ID");
} else {
trace("WARNING: Using testing game ID");
};
return;
};
};
};
var _local3:Number = 0;
while (_local3 < _arg1.length) {
switch (_arg1.charAt(_local3)){
case "0":
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
case "a":
case "b":
case "c":
case "d":
case "e":
case "f":
break;
default:
trace(("WARNING: Board ID contains illegal characters: " + _arg1));
return;
};
_local3++;
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
warnID(id, false);
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
if ((clip is DisplayObject)){
if (clip.stage == null){
trace("MochiServices connect requires the containing clip be attached to the stage");
};
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_mochiLocalConnection.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, connectWait);
_timer = null;
} catch(error:Error) {
};
};
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
}
public static function bringToTop(_arg1:Event=null):void{
var e = _arg1;
if (((!((MochiServices.clip == null))) && (!((MochiServices.childClip == null))))){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_clip.parent){
_clip.parent.removeChild(_clip);
};
if (_arg1 != null){
if ((_arg1 is DisplayObjectContainer)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is DisplayObjectContainer)){
DisplayObjectContainer(_container).addChild(_clip);
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
MochiServices.onError("NotConnected");
return (null);
};
if (urlOptions(_arg2).servURL){
_servURL = urlOptions(_arg2).servURL;
};
var _local3:String = (_servURL + _services);
if (urlOptions(_arg2).servicesURL){
_local3 = urlOptions(_arg2).servicesURL;
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().time) + "_") + Math.floor((Math.random() * 99999))));
MochiServices.allowDomains(_local3);
_clip = new MovieClip();
loadLCBridge(_clip);
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, detach);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
var _local4:URLRequest = new URLRequest(_local3);
var _local5:URLVariables = new URLVariables();
_local5.listenLC = _listenChannelName;
_local5.mochiad_options = _arg2.loaderInfo.parameters.mochiad_options;
_local5.api_version = getVersion();
if (widget){
_local5.widget = true;
};
_local4.data = _local5;
_loader.load(_local4);
_clip.addChild(_loader);
_sendChannel = new LocalConnection();
_queue = [];
_nextCallbackID = 0;
_callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
private static function detach(_arg1:Event):void{
var _local2:LoaderInfo = LoaderInfo(_arg1.target);
_local2.removeEventListener(Event.COMPLETE, detach);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, detach);
_local2.removeEventListener(Event.COMPLETE, loadLCBridgeComplete);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, loadError);
}
private static function loadLCBridge(_arg1:Object):void{
var _local2:Loader = new Loader();
var _local3:String = (_servURL + _mochiLC);
var _local4:URLRequest = new URLRequest(_local3);
_local2.contentLoaderInfo.addEventListener(Event.COMPLETE, detach);
_local2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach);
_local2.contentLoaderInfo.addEventListener(Event.COMPLETE, loadLCBridgeComplete);
_local2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
_local2.load(_local4);
_arg1.addChild(_local2);
}
private static function loadLCBridgeComplete(_arg1:Event):void{
var _local2:Loader = LoaderInfo(_arg1.target).loader;
_mochiLocalConnection = MovieClip(_local2.content);
listen();
}
private static function loadError(_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
}
public static function connectWait(_arg1:TimerEvent):void{
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
} else {
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, connectWait);
_timer = null;
};
}
private static function listen():void{
_mochiLocalConnection.connect(_listenChannelName);
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
trace("Waiting for MochiAds services to connect...");
}
private static function initComChannels():void{
if (!_connected){
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"registerGame", preserved:_preserved, id:_id, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_clip.onReceive = onReceive;
_clip.onEvent = onEvent;
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
while (_queue.length > 0) {
_mochiLocalConnection.send(_sendChannelName, "onReceive", _queue.shift());
};
};
}
private static function onReceive(_arg1:Object):void{
var methodName:String;
var pkg = _arg1;
var cb:String = pkg.callbackID;
var cblst:Object = _callbacks[cb];
if (!cblst){
return;
};
var method:* = cblst.callbackMethod;
methodName = "";
var obj:Object = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete _callbacks[cb];
}
private static function onEvent(_arg1:Object):void{
var _local2:String = _arg1.target;
var _local3:String = _arg1.event;
switch (_local2){
case "services":
MochiServices.triggerEvent(_arg1.event, _arg1.args);
break;
case "events":
MochiEvents.triggerEvent(_arg1.event, _arg1.args);
break;
case "coins":
MochiCoins.triggerEvent(_arg1.event, _arg1.args);
break;
case "social":
MochiSocial.triggerEvent(_arg1.event, _arg1.args);
break;
};
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (((_clip) && (_queue))){
while (_queue.length > 0) {
_local2 = _queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _callbacks[_local2.callbackID];
};
delete _callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError("NotConnected");
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError("NotConnected");
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_nextCallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + _arg1));
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_queue.push({methodName:_arg1, args:_arg2, callbackID:_nextCallbackID});
};
if (_clip != null){
if (_callbacks != null){
_callbacks[_nextCallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_nextCallbackID++;
};
};
}
private static function urlOptions(_arg1:Object):Object{
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
var _local2:Object = {};
if (_arg1.stage){
_local3 = _arg1.stage.loaderInfo.parameters.mochiad_options;
} else {
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
};
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var avm1Click:DisplayObject;
var x:String;
var req:URLRequest;
var loader:Loader;
var setURL:Function;
var err:Function;
var complete:Function;
var url = _arg1;
var burl = _arg2;
var btn = _arg3;
var onClick = _arg4;
var vars:Object = new Object();
vars["mav"] = getVersion();
vars["swfv"] = "9";
vars["swfurl"] = btn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
var s = "?";
var i:Number = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://link.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
var _local2:Rectangle = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = _local2.x;
avm1Click.y = _local2.y;
avm1Click.scaleX = (0.01 * _local2.width);
avm1Click.scaleY = (0.01 * _local2.height);
};
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
setURL(burl);
};
complete = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local4:int;
var _local14:Loader;
var _local3:Array = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23];
var _local5:Array = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
var _local6:Array = [0, 64, 0, 0, 0];
var _local7:MovieClip = new MovieClip();
var _local8:LocalConnection = new LocalConnection();
var _local9:String = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().time));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
var _local10:ByteArray = new ByteArray();
var _local11:ByteArray = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
var _local12:uint = ((_local3.length + _local11.length) + 4);
var _local13:uint = (_local12 + 35);
_local10.endian = Endian.LITTLE_ENDIAN;
_local10.writeUTFBytes("FWS");
_local10.writeByte(8);
_local10.writeUnsignedInt(_local13);
for each (_local4 in _local5) {
_local10.writeByte(_local4);
};
_local10.writeUnsignedInt(_local12);
_local10.writeByte(136);
_local10.writeShort(_local11.length);
_local10.writeBytes(_local11);
for each (_local4 in _local3) {
_local10.writeByte(_local4);
};
for each (_local4 in _local6) {
_local10.writeByte(_local4);
};
_local14 = new Loader();
_local14.loadBytes(_local10);
_local7.addChild(_local14);
return (_local7);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
}
}//package mochi.as3
Section 278
//MochiSocial (mochi.as3.MochiSocial)
package mochi.as3 {
public class MochiSocial {
public static const LOGGED_IN:String = "LoggedIn";
public static const LOGGED_OUT:String = "LoggedOut";
public static const LOGIN_SHOW:String = "LoginShow";
public static const LOGIN_HIDE:String = "LoginHide";
public static const LOGIN_SHOWN:String = "LoginShown";
public static const PROFILE_SHOW:String = "ProfileShow";
public static const PROFILE_HIDE:String = "ProfileHide";
public static const PROPERTIES_SAVED:String = "PropertySaved";
public static const WIDGET_LOADED:String = "WidgetLoaded";
public static const FRIEND_LIST:String = "FriendsList";
public static const PROFILE_DATA:String = "ProfileData";
public static const GAMEPLAY_DATA:String = "GameplayData";
public static const ACTION_CANCELED:String = "onCancel";
public static const ACTION_COMPLETE:String = "onComplete";
public static const USER_INFO:String = "UserInfo";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IOError";
public static const NO_USER:String = "NoUser";
public static const PROPERTIES_SIZE:String = "PropertiesSize";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static var _user_info:Object = null;
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function getAPIURL():String{
if (!_user_info){
return (null);
};
return (_user_info.api_url);
}
public static function getAPIToken():String{
if (!_user_info){
return (null);
};
return (_user_info.api_token);
}
public static function showLoginWidget(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_showLoginWidget", {options:_arg1});
}
public static function hideLoginWidget():void{
MochiServices.send("social_hideLoginWidget");
}
public static function requestLogin(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestLogin", _arg1);
}
public static function showProfile(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.stayOnTop();
MochiServices.send("social_showProfile", _arg1);
}
public static function saveUserProperties(_arg1:Object):void{
MochiServices.send("social_saveUserProperties", _arg1);
}
public static function getFriendsList(_arg1:Object=null):void{
MochiServices.send("social_getFriendsList", _arg1);
}
public static function postToStream(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_postToStream", _arg1);
}
public static function inviteFriends(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_inviteFriends", _arg1);
}
public static function requestFan(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestFan", _arg1);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function get loggedIn():Boolean{
return (!((_user_info == null)));
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_user_info = _arg1;
});
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_user_info = null;
});
}
}//package mochi.as3
Section 279
//MochiUserData (mochi.as3.MochiUserData)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
public class MochiUserData extends EventDispatcher {
public var _loader:URLLoader;
public var key:String;// = null
public var data;// = null
public var error:Event;// = null
public var operation:String;// = null
public var callback:Function;// = null
public function MochiUserData(_arg1:String="", _arg2:Function=null){
this.key = _arg1;
this.callback = _arg2;
}
public function serialize(_arg1):ByteArray{
var _local2:ByteArray = new ByteArray();
_local2.objectEncoding = ObjectEncoding.AMF3;
_local2.writeObject(_arg1);
_local2.compress();
return (_local2);
}
public function deserialize(_arg1:ByteArray){
_arg1.objectEncoding = ObjectEncoding.AMF3;
_arg1.uncompress();
return (_arg1.readObject());
}
public function request(_arg1:String, _arg2:ByteArray):void{
var _operation = _arg1;
var _data = _arg2;
operation = _operation;
var api_url:String = MochiSocial.getAPIURL();
var api_token:String = MochiSocial.getAPIToken();
if ((((api_url == null)) || ((api_token == null)))){
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, "not logged in"));
return;
};
_loader = new URLLoader();
var args:URLVariables = new URLVariables();
args.op = _operation;
args.key = key;
var req:URLRequest = new URLRequest((((MochiSocial.getAPIURL() + "/") + "MochiUserData?") + args.toString()));
req.method = URLRequestMethod.POST;
req.contentType = "application/x-mochi-userdata";
req.requestHeaders = [new URLRequestHeader("x-mochi-services-version", MochiServices.getVersion()), new URLRequestHeader("x-mochi-api-token", api_token)];
req.data = _data;
_loader.dataFormat = URLLoaderDataFormat.BINARY;
_loader.addEventListener(Event.COMPLETE, completeHandler);
_loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
try {
_loader.load(req);
} catch(e:SecurityError) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + e.toString())));
};
}
public function completeHandler(_arg1:Event):void{
var event = _arg1;
try {
if (_loader.data.length){
data = deserialize(_loader.data);
} else {
data = null;
};
} catch(e:Error) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("deserialize error: " + e.toString())));
return;
};
if (callback != null){
performCallback();
} else {
dispatchEvent(event);
};
close();
}
public function errorHandler(_arg1:IOErrorEvent):void{
data = null;
error = _arg1;
if (callback != null){
performCallback();
} else {
dispatchEvent(_arg1);
};
close();
}
public function securityErrorHandler(_arg1:SecurityErrorEvent):void{
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.toString())));
}
public function performCallback():void{
try {
callback(this);
} catch(e:Error) {
trace(("[MochiUserData] exception during callback: " + e));
};
}
public function close():void{
if (_loader){
_loader.removeEventListener(Event.COMPLETE, completeHandler);
_loader.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
_loader.close();
_loader = null;
};
error = null;
callback = null;
}
public function getEvent():void{
request("get", serialize(null));
}
public function putEvent(_arg1):void{
request("put", serialize(_arg1));
}
override public function toString():String{
return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]"));
}
public static function get(_arg1:String, _arg2:Function):void{
var _local3:MochiUserData = new MochiUserData(_arg1, _arg2);
_local3.getEvent();
}
public static function put(_arg1:String, _arg2, _arg3:Function):void{
var _local4:MochiUserData = new MochiUserData(_arg1, _arg3);
_local4.putEvent(_arg2);
}
}
}//package mochi.as3
Section 280
//AA (AA)
package {
import gg.app.theater.actors.*;
public dynamic class AA extends Evil {
}
}//package
Section 281
//AB (AB)
package {
import gg.app.theater.actors.*;
public dynamic class AB extends Shape {
}
}//package
Section 282
//AC (AC)
package {
import gg.app.theater.actors.*;
public dynamic class AC extends Shape {
}
}//package
Section 283
//actorCoreParams (actorCoreParams)
package {
public function actorCoreParams(_arg1:String):Object{
var _local2:Object = new Object();
switch (_arg1){
case "AA":
_local2.physModel = "Rectangle";
break;
case "AB":
_local2.physModel = "Rectangle";
break;
case "AC":
_local2.physModel = "Concave";
_local2.polygons = [[[0.1, -28.85], [25, 14.45], [-25, 14.45]]];
break;
case "AD":
_local2.physModel = "Circle";
_local2.fixedScale = true;
break;
case "AP":
_local2.physModel = "Rectangle";
break;
case "BA":
_local2.physModel = "Circle";
break;
case "BB":
_local2.physModel = "Circle";
break;
case "BC":
_local2.physModel = "Circle";
break;
};
return (_local2);
}
}//package
Section 284
//AD (AD)
package {
import gg.app.theater.actors.*;
public dynamic class AD extends Shape {
}
}//package
Section 285
//AF (AF)
package {
import gg.engine.theater.actors.*;
public dynamic class AF extends RevoluteJoint {
}
}//package
Section 286
//AP (AP)
package {
import gg.engine.theater.actors.*;
public dynamic class AP extends MovingPlatform {
}
}//package
Section 287
//AQ (AQ)
package {
import gg.app.theater.actors.*;
public dynamic class AQ extends ExplosionAnimation {
}
}//package
Section 288
//arrow (arrow)
package {
import flash.display.*;
public dynamic class arrow extends MovieClip {
}
}//package
Section 289
//BA (BA)
package {
import gg.app.theater.actors.*;
public dynamic class BA extends CrashBall {
}
}//package
Section 290
//BangEyeAngry (BangEyeAngry)
package {
import gg.app.display.*;
public dynamic class BangEyeAngry extends Eye {
}
}//package
Section 291
//BangEyeNormal (BangEyeNormal)
package {
import gg.app.display.*;
public dynamic class BangEyeNormal extends Eye {
}
}//package
Section 292
//BB (BB)
package {
import gg.app.theater.actors.*;
public dynamic class BB extends BoomBall {
}
}//package
Section 293
//BC (BC)
package {
import gg.app.theater.actors.*;
public dynamic class BC extends BangBall {
}
}//package
Section 294
//BoomEyeAngry (BoomEyeAngry)
package {
import gg.app.display.*;
public dynamic class BoomEyeAngry extends Eye {
}
}//package
Section 295
//BoomEyeNormal (BoomEyeNormal)
package {
import gg.app.display.*;
public dynamic class BoomEyeNormal extends Eye {
}
}//package
Section 296
//BrandingSettings (BrandingSettings)
package {
public class BrandingSettings {
private static const _SPONSOR_URL:String = "http://www.godvilgames.com/";
private static const _SPONSOR_GAME_CODE:String = "hit-the-troll";
private static const _ANALYTICS_URL:String = (("?utm_source=our_game&utm_campaign=" + _SPONSOR_GAME_CODE) + "&utm_medium=");
private static const _SPONSOR_WITH_ANALYTICS_URL:String = (_SPONSOR_URL + _ANALYTICS_URL);
public static const GAME_NAME:String = "Hit The Troll";
public static const MOCHIBOT_ID:String = "aa9ca84e";
public static const MOCHIADS_GAME_ID:String = "d7a24be5c385fb03";
public static const HIGHSCORES_LEADERBOARD_ID:String = "70012f3db5fcc09a";
public static const SPRINT_LEADERBOARD_ID:String = "4f88aadf393cfdf3";
public static const CPMSTAR_CONTENT_SPOT_ID:String = "6229QD3A9A886";
public static const MORE_GAMES_URL:String = (_SPONSOR_WITH_ANALYTICS_URL + "more_games");
public static const PRELOADER_SPONSOR_LOGO_URL:String = (_SPONSOR_WITH_ANALYTICS_URL + "preloader_logo");
public static const PRELOADER_GAME_ICON_URL_END:String = (_ANALYTICS_URL + "preloader_game_icon");
public static const PRELOADER_BACKGROUND_URL:String = (_SPONSOR_WITH_ANALYTICS_URL + "preloader_background");
public static const HINT_URL:String = (((((_SPONSOR_URL + "walks/") + _SPONSOR_GAME_CODE) + ".html") + _ANALYTICS_URL) + "hint");
public static const ANY_GAME_URL_START:String = (_SPONSOR_URL + "games/");
public static const TRY_IT_URL:String = (((ANY_GAME_URL_START + "fanged-fun.html") + _ANALYTICS_URL) + "try_it");
public static const FACEBOOK_PAGE_URL:String = "http://www.facebook.com/GodvilGames";
public static const TWITTER_PAGE_URL:String = "http://www.twitter.com/GodvilGames";
public static const SHARING_URL_DESCRIPTION:String = "Funny physics-based puzzle game!";
public static const SHARING_URL:String = ((((((("http://api.addthis.com/oexchange/0.8/offer?url=" + ANY_GAME_URL_START) + _SPONSOR_GAME_CODE) + ".html") + "&title=") + GAME_NAME) + "&pubid=godvilgames&description=") + SHARING_URL_DESCRIPTION);
public static const ADD_TO_YOUR_SITE_URL:String = "http://www.godvilgames.com/freecontent/hit_the_troll/viral.rar";
public static const LOCKED_DOMAINS:Array = [];
public static const WIDTH:Number = 700;
public static const HEIGHT:Number = 525;
public static const Y8:String = "y8";
public static const Y8_URL:String = "http://y8.com/";
public static var BLOCKED_DOMAINS:Array = ["N2s3ay5jb20sMzgzOS5jb20sam9xb28uY29tLDY1NDMuY29tLGRpZ3VhMTIzLmNvbSwyMTQ0LmNuLDMzNjYuY29tLDM1MjUuY29tLDM4MzkuY29tLDQxOTkuY24sNDM5OXBrLmNvbSw0OTlway5jb20sNTE0Mzk5LmNvbSw1MjUzLmNvbSw2NTQ1LmNuLDY5NDkuY29tLDdrOGs4LmNvbSw4ODYuY29tLDg4eXguY29tLDk1NTUubmV0LGJhb2ZlbmcuY29tLGRpZ3VhMTIzLmNvbSxkdW93YW4uY29tLGYxMzMuY29tLGdhbWVhbmdlbC5jb20saDQzOTkuY29tLGpvcW9vLmNvbSxqb3lnYW1lcy5jb20sa280Mzk5LmNvbSxrdTQzOTkuY29tLGx5b3V4aS5jb20scWsxMDAuY29tLHMzMzY2LmNvbSx0b202MS5jb20sdTE0OC5uZXQseDQzOTkuY29tLHh1aXRlLm5ldCx5eDAwNy5jb20sNTUyMy5jb20sOTQ3Ny5jb20sMjM5OWcuY29tLDUwNjguY29tLDM4MzkuY29tLDdrNzcubmV0LDUwNjguY29tLDR1c2t5LmNvbSwzODM5LmNvbSw0Mzk5OS5jb20sMzM2Ni5jb20sNDM5OS5jb20="];
public static var LITE_BRANDED_DOMAINS:Array = ["a29uZ3JlZ2F0ZS5jb20sbmV3Z3JvdW5kcy5jb20sdXBsb2Fkcy51bmdyb3VuZGVkLm5ldCxnb2R2aWxnYW1lcy5jb20sbG9jYWxob3N0LGZsYXNoZ2FtZWRpc3RyaWJ1dGlvbi5jb20sZmxhc2hnYW1lbGljZW5zZS5jb20sbW9jaGltZWRpYS5jb20sbm90ZG9wcGxlci5jb20sdGFsa2FyY2FkZXMuY29tLHBsYXlqdXRzdS5jb20sa2Fpc2VyZ2FtZXMuZGUsbW9mdW56b25lLmNvbSxmZXR0c3BpZWxlbi5kZSxqYXlpc2dhbWVzLmNvbSx5OA=="];
}
}//package
Section 297
//CellRenderer_disabledSkin (CellRenderer_disabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_disabledSkin extends MovieClip {
}
}//package
Section 298
//CellRenderer_downSkin (CellRenderer_downSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_downSkin extends MovieClip {
}
}//package
Section 299
//CellRenderer_overSkin (CellRenderer_overSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_overSkin extends MovieClip {
}
}//package
Section 300
//CellRenderer_selectedDisabledSkin (CellRenderer_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDisabledSkin extends MovieClip {
}
}//package
Section 301
//CellRenderer_selectedDownSkin (CellRenderer_selectedDownSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDownSkin extends MovieClip {
}
}//package
Section 302
//CellRenderer_selectedOverSkin (CellRenderer_selectedOverSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedOverSkin extends MovieClip {
}
}//package
Section 303
//CellRenderer_selectedUpSkin (CellRenderer_selectedUpSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedUpSkin extends MovieClip {
}
}//package
Section 304
//CellRenderer_upSkin (CellRenderer_upSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_upSkin extends MovieClip {
}
}//package
Section 305
//CheckBox_disabledIcon (CheckBox_disabledIcon)
package {
import flash.display.*;
public dynamic class CheckBox_disabledIcon extends MovieClip {
}
}//package
Section 306
//CheckBox_downIcon (CheckBox_downIcon)
package {
import flash.display.*;
public dynamic class CheckBox_downIcon extends MovieClip {
}
}//package
Section 307
//CheckBox_overIcon (CheckBox_overIcon)
package {
import flash.display.*;
public dynamic class CheckBox_overIcon extends MovieClip {
}
}//package
Section 308
//CheckBox_selectedDisabledIcon (CheckBox_selectedDisabledIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedDisabledIcon extends MovieClip {
}
}//package
Section 309
//CheckBox_selectedDownIcon (CheckBox_selectedDownIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedDownIcon extends MovieClip {
}
}//package
Section 310
//CheckBox_selectedOverIcon (CheckBox_selectedOverIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedOverIcon extends MovieClip {
}
}//package
Section 311
//CheckBox_selectedUpIcon (CheckBox_selectedUpIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedUpIcon extends MovieClip {
}
}//package
Section 312
//CheckBox_upIcon (CheckBox_upIcon)
package {
import flash.display.*;
public dynamic class CheckBox_upIcon extends MovieClip {
}
}//package
Section 313
//ColumnStretch_cursor (ColumnStretch_cursor)
package {
import flash.display.*;
public dynamic class ColumnStretch_cursor extends MovieClip {
}
}//package
Section 314
//ComboBox_disabledSkin (ComboBox_disabledSkin)
package {
import flash.display.*;
public dynamic class ComboBox_disabledSkin extends MovieClip {
}
}//package
Section 315
//ComboBox_downSkin (ComboBox_downSkin)
package {
import flash.display.*;
public dynamic class ComboBox_downSkin extends MovieClip {
}
}//package
Section 316
//ComboBox_overSkin (ComboBox_overSkin)
package {
import flash.display.*;
public dynamic class ComboBox_overSkin extends MovieClip {
}
}//package
Section 317
//ComboBox_upSkin (ComboBox_upSkin)
package {
import flash.display.*;
public dynamic class ComboBox_upSkin extends MovieClip {
}
}//package
Section 318
//CrashEyeAngry (CrashEyeAngry)
package {
import gg.app.display.*;
public dynamic class CrashEyeAngry extends Eye {
}
}//package
Section 319
//CrashEyeNormal (CrashEyeNormal)
package {
import gg.app.display.*;
public dynamic class CrashEyeNormal extends Eye {
}
}//package
Section 320
//DataGrid_skin (DataGrid_skin)
package {
import flash.display.*;
public dynamic class DataGrid_skin extends MovieClip {
}
}//package
Section 321
//DataGridCellEditor_skin (DataGridCellEditor_skin)
package {
import flash.display.*;
public dynamic class DataGridCellEditor_skin extends MovieClip {
}
}//package
Section 322
//egg (egg)
package {
import gg.app.display.*;
public dynamic class egg extends EasterEgg {
}
}//package
Section 323
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 324
//HeaderRenderer_disabledSkin (HeaderRenderer_disabledSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_disabledSkin extends MovieClip {
}
}//package
Section 325
//HeaderRenderer_downSkin (HeaderRenderer_downSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_downSkin extends MovieClip {
}
}//package
Section 326
//HeaderRenderer_overSkin (HeaderRenderer_overSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_overSkin extends MovieClip {
}
}//package
Section 327
//HeaderRenderer_selectedDisabledSkin (HeaderRenderer_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedDisabledSkin extends MovieClip {
}
}//package
Section 328
//HeaderRenderer_selectedDownSkin (HeaderRenderer_selectedDownSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedDownSkin extends MovieClip {
}
}//package
Section 329
//HeaderRenderer_selectedOverSkin (HeaderRenderer_selectedOverSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedOverSkin extends MovieClip {
}
}//package
Section 330
//HeaderRenderer_selectedUpSkin (HeaderRenderer_selectedUpSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedUpSkin extends MovieClip {
}
}//package
Section 331
//HeaderRenderer_upSkin (HeaderRenderer_upSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_upSkin extends MovieClip {
}
}//package
Section 332
//HeaderSortArrow_ascIcon (HeaderSortArrow_ascIcon)
package {
import flash.display.*;
public dynamic class HeaderSortArrow_ascIcon extends MovieClip {
}
}//package
Section 333
//HeaderSortArrow_descIcon (HeaderSortArrow_descIcon)
package {
import flash.display.*;
public dynamic class HeaderSortArrow_descIcon extends MovieClip {
}
}//package
Section 334
//LevelPacks (LevelPacks)
package {
import flash.events.*;
import flash.net.*;
public class LevelPacks {
public static var xml:XML;
private static var _loader:URLLoader;
public static function load(_arg1:Boolean):void{
if (_arg1){
loadFromLocal();
} else {
loadFromAS3();
};
}
private static function loadFromLocal():void{
_loader = new URLLoader();
_loader.data = URLLoaderDataFormat.TEXT;
_loader.load(new URLRequest("LevelPacks.xml"));
_loader.addEventListener(Event.COMPLETE, onLoader_Complete, false, 0, true);
}
private static function onLoader_Complete(_arg1:Event):void{
_loader.removeEventListener(Event.COMPLETE, onLoader_Complete);
xml = new XML(_loader.data);
}
private static function loadFromAS3():void{
xml = new XML(<LevelPacks>
<LevelPack Name="First">
<Level>
<Code>eNpj0HF0sjIyMtUxMTfVsTTQMQRCAz2LGkdHsKixgYEOBJrpmMUbAgDXKwlY</Code>
</Level>
<Level>
<Code>eNpjCHN0sjI2NdABYQMdQx1zHQM90xpHRysjAwM9A1MdI3NToIiBCVDSWMdIzxSEQdKmcGk9Q5ACC7BuqIJ4IwAezRHk</Code>
</Level>
<Level>
<Code>eNpj8HR0tDI0NdAxMjfVMQBCIxCsAQqaIgkaQwRdwCqNTUFChiCuKYIbbwIAT2IP2g==</Code>
</Level>
<Level>
<Code>eNptjdENwyAMRNUZsoaD7ANDyx/JIF0kw9cGolRRhO6Dd8/2a2l7LUpiWTOTHK31v3DIxIFBTJFAOEzMuJkd/KtpqK0CKXyU8C5e9jebVG6NnE1UWyAY22RMeLPVyNbYYZc5qMdxesa+x+M4n1DNhUXGwUkx6Xrhb/kBPLE5kg==</Code>
</Level>
<Level>
<Code>eNpVjkEKwzAMBGnfI8JKytrUN+fQb/QjeXytxAIHHQTDMOzr3Y/mhFilYIMLxqP42XsrRlGvW2FQoZjYmT4gH0z7omFPqkl74yBe7wAyEHDnomqoOrRIx3mqAfdRflZDW5aVdVnVh/y9oNuckMBwA/3xD2ZtNl8=</Code>
</Level>
<Level>
<Code>eNpljMsNgCAQRC1oYvbDStwbHGjDRqjIKkVIiMTs6b2Zne1O2QMZ5DQQuKbkagbVF9vVlncRh1DQfnT5fcouLQ88MeiKc3KU/8i87BdXoS4jjIggFz/ZIyWg</Code>
</Level>
<Level>
<Code>eNptjksOgCAMRD1QNdAPUXcQ7+FFuLg7O8W4IoRF3xs6LE+tp7FR1kTjMHGvLSAnc5BJKW2le1IAzSIngCTArFOcywS3SIvf9cBu4NjeIj8VqJ2I61RxsccnURijjEKF93d6/BqTfvaWF35GNcI=</Code>
</Level>
<Level>
<Code>eNp1kEEOwzAIBNX/0AhjoI5vyaXP6Ef6+LLGjapUEfKBYVnAt+e299KYRIw4QogXfwesbFQqUIkQIC+BVhuopm7rrjx12T6UNYC0VPrXUf2vfe+CMcnsYHYhRCH3mcNV0T03B8DW51w0AcPGIjE+2QCq5gUD5hXaSAvdMYNkOX4GeI33g1+PD70LRZM=</Code>
</Level>
<Level>
<Code>eNpVjsENgDAMAxkoQmmcFNRfeXQNFmEipiQRFKjyOss+ZTrrVtSYwExxSjznI0IYQSNKgbYYSR4xvQjhf1l42IqXux+3vxaTLnxa6rrVgvwJT1pB/na84wK76yVf</Code>
</Level>
<Level>
<Code>eNptkMsRwjAMRId+BCPrYye5hQNnOqARSqBoVjYOcSbHvMnuPvnyWe+LKZNMTFdzYjLiW34DOzulIOnP9ISl2cmRnoNKpzmdUS/Ia5vaVcR6Gnufi+M/lYCBuc0DoXEeBKzAGulKdRPAuuQjjVv70maFA0wHtgbTwnW8MpIqMMVVhwfwzBvUntfEVJo8x7cjadYKoxJ1j8UgJ/KDL/0Cw/FUZg==</Code>
</Level>
<Level>
<Code>eNptjdENgzAMBTuQi15eHCfNH0zABizCwIxRp5AqVZG/7mS9exzzUqlJwisJ/KJgst2lJgiBX2m5f4aGHGit6kieMxQ0xYxBPUPBZyVCNH9X8kBzNe/q1Q3eLcKm7y2diF7s1sqf3uwNgPkyWA==</Code>
</Level>
<Level>
<Code>eNpdj10OAjEIhD0QMfyUbpc3VuM1vEjvrpTWTdzwQr7MMMzt44cpKTAijCmA99r9aVoVSDQhA/fQVYpVBqCY1D0SShygFri7G3MsZRoxbaygCrKFaZ0/jEIlO16oZIJmwgk5LpfyB1fKfqa4yYhos4SEqo2fff68rRrdX1aiwK8svuULFsY3Mw==</Code>
</Level>
<Level>
<Code>eNpljmsKw0AIhOl9pIyPySb5l1ykF8nh6yYsrC0i6PCNzovHuS+NEqBANMuulEiKGm4pRK9BUbZJ8vZHaSKGm3x2o/DHtUIiXQOxBnGtu1mPgxGnW9yLpJ1aUR5ZXpk/WebziSFyDpTLycdWEdrIf+x0yPI40vOO3h//Ap1JQsU=</Code>
</Level>
<Level>
<Code>eNptT0EOwzAI0/6DKiAkWblRVbvvBftIHz8gU7qpU8TBxrHN7Wmb8orApQL6E8BFDidLq8DrIAn4sF2p+74lcZgNSAiTKPcKhIPA+FBcEZP7XcXtpE95ws9/pxaJiWjyDMrokRNw1ps6y4rUx4JHSdN63uKMX9PC0lXcp2P7L2r8pdq0yk+NhNcaD2U83fBV3yK5SGw=</Code>
</Level>
<Level>
<Code>eNpNjckNwCAQA1PQPvbg/iGljzRCl2koBhFAfBiPrb3eehf1ntQ8MUmrdaCkjngNXiKCsPxAObwDWFx+oC6PICPI5wDg3BzcxXDbeO2D4mO86yNIvOtMjv92H+tsGwnpYx/ZPy7e</Code>
</Level>
<Level>
<Code>eNpljkEOwzAIBPugVQQY3ISbrfyjH+nPeymYSJVSoT14PCt4fMZ0VYNECAwFv8dwYwM/CQchR5JOl7s4fXlFaOvQLGcxkxPfkBRb9Jr+zNW2Tnc4limHrbqiXQeF+QdjsVLt4WKnyx6PvUTeNJM41V7iRV/2BR29Nfo=</Code>
</Level>
<Level>
<Code>eNpjaHR0tDK0NNUxtDTQAcMaRyewgJEJiGsI4hqbm+oYG5iCuDqGeiYgXAPUBhI2MjaFaENIOFmZmgHVm2OoBwsboKmPNwQAOXQbpQ==</Code>
</Level>
<Level>
<Code>eNptkMsNAzEIBZV+iGUw/uzenMO2kUbSX9oKvHUUR2v5Nn7AwO3dH7tqJm6Ztkj2QqH0ciqZpAABSlDHkhe4I83WBxi5tGoq2zfGgAzIC5jaAmpZlZsRR0zioSSuBD4rwfES9PmRJop9kkZKdaxpvwg61DGeg57j2Zyy/MEO6LJnOT6gZIcrk5GXMvn5fycqibQ2us/02LM5+jlH6bFzncCzfgAgrWE/</Code>
</Level>
<Level>
<Code>eNpVjd0NhDAMgxkoSPnzVdc3EHuwCPPeHJe0pQLlIfIX21l+217hIGOmWBKjVzAvwQy0BuQOtwph0g+oMZtWjyjjET+qfEGqLZrBlFJSxtx3L+Pepb3tNuwTuD5A/sToI+8lyYRnJ+T+KSf+Jgwyqw==</Code>
</Level>
<Level>
<Code>eNpdj0EOAyEIRXsgphEUVHZOk657g17Eg3dZUJo0Ezby+Dzi7TNOzZKAKIGXQLq3OV7KiSH3DREObGmOoaUxYOVNHVC+gLXHG5RpdmR7CC8NmV08JWgwTpr4odk8neHoS3OqKR2F1Dpq/EuvKZb/aQ2V3/CA2G6pATz1jF+G5M1f6RE2gA==</Code>
</Level>
</LevelPack>
</LevelPacks>
);
}
}
}//package
Section 335
//List_skin (List_skin)
package {
import flash.display.*;
public dynamic class List_skin extends MovieClip {
}
}//package
Section 336
//Main (Main)
package {
import flash.display.*;
import gg.engine.utils.*;
import flash.events.*;
import gg.engine.common.*;
import gg.engine.*;
import gg.engine.ui.*;
import gg.app.display.*;
import gg.app.display.windows.dialogs.*;
import gg.app.display.windows.sheets.*;
import flash.ui.*;
public class Main {
public static var inited:Boolean;
public static var container:DisplayObjectContainer;
public static var engine:Engine;
public static function init(_arg1:DisplayObjectContainer):void{
if (inited){
throw (new Error("you can only call Main.init once"));
};
if (!_arg1.stage){
throw (new Error("container must be added to the stage"));
};
container = _arg1;
engine = new Engine(container, Settings.COOKIE_FILE_NAME);
engine.guiMgr.background = new Background();
engine.guiMgr.hud = new HUD(["soundOnOff", "btnAddToYourSite", "btnCredits"]);
engine.levelMgr.load(LevelPacks.xml);
engine.guiMgr.onSheetOpening.addListener(onGuiMgr_SheetOpening);
engine.achievementMgr.onObtain.addListener(onAchievementMgr_AchievementObtain);
engine.soundMgr.onChange.addListener(onSoundMgr_Change);
engine.keyboardMgr.onKeyDown.addListener(onKeyboardMgr_KeyDown);
LevelCode.paramNames = ["theater", "balls"];
setupSheets();
setupDialogs();
setupHUD();
setupSound();
setupAchievements();
setupContextMenu();
engine.load();
updateSoundOnOff();
inited = true;
engine.guiMgr.openWindow("MainMenu", {});
}
private static function setupSheets():void{
engine.guiMgr.registerWindow(MainMenu, "MainMenu");
engine.guiMgr.registerWindow(LevelEditor, "LevelEditor");
engine.guiMgr.registerWindow(LevelSelection, "LevelSelection");
engine.guiMgr.registerWindow(Game, "Game");
engine.guiMgr.registerWindow(Achievements, "Achievements");
}
private static function setupDialogs():void{
engine.guiMgr.registerWindow(Message, "Message");
engine.guiMgr.registerWindow(Options, "Options");
engine.guiMgr.registerWindow(SaveLoadLevel, "SaveLoadLevel");
engine.guiMgr.registerWindow(LevelEditorPanel, "LevelEditorPanel");
engine.guiMgr.registerWindow(CustomLevelComplete, "CustomLevelComplete");
engine.guiMgr.registerWindow(CustomLevelFailed, "CustomLevelFailed");
engine.guiMgr.registerWindow(OfficialLevelComplete, "OfficialLevelComplete");
engine.guiMgr.registerWindow(LevelEditorSettings, "LevelEditorSettings");
engine.guiMgr.registerWindow(SprintFinished, "SprintFinished");
engine.guiMgr.registerWindow(AchievementObtained, "AchievementObtained");
}
private static function setupHUD():void{
var _local1:HUD = (engine.guiMgr.hud as HUD);
_local1.addState("GameOfficialLevel", ["btnMoreGames", "soundOnOff", "btnRestart", "btnHint", "btnBack", "txtScore", "txtLevelIndex", "ballPanel"]);
_local1.addState("GameCustomLevel", ["btnMoreGames", "soundOnOff", "btnRestart", "btnHint", "btnBack", "txtScore", "ballPanel"]);
_local1.addState("GameSprint", ["btnMoreGames", "soundOnOff", "btnRestart", "btnHint", "btnBack", "txtTime", "txtLevelsBeaten", "ballPanel"]);
_local1.addState("MainMenu", ["btnMoreGames", "soundOnOff", "btnCredits", "btnAddToYourSite"]);
_local1.addState("LevelSelection", ["btnMoreGames", "soundOnOff"]);
_local1.addState("Achievements", ["btnMoreGames", "soundOnOff"]);
_local1.addState("LevelEditor", []);
_local1.soundOnOff.buttonMode = true;
_local1.btnMoreGames.buttonMode = true;
_local1.soundOnOff.addEventListener(MouseEvent.CLICK, onHUD_SoundOnOff_Click);
_local1.btnMoreGames.addEventListener(MouseEvent.CLICK, onHUD_MoreGames_Click);
_local1.btnCredits.addEventListener(MouseEvent.CLICK, onHUD_Credits_Click);
_local1.btnAddToYourSite.addEventListener(MouseEvent.CLICK, onHUD_AddToYourSite_Click);
}
private static function setupSound():void{
engine.soundMgr.registerMusic(SoundTheme, "Theme");
engine.soundMgr.registerSFX(SoundClick, "Click");
engine.soundMgr.registerSFX(SoundWin, "Win");
engine.soundMgr.registerSFX(SoundWind, "Wind");
engine.soundMgr.registerSFX(SoundFail, "Fail");
engine.soundMgr.registerSFX(SoundExplosion, "Explosion");
engine.soundMgr.pushMusicToPlayList("Theme", 0, int.MAX_VALUE);
}
private static function setupAchievements():void{
engine.achievementMgr.registerAchievement("Beat 5 levels");
engine.achievementMgr.registerAchievement("Beat 10 levels");
engine.achievementMgr.registerAchievement("Beat the game");
engine.achievementMgr.registerAchievement("Beat 10 levels in sprint");
engine.achievementMgr.registerAchievement("Beat a custom level");
engine.achievementMgr.registerAchievement("Submit highscores");
engine.achievementMgr.registerAchievement("Click on more games");
}
private static function setupContextMenu():void{
container.contextMenu = new ContextMenu();
container.contextMenu.hideBuiltInItems();
var _local1:ContextMenuItem = new ContextMenuItem("More Games!");
_local1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onContextMenu_MoreGames_MenuItemSelect);
container.contextMenu.customItems.push(_local1);
_local1 = new ContextMenuItem("Credits");
_local1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onContextMenu_Credits_MenuItemSelect);
_local1.separatorBefore = true;
container.contextMenu.customItems.push(_local1);
_local1 = new ContextMenuItem("Options");
_local1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onContextMenu_Options_MenuItemSelect);
_local1.separatorBefore = true;
container.contextMenu.customItems.push(_local1);
_local1 = new ContextMenuItem("Music Off");
_local1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onContextMenu_MusicOff_MenuItemSelect);
_local1.separatorBefore = true;
container.contextMenu.customItems.push(_local1);
_local1 = new ContextMenuItem("Music On");
_local1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onContextMenu_MusicOn_MenuItemSelect);
container.contextMenu.customItems.push(_local1);
_local1 = new ContextMenuItem("SFX Off");
_local1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onContextMenu_SFXOff_MenuItemSelect);
container.contextMenu.customItems.push(_local1);
_local1 = new ContextMenuItem("SFX On");
_local1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onContextMenu_SFXOn_MenuItemSelect);
container.contextMenu.customItems.push(_local1);
}
private static function updateSoundOnOff():void{
if (((engine.soundMgr.musicMuting) && (engine.soundMgr.sfxMuting))){
engine.guiMgr.hud.soundOnOff.gotoAndStop("off");
} else {
engine.guiMgr.hud.soundOnOff.gotoAndStop("on");
};
}
private static function onGuiMgr_SheetOpening():void{
engine.soundMgr.playSFX("Wind");
}
private static function onSoundMgr_Change():void{
updateSoundOnOff();
}
private static function onAchievementMgr_AchievementObtain():void{
engine.guiMgr.openWindow("AchievementObtained", {});
}
private static function onKeyboardMgr_KeyDown(_arg1:uint):void{
if (_arg1 == KeyboardManager.M){
onHUD_SoundOnOff_Click(null);
};
if (_arg1 == KeyboardManager.T){
EasterEgg.toggleEgg(engine.guiMgr);
};
}
private static function onHUD_SoundOnOff_Click(_arg1:MouseEvent):void{
if (engine.guiMgr.hud.soundOnOff.currentLabel == "on"){
engine.soundMgr.musicMuting = true;
engine.soundMgr.sfxMuting = true;
} else {
engine.soundMgr.musicMuting = false;
engine.soundMgr.sfxMuting = false;
};
}
private static function onHUD_MoreGames_Click(_arg1:MouseEvent):void{
openURL(BrandingSettings.MORE_GAMES_URL);
}
private static function showCredits():void{
engine.guiMgr.openWindow("Message", {message:"Programming — Alexey Stashin\n\nArt — Yuri (derecstar) Stepanov\n\nLevel Design — Igor (Terrax) Makeenko\n\nGodvilGames@gmail.com, 2012", title:"ABOUT"});
}
private static function onHUD_Credits_Click(_arg1:MouseEvent):void{
showCredits();
}
private static function onHUD_AddToYourSite_Click(_arg1:MouseEvent):void{
openURL(BrandingSettings.ADD_TO_YOUR_SITE_URL);
}
private static function onContextMenu_MoreGames_MenuItemSelect(_arg1:ContextMenuEvent):void{
engine.achievementMgr.obtainAchievement("Click on more games");
openURL(BrandingSettings.MORE_GAMES_URL);
}
private static function onContextMenu_Credits_MenuItemSelect(_arg1:ContextMenuEvent):void{
showCredits();
}
private static function onContextMenu_Options_MenuItemSelect(_arg1:ContextMenuEvent):void{
engine.guiMgr.openWindow("Options", {});
}
private static function onContextMenu_MusicOff_MenuItemSelect(_arg1:ContextMenuEvent):void{
engine.soundMgr.musicMuting = true;
}
private static function onContextMenu_MusicOn_MenuItemSelect(_arg1:ContextMenuEvent):void{
engine.soundMgr.musicMuting = false;
}
private static function onContextMenu_SFXOff_MenuItemSelect(_arg1:ContextMenuEvent):void{
engine.soundMgr.sfxMuting = true;
}
private static function onContextMenu_SFXOn_MenuItemSelect(_arg1:ContextMenuEvent):void{
engine.soundMgr.sfxMuting = false;
}
}
}//package
Section 337
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
if (Security.sandboxType == "localWithFile"){
return (null);
};
var _local3:MochiBot = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
var _local4 = "http://core.mochibot.com/my/core.swf";
var _local5:URLVariables = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
var _local6:String = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
var _local7:URLRequest = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
var _local8:Loader = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 338
//Preloader (Preloader)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import mochi.as3.*;
import gg.app.*;
public dynamic class Preloader extends MovieClip {
public var preloader:BrandedPreloader;
public function Preloader(){
stop();
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function onAddedToStage(_arg1:Event):void{
MochiServices.connect(BrandingSettings.MOCHIADS_GAME_ID, this);
stage.showDefaultContextMenu = false;
stage.scaleMode = StageScaleMode.NO_SCALE;
preloader.init(playCallback);
LevelPacks.load(Settings.LOAD_LEVEL_PACKS_FROM_LOCAL);
}
private function playCallback():void{
MochiBot.track(this, BrandingSettings.MOCHIBOT_ID);
stage.frameRate = Settings.FPS;
preloader._1();
gotoAndStop(2);
getDefinitionByName("Main").init(this);
}
}
}//package
Section 339
//ScrollArrowDown_disabledSkin (ScrollArrowDown_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_disabledSkin extends MovieClip {
}
}//package
Section 340
//ScrollArrowDown_downSkin (ScrollArrowDown_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_downSkin extends MovieClip {
}
}//package
Section 341
//ScrollArrowDown_overSkin (ScrollArrowDown_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_overSkin extends MovieClip {
}
}//package
Section 342
//ScrollArrowDown_upSkin (ScrollArrowDown_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_upSkin extends MovieClip {
}
}//package
Section 343
//ScrollArrowUp_disabledSkin (ScrollArrowUp_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_disabledSkin extends MovieClip {
}
}//package
Section 344
//ScrollArrowUp_downSkin (ScrollArrowUp_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_downSkin extends MovieClip {
}
}//package
Section 345
//ScrollArrowUp_overSkin (ScrollArrowUp_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_overSkin extends MovieClip {
}
}//package
Section 346
//ScrollArrowUp_upSkin (ScrollArrowUp_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_upSkin extends MovieClip {
}
}//package
Section 347
//ScrollBar_thumbIcon (ScrollBar_thumbIcon)
package {
import flash.display.*;
public dynamic class ScrollBar_thumbIcon extends MovieClip {
}
}//package
Section 348
//ScrollThumb_downSkin (ScrollThumb_downSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_downSkin extends MovieClip {
}
}//package
Section 349
//ScrollThumb_overSkin (ScrollThumb_overSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_overSkin extends MovieClip {
}
}//package
Section 350
//ScrollThumb_upSkin (ScrollThumb_upSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_upSkin extends MovieClip {
}
}//package
Section 351
//ScrollTrack_skin (ScrollTrack_skin)
package {
import flash.display.*;
public dynamic class ScrollTrack_skin extends MovieClip {
}
}//package
Section 352
//Settings (Settings)
package {
import fl.motion.easing.*;
public class Settings {
public static const COOKIE_FILE_NAME:String = "Hit_The_Troll";
public static const LOAD_LEVEL_PACKS_FROM_LOCAL:Boolean = false;
public static const WIDTH:Number = 700;
public static const HEIGHT:Number = 525;
public static const THEATER_WIDTH:Number = 8192;
public static const THEATER_HEIGHT:Number = 8192;
public static const GAME_INIT_SCORE:int = 1000;
public static const GAME_ADDITION_SCORE:int = 100;
public static const FPS:int = 30;
public static const PHYS_DT:Number = 0.0333333333333333;
public static const PHYS_ITERATIONS:int = 10;
public static const PHYS_SCALE:Number = 30;
public static const INV_PHYS_SCALE:Number = 0.0333333333333333;
public static const HALF_INV_PHYS_SCALE:Number = 0.0166666666666667;
public static const DEFAULT_GRAVITY_X:Number = 0;
public static const DEFAULT_GRAVITY_Y:Number = 10;
public static const DEFAULT_DENSITY:Number = 100;
public static const DEFAULT_FRICTION:Number = 0.5;
public static const DEFAULT_RESTITUTION:Number = 0;
public static const CRASH_DENSITY:Number = 200;
public static const CRASH_RESTITUTION:Number = 0.1;
public static const CRASH_FRICTION:Number = 0.25;
public static const CRASH_LAUNCH_VELOCITY:Number = 20000;
public static const BANG_FRICTION:Number = 0.01;
public static const BANG_DENSITY:Number = 20;
public static const BANG_RESTITUTION:Number = 0.95;
public static const BANG_LAUNCH_VELOCITY:Number = 2000;
public static const BOOM_FRICTION:Number = 0;
public static const BOOM_DENSITY:Number = 1.1;
public static const BOOM_RESTITUTION:Number = 0;
public static const BOOM_LAUNCH_VELOCITY:Number = 110;
public static const BALL_LIFETIME:Number = 8;
public static const GAME_OVER_MIN_DELAY:Number = 2;
public static const SHEET_EASE:Function = Cubic.easeInOut;
public static const SHEET_OPEN_TWEEN_TIME:Number = 0.55;
public static const SHEET_OPEN_POS_X:Number = -(WIDTH);
public static const SHEET_OPEN_POS_Y:Number = 0;
public static const SHEET_SHOW_POS_X:Number = 0;
public static const SHEET_SHOW_POS_Y:Number = 0;
public static const SHEET_CLOSE_TWEEN_TIME:Number = 0.55;
public static const SHEET_CLOSE_POS_X:Number = 700;
public static const SHEET_CLOSE_POS_Y:Number = 0;
public static const SHEET_ALPHA_TWEENING:Boolean = false;
public static const DIALOG_OPEN_TWEEN_TIME:Number = 0.55;
public static const DIALOG_CLOSE_TWEEN_TIME:Number = 0.55;
public static const MODAL_DIALOG_OPEN_TWEEN_TIME:Number = 0.55;
public static const MODAL_DIALOG_CLOSE_TWEEN_TIME:Number = 0.55;
}
}//package
Section 353
//SliderThumb_disabledSkin (SliderThumb_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_disabledSkin extends MovieClip {
}
}//package
Section 354
//SliderThumb_downSkin (SliderThumb_downSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_downSkin extends MovieClip {
}
}//package
Section 355
//SliderThumb_overSkin (SliderThumb_overSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_overSkin extends MovieClip {
}
}//package
Section 356
//SliderThumb_upSkin (SliderThumb_upSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_upSkin extends MovieClip {
}
}//package
Section 357
//SliderTick_skin (SliderTick_skin)
package {
import flash.display.*;
public dynamic class SliderTick_skin extends MovieClip {
}
}//package
Section 358
//SliderTrack_disabledSkin (SliderTrack_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderTrack_disabledSkin extends MovieClip {
}
}//package
Section 359
//SliderTrack_skin (SliderTrack_skin)
package {
import flash.display.*;
public dynamic class SliderTrack_skin extends MovieClip {
}
}//package
Section 360
//SoundClick (SoundClick)
package {
import flash.media.*;
public dynamic class SoundClick extends Sound {
}
}//package
Section 361
//SoundExplosion (SoundExplosion)
package {
import flash.media.*;
public dynamic class SoundExplosion extends Sound {
}
}//package
Section 362
//SoundFail (SoundFail)
package {
import flash.media.*;
public dynamic class SoundFail extends Sound {
}
}//package
Section 363
//SoundTheme (SoundTheme)
package {
import flash.media.*;
public dynamic class SoundTheme extends Sound {
}
}//package
Section 364
//SoundWin (SoundWin)
package {
import flash.media.*;
public dynamic class SoundWin extends Sound {
}
}//package
Section 365
//SoundWind (SoundWind)
package {
import flash.media.*;
public dynamic class SoundWind extends Sound {
}
}//package
Section 366
//TextArea_disabledSkin (TextArea_disabledSkin)
package {
import flash.display.*;
public dynamic class TextArea_disabledSkin extends MovieClip {
}
}//package
Section 367
//TextArea_upSkin (TextArea_upSkin)
package {
import flash.display.*;
public dynamic class TextArea_upSkin extends MovieClip {
}
}//package
Section 368
//TextInput_disabledSkin (TextInput_disabledSkin)
package {
import flash.display.*;
public dynamic class TextInput_disabledSkin extends MovieClip {
}
}//package
Section 369
//TextInput_upSkin (TextInput_upSkin)
package {
import flash.display.*;
public dynamic class TextInput_upSkin extends MovieClip {
}
}//package
Section 370
//Waves (Waves)
package {
import flash.display.*;
public dynamic class Waves extends MovieClip {
}
}//package