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(){
this.localPosition = new b2Vec2(0, 0);
super();
type = b2Shape.e_circleShape;
this.radius = 1;
}
}
}//package Box2D.Collision.Shapes
Section 2
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2CircleShape extends b2Shape {
b2internal var m_localPosition:b2Vec2;
b2internal var m_radius:Number;
public function b2CircleShape(_arg1:b2ShapeDef){
this.m_localPosition = new b2Vec2();
super(_arg1);
var _local2:b2CircleDef = (_arg1 as b2CircleDef);
m_type = e_circleShape;
this.m_localPosition.SetV(_local2.localPosition);
this.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 * this.m_localPosition.x) + (_local3.col2.x * this.m_localPosition.y)));
var _local5:Number = (_arg1.position.y + ((_local3.col1.y * this.m_localPosition.x) + (_local3.col2.y * this.m_localPosition.y)));
_local4 = (_arg2.x - _local4);
_local5 = (_arg2.y - _local5);
return ((((_local4 * _local4) + (_local5 * _local5)) <= (this.m_radius * this.m_radius)));
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):int{
var _local6:b2Mat22 = _arg1.R;
var _local7:Number = (_arg1.position.x + ((_local6.col1.x * this.m_localPosition.x) + (_local6.col2.x * this.m_localPosition.y)));
var _local8:Number = (_arg1.position.y + ((_local6.col1.y * this.m_localPosition.x) + (_local6.col2.y * this.m_localPosition.y)));
var _local9:Number = (_arg4.p1.x - _local7);
var _local10:Number = (_arg4.p1.y - _local8);
var _local11:Number = (((_local9 * _local9) + (_local10 * _local10)) - (this.m_radius * this.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 * this.m_localPosition.x) + (_local3.col2.x * this.m_localPosition.y)));
var _local5:Number = (_arg2.position.y + ((_local3.col1.y * this.m_localPosition.x) + (_local3.col2.y * this.m_localPosition.y)));
_arg1.lowerBound.Set((_local4 - this.m_radius), (_local5 - this.m_radius));
_arg1.upperBound.Set((_local4 + this.m_radius), (_local5 + this.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 * this.m_localPosition.x) + (_local4.col2.x * this.m_localPosition.y)));
var _local6:Number = (_arg2.position.y + ((_local4.col1.y * this.m_localPosition.x) + (_local4.col2.y * this.m_localPosition.y)));
_local4 = _arg3.R;
var _local7:Number = (_arg3.position.x + ((_local4.col1.x * this.m_localPosition.x) + (_local4.col2.x * this.m_localPosition.y)));
var _local8:Number = (_arg3.position.y + ((_local4.col1.y * this.m_localPosition.x) + (_local4.col2.y * this.m_localPosition.y)));
_arg1.lowerBound.Set((((_local5 < _local7)) ? _local5 : _local7 - this.m_radius), (((_local6 < _local8)) ? _local6 : _local8 - this.m_radius));
_arg1.upperBound.Set((((_local5 > _local7)) ? _local5 : _local7 + this.m_radius), (((_local6 > _local8)) ? _local6 : _local8 + this.m_radius));
}
override public function ComputeMass(_arg1:b2MassData):void{
_arg1.mass = (((m_density * b2Settings.b2_pi) * this.m_radius) * this.m_radius);
_arg1.center.SetV(this.m_localPosition);
_arg1.I = (_arg1.mass * (((0.5 * this.m_radius) * this.m_radius) + ((this.m_localPosition.x * this.m_localPosition.x) + (this.m_localPosition.y * this.m_localPosition.y))));
}
public function GetLocalPosition():b2Vec2{
return (this.m_localPosition);
}
public function GetRadius():Number{
return (this.m_radius);
}
override b2internal function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:Number = (this.m_localPosition.x - _arg1.x);
var _local3:Number = (this.m_localPosition.y - _arg1.y);
_local2 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
m_sweepRadius = ((_local2 + this.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 = this.categoryBits;
_local1.maskBits = this.maskBits;
_local1.groupIndex = this.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(){
this.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(){
this.vertices = new Array(b2Settings.b2_maxPolygonVertices);
super();
type = b2Shape.e_polygonShape;
this.vertexCount = 0;
var _local1:int;
while (_local1 < b2Settings.b2_maxPolygonVertices) {
this.vertices[_local1] = new b2Vec2();
_local1++;
};
}
public function SetAsBox(_arg1:Number, _arg2:Number):void{
this.vertexCount = 4;
this.vertices[0].Set(-(_arg1), -(_arg2));
this.vertices[1].Set(_arg1, -(_arg2));
this.vertices[2].Set(_arg1, _arg2);
this.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;
this.vertexCount = 4;
this.vertices[0].Set(-(_arg1), -(_arg2));
this.vertices[1].Set(_arg1, -(_arg2));
this.vertices[2].Set(_arg1, _arg2);
this.vertices[3].Set(-(_arg1), _arg2);
if (_arg3){
_local5 = _arg3;
_local6 = s_mat;
_local6.Set(_arg4);
_local7 = 0;
while (_local7 < this.vertexCount) {
_arg3 = this.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.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2PolygonShape extends b2Shape {
private var s_supportVec:b2Vec2;
b2internal var m_centroid:b2Vec2;
private var m_obb:b2OBB;
b2internal var m_vertices:Array;
b2internal var m_normals:Array;
private var m_coreVertices:Array;
b2internal 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;
this.s_supportVec = new b2Vec2();
this.m_obb = new b2OBB();
this.m_vertices = new Array(b2Settings.b2_maxPolygonVertices);
this.m_normals = new Array(b2Settings.b2_maxPolygonVertices);
this.m_coreVertices = new Array(b2Settings.b2_maxPolygonVertices);
super(_arg1);
m_type = e_polygonShape;
var _local2:b2PolygonDef = (_arg1 as b2PolygonDef);
this.m_vertexCount = _local2.vertexCount;
var _local4:int = _local3;
var _local5:int = _local3;
_local3 = 0;
while (_local3 < this.m_vertexCount) {
this.m_vertices[_local3] = _local2.vertices[_local3].Copy();
_local3++;
};
_local3 = 0;
while (_local3 < this.m_vertexCount) {
_local4 = _local3;
_local5 = (((_local3 + 1) < this.m_vertexCount)) ? (_local3 + 1) : 0;
_local6 = (this.m_vertices[_local5].x - this.m_vertices[_local4].x);
_local7 = (this.m_vertices[_local5].y - this.m_vertices[_local4].y);
_local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
this.m_normals[_local3] = new b2Vec2((_local7 / _local8), (-(_local6) / _local8));
_local3++;
};
this.m_centroid = ComputeCentroid(_local2.vertices, _local2.vertexCount);
ComputeOBB(this.m_obb, this.m_vertices, this.m_vertexCount);
_local3 = 0;
while (_local3 < this.m_vertexCount) {
_local4 = (((_local3 - 1) >= 0)) ? (_local3 - 1) : (this.m_vertexCount - 1);
_local5 = _local3;
_local9 = this.m_normals[_local4].x;
_local10 = this.m_normals[_local4].y;
_local11 = this.m_normals[_local5].x;
_local12 = this.m_normals[_local5].y;
_local13 = (this.m_vertices[_local3].x - this.m_centroid.x);
_local14 = (this.m_vertices[_local3].y - this.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)));
this.m_coreVertices[_local3] = new b2Vec2(((_local17 * ((_local12 * _local15) - (_local10 * _local16))) + this.m_centroid.x), ((_local17 * ((_local9 * _local16) - (_local11 * _local15))) + this.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 < this.m_vertexCount) {
_local3 = this.m_vertices[_local9];
_local5 = (_local7 - _local3.x);
_local6 = (_local8 - _local3.y);
_local3 = this.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 < this.m_vertexCount) {
_local11 = this.m_vertices[_local19];
_local8 = (_local11.x - _local12);
_local9 = (_local11.y - _local13);
_local11 = this.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 = this.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 = this.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 = this.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 = this.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 = this.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;
this.ComputeAABB(_local4, _arg2);
this.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 < this.m_vertexCount) {
_local10 = this.m_vertices[_local9];
_local11 = (((_local9 + 1) < this.m_vertexCount)) ? this.m_vertices[int((_local9 + 1))] : this.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 (this.m_obb);
}
public function GetCentroid():b2Vec2{
return (this.m_centroid);
}
public function GetVertexCount():int{
return (this.m_vertexCount);
}
public function GetVertices():Array{
return (this.m_vertices);
}
public function GetCoreVertices():Array{
return (this.m_coreVertices);
}
public function GetNormals():Array{
return (this.m_normals);
}
public function GetFirstVertex(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, this.m_coreVertices[0]));
}
public function Centroid(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, this.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 = this.m_coreVertices[0];
var _local9:Number = ((_local4.x * _local6) + (_local4.y * _local7));
var _local10 = 1;
while (_local10 < this.m_vertexCount) {
_local4 = this.m_coreVertices[_local10];
_local11 = ((_local4.x * _local6) + (_local4.y * _local7));
if (_local11 > _local9){
_local8 = _local10;
_local9 = _local11;
};
_local10++;
};
_local5 = _arg1.R;
_local4 = this.m_coreVertices[_local8];
this.s_supportVec.x = (_arg1.position.x + ((_local5.col1.x * _local4.x) + (_local5.col2.x * _local4.y)));
this.s_supportVec.y = (_arg1.position.y + ((_local5.col1.y * _local4.x) + (_local5.col2.y * _local4.y)));
return (this.s_supportVec);
}
override b2internal function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:b2Vec2;
var _local4:Number;
var _local5:Number;
m_sweepRadius = 0;
var _local3:int;
while (_local3 < this.m_vertexCount) {
_local2 = this.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 _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local3:b2Vec2 = new b2Vec2();
var _local4:Number = 0;
var _local5:Number = 0;
var _local6:Number = 0;
var _local7:Number = (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);
}
b2internal 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.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2Shape {
b2internal var m_type:int;
b2internal var m_next:b2Shape;
b2internal var m_body:b2Body;
b2internal var m_sweepRadius:Number;
b2internal var m_density:Number;
b2internal var m_friction:Number;
b2internal var m_restitution:Number;
private var m_proxyId:uint;
private var m_filter:b2FilterData;
private var m_isSensor:Boolean;
private var m_userData;
b2internal static const e_unknownShape:int = -1;
b2internal static const e_circleShape:int = 0;
b2internal static const e_polygonShape:int = 1;
b2internal static const e_shapeTypeCount:int = 2;
public static const e_hitCollide:int = 1;
public static const e_missCollide:int = 0;
public static const e_startsInsideCollide:int = -1;
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){
this.m_userData = _arg1.userData;
this.m_friction = _arg1.friction;
this.m_restitution = _arg1.restitution;
this.m_density = _arg1.density;
this.m_body = null;
this.m_sweepRadius = 0;
this.m_next = null;
this.m_proxyId = b2Pair.b2_nullProxy;
this.m_filter = _arg1.filter.Copy();
this.m_isSensor = _arg1.isSensor;
}
public function GetType():int{
return (this.m_type);
}
public function IsSensor():Boolean{
return (this.m_isSensor);
}
public function SetFilterData(_arg1:b2FilterData):void{
this.m_filter = _arg1.Copy();
}
public function GetFilterData():b2FilterData{
return (this.m_filter.Copy());
}
public function GetBody():b2Body{
return (this.m_body);
}
public function GetNext():b2Shape{
return (this.m_next);
}
public function GetUserData(){
return (this.m_userData);
}
public function SetUserData(_arg1):void{
this.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 (this.m_sweepRadius);
}
public function GetFriction():Number{
return (this.m_friction);
}
public function GetRestitution():Number{
return (this.m_restitution);
}
b2internal function CreateProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
var _local3:b2AABB = s_proxyAABB;
this.ComputeAABB(_local3, _arg2);
var _local4:Boolean = _arg1.InRange(_local3);
if (_local4){
this.m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
this.m_proxyId = b2Pair.b2_nullProxy;
};
}
b2internal function DestroyProxy(_arg1:b2BroadPhase):void{
if (this.m_proxyId != b2Pair.b2_nullProxy){
_arg1.DestroyProxy(this.m_proxyId);
this.m_proxyId = b2Pair.b2_nullProxy;
};
}
b2internal function Synchronize(_arg1:b2BroadPhase, _arg2:b2XForm, _arg3:b2XForm):Boolean{
if (this.m_proxyId == b2Pair.b2_nullProxy){
return (false);
};
var _local4:b2AABB = s_syncAABB;
this.ComputeSweptAABB(_local4, _arg2, _arg3);
if (_arg1.InRange(_local4)){
_arg1.MoveProxy(this.m_proxyId, _local4);
return (true);
};
return (false);
}
b2internal function RefilterProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
if (this.m_proxyId == b2Pair.b2_nullProxy){
return;
};
_arg1.DestroyProxy(this.m_proxyId);
var _local3:b2AABB = s_resetAABB;
this.ComputeAABB(_local3, _arg2);
var _local4:Boolean = _arg1.InRange(_local3);
if (_local4){
this.m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
this.m_proxyId = b2Pair.b2_nullProxy;
};
}
b2internal function UpdateSweepRadius(_arg1:b2Vec2):void{
}
b2internal 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);
};
}
b2internal 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(){
this.type = b2Shape.e_unknownShape;
this.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(){
this.lowerBound = new b2Vec2();
this.upperBound = new b2Vec2();
super();
}
public function IsValid():Boolean{
var _local1:Number = (this.upperBound.x - this.lowerBound.x);
var _local2:Number = (this.upperBound.y - this.lowerBound.y);
var _local3:Boolean = (((_local1 >= 0)) && ((_local2 >= 0)));
_local3 = ((((_local3) && (this.lowerBound.IsValid()))) && (this.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 (((this.value & 1) == 0));
}
public function IsUpper():Boolean{
return (((this.value & 1) == 1));
}
public function Swap(_arg1:b2Bound):void{
var _local2:uint = this.value;
var _local3:uint = this.proxyId;
var _local4:uint = this.stabbingCount;
this.value = _arg1.value;
this.proxyId = _arg1.proxyId;
this.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(){
this.lowerValues = [0, 0];
this.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 {
b2internal var m_pairManager:b2PairManager;
b2internal var m_proxyPool:Array;
private var m_freeProxy:uint;
b2internal var m_bounds:Array;
private var m_querySortKeys:Array;
private var m_queryResults:Array;
private var m_queryResultCount:int;
b2internal var m_worldAABB:b2AABB;
b2internal var m_quantizationFactor:b2Vec2;
b2internal var m_proxyCount:int;
private var m_timeStamp:uint;
public static const b2_invalid:uint = 0xFFFF;
public static const b2_nullEdge:uint = 0xFFFF;
public static var s_validate:Boolean = false;
public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){
var _local3:int;
var _local6:b2Proxy;
var _local7:int;
this.m_pairManager = new b2PairManager();
this.m_proxyPool = new Array(b2Settings.b2_maxPairs);
this.m_bounds = new Array((2 * b2Settings.b2_maxProxies));
this.m_querySortKeys = new Array(b2Settings.b2_maxProxies);
this.m_queryResults = new Array(b2Settings.b2_maxProxies);
this.m_quantizationFactor = new b2Vec2();
super();
this.m_pairManager.Initialize(this, _arg2);
this.m_worldAABB = _arg1;
this.m_proxyCount = 0;
_local3 = 0;
while (_local3 < b2Settings.b2_maxProxies) {
this.m_queryResults[_local3] = 0;
this.m_querySortKeys[_local3] = 0;
_local3++;
};
this.m_bounds = new Array(2);
_local3 = 0;
while (_local3 < 2) {
this.m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies));
_local7 = 0;
while (_local7 < (2 * b2Settings.b2_maxProxies)) {
this.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);
this.m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4);
this.m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5);
_local3 = 0;
while (_local3 < (b2Settings.b2_maxProxies - 1)) {
_local6 = new b2Proxy();
this.m_proxyPool[_local3] = _local6;
_local6.SetNext((_local3 + 1));
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
_local3++;
};
_local6 = new b2Proxy();
this.m_proxyPool[int((b2Settings.b2_maxProxies - 1))] = _local6;
_local6.SetNext(b2Pair.b2_nullProxy);
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
this.m_freeProxy = 0;
this.m_timeStamp = 1;
this.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 - this.m_worldAABB.upperBound.x);
_local3 = (_local3 - this.m_worldAABB.upperBound.y);
_local4 = this.m_worldAABB.lowerBound.x;
_local5 = this.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 = this.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 = this.m_freeProxy;
_local4 = this.m_proxyPool[_local5];
this.m_freeProxy = _local4.GetNext();
_local4.overlapCount = 0;
_local4.userData = _arg2;
var _local6:uint = (2 * this.m_proxyCount);
var _local7:Array = new Array();
var _local8:Array = new Array();
this.ComputeBounds(_local7, _local8, _arg1);
var _local9:int;
while (_local9 < 2) {
_local11 = this.m_bounds[_local9];
_local14 = [_local12];
_local15 = [_local13];
this.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 = this.m_proxyPool[_local19.proxyId];
if (_local19.IsLower()){
_local23.lowerBounds[_local9] = _local3;
} else {
_local23.upperBounds[_local9] = _local3;
};
_local3++;
};
_local9++;
};
this.m_proxyCount++;
var _local10:int;
while (_local10 < this.m_queryResultCount) {
this.m_pairManager.AddBufferedPair(_local5, this.m_queryResults[_local10]);
_local10++;
};
this.m_pairManager.Commit();
this.m_queryResultCount = 0;
this.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 = this.m_proxyPool[_arg1];
var _local5:int = (2 * this.m_proxyCount);
var _local6:int;
while (_local6 < 2) {
_local8 = this.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 = this.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++;
};
this.Query([0], [0], _local11, _local12, _local8, (_local5 - 2), _local6);
_local6++;
};
var _local7:int;
while (_local7 < this.m_queryResultCount) {
this.m_pairManager.RemoveBufferedPair(_arg1, this.m_queryResults[_local7]);
_local7++;
};
this.m_pairManager.Commit();
this.m_queryResultCount = 0;
this.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(this.m_freeProxy);
this.m_freeProxy = _arg1;
this.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 * this.m_proxyCount);
var _local13:b2Proxy = this.m_proxyPool[_arg1];
var _local14:b2BoundValues = new b2BoundValues();
this.ComputeBounds(_local14.lowerValues, _local14.upperValues, _arg2);
var _local15:b2BoundValues = new b2BoundValues();
_local5 = 0;
while (_local5 < 2) {
_local7 = this.m_bounds[_local5][_local13.lowerBounds[_local5]];
_local15.lowerValues[_local5] = _local7.value;
_local7 = this.m_bounds[_local5][_local13.upperBounds[_local5]];
_local15.upperValues[_local5] = _local7.value;
_local5++;
};
_local5 = 0;
while (_local5 < 2) {
_local16 = this.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 = this.m_proxyPool[_local8.proxyId];
_local8.stabbingCount++;
if (_local8.IsUpper() == true){
if (this.TestOverlap(_local14, _local24)){
this.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 = this.m_proxyPool[_local10];
_local9.stabbingCount++;
if (_local9.IsLower() == true){
if (this.TestOverlap(_local14, _local11)){
this.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 = this.m_proxyPool[_local10];
_local9.stabbingCount--;
if (_local9.IsUpper()){
if (this.TestOverlap(_local15, _local11)){
this.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 = this.m_proxyPool[_local23];
_local8.stabbingCount--;
if (_local8.IsLower() == true){
if (this.TestOverlap(_local15, _local24)){
this.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{
this.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();
this.ComputeBounds(_local4, _local5, _arg1);
var _local8:Array = [_local6];
var _local9:Array = [_local7];
this.Query(_local8, _local9, _local4[0], _local5[0], this.m_bounds[0], (2 * this.m_proxyCount), 0);
this.Query(_local8, _local9, _local4[1], _local5[1], this.m_bounds[1], (2 * this.m_proxyCount), 1);
var _local10:int;
var _local11:int;
while ((((_local11 < this.m_queryResultCount)) && ((_local10 < _arg3)))) {
_local12 = this.m_proxyPool[this.m_queryResults[_local11]];
_arg2[_local11] = _local12.userData;
_local11++;
_local10++;
};
this.m_queryResultCount = 0;
this.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 = this.m_bounds[_local5];
_local7 = (2 * this.m_proxyCount);
_local8 = 0;
_local9 = 0;
while (_local9 < _local7) {
_local10 = _local6[_local9];
if (_local10.IsLower() == true){
_local8++;
} else {
_local8--;
};
_local9++;
};
_local5++;
};
}
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) * this.m_quantizationFactor.x);
var _local7:Number = ((_arg1.p2.y - _arg1.p1.y) * this.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 = (this.m_quantizationFactor.x * (_arg1.p1.x - this.m_worldAABB.lowerBound.x));
var _local11:Number = (this.m_quantizationFactor.y * (_arg1.p1.y - this.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];
this.Query(_local21, _local22, _local12[0], _local13[0], this.m_bounds[0], (2 * this.m_proxyCount), 0);
if (_local8 >= 0){
_local15 = (_local22[0] - 1);
} else {
_local15 = _local21[0];
};
this.Query(_local21, _local22, _local12[1], _local13[1], this.m_bounds[1], (2 * this.m_proxyCount), 1);
if (_local9 >= 0){
_local16 = (_local22[0] - 1);
} else {
_local16 = _local21[0];
};
if (_arg4 != null){
_local24 = 0;
while (_local24 < this.m_queryResultCount) {
this.m_querySortKeys[_local24] = _arg4(this.m_proxyPool[this.m_queryResults[_local24]].userData);
_local24++;
};
_local24 = 0;
while (_local24 < (this.m_queryResultCount - 1)) {
_local25 = this.m_querySortKeys[_local24];
_local26 = this.m_querySortKeys[(_local24 + 1)];
if (((_local25)<0) ? (_local26 >= 0) : (((_local25 > _local26)) && ((_local26 >= 0)))){
this.m_querySortKeys[(_local24 + 1)] = _local25;
this.m_querySortKeys[_local24] = _local26;
_local27 = this.m_queryResults[(_local24 + 1)];
this.m_queryResults[(_local24 + 1)] = this.m_queryResults[_local24];
this.m_queryResults[_local24] = _local27;
--_local24;
if (_local24 == -1){
_local24 = 1;
};
} else {
_local24++;
};
};
while ((((this.m_queryResultCount > 0)) && ((this.m_querySortKeys[(this.m_queryResultCount - 1)] < 0)))) {
this.m_queryResultCount--;
};
};
while (true) {
_local28 = 0;
_local29 = 0;
_local15 = (_local15 + ((_local8 >= 0)) ? 1 : -1);
if ((((_local15 < 0)) || ((_local15 >= (this.m_proxyCount * 2))))){
break;
};
if (_local8 != 0){
_local28 = ((this.m_bounds[0][_local15].value - _local10) / _local6);
};
_local16 = (_local16 + ((_local9 >= 0)) ? 1 : -1);
if ((((_local16 < 0)) || ((_local16 >= (this.m_proxyCount * 2))))){
break;
};
if (_local9 != 0){
_local29 = ((this.m_bounds[1][_local16].value - _local11) / _local7);
};
while (true) {
if ((((_local9 == 0)) || (((!((_local8 == 0))) && ((_local28 < _local29)))))){
if (_local28 > _local5){
break;
};
if (((_local8 > 0)) ? this.m_bounds[0][_local15].IsLower() : this.m_bounds[0][_local15].IsUpper()){
_local17 = this.m_bounds[0][_local15].proxyId;
_local18 = this.m_proxyPool[_local17];
if (_local9 >= 0){
if ((((_local18.lowerBounds[1] <= (_local16 - 1))) && ((_local18.upperBounds[1] >= _local16)))){
if (_arg4 != null){
this.AddProxyResult(_local17, _local18, _arg3, _arg4);
} else {
this.m_queryResults[this.m_queryResultCount] = _local17;
this.m_queryResultCount++;
};
};
} else {
if ((((_local18.lowerBounds[1] <= _local16)) && ((_local18.upperBounds[1] >= (_local16 + 1))))){
if (_arg4 != null){
this.AddProxyResult(_local17, _local18, _arg3, _arg4);
} else {
this.m_queryResults[this.m_queryResultCount] = _local17;
this.m_queryResultCount++;
};
};
};
};
if (((((((!((_arg4 == null))) && ((this.m_queryResultCount == _arg3)))) && ((this.m_queryResultCount > 0)))) && ((_local28 > this.m_querySortKeys[(this.m_queryResultCount - 1)])))){
break;
};
if (_local8 > 0){
_local15++;
if (_local15 == (this.m_proxyCount * 2)){
break;
};
} else {
--_local15;
if (_local15 < 0){
break;
};
};
_local28 = ((this.m_bounds[0][_local15].value - _local10) / _local6);
} else {
if (_local29 > _local5){
break;
};
if (((_local9 > 0)) ? this.m_bounds[1][_local16].IsLower() : this.m_bounds[1][_local16].IsUpper()){
_local17 = this.m_bounds[1][_local16].proxyId;
_local18 = this.m_proxyPool[_local17];
if (_local8 >= 0){
if ((((_local18.lowerBounds[0] <= (_local15 - 1))) && ((_local18.upperBounds[0] >= _local15)))){
if (_arg4 != null){
this.AddProxyResult(_local17, _local18, _arg3, _arg4);
} else {
this.m_queryResults[this.m_queryResultCount] = _local17;
this.m_queryResultCount++;
};
};
} else {
if ((((_local18.lowerBounds[0] <= _local15)) && ((_local18.upperBounds[0] >= (_local15 + 1))))){
if (_arg4 != null){
this.AddProxyResult(_local17, _local18, _arg3, _arg4);
} else {
this.m_queryResults[this.m_queryResultCount] = _local17;
this.m_queryResultCount++;
};
};
};
};
if (((((((!((_arg4 == null))) && ((this.m_queryResultCount == _arg3)))) && ((this.m_queryResultCount > 0)))) && ((_local29 > this.m_querySortKeys[(this.m_queryResultCount - 1)])))){
break;
};
if (_local9 > 0){
_local16++;
if (_local16 == (this.m_proxyCount * 2)){
break;
};
} else {
--_local16;
if (_local16 < 0){
break;
};
};
_local29 = ((this.m_bounds[1][_local16].value - _local11) / _local7);
};
};
break;
};
_local23 = 0;
_local24 = 0;
while ((((_local24 < this.m_queryResultCount)) && ((_local23 < _arg3)))) {
_local18 = this.m_proxyPool[this.m_queryResults[_local24]];
_arg2[_local24] = _local18.userData;
_local24++;
_local23++;
};
this.m_queryResultCount = 0;
this.IncrementTimeStamp();
return (_local23);
}
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, this.m_worldAABB.upperBound.x);
_local5 = b2Math.b2Min(_local5, this.m_worldAABB.upperBound.y);
_local4 = b2Math.b2Max(_local4, this.m_worldAABB.lowerBound.x);
_local5 = b2Math.b2Max(_local5, this.m_worldAABB.lowerBound.y);
var _local6:Number = _arg3.upperBound.x;
var _local7:Number = _arg3.upperBound.y;
_local6 = b2Math.b2Min(_local6, this.m_worldAABB.upperBound.x);
_local7 = b2Math.b2Min(_local7, this.m_worldAABB.upperBound.y);
_local6 = b2Math.b2Max(_local6, this.m_worldAABB.lowerBound.x);
_local7 = b2Math.b2Max(_local7, this.m_worldAABB.lowerBound.y);
_arg1[0] = (uint((this.m_quantizationFactor.x * (_local4 - this.m_worldAABB.lowerBound.x))) & (b2Settings.USHRT_MAX - 1));
_arg2[0] = ((uint((this.m_quantizationFactor.x * (_local6 - this.m_worldAABB.lowerBound.x))) & 0xFFFF) | 1);
_arg1[1] = (uint((this.m_quantizationFactor.y * (_local5 - this.m_worldAABB.lowerBound.y))) & (b2Settings.USHRT_MAX - 1));
_arg2[1] = ((uint((this.m_quantizationFactor.y * (_local7 - this.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 = this.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 = this.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()){
this.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 = this.m_proxyPool[_local10.proxyId];
if (_local8 <= _local14.upperBounds[_arg7]){
this.IncrementOverlapCount(_local10.proxyId);
_local13--;
};
};
_local12--;
};
};
_arg1[0] = _local8;
_arg2[0] = _local9;
}
private function IncrementOverlapCount(_arg1:uint):void{
var _local2:b2Proxy = this.m_proxyPool[_arg1];
if (_local2.timeStamp < this.m_timeStamp){
_local2.timeStamp = this.m_timeStamp;
_local2.overlapCount = 1;
} else {
_local2.overlapCount = 2;
this.m_queryResults[this.m_queryResultCount] = _arg1;
this.m_queryResultCount++;
};
}
private function IncrementTimeStamp():void{
var _local1:uint;
if (this.m_timeStamp == b2Settings.USHRT_MAX){
_local1 = 0;
while (_local1 < b2Settings.b2_maxProxies) {
(this.m_proxyPool[_local1] as b2Proxy).timeStamp = 0;
_local1++;
};
this.m_timeStamp = 1;
} else {
this.m_timeStamp++;
};
}
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 < this.m_queryResultCount)) && ((this.m_querySortKeys[_local6] < _local5)))) {
_local6++;
};
var _local7:Number = _local5;
var _local8:uint = _arg1;
this.m_queryResultCount = (this.m_queryResultCount + 1);
if (this.m_queryResultCount > _arg3){
this.m_queryResultCount = _arg3;
};
while (_local6 < this.m_queryResultCount) {
_local9 = this.m_querySortKeys[_local6];
_local10 = this.m_queryResults[_local6];
this.m_querySortKeys[_local6] = _local7;
this.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.Collision.Shapes.*;
import Box2D.Common.Math.*;
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 _local11:Number;
var _local12:b2Vec2;
var _local13:ClipVertex;
var _local6:int;
_local5 = _arg2[0];
var _local7:b2Vec2 = _local5.v;
_local5 = _arg2[1];
var _local8:b2Vec2 = _local5.v;
var _local9:Number = (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 _local36:b2Vec2;
_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))];
_local36 = _local24.Copy();
} else {
_local24 = _local23[0];
_local36 = _local24.Copy();
};
var _local26:b2Vec2 = b2Math.SubtractVV(_local36, _local25);
var _local27:b2Vec2 = b2Math.b2MulMV(_local15.R, b2Math.SubtractVV(_local36, _local25));
_local27.Normalize();
var _local28:b2Vec2 = b2Math.b2CrossVF(_local27, 1);
_local25 = b2Math.b2MulX(_local15, _local25);
_local36 = b2Math.b2MulX(_local15, _local36);
var _local29:Number = b2Math.b2Dot(_local28, _local25);
var _local30:Number = -(b2Math.b2Dot(_local27, _local25));
var _local31:Number = b2Math.b2Dot(_local27, _local36);
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();
_local6 = _local33[0];
var _local35:b2ManifoldPoint = _arg1.points[0];
_local35.separation = (b2Math.b2Dot(_local28, _local6.v) - _local29);
_local35.localPoint1 = b2Math.b2MulXT(_arg3, _local6.v);
_local35.localPoint2 = b2Math.b2MulXT(_arg5, _local6.v);
_local35.id.key = _local6.id._key;
_local35.id.features.flip = _local18;
_local6 = _local33[1];
_local35 = _arg1.points[1];
_local35.separation = (b2Math.b2Dot(_local28, _local6.v) - _local29);
_local35.localPoint1 = b2Math.b2MulXT(_arg3, _local6.v);
_local35.localPoint2 = b2Math.b2MulXT(_arg5, _local6.v);
_local35.id.key = _local6.id._key;
_local35.id.features.flip = _local18;
_arg1.pointCount = 2;
}
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 {
import Box2D.Common.*;
public class b2ContactID {
public var features:Features;
b2internal var _key:uint;
public function b2ContactID(){
this.features = new Features();
super();
this.features._m_id = this;
}
public function Set(_arg1:b2ContactID):void{
this.key = _arg1._key;
}
public function Copy():b2ContactID{
var _local1:b2ContactID = new b2ContactID();
_local1.key = this.key;
return (_local1);
}
public function get key():uint{
return (this._key);
}
public function set key(_arg1:uint):void{
this._key = _arg1;
this.features._referenceEdge = (this._key & 0xFF);
this.features._incidentEdge = (((this._key & 0xFF00) >> 8) & 0xFF);
this.features._incidentVertex = (((this._key & 0xFF0000) >> 16) & 0xFF);
this.features._flip = (((this._key & 4278190080) >> 24) & 0xFF);
}
}
}//package Box2D.Collision
Section 16
//b2ContactPoint (Box2D.Collision.b2ContactPoint)
package Box2D.Collision {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
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(){
this.position = new b2Vec2();
this.velocity = new b2Vec2();
this.normal = new b2Vec2();
this.id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 17
//b2Distance (Box2D.Collision.b2Distance)
package Box2D.Collision {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
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 _local6:b2Vec2 = _arg5[0];
var _local7:b2Vec2 = _arg5[1];
var _local8:b2Vec2 = _arg3[0];
var _local9:b2Vec2 = _arg3[1];
var _local10:b2Vec2 = _arg4[0];
var _local11:b2Vec2 = _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);
var _local17:Number = ((_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 _local35:Number;
var _local6:b2Vec2 = _arg5[0];
var _local7:b2Vec2 = _arg5[1];
var _local8:b2Vec2 = _arg5[2];
var _local9:b2Vec2 = _arg3[0];
var _local10:b2Vec2 = _arg3[1];
var _local11:b2Vec2 = _arg3[2];
var _local12:b2Vec2 = _arg4[0];
var _local13:b2Vec2 = _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(){
this.points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
this.points[_local1] = new b2ManifoldPoint();
_local1++;
};
this.normal = new b2Vec2();
}
public function Reset():void{
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
(this.points[_local1] as b2ManifoldPoint).Reset();
_local1++;
};
this.normal.SetZero();
this.pointCount = 0;
}
public function Set(_arg1:b2Manifold):void{
this.pointCount = _arg1.pointCount;
var _local2:int;
while (_local2 < b2Settings.b2_maxManifoldPoints) {
(this.points[_local2] as b2ManifoldPoint).Set(_arg1.points[_local2]);
_local2++;
};
this.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(){
this.localPoint1 = new b2Vec2();
this.localPoint2 = new b2Vec2();
this.id = new b2ContactID();
super();
}
public function Reset():void{
this.localPoint1.SetZero();
this.localPoint2.SetZero();
this.separation = 0;
this.normalImpulse = 0;
this.tangentImpulse = 0;
this.id.key = 0;
}
public function Set(_arg1:b2ManifoldPoint):void{
this.localPoint1.SetV(_arg1.localPoint1);
this.localPoint2.SetV(_arg1.localPoint2);
this.separation = _arg1.separation;
this.normalImpulse = _arg1.normalImpulse;
this.tangentImpulse = _arg1.tangentImpulse;
this.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(){
this.R = new b2Mat22();
this.center = new b2Vec2();
this.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{
this.status = (this.status | e_pairBuffered);
}
public function ClearBuffered():void{
this.status = (this.status & ~(e_pairBuffered));
}
public function IsBuffered():Boolean{
return (((this.status & e_pairBuffered) == e_pairBuffered));
}
public function SetRemoved():void{
this.status = (this.status | e_pairRemoved);
}
public function ClearRemoved():void{
this.status = (this.status & ~(e_pairRemoved));
}
public function IsRemoved():Boolean{
return (((this.status & e_pairRemoved) == e_pairRemoved));
}
public function SetFinal():void{
this.status = (this.status | e_pairFinal);
}
public function IsFinal():Boolean{
return (((this.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 {
private var m_broadPhase:b2BroadPhase;
private var m_callback:b2PairCallback;
b2internal var m_pairs:Array;
private var m_freePair:uint;
b2internal var m_pairCount:int;
private var m_pairBuffer:Array;
private var m_pairBufferCount:int;
b2internal var m_hashTable:Array;
public function b2PairManager(){
var _local1:uint;
super();
this.m_hashTable = new Array(b2Pair.b2_tableCapacity);
_local1 = 0;
while (_local1 < b2Pair.b2_tableCapacity) {
this.m_hashTable[_local1] = b2Pair.b2_nullPair;
_local1++;
};
this.m_pairs = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
this.m_pairs[_local1] = new b2Pair();
_local1++;
};
this.m_pairBuffer = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
this.m_pairBuffer[_local1] = new b2BufferedPair();
_local1++;
};
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
this.m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy;
this.m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy;
this.m_pairs[_local1].userData = null;
this.m_pairs[_local1].status = 0;
this.m_pairs[_local1].next = (_local1 + 1);
_local1++;
};
this.m_pairs[int((b2Settings.b2_maxPairs - 1))].next = b2Pair.b2_nullPair;
this.m_pairCount = 0;
this.m_pairBufferCount = 0;
}
public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{
this.m_broadPhase = _arg1;
this.m_callback = _arg2;
}
public function AddBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair = this.AddPair(_arg1, _arg2);
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = this.m_pairBuffer[this.m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
this.m_pairBufferCount++;
};
_local4.ClearRemoved();
if (b2BroadPhase.s_validate){
this.ValidateBuffer();
};
}
public function RemoveBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair = this.Find(_arg1, _arg2);
if (_local4 == null){
return;
};
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = this.m_pairBuffer[this.m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
this.m_pairBufferCount++;
};
_local4.SetRemoved();
if (b2BroadPhase.s_validate){
this.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 = this.m_broadPhase.m_proxyPool;
_local2 = 0;
while (_local2 < this.m_pairBufferCount) {
_local1 = this.m_pairBuffer[_local2];
_local5 = this.Find(_local1.proxyId1, _local1.proxyId2);
_local5.ClearBuffered();
_local6 = _local4[_local5.proxyId1];
_local7 = _local4[_local5.proxyId2];
if (_local5.IsRemoved()){
if (_local5.IsFinal() == true){
this.m_callback.PairRemoved(_local6.userData, _local7.userData, _local5.userData);
};
_local1 = this.m_pairBuffer[_local3];
_local1.proxyId1 = _local5.proxyId1;
_local1.proxyId2 = _local5.proxyId2;
_local3++;
} else {
if (_local5.IsFinal() == false){
_local5.userData = this.m_callback.PairAdded(_local6.userData, _local7.userData);
_local5.SetFinal();
};
};
_local2++;
};
_local2 = 0;
while (_local2 < _local3) {
_local1 = this.m_pairBuffer[_local2];
this.RemovePair(_local1.proxyId1, _local1.proxyId2);
_local2++;
};
this.m_pairBufferCount = 0;
if (b2BroadPhase.s_validate){
this.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 = this.FindHash(_arg1, _arg2, _local3);
if (_local4 != null){
return (_local4);
};
var _local5:uint = this.m_freePair;
_local4 = this.m_pairs[_local5];
this.m_freePair = _local4.next;
_local4.proxyId1 = _arg1;
_local4.proxyId2 = _arg2;
_local4.status = 0;
_local4.userData = null;
_local4.next = this.m_hashTable[_local3];
this.m_hashTable[_local3] = _local5;
this.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 = this.m_hashTable[_local4];
var _local6:b2Pair;
while (_local5 != b2Pair.b2_nullPair) {
if (Equals(this.m_pairs[_local5], _arg1, _arg2)){
_local8 = _local5;
_local3 = this.m_pairs[_local5];
if (_local6){
_local6.next = _local3.next;
} else {
this.m_hashTable[_local4] = _local3.next;
};
_local3 = this.m_pairs[_local8];
_local9 = _local3.userData;
_local3.next = this.m_freePair;
_local3.proxyId1 = b2Pair.b2_nullProxy;
_local3.proxyId2 = b2Pair.b2_nullProxy;
_local3.userData = null;
_local3.status = 0;
this.m_freePair = _local8;
this.m_pairCount--;
return (_local9);
} else {
_local6 = this.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 (this.FindHash(_arg1, _arg2, _local3));
}
private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{
var _local4:b2Pair;
var _local5:uint = this.m_hashTable[_arg3];
_local4 = this.m_pairs[_local5];
while (((!((_local5 == b2Pair.b2_nullPair))) && ((Equals(_local4, _arg1, _arg2) == false)))) {
_local5 = _local4.next;
_local4 = this.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(){
this.p = new b2Vec2();
super();
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
return (this.p);
}
public function GetFirstVertex(_arg1:b2XForm):b2Vec2{
return (this.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(){
this.lowerBounds = [uint(0), uint(0)];
this.upperBounds = [uint(0), uint(0)];
super();
}
public function GetNext():uint{
return (this.lowerBounds[0]);
}
public function SetNext(_arg1:uint):void{
this.lowerBounds[0] = (_arg1 & 0xFFFF);
}
public function IsValid():Boolean{
return (!((this.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(){
this.p1 = new b2Vec2();
this.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 = (this.p2.x - this.p1.x);
var _local9:Number = (this.p2.y - this.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 - this.p1.x);
_local15 = (_local5.y - this.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{
this.ExtendForward(_arg1);
this.ExtendBackward(_arg1);
}
public function ExtendForward(_arg1:b2AABB):void{
var _local2:Number = (this.p2.x - this.p1.x);
var _local3:Number = (this.p2.y - this.p1.y);
var _local4:Number = Math.min(((_local2 > 0)) ? ((_arg1.upperBound.x - this.p1.x) / _local2) : ((_local2 < 0)) ? ((_arg1.lowerBound.x - this.p1.x) / _local2) : Number.POSITIVE_INFINITY, ((_local3 > 0)) ? ((_arg1.upperBound.y - this.p1.y) / _local3) : ((_local3 < 0)) ? ((_arg1.lowerBound.y - this.p1.y) / _local3) : Number.POSITIVE_INFINITY);
this.p2.x = (this.p1.x + (_local2 * _local4));
this.p2.y = (this.p1.y + (_local3 * _local4));
}
public function ExtendBackward(_arg1:b2AABB):void{
var _local2:Number = (-(this.p2.x) + this.p1.x);
var _local3:Number = (-(this.p2.y) + this.p1.y);
var _local4:Number = Math.min(((_local2 > 0)) ? ((_arg1.upperBound.x - this.p2.x) / _local2) : ((_local2 < 0)) ? ((_arg1.lowerBound.x - this.p2.x) / _local2) : Number.POSITIVE_INFINITY, ((_local3 > 0)) ? ((_arg1.upperBound.y - this.p2.y) / _local3) : ((_local3 < 0)) ? ((_arg1.lowerBound.y - this.p2.y) / _local3) : Number.POSITIVE_INFINITY);
this.p1.x = (this.p2.x + (_local2 * _local4));
this.p1.y = (this.p2.y + (_local3 * _local4));
}
}
}//package Box2D.Collision
Section 27
//b2TimeOfImpact (Box2D.Collision.b2TimeOfImpact)
package Box2D.Collision {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
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(){
this.v = new b2Vec2();
this.id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 29
//Features (Box2D.Collision.Features)
package Box2D.Collision {
import Box2D.Common.*;
public class Features {
b2internal var _referenceEdge:int;
b2internal var _incidentEdge:int;
b2internal var _incidentVertex:int;
b2internal var _flip:int;
b2internal var _m_id:b2ContactID;
public function get referenceEdge():int{
return (this._referenceEdge);
}
public function set referenceEdge(_arg1:int):void{
this._referenceEdge = _arg1;
this._m_id._key = ((this._m_id._key & 4294967040) | (this._referenceEdge & 0xFF));
}
public function get incidentEdge():int{
return (this._incidentEdge);
}
public function set incidentEdge(_arg1:int):void{
this._incidentEdge = _arg1;
this._m_id._key = ((this._m_id._key & 4294902015) | ((this._incidentEdge << 8) & 0xFF00));
}
public function get incidentVertex():int{
return (this._incidentVertex);
}
public function set incidentVertex(_arg1:int):void{
this._incidentVertex = _arg1;
this._m_id._key = ((this._m_id._key & 4278255615) | ((this._incidentVertex << 16) & 0xFF0000));
}
public function get flip():int{
return (this._flip);
}
public function set flip(_arg1:int):void{
this._flip = _arg1;
this._m_id._key = ((this._m_id._key & 0xFFFFFF) | ((this._flip << 24) & 4278190080));
}
}
}//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;
this.col1 = new b2Vec2();
this.col2 = new b2Vec2();
super();
if (((!((_arg2 == null))) && (!((_arg3 == null))))){
this.col1.SetV(_arg2);
this.col2.SetV(_arg3);
} else {
_local4 = Math.cos(_arg1);
_local5 = Math.sin(_arg1);
this.col1.x = _local4;
this.col2.x = -(_local5);
this.col1.y = _local5;
this.col2.y = _local4;
};
}
public function Set(_arg1:Number):void{
var _local2:Number;
_local2 = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
this.col1.x = _local2;
this.col2.x = -(_local3);
this.col1.y = _local3;
this.col2.y = _local2;
}
public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{
this.col1.SetV(_arg1);
this.col2.SetV(_arg2);
}
public function Copy():b2Mat22{
return (new b2Mat22(0, this.col1, this.col2));
}
public function SetM(_arg1:b2Mat22):void{
this.col1.SetV(_arg1.col1);
this.col2.SetV(_arg1.col2);
}
public function AddM(_arg1:b2Mat22):void{
this.col1.x = (this.col1.x + _arg1.col1.x);
this.col1.y = (this.col1.y + _arg1.col1.y);
this.col2.x = (this.col2.x + _arg1.col2.x);
this.col2.y = (this.col2.y + _arg1.col2.y);
}
public function SetIdentity():void{
this.col1.x = 1;
this.col2.x = 0;
this.col1.y = 0;
this.col2.y = 1;
}
public function SetZero():void{
this.col1.x = 0;
this.col2.x = 0;
this.col1.y = 0;
this.col2.y = 0;
}
public function GetAngle():Number{
return (Math.atan2(this.col1.y, this.col1.x));
}
public function Invert(_arg1:b2Mat22):b2Mat22{
var _local2:Number;
var _local4:Number;
var _local6:Number;
_local2 = this.col1.x;
var _local3:Number = this.col2.x;
_local4 = this.col1.y;
var _local5:Number = this.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 = this.col1.x;
var _local5:Number = this.col2.x;
var _local6:Number = this.col1.y;
var _local7:Number = this.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{
this.col1.Abs();
this.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(){
this.localCenter = new b2Vec2();
this.c0 = new b2Vec2();
this.c = new b2Vec2();
super();
}
public function GetXForm(_arg1:b2XForm, _arg2:Number):void{
var _local4:Number;
var _local5:Number;
if ((1 - this.t0) > Number.MIN_VALUE){
_local4 = ((_arg2 - this.t0) / (1 - this.t0));
_arg1.position.x = (((1 - _local4) * this.c0.x) + (_local4 * this.c.x));
_arg1.position.y = (((1 - _local4) * this.c0.y) + (_local4 * this.c.y));
_local5 = (((1 - _local4) * this.a0) + (_local4 * this.a));
_arg1.R.Set(_local5);
} else {
_arg1.position.SetV(this.c);
_arg1.R.Set(this.a);
};
var _local3:b2Mat22 = _arg1.R;
_arg1.position.x = (_arg1.position.x - ((_local3.col1.x * this.localCenter.x) + (_local3.col2.x * this.localCenter.y)));
_arg1.position.y = (_arg1.position.y - ((_local3.col1.y * this.localCenter.x) + (_local3.col2.y * this.localCenter.y)));
}
public function Advance(_arg1:Number):void{
var _local2:Number;
if ((((this.t0 < _arg1)) && (((1 - this.t0) > Number.MIN_VALUE)))){
_local2 = ((_arg1 - this.t0) / (1 - this.t0));
this.c0.x = (((1 - _local2) * this.c0.x) + (_local2 * this.c.x));
this.c0.y = (((1 - _local2) * this.c0.y) + (_local2 * this.c.y));
this.a0 = (((1 - _local2) * this.a0) + (_local2 * this.a));
this.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{
this.x = _arg1;
this.y = _arg2;
}
public function SetZero():void{
this.x = 0;
this.y = 0;
}
public function Set(_arg1:Number=0, _arg2:Number=0):void{
this.x = _arg1;
this.y = _arg2;
}
public function SetV(_arg1:b2Vec2):void{
this.x = _arg1.x;
this.y = _arg1.y;
}
public function Negative():b2Vec2{
return (new b2Vec2(-(this.x), -(this.y)));
}
public function Copy():b2Vec2{
return (new b2Vec2(this.x, this.y));
}
public function Add(_arg1:b2Vec2):void{
this.x = (this.x + _arg1.x);
this.y = (this.y + _arg1.y);
}
public function Subtract(_arg1:b2Vec2):void{
this.x = (this.x - _arg1.x);
this.y = (this.y - _arg1.y);
}
public function Multiply(_arg1:Number):void{
this.x = (this.x * _arg1);
this.y = (this.y * _arg1);
}
public function MulM(_arg1:b2Mat22):void{
var _local2:Number = this.x;
this.x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * this.y));
this.y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * this.y));
}
public function MulTM(_arg1:b2Mat22):void{
var _local2:Number = b2Math.b2Dot(this, _arg1.col1);
this.y = b2Math.b2Dot(this, _arg1.col2);
this.x = _local2;
}
public function CrossVF(_arg1:Number):void{
var _local2:Number = this.x;
this.x = (_arg1 * this.y);
this.y = (-(_arg1) * _local2);
}
public function CrossFV(_arg1:Number):void{
var _local2:Number = this.x;
this.x = (-(_arg1) * this.y);
this.y = (_arg1 * _local2);
}
public function MinV(_arg1:b2Vec2):void{
this.x = ((this.x < _arg1.x)) ? this.x : _arg1.x;
this.y = ((this.y < _arg1.y)) ? this.y : _arg1.y;
}
public function MaxV(_arg1:b2Vec2):void{
this.x = ((this.x > _arg1.x)) ? this.x : _arg1.x;
this.y = ((this.y > _arg1.y)) ? this.y : _arg1.y;
}
public function Abs():void{
if (this.x < 0){
this.x = -(this.x);
};
if (this.y < 0){
this.y = -(this.y);
};
}
public function Length():Number{
return (Math.sqrt(((this.x * this.x) + (this.y * this.y))));
}
public function LengthSquared():Number{
return (((this.x * this.x) + (this.y * this.y)));
}
public function Normalize():Number{
var _local1:Number = Math.sqrt(((this.x * this.x) + (this.y * this.y)));
if (_local1 < Number.MIN_VALUE){
return (0);
};
var _local2:Number = (1 / _local1);
this.x = (this.x * _local2);
this.y = (this.y * _local2);
return (_local1);
}
public function IsValid():Boolean{
return (((b2Math.b2IsValid(this.x)) && (b2Math.b2IsValid(this.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{
this.position = new b2Vec2();
this.R = new b2Mat22();
super();
if (_arg1){
this.position.SetV(_arg1);
this.R.SetM(_arg2);
};
}
public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{
this.position.SetV(_arg1);
this.R.SetM(_arg2);
}
public function SetIdentity():void{
this.position.SetZero();
this.R.SetIdentity();
}
public function Set(_arg1:b2XForm):void{
this.position.SetV(_arg1.position);
this.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){
this._r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
this._g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
this._b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{
this._r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
this._g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
this._b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function set r(_arg1:Number):void{
this._r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function set g(_arg1:Number):void{
this._g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function set b(_arg1:Number):void{
this._b = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function get color():uint{
return ((((this._r << 16) | (this._g << 8)) | this._b));
}
}
}//package Box2D.Common
Section 36
//b2internal (Box2D.Common.b2internal)
package Box2D.Common {
public namespace b2internal = "http://www.box2d.org/ns/b2internal";
}//package Box2D.Common
Section 37
//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 = 32;
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_maxTOIJointsPerIsland: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.01;
public static const b2_angularSleepTolerance:Number = 0.0111111111111111;
public static function b2Assert(_arg1:Boolean):void{
var _local2:b2Vec2;
if (!_arg1){
_local2.x++;
};
}
}
}//package Box2D.Common
Section 38
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2CircleContact extends b2Contact {
private var m_manifolds:Array;
private var m_manifold:b2Manifold;
private var m0:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){
this.m_manifolds = [new b2Manifold()];
this.m0 = new b2Manifold();
super(_arg1, _arg2);
this.m_manifold = this.m_manifolds[0];
this.m_manifold.pointCount = 0;
var _local3:b2ManifoldPoint = this.m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override b2internal 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;
this.m0.Set(this.m_manifold);
b2Collision.b2CollideCircles(this.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 (this.m_manifold.pointCount > 0){
m_manifoldCount = 1;
_local8 = this.m_manifold.points[0];
if (this.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(this.m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Add(_local7);
};
} else {
_local4 = this.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(this.m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Persist(_local7);
};
};
} else {
m_manifoldCount = 0;
if ((((this.m0.pointCount > 0)) && (_arg1))){
_local4 = this.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(this.m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
};
}
override public function GetManifolds():Array{
return (this.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 39
//b2Contact (Box2D.Dynamics.Contacts.b2Contact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2Contact {
b2internal var m_flags:uint;
b2internal var m_prev:b2Contact;
b2internal var m_next:b2Contact;
b2internal var m_node1:b2ContactEdge;
b2internal var m_node2:b2ContactEdge;
b2internal var m_shape1:b2Shape;
b2internal var m_shape2:b2Shape;
b2internal var m_manifoldCount:int;
b2internal var m_friction:Number;
b2internal var m_restitution:Number;
b2internal var m_toi:Number;
b2internal static var e_nonSolidFlag:uint = 1;
b2internal static var e_slowFlag:uint = 2;
b2internal static var e_islandFlag:uint = 4;
b2internal static var e_toiFlag:uint = 8;
b2internal static var s_registers:Array;
b2internal static var s_initialized:Boolean = false;
public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){
this.m_node1 = new b2ContactEdge();
this.m_node2 = new b2ContactEdge();
super();
this.m_flags = 0;
if (((!(_arg1)) || (!(_arg2)))){
this.m_shape1 = null;
this.m_shape2 = null;
return;
};
if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){
this.m_flags = (this.m_flags | e_nonSolidFlag);
};
this.m_shape1 = _arg1;
this.m_shape2 = _arg2;
this.m_manifoldCount = 0;
this.m_friction = Math.sqrt((this.m_shape1.m_friction * this.m_shape2.m_friction));
this.m_restitution = b2Math.b2Max(this.m_shape1.m_restitution, this.m_shape2.m_restitution);
this.m_prev = null;
this.m_next = null;
this.m_node1.contact = null;
this.m_node1.prev = null;
this.m_node1.next = null;
this.m_node1.other = null;
this.m_node2.contact = null;
this.m_node2.prev = null;
this.m_node2.next = null;
this.m_node2.other = null;
}
public function GetManifolds():Array{
return (null);
}
public function GetManifoldCount():int{
return (this.m_manifoldCount);
}
public function IsSolid():Boolean{
return (((this.m_flags & e_nonSolidFlag) == 0));
}
public function GetNext():b2Contact{
return (this.m_next);
}
public function GetShape1():b2Shape{
return (this.m_shape1);
}
public function GetShape2():b2Shape{
return (this.m_shape2);
}
b2internal function Update(_arg1:b2ContactListener):void{
var _local2:int = this.m_manifoldCount;
this.Evaluate(_arg1);
var _local3:int = this.m_manifoldCount;
var _local4:b2Body = this.m_shape1.m_body;
var _local5:b2Body = this.m_shape2.m_body;
if ((((_local3 == 0)) && ((_local2 > 0)))){
_local4.WakeUp();
_local5.WakeUp();
};
if (((((((_local4.IsStatic()) || (_local4.IsBullet()))) || (_local5.IsStatic()))) || (_local5.IsBullet()))){
this.m_flags = (this.m_flags & ~(e_slowFlag));
} else {
this.m_flags = (this.m_flags | e_slowFlag);
};
}
b2internal function Evaluate(_arg1:b2ContactListener):void{
}
b2internal 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;
};
}
b2internal 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);
}
b2internal 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);
}
b2internal 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 40
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ContactConstraint {
public var points:Array;
public var normal:b2Vec2;
public var normalMass:b2Mat22;
public var K:b2Mat22;
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(){
this.normal = new b2Vec2();
this.normalMass = new b2Mat22();
this.K = new b2Mat22();
super();
this.points = new Array(b2Settings.b2_maxManifoldPoints);
var _local1:int;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
this.points[_local1] = new b2ContactConstraintPoint();
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 41
//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 normalMass:Number;
public var tangentMass:Number;
public var equalizedMass:Number;
public var separation:Number;
public var velocityBias:Number;
public function b2ContactConstraintPoint(){
this.localAnchor1 = new b2Vec2();
this.localAnchor2 = new b2Vec2();
this.r1 = new b2Vec2();
this.r2 = new b2Vec2();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 42
//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 43
//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 44
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Collision.*;
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(){
this.position = new b2Vec2();
this.normal = new b2Vec2();
this.id = new b2ContactID();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 45
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ContactSolver {
private var m_step:b2TimeStep;
private var m_allocator;
b2internal var m_constraints:Array;
private 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:b2ContactConstraintPoint;
var _local47:b2ContactConstraintPoint;
var _local48:Number;
var _local49:Number;
var _local50:Number;
var _local51:Number;
var _local52:Number;
var _local53:Number;
var _local54:Number;
var _local55:Number;
var _local56:Number;
var _local57:Number;
var _local58:Number;
var _local59:Number;
this.m_step = new b2TimeStep();
this.m_constraints = new Array();
super();
this.m_step.dt = _arg1.dt;
this.m_step.inv_dt = _arg1.inv_dt;
this.m_step.maxIterations = _arg1.maxIterations;
this.m_allocator = _arg4;
this.m_constraintCount = 0;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
this.m_constraintCount = (this.m_constraintCount + _local5.m_manifoldCount);
_local6++;
};
_local6 = 0;
while (_local6 < this.m_constraintCount) {
this.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 = this.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.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 * _local25) - (_local33 * _local24));
_local37 = ((_local34 * _local25) - (_local35 * _local24));
_local36 = (_local36 * _local36);
_local37 = (_local37 * _local37);
_local38 = (((_local10.m_invMass + _local11.m_invMass) + (_local10.m_invI * _local36)) + (_local11.m_invI * _local37));
_local29.normalMass = (1 / _local38);
_local39 = ((_local10.m_mass * _local10.m_invMass) + (_local11.m_mass * _local11.m_invMass));
_local39 = (_local39 + (((_local10.m_mass * _local10.m_invI) * _local36) + ((_local11.m_mass * _local11.m_invI) * _local37)));
_local29.equalizedMass = (1 / _local39);
_local40 = _local25;
_local41 = -(_local24);
_local42 = ((_local32 * _local41) - (_local33 * _local40));
_local43 = ((_local34 * _local41) - (_local35 * _local40));
_local42 = (_local42 * _local42);
_local43 = (_local43 * _local43);
_local44 = (((_local10.m_invMass + _local11.m_invMass) + (_local10.m_invI * _local42)) + (_local11.m_invI * _local43));
_local29.tangentMass = (1 / _local44);
_local29.velocityBias = 0;
if (_local29.separation > 0){
_local29.velocityBias = (-60 * _local29.separation);
} else {
_local30 = (((_local18 + (-(_local21) * _local35)) - _local16) - (-(_local20) * _local33));
_local31 = (((_local19 + (_local21 * _local34)) - _local17) - (_local20 * _local32));
_local45 = ((_local26.normal.x * _local30) + (_local26.normal.y * _local31));
if (_local45 < -(b2Settings.b2_velocityThreshold)){
_local29.velocityBias = (_local29.velocityBias + (-(_local26.restitution) * _local45));
};
};
_local27++;
};
if (_local26.pointCount == 2){
_local46 = _local26.points[0];
_local47 = _local26.points[1];
_local48 = _local10.m_invMass;
_local49 = _local10.m_invI;
_local50 = _local11.m_invMass;
_local51 = _local11.m_invI;
_local52 = ((_local46.r1.x * _local25) - (_local46.r1.y * _local24));
_local53 = ((_local46.r2.x * _local25) - (_local46.r2.y * _local24));
_local54 = ((_local47.r1.x * _local25) - (_local47.r1.y * _local24));
_local55 = ((_local47.r2.x * _local25) - (_local47.r2.y * _local24));
_local56 = (((_local48 + _local50) + ((_local49 * _local52) * _local52)) + ((_local51 * _local53) * _local53));
_local57 = (((_local48 + _local50) + ((_local49 * _local54) * _local54)) + ((_local51 * _local55) * _local55));
_local58 = (((_local48 + _local50) + ((_local49 * _local52) * _local54)) + ((_local51 * _local53) * _local55));
_local59 = 100;
if ((_local56 * _local56) < (_local59 * ((_local56 * _local57) - (_local58 * _local58)))){
_local26.K.col1.Set(_local56, _local58);
_local26.K.col2.Set(_local58, _local57);
_local26.K.Invert(_local26.normalMass);
} else {
_local26.pointCount = 1;
};
};
_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 < this.m_constraintCount) {
_local6 = this.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:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:b2Mat22;
var _local24:b2Vec2;
var _local26:b2ContactConstraint;
var _local27:b2Body;
var _local28:b2Body;
var _local29:Number;
var _local30:Number;
var _local31:b2Vec2;
var _local32:b2Vec2;
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:int;
var _local44:Number;
var _local45:b2ContactConstraintPoint;
var _local46:b2ContactConstraintPoint;
var _local47:Number;
var _local48:Number;
var _local49:Number;
var _local50:Number;
var _local51:Number;
var _local52:Number;
var _local53:Number;
var _local54:Number;
var _local55:Number;
var _local56:Number;
var _local57:Number;
var _local58:Number;
var _local59:Number;
var _local25:int;
while (_local25 < this.m_constraintCount) {
_local26 = this.m_constraints[_local25];
_local27 = _local26.body1;
_local28 = _local26.body2;
_local29 = _local27.m_angularVelocity;
_local30 = _local28.m_angularVelocity;
_local31 = _local27.m_linearVelocity;
_local32 = _local28.m_linearVelocity;
_local33 = _local27.m_invMass;
_local34 = _local27.m_invI;
_local35 = _local28.m_invMass;
_local36 = _local28.m_invI;
_local37 = _local26.normal.x;
_local38 = _local26.normal.y;
_local39 = _local38;
_local40 = -(_local37);
_local41 = _local26.friction;
_local43 = _local26.pointCount;
if (_local26.pointCount == 1){
_local2 = _local26.points[0];
_local7 = (((_local32.x + (-(_local30) * _local2.r2.y)) - _local31.x) - (-(_local29) * _local2.r1.y));
_local8 = (((_local32.y + (_local30 * _local2.r2.x)) - _local31.y) - (_local29 * _local2.r1.x));
_local9 = ((_local7 * _local37) + (_local8 * _local38));
_local11 = (-(_local2.normalMass) * (_local9 - _local2.velocityBias));
_local10 = ((_local7 * _local39) + (_local8 * _local40));
_local12 = (_local2.tangentMass * -(_local10));
_local13 = b2Math.b2Max((_local2.normalImpulse + _local11), 0);
_local11 = (_local13 - _local2.normalImpulse);
_local44 = (_local41 * _local2.normalImpulse);
_local14 = b2Math.b2Clamp((_local2.tangentImpulse + _local12), -(_local44), _local44);
_local12 = (_local14 - _local2.tangentImpulse);
_local15 = ((_local11 * _local37) + (_local12 * _local39));
_local16 = ((_local11 * _local38) + (_local12 * _local40));
_local31.x = (_local31.x - (_local33 * _local15));
_local31.y = (_local31.y - (_local33 * _local16));
_local29 = (_local29 - (_local34 * ((_local2.r1.x * _local16) - (_local2.r1.y * _local15))));
_local32.x = (_local32.x + (_local35 * _local15));
_local32.y = (_local32.y + (_local35 * _local16));
_local30 = (_local30 + (_local36 * ((_local2.r2.x * _local16) - (_local2.r2.y * _local15))));
_local2.normalImpulse = _local13;
_local2.tangentImpulse = _local14;
} else {
_local45 = _local26.points[0];
_local46 = _local26.points[1];
_local47 = _local45.normalImpulse;
_local48 = _local46.normalImpulse;
_local49 = (((_local32.x - (_local30 * _local45.r2.y)) - _local31.x) + (_local29 * _local45.r1.y));
_local50 = (((_local32.y + (_local30 * _local45.r2.x)) - _local31.y) - (_local29 * _local45.r1.x));
_local51 = (((_local32.x - (_local30 * _local46.r2.y)) - _local31.x) + (_local29 * _local46.r1.y));
_local52 = (((_local32.y + (_local30 * _local46.r2.x)) - _local31.y) - (_local29 * _local46.r1.x));
_local53 = ((_local49 * _local37) + (_local50 * _local38));
_local54 = ((_local51 * _local37) + (_local52 * _local38));
_local55 = (_local53 - _local45.velocityBias);
_local56 = (_local54 - _local46.velocityBias);
_local23 = _local26.K;
_local55 = (_local55 - ((_local23.col1.x * _local47) + (_local23.col2.x * _local48)));
_local56 = (_local56 - ((_local23.col1.y * _local47) + (_local23.col2.y * _local48)));
_local57 = 0.001;
while (true) {
_local23 = _local26.normalMass;
_local58 = -(((_local23.col1.x * _local55) + (_local23.col2.x * _local56)));
_local59 = -(((_local23.col1.y * _local55) + (_local23.col2.y * _local56)));
if ((((_local58 >= 0)) && ((_local59 >= 0)))){
_local17 = (_local58 - _local47);
_local18 = (_local59 - _local48);
_local19 = (_local17 * _local37);
_local20 = (_local17 * _local38);
_local21 = (_local18 * _local37);
_local22 = (_local18 * _local38);
_local31.x = (_local31.x - (_local33 * (_local19 + _local21)));
_local31.y = (_local31.y - (_local33 * (_local20 + _local22)));
_local29 = (_local29 - (_local34 * ((((_local45.r1.x * _local20) - (_local45.r1.y * _local19)) + (_local46.r1.x * _local22)) - (_local46.r1.y * _local21))));
_local32.x = (_local32.x + (_local35 * (_local19 + _local21)));
_local32.y = (_local32.y + (_local35 * (_local20 + _local22)));
_local30 = (_local30 + (_local36 * ((((_local45.r2.x * _local20) - (_local45.r2.y * _local19)) + (_local46.r2.x * _local22)) - (_local46.r2.y * _local21))));
_local45.normalImpulse = _local58;
_local46.normalImpulse = _local59;
break;
};
_local58 = (-(_local45.normalMass) * _local55);
_local59 = 0;
_local53 = 0;
_local54 = ((_local26.K.col1.y * _local58) + _local56);
if ((((_local58 >= 0)) && ((_local54 >= 0)))){
_local17 = (_local58 - _local47);
_local18 = (_local59 - _local48);
_local19 = (_local17 * _local37);
_local20 = (_local17 * _local38);
_local21 = (_local18 * _local37);
_local22 = (_local18 * _local38);
_local31.x = (_local31.x - (_local33 * (_local19 + _local21)));
_local31.y = (_local31.y - (_local33 * (_local20 + _local22)));
_local29 = (_local29 - (_local34 * ((((_local45.r1.x * _local20) - (_local45.r1.y * _local19)) + (_local46.r1.x * _local22)) - (_local46.r1.y * _local21))));
_local32.x = (_local32.x + (_local35 * (_local19 + _local21)));
_local32.y = (_local32.y + (_local35 * (_local20 + _local22)));
_local30 = (_local30 + (_local36 * ((((_local45.r2.x * _local20) - (_local45.r2.y * _local19)) + (_local46.r2.x * _local22)) - (_local46.r2.y * _local21))));
_local45.normalImpulse = _local58;
_local46.normalImpulse = _local59;
break;
};
_local58 = 0;
_local59 = (-(_local46.normalMass) * _local56);
_local53 = ((_local26.K.col2.x * _local59) + _local55);
_local54 = 0;
if ((((_local59 >= 0)) && ((_local53 >= 0)))){
_local17 = (_local58 - _local47);
_local18 = (_local59 - _local48);
_local19 = (_local17 * _local37);
_local20 = (_local17 * _local38);
_local21 = (_local18 * _local37);
_local22 = (_local18 * _local38);
_local31.x = (_local31.x - (_local33 * (_local19 + _local21)));
_local31.y = (_local31.y - (_local33 * (_local20 + _local22)));
_local29 = (_local29 - (_local34 * ((((_local45.r1.x * _local20) - (_local45.r1.y * _local19)) + (_local46.r1.x * _local22)) - (_local46.r1.y * _local21))));
_local32.x = (_local32.x + (_local35 * (_local19 + _local21)));
_local32.y = (_local32.y + (_local35 * (_local20 + _local22)));
_local30 = (_local30 + (_local36 * ((((_local45.r2.x * _local20) - (_local45.r2.y * _local19)) + (_local46.r2.x * _local22)) - (_local46.r2.y * _local21))));
_local45.normalImpulse = _local58;
_local46.normalImpulse = _local59;
break;
};
_local58 = 0;
_local59 = 0;
_local53 = _local55;
_local54 = _local56;
if ((((_local53 >= 0)) && ((_local54 >= 0)))){
_local17 = (_local58 - _local47);
_local18 = (_local59 - _local48);
_local19 = (_local17 * _local37);
_local20 = (_local17 * _local38);
_local21 = (_local18 * _local37);
_local22 = (_local18 * _local38);
_local31.x = (_local31.x - (_local33 * (_local19 + _local21)));
_local31.y = (_local31.y - (_local33 * (_local20 + _local22)));
_local29 = (_local29 - (_local34 * ((((_local45.r1.x * _local20) - (_local45.r1.y * _local19)) + (_local46.r1.x * _local22)) - (_local46.r1.y * _local21))));
_local32.x = (_local32.x + (_local35 * (_local19 + _local21)));
_local32.y = (_local32.y + (_local35 * (_local20 + _local22)));
_local30 = (_local30 + (_local36 * ((((_local45.r2.x * _local20) - (_local45.r2.y * _local19)) + (_local46.r2.x * _local22)) - (_local46.r2.y * _local21))));
_local45.normalImpulse = _local58;
_local46.normalImpulse = _local59;
break;
};
break;
};
_local1 = 0;
while (_local1 < _local26.pointCount) {
_local2 = _local26.points[_local1];
_local7 = (((_local32.x - (_local30 * _local2.r2.y)) - _local31.x) + (_local29 * _local2.r1.y));
_local8 = (((_local32.y + (_local30 * _local2.r2.x)) - _local31.y) - (_local29 * _local2.r1.x));
_local10 = ((_local7 * _local39) + (_local8 * _local40));
_local12 = (_local2.tangentMass * -(_local10));
_local44 = (_local41 * _local2.normalImpulse);
_local14 = b2Math.b2Clamp((_local2.tangentImpulse + _local12), -(_local44), _local44);
_local12 = (_local14 - _local2.tangentImpulse);
_local15 = (_local12 * _local39);
_local16 = (_local12 * _local40);
_local31.x = (_local31.x - (_local33 * _local15));
_local31.y = (_local31.y - (_local33 * _local16));
_local29 = (_local29 - (_local34 * ((_local2.r1.x * _local16) - (_local2.r1.y * _local15))));
_local32.x = (_local32.x + (_local35 * _local15));
_local32.y = (_local32.y + (_local35 * _local16));
_local30 = (_local30 + (_local36 * ((_local2.r2.x * _local16) - (_local2.r2.y * _local15))));
_local2.tangentImpulse = _local14;
_local1++;
};
};
_local27.m_angularVelocity = _local29;
_local28.m_angularVelocity = _local30;
_local25++;
};
}
public function FinalizeVelocityConstraints():void{
var _local2:b2ContactConstraint;
var _local3:b2Manifold;
var _local4:int;
var _local5:b2ManifoldPoint;
var _local6:b2ContactConstraintPoint;
var _local1:int;
while (_local1 < this.m_constraintCount) {
_local2 = this.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 _local2:Number = 0;
var _local5:int;
while (_local5 < this.m_constraintCount) {
_local6 = this.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 = (_local35 * _local17);
_local37 = (_local35 * _local18);
_local9.x = (_local9.x - (_local13 * _local36));
_local9.y = (_local9.y - (_local13 * _local37));
_local10 = (_local10 - (_local14 * ((_local22 * _local37) - (_local23 * _local36))));
_local7.m_sweep.a = _local10;
_local7.SynchronizeTransform();
_local11.x = (_local11.x + (_local15 * _local36));
_local11.y = (_local11.y + (_local15 * _local37));
_local12 = (_local12 + (_local16 * ((_local24 * _local37) - (_local25 * _local36))));
_local8.m_sweep.a = _local12;
_local8.SynchronizeTransform();
_local20++;
};
_local5++;
};
return ((_local2 >= (-1.5 * b2Settings.b2_linearSlop)));
}
}
}//package Box2D.Dynamics.Contacts
Section 46
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2NullContact extends b2Contact {
override b2internal function Evaluate(_arg1:b2ContactListener):void{
}
override public function GetManifolds():Array{
return (null);
}
}
}//package Box2D.Dynamics.Contacts
Section 47
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2PolyAndCircleContact extends b2Contact {
private var m_manifolds:Array;
private var m_manifold:b2Manifold;
private var m0:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){
this.m_manifolds = [new b2Manifold()];
this.m0 = new b2Manifold();
super(_arg1, _arg2);
this.m_manifold = this.m_manifolds[0];
b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polygonShape));
b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape));
this.m_manifold.pointCount = 0;
var _local3:b2ManifoldPoint = this.m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override b2internal 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;
this.m0.Set(this.m_manifold);
b2Collision.b2CollidePolygonAndCircle(this.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 (this.m_manifold.pointCount > 0){
_local2 = 0;
while (_local2 < this.m_manifold.pointCount) {
_local10 = this.m_manifold.points[_local2];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < this.m0.pointCount) {
if (_local8[_local13] == true){
} else {
_local5 = this.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(this.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(this.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 < this.m0.pointCount) {
if (_local8[_local2]){
} else {
_local5 = this.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(this.m0.normal);
_local9.separation = _local5.separation;
_local9.id.key = _local5.id._key;
_arg1.Remove(_local9);
};
_local2++;
};
}
override public function GetManifolds():Array{
return (this.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 48
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2PolygonContact extends b2Contact {
private var m0:b2Manifold;
private var m_manifolds:Array;
private var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolygonContact(_arg1:b2Shape, _arg2:b2Shape):void{
this.m0 = new b2Manifold();
this.m_manifolds = [new b2Manifold()];
super(_arg1, _arg2);
this.m_manifold = this.m_manifolds[0];
this.m_manifold.pointCount = 0;
}
override b2internal 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;
this.m0.Set(this.m_manifold);
b2Collision.b2CollidePolygons(this.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 (this.m_manifold.pointCount > 0){
_local8 = 0;
while (_local8 < this.m_manifold.pointCount) {
_local10 = this.m_manifold.points[_local8];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < this.m0.pointCount) {
if (_local9[_local13] == true){
} else {
_local4 = this.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(this.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(this.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 < this.m0.pointCount) {
if (_local9[_local8]){
} else {
_local4 = this.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(this.m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
_local8++;
};
}
override public function GetManifolds():Array{
return (this.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 49
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2DistanceJoint extends b2Joint {
private var m_localAnchor1:b2Vec2;
private var m_localAnchor2:b2Vec2;
private var m_u:b2Vec2;
private var m_frequencyHz:Number;
private var m_dampingRatio:Number;
private var m_gamma:Number;
private var m_bias:Number;
private var m_impulse:Number;
private var m_mass:Number;
private var m_length:Number;
public function b2DistanceJoint(_arg1:b2DistanceJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
this.m_localAnchor1 = new b2Vec2();
this.m_localAnchor2 = new b2Vec2();
this.m_u = new b2Vec2();
super(_arg1);
this.m_localAnchor1.SetV(_arg1.localAnchor1);
this.m_localAnchor2.SetV(_arg1.localAnchor2);
this.m_length = _arg1.length;
this.m_frequencyHz = _arg1.frequencyHz;
this.m_dampingRatio = _arg1.dampingRatio;
this.m_impulse = 0;
this.m_gamma = 0;
this.m_bias = 0;
m_inv_dt = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(this.m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(this.m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2 = new b2Vec2();
_local1.SetV(this.m_u);
_local1.Multiply((m_inv_dt * this.m_impulse));
return (_local1);
}
override public function GetReactionTorque():Number{
return (0);
}
override b2internal function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3: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;
var _local4:b2Body = m_body1;
var _local5:b2Body = m_body2;
_local2 = _local4.m_xf.R;
var _local6:Number = (this.m_localAnchor1.x - _local4.m_sweep.localCenter.x);
var _local7:Number = (this.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;
var _local8:Number = (this.m_localAnchor2.x - _local5.m_sweep.localCenter.x);
var _local9:Number = (this.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;
this.m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6);
this.m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7);
var _local10:Number = Math.sqrt(((this.m_u.x * this.m_u.x) + (this.m_u.y * this.m_u.y)));
if (_local10 > b2Settings.b2_linearSlop){
this.m_u.Multiply((1 / _local10));
} else {
this.m_u.SetZero();
};
var _local11:Number = ((_local6 * this.m_u.y) - (_local7 * this.m_u.x));
var _local12:Number = ((_local8 * this.m_u.y) - (_local9 * this.m_u.x));
var _local13:Number = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12));
this.m_mass = (1 / _local13);
if (this.m_frequencyHz > 0){
_local14 = (_local10 - this.m_length);
_local15 = ((2 * Math.PI) * this.m_frequencyHz);
_local16 = (((2 * this.m_mass) * this.m_dampingRatio) * _local15);
_local17 = ((this.m_mass * _local15) * _local15);
this.m_gamma = (1 / (_arg1.dt * (_local16 + (_arg1.dt * _local17))));
this.m_bias = (((_local14 * _arg1.dt) * _local17) * this.m_gamma);
this.m_mass = (1 / (_local13 + this.m_gamma));
};
if (_arg1.warmStarting){
this.m_impulse = (this.m_impulse * _arg1.dtRatio);
_local18 = (this.m_impulse * this.m_u.x);
_local19 = (this.m_impulse * this.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 {
this.m_impulse = 0;
};
}
override b2internal 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 = (this.m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local6:Number = (this.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 = (this.m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local9:Number = (this.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 = ((this.m_u.x * (_local12 - _local10)) + (this.m_u.y * (_local13 - _local11)));
var _local15:Number = (-(this.m_mass) * ((_local14 + this.m_bias) + (this.m_gamma * this.m_impulse)));
this.m_impulse = (this.m_impulse + _local15);
var _local16:Number = (_local15 * this.m_u.x);
var _local17:Number = (_local15 * this.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 b2internal function SolvePositionConstraints():Boolean{
var _local1:b2Mat22;
if (this.m_frequencyHz > 0){
return (true);
};
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local1 = _local2.m_xf.R;
var _local4:Number = (this.m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local5:Number = (this.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 = (this.m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local8:Number = (this.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 - this.m_length);
_local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
var _local13:Number = (-(this.m_mass) * _local12);
this.m_u.Set(_local9, _local10);
var _local14:Number = (_local13 * this.m_u.x);
var _local15:Number = (_local13 * this.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));
}
}
}//package Box2D.Dynamics.Joints
Section 50
//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(){
this.localAnchor1 = new b2Vec2();
this.localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_distanceJoint;
this.length = 1;
this.frequencyHz = 0;
this.dampingRatio = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
this.localAnchor1.SetV(body1.GetLocalPoint(_arg3));
this.localAnchor2.SetV(body2.GetLocalPoint(_arg4));
var _local5:Number = (_arg4.x - _arg3.x);
var _local6:Number = (_arg4.y - _arg3.y);
this.length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
this.frequencyHz = 0;
this.dampingRatio = 0;
}
}
}//package Box2D.Dynamics.Joints
Section 51
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2GearJoint extends b2Joint {
private var m_ground1:b2Body;
private var m_ground2:b2Body;
private var m_revolute1:b2RevoluteJoint;
private var m_prismatic1:b2PrismaticJoint;
private var m_revolute2:b2RevoluteJoint;
private var m_prismatic2:b2PrismaticJoint;
private var m_groundAnchor1:b2Vec2;
private var m_groundAnchor2:b2Vec2;
private var m_localAnchor1:b2Vec2;
private var m_localAnchor2:b2Vec2;
private var m_J:b2Jacobian;
private var m_constant:Number;
private var m_ratio:Number;
private var m_mass:Number;
private var m_force:Number;
public function b2GearJoint(_arg1:b2GearJointDef){
var _local4:Number;
var _local5:Number;
this.m_groundAnchor1 = new b2Vec2();
this.m_groundAnchor2 = new b2Vec2();
this.m_localAnchor1 = new b2Vec2();
this.m_localAnchor2 = new b2Vec2();
this.m_J = new b2Jacobian();
super(_arg1);
var _local2:int = _arg1.joint1.m_type;
var _local3:int = _arg1.joint2.m_type;
this.m_revolute1 = null;
this.m_prismatic1 = null;
this.m_revolute2 = null;
this.m_prismatic2 = null;
this.m_ground1 = _arg1.joint1.m_body1;
m_body1 = _arg1.joint1.m_body2;
if (_local2 == b2Joint.e_revoluteJoint){
this.m_revolute1 = (_arg1.joint1 as b2RevoluteJoint);
this.m_groundAnchor1.SetV(this.m_revolute1.m_localAnchor1);
this.m_localAnchor1.SetV(this.m_revolute1.m_localAnchor2);
_local4 = this.m_revolute1.GetJointAngle();
} else {
this.m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint);
this.m_groundAnchor1.SetV(this.m_prismatic1.m_localAnchor1);
this.m_localAnchor1.SetV(this.m_prismatic1.m_localAnchor2);
_local4 = this.m_prismatic1.GetJointTranslation();
};
this.m_ground2 = _arg1.joint2.m_body1;
m_body2 = _arg1.joint2.m_body2;
if (_local3 == b2Joint.e_revoluteJoint){
this.m_revolute2 = (_arg1.joint2 as b2RevoluteJoint);
this.m_groundAnchor2.SetV(this.m_revolute2.m_localAnchor1);
this.m_localAnchor2.SetV(this.m_revolute2.m_localAnchor2);
_local5 = this.m_revolute2.GetJointAngle();
} else {
this.m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint);
this.m_groundAnchor2.SetV(this.m_prismatic2.m_localAnchor1);
this.m_localAnchor2.SetV(this.m_prismatic2.m_localAnchor2);
_local5 = this.m_prismatic2.GetJointTranslation();
};
this.m_ratio = _arg1.ratio;
this.m_constant = (_local4 + (this.m_ratio * _local5));
this.m_force = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(this.m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(this.m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2 = new b2Vec2((this.m_force * this.m_J.linear2.x), (this.m_force * this.m_J.linear2.y));
return (_local1);
}
override public function GetReactionTorque():Number{
var _local1:b2Mat22 = m_body2.m_xf.R;
var _local2:Number = (this.m_localAnchor1.x - m_body2.m_sweep.localCenter.x);
var _local3:Number = (this.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 = ((this.m_force * this.m_J.angular2) - ((_local2 * (this.m_force * this.m_J.linear2.y)) - (_local3 * (this.m_force * this.m_J.linear2.x))));
return (_local4);
}
public function GetRatio():Number{
return (this.m_ratio);
}
override b2internal 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 = this.m_ground1;
var _local3:b2Body = this.m_ground2;
var _local4:b2Body = m_body1;
var _local5:b2Body = m_body2;
var _local14:Number = 0;
this.m_J.SetZero();
if (this.m_revolute1){
this.m_J.angular1 = -1;
_local14 = (_local14 + _local4.m_invI);
} else {
_local10 = _local2.m_xf.R;
_local11 = this.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 = (this.m_localAnchor1.x - _local4.m_sweep.localCenter.x);
_local9 = (this.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));
this.m_J.linear1.Set(-(_local6), -(_local7));
this.m_J.angular1 = -(_local12);
_local14 = (_local14 + (_local4.m_invMass + ((_local4.m_invI * _local12) * _local12)));
};
if (this.m_revolute2){
this.m_J.angular2 = -(this.m_ratio);
_local14 = (_local14 + ((this.m_ratio * this.m_ratio) * _local5.m_invI));
} else {
_local10 = _local3.m_xf.R;
_local11 = this.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 = (this.m_localAnchor2.x - _local5.m_sweep.localCenter.x);
_local9 = (this.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));
this.m_J.linear2.Set((-(this.m_ratio) * _local6), (-(this.m_ratio) * _local7));
this.m_J.angular2 = (-(this.m_ratio) * _local12);
_local14 = (_local14 + ((this.m_ratio * this.m_ratio) * (_local5.m_invMass + ((_local5.m_invI * _local12) * _local12))));
};
this.m_mass = (1 / _local14);
if (_arg1.warmStarting){
_local15 = (_arg1.dt * this.m_force);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * _local15) * this.m_J.linear1.x));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * _local15) * this.m_J.linear1.y));
_local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * _local15) * this.m_J.angular1));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * _local15) * this.m_J.linear2.x));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * _local15) * this.m_J.linear2.y));
_local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * _local15) * this.m_J.angular2));
} else {
this.m_force = 0;
};
}
override b2internal function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
var _local4:Number = this.m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
var _local5:Number = ((-(_arg1.inv_dt) * this.m_mass) * _local4);
this.m_force = (this.m_force + _local5);
var _local6:Number = (_arg1.dt * _local5);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local6) * this.m_J.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local6) * this.m_J.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local6) * this.m_J.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local6) * this.m_J.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local6) * this.m_J.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local6) * this.m_J.angular2));
}
override b2internal function SolvePositionConstraints():Boolean{
var _local4:Number;
var _local5:Number;
var _local1:Number = 0;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
if (this.m_revolute1){
_local4 = this.m_revolute1.GetJointAngle();
} else {
_local4 = this.m_prismatic1.GetJointTranslation();
};
if (this.m_revolute2){
_local5 = this.m_revolute2.GetJointAngle();
} else {
_local5 = this.m_prismatic2.GetJointTranslation();
};
var _local6:Number = (this.m_constant - (_local4 + (this.m_ratio * _local5)));
var _local7:Number = (-(this.m_mass) * _local6);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + ((_local2.m_invMass * _local7) * this.m_J.linear1.x));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + ((_local2.m_invMass * _local7) * this.m_J.linear1.y));
_local2.m_sweep.a = (_local2.m_sweep.a + ((_local2.m_invI * _local7) * this.m_J.angular1));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local3.m_invMass * _local7) * this.m_J.linear2.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local3.m_invMass * _local7) * this.m_J.linear2.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local3.m_invI * _local7) * this.m_J.angular2));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((_local1 < b2Settings.b2_linearSlop));
}
}
}//package Box2D.Dynamics.Joints
Section 52
//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;
this.joint1 = null;
this.joint2 = null;
this.ratio = 1;
}
}
}//package Box2D.Dynamics.Joints
Section 53
//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(){
this.linear1 = new b2Vec2();
this.linear2 = new b2Vec2();
super();
}
public function SetZero():void{
this.linear1.SetZero();
this.angular1 = 0;
this.linear2.SetZero();
this.angular2 = 0;
}
public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{
this.linear1.SetV(_arg1);
this.angular1 = _arg2;
this.linear2.SetV(_arg3);
this.angular2 = _arg4;
}
public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{
return ((((((this.linear1.x * _arg1.x) + (this.linear1.y * _arg1.y)) + (this.angular1 * _arg2)) + ((this.linear2.x * _arg3.x) + (this.linear2.y * _arg3.y))) + (this.angular2 * _arg4)));
}
}
}//package Box2D.Dynamics.Joints
Section 54
//b2Joint (Box2D.Dynamics.Joints.b2Joint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2Joint {
b2internal var m_type:int;
b2internal var m_prev:b2Joint;
b2internal var m_next:b2Joint;
b2internal var m_node1:b2JointEdge;
b2internal var m_node2:b2JointEdge;
b2internal var m_body1:b2Body;
b2internal var m_body2:b2Body;
b2internal var m_inv_dt:Number;
b2internal var m_islandFlag:Boolean;
b2internal var m_collideConnected:Boolean;
private var m_userData;
b2internal static const e_unknownJoint:int = 0;
b2internal static const e_revoluteJoint:int = 1;
b2internal static const e_prismaticJoint:int = 2;
b2internal static const e_distanceJoint:int = 3;
b2internal static const e_pulleyJoint:int = 4;
b2internal static const e_mouseJoint:int = 5;
b2internal static const e_gearJoint:int = 6;
b2internal static const e_inactiveLimit:int = 0;
b2internal static const e_atLowerLimit:int = 1;
b2internal static const e_atUpperLimit:int = 2;
b2internal static const e_equalLimits:int = 3;
public function b2Joint(_arg1:b2JointDef){
this.m_node1 = new b2JointEdge();
this.m_node2 = new b2JointEdge();
super();
this.m_type = _arg1.type;
this.m_prev = null;
this.m_next = null;
this.m_body1 = _arg1.body1;
this.m_body2 = _arg1.body2;
this.m_collideConnected = _arg1.collideConnected;
this.m_islandFlag = false;
this.m_userData = _arg1.userData;
}
public function GetType():int{
return (this.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 (this.m_body1);
}
public function GetBody2():b2Body{
return (this.m_body2);
}
public function GetNext():b2Joint{
return (this.m_next);
}
public function GetUserData(){
return (this.m_userData);
}
public function SetUserData(_arg1):void{
this.m_userData = _arg1;
}
b2internal function InitVelocityConstraints(_arg1:b2TimeStep):void{
}
b2internal function SolveVelocityConstraints(_arg1:b2TimeStep):void{
}
b2internal function InitPositionConstraints():void{
}
b2internal function SolvePositionConstraints():Boolean{
return (false);
}
b2internal 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);
}
b2internal static function Destroy(_arg1:b2Joint, _arg2):void{
}
}
}//package Box2D.Dynamics.Joints
Section 55
//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(){
this.type = b2Joint.e_unknownJoint;
this.userData = null;
this.body1 = null;
this.body2 = null;
this.collideConnected = false;
}
}
}//package Box2D.Dynamics.Joints
Section 56
//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 57
//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;
private var m_localAnchor:b2Vec2;
private var m_target:b2Vec2;
private var m_impulse:b2Vec2;
private var m_mass:b2Mat22;
private var m_C:b2Vec2;
private var m_maxForce:Number;
private var m_beta:Number;
private var m_gamma:Number;
public function b2MouseJoint(_arg1:b2MouseJointDef){
this.K = new b2Mat22();
this.K1 = new b2Mat22();
this.K2 = new b2Mat22();
this.m_localAnchor = new b2Vec2();
this.m_target = new b2Vec2();
this.m_impulse = new b2Vec2();
this.m_mass = new b2Mat22();
this.m_C = new b2Vec2();
super(_arg1);
this.m_target.SetV(_arg1.target);
var _local2:Number = (this.m_target.x - m_body2.m_xf.position.x);
var _local3:Number = (this.m_target.y - m_body2.m_xf.position.y);
var _local4:b2Mat22 = m_body2.m_xf.R;
this.m_localAnchor.x = ((_local2 * _local4.col1.x) + (_local3 * _local4.col1.y));
this.m_localAnchor.y = ((_local2 * _local4.col2.x) + (_local3 * _local4.col2.y));
this.m_maxForce = _arg1.maxForce;
this.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));
this.m_gamma = (1 / (_local7 + _local8));
this.m_beta = (_local8 / (_local7 + _local8));
}
override public function GetAnchor1():b2Vec2{
return (this.m_target);
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(this.m_localAnchor));
}
override public function GetReactionForce():b2Vec2{
return (this.m_impulse);
}
override public function GetReactionTorque():Number{
return (0);
}
public function SetTarget(_arg1:b2Vec2):void{
if (m_body2.IsSleeping()){
m_body2.WakeUp();
};
this.m_target = _arg1;
}
override b2internal function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local3:b2Mat22;
var _local2:b2Body = m_body2;
_local3 = _local2.m_xf.R;
var _local4:Number = (this.m_localAnchor.x - _local2.m_sweep.localCenter.x);
var _local5:Number = (this.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;
var _local7:Number = _local2.m_invMass;
var _local8:Number = _local2.m_invI;
this.K1.col1.x = _local7;
this.K1.col2.x = 0;
this.K1.col1.y = 0;
this.K1.col2.y = _local7;
this.K2.col1.x = ((_local8 * _local5) * _local5);
this.K2.col2.x = ((-(_local8) * _local4) * _local5);
this.K2.col1.y = ((-(_local8) * _local4) * _local5);
this.K2.col2.y = ((_local8 * _local4) * _local4);
this.K.SetM(this.K1);
this.K.AddM(this.K2);
this.K.col1.x = (this.K.col1.x + this.m_gamma);
this.K.col2.y = (this.K.col2.y + this.m_gamma);
this.K.Invert(this.m_mass);
this.m_C.x = ((_local2.m_sweep.c.x + _local4) - this.m_target.x);
this.m_C.y = ((_local2.m_sweep.c.y + _local5) - this.m_target.y);
_local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98);
var _local9:Number = (_arg1.dt * this.m_impulse.x);
var _local10:Number = (_arg1.dt * this.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 b2internal 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 = (this.m_localAnchor.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (this.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 = this.m_mass;
_local4 = ((_local8 + ((this.m_beta * _arg1.inv_dt) * this.m_C.x)) + ((this.m_gamma * _arg1.dt) * this.m_impulse.x));
_local5 = ((_local9 + ((this.m_beta * _arg1.inv_dt) * this.m_C.y)) + ((this.m_gamma * _arg1.dt) * this.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 = this.m_impulse.x;
var _local13:Number = this.m_impulse.y;
this.m_impulse.x = (this.m_impulse.x + _local10);
this.m_impulse.y = (this.m_impulse.y + _local11);
var _local14:Number = this.m_impulse.Length();
if (_local14 > this.m_maxForce){
this.m_impulse.Multiply((this.m_maxForce / _local14));
};
_local10 = (this.m_impulse.x - _local12);
_local11 = (this.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 b2internal function SolvePositionConstraints():Boolean{
return (true);
}
}
}//package Box2D.Dynamics.Joints
Section 58
//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(){
this.target = new b2Vec2();
super();
type = b2Joint.e_mouseJoint;
this.maxForce = 0;
this.frequencyHz = 5;
this.dampingRatio = 0.7;
this.timeStep = (1 / 60);
}
}
}//package Box2D.Dynamics.Joints
Section 59
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PrismaticJoint extends b2Joint {
b2internal var m_localAnchor1:b2Vec2;
b2internal var m_localAnchor2:b2Vec2;
b2internal var m_localXAxis1:b2Vec2;
private var m_localYAxis1:b2Vec2;
private var m_refAngle:Number;
private var m_linearJacobian:b2Jacobian;
private var m_linearMass:Number;
private var m_force:Number;
private var m_angularMass:Number;
private var m_torque:Number;
private var m_motorJacobian:b2Jacobian;
private var m_motorMass:Number;
private var m_motorForce:Number;
private var m_limitForce:Number;
private var m_limitPositionImpulse:Number;
private var m_lowerTranslation:Number;
private var m_upperTranslation:Number;
private var m_maxMotorForce:Number;
private var m_motorSpeed:Number;
private var m_enableLimit:Boolean;
private var m_enableMotor:Boolean;
private var m_limitState:int;
public function b2PrismaticJoint(_arg1:b2PrismaticJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
this.m_localAnchor1 = new b2Vec2();
this.m_localAnchor2 = new b2Vec2();
this.m_localXAxis1 = new b2Vec2();
this.m_localYAxis1 = new b2Vec2();
this.m_linearJacobian = new b2Jacobian();
this.m_motorJacobian = new b2Jacobian();
super(_arg1);
this.m_localAnchor1.SetV(_arg1.localAnchor1);
this.m_localAnchor2.SetV(_arg1.localAnchor2);
this.m_localXAxis1.SetV(_arg1.localAxis1);
this.m_localYAxis1.x = -(this.m_localXAxis1.y);
this.m_localYAxis1.y = this.m_localXAxis1.x;
this.m_refAngle = _arg1.referenceAngle;
this.m_linearJacobian.SetZero();
this.m_linearMass = 0;
this.m_force = 0;
this.m_angularMass = 0;
this.m_torque = 0;
this.m_motorJacobian.SetZero();
this.m_motorMass = 0;
this.m_motorForce = 0;
this.m_limitForce = 0;
this.m_limitPositionImpulse = 0;
this.m_lowerTranslation = _arg1.lowerTranslation;
this.m_upperTranslation = _arg1.upperTranslation;
this.m_maxMotorForce = _arg1.maxMotorForce;
this.m_motorSpeed = _arg1.motorSpeed;
this.m_enableLimit = _arg1.enableLimit;
this.m_enableMotor = _arg1.enableMotor;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(this.m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(this.m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Mat22 = m_body1.m_xf.R;
var _local2:Number = (this.m_limitForce * ((_local1.col1.x * this.m_localXAxis1.x) + (_local1.col2.x * this.m_localXAxis1.y)));
var _local3:Number = (this.m_limitForce * ((_local1.col1.y * this.m_localXAxis1.x) + (_local1.col2.y * this.m_localXAxis1.y)));
var _local4:Number = (this.m_force * ((_local1.col1.x * this.m_localYAxis1.x) + (_local1.col2.x * this.m_localYAxis1.y)));
var _local5:Number = (this.m_force * ((_local1.col1.y * this.m_localYAxis1.x) + (_local1.col2.y * this.m_localYAxis1.y)));
return (new b2Vec2(((this.m_limitForce * _local2) + (this.m_force * _local4)), ((this.m_limitForce * _local3) + (this.m_force * _local5))));
}
override public function GetReactionTorque():Number{
return (this.m_torque);
}
public function GetJointTranslation():Number{
var _local3:b2Mat22;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
var _local4:b2Vec2 = _local1.GetWorldPoint(this.m_localAnchor1);
var _local5:b2Vec2 = _local2.GetWorldPoint(this.m_localAnchor2);
var _local6:Number = (_local5.x - _local4.x);
var _local7:Number = (_local5.y - _local4.y);
var _local8:b2Vec2 = _local1.GetWorldVector(this.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 = (this.m_localAnchor1.x - _local1.m_sweep.localCenter.x);
var _local5:Number = (this.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 = (this.m_localAnchor2.x - _local2.m_sweep.localCenter.x);
var _local8:Number = (this.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(this.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 (this.m_enableLimit);
}
public function EnableLimit(_arg1:Boolean):void{
this.m_enableLimit = _arg1;
}
public function GetLowerLimit():Number{
return (this.m_lowerTranslation);
}
public function GetUpperLimit():Number{
return (this.m_upperTranslation);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
this.m_lowerTranslation = _arg1;
this.m_upperTranslation = _arg2;
}
public function IsMotorEnabled():Boolean{
return (this.m_enableMotor);
}
public function EnableMotor(_arg1:Boolean):void{
this.m_enableMotor = _arg1;
}
public function SetMotorSpeed(_arg1:Number):void{
this.m_motorSpeed = _arg1;
}
public function GetMotorSpeed():Number{
return (this.m_motorSpeed);
}
public function SetMaxMotorForce(_arg1:Number):void{
this.m_maxMotorForce = _arg1;
}
public function GetMotorForce():Number{
return (this.m_motorForce);
}
override b2internal 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 = (this.m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (this.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 = (this.m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (this.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 * this.m_localYAxis1.x) + (_local4.col2.x * this.m_localYAxis1.y));
var _local15:Number = ((_local4.col1.y * this.m_localYAxis1.x) + (_local4.col2.y * this.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);
this.m_linearJacobian.linear1.x = -(_local14);
this.m_linearJacobian.linear1.y = -(_local15);
this.m_linearJacobian.linear2.x = _local14;
this.m_linearJacobian.linear2.y = _local15;
this.m_linearJacobian.angular1 = -(((_local16 * _local15) - (_local17 * _local14)));
this.m_linearJacobian.angular2 = ((_local8 * _local15) - (_local9 * _local14));
this.m_linearMass = (((_local10 + ((_local12 * this.m_linearJacobian.angular1) * this.m_linearJacobian.angular1)) + _local11) + ((_local13 * this.m_linearJacobian.angular2) * this.m_linearJacobian.angular2));
this.m_linearMass = (1 / this.m_linearMass);
this.m_angularMass = (_local12 + _local13);
if (this.m_angularMass > Number.MIN_VALUE){
this.m_angularMass = (1 / this.m_angularMass);
};
if (((this.m_enableLimit) || (this.m_enableMotor))){
_local4 = _local2.m_xf.R;
_local18 = ((_local4.col1.x * this.m_localXAxis1.x) + (_local4.col2.x * this.m_localXAxis1.y));
_local19 = ((_local4.col1.y * this.m_localXAxis1.x) + (_local4.col2.y * this.m_localXAxis1.y));
this.m_motorJacobian.linear1.x = -(_local18);
this.m_motorJacobian.linear1.y = -(_local19);
this.m_motorJacobian.linear2.x = _local18;
this.m_motorJacobian.linear2.y = _local19;
this.m_motorJacobian.angular1 = -(((_local16 * _local19) - (_local17 * _local18)));
this.m_motorJacobian.angular2 = ((_local8 * _local19) - (_local9 * _local18));
this.m_motorMass = (((_local10 + ((_local12 * this.m_motorJacobian.angular1) * this.m_motorJacobian.angular1)) + _local11) + ((_local13 * this.m_motorJacobian.angular2) * this.m_motorJacobian.angular2));
this.m_motorMass = (1 / this.m_motorMass);
if (this.m_enableLimit){
_local20 = (_local16 - _local6);
_local21 = (_local17 - _local7);
_local22 = ((_local18 * _local20) + (_local19 * _local21));
if (b2Math.b2Abs((this.m_upperTranslation - this.m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){
this.m_limitState = e_equalLimits;
} else {
if (_local22 <= this.m_lowerTranslation){
if (this.m_limitState != e_atLowerLimit){
this.m_limitForce = 0;
};
this.m_limitState = e_atLowerLimit;
} else {
if (_local22 >= this.m_upperTranslation){
if (this.m_limitState != e_atUpperLimit){
this.m_limitForce = 0;
};
this.m_limitState = e_atUpperLimit;
} else {
this.m_limitState = e_inactiveLimit;
this.m_limitForce = 0;
};
};
};
};
};
if (this.m_enableMotor == false){
this.m_motorForce = 0;
};
if (this.m_enableLimit == false){
this.m_limitForce = 0;
};
if (_arg1.warmStarting){
_local23 = (_arg1.dt * ((this.m_force * this.m_linearJacobian.linear1.x) + ((this.m_motorForce + this.m_limitForce) * this.m_motorJacobian.linear1.x)));
_local24 = (_arg1.dt * ((this.m_force * this.m_linearJacobian.linear1.y) + ((this.m_motorForce + this.m_limitForce) * this.m_motorJacobian.linear1.y)));
_local25 = (_arg1.dt * ((this.m_force * this.m_linearJacobian.linear2.x) + ((this.m_motorForce + this.m_limitForce) * this.m_motorJacobian.linear2.x)));
_local26 = (_arg1.dt * ((this.m_force * this.m_linearJacobian.linear2.y) + ((this.m_motorForce + this.m_limitForce) * this.m_motorJacobian.linear2.y)));
_local27 = (_arg1.dt * (((this.m_force * this.m_linearJacobian.angular1) - this.m_torque) + ((this.m_motorForce + this.m_limitForce) * this.m_motorJacobian.angular1)));
_local28 = (_arg1.dt * (((this.m_force * this.m_linearJacobian.angular2) + this.m_torque) + ((this.m_motorForce + this.m_limitForce) * this.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 {
this.m_force = 0;
this.m_torque = 0;
this.m_limitForce = 0;
this.m_motorForce = 0;
};
this.m_limitPositionImpulse = 0;
}
override b2internal 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 = this.m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
var _local10:Number = ((-(_arg1.inv_dt) * this.m_linearMass) * _local9);
this.m_force = (this.m_force + _local10);
var _local11:Number = (_arg1.dt * _local10);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * this.m_linearJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * this.m_linearJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * this.m_linearJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * this.m_linearJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * this.m_linearJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * this.m_linearJacobian.angular2));
var _local12:Number = (_local3.m_angularVelocity - _local2.m_angularVelocity);
var _local13:Number = ((-(_arg1.inv_dt) * this.m_angularMass) * _local12);
this.m_torque = (this.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 (((this.m_enableMotor) && (!((this.m_limitState == e_equalLimits))))){
_local15 = (this.m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - this.m_motorSpeed);
_local16 = ((-(_arg1.inv_dt) * this.m_motorMass) * _local15);
_local17 = this.m_motorForce;
this.m_motorForce = b2Math.b2Clamp((this.m_motorForce + _local16), -(this.m_maxMotorForce), this.m_maxMotorForce);
_local16 = (this.m_motorForce - _local17);
_local11 = (_arg1.dt * _local16);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * this.m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * this.m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * this.m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * this.m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * this.m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * this.m_motorJacobian.angular2));
};
if (((this.m_enableLimit) && (!((this.m_limitState == e_inactiveLimit))))){
_local18 = this.m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local19 = ((-(_arg1.inv_dt) * this.m_motorMass) * _local18);
if (this.m_limitState == e_equalLimits){
this.m_limitForce = (this.m_limitForce + _local19);
} else {
if (this.m_limitState == e_atLowerLimit){
_local8 = this.m_limitForce;
this.m_limitForce = b2Math.b2Max((this.m_limitForce + _local19), 0);
_local19 = (this.m_limitForce - _local8);
} else {
if (this.m_limitState == e_atUpperLimit){
_local8 = this.m_limitForce;
this.m_limitForce = b2Math.b2Min((this.m_limitForce + _local19), 0);
_local19 = (this.m_limitForce - _local8);
};
};
};
_local11 = (_arg1.dt * _local19);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * this.m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * this.m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * this.m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * this.m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * this.m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * this.m_motorJacobian.angular2));
};
}
override b2internal 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 = (this.m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local12:Number = (this.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 = (this.m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local14:Number = (this.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 * this.m_localYAxis1.x) + (_local9.col2.x * this.m_localYAxis1.y));
var _local22:Number = ((_local9.col1.y * this.m_localYAxis1.x) + (_local9.col2.y * this.m_localYAxis1.y));
var _local23:Number = ((_local21 * _local19) + (_local22 * _local20));
_local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
var _local24:Number = (-(this.m_linearMass) * _local23);
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local24) * this.m_linearJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local24) * this.m_linearJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local24) * this.m_linearJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local24) * this.m_linearJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local24) * this.m_linearJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local24) * this.m_linearJacobian.angular2));
var _local25:Number = b2Math.b2Abs(_local23);
var _local26:Number = ((_local4.m_sweep.a - _local3.m_sweep.a) - this.m_refAngle);
_local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
var _local27:Number = (-(this.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 (((this.m_enableLimit) && (!((this.m_limitState == e_inactiveLimit))))){
_local9 = _local3.m_xf.R;
_local11 = (this.m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local12 = (this.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 = (this.m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local14 = (this.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 * this.m_localXAxis1.x) + (_local9.col2.x * this.m_localXAxis1.y));
_local30 = ((_local9.col1.y * this.m_localXAxis1.x) + (_local9.col2.y * this.m_localXAxis1.y));
_local31 = ((_local29 * _local19) + (_local30 * _local20));
_local32 = 0;
if (this.m_limitState == e_equalLimits){
_local1 = b2Math.b2Clamp(_local31, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local32 = (-(this.m_motorMass) * _local1);
_local25 = b2Math.b2Max(_local25, b2Math.b2Abs(_local26));
} else {
if (this.m_limitState == e_atLowerLimit){
_local1 = (_local31 - this.m_lowerTranslation);
_local25 = b2Math.b2Max(_local25, -(_local1));
_local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local32 = (-(this.m_motorMass) * _local1);
_local2 = this.m_limitPositionImpulse;
this.m_limitPositionImpulse = b2Math.b2Max((this.m_limitPositionImpulse + _local32), 0);
_local32 = (this.m_limitPositionImpulse - _local2);
} else {
if (this.m_limitState == e_atUpperLimit){
_local1 = (_local31 - this.m_upperTranslation);
_local25 = b2Math.b2Max(_local25, _local1);
_local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection);
_local32 = (-(this.m_motorMass) * _local1);
_local2 = this.m_limitPositionImpulse;
this.m_limitPositionImpulse = b2Math.b2Min((this.m_limitPositionImpulse + _local32), 0);
_local32 = (this.m_limitPositionImpulse - _local2);
};
};
};
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local32) * this.m_motorJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local32) * this.m_motorJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local32) * this.m_motorJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local32) * this.m_motorJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local32) * this.m_motorJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local32) * this.m_motorJacobian.angular2));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local25 <= b2Settings.b2_linearSlop)) && ((_local28 <= b2Settings.b2_angularSlop))));
}
}
}//package Box2D.Dynamics.Joints
Section 60
//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(){
this.localAnchor1 = new b2Vec2();
this.localAnchor2 = new b2Vec2();
this.localAxis1 = new b2Vec2();
super();
type = b2Joint.e_prismaticJoint;
this.localAxis1.Set(1, 0);
this.referenceAngle = 0;
this.enableLimit = false;
this.lowerTranslation = 0;
this.upperTranslation = 0;
this.enableMotor = false;
this.maxMotorForce = 0;
this.motorSpeed = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
this.localAnchor1 = body1.GetLocalPoint(_arg3);
this.localAnchor2 = body2.GetLocalPoint(_arg3);
this.localAxis1 = body1.GetLocalVector(_arg4);
this.referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 61
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PulleyJoint extends b2Joint {
private var m_ground:b2Body;
private var m_groundAnchor1:b2Vec2;
private var m_groundAnchor2:b2Vec2;
private var m_localAnchor1:b2Vec2;
private var m_localAnchor2:b2Vec2;
private var m_u1:b2Vec2;
private var m_u2:b2Vec2;
private var m_constant:Number;
private var m_ratio:Number;
private var m_maxLength1:Number;
private var m_maxLength2:Number;
private var m_pulleyMass:Number;
private var m_limitMass1:Number;
private var m_limitMass2:Number;
private var m_force:Number;
private var m_limitForce1:Number;
private var m_limitForce2:Number;
private var m_positionImpulse:Number;
private var m_limitPositionImpulse1:Number;
private var m_limitPositionImpulse2:Number;
private var m_state:int;
private var m_limitState1:int;
private var m_limitState2:int;
b2internal static const b2_minPulleyLength:Number = 2;
public function b2PulleyJoint(_arg1:b2PulleyJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
this.m_groundAnchor1 = new b2Vec2();
this.m_groundAnchor2 = new b2Vec2();
this.m_localAnchor1 = new b2Vec2();
this.m_localAnchor2 = new b2Vec2();
this.m_u1 = new b2Vec2();
this.m_u2 = new b2Vec2();
super(_arg1);
this.m_ground = m_body1.m_world.m_groundBody;
this.m_groundAnchor1.x = (_arg1.groundAnchor1.x - this.m_ground.m_xf.position.x);
this.m_groundAnchor1.y = (_arg1.groundAnchor1.y - this.m_ground.m_xf.position.y);
this.m_groundAnchor2.x = (_arg1.groundAnchor2.x - this.m_ground.m_xf.position.x);
this.m_groundAnchor2.y = (_arg1.groundAnchor2.y - this.m_ground.m_xf.position.y);
this.m_localAnchor1.SetV(_arg1.localAnchor1);
this.m_localAnchor2.SetV(_arg1.localAnchor2);
this.m_ratio = _arg1.ratio;
this.m_constant = (_arg1.length1 + (this.m_ratio * _arg1.length2));
this.m_maxLength1 = b2Math.b2Min(_arg1.maxLength1, (this.m_constant - (this.m_ratio * b2_minPulleyLength)));
this.m_maxLength2 = b2Math.b2Min(_arg1.maxLength2, ((this.m_constant - b2_minPulleyLength) / this.m_ratio));
this.m_force = 0;
this.m_limitForce1 = 0;
this.m_limitForce2 = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(this.m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(this.m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2 = this.m_u2.Copy();
_local1.Multiply(this.m_force);
return (_local1);
}
override public function GetReactionTorque():Number{
return (0);
}
public function GetGroundAnchor1():b2Vec2{
var _local1:b2Vec2 = this.m_ground.m_xf.position.Copy();
_local1.Add(this.m_groundAnchor1);
return (_local1);
}
public function GetGroundAnchor2():b2Vec2{
var _local1:b2Vec2 = this.m_ground.m_xf.position.Copy();
_local1.Add(this.m_groundAnchor2);
return (_local1);
}
public function GetLength1():Number{
var _local1:b2Vec2 = m_body1.GetWorldPoint(this.m_localAnchor1);
var _local2:Number = (this.m_ground.m_xf.position.x + this.m_groundAnchor1.x);
var _local3:Number = (this.m_ground.m_xf.position.y + this.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(this.m_localAnchor2);
var _local2:Number = (this.m_ground.m_xf.position.x + this.m_groundAnchor2.x);
var _local3:Number = (this.m_ground.m_xf.position.y + this.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 (this.m_ratio);
}
override b2internal 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 = (this.m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local6:Number = (this.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 = (this.m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (this.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 = (this.m_ground.m_xf.position.x + this.m_groundAnchor1.x);
var _local15:Number = (this.m_ground.m_xf.position.y + this.m_groundAnchor1.y);
var _local16:Number = (this.m_ground.m_xf.position.x + this.m_groundAnchor2.x);
var _local17:Number = (this.m_ground.m_xf.position.y + this.m_groundAnchor2.y);
this.m_u1.Set((_local10 - _local14), (_local11 - _local15));
this.m_u2.Set((_local12 - _local16), (_local13 - _local17));
var _local18:Number = this.m_u1.Length();
var _local19:Number = this.m_u2.Length();
if (_local18 > b2Settings.b2_linearSlop){
this.m_u1.Multiply((1 / _local18));
} else {
this.m_u1.SetZero();
};
if (_local19 > b2Settings.b2_linearSlop){
this.m_u2.Multiply((1 / _local19));
} else {
this.m_u2.SetZero();
};
var _local20:Number = ((this.m_constant - _local18) - (this.m_ratio * _local19));
if (_local20 > 0){
this.m_state = e_inactiveLimit;
this.m_force = 0;
} else {
this.m_state = e_atUpperLimit;
this.m_positionImpulse = 0;
};
if (_local18 < this.m_maxLength1){
this.m_limitState1 = e_inactiveLimit;
this.m_limitForce1 = 0;
} else {
this.m_limitState1 = e_atUpperLimit;
this.m_limitPositionImpulse1 = 0;
};
if (_local19 < this.m_maxLength2){
this.m_limitState2 = e_inactiveLimit;
this.m_limitForce2 = 0;
} else {
this.m_limitState2 = e_atUpperLimit;
this.m_limitPositionImpulse2 = 0;
};
var _local21:Number = ((_local5 * this.m_u1.y) - (_local6 * this.m_u1.x));
var _local22:Number = ((_local8 * this.m_u2.y) - (_local9 * this.m_u2.x));
this.m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21));
this.m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22));
this.m_pulleyMass = (this.m_limitMass1 + ((this.m_ratio * this.m_ratio) * this.m_limitMass2));
this.m_limitMass1 = (1 / this.m_limitMass1);
this.m_limitMass2 = (1 / this.m_limitMass2);
this.m_pulleyMass = (1 / this.m_pulleyMass);
if (_arg1.warmStarting){
_local23 = ((_arg1.dt * (-(this.m_force) - this.m_limitForce1)) * this.m_u1.x);
_local24 = ((_arg1.dt * (-(this.m_force) - this.m_limitForce1)) * this.m_u1.y);
_local25 = ((_arg1.dt * ((-(this.m_ratio) * this.m_force) - this.m_limitForce2)) * this.m_u2.x);
_local26 = ((_arg1.dt * ((-(this.m_ratio) * this.m_force) - this.m_limitForce2)) * this.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 {
this.m_force = 0;
this.m_limitForce1 = 0;
this.m_limitForce2 = 0;
};
}
override b2internal 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 = (this.m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local6:Number = (this.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 = (this.m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (this.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 (this.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 = (-(((this.m_u1.x * _local10) + (this.m_u1.y * _local11))) - (this.m_ratio * ((this.m_u2.x * _local12) + (this.m_u2.y * _local13))));
_local19 = ((-(_arg1.inv_dt) * this.m_pulleyMass) * _local18);
_local20 = this.m_force;
this.m_force = b2Math.b2Max(0, (this.m_force + _local19));
_local19 = (this.m_force - _local20);
_local14 = ((-(_arg1.dt) * _local19) * this.m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * this.m_u1.y);
_local16 = (((-(_arg1.dt) * this.m_ratio) * _local19) * this.m_u2.x);
_local17 = (((-(_arg1.dt) * this.m_ratio) * _local19) * this.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 (this.m_limitState1 == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local18 = -(((this.m_u1.x * _local10) + (this.m_u1.y * _local11)));
_local19 = ((-(_arg1.inv_dt) * this.m_limitMass1) * _local18);
_local20 = this.m_limitForce1;
this.m_limitForce1 = b2Math.b2Max(0, (this.m_limitForce1 + _local19));
_local19 = (this.m_limitForce1 - _local20);
_local14 = ((-(_arg1.dt) * _local19) * this.m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * this.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 (this.m_limitState2 == e_atUpperLimit){
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = -(((this.m_u2.x * _local12) + (this.m_u2.y * _local13)));
_local19 = ((-(_arg1.inv_dt) * this.m_limitMass2) * _local18);
_local20 = this.m_limitForce2;
this.m_limitForce2 = b2Math.b2Max(0, (this.m_limitForce2 + _local19));
_local19 = (this.m_limitForce2 - _local20);
_local16 = ((-(_arg1.dt) * _local19) * this.m_u2.x);
_local17 = ((-(_arg1.dt) * _local19) * this.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 b2internal 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 = (this.m_ground.m_xf.position.x + this.m_groundAnchor1.x);
var _local5:Number = (this.m_ground.m_xf.position.y + this.m_groundAnchor1.y);
var _local6:Number = (this.m_ground.m_xf.position.x + this.m_groundAnchor2.x);
var _local7:Number = (this.m_ground.m_xf.position.y + this.m_groundAnchor2.y);
var _local23:Number = 0;
if (this.m_state == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (this.m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (this.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 = (this.m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (this.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);
this.m_u1.Set((_local12 - _local4), (_local13 - _local5));
this.m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local16 = this.m_u1.Length();
_local17 = this.m_u2.Length();
if (_local16 > b2Settings.b2_linearSlop){
this.m_u1.Multiply((1 / _local16));
} else {
this.m_u1.SetZero();
};
if (_local17 > b2Settings.b2_linearSlop){
this.m_u2.Multiply((1 / _local17));
} else {
this.m_u2.SetZero();
};
_local18 = ((this.m_constant - _local16) - (this.m_ratio * _local17));
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(this.m_pulleyMass) * _local18);
_local20 = this.m_positionImpulse;
this.m_positionImpulse = b2Math.b2Max(0, (this.m_positionImpulse + _local19));
_local19 = (this.m_positionImpulse - _local20);
_local12 = (-(_local19) * this.m_u1.x);
_local13 = (-(_local19) * this.m_u1.y);
_local14 = ((-(this.m_ratio) * _local19) * this.m_u2.x);
_local15 = ((-(this.m_ratio) * _local19) * this.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 (this.m_limitState1 == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (this.m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (this.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);
this.m_u1.Set((_local12 - _local4), (_local13 - _local5));
_local16 = this.m_u1.Length();
if (_local16 > b2Settings.b2_linearSlop){
this.m_u1.x = (this.m_u1.x * (1 / _local16));
this.m_u1.y = (this.m_u1.y * (1 / _local16));
} else {
this.m_u1.SetZero();
};
_local18 = (this.m_maxLength1 - _local16);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(this.m_limitMass1) * _local18);
_local21 = this.m_limitPositionImpulse1;
this.m_limitPositionImpulse1 = b2Math.b2Max(0, (this.m_limitPositionImpulse1 + _local19));
_local19 = (this.m_limitPositionImpulse1 - _local21);
_local12 = (-(_local19) * this.m_u1.x);
_local13 = (-(_local19) * this.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 (this.m_limitState2 == e_atUpperLimit){
_local3 = _local2.m_xf.R;
_local10 = (this.m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (this.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);
this.m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local17 = this.m_u2.Length();
if (_local17 > b2Settings.b2_linearSlop){
this.m_u2.x = (this.m_u2.x * (1 / _local17));
this.m_u2.y = (this.m_u2.y * (1 / _local17));
} else {
this.m_u2.SetZero();
};
_local18 = (this.m_maxLength2 - _local17);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(this.m_limitMass2) * _local18);
_local21 = this.m_limitPositionImpulse2;
this.m_limitPositionImpulse2 = b2Math.b2Max(0, (this.m_limitPositionImpulse2 + _local19));
_local19 = (this.m_limitPositionImpulse2 - _local21);
_local14 = (-(_local19) * this.m_u2.x);
_local15 = (-(_local19) * this.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 62
//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(){
this.groundAnchor1 = new b2Vec2();
this.groundAnchor2 = new b2Vec2();
this.localAnchor1 = new b2Vec2();
this.localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_pulleyJoint;
this.groundAnchor1.Set(-1, 1);
this.groundAnchor2.Set(1, 1);
this.localAnchor1.Set(-1, 0);
this.localAnchor2.Set(1, 0);
this.length1 = 0;
this.maxLength1 = 0;
this.length2 = 0;
this.maxLength2 = 0;
this.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;
this.groundAnchor1.SetV(_arg3);
this.groundAnchor2.SetV(_arg4);
this.localAnchor1 = body1.GetLocalPoint(_arg5);
this.localAnchor2 = body2.GetLocalPoint(_arg6);
var _local8:Number = (_arg5.x - _arg3.x);
var _local9:Number = (_arg5.y - _arg3.y);
this.length1 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
var _local10:Number = (_arg6.x - _arg4.x);
var _local11:Number = (_arg6.y - _arg4.y);
this.length2 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
this.ratio = _arg7;
var _local12:Number = (this.length1 + (this.ratio * this.length2));
this.maxLength1 = (_local12 - (this.ratio * b2PulleyJoint.b2_minPulleyLength));
this.maxLength2 = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / this.ratio);
}
}
}//package Box2D.Dynamics.Joints
Section 63
//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;
b2internal var m_localAnchor1:b2Vec2;
b2internal var m_localAnchor2:b2Vec2;
private var m_pivotForce:b2Vec2;
private var m_motorForce:Number;
private var m_limitForce:Number;
private var m_limitPositionImpulse:Number;
private var m_pivotMass:b2Mat22;
private var m_motorMass:Number;
private var m_enableMotor:Boolean;
private var m_maxMotorTorque:Number;
private var m_motorSpeed:Number;
private var m_enableLimit:Boolean;
private var m_referenceAngle:Number;
private var m_lowerAngle:Number;
private var m_upperAngle:Number;
private var m_limitState:int;
private var m_lastWarmStartingPivotForce:b2Vec2;
private static var tImpulse:b2Vec2 = new b2Vec2();
public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){
this.K = new b2Mat22();
this.K1 = new b2Mat22();
this.K2 = new b2Mat22();
this.K3 = new b2Mat22();
this.m_localAnchor1 = new b2Vec2();
this.m_localAnchor2 = new b2Vec2();
this.m_pivotForce = new b2Vec2();
this.m_pivotMass = new b2Mat22();
this.m_lastWarmStartingPivotForce = new b2Vec2();
super(_arg1);
this.m_localAnchor1.SetV(_arg1.localAnchor1);
this.m_localAnchor2.SetV(_arg1.localAnchor2);
this.m_referenceAngle = _arg1.referenceAngle;
this.m_pivotForce.Set(0, 0);
this.m_motorForce = 0;
this.m_limitForce = 0;
this.m_limitPositionImpulse = 0;
this.m_lowerAngle = _arg1.lowerAngle;
this.m_upperAngle = _arg1.upperAngle;
this.m_maxMotorTorque = _arg1.maxMotorTorque;
this.m_motorSpeed = _arg1.motorSpeed;
this.m_enableLimit = _arg1.enableLimit;
this.m_enableMotor = _arg1.enableMotor;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(this.m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(this.m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
return (this.m_pivotForce);
}
override public function GetReactionTorque():Number{
return (this.m_limitForce);
}
public function GetJointAngle():Number{
return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - this.m_referenceAngle));
}
public function GetJointSpeed():Number{
return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity));
}
public function IsLimitEnabled():Boolean{
return (this.m_enableLimit);
}
public function EnableLimit(_arg1:Boolean):void{
this.m_enableLimit = _arg1;
}
public function GetLowerLimit():Number{
return (this.m_lowerAngle);
}
public function GetUpperLimit():Number{
return (this.m_upperAngle);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
this.m_lowerAngle = _arg1;
this.m_upperAngle = _arg2;
}
public function IsMotorEnabled():Boolean{
return (this.m_enableMotor);
}
public function EnableMotor(_arg1:Boolean):void{
this.m_enableMotor = _arg1;
}
public function SetMotorSpeed(_arg1:Number):void{
this.m_motorSpeed = _arg1;
}
public function GetMotorSpeed():Number{
return (this.m_motorSpeed);
}
public function SetMaxMotorTorque(_arg1:Number):void{
this.m_maxMotorTorque = _arg1;
}
public function GetMotorTorque():Number{
return (this.m_motorForce);
}
override b2internal function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local5:Number;
var _local14:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local6:Number = (this.m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (this.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 = (this.m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (this.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;
this.K1.col1.x = (_local10 + _local11);
this.K1.col2.x = 0;
this.K1.col1.y = 0;
this.K1.col2.y = (_local10 + _local11);
this.K2.col1.x = ((_local12 * _local7) * _local7);
this.K2.col2.x = ((-(_local12) * _local6) * _local7);
this.K2.col1.y = ((-(_local12) * _local6) * _local7);
this.K2.col2.y = ((_local12 * _local6) * _local6);
this.K3.col1.x = ((_local13 * _local9) * _local9);
this.K3.col2.x = ((-(_local13) * _local8) * _local9);
this.K3.col1.y = ((-(_local13) * _local8) * _local9);
this.K3.col2.y = ((_local13 * _local8) * _local8);
this.K.SetM(this.K1);
this.K.AddM(this.K2);
this.K.AddM(this.K3);
this.K.Invert(this.m_pivotMass);
this.m_motorMass = (1 / (_local12 + _local13));
if (this.m_enableMotor == false){
this.m_motorForce = 0;
};
if (this.m_enableLimit){
_local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - this.m_referenceAngle);
if (b2Math.b2Abs((this.m_upperAngle - this.m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){
this.m_limitState = e_equalLimits;
} else {
if (_local14 <= this.m_lowerAngle){
if (this.m_limitState != e_atLowerLimit){
this.m_limitForce = 0;
};
this.m_limitState = e_atLowerLimit;
} else {
if (_local14 >= this.m_upperAngle){
if (this.m_limitState != e_atUpperLimit){
this.m_limitForce = 0;
};
this.m_limitState = e_atUpperLimit;
} else {
this.m_limitState = e_inactiveLimit;
this.m_limitForce = 0;
};
};
};
} else {
this.m_limitForce = 0;
};
if (_arg1.warmStarting){
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - ((_arg1.dt * _local10) * this.m_pivotForce.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - ((_arg1.dt * _local10) * this.m_pivotForce.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_arg1.dt * _local12) * ((((_local6 * this.m_pivotForce.y) - (_local7 * this.m_pivotForce.x)) + this.m_motorForce) + this.m_limitForce)));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_arg1.dt * _local11) * this.m_pivotForce.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_arg1.dt * _local11) * this.m_pivotForce.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_arg1.dt * _local13) * ((((_local8 * this.m_pivotForce.y) - (_local9 * this.m_pivotForce.x)) + this.m_motorForce) + this.m_limitForce)));
} else {
this.m_pivotForce.SetZero();
this.m_motorForce = 0;
this.m_limitForce = 0;
};
this.m_limitPositionImpulse = 0;
}
override b2internal function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local5:Number;
var _local10: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 = (this.m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (this.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 = (this.m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (this.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) * ((this.m_pivotMass.col1.x * _local11) + (this.m_pivotMass.col2.x * _local12)));
var _local14:Number = (-(_arg1.inv_dt) * ((this.m_pivotMass.col1.y * _local11) + (this.m_pivotMass.col2.y * _local12)));
if (_arg1.warmStarting){
this.m_pivotForce.x = (this.m_pivotForce.x + _local13);
this.m_pivotForce.y = (this.m_pivotForce.y + _local14);
} else {
this.m_pivotForce.x = this.m_lastWarmStartingPivotForce.x;
this.m_pivotForce.y = this.m_lastWarmStartingPivotForce.y;
};
var _local15:Number = (_arg1.dt * _local13);
var _local16:Number = (_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 (((this.m_enableMotor) && (!((this.m_limitState == e_equalLimits))))){
_local17 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - this.m_motorSpeed);
_local18 = ((-(_arg1.inv_dt) * this.m_motorMass) * _local17);
_local19 = this.m_motorForce;
this.m_motorForce = b2Math.b2Clamp((this.m_motorForce + _local18), -(this.m_maxMotorTorque), this.m_maxMotorTorque);
_local18 = (this.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 (((this.m_enableLimit) && (!((this.m_limitState == e_inactiveLimit))))){
_local20 = (_local3.m_angularVelocity - _local2.m_angularVelocity);
_local21 = ((-(_arg1.inv_dt) * this.m_motorMass) * _local20);
if (this.m_limitState == e_equalLimits){
this.m_limitForce = (this.m_limitForce + _local21);
} else {
if (this.m_limitState == e_atLowerLimit){
_local10 = this.m_limitForce;
this.m_limitForce = b2Math.b2Max((this.m_limitForce + _local21), 0);
_local21 = (this.m_limitForce - _local10);
} else {
if (this.m_limitState == e_atUpperLimit){
_local10 = this.m_limitForce;
this.m_limitForce = b2Math.b2Min((this.m_limitForce + _local21), 0);
_local21 = (this.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 b2internal 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 = (this.m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local8:Number = (this.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 = (this.m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local11:Number = (this.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;
this.K1.col1.x = (_local18 + _local19);
this.K1.col2.x = 0;
this.K1.col1.y = 0;
this.K1.col2.y = (_local18 + _local19);
this.K2.col1.x = ((_local20 * _local8) * _local8);
this.K2.col2.x = ((-(_local20) * _local7) * _local8);
this.K2.col1.y = ((-(_local20) * _local7) * _local8);
this.K2.col2.y = ((_local20 * _local7) * _local7);
this.K3.col1.x = ((_local21 * _local11) * _local11);
this.K3.col2.x = ((-(_local21) * _local10) * _local11);
this.K3.col1.y = ((-(_local21) * _local10) * _local11);
this.K3.col2.y = ((_local21 * _local10) * _local10);
this.K.SetM(this.K1);
this.K.AddM(this.K2);
this.K.AddM(this.K3);
this.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 (((this.m_enableLimit) && (!((this.m_limitState == e_inactiveLimit))))){
_local25 = ((_local4.m_sweep.a - _local3.m_sweep.a) - this.m_referenceAngle);
_local26 = 0;
if (this.m_limitState == e_equalLimits){
_local2 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local26 = (-(this.m_motorMass) * _local2);
_local24 = b2Math.b2Abs(_local2);
} else {
if (this.m_limitState == e_atLowerLimit){
_local2 = (_local25 - this.m_lowerAngle);
_local24 = b2Math.b2Max(0, -(_local2));
_local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0);
_local26 = (-(this.m_motorMass) * _local2);
_local1 = this.m_limitPositionImpulse;
this.m_limitPositionImpulse = b2Math.b2Max((this.m_limitPositionImpulse + _local26), 0);
_local26 = (this.m_limitPositionImpulse - _local1);
} else {
if (this.m_limitState == e_atUpperLimit){
_local2 = (_local25 - this.m_upperAngle);
_local24 = b2Math.b2Max(0, _local2);
_local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection);
_local26 = (-(this.m_motorMass) * _local2);
_local1 = this.m_limitPositionImpulse;
this.m_limitPositionImpulse = b2Math.b2Min((this.m_limitPositionImpulse + _local26), 0);
_local26 = (this.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 64
//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(){
this.localAnchor1 = new b2Vec2();
this.localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_revoluteJoint;
this.localAnchor1.Set(0, 0);
this.localAnchor2.Set(0, 0);
this.referenceAngle = 0;
this.lowerAngle = 0;
this.upperAngle = 0;
this.maxMotorTorque = 0;
this.motorSpeed = 0;
this.enableLimit = false;
this.enableMotor = false;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
this.localAnchor1 = body1.GetLocalPoint(_arg3);
this.localAnchor2 = body2.GetLocalPoint(_arg3);
this.referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 65
//b2Body (Box2D.Dynamics.b2Body)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Common.*;
public class b2Body {
b2internal var m_flags:uint;
private var m_type:int;
b2internal var m_xf:b2XForm;
b2internal var m_sweep:b2Sweep;
b2internal var m_linearVelocity:b2Vec2;
b2internal var m_angularVelocity:Number;
b2internal var m_force:b2Vec2;
b2internal var m_torque:Number;
b2internal var m_world:b2World;
b2internal var m_prev:b2Body;
b2internal var m_next:b2Body;
b2internal var m_shapeList:b2Shape;
b2internal var m_shapeCount:int;
b2internal var m_jointList:b2JointEdge;
b2internal var m_contactList:b2ContactEdge;
b2internal var m_mass:Number;
b2internal var m_invMass:Number;
b2internal var m_I:Number;
b2internal var m_invI:Number;
b2internal var m_linearDamping:Number;
b2internal var m_angularDamping:Number;
b2internal var m_sleepTime:Number;
private var m_userData;
private static var s_massData:b2MassData = new b2MassData();
private static var s_xf1:b2XForm = new b2XForm();
b2internal static var e_frozenFlag:uint = 2;
b2internal static var e_islandFlag:uint = 4;
b2internal static var e_sleepFlag:uint = 8;
b2internal static var e_allowSleepFlag:uint = 16;
b2internal static var e_bulletFlag:uint = 32;
b2internal static var e_fixedRotationFlag:uint = 64;
b2internal static var e_staticType:uint = 1;
b2internal static var e_dynamicType:uint = 2;
b2internal static var e_maxTypes:uint = 3;
public function b2Body(_arg1:b2BodyDef, _arg2:b2World){
this.m_xf = new b2XForm();
this.m_sweep = new b2Sweep();
this.m_linearVelocity = new b2Vec2();
this.m_force = new b2Vec2();
super();
this.m_flags = 0;
if (_arg1.isBullet){
this.m_flags = (this.m_flags | e_bulletFlag);
};
if (_arg1.fixedRotation){
this.m_flags = (this.m_flags | e_fixedRotationFlag);
};
if (_arg1.allowSleep){
this.m_flags = (this.m_flags | e_allowSleepFlag);
};
if (_arg1.isSleeping){
this.m_flags = (this.m_flags | e_sleepFlag);
};
this.m_world = _arg2;
this.m_xf.position.SetV(_arg1.position);
this.m_xf.R.Set(_arg1.angle);
this.m_sweep.localCenter.SetV(_arg1.massData.center);
this.m_sweep.t0 = 1;
this.m_sweep.a0 = (this.m_sweep.a = _arg1.angle);
var _local3:b2Mat22 = this.m_xf.R;
var _local4:b2Vec2 = this.m_sweep.localCenter;
this.m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
this.m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
this.m_sweep.c.x = (this.m_sweep.c.x + this.m_xf.position.x);
this.m_sweep.c.y = (this.m_sweep.c.y + this.m_xf.position.y);
this.m_sweep.c0.SetV(this.m_sweep.c);
this.m_jointList = null;
this.m_contactList = null;
this.m_prev = null;
this.m_next = null;
this.m_linearDamping = _arg1.linearDamping;
this.m_angularDamping = _arg1.angularDamping;
this.m_force.Set(0, 0);
this.m_torque = 0;
this.m_linearVelocity.SetZero();
this.m_angularVelocity = 0;
this.m_sleepTime = 0;
this.m_invMass = 0;
this.m_I = 0;
this.m_invI = 0;
this.m_mass = _arg1.massData.mass;
if (this.m_mass > 0){
this.m_invMass = (1 / this.m_mass);
};
if ((this.m_flags & b2Body.e_fixedRotationFlag) == 0){
this.m_I = _arg1.massData.I;
};
if (this.m_I > 0){
this.m_invI = (1 / this.m_I);
};
if ((((this.m_invMass == 0)) && ((this.m_invI == 0)))){
this.m_type = e_staticType;
} else {
this.m_type = e_dynamicType;
};
this.m_userData = _arg1.userData;
this.m_shapeList = null;
this.m_shapeCount = 0;
}
public function CreateShape(_arg1:b2ShapeDef):b2Shape{
if (this.m_world.m_lock == true){
return (null);
};
var _local2:b2Shape = b2Shape.Create(_arg1, this.m_world.m_blockAllocator);
_local2.m_next = this.m_shapeList;
this.m_shapeList = _local2;
this.m_shapeCount++;
_local2.m_body = this;
_local2.CreateProxy(this.m_world.m_broadPhase, this.m_xf);
_local2.UpdateSweepRadius(this.m_sweep.localCenter);
return (_local2);
}
public function DestroyShape(_arg1:b2Shape):void{
if (this.m_world.m_lock == true){
return;
};
_arg1.DestroyProxy(this.m_world.m_broadPhase);
var _local2:b2Shape = this.m_shapeList;
var _local3:b2Shape;
var _local4:Boolean;
while (_local2 != null) {
if (_local2 == _arg1){
if (_local3){
_local3.m_next = _arg1.m_next;
} else {
this.m_shapeList = _arg1.m_next;
};
_local4 = true;
break;
};
_local3 = _local2;
_local2 = _local2.m_next;
};
_arg1.m_body = null;
_arg1.m_next = null;
this.m_shapeCount--;
b2Shape.Destroy(_arg1, this.m_world.m_blockAllocator);
}
public function SetMass(_arg1:b2MassData):void{
var _local2:b2Shape;
if (this.m_world.m_lock == true){
return;
};
this.m_invMass = 0;
this.m_I = 0;
this.m_invI = 0;
this.m_mass = _arg1.mass;
if (this.m_mass > 0){
this.m_invMass = (1 / this.m_mass);
};
if ((this.m_flags & b2Body.e_fixedRotationFlag) == 0){
this.m_I = _arg1.I;
};
if (this.m_I > 0){
this.m_invI = (1 / this.m_I);
};
this.m_sweep.localCenter.SetV(_arg1.center);
var _local3:b2Mat22 = this.m_xf.R;
var _local4:b2Vec2 = this.m_sweep.localCenter;
this.m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
this.m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
this.m_sweep.c.x = (this.m_sweep.c.x + this.m_xf.position.x);
this.m_sweep.c.y = (this.m_sweep.c.y + this.m_xf.position.y);
this.m_sweep.c0.SetV(this.m_sweep.c);
_local2 = this.m_shapeList;
while (_local2) {
_local2.UpdateSweepRadius(this.m_sweep.localCenter);
_local2 = _local2.m_next;
};
var _local5:int = this.m_type;
if ((((this.m_invMass == 0)) && ((this.m_invI == 0)))){
this.m_type = e_staticType;
} else {
this.m_type = e_dynamicType;
};
if (_local5 != this.m_type){
_local2 = this.m_shapeList;
while (_local2) {
_local2.RefilterProxy(this.m_world.m_broadPhase, this.m_xf);
_local2 = _local2.m_next;
};
};
}
public function SetMassFromShapes():void{
var _local1:b2Shape;
if (this.m_world.m_lock == true){
return;
};
this.m_mass = 0;
this.m_invMass = 0;
this.m_I = 0;
this.m_invI = 0;
var _local2:Number = 0;
var _local3:Number = 0;
var _local4:b2MassData = s_massData;
_local1 = this.m_shapeList;
while (_local1) {
_local1.ComputeMass(_local4);
this.m_mass = (this.m_mass + _local4.mass);
_local2 = (_local2 + (_local4.mass * _local4.center.x));
_local3 = (_local3 + (_local4.mass * _local4.center.y));
this.m_I = (this.m_I + _local4.I);
_local1 = _local1.m_next;
};
if (this.m_mass > 0){
this.m_invMass = (1 / this.m_mass);
_local2 = (_local2 * this.m_invMass);
_local3 = (_local3 * this.m_invMass);
};
if ((((this.m_I > 0)) && (((this.m_flags & e_fixedRotationFlag) == 0)))){
this.m_I = (this.m_I - (this.m_mass * ((_local2 * _local2) + (_local3 * _local3))));
this.m_invI = (1 / this.m_I);
} else {
this.m_I = 0;
this.m_invI = 0;
};
this.m_sweep.localCenter.Set(_local2, _local3);
var _local5:b2Mat22 = this.m_xf.R;
var _local6:b2Vec2 = this.m_sweep.localCenter;
this.m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y));
this.m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y));
this.m_sweep.c.x = (this.m_sweep.c.x + this.m_xf.position.x);
this.m_sweep.c.y = (this.m_sweep.c.y + this.m_xf.position.y);
this.m_sweep.c0.SetV(this.m_sweep.c);
_local1 = this.m_shapeList;
while (_local1) {
_local1.UpdateSweepRadius(this.m_sweep.localCenter);
_local1 = _local1.m_next;
};
var _local7:int = this.m_type;
if ((((this.m_invMass == 0)) && ((this.m_invI == 0)))){
this.m_type = e_staticType;
} else {
this.m_type = e_dynamicType;
};
if (_local7 != this.m_type){
_local1 = this.m_shapeList;
while (_local1) {
_local1.RefilterProxy(this.m_world.m_broadPhase, this.m_xf);
_local1 = _local1.m_next;
};
};
}
public function SetXForm(_arg1:b2Vec2, _arg2:Number):Boolean{
var _local3:b2Shape;
var _local7:Boolean;
if (this.m_world.m_lock == true){
return (true);
};
if (this.IsFrozen()){
return (false);
};
this.m_xf.R.Set(_arg2);
this.m_xf.position.SetV(_arg1);
var _local4:b2Mat22 = this.m_xf.R;
var _local5:b2Vec2 = this.m_sweep.localCenter;
this.m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y));
this.m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y));
this.m_sweep.c.x = (this.m_sweep.c.x + this.m_xf.position.x);
this.m_sweep.c.y = (this.m_sweep.c.y + this.m_xf.position.y);
this.m_sweep.c0.SetV(this.m_sweep.c);
this.m_sweep.a0 = (this.m_sweep.a = _arg2);
var _local6:Boolean;
_local3 = this.m_shapeList;
while (_local3) {
_local7 = _local3.Synchronize(this.m_world.m_broadPhase, this.m_xf, this.m_xf);
if (_local7 == false){
_local6 = true;
break;
};
_local3 = _local3.m_next;
};
if (_local6 == true){
this.m_flags = (this.m_flags | e_frozenFlag);
this.m_linearVelocity.SetZero();
this.m_angularVelocity = 0;
_local3 = this.m_shapeList;
while (_local3) {
_local3.DestroyProxy(this.m_world.m_broadPhase);
_local3 = _local3.m_next;
};
return (false);
};
this.m_world.m_broadPhase.Commit();
return (true);
}
public function GetXForm():b2XForm{
return (this.m_xf);
}
public function GetPosition():b2Vec2{
return (this.m_xf.position);
}
public function GetAngle():Number{
return (this.m_sweep.a);
}
public function GetWorldCenter():b2Vec2{
return (this.m_sweep.c);
}
public function GetLocalCenter():b2Vec2{
return (this.m_sweep.localCenter);
}
public function SetLinearVelocity(_arg1:b2Vec2):void{
this.m_linearVelocity.SetV(_arg1);
}
public function GetLinearVelocity():b2Vec2{
return (this.m_linearVelocity);
}
public function SetAngularVelocity(_arg1:Number):void{
this.m_angularVelocity = _arg1;
}
public function GetAngularVelocity():Number{
return (this.m_angularVelocity);
}
public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (this.IsSleeping()){
this.WakeUp();
};
this.m_force.x = (this.m_force.x + _arg1.x);
this.m_force.y = (this.m_force.y + _arg1.y);
this.m_torque = (this.m_torque + (((_arg2.x - this.m_sweep.c.x) * _arg1.y) - ((_arg2.y - this.m_sweep.c.y) * _arg1.x)));
}
public function ApplyTorque(_arg1:Number):void{
if (this.IsSleeping()){
this.WakeUp();
};
this.m_torque = (this.m_torque + _arg1);
}
public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (this.IsSleeping()){
this.WakeUp();
};
this.m_linearVelocity.x = (this.m_linearVelocity.x + (this.m_invMass * _arg1.x));
this.m_linearVelocity.y = (this.m_linearVelocity.y + (this.m_invMass * _arg1.y));
this.m_angularVelocity = (this.m_angularVelocity + (this.m_invI * (((_arg2.x - this.m_sweep.c.x) * _arg1.y) - ((_arg2.y - this.m_sweep.c.y) * _arg1.x))));
}
public function GetMass():Number{
return (this.m_mass);
}
public function GetInertia():Number{
return (this.m_I);
}
public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22 = this.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 + this.m_xf.position.x);
_local3.y = (_local3.y + this.m_xf.position.y);
return (_local3);
}
public function GetWorldVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulMV(this.m_xf.R, _arg1));
}
public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulXT(this.m_xf, _arg1));
}
public function GetLocalVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(this.m_xf.R, _arg1));
}
public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{
return (new b2Vec2((this.m_linearVelocity.x - (this.m_angularVelocity * (_arg1.y - this.m_sweep.c.y))), (this.m_linearVelocity.y + (this.m_angularVelocity * (_arg1.x - this.m_sweep.c.x)))));
}
public function GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22 = this.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 + this.m_xf.position.x);
_local3.y = (_local3.y + this.m_xf.position.y);
return (new b2Vec2((this.m_linearVelocity.x - (this.m_angularVelocity * (_local3.y - this.m_sweep.c.y))), (this.m_linearVelocity.y + (this.m_angularVelocity * (_local3.x - this.m_sweep.c.x)))));
}
public function IsBullet():Boolean{
return (((this.m_flags & e_bulletFlag) == e_bulletFlag));
}
public function SetBullet(_arg1:Boolean):void{
if (_arg1){
this.m_flags = (this.m_flags | e_bulletFlag);
} else {
this.m_flags = (this.m_flags & ~(e_bulletFlag));
};
}
public function IsStatic():Boolean{
return ((this.m_type == e_staticType));
}
public function IsDynamic():Boolean{
return ((this.m_type == e_dynamicType));
}
public function IsFrozen():Boolean{
return (((this.m_flags & e_frozenFlag) == e_frozenFlag));
}
public function IsSleeping():Boolean{
return (((this.m_flags & e_sleepFlag) == e_sleepFlag));
}
public function AllowSleeping(_arg1:Boolean):void{
if (_arg1){
this.m_flags = (this.m_flags | e_allowSleepFlag);
} else {
this.m_flags = (this.m_flags & ~(e_allowSleepFlag));
this.WakeUp();
};
}
public function WakeUp():void{
this.m_flags = (this.m_flags & ~(e_sleepFlag));
this.m_sleepTime = 0;
}
public function PutToSleep():void{
this.m_flags = (this.m_flags | e_sleepFlag);
this.m_sleepTime = 0;
this.m_linearVelocity.SetZero();
this.m_angularVelocity = 0;
this.m_force.SetZero();
this.m_torque = 0;
}
public function GetShapeList():b2Shape{
return (this.m_shapeList);
}
public function GetJointList():b2JointEdge{
return (this.m_jointList);
}
public function GetContactList():b2ContactEdge{
return (this.m_contactList);
}
public function GetNext():b2Body{
return (this.m_next);
}
public function GetUserData(){
return (this.m_userData);
}
public function SetUserData(_arg1):void{
this.m_userData = _arg1;
}
public function GetWorld():b2World{
return (this.m_world);
}
b2internal function SynchronizeShapes():Boolean{
var _local4:b2Shape;
var _local1:b2XForm = s_xf1;
_local1.R.Set(this.m_sweep.a0);
var _local2:b2Mat22 = _local1.R;
var _local3:b2Vec2 = this.m_sweep.localCenter;
_local1.position.x = (this.m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y)));
_local1.position.y = (this.m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y)));
var _local5:Boolean;
_local4 = this.m_shapeList;
while (_local4) {
_local5 = _local4.Synchronize(this.m_world.m_broadPhase, _local1, this.m_xf);
if (_local5 == false){
break;
};
_local4 = _local4.m_next;
};
if (_local5 == false){
this.m_flags = (this.m_flags | e_frozenFlag);
this.m_linearVelocity.SetZero();
this.m_angularVelocity = 0;
_local4 = this.m_shapeList;
while (_local4) {
_local4.DestroyProxy(this.m_world.m_broadPhase);
_local4 = _local4.m_next;
};
return (false);
};
return (true);
}
b2internal function SynchronizeTransform():void{
this.m_xf.R.Set(this.m_sweep.a);
var _local1:b2Mat22 = this.m_xf.R;
var _local2:b2Vec2 = this.m_sweep.localCenter;
this.m_xf.position.x = (this.m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y)));
this.m_xf.position.y = (this.m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y)));
}
b2internal function IsConnected(_arg1:b2Body):Boolean{
var _local2:b2JointEdge = this.m_jointList;
while (_local2) {
if (_local2.other == _arg1){
return ((_local2.joint.m_collideConnected == false));
};
_local2 = _local2.next;
};
return (false);
}
b2internal function Advance(_arg1:Number):void{
this.m_sweep.Advance(_arg1);
this.m_sweep.c.SetV(this.m_sweep.c0);
this.m_sweep.a = this.m_sweep.a0;
this.SynchronizeTransform();
}
}
}//package Box2D.Dynamics
Section 66
//b2BodyDef (Box2D.Dynamics.b2BodyDef)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
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 function b2BodyDef(){
this.massData = new b2MassData();
this.position = new b2Vec2();
super();
this.massData.center.SetZero();
this.massData.mass = 0;
this.massData.I = 0;
this.userData = null;
this.position.Set(0, 0);
this.angle = 0;
this.linearDamping = 0;
this.angularDamping = 0;
this.allowSleep = true;
this.isSleeping = false;
this.fixedRotation = false;
this.isBullet = false;
}
}
}//package Box2D.Dynamics
Section 67
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener)
package Box2D.Dynamics {
public class b2BoundaryListener {
public function Violation(_arg1:b2Body):void{
}
}
}//package Box2D.Dynamics
Section 68
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2ContactFilter {
b2internal 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 (this.ShouldCollide((_arg1 as b2Shape), _arg2));
}
}
}//package Box2D.Dynamics
Section 69
//b2ContactListener (Box2D.Dynamics.b2ContactListener)
package Box2D.Dynamics {
import Box2D.Dynamics.Contacts.*;
import Box2D.Collision.*;
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 70
//b2ContactManager (Box2D.Dynamics.b2ContactManager)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2ContactManager extends b2PairCallback {
b2internal var m_world:b2World;
private var m_nullContact:b2NullContact;
private var m_destroyImmediate:Boolean;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2ContactManager(){
this.m_nullContact = new b2NullContact();
super();
this.m_world = null;
this.m_destroyImmediate = false;
}
override public function PairAdded(_arg1, _arg2){
var _local3:b2Shape = (_arg1 as b2Shape);
var _local4:b2Shape = (_arg2 as b2Shape);
var _local5:b2Body = _local3.m_body;
var _local6:b2Body = _local4.m_body;
if (((_local5.IsStatic()) && (_local6.IsStatic()))){
return (this.m_nullContact);
};
if (_local3.m_body == _local4.m_body){
return (this.m_nullContact);
};
if (_local6.IsConnected(_local5)){
return (this.m_nullContact);
};
if (((!((this.m_world.m_contactFilter == null))) && ((this.m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){
return (this.m_nullContact);
};
var _local7:b2Contact = b2Contact.Create(_local3, _local4, this.m_world.m_blockAllocator);
if (_local7 == null){
return (this.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 = this.m_world.m_contactList;
if (this.m_world.m_contactList != null){
this.m_world.m_contactList.m_prev = _local7;
};
this.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;
this.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 == this.m_nullContact){
return;
};
this.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)) && (this.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;
this.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 == this.m_world.m_contactList){
this.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, this.m_world.m_blockAllocator);
this.m_world.m_contactCount--;
}
public function Collide():void{
var _local2:b2Body;
var _local3:b2Body;
var _local1:b2Contact = this.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(this.m_world.m_contactListener);
};
_local1 = _local1.m_next;
};
}
}
}//package Box2D.Dynamics
Section 71
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw)
package Box2D.Dynamics {
import flash.display.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2DebugDraw {
private var m_drawFlags:uint;
b2internal var m_sprite:Sprite;
private var m_drawScale:Number;// = 1
private var m_lineThickness:Number;// = 1
private var m_alpha:Number;// = 1
private var m_fillAlpha:Number;// = 1
private 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(){
this.m_drawFlags = 0;
}
public function SetFlags(_arg1:uint):void{
this.m_drawFlags = _arg1;
}
public function GetFlags():uint{
return (this.m_drawFlags);
}
public function AppendFlags(_arg1:uint):void{
this.m_drawFlags = (this.m_drawFlags | _arg1);
}
public function ClearFlags(_arg1:uint):void{
this.m_drawFlags = (this.m_drawFlags & ~(_arg1));
}
public function SetSprite(_arg1:Sprite):void{
this.m_sprite = _arg1;
}
public function GetSprite():Sprite{
return (this.m_sprite);
}
public function SetDrawScale(_arg1:Number):void{
this.m_drawScale = _arg1;
}
public function GetDrawScale():Number{
return (this.m_drawScale);
}
public function SetLineThickness(_arg1:Number):void{
this.m_lineThickness = _arg1;
}
public function GetLineThickness():Number{
return (this.m_lineThickness);
}
public function SetAlpha(_arg1:Number):void{
this.m_alpha = _arg1;
}
public function GetAlpha():Number{
return (this.m_alpha);
}
public function SetFillAlpha(_arg1:Number):void{
this.m_fillAlpha = _arg1;
}
public function GetFillAlpha():Number{
return (this.m_fillAlpha);
}
public function SetXFormScale(_arg1:Number):void{
this.m_xformScale = _arg1;
}
public function GetXFormScale():Number{
return (this.m_xformScale);
}
public function DrawPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
this.m_sprite.graphics.lineStyle(this.m_lineThickness, _arg3.color, this.m_alpha);
this.m_sprite.graphics.moveTo((_arg1[0].x * this.m_drawScale), (_arg1[0].y * this.m_drawScale));
var _local4 = 1;
while (_local4 < _arg2) {
this.m_sprite.graphics.lineTo((_arg1[_local4].x * this.m_drawScale), (_arg1[_local4].y * this.m_drawScale));
_local4++;
};
this.m_sprite.graphics.lineTo((_arg1[0].x * this.m_drawScale), (_arg1[0].y * this.m_drawScale));
}
public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
this.m_sprite.graphics.lineStyle(this.m_lineThickness, _arg3.color, this.m_alpha);
this.m_sprite.graphics.moveTo((_arg1[0].x * this.m_drawScale), (_arg1[0].y * this.m_drawScale));
this.m_sprite.graphics.beginFill(_arg3.color, this.m_fillAlpha);
var _local4 = 1;
while (_local4 < _arg2) {
this.m_sprite.graphics.lineTo((_arg1[_local4].x * this.m_drawScale), (_arg1[_local4].y * this.m_drawScale));
_local4++;
};
this.m_sprite.graphics.lineTo((_arg1[0].x * this.m_drawScale), (_arg1[0].y * this.m_drawScale));
this.m_sprite.graphics.endFill();
}
public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{
this.m_sprite.graphics.lineStyle(this.m_lineThickness, _arg3.color, this.m_alpha);
this.m_sprite.graphics.drawCircle((_arg1.x * this.m_drawScale), (_arg1.y * this.m_drawScale), (_arg2 * this.m_drawScale));
}
public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{
this.m_sprite.graphics.lineStyle(this.m_lineThickness, _arg4.color, this.m_alpha);
this.m_sprite.graphics.moveTo(0, 0);
this.m_sprite.graphics.beginFill(_arg4.color, this.m_fillAlpha);
this.m_sprite.graphics.drawCircle((_arg1.x * this.m_drawScale), (_arg1.y * this.m_drawScale), (_arg2 * this.m_drawScale));
this.m_sprite.graphics.endFill();
this.m_sprite.graphics.moveTo((_arg1.x * this.m_drawScale), (_arg1.y * this.m_drawScale));
this.m_sprite.graphics.lineTo(((_arg1.x + (_arg3.x * _arg2)) * this.m_drawScale), ((_arg1.y + (_arg3.y * _arg2)) * this.m_drawScale));
}
public function DrawSegment(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Color):void{
this.m_sprite.graphics.lineStyle(this.m_lineThickness, _arg3.color, this.m_alpha);
this.m_sprite.graphics.moveTo((_arg1.x * this.m_drawScale), (_arg1.y * this.m_drawScale));
this.m_sprite.graphics.lineTo((_arg2.x * this.m_drawScale), (_arg2.y * this.m_drawScale));
}
public function DrawXForm(_arg1:b2XForm):void{
this.m_sprite.graphics.lineStyle(this.m_lineThickness, 0xFF0000, this.m_alpha);
this.m_sprite.graphics.moveTo((_arg1.position.x * this.m_drawScale), (_arg1.position.y * this.m_drawScale));
this.m_sprite.graphics.lineTo(((_arg1.position.x + (this.m_xformScale * _arg1.R.col1.x)) * this.m_drawScale), ((_arg1.position.y + (this.m_xformScale * _arg1.R.col1.y)) * this.m_drawScale));
this.m_sprite.graphics.lineStyle(this.m_lineThickness, 0xFF00, this.m_alpha);
this.m_sprite.graphics.moveTo((_arg1.position.x * this.m_drawScale), (_arg1.position.y * this.m_drawScale));
this.m_sprite.graphics.lineTo(((_arg1.position.x + (this.m_xformScale * _arg1.R.col2.x)) * this.m_drawScale), ((_arg1.position.y + (this.m_xformScale * _arg1.R.col2.y)) * this.m_drawScale));
}
}
}//package Box2D.Dynamics
Section 72
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Joints.*;
public class b2DestructionListener {
public function SayGoodbyeJoint(_arg1:b2Joint):void{
}
public function SayGoodbyeShape(_arg1:b2Shape):void{
}
}
}//package Box2D.Dynamics
Section 73
//b2Island (Box2D.Dynamics.b2Island)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2Island {
private var m_allocator;
private var m_listener:b2ContactListener;
b2internal var m_bodies:Array;
b2internal var m_contacts:Array;
b2internal var m_joints:Array;
b2internal var m_bodyCount:int;
b2internal var m_jointCount:int;
b2internal var m_contactCount:int;
private var m_bodyCapacity:int;
b2internal var m_contactCapacity:int;
b2internal var m_jointCapacity:int;
b2internal 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();
this.m_bodyCapacity = _arg1;
this.m_contactCapacity = _arg2;
this.m_jointCapacity = _arg3;
this.m_bodyCount = 0;
this.m_contactCount = 0;
this.m_jointCount = 0;
this.m_allocator = _arg4;
this.m_listener = _arg5;
this.m_bodies = new Array(_arg1);
_local6 = 0;
while (_local6 < _arg1) {
this.m_bodies[_local6] = null;
_local6++;
};
this.m_contacts = new Array(_arg2);
_local6 = 0;
while (_local6 < _arg2) {
this.m_contacts[_local6] = null;
_local6++;
};
this.m_joints = new Array(_arg3);
_local6 = 0;
while (_local6 < _arg3) {
this.m_joints[_local6] = null;
_local6++;
};
this.m_positionIterationCount = 0;
}
public function Clear():void{
this.m_bodyCount = 0;
this.m_contactCount = 0;
this.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 < this.m_bodyCount) {
_local6 = this.m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x))));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y))));
_local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque));
_local6.m_force.SetZero();
_local6.m_torque = 0;
_local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1));
_local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1));
if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){
_local6.m_linearVelocity.Normalize();
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity);
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity);
};
if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){
if (_local6.m_angularVelocity < 0){
_local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity);
} else {
_local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity;
};
};
};
_local5++;
};
var _local8:b2ContactSolver = new b2ContactSolver(_arg1, this.m_contacts, this.m_contactCount, this.m_allocator);
_local8.InitVelocityConstraints(_arg1);
_local5 = 0;
while (_local5 < this.m_jointCount) {
_local7 = this.m_joints[_local5];
_local7.InitVelocityConstraints(_arg1);
_local5++;
};
_local5 = 0;
while (_local5 < _arg1.maxIterations) {
_local8.SolveVelocityConstraints();
_local9 = 0;
while (_local9 < this.m_jointCount) {
_local7 = this.m_joints[_local9];
_local7.SolveVelocityConstraints(_arg1);
_local9++;
};
_local5++;
};
_local8.FinalizeVelocityConstraints();
_local5 = 0;
while (_local5 < this.m_bodyCount) {
_local6 = this.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 < this.m_jointCount) {
_local7 = this.m_joints[_local5];
_local7.InitPositionConstraints();
_local5++;
};
this.m_positionIterationCount = 0;
while (this.m_positionIterationCount < _arg1.maxIterations) {
_local10 = _local8.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
_local11 = true;
_local5 = 0;
while (_local5 < this.m_jointCount) {
_local7 = this.m_joints[_local5];
_local12 = _local7.SolvePositionConstraints();
_local11 = ((_local11) && (_local12));
_local5++;
};
if (((_local10) && (_local11))){
break;
};
this.m_positionIterationCount++;
};
};
this.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 < this.m_bodyCount) {
_local6 = this.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 < this.m_bodyCount) {
_local6 = this.m_bodies[_local5];
this.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 _local3:int;
var _local6:b2Body;
var _local7:Boolean;
var _local8:Boolean;
var _local9:Boolean;
var _local4:b2ContactSolver = new b2ContactSolver(_arg1, this.m_contacts, this.m_contactCount, this.m_allocator);
_arg1.warmStarting = true;
_local2 = 0;
while (_local2 < this.m_jointCount) {
this.m_joints[_local2].InitVelocityConstraints(_arg1);
_local2++;
};
_arg1.warmStarting = false;
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local4.SolveVelocityConstraints();
_local3 = 0;
while (_local3 < this.m_jointCount) {
this.m_joints[_local3].InitVelocityConstraints(_arg1);
_local3++;
};
_local2++;
};
_local2 = 0;
while (_local2 < this.m_bodyCount) {
_local6 = this.m_bodies[_local2];
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();
};
_local2++;
};
var _local5:Number = 0.75;
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local7 = _local4.SolvePositionConstraints(_local5);
_local8 = true;
_local3 = 0;
while (_local3 < this.m_jointCount) {
_local9 = this.m_joints[_local3].SolvePositionConstraints();
_local8 = ((_local8) && (_local9));
_local3++;
};
if (((_local7) && (_local8))){
break;
};
_local2++;
};
this.Report(_local4.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 (this.m_listener == null){
return;
};
var _local4:int;
while (_local4 < this.m_contactCount) {
_local5 = this.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;
this.m_listener.Result(_local7);
_local13++;
};
_local11++;
};
_local4++;
};
}
public function AddBody(_arg1:b2Body):void{
var _local2 = this.m_bodyCount++;
this.m_bodies[_local2] = _arg1;
}
public function AddContact(_arg1:b2Contact):void{
var _local2 = this.m_contactCount++;
this.m_contacts[_local2] = _arg1;
}
public function AddJoint(_arg1:b2Joint):void{
var _local2 = this.m_jointCount++;
this.m_joints[_local2] = _arg1;
}
}
}//package Box2D.Dynamics
Section 74
//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 75
//b2World (Box2D.Dynamics.b2World)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Collision.*;
import Box2D.Common.*;
public class b2World {
b2internal var m_raycastUserData;
b2internal var m_raycastSegment:b2Segment;
b2internal var m_raycastNormal:b2Vec2;
b2internal var m_blockAllocator;
b2internal var m_stackAllocator;
b2internal var m_lock:Boolean;
b2internal var m_broadPhase:b2BroadPhase;
private var m_contactManager:b2ContactManager;
b2internal var m_bodyList:b2Body;
private var m_jointList:b2Joint;
b2internal var m_contactList:b2Contact;
private var m_bodyCount:int;
b2internal var m_contactCount:int;
private var m_jointCount:int;
private var m_gravity:b2Vec2;
private var m_allowSleep:Boolean;
b2internal var m_groundBody:b2Body;
private var m_destructionListener:b2DestructionListener;
private var m_boundaryListener:b2BoundaryListener;
b2internal var m_contactFilter:b2ContactFilter;
b2internal var m_contactListener:b2ContactListener;
private var m_debugDraw:b2DebugDraw;
private var m_inv_dt0:Number;
private 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();
private static var m_positionCorrection:Boolean;
private static var m_warmStarting:Boolean;
private static var m_continuousPhysics:Boolean;
public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){
this.m_raycastNormal = new b2Vec2();
this.m_contactManager = new b2ContactManager();
super();
this.m_destructionListener = null;
this.m_boundaryListener = null;
this.m_contactFilter = b2ContactFilter.b2_defaultFilter;
this.m_contactListener = null;
this.m_debugDraw = null;
this.m_bodyList = null;
this.m_contactList = null;
this.m_jointList = null;
this.m_bodyCount = 0;
this.m_contactCount = 0;
this.m_jointCount = 0;
m_positionCorrection = true;
m_warmStarting = true;
m_continuousPhysics = true;
this.m_allowSleep = _arg3;
this.m_gravity = _arg2;
this.m_lock = false;
this.m_inv_dt0 = 0;
this.m_contactManager.m_world = this;
this.m_broadPhase = new b2BroadPhase(_arg1, this.m_contactManager);
var _local4:b2BodyDef = new b2BodyDef();
this.m_groundBody = this.CreateBody(_local4);
}
public function SetDestructionListener(_arg1:b2DestructionListener):void{
this.m_destructionListener = _arg1;
}
public function SetBoundaryListener(_arg1:b2BoundaryListener):void{
this.m_boundaryListener = _arg1;
}
public function SetContactFilter(_arg1:b2ContactFilter):void{
this.m_contactFilter = _arg1;
}
public function SetContactListener(_arg1:b2ContactListener):void{
this.m_contactListener = _arg1;
}
public function SetDebugDraw(_arg1:b2DebugDraw):void{
this.m_debugDraw = _arg1;
}
public function Validate():void{
this.m_broadPhase.Validate();
}
public function GetProxyCount():int{
return (this.m_broadPhase.m_proxyCount);
}
public function GetPairCount():int{
return (this.m_broadPhase.m_pairManager.m_pairCount);
}
public function CreateBody(_arg1:b2BodyDef):b2Body{
if (this.m_lock == true){
return (null);
};
var _local2:b2Body = new b2Body(_arg1, this);
_local2.m_prev = null;
_local2.m_next = this.m_bodyList;
if (this.m_bodyList){
this.m_bodyList.m_prev = _local2;
};
this.m_bodyList = _local2;
this.m_bodyCount++;
return (_local2);
}
public function DestroyBody(_arg1:b2Body):void{
var _local4:b2JointEdge;
var _local5:b2Shape;
if (this.m_lock == true){
return;
};
var _local2:b2JointEdge = _arg1.m_jointList;
while (_local2) {
_local4 = _local2;
_local2 = _local2.next;
if (this.m_destructionListener){
this.m_destructionListener.SayGoodbyeJoint(_local4.joint);
};
this.DestroyJoint(_local4.joint);
};
var _local3:b2Shape = _arg1.m_shapeList;
while (_local3) {
_local5 = _local3;
_local3 = _local3.m_next;
if (this.m_destructionListener){
this.m_destructionListener.SayGoodbyeShape(_local5);
};
_local5.DestroyProxy(this.m_broadPhase);
b2Shape.Destroy(_local5, this.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 == this.m_bodyList){
this.m_bodyList = _arg1.m_next;
};
this.m_bodyCount--;
}
public function CreateJoint(_arg1:b2JointDef):b2Joint{
var _local3:b2Body;
var _local4:b2Shape;
var _local2:b2Joint = b2Joint.Create(_arg1, this.m_blockAllocator);
_local2.m_prev = null;
_local2.m_next = this.m_jointList;
if (this.m_jointList){
this.m_jointList.m_prev = _local2;
};
this.m_jointList = _local2;
this.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(this.m_broadPhase, _local3.m_xf);
_local4 = _local4.m_next;
};
};
return (_local2);
}
public function DestroyJoint(_arg1:b2Joint):void{
var _local5:b2Body;
var _local6:b2Shape;
var _local2:Boolean = _arg1.m_collideConnected;
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == this.m_jointList){
this.m_jointList = _arg1.m_next;
};
var _local3:b2Body = _arg1.m_body1;
var _local4:b2Body = _arg1.m_body2;
_local3.WakeUp();
_local4.WakeUp();
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local3.m_jointList){
_local3.m_jointList = _arg1.m_node1.next;
};
_arg1.m_node1.prev = null;
_arg1.m_node1.next = null;
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local4.m_jointList){
_local4.m_jointList = _arg1.m_node2.next;
};
_arg1.m_node2.prev = null;
_arg1.m_node2.next = null;
b2Joint.Destroy(_arg1, this.m_blockAllocator);
this.m_jointCount--;
if (_local2 == false){
_local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4;
_local6 = _local5.m_shapeList;
while (_local6) {
_local6.RefilterProxy(this.m_broadPhase, _local5.m_xf);
_local6 = _local6.m_next;
};
};
}
public function Refilter(_arg1:b2Shape):void{
_arg1.RefilterProxy(this.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 (this.m_bodyCount);
}
public function GetJointCount():int{
return (this.m_jointCount);
}
public function GetContactCount():int{
return (this.m_contactCount);
}
public function SetGravity(_arg1:b2Vec2):void{
this.m_gravity = _arg1;
}
public function GetGravity():b2Vec2{
return (this.m_gravity);
}
public function GetGroundBody():b2Body{
return (this.m_groundBody);
}
public function Step(_arg1:Number, _arg2:int):void{
this.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 = (this.m_inv_dt0 * _arg1);
_local3.positionCorrection = m_positionCorrection;
_local3.warmStarting = m_warmStarting;
this.m_contactManager.Collide();
if (_local3.dt > 0){
this.Solve(_local3);
};
if (((m_continuousPhysics) && ((_local3.dt > 0)))){
this.SolveTOI(_local3);
};
this.DrawDebugData();
this.m_inv_dt0 = _local3.inv_dt;
this.m_lock = false;
}
public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{
var _local4:Array = new Array(_arg3);
var _local5:int = this.m_broadPhase.QueryAABB(_arg1, _local4, _arg3);
var _local6:int;
while (_local6 < _local5) {
_arg2[_local6] = _local4[_local6];
_local6++;
};
return (_local5);
}
public function InRange(_arg1:b2AABB):Boolean{
return (this.m_broadPhase.InRange(_arg1));
}
public function Raycast(_arg1:b2Segment, _arg2:Array, _arg3:int, _arg4:Boolean, _arg5):int{
var _local7:int;
var _local6:Array = new Array(_arg3);
this.m_raycastSegment = _arg1;
this.m_raycastUserData = _arg5;
if (_arg4){
_local7 = this.m_broadPhase.QuerySegment(_arg1, _local6, _arg3, this.RaycastSortKey);
} else {
_local7 = this.m_broadPhase.QuerySegment(_arg1, _local6, _arg3, this.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 = this.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 GetBodyList():b2Body{
return (this.m_bodyList);
}
public function GetJointList():b2Joint{
return (this.m_jointList);
}
b2internal 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;
this.m_positionIterationCount = 0;
var _local3:b2Island = new b2Island(this.m_bodyCount, this.m_contactCount, this.m_jointCount, this.m_stackAllocator, this.m_contactListener);
_local2 = this.m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2 = _local2.m_next;
};
var _local4:b2Contact = this.m_contactList;
while (_local4) {
_local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag));
_local4 = _local4.m_next;
};
var _local5:b2Joint = this.m_jointList;
while (_local5) {
_local5.m_islandFlag = false;
_local5 = _local5.m_next;
};
var _local6:int = this.m_bodyCount;
var _local7:Array = new Array(_local6);
var _local8:b2Body = this.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, this.m_gravity, m_positionCorrection, this.m_allowSleep);
if (_local3.m_positionIterationCount > this.m_positionIterationCount){
this.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 = this.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)) && (!((this.m_boundaryListener == null))))){
this.m_boundaryListener.Violation(_local2);
};
};
};
_local2 = _local2.m_next;
};
this.m_broadPhase.Commit();
}
b2internal function SolveTOI(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactEdge;
var _local8:b2Joint;
var _local12:b2Contact;
var _local13:b2Contact;
var _local14:Number;
var _local15:b2Body;
var _local16:int;
var _local17:int;
var _local18:b2JointEdge;
var _local19:b2TimeStep;
var _local20:int;
var _local21:Number;
var _local22:Number;
var _local23:b2Body;
var _local24:Boolean;
var _local9:b2Island = new b2Island(this.m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, b2Settings.b2_maxTOIJointsPerIsland, this.m_stackAllocator, this.m_contactListener);
var _local10:int = this.m_bodyCount;
var _local11:Array = new Array(_local10);
_local2 = this.m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2.m_sweep.t0 = 0;
_local2 = _local2.m_next;
};
_local12 = this.m_contactList;
while (_local12) {
_local12.m_flags = (_local12.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local12 = _local12.m_next;
};
_local8 = this.m_jointList;
while (_local8) {
_local8.m_islandFlag = false;
_local8 = _local8.m_next;
};
while (true) {
_local13 = null;
_local14 = 1;
_local12 = this.m_contactList;
for (;_local12;(_local12 = _local12.m_next)) {
if ((_local12.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){
} else {
_local21 = 1;
if ((_local12.m_flags & b2Contact.e_toiFlag)){
_local21 = _local12.m_toi;
} else {
_local3 = _local12.m_shape1;
_local4 = _local12.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((((_local5.IsStatic()) || (_local5.IsSleeping()))) && (((_local6.IsStatic()) || (_local6.IsSleeping()))))){
continue;
};
_local22 = _local5.m_sweep.t0;
if (_local5.m_sweep.t0 < _local6.m_sweep.t0){
_local22 = _local6.m_sweep.t0;
_local5.m_sweep.Advance(_local22);
} else {
if (_local6.m_sweep.t0 < _local5.m_sweep.t0){
_local22 = _local5.m_sweep.t0;
_local6.m_sweep.Advance(_local22);
};
};
_local21 = b2TimeOfImpact.TimeOfImpact(_local12.m_shape1, _local5.m_sweep, _local12.m_shape2, _local6.m_sweep);
if ((((_local21 > 0)) && ((_local21 < 1)))){
_local21 = (((1 - _local21) * _local22) + _local21);
if (_local21 > 1){
_local21 = 1;
};
};
_local12.m_toi = _local21;
_local12.m_flags = (_local12.m_flags | b2Contact.e_toiFlag);
};
if ((((Number.MIN_VALUE < _local21)) && ((_local21 < _local14)))){
_local13 = _local12;
_local14 = _local21;
};
};
};
if ((((_local13 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local14)))){
break;
};
_local3 = _local13.m_shape1;
_local4 = _local13.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local5.Advance(_local14);
_local6.Advance(_local14);
_local13.Update(this.m_contactListener);
_local13.m_flags = (_local13.m_flags & ~(b2Contact.e_toiFlag));
if (_local13.m_manifoldCount == 0){
} else {
_local15 = _local5;
if (_local15.IsStatic()){
_local15 = _local6;
};
_local9.Clear();
_local16 = 0;
_local17 = 0;
var _temp1 = _local17;
_local17 = (_local17 + 1);
_local11[(_local16 + _temp1)] = _local15;
_local15.m_flags = (_local15.m_flags | b2Body.e_islandFlag);
while (_local17 > 0) {
var _temp2 = _local16;
_local16 = (_local16 + 1);
_local2 = _local11[_temp2];
_local17--;
_local9.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local7 = _local2.m_contactList;
while (_local7) {
if (_local9.m_contactCount == _local9.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 {
_local9.AddContact(_local7.contact);
_local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag);
_local23 = _local7.other;
if ((_local23.m_flags & b2Body.e_islandFlag)){
} else {
if (_local23.IsStatic() == false){
_local23.Advance(_local14);
_local23.WakeUp();
};
var _temp3 = _local17;
_local17 = (_local17 + 1);
_local11[(_local16 + _temp3)] = _local23;
_local23.m_flags = (_local23.m_flags | b2Body.e_islandFlag);
};
};
};
};
_local7 = _local7.next;
};
};
};
_local18 = _local2.m_jointList;
while (_local18) {
if (_local9.m_jointCount == _local9.m_jointCapacity){
} else {
if (_local18.joint.m_islandFlag == true){
} else {
_local9.AddJoint(_local18.joint);
_local18.joint.m_islandFlag = true;
_local23 = _local18.other;
if ((_local23.m_flags & b2Body.e_islandFlag)){
} else {
if (!_local23.IsStatic()){
_local23.Advance(_local14);
_local23.WakeUp();
};
var _temp4 = _local17;
_local17 = (_local17 + 1);
_local11[(_local16 + _temp4)] = _local23;
_local23.m_flags = (_local23.m_flags | b2Body.e_islandFlag);
};
};
};
_local18 = _local18.next;
};
_local19 = new b2TimeStep();
_local19.warmStarting = false;
_local19.dt = ((1 - _local14) * _arg1.dt);
_local19.inv_dt = (1 / _local19.dt);
_local19.maxIterations = _arg1.maxIterations;
_local9.SolveTOI(_local19);
_local20 = 0;
while (_local20 < _local9.m_bodyCount) {
_local2 = _local9.m_bodies[_local20];
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local24 = _local2.SynchronizeShapes();
if ((((_local24 == false)) && (!((this.m_boundaryListener == null))))){
this.m_boundaryListener.Violation(_local2);
};
_local7 = _local2.m_contactList;
while (_local7) {
_local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag));
_local7 = _local7.next;
};
};
};
_local20++;
};
_local20 = 0;
while (_local20 < _local9.m_contactCount) {
_local12 = _local9.m_contacts[_local20];
_local9.m_contacts[_local20].m_flags = (_local12.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local20++;
};
_local20 = 0;
while (_local20 < _local9.m_jointCount) {
_local8 = _local9.m_joints[_local20];
_local8.m_islandFlag = false;
_local20++;
};
this.m_broadPhase.Commit();
};
};
}
b2internal 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:
this.m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
case b2Joint.e_pulleyJoint:
_local11 = (_arg1 as b2PulleyJoint);
_local12 = _local11.GetGroundAnchor1();
_local13 = _local11.GetGroundAnchor2();
this.m_debugDraw.DrawSegment(_local12, _local8, _local10);
this.m_debugDraw.DrawSegment(_local13, _local9, _local10);
this.m_debugDraw.DrawSegment(_local12, _local13, _local10);
break;
case b2Joint.e_mouseJoint:
this.m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
default:
if (_local2 != this.m_groundBody){
this.m_debugDraw.DrawSegment(_local6, _local8, _local10);
};
this.m_debugDraw.DrawSegment(_local8, _local9, _local10);
if (_local3 != this.m_groundBody){
this.m_debugDraw.DrawSegment(_local7, _local9, _local10);
};
};
}
b2internal 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;
this.m_debugDraw.DrawSolidCircle(_local7, _local8, _local9, _arg3);
if (_arg4){
this.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++;
};
this.m_debugDraw.DrawSolidPolygon(_local14, _local12, _arg3);
if (_arg4){
_local15 = _local11.GetCoreVertices();
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]);
_local10++;
};
this.m_debugDraw.DrawPolygon(_local14, _local12, _local5);
};
break;
};
}
b2internal 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 (this.m_debugDraw == null){
return;
};
this.m_debugDraw.m_sprite.graphics.clear();
var _local1:uint = this.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 = this.m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local3.IsStatic()){
this.DrawShape(_local4, _local11, new b2Color(0.5, 0.9, 0.5), _local15);
} else {
if (_local3.IsSleeping()){
this.DrawShape(_local4, _local11, new b2Color(0.5, 0.5, 0.9), _local15);
} else {
this.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 = this.m_jointList;
while (_local5) {
this.DrawJoint(_local5);
_local5 = _local5.m_next;
};
};
if ((_local1 & b2DebugDraw.e_pairBit)){
_local6 = this.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));
this.m_debugDraw.DrawSegment(_local8, _local9, _local10);
_local16 = _local17.next;
};
_local2++;
};
};
if ((_local1 & b2DebugDraw.e_aabbBit)){
_local6 = this.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);
this.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);
this.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 = this.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++;
};
this.m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_centerOfMassBit)){
_local3 = this.m_bodyList;
while (_local3) {
_local11 = s_xf;
_local11.R = _local3.m_xf.R;
_local11.position = _local3.GetWorldCenter();
this.m_debugDraw.DrawXForm(_local11);
_local3 = _local3.m_next;
};
};
}
b2internal function RaycastSortKey(_arg1:b2Shape):Number{
if (((this.m_contactFilter) && (!(this.m_contactFilter.RayCollide(this.m_raycastUserData, _arg1))))){
return (-1);
};
var _local2:b2Body = _arg1.GetBody();
var _local3:b2XForm = _local2.GetXForm();
var _local4:Array = [0];
if (_arg1.TestSegment(_local3, _local4, this.m_raycastNormal, this.m_raycastSegment, 1) == b2Shape.e_missCollide){
return (-1);
};
return (_local4[0]);
}
b2internal function RaycastSortKey2(_arg1:b2Shape):Number{
if (((this.m_contactFilter) && (!(this.m_contactFilter.RayCollide(this.m_raycastUserData, _arg1))))){
return (-1);
};
var _local2:b2Body = _arg1.GetBody();
var _local3:b2XForm = _local2.GetXForm();
var _local4:Array = [0];
if (_arg1.TestSegment(_local3, _local4, this.m_raycastNormal, this.m_raycastSegment, 1) != b2Shape.e_hitCollide){
return (-1);
};
return (_local4[0]);
}
}
}//package Box2D.Dynamics
Section 76
//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 77
//CampaignInfo (com.google.analytics.campaign.CampaignInfo)
package com.google.analytics.campaign {
import com.google.analytics.utils.*;
public class CampaignInfo {
private var _new:Boolean;
private var _empty:Boolean;
public function CampaignInfo(_arg1:Boolean=true, _arg2:Boolean=false){
_empty = _arg1;
_new = _arg2;
}
public function isEmpty():Boolean{
return (_empty);
}
public function toURLString():String{
var _local1:Variables;
_local1 = toVariables();
return (_local1.toString());
}
public function toVariables():Variables{
var _local1:Variables;
_local1 = new Variables();
_local1.URIencode = true;
if (((!(isEmpty())) && (isNew()))){
_local1.utmcn = utmcn;
};
if (((!(isEmpty())) && (!(isNew())))){
_local1.utmcr = utmcr;
};
return (_local1);
}
public function isNew():Boolean{
return (_new);
}
public function get utmcn():String{
return ("1");
}
public function get utmcr():String{
return ("1");
}
}
}//package com.google.analytics.campaign
Section 78
//CampaignKey (com.google.analytics.campaign.CampaignKey)
package com.google.analytics.campaign {
public class CampaignKey {
public var UCMD:String;// = "utm_medium"
public var UCID:String;// = "utm_id"
public var UCTR:String;// = "utm_term"
public var UCSR:String;// = "utm_source"
public var UCNO:String;// = "utm_nooverride"
public var UCCN:String;// = "utm_campaign"
public var UGCLID:String;// = "gclid"
public var UCCT:String;// = "utm_content"
public function CampaignKey(){
UCCN = "utm_campaign";
UCCT = "utm_content";
UCID = "utm_id";
UCMD = "utm_medium";
UCNO = "utm_nooverride";
UCSR = "utm_source";
UCTR = "utm_term";
UGCLID = "gclid";
super();
}
}
}//package com.google.analytics.campaign
Section 79
//CampaignManager (com.google.analytics.campaign.CampaignManager)
package com.google.analytics.campaign {
import com.google.analytics.core.*;
import com.google.analytics.v4.*;
import com.google.analytics.debug.*;
import com.google.analytics.utils.*;
public class CampaignManager {
private var _config:Configuration;
private var _domainHash:Number;
private var _debug:DebugConfiguration;
private var _timeStamp:Number;
private var _referrer:String;
private var _buffer:Buffer;
public static const trackingDelimiter:String = "|";
public function CampaignManager(_arg1:Configuration, _arg2:DebugConfiguration, _arg3:Buffer, _arg4:Number, _arg5:String, _arg6:Number){
_config = _arg1;
_debug = _arg2;
_buffer = _arg3;
_domainHash = _arg4;
_referrer = _arg5;
_timeStamp = _arg6;
}
public function hasNoOverride(_arg1:String):Boolean{
var _local2:CampaignKey;
var _local3:Variables;
var _local4:String;
_local2 = _config.campaignKey;
if (_arg1 == ""){
return (false);
};
_local3 = new Variables(_arg1);
_local4 = "";
if (_local3.hasOwnProperty(_local2.UCNO)){
_local4 = _local3[_local2.UCNO];
switch (_local4){
case "1":
return (true);
case "":
case "0":
default:
return (false);
};
};
return (false);
}
public function getCampaignInformation(_arg1:String, _arg2:Boolean):CampaignInfo{
var _local3:CampaignInfo;
var _local4:CampaignTracker;
var _local5:Boolean;
var _local6:Boolean;
var _local7:int;
var _local8:CampaignTracker;
var _local9:int;
_local3 = new CampaignInfo();
_local5 = false;
_local6 = false;
_local7 = 0;
if (((_config.allowLinker) && (_buffer.isGenuine()))){
if (!_buffer.hasUTMZ()){
return (_local3);
};
};
_local4 = getTrackerFromSearchString(_arg1);
if (isValid(_local4)){
_local6 = hasNoOverride(_arg1);
if (((_local6) && (!(_buffer.hasUTMZ())))){
return (_local3);
};
};
if (!isValid(_local4)){
_local4 = getOrganicCampaign();
if (((!(_buffer.hasUTMZ())) && (isIgnoredKeyword(_local4)))){
return (_local3);
};
};
if (((!(isValid(_local4))) && (_arg2))){
_local4 = getReferrerCampaign();
if (((!(_buffer.hasUTMZ())) && (isIgnoredReferral(_local4)))){
return (_local3);
};
};
if (!isValid(_local4)){
if (((!(_buffer.hasUTMZ())) && (_arg2))){
_local4 = getDirectCampaign();
};
};
if (!isValid(_local4)){
return (_local3);
};
if (((_buffer.hasUTMZ()) && (!(_buffer.utmz.isEmpty())))){
_local8 = new CampaignTracker();
_local8.fromTrackerString(_buffer.utmz.campaignTracking);
_local5 = (_local8.toTrackerString() == _local4.toTrackerString());
_local7 = _buffer.utmz.responseCount;
};
if (((!(_local5)) || (_arg2))){
_local9 = _buffer.utma.sessionCount;
_local7++;
if (_local9 == 0){
_local9 = 1;
};
_buffer.utmz.domainHash = _domainHash;
_buffer.utmz.campaignCreation = _timeStamp;
_buffer.utmz.campaignSessions = _local9;
_buffer.utmz.responseCount = _local7;
_buffer.utmz.campaignTracking = _local4.toTrackerString();
_debug.info(_buffer.utmz.toString(), VisualDebugMode.geek);
_local3 = new CampaignInfo(false, true);
} else {
_local3 = new CampaignInfo(false, false);
};
return (_local3);
}
public function isValid(_arg1:CampaignTracker):Boolean{
if (((_arg1) && (_arg1.isValid()))){
return (true);
};
return (false);
}
public function getTrackerFromSearchString(_arg1:String):CampaignTracker{
var _local2:CampaignTracker;
var _local3:CampaignTracker;
var _local4:CampaignKey;
var _local5:Variables;
_local2 = getOrganicCampaign();
_local3 = new CampaignTracker();
_local4 = _config.campaignKey;
if (_arg1 == ""){
return (_local3);
};
_local5 = new Variables(_arg1);
if (_local5.hasOwnProperty(_local4.UCID)){
_local3.id = _local5[_local4.UCID];
};
if (_local5.hasOwnProperty(_local4.UCSR)){
_local3.source = _local5[_local4.UCSR];
};
if (_local5.hasOwnProperty(_local4.UGCLID)){
_local3.clickId = _local5[_local4.UGCLID];
};
if (_local5.hasOwnProperty(_local4.UCCN)){
_local3.name = _local5[_local4.UCCN];
} else {
_local3.name = "(not set)";
};
if (_local5.hasOwnProperty(_local4.UCMD)){
_local3.medium = _local5[_local4.UCMD];
} else {
_local3.medium = "(not set)";
};
if (_local5.hasOwnProperty(_local4.UCTR)){
_local3.term = _local5[_local4.UCTR];
} else {
if (((_local2) && (!((_local2.term == ""))))){
_local3.term = _local2.term;
};
};
if (_local5.hasOwnProperty(_local4.UCCT)){
_local3.content = _local5[_local4.UCCT];
};
return (_local3);
}
public function getOrganicCampaign():CampaignTracker{
var _local1:CampaignTracker;
var _local2:URL;
var _local3:String;
var _local4:Array;
var _local5:OrganicReferrer;
var _local6:String;
if (((isInvalidReferrer(_referrer)) || (isFromGoogleCSE(_referrer, _config)))){
return (_local1);
};
_local2 = new URL(_referrer);
_local3 = "";
if (_local2.hostName != ""){
if (_local2.hostName.indexOf(".") > -1){
_local4 = _local2.hostName.split(".");
switch (_local4.length){
case 2:
_local3 = _local4[0];
break;
case 3:
_local3 = _local4[1];
break;
};
};
};
if (_config.organic.match(_local3)){
_local5 = _config.organic.getReferrerByName(_local3);
_local6 = _config.organic.getKeywordValue(_local5, _local2.search);
_local1 = new CampaignTracker();
_local1.source = _local5.engine;
_local1.name = "(organic)";
_local1.medium = "organic";
_local1.term = _local6;
};
return (_local1);
}
public function isIgnoredReferral(_arg1:CampaignTracker):Boolean{
if (((_arg1) && ((_arg1.medium == "referral")))){
return (_config.organic.isIgnoredReferral(_arg1.source));
};
return (false);
}
public function getDirectCampaign():CampaignTracker{
var _local1:CampaignTracker;
_local1 = new CampaignTracker();
_local1.source = "(direct)";
_local1.name = "(direct)";
_local1.medium = "(none)";
return (_local1);
}
public function isIgnoredKeyword(_arg1:CampaignTracker):Boolean{
if (((_arg1) && ((_arg1.medium == "organic")))){
return (_config.organic.isIgnoredKeyword(_arg1.term));
};
return (false);
}
public function getReferrerCampaign():CampaignTracker{
var _local1:CampaignTracker;
var _local2:URL;
var _local3:String;
var _local4:String;
if (((isInvalidReferrer(_referrer)) || (isFromGoogleCSE(_referrer, _config)))){
return (_local1);
};
_local2 = new URL(_referrer);
_local3 = _local2.hostName;
_local4 = _local2.path;
if (_local3.indexOf("www.") == 0){
_local3 = _local3.substr(4);
};
_local1 = new CampaignTracker();
_local1.source = _local3;
_local1.name = "(referral)";
_local1.medium = "referral";
_local1.content = _local4;
return (_local1);
}
public static function isInvalidReferrer(_arg1:String):Boolean{
var _local2:URL;
if ((((((_arg1 == "")) || ((_arg1 == "-")))) || ((_arg1 == "0")))){
return (true);
};
if (_arg1.indexOf("://") > -1){
_local2 = new URL(_arg1);
if ((((_local2.protocol == Protocols.file)) || ((_local2.protocol == Protocols.none)))){
return (true);
};
};
return (false);
}
public static function isFromGoogleCSE(_arg1:String, _arg2:Configuration):Boolean{
var _local3:URL;
_local3 = new URL(_arg1);
if (_local3.hostName.indexOf(_arg2.google) > -1){
if (_local3.search.indexOf((_arg2.googleSearchParam + "=")) > -1){
if (_local3.path == ("/" + _arg2.googleCsePath)){
return (true);
};
};
};
return (false);
}
}
}//package com.google.analytics.campaign
Section 80
//CampaignTracker (com.google.analytics.campaign.CampaignTracker)
package com.google.analytics.campaign {
import com.google.analytics.utils.*;
public class CampaignTracker {
public var content:String;
public var id:String;
public var clickId:String;
public var name:String;
public var term:String;
public var medium:String;
public var source:String;
public function CampaignTracker(_arg1:String="", _arg2:String="", _arg3:String="", _arg4:String="", _arg5:String="", _arg6:String="", _arg7:String=""){
this.id = _arg1;
this.source = _arg2;
this.clickId = _arg3;
this.name = _arg4;
this.medium = _arg5;
this.term = _arg6;
this.content = _arg7;
}
public function toTrackerString():String{
var _local1:Array;
_local1 = [];
_addIfNotEmpty(_local1, "utmcsr=", source);
_addIfNotEmpty(_local1, "utmccn=", name);
_addIfNotEmpty(_local1, "utmcmd=", medium);
_addIfNotEmpty(_local1, "utmctr=", term);
_addIfNotEmpty(_local1, "utmcct=", content);
_addIfNotEmpty(_local1, "utmcid=", id);
_addIfNotEmpty(_local1, "utmgclid=", clickId);
return (_local1.join(CampaignManager.trackingDelimiter));
}
public function isValid():Boolean{
if (((((!((id == ""))) || (!((source == ""))))) || (!((clickId == ""))))){
return (true);
};
return (false);
}
private function _addIfNotEmpty(_arg1:Array, _arg2:String, _arg3:String):void{
if (_arg3 != ""){
_arg3 = _arg3.split("+").join("%20");
_arg3 = _arg3.split(" ").join("%20");
_arg1.push((_arg2 + _arg3));
};
}
public function fromTrackerString(_arg1:String):void{
var _local2:String;
var _local3:Variables;
_local2 = _arg1.split(CampaignManager.trackingDelimiter).join("&");
_local3 = new Variables(_local2);
if (_local3.hasOwnProperty("utmcid")){
this.id = _local3["utmcid"];
};
if (_local3.hasOwnProperty("utmcsr")){
this.source = _local3["utmcsr"];
};
if (_local3.hasOwnProperty("utmccn")){
this.name = _local3["utmccn"];
};
if (_local3.hasOwnProperty("utmcmd")){
this.medium = _local3["utmcmd"];
};
if (_local3.hasOwnProperty("utmctr")){
this.term = _local3["utmctr"];
};
if (_local3.hasOwnProperty("utmcct")){
this.content = _local3["utmcct"];
};
if (_local3.hasOwnProperty("utmgclid")){
this.clickId = _local3["utmgclid"];
};
}
}
}//package com.google.analytics.campaign
Section 81
//BrowserInfo (com.google.analytics.core.BrowserInfo)
package com.google.analytics.core {
import com.google.analytics.v4.*;
import com.google.analytics.utils.*;
public class BrowserInfo {
private var _config:Configuration;
private var _info:Environment;
public function BrowserInfo(_arg1:Configuration, _arg2:Environment){
_config = _arg1;
_info = _arg2;
}
public function get utmul():String{
return (_info.language.toLowerCase());
}
public function get utmje():String{
return ("0");
}
public function toURLString():String{
var _local1:Variables;
_local1 = toVariables();
return (_local1.toString());
}
public function get utmsr():String{
return (((_info.screenWidth + "x") + _info.screenHeight));
}
public function get utmcs():String{
return (_info.languageEncoding);
}
public function get utmfl():String{
var _local1:Version;
if (_config.detectFlash){
_local1 = _info.flashVersion;
return (((((_local1.major + ".") + _local1.minor) + " r") + _local1.build));
};
return ("-");
}
public function toVariables():Variables{
var _local1:Variables;
_local1 = new Variables();
_local1.URIencode = true;
_local1.utmcs = utmcs;
_local1.utmsr = utmsr;
_local1.utmsc = utmsc;
_local1.utmul = utmul;
_local1.utmje = utmje;
_local1.utmfl = utmfl;
return (_local1);
}
public function get utmsc():String{
return ((_info.screenColorDepth + "-bit"));
}
}
}//package com.google.analytics.core
Section 82
//Buffer (com.google.analytics.core.Buffer)
package com.google.analytics.core {
import flash.events.*;
import com.google.analytics.v4.*;
import com.google.analytics.debug.*;
import flash.net.*;
import com.google.analytics.data.*;
public dynamic class Buffer {
private var _SO:SharedObject;
private var _OBJ:Object;
private var _utma:UTMA;
private var _utmb:UTMB;
private var _utmc:UTMC;
private var _debug:DebugConfiguration;
private var _utmk:UTMK;
private var _config:Configuration;
private var _utmv:UTMV;
private var _utmz:UTMZ;
private var _volatile:Boolean;
public function Buffer(_arg1:Configuration, _arg2:DebugConfiguration, _arg3:Boolean=false, _arg4:Object=null){
var _local5:Boolean;
var _local6:String;
super();
_config = _arg1;
_debug = _arg2;
UTMB.defaultTimespan = _config.sessionTimeout;
UTMZ.defaultTimespan = _config.conversionTimeout;
if (!_arg3){
_SO = SharedObject.getLocal(_config.cookieName, _config.cookiePath);
_local5 = false;
if (_SO.data.utma){
if (!hasUTMA()){
_createUMTA();
};
_utma.fromSharedObject(_SO.data.utma);
if (_debug.verbose){
_debug.info(("found: " + _utma.toString(true)), VisualDebugMode.geek);
};
if (_utma.isExpired()){
if (_debug.verbose){
_debug.warning("UTMA has expired", VisualDebugMode.advanced);
};
_clearUTMA();
_local5 = true;
};
};
if (_SO.data.utmb){
if (!hasUTMB()){
_createUMTB();
};
_utmb.fromSharedObject(_SO.data.utmb);
if (_debug.verbose){
_debug.info(("found: " + _utmb.toString(true)), VisualDebugMode.geek);
};
if (_utmb.isExpired()){
if (_debug.verbose){
_debug.warning("UTMB has expired", VisualDebugMode.advanced);
};
_clearUTMB();
_local5 = true;
};
};
if (_SO.data.utmc){
delete _SO.data.utmc;
_local5 = true;
};
if (_SO.data.utmk){
if (!hasUTMK()){
_createUMTK();
};
_utmk.fromSharedObject(_SO.data.utmk);
if (_debug.verbose){
_debug.info(("found: " + _utmk.toString()), VisualDebugMode.geek);
};
};
if (_SO.data.utmv){
if (!hasUTMV()){
_createUMTV();
};
_utmv.fromSharedObject(_SO.data.utmv);
if (_debug.verbose){
_debug.info(("found: " + _utmv.toString(true)), VisualDebugMode.geek);
};
if (_utmv.isExpired()){
if (_debug.verbose){
_debug.warning("UTMV has expired", VisualDebugMode.advanced);
};
_clearUTMV();
_local5 = true;
};
};
if (_SO.data.utmz){
if (!hasUTMZ()){
_createUMTZ();
};
_utmz.fromSharedObject(_SO.data.utmz);
if (_debug.verbose){
_debug.info(("found: " + _utmz.toString(true)), VisualDebugMode.geek);
};
if (_utmz.isExpired()){
if (_debug.verbose){
_debug.warning("UTMZ has expired", VisualDebugMode.advanced);
};
_clearUTMZ();
_local5 = true;
};
};
if (_local5){
save();
};
} else {
_OBJ = new Object();
if (_arg4){
for (_local6 in _arg4) {
_OBJ[_local6] = _arg4[_local6];
};
};
};
_volatile = _arg3;
}
public function save():void{
var flushStatus:String;
if (!isVolatile()){
flushStatus = null;
try {
flushStatus = _SO.flush();
} catch(e:Error) {
_debug.warning("Error...Could not write SharedObject to disk");
};
switch (flushStatus){
case SharedObjectFlushStatus.PENDING:
_debug.info("Requesting permission to save object...");
_SO.addEventListener(NetStatusEvent.NET_STATUS, _onFlushStatus);
break;
case SharedObjectFlushStatus.FLUSHED:
_debug.info("Value flushed to disk.");
break;
};
};
}
public function get utmv():UTMV{
if (!hasUTMV()){
_createUMTV();
};
return (_utmv);
}
public function clearCookies():void{
utma.reset();
utmb.reset();
utmc.reset();
utmz.reset();
utmv.reset();
utmk.reset();
}
public function get utmz():UTMZ{
if (!hasUTMZ()){
_createUMTZ();
};
return (_utmz);
}
public function hasUTMA():Boolean{
if (_utma){
return (true);
};
return (false);
}
public function hasUTMB():Boolean{
if (_utmb){
return (true);
};
return (false);
}
public function isGenuine():Boolean{
if (!hasUTMK()){
return (true);
};
return ((utmk.hash == generateCookiesHash()));
}
public function resetCurrentSession():void{
_clearUTMB();
_clearUTMC();
save();
}
public function hasUTMC():Boolean{
if (_utmc){
return (true);
};
return (false);
}
public function hasUTMK():Boolean{
if (_utmk){
return (true);
};
return (false);
}
public function generateCookiesHash():Number{
var _local1:String;
_local1 = "";
_local1 = (_local1 + utma.valueOf());
_local1 = (_local1 + utmb.valueOf());
_local1 = (_local1 + utmc.valueOf());
_local1 = (_local1 + utmz.valueOf());
_local1 = (_local1 + utmv.valueOf());
return (Utils.generateHash(_local1));
}
private function _createUMTA():void{
_utma = new UTMA();
_utma.proxy = this;
}
private function _createUMTB():void{
_utmb = new UTMB();
_utmb.proxy = this;
}
private function _createUMTC():void{
_utmc = new UTMC();
}
public function hasUTMV():Boolean{
if (_utmv){
return (true);
};
return (false);
}
private function _createUMTK():void{
_utmk = new UTMK();
_utmk.proxy = this;
}
public function hasUTMZ():Boolean{
if (_utmz){
return (true);
};
return (false);
}
private function _createUMTV():void{
_utmv = new UTMV();
_utmv.proxy = this;
}
private function _createUMTZ():void{
_utmz = new UTMZ();
_utmz.proxy = this;
}
public function updateUTMA(_arg1:Number):void{
if (_debug.verbose){
_debug.info((("updateUTMA( " + _arg1) + " )"), VisualDebugMode.advanced);
};
if (!utma.isEmpty()){
if (isNaN(utma.sessionCount)){
utma.sessionCount = 1;
} else {
utma.sessionCount = (utma.sessionCount + 1);
};
utma.lastTime = utma.currentTime;
utma.currentTime = _arg1;
};
}
private function _onFlushStatus(_arg1:NetStatusEvent):void{
_debug.info("User closed permission dialog...");
switch (_arg1.info.code){
case "SharedObject.Flush.Success":
_debug.info("User granted permission -- value saved.");
break;
case "SharedObject.Flush.Failed":
_debug.info("User denied permission -- value not saved.");
break;
};
_SO.removeEventListener(NetStatusEvent.NET_STATUS, _onFlushStatus);
}
private function _clearUTMA():void{
_utma = null;
if (!isVolatile()){
_SO.data.utma = null;
delete _SO.data.utma;
};
}
private function _clearUTMC():void{
_utmc = null;
}
private function _clearUTMB():void{
_utmb = null;
if (!isVolatile()){
_SO.data.utmb = null;
delete _SO.data.utmb;
};
}
public function update(_arg1:String, _arg2):void{
if (isVolatile()){
_OBJ[_arg1] = _arg2;
} else {
_SO.data[_arg1] = _arg2;
};
}
private function _clearUTMZ():void{
_utmz = null;
if (!isVolatile()){
_SO.data.utmz = null;
delete _SO.data.utmz;
};
}
private function _clearUTMV():void{
_utmv = null;
if (!isVolatile()){
_SO.data.utmv = null;
delete _SO.data.utmv;
};
}
public function isVolatile():Boolean{
return (_volatile);
}
public function get utma():UTMA{
if (!hasUTMA()){
_createUMTA();
};
return (_utma);
}
public function get utmb():UTMB{
if (!hasUTMB()){
_createUMTB();
};
return (_utmb);
}
public function get utmc():UTMC{
if (!hasUTMC()){
_createUMTC();
};
return (_utmc);
}
public function get utmk():UTMK{
if (!hasUTMK()){
_createUMTK();
};
return (_utmk);
}
}
}//package com.google.analytics.core
Section 83
//DocumentInfo (com.google.analytics.core.DocumentInfo)
package com.google.analytics.core {
import com.google.analytics.v4.*;
import com.google.analytics.utils.*;
import com.google.analytics.external.*;
public class DocumentInfo {
private var _config:Configuration;
private var _utmr:String;
private var _adSense:AdSenseGlobals;
private var _info:Environment;
private var _pageURL:String;
public function DocumentInfo(_arg1:Configuration, _arg2:Environment, _arg3:String, _arg4:String=null, _arg5:AdSenseGlobals=null){
_config = _arg1;
_info = _arg2;
_utmr = _arg3;
_pageURL = _arg4;
_adSense = _arg5;
}
public function get utmr():String{
if (!_utmr){
return ("-");
};
return (_utmr);
}
public function toURLString():String{
var _local1:Variables;
_local1 = toVariables();
return (_local1.toString());
}
private function _renderPageURL(_arg1:String=""):String{
var _local2:String;
var _local3:String;
_local2 = _info.locationPath;
_local3 = _info.locationSearch;
if (((!(_arg1)) || ((_arg1 == "")))){
_arg1 = (_local2 + unescape(_local3));
};
return (_arg1);
}
public function get utmp():String{
return (_renderPageURL(_pageURL));
}
private function _generateHitId():Number{
var _local1:Number;
if (((_adSense.hid) && (!((_adSense.hid == ""))))){
_local1 = Number(_adSense.hid);
} else {
_local1 = Math.round((Math.random() * 2147483647));
_adSense.hid = String(_local1);
};
return (_local1);
}
public function get utmhid():String{
return (String(_generateHitId()));
}
public function toVariables():Variables{
var _local1:Variables;
_local1 = new Variables();
_local1.URIencode = true;
if (((_config.detectTitle) && (!((utmdt == ""))))){
_local1.utmdt = utmdt;
};
_local1.utmhid = utmhid;
_local1.utmr = utmr;
_local1.utmp = utmp;
return (_local1);
}
public function get utmdt():String{
return (_info.documentTitle);
}
}
}//package com.google.analytics.core
Section 84
//Domain (com.google.analytics.core.Domain)
package com.google.analytics.core {
import com.google.analytics.debug.*;
public class Domain {
private var _mode:DomainNameMode;
private var _name:String;
private var _debug:DebugConfiguration;
public function Domain(_arg1:DomainNameMode=null, _arg2:String="", _arg3:DebugConfiguration=null){
_debug = _arg3;
if (_arg1 == null){
_arg1 = DomainNameMode.auto;
};
_mode = _arg1;
if (_arg1 == DomainNameMode.custom){
this.name = _arg2;
} else {
_name = _arg2;
};
}
public function get mode():DomainNameMode{
return (_mode);
}
public function set mode(_arg1:DomainNameMode):void{
_mode = _arg1;
if (_mode == DomainNameMode.none){
_name = "";
};
}
public function get name():String{
return (_name);
}
public function set name(_arg1:String):void{
if (((!((_arg1.charAt(0) == "."))) && (_debug))){
_debug.warning(("missing leading period \".\", cookie will only be accessible on " + _arg1), VisualDebugMode.geek);
};
_name = _arg1;
}
}
}//package com.google.analytics.core
Section 85
//DomainNameMode (com.google.analytics.core.DomainNameMode)
package com.google.analytics.core {
public class DomainNameMode {
private var _value:int;
private var _name:String;
public static const custom:DomainNameMode = new DomainNameMode(2, "custom");
;
public static const none:DomainNameMode = new DomainNameMode(0, "none");
;
public static const auto:DomainNameMode = new DomainNameMode(1, "auto");
;
public function DomainNameMode(_arg1:int=0, _arg2:String=""){
_value = _arg1;
_name = _arg2;
}
public function valueOf():int{
return (_value);
}
public function toString():String{
return (_name);
}
}
}//package com.google.analytics.core
Section 86
//EventInfo (com.google.analytics.core.EventInfo)
package com.google.analytics.core {
import com.google.analytics.utils.*;
import com.google.analytics.data.*;
public class EventInfo {
private var _isEventHit:Boolean;
private var _ext10:X10;
private var _x10:X10;
public function EventInfo(_arg1:Boolean, _arg2:X10, _arg3:X10=null){
_isEventHit = _arg1;
_x10 = _arg2;
_ext10 = _arg3;
}
public function toURLString():String{
var _local1:Variables;
_local1 = toVariables();
return (_local1.toString());
}
public function get utmt():String{
return ("event");
}
public function get utme():String{
return (_x10.renderMergedUrlString(_ext10));
}
public function toVariables():Variables{
var _local1:Variables;
_local1 = new Variables();
_local1.URIencode = true;
if (_isEventHit){
_local1.utmt = utmt;
};
_local1.utme = utme;
return (_local1);
}
}
}//package com.google.analytics.core
Section 87
//EventTracker (com.google.analytics.core.EventTracker)
package com.google.analytics.core {
import com.google.analytics.v4.*;
public class EventTracker {
private var _parent:GoogleAnalyticsAPI;
public var name:String;
public function EventTracker(_arg1:String, _arg2:GoogleAnalyticsAPI){
this.name = _arg1;
_parent = _arg2;
}
public function trackEvent(_arg1:String, _arg2:String=null, _arg3:Number=NaN):Boolean{
return (_parent.trackEvent(name, _arg1, _arg2, _arg3));
}
}
}//package com.google.analytics.core
Section 88
//ga_internal (com.google.analytics.core.ga_internal)
package com.google.analytics.core {
public namespace ga_internal;
}//package com.google.analytics.core
Section 89
//GIFRequest (com.google.analytics.core.GIFRequest)
package com.google.analytics.core {
import flash.events.*;
import flash.display.*;
import com.google.analytics.v4.*;
import com.google.analytics.debug.*;
import flash.net.*;
import com.google.analytics.utils.*;
import flash.system.*;
public class GIFRequest {
private var _info:Environment;
private var _count:int;
private var _utmac:String;
private var _alertcount:int;
private var _debug:DebugConfiguration;
private var _lastRequest:URLRequest;
private var _buffer:Buffer;
private var _config:Configuration;
private var _requests:Array;
public function GIFRequest(_arg1:Configuration, _arg2:DebugConfiguration, _arg3:Buffer, _arg4:Environment){
_config = _arg1;
_debug = _arg2;
_buffer = _arg3;
_info = _arg4;
_count = 0;
_alertcount = 0;
_requests = [];
}
public function get utmn():String{
return ((Utils.generate32bitRandom() as String));
}
public function onIOError(_arg1:IOErrorEvent):void{
var _local2:String;
var _local3:String;
var _local4:String;
_local2 = _lastRequest.url;
_local3 = String((_requests.length - 1));
_local4 = (("Gif Request #" + _local3) + " failed");
if (_debug.GIFRequests){
if (!_debug.verbose){
if (_local2.indexOf("?") > -1){
_local2 = _local2.split("?")[0];
};
_local2 = _shortenURL(_local2);
};
if (int(_debug.mode) > int(VisualDebugMode.basic)){
_local4 = (_local4 + ((" \"" + _local2) + "\" does not exists or is unreachable"));
};
_debug.failure(_local4);
} else {
_debug.warning(_local4);
};
_removeListeners(_arg1.target);
}
public function send(_arg1:String, _arg2:Variables=null, _arg3:Boolean=false, _arg4:Boolean=false):void{
var _local5:String;
var _local6:URLRequest;
var _local7:URLRequest;
_utmac = _arg1;
if (!_arg2){
_arg2 = new Variables();
};
_arg2.URIencode = false;
_arg2.pre = ["utmwv", "utmn", "utmhn", "utmt", "utme", "utmcs", "utmsr", "utmsc", "utmul", "utmje", "utmfl", "utmdt", "utmhid", "utmr", "utmp"];
_arg2.post = ["utmcc"];
if (_debug.verbose){
_debug.info(((("tracking: " + _buffer.utmb.trackCount) + "/") + _config.trackingLimitPerSession), VisualDebugMode.geek);
};
if ((((_buffer.utmb.trackCount < _config.trackingLimitPerSession)) || (_arg3))){
if (_arg4){
updateToken();
};
if (((((_arg3) || (!(_arg4)))) || ((_buffer.utmb.token >= 1)))){
if (((!(_arg3)) && (_arg4))){
_buffer.utmb.token = (_buffer.utmb.token - 1);
};
_buffer.utmb.trackCount = (_buffer.utmb.trackCount + 1);
if (_debug.verbose){
_debug.info(_buffer.utmb.toString(), VisualDebugMode.geek);
};
_arg2.utmwv = utmwv;
_arg2.utmn = Utils.generate32bitRandom();
if (_info.domainName != ""){
_arg2.utmhn = _info.domainName;
};
if (_config.sampleRate < 1){
_arg2.utmsp = (_config.sampleRate * 100);
};
if ((((_config.serverMode == ServerOperationMode.local)) || ((_config.serverMode == ServerOperationMode.both)))){
_local5 = _info.locationSWFPath;
if (_local5.lastIndexOf("/") > 0){
_local5 = _local5.substring(0, _local5.lastIndexOf("/"));
};
_local6 = new URLRequest();
if (_config.localGIFpath.indexOf("http") == 0){
_local6.url = _config.localGIFpath;
} else {
_local6.url = (_local5 + _config.localGIFpath);
};
_local6.url = (_local6.url + ("?" + _arg2.toString()));
if (((_debug.active) && (_debug.GIFRequests))){
_debugSend(_local6);
} else {
sendRequest(_local6);
};
};
if ((((_config.serverMode == ServerOperationMode.remote)) || ((_config.serverMode == ServerOperationMode.both)))){
_local7 = new URLRequest();
if (_info.protocol == Protocols.HTTPS){
_local7.url = _config.secureRemoteGIFpath;
} else {
if (_info.protocol == Protocols.HTTP){
_local7.url = _config.remoteGIFpath;
} else {
_local7.url = _config.remoteGIFpath;
};
};
_arg2.utmac = utmac;
_arg2.utmcc = encodeURIComponent(utmcc);
_local7.url = (_local7.url + ("?" + _arg2.toString()));
if (((_debug.active) && (_debug.GIFRequests))){
_debugSend(_local7);
} else {
sendRequest(_local7);
};
};
};
};
}
public function onSecurityError(_arg1:SecurityErrorEvent):void{
if (_debug.GIFRequests){
_debug.failure(_arg1.text);
};
}
public function get utmsp():String{
return (((_config.sampleRate * 100) as String));
}
public function get utmcc():String{
var _local1:Array;
_local1 = [];
if (_buffer.hasUTMA()){
_local1.push((_buffer.utma.toURLString() + ";"));
};
if (_buffer.hasUTMZ()){
_local1.push((_buffer.utmz.toURLString() + ";"));
};
if (_buffer.hasUTMV()){
_local1.push((_buffer.utmv.toURLString() + ";"));
};
return (_local1.join("+"));
}
public function get utmac():String{
return (_utmac);
}
public function get utmwv():String{
return (_config.version);
}
public function sendRequest(_arg1:URLRequest):void{
var loader:Loader;
var context:LoaderContext;
var request = _arg1;
loader = new Loader();
loader.name = String(_count++);
context = new LoaderContext(false);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onComplete);
_lastRequest = request;
_requests[loader.name] = new RequestObject(request);
try {
loader.load(request, context);
} catch(e:Error) {
_debug.failure("\"Loader.load()\" could not instanciate Gif Request");
};
}
private function _removeListeners(_arg1:Object):void{
_arg1.removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
_arg1.removeEventListener(Event.COMPLETE, onComplete);
}
public function updateToken():void{
var _local1:Number;
var _local2:Number;
_local1 = new Date().getTime();
_local2 = ((_local1 - _buffer.utmb.lastTime) * (_config.tokenRate / 1000));
if (_debug.verbose){
_debug.info(("tokenDelta: " + _local2), VisualDebugMode.geek);
};
if (_local2 >= 1){
_buffer.utmb.token = Math.min(Math.floor((_buffer.utmb.token + _local2)), _config.bucketCapacity);
_buffer.utmb.lastTime = _local1;
if (_debug.verbose){
_debug.info(_buffer.utmb.toString(), VisualDebugMode.geek);
};
};
}
private function _shortenURL(_arg1:String):String{
var _local2:Array;
if (_arg1.length > 60){
_local2 = _arg1.split("/");
while (_arg1.length > 60) {
_local2.shift();
_arg1 = ("../" + _local2.join("/"));
};
};
return (_arg1);
}
public function get utmhn():String{
return (_info.domainName);
}
private function _debugSend(_arg1:URLRequest):void{
var _local2:String;
var _local3:String;
_local2 = "";
switch (_debug.mode){
case VisualDebugMode.geek:
_local2 = ((("Gif Request #" + _alertcount) + ":\n") + _arg1.url);
break;
case VisualDebugMode.advanced:
_local3 = _arg1.url;
if (_local3.indexOf("?") > -1){
_local3 = _local3.split("?")[0];
};
_local3 = _shortenURL(_local3);
_local2 = (((("Send Gif Request #" + _alertcount) + ":\n") + _local3) + " ?");
break;
case VisualDebugMode.basic:
default:
_local2 = (((("Send " + _config.serverMode.toString()) + " Gif Request #") + _alertcount) + " ?");
};
_debug.alertGifRequest(_local2, _arg1, this);
_alertcount++;
}
public function onComplete(_arg1:Event):void{
var _local2:String;
var _local3:String;
var _local4:String;
_local2 = _arg1.target.loader.name;
_requests[_local2].complete();
_local3 = (("Gif Request #" + _local2) + " sent");
_local4 = _requests[_local2].request.url;
if (_debug.GIFRequests){
if (!_debug.verbose){
if (_local4.indexOf("?") > -1){
_local4 = _local4.split("?")[0];
};
_local4 = _shortenURL(_local4);
};
if (int(_debug.mode) > int(VisualDebugMode.basic)){
_local3 = (_local3 + ((" to \"" + _local4) + "\""));
};
_debug.success(_local3);
} else {
_debug.info(_local3);
};
_removeListeners(_arg1.target);
}
}
}//package com.google.analytics.core
Section 90
//IdleTimer (com.google.analytics.core.IdleTimer)
package com.google.analytics.core {
import flash.events.*;
import flash.display.*;
import com.google.analytics.v4.*;
import com.google.analytics.debug.*;
import flash.utils.*;
public class IdleTimer {
private var _loop:Timer;
private var _stage:Stage;
private var _lastMove:int;
private var _debug:DebugConfiguration;
private var _session:Timer;
private var _inactivity:Number;
private var _buffer:Buffer;
public function IdleTimer(_arg1:Configuration, _arg2:DebugConfiguration, _arg3:DisplayObject, _arg4:Buffer){
var _local5:Number;
var _local6:Number;
var _local7:Number;
super();
_local5 = _arg1.idleLoop;
_local6 = _arg1.idleTimeout;
_local7 = _arg1.sessionTimeout;
_loop = new Timer((_local5 * 1000));
_session = new Timer((_local7 * 1000), 1);
_debug = _arg2;
_stage = _arg3.stage;
_buffer = _arg4;
_lastMove = getTimer();
_inactivity = (_local6 * 1000);
_loop.addEventListener(TimerEvent.TIMER, checkForIdle);
_session.addEventListener(TimerEvent.TIMER_COMPLETE, endSession);
_stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMove);
_debug.info(((((("delay: " + _local5) + "sec , inactivity: ") + _local6) + "sec, sessionTimeout: ") + _local7), VisualDebugMode.geek);
_loop.start();
}
private function onMouseMove(_arg1:MouseEvent):void{
_lastMove = getTimer();
if (_session.running){
_debug.info("session timer reset", VisualDebugMode.geek);
_session.reset();
};
}
public function endSession(_arg1:TimerEvent):void{
_session.removeEventListener(TimerEvent.TIMER_COMPLETE, endSession);
_debug.info("session timer end session", VisualDebugMode.geek);
_session.reset();
_buffer.resetCurrentSession();
_debug.info(_buffer.utmb.toString(), VisualDebugMode.geek);
_debug.info(_buffer.utmc.toString(), VisualDebugMode.geek);
_session.addEventListener(TimerEvent.TIMER_COMPLETE, endSession);
}
public function checkForIdle(_arg1:TimerEvent):void{
var _local2:int;
_local2 = getTimer();
if ((_local2 - _lastMove) >= _inactivity){
if (!_session.running){
_debug.info("session timer start", VisualDebugMode.geek);
_session.start();
};
};
}
}
}//package com.google.analytics.core
Section 91
//Organic (com.google.analytics.core.Organic)
package com.google.analytics.core {
import com.google.analytics.utils.*;
public class Organic {
private var _sourcesCache:Array;
private var _sourcesEngine:Array;
private var _ignoredKeywords:Array;
private var _ignoredReferralsCache:Object;
private var _ignoredReferrals:Array;
private var _ignoredKeywordsCache:Object;
private var _sources:Array;
public static var throwErrors:Boolean = false;
public function Organic(){
_sources = [];
_sourcesCache = [];
_sourcesEngine = [];
_ignoredReferrals = [];
_ignoredReferralsCache = {};
_ignoredKeywords = [];
_ignoredKeywordsCache = {};
}
public function getKeywordValue(_arg1:OrganicReferrer, _arg2:String):String{
var _local3:String;
_local3 = _arg1.keyword;
return (getKeywordValueFromPath(_local3, _arg2));
}
public function isIgnoredKeyword(_arg1:String):Boolean{
if (_ignoredKeywordsCache.hasOwnProperty(_arg1)){
return (true);
};
return (false);
}
public function isIgnoredReferral(_arg1:String):Boolean{
if (_ignoredReferralsCache.hasOwnProperty(_arg1)){
return (true);
};
return (false);
}
public function clear():void{
clearEngines();
clearIgnoredReferrals();
clearIgnoredKeywords();
}
public function get ignoredKeywordsCount():int{
return (_ignoredKeywords.length);
}
public function match(_arg1:String):Boolean{
if (_arg1 == ""){
return (false);
};
_arg1 = _arg1.toLowerCase();
if (_sourcesEngine[_arg1] != undefined){
return (true);
};
return (false);
}
public function get count():int{
return (_sources.length);
}
public function addSource(_arg1:String, _arg2:String):void{
var _local3:OrganicReferrer;
_local3 = new OrganicReferrer(_arg1, _arg2);
if (_sourcesCache[_local3.toString()] == undefined){
_sources.push(_local3);
_sourcesCache[_local3.toString()] = (_sources.length - 1);
if (_sourcesEngine[_local3.engine] == undefined){
_sourcesEngine[_local3.engine] = [(_sources.length - 1)];
} else {
_sourcesEngine[_local3.engine].push((_sources.length - 1));
};
} else {
if (throwErrors){
throw (new Error((_local3.toString() + " already exists, we don't add it.")));
};
};
}
public function clearIgnoredKeywords():void{
_ignoredKeywords = [];
_ignoredKeywordsCache = {};
}
public function clearEngines():void{
_sources = [];
_sourcesCache = [];
_sourcesEngine = [];
}
public function get ignoredReferralsCount():int{
return (_ignoredReferrals.length);
}
public function addIgnoredReferral(_arg1:String):void{
if (_ignoredReferralsCache[_arg1] == undefined){
_ignoredReferrals.push(_arg1);
_ignoredReferralsCache[_arg1] = (_ignoredReferrals.length - 1);
} else {
if (throwErrors){
throw (new Error((("\"" + _arg1) + "\" already exists, we don't add it.")));
};
};
}
public function clearIgnoredReferrals():void{
_ignoredReferrals = [];
_ignoredReferralsCache = {};
}
public function getReferrerByName(_arg1:String):OrganicReferrer{
var _local2:int;
if (match(_arg1)){
_local2 = _sourcesEngine[_arg1][0];
return (_sources[_local2]);
};
return (null);
}
public function addIgnoredKeyword(_arg1:String):void{
if (_ignoredKeywordsCache[_arg1] == undefined){
_ignoredKeywords.push(_arg1);
_ignoredKeywordsCache[_arg1] = (_ignoredKeywords.length - 1);
} else {
if (throwErrors){
throw (new Error((("\"" + _arg1) + "\" already exists, we don't add it.")));
};
};
}
public function get sources():Array{
return (_sources);
}
public static function getKeywordValueFromPath(_arg1:String, _arg2:String):String{
var _local3:String;
var _local4:Variables;
if (_arg2.indexOf((_arg1 + "=")) > -1){
if (_arg2.charAt(0) == "?"){
_arg2 = _arg2.substr(1);
};
_arg2 = _arg2.split("+").join("%20");
_local4 = new Variables(_arg2);
_local3 = _local4[_arg1];
};
return (_local3);
}
}
}//package com.google.analytics.core
Section 92
//OrganicReferrer (com.google.analytics.core.OrganicReferrer)
package com.google.analytics.core {
public class OrganicReferrer {
private var _engine:String;
private var _keyword:String;
public function OrganicReferrer(_arg1:String, _arg2:String){
this.engine = _arg1;
this.keyword = _arg2;
}
public function set engine(_arg1:String):void{
_engine = _arg1.toLowerCase();
}
public function get keyword():String{
return (_keyword);
}
public function toString():String{
return (((engine + "?") + keyword));
}
public function get engine():String{
return (_engine);
}
public function set keyword(_arg1:String):void{
_keyword = _arg1.toLowerCase();
}
}
}//package com.google.analytics.core
Section 93
//RequestObject (com.google.analytics.core.RequestObject)
package com.google.analytics.core {
import flash.net.*;
import flash.utils.*;
public class RequestObject {
public var start:int;
public var request:URLRequest;
public var end:int;
public function RequestObject(_arg1:URLRequest){
start = getTimer();
this.request = _arg1;
}
public function toString():String{
var _local1:Array;
_local1 = [];
_local1.push((("duration: " + duration) + "ms"));
_local1.push(("url: " + request.url));
return ((("{ " + _local1.join(", ")) + " }"));
}
public function get duration():int{
if (!hasCompleted()){
return (0);
};
return ((end - start));
}
public function hasCompleted():Boolean{
return ((end > 0));
}
public function complete():void{
end = getTimer();
}
}
}//package com.google.analytics.core
Section 94
//ServerOperationMode (com.google.analytics.core.ServerOperationMode)
package com.google.analytics.core {
public class ServerOperationMode {
private var _value:int;
private var _name:String;
public static const both:ServerOperationMode = new ServerOperationMode(2, "both");
;
public static const remote:ServerOperationMode = new ServerOperationMode(1, "remote");
;
public static const local:ServerOperationMode = new ServerOperationMode(0, "local");
;
public function ServerOperationMode(_arg1:int=0, _arg2:String=""){
_value = _arg1;
_name = _arg2;
}
public function valueOf():int{
return (_value);
}
public function toString():String{
return (_name);
}
}
}//package com.google.analytics.core
Section 95
//TrackerCache (com.google.analytics.core.TrackerCache)
package com.google.analytics.core {
import com.google.analytics.v4.*;
import flash.errors.*;
public class TrackerCache implements GoogleAnalyticsAPI {
public var tracker:GoogleAnalyticsAPI;
private var _ar:Array;
public static var CACHE_THROW_ERROR:Boolean;
public function TrackerCache(_arg1:GoogleAnalyticsAPI=null){
this.tracker = _arg1;
_ar = [];
}
public function size():uint{
return (_ar.length);
}
public function flush():void{
var _local1:Object;
var _local2:String;
var _local3:Array;
var _local4:int;
var _local5:int;
if (tracker == null){
return;
};
if (size() > 0){
_local4 = _ar.length;
while (_local5 < _local4) {
_local1 = _ar.shift();
_local2 = (_local1.name as String);
_local3 = (_local1.args as Array);
if (((!((_local2 == null))) && ((_local2 in tracker)))){
(tracker[_local2] as Function).apply(tracker, _local3);
};
_local5++;
};
};
}
public function enqueue(_arg1:String, ... _args):Boolean{
if (_arg1 == null){
return (false);
};
_ar.push({name:_arg1, args:_args});
return (true);
}
public function link(_arg1:String, _arg2:Boolean=false):void{
enqueue("link", _arg1, _arg2);
}
public function addOrganic(_arg1:String, _arg2:String):void{
enqueue("addOrganic", _arg1, _arg2);
}
public function setAllowLinker(_arg1:Boolean):void{
enqueue("setAllowLinker", _arg1);
}
public function trackEvent(_arg1:String, _arg2:String, _arg3:String=null, _arg4:Number=NaN):Boolean{
enqueue("trackEvent", _arg1, _arg2, _arg3, _arg4);
return (true);
}
public function trackTrans():void{
enqueue("trackTrans");
}
public function trackPageview(_arg1:String=""):void{
enqueue("trackPageview", _arg1);
}
public function setClientInfo(_arg1:Boolean):void{
enqueue("setClientInfo", _arg1);
}
public function getClientInfo():Boolean{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getClientInfo' method for the moment."));
};
return (false);
}
public function linkByPost(_arg1:Object, _arg2:Boolean=false):void{
enqueue("linkByPost", _arg1, _arg2);
}
public function setCookieTimeout(_arg1:int):void{
enqueue("setCookieTimeout", _arg1);
}
public function isEmpty():Boolean{
return ((_ar.length == 0));
}
public function resetSession():void{
enqueue("resetSession");
}
public function setDetectFlash(_arg1:Boolean):void{
enqueue("setDetectFlash", _arg1);
}
public function clear():void{
_ar = [];
}
public function getDetectTitle():Boolean{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getDetectTitle' method for the moment."));
};
return (false);
}
public function setCampNameKey(_arg1:String):void{
enqueue("setCampNameKey", _arg1);
}
public function addItem(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:Number, _arg6:int):void{
enqueue("addItem", _arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
}
public function createEventTracker(_arg1:String):EventTracker{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'createEventTracker' method for the moment."));
};
return (null);
}
public function setVar(_arg1:String):void{
enqueue("setVar", _arg1);
}
public function clearIgnoredOrganic():void{
enqueue("clearIgnoredOrganic");
}
public function setDomainName(_arg1:String):void{
enqueue("setDomainName", _arg1);
}
public function addTrans(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:String, _arg8:String):Object{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'addTrans' method for the moment."));
};
return (null);
}
public function setCampSourceKey(_arg1:String):void{
enqueue("setCampSourceKey", _arg1);
}
public function setCampContentKey(_arg1:String):void{
enqueue("setCampContentKey", _arg1);
}
public function clearIgnoredRef():void{
enqueue("clearIgnoredRef");
}
public function setLocalServerMode():void{
enqueue("setLocalServerMode");
}
public function getLocalGifPath():String{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getLocalGifPath' method for the moment."));
};
return ("");
}
public function setAllowAnchor(_arg1:Boolean):void{
enqueue("setAllowAnchor", _arg1);
}
public function setLocalGifPath(_arg1:String):void{
enqueue("setLocalGifPath", _arg1);
}
public function getVersion():String{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getVersion' method for the moment."));
};
return ("");
}
public function setCookiePath(_arg1:String):void{
enqueue("setCookiePath", _arg1);
}
public function setSampleRate(_arg1:Number):void{
enqueue("setSampleRate", _arg1);
}
public function setAllowHash(_arg1:Boolean):void{
enqueue("setAllowHash", _arg1);
}
public function addIgnoredOrganic(_arg1:String):void{
enqueue("addIgnoredOrganic", _arg1);
}
public function setCampNOKey(_arg1:String):void{
enqueue("setCampNOKey", _arg1);
}
public function getServiceMode():ServerOperationMode{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getServiceMode' method for the moment."));
};
return (null);
}
public function setLocalRemoteServerMode():void{
enqueue("setLocalRemoteServerMode");
}
public function cookiePathCopy(_arg1:String):void{
enqueue("cookiePathCopy", _arg1);
}
public function setDetectTitle(_arg1:Boolean):void{
enqueue("setDetectTitle", _arg1);
}
public function getDetectFlash():Boolean{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getDetectFlash' method for the moment."));
};
return (false);
}
public function setCampaignTrack(_arg1:Boolean):void{
enqueue("setCampaignTrack", _arg1);
}
public function clearOrganic():void{
enqueue("clearOrganic");
}
public function setCampTermKey(_arg1:String):void{
enqueue("setCampTermKey", _arg1);
}
public function addIgnoredRef(_arg1:String):void{
enqueue("addIgnoredRef", _arg1);
}
public function setCampMediumKey(_arg1:String):void{
enqueue("setCampMediumKey", _arg1);
}
public function setSessionTimeout(_arg1:int):void{
enqueue("setSessionTimeout", _arg1);
}
public function setRemoteServerMode():void{
enqueue("setRemoteServerMode");
}
public function element(){
return (_ar[0]);
}
public function getAccount():String{
if (CACHE_THROW_ERROR){
throw (new IllegalOperationError("The tracker is not ready and you can use the 'getAccount' method for the moment."));
};
return ("");
}
}
}//package com.google.analytics.core
Section 96
//TrackerMode (com.google.analytics.core.TrackerMode)
package com.google.analytics.core {
public class TrackerMode {
public static const BRIDGE:String = "Bridge";
public static const AS3:String = "AS3";
}
}//package com.google.analytics.core
Section 97
//Utils (com.google.analytics.core.Utils)
package com.google.analytics.core {
public class Utils {
public static function trim(_arg1:String, _arg2:Boolean=false):String{
var _local3:Array;
var _local4:String;
var _local5:int;
var _local6:int;
var _local7:int;
if (_arg1 == ""){
return ("");
};
_local3 = [" ", "\n", "\r", "\t"];
_local4 = _arg1;
if (_arg2){
_local5 = 0;
while ((((_local5 < _local3.length)) && ((_local4.indexOf(_local3[_local5]) > -1)))) {
_local4 = _local4.split(_local3[_local5]).join("");
_local5++;
};
} else {
_local6 = 0;
while ((((_local6 < _local4.length)) && ((_local3.indexOf(_local4.charAt(_local6)) > -1)))) {
_local6++;
};
_local4 = _local4.substr(_local6);
_local7 = (_local4.length - 1);
while ((((_local7 >= 0)) && ((_local3.indexOf(_local4.charAt(_local7)) > -1)))) {
_local7--;
};
_local4 = _local4.substring(0, (_local7 + 1));
};
return (_local4);
}
public static function generateHash(_arg1:String):int{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
_local2 = 1;
_local3 = 0;
if (((!((_arg1 == null))) && (!((_arg1 == ""))))){
_local2 = 0;
_local4 = (_arg1.length - 1);
while (_local4 >= 0) {
_local5 = _arg1.charCodeAt(_local4);
_local2 = ((((_local2 << 6) & 268435455) + _local5) + (_local5 << 14));
_local3 = (_local2 & 266338304);
if (_local3 != 0){
_local2 = (_local2 ^ (_local3 >> 21));
};
_local4--;
};
};
return (_local2);
}
public static function generate32bitRandom():int{
return (Math.round((Math.random() * 2147483647)));
}
public static function validateAccount(_arg1:String):Boolean{
var _local2:RegExp;
_local2 = /^UA-[0-9]*-[0-9]*$/;
return (_local2.test(_arg1));
}
}
}//package com.google.analytics.core
Section 98
//Cookie (com.google.analytics.data.Cookie)
package com.google.analytics.data {
public interface Cookie {
function toURLString():String;
function toSharedObject():Object;
function set creation(_arg1:Date):void;
function fromSharedObject(_arg1:Object):void;
function get expiration():Date;
function isExpired():Boolean;
function set expiration(_arg1:Date):void;
function get creation():Date;
}
}//package com.google.analytics.data
Section 99
//UTMA (com.google.analytics.data.UTMA)
package com.google.analytics.data {
import com.google.analytics.utils.*;
public class UTMA extends UTMCookie {
private var _domainHash:Number;
private var _firstTime:Number;
private var _currentTime:Number;
private var _sessionId:Number;
private var _lastTime:Number;
private var _sessionCount:Number;
public function UTMA(_arg1:Number=NaN, _arg2:Number=NaN, _arg3:Number=NaN, _arg4:Number=NaN, _arg5:Number=NaN, _arg6:Number=NaN){
super("utma", "__utma", ["domainHash", "sessionId", "firstTime", "lastTime", "currentTime", "sessionCount"], (Timespan.twoyears * 1000));
this.domainHash = _arg1;
this.sessionId = _arg2;
this.firstTime = _arg3;
this.lastTime = _arg4;
this.currentTime = _arg5;
this.sessionCount = _arg6;
}
public function get lastTime():Number{
return (_lastTime);
}
public function set lastTime(_arg1:Number):void{
_lastTime = _arg1;
update();
}
public function get sessionCount():Number{
return (_sessionCount);
}
public function get firstTime():Number{
return (_firstTime);
}
public function set sessionId(_arg1:Number):void{
_sessionId = _arg1;
update();
}
public function set sessionCount(_arg1:Number):void{
_sessionCount = _arg1;
update();
}
public function set firstTime(_arg1:Number):void{
_firstTime = _arg1;
update();
}
public function set currentTime(_arg1:Number):void{
_currentTime = _arg1;
update();
}
public function get sessionId():Number{
return (_sessionId);
}
public function set domainHash(_arg1:Number):void{
_domainHash = _arg1;
update();
}
public function get currentTime():Number{
return (_currentTime);
}
public function get domainHash():Number{
return (_domainHash);
}
}
}//package com.google.analytics.data
Section 100
//UTMB (com.google.analytics.data.UTMB)
package com.google.analytics.data {
import com.google.analytics.utils.*;
public class UTMB extends UTMCookie {
private var _lastTime:Number;
private var _domainHash:Number;
private var _trackCount:Number;
private var _token:Number;
public static var defaultTimespan:Number = Timespan.thirtyminutes;
public function UTMB(_arg1:Number=NaN, _arg2:Number=NaN, _arg3:Number=NaN, _arg4:Number=NaN){
super("utmb", "__utmb", ["domainHash", "trackCount", "token", "lastTime"], (defaultTimespan * 1000));
this.domainHash = _arg1;
this.trackCount = _arg2;
this.token = _arg3;
this.lastTime = _arg4;
}
public function get token():Number{
return (_token);
}
public function set trackCount(_arg1:Number):void{
_trackCount = _arg1;
update();
}
public function set lastTime(_arg1:Number):void{
_lastTime = _arg1;
update();
}
public function get lastTime():Number{
return (_lastTime);
}
public function set domainHash(_arg1:Number):void{
_domainHash = _arg1;
update();
}
public function get domainHash():Number{
return (_domainHash);
}
public function set token(_arg1:Number):void{
_token = _arg1;
update();
}
public function get trackCount():Number{
return (_trackCount);
}
}
}//package com.google.analytics.data
Section 101
//UTMC (com.google.analytics.data.UTMC)
package com.google.analytics.data {
public class UTMC extends UTMCookie {
private var _domainHash:Number;
public function UTMC(_arg1:Number=NaN){
super("utmc", "__utmc", ["domainHash"]);
this.domainHash = _arg1;
}
public function set domainHash(_arg1:Number):void{
_domainHash = _arg1;
update();
}
public function get domainHash():Number{
return (_domainHash);
}
}
}//package com.google.analytics.data
Section 102
//UTMCookie (com.google.analytics.data.UTMCookie)
package com.google.analytics.data {
import com.google.analytics.core.*;
public class UTMCookie implements Cookie {
protected var inURL:String;
protected var name:String;
private var _creation:Date;
private var _expiration:Date;
public var proxy:Buffer;
private var _timespan:Number;
protected var fields:Array;
public function UTMCookie(_arg1:String, _arg2:String, _arg3:Array, _arg4:Number=0){
this.name = _arg1;
this.inURL = _arg2;
this.fields = _arg3;
_timestamp(_arg4);
}
public function isEmpty():Boolean{
var _local1:int;
var _local2:String;
var _local3:int;
_local1 = 0;
_local3 = 0;
while (_local3 < fields.length) {
_local2 = fields[_local3];
if ((((this[_local2] is Number)) && (isNaN(this[_local2])))){
_local1++;
} else {
if ((((this[_local2] is String)) && ((this[_local2] == "")))){
_local1++;
};
};
_local3++;
};
if (_local1 == fields.length){
return (true);
};
return (false);
}
protected function update():void{
resetTimestamp();
if (proxy){
proxy.update(name, toSharedObject());
};
}
public function fromSharedObject(_arg1:Object):void{
var _local2:String;
var _local3:int;
var _local4:int;
_local3 = fields.length;
_local4 = 0;
while (_local4 < _local3) {
_local2 = fields[_local4];
if (_arg1[_local2]){
this[_local2] = _arg1[_local2];
};
_local4++;
};
if (_arg1.creation){
this.creation = _arg1.creation;
};
if (_arg1.expiration){
this.expiration = _arg1.expiration;
};
}
private function _timestamp(_arg1:Number):void{
creation = new Date();
_timespan = _arg1;
if (_arg1 > 0){
expiration = new Date((creation.valueOf() + _arg1));
};
}
public function isExpired():Boolean{
var _local1:Date;
var _local2:Number;
_local1 = new Date();
_local2 = (expiration.valueOf() - _local1.valueOf());
if (_local2 <= 0){
return (true);
};
return (false);
}
public function set expiration(_arg1:Date):void{
_expiration = _arg1;
}
public function get creation():Date{
return (_creation);
}
public function reset():void{
var _local1:String;
var _local2:int;
_local2 = 0;
while (_local2 < fields.length) {
_local1 = fields[_local2];
if ((this[_local1] is Number)){
this[_local1] = NaN;
} else {
if ((this[_local1] is String)){
this[_local1] = "";
};
};
_local2++;
};
resetTimestamp();
update();
}
public function valueOf():String{
var _local1:Array;
var _local2:String;
var _local3:*;
var _local4:int;
_local1 = [];
_local4 = 0;
while (_local4 < fields.length) {
_local2 = fields[_local4];
_local3 = this[_local2];
if ((_local3 is String)){
if (_local3 == ""){
_local3 = "-";
_local1.push(_local3);
} else {
_local1.push(_local3);
};
} else {
if ((_local3 is Number)){
if (_local3 == 0){
_local1.push(_local3);
} else {
if (isNaN(_local3)){
_local3 = "-";
_local1.push(_local3);
} else {
_local1.push(_local3);
};
};
};
};
_local4++;
};
return (("" + _local1.join(".")));
}
public function resetTimestamp(_arg1:Number=NaN):void{
if (!isNaN(_arg1)){
_timespan = _arg1;
};
_creation = null;
_expiration = null;
_timestamp(_timespan);
}
public function get expiration():Date{
if (_expiration){
return (_expiration);
};
return (new Date((new Date().valueOf() + 1000)));
}
public function toURLString():String{
return (((inURL + "=") + valueOf()));
}
public function toSharedObject():Object{
var _local1:Object;
var _local2:String;
var _local3:*;
var _local4:int;
_local1 = {};
_local4 = 0;
for (;_local4 < fields.length;_local4++) {
_local2 = fields[_local4];
_local3 = this[_local2];
if ((_local3 is String)){
_local1[_local2] = _local3;
} else {
if (_local3 == 0){
_local1[_local2] = _local3;
} else {
if (isNaN(_local3)){
continue;
} else {
_local1[_local2] = _local3;
};
};
};
};
_local1.creation = creation;
_local1.expiration = expiration;
return (_local1);
}
public function toString(_arg1:Boolean=false):String{
var _local2:Array;
var _local3:String;
var _local4:*;
var _local5:int;
var _local6:int;
var _local7:String;
_local2 = [];
_local5 = fields.length;
_local6 = 0;
for (;_local6 < _local5;_local6++) {
_local3 = fields[_local6];
_local4 = this[_local3];
if ((_local4 is String)){
_local2.push((((_local3 + ": \"") + _local4) + "\""));
} else {
if (_local4 == 0){
_local2.push(((_local3 + ": ") + _local4));
} else {
if (isNaN(_local4)){
continue;
} else {
_local2.push(((_local3 + ": ") + _local4));
};
};
};
};
_local7 = (((name.toUpperCase() + " {") + _local2.join(", ")) + "}");
if (_arg1){
_local7 = (_local7 + (((" creation:" + creation) + ", expiration:") + expiration));
};
return (_local7);
}
public function set creation(_arg1:Date):void{
_creation = _arg1;
}
}
}//package com.google.analytics.data
Section 103
//UTMK (com.google.analytics.data.UTMK)
package com.google.analytics.data {
public class UTMK extends UTMCookie {
private var _hash:Number;
public function UTMK(_arg1:Number=NaN){
super("utmk", "__utmk", ["hash"]);
this.hash = _arg1;
}
public function get hash():Number{
return (_hash);
}
public function set hash(_arg1:Number):void{
_hash = _arg1;
update();
}
}
}//package com.google.analytics.data
Section 104
//UTMV (com.google.analytics.data.UTMV)
package com.google.analytics.data {
import com.google.analytics.utils.*;
public class UTMV extends UTMCookie {
private var _domainHash:Number;
private var _value:String;
public function UTMV(_arg1:Number=NaN, _arg2:String=""){
super("utmv", "__utmv", ["domainHash", "value"], (Timespan.twoyears * 1000));
this.domainHash = _arg1;
this.value = _arg2;
}
public function get value():String{
return (_value);
}
public function set value(_arg1:String):void{
_value = _arg1;
update();
}
override public function toURLString():String{
return (((inURL + "=") + encodeURI(valueOf())));
}
public function get domainHash():Number{
return (_domainHash);
}
public function set domainHash(_arg1:Number):void{
_domainHash = _arg1;
update();
}
}
}//package com.google.analytics.data
Section 105
//UTMZ (com.google.analytics.data.UTMZ)
package com.google.analytics.data {
import com.google.analytics.utils.*;
public class UTMZ extends UTMCookie {
private var _domainHash:Number;
private var _campaignSessions:Number;
private var _campaignTracking:String;
private var _responseCount:Number;
private var _campaignCreation:Number;
public static var defaultTimespan:Number = Timespan.sixmonths;
public function UTMZ(_arg1:Number=NaN, _arg2:Number=NaN, _arg3:Number=NaN, _arg4:Number=NaN, _arg5:String=""){
super("utmz", "__utmz", ["domainHash", "campaignCreation", "campaignSessions", "responseCount", "campaignTracking"], (defaultTimespan * 1000));
this.domainHash = _arg1;
this.campaignCreation = _arg2;
this.campaignSessions = _arg3;
this.responseCount = _arg4;
this.campaignTracking = _arg5;
}
public function get campaignCreation():Number{
return (_campaignCreation);
}
public function set campaignSessions(_arg1:Number):void{
_campaignSessions = _arg1;
update();
}
public function set responseCount(_arg1:Number):void{
_responseCount = _arg1;
update();
}
public function set campaignCreation(_arg1:Number):void{
_campaignCreation = _arg1;
update();
}
public function get campaignSessions():Number{
return (_campaignSessions);
}
public function get responseCount():Number{
return (_responseCount);
}
public function set domainHash(_arg1:Number):void{
_domainHash = _arg1;
update();
}
public function get campaignTracking():String{
return (_campaignTracking);
}
public function set campaignTracking(_arg1:String):void{
_campaignTracking = _arg1;
update();
}
public function get domainHash():Number{
return (_domainHash);
}
}
}//package com.google.analytics.data
Section 106
//X10 (com.google.analytics.data.X10)
package com.google.analytics.data {
public class X10 {
private var _delimEnd:String;// = ")"
private var _delimSet:String;// = "*"
private var _escapeChar:String;// = "'"
private var _delimBegin:String;// = "("
private var _delimNumValue:String;// = "!"
private var _key:String;// = "k"
private var _set:Array;
private var _projectData:Object;
private var _hasData:int;
private var _escapeCharMap:Object;
private var _minimum:int;
private var _value:String;// = "v"
public function X10(){
_key = "k";
_value = "v";
_set = [_key, _value];
_delimBegin = "(";
_delimEnd = ")";
_delimSet = "*";
_delimNumValue = "!";
_escapeChar = "'";
super();
_projectData = {};
_escapeCharMap = {};
_escapeCharMap[_escapeChar] = "'0";
_escapeCharMap[_delimEnd] = "'1";
_escapeCharMap[_delimSet] = "'2";
_escapeCharMap[_delimNumValue] = "'3";
_minimum = 1;
}
private function _clearInternal(_arg1:Number, _arg2:String):void{
var _local3:Boolean;
var _local4:int;
var _local5:int;
if (((hasProject(_arg1)) && (!((_projectData[_arg1][_arg2] == undefined))))){
_projectData[_arg1][_arg2] = undefined;
_local3 = true;
_local5 = _set.length;
_local4 = 0;
while (_local4 < _local5) {
if (_projectData[_arg1][_set[_local4]] != undefined){
_local3 = false;
break;
};
_local4++;
};
if (_local3){
_projectData[_arg1] = undefined;
_hasData = (_hasData - 1);
};
};
}
public function hasData():Boolean{
return ((_hasData > 0));
}
private function _setInternal(_arg1:Number, _arg2:String, _arg3:Number, _arg4:String):void{
if (!hasProject(_arg1)){
_projectData[_arg1] = {};
};
if (_projectData[_arg1][_arg2] == undefined){
_projectData[_arg1][_arg2] = [];
};
_projectData[_arg1][_arg2][_arg3] = _arg4;
_hasData = (_hasData + 1);
}
public function hasProject(_arg1:Number):Boolean{
return (_projectData[_arg1]);
}
public function clearKey(_arg1:Number):void{
_clearInternal(_arg1, _key);
}
private function _renderDataType(_arg1:Array):String{
var _local2:Array;
var _local3:String;
var _local4:int;
_local2 = [];
_local4 = 0;
while (_local4 < _arg1.length) {
if (_arg1[_local4] != undefined){
_local3 = "";
if (((!((_local4 == _minimum))) && ((_arg1[(_local4 - 1)] == undefined)))){
_local3 = (_local3 + _local4.toString());
_local3 = (_local3 + _delimNumValue);
};
_local3 = (_local3 + _escapeExtensibleValue(_arg1[_local4]));
_local2.push(_local3);
};
_local4++;
};
return (((_delimBegin + _local2.join(_delimSet)) + _delimEnd));
}
public function getKey(_arg1:Number, _arg2:Number):String{
return ((_getInternal(_arg1, _key, _arg2) as String));
}
public function clearValue(_arg1:Number):void{
_clearInternal(_arg1, _value);
}
public function renderMergedUrlString(_arg1:X10=null):String{
var _local2:Array;
var _local3:String;
if (!_arg1){
return (renderUrlString());
};
_local2 = [_arg1.renderUrlString()];
for (_local3 in _projectData) {
if (((hasProject(Number(_local3))) && (!(_arg1.hasProject(Number(_local3)))))){
_local2.push((_local3 + _renderProject(_projectData[_local3])));
};
};
return (_local2.join(""));
}
public function setValue(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
if (((((!((Math.round(_arg3) == _arg3))) || (isNaN(_arg3)))) || ((_arg3 == Infinity)))){
return (false);
};
_setInternal(_arg1, _value, _arg2, _arg3.toString());
return (true);
}
public function renderUrlString():String{
var _local1:Array;
var _local2:String;
_local1 = [];
for (_local2 in _projectData) {
if (hasProject(Number(_local2))){
_local1.push((_local2 + _renderProject(_projectData[_local2])));
};
};
return (_local1.join(""));
}
private function _getInternal(_arg1:Number, _arg2:String, _arg3:Number):Object{
if (((hasProject(_arg1)) && (!((_projectData[_arg1][_arg2] == undefined))))){
return (_projectData[_arg1][_arg2][_arg3]);
};
return (undefined);
}
public function setKey(_arg1:Number, _arg2:Number, _arg3:String):Boolean{
_setInternal(_arg1, _key, _arg2, _arg3);
return (true);
}
public function getValue(_arg1:Number, _arg2:Number){
var _local3:*;
_local3 = _getInternal(_arg1, _value, _arg2);
if (_local3 == null){
return (null);
};
return (Number(_local3));
}
private function _renderProject(_arg1:Object):String{
var _local2:String;
var _local3:Boolean;
var _local4:int;
var _local5:Array;
var _local6:int;
_local2 = "";
_local3 = false;
_local6 = _set.length;
_local4 = 0;
while (_local4 < _local6) {
_local5 = _arg1[_set[_local4]];
if (_local5){
if (_local3){
_local2 = (_local2 + _set[_local4]);
};
_local2 = (_local2 + _renderDataType(_local5));
_local3 = false;
} else {
_local3 = true;
};
_local4++;
};
return (_local2);
}
private function _escapeExtensibleValue(_arg1:String):String{
var _local2:String;
var _local3:int;
var _local4:String;
var _local5:String;
_local2 = "";
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = _arg1.charAt(_local3);
_local5 = _escapeCharMap[_local4];
if (_local5){
_local2 = (_local2 + _local5);
} else {
_local2 = (_local2 + _local4);
};
_local3++;
};
return (_local2);
}
}
}//package com.google.analytics.data
Section 107
//_Style (com.google.analytics.debug._Style)
package com.google.analytics.debug {
import flash.net.*;
import flash.text.*;
public class _Style {
public var borderColor:uint;
public var backgroundColor:uint;
private var _sheet:StyleSheet;
public var roundedCorner:uint;
public var alertColor:uint;
public var infoColor:uint;
public var successColor:uint;
private var _loader:URLLoader;
public var failureColor:uint;
private var _defaultSheet:String;
public var warningColor:uint;
public function _Style(){
_sheet = new StyleSheet();
_loader = new URLLoader();
_init();
}
private function _parseSheet(_arg1:String):void{
_sheet.parseCSS(_arg1);
}
public function get sheet():StyleSheet{
return (_sheet);
}
private function _init():void{
_defaultSheet = "";
_defaultSheet = (_defaultSheet + "a{text-decoration: underline;}\n");
_defaultSheet = (_defaultSheet + ".uiLabel{color: #000000;font-family: Arial;font-size: 12;margin-left: 2;margin-right: 2;}\n");
_defaultSheet = (_defaultSheet + ".uiWarning{color: #ffffff;font-family: Arial;font-size: 14;font-weight: bold;margin-left: 6;margin-right: 6;}\n");
_defaultSheet = (_defaultSheet + ".uiAlert{color: #ffffff;font-family: Arial;font-size: 14;font-weight: bold;margin-left: 6;margin-right: 6;}\n");
_defaultSheet = (_defaultSheet + ".uiInfo{color: #000000;font-family: Arial;font-size: 14;font-weight: bold;margin-left: 6;margin-right: 6;}\n");
_defaultSheet = (_defaultSheet + ".uiSuccess{color: #ffffff;font-family: Arial;font-size: 12;font-weight: bold;margin-left: 6;margin-right: 6;}\n");
_defaultSheet = (_defaultSheet + ".uiFailure{color: #ffffff;font-family: Arial;font-size: 12;font-weight: bold;margin-left: 6;margin-right: 6;}\n");
_defaultSheet = (_defaultSheet + ".uiAlertAction{color: #ffffff;text-align: center;font-family: Arial;font-size: 12;font-weight: bold;margin-left: 6;margin-right: 6;}\n");
_defaultSheet = (_defaultSheet + ".uiAlertTitle{color: #ffffff;font-family: Arial;font-size: 16;font-weight: bold;margin-left: 6;margin-right: 6;}\n");
_defaultSheet = (_defaultSheet + "\n");
roundedCorner = 6;
backgroundColor = 0xCCCCCC;
borderColor = 0x555555;
infoColor = 16777113;
alertColor = 0xFFCC00;
warningColor = 0xCC0000;
successColor = 0xFF00;
failureColor = 0xFF0000;
_parseSheet(_defaultSheet);
}
}
}//package com.google.analytics.debug
Section 108
//Alert (com.google.analytics.debug.Alert)
package com.google.analytics.debug {
import flash.events.*;
public class Alert extends Label {
public var actionOnNextLine:Boolean;// = true
public var autoClose:Boolean;// = true
private var _actions:Array;
public function Alert(_arg1:String, _arg2:Array, _arg3:String="uiAlert", _arg4:uint=0, _arg5:Align=null, _arg6:Boolean=false, _arg7:Boolean=true){
var _local8:int;
autoClose = true;
actionOnNextLine = true;
if (_arg4 == 0){
_arg4 = Style.alertColor;
};
if (_arg5 == null){
_arg5 = Align.center;
};
super(_arg1, _arg3, _arg4, _arg5, _arg6);
this.selectable = true;
super.mouseChildren = true;
this.buttonMode = true;
this.mouseEnabled = true;
this.useHandCursor = true;
this.actionOnNextLine = _arg7;
_actions = [];
_local8 = 0;
while (_local8 < _arg2.length) {
_arg2[_local8].container = this;
_actions.push(_arg2[_local8]);
_local8++;
};
}
protected function getAction(_arg1:String):AlertAction{
var _local2:int;
_local2 = 0;
while (_local2 < _actions.length) {
if (_arg1 == _actions[_local2].activator){
return (_actions[_local2]);
};
_local2++;
};
return (null);
}
override protected function layout():void{
super.layout();
_defineActions();
}
protected function spaces(_arg1:int):String{
var _local2:String;
var _local3:String;
var _local4:int;
_local2 = "";
_local3 = " ";
_local4 = 0;
while (_local4 < (_arg1 + 1)) {
_local2 = (_local2 + _local3);
_local4++;
};
return (_local2);
}
override public function onLink(_arg1:TextEvent):void{
var _local2:AlertAction;
if (isValidAction(_arg1.text)){
_local2 = getAction(_arg1.text);
if (_local2){
_local2.execute();
};
};
if (autoClose){
close();
};
}
protected function isValidAction(_arg1:String):Boolean{
var _local2:int;
_local2 = 0;
while (_local2 < _actions.length) {
if (_arg1 == _actions[_local2].activator){
return (true);
};
_local2++;
};
return (false);
}
private function _defineActions():void{
var _local1:String;
var _local2:Array;
var _local3:AlertAction;
var _local4:int;
_local1 = "";
if (actionOnNextLine){
_local1 = (_local1 + "\n");
} else {
_local1 = (_local1 + " |");
};
_local1 = (_local1 + " ");
_local2 = [];
_local4 = 0;
while (_local4 < _actions.length) {
_local3 = _actions[_local4];
_local2.push((((("<a href=\"event:" + _local3.activator) + "\">") + _local3.name) + "</a>"));
_local4++;
};
_local1 = (_local1 + _local2.join(" | "));
appendText(_local1, "uiAlertAction");
}
public function close():void{
if (parent != null){
parent.removeChild(this);
};
}
}
}//package com.google.analytics.debug
Section 109
//AlertAction (com.google.analytics.debug.AlertAction)
package com.google.analytics.debug {
public class AlertAction {
public var container:Alert;
private var _callback;
public var name:String;
public var activator:String;
public function AlertAction(_arg1:String, _arg2:String, _arg3){
this.name = _arg1;
this.activator = _arg2;
_callback = _arg3;
}
public function execute():void{
if (_callback){
if ((_callback is Function)){
(_callback as Function)();
} else {
if ((_callback is String)){
var _local1 = container;
_local1[_callback]();
};
};
};
}
}
}//package com.google.analytics.debug
Section 110
//Align (com.google.analytics.debug.Align)
package com.google.analytics.debug {
public class Align {
private var _value:int;
private var _name:String;
public static const bottomRight:Align = new Align(18, "bottomRight");
;
public static const right:Align = new Align(16, "right");
;
public static const left:Align = new Align(32, "left");
;
public static const topRight:Align = new Align(17, "topRight");
;
public static const bottom:Align = new Align(2, "bottom");
;
public static const bottomLeft:Align = new Align(34, "bottomLeft");
;
public static const topLeft:Align = new Align(33, "topLeft");
;
public static const center:Align = new Align(0x0100, "center");
;
public static const none:Align = new Align(0, "none");
;
public static const top:Align = new Align(1, "top");
;
public function Align(_arg1:int=0, _arg2:String=""){
_value = _arg1;
_name = _arg2;
}
public function valueOf():int{
return (_value);
}
public function toString():String{
return (_name);
}
}
}//package com.google.analytics.debug
Section 111
//Background (com.google.analytics.debug.Background)
package com.google.analytics.debug {
import flash.display.*;
public class Background {
public static function drawRounded(_arg1, _arg2:Graphics, _arg3:uint=0, _arg4:uint=0):void{
var _local5:uint;
var _local6:uint;
var _local7:uint;
_local7 = Style.roundedCorner;
if ((((_arg3 > 0)) && ((_arg4 > 0)))){
_local5 = _arg3;
_local6 = _arg4;
} else {
_local5 = _arg1.width;
_local6 = _arg1.height;
};
if (((_arg1.stickToEdge) && (!((_arg1.alignement == Align.none))))){
switch (_arg1.alignement){
case Align.top:
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, 0, 0, _local7, _local7);
break;
case Align.topLeft:
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, 0, 0, 0, _local7);
break;
case Align.topRight:
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, 0, 0, _local7, 0);
break;
case Align.bottom:
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, _local7, _local7, 0, 0);
break;
case Align.bottomLeft:
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, 0, _local7, 0, 0);
break;
case Align.bottomRight:
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, _local7, 0, 0, 0);
break;
case Align.left:
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, 0, _local7, 0, _local7);
break;
case Align.right:
_arg2.drawRoundRectComplex(0, 0, _local5, _local6, _local7, 0, _local7, 0);
break;
case Align.center:
_arg2.drawRoundRect(0, 0, _local5, _local6, _local7, _local7);
break;
};
} else {
_arg2.drawRoundRect(0, 0, _local5, _local6, _local7, _local7);
};
}
}
}//package com.google.analytics.debug
Section 112
//Debug (com.google.analytics.debug.Debug)
package com.google.analytics.debug {
import flash.events.*;
import flash.ui.*;
public class Debug extends Label {
private var _lines:Array;
private var _preferredForcedWidth:uint;// = 540
public var maxLines:uint;// = 16
private var _linediff:int;// = 0
public static var count:uint = 0;
public function Debug(_arg1:uint=0, _arg2:Align=null, _arg3:Boolean=false){
_linediff = 0;
_preferredForcedWidth = 540;
maxLines = 16;
if (_arg2 == null){
_arg2 = Align.bottom;
};
super("", "uiLabel", _arg1, _arg2, _arg3);
this.name = ("Debug" + count++);
_lines = [];
selectable = true;
addEventListener(KeyboardEvent.KEY_DOWN, onKey);
}
public function close():void{
dispose();
}
public function writeBold(_arg1:String):void{
write(_arg1, true);
}
override protected function dispose():void{
removeEventListener(KeyboardEvent.KEY_DOWN, onKey);
super.dispose();
}
override public function get forcedWidth():uint{
if (this.parent){
if (UISprite(this.parent).forcedWidth > _preferredForcedWidth){
return (_preferredForcedWidth);
};
return (UISprite(this.parent).forcedWidth);
} else {
};
return (!NULL!);
}
private function onKey(_arg1:KeyboardEvent=null):void{
var _local2:Array;
switch (_arg1.keyCode){
case Keyboard.DOWN:
_local2 = _getLinesToDisplay(1);
break;
case Keyboard.UP:
_local2 = _getLinesToDisplay(-1);
break;
default:
_local2 = null;
};
if (_local2 == null){
return;
};
text = _local2.join("\n");
}
public function write(_arg1:String, _arg2:Boolean=false):void{
var _local3:Array;
var _local4:String;
var _local5:String;
var _local6:int;
var _local7:Array;
if (_arg1.indexOf("") > -1){
_local3 = _arg1.split("\n");
} else {
_local3 = [_arg1];
};
_local4 = "";
_local5 = "";
if (_arg2){
_local4 = "<b>";
_local5 = "</b>";
};
_local6 = 0;
while (_local6 < _local3.length) {
_lines.push(((_local4 + _local3[_local6]) + _local5));
_local6++;
};
_local7 = _getLinesToDisplay();
text = _local7.join("\n");
}
private function _getLinesToDisplay(_arg1:int=0):Array{
var _local2:Array;
var _local3:uint;
var _local4:uint;
if ((_lines.length - 1) > maxLines){
if ((_linediff <= 0)){
_linediff = (_linediff + _arg1);
} else {
if ((((_linediff > 0)) && ((_arg1 < 0)))){
_linediff = (_linediff + _arg1);
};
};
_local3 = ((_lines.length - maxLines) + _linediff);
_local4 = (_local3 + maxLines);
_local2 = _lines.slice(_local3, _local4);
} else {
_local2 = _lines;
};
return (_local2);
}
}
}//package com.google.analytics.debug
Section 113
//DebugConfiguration (com.google.analytics.debug.DebugConfiguration)
package com.google.analytics.debug {
import com.google.analytics.core.*;
import flash.net.*;
import flash.utils.*;
import flash.ui.*;
public class DebugConfiguration {
public var showHideKey:Number;
private var _mode:VisualDebugMode;
private var _verbose:Boolean;// = false
public var destroyKey:Number;
public var GIFRequests:Boolean;// = false
public var infoTimeout:Number;// = 1000
public var showInfos:Boolean;// = true
public var minimizedOnStart:Boolean;// = false
private var _active:Boolean;// = false
public var traceOutput:Boolean;// = false
public var layout:ILayout;
public var warningTimeout:Number;// = 1500
public var javascript:Boolean;// = false
public var showWarnings:Boolean;// = true
private var _visualInitialized:Boolean;// = false
public function DebugConfiguration(){
_active = false;
_verbose = false;
_visualInitialized = false;
_mode = VisualDebugMode.basic;
traceOutput = false;
javascript = false;
GIFRequests = false;
showInfos = true;
infoTimeout = 1000;
showWarnings = true;
warningTimeout = 1500;
minimizedOnStart = false;
showHideKey = Keyboard.SPACE;
destroyKey = Keyboard.BACKSPACE;
super();
}
public function get verbose():Boolean{
return (_verbose);
}
public function set verbose(_arg1:Boolean):void{
_verbose = _arg1;
}
public function set mode(_arg1):void{
if ((_arg1 is String)){
switch (_arg1){
case "geek":
_arg1 = VisualDebugMode.geek;
break;
case "advanced":
_arg1 = VisualDebugMode.advanced;
break;
case "basic":
default:
_arg1 = VisualDebugMode.basic;
};
};
_mode = _arg1;
}
public function success(_arg1:String):void{
if (layout){
layout.createSuccessAlert(_arg1);
};
if (traceOutput){
trace((("[+] " + _arg1) + " !!"));
};
}
public function get active():Boolean{
return (_active);
}
private function _initializeVisual():void{
if (layout){
layout.init();
_visualInitialized = true;
};
}
private function _destroyVisual():void{
if (((layout) && (_visualInitialized))){
layout.destroy();
};
}
public function warning(_arg1:String, _arg2:VisualDebugMode=null):void{
if (_filter(_arg2)){
return;
};
if (((layout) && (showWarnings))){
layout.createWarning(_arg1);
};
if (traceOutput){
trace((("## " + _arg1) + " ##"));
};
}
private function _filter(_arg1:VisualDebugMode=null):Boolean{
return (((_arg1) && ((int(_arg1) >= int(this.mode)))));
}
public function failure(_arg1:String):void{
if (layout){
layout.createFailureAlert(_arg1);
};
if (traceOutput){
trace((("[-] " + _arg1) + " !!"));
};
}
public function get mode(){
return (_mode);
}
public function set active(_arg1:Boolean):void{
_active = _arg1;
if (_active){
_initializeVisual();
} else {
_destroyVisual();
};
}
protected function trace(_arg1:String):void{
var _local2:Array;
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:int;
var _local7:Array;
var _local8:int;
_local2 = [];
_local3 = "";
_local4 = "";
if (this.mode == VisualDebugMode.geek){
_local3 = (getTimer() + " - ");
_local4 = (new Array(_local3.length).join(" ") + " ");
};
if (_arg1.indexOf("\n") > -1){
_local7 = _arg1.split("\n");
_local8 = 0;
while (_local8 < _local7.length) {
if (_local7[_local8] == ""){
} else {
if (_local8 == 0){
_local2.push((_local3 + _local7[_local8]));
} else {
_local2.push((_local4 + _local7[_local8]));
};
};
_local8++;
};
} else {
_local2.push((_local3 + _arg1));
};
_local5 = _local2.length;
_local6 = 0;
while (_local6 < _local5) {
trace(_local2[_local6]);
_local6++;
};
}
public function alert(_arg1:String):void{
if (layout){
layout.createAlert(_arg1);
};
if (traceOutput){
trace((("!! " + _arg1) + " !!"));
};
}
public function info(_arg1:String, _arg2:VisualDebugMode=null):void{
if (_filter(_arg2)){
return;
};
if (((layout) && (showInfos))){
layout.createInfo(_arg1);
};
if (traceOutput){
trace(_arg1);
};
}
public function alertGifRequest(_arg1:String, _arg2:URLRequest, _arg3:GIFRequest):void{
if (layout){
layout.createGIFRequestAlert(_arg1, _arg2, _arg3);
};
if (traceOutput){
trace(((">> " + _arg1) + " <<"));
};
}
}
}//package com.google.analytics.debug
Section 114
//FailureAlert (com.google.analytics.debug.FailureAlert)
package com.google.analytics.debug {
public class FailureAlert extends Alert {
public function FailureAlert(_arg1:DebugConfiguration, _arg2:String, _arg3:Array){
var _local4:Align;
var _local5:Boolean;
var _local6:Boolean;
_local4 = Align.bottomLeft;
_local5 = true;
_local6 = false;
if (_arg1.verbose){
_arg2 = ((("<u><span class=\"uiAlertTitle\">Failure</span>" + spaces(18)) + "</u>\n\n") + _arg2);
_local4 = Align.center;
_local5 = false;
_local6 = true;
};
super(_arg2, _arg3, "uiFailure", Style.failureColor, _local4, _local5, _local6);
}
}
}//package com.google.analytics.debug
Section 115
//GIFRequestAlert (com.google.analytics.debug.GIFRequestAlert)
package com.google.analytics.debug {
public class GIFRequestAlert extends Alert {
public function GIFRequestAlert(_arg1:String, _arg2:Array){
super(_arg1, _arg2);
}
}
}//package com.google.analytics.debug
Section 116
//ILayout (com.google.analytics.debug.ILayout)
package com.google.analytics.debug {
import flash.display.*;
import com.google.analytics.core.*;
import flash.net.*;
public interface ILayout {
function createWarning(_arg1:String):void;
function addToStage(_arg1:DisplayObject):void;
function createGIFRequestAlert(_arg1:String, _arg2:URLRequest, _arg3:GIFRequest):void;
function createPanel(_arg1:String, _arg2:uint, _arg3:uint):void;
function createInfo(_arg1:String):void;
function createFailureAlert(_arg1:String):void;
function addToPanel(_arg1:String, _arg2:DisplayObject):void;
function init():void;
function createSuccessAlert(_arg1:String):void;
function createVisualDebug():void;
function createAlert(_arg1:String):void;
function destroy():void;
function bringToFront(_arg1:DisplayObject):void;
function isAvailable():Boolean;
}
}//package com.google.analytics.debug
Section 117
//Info (com.google.analytics.debug.Info)
package com.google.analytics.debug {
import flash.events.*;
import flash.utils.*;
public class Info extends Label {
private var _timer:Timer;
public function Info(_arg1:String="", _arg2:uint=3000){
super(_arg1, "uiInfo", Style.infoColor, Align.top, true);
if (_arg2 > 0){
_timer = new Timer(_arg2, 1);
_timer.start();
_timer.addEventListener(TimerEvent.TIMER_COMPLETE, onComplete, false, 0, true);
};
}
public function onComplete(_arg1:TimerEvent):void{
close();
}
override public function onLink(_arg1:TextEvent):void{
switch (_arg1.text){
case "hide":
close();
break;
};
}
public function close():void{
if (parent != null){
parent.removeChild(this);
};
}
}
}//package com.google.analytics.debug
Section 118
//Label (com.google.analytics.debug.Label)
package com.google.analytics.debug {
import flash.events.*;
import flash.display.*;
import flash.text.*;
public class Label extends UISprite {
private var _text:String;
private var _textField:TextField;
private var _color:uint;
protected var selectable:Boolean;
public var stickToEdge:Boolean;
private var _background:Shape;
private var _tag:String;
public static var count:uint = 0;
public function Label(_arg1:String="", _arg2:String="uiLabel", _arg3:uint=0, _arg4:Align=null, _arg5:Boolean=false){
this.name = ("Label" + count++);
selectable = false;
_background = new Shape();
_textField = new TextField();
_text = _arg1;
_tag = _arg2;
if (_arg4 == null){
_arg4 = Align.none;
};
this.alignement = _arg4;
this.stickToEdge = _arg5;
if (_arg3 == 0){
_arg3 = Style.backgroundColor;
};
_color = _arg3;
_textField.addEventListener(TextEvent.LINK, onLink);
}
override protected function dispose():void{
_textField.removeEventListener(TextEvent.LINK, onLink);
super.dispose();
}
private function _draw():void{
var _local1:Graphics;
var _local2:uint;
var _local3:uint;
_local1 = _background.graphics;
_local1.clear();
_local1.beginFill(_color);
_local2 = _textField.width;
_local3 = _textField.height;
if (forcedWidth > 0){
_local2 = forcedWidth;
};
Background.drawRounded(this, _local1, _local2, _local3);
_local1.endFill();
}
override protected function layout():void{
_textField.type = TextFieldType.DYNAMIC;
_textField.autoSize = TextFieldAutoSize.LEFT;
_textField.background = false;
_textField.selectable = selectable;
_textField.multiline = true;
_textField.styleSheet = Style.sheet;
this.text = _text;
addChild(_background);
addChild(_textField);
}
public function get text():String{
return (_textField.text);
}
public function set tag(_arg1:String):void{
_tag = _arg1;
text = "";
}
public function set text(_arg1:String):void{
if (_arg1 == ""){
_arg1 = _text;
};
_textField.htmlText = (((("<span class=\"" + tag) + "\">") + _arg1) + "</span>");
_text = _arg1;
_draw();
resize();
}
public function appendText(_arg1:String, _arg2:String=""):void{
if (_arg1 == ""){
return;
};
if (_arg2 == ""){
_arg2 = tag;
};
_textField.htmlText = (_textField.htmlText + (((("<span class=\"" + _arg2) + "\">") + _arg1) + "</span>"));
_text = (_text + _arg1);
_draw();
resize();
}
public function onLink(_arg1:TextEvent):void{
}
public function get tag():String{
return (_tag);
}
}
}//package com.google.analytics.debug
Section 119
//Layout (com.google.analytics.debug.Layout)
package com.google.analytics.debug {
import flash.events.*;
import flash.display.*;
import com.google.analytics.core.*;
import flash.net.*;
import com.google.analytics.*;
public class Layout implements ILayout {
private var _display:DisplayObject;
private var _infoQueue:Array;
private var _maxCharPerLine:int;// = 85
private var _hasInfo:Boolean;
private var _warningQueue:Array;
private var _hasDebug:Boolean;
private var _hasWarning:Boolean;
private var _mainPanel:Panel;
private var _GRAlertQueue:Array;
private var _debug:DebugConfiguration;
public var visualDebug:Debug;
private var _hasGRAlert:Boolean;
public function Layout(_arg1:DebugConfiguration, _arg2:DisplayObject){
_maxCharPerLine = 85;
super();
_display = _arg2;
_debug = _arg1;
_hasWarning = false;
_hasInfo = false;
_hasDebug = false;
_hasGRAlert = false;
_warningQueue = [];
_infoQueue = [];
_GRAlertQueue = [];
}
private function onKey(_arg1:KeyboardEvent=null):void{
switch (_arg1.keyCode){
case _debug.showHideKey:
_mainPanel.visible = !(_mainPanel.visible);
break;
case _debug.destroyKey:
destroy();
break;
};
}
public function bringToFront(_arg1:DisplayObject):void{
_display.stage.setChildIndex(_arg1, (_display.stage.numChildren - 1));
}
public function createFailureAlert(_arg1:String):void{
var _local2:AlertAction;
var _local3:Alert;
if (_debug.verbose){
_arg1 = _filterMaxChars(_arg1);
_local2 = new AlertAction("Close", "close", "close");
} else {
_local2 = new AlertAction("X", "close", "close");
};
_local3 = new FailureAlert(_debug, _arg1, [_local2]);
addToPanel("analytics", _local3);
if (_hasDebug){
if (_debug.verbose){
_arg1 = _arg1.split("\n").join("");
_arg1 = _filterMaxChars(_arg1, 66);
};
visualDebug.writeBold(_arg1);
};
}
public function init():void{
var _local1:int;
var _local2:uint;
var _local3:uint;
var _local4:Panel;
_local1 = 10;
_local2 = (_display.stage.stageWidth - (_local1 * 2));
_local3 = (_display.stage.stageHeight - (_local1 * 2));
_local4 = new Panel("analytics", _local2, _local3);
_local4.alignement = Align.top;
_local4.stickToEdge = false;
_local4.title = ("Google Analytics v" + GATracker.version);
_mainPanel = _local4;
addToStage(_local4);
bringToFront(_local4);
if (_debug.minimizedOnStart){
_mainPanel.onToggle();
};
createVisualDebug();
_display.stage.addEventListener(KeyboardEvent.KEY_DOWN, onKey, false, 0, true);
}
public function addToPanel(_arg1:String, _arg2:DisplayObject):void{
var _local3:DisplayObject;
var _local4:Panel;
_local3 = _display.stage.getChildByName(_arg1);
if (_local3){
_local4 = (_local3 as Panel);
_local4.addData(_arg2);
} else {
trace((("panel \"" + _arg1) + "\" not found"));
};
}
private function _clearInfo(_arg1:Event):void{
_hasInfo = false;
if (_infoQueue.length > 0){
createInfo(_infoQueue.shift());
};
}
private function _filterMaxChars(_arg1:String, _arg2:int=0):String{
var _local3:String;
var _local4:Array;
var _local5:Array;
var _local6:String;
var _local7:int;
_local3 = "\n";
_local4 = [];
_local5 = _arg1.split(_local3);
if (_arg2 == 0){
_arg2 = _maxCharPerLine;
};
_local7 = 0;
while (_local7 < _local5.length) {
_local6 = _local5[_local7];
while (_local6.length > _arg2) {
_local4.push(_local6.substr(0, _arg2));
_local6 = _local6.substring(_arg2);
};
_local4.push(_local6);
_local7++;
};
return (_local4.join(_local3));
}
public function createWarning(_arg1:String):void{
var _local2:Warning;
if (((_hasWarning) || (!(isAvailable())))){
_warningQueue.push(_arg1);
return;
};
_arg1 = _filterMaxChars(_arg1);
_hasWarning = true;
_local2 = new Warning(_arg1, _debug.warningTimeout);
addToPanel("analytics", _local2);
_local2.addEventListener(Event.REMOVED_FROM_STAGE, _clearWarning, false, 0, true);
if (_hasDebug){
visualDebug.writeBold(_arg1);
};
}
private function _clearGRAlert(_arg1:Event):void{
_hasGRAlert = false;
if (_GRAlertQueue.length > 0){
createGIFRequestAlert.apply(this, _GRAlertQueue.shift());
};
}
public function createSuccessAlert(_arg1:String):void{
var _local2:AlertAction;
var _local3:Alert;
if (_debug.verbose){
_arg1 = _filterMaxChars(_arg1);
_local2 = new AlertAction("Close", "close", "close");
} else {
_local2 = new AlertAction("X", "close", "close");
};
_local3 = new SuccessAlert(_debug, _arg1, [_local2]);
addToPanel("analytics", _local3);
if (_hasDebug){
if (_debug.verbose){
_arg1 = _arg1.split("\n").join("");
_arg1 = _filterMaxChars(_arg1, 66);
};
visualDebug.writeBold(_arg1);
};
}
public function isAvailable():Boolean{
return (!((_display.stage == null)));
}
public function createAlert(_arg1:String):void{
var _local2:Alert;
_arg1 = _filterMaxChars(_arg1);
_local2 = new Alert(_arg1, [new AlertAction("Close", "close", "close")]);
addToPanel("analytics", _local2);
if (_hasDebug){
visualDebug.writeBold(_arg1);
};
}
public function createInfo(_arg1:String):void{
var _local2:Info;
if (((_hasInfo) || (!(isAvailable())))){
_infoQueue.push(_arg1);
return;
};
_arg1 = _filterMaxChars(_arg1);
_hasInfo = true;
_local2 = new Info(_arg1, _debug.infoTimeout);
addToPanel("analytics", _local2);
_local2.addEventListener(Event.REMOVED_FROM_STAGE, _clearInfo, false, 0, true);
if (_hasDebug){
visualDebug.write(_arg1);
};
}
public function createGIFRequestAlert(_arg1:String, _arg2:URLRequest, _arg3:GIFRequest):void{
var f:Function;
var gra:GIFRequestAlert;
var message = _arg1;
var request = _arg2;
var ref = _arg3;
if (_hasGRAlert){
_GRAlertQueue.push([message, request, ref]);
return;
};
_hasGRAlert = true;
f = function ():void{
ref.sendRequest(request);
};
message = _filterMaxChars(message);
gra = new GIFRequestAlert(message, [new AlertAction("OK", "ok", f), new AlertAction("Cancel", "cancel", "close")]);
addToPanel("analytics", gra);
gra.addEventListener(Event.REMOVED_FROM_STAGE, _clearGRAlert, false, 0, true);
if (_hasDebug){
if (_debug.verbose){
message = message.split("\n").join("");
message = _filterMaxChars(message, 66);
};
visualDebug.write(message);
};
}
public function createVisualDebug():void{
if (!visualDebug){
visualDebug = new Debug();
visualDebug.alignement = Align.bottom;
visualDebug.stickToEdge = true;
addToPanel("analytics", visualDebug);
_hasDebug = true;
};
}
public function addToStage(_arg1:DisplayObject):void{
_display.stage.addChild(_arg1);
}
private function _clearWarning(_arg1:Event):void{
_hasWarning = false;
if (_warningQueue.length > 0){
createWarning(_warningQueue.shift());
};
}
public function createPanel(_arg1:String, _arg2:uint, _arg3:uint):void{
var _local4:Panel;
_local4 = new Panel(_arg1, _arg2, _arg3);
_local4.alignement = Align.center;
_local4.stickToEdge = false;
addToStage(_local4);
bringToFront(_local4);
}
public function destroy():void{
_mainPanel.close();
_debug.layout = null;
}
}
}//package com.google.analytics.debug
Section 120
//Margin (com.google.analytics.debug.Margin)
package com.google.analytics.debug {
public class Margin {
public var bottom:int;
public var top:int;
public var right:int;
public var left:int;
public function Margin(_arg1:int=0, _arg2:int=0, _arg3:int=0, _arg4:int=0){
this.top = _arg1;
this.bottom = _arg2;
this.left = _arg3;
this.right = _arg4;
}
}
}//package com.google.analytics.debug
Section 121
//Panel (com.google.analytics.debug.Panel)
package com.google.analytics.debug {
import flash.events.*;
import flash.display.*;
public class Panel extends UISprite {
protected var baseAlpha:Number;
private var _border:Shape;
private var _name:String;
private var _title:Label;
private var _data:UISprite;
private var _backgroundColor:uint;
private var _colapsed:Boolean;
private var _stickToEdge:Boolean;
private var _background:Shape;
private var _savedW:uint;
private var _mask:Sprite;
private var _savedH:uint;
private var _borderColor:uint;
public function Panel(_arg1:String, _arg2:uint, _arg3:uint, _arg4:uint=0, _arg5:uint=0, _arg6:Number=0.3, _arg7:Align=null, _arg8:Boolean=false){
_name = _arg1;
this.name = _arg1;
this.mouseEnabled = false;
_colapsed = false;
forcedWidth = _arg2;
forcedHeight = _arg3;
this.baseAlpha = _arg6;
_background = new Shape();
_data = new UISprite();
_data.forcedWidth = _arg2;
_data.forcedHeight = _arg3;
_data.mouseEnabled = false;
_title = new Label(_arg1, "uiLabel", 0xFFFFFF, Align.topLeft, _arg8);
_title.buttonMode = true;
_title.margin.top = 0.6;
_title.margin.left = 0.6;
_title.addEventListener(MouseEvent.CLICK, onToggle);
_title.mouseChildren = false;
_border = new Shape();
_mask = new Sprite();
_mask.useHandCursor = false;
_mask.mouseEnabled = false;
_mask.mouseChildren = false;
if (_arg7 == null){
_arg7 = Align.none;
};
this.alignement = _arg7;
this.stickToEdge = _arg8;
if (_arg4 == 0){
_arg4 = Style.backgroundColor;
};
_backgroundColor = _arg4;
if (_arg5 == 0){
_arg5 = Style.borderColor;
};
_borderColor = _arg5;
}
public function set stickToEdge(_arg1:Boolean):void{
_stickToEdge = _arg1;
_title.stickToEdge = _arg1;
}
public function onToggle(_arg1:MouseEvent=null):void{
if (_colapsed){
_data.visible = true;
} else {
_data.visible = false;
};
_colapsed = !(_colapsed);
_update();
resize();
}
override protected function dispose():void{
_title.removeEventListener(MouseEvent.CLICK, onToggle);
super.dispose();
}
private function _draw():void{
var _local1:uint;
var _local2:uint;
var _local3:Graphics;
var _local4:Graphics;
var _local5:Graphics;
var _local6:Graphics;
if (((_savedW) && (_savedH))){
forcedWidth = _savedW;
forcedHeight = _savedH;
};
if (!_colapsed){
_local1 = forcedWidth;
_local2 = forcedHeight;
} else {
_local1 = _title.width;
_local2 = _title.height;
_savedW = forcedWidth;
_savedH = forcedHeight;
forcedWidth = _local1;
forcedHeight = _local2;
};
_local3 = _background.graphics;
_local3.clear();
_local3.beginFill(_backgroundColor);
Background.drawRounded(this, _local3, _local1, _local2);
_local3.endFill();
_local4 = _data.graphics;
_local4.clear();
_local4.beginFill(_backgroundColor, 0);
Background.drawRounded(this, _local4, _local1, _local2);
_local4.endFill();
_local5 = _border.graphics;
_local5.clear();
_local5.lineStyle(0.1, _borderColor);
Background.drawRounded(this, _local5, _local1, _local2);
_local5.endFill();
_local6 = _mask.graphics;
_local6.clear();
_local6.beginFill(_backgroundColor);
Background.drawRounded(this, _local6, (_local1 + 1), (_local2 + 1));
_local6.endFill();
}
override protected function layout():void{
_update();
addChild(_background);
addChild(_data);
addChild(_title);
addChild(_border);
addChild(_mask);
mask = _mask;
}
public function get title():String{
return (_title.text);
}
public function get stickToEdge():Boolean{
return (_stickToEdge);
}
public function set title(_arg1:String):void{
_title.text = _arg1;
}
private function _update():void{
_draw();
if (baseAlpha < 1){
_background.alpha = baseAlpha;
_border.alpha = baseAlpha;
};
}
public function addData(_arg1:DisplayObject):void{
_data.addChild(_arg1);
}
public function close():void{
dispose();
if (parent != null){
parent.removeChild(this);
};
}
}
}//package com.google.analytics.debug
Section 122
//Style (com.google.analytics.debug.Style)
package com.google.analytics.debug {
public const Style:_Style = new _Style();
}//package com.google.analytics.debug
Section 123
//SuccessAlert (com.google.analytics.debug.SuccessAlert)
package com.google.analytics.debug {
public class SuccessAlert extends Alert {
public function SuccessAlert(_arg1:DebugConfiguration, _arg2:String, _arg3:Array){
var _local4:Align;
var _local5:Boolean;
var _local6:Boolean;
_local4 = Align.bottomLeft;
_local5 = true;
_local6 = false;
if (_arg1.verbose){
_arg2 = ((("<u><span class=\"uiAlertTitle\">Success</span>" + spaces(18)) + "</u>\n\n") + _arg2);
_local4 = Align.center;
_local5 = false;
_local6 = true;
};
super(_arg2, _arg3, "uiSuccess", Style.successColor, _local4, _local5, _local6);
}
}
}//package com.google.analytics.debug
Section 124
//UISprite (com.google.analytics.debug.UISprite)
package com.google.analytics.debug {
import flash.events.*;
import flash.display.*;
public class UISprite extends Sprite {
private var _forcedHeight:uint;
protected var listenResize:Boolean;
public var alignement:Align;
private var _forcedWidth:uint;
public var margin:Margin;
protected var alignTarget:DisplayObject;
public function UISprite(_arg1:DisplayObject=null){
listenResize = false;
alignement = Align.none;
this.alignTarget = _arg1;
margin = new Margin();
addEventListener(Event.ADDED_TO_STAGE, _onAddedToStage);
addEventListener(Event.REMOVED_FROM_STAGE, _onRemovedFromStage);
}
protected function dispose():void{
var _local1:DisplayObject;
var _local2:int;
_local2 = 0;
while (_local2 < numChildren) {
_local1 = getChildAt(_local2);
if (_local1){
removeChild(_local1);
};
_local2++;
};
}
protected function layout():void{
}
public function get forcedHeight():uint{
if (_forcedHeight){
return (_forcedHeight);
};
return (height);
}
public function alignTo(_arg1:Align, _arg2:DisplayObject=null):void{
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:UISprite;
if (_arg2 == null){
if ((parent is Stage)){
_arg2 = this.stage;
} else {
_arg2 = parent;
};
};
if (_arg2 == this.stage){
if (this.stage == null){
return;
};
_local3 = this.stage.stageHeight;
_local4 = this.stage.stageWidth;
_local5 = 0;
_local6 = 0;
} else {
_local7 = (_arg2 as UISprite);
if (_local7.forcedHeight){
_local3 = _local7.forcedHeight;
} else {
_local3 = _local7.height;
};
if (_local7.forcedWidth){
_local4 = _local7.forcedWidth;
} else {
_local4 = _local7.width;
};
_local5 = 0;
_local6 = 0;
};
switch (_arg1){
case Align.top:
x = ((_local4 / 2) - (forcedWidth / 2));
y = (_local6 + margin.top);
break;
case Align.bottom:
x = ((_local4 / 2) - (forcedWidth / 2));
y = (((_local6 + _local3) - forcedHeight) - margin.bottom);
break;
case Align.left:
x = (_local5 + margin.left);
y = ((_local3 / 2) - (forcedHeight / 2));
break;
case Align.right:
x = (((_local5 + _local4) - forcedWidth) - margin.right);
y = ((_local3 / 2) - (forcedHeight / 2));
break;
case Align.center:
x = ((_local4 / 2) - (forcedWidth / 2));
y = ((_local3 / 2) - (forcedHeight / 2));
break;
case Align.topLeft:
x = (_local5 + margin.left);
y = (_local6 + margin.top);
break;
case Align.topRight:
x = (((_local5 + _local4) - forcedWidth) - margin.right);
y = (_local6 + margin.top);
break;
case Align.bottomLeft:
x = (_local5 + margin.left);
y = (((_local6 + _local3) - forcedHeight) - margin.bottom);
break;
case Align.bottomRight:
x = (((_local5 + _local4) - forcedWidth) - margin.right);
y = (((_local6 + _local3) - forcedHeight) - margin.bottom);
break;
};
if (((!(listenResize)) && (!((_arg1 == Align.none))))){
_arg2.addEventListener(Event.RESIZE, onResize, false, 0, true);
listenResize = true;
};
this.alignement = _arg1;
this.alignTarget = _arg2;
}
public function get forcedWidth():uint{
if (_forcedWidth){
return (_forcedWidth);
};
return (width);
}
protected function onResize(_arg1:Event):void{
resize();
}
private function _onRemovedFromStage(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, _onAddedToStage);
removeEventListener(Event.REMOVED_FROM_STAGE, _onRemovedFromStage);
dispose();
}
public function resize():void{
if (alignement != Align.none){
alignTo(alignement, alignTarget);
};
}
private function _onAddedToStage(_arg1:Event):void{
layout();
resize();
}
public function set forcedHeight(_arg1:uint):void{
_forcedHeight = _arg1;
}
public function set forcedWidth(_arg1:uint):void{
_forcedWidth = _arg1;
}
}
}//package com.google.analytics.debug
Section 125
//Warning (com.google.analytics.debug.Warning)
package com.google.analytics.debug {
import flash.events.*;
import flash.utils.*;
public class Warning extends Label {
private var _timer:Timer;
public function Warning(_arg1:String="", _arg2:uint=3000){
super(_arg1, "uiWarning", Style.warningColor, Align.top, false);
margin.top = 32;
if (_arg2 > 0){
_timer = new Timer(_arg2, 1);
_timer.start();
_timer.addEventListener(TimerEvent.TIMER_COMPLETE, onComplete, false, 0, true);
};
}
public function onComplete(_arg1:TimerEvent):void{
close();
}
override public function onLink(_arg1:TextEvent):void{
switch (_arg1.text){
case "hide":
close();
break;
};
}
public function close():void{
if (parent != null){
parent.removeChild(this);
};
}
}
}//package com.google.analytics.debug
Section 126
//VisualDebugMode (com.google.analytics.debug.VisualDebugMode)
package com.google.analytics.debug {
public class VisualDebugMode {
private var _value:int;
private var _name:String;
public static const advanced:VisualDebugMode = new VisualDebugMode(1, "advanced");
;
public static const geek:VisualDebugMode = new VisualDebugMode(2, "geek");
;
public static const basic:VisualDebugMode = new VisualDebugMode(0, "basic");
;
public function VisualDebugMode(_arg1:int=0, _arg2:String=""){
_value = _arg1;
_name = _arg2;
}
public function valueOf():int{
return (_value);
}
public function toString():String{
return (_name);
}
}
}//package com.google.analytics.debug
Section 127
//AnalyticsEvent (com.google.analytics.events.AnalyticsEvent)
package com.google.analytics.events {
import flash.events.*;
import com.google.analytics.*;
public class AnalyticsEvent extends Event {
public var tracker:AnalyticsTracker;
public static const READY:String = "ready";
public function AnalyticsEvent(_arg1:String, _arg2:AnalyticsTracker, _arg3:Boolean=false, _arg4:Boolean=false){
super(_arg1, _arg3, _arg4);
this.tracker = _arg2;
}
override public function clone():Event{
return (new AnalyticsEvent(type, tracker, bubbles, cancelable));
}
}
}//package com.google.analytics.events
Section 128
//AdSenseGlobals (com.google.analytics.external.AdSenseGlobals)
package com.google.analytics.external {
import com.google.analytics.debug.*;
public class AdSenseGlobals extends JavascriptProxy {
private var _gaGlobalVerified:Boolean;// = false
public static var gaGlobal_js:XML = <script>
<![CDATA[
function()
{
try
{
gaGlobal
}
catch(e)
{
gaGlobal = {} ;
}
}
]]>
</script>
;
public function AdSenseGlobals(_arg1:DebugConfiguration){
_gaGlobalVerified = false;
super(_arg1);
}
public function set vid(_arg1:String):void{
if (!isAvailable()){
return;
};
_verify();
setProperty("gaGlobal.vid", _arg1);
}
public function get hid():String{
if (!isAvailable()){
return (null);
};
_verify();
return (getProperty("gaGlobal.hid"));
}
public function get dh():String{
if (!isAvailable()){
return (null);
};
_verify();
return (getProperty("gaGlobal.dh"));
}
public function get gaGlobal():Object{
if (!isAvailable()){
return (null);
};
_verify();
return (getProperty("gaGlobal"));
}
public function set hid(_arg1:String):void{
if (!isAvailable()){
return;
};
_verify();
setProperty("gaGlobal.hid", _arg1);
}
public function get sid():String{
if (!isAvailable()){
return (null);
};
_verify();
return (getProperty("gaGlobal.sid"));
}
private function _verify():void{
if (!_gaGlobalVerified){
executeBlock(gaGlobal_js);
_gaGlobalVerified = true;
};
}
public function get vid():String{
if (!isAvailable()){
return (null);
};
_verify();
return (getProperty("gaGlobal.vid"));
}
public function set sid(_arg1:String):void{
if (!isAvailable()){
return;
};
_verify();
setProperty("gaGlobal.sid", _arg1);
}
}
}//package com.google.analytics.external
Section 129
//HTMLDOM (com.google.analytics.external.HTMLDOM)
package com.google.analytics.external {
import com.google.analytics.debug.*;
public class HTMLDOM extends JavascriptProxy {
private var _referrer:String;
private var _protocol:String;
private var _host:String;
private var _location:String;
private var _pathname:String;
private var _title:String;
private var _characterSet:String;
private var _search:String;
private var _language:String;
private var _colorDepth:String;
public static var cache_properties_js:XML = <script>
<![CDATA[
function()
{
var obj = {};
obj.host = document.location.host;
obj.language = navigator.language ? navigator.language : navigator.browserLanguage;
obj.characterSet = document.characterSet ? document.characterSet : document.charset;
obj.colorDepth = window.screen.colorDepth;
obj.location = document.location.toString();
obj.pathname = document.location.pathname;
obj.protocol = document.location.protocol;
obj.search = document.location.search;
obj.referrer = document.referrer;
obj.title = document.title;
return obj;
}
]]>
</script>
;
public function HTMLDOM(_arg1:DebugConfiguration){
super(_arg1);
}
public function get search():String{
if (_search){
return (_search);
};
if (!isAvailable()){
return (null);
};
_search = getProperty("document.location.search");
return (_search);
}
public function get location():String{
if (_location){
return (_location);
};
if (!isAvailable()){
return (null);
};
_location = getPropertyString("document.location");
return (_location);
}
public function get pathname():String{
if (_pathname){
return (_pathname);
};
if (!isAvailable()){
return (null);
};
_pathname = getProperty("document.location.pathname");
return (_pathname);
}
public function get referrer():String{
if (_referrer){
return (_referrer);
};
if (!isAvailable()){
return (null);
};
_referrer = getProperty("document.referrer");
return (_referrer);
}
public function get protocol():String{
if (_protocol){
return (_protocol);
};
if (!isAvailable()){
return (null);
};
_protocol = getProperty("document.location.protocol");
return (_protocol);
}
public function cacheProperties():void{
var _local1:Object;
if (!isAvailable()){
return;
};
_local1 = call(cache_properties_js);
if (_local1){
_host = _local1.host;
_language = _local1.language;
_characterSet = _local1.characterSet;
_colorDepth = _local1.colorDepth;
_location = _local1.location;
_pathname = _local1.pathname;
_protocol = _local1.protocol;
_search = _local1.search;
_referrer = _local1.referrer;
_title = _local1.title;
};
}
public function get colorDepth():String{
if (_colorDepth){
return (_colorDepth);
};
if (!isAvailable()){
return (null);
};
_colorDepth = getProperty("window.screen.colorDepth");
return (_colorDepth);
}
public function get title():String{
if (_title){
return (_title);
};
if (!isAvailable()){
return (null);
};
_title = getProperty("document.title");
return (_title);
}
public function get host():String{
if (_host){
return (_host);
};
if (!isAvailable()){
return (null);
};
_host = getProperty("document.location.host");
return (_host);
}
public function get characterSet():String{
var _local1:String;
if (_characterSet){
return (_characterSet);
};
if (!isAvailable()){
return (null);
};
_local1 = getProperty("document.characterSet");
if (_local1 == null){
_local1 = getProperty("document.charset");
};
_characterSet = _local1;
return (_characterSet);
}
public function get language():String{
var _local1:String;
if (_language){
return (_language);
};
if (!isAvailable()){
return (null);
};
_local1 = getProperty("navigator.language");
if (_local1 == null){
_local1 = getProperty("navigator.browserLanguage");
};
_language = _local1;
return (_language);
}
}
}//package com.google.analytics.external
Section 130
//JavascriptProxy (com.google.analytics.external.JavascriptProxy)
package com.google.analytics.external {
import com.google.analytics.debug.*;
import flash.system.*;
import flash.external.*;
public class JavascriptProxy {
private var _notAvailableWarning:Boolean;// = true
private var _debug:DebugConfiguration;
public static var setProperty_js:XML = <script>
<![CDATA[
function( path , value )
{
var paths;
var prop;
if( path.indexOf(".") > 0 )
{
paths = path.split(".");
prop = paths.pop() ;
}
else
{
paths = [];
prop = path;
}
var target = window ;
var len = paths.length ;
for( var i = 0 ; i < len ; i++ )
{
target = target[ paths[i] ] ;
}
target[ prop ] = value ;
}
]]>
</script>
;
public static var hasProperty_js:XML = <script>
<![CDATA[
function( path )
{
var paths;
if( path.indexOf(".") > 0 )
{
paths = path.split(".");
}
else
{
paths = [path];
}
var target = window ;
var len = paths.length ;
for( var i = 0 ; i < len ; i++ )
{
target = target[ paths[i] ] ;
}
if( target )
{
return true;
}
else
{
return false;
}
}
]]>
</script>
;
public static var setPropertyRef_js:XML = <script>
<![CDATA[
function( path , target )
{
var paths;
var prop;
if( path.indexOf(".") > 0 )
{
paths = path.split(".");
prop = paths.pop() ;
}
else
{
paths = [];
prop = path;
}
alert( "paths:"+paths.length+", prop:"+prop );
var targets;
var name;
if( target.indexOf(".") > 0 )
{
targets = target.split(".");
name = targets.pop();
}
else
{
targets = [];
name = target;
}
alert( "targets:"+targets.length+", name:"+name );
var root = window;
var len = paths.length;
for( var i = 0 ; i < len ; i++ )
{
root = root[ paths[i] ] ;
}
var ref = window;
var depth = targets.length;
for( var j = 0 ; j < depth ; j++ )
{
ref = ref[ targets[j] ] ;
}
root[ prop ] = ref[name] ;
}
]]>
</script>
;
public function JavascriptProxy(_arg1:DebugConfiguration){
_notAvailableWarning = true;
super();
_debug = _arg1;
}
public function getProperty(_arg1:String){
return (call((_arg1 + ".valueOf")));
}
public function hasProperty(_arg1:String):Boolean{
return (call(hasProperty_js, _arg1));
}
public function setProperty(_arg1:String, _arg2):void{
call(setProperty_js, _arg1, _arg2);
}
public function executeBlock(_arg1:String):void{
var data = _arg1;
if (isAvailable()){
try {
ExternalInterface.call(data);
} catch(e:SecurityError) {
if (_debug.javascript){
_debug.warning("ExternalInterface is not allowed.\nEnsure that allowScriptAccess is set to \"always\" in the Flash embed HTML.");
};
} catch(e:Error) {
if (_debug.javascript){
_debug.warning(("ExternalInterface failed to make the call\nreason: " + e.message));
};
};
};
}
public function getPropertyString(_arg1:String):String{
return (call((_arg1 + ".toString")));
}
public function setPropertyByReference(_arg1:String, _arg2:String):void{
call(setPropertyRef_js, _arg1, _arg2);
}
public function call(_arg1:String, ... _args){
var output:String;
var functionName = _arg1;
var args = _args;
if (isAvailable()){
try {
if (((_debug.javascript) && (_debug.verbose))){
output = "";
output = ("Flash->JS: " + functionName);
output = (output + "( ");
if (args.length > 0){
output = (output + args.join(","));
};
output = (output + " )");
_debug.info(output);
};
args.unshift(functionName);
return (ExternalInterface.call.apply(ExternalInterface, args));
} catch(e:SecurityError) {
if (_debug.javascript){
_debug.warning("ExternalInterface is not allowed.\nEnsure that allowScriptAccess is set to \"always\" in the Flash embed HTML.");
};
} catch(e:Error) {
if (_debug.javascript){
_debug.warning(("ExternalInterface failed to make the call\nreason: " + e.message));
};
};
};
return (null);
}
public function isAvailable():Boolean{
var _local1:Boolean;
_local1 = ExternalInterface.available;
if (((_local1) && ((Capabilities.playerType == "External")))){
_local1 = false;
};
if (((((!(_local1)) && (_debug.javascript))) && (_notAvailableWarning))){
_debug.warning("ExternalInterface is not available.");
_notAvailableWarning = false;
};
return (_local1);
}
}
}//package com.google.analytics.external
Section 131
//Environment (com.google.analytics.utils.Environment)
package com.google.analytics.utils {
import com.google.analytics.core.*;
import com.google.analytics.debug.*;
import com.google.analytics.external.*;
import flash.system.*;
public class Environment {
private var _dom:HTMLDOM;
private var _appName:String;
private var _debug:DebugConfiguration;
private var _appVersion:Version;
private var _url:String;
private var _protocol:Protocols;
private var _userAgent:UserAgent;
public function Environment(_arg1:String="", _arg2:String="", _arg3:String="", _arg4:DebugConfiguration=null, _arg5:HTMLDOM=null){
var _local6:Version;
super();
if (_arg2 == ""){
if (isAIR()){
_arg2 = "AIR";
} else {
_arg2 = "Flash";
};
};
if (_arg3 == ""){
_local6 = flashVersion;
} else {
_local6 = Version.fromString(_arg3);
};
_url = _arg1;
_appName = _arg2;
_appVersion = _local6;
_debug = _arg4;
_dom = _arg5;
}
public function isAIR():Boolean{
return ((((playerType == "Desktop")) && ((Security.sandboxType.toString() == "application"))));
}
public function get playerType():String{
return (Capabilities.playerType);
}
public function get locationSearch():String{
var _local1:String;
_local1 = _dom.search;
if (_local1){
return (_local1);
};
return ("");
}
public function get protocol():Protocols{
if (!_protocol){
_findProtocol();
};
return (_protocol);
}
public function get flashVersion():Version{
var _local1:Version;
_local1 = Version.fromString(Capabilities.version.split(" ")[1], ",");
return (_local1);
}
public function get screenWidth():Number{
return (Capabilities.screenResolutionX);
}
public function get languageEncoding():String{
var _local1:String;
if (System.useCodePage){
_local1 = _dom.characterSet;
if (_local1){
return (_local1);
};
return ("-");
};
return ("UTF-8");
}
public function get appName():String{
return (_appName);
}
public function get screenColorDepth():String{
var _local1:String;
var _local2:String;
switch (Capabilities.screenColor){
case "bw":
_local1 = "1";
break;
case "gray":
_local1 = "2";
break;
case "color":
default:
_local1 = "24";
};
_local2 = _dom.colorDepth;
if (_local2){
_local1 = _local2;
};
return (_local1);
}
private function _findProtocol():void{
var _local1:Protocols;
var _local2:String;
var _local3:String;
var _local4:String;
var _local5:String;
_local1 = Protocols.none;
if (_url != ""){
_local4 = _url.toLowerCase();
_local5 = _local4.substr(0, 5);
switch (_local5){
case "file:":
_local1 = Protocols.file;
break;
case "http:":
_local1 = Protocols.HTTP;
break;
case "https":
if (_local4.charAt(5) == ":"){
_local1 = Protocols.HTTPS;
};
break;
default:
_protocol = Protocols.none;
};
};
_local2 = _dom.protocol;
_local3 = (_local1.toString() + ":").toLowerCase();
if (((((_local2) && (!((_local2 == _local3))))) && (_debug))){
_debug.warning(((("Protocol mismatch: SWF=" + _local3) + ", DOM=") + _local2));
};
_protocol = _local1;
}
public function get locationSWFPath():String{
return (_url);
}
public function get platform():String{
var _local1:String;
_local1 = Capabilities.manufacturer;
return (_local1.split("Adobe ")[1]);
}
public function get operatingSystem():String{
return (Capabilities.os);
}
public function set appName(_arg1:String):void{
_appName = _arg1;
userAgent.applicationProduct = _arg1;
}
public function get userAgent():UserAgent{
if (!_userAgent){
_userAgent = new UserAgent(this, appName, appVersion.toString(4));
};
return (_userAgent);
}
ga_internal function set url(_arg1:String):void{
_url = _arg1;
}
public function get referrer():String{
var _local1:String;
_local1 = _dom.referrer;
if (_local1){
return (_local1);
};
if (protocol == Protocols.file){
return ("localhost");
};
return ("");
}
public function isInHTML():Boolean{
return ((Capabilities.playerType == "PlugIn"));
}
public function get language():String{
var _local1:String;
var _local2:String;
_local1 = _dom.language;
_local2 = Capabilities.language;
if (_local1){
if ((((_local1.length > _local2.length)) && ((_local1.substr(0, _local2.length) == _local2)))){
_local2 = _local1;
};
};
return (_local2);
}
public function get domainName():String{
var _local1:String;
var _local2:String;
var _local3:int;
if ((((protocol == Protocols.HTTP)) || ((protocol == Protocols.HTTPS)))){
_local1 = _url.toLowerCase();
if (protocol == Protocols.HTTP){
_local2 = _local1.split("http://").join("");
} else {
if (protocol == Protocols.HTTPS){
_local2 = _local1.split("https://").join("");
};
};
_local3 = _local2.indexOf("/");
if (_local3 > -1){
_local2 = _local2.substring(0, _local3);
};
return (_local2);
};
if (protocol == Protocols.file){
return ("localhost");
};
return ("");
}
public function set userAgent(_arg1:UserAgent):void{
_userAgent = _arg1;
}
public function set appVersion(_arg1:Version):void{
_appVersion = _arg1;
userAgent.applicationVersion = _arg1.toString(4);
}
public function get screenHeight():Number{
return (Capabilities.screenResolutionY);
}
public function get locationPath():String{
var _local1:String;
_local1 = _dom.pathname;
if (_local1){
return (_local1);
};
return ("");
}
public function get documentTitle():String{
var _local1:String;
_local1 = _dom.title;
if (_local1){
return (_local1);
};
return ("");
}
public function get appVersion():Version{
return (_appVersion);
}
}
}//package com.google.analytics.utils
Section 132
//Protocols (com.google.analytics.utils.Protocols)
package com.google.analytics.utils {
public class Protocols {
private var _value:int;
private var _name:String;
public static const none:Protocols = new Protocols(0, "none");
;
public static const HTTPS:Protocols = new Protocols(3, "HTTPS");
;
public static const file:Protocols = new Protocols(1, "file");
;
public static const HTTP:Protocols = new Protocols(2, "HTTP");
;
public function Protocols(_arg1:int=0, _arg2:String=""){
_value = _arg1;
_name = _arg2;
}
public function valueOf():int{
return (_value);
}
public function toString():String{
return (_name);
}
}
}//package com.google.analytics.utils
Section 133
//Timespan (com.google.analytics.utils.Timespan)
package com.google.analytics.utils {
public class Timespan {
public static var sixmonths:Number = 15768000;
public static var twoyears:Number = 63072000;
public static var thirtyminutes:Number = 1800;
}
}//package com.google.analytics.utils
Section 134
//URL (com.google.analytics.utils.URL)
package com.google.analytics.utils {
public class URL {
private var _url:String;
public function URL(_arg1:String=""){
_url = _arg1.toLowerCase();
}
public function get domain():String{
var _local1:Array;
if (((!((hostName == ""))) && ((hostName.indexOf(".") > -1)))){
_local1 = hostName.split(".");
switch (_local1.length){
case 2:
return (hostName);
case 3:
if (_local1[1] == "co"){
return (hostName);
};
_local1.shift();
return (_local1.join("."));
case 4:
_local1.shift();
return (_local1.join("."));
};
};
return ("");
}
public function get path():String{
var _local1:String;
_local1 = _url;
if (_local1.indexOf("://") > -1){
_local1 = _local1.split("://")[1];
};
if (_local1.indexOf(hostName) == 0){
_local1 = _local1.substr(hostName.length);
};
if (_local1.indexOf("?") > -1){
_local1 = _local1.split("?")[0];
};
if (_local1.charAt(0) != "/"){
_local1 = ("/" + _local1);
};
return (_local1);
}
public function get search():String{
var _local1:String;
_local1 = _url;
if (_local1.indexOf("://") > -1){
_local1 = _local1.split("://")[1];
};
if (_local1.indexOf(hostName) == 0){
_local1 = _local1.substr(hostName.length);
};
if (_local1.indexOf("?") > -1){
_local1 = _local1.split("?")[1];
} else {
_local1 = "";
};
return (_local1);
}
public function get subDomain():String{
if (((!((domain == ""))) && (!((domain == hostName))))){
return (hostName.split(("." + domain)).join(""));
};
return ("");
}
public function get protocol():Protocols{
var _local1:String;
_local1 = _url.split("://")[0];
switch (_local1){
case "file":
return (Protocols.file);
case "http":
return (Protocols.HTTP);
case "https":
return (Protocols.HTTPS);
default:
return (Protocols.none);
};
}
public function get hostName():String{
var _local1:String;
_local1 = _url;
if (_local1.indexOf("://") > -1){
_local1 = _local1.split("://")[1];
};
if (_local1.indexOf("/") > -1){
_local1 = _local1.split("/")[0];
};
if (_local1.indexOf("?") > -1){
_local1 = _local1.split("?")[0];
};
if ((((protocol == Protocols.file)) || ((protocol == Protocols.none)))){
return ("");
};
return (_local1);
}
}
}//package com.google.analytics.utils
Section 135
//UserAgent (com.google.analytics.utils.UserAgent)
package com.google.analytics.utils {
import com.google.analytics.core.*;
import flash.system.*;
public class UserAgent {
private var _version:Version;
private var _localInfo:Environment;
private var _applicationProduct:String;
public static var minimal:Boolean = false;
public function UserAgent(_arg1:Environment, _arg2:String="", _arg3:String=""){
_localInfo = _arg1;
applicationProduct = _arg2;
_version = Version.fromString(_arg3);
}
public function get tamarinProductToken():String{
if (UserAgent.minimal){
return ("");
};
if (System.vmVersion){
return (("Tamarin/" + Utils.trim(System.vmVersion, true)));
};
return ("");
}
public function set applicationProduct(_arg1:String):void{
_applicationProduct = _arg1;
}
public function get applicationVersion():String{
return (_version.toString(2));
}
public function get applicationProductToken():String{
var _local1:String;
_local1 = applicationProduct;
if (applicationVersion != ""){
_local1 = (_local1 + ("/" + applicationVersion));
};
return (_local1);
}
public function get vendorProductToken():String{
var _local1:String;
_local1 = "";
if (_localInfo.isAIR()){
_local1 = (_local1 + "AIR");
} else {
_local1 = (_local1 + "FlashPlayer");
};
_local1 = (_local1 + "/");
_local1 = (_local1 + _version.toString(3));
return (_local1);
}
public function toString():String{
var _local1:String;
_local1 = "";
_local1 = (_local1 + applicationProductToken);
if (applicationComment != ""){
_local1 = (_local1 + (" " + applicationComment));
};
if (tamarinProductToken != ""){
_local1 = (_local1 + (" " + tamarinProductToken));
};
if (vendorProductToken != ""){
_local1 = (_local1 + (" " + vendorProductToken));
};
return (_local1);
}
public function get applicationComment():String{
var _local1:Array;
_local1 = [];
_local1.push(_localInfo.platform);
_local1.push(_localInfo.playerType);
if (!UserAgent.minimal){
_local1.push(_localInfo.operatingSystem);
_local1.push(_localInfo.language);
};
if (Capabilities.isDebugger){
_local1.push("DEBUG");
};
if (_local1.length > 0){
return ((("(" + _local1.join("; ")) + ")"));
};
return ("");
}
public function set applicationVersion(_arg1:String):void{
_version = Version.fromString(_arg1);
}
public function get applicationProduct():String{
return (_applicationProduct);
}
}
}//package com.google.analytics.utils
Section 136
//Variables (com.google.analytics.utils.Variables)
package com.google.analytics.utils {
import flash.net.*;
public dynamic class Variables {
public var post:Array;
public var URIencode:Boolean;
public var pre:Array;
public var sort:Boolean;// = true
public function Variables(_arg1:String=null, _arg2:Array=null, _arg3:Array=null){
pre = [];
post = [];
sort = true;
super();
if (_arg1){
decode(_arg1);
};
if (_arg2){
this.pre = _arg2;
};
if (_arg3){
this.post = _arg3;
};
}
private function _join(_arg1:Variables):void{
var _local2:String;
if (!_arg1){
return;
};
for (_local2 in _arg1) {
this[_local2] = _arg1[_local2];
};
}
public function join(... _args):void{
var _local2:int;
var _local3:int;
_local2 = _args.length;
_local3 = 0;
while (_local3 < _local2) {
if (!(_args[_local3] is Variables)){
} else {
_join(_args[_local3]);
};
_local3++;
};
}
public function toString():String{
var _local1:Array;
var _local2:String;
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:int;
var _local7:String;
var _local8:String;
_local1 = [];
for (_local3 in this) {
_local2 = this[_local3];
if (URIencode){
_local2 = encodeURI(_local2);
};
_local1.push(((_local3 + "=") + _local2));
};
if (sort){
_local1.sort();
};
if (pre.length > 0){
pre.reverse();
_local5 = 0;
while (_local5 < pre.length) {
_local7 = pre[_local5];
_local6 = 0;
while (_local6 < _local1.length) {
_local4 = _local1[_local6];
if (_local4.indexOf(_local7) == 0){
_local1.unshift(_local1.splice(_local6, 1)[0]);
};
_local6++;
};
_local5++;
};
pre.reverse();
};
if (post.length > 0){
_local5 = 0;
while (_local5 < post.length) {
_local8 = post[_local5];
_local6 = 0;
while (_local6 < _local1.length) {
_local4 = _local1[_local6];
if (_local4.indexOf(_local8) == 0){
_local1.push(_local1.splice(_local6, 1)[0]);
};
_local6++;
};
_local5++;
};
};
return (_local1.join("&"));
}
public function decode(_arg1:String):void{
var _local2:Array;
var _local3:String;
var _local4:String;
var _local5:String;
var _local6:Array;
var _local7:int;
if (_arg1 == ""){
return;
};
if (_arg1.indexOf("&") > -1){
_local2 = _arg1.split("&");
} else {
_local2 = [_arg1];
};
_local7 = 0;
while (_local7 < _local2.length) {
_local3 = _local2[_local7];
if (_local3.indexOf("=") > -1){
_local6 = _local3.split("=");
_local4 = _local6[0];
_local5 = decodeURI(_local6[1]);
this[_local4] = _local5;
};
_local7++;
};
}
public function toURLVariables():URLVariables{
var _local1:URLVariables;
var _local2:String;
_local1 = new URLVariables();
for (_local2 in this) {
_local1[_local2] = this[_local2];
};
return (_local1);
}
}
}//package com.google.analytics.utils
Section 137
//Version (com.google.analytics.utils.Version)
package com.google.analytics.utils {
public class Version {
private var _maxBuild:uint;// = 0xFF
private var _maxMinor:uint;// = 15
private var _maxMajor:uint;// = 15
private var _revision:uint;
private var _separator:String;// = "."
private var _maxRevision:uint;// = 0xFFFF
private var _build:uint;
private var _minor:uint;
private var _major:uint;
public function Version(_arg1:uint=0, _arg2:uint=0, _arg3:uint=0, _arg4:uint=0){
var _local5:Version;
_maxMajor = 15;
_maxMinor = 15;
_maxBuild = 0xFF;
_maxRevision = 0xFFFF;
_separator = ".";
super();
if ((((((((_arg1 > _maxMajor)) && ((_arg2 == 0)))) && ((_arg3 == 0)))) && ((_arg4 == 0)))){
_local5 = Version.fromNumber(_arg1);
_arg1 = _local5.major;
_arg2 = _local5.minor;
_arg3 = _local5.build;
_arg4 = _local5.revision;
};
this.major = _arg1;
this.minor = _arg2;
this.build = _arg3;
this.revision = _arg4;
}
public function toString(_arg1:int=0):String{
var _local2:Array;
if ((((_arg1 <= 0)) || ((_arg1 > 4)))){
_arg1 = getFields();
};
switch (_arg1){
case 1:
_local2 = [major];
break;
case 2:
_local2 = [major, minor];
break;
case 3:
_local2 = [major, minor, build];
break;
case 4:
default:
_local2 = [major, minor, build, revision];
};
return (_local2.join(_separator));
}
public function get revision():uint{
return (_revision);
}
public function set build(_arg1:uint):void{
_build = Math.min(_arg1, _maxBuild);
}
public function set minor(_arg1:uint):void{
_minor = Math.min(_arg1, _maxMinor);
}
public function get build():uint{
return (_build);
}
public function set major(_arg1:uint):void{
_major = Math.min(_arg1, _maxMajor);
}
public function get minor():uint{
return (_minor);
}
public function valueOf():uint{
return (((((major << 28) | (minor << 24)) | (build << 16)) | revision));
}
public function get major():uint{
return (_major);
}
public function set revision(_arg1:uint):void{
_revision = Math.min(_arg1, _maxRevision);
}
private function getFields():int{
var _local1:int;
_local1 = 4;
if (revision == 0){
_local1--;
};
if ((((_local1 == 3)) && ((build == 0)))){
_local1--;
};
if ((((_local1 == 2)) && ((minor == 0)))){
_local1--;
};
return (_local1);
}
public function equals(_arg1):Boolean{
if (!(_arg1 is Version)){
return (false);
};
if ((((((((_arg1.major == major)) && ((_arg1.minor == minor)))) && ((_arg1.build == build)))) && ((_arg1.revision == revision)))){
return (true);
};
return (false);
}
public static function fromString(_arg1:String="", _arg2:String="."):Version{
var _local3:Version;
var _local4:Array;
_local3 = new (Version);
if ((((_arg1 == "")) || ((_arg1 == null)))){
return (_local3);
};
if (_arg1.indexOf(_arg2) > -1){
_local4 = _arg1.split(_arg2);
_local3.major = parseInt(_local4[0]);
_local3.minor = parseInt(_local4[1]);
_local3.build = parseInt(_local4[2]);
_local3.revision = parseInt(_local4[3]);
} else {
_local3.major = parseInt(_arg1);
};
return (_local3);
}
public static function fromNumber(_arg1:Number=0):Version{
var _local2:Version;
_local2 = new (Version);
if (((((((((((isNaN(_arg1)) || ((_arg1 == 0)))) || ((_arg1 < 0)))) || ((_arg1 == Number.MAX_VALUE)))) || ((_arg1 == Number.POSITIVE_INFINITY)))) || ((_arg1 == Number.NEGATIVE_INFINITY)))){
return (_local2);
};
_local2.major = (_arg1 >>> 28);
_local2.minor = ((_arg1 & 251658240) >>> 24);
_local2.build = ((_arg1 & 0xFF0000) >>> 16);
_local2.revision = (_arg1 & 0xFFFF);
return (_local2);
}
}
}//package com.google.analytics.utils
Section 138
//Bridge (com.google.analytics.v4.Bridge)
package com.google.analytics.v4 {
import com.google.analytics.core.*;
import com.google.analytics.debug.*;
import com.google.analytics.external.*;
public class Bridge implements GoogleAnalyticsAPI {
private var _debug:DebugConfiguration;
private var _proxy:JavascriptProxy;
private var _jsContainer:String;// = "_GATracker"
private var _hasGATracker:Boolean;// = false
private var _account:String;
private static var _linkTrackingObject_js:XML = <script>
<![CDATA[
function( container , target )
{
var targets ;
var name ;
if( target.indexOf(".") > 0 )
{
targets = target.split(".");
name = targets.pop();
}
else
{
targets = [];
name = target;
}
var ref = window;
var depth = targets.length;
for( var j = 0 ; j < depth ; j++ )
{
ref = ref[ targets[j] ] ;
}
window[container][target] = ref[name] ;
}
]]>
</script>
;
private static var _createTrackingObject_js:XML = <script>
<![CDATA[
function( acct )
{
_GATracker[acct] = _gat._getTracker(acct);
}
]]>
</script>
;
private static var _injectTrackingObject_js:XML = <script>
<![CDATA[
function()
{
try
{
_GATracker
}
catch(e)
{
_GATracker = {};
}
}
]]>
</script>
;
private static var _checkGAJS_js:XML = <script>
<![CDATA[
function()
{
if( _gat && _gat._getTracker )
{
return true;
}
return false;
}
]]>
</script>
;
private static var _checkValidTrackingObject_js:XML = <script>
<![CDATA[
function(acct)
{
if( _GATracker[acct] && (_GATracker[acct]._getAccount) )
{
return true ;
}
else
{
return false;
}
}
]]>
</script>
;
public function Bridge(_arg1:String, _arg2:DebugConfiguration, _arg3:JavascriptProxy){
var _local4:String;
var _local5:String;
var _local6:String;
_hasGATracker = false;
_jsContainer = "_GATracker";
super();
_account = _arg1;
_debug = _arg2;
_proxy = _arg3;
if (!_checkGAJS()){
_local4 = "";
_local4 = (_local4 + "ga.js not found, be sure to check if\n");
_local4 = (_local4 + "<script src=\"http://www.google-analytics.com/ga.js\"></script>\n");
_local4 = (_local4 + "is included in the HTML.");
_debug.warning(_local4);
throw (new Error(_local4));
};
if (!_hasGATracker){
if (((_debug.javascript) && (_debug.verbose))){
_local5 = "";
_local5 = (_local5 + "The Google Analytics tracking code was not found on the container page\n");
_local5 = (_local5 + "we create it");
_debug.info(_local5, VisualDebugMode.advanced);
};
_injectTrackingObject();
};
if (Utils.validateAccount(_arg1)){
_createTrackingObject(_arg1);
} else {
if (_checkTrackingObject(_arg1)){
_linkTrackingObject(_arg1);
} else {
_local6 = "";
_local6 = (_local6 + (("JS Object \"" + _arg1) + "\" doesn't exist in DOM\n"));
_local6 = (_local6 + "Bridge object not created.");
_debug.warning(_local6);
throw (new Error(_local6));
};
};
}
public function link(_arg1:String, _arg2:Boolean=false):void{
_debug.info((((("link( " + _arg1) + ", ") + _arg2) + " )"));
_call("_link", _arg1, _arg2);
}
public function addOrganic(_arg1:String, _arg2:String):void{
_debug.info((("addOrganic( " + [_arg1, _arg2].join(", ")) + " )"));
_call("_addOrganic", _arg1);
}
public function setAllowLinker(_arg1:Boolean):void{
_debug.info((("setAllowLinker( " + _arg1) + " )"));
_call("_setAllowLinker", _arg1);
}
private function _linkTrackingObject(_arg1:String):void{
_proxy.call(_linkTrackingObject_js, _jsContainer, _arg1);
}
public function setClientInfo(_arg1:Boolean):void{
_debug.info((("setClientInfo( " + _arg1) + " )"));
_call("_setClientInfo", _arg1);
}
public function trackTrans():void{
_debug.info("trackTrans()");
_call("_trackTrans");
}
public function trackEvent(_arg1:String, _arg2:String, _arg3:String=null, _arg4:Number=NaN):Boolean{
var _local5:int;
_local5 = 2;
if (((_arg3) && (!((_arg3 == ""))))){
_local5 = 3;
};
if ((((_local5 == 3)) && (!(isNaN(_arg4))))){
_local5 = 4;
};
switch (_local5){
case 4:
_debug.info((("trackEvent( " + [_arg1, _arg2, _arg3, _arg4].join(", ")) + " )"));
return (_call("_trackEvent", _arg1, _arg2, _arg3, _arg4));
case 3:
_debug.info((("trackEvent( " + [_arg1, _arg2, _arg3].join(", ")) + " )"));
return (_call("_trackEvent", _arg1, _arg2, _arg3));
case 2:
default:
_debug.info((("trackEvent( " + [_arg1, _arg2].join(", ")) + " )"));
return (_call("_trackEvent", _arg1, _arg2));
};
}
public function trackPageview(_arg1:String=""):void{
_debug.info((("trackPageview( " + _arg1) + " )"));
_call("_trackPageview", _arg1);
}
public function setCookieTimeout(_arg1:int):void{
_debug.info((("setCookieTimeout( " + _arg1) + " )"));
_call("_setCookieTimeout", _arg1);
}
private function _checkValidTrackingObject(_arg1:String):Boolean{
return (_proxy.call(_checkValidTrackingObject_js, _arg1));
}
private function _checkGAJS():Boolean{
return (_proxy.call(_checkGAJS_js));
}
public function linkByPost(_arg1:Object, _arg2:Boolean=false):void{
_debug.warning((((("linkByPost( " + _arg1) + ", ") + _arg2) + " ) not implemented"));
}
public function getClientInfo():Boolean{
_debug.info("getClientInfo()");
return (_call("_getClientInfo"));
}
private function _call(_arg1:String, ... _args){
_args.unshift(((((("window." + _jsContainer) + "[\"") + _account) + "\"].") + _arg1));
return (_proxy.call.apply(_proxy, _args));
}
public function hasGAJS():Boolean{
return (_checkGAJS());
}
private function _checkTrackingObject(_arg1:String):Boolean{
var _local2:Boolean;
var _local3:Boolean;
_local2 = _proxy.hasProperty(_arg1);
_local3 = _proxy.hasProperty((_arg1 + "._getAccount"));
return (((_local2) && (_local3)));
}
public function resetSession():void{
_debug.warning("resetSession() not implemented");
}
public function getDetectTitle():Boolean{
_debug.info("getDetectTitle()");
return (_call("_getDetectTitle"));
}
public function setDetectFlash(_arg1:Boolean):void{
_debug.info((("setDetectFlash( " + _arg1) + " )"));
_call("_setDetectFlash", _arg1);
}
public function setCampNameKey(_arg1:String):void{
_debug.info((("setCampNameKey( " + _arg1) + " )"));
_call("_setCampNameKey", _arg1);
}
public function createEventTracker(_arg1:String):EventTracker{
_debug.info((("createEventTracker( " + _arg1) + " )"));
return (new EventTracker(_arg1, this));
}
public function addItem(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:Number, _arg6:int):void{
_debug.info((("addItem( " + [_arg1, _arg2, _arg3, _arg4, _arg5, _arg6].join(", ")) + " )"));
_call("_addItem", _arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
}
public function clearIgnoredOrganic():void{
_debug.info("clearIgnoredOrganic()");
_call("_clearIgnoreOrganic");
}
public function setVar(_arg1:String):void{
_debug.info((("setVar( " + _arg1) + " )"));
_call("_setVar", _arg1);
}
public function setDomainName(_arg1:String):void{
_debug.info((("setDomainName( " + _arg1) + " )"));
_call("_setDomainName", _arg1);
}
public function hasTrackingAccount(_arg1:String):Boolean{
if (Utils.validateAccount(_arg1)){
return (_checkValidTrackingObject(_arg1));
};
return (_checkTrackingObject(_arg1));
}
public function addTrans(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:String, _arg8:String):Object{
_debug.info((("addTrans( " + [_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8].join(", ")) + " )"));
_call("_addTrans", _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
return (null);
}
public function setCampSourceKey(_arg1:String):void{
_debug.info((("setCampSourceKey( " + _arg1) + " )"));
_call("_setCampSourceKey", _arg1);
}
public function setCampContentKey(_arg1:String):void{
_debug.info((("setCampContentKey( " + _arg1) + " )"));
_call("_setCampContentKey", _arg1);
}
public function clearIgnoredRef():void{
_debug.info("clearIgnoredRef()");
_call("_clearIgnoreRef");
}
public function setLocalServerMode():void{
_debug.info("setLocalServerMode()");
_call("_setLocalServerMode");
}
public function getLocalGifPath():String{
_debug.info("getLocalGifPath()");
return (_call("_getLocalGifPath"));
}
public function setAllowAnchor(_arg1:Boolean):void{
_debug.info((("setAllowAnchor( " + _arg1) + " )"));
_call("_setAllowAnchor", _arg1);
}
public function setLocalGifPath(_arg1:String):void{
_debug.info((("setLocalGifPath( " + _arg1) + " )"));
_call("_setLocalGifPath", _arg1);
}
public function getVersion():String{
_debug.info("getVersion()");
return (_call("_getVersion"));
}
private function _injectTrackingObject():void{
_proxy.executeBlock(_injectTrackingObject_js);
_hasGATracker = true;
}
public function setCookiePath(_arg1:String):void{
_debug.info((("setCookiePath( " + _arg1) + " )"));
_call("_setCookiePath", _arg1);
}
public function setSampleRate(_arg1:Number):void{
_debug.info((("setSampleRate( " + _arg1) + " )"));
_call("_setSampleRate", _arg1);
}
public function setAllowHash(_arg1:Boolean):void{
_debug.info((("setAllowHash( " + _arg1) + " )"));
_call("_setAllowHash", _arg1);
}
public function addIgnoredOrganic(_arg1:String):void{
_debug.info((("addIgnoredOrganic( " + _arg1) + " )"));
_call("_addIgnoredOrganic", _arg1);
}
public function setCampNOKey(_arg1:String):void{
_debug.info((("setCampNOKey( " + _arg1) + " )"));
_call("_setCampNOKey", _arg1);
}
public function cookiePathCopy(_arg1:String):void{
_debug.info((("cookiePathCopy( " + _arg1) + " )"));
_call("_cookiePathCopy", _arg1);
}
public function setLocalRemoteServerMode():void{
_debug.info("setLocalRemoteServerMode()");
_call("_setLocalRemoteServerMode");
}
public function getServiceMode():ServerOperationMode{
_debug.info("getServiceMode()");
return (_call("_getServiceMode"));
}
public function setDetectTitle(_arg1:Boolean):void{
_debug.info((("setDetectTitle( " + _arg1) + " )"));
_call("_setDetectTitle", _arg1);
}
public function setCampTermKey(_arg1:String):void{
_debug.info((("setCampTermKey( " + _arg1) + " )"));
_call("_setCampTermKey", _arg1);
}
private function _createTrackingObject(_arg1:String):void{
_proxy.call(_createTrackingObject_js, _arg1);
}
public function getDetectFlash():Boolean{
_debug.info("getDetectFlash()");
return (_call("_getDetectFlash"));
}
public function setCampaignTrack(_arg1:Boolean):void{
_debug.info((("setCampaignTrack( " + _arg1) + " )"));
_call("_setCampaignTrack", _arg1);
}
public function clearOrganic():void{
_debug.info("clearOrganic()");
_call("_clearOrganic");
}
public function addIgnoredRef(_arg1:String):void{
_debug.info((("addIgnoredRef( " + _arg1) + " )"));
_call("_addIgnoredRef", _arg1);
}
public function setCampMediumKey(_arg1:String):void{
_debug.info((("setCampMediumKey( " + _arg1) + " )"));
_call("_setCampMediumKey", _arg1);
}
public function setSessionTimeout(_arg1:int):void{
_debug.info((("setSessionTimeout( " + _arg1) + " )"));
_call("_setSessionTimeout", _arg1);
}
public function setRemoteServerMode():void{
_debug.info("setRemoteServerMode()");
_call("_setRemoteServerMode");
}
public function getAccount():String{
_debug.info("getAccount()");
return (_call("_getAccount"));
}
}
}//package com.google.analytics.v4
Section 139
//Configuration (com.google.analytics.v4.Configuration)
package com.google.analytics.v4 {
import com.google.analytics.core.*;
import com.google.analytics.debug.*;
import com.google.analytics.utils.*;
import com.google.analytics.campaign.*;
public class Configuration {
public var serverMode:ServerOperationMode;
public var detectFlash:Boolean;// = true
public var allowLocalTracking:Boolean;// = true
public var secureRemoteGIFpath:String;// = "https://ssl.google-analytics.com/__utm.gif"
public var hasSiteOverlay:Boolean;// = false
private var _version:String;// = "4.3as"
public var allowDomainHash:Boolean;// = true
public var detectClientInfo:Boolean;// = true
public var idleLoop:Number;// = 30
public var isTrackOutboundSubdomains:Boolean;// = false
public var cookiePath:String;// = "/"
public var transactionFieldDelim:String;// = "|"
private var _organic:Organic;
private var _cookieName:String;// = "analytics"
public var campaignKey:CampaignKey;
public var google:String;// = "google"
public var googleCsePath:String;// = "cse"
public var bucketCapacity:Number;// = 10
private var _sampleRate:Number;// = 1
public var remoteGIFpath:String;// = "http://www.google-analytics.com/__utm.gif"
public var googleSearchParam:String;// = "q"
public var allowLinker:Boolean;// = false
public var maxOutboundLinkExamined:Number;// = 1000
private var _debug:DebugConfiguration;
private var _trackingLimitPerSession:int;// = 500
private var _domain:Domain;
public var allowAnchor:Boolean;// = false
public var tokenCliff:int;// = 10
public var sessionTimeout:Number;
public var idleTimeout:Number;// = 60
public var campaignTracking:Boolean;// = true
public var domainName:String;// = ""
public var detectTitle:Boolean;// = true
public var tokenRate:Number;// = 0.2
public var conversionTimeout:Number;
public var localGIFpath:String;// = "/__utm.gif"
public function Configuration(_arg1:DebugConfiguration=null){
_version = "4.3as";
_sampleRate = 1;
_trackingLimitPerSession = 500;
_organic = new Organic();
googleCsePath = "cse";
googleSearchParam = "q";
google = "google";
_cookieName = "analytics";
allowDomainHash = true;
allowAnchor = false;
allowLinker = false;
hasSiteOverlay = false;
tokenRate = 0.2;
conversionTimeout = Timespan.sixmonths;
sessionTimeout = Timespan.thirtyminutes;
idleLoop = 30;
idleTimeout = 60;
maxOutboundLinkExamined = 1000;
tokenCliff = 10;
bucketCapacity = 10;
detectClientInfo = true;
detectFlash = true;
detectTitle = true;
campaignKey = new CampaignKey();
campaignTracking = true;
isTrackOutboundSubdomains = false;
serverMode = ServerOperationMode.remote;
localGIFpath = "/__utm.gif";
remoteGIFpath = "http://www.google-analytics.com/__utm.gif";
secureRemoteGIFpath = "https://ssl.google-analytics.com/__utm.gif";
cookiePath = "/";
transactionFieldDelim = "|";
domainName = "";
allowLocalTracking = true;
super();
_debug = _arg1;
_domain = new Domain(DomainNameMode.auto, "", _debug);
serverMode = ServerOperationMode.remote;
_initOrganicSources();
}
public function get organic():Organic{
return (_organic);
}
public function get trackingLimitPerSession():int{
return (_trackingLimitPerSession);
}
private function _initOrganicSources():void{
addOrganicSource(google, googleSearchParam);
addOrganicSource("yahoo", "p");
addOrganicSource("msn", "q");
addOrganicSource("aol", "query");
addOrganicSource("aol", "encquery");
addOrganicSource("lycos", "query");
addOrganicSource("ask", "q");
addOrganicSource("altavista", "q");
addOrganicSource("netscape", "query");
addOrganicSource("cnn", "query");
addOrganicSource("looksmart", "qt");
addOrganicSource("about", "terms");
addOrganicSource("mamma", "query");
addOrganicSource("alltheweb", "q");
addOrganicSource("gigablast", "q");
addOrganicSource("voila", "rdata");
addOrganicSource("virgilio", "qs");
addOrganicSource("live", "q");
addOrganicSource("baidu", "wd");
addOrganicSource("alice", "qs");
addOrganicSource("yandex", "text");
addOrganicSource("najdi", "q");
addOrganicSource("aol", "q");
addOrganicSource("club-internet", "q");
addOrganicSource("mama", "query");
addOrganicSource("seznam", "q");
addOrganicSource("search", "q");
addOrganicSource("wp", "szukaj");
addOrganicSource("onet", "qt");
addOrganicSource("netsprint", "q");
addOrganicSource("google.interia", "q");
addOrganicSource("szukacz", "q");
addOrganicSource("yam", "k");
addOrganicSource("pchome", "q");
addOrganicSource("kvasir", "searchExpr");
addOrganicSource("sesam", "q");
addOrganicSource("ozu", "q");
addOrganicSource("terra", "query");
addOrganicSource("nostrum", "query");
addOrganicSource("mynet", "q");
addOrganicSource("ekolay", "q");
addOrganicSource("search.ilse", "search_for");
}
public function get sampleRate():Number{
return (_sampleRate);
}
public function get cookieName():String{
return (_cookieName);
}
public function addOrganicSource(_arg1:String, _arg2:String):void{
var engine = _arg1;
var keyword = _arg2;
try {
_organic.addSource(engine, keyword);
} catch(e:Error) {
if (((_debug) && (_debug.active))){
_debug.warning(e.message);
};
};
}
public function get domain():Domain{
return (_domain);
}
public function set sampleRate(_arg1:Number):void{
if (_arg1 <= 0){
_arg1 = 0.1;
};
if (_arg1 > 1){
_arg1 = 1;
};
_arg1 = Number(_arg1.toFixed(2));
_sampleRate = _arg1;
}
public function get version():String{
return (_version);
}
}
}//package com.google.analytics.v4
Section 140
//GoogleAnalyticsAPI (com.google.analytics.v4.GoogleAnalyticsAPI)
package com.google.analytics.v4 {
import com.google.analytics.core.*;
public interface GoogleAnalyticsAPI {
function getServiceMode():ServerOperationMode;
function setLocalRemoteServerMode():void;
function setCampSourceKey(_arg1:String):void;
function setCampContentKey(_arg1:String):void;
function addOrganic(_arg1:String, _arg2:String):void;
function setDetectFlash(_arg1:Boolean):void;
function resetSession():void;
function setCampTermKey(_arg1:String):void;
function setCampNameKey(_arg1:String):void;
function addIgnoredOrganic(_arg1:String):void;
function addItem(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:Number, _arg6:int):void;
function setAllowLinker(_arg1:Boolean):void;
function addTrans(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:String, _arg8:String):Object;
function getDetectFlash():Boolean;
function setCampaignTrack(_arg1:Boolean):void;
function createEventTracker(_arg1:String):EventTracker;
function setCookieTimeout(_arg1:int):void;
function setAllowAnchor(_arg1:Boolean):void;
function trackTrans():void;
function trackEvent(_arg1:String, _arg2:String, _arg3:String=null, _arg4:Number=NaN):Boolean;
function trackPageview(_arg1:String=""):void;
function setLocalGifPath(_arg1:String):void;
function getVersion():String;
function getLocalGifPath():String;
function setVar(_arg1:String):void;
function clearIgnoredOrganic():void;
function setCampMediumKey(_arg1:String):void;
function addIgnoredRef(_arg1:String):void;
function setClientInfo(_arg1:Boolean):void;
function setCookiePath(_arg1:String):void;
function setSampleRate(_arg1:Number):void;
function setSessionTimeout(_arg1:int):void;
function setRemoteServerMode():void;
function clearIgnoredRef():void;
function linkByPost(_arg1:Object, _arg2:Boolean=false):void;
function setLocalServerMode():void;
function setDetectTitle(_arg1:Boolean):void;
function setAllowHash(_arg1:Boolean):void;
function clearOrganic():void;
function getAccount():String;
function setDomainName(_arg1:String):void;
function link(_arg1:String, _arg2:Boolean=false):void;
function setCampNOKey(_arg1:String):void;
function getClientInfo():Boolean;
function cookiePathCopy(_arg1:String):void;
function getDetectTitle():Boolean;
}
}//package com.google.analytics.v4
Section 141
//Tracker (com.google.analytics.v4.Tracker)
package com.google.analytics.v4 {
import com.google.analytics.core.*;
import com.google.analytics.debug.*;
import com.google.analytics.utils.*;
import com.google.analytics.data.*;
import com.google.analytics.external.*;
import com.google.analytics.campaign.*;
public class Tracker implements GoogleAnalyticsAPI {
private const EVENT_TRACKER_LABEL_KEY_NUM:int = 3;
private const EVENT_TRACKER_VALUE_VALUE_NUM:int = 1;
private const EVENT_TRACKER_PROJECT_ID:int = 5;
private const EVENT_TRACKER_OBJECT_NAME_KEY_NUM:int = 1;
private const EVENT_TRACKER_TYPE_KEY_NUM:int = 2;
private var _adSense:AdSenseGlobals;
private var _eventTracker:X10;
private var _noSessionInformation:Boolean;// = false
private var _browserInfo:BrowserInfo;
private var _debug:DebugConfiguration;
private var _isNewVisitor:Boolean;// = false
private var _buffer:Buffer;
private var _config:Configuration;
private var _x10Module:X10;
private var _campaign:CampaignManager;
private var _formatedReferrer:String;
private var _timeStamp:Number;
private var _info:Environment;
private var _domainHash:Number;
private var _campaignInfo:CampaignInfo;
private var _gifRequest:GIFRequest;
private var _hasInitData:Boolean;// = false
private var _account:String;
public function Tracker(_arg1:String, _arg2:Configuration, _arg3:DebugConfiguration, _arg4:Environment, _arg5:Buffer, _arg6:GIFRequest, _arg7:AdSenseGlobals){
var _local8:String;
_hasInitData = false;
_isNewVisitor = false;
_noSessionInformation = false;
super();
_account = _arg1;
_config = _arg2;
_debug = _arg3;
_info = _arg4;
_buffer = _arg5;
_gifRequest = _arg6;
_adSense = _arg7;
if (!Utils.validateAccount(_arg1)){
_local8 = (("Account \"" + _arg1) + "\" is not valid.");
_debug.warning(_local8);
throw (new Error(_local8));
};
_initData();
}
private function _doTracking():Boolean{
if (((((!((_info.protocol == Protocols.file))) && (!((_info.protocol == Protocols.none))))) && (_isNotGoogleSearch()))){
return (true);
};
if (_config.allowLocalTracking){
return (true);
};
return (false);
}
public function addOrganic(_arg1:String, _arg2:String):void{
_debug.info((("addOrganic( " + [_arg1, _arg2].join(", ")) + " )"));
_config.organic.addSource(_arg1, _arg2);
}
public function setAllowLinker(_arg1:Boolean):void{
_config.allowLinker = _arg1;
_debug.info((("setAllowLinker( " + _config.allowLinker) + " )"));
}
public function trackPageview(_arg1:String=""):void{
_debug.info((("trackPageview( " + _arg1) + " )"));
if (_doTracking()){
_initData();
_trackMetrics(_arg1);
_noSessionInformation = false;
} else {
_debug.warning((("trackPageview( " + _arg1) + " ) failed"));
};
}
public function setCookieTimeout(_arg1:int):void{
_config.conversionTimeout = _arg1;
_debug.info((("setCookieTimeout( " + _config.conversionTimeout) + " )"));
}
public function trackTrans():void{
_debug.warning("trackTrans() not implemented");
}
public function trackEvent(_arg1:String, _arg2:String, _arg3:String=null, _arg4:Number=NaN):Boolean{
var _local5:Boolean;
var _local6:int;
_local5 = true;
_local6 = 2;
if (((!((_arg1 == ""))) && (!((_arg2 == ""))))){
_eventTracker.clearKey(EVENT_TRACKER_PROJECT_ID);
_eventTracker.clearValue(EVENT_TRACKER_PROJECT_ID);
_local5 = _eventTracker.setKey(EVENT_TRACKER_PROJECT_ID, EVENT_TRACKER_OBJECT_NAME_KEY_NUM, _arg1);
_local5 = _eventTracker.setKey(EVENT_TRACKER_PROJECT_ID, EVENT_TRACKER_TYPE_KEY_NUM, _arg2);
if (((_arg3) && (!((_arg3 == ""))))){
_local5 = _eventTracker.setKey(EVENT_TRACKER_PROJECT_ID, EVENT_TRACKER_LABEL_KEY_NUM, _arg3);
_local6 = 3;
if (!isNaN(_arg4)){
_local5 = _eventTracker.setValue(EVENT_TRACKER_PROJECT_ID, EVENT_TRACKER_VALUE_VALUE_NUM, _arg4);
_local6 = 4;
};
};
if (_local5){
_debug.info(((("valid event tracking call\ncategory: " + _arg1) + "\naction: ") + _arg2), VisualDebugMode.geek);
_sendXEvent(_eventTracker);
};
} else {
_debug.warning(((("event tracking call is not valid, failed!\ncategory: " + _arg1) + "\naction: ") + _arg2), VisualDebugMode.geek);
_local5 = false;
};
switch (_local6){
case 4:
_debug.info((("trackEvent( " + [_arg1, _arg2, _arg3, _arg4].join(", ")) + " )"));
break;
case 3:
_debug.info((("trackEvent( " + [_arg1, _arg2, _arg3].join(", ")) + " )"));
break;
case 2:
default:
_debug.info((("trackEvent( " + [_arg1, _arg2].join(", ")) + " )"));
};
return (_local5);
}
public function setClientInfo(_arg1:Boolean):void{
_config.detectClientInfo = _arg1;
_debug.info((("setClientInfo( " + _config.detectClientInfo) + " )"));
}
public function linkByPost(_arg1:Object, _arg2:Boolean=false):void{
_debug.warning((("linkByPost( " + [_arg1, _arg2].join(", ")) + " ) not implemented"));
}
private function _initData():void{
var _local1:String;
var _local2:String;
if (!_hasInitData){
_updateDomainName();
_domainHash = _getDomainHash();
_timeStamp = Math.round((new Date().getTime() / 1000));
if (_debug.verbose){
_local1 = "";
_local1 = (_local1 + "_initData 0");
_local1 = (_local1 + ("\ndomain name: " + _config.domainName));
_local1 = (_local1 + ("\ndomain hash: " + _domainHash));
_local1 = (_local1 + (((("\ntimestamp: " + _timeStamp) + " (") + new Date((_timeStamp * 1000))) + ")"));
_debug.info(_local1, VisualDebugMode.geek);
};
};
if (_doTracking()){
_handleCookie();
};
if (!_hasInitData){
if (_doTracking()){
_formatedReferrer = _formatReferrer();
_browserInfo = new BrowserInfo(_config, _info);
_debug.info(("browserInfo: " + _browserInfo.toURLString()), VisualDebugMode.advanced);
if (_config.campaignTracking){
_campaign = new CampaignManager(_config, _debug, _buffer, _domainHash, _formatedReferrer, _timeStamp);
_campaignInfo = _campaign.getCampaignInformation(_info.locationSearch, _noSessionInformation);
_debug.info(("campaignInfo: " + _campaignInfo.toURLString()), VisualDebugMode.advanced);
};
};
_x10Module = new X10();
_eventTracker = new X10();
_hasInitData = true;
};
if (_config.hasSiteOverlay){
_debug.warning("Site Overlay is not supported");
};
if (_debug.verbose){
_local2 = "";
_local2 = (_local2 + "_initData (misc)");
_local2 = (_local2 + ("\nflash version: " + _info.flashVersion.toString(4)));
_local2 = (_local2 + ("\nprotocol: " + _info.protocol));
_local2 = (_local2 + (("\ndefault domain name (auto): \"" + _info.domainName) + "\""));
_local2 = (_local2 + ("\nlanguage: " + _info.language));
_local2 = (_local2 + ("\ndomain hash: " + _getDomainHash()));
_local2 = (_local2 + ("\nuser-agent: " + _info.userAgent));
_debug.info(_local2, VisualDebugMode.geek);
};
}
public function getDetectTitle():Boolean{
_debug.info("getDetectTitle()");
return (_config.detectTitle);
}
public function resetSession():void{
_debug.info("resetSession()");
_buffer.resetCurrentSession();
}
private function _sendXEvent(_arg1:X10=null):void{
var _local2:Variables;
var _local3:EventInfo;
var _local4:Variables;
var _local5:Variables;
_initData();
if (_takeSample()){
_local2 = new Variables();
_local2.URIencode = true;
_local3 = new EventInfo(true, _x10Module, _arg1);
_local4 = _local3.toVariables();
_local5 = _renderMetricsSearchVariables();
_local2.join(_local4, _local5);
_gifRequest.send(_account, _local2, false, true);
};
}
public function setDetectFlash(_arg1:Boolean):void{
_config.detectFlash = _arg1;
_debug.info((("setDetectFlash( " + _config.detectFlash) + " )"));
}
public function setCampNameKey(_arg1:String):void{
var _local2:String;
_config.campaignKey.UCCN = _arg1;
_local2 = (("setCampNameKey( " + _config.campaignKey.UCCN) + " )");
if (_debug.mode == VisualDebugMode.geek){
_debug.info((_local2 + " [UCCN]"));
} else {
_debug.info(_local2);
};
}
private function _formatReferrer():String{
var _local1:String;
var _local2:String;
var _local3:URL;
var _local4:URL;
_local1 = _info.referrer;
if ((((_local1 == "")) || ((_local1 == "localhost")))){
_local1 = "-";
} else {
_local2 = _info.domainName;
_local3 = new URL(_local1);
_local4 = new URL(("http://" + _local2));
if (_local3.hostName == _local2){
return ("-");
};
if (_local4.domain == _local3.domain){
if (_local4.subDomain != _local3.subDomain){
_local1 = "0";
};
};
if ((((_local1.charAt(0) == "[")) && (_local1.charAt((_local1.length - 1))))){
_local1 = "-";
};
};
_debug.info(("formated referrer: " + _local1), VisualDebugMode.advanced);
return (_local1);
}
private function _visitCode():Number{
if (_debug.verbose){
_debug.info(("visitCode: " + _buffer.utma.sessionId), VisualDebugMode.geek);
};
return (_buffer.utma.sessionId);
}
public function createEventTracker(_arg1:String):EventTracker{
_debug.info((("createEventTracker( " + _arg1) + " )"));
return (new EventTracker(_arg1, this));
}
public function addItem(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:Number, _arg6:int):void{
_debug.warning((("addItem( " + [_arg1, _arg2, _arg3, _arg4, _arg5, _arg6].join(", ")) + " ) not implemented"));
}
public function clearIgnoredOrganic():void{
_debug.info("clearIgnoredOrganic()");
_config.organic.clearIgnoredKeywords();
}
public function setVar(_arg1:String):void{
var _local2:Variables;
if (((!((_arg1 == ""))) && (_isNotGoogleSearch()))){
_initData();
_buffer.utmv.domainHash = _domainHash;
_buffer.utmv.value = _arg1;
if (_debug.verbose){
_debug.info(_buffer.utmv.toString(), VisualDebugMode.geek);
};
_debug.info((("setVar( " + _arg1) + " )"));
if (_takeSample()){
_local2 = new Variables();
_local2.utmt = "var";
_gifRequest.send(_account, _local2);
};
} else {
_debug.warning((("setVar \"" + _arg1) + "\" is ignored"));
};
}
public function setDomainName(_arg1:String):void{
if (_arg1 == "auto"){
_config.domain.mode = DomainNameMode.auto;
} else {
if (_arg1 == "none"){
_config.domain.mode = DomainNameMode.none;
} else {
_config.domain.mode = DomainNameMode.custom;
_config.domain.name = _arg1;
};
};
_updateDomainName();
_debug.info((("setDomainName( " + _config.domainName) + " )"));
}
public function getClientInfo():Boolean{
_debug.info("getClientInfo()");
return (_config.detectClientInfo);
}
private function _updateDomainName():void{
var _local1:String;
if (_config.domain.mode == DomainNameMode.auto){
_local1 = _info.domainName;
if (_local1.substring(0, 4) == "www."){
_local1 = _local1.substring(4);
};
_config.domain.name = _local1;
};
_config.domainName = _config.domain.name.toLowerCase();
_debug.info(("domain name: " + _config.domainName), VisualDebugMode.advanced);
}
public function addTrans(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:String, _arg8:String):Object{
_debug.warning((("addTrans( " + [_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8].join(", ")) + " ) not implemented"));
return (null);
}
public function setCampContentKey(_arg1:String):void{
var _local2:String;
_config.campaignKey.UCCT = _arg1;
_local2 = (("setCampContentKey( " + _config.campaignKey.UCCT) + " )");
if (_debug.mode == VisualDebugMode.geek){
_debug.info((_local2 + " [UCCT]"));
} else {
_debug.info(_local2);
};
}
private function _handleCookie():void{
var _local1:String;
var _local2:String;
var _local3:Array;
var _local4:String;
if (_config.allowLinker){
};
if (((_buffer.hasUTMA()) && (!(_buffer.utma.isEmpty())))){
if (((!(_buffer.hasUTMB())) || (!(_buffer.hasUTMC())))){
_buffer.updateUTMA(_timeStamp);
_noSessionInformation = true;
};
if (_debug.verbose){
_debug.info(("from cookie " + _buffer.utma.toString()), VisualDebugMode.geek);
};
} else {
_debug.info("create a new utma", VisualDebugMode.advanced);
_buffer.utma.domainHash = _domainHash;
_buffer.utma.sessionId = _getUniqueSessionId();
_buffer.utma.firstTime = _timeStamp;
_buffer.utma.lastTime = _timeStamp;
_buffer.utma.currentTime = _timeStamp;
_buffer.utma.sessionCount = 1;
if (_debug.verbose){
_debug.info(_buffer.utma.toString(), VisualDebugMode.geek);
};
_noSessionInformation = true;
_isNewVisitor = true;
};
if (((_adSense.gaGlobal) && ((_adSense.dh == String(_domainHash))))){
if (_adSense.sid){
_buffer.utma.currentTime = Number(_adSense.sid);
if (_debug.verbose){
_local1 = "";
_local1 = (_local1 + "AdSense sid found\n");
_local1 = (_local1 + (((("Override currentTime(" + _buffer.utma.currentTime) + ") from AdSense sid(") + Number(_adSense.sid)) + ")"));
_debug.info(_local1, VisualDebugMode.geek);
};
};
if (_isNewVisitor){
if (_adSense.sid){
_buffer.utma.lastTime = Number(_adSense.sid);
if (_debug.verbose){
_local2 = "";
_local2 = (_local2 + "AdSense sid found (new visitor)\n");
_local2 = (_local2 + (((("Override lastTime(" + _buffer.utma.lastTime) + ") from AdSense sid(") + Number(_adSense.sid)) + ")"));
_debug.info(_local2, VisualDebugMode.geek);
};
};
if (_adSense.vid){
_local3 = _adSense.vid.split(".");
_buffer.utma.sessionId = Number(_local3[0]);
_buffer.utma.firstTime = Number(_local3[1]);
if (_debug.verbose){
_local4 = "";
_local4 = (_local4 + "AdSense vid found (new visitor)\n");
_local4 = (_local4 + (((("Override sessionId(" + _buffer.utma.sessionId) + ") from AdSense vid(") + Number(_local3[0])) + ")\n"));
_local4 = (_local4 + (((("Override firstTime(" + _buffer.utma.firstTime) + ") from AdSense vid(") + Number(_local3[1])) + ")"));
_debug.info(_local4, VisualDebugMode.geek);
};
};
if (_debug.verbose){
_debug.info(("AdSense modified : " + _buffer.utma.toString()), VisualDebugMode.geek);
};
};
};
_buffer.utmb.domainHash = _domainHash;
if (isNaN(_buffer.utmb.trackCount)){
_buffer.utmb.trackCount = 0;
};
if (isNaN(_buffer.utmb.token)){
_buffer.utmb.token = _config.tokenCliff;
};
if (isNaN(_buffer.utmb.lastTime)){
_buffer.utmb.lastTime = _buffer.utma.currentTime;
};
_buffer.utmc.domainHash = _domainHash;
if (_debug.verbose){
_debug.info(_buffer.utmb.toString(), VisualDebugMode.advanced);
_debug.info(_buffer.utmc.toString(), VisualDebugMode.advanced);
};
}
public function setLocalServerMode():void{
_config.serverMode = ServerOperationMode.local;
_debug.info("setLocalServerMode()");
}
private function _renderMetricsSearchVariables(_arg1:String=""):Variables{
var _local2:Variables;
var _local3:DocumentInfo;
var _local4:Variables;
var _local5:Variables;
_local2 = new Variables();
_local2.URIencode = true;
_local3 = new DocumentInfo(_config, _info, _formatedReferrer, _arg1, _adSense);
_debug.info(("docInfo: " + _local3.toURLString()), VisualDebugMode.geek);
if (_config.campaignTracking){
_local4 = _campaignInfo.toVariables();
};
_local5 = _browserInfo.toVariables();
_local2.join(_local3.toVariables(), _local5, _local4);
return (_local2);
}
public function clearIgnoredRef():void{
_debug.info("clearIgnoredRef()");
_config.organic.clearIgnoredReferrals();
}
public function setCampSourceKey(_arg1:String):void{
var _local2:String;
_config.campaignKey.UCSR = _arg1;
_local2 = (("setCampSourceKey( " + _config.campaignKey.UCSR) + " )");
if (_debug.mode == VisualDebugMode.geek){
_debug.info((_local2 + " [UCSR]"));
} else {
_debug.info(_local2);
};
}
public function getLocalGifPath():String{
_debug.info("getLocalGifPath()");
return (_config.localGIFpath);
}
public function setLocalGifPath(_arg1:String):void{
_config.localGIFpath = _arg1;
_debug.info((("setLocalGifPath( " + _config.localGIFpath) + " )"));
}
public function getVersion():String{
_debug.info("getVersion()");
return (_config.version);
}
public function setAllowAnchor(_arg1:Boolean):void{
_config.allowAnchor = _arg1;
_debug.info((("setAllowAnchor( " + _config.allowAnchor) + " )"));
}
private function _isNotGoogleSearch():Boolean{
var _local1:String;
var _local2:Boolean;
var _local3:Boolean;
var _local4:Boolean;
var _local5:Boolean;
_local1 = _config.domainName;
_local2 = (_local1.indexOf("www.google.") < 0);
_local3 = (_local1.indexOf(".google.") < 0);
_local4 = (_local1.indexOf("google.") < 0);
_local5 = (_local1.indexOf("google.org") > -1);
return (((((((((_local2) || (_local3))) || (_local4))) || (!((_config.cookiePath == "/"))))) || (_local5)));
}
public function setSampleRate(_arg1:Number):void{
if (_arg1 < 0){
_debug.warning("sample rate can not be negative, ignoring value.");
} else {
_config.sampleRate = _arg1;
};
_debug.info((("setSampleRate( " + _config.sampleRate) + " )"));
}
private function _takeSample():Boolean{
if (_debug.verbose){
_debug.info((((("takeSample: (" + (_visitCode() % 10000)) + ") < (") + (_config.sampleRate * 10000)) + ")"), VisualDebugMode.geek);
};
return (((_visitCode() % 10000) < (_config.sampleRate * 10000)));
}
public function setCookiePath(_arg1:String):void{
_config.cookiePath = _arg1;
_debug.info((("setCookiePath( " + _config.cookiePath) + " )"));
}
public function setAllowHash(_arg1:Boolean):void{
_config.allowDomainHash = _arg1;
_debug.info((("setAllowHash( " + _config.allowDomainHash) + " )"));
}
private function _generateUserDataHash():Number{
var _local1:String;
_local1 = "";
_local1 = (_local1 + _info.appName);
_local1 = (_local1 + _info.appVersion);
_local1 = (_local1 + _info.language);
_local1 = (_local1 + _info.platform);
_local1 = (_local1 + _info.userAgent.toString());
_local1 = (_local1 + (((_info.screenWidth + "x") + _info.screenHeight) + _info.screenColorDepth));
_local1 = (_local1 + _info.referrer);
return (Utils.generateHash(_local1));
}
public function addIgnoredOrganic(_arg1:String):void{
_debug.info((("addIgnoredOrganic( " + _arg1) + " )"));
_config.organic.addIgnoredKeyword(_arg1);
}
public function setLocalRemoteServerMode():void{
_config.serverMode = ServerOperationMode.both;
_debug.info("setLocalRemoteServerMode()");
}
public function cookiePathCopy(_arg1:String):void{
_debug.warning((("cookiePathCopy( " + _arg1) + " ) not implemented"));
}
public function setDetectTitle(_arg1:Boolean):void{
_config.detectTitle = _arg1;
_debug.info((("setDetectTitle( " + _config.detectTitle) + " )"));
}
public function setCampTermKey(_arg1:String):void{
var _local2:String;
_config.campaignKey.UCTR = _arg1;
_local2 = (("setCampTermKey( " + _config.campaignKey.UCTR) + " )");
if (_debug.mode == VisualDebugMode.geek){
_debug.info((_local2 + " [UCTR]"));
} else {
_debug.info(_local2);
};
}
public function getServiceMode():ServerOperationMode{
_debug.info("getServiceMode()");
return (_config.serverMode);
}
public function setCampNOKey(_arg1:String):void{
var _local2:String;
_config.campaignKey.UCNO = _arg1;
_local2 = (("setCampNOKey( " + _config.campaignKey.UCNO) + " )");
if (_debug.mode == VisualDebugMode.geek){
_debug.info((_local2 + " [UCNO]"));
} else {
_debug.info(_local2);
};
}
private function _trackMetrics(_arg1:String=""):void{
var _local2:Variables;
var _local3:Variables;
var _local4:Variables;
var _local5:EventInfo;
if (_takeSample()){
_local2 = new Variables();
_local2.URIencode = true;
if (((_x10Module) && (_x10Module.hasData()))){
_local5 = new EventInfo(false, _x10Module);
_local3 = _local5.toVariables();
};
_local4 = _renderMetricsSearchVariables(_arg1);
_local2.join(_local3, _local4);
_gifRequest.send(_account, _local2);
};
}
public function setCampaignTrack(_arg1:Boolean):void{
_config.campaignTracking = _arg1;
_debug.info((("setCampaignTrack( " + _config.campaignTracking) + " )"));
}
public function addIgnoredRef(_arg1:String):void{
_debug.info((("addIgnoredRef( " + _arg1) + " )"));
_config.organic.addIgnoredReferral(_arg1);
}
public function clearOrganic():void{
_debug.info("clearOrganic()");
_config.organic.clearEngines();
}
public function getDetectFlash():Boolean{
_debug.info("getDetectFlash()");
return (_config.detectFlash);
}
public function setCampMediumKey(_arg1:String):void{
var _local2:String;
_config.campaignKey.UCMD = _arg1;
_local2 = (("setCampMediumKey( " + _config.campaignKey.UCMD) + " )");
if (_debug.mode == VisualDebugMode.geek){
_debug.info((_local2 + " [UCMD]"));
} else {
_debug.info(_local2);
};
}
private function _getUniqueSessionId():Number{
var _local1:Number;
_local1 = ((Utils.generate32bitRandom() ^ _generateUserDataHash()) * 2147483647);
_debug.info(("Session ID: " + _local1), VisualDebugMode.geek);
return (_local1);
}
private function _getDomainHash():Number{
if (((((!(_config.domainName)) || ((_config.domainName == "")))) || ((_config.domain.mode == DomainNameMode.none)))){
_config.domainName = "";
return (1);
};
_updateDomainName();
if (_config.allowDomainHash){
return (Utils.generateHash(_config.domainName));
};
return (1);
}
public function setSessionTimeout(_arg1:int):void{
_config.sessionTimeout = _arg1;
_debug.info((("setSessionTimeout( " + _config.sessionTimeout) + " )"));
}
public function getAccount():String{
_debug.info("getAccount()");
return (_account);
}
public function link(_arg1:String, _arg2:Boolean=false):void{
_debug.warning((("link( " + [_arg1, _arg2].join(", ")) + " ) not implemented"));
}
public function setRemoteServerMode():void{
_config.serverMode = ServerOperationMode.remote;
_debug.info("setRemoteServerMode()");
}
}
}//package com.google.analytics.v4
Section 142
//AnalyticsTracker (com.google.analytics.AnalyticsTracker)
package com.google.analytics {
import flash.events.*;
import com.google.analytics.v4.*;
import com.google.analytics.debug.*;
public interface AnalyticsTracker extends GoogleAnalyticsAPI, IEventDispatcher {
function set config(_arg1:Configuration):void;
function isReady():Boolean;
function get mode():String;
function set debug(_arg1:DebugConfiguration):void;
function get account():String;
function set mode(_arg1:String):void;
function get config():Configuration;
function get debug():DebugConfiguration;
function set account(_arg1:String):void;
function get visualDebug():Boolean;
function set visualDebug(_arg1:Boolean):void;
}
}//package com.google.analytics
Section 143
//API (com.google.analytics.API)
package com.google.analytics {
import com.google.analytics.utils.*;
public class API {
public static var version:Version = new Version();
version.major = 1;
version.minor = 0;
version.build = 1;
version.revision = "$Rev: 234 $ ".split(" ")[1];
}
}//package com.google.analytics
Section 144
//GATracker (com.google.analytics.GATracker)
package com.google.analytics {
import flash.events.*;
import flash.display.*;
import com.google.analytics.core.*;
import com.google.analytics.v4.*;
import com.google.analytics.debug.*;
import com.google.analytics.utils.*;
import com.google.analytics.external.*;
import com.google.analytics.events.*;
public class GATracker implements AnalyticsTracker {
private var _adSense:AdSenseGlobals;
private var _env:Environment;
private var _visualDebug:Boolean;
private var _idleTimer:IdleTimer;
private var _debug:DebugConfiguration;
private var _buffer:Buffer;
private var _config:Configuration;
private var _mode:String;
private var _display:DisplayObject;
private var _jsproxy:JavascriptProxy;
private var _dom:HTMLDOM;
private var _eventDispatcher:EventDispatcher;
private var _ready:Boolean;// = false
private var _gifRequest:GIFRequest;
private var _account:String;
private var _tracker:GoogleAnalyticsAPI;
public static var version:Version = API.version;
public static var autobuild:Boolean = true;
public function GATracker(_arg1:DisplayObject, _arg2:String, _arg3:String="AS3", _arg4:Boolean=false, _arg5:Configuration=null, _arg6:DebugConfiguration=null){
_ready = false;
super();
_display = _arg1;
_eventDispatcher = new EventDispatcher(this);
_tracker = new TrackerCache();
this.account = _arg2;
this.mode = _arg3;
this.visualDebug = _arg4;
if (!_arg6){
this.debug = new DebugConfiguration();
};
if (!_arg5){
this.config = new Configuration(_arg6);
};
if (autobuild){
_factory();
};
}
public function link(_arg1:String, _arg2:Boolean=false):void{
_tracker.link(_arg1, _arg2);
}
public function addOrganic(_arg1:String, _arg2:String):void{
_tracker.addOrganic(_arg1, _arg2);
}
public function setAllowLinker(_arg1:Boolean):void{
_tracker.setAllowLinker(_arg1);
}
public function trackEvent(_arg1:String, _arg2:String, _arg3:String=null, _arg4:Number=NaN):Boolean{
return (_tracker.trackEvent(_arg1, _arg2, _arg3, _arg4));
}
public function setCookieTimeout(_arg1:int):void{
_tracker.setCookieTimeout(_arg1);
}
public function trackTrans():void{
_tracker.trackTrans();
}
public function trackPageview(_arg1:String=""):void{
_tracker.trackPageview(_arg1);
}
public function getClientInfo():Boolean{
return (_tracker.getClientInfo());
}
public function setClientInfo(_arg1:Boolean):void{
_tracker.setClientInfo(_arg1);
}
public function get account():String{
return (_account);
}
public function linkByPost(_arg1:Object, _arg2:Boolean=false):void{
_tracker.linkByPost(_arg1, _arg2);
}
public function getDetectTitle():Boolean{
return (_tracker.getDetectTitle());
}
public function dispatchEvent(_arg1:Event):Boolean{
return (_eventDispatcher.dispatchEvent(_arg1));
}
public function get config():Configuration{
return (_config);
}
public function set mode(_arg1:String):void{
_mode = _arg1;
}
public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
_eventDispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
public function setDetectFlash(_arg1:Boolean):void{
_tracker.setDetectFlash(_arg1);
}
public function resetSession():void{
_tracker.resetSession();
}
public function setCampNameKey(_arg1:String):void{
_tracker.setCampNameKey(_arg1);
}
public function get debug():DebugConfiguration{
return (_debug);
}
public function addItem(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:Number, _arg6:int):void{
_tracker.addItem(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
}
private function _bridgeFactory():GoogleAnalyticsAPI{
debug.info(((("GATracker (Bridge) v" + version) + "\naccount: ") + account));
return (new Bridge(account, _debug, _jsproxy));
}
public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
_eventDispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public function clearIgnoredOrganic():void{
_tracker.clearIgnoredOrganic();
}
public function set account(_arg1:String):void{
_account = _arg1;
}
public function setVar(_arg1:String):void{
_tracker.setVar(_arg1);
}
public function build():void{
if (!isReady()){
_factory();
};
}
public function setDomainName(_arg1:String):void{
_tracker.setDomainName(_arg1);
}
public function createEventTracker(_arg1:String):EventTracker{
return (_tracker.createEventTracker(_arg1));
}
public function set config(_arg1:Configuration):void{
_config = _arg1;
}
public function addTrans(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:String, _arg7:String, _arg8:String):Object{
return (_tracker.addTrans(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8));
}
public function setCampSourceKey(_arg1:String):void{
_tracker.setCampSourceKey(_arg1);
}
public function setCampContentKey(_arg1:String):void{
_tracker.setCampContentKey(_arg1);
}
public function willTrigger(_arg1:String):Boolean{
return (_eventDispatcher.willTrigger(_arg1));
}
public function setLocalServerMode():void{
_tracker.setLocalServerMode();
}
public function isReady():Boolean{
return (_ready);
}
public function getLocalGifPath():String{
return (_tracker.getLocalGifPath());
}
public function setAllowAnchor(_arg1:Boolean):void{
_tracker.setAllowAnchor(_arg1);
}
public function clearIgnoredRef():void{
_tracker.clearIgnoredRef();
}
public function get mode():String{
return (_mode);
}
public function set debug(_arg1:DebugConfiguration):void{
_debug = _arg1;
}
public function setLocalGifPath(_arg1:String):void{
_tracker.setLocalGifPath(_arg1);
}
public function getVersion():String{
return (_tracker.getVersion());
}
public function setSampleRate(_arg1:Number):void{
_tracker.setSampleRate(_arg1);
}
public function setCookiePath(_arg1:String):void{
_tracker.setCookiePath(_arg1);
}
public function setAllowHash(_arg1:Boolean):void{
_tracker.setAllowHash(_arg1);
}
public function setCampNOKey(_arg1:String):void{
_tracker.setCampNOKey(_arg1);
}
public function addIgnoredOrganic(_arg1:String):void{
_tracker.addIgnoredOrganic(_arg1);
}
public function setLocalRemoteServerMode():void{
_tracker.setLocalRemoteServerMode();
}
public function cookiePathCopy(_arg1:String):void{
_tracker.cookiePathCopy(_arg1);
}
private function _factory():void{
var _local1:GoogleAnalyticsAPI;
var _local2:TrackerCache;
_jsproxy = new JavascriptProxy(debug);
if (visualDebug){
debug.layout = new Layout(debug, _display);
debug.active = visualDebug;
};
_local2 = (_tracker as TrackerCache);
switch (mode){
case TrackerMode.BRIDGE:
_local1 = _bridgeFactory();
break;
case TrackerMode.AS3:
default:
_local1 = _trackerFactory();
};
if (!_local2.isEmpty()){
_local2.tracker = _local1;
_local2.flush();
};
_tracker = _local1;
_ready = true;
dispatchEvent(new AnalyticsEvent(AnalyticsEvent.READY, this));
}
public function setCampTermKey(_arg1:String):void{
_tracker.setCampTermKey(_arg1);
}
private function _trackerFactory():GoogleAnalyticsAPI{
debug.info(((("GATracker (AS3) v" + version) + "\naccount: ") + account));
_adSense = new AdSenseGlobals(debug);
_dom = new HTMLDOM(debug);
_dom.cacheProperties();
_env = new Environment("", "", "", debug, _dom);
_buffer = new Buffer(config, debug, false);
_gifRequest = new GIFRequest(config, debug, _buffer, _env);
_idleTimer = new IdleTimer(config, debug, _display, _buffer);
_env.url = _display.stage.loaderInfo.url;
return (new Tracker(account, config, debug, _env, _buffer, _gifRequest, _adSense));
}
public function setDetectTitle(_arg1:Boolean):void{
_tracker.setDetectTitle(_arg1);
}
public function getServiceMode():ServerOperationMode{
return (_tracker.getServiceMode());
}
public function clearOrganic():void{
_tracker.clearOrganic();
}
public function setCampaignTrack(_arg1:Boolean):void{
_tracker.setCampaignTrack(_arg1);
}
public function addIgnoredRef(_arg1:String):void{
_tracker.addIgnoredRef(_arg1);
}
public function set visualDebug(_arg1:Boolean):void{
_visualDebug = _arg1;
}
public function setCampMediumKey(_arg1:String):void{
_tracker.setCampMediumKey(_arg1);
}
public function setSessionTimeout(_arg1:int):void{
_tracker.setSessionTimeout(_arg1);
}
public function getDetectFlash():Boolean{
return (_tracker.getDetectFlash());
}
public function get visualDebug():Boolean{
return (_visualDebug);
}
public function getAccount():String{
return (_tracker.getAccount());
}
public function hasEventListener(_arg1:String):Boolean{
return (_eventDispatcher.hasEventListener(_arg1));
}
public function setRemoteServerMode():void{
_tracker.setRemoteServerMode();
}
}
var _local1:* = ServerOperationMode;
return (_local1);
}//package com.google.analytics
Section 145
//PropTween (com.greensock.core.PropTween)
package com.greensock.core {
public 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 146
//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);
}
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 addChild(_arg1:TweenCore):void{
if (((!(_arg1.cachedOrphan)) && (_arg1.timeline))){
_arg1.timeline.remove(_arg1, true);
};
_arg1.timeline = this;
if (_arg1.gc){
_arg1.setEnabled(true, true);
};
if (_firstChild){
_firstChild.prevNode = _arg1;
};
_arg1.nextNode = _firstChild;
_firstChild = _arg1;
_arg1.prevNode = null;
_arg1.cachedOrphan = false;
}
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;
}
public function get rawTime():Number{
return (this.cachedTotalTime);
}
}
}//package com.greensock.core
Section 147
//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.4;
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;
this.cachedStartTime = (_local3.cachedTotalTime + _delay);
_local3.addChild(this);
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{
var _local2:Boolean = Boolean(((!((this.timeline == null))) && (((!((_arg1 == this.cachedStartTime))) || (this.gc)))));
this.cachedStartTime = _arg1;
if (_local2){
this.timeline.addChild(this);
};
}
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{
this.cachedDuration = (this.cachedTotalDuration = _arg1);
setDirtyCache(false);
}
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.setTotalTime(this.cachedTotalTime, false);
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.cachedPauseTime) || ((this.cachedPauseTime == 0)))) ? 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.addChild(this);
};
} else {
this.active = false;
if (((!(_arg2)) && (!(this.cachedOrphan)))){
this.timeline.remove(this, true);
};
};
return (false);
}
}
}//package com.greensock.core
Section 148
//OverwriteManager (com.greensock.OverwriteManager)
package com.greensock {
import com.greensock.core.*;
public 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.04;
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.1){
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))){
} 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)))) && (!(getGlobalPaused(_local7))))){
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 149
//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.392;
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 ((((_rawPrevTime <= _local4)) && (!((_rawPrevTime == _arg1))))){
this.cachedTotalTime = (this.cachedTime = _local4);
forceChildrenToEnd(_local4, _arg2);
_local9 = !(this.hasPausedChild());
_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;
};
};
if ((((_rawPrevTime >= 0)) && (!((_rawPrevTime == _arg1))))){
forceChildrenToBeginning(0, _arg2);
this.cachedTotalTime = 0;
this.cachedTime = 0;
_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.addChild(_local3);
_local4 = _local3.prevNode.cachedStartTime;
} 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 invalidate():void{
var _local1:TweenCore = (this.gc) ? _endCaps[0] : _firstChild;
while (_local1) {
_local1.invalidate();
_local1 = _local1.nextNode;
};
}
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.cachedTotalTime == 0))) && (!((this.cachedTotalTime == this.cachedTotalDuration))))){
return (this.cachedTotalTime);
};
return (((this.timeline.rawTime - this.cachedStartTime) * this.cachedTimeScale));
}
override public function set duration(_arg1:Number):void{
if (((!((this.duration == 0))) && (!((_arg1 == 0))))){
this.timeScale = (this.duration / _arg1);
};
}
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));
};
};
};
_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);
}
public function insert(_arg1:TweenCore, _arg2=0):TweenCore{
if (typeof(_arg2) == "string"){
if (!(_arg2 in _labels)){
addLabel(_arg2, this.duration);
};
_arg2 = Number(_labels[_arg2]);
};
_arg1.cachedStartTime = (Number(_arg2) + _arg1.delay);
addChild(_arg1);
return (_arg1);
}
override public function addChild(_arg1:TweenCore):void{
var _local4:TweenCore;
var _local5:Number;
if (((!(_arg1.cachedOrphan)) && (_arg1.timeline))){
_arg1.timeline.remove(_arg1, true);
};
_arg1.timeline = this;
if (_arg1.gc){
_arg1.setEnabled(true, true);
};
setDirtyCache(true);
if (((_arg1.cachedPauseTime) || ((_arg1.cachedPauseTime == 0)))){
_arg1.cachedPauseTime = (_arg1.cachedStartTime + (_arg1.cachedTime / _arg1.cachedTimeScale));
};
var _local2:TweenCore = (this.gc) ? _endCaps[0] : _firstChild;
var _local3:TweenCore = (this.gc) ? _endCaps[1] : _lastChild;
if (_local3 == null){
_local3 = _arg1;
_local2 = _local3;
_arg1.nextNode = (_arg1.prevNode = null);
} else {
_local4 = _local3;
_local5 = _arg1.cachedStartTime;
while (((!((_local4 == null))) && ((_local5 <= _local4.cachedStartTime)))) {
_local4 = _local4.prevNode;
};
if (_local4 == null){
_local2.prevNode = _arg1;
_arg1.nextNode = _local2;
_arg1.prevNode = null;
_local2 = _arg1;
} else {
if (_local4.nextNode){
_local4.nextNode.prevNode = _arg1;
} else {
if (_local4 == _local3){
_local3 = _arg1;
};
};
_arg1.prevNode = _local4;
_arg1.nextNode = _local4.nextNode;
_local4.nextNode = _arg1;
};
};
_arg1.cachedOrphan = false;
if (this.gc){
_endCaps[0] = _local2;
_endCaps[1] = _local3;
} else {
_firstChild = _local2;
_lastChild = _local3;
};
}
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 150
//TweenLite (com.greensock.TweenLite)
package com.greensock {
import flash.events.*;
import flash.display.*;
import com.greensock.core.*;
import flash.utils.*;
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.4;
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, roundProps: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 = true;
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))))) && (!(_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){
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 {
_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("onInit", 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 (_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{
_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 151
//BaseScrollPane (fl.containers.BaseScrollPane)
package fl.containers {
import fl.core.*;
import fl.controls.*;
import flash.display.*;
import flash.geom.*;
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 152
//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 153
//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 154
//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 155
//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 156
//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 157
//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 158
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import fl.core.*;
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import fl.events.*;
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 159
//Button (fl.controls.Button)
package fl.controls {
import fl.core.*;
import flash.display.*;
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 160
//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 161
//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 162
//ComboBox (fl.controls.ComboBox)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.geom.*;
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 163
//DataGrid (fl.controls.DataGrid)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.geom.*;
import flash.events.*;
import flash.utils.*;
import fl.data.*;
import fl.events.*;
import fl.managers.*;
import fl.controls.dataGridClasses.*;
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 164
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import fl.core.*;
import flash.display.*;
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 165
//List (fl.controls.List)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.geom.*;
import flash.events.*;
import flash.utils.*;
import fl.managers.*;
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 166
//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 167
//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 168
//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 169
//SelectableList (fl.controls.SelectableList)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import fl.data.*;
import fl.events.*;
import fl.managers.*;
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 170
//Slider (fl.controls.Slider)
package fl.controls {
import fl.core.*;
import flash.display.*;
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 171
//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 172
//TextArea (fl.controls.TextArea)
package fl.controls {
import fl.core.*;
import flash.display.*;
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 173
//TextInput (fl.controls.TextInput)
package fl.controls {
import fl.core.*;
import flash.display.*;
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 174
//UIScrollBar (fl.controls.UIScrollBar)
package fl.controls {
import fl.core.*;
import flash.display.*;
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 175
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 176
//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 177
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import fl.events.*;
import fl.managers.*;
import flash.text.*;
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 178
//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 179
//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 180
//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 181
//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 182
//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 183
//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 184
//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 185
//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 186
//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 187
//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 188
//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 189
//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 190
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import fl.core.*;
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
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 191
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
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 192
//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 193
//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 194
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.utils.*;
import flash.text.*;
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 195
//Back (fl.motion.easing.Back)
package fl.motion.easing {
public class Back {
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0):Number{
if (!_arg5){
_arg5 = 1.70158;
};
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * (((_arg5 + 1) * _arg1) - _arg5)) + _arg2));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0):Number{
if (!_arg5){
_arg5 = 1.70158;
};
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) + _arg5)) + 1)) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0):Number{
if (!_arg5){
_arg5 = 1.70158;
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
_arg5 = (_arg5 * 1.525);
return ((((_arg3 / 2) * ((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) - _arg5))) + _arg2));
};
_arg1 = (_arg1 - 2);
_arg5 = (_arg5 * 1.525);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) + _arg5)) + 2)) + _arg2));
}
}
}//package fl.motion.easing
Section 196
//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 197
//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 198
//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 199
//Star (jk.app.display.backgroundAssets.Star)
package jk.app.display.backgroundAssets {
import flash.display.*;
public dynamic class Star extends Sprite {
}
}//package jk.app.display.backgroundAssets
Section 200
//Background (jk.app.display.buttons.backgrounds.background1Assets.Background)
package jk.app.display.buttons.backgrounds.background1Assets {
import flash.display.*;
public dynamic class Background extends Sprite {
}
}//package jk.app.display.buttons.backgrounds.background1Assets
Section 201
//Background1 (jk.app.display.buttons.backgrounds.Background1)
package jk.app.display.buttons.backgrounds {
import flash.display.*;
public dynamic class Background1 extends SimpleButton {
}
}//package jk.app.display.buttons.backgrounds
Section 202
//BtnCancel (jk.app.display.buttons.BtnCancel)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnCancel extends Sprite {
}
}//package jk.app.display.buttons
Section 203
//BtnClear (jk.app.display.buttons.BtnClear)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnClear extends Sprite {
}
}//package jk.app.display.buttons
Section 204
//BtnCustomLevel (jk.app.display.buttons.BtnCustomLevel)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnCustomLevel extends Sprite {
}
}//package jk.app.display.buttons
Section 205
//BtnEditLevel (jk.app.display.buttons.BtnEditLevel)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnEditLevel extends MovieClip {
}
}//package jk.app.display.buttons
Section 206
//BtnHighscores (jk.app.display.buttons.BtnHighscores)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnHighscores extends Sprite {
}
}//package jk.app.display.buttons
Section 207
//BtnHint (jk.app.display.buttons.BtnHint)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnHint extends Sprite {
}
}//package jk.app.display.buttons
Section 208
//BtnLevelEditor (jk.app.display.buttons.BtnLevelEditor)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnLevelEditor extends Sprite {
}
}//package jk.app.display.buttons
Section 209
//BtnLoad (jk.app.display.buttons.BtnLoad)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnLoad extends Sprite {
}
}//package jk.app.display.buttons
Section 210
//BtnMainMenu (jk.app.display.buttons.BtnMainMenu)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnMainMenu extends Sprite {
}
}//package jk.app.display.buttons
Section 211
//BtnMoreGames (jk.app.display.buttons.BtnMoreGames)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnMoreGames extends Sprite {
}
}//package jk.app.display.buttons
Section 212
//BtnNext (jk.app.display.buttons.BtnNext)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnNext extends Sprite {
}
}//package jk.app.display.buttons
Section 213
//BtnNo (jk.app.display.buttons.BtnNo)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnNo extends Sprite {
}
}//package jk.app.display.buttons
Section 214
//BtnOk (jk.app.display.buttons.BtnOk)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnOk extends Sprite {
}
}//package jk.app.display.buttons
Section 215
//BtnPostItHere (jk.app.display.buttons.BtnPostItHere)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnPostItHere extends Sprite {
}
}//package jk.app.display.buttons
Section 216
//BtnRestart (jk.app.display.buttons.BtnRestart)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnRestart extends Sprite {
}
}//package jk.app.display.buttons
Section 217
//BtnSaveLoad (jk.app.display.buttons.BtnSaveLoad)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnSaveLoad extends Sprite {
}
}//package jk.app.display.buttons
Section 218
//BtnSelectLevel (jk.app.display.buttons.BtnSelectLevel)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnSelectLevel extends Sprite {
}
}//package jk.app.display.buttons
Section 219
//BtnSettings (jk.app.display.buttons.BtnSettings)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnSettings extends Sprite {
}
}//package jk.app.display.buttons
Section 220
//BtnStart (jk.app.display.buttons.BtnStart)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnStart extends Sprite {
}
}//package jk.app.display.buttons
Section 221
//BtnStep (jk.app.display.buttons.BtnStep)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnStep extends Sprite {
}
}//package jk.app.display.buttons
Section 222
//BtnSubmit (jk.app.display.buttons.BtnSubmit)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnSubmit extends Sprite {
}
}//package jk.app.display.buttons
Section 223
//BtnTest (jk.app.display.buttons.BtnTest)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnTest extends Sprite {
}
}//package jk.app.display.buttons
Section 224
//BtnYes (jk.app.display.buttons.BtnYes)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnYes extends Sprite {
}
}//package jk.app.display.buttons
Section 225
//SoundOnOff (jk.app.display.hudAssets.SoundOnOff)
package jk.app.display.hudAssets {
import flash.display.*;
public dynamic class SoundOnOff extends MovieClip {
}
}//package jk.app.display.hudAssets
Section 226
//CustomLevelComplete (jk.app.display.windows.dialogs.CustomLevelComplete)
package jk.app.display.windows.dialogs {
import flash.events.*;
import jk.engine.display.windows.*;
import jk.app.display.buttons.*;
public class CustomLevelComplete extends ModalDialog {
public var btnSaveLoad:BtnSaveLoad;
public var btnMainMenu:BtnMainMenu;
public var btnEditLevel:BtnEditLevel;
override public function initialize():void{
guiMgr.hud.showItem("adGame1", openTweenTime);
guiMgr.hud.showItem("adGame2", openTweenTime);
guiMgr.hud.showItem("socialButtons", openTweenTime);
}
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 jk.app.display.windows.dialogs
Section 227
//CustomLevelFailed (jk.app.display.windows.dialogs.CustomLevelFailed)
package jk.app.display.windows.dialogs {
import flash.events.*;
import jk.engine.display.windows.*;
import jk.app.display.buttons.*;
public class CustomLevelFailed extends ModalDialog {
public var btnMainMenu:BtnMainMenu;
public var btnEditLevel:BtnEditLevel;
public var btnRestart:BtnRestart;
override public function initialize():void{
guiMgr.hud.showItem("adGame1", openTweenTime);
guiMgr.hud.showItem("adGame2", openTweenTime);
guiMgr.hud.showItem("socialButtons", openTweenTime);
}
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 jk.app.display.windows.dialogs
Section 228
//LevelEditorPanel (jk.app.display.windows.dialogs.LevelEditorPanel)
package jk.app.display.windows.dialogs {
import fl.controls.*;
import fl.data.*;
import jk.engine.display.windows.*;
import jk.app.display.buttons.*;
public class LevelEditorPanel extends Dialog {
public var btnClear:BtnClear;
public var btnSaveLoad:BtnSaveLoad;
public var cbActors:ComboBox;
public var btnStep:BtnStep;
public var btnTest:BtnTest;
public var btnMainMenu:BtnMainMenu;
public var btnSettings:BtnSettings;
public function LevelEditorPanel(){
__setProp_cbActors_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:"Roll", data:"AZ"}, {label:"Fox I", data:"AV"}, {label:"Fox II", data:"AW"}, {label:"---Evil---", data:"---"}, {label:"Evil I", data:"AX"}, {label:"Evil II", data:"AY"}, {label:"---Shapes---", data:"---"}, {label:"Corner I", data:"AA"}, {label:"Corner II", data:"AB"}, {label:"Cross I", data:"AC"}, {label:"Cross II", data:"AD"}, {label:"Rect I", data:"AG"}, {label:"Rect II", data:"AH"}, {label:"Rect III", data:"AI"}, {label:"Rect IV", data:"AJ"}, {label:"Rect V", data:"AK"}, {label:"Rect VI", data:"AL"}, {label:"Rect VII", data:"AM"}, {label:"Rect VIII", data:"AN"}, {label:"Rect IX", data:"AO"}, {label:"Semicircle", data:"AP"}, {label:"Square", data:"AQ"}, {label:"TetrisJ", data:"AE"}, {label:"TetrisL", data:"AF"}, {label:"TetrisT I", data:"AR"}, {label:"TetrisT II", data:"AS"}, {label:"Trapezoid", data:"AT"}, {label:"Triangle", data:"AU"}];
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) {
};
}
}
}//package jk.app.display.windows.dialogs
Section 229
//LevelEditorSettings (jk.app.display.windows.dialogs.LevelEditorSettings)
package jk.app.display.windows.dialogs {
import jk.engine.utils.*;
import flash.events.*;
import jk.engine.theater.edit.*;
import jk.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 jk.app.display.windows.dialogs
Section 230
//Message (jk.app.display.windows.dialogs.Message)
package jk.app.display.windows.dialogs {
import flash.events.*;
import jk.engine.display.windows.*;
import flash.text.*;
import jk.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 jk.app.display.windows.dialogs
Section 231
//OfficialLevelComplete (jk.app.display.windows.dialogs.OfficialLevelComplete)
package jk.app.display.windows.dialogs {
import flash.events.*;
import jk.engine.display.windows.*;
import flash.text.*;
import jk.app.display.buttons.*;
public class OfficialLevelComplete extends ModalDialog {
public var txtScore:TextField;
public var btnSelectLevel:BtnSelectLevel;
public var btnNext:BtnNext;
public var btnRestart:BtnRestart;
override public function initialize():void{
txtScore.text = ("Score: " + _initOptions.score);
guiMgr.hud.showItem("adGame1", openTweenTime);
guiMgr.hud.showItem("adGame2", openTweenTime);
guiMgr.hud.showItem("socialButtons", openTweenTime);
}
override public function postInitialize():void{
btnNext.addEventListener(MouseEvent.CLICK, onNext_Click);
btnRestart.addEventListener(MouseEvent.CLICK, onRestart_Click);
btnSelectLevel.addEventListener(MouseEvent.CLICK, onSelectLevel_Click);
}
override public function shutdown():void{
btnNext.removeEventListener(MouseEvent.CLICK, onNext_Click);
btnRestart.removeEventListener(MouseEvent.CLICK, onRestart_Click);
btnSelectLevel.removeEventListener(MouseEvent.CLICK, onSelectLevel_Click);
}
private function onNext_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("Game", {levelIndex:(_initOptions.levelIndex + 1), levelPack:_initOptions.levelPack});
}
private function onRestart_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("Game", {levelIndex:_initOptions.levelIndex, levelPack:_initOptions.levelPack});
}
private function onSelectLevel_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("LevelSelection", {levelPack:_initOptions.levelPack});
}
}
}//package jk.app.display.windows.dialogs
Section 232
//Options (jk.app.display.windows.dialogs.Options)
package jk.app.display.windows.dialogs {
import fl.controls.*;
import flash.events.*;
import jk.engine.display.windows.*;
import jk.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_sliderQuality_Options_Layer3_0();
__setProp_sliderMusicVol_Options_Layer3_0();
__setProp_cbMusic_Options_Layer3_0();
__setProp_sliderSFXVol_Options_Layer3_0();
__setProp_cbSFX_Options_Layer3_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_sliderQuality_Options_Layer3_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_sliderMusicVol_Options_Layer3_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) {
};
}
function __setProp_cbMusic_Options_Layer3_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_sliderSFXVol_Options_Layer3_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_cbSFX_Options_Layer3_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) {
};
}
}
}//package jk.app.display.windows.dialogs
Section 233
//SaveLoadLevel (jk.app.display.windows.dialogs.SaveLoadLevel)
package jk.app.display.windows.dialogs {
import fl.controls.*;
import jk.engine.utils.*;
import flash.events.*;
import jk.engine.common.*;
import jk.engine.display.windows.*;
import jk.app.display.buttons.*;
public class SaveLoadLevel extends ModalDialog {
public var txtLevelCode:TextArea;
public var btnLoad:BtnLoad;
public var btnPostItHere:BtnPostItHere;
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);
btnPostItHere.addEventListener(MouseEvent.CLICK, onPostItHere_Click);
}
override public function shutdown():void{
btnCancel.removeEventListener(MouseEvent.CLICK, onCancel_Click);
btnLoad.removeEventListener(MouseEvent.CLICK, onLoad_Click);
btnPostItHere.removeEventListener(MouseEvent.CLICK, onPostItHere_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]);
};
}
private function onPostItHere_Click(_arg1:MouseEvent):void{
GATracker.trackEvent("Save/Load Level", "Click", "Post It Here!");
openURL(Settings.POST_IT_HERE_URL);
}
}
}//package jk.app.display.windows.dialogs
Section 234
//ContactListener (jk.app.display.windows.sheets.gameAssets.ContactListener)
package jk.app.display.windows.sheets.gameAssets {
import Box2D.Dynamics.Contacts.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import jk.engine.utils.*;
import jk.engine.theater.*;
import jk.app.theater.actors.*;
public class ContactListener extends b2ContactListener {
private var _heroesOnPlatform:Array;
private var _fail:Boolean;
public function ContactListener(){
_heroesOnPlatform = new Array();
}
public function get numheroesOnPlatform():uint{
return (_heroesOnPlatform.length);
}
public function get fail():Boolean{
return (_fail);
}
override public function Result(_arg1:b2ContactResult):void{
heroesOnPlatform_Add(_arg1.shape1.GetUserData(), _arg1.shape2.GetUserData());
heroesOnPlatform_Add(_arg1.shape2.GetUserData(), _arg1.shape1.GetUserData());
processHeroAndEvil(_arg1.shape1.GetUserData(), _arg1.shape2.GetUserData());
processHeroAndEvil(_arg1.shape2.GetUserData(), _arg1.shape1.GetUserData());
}
override public function Remove(_arg1:b2ContactPoint):void{
heroesOnPlatform_Remove(_arg1.shape1.GetUserData(), _arg1.shape2.GetUserData());
heroesOnPlatform_Remove(_arg1.shape2.GetUserData(), _arg1.shape1.GetUserData());
}
public function clear():void{
UArray.clear(_heroesOnPlatform);
_fail = false;
}
private function heroesOnPlatform_Add(_arg1:Object, _arg2:Object):void{
var _local3:Hero = (_arg1 as Hero);
var _local4:Platform = (_arg2 as Platform);
if (!((_local3) && (_local4))){
return;
};
UArray.pushUnique(_heroesOnPlatform, _local3);
}
private function heroesOnPlatform_Remove(_arg1:Object, _arg2:Object):void{
var _local3:Hero = (_arg1 as Hero);
var _local4:Platform = (_arg2 as Platform);
if (!((_local3) && (_local4))){
return;
};
UArray.remove(_heroesOnPlatform, _local3);
}
private function processHeroAndEvil(_arg1:Actor, _arg2:Actor):void{
var _local3:Hero = (_arg1 as Hero);
var _local4:Evil = (_arg2 as Evil);
if (((_local3) && (_local4))){
_fail = true;
};
}
}
}//package jk.app.display.windows.sheets.gameAssets
Section 235
//CursorInformer (jk.app.display.windows.sheets.gameAssets.CursorInformer)
package jk.app.display.windows.sheets.gameAssets {
import flash.display.*;
import flash.events.*;
import com.greensock.*;
import fl.motion.easing.*;
public class CursorInformer extends MovieClip {
private var _type:int;
private var _tween:TweenLite;
public static const EMPTY:int = 1;
public static const DELETE:int = 2;
public static const TIMER:int = 3;
public function CursorInformer(){
stop();
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
mouseEnabled = false;
_type = EMPTY;
}
public function get type():int{
return (_type);
}
public function set type(_arg1:int):void{
var vars:Object;
var value = _arg1;
if (_type == value){
return;
};
if (_tween){
_tween.kill();
};
vars = new Object();
if (value == EMPTY){
vars["scaleX"] = 0;
vars["scaleY"] = 0;
vars["ease"] = Cubic.easeInOut;
vars["onComplete"] = function ():void{
gotoAndStop(EMPTY);
};
} else {
gotoAndStop(value);
scaleX = 0;
scaleY = 0;
vars["scaleX"] = 1;
vars["scaleY"] = 1;
vars["ease"] = Cubic.easeInOut;
if (value == TIMER){
vars["onComplete"] = onTimer_Tween_Part2;
};
};
_tween = TweenLite.to(this, 0.1, vars);
_type = value;
}
private function onAddedToStage(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onRemovedFromStage(_arg1:Event):void{
removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function onEnterFrame(_arg1:Event):void{
x = (parent.mouseX + 25);
y = (parent.mouseY + 25);
}
private function onTimer_Tween_Part2():void{
TweenLite.to(this, 1, {rotation:360, ease:Cubic.easeInOut, onComplete:onTimer_Tween_Part3});
}
private function onTimer_Tween_Part3():void{
type = EMPTY;
}
}
}//package jk.app.display.windows.sheets.gameAssets
Section 236
//Level0Hint1 (jk.app.display.windows.sheets.gameAssets.Level0Hint1)
package jk.app.display.windows.sheets.gameAssets {
import flash.display.*;
public dynamic class Level0Hint1 extends Sprite {
}
}//package jk.app.display.windows.sheets.gameAssets
Section 237
//Level0Hint2 (jk.app.display.windows.sheets.gameAssets.Level0Hint2)
package jk.app.display.windows.sheets.gameAssets {
import flash.display.*;
public dynamic class Level0Hint2 extends Sprite {
}
}//package jk.app.display.windows.sheets.gameAssets
Section 238
//Level1Hint1 (jk.app.display.windows.sheets.gameAssets.Level1Hint1)
package jk.app.display.windows.sheets.gameAssets {
import flash.display.*;
public dynamic class Level1Hint1 extends Sprite {
}
}//package jk.app.display.windows.sheets.gameAssets
Section 239
//Theater (jk.app.display.windows.sheets.gameAssets.Theater)
package jk.app.display.windows.sheets.gameAssets {
import jk.engine.theater.*;
import com.greensock.*;
import fl.motion.easing.*;
public class Theater extends Theater {
public function removeActorWithEffect(_arg1:Actor):void{
var _local2:int;
var _local3:Object;
while (_local2 < actors.length) {
if (actors[_local2] == _arg1){
_arg1.onRemovingFromTheater();
_actors.splice(_local2, 1);
_arg1.parent.setChildIndex(_arg1, 0);
_local3 = {scaleX:0, scaleY:0, ease:Cubic.easeInOut, onComplete:onRemoving_Tween_Complete, onCompleteParams:[_arg1]};
TweenLite.to(_arg1, 0.65, _local3);
return;
};
_local2++;
};
}
private function onRemoving_Tween_Complete(_arg1:Actor):void{
_actorsHolder.removeActor(_arg1);
ActorPool.release(_arg1);
}
}
}//package jk.app.display.windows.sheets.gameAssets
Section 240
//Theater (jk.app.display.windows.sheets.levelEditorAssets.Theater)
package jk.app.display.windows.sheets.levelEditorAssets {
import jk.engine.theater.edit.*;
public dynamic class Theater extends EditableTheater {
}
}//package jk.app.display.windows.sheets.levelEditorAssets
Section 241
//AnimatedStar (jk.app.display.windows.sheets.levelSelectionAssets.levelSelectorAssets.AnimatedStar)
package jk.app.display.windows.sheets.levelSelectionAssets.levelSelectorAssets {
import flash.display.*;
public dynamic class AnimatedStar extends MovieClip {
}
}//package jk.app.display.windows.sheets.levelSelectionAssets.levelSelectorAssets
Section 242
//LevelSelector (jk.app.display.windows.sheets.levelSelectionAssets.LevelSelector)
package jk.app.display.windows.sheets.levelSelectionAssets {
import flash.display.*;
import flash.text.*;
public class LevelSelector extends MovieClip {
public var txtNumber:TextField;
public var levelIndex:int;
public function LevelSelector(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package jk.app.display.windows.sheets.levelSelectionAssets
Section 243
//Game (jk.app.display.windows.sheets.Game)
package jk.app.display.windows.sheets {
import jk.engine.utils.*;
import jk.engine.theater.*;
import flash.geom.*;
import flash.events.*;
import jk.engine.common.*;
import jk.engine.display.windows.*;
import jk.engine.ui.*;
import jk.app.display.windows.sheets.gameAssets.*;
import jk.app.theater.actors.*;
public class Game extends Sheet {
private var _hintMgr:HintManager;
private var _theater:Theater;
private var _bound:Rectangle;
private var _mode:int;
private var _levelPack:LevelPack;
private var _score:int;
private var _cursorInformer:CursorInformer;
private var _contactListener:ContactListener;
private var _numHeroes:uint;
private static const _NONE:int = 0;
private static const _CUSTOM:int = 1;
private static const _OFFICIAL:int = 2;
private static const _DEATH_DIST:Number = (4 * ((Settings.HEIGHT > Settings.WIDTH)) ? Settings.HEIGHT : Settings.WIDTH);
public function Game(){
_hintMgr = new HintManager();
_theater = new Theater();
_bound = new Rectangle(0, 0, Settings.WIDTH, Settings.HEIGHT);
_cursorInformer = new CursorInformer();
_contactListener = new ContactListener();
_hintMgr.add(0, [new Level0Hint1(), new Level0Hint2()]);
_hintMgr.add(1, [new Level1Hint1()]);
_theater.world.SetContactListener(_contactListener);
addChild(_hintMgr);
addChild(_theater);
addChild(_cursorInformer);
}
override public function initialize():void{
var _local1:Object;
selectMode();
if (_mode == _CUSTOM){
GATracker.trackPageview("/Game - Custom", false);
guiMgr.hud.state = "GameCustomLevel";
_local1 = LevelCode.decode(_initOptions.levelCode);
_score = (Settings.GAME_INIT_SCORE + 1);
} else {
if (_mode == _OFFICIAL){
GATracker.trackPageview("/Game - Official", false);
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 {
close();
};
};
_theater.code = _local1.theater;
updateHUD();
_numHeroes = _theater.numActorsOf(Hero);
}
override public function postInitialize():void{
addEventListener(Event.ENTER_FRAME, onEnterFrame);
guiMgr.hud.btnEditLevel.addEventListener(MouseEvent.CLICK, onHUD_EditLevel_Click);
guiMgr.hud.btnSelectLevel.addEventListener(MouseEvent.CLICK, onHUD_SelectLevel_Click);
guiMgr.hud.btnRestart.addEventListener(MouseEvent.CLICK, onHUD_Restart_Click);
guiMgr.hud.btnHint.addEventListener(MouseEvent.CLICK, onHUD_Hint_Click);
_theater.actorsHolder.addEventListener(MouseEvent.CLICK, onTheater_ActorsHolder_Click);
if (_mode == _OFFICIAL){
_hintMgr.show(_initOptions.levelIndex);
};
}
override public function shutdown():void{
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
guiMgr.hud.btnEditLevel.removeEventListener(MouseEvent.CLICK, onHUD_EditLevel_Click);
guiMgr.hud.btnSelectLevel.removeEventListener(MouseEvent.CLICK, onHUD_SelectLevel_Click);
guiMgr.hud.btnRestart.removeEventListener(MouseEvent.CLICK, onHUD_Restart_Click);
guiMgr.hud.btnHint.removeEventListener(MouseEvent.CLICK, onHUD_Hint_Click);
_theater.actorsHolder.removeEventListener(MouseEvent.CLICK, onTheater_ActorsHolder_Click);
_cursorInformer.type = CursorInformer.EMPTY;
}
override public function postShutdown():void{
_contactListener.clear();
_theater.removeAllActors();
_hintMgr.hide();
}
private function updateCursorInformer():void{
var _local1:Shape;
if (_cursorInformer.type != CursorInformer.TIMER){
_local1 = (_theater.getActorAtMouse() as Shape);
if (((_local1) && (_local1.bitParams.getBit("clickable")))){
_cursorInformer.type = CursorInformer.DELETE;
} else {
_cursorInformer.type = CursorInformer.EMPTY;
};
};
}
private function selectMode():void{
if (_initOptions.hasOwnProperty("levelCode")){
_mode = _CUSTOM;
} else {
if (((_initOptions.hasOwnProperty("levelPack")) && (_initOptions.hasOwnProperty("levelIndex")))){
_mode = _OFFICIAL;
} else {
_mode = _NONE;
};
};
}
private function levelFailed():void{
Main.engine.soundMgr.playSFX("Fail");
if (_mode == _CUSTOM){
guiMgr.openWindow("CustomLevelFailed", {levelCode:_initOptions.levelCode});
} else {
if (_mode == _OFFICIAL){
restart();
};
};
}
private function levelComplete():void{
Main.engine.soundMgr.playSFX("Win");
if (_mode == _CUSTOM){
guiMgr.openWindow("CustomLevelComplete", {levelCode:_initOptions.levelCode});
} 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});
} else {
if (!_levelPack.beaten){
GATracker.trackEvent("Game", "All levels are 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!\n\nThanks for the game!"});
return;
};
guiMgr.openWindow("LevelSelection", {levelPack:_levelPack});
};
};
};
}
private function checkWin():void{
var _local2:Actor;
if (_contactListener.fail){
levelFailed();
return;
};
var _local1:int = (_theater.actors.length - 1);
for (;_local1 > -1;_local1--) {
_local2 = _theater.actors[_local1];
if (_local2.y > _bound.bottom){
if ((((_local2 as Hero)) || ((_local2 as Platform)))){
levelFailed();
return;
};
if (_local2.y > _DEATH_DIST){
_theater.removeActor(_local2);
continue;
};
};
};
if (_numHeroes != _contactListener.numheroesOnPlatform){
return;
};
levelComplete();
}
private function updateHUD():void{
if ((((_mode == _OFFICIAL)) || ((_mode == _CUSTOM)))){
if (_score){
_score--;
guiMgr.hud.txtScore.text = ("Score: " + _score);
};
};
}
private function onEnterFrame(_arg1:Event):void{
if (guiMgr.sheetOverlapping){
_cursorInformer.type = CursorInformer.EMPTY;
return;
};
if (Main.engine.keyboardMgr.isKeyDown(KeyboardManager.R)){
restart();
};
_theater.step();
updateHUD();
checkWin();
updateCursorInformer();
}
private function onHUD_EditLevel_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("LevelEditor", {levelCode:_initOptions.levelCode});
}
private function onHUD_SelectLevel_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("LevelSelection", {levelPack:_levelPack});
}
private function onHUD_Restart_Click(_arg1:MouseEvent):void{
restart();
}
private function onHUD_Hint_Click(_arg1:MouseEvent):void{
GATracker.trackEvent("HUD", "Click", "Solutions");
openURL(Settings.HINT_URL);
}
private function onTheater_ActorsHolder_Click(_arg1:MouseEvent):void{
if (_cursorInformer.type == CursorInformer.DELETE){
_theater.removeActorWithEffect(_theater.getActorAtMouse());
_cursorInformer.type = CursorInformer.TIMER;
Main.engine.soundMgr.playSFX("Click");
};
}
}
}//package jk.app.display.windows.sheets
Section 244
//LevelEditor (jk.app.display.windows.sheets.LevelEditor)
package jk.app.display.windows.sheets {
import flash.events.*;
import jk.engine.common.*;
import jk.engine.display.windows.*;
import jk.app.display.windows.dialogs.*;
import jk.app.display.windows.sheets.levelEditorAssets.*;
import jk.app.theater.actors.*;
public class LevelEditor extends Sheet {
public var theater:Theater;
private var _panel:LevelEditorPanel;
private var _needSyncTheater:Boolean;
public function LevelEditor(){
theater.dragStep = 2.5;
theater.gridStep = 0;
}
override public function initialize():void{
var _local1:Object;
GATracker.trackPageview("/Level Editor", false);
guiMgr.hud.state = "LevelEditor";
_panel = (guiMgr.openWindow("LevelEditorPanel", {}) as LevelEditorPanel);
if (_initOptions.levelCode){
_local1 = LevelCode.decode(_initOptions.levelCode);
theater.code = _local1.theater;
};
}
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);
}
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);
}
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;
};
guiMgr.openWindow("SaveLoadLevel", {levelCode:LevelCode.encode({theater:theater.code}), loadCallback:loadCallback});
}
private function onClear_Click(_arg1:MouseEvent):void{
var yesCallback:Function;
var e = _arg1;
yesCallback = function ():void{
theater.removeAllActors();
};
guiMgr.openWindow("YesNo", {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{
var _local2:Boolean = theater.hasActorOf(Hero);
var _local3:Boolean = theater.hasActorOf(Platform);
if (!((_local2) || (_local3))){
guiMgr.openWindow("Message", {title:"MESSAGE", message:"Please add Fox and Roll."});
} else {
if (!_local2){
guiMgr.openWindow("Message", {title:"MESSAGE", message:"Please add Roll."});
} else {
if (!_local3){
guiMgr.openWindow("Message", {title:"MESSAGE", message:"Please add Fox."});
} else {
guiMgr.openWindow("Game", {levelCode:LevelCode.encode({theater:theater.code})});
};
};
};
}
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;
}
}
}//package jk.app.display.windows.sheets
Section 245
//LevelSelection (jk.app.display.windows.sheets.LevelSelection)
package jk.app.display.windows.sheets {
import flash.events.*;
import jk.engine.common.*;
import com.greensock.*;
import jk.engine.display.windows.*;
import flash.text.*;
import fl.motion.easing.*;
import mochi.as3.*;
import jk.app.display.buttons.*;
import jk.app.display.windows.sheets.levelSelectionAssets.*;
public class LevelSelection extends Sheet {
private const _LS_NUM:int = 30;
public var ls26:LevelSelector;
public var ls17:LevelSelector;
public var txtScore:TextField;
public var ls27:LevelSelector;
public var ls18:LevelSelector;
public var ls28:LevelSelector;
public var ls19:LevelSelector;
public var ls29: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 ls20:LevelSelector;
public var ls11:LevelSelector;
public var ls6:LevelSelector;
public var ls30:LevelSelector;
public var ls21:LevelSelector;
public var ls12:LevelSelector;
public var ls7:LevelSelector;
public var ls22:LevelSelector;
public var ls13:LevelSelector;
public var ls8:LevelSelector;
public var ls23:LevelSelector;
public var ls14:LevelSelector;
public var ls9:LevelSelector;
public var ls24:LevelSelector;
public var ls15:LevelSelector;
public var ls25: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;
GATracker.trackPageview("/Level Selection", false);
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.gotoAndStop("closed");
};
} else {
_levelSelectors[_local1].visible = false;
};
_local1++;
};
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++;
};
}
override public function shutdown():void{
var _local1:int;
btnMainMenu.removeEventListener(MouseEvent.CLICK, onMainMenu_Click);
btnSubmit.removeEventListener(MouseEvent.CLICK, onSubmit_Click);
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++;
};
}
private function onLevelSelector_MouseOver(_arg1:MouseEvent):void{
var _local2:* = _arg1.currentTarget;
TweenLite.to(_local2, 1, {scaleX:1.5, scaleY:1.5, ease:Elastic.easeOut});
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});
guiMgr.openWindow("Game", {levelIndex:_local2.levelIndex, levelPack:_levelPack});
txtScore.text = "";
}
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;
};
GATracker.trackEvent("Level Selection", "Click", "Submit");
if (!_levelPack.totalScore){
return;
};
guiMgr.frozen = true;
MochiScores.showLeaderboard({boardID:Settings.HIGHSCORES_LEADERBOARD_ID, score:_levelPack.totalScore, onClose:onClose});
}
}
}//package jk.app.display.windows.sheets
Section 246
//MainMenu (jk.app.display.windows.sheets.MainMenu)
package jk.app.display.windows.sheets {
import jk.engine.utils.*;
import flash.events.*;
import jk.engine.display.windows.*;
import mochi.as3.*;
import jk.app.display.buttons.*;
public class MainMenu extends Sheet {
public var btnCustomLevel:BtnCustomLevel;
public var btnMoreGames:BtnMoreGames;
public var btnStart:BtnStart;
public var btnHighscores:BtnHighscores;
public var btnLevelEditor:BtnLevelEditor;
override public function initialize():void{
GATracker.trackPageview("/Main Menu", false);
guiMgr.hud.state = "MainMenu";
}
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);
}
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);
}
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;
};
GATracker.trackEvent("Main Menu", "Click", "Highscores");
guiMgr.frozen = true;
MochiScores.showLeaderboard({boardID:Settings.HIGHSCORES_LEADERBOARD_ID, onClose:onClose});
}
private function onLevelEditor_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("LevelEditor", {});
}
private function onMoreGames_Click(_arg1:MouseEvent):void{
GATracker.trackEvent("Main Menu", "Click", "More Games!");
openURL(Settings.MORE_GAMES_MAIN_MENU_URL);
}
}
}//package jk.app.display.windows.sheets
Section 247
//Background (jk.app.display.Background)
package jk.app.display {
import flash.display.*;
import com.greensock.*;
import fl.motion.easing.*;
import jk.app.display.backgroundAssets.*;
public class Background extends Sprite {
private static const _NUM_STARS:int = 64;
private static const _X_DELTA:Number = 10.9375;
public function Background(){
var _local1:int;
var _local2:Star;
var _local3:TweenLite;
super();
while (_local1 < _NUM_STARS) {
_local2 = new Star();
_local2.defaultX = ((_X_DELTA * _local1) + 128);
addChild(_local2);
_local3 = TweenLite.to(_local2, 1, {});
_local3.vars["onComplete"] = onTween_Complete;
_local3.vars["onCompleteParams"] = [_local3];
setupTween(_local3);
_local3.currentTime = (Math.random() * (_local3.duration + _local3.delay));
_local1++;
};
}
private function setupTween(_arg1:TweenLite):void{
var _local2:Star;
_local2 = (_arg1.target as Star);
_local2.x = _local2.defaultX;
_local2.y = ((-(Settings.HEIGHT) * Math.random()) - 16);
_local2.scaleX = (0.5 + (0.5 * Math.random()));
_local2.scaleY = _local2.scaleX;
_arg1.vars["x"] = ((_local2.x - (128 * Math.random())) - 128);
_arg1.vars["y"] = (Settings.HEIGHT + 100);
_arg1.vars["rotation"] = (360 * Math.random());
_arg1.vars["ease"] = Linear.easeNone;
_arg1.duration = (32 + (16 * Math.random()));
_arg1.delay = (16 * Math.random());
}
private function onTween_Complete(_arg1:TweenLite):void{
setupTween(_arg1);
_arg1.invalidate();
_arg1.restart(true);
}
}
}//package jk.app.display
Section 248
//HUD (jk.app.display.HUD)
package jk.app.display {
import flash.display.*;
import jk.engine.display.*;
import flash.text.*;
import jk.app.display.buttons.*;
import jk.app.display.hudAssets.*;
public class HUD extends HUD {
public var txtScore:TextField;
public var adGame1:MovieClip;
public var adGame2:MovieClip;
public var btnSelectLevel:BtnSelectLevel;
public var soundOnOff:SoundOnOff;
public var btnHint:BtnHint;
public var txtLevelIndex:TextField;
public var btnSponsorLogo:SimpleButton;
public var btnEditLevel:BtnEditLevel;
public var socialButtons:MovieClip;
public var btnRestart:BtnRestart;
public function HUD(_arg1:Array=null){
super(_arg1);
}
}
}//package jk.app.display
Section 249
//Bar (jk.app.preloader.progressBarAssets.Bar)
package jk.app.preloader.progressBarAssets {
import flash.display.*;
public dynamic class Bar extends Sprite {
}
}//package jk.app.preloader.progressBarAssets
Section 250
//ProgressBar (jk.app.preloader.ProgressBar)
package jk.app.preloader {
import flash.display.*;
import jk.app.preloader.progressBarAssets.*;
public dynamic class ProgressBar extends Sprite {
public var bar:Bar;
}
}//package jk.app.preloader
Section 251
//Eye (jk.app.theater.actors.rollAssets.Eye)
package jk.app.theater.actors.rollAssets {
import flash.display.*;
import flash.geom.*;
import flash.events.*;
public class Eye extends Sprite {
public var pupil:Pupil;
private var _mousePos:Point;
private static const _RADIUS:Number = 3.5;
public function Eye(){
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
_mousePos = new Point(mouseX, mouseY);
}
private function onAddedToStage(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
private function onRemovedFromStage(_arg1:Event):void{
removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function onEnterFrame(_arg1:Event):void{
_mousePos.x = mouseX;
_mousePos.y = mouseY;
if (_mousePos.length <= _RADIUS){
pupil.x = _mousePos.x;
pupil.y = _mousePos.y;
} else {
_mousePos.normalize(1);
pupil.x = (_RADIUS * _mousePos.x);
pupil.y = (_RADIUS * _mousePos.y);
};
}
}
}//package jk.app.theater.actors.rollAssets
Section 252
//Pupil (jk.app.theater.actors.rollAssets.Pupil)
package jk.app.theater.actors.rollAssets {
import flash.display.*;
public dynamic class Pupil extends Sprite {
}
}//package jk.app.theater.actors.rollAssets
Section 253
//Evil (jk.app.theater.actors.Evil)
package jk.app.theater.actors {
import jk.engine.theater.actors.*;
public class Evil extends Shape {
override protected function setupEditableParams():void{
super.setupEditableParams();
_editableParams.removeParam("width");
_editableParams.removeParam("height");
}
}
}//package jk.app.theater.actors
Section 254
//Hero (jk.app.theater.actors.Hero)
package jk.app.theater.actors {
import jk.app.theater.actors.rollAssets.*;
import jk.engine.theater.actors.*;
public class Hero extends Shape {
public var leftEye:Eye;
public var rightEye:Eye;
override protected function setupEditableParams():void{
super.setupEditableParams();
_editableParams.removeParam("width");
_editableParams.removeParam("height");
}
}
}//package jk.app.theater.actors
Section 255
//Platform (jk.app.theater.actors.Platform)
package jk.app.theater.actors {
import jk.engine.theater.actors.*;
public class Platform extends Shape {
override protected function setupBitParams():void{
super.setupBitParams();
_bitParams.setBitDefaultValue("static", true);
}
override protected function setupEditableParams():void{
super.setupEditableParams();
_editableParams.removeParam("width");
_editableParams.removeParam("height");
}
}
}//package jk.app.theater.actors
Section 256
//Shape (jk.app.theater.actors.Shape)
package jk.app.theater.actors {
import jk.engine.theater.edit.params.*;
import jk.engine.utils.*;
import jk.engine.theater.actors.*;
import flash.filters.*;
public class Shape extends Shape {
override protected function setupBitParams():void{
super.setupBitParams();
_bitParams.addBit("clickable", true, onBitParams_Clickable_Changed);
}
override protected function setupEditableParams():void{
super.setupEditableParams();
_editableParams.addParam(new BooleanParam("clickable", "clickable", true));
_editableParams.removeParam("width");
_editableParams.removeParam("height");
}
protected function onBitParams_Clickable_Changed(_arg1:Boolean, _arg2:Boolean):void{
if (_arg2){
filters = [];
} else {
filters = [new ColorMatrixFilter(ColorMatrixArrays.GRAYSCALE)];
};
}
}
}//package jk.app.theater.actors
Section 257
//Achievement (jk.engine.common.Achievement)
package jk.engine.common {
class Achievement {
var name:String;
var obtained:Boolean;
function Achievement(_arg1:String){
name = _arg1;
}
}
}//package jk.engine.common
Section 258
//AchievementManager (jk.engine.common.AchievementManager)
package jk.engine.common {
import jk.engine.utils.*;
public class AchievementManager {
protected var _achievements:Array;
protected var _onObtain:JKEvent;
public function AchievementManager(){
_achievements = new Array();
_onObtain = new JKEvent();
}
public function get onObtain():JKEvent{
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 jk.engine.common
Section 259
//LevelCode (jk.engine.common.LevelCode)
package jk.engine.common {
import jk.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 (JKCode.encodeObject(_arg1, paramNames, delimiter));
}
public static function decode(_arg1:String):Object{
return (JKCode.decodeObject(_arg1, paramNames, delimiter));
}
}
}//package jk.engine.common
Section 260
//LevelManager (jk.engine.common.LevelManager)
package jk.engine.common {
import jk.engine.utils.*;
public class LevelManager {
protected var _levelPacks:Array;
protected var _onChange:JKEvent;
public function LevelManager(){
_levelPacks = new Array();
_onChange = new JKEvent();
}
public function get onChange():JKEvent{
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 jk.engine.common
Section 261
//LevelPack (jk.engine.common.LevelPack)
package jk.engine.common {
import jk.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:JKEvent;
public function LevelPack(){
_levelCodes = new Array();
_scores = new Array();
_onChange = new JKEvent();
}
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():JKEvent{
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 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 jk.engine.common
Section 262
//Dialog (jk.engine.display.windows.Dialog)
package jk.engine.display.windows {
import jk.engine.display.*;
public class Dialog extends Window {
public function Dialog(){
_openTweenTime = Settings.DIALOG_OPEN_TWEEN_TIME;
_closeTweenTime = Settings.DIALOG_CLOSE_TWEEN_TIME;
}
}
}//package jk.engine.display.windows
Section 263
//ModalDialog (jk.engine.display.windows.ModalDialog)
package jk.engine.display.windows {
import jk.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 jk.engine.display.windows
Section 264
//Sheet (jk.engine.display.windows.Sheet)
package jk.engine.display.windows {
import flash.geom.*;
import jk.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 jk.engine.display.windows
Section 265
//DialogBackground (jk.engine.display.DialogBackground)
package jk.engine.display {
import flash.display.*;
import flash.text.*;
public dynamic class DialogBackground extends MovieClip {
public var txtInfoDimensions:TextField;
public function DialogBackground(){
addFrameScript(0, frame1);
}
function frame1(){
txtInfoDimensions.text = ((Math.round(width) + "x") + Math.round(height));
}
}
}//package jk.engine.display
Section 266
//Dummy (jk.engine.display.Dummy)
package jk.engine.display {
import flash.display.*;
public class Dummy extends Sprite {
public function Dummy(){
graphics.beginFill(0, 0);
graphics.drawRect(0, 0, Settings.WIDTH, Settings.HEIGHT);
graphics.endFill();
}
}
}//package jk.engine.display
Section 267
//GUIManager (jk.engine.display.GUIManager)
package jk.engine.display {
import flash.display.*;
import jk.engine.utils.*;
import flash.utils.*;
import com.greensock.*;
import jk.engine.display.windows.*;
import jk.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:JKEvent;
protected var _onSheetOpening:JKEvent;
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 JKEvent();
_onSheetOpening = new JKEvent();
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():JKEvent{
return (_onChange);
}
public function get onSheetOpening():JKEvent{
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 jk.engine.display
Section 268
//HUD (jk.engine.display.HUD)
package jk.engine.display {
import flash.display.*;
import jk.engine.utils.*;
import flash.utils.*;
import jk.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 jk.engine.display
Section 269
//PanelBackground (jk.engine.display.PanelBackground)
package jk.engine.display {
import flash.display.*;
import flash.text.*;
public dynamic class PanelBackground extends MovieClip {
public var txtInfoDimensions:TextField;
public function PanelBackground(){
addFrameScript(0, frame1);
}
function frame1(){
txtInfoDimensions.text = ((Math.round(width) + "x") + Math.round(height));
}
}
}//package jk.engine.display
Section 270
//SheetBackground (jk.engine.display.SheetBackground)
package jk.engine.display {
import flash.display.*;
import flash.text.*;
public dynamic class SheetBackground extends MovieClip {
public var txtInfoDimensions:TextField;
public function SheetBackground(){
addFrameScript(0, frame1);
}
function frame1(){
txtInfoDimensions.text = ((Math.round(width) + "x") + Math.round(height));
}
}
}//package jk.engine.display
Section 271
//Window (jk.engine.display.Window)
package jk.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 jk.engine.display
Section 272
//WindowAction (jk.engine.display.WindowAction)
package jk.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 jk.engine.display
Section 273
//MusicPlayListItem (jk.engine.sound.MusicPlayListItem)
package jk.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 jk.engine.sound
Section 274
//SoundManager (jk.engine.sound.SoundManager)
package jk.engine.sound {
import jk.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:JKEvent;
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 JKEvent();
}
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():JKEvent{
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 jk.engine.sound
Section 275
//Shape (jk.engine.theater.actors.Shape)
package jk.engine.theater.actors {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Contacts.*;
import Box2D.Dynamics.*;
import jk.engine.theater.edit.params.*;
import jk.engine.utils.*;
import jk.engine.theater.*;
public class Shape extends Actor {
protected var _body:b2Body;
protected var _originalWidth:Number;
protected var _originalHeight:Number;
public function Shape(){
_originalWidth = width;
_originalHeight = height;
}
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 (_buildingParams.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 (_buildingParams.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 = (Settings.PHYS_SCALE * _body.GetPosition().x);
y = (Settings.PHYS_SCALE * _body.GetPosition().y);
rotation = UMath.rad2Deg(_body.GetAngle());
};
}
override public function syncPhys():Boolean{
if (super.syncPhys()){
_body.SetXForm(new b2Vec2((Settings.INV_PHYS_SCALE * x), (Settings.INV_PHYS_SCALE * y)), UMath.deg2Rad(rotation));
return (true);
};
return (false);
}
public function inContactWith(_arg1:Class):Boolean{
var _local2:b2ContactEdge = _body.GetContactList();
while (_local2) {
if ((_local2.other.GetUserData() is _arg1)){
return (true);
};
_local2 = _local2.next;
};
return (false);
}
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.scaleX = 1;
_buildingParams.scaleY = 1;
}
override protected function build():void{
var _local2:int;
scaleX = _buildingParams.scaleX;
scaleY = _buildingParams.scaleY;
var _local1:b2BodyDef = new b2BodyDef();
_local1.position.x = (Settings.INV_PHYS_SCALE * _buildingParams.x);
_local1.position.y = (Settings.INV_PHYS_SCALE * _buildingParams.y);
_local1.angle = UMath.deg2Rad(_buildingParams.rotation);
_local1.userData = this;
_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{
_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 onBitParams_Static_Change(_arg1:Boolean, _arg2:Boolean):void{
if (_body){
if (_arg2){
_body.SetMass(new b2MassData());
} else {
_body.SetMassFromShapes();
};
};
}
}
}//package jk.engine.theater.actors
Section 276
//BooleanParam (jk.engine.theater.edit.params.BooleanParam)
package jk.engine.theater.edit.params {
import jk.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 jk.engine.theater.edit.params
Section 277
//NumericParam (jk.engine.theater.edit.params.NumericParam)
package jk.engine.theater.edit.params {
import jk.engine.utils.*;
import jk.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 jk.engine.theater.edit.params
Section 278
//Param (jk.engine.theater.edit.params.Param)
package jk.engine.theater.edit.params {
import jk.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 jk.engine.theater.edit.params
Section 279
//Border (jk.engine.theater.edit.paramsEditorAssets.Border)
package jk.engine.theater.edit.paramsEditorAssets {
import flash.display.*;
public dynamic class Border extends Sprite {
}
}//package jk.engine.theater.edit.paramsEditorAssets
Section 280
//BtnClose (jk.engine.theater.edit.paramsEditorAssets.BtnClose)
package jk.engine.theater.edit.paramsEditorAssets {
import flash.display.*;
public dynamic class BtnClose extends Sprite {
}
}//package jk.engine.theater.edit.paramsEditorAssets
Section 281
//Title (jk.engine.theater.edit.paramsEditorAssets.Title)
package jk.engine.theater.edit.paramsEditorAssets {
import flash.display.*;
public dynamic class Title extends MovieClip {
public function Title(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package jk.engine.theater.edit.paramsEditorAssets
Section 282
//BtnCopy (jk.engine.theater.edit.transformToolAssets.BtnCopy)
package jk.engine.theater.edit.transformToolAssets {
import flash.display.*;
public dynamic class BtnCopy extends Sprite {
}
}//package jk.engine.theater.edit.transformToolAssets
Section 283
//BtnDelete (jk.engine.theater.edit.transformToolAssets.BtnDelete)
package jk.engine.theater.edit.transformToolAssets {
import flash.display.*;
public dynamic class BtnDelete extends Sprite {
}
}//package jk.engine.theater.edit.transformToolAssets
Section 284
//BtnProps (jk.engine.theater.edit.transformToolAssets.BtnProps)
package jk.engine.theater.edit.transformToolAssets {
import flash.display.*;
public dynamic class BtnProps extends Sprite {
}
}//package jk.engine.theater.edit.transformToolAssets
Section 285
//Circle (jk.engine.theater.edit.transformToolAssets.Circle)
package jk.engine.theater.edit.transformToolAssets {
import flash.display.*;
public dynamic class Circle extends Sprite {
}
}//package jk.engine.theater.edit.transformToolAssets
Section 286
//Rotator (jk.engine.theater.edit.transformToolAssets.Rotator)
package jk.engine.theater.edit.transformToolAssets {
import flash.display.*;
public dynamic class Rotator extends MovieClip {
public function Rotator(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package jk.engine.theater.edit.transformToolAssets
Section 287
//EditableParams (jk.engine.theater.edit.EditableParams)
package jk.engine.theater.edit {
import jk.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 jk.engine.theater.edit
Section 288
//EditableTheater (jk.engine.theater.edit.EditableTheater)
package jk.engine.theater.edit {
import flash.display.*;
import jk.engine.theater.*;
import flash.geom.*;
import flash.events.*;
import flash.filters.*;
public class EditableTheater extends Theater {
var transformTool:TransformTool;
var paramsEditor:ParamsEditor;
protected var _gridHolder:Sprite;
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 Sprite();
_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 jk.engine.theater.edit
Section 289
//ParamsEditor (jk.engine.theater.edit.ParamsEditor)
package jk.engine.theater.edit {
import fl.controls.*;
import flash.display.*;
import jk.engine.theater.edit.params.*;
import jk.engine.theater.*;
import flash.events.*;
import fl.data.*;
import fl.events.*;
import jk.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 jk.engine.theater.edit
Section 290
//TransformTool (jk.engine.theater.edit.TransformTool)
package jk.engine.theater.edit {
import flash.display.*;
import jk.engine.utils.*;
import jk.engine.theater.*;
import flash.events.*;
import jk.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 jk.engine.theater.edit
Section 291
//Actor (jk.engine.theater.Actor)
package jk.engine.theater {
import flash.display.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import jk.engine.utils.*;
import flash.utils.*;
import jk.engine.theater.edit.*;
public class Actor extends MovieClip {
var dragging:Boolean;
var dragOffsetX:Number;
var dragOffsetY:Number;
protected var _className:String;
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(){
mouseChildren = false;
_className = getQualifiedClassName(this);
_buildingParams = new Object();
_bitParams = new BitField();
_editableParams = new EditableParams();
_transformToolPolicy = new BitField();
setupBitParams();
setupEditableParams();
setupTransformToolPolicy();
}
public function get className():String{
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 decode(_arg1:String):Object{
return (new Object());
}
public function step():void{
}
public function syncPhys():Boolean{
if (((!(inTheater)) || (dragging))){
return (false);
};
return (true);
}
public function onAcquire():void{
restore2default();
setupActorBuildingParams(className, _buildingParams);
}
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;
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;
}
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((Settings.HALF_INV_PHYS_SCALE * _arg1), (Settings.HALF_INV_PHYS_SCALE * _arg2), new b2Vec2((Settings.INV_PHYS_SCALE * _arg3), (Settings.INV_PHYS_SCALE * _arg4)), UMath.deg2Rad(_arg5));
} else {
_local6.SetAsBox((Settings.HALF_INV_PHYS_SCALE * _arg1), (Settings.HALF_INV_PHYS_SCALE * _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 = (Settings.INV_PHYS_SCALE * _arg1);
if (((_arg2) || (_arg3))){
_local4.localPosition.Set((Settings.INV_PHYS_SCALE * _arg2), (Settings.INV_PHYS_SCALE * _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 * Settings.INV_PHYS_SCALE) * _arg1[_local3][0]), ((scaleY * Settings.INV_PHYS_SCALE) * _arg1[_local3][1]));
_local3++;
};
_local2.vertexCount = _arg1.length;
return (_local2);
}
}
}//package jk.engine.theater
Section 292
//ActorPool (jk.engine.theater.ActorPool)
package jk.engine.theater {
import jk.engine.utils.*;
import flash.utils.*;
public class ActorPool {
private static var _actors:Array = new Array();
public static function acquire(_arg1:String):Actor{
var _local3:int;
var _local2:Actor;
while (_local3 < _actors.length) {
if (_actors[_local3].className == _arg1){
_local2 = _actors[_local3];
_actors.splice(_local3, 1);
break;
};
_local3++;
};
if (!_local2){
_local2 = new ((getDefinitionByName(_arg1) as Class));
};
if (_local2){
_local2.onAcquire();
};
return (_local2);
}
public static function release(_arg1:Actor):void{
UArray.pushUnique(_actors, _arg1);
}
}
}//package jk.engine.theater
Section 293
//ActorsHolder (jk.engine.theater.ActorsHolder)
package jk.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 jk.engine.theater
Section 294
//Theater (jk.engine.theater.Theater)
package jk.engine.theater {
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import jk.engine.utils.*;
import flash.geom.*;
import flash.events.*;
public class Theater extends Sprite {
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 _dragBounds:Rectangle;
protected var _dragStep:Number;
protected static var _someVec2:b2Vec2 = new b2Vec2();
protected static var _someAABB:b2AABB = new b2AABB();
public function Theater(){
dragBounds = new Rectangle();
_actors = new Array();
_bounds = new Rectangle();
_background = new Sprite();
_actorsHolder = new ActorsHolder();
_draggingActors = new Array();
_dragStep = 0;
while (numChildren) {
_background.addChild(removeChildAt(0));
};
addChild(_background);
addChild(_actorsHolder);
if (!((width) && (height))){
_background.graphics.beginFill(0, 0);
_background.graphics.drawRect(0, 0, Settings.THEATER_WIDTH, Settings.THEATER_HEIGHT);
_background.graphics.endFill();
_bounds.width = Settings.THEATER_WIDTH;
_bounds.height = Settings.THEATER_HEIGHT;
} else {
_bounds.width = Math.ceil((width / scaleX));
_bounds.height = Math.ceil((height / scaleY));
};
var _local1:Number = 0x0200;
var _local2:b2AABB = new b2AABB();
_local2.lowerBound.Set((-(Settings.INV_PHYS_SCALE) * _local1), (-(Settings.INV_PHYS_SCALE) * _local1));
_local2.upperBound.Set((Settings.INV_PHYS_SCALE * (width + _local1)), (Settings.INV_PHYS_SCALE * (height + _local1)));
_world = new b2World(_local2, new b2Vec2(Settings.DEFAULT_GRAVITY_X, Settings.DEFAULT_GRAVITY_Y), true);
dragBounds.width = _bounds.width;
dragBounds.height = _bounds.height;
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 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.onAcquire();
_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 _local2:int;
world.Step(_arg1, Settings.PHYS_ITERATIONS);
while (_local2 < _actors.length) {
_actors[_local2].step();
_local2++;
};
}
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) {
_local1.SetLinearVelocity(b2Math.b2Vec2_zero);
_local1.SetAngularVelocity(0);
_local1 = _local1.GetNext();
};
}
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;
var _local5:int;
_someVec2.Set((Settings.INV_PHYS_SCALE * _arg1), (Settings.INV_PHYS_SCALE * _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);
while (_local5 < _local4.length) {
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 _local5:int;
var _local3:Array = new Array();
_someVec2.Set((Settings.INV_PHYS_SCALE * _arg1), (Settings.INV_PHYS_SCALE * _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);
while (_local5 < _local4.length) {
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 jk.engine.theater
Section 295
//KeyboardManager (jk.engine.ui.KeyboardManager)
package jk.engine.ui {
import flash.display.*;
import jk.engine.utils.*;
import flash.events.*;
public class KeyboardManager {
private var _isKeyDown:Array;
private var _onKeyDown:JKEvent;
private var _onKeyUp:JKEvent;
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 JKEvent();
_onKeyUp = new JKEvent();
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():JKEvent{
return (_onKeyDown);
}
public function get onKeyUp():JKEvent{
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 jk.engine.ui
Section 296
//BasicFiller (jk.engine.utils.graphicsFill.BasicFiller)
package jk.engine.utils.graphicsFill {
import flash.display.*;
import flash.geom.*;
import jk.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 jk.engine.utils.graphicsFill
Section 297
//Bubble (jk.engine.utils.graphicsFill.Bubble)
package jk.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 jk.engine.utils.graphicsFill
Section 298
//Bubbles (jk.engine.utils.graphicsFill.Bubbles)
package jk.engine.utils.graphicsFill {
import flash.display.*;
import flash.geom.*;
import jk.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 jk.engine.utils.graphicsFill
Section 299
//Left2Right (jk.engine.utils.graphicsFill.Left2Right)
package jk.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 jk.engine.utils.graphicsFill
Section 300
//Bit (jk.engine.utils.Bit)
package jk.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 jk.engine.utils
Section 301
//BitField (jk.engine.utils.BitField)
package jk.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 jk.engine.utils
Section 302
//ColorMatrixArrays (jk.engine.utils.ColorMatrixArrays)
package jk.engine.utils {
public class ColorMatrixArrays {
public static const DIGITAL_NEGATIVE:Array = [-1, 0, 0, 0, 0xFF, 0, -1, 0, 0, 0xFF, 0, 0, -1, 0, 0xFF, 0, 0, 0, 1, 0];
public static const GRAYSCALE:Array = [0.3086, 0.6094, 0.082, 0, 0, 0.3086, 0.6094, 0.082, 0, 0, 0.3086, 0.6094, 0.082, 0, 0, 0, 0, 0, 1, 0];
}
}//package jk.engine.utils
Section 303
//Cookie (jk.engine.utils.Cookie)
package jk.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 (JKCode.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"] = JKCode.encodeObject(_arg1, _paramNames, _delimiter);
_sharedObject.flush();
};
}
}
}//package jk.engine.utils
Section 304
//HintGroup (jk.engine.utils.HintGroup)
package jk.engine.utils {
import flash.display.*;
import jk.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:3, 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 jk.engine.utils
Section 305
//HintManager (jk.engine.utils.HintManager)
package jk.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 jk.engine.utils
Section 306
//IClearable (jk.engine.utils.IClearable)
package jk.engine.utils {
public interface IClearable {
function clear():void;
}
}//package jk.engine.utils
Section 307
//JKCode (jk.engine.utils.JKCode)
package jk.engine.utils {
import flash.utils.*;
import com.dynamicflash.util.*;
public class JKCode {
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 jk.engine.utils
Section 308
//JKEvent (jk.engine.utils.JKEvent)
package jk.engine.utils {
public class JKEvent {
protected var _listeners:Array;
public function JKEvent(){
_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 jk.engine.utils
Section 309
//MultiObjectPool (jk.engine.utils.MultiObjectPool)
package jk.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 jk.engine.utils
Section 310
//ObjectPool (jk.engine.utils.ObjectPool)
package jk.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 jk.engine.utils
Section 311
//openURL (jk.engine.utils.openURL)
package jk.engine.utils {
import flash.net.*;
public function openURL(_arg1:String):void{
navigateToURL(new URLRequest(_arg1), "_blank");
}
}//package jk.engine.utils
Section 312
//ShowHide (jk.engine.utils.ShowHide)
package jk.engine.utils {
import flash.display.*;
import com.greensock.*;
import flash.geom.*;
import flash.utils.*;
import fl.motion.easing.*;
import jk.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){
_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{
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{
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);
};
}
private static function prepareTarget(_arg1:DisplayObject):void{
var _local2:ShowHide = _activeInstances[_arg1];
if (_local2){
_showHidePool.release(_local2);
};
}
}
}//package jk.engine.utils
Section 313
//UArray (jk.engine.utils.UArray)
package jk.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 jk.engine.utils
Section 314
//UDomain (jk.engine.utils.UDomain)
package jk.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:String=""):Boolean{
var _local4:String;
if (!((_arg1) && (_arg1.length))){
return (true);
};
if (!_arg2.length){
_arg2 = domain;
};
var _local3:String = _arg2.toLowerCase();
for each (_local4 in _arg1) {
if (!(_local3.indexOf(_local4.toLowerCase()) > -1)){
} else {
return (true);
};
};
return (false);
}
}
}//package jk.engine.utils
Section 315
//UMath (jk.engine.utils.UMath)
package jk.engine.utils {
public class UMath {
public static const DEG_2_RAD:Number = (Math.PI / 180);
public static const RAD_2_DEG:Number = (180 / Math.PI);
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 jk.engine.utils
Section 316
//UNumber (jk.engine.utils.UNumber)
package jk.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 jk.engine.utils
Section 317
//UObject (jk.engine.utils.UObject)
package jk.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 jk.engine.utils
Section 318
//URectangle (jk.engine.utils.URectangle)
package jk.engine.utils {
import flash.display.*;
import flash.geom.*;
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 jk.engine.utils
Section 319
//UString (jk.engine.utils.UString)
package jk.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 jk.engine.utils
Section 320
//Engine (jk.engine.Engine)
package jk.engine {
import flash.display.*;
import jk.engine.utils.*;
import jk.engine.common.*;
import jk.engine.display.*;
import jk.engine.sound.*;
import jk.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 jk.engine
Section 321
//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 322
//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{
this.Encoder = 0;
this.setValue(_arg1, _arg2);
}
public function get value():Number{
return (Number(this.toString()));
}
public function set value(_arg1:Number):void{
this.setValue(_arg1);
}
public function addValue(_arg1:Number):void{
this.value = (this.value + _arg1);
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
this.Fragment = (_local3.charCodeAt(_temp1) ^ this.Encoder);
if (_arg2 < _local3.length){
this.Sibling = new MochiDigits(_arg1, _arg2);
} else {
this.Sibling = null;
};
this.reencode();
}
public function reencode():void{
var _local1:uint = int((2147483647 * Math.random()));
this.Fragment = (this.Fragment ^ (_local1 ^ this.Encoder));
this.Encoder = _local1;
}
public function toString():String{
var _local1:String = String.fromCharCode((this.Fragment ^ this.Encoder));
if (this.Sibling != null){
_local1 = (_local1 + this.Sibling.toString());
};
return (_local1);
}
}
}//package mochi.as3
Section 323
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher)
package mochi.as3 {
public class MochiEventDispatcher {
private var eventTable:Object;
public function MochiEventDispatcher():void{
this.eventTable = {};
}
public function addEventListener(_arg1:String, _arg2:Function):void{
this.removeEventListener(_arg1, _arg2);
this.eventTable[_arg1].push(_arg2);
}
public function removeEventListener(_arg1:String, _arg2:Function):void{
var _local3:Object;
if (this.eventTable[_arg1] == undefined){
this.eventTable[_arg1] = [];
return;
};
for (_local3 in this.eventTable[_arg1]) {
if (this.eventTable[_arg1][_local3] != _arg2){
} else {
this.eventTable[_arg1].splice(Number(_local3), 1);
};
};
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
var _local3:Object;
if (this.eventTable[_arg1] == undefined){
return;
};
for (_local3 in this.eventTable[_arg1]) {
var _local6 = this.eventTable[_arg1];
_local6[_local3](_arg2);
};
}
}
}//package mochi.as3
Section 324
//MochiEvents (mochi.as3.MochiEvents)
package mochi.as3 {
import flash.display.*;
public class MochiEvents {
public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived";
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";
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 startSession(_arg1:String):void{
MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null);
}
public static function setNotifications(_arg1:MovieClip, _arg2:Object):void{
var _local4:Object;
var _local3:Object = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
_local3.clip = _arg1;
MochiServices.send("events_setNotifications", _local3, 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 325
//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, this.itemOwned);
MochiCoins.addEventListener(MochiCoins.ITEM_NEW, this.newItems);
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, this.loggedIn);
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, this.loggedOut);
this._storeSync = new Object();
this._syncPending = false;
this._outstandingID = 0;
this._syncID = 0;
this._timer = new Timer(1000);
this._timer.addEventListener(TimerEvent.TIMER, this.sync);
this._timer.start();
if (MochiSocial.loggedIn){
this.loggedIn();
} else {
this.loggedOut();
};
}
public function release():void{
MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, this.newItems);
MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, this.loggedIn);
MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, this.loggedOut);
}
private function loggedOut(_arg1:Object=null):void{
this._consumableProperties = null;
}
private function loggedIn(_arg1:Object=null):void{
MochiUserData.get(CONSUMER_KEY, this.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{
this._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;
};
this._consumableProperties = {};
this._names = new Array();
if (_arg1.data){
for (_local2 in _arg1.data) {
this._names.push(_local2);
this._consumableProperties[_local2] = new MochiDigits(_arg1.data[_local2]);
};
};
for (_local2 in this._storeSync) {
_local3 = this._storeSync[_local2].count;
if (this._consumableProperties[(_local2 + KEY_SALT)]){
_local3 = (_local3 - this._consumableProperties[(_local2 + KEY_SALT)].value);
};
if (_local3 == 0){
} else {
this.newItems({id:_local2, count:_local3, properties:this._storeSync[_local2].properties});
};
};
triggerEvent(READY, {});
}
private function putConsumableBag(_arg1:MochiUserData):void{
this._syncPending = false;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
this._outstandingID = -1;
};
triggerEvent(WRITTEN, {});
}
private function sync(_arg1:Event=null):void{
var _local3:String;
if (((this._syncPending) || ((this._syncID == this._outstandingID)))){
return;
};
this._outstandingID = this._syncID;
var _local2:Object = {};
for (_local3 in this._consumableProperties) {
_local2[_local3] = MochiDigits(this._consumableProperties[_local3]).value;
};
MochiUserData.put(CONSUMER_KEY, _local2, this.putConsumableBag);
this._syncPending = true;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
if (this._consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (-1);
};
if (this._consumableProperties[_arg1]){
return (MochiDigits(this._consumableProperties[_arg1]).value);
};
return (undefined);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{
if (!this._consumableProperties[_arg1]){
return (false);
};
this._names.splice(this._names.indexOf(_arg1), 1);
delete this._consumableProperties[_arg1];
return (true);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
if (this._consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (false);
};
if (this._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 (this._consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return;
};
if (!(_arg2 is Number)){
triggerEvent(ERROR, {type:VALUE_ERROR, error:"Invalid type", arg:_arg2});
return;
};
if (this._consumableProperties[_arg1]){
_local3 = MochiDigits(this._consumableProperties[_arg1]);
if (_local3.value == _arg2){
return;
};
_local3.value = _arg2;
} else {
this._names.push(_arg1);
this._consumableProperties[_arg1] = new MochiDigits(_arg2);
};
this._syncID++;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
return (((_arg1)>=this._names.length) ? 0 : (_arg1 + 1));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return (this._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 326
//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);
_slot1.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 (_slot1.boardID != null){
options.boardID = _slot1.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 327
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.geom.*;
import flash.utils.*;
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.1 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 ((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.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
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()){
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.apply(null, ["NotConnected"]);
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["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 328
//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 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 329
//MochiUserData (mochi.as3.MochiUserData)
package mochi.as3 {
import flash.events.*;
import flash.net.*;
import flash.utils.*;
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;
this.operation = _operation;
var api_url:String = MochiSocial.getAPIURL();
var api_token:String = MochiSocial.getAPIToken();
if ((((api_url == null)) || ((api_token == null)))){
this.errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, "not logged in"));
return;
};
this._loader = new URLLoader();
var args:URLVariables = new URLVariables();
args.op = _operation;
args.key = this.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;
this._loader.dataFormat = URLLoaderDataFormat.BINARY;
this._loader.addEventListener(Event.COMPLETE, this.completeHandler);
this._loader.addEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
this._loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.securityErrorHandler);
try {
this._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 (this._loader.data.length){
this.data = this.deserialize(this._loader.data);
} else {
this.data = null;
};
} catch(e:Error) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("deserialize error: " + e.toString())));
return;
};
if (this.callback != null){
this.performCallback();
} else {
dispatchEvent(event);
};
this.close();
}
public function errorHandler(_arg1:IOErrorEvent):void{
this.data = null;
this.error = _arg1;
if (this.callback != null){
this.performCallback();
} else {
dispatchEvent(_arg1);
};
this.close();
}
public function securityErrorHandler(_arg1:SecurityErrorEvent):void{
this.errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.toString())));
}
public function performCallback():void{
try {
this.callback(this);
} catch(e:Error) {
trace(("[MochiUserData] exception during callback: " + e));
};
}
public function close():void{
if (this._loader){
this._loader.removeEventListener(Event.COMPLETE, this.completeHandler);
this._loader.removeEventListener(IOErrorEvent.IO_ERROR, this.errorHandler);
this._loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, this.securityErrorHandler);
this._loader.close();
this._loader = null;
};
this.error = null;
this.callback = null;
}
public function getEvent():void{
this.request("get", this.serialize(null));
}
public function putEvent(_arg1):void{
this.request("put", this.serialize(_arg1));
}
override public function toString():String{
return ((((((((("[MochiUserData operation=" + this.operation) + " key=\"") + this.key) + "\" data=") + this.data) + " error=\"") + this.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 330
//AA (AA)
package {
import jk.app.theater.actors.*;
public dynamic class AA extends Shape {
}
}//package
Section 331
//AB (AB)
package {
import jk.app.theater.actors.*;
public dynamic class AB extends Shape {
}
}//package
Section 332
//AC (AC)
package {
import jk.app.theater.actors.*;
public dynamic class AC extends Shape {
}
}//package
Section 333
//AD (AD)
package {
import jk.app.theater.actors.*;
public dynamic class AD extends Shape {
}
}//package
Section 334
//AE (AE)
package {
import jk.app.theater.actors.*;
public dynamic class AE extends Shape {
}
}//package
Section 335
//AF (AF)
package {
import jk.app.theater.actors.*;
public dynamic class AF extends Shape {
}
}//package
Section 336
//AG (AG)
package {
import jk.app.theater.actors.*;
public dynamic class AG extends Shape {
}
}//package
Section 337
//AH (AH)
package {
import jk.app.theater.actors.*;
public dynamic class AH extends Shape {
}
}//package
Section 338
//AI (AI)
package {
import jk.app.theater.actors.*;
public dynamic class AI extends Shape {
}
}//package
Section 339
//AJ (AJ)
package {
import jk.app.theater.actors.*;
public dynamic class AJ extends Shape {
}
}//package
Section 340
//AK (AK)
package {
import jk.app.theater.actors.*;
public dynamic class AK extends Shape {
}
}//package
Section 341
//AL (AL)
package {
import jk.app.theater.actors.*;
public dynamic class AL extends Shape {
}
}//package
Section 342
//AM (AM)
package {
import jk.app.theater.actors.*;
public dynamic class AM extends Shape {
}
}//package
Section 343
//AN (AN)
package {
import jk.app.theater.actors.*;
public dynamic class AN extends Shape {
}
}//package
Section 344
//AO (AO)
package {
import jk.app.theater.actors.*;
public dynamic class AO extends Shape {
}
}//package
Section 345
//AP (AP)
package {
import jk.app.theater.actors.*;
public dynamic class AP extends Shape {
}
}//package
Section 346
//AQ (AQ)
package {
import jk.app.theater.actors.*;
public dynamic class AQ extends Shape {
}
}//package
Section 347
//AR (AR)
package {
import jk.app.theater.actors.*;
public dynamic class AR extends Shape {
}
}//package
Section 348
//AS (AS)
package {
import jk.app.theater.actors.*;
public dynamic class AS extends Shape {
}
}//package
Section 349
//AT (AT)
package {
import jk.app.theater.actors.*;
public dynamic class AT extends Shape {
}
}//package
Section 350
//AU (AU)
package {
import jk.app.theater.actors.*;
public dynamic class AU extends Shape {
}
}//package
Section 351
//AV (AV)
package {
import jk.app.theater.actors.*;
public dynamic class AV extends Platform {
}
}//package
Section 352
//AW (AW)
package {
import jk.app.theater.actors.*;
public dynamic class AW extends Platform {
}
}//package
Section 353
//AX (AX)
package {
import jk.app.theater.actors.*;
public dynamic class AX extends Evil {
}
}//package
Section 354
//AY (AY)
package {
import jk.app.theater.actors.*;
public dynamic class AY extends Evil {
}
}//package
Section 355
//AZ (AZ)
package {
import jk.app.theater.actors.*;
public dynamic class AZ extends Hero {
}
}//package
Section 356
//Background (Background)
package {
import jk.app.display.*;
public dynamic class Background extends Background {
}
}//package
Section 357
//CellRenderer_disabledSkin (CellRenderer_disabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_disabledSkin extends MovieClip {
}
}//package
Section 358
//CellRenderer_downSkin (CellRenderer_downSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_downSkin extends MovieClip {
}
}//package
Section 359
//CellRenderer_overSkin (CellRenderer_overSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_overSkin extends MovieClip {
}
}//package
Section 360
//CellRenderer_selectedDisabledSkin (CellRenderer_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDisabledSkin extends MovieClip {
}
}//package
Section 361
//CellRenderer_selectedDownSkin (CellRenderer_selectedDownSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDownSkin extends MovieClip {
}
}//package
Section 362
//CellRenderer_selectedOverSkin (CellRenderer_selectedOverSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedOverSkin extends MovieClip {
}
}//package
Section 363
//CellRenderer_selectedUpSkin (CellRenderer_selectedUpSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedUpSkin extends MovieClip {
}
}//package
Section 364
//CellRenderer_upSkin (CellRenderer_upSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_upSkin extends MovieClip {
}
}//package
Section 365
//CheckBox_disabledIcon (CheckBox_disabledIcon)
package {
import flash.display.*;
public dynamic class CheckBox_disabledIcon extends MovieClip {
}
}//package
Section 366
//CheckBox_downIcon (CheckBox_downIcon)
package {
import flash.display.*;
public dynamic class CheckBox_downIcon extends MovieClip {
}
}//package
Section 367
//CheckBox_overIcon (CheckBox_overIcon)
package {
import flash.display.*;
public dynamic class CheckBox_overIcon extends MovieClip {
}
}//package
Section 368
//CheckBox_selectedDisabledIcon (CheckBox_selectedDisabledIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedDisabledIcon extends MovieClip {
}
}//package
Section 369
//CheckBox_selectedDownIcon (CheckBox_selectedDownIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedDownIcon extends MovieClip {
}
}//package
Section 370
//CheckBox_selectedOverIcon (CheckBox_selectedOverIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedOverIcon extends MovieClip {
}
}//package
Section 371
//CheckBox_selectedUpIcon (CheckBox_selectedUpIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedUpIcon extends MovieClip {
}
}//package
Section 372
//CheckBox_upIcon (CheckBox_upIcon)
package {
import flash.display.*;
public dynamic class CheckBox_upIcon extends MovieClip {
}
}//package
Section 373
//ColumnStretch_cursor (ColumnStretch_cursor)
package {
import flash.display.*;
public dynamic class ColumnStretch_cursor extends MovieClip {
}
}//package
Section 374
//ComboBox_disabledSkin (ComboBox_disabledSkin)
package {
import flash.display.*;
public dynamic class ComboBox_disabledSkin extends MovieClip {
}
}//package
Section 375
//ComboBox_downSkin (ComboBox_downSkin)
package {
import flash.display.*;
public dynamic class ComboBox_downSkin extends MovieClip {
}
}//package
Section 376
//ComboBox_overSkin (ComboBox_overSkin)
package {
import flash.display.*;
public dynamic class ComboBox_overSkin extends MovieClip {
}
}//package
Section 377
//ComboBox_upSkin (ComboBox_upSkin)
package {
import flash.display.*;
public dynamic class ComboBox_upSkin extends MovieClip {
}
}//package
Section 378
//DataGrid_skin (DataGrid_skin)
package {
import flash.display.*;
public dynamic class DataGrid_skin extends MovieClip {
}
}//package
Section 379
//DataGridCellEditor_skin (DataGridCellEditor_skin)
package {
import flash.display.*;
public dynamic class DataGridCellEditor_skin extends MovieClip {
}
}//package
Section 380
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 381
//GATracker (GATracker)
package {
import flash.display.*;
import com.google.analytics.*;
public class GATracker {
private static var _gaTracker:GATracker;
private static var _trackEverything:Boolean;
public static function init(_arg1:DisplayObjectContainer, _arg2:String, _arg3:Boolean=true):void{
if (!_gaTracker){
_gaTracker = new GATracker(_arg1, _arg2);
};
_trackEverything = _arg3;
}
public static function get trackEverything():Boolean{
return (_trackEverything);
}
public static function set trackEverything(_arg1:Boolean):void{
_trackEverything = _arg1;
}
public static function trackEvent(_arg1:String, _arg2:String, _arg3:String=null, _arg4:Boolean=true):void{
if (((_arg4) || (_trackEverything))){
_gaTracker.trackEvent(_arg1, _arg2, _arg3);
};
}
public static function trackPageview(_arg1:String, _arg2:Boolean=true):void{
if (((_arg2) || (_trackEverything))){
_gaTracker.trackPageview(_arg1);
};
}
}
}//package
Section 382
//HeaderRenderer_disabledSkin (HeaderRenderer_disabledSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_disabledSkin extends MovieClip {
}
}//package
Section 383
//HeaderRenderer_downSkin (HeaderRenderer_downSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_downSkin extends MovieClip {
}
}//package
Section 384
//HeaderRenderer_overSkin (HeaderRenderer_overSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_overSkin extends MovieClip {
}
}//package
Section 385
//HeaderRenderer_selectedDisabledSkin (HeaderRenderer_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedDisabledSkin extends MovieClip {
}
}//package
Section 386
//HeaderRenderer_selectedDownSkin (HeaderRenderer_selectedDownSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedDownSkin extends MovieClip {
}
}//package
Section 387
//HeaderRenderer_selectedOverSkin (HeaderRenderer_selectedOverSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedOverSkin extends MovieClip {
}
}//package
Section 388
//HeaderRenderer_selectedUpSkin (HeaderRenderer_selectedUpSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedUpSkin extends MovieClip {
}
}//package
Section 389
//HeaderRenderer_upSkin (HeaderRenderer_upSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_upSkin extends MovieClip {
}
}//package
Section 390
//HeaderSortArrow_ascIcon (HeaderSortArrow_ascIcon)
package {
import flash.display.*;
public dynamic class HeaderSortArrow_ascIcon extends MovieClip {
}
}//package
Section 391
//HeaderSortArrow_descIcon (HeaderSortArrow_descIcon)
package {
import flash.display.*;
public dynamic class HeaderSortArrow_descIcon extends MovieClip {
}
}//package
Section 392
//levelPacksXML (levelPacksXML)
package {
//unhandled trait type in script info (getter/setter)
}//package
Section 393
//List_skin (List_skin)
package {
import flash.display.*;
public dynamic class List_skin extends MovieClip {
}
}//package
Section 394
//Main (Main)
package {
import flash.display.*;
import jk.engine.utils.*;
import flash.events.*;
import jk.engine.*;
import jk.engine.ui.*;
import jk.app.display.*;
import jk.app.display.windows.dialogs.*;
import jk.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", "btnSponsorLogo", "adGame1", "adGame2", "socialButtons"]);
engine.levelMgr.load(levelPacksXML);
engine.guiMgr.onSheetOpening.addListener(onGuiMgr_SheetOpening);
engine.soundMgr.onChange.addListener(onSoundMgr_Change);
engine.keyboardMgr.onKeyDown.addListener(onKeyboardMgr_KeyDown);
setupSheets();
setupDialogs();
setupHUD();
setupSound();
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");
}
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");
}
private static function setupHUD():void{
var _local1:HUD = (engine.guiMgr.hud as HUD);
_local1.addState("GameOfficialLevel", ["soundOnOff", "btnSponsorLogo", "btnRestart", "btnHint", "btnSelectLevel", "txtScore", "txtLevelIndex"]);
_local1.addState("GameCustomLevel", ["soundOnOff", "btnSponsorLogo", "btnRestart", "btnHint", "btnEditLevel", "txtScore"]);
_local1.addState("MainMenu", ["soundOnOff", "btnSponsorLogo", "adGame1", "adGame2", "socialButtons"]);
_local1.addState("LevelSelection", ["soundOnOff", "btnSponsorLogo", "adGame1", "adGame2", "socialButtons"]);
_local1.addState("LevelEditor", []);
_local1.soundOnOff.buttonMode = true;
_local1.soundOnOff.addEventListener(MouseEvent.CLICK, onHUD_SoundOnOff_Click);
_local1.btnSponsorLogo.addEventListener(MouseEvent.CLICK, onHUD_SponsorLogo_Click);
_local1.adGame1.btnIcon.addEventListener(MouseEvent.CLICK, onHUD_AdGame1_Icon_Click);
_local1.adGame2.btnIcon.addEventListener(MouseEvent.CLICK, onHUD_AdGame2_Icon_Click);
_local1.socialButtons.btnFacebook.addEventListener(MouseEvent.CLICK, onHUD_SocialButtons_Facebook_Click);
_local1.socialButtons.btnTwitter.addEventListener(MouseEvent.CLICK, onHUD_SocialButtons_Twitter_Click);
_local1.socialButtons.btnLike.addEventListener(MouseEvent.CLICK, onHUD_SocialButtons_Like_Click);
}
private static function setupSound():void{
engine.soundMgr.registerMusic(MusicTheme, "MusicTheme");
engine.soundMgr.registerSFX(SFXFail, "Fail");
engine.soundMgr.registerSFX(SFXClick, "Click");
engine.soundMgr.registerSFX(SFXWin, "Win");
engine.soundMgr.registerSFX(SFXWind, "Wind");
engine.soundMgr.pushMusicToPlayList("MusicTheme", 0, int.MAX_VALUE);
}
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("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 onKeyboardMgr_KeyDown(_arg1:uint):void{
if (_arg1 == KeyboardManager.M){
onHUD_SoundOnOff_Click(null);
};
}
private static function onHUD_SponsorLogo_Click(_arg1:MouseEvent):void{
GATracker.trackEvent("HUD", "Click", "More Games LOGO");
openURL(Settings.SPONSOR_LOGO_HUD_URL);
}
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_AdGame1_Icon_Click(_arg1:MouseEvent):void{
GATracker.trackEvent("AD Panel", "Click", "Game 1");
openURL(Settings.AD_GAME_1_URL);
}
private static function onHUD_AdGame2_Icon_Click(_arg1:MouseEvent):void{
GATracker.trackEvent("AD Panel", "Click", "Game 2");
openURL(Settings.AD_GAME_2_URL);
}
private static function onHUD_SocialButtons_Facebook_Click(_arg1:MouseEvent):void{
GATracker.trackEvent("AD Panel", "Click", "Facebook Page");
openURL(Settings.FACEBOOK_PAGE_URL);
}
private static function onHUD_SocialButtons_Twitter_Click(_arg1:MouseEvent):void{
GATracker.trackEvent("AD Panel", "Click", "Twitter Page");
openURL(Settings.TWITTER_PAGE_URL);
}
private static function onHUD_SocialButtons_Like_Click(_arg1:MouseEvent):void{
GATracker.trackEvent("AD Panel", "Click", "Facebook Like");
openURL(((((Settings.FACEBOOK_SHARE_SERVICE_URL + "?u=") + Settings.FACEBOOK_SHARING_URL) + "&t=") + Settings.GAME_NAME));
}
private static function onContextMenu_MoreGames_MenuItemSelect(_arg1:ContextMenuEvent):void{
GATracker.trackEvent("Context Menu", "Click", "More Games!");
openURL(Settings.MORE_GAMES_CONTEXT_MENU_URL);
}
private static function onContextMenu_Options_MenuItemSelect(_arg1:ContextMenuEvent):void{
GATracker.trackEvent("Context Menu", "Click", "Options", false);
engine.guiMgr.openWindow("Options", {});
}
private static function onContextMenu_MusicOff_MenuItemSelect(_arg1:ContextMenuEvent):void{
GATracker.trackEvent("Context Menu", "Click", "Music Off", false);
engine.soundMgr.musicMuting = true;
}
private static function onContextMenu_MusicOn_MenuItemSelect(_arg1:ContextMenuEvent):void{
GATracker.trackEvent("Context Menu", "Click", "Music On", false);
engine.soundMgr.musicMuting = false;
}
private static function onContextMenu_SFXOff_MenuItemSelect(_arg1:ContextMenuEvent):void{
GATracker.trackEvent("Context Menu", "Click", "SFX Off", false);
engine.soundMgr.sfxMuting = true;
}
private static function onContextMenu_SFXOn_MenuItemSelect(_arg1:ContextMenuEvent):void{
GATracker.trackEvent("Context Menu", "Click", "SFX On", false);
engine.soundMgr.sfxMuting = false;
}
}
}//package
Section 395
//MusicTheme (MusicTheme)
package {
import flash.media.*;
public dynamic class MusicTheme extends Sound {
}
}//package
Section 396
//Preloader (Preloader)
package {
import flash.events.*;
import flash.display.*;
import mochi.as3.*;
import flash.text.*;
import com.greensock.*;
import flash.utils.*;
import fl.motion.easing.*;
import jk.engine.utils.*;
import jk.engine.utils.graphicsFill.*;
import jk.app.preloader.*;
public dynamic class Preloader extends MovieClip {
public var background:MovieClip;
public var progressBar:ProgressBar;
public var txtLoading:TextField;
public var btnSponsorLogo:SimpleButton;
public var gameIconsHolder:MovieClip;
public var txtProgress:TextField;
public var btnPlay:SimpleButton;
private var _liteBranded:Boolean;
public function Preloader(){
stop();
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
private function setupGameIcons():void{
var _local3:int;
var _local4:MovieClip;
var _local1:int = gameIconsHolder.numChildren;
var _local2:Array = new Array(_local1);
while (_local3 < _local1) {
_local2[_local3] = (_local3 + 1);
_local3++;
};
UArray.shuffle(_local2);
_local3 = 0;
while (_local3 < _local1) {
_local4 = (gameIconsHolder.getChildAt(_local3) as MovieClip);
_local4.gotoAndStop(_local2[_local3]);
_local3++;
};
gameIconsHolder.buttonMode = true;
}
private function showPlayButton():void{
btnPlay.visible = true;
removeChild(txtProgress);
removeChild(txtLoading);
}
private function onAddedToStage(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
MochiServices.connect(Settings.MOCHIADS_GAME_ID, this);
GATracker.init(this, Settings.GA_ACCOUNT, Settings.GA_TRACK_EVERYTHING);
_liteBranded = UDomain.checkDomain(Settings.LITE_BRANDED_DOMAINS);
setupGameIcons();
loaderInfo.addEventListener(Event.COMPLETE, onLoaderInfo_Complete);
loaderInfo.addEventListener(ProgressEvent.PROGRESS, onLoaderInfo_Progress);
btnPlay.addEventListener(MouseEvent.CLICK, onPlay_Click);
btnSponsorLogo.addEventListener(MouseEvent.CLICK, onSponsorLogo_Click);
gameIconsHolder.addEventListener(MouseEvent.CLICK, onGameIconsHolder_Click);
gameIconsHolder.addEventListener(MouseEvent.MOUSE_OVER, onGameIconsHolder_MouseOver);
gameIconsHolder.addEventListener(MouseEvent.MOUSE_OUT, onGameIconsHolder_MouseOut);
background.addEventListener(MouseEvent.CLICK, onBackground_Click);
stage.showDefaultContextMenu = false;
btnPlay.visible = false;
progressBar.bar.scaleX = 0;
if (_liteBranded){
gameIconsHolder.visible = false;
};
}
private function onLoaderInfo_Complete(_arg1:Event):void{
loaderInfo.removeEventListener(Event.COMPLETE, onLoaderInfo_Complete);
loaderInfo.removeEventListener(ProgressEvent.PROGRESS, onLoaderInfo_Progress);
if (_liteBranded){
showPlayButton();
} else {
TweenLite.delayedCall(3, showPlayButton);
};
}
private function onLoaderInfo_Progress(_arg1:ProgressEvent):void{
progressBar.bar.scaleX = (_arg1.bytesLoaded / _arg1.bytesTotal);
txtProgress.text = (String(Math.round((100 * progressBar.bar.scaleX))) + "%");
}
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);
gameIconsHolder.removeEventListener(MouseEvent.CLICK, onGameIconsHolder_Click);
gameIconsHolder.removeEventListener(MouseEvent.MOUSE_OVER, onGameIconsHolder_MouseOver);
gameIconsHolder.removeEventListener(MouseEvent.MOUSE_OUT, onGameIconsHolder_MouseOut);
if (!_liteBranded){
ShowHide.hide(gameIconsHolder, 1, {filler:Bubbles});
};
ShowHide.hide(btnPlay, 1, {filler:Bubbles});
ShowHide.hide(progressBar, 1, {filler:Bubbles});
TweenLite.to(btnSponsorLogo, 1, {y:(0.5 * (Settings.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 (!UDomain.checkDomain(Settings.DOMAIN_LOCK)){
gotoAndStop(2);
return;
};
stage.frameRate = Settings.FPS;
gotoAndStop(3);
getDefinitionByName("Main").init(this);
}
private function onSponsorLogo_Click(_arg1:MouseEvent):void{
GATracker.trackEvent("Preloader", "Click", "Sponsor Logo");
openURL(Settings.SPONSOR_LOGO_PRELOADER_URL);
}
private function onGameIconsHolder_Click(_arg1:MouseEvent):void{
GATracker.trackEvent("Preloader", "Click", "Game Icon");
var _local2:MovieClip = (_arg1.target as MovieClip);
openURL(_local2.currentLabel);
}
private function onGameIconsHolder_MouseOver(_arg1:MouseEvent):void{
var _local2:MovieClip = (_arg1.target as MovieClip);
TweenLite.to(_local2, 0.3, {scaleX:1.3, scaleY:1.3, ease:Back.easeOut});
}
private function onGameIconsHolder_MouseOut(_arg1:MouseEvent):void{
var _local2:MovieClip = (_arg1.target as MovieClip);
TweenLite.to(_local2, 0.3, {scaleX:1, scaleY:1, ease:Back.easeOut});
}
private function onBackground_Click(_arg1:MouseEvent):void{
GATracker.trackEvent("Preloader", "Click", "Background");
openURL(Settings.PRELOADER_BACKGROUND_URL);
}
}
}//package
Section 397
//ScrollArrowDown_disabledSkin (ScrollArrowDown_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_disabledSkin extends MovieClip {
}
}//package
Section 398
//ScrollArrowDown_downSkin (ScrollArrowDown_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_downSkin extends MovieClip {
}
}//package
Section 399
//ScrollArrowDown_overSkin (ScrollArrowDown_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_overSkin extends MovieClip {
}
}//package
Section 400
//ScrollArrowDown_upSkin (ScrollArrowDown_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_upSkin extends MovieClip {
}
}//package
Section 401
//ScrollArrowUp_disabledSkin (ScrollArrowUp_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_disabledSkin extends MovieClip {
}
}//package
Section 402
//ScrollArrowUp_downSkin (ScrollArrowUp_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_downSkin extends MovieClip {
}
}//package
Section 403
//ScrollArrowUp_overSkin (ScrollArrowUp_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_overSkin extends MovieClip {
}
}//package
Section 404
//ScrollArrowUp_upSkin (ScrollArrowUp_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_upSkin extends MovieClip {
}
}//package
Section 405
//ScrollBar_thumbIcon (ScrollBar_thumbIcon)
package {
import flash.display.*;
public dynamic class ScrollBar_thumbIcon extends MovieClip {
}
}//package
Section 406
//ScrollThumb_downSkin (ScrollThumb_downSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_downSkin extends MovieClip {
}
}//package
Section 407
//ScrollThumb_overSkin (ScrollThumb_overSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_overSkin extends MovieClip {
}
}//package
Section 408
//ScrollThumb_upSkin (ScrollThumb_upSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_upSkin extends MovieClip {
}
}//package
Section 409
//ScrollTrack_skin (ScrollTrack_skin)
package {
import flash.display.*;
public dynamic class ScrollTrack_skin extends MovieClip {
}
}//package
Section 410
//Settings (Settings)
package {
import fl.motion.easing.*;
public class Settings {
public static const GAME_NAME:String = "Fox'n'Roll Pro";
public static const COOKIE_FILE_NAME:String = "Fox_n_Roll_Pro";
public static const GA_ACCOUNT:String = "UA-15327633-5";
public static const MOCHIADS_GAME_ID:String = "4a65e8d29bedf985";
public static const HIGHSCORES_LEADERBOARD_ID:String = "ee75a2cb013e090d";
public static const GA_TRACK_EVERYTHING:Boolean = false;
public static const PRELOADER_BACKGROUND_URL:String = "http://www.godvilgames.com/?utm_source=our_game&utm_medium=preloader_back&utm_campaign=foxnroll-pro";
public static const MORE_GAMES_CONTEXT_MENU_URL:String = "http://www.godvilgames.com/?utm_source=our_game&utm_medium=context_menu&utm_campaign=foxnroll-pro";
public static const MORE_GAMES_MAIN_MENU_URL:String = "http://www.godvilgames.com/?utm_source=our_game&utm_medium=main_menu&utm_campaign=foxnroll-pro";
public static const SPONSOR_LOGO_PRELOADER_URL:String = "http://www.godvilgames.com/?utm_source=our_game&utm_medium=preloader_logo&utm_campaign=foxnroll-pro";
public static const SPONSOR_LOGO_HUD_URL:String = "http://www.godvilgames.com/?utm_source=our_game&utm_medium=hud_logo&utm_campaign=foxnroll-pro";
public static const POST_IT_HERE_URL:String = "http://www.godvilgames.com/games/3166/foxnroll-pro.html/?utm_source=our_game&utm_medium=post_it_here&utm_campaign=foxnroll-pro";
public static const HINT_URL:String = "http://www.godvilgames.com/walks/3166/foxnroll-pro.html/?utm_source=our_game&utm_medium=hint&utm_campaign=foxnroll-pro";
public static const FACEBOOK_PAGE_URL:String = "http://www.facebook.com/pages/GodvilGames/173092012711374";
public static const TWITTER_PAGE_URL:String = "http://www.twitter.com/GodvilGames";
public static const AD_GAME_1_URL:String = "http://www.godvilgames.com/games/3126/steambirds.html/?utm_source=our_game&utm_medium=ad_panel_game_1&utm_campaign=foxnroll-pro";
public static const AD_GAME_2_URL:String = "http://www.godvilgames.com/games/3143/redstar-fall.html/?utm_source=our_game&utm_medium=ad_panel_game_2&utm_campaign=foxnroll-pro";
public static const FACEBOOK_SHARE_SERVICE_URL:String = "http://www.facebook.com/sharer.php";
public static const FACEBOOK_SHARING_URL:String = "http://www.godvilgames.com/games/3166/foxnroll-pro.html";
public static const DOMAIN_LOCK:Array = [];
public static const LITE_BRANDED_DOMAINS:Array = ["kongregate.com", "newgrounds.com", "ungrounded.net", "uploads.ungrounded.net", "godvilgames.com", "localhost"];
public static const WIDTH:Number = 700;
public static const HEIGHT:Number = 525;
public static const THEATER_WIDTH:Number = 32768;
public static const THEATER_HEIGHT:Number = 32768;
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 = 8.5;
public static const DEFAULT_DENSITY:Number = 1;
public static const DEFAULT_FRICTION:Number = 0.1;
public static const DEFAULT_RESTITUTION:Number = 0;
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 411
//setupActorBuildingParams (setupActorBuildingParams)
package {
public function setupActorBuildingParams(_arg1:String, _arg2:Object):void{
switch (_arg1){
case "AA":
_arg2.physModel = "Concave";
_arg2.polygons = [[[-27.55, -47.45], [-2.55, -47.45], [-2.55, 2.55], [-27.55, 27.55]], [[47.45, 27.55], [-27.55, 27.55], [-2.55, 2.55], [47.45, 2.55]]];
break;
case "AB":
_arg2.physModel = "Concave";
_arg2.polygons = [[[4.15, -29.15], [4.15, -4.15], [-20.85, 20.85], [-20.85, -29.15]], [[-20.85, 20.85], [4.15, -4.15], [29.15, -4.15], [29.15, 20.85]]];
break;
case "AC":
_arg2.physModel = "Concave";
_arg2.polygons = [[[12.5, -37.5], [12.5, -12.5], [-12.5, -12.5], [-12.5, -37.5]], [[-37.5, -12.5], [12.5, -12.5], [-12.5, 12.5], [-37.5, 12.5]], [[-12.5, 12.5], [12.5, -12.5], [12.5, 37.5], [-12.5, 37.5]], [[12.5, 12.5], [12.5, -12.5], [37.5, -12.5], [37.5, 12.5]]];
break;
case "AD":
_arg2.physModel = "Concave";
_arg2.polygons = [[[12.5, -25], [12.5, -12.5], [-12.5, -12.5], [-12.5, -25]], [[-25, -12.5], [12.5, -12.5], [-12.5, 12.5], [-25, 12.5]], [[-12.5, 12.5], [12.5, -12.5], [12.5, 25], [-12.5, 25]], [[12.5, 12.5], [12.5, -12.5], [25, -12.5], [25, 12.5]]];
break;
case "AE":
_arg2.physModel = "Concave";
_arg2.polygons = [[[-6.25, -43.75], [18.75, -43.75], [18.75, 31.25], [-6.25, 6.25]], [[-31.25, 6.25], [-6.25, 6.25], [18.75, 31.25], [-31.25, 31.25]]];
break;
case "AF":
_arg2.physModel = "Concave";
_arg2.polygons = [[[6.2, -43.7], [6.2, 6.3], [-18.8, 31.3], [-18.8, -43.7]], [[6.2, 6.3], [31.2, 6.3], [31.2, 31.3], [-18.8, 31.3]]];
break;
case "AG":
_arg2.physModel = "Rectangle";
break;
case "AH":
_arg2.physModel = "Rectangle";
break;
case "AI":
_arg2.physModel = "Rectangle";
break;
case "AJ":
_arg2.physModel = "Rectangle";
break;
case "AK":
_arg2.physModel = "Rectangle";
break;
case "AL":
_arg2.physModel = "Rectangle";
break;
case "AM":
_arg2.physModel = "Rectangle";
break;
case "AN":
_arg2.physModel = "Rectangle";
break;
case "AO":
_arg2.physModel = "Rectangle";
break;
case "AP":
_arg2.physModel = "Concave";
_arg2.polygons = [[[0, -28.95], [0, 21.05], [-50.05, 21.05], [-49, 10.4], [-45.9, 0.75], [-41.45, -7.1], [-35.4, -14.35], [-28.1, -20.45], [-20.05, -24.95], [-11.25, -27.75], [-0.05, -28.95]], [[0, -28.95], [8.55, -28.3], [18.4, -25.65], [27.75, -20.65], [35.3, -14.35], [40, -8.95], [45.3, -0.4], [48.7, 9.5], [49.95, 21.05], [0, 21.05]]];
break;
case "AQ":
_arg2.physModel = "Rectangle";
break;
case "AR":
_arg2.physModel = "Concave";
_arg2.polygons = [[[37.5, -27.5], [37.5, -2.5], [-37.5, -2.5], [-37.5, -27.5]], [[12.5, -2.5], [12.5, 47.5], [-12.5, 47.5], [-12.5, -2.5]]];
break;
case "AS":
_arg2.physModel = "Concave";
_arg2.polygons = [[[21.15, -18.8], [37.45, -18.75], [20.85, -18.75]], [[-37.6, -18.75], [37.45, -18.75], [-12.6, 6.2], [-13, 6.25], [-37.6, 6.25], [-37.65, -18.05]], [[-12.6, 31.25], [-12.6, 6.2], [12.4, 6.25], [12.4, 31.25]], [[-12.6, 6.2], [37.45, -18.75], [37.4, 6.25], [12.4, 6.25]]];
break;
case "AT":
_arg2.physModel = "Concave";
_arg2.polygons = [[[-25, -22.25], [25, -22.25], [12.5, 27.75], [-12.5, 27.75]]];
break;
case "AU":
_arg2.physModel = "Concave";
_arg2.polygons = [[[-25, 14.4], [0, -28.8], [25, 14.4]]];
break;
case "AV":
_arg2.physModel = "Concave";
_arg2.polygons = [[[-27.55, -0.25], [-32.8, -2.95], [-32.9, -4.75], [-30.85, -6.6], [-25.6, -7.95]], [[-24.6, 4.15], [-27.55, -0.25], [-25.6, -7.95]], [[-21.1, -7.95], [-16.95, -5.95], [-14.15, -2], [-6.9, 14.8], [-5.25, 20], [-14.95, 20.45], [-18.25, 19.3], [-21.85, 15.4], [-23.55, 11.15], [-24.6, 4.15], [-25.6, -7.95]], [[0.9, -35.05], [3.55, 24.25], [-3.7, 22.05], [-5.25, 20], [-6.9, 14.8], [-7.65, -3.6], [-2.65, -27.8]], [[0.9, -35.05], [6.7, -25.4], [10.75, 23.5], [3.55, 24.25]], [[6.7, -25.4], [11.15, -31.8], [15.5, 21.5], [10.75, 23.5]], [[11.15, -31.8], [15.65, -22], [18.9, -4.35], [19.9, 8.8], [18.6, 18.55], [15.5, 21.5]]];
break;
case "AW":
_arg2.physModel = "Concave";
_arg2.polygons = [[[-18.85, -4.35], [-15.6, -22], [-6.65, -25.4], [-3.5, 24.25], [-10.7, 23.5], [-15.45, 21.5], [-18.55, 18.55], [-19.85, 8.8]], [[2.7, -27.8], [7.7, -3.6], [6.95, 14.8], [5.3, 20], [3.75, 22.05], [-3.5, 24.25], [-6.65, -25.4]], [[-15.6, -22], [-11.1, -31.8], [-6.65, -25.4]], [[2.7, -27.8], [-6.65, -25.4], [-0.85, -35.05]], [[17, -5.95], [21.15, -7.95], [25.65, -7.95], [24.65, 4.15], [23.6, 11.15], [21.9, 15.4], [18.3, 19.3], [15, 20.45], [5.3, 20], [6.95, 14.8], [14.2, -2]], [[24.65, 4.15], [25.65, -7.95], [27.6, -0.25]], [[25.65, -7.95], [30.9, -6.6], [32.95, -4.75], [32.85, -2.95], [27.6, -0.25]]];
break;
case "AX":
_arg2.physModel = "Concave";
_arg2.polygons = [[[-25.05, -8.1], [-0.05, -26.2], [25, -8.1], [15.4, 21.25], [-15.45, 21.25]]];
break;
case "AY":
_arg2.physModel = "Concave";
_arg2.polygons = [[[25, -24.95], [25, -10.35], [-10.3, 25.05], [-25, 25.05], [-25, -24.95]], [[-10.3, 25.05], [25, -10.35], [10.3, 25.05], [0, 35.35]], [[10.3, 25.05], [25, -10.35], [25, 25.05]], [[35.35, 0], [25, 10.35], [25, -10.35]], [[-25, -10.35], [-25, 10.35], [-35.35, 0]], [[-10.35, -25], [0, -35.35], [10.35, -25]]];
break;
case "AZ":
_arg2.physModel = "Circle";
break;
};
}
}//package
Section 412
//SFXClick (SFXClick)
package {
import flash.media.*;
public dynamic class SFXClick extends Sound {
}
}//package
Section 413
//SFXFail (SFXFail)
package {
import flash.media.*;
public dynamic class SFXFail extends Sound {
}
}//package
Section 414
//SFXWin (SFXWin)
package {
import flash.media.*;
public dynamic class SFXWin extends Sound {
}
}//package
Section 415
//SFXWind (SFXWind)
package {
import flash.media.*;
public dynamic class SFXWind extends Sound {
}
}//package
Section 416
//SliderThumb_disabledSkin (SliderThumb_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_disabledSkin extends MovieClip {
}
}//package
Section 417
//SliderThumb_downSkin (SliderThumb_downSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_downSkin extends MovieClip {
}
}//package
Section 418
//SliderThumb_overSkin (SliderThumb_overSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_overSkin extends MovieClip {
}
}//package
Section 419
//SliderThumb_upSkin (SliderThumb_upSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_upSkin extends MovieClip {
}
}//package
Section 420
//SliderTick_skin (SliderTick_skin)
package {
import flash.display.*;
public dynamic class SliderTick_skin extends MovieClip {
}
}//package
Section 421
//SliderTrack_disabledSkin (SliderTrack_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderTrack_disabledSkin extends MovieClip {
}
}//package
Section 422
//SliderTrack_skin (SliderTrack_skin)
package {
import flash.display.*;
public dynamic class SliderTrack_skin extends MovieClip {
}
}//package
Section 423
//TextArea_disabledSkin (TextArea_disabledSkin)
package {
import flash.display.*;
public dynamic class TextArea_disabledSkin extends MovieClip {
}
}//package
Section 424
//TextArea_upSkin (TextArea_upSkin)
package {
import flash.display.*;
public dynamic class TextArea_upSkin extends MovieClip {
}
}//package
Section 425
//TextInput_disabledSkin (TextInput_disabledSkin)
package {
import flash.display.*;
public dynamic class TextInput_disabledSkin extends MovieClip {
}
}//package
Section 426
//TextInput_upSkin (TextInput_upSkin)
package {
import flash.display.*;
public dynamic class TextInput_upSkin extends MovieClip {
}
}//package