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.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2CircleShape extends b2Shape {
public var m_localPosition:b2Vec2;
public var m_radius:Number;
public function b2CircleShape(_arg1:b2ShapeDef){
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 public 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.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PolygonShape extends b2Shape {
private var s_supportVec:b2Vec2;
public var m_centroid:b2Vec2;
public var m_obb:b2OBB;
public var m_vertices:Array;
public var m_normals:Array;
public var m_coreVertices:Array;
public var m_vertexCount:int;
private static var s_computeMat:b2Mat22 = new b2Mat22();
private static var s_sweptAABB1:b2AABB = new b2AABB();
private static var s_sweptAABB2:b2AABB = new b2AABB();
public function b2PolygonShape(_arg1:b2ShapeDef){
var _local3:int;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
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 public 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);
}
public static function ComputeOBB(_arg1:b2OBB, _arg2:Array, _arg3:int):void{
var _local4:int;
var _local7:b2Vec2;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:b2Mat22;
var _local5:Array = new Array((b2Settings.b2_maxPolygonVertices + 1));
_local4 = 0;
while (_local4 < _arg3) {
_local5[_local4] = _arg2[_local4];
_local4++;
};
_local5[_arg3] = _local5[0];
var _local6:Number = Number.MAX_VALUE;
_local4 = 1;
while (_local4 <= _arg3) {
_local7 = _local5[int((_local4 - 1))];
_local8 = (_local5[_local4].x - _local7.x);
_local9 = (_local5[_local4].y - _local7.y);
_local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local8 = (_local8 / _local10);
_local9 = (_local9 / _local10);
_local11 = -(_local9);
_local12 = _local8;
_local13 = Number.MAX_VALUE;
_local14 = Number.MAX_VALUE;
_local15 = -(Number.MAX_VALUE);
_local16 = -(Number.MAX_VALUE);
_local17 = 0;
while (_local17 < _arg3) {
_local19 = (_local5[_local17].x - _local7.x);
_local20 = (_local5[_local17].y - _local7.y);
_local21 = ((_local8 * _local19) + (_local9 * _local20));
_local22 = ((_local11 * _local19) + (_local12 * _local20));
if (_local21 < _local13){
_local13 = _local21;
};
if (_local22 < _local14){
_local14 = _local22;
};
if (_local21 > _local15){
_local15 = _local21;
};
if (_local22 > _local16){
_local16 = _local22;
};
_local17++;
};
_local18 = ((_local15 - _local13) * (_local16 - _local14));
if (_local18 < (0.95 * _local6)){
_local6 = _local18;
_arg1.R.col1.x = _local8;
_arg1.R.col1.y = _local9;
_arg1.R.col2.x = _local11;
_arg1.R.col2.y = _local12;
_local23 = (0.5 * (_local13 + _local15));
_local24 = (0.5 * (_local14 + _local16));
_local25 = _arg1.R;
_arg1.center.x = (_local7.x + ((_local25.col1.x * _local23) + (_local25.col2.x * _local24)));
_arg1.center.y = (_local7.y + ((_local25.col1.y * _local23) + (_local25.col2.y * _local24)));
_arg1.extents.x = (0.5 * (_local15 - _local13));
_arg1.extents.y = (0.5 * (_local16 - _local14));
};
_local4++;
};
}
}
}//package Box2D.Collision.Shapes
Section 7
//b2Shape (Box2D.Collision.Shapes.b2Shape)
package Box2D.Collision.Shapes {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2Shape {
public var m_type:int;
public var m_next:b2Shape;
public var m_body:b2Body;
public var m_sweepRadius:Number;
public var m_density:Number;
public var m_friction:Number;
public var m_restitution:Number;
public var m_proxyId:uint;
public var m_filter:b2FilterData;
public var m_isSensor:Boolean;
public var m_userData;
public static const e_hitCollide:int = 1;
public static const e_missCollide:int = 0;
public static const e_startsInsideCollide:int = -1;
public static const e_unknownShape:int = -1;
public static const e_circleShape:int = 0;
public static const e_polygonShape:int = 1;
public static const e_shapeTypeCount:int = 2;
private static var s_proxyAABB:b2AABB = new b2AABB();
private static var s_syncAABB:b2AABB = new b2AABB();
private static var s_resetAABB:b2AABB = new b2AABB();
public function b2Shape(_arg1:b2ShapeDef){
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);
}
public 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;
};
}
public function DestroyProxy(_arg1:b2BroadPhase):void{
if (this.m_proxyId != b2Pair.b2_nullProxy){
_arg1.DestroyProxy(this.m_proxyId);
this.m_proxyId = b2Pair.b2_nullProxy;
};
}
public 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);
}
public 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;
};
}
public function UpdateSweepRadius(_arg1:b2Vec2):void{
}
public static function Create(_arg1:b2ShapeDef, _arg2):b2Shape{
switch (_arg1.type){
case e_circleShape:
return (new b2CircleShape(_arg1));
case e_polygonShape:
return (new b2PolygonShape(_arg1));
default:
return (null);
};
}
public static function Destroy(_arg1:b2Shape, _arg2):void{
}
}
}//package Box2D.Collision.Shapes
Section 8
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef)
package Box2D.Collision.Shapes {
public class b2ShapeDef {
public var type:int;// = -1
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.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 {
public var m_pairManager:b2PairManager;
public var m_proxyPool:Array;
public var m_freeProxy:uint;
public var m_bounds:Array;
public var m_querySortKeys:Array;
public var m_queryResults:Array;
public var m_queryResultCount:int;
public var m_worldAABB:b2AABB;
public var m_quantizationFactor:b2Vec2;
public var m_proxyCount:int;
public var m_timeStamp:uint;
public static const b2_invalid:uint = b2Settings.USHRT_MAX;
public static const b2_nullEdge:uint = b2Settings.USHRT_MAX;
public static var s_validate:Boolean = false;
public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){
var _local3:int;
var _local6:b2Proxy;
var _local7:int;
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++;
};
}
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++;
};
}
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 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.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Collision {
public static const b2_nullFeature:uint = 0xFF;
private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2();
public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{
var _local5:ClipVertex;
var _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 _local37:b2Vec2;
var _local38:Number;
var _local39:b2ManifoldPoint;
_arg1.pointCount = 0;
var _local7:int;
var _local8:Array = [_local7];
var _local9:Number = FindMaxSeparation(_local8, _arg2, _arg3, _arg4, _arg5);
_local7 = _local8[0];
if (_local9 > 0){
return;
};
var _local10:int;
var _local11:Array = [_local10];
var _local12:Number = FindMaxSeparation(_local11, _arg4, _arg5, _arg2, _arg3);
_local10 = _local11[0];
if (_local12 > 0){
return;
};
var _local15:b2XForm = new b2XForm();
var _local16:b2XForm = new b2XForm();
var _local19:Number = 0.98;
var _local20:Number = 0.001;
if (_local12 > ((_local19 * _local9) + _local20)){
_local13 = _arg4;
_local14 = _arg2;
_local15.Set(_arg5);
_local16.Set(_arg3);
_local17 = _local10;
_local18 = 1;
} else {
_local13 = _arg2;
_local14 = _arg4;
_local15.Set(_arg3);
_local16.Set(_arg5);
_local17 = _local7;
_local18 = 0;
};
var _local21:Array = [new ClipVertex(), new ClipVertex()];
FindIncidentEdge(_local21, _local13, _local15, _local17, _local14, _local16);
var _local22:int = _local13.m_vertexCount;
var _local23:Array = _local13.m_vertices;
var _local24:b2Vec2 = _local23[_local17];
var _local25:b2Vec2 = _local24.Copy();
if ((_local17 + 1) < _local22){
_local24 = _local23[int((_local17 + 1))];
_local37 = _local24.Copy();
} else {
_local24 = _local23[0];
_local37 = _local24.Copy();
};
var _local26:b2Vec2 = b2Math.SubtractVV(_local37, _local25);
var _local27:b2Vec2 = b2Math.b2MulMV(_local15.R, b2Math.SubtractVV(_local37, _local25));
_local27.Normalize();
var _local28:b2Vec2 = b2Math.b2CrossVF(_local27, 1);
_local25 = b2Math.b2MulX(_local15, _local25);
_local37 = b2Math.b2MulX(_local15, _local37);
var _local29:Number = b2Math.b2Dot(_local28, _local25);
var _local30:Number = -(b2Math.b2Dot(_local27, _local25));
var _local31:Number = b2Math.b2Dot(_local27, _local37);
var _local32:Array = [new ClipVertex(), new ClipVertex()];
var _local33:Array = [new ClipVertex(), new ClipVertex()];
_local34 = ClipSegmentToLine(_local32, _local21, _local27.Negative(), _local30);
if (_local34 < 2){
return;
};
_local34 = ClipSegmentToLine(_local33, _local32, _local27, _local31);
if (_local34 < 2){
return;
};
_arg1.normal = (_local18) ? _local28.Negative() : _local28.Copy();
var _local35:int;
var _local36:int;
while (_local36 < b2Settings.b2_maxManifoldPoints) {
_local6 = _local33[_local36];
_local38 = (b2Math.b2Dot(_local28, _local6.v) - _local29);
if (_local38 <= 0){
_local39 = _arg1.points[_local35];
_local39.separation = _local38;
_local39.localPoint1 = b2Math.b2MulXT(_arg3, _local6.v);
_local39.localPoint2 = b2Math.b2MulXT(_arg5, _local6.v);
_local39.id.key = _local6.id._key;
_local39.id.features.flip = _local18;
_local35++;
};
_local36++;
};
_arg1.pointCount = _local35;
}
public static function b2CollideCircles(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2Mat22;
var _local7:b2Vec2;
var _local18:Number;
var _local24:Number;
var _local25:Number;
_arg1.pointCount = 0;
_local6 = _arg3.R;
_local7 = _arg2.m_localPosition;
var _local8:Number = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
var _local9:Number = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local6 = _arg5.R;
_local7 = _arg4.m_localPosition;
var _local10:Number = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
var _local11:Number = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
var _local12:Number = (_local10 - _local8);
var _local13:Number = (_local11 - _local9);
var _local14:Number = ((_local12 * _local12) + (_local13 * _local13));
var _local15:Number = _arg2.m_radius;
var _local16:Number = _arg4.m_radius;
var _local17:Number = (_local15 + _local16);
if (_local14 > (_local17 * _local17)){
return;
};
if (_local14 < Number.MIN_VALUE){
_local18 = -(_local17);
_arg1.normal.Set(0, 1);
} else {
_local24 = Math.sqrt(_local14);
_local18 = (_local24 - _local17);
_local25 = (1 / _local24);
_arg1.normal.x = (_local25 * _local12);
_arg1.normal.y = (_local25 * _local13);
};
_arg1.pointCount = 1;
var _local19:b2ManifoldPoint = _arg1.points[0];
_local19.id.key = 0;
_local19.separation = _local18;
_local8 = (_local8 + (_local15 * _arg1.normal.x));
_local9 = (_local9 + (_local15 * _arg1.normal.y));
_local10 = (_local10 - (_local16 * _arg1.normal.x));
_local11 = (_local11 - (_local16 * _arg1.normal.y));
var _local20:Number = (0.5 * (_local8 + _local10));
var _local21:Number = (0.5 * (_local9 + _local11));
var _local22:Number = (_local20 - _arg3.position.x);
var _local23:Number = (_local21 - _arg3.position.y);
_local19.localPoint1.x = ((_local22 * _arg3.R.col1.x) + (_local23 * _arg3.R.col1.y));
_local19.localPoint1.y = ((_local22 * _arg3.R.col2.x) + (_local23 * _arg3.R.col2.y));
_local22 = (_local20 - _arg5.position.x);
_local23 = (_local21 - _arg5.position.y);
_local19.localPoint2.x = ((_local22 * _arg5.R.col1.x) + (_local23 * _arg5.R.col1.y));
_local19.localPoint2.y = ((_local22 * _arg5.R.col2.x) + (_local23 * _arg5.R.col2.y));
}
public static function b2CollidePolygonAndCircle(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2ManifoldPoint;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:b2Vec2;
var _local12:b2Mat22;
var _local17:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
_arg1.pointCount = 0;
_local12 = _arg5.R;
_local11 = _arg4.m_localPosition;
var _local13:Number = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y)));
var _local14:Number = (_arg5.position.y + ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y)));
_local7 = (_local13 - _arg3.position.x);
_local8 = (_local14 - _arg3.position.y);
_local12 = _arg3.R;
var _local15:Number = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
var _local16:Number = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
var _local18:int;
var _local19:Number = -(Number.MAX_VALUE);
var _local20:Number = _arg4.m_radius;
var _local21:int = _arg2.m_vertexCount;
var _local22:Array = _arg2.m_vertices;
var _local23:Array = _arg2.m_normals;
var _local24:int;
while (_local24 < _local21) {
_local11 = _local22[_local24];
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local11 = _local23[_local24];
_local34 = ((_local11.x * _local7) + (_local11.y * _local8));
if (_local34 > _local20){
return;
};
if (_local34 > _local19){
_local19 = _local34;
_local18 = _local24;
};
_local24++;
};
if (_local19 < Number.MIN_VALUE){
_arg1.pointCount = 1;
_local11 = _local23[_local18];
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y));
_arg1.normal.y = ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y));
_local6 = _arg1.points[0];
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = b2_nullFeature;
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local19 - _local20);
return;
};
var _local25:int = _local18;
var _local26:int = (((_local25 + 1) < _local21)) ? (_local25 + 1) : 0;
_local11 = _local22[_local25];
var _local27:b2Vec2 = _local22[_local26];
var _local28:Number = (_local27.x - _local11.x);
var _local29:Number = (_local27.y - _local11.y);
var _local30:Number = Math.sqrt(((_local28 * _local28) + (_local29 * _local29)));
_local28 = (_local28 / _local30);
_local29 = (_local29 / _local30);
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
var _local31:Number = ((_local7 * _local28) + (_local8 * _local29));
_local6 = _arg1.points[0];
if (_local31 <= 0){
_local32 = _local11.x;
_local33 = _local11.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local25;
} else {
if (_local31 >= _local30){
_local32 = _local27.x;
_local33 = _local27.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local26;
} else {
_local32 = ((_local28 * _local31) + _local11.x);
_local33 = ((_local29 * _local31) + _local11.y);
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = b2_nullFeature;
};
};
_local7 = (_local15 - _local32);
_local8 = (_local16 - _local33);
_local17 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local7 = (_local7 / _local17);
_local8 = (_local8 / _local17);
if (_local17 > _local20){
return;
};
_arg1.pointCount = 1;
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local7) + (_local12.col2.x * _local8));
_arg1.normal.y = ((_local12.col1.y * _local7) + (_local12.col2.y * _local8));
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local17 - _local20);
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
}
public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{
var _local3:b2Vec2 = _arg2.lowerBound;
var _local4:b2Vec2 = _arg1.upperBound;
var _local5:Number = (_local3.x - _local4.x);
var _local6:Number = (_local3.y - _local4.y);
_local3 = _arg1.lowerBound;
_local4 = _arg2.upperBound;
var _local7:Number = (_local3.x - _local4.x);
var _local8:Number = (_local3.y - _local4.y);
if ((((_local5 > 0)) || ((_local6 > 0)))){
return (false);
};
if ((((_local7 > 0)) || ((_local8 > 0)))){
return (false);
};
return (true);
}
}
}//package Box2D.Collision
Section 15
//b2ContactID (Box2D.Collision.b2ContactID)
package Box2D.Collision {
public class b2ContactID {
public var features:Features;
public var _key:uint;
public function b2ContactID(){
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.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class b2ContactPoint {
public var shape1:b2Shape;
public var shape2:b2Shape;
public var position:b2Vec2;
public var velocity:b2Vec2;
public var normal:b2Vec2;
public var separation:Number;
public var friction:Number;
public var restitution:Number;
public var id:b2ContactID;
public function b2ContactPoint(){
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.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Distance {
private static var s_p1s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var s_p2s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var s_points:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var gPoint:b2Point = new b2Point();
public static var g_GJK_Iterations:int = 0;
public static function ProcessTwo(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _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 {
public var m_broadPhase:b2BroadPhase;
public var m_callback:b2PairCallback;
public var m_pairs:Array;
public var m_freePair:uint;
public var m_pairCount:int;
public var m_pairBuffer:Array;
public var m_pairBufferCount:int;
public var m_hashTable:Array;
public function b2PairManager(){
var _local1:uint;
super();
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 _local4:Number;
var _local2:Number = (this.p2.x - this.p1.x);
var _local3:Number = (this.p2.y - this.p1.y);
_local4 = 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 _local4:Number;
var _local2:Number = (-(this.p2.x) + this.p1.x);
var _local3:Number = (-(this.p2.y) + this.p1.y);
_local4 = 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.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2TimeOfImpact {
public static var s_p1:b2Vec2 = new b2Vec2();
public static var s_p2:b2Vec2 = new b2Vec2();
public static var s_xf1:b2XForm = new b2XForm();
public static var s_xf2:b2XForm = new b2XForm();
public static function TimeOfImpact(_arg1:b2Shape, _arg2:b2Sweep, _arg3:b2Shape, _arg4:b2Sweep):Number{
var _local5:Number;
var _local6:Number;
var _local25:Number;
var _local26:b2XForm;
var _local27:b2XForm;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local7:Number = _arg1.m_sweepRadius;
var _local8:Number = _arg3.m_sweepRadius;
var _local9:Number = _arg2.t0;
var _local10:Number = (_arg2.c.x - _arg2.c0.x);
var _local11:Number = (_arg2.c.y - _arg2.c0.y);
var _local12:Number = (_arg4.c.x - _arg4.c0.x);
var _local13:Number = (_arg4.c.y - _arg4.c0.y);
var _local14:Number = (_arg2.a - _arg2.a0);
var _local15:Number = (_arg4.a - _arg4.a0);
var _local16:Number = 0;
var _local17:b2Vec2 = s_p1;
var _local18:b2Vec2 = s_p2;
var _local19 = 20;
var _local20:int;
var _local21:Number = 0;
var _local22:Number = 0;
var _local23:Number = 0;
var _local24:Number = 0;
while (true) {
_local25 = (((1 - _local16) * _local9) + _local16);
_local26 = s_xf1;
_local27 = s_xf2;
_arg2.GetXForm(_local26, _local25);
_arg4.GetXForm(_local27, _local25);
_local23 = b2Distance.Distance(_local17, _local18, _arg1, _local26, _arg3, _local27);
if (_local20 == 0){
if (_local23 > (2 * b2Settings.b2_toiSlop)){
_local24 = (1.5 * b2Settings.b2_toiSlop);
} else {
_local5 = (0.05 * b2Settings.b2_toiSlop);
_local6 = (_local23 - (0.5 * b2Settings.b2_toiSlop));
_local24 = ((_local5 > _local6)) ? _local5 : _local6;
};
};
if (((((_local23 - _local24) < (0.05 * b2Settings.b2_toiSlop))) || ((_local20 == _local19)))){
break;
};
_local21 = (_local18.x - _local17.x);
_local22 = (_local18.y - _local17.y);
_local28 = Math.sqrt(((_local21 * _local21) + (_local22 * _local22)));
_local21 = (_local21 / _local28);
_local22 = (_local22 / _local28);
_local29 = ((((_local21 * (_local10 - _local12)) + (_local22 * (_local11 - _local13))) + (((_local14 < 0)) ? -(_local14) : _local14 * _local7)) + (((_local15 < 0)) ? -(_local15) : _local15 * _local8));
if (_local29 == 0){
_local16 = 1;
break;
};
_local30 = ((_local23 - _local24) / _local29);
_local31 = (_local16 + _local30);
if ((((_local31 < 0)) || ((1 < _local31)))){
_local16 = 1;
break;
};
if (_local31 < ((1 + (100 * Number.MIN_VALUE)) * _local16)){
break;
};
_local16 = _local31;
_local20++;
};
return (_local16);
}
}
}//package Box2D.Collision
Section 28
//ClipVertex (Box2D.Collision.ClipVertex)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class ClipVertex {
public var v:b2Vec2;
public var id:b2ContactID;
public function ClipVertex(){
this.v = new b2Vec2();
this.id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 29
//Features (Box2D.Collision.Features)
package Box2D.Collision {
public class Features {
public var _referenceEdge:int;
public var _incidentEdge:int;
public var _incidentVertex:int;
public var _flip:int;
public var _m_id:b2ContactID;
public function set referenceEdge(_arg1:int):void{
this._referenceEdge = _arg1;
this._m_id._key = ((this._m_id._key & 4294967040) | (this._referenceEdge & 0xFF));
}
public function get referenceEdge():int{
return (this._referenceEdge);
}
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 incidentEdge():int{
return (this._incidentEdge);
}
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 incidentVertex():int{
return (this._incidentVertex);
}
public function set flip(_arg1:int):void{
this._flip = _arg1;
this._m_id._key = ((this._m_id._key & 0xFFFFFF) | ((this._flip << 24) & 4278190080));
}
public function get flip():int{
return (this._flip);
}
}
}//package Box2D.Collision
Section 30
//b2Mat22 (Box2D.Common.Math.b2Mat22)
package Box2D.Common.Math {
public class b2Mat22 {
public var col1:b2Vec2;
public var col2:b2Vec2;
public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){
var _local4:Number;
var _local5:Number;
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 | (this._g << 8)) | (this._b << 16)));
}
}
}//package Box2D.Common
Section 36
//b2Settings (Box2D.Common.b2Settings)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Settings {
public static const USHRT_MAX:int = 0xFFFF;
public static const b2_pi:Number = 3.14159265358979;
public static const b2_maxManifoldPoints:int = 2;
public static const b2_maxPolygonVertices:int = 16;
public static const b2_maxProxies:int = 0x0200;
public static const b2_maxPairs:int = 4096;
public static const b2_linearSlop:Number = 0.005;
public static const b2_angularSlop:Number = 0.0349065850398866;
public static const b2_toiSlop:Number = 0.04;
public static const b2_maxTOIContactsPerIsland:int = 32;
public static const b2_velocityThreshold:Number = 1;
public static const b2_maxLinearCorrection:Number = 0.2;
public static const b2_maxAngularCorrection:Number = 0.139626340159546;
public static const b2_maxLinearVelocity:Number = 200;
public static const b2_maxLinearVelocitySquared:Number = 40000;
public static const b2_maxAngularVelocity:Number = 250;
public static const b2_maxAngularVelocitySquared:Number = 62500;
public static const b2_contactBaumgarte:Number = 0.2;
public static const b2_timeToSleep:Number = 0.5;
public static const b2_linearSleepTolerance:Number = 0.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 37
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2CircleContact extends b2Contact {
private var m_manifolds:Array;
public var m_manifold:b2Manifold;
private var m0:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){
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 public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local8:b2ManifoldPoint;
var _local5:b2Body = m_shape1.m_body;
var _local6:b2Body = m_shape2.m_body;
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 38
//b2Contact (Box2D.Dynamics.Contacts.b2Contact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Contact {
public var m_flags:uint;
public var m_prev:b2Contact;
public var m_next:b2Contact;
public var m_node1:b2ContactEdge;
public var m_node2:b2ContactEdge;
public var m_shape1:b2Shape;
public var m_shape2:b2Shape;
public var m_manifoldCount:int;
public var m_friction:Number;
public var m_restitution:Number;
public var m_toi:Number;
public static var e_nonSolidFlag:uint = 1;
public static var e_slowFlag:uint = 2;
public static var e_islandFlag:uint = 4;
public static var e_toiFlag:uint = 8;
public static var s_registers:Array;
public static var s_initialized:Boolean = false;
public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){
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);
}
public 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);
};
}
public function Evaluate(_arg1:b2ContactListener):void{
}
public static function AddType(_arg1:Function, _arg2:Function, _arg3:int, _arg4:int):void{
s_registers[_arg3][_arg4].createFcn = _arg1;
s_registers[_arg3][_arg4].destroyFcn = _arg2;
s_registers[_arg3][_arg4].primary = true;
if (_arg3 != _arg4){
s_registers[_arg4][_arg3].createFcn = _arg1;
s_registers[_arg4][_arg3].destroyFcn = _arg2;
s_registers[_arg4][_arg3].primary = false;
};
}
public static function InitializeRegisters():void{
var _local2:int;
s_registers = new Array(b2Shape.e_shapeTypeCount);
var _local1:int;
while (_local1 < b2Shape.e_shapeTypeCount) {
s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount);
_local2 = 0;
while (_local2 < b2Shape.e_shapeTypeCount) {
s_registers[_local1][_local2] = new b2ContactRegister();
_local2++;
};
_local1++;
};
AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape);
AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_circleShape);
AddType(b2PolygonContact.Create, b2PolygonContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_polygonShape);
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
var _local8:b2Contact;
var _local9:int;
var _local10:b2Manifold;
if (s_initialized == false){
InitializeRegisters();
s_initialized = true;
};
var _local4:int = _arg1.m_type;
var _local5:int = _arg2.m_type;
var _local6:b2ContactRegister = s_registers[_local4][_local5];
var _local7:Function = _local6.createFcn;
if (_local7 != null){
if (_local6.primary){
return (_local7(_arg1, _arg2, _arg3));
};
_local8 = _local7(_arg2, _arg1, _arg3);
_local9 = 0;
while (_local9 < _local8.m_manifoldCount) {
_local10 = _local8.GetManifolds()[_local9];
_local8.GetManifolds()[_local9].normal = _local10.normal.Negative();
_local9++;
};
return (_local8);
//unresolved jump
};
return (null);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
if (_arg1.m_manifoldCount > 0){
_arg1.m_shape1.m_body.WakeUp();
_arg1.m_shape2.m_body.WakeUp();
};
var _local3:int = _arg1.m_shape1.m_type;
var _local4:int = _arg1.m_shape2.m_type;
var _local5:b2ContactRegister = s_registers[_local3][_local4];
var _local6:Function = _local5.destroyFcn;
_local6(_arg1, _arg2);
}
}
}//package Box2D.Dynamics.Contacts
Section 39
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2ContactConstraint {
public var points:Array;
public var normal:b2Vec2;
public var manifold:b2Manifold;
public var body1:b2Body;
public var body2:b2Body;
public var friction:Number;
public var restitution:Number;
public var pointCount:int;
public function b2ContactConstraint(){
this.normal = new b2Vec2();
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 40
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
public class b2ContactConstraintPoint {
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var r1:b2Vec2;
public var r2:b2Vec2;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var positionImpulse:Number;
public var normalMass:Number;
public var tangentMass:Number;
public var equalizedMass:Number;
public var separation:Number;
public var velocityBias:Number;
public function b2ContactConstraintPoint(){
this.localAnchor1 = new b2Vec2();
this.localAnchor2 = new b2Vec2();
this.r1 = new b2Vec2();
this.r2 = new b2Vec2();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 41
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2ContactEdge {
public var other:b2Body;
public var contact:b2Contact;
public var prev:b2ContactEdge;
public var next:b2ContactEdge;
}
}//package Box2D.Dynamics.Contacts
Section 42
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister)
package Box2D.Dynamics.Contacts {
public class b2ContactRegister {
public var createFcn:Function;
public var destroyFcn:Function;
public var primary:Boolean;
}
}//package Box2D.Dynamics.Contacts
Section 43
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class b2ContactResult {
public var shape1:b2Shape;
public var shape2:b2Shape;
public var position:b2Vec2;
public var normal:b2Vec2;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var id:b2ContactID;
public function b2ContactResult(){
this.position = new b2Vec2();
this.normal = new b2Vec2();
this.id = new b2ContactID();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 44
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2ContactSolver {
public var m_step:b2TimeStep;
public var m_allocator;
public var m_constraints:Array;
public var m_constraintCount:int;
public function b2ContactSolver(_arg1:b2TimeStep, _arg2:Array, _arg3:int, _arg4){
var _local5:b2Contact;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Mat22;
var _local10:b2Body;
var _local11:b2Body;
var _local12:int;
var _local13:Array;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:int;
var _local23:b2Manifold;
var _local24:Number;
var _local25:Number;
var _local26:b2ContactConstraint;
var _local27:uint;
var _local28:b2ManifoldPoint;
var _local29:b2ContactConstraintPoint;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local40:Number;
var _local41:Number;
var _local42:Number;
var _local43:Number;
var _local44:Number;
var _local45:Number;
var _local46:Number;
var _local47:Number;
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.positionImpulse = 0;
_local29.localAnchor1.SetV(_local28.localPoint1);
_local29.localAnchor2.SetV(_local28.localPoint2);
_local8 = _local10.m_xf.R;
_local32 = (_local28.localPoint1.x - _local10.m_sweep.localCenter.x);
_local33 = (_local28.localPoint1.y - _local10.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local32) + (_local8.col2.x * _local33));
_local33 = ((_local8.col1.y * _local32) + (_local8.col2.y * _local33));
_local32 = _local30;
_local29.r1.Set(_local32, _local33);
_local8 = _local11.m_xf.R;
_local34 = (_local28.localPoint2.x - _local11.m_sweep.localCenter.x);
_local35 = (_local28.localPoint2.y - _local11.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local34) + (_local8.col2.x * _local35));
_local35 = ((_local8.col1.y * _local34) + (_local8.col2.y * _local35));
_local34 = _local30;
_local29.r2.Set(_local34, _local35);
_local36 = ((_local32 * _local32) + (_local33 * _local33));
_local37 = ((_local34 * _local34) + (_local35 * _local35));
_local38 = ((_local32 * _local24) + (_local33 * _local25));
_local39 = ((_local34 * _local24) + (_local35 * _local25));
_local40 = (_local10.m_invMass + _local11.m_invMass);
_local40 = (_local40 + ((_local10.m_invI * (_local36 - (_local38 * _local38))) + (_local11.m_invI * (_local37 - (_local39 * _local39)))));
_local29.normalMass = (1 / _local40);
_local41 = ((_local10.m_mass * _local10.m_invMass) + (_local11.m_mass * _local11.m_invMass));
_local41 = (_local41 + (((_local10.m_mass * _local10.m_invI) * (_local36 - (_local38 * _local38))) + ((_local11.m_mass * _local11.m_invI) * (_local37 - (_local39 * _local39)))));
_local29.equalizedMass = (1 / _local41);
_local42 = _local25;
_local43 = -(_local24);
_local44 = ((_local32 * _local42) + (_local33 * _local43));
_local45 = ((_local34 * _local42) + (_local35 * _local43));
_local46 = (_local10.m_invMass + _local11.m_invMass);
_local46 = (_local46 + ((_local10.m_invI * (_local36 - (_local44 * _local44))) + (_local11.m_invI * (_local37 - (_local45 * _local45)))));
_local29.tangentMass = (1 / _local46);
_local29.velocityBias = 0;
if (_local29.separation > 0){
_local29.velocityBias = (-60 * _local29.separation);
};
_local30 = (((_local18 + (-(_local21) * _local35)) - _local16) - (-(_local20) * _local33));
_local31 = (((_local19 + (_local21 * _local34)) - _local17) - (_local20 * _local32));
_local47 = ((_local26.normal.x * _local30) + (_local26.normal.y * _local31));
if (_local47 < -(b2Settings.b2_velocityThreshold)){
_local29.velocityBias = (_local29.velocityBias + (-(_local26.restitution) * _local47));
};
_local27++;
};
_local9++;
_local22++;
};
_local6++;
};
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2Mat22;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:int;
var _local20:b2ContactConstraintPoint;
var _local21:Number;
var _local22:Number;
var _local23:b2ContactConstraintPoint;
var _local5:int;
while (_local5 < 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:b2Mat22;
var _local18:b2Vec2;
var _local20:b2ContactConstraint;
var _local21:b2Body;
var _local22:b2Body;
var _local23:Number;
var _local24:Number;
var _local25:b2Vec2;
var _local26:b2Vec2;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:int;
var _local38:Number;
var _local19:int;
while (_local19 < this.m_constraintCount) {
_local20 = this.m_constraints[_local19];
_local21 = _local20.body1;
_local22 = _local20.body2;
_local23 = _local21.m_angularVelocity;
_local24 = _local22.m_angularVelocity;
_local25 = _local21.m_linearVelocity;
_local26 = _local22.m_linearVelocity;
_local27 = _local21.m_invMass;
_local28 = _local21.m_invI;
_local29 = _local22.m_invMass;
_local30 = _local22.m_invI;
_local31 = _local20.normal.x;
_local32 = _local20.normal.y;
_local33 = _local32;
_local34 = -(_local31);
_local35 = _local20.friction;
_local37 = _local20.pointCount;
_local1 = 0;
while (_local1 < _local37) {
_local2 = _local20.points[_local1];
_local7 = (((_local26.x + (-(_local24) * _local2.r2.y)) - _local25.x) - (-(_local23) * _local2.r1.y));
_local8 = (((_local26.y + (_local24 * _local2.r2.x)) - _local25.y) - (_local23 * _local2.r1.x));
_local9 = ((_local7 * _local31) + (_local8 * _local32));
_local11 = (-(_local2.normalMass) * (_local9 - _local2.velocityBias));
_local10 = ((_local7 * _local33) + (_local8 * _local34));
_local12 = (_local2.tangentMass * -(_local10));
_local13 = b2Math.b2Max((_local2.normalImpulse + _local11), 0);
_local11 = (_local13 - _local2.normalImpulse);
_local38 = (_local35 * _local2.normalImpulse);
_local14 = b2Math.b2Clamp((_local2.tangentImpulse + _local12), -(_local38), _local38);
_local12 = (_local14 - _local2.tangentImpulse);
_local15 = ((_local11 * _local31) + (_local12 * _local33));
_local16 = ((_local11 * _local32) + (_local12 * _local34));
_local25.x = (_local25.x - (_local27 * _local15));
_local25.y = (_local25.y - (_local27 * _local16));
_local23 = (_local23 - (_local28 * ((_local2.r1.x * _local16) - (_local2.r1.y * _local15))));
_local26.x = (_local26.x + (_local29 * _local15));
_local26.y = (_local26.y + (_local29 * _local16));
_local24 = (_local24 + (_local30 * ((_local2.r2.x * _local16) - (_local2.r2.y * _local15))));
_local2.normalImpulse = _local13;
_local2.tangentImpulse = _local14;
_local1++;
};
_local21.m_angularVelocity = _local23;
_local22.m_angularVelocity = _local24;
_local19++;
};
}
public function FinalizeVelocityConstraints():void{
var _local2:b2ContactConstraint;
var _local3:b2Manifold;
var _local4:int;
var _local5:b2ManifoldPoint;
var _local6:b2ContactConstraintPoint;
var _local1:int;
while (_local1 < 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 _local38: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 = _local21.positionImpulse;
_local21.positionImpulse = b2Math.b2Max((_local36 + _local35), 0);
_local35 = (_local21.positionImpulse - _local36);
_local37 = (_local35 * _local17);
_local38 = (_local35 * _local18);
_local9.x = (_local9.x - (_local13 * _local37));
_local9.y = (_local9.y - (_local13 * _local38));
_local10 = (_local10 - (_local14 * ((_local22 * _local38) - (_local23 * _local37))));
_local7.m_sweep.a = _local10;
_local7.SynchronizeTransform();
_local11.x = (_local11.x + (_local15 * _local37));
_local11.y = (_local11.y + (_local15 * _local38));
_local12 = (_local12 + (_local16 * ((_local24 * _local38) - (_local25 * _local37))));
_local8.m_sweep.a = _local12;
_local8.SynchronizeTransform();
_local20++;
};
_local5++;
};
return ((_local2 >= (-1.5 * b2Settings.b2_linearSlop)));
}
}
}//package Box2D.Dynamics.Contacts
Section 45
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2NullContact extends b2Contact {
override public function Evaluate(_arg1:b2ContactListener):void{
}
override public function GetManifolds():Array{
return (null);
}
}
}//package Box2D.Dynamics.Contacts
Section 46
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2PolyAndCircleContact extends b2Contact {
private var m_manifolds:Array;
public var m_manifold:b2Manifold;
private var m0:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){
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 public function Evaluate(_arg1:b2ContactListener):void{
var _local2:int;
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2ManifoldPoint;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
var _local6:b2Body = m_shape1.m_body;
var _local7:b2Body = m_shape2.m_body;
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 47
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2PolygonContact extends b2Contact {
private var m0:b2Manifold;
private var m_manifolds:Array;
public var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolygonContact(_arg1:b2Shape, _arg2:b2Shape):void{
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 public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local7:b2ContactPoint;
var _local8:int;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
var _local5:b2Body = m_shape1.m_body;
var _local6:b2Body = m_shape2.m_body;
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 48
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2DistanceJoint extends b2Joint {
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_u:b2Vec2;
public var m_frequencyHz:Number;
public var m_dampingRatio:Number;
public var m_gamma:Number;
public var m_bias:Number;
public var m_impulse:Number;
public var m_mass:Number;
public var m_length:Number;
public function b2DistanceJoint(_arg1:b2DistanceJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
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 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 public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
_local2 = _local3.m_xf.R;
var _local5:Number = (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 public 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));
}
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);
}
}
}//package Box2D.Dynamics.Joints
Section 49
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2DistanceJointDef extends b2JointDef {
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var length:Number;
public var frequencyHz:Number;
public var dampingRatio:Number;
public function b2DistanceJointDef(){
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 50
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2GearJoint extends b2Joint {
public var m_ground1:b2Body;
public var m_ground2:b2Body;
public var m_revolute1:b2RevoluteJoint;
public var m_prismatic1:b2PrismaticJoint;
public var m_revolute2:b2RevoluteJoint;
public var m_prismatic2:b2PrismaticJoint;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_J:b2Jacobian;
public var m_constant:Number;
public var m_ratio:Number;
public var m_mass:Number;
public var m_force:Number;
public function b2GearJoint(_arg1:b2GearJointDef){
var _local4:Number;
var _local5:Number;
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 public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local15:Number;
var _local2:b2Body = 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 public 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 public function SolvePositionConstraints():Boolean{
var _local4:Number;
var _local5:Number;
var _local1:Number = 0;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
if (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 51
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef)
package Box2D.Dynamics.Joints {
public class b2GearJointDef extends b2JointDef {
public var joint1:b2Joint;
public var joint2:b2Joint;
public var ratio:Number;
public function b2GearJointDef(){
type = b2Joint.e_gearJoint;
this.joint1 = null;
this.joint2 = null;
this.ratio = 1;
}
}
}//package Box2D.Dynamics.Joints
Section 52
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2Jacobian {
public var linear1:b2Vec2;
public var angular1:Number;
public var linear2:b2Vec2;
public var angular2:Number;
public function b2Jacobian(){
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 53
//b2Joint (Box2D.Dynamics.Joints.b2Joint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2Joint {
public var m_type:int;
public var m_prev:b2Joint;
public var m_next:b2Joint;
public var m_node1:b2JointEdge;
public var m_node2:b2JointEdge;
public var m_body1:b2Body;
public var m_body2:b2Body;
public var m_inv_dt:Number;
public var m_islandFlag:Boolean;
public var m_collideConnected:Boolean;
public var m_userData;
public static const e_unknownJoint:int = 0;
public static const e_revoluteJoint:int = 1;
public static const e_prismaticJoint:int = 2;
public static const e_distanceJoint:int = 3;
public static const e_pulleyJoint:int = 4;
public static const e_mouseJoint:int = 5;
public static const e_gearJoint:int = 6;
public static const e_inactiveLimit:int = 0;
public static const e_atLowerLimit:int = 1;
public static const e_atUpperLimit:int = 2;
public static const e_equalLimits:int = 3;
public function b2Joint(_arg1:b2JointDef){
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;
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
}
public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
}
public function InitPositionConstraints():void{
}
public function SolvePositionConstraints():Boolean{
return (false);
}
public static function Create(_arg1:b2JointDef, _arg2):b2Joint{
var _local3:b2Joint;
switch (_arg1.type){
case e_distanceJoint:
_local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef));
break;
case e_mouseJoint:
_local3 = new b2MouseJoint((_arg1 as b2MouseJointDef));
break;
case e_prismaticJoint:
_local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef));
break;
case e_revoluteJoint:
_local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef));
break;
case e_pulleyJoint:
_local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef));
break;
case e_gearJoint:
_local3 = new b2GearJoint((_arg1 as b2GearJointDef));
break;
default:
break;
};
return (_local3);
}
public static function Destroy(_arg1:b2Joint, _arg2):void{
}
}
}//package Box2D.Dynamics.Joints
Section 54
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointDef {
public var type:int;
public var userData;
public var body1:b2Body;
public var body2:b2Body;
public var collideConnected:Boolean;
public function b2JointDef(){
this.type = b2Joint.e_unknownJoint;
this.userData = null;
this.body1 = null;
this.body2 = null;
this.collideConnected = false;
}
}
}//package Box2D.Dynamics.Joints
Section 55
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointEdge {
public var other:b2Body;
public var joint:b2Joint;
public var prev:b2JointEdge;
public var next:b2JointEdge;
}
}//package Box2D.Dynamics.Joints
Section 56
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2MouseJoint extends b2Joint {
private var K:b2Mat22;
private var K1:b2Mat22;
private var K2:b2Mat22;
public var m_localAnchor:b2Vec2;
public var m_target:b2Vec2;
public var m_impulse:b2Vec2;
public var m_mass:b2Mat22;
public var m_C:b2Vec2;
public var m_maxForce:Number;
public var m_beta:Number;
public var m_gamma:Number;
public function b2MouseJoint(_arg1:b2MouseJointDef){
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 public 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 public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local2:b2Body = m_body2;
_local3 = _local2.m_xf.R;
var _local6:Number = (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 public function SolvePositionConstraints():Boolean{
return (true);
}
}
}//package Box2D.Dynamics.Joints
Section 57
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2MouseJointDef extends b2JointDef {
public var target:b2Vec2;
public var maxForce:Number;
public var frequencyHz:Number;
public var dampingRatio:Number;
public var timeStep:Number;
public function b2MouseJointDef(){
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 58
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PrismaticJoint extends b2Joint {
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_localXAxis1:b2Vec2;
public var m_localYAxis1:b2Vec2;
public var m_refAngle:Number;
public var m_linearJacobian:b2Jacobian;
public var m_linearMass:Number;
public var m_force:Number;
public var m_angularMass:Number;
public var m_torque:Number;
public var m_motorJacobian:b2Jacobian;
public var m_motorMass:Number;
public var m_motorForce:Number;
public var m_limitForce:Number;
public var m_limitPositionImpulse:Number;
public var m_lowerTranslation:Number;
public var m_upperTranslation:Number;
public var m_maxMotorForce:Number;
public var m_motorSpeed:Number;
public var m_enableLimit:Boolean;
public var m_enableMotor:Boolean;
public var m_limitState:int;
public function b2PrismaticJoint(_arg1:b2PrismaticJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
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 public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local5:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local6:Number = (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 public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local8:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
var _local4:Number = _local2.m_invMass;
var _local5:Number = _local3.m_invMass;
var _local6:Number = _local2.m_invI;
var _local7:Number = _local3.m_invI;
var _local9:Number = 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 public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local9:b2Mat22;
var _local10:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
var _local5:Number = _local3.m_invMass;
var _local6:Number = _local4.m_invMass;
var _local7:Number = _local3.m_invI;
var _local8:Number = _local4.m_invI;
_local9 = _local3.m_xf.R;
var _local11:Number = (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 59
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2PrismaticJointDef extends b2JointDef {
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var localAxis1:b2Vec2;
public var referenceAngle:Number;
public var enableLimit:Boolean;
public var lowerTranslation:Number;
public var upperTranslation:Number;
public var enableMotor:Boolean;
public var maxMotorForce:Number;
public var motorSpeed:Number;
public function b2PrismaticJointDef(){
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 60
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PulleyJoint extends b2Joint {
public var m_ground:b2Body;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_u1:b2Vec2;
public var m_u2:b2Vec2;
public var m_constant:Number;
public var m_ratio:Number;
public var m_maxLength1:Number;
public var m_maxLength2:Number;
public var m_pulleyMass:Number;
public var m_limitMass1:Number;
public var m_limitMass2:Number;
public var m_force:Number;
public var m_limitForce1:Number;
public var m_limitForce2:Number;
public var m_positionImpulse:Number;
public var m_limitPositionImpulse1:Number;
public var m_limitPositionImpulse2:Number;
public var m_state:int;
public var m_limitState1:int;
public var m_limitState2:int;
public static const b2_minPulleyLength:Number = 2;
public function b2PulleyJoint(_arg1:b2PulleyJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
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 public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local5:Number = (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 public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local5:Number = (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 public function SolvePositionConstraints():Boolean{
var _local3:b2Mat22;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local1:b2Body = m_body1;
var _local2:b2Body = m_body2;
var _local4:Number = (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 61
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2PulleyJointDef extends b2JointDef {
public var groundAnchor1:b2Vec2;
public var groundAnchor2:b2Vec2;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var length1:Number;
public var maxLength1:Number;
public var length2:Number;
public var maxLength2:Number;
public var ratio:Number;
public function b2PulleyJointDef(){
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 62
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2RevoluteJoint extends b2Joint {
private var K:b2Mat22;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K3:b2Mat22;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_pivotForce:b2Vec2;
public var m_motorForce:Number;
public var m_limitForce:Number;
public var m_limitPositionImpulse:Number;
public var m_pivotMass:b2Mat22;
public var m_motorMass:Number;
public var m_enableMotor:Boolean;
public var m_maxMotorTorque:Number;
public var m_motorSpeed:Number;
public var m_enableLimit:Boolean;
public var m_referenceAngle:Number;
public var m_lowerAngle:Number;
public var m_upperAngle:Number;
public var m_limitState:int;
public static var tImpulse:b2Vec2 = new b2Vec2();
public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){
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();
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 public 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 public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local5:Number;
var _local10:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local6:Number = (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)));
this.m_pivotForce.x = (this.m_pivotForce.x + _local13);
this.m_pivotForce.y = (this.m_pivotForce.y + _local14);
var _local15:Number = (_arg1.dt * _local13);
_local16 = (_arg1.dt * _local14);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local16) - (_local9 * _local15))));
if (((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 public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local6:b2Mat22;
var _local25:Number;
var _local26:Number;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
var _local5:Number = 0;
_local6 = _local3.m_xf.R;
var _local7:Number = (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 63
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2RevoluteJointDef extends b2JointDef {
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var referenceAngle:Number;
public var enableLimit:Boolean;
public var lowerAngle:Number;
public var upperAngle:Number;
public var enableMotor:Boolean;
public var motorSpeed:Number;
public var maxMotorTorque:Number;
public function b2RevoluteJointDef(){
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 64
//b2Body (Box2D.Dynamics.b2Body)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
public class b2Body {
public var m_flags:uint;
public var m_type:int;
public var m_xf:b2XForm;
public var m_sweep:b2Sweep;
public var m_linearVelocity:b2Vec2;
public var m_angularVelocity:Number;
public var m_force:b2Vec2;
public var m_torque:Number;
public var m_world:b2World;
public var m_prev:b2Body;
public var m_next:b2Body;
public var m_shapeList:b2Shape;
public var m_shapeCount:int;
public var m_jointList:b2JointEdge;
public var m_contactList:b2ContactEdge;
public var m_mass:Number;
public var m_invMass:Number;
public var m_I:Number;
public var m_invI:Number;
public var m_linearDamping:Number;
public var m_angularDamping:Number;
public var m_sleepTime:Number;
public var m_userData;
public var m_applyGravity:Boolean;
private static var s_massData:b2MassData = new b2MassData();
private static var s_xf1:b2XForm = new b2XForm();
public static var e_frozenFlag:uint = 2;
public static var e_islandFlag:uint = 4;
public static var e_sleepFlag:uint = 8;
public static var e_allowSleepFlag:uint = 16;
public static var e_bulletFlag:uint = 32;
public static var e_fixedRotationFlag:uint = 64;
public static var e_staticType:uint = 1;
public static var e_dynamicType:uint = 2;
public static var e_maxTypes:uint = 3;
public function b2Body(_arg1:b2BodyDef, _arg2:b2World){
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;
this.m_applyGravity = _arg1.applyGravity;
}
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.x - (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 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);
}
public 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);
}
public 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)));
}
public 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);
}
public 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 65
//b2BodyDef (Box2D.Dynamics.b2BodyDef)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class b2BodyDef {
public var massData:b2MassData;
public var userData;
public var position:b2Vec2;
public var angle:Number;
public var linearDamping:Number;
public var angularDamping:Number;
public var allowSleep:Boolean;
public var isSleeping:Boolean;
public var fixedRotation:Boolean;
public var isBullet:Boolean;
public var applyGravity:Boolean;
public function b2BodyDef(){
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;
this.applyGravity = true;
}
}
}//package Box2D.Dynamics
Section 66
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener)
package Box2D.Dynamics {
public class b2BoundaryListener {
public function Violation(_arg1:b2Body):void{
}
}
}//package Box2D.Dynamics
Section 67
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
public class b2ContactFilter {
public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter);
;
public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{
var _local3:b2FilterData = _arg1.GetFilterData();
var _local4:b2FilterData = _arg2.GetFilterData();
if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){
return ((_local3.groupIndex > 0));
};
var _local5:Boolean = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0))));
return (_local5);
}
public function RayCollide(_arg1, _arg2:b2Shape):Boolean{
if (!_arg1){
return (true);
};
return (this.ShouldCollide((_arg1 as b2Shape), _arg2));
}
}
}//package Box2D.Dynamics
Section 68
//b2ContactListener (Box2D.Dynamics.b2ContactListener)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactListener {
public function Add(_arg1:b2ContactPoint):void{
}
public function Persist(_arg1:b2ContactPoint):void{
}
public function Remove(_arg1:b2ContactPoint):void{
}
public function Result(_arg1:b2ContactResult):void{
}
}
}//package Box2D.Dynamics
Section 69
//b2ContactManager (Box2D.Dynamics.b2ContactManager)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactManager extends b2PairCallback {
public var m_world:b2World;
public var m_nullContact:b2NullContact;
public var m_destroyImmediate:Boolean;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2ContactManager(){
this.m_nullContact = new b2NullContact();
super();
this.m_world = null;
this.m_destroyImmediate = false;
}
override public function PairAdded(_arg1, _arg2){
var _local5:b2Body;
var _local3:b2Shape = (_arg1 as b2Shape);
var _local4:b2Shape = (_arg2 as b2Shape);
_local5 = _local3.m_body;
var _local6:b2Body = _local4.m_body;
if (((_local5.IsStatic()) && (_local6.IsStatic()))){
return (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 70
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw)
package Box2D.Dynamics {
import flash.display.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2DebugDraw {
public var m_drawFlags:uint;
public var m_sprite:Sprite;
public var m_drawScale:Number;// = 1
public var m_lineThickness:Number;// = 1
public var m_alpha:Number;// = 1
public var m_fillAlpha:Number;// = 1
public var m_xformScale:Number;// = 1
public static var e_shapeBit:uint = 1;
public static var e_jointBit:uint = 2;
public static var e_coreShapeBit:uint = 4;
public static var e_aabbBit:uint = 8;
public static var e_obbBit:uint = 16;
public static var e_pairBit:uint = 32;
public static var e_centerOfMassBit:uint = 64;
public function b2DebugDraw(){
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 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 71
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener)
package Box2D.Dynamics {
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
public class b2DestructionListener {
public function SayGoodbyeJoint(_arg1:b2Joint):void{
}
public function SayGoodbyeShape(_arg1:b2Shape):void{
}
}
}//package Box2D.Dynamics
Section 72
//b2Island (Box2D.Dynamics.b2Island)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2Island {
public var m_allocator;
public var m_listener:b2ContactListener;
public var m_bodies:Array;
public var m_contacts:Array;
public var m_joints:Array;
public var m_bodyCount:int;
public var m_jointCount:int;
public var m_contactCount:int;
public var m_bodyCapacity:int;
public var m_contactCapacity:int;
public var m_jointCapacity:int;
public var m_positionIterationCount:int;
private static var s_reportCR:b2ContactResult = new b2ContactResult();
public function b2Island(_arg1:int, _arg2:int, _arg3:int, _arg4, _arg5:b2ContactListener){
var _local6:int;
super();
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 {
if (_local6.m_applyGravity){
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x))));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y))));
} else {
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + ((_arg1.dt * _local6.m_invMass) * _local6.m_force.x));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + ((_arg1.dt * _local6.m_invMass) * _local6.m_force.y));
};
_local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque));
_local6.m_force.SetZero();
_local6.m_torque = 0;
_local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1));
_local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1));
if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){
_local6.m_linearVelocity.Normalize();
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity);
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity);
};
if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){
if (_local6.m_angularVelocity < 0){
_local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity);
} else {
_local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity;
};
};
};
_local5++;
};
var _local8:b2ContactSolver = new b2ContactSolver(_arg1, 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 _local5:b2Body;
var _local6:Boolean;
var _local3:b2ContactSolver = new b2ContactSolver(_arg1, this.m_contacts, this.m_contactCount, this.m_allocator);
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local3.SolveVelocityConstraints();
_local2++;
};
_local2 = 0;
while (_local2 < this.m_bodyCount) {
_local5 = this.m_bodies[_local2];
if (_local5.IsStatic()){
} else {
_local5.m_sweep.c0.SetV(_local5.m_sweep.c);
_local5.m_sweep.a0 = _local5.m_sweep.a;
_local5.m_sweep.c.x = (_local5.m_sweep.c.x + (_arg1.dt * _local5.m_linearVelocity.x));
_local5.m_sweep.c.y = (_local5.m_sweep.c.y + (_arg1.dt * _local5.m_linearVelocity.y));
_local5.m_sweep.a = (_local5.m_sweep.a + (_arg1.dt * _local5.m_angularVelocity));
_local5.SynchronizeTransform();
};
_local2++;
};
var _local4:Number = 0.75;
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local6 = _local3.SolvePositionConstraints(_local4);
if (_local6){
break;
};
_local2++;
};
this.Report(_local3.m_constraints);
}
public function Report(_arg1:Array):void{
var _local2:b2Mat22;
var _local3:b2Vec2;
var _local5:b2Contact;
var _local6:b2ContactConstraint;
var _local7:b2ContactResult;
var _local8:b2Body;
var _local9:int;
var _local10:Array;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2ContactConstraintPoint;
if (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 73
//b2TimeStep (Box2D.Dynamics.b2TimeStep)
package Box2D.Dynamics {
public class b2TimeStep {
public var dt:Number;
public var inv_dt:Number;
public var dtRatio:Number;
public var maxIterations:int;
public var warmStarting:Boolean;
public var positionCorrection:Boolean;
}
}//package Box2D.Dynamics
Section 74
//b2World (Box2D.Dynamics.b2World)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2World {
public var m_raycastUserData;
public var m_raycastSegment:b2Segment;
public var m_raycastNormal:b2Vec2;
public var m_blockAllocator;
public var m_stackAllocator;
public var m_lock:Boolean;
public var m_broadPhase:b2BroadPhase;
public var m_contactManager:b2ContactManager;
public var m_bodyList:b2Body;
public var m_jointList:b2Joint;
public var m_contactList:b2Contact;
public var m_bodyCount:int;
public var m_contactCount:int;
public var m_jointCount:int;
public var m_gravity:b2Vec2;
public var m_allowSleep:Boolean;
public var m_groundBody:b2Body;
public var m_destructionListener:b2DestructionListener;
public var m_boundaryListener:b2BoundaryListener;
public var m_contactFilter:b2ContactFilter;
public var m_contactListener:b2ContactListener;
public var m_debugDraw:b2DebugDraw;
public var m_inv_dt0:Number;
public var m_positionIterationCount:int;
private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8);
private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6);
private static var s_xf:b2XForm = new b2XForm();
public static var m_positionCorrection:Boolean;
public static var m_warmStarting:Boolean;
public static var m_continuousPhysics:Boolean;
public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){
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:b2Body = _arg1.m_body1;
var _local3:b2Body = _arg1.m_body2;
if (!_arg1.m_body1){
throw (new Error("You cannot delete a joint twice."));
};
_arg1.m_body1 = null;
_arg1.m_body2 = null;
var _local4:Boolean = _arg1.m_collideConnected;
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == this.m_jointList){
this.m_jointList = _arg1.m_next;
};
_local2.WakeUp();
_local3.WakeUp();
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local2.m_jointList){
_local2.m_jointList = _arg1.m_node1.next;
};
_arg1.m_node1.prev = null;
_arg1.m_node1.next = null;
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local3.m_jointList){
_local3.m_jointList = _arg1.m_node2.next;
};
_arg1.m_node2.prev = null;
_arg1.m_node2.next = null;
b2Joint.Destroy(_arg1, this.m_blockAllocator);
this.m_jointCount--;
if (_local4 == false){
_local5 = ((_local2.m_shapeCount < _local3.m_shapeCount)) ? _local2 : _local3;
_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 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 GetBodyList():b2Body{
return (this.m_bodyList);
}
public function GetJointList():b2Joint{
return (this.m_jointList);
}
public function Solve(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local9:int;
var _local10:int;
var _local11:b2Body;
var _local12:b2ContactEdge;
var _local13:b2JointEdge;
var _local14:Boolean;
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();
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactEdge;
var _local11:b2Contact;
var _local12:b2Contact;
var _local13:Number;
var _local14:b2Body;
var _local15:int;
var _local16:b2TimeStep;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:b2Body;
var _local21:Boolean;
var _local8:b2Island = new b2Island(this.m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, this.m_stackAllocator, this.m_contactListener);
var _local9:int = this.m_bodyCount;
var _local10:Array = new Array(_local9);
_local2 = this.m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2.m_sweep.t0 = 0;
_local2 = _local2.m_next;
};
_local11 = this.m_contactList;
while (_local11) {
_local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local11 = _local11.m_next;
};
while (true) {
_local12 = null;
_local13 = 1;
_local11 = this.m_contactList;
for (;_local11;(_local11 = _local11.m_next)) {
if ((_local11.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){
} else {
_local18 = 1;
if ((_local11.m_flags & b2Contact.e_toiFlag)){
_local18 = _local11.m_toi;
} else {
_local3 = _local11.m_shape1;
_local4 = _local11.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((((_local5.IsStatic()) || (_local5.IsSleeping()))) && (((_local6.IsStatic()) || (_local6.IsSleeping()))))){
continue;
};
_local19 = _local5.m_sweep.t0;
if (_local5.m_sweep.t0 < _local6.m_sweep.t0){
_local19 = _local6.m_sweep.t0;
_local5.m_sweep.Advance(_local19);
} else {
if (_local6.m_sweep.t0 < _local5.m_sweep.t0){
_local19 = _local5.m_sweep.t0;
_local6.m_sweep.Advance(_local19);
};
};
_local18 = b2TimeOfImpact.TimeOfImpact(_local11.m_shape1, _local5.m_sweep, _local11.m_shape2, _local6.m_sweep);
if ((((_local18 > 0)) && ((_local18 < 1)))){
_local18 = (((1 - _local18) * _local19) + _local18);
if (_local18 > 1){
_local18 = 1;
};
};
_local11.m_toi = _local18;
_local11.m_flags = (_local11.m_flags | b2Contact.e_toiFlag);
};
if ((((Number.MIN_VALUE < _local18)) && ((_local18 < _local13)))){
_local12 = _local11;
_local13 = _local18;
};
};
};
if ((((_local12 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local13)))){
break;
};
_local3 = _local12.m_shape1;
_local4 = _local12.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local5.Advance(_local13);
_local6.Advance(_local13);
_local12.Update(this.m_contactListener);
_local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag));
if (_local12.m_manifoldCount == 0){
} else {
_local14 = _local5;
if (_local14.IsStatic()){
_local14 = _local6;
};
_local8.Clear();
_local15 = 0;
var _temp1 = _local15;
_local15 = (_local15 + 1);
var _local22 = _temp1;
_local10[_local22] = _local14;
_local14.m_flags = (_local14.m_flags | b2Body.e_islandFlag);
while (_local15 > 0) {
--_local15;
_local2 = _local10[_local15];
_local8.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local7 = _local2.m_contactList;
while (_local7) {
if (_local8.m_contactCount == _local8.m_contactCapacity){
} else {
if ((_local7.contact.m_flags & ((b2Contact.e_islandFlag | b2Contact.e_slowFlag) | b2Contact.e_nonSolidFlag))){
} else {
if (_local7.contact.m_manifoldCount == 0){
} else {
_local8.AddContact(_local7.contact);
_local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag);
_local20 = _local7.other;
if ((_local20.m_flags & b2Body.e_islandFlag)){
} else {
if (_local20.IsStatic() == false){
_local20.Advance(_local13);
_local20.WakeUp();
};
var _temp2 = _local15;
_local15 = (_local15 + 1);
var _local23 = _temp2;
_local10[_local23] = _local20;
_local20.m_flags = (_local20.m_flags | b2Body.e_islandFlag);
};
};
};
};
_local7 = _local7.next;
};
};
};
_local16 = new b2TimeStep();
_local16.dt = ((1 - _local13) * _arg1.dt);
_local16.inv_dt = (1 / _local16.dt);
_local16.maxIterations = _arg1.maxIterations;
_local8.SolveTOI(_local16);
_local17 = 0;
while (_local17 < _local8.m_bodyCount) {
_local2 = _local8.m_bodies[_local17];
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local21 = _local2.SynchronizeShapes();
if ((((_local21 == false)) && (!((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;
};
};
};
_local17++;
};
_local17 = 0;
while (_local17 < _local8.m_contactCount) {
_local11 = _local8.m_contacts[_local17];
_local8.m_contacts[_local17].m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local17++;
};
this.m_broadPhase.Commit();
};
};
}
public function DrawJoint(_arg1:b2Joint):void{
var _local11:b2PulleyJoint;
var _local12:b2Vec2;
var _local13:b2Vec2;
var _local2:b2Body = _arg1.m_body1;
var _local3:b2Body = _arg1.m_body2;
var _local4:b2XForm = _local2.m_xf;
var _local5:b2XForm = _local3.m_xf;
var _local6:b2Vec2 = _local4.position;
var _local7:b2Vec2 = _local5.position;
var _local8:b2Vec2 = _arg1.GetAnchor1();
var _local9:b2Vec2 = _arg1.GetAnchor2();
var _local10:b2Color = s_jointColor;
switch (_arg1.m_type){
case b2Joint.e_distanceJoint:
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);
};
};
}
public function DrawShape(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{
var _local6:b2CircleShape;
var _local7:b2Vec2;
var _local8:Number;
var _local9:b2Vec2;
var _local10:int;
var _local11:b2PolygonShape;
var _local12:int;
var _local13:Array;
var _local14:Array;
var _local15:Array;
var _local5:b2Color = s_coreColor;
switch (_arg1.m_type){
case b2Shape.e_circleShape:
_local6 = (_arg1 as b2CircleShape);
_local7 = b2Math.b2MulX(_arg2, _local6.m_localPosition);
_local8 = _local6.m_radius;
_local9 = _arg2.R.col1;
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;
};
}
public function DrawDebugData():void{
var _local2:int;
var _local3:b2Body;
var _local4:b2Shape;
var _local5:b2Joint;
var _local6:b2BroadPhase;
var _local11:b2XForm;
var _local15:Boolean;
var _local16:uint;
var _local17:b2Pair;
var _local18:b2Proxy;
var _local19:b2Proxy;
var _local20:b2Vec2;
var _local21:b2Vec2;
var _local22:b2Proxy;
var _local23:b2PolygonShape;
var _local24:b2OBB;
var _local25:b2Vec2;
var _local26:b2Mat22;
var _local27:b2Vec2;
var _local28:Number;
if (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;
};
};
}
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 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]);
}
public 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 75
//Base64 (com.dynamicflash.util.Base64)
package com.dynamicflash.util {
import flash.utils.*;
public class Base64 {
public static const BASE64_CHARS:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
public static const version:String = "1.1.0";
public function Base64(){
throw (new Error("Base64 class is static container only"));
}
public static function encode(_arg1:String):String{
var _local2:ByteArray = new ByteArray();
_local2.writeUTFBytes(_arg1);
return (encodeByteArray(_local2));
}
public static function encodeByteArray(_arg1:ByteArray):String{
var _local3:Array;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local2 = "";
var _local4:Array = new Array(4);
_arg1.position = 0;
while (_arg1.bytesAvailable > 0) {
_local3 = new Array();
_local5 = 0;
while ((((_local5 < 3)) && ((_arg1.bytesAvailable > 0)))) {
_local3[_local5] = _arg1.readUnsignedByte();
_local5++;
};
_local4[0] = ((_local3[0] & 252) >> 2);
_local4[1] = (((_local3[0] & 3) << 4) | (_local3[1] >> 4));
_local4[2] = (((_local3[1] & 15) << 2) | (_local3[2] >> 6));
_local4[3] = (_local3[2] & 63);
_local6 = _local3.length;
while (_local6 < 3) {
_local4[(_local6 + 1)] = 64;
_local6++;
};
_local7 = 0;
while (_local7 < _local4.length) {
_local2 = (_local2 + BASE64_CHARS.charAt(_local4[_local7]));
_local7++;
};
};
return (_local2);
}
public static function decode(_arg1:String):String{
var _local2:ByteArray = decodeToByteArray(_arg1);
return (_local2.readUTFBytes(_local2.length));
}
public static function decodeToByteArray(_arg1:String):ByteArray{
var _local6:uint;
var _local7:uint;
var _local2:ByteArray = new ByteArray();
var _local3:Array = new Array(4);
var _local4:Array = new Array(3);
var _local5:uint;
while (_local5 < _arg1.length) {
_local6 = 0;
while ((((_local6 < 4)) && (((_local5 + _local6) < _arg1.length)))) {
_local3[_local6] = BASE64_CHARS.indexOf(_arg1.charAt((_local5 + _local6)));
_local6++;
};
_local4[0] = ((_local3[0] << 2) + ((_local3[1] & 48) >> 4));
_local4[1] = (((_local3[1] & 15) << 4) + ((_local3[2] & 60) >> 2));
_local4[2] = (((_local3[2] & 3) << 6) + _local3[3]);
_local7 = 0;
while (_local7 < _local4.length) {
if (_local3[(_local7 + 1)] == 64){
break;
};
_local2.writeByte(_local4[_local7]);
_local7++;
};
_local5 = (_local5 + 4);
};
_local2.position = 0;
return (_local2);
}
}
}//package com.dynamicflash.util
Section 76
//PropTween (com.greensock.core.PropTween)
package com.greensock.core {
public final class PropTween {
public var priority:int;
public var start:Number;
public var prevNode:PropTween;
public var change:Number;
public var target:Object;
public var name:String;
public var property:String;
public var nextNode:PropTween;
public var isPlugin:Boolean;
public function PropTween(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Boolean, _arg7:PropTween=null, _arg8:int=0){
this.target = _arg1;
this.property = _arg2;
this.start = _arg3;
this.change = _arg4;
this.name = _arg5;
this.isPlugin = _arg6;
if (_arg7){
_arg7.prevNode = this;
this.nextNode = _arg7;
};
this.priority = _arg8;
}
}
}//package com.greensock.core
Section 77
//SimpleTimeline (com.greensock.core.SimpleTimeline)
package com.greensock.core {
public class SimpleTimeline extends TweenCore {
public var autoRemoveChildren:Boolean;
protected var _lastChild:TweenCore;
protected var _firstChild:TweenCore;
public function SimpleTimeline(_arg1:Object=null){
super(0, _arg1);
}
public function get rawTime():Number{
return (this.cachedTotalTime);
}
public function insert(_arg1:TweenCore, _arg2=0):TweenCore{
if (((!(_arg1.cachedOrphan)) && (_arg1.timeline))){
_arg1.timeline.remove(_arg1, true);
};
_arg1.timeline = this;
_arg1.cachedStartTime = (Number(_arg2) + _arg1.delay);
if (_arg1.gc){
_arg1.setEnabled(true, true);
};
if (_arg1.cachedPaused){
_arg1.cachedPauseTime = (_arg1.cachedStartTime + ((this.rawTime - _arg1.cachedStartTime) / _arg1.cachedTimeScale));
};
if (_lastChild){
_lastChild.nextNode = _arg1;
} else {
_firstChild = _arg1;
};
_arg1.prevNode = _lastChild;
_lastChild = _arg1;
_arg1.nextNode = null;
_arg1.cachedOrphan = false;
return (_arg1);
}
override public function renderTime(_arg1:Number, _arg2:Boolean=false, _arg3:Boolean=false):void{
var _local5:Number;
var _local6:TweenCore;
var _local4:TweenCore = _firstChild;
this.cachedTotalTime = _arg1;
this.cachedTime = _arg1;
while (_local4) {
_local6 = _local4.nextNode;
if (((_local4.active) || ((((((_arg1 >= _local4.cachedStartTime)) && (!(_local4.cachedPaused)))) && (!(_local4.gc)))))){
if (!_local4.cachedReversed){
_local4.renderTime(((_arg1 - _local4.cachedStartTime) * _local4.cachedTimeScale), _arg2, false);
} else {
_local5 = (_local4.cacheIsDirty) ? _local4.totalDuration : _local4.cachedTotalDuration;
_local4.renderTime((_local5 - ((_arg1 - _local4.cachedStartTime) * _local4.cachedTimeScale)), _arg2, false);
};
};
_local4 = _local6;
};
}
public function remove(_arg1:TweenCore, _arg2:Boolean=false):void{
if (_arg1.cachedOrphan){
return;
};
if (!_arg2){
_arg1.setEnabled(false, true);
};
if (_arg1.nextNode){
_arg1.nextNode.prevNode = _arg1.prevNode;
} else {
if (_lastChild == _arg1){
_lastChild = _arg1.prevNode;
};
};
if (_arg1.prevNode){
_arg1.prevNode.nextNode = _arg1.nextNode;
} else {
if (_firstChild == _arg1){
_firstChild = _arg1.nextNode;
};
};
_arg1.cachedOrphan = true;
}
}
}//package com.greensock.core
Section 78
//TweenCore (com.greensock.core.TweenCore)
package com.greensock.core {
import com.greensock.*;
public class TweenCore {
public var initted:Boolean;
protected var _hasUpdate:Boolean;
public var active:Boolean;
protected var _delay:Number;
public var cachedReversed:Boolean;
public var nextNode:TweenCore;
public var cachedTime:Number;
protected var _rawPrevTime:Number;// = -1
public var vars:Object;
public var cachedTotalTime:Number;
public var data;
public var timeline:SimpleTimeline;
public var cachedOrphan:Boolean;
public var cachedStartTime:Number;
public var prevNode:TweenCore;
public var cachedDuration:Number;
public var gc:Boolean;
public var cachedPauseTime:Number;
public var cacheIsDirty:Boolean;
public var cachedPaused:Boolean;
public var cachedTimeScale:Number;
public var cachedTotalDuration:Number;
public static const version:Number = 1.64;
protected static var _classInitted:Boolean;
public function TweenCore(_arg1:Number=0, _arg2:Object=null){
this.vars = ((_arg2)!=null) ? _arg2 : {};
if (this.vars.isGSVars){
this.vars = this.vars.vars;
};
this.cachedDuration = (this.cachedTotalDuration = _arg1);
_delay = (this.vars.delay) ? Number(this.vars.delay) : 0;
this.cachedTimeScale = (this.vars.timeScale) ? Number(this.vars.timeScale) : 1;
this.active = Boolean((((((_arg1 == 0)) && ((_delay == 0)))) && (!((this.vars.immediateRender == false)))));
this.cachedTotalTime = (this.cachedTime = 0);
this.data = this.vars.data;
if (!_classInitted){
if (isNaN(TweenLite.rootFrame)){
TweenLite.initClass();
_classInitted = true;
} else {
return;
};
};
var _local3:SimpleTimeline = ((this.vars.timeline is SimpleTimeline)) ? this.vars.timeline : (this.vars.useFrames) ? TweenLite.rootFramesTimeline : TweenLite.rootTimeline;
_local3.insert(this, _local3.cachedTotalTime);
if (this.vars.reversed){
this.cachedReversed = true;
};
if (this.vars.paused){
this.paused = true;
};
}
public function renderTime(_arg1:Number, _arg2:Boolean=false, _arg3:Boolean=false):void{
}
public function get delay():Number{
return (_delay);
}
public function get duration():Number{
return (this.cachedDuration);
}
public function set reversed(_arg1:Boolean):void{
if (_arg1 != this.cachedReversed){
this.cachedReversed = _arg1;
setTotalTime(this.cachedTotalTime, true);
};
}
public function set startTime(_arg1:Number):void{
if (((!((this.timeline == null))) && (((!((_arg1 == this.cachedStartTime))) || (this.gc))))){
this.timeline.insert(this, (_arg1 - _delay));
} else {
this.cachedStartTime = _arg1;
};
}
public function restart(_arg1:Boolean=false, _arg2:Boolean=true):void{
this.reversed = false;
this.paused = false;
this.setTotalTime((_arg1) ? -(_delay) : 0, _arg2);
}
public function set delay(_arg1:Number):void{
this.startTime = (this.startTime + (_arg1 - _delay));
_delay = _arg1;
}
public function resume():void{
this.paused = false;
}
public function get paused():Boolean{
return (this.cachedPaused);
}
public function play():void{
this.reversed = false;
this.paused = false;
}
public function set duration(_arg1:Number):void{
var _local2:Number = (_arg1 / this.cachedDuration);
this.cachedDuration = (this.cachedTotalDuration = _arg1);
if (((((this.active) && (!(this.cachedPaused)))) && (!((_arg1 == 0))))){
this.setTotalTime((this.cachedTotalTime * _local2), true);
};
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.cachedPaused) ? this.cachedPauseTime : this.timeline.cachedTotalTime;
if (this.cachedReversed){
_local4 = (this.cacheIsDirty) ? this.totalDuration : this.cachedTotalDuration;
this.cachedStartTime = (_local3 - ((_local4 - _arg1) / this.cachedTimeScale));
} else {
this.cachedStartTime = (_local3 - (_arg1 / this.cachedTimeScale));
};
if (!this.timeline.cacheIsDirty){
setDirtyCache(false);
};
if (this.cachedTotalTime != _arg1){
renderTime(_arg1, _arg2, false);
};
};
}
public function pause():void{
this.paused = true;
}
public function set totalDuration(_arg1:Number):void{
this.duration = _arg1;
}
public function get totalDuration():Number{
return (this.cachedTotalDuration);
}
public function setEnabled(_arg1:Boolean, _arg2:Boolean=false):Boolean{
this.gc = !(_arg1);
if (_arg1){
this.active = Boolean(((((!(this.cachedPaused)) && ((this.cachedTotalTime > 0)))) && ((this.cachedTotalTime < this.cachedTotalDuration))));
if (((!(_arg2)) && (this.cachedOrphan))){
this.timeline.insert(this, (this.cachedStartTime - _delay));
};
} else {
this.active = false;
if (((!(_arg2)) && (!(this.cachedOrphan)))){
this.timeline.remove(this, true);
};
};
return (false);
}
}
}//package com.greensock.core
Section 79
//OverwriteManager (com.greensock.OverwriteManager)
package com.greensock {
import com.greensock.core.*;
public final class OverwriteManager {
public static const ALL_ONSTART:int = 4;
public static const CONCURRENT:int = 3;
public static const ALL_IMMEDIATE:int = 1;
public static const PREEXISTING:int = 5;
public static const AUTO:int = 2;
public static const version:Number = 6.1;
public static const NONE:int = 0;
public static var enabled:Boolean;
public static var mode:int;
public static function getGlobalPaused(_arg1:TweenCore):Boolean{
var _local2:Boolean;
while (_arg1) {
if (_arg1.cachedPaused){
_local2 = true;
break;
};
_arg1 = _arg1.timeline;
};
return (_local2);
}
public static function init(_arg1:int=2):int{
if (TweenLite.version < 11.6){
throw (new Error("Warning: Your TweenLite class needs to be updated to work with OverwriteManager (or you may need to clear your ASO files). Please download and install the latest version from http://www.tweenlite.com."));
};
TweenLite.overwriteManager = OverwriteManager;
mode = _arg1;
enabled = true;
return (mode);
}
public static function manageOverwrites(_arg1:TweenLite, _arg2:Object, _arg3:Array, _arg4:int):Boolean{
var _local5:int;
var _local6:Boolean;
var _local7:TweenLite;
var _local13:int;
var _local14:Number;
var _local15:Number;
var _local16:TweenCore;
var _local17:Number;
var _local18:SimpleTimeline;
if (_arg4 >= 4){
_local13 = _arg3.length;
_local5 = 0;
while (_local5 < _local13) {
_local7 = _arg3[_local5];
if (_local7 != _arg1){
if (_local7.setEnabled(false, false)){
_local6 = true;
};
} else {
if (_arg4 == 5){
break;
};
};
_local5++;
};
return (_local6);
};
var _local8:Number = (_arg1.cachedStartTime + 1E-10);
var _local9:Array = [];
var _local10:Array = [];
var _local11:int;
var _local12:int;
_local5 = _arg3.length;
while (--_local5 > -1) {
_local7 = _arg3[_local5];
if ((((((_local7 == _arg1)) || (_local7.gc))) || (((!(_local7.initted)) && (((_local8 - _local7.cachedStartTime) <= 2E-10)))))){
} else {
if (_local7.timeline != _arg1.timeline){
if (!getGlobalPaused(_local7)){
var _temp1 = _local11;
_local11 = (_local11 + 1);
var _local19 = _temp1;
_local10[_local19] = _local7;
};
} else {
if ((((((((_local7.cachedStartTime <= _local8)) && ((((_local7.cachedStartTime + _local7.totalDuration) + 1E-10) > _local8)))) && (!(_local7.cachedPaused)))) && (!((((_arg1.cachedDuration == 0)) && (((_local8 - _local7.cachedStartTime) <= 2E-10))))))){
var _temp2 = _local12;
_local12 = (_local12 + 1);
_local19 = _temp2;
_local9[_local19] = _local7;
};
};
};
};
if (_local11 != 0){
_local14 = _arg1.cachedTimeScale;
_local15 = _local8;
_local18 = _arg1.timeline;
while (_local18) {
_local14 = (_local14 * _local18.cachedTimeScale);
_local15 = (_local15 + _local18.cachedStartTime);
_local18 = _local18.timeline;
};
_local8 = (_local14 * _local15);
_local5 = _local11;
while (--_local5 > -1) {
_local16 = _local10[_local5];
_local14 = _local16.cachedTimeScale;
_local15 = _local16.cachedStartTime;
_local18 = _local16.timeline;
while (_local18) {
_local14 = (_local14 * _local18.cachedTimeScale);
_local15 = (_local15 + _local18.cachedStartTime);
_local18 = _local18.timeline;
};
_local17 = (_local14 * _local15);
if ((((_local17 <= _local8)) && ((((((_local17 + (_local16.totalDuration * _local14)) + 1E-10) > _local8)) || ((_local16.cachedDuration == 0)))))){
var _temp3 = _local12;
_local12 = (_local12 + 1);
_local19 = _temp3;
_local9[_local19] = _local16;
};
};
};
if (_local12 == 0){
return (_local6);
};
_local5 = _local12;
if (_arg4 == 2){
while (--_local5 > -1) {
_local7 = _local9[_local5];
if (_local7.killVars(_arg2)){
_local6 = true;
};
if ((((_local7.cachedPT1 == null)) && (_local7.initted))){
_local7.setEnabled(false, false);
};
};
} else {
while (--_local5 > -1) {
if (TweenLite(_local9[_local5]).setEnabled(false, false)){
_local6 = true;
};
};
};
return (_local6);
}
}
}//package com.greensock
Section 80
//TimelineLite (com.greensock.TimelineLite)
package com.greensock {
import com.greensock.core.*;
public class TimelineLite extends SimpleTimeline {
protected var _endCaps:Array;
protected var _labels:Object;
public static const version:Number = 1.65;
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;
};
} else {
if ((((_arg1 == 0)) && (!(this.initted)))){
_arg3 = true;
};
};
if ((((_rawPrevTime >= 0)) && (!((_rawPrevTime == _arg1))))){
this.cachedTotalTime = 0;
this.cachedTime = 0;
forceChildrenToBeginning(0, _arg2);
_local10 = true;
if (this.cachedReversed){
_local9 = true;
};
};
} else {
this.cachedTotalTime = (this.cachedTime = _arg1);
};
};
_rawPrevTime = _arg1;
if ((((this.cachedTime == _local5)) && (!(_arg3)))){
return;
};
if (!this.initted){
this.initted = true;
};
if ((((((((_local5 == 0)) && (this.vars.onStart))) && (!((this.cachedTime == 0))))) && (!(_arg2)))){
this.vars.onStart.apply(null, this.vars.onStartParams);
};
if (_local10){
} else {
if ((this.cachedTime - _local5) > 0){
_local8 = _firstChild;
while (_local8) {
_local11 = _local8.nextNode;
if (((this.cachedPaused) && (!(_local13)))){
break;
} else {
if (((_local8.active) || (((((!(_local8.cachedPaused)) && ((_local8.cachedStartTime <= this.cachedTime)))) && (!(_local8.gc)))))){
if (!_local8.cachedReversed){
_local8.renderTime(((this.cachedTime - _local8.cachedStartTime) * _local8.cachedTimeScale), _arg2, false);
} else {
_local12 = (_local8.cacheIsDirty) ? _local8.totalDuration : _local8.cachedTotalDuration;
_local8.renderTime((_local12 - ((this.cachedTime - _local8.cachedStartTime) * _local8.cachedTimeScale)), _arg2, false);
};
};
};
_local8 = _local11;
};
} else {
_local8 = _lastChild;
while (_local8) {
_local11 = _local8.prevNode;
if (((this.cachedPaused) && (!(_local13)))){
break;
} else {
if (((_local8.active) || (((((!(_local8.cachedPaused)) && ((_local8.cachedStartTime <= _local5)))) && (!(_local8.gc)))))){
if (!_local8.cachedReversed){
_local8.renderTime(((this.cachedTime - _local8.cachedStartTime) * _local8.cachedTimeScale), _arg2, false);
} else {
_local12 = (_local8.cacheIsDirty) ? _local8.totalDuration : _local8.cachedTotalDuration;
_local8.renderTime((_local12 - ((this.cachedTime - _local8.cachedStartTime) * _local8.cachedTimeScale)), _arg2, false);
};
};
};
_local8 = _local11;
};
};
};
if (((_hasUpdate) && (!(_arg2)))){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (((((_local9) && ((((_local6 == this.cachedStartTime)) || (!((_local7 == this.cachedTimeScale))))))) && ((((_local4 >= this.totalDuration)) || ((this.cachedTime == 0)))))){
complete(true, _arg2);
};
}
override public function remove(_arg1:TweenCore, _arg2:Boolean=false):void{
if (_arg1.cachedOrphan){
return;
};
if (!_arg2){
_arg1.setEnabled(false, true);
};
var _local3:TweenCore = (this.gc) ? _endCaps[0] : _firstChild;
var _local4:TweenCore = (this.gc) ? _endCaps[1] : _lastChild;
if (_arg1.nextNode){
_arg1.nextNode.prevNode = _arg1.prevNode;
} else {
if (_local4 == _arg1){
_local4 = _arg1.prevNode;
};
};
if (_arg1.prevNode){
_arg1.prevNode.nextNode = _arg1.nextNode;
} else {
if (_local3 == _arg1){
_local3 = _arg1.nextNode;
};
};
if (this.gc){
_endCaps[0] = _local3;
_endCaps[1] = _local4;
} else {
_firstChild = _local3;
_lastChild = _local4;
};
_arg1.cachedOrphan = true;
setDirtyCache(true);
}
public function get currentProgress():Number{
return ((this.cachedTime / this.duration));
}
override public function get totalDuration():Number{
var _local1:Number;
var _local2:Number;
var _local3:TweenCore;
var _local4:Number;
var _local5:TweenCore;
if (this.cacheIsDirty){
_local1 = 0;
_local3 = (this.gc) ? _endCaps[0] : _firstChild;
_local4 = -(Infinity);
while (_local3) {
_local5 = _local3.nextNode;
if (_local3.cachedStartTime < _local4){
this.insert(_local3, (_local3.cachedStartTime - _local3.delay));
_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 set duration(_arg1:Number):void{
if (((!((this.duration == 0))) && (!((_arg1 == 0))))){
this.timeScale = (this.duration / _arg1);
};
}
public function insertMultiple(_arg1:Array, _arg2=0, _arg3:String="normal", _arg4:Number=0):Array{
var _local5:int;
var _local6:TweenCore;
var _local7:Number = ((Number(_arg2)) || (0));
var _local8:int = _arg1.length;
if (typeof(_arg2) == "string"){
if (!(_arg2 in _labels)){
addLabel(_arg2, this.duration);
};
_local7 = _labels[_arg2];
};
_local5 = 0;
while (_local5 < _local8) {
_local6 = (_arg1[_local5] as TweenCore);
insert(_local6, _local7);
if (_arg3 == "sequence"){
_local7 = (_local6.cachedStartTime + (_local6.totalDuration / _local6.cachedTimeScale));
} else {
if (_arg3 == "start"){
_local6.cachedStartTime = (_local6.cachedStartTime - _local6.delay);
};
};
_local7 = (_local7 + _arg4);
_local5 = (_local5 + 1);
};
return (_arg1);
}
public function getLabelTime(_arg1:String):Number{
return (((_arg1 in _labels)) ? Number(_labels[_arg1]) : -1);
}
override public function get rawTime():Number{
if (((!((this.cachedTotalTime == 0))) && (!((this.cachedTotalTime == this.cachedTotalDuration))))){
return (this.cachedTotalTime);
};
return (((this.timeline.rawTime - this.cachedStartTime) * this.cachedTimeScale));
}
override public function set totalDuration(_arg1:Number):void{
if (((!((this.totalDuration == 0))) && (!((_arg1 == 0))))){
this.timeScale = (this.totalDuration / _arg1);
};
}
public function getChildren(_arg1:Boolean=true, _arg2:Boolean=true, _arg3:Boolean=true, _arg4:Number=-9999999999):Array{
var _local5:Array = [];
var _local6:int;
var _local7:TweenCore = (this.gc) ? _endCaps[0] : _firstChild;
while (_local7) {
if (_local7.cachedStartTime < _arg4){
} else {
if ((_local7 is TweenLite)){
if (_arg2){
var _temp1 = _local6;
_local6 = (_local6 + 1);
var _local8 = _temp1;
_local5[_local8] = _local7;
};
} else {
if (_arg3){
var _temp2 = _local6;
_local6 = (_local6 + 1);
_local8 = _temp2;
_local5[_local8] = _local7;
};
if (_arg1){
_local5 = _local5.concat(TimelineLite(_local7).getChildren(true, _arg2, _arg3));
};
};
};
_local7 = _local7.nextNode;
};
return (_local5);
}
protected function forceChildrenToEnd(_arg1:Number, _arg2:Boolean=false):Number{
var _local4:TweenCore;
var _local5:Number;
var _local3:TweenCore = _firstChild;
var _local6:Boolean = this.cachedPaused;
while (_local3) {
_local4 = _local3.nextNode;
if (((this.cachedPaused) && (!(_local6)))){
break;
} else {
if (((_local3.active) || (((((!(_local3.cachedPaused)) && (!(_local3.gc)))) && (((!((_local3.cachedTotalTime == _local3.cachedTotalDuration))) || ((_local3.cachedDuration == 0)))))))){
if ((((_arg1 == this.cachedDuration)) && (((!((_local3.cachedDuration == 0))) || ((_local3.cachedStartTime == this.cachedDuration)))))){
_local3.renderTime((_local3.cachedReversed) ? 0 : _local3.cachedTotalDuration, _arg2, false);
} else {
if (!_local3.cachedReversed){
_local3.renderTime(((_arg1 - _local3.cachedStartTime) * _local3.cachedTimeScale), _arg2, false);
} else {
_local5 = (_local3.cacheIsDirty) ? _local3.totalDuration : _local3.cachedTotalDuration;
_local3.renderTime((_local5 - ((_arg1 - _local3.cachedStartTime) * _local3.cachedTimeScale)), _arg2, false);
};
};
};
};
_local3 = _local4;
};
return (_arg1);
}
protected function forceChildrenToBeginning(_arg1:Number, _arg2:Boolean=false):Number{
var _local4:TweenCore;
var _local5:Number;
var _local3:TweenCore = _lastChild;
var _local6:Boolean = this.cachedPaused;
while (_local3) {
_local4 = _local3.prevNode;
if (((this.cachedPaused) && (!(_local6)))){
break;
} else {
if (((_local3.active) || (((((!(_local3.cachedPaused)) && (!(_local3.gc)))) && (((!((_local3.cachedTotalTime == 0))) || ((_local3.cachedDuration == 0)))))))){
if ((((_arg1 == 0)) && (((!((_local3.cachedDuration == 0))) || ((_local3.cachedStartTime == 0)))))){
_local3.renderTime((_local3.cachedReversed) ? _local3.cachedTotalDuration : 0, _arg2, false);
} else {
if (!_local3.cachedReversed){
_local3.renderTime(((_arg1 - _local3.cachedStartTime) * _local3.cachedTimeScale), _arg2, false);
} else {
_local5 = (_local3.cacheIsDirty) ? _local3.totalDuration : _local3.cachedTotalDuration;
_local3.renderTime((_local5 - ((_arg1 - _local3.cachedStartTime) * _local3.cachedTimeScale)), _arg2, false);
};
};
};
};
_local3 = _local4;
};
return (_arg1);
}
override public function insert(_arg1:TweenCore, _arg2=0):TweenCore{
var _local5:TweenCore;
var _local6:Number;
var _local7:SimpleTimeline;
if (typeof(_arg2) == "string"){
if (!(_arg2 in _labels)){
addLabel(_arg2, this.duration);
};
_arg2 = Number(_labels[_arg2]);
};
if (((!(_arg1.cachedOrphan)) && (_arg1.timeline))){
_arg1.timeline.remove(_arg1, true);
};
_arg1.timeline = this;
_arg1.cachedStartTime = (Number(_arg2) + _arg1.delay);
if (_arg1.cachedPaused){
_arg1.cachedPauseTime = (_arg1.cachedStartTime + ((this.rawTime - _arg1.cachedStartTime) / _arg1.cachedTimeScale));
};
if (_arg1.gc){
_arg1.setEnabled(true, true);
};
setDirtyCache(true);
var _local3:TweenCore = (this.gc) ? _endCaps[0] : _firstChild;
var _local4:TweenCore = (this.gc) ? _endCaps[1] : _lastChild;
if (_local4 == null){
_local4 = _arg1;
_local3 = _local4;
_arg1.nextNode = (_arg1.prevNode = null);
} else {
_local5 = _local4;
_local6 = _arg1.cachedStartTime;
while (((!((_local5 == null))) && ((_local6 < _local5.cachedStartTime)))) {
_local5 = _local5.prevNode;
};
if (_local5 == null){
_local3.prevNode = _arg1;
_arg1.nextNode = _local3;
_arg1.prevNode = null;
_local3 = _arg1;
} else {
if (_local5.nextNode){
_local5.nextNode.prevNode = _arg1;
} else {
if (_local5 == _local4){
_local4 = _arg1;
};
};
_arg1.prevNode = _local5;
_arg1.nextNode = _local5.nextNode;
_local5.nextNode = _arg1;
};
};
_arg1.cachedOrphan = false;
if (this.gc){
_endCaps[0] = _local3;
_endCaps[1] = _local4;
} else {
_firstChild = _local3;
_lastChild = _local4;
};
if (((((this.gc) && (!(this.cachedPaused)))) && (((this.cachedStartTime + ((_arg1.cachedStartTime + (_arg1.cachedTotalDuration / _arg1.cachedTimeScale)) / this.cachedTimeScale)) > this.timeline.cachedTime)))){
if ((((this.timeline == TweenLite.rootTimeline)) || ((this.timeline == TweenLite.rootFramesTimeline)))){
this.setTotalTime(this.cachedTotalTime, true);
};
this.setEnabled(true, false);
_local7 = this.timeline;
while (((_local7.gc) && (_local7.timeline))) {
if ((_local7.cachedStartTime + (_local7.totalDuration / _local7.cachedTimeScale)) > _local7.timeline.cachedTime){
_local7.setEnabled(true, false);
};
_local7 = _local7.timeline;
};
};
return (_arg1);
}
override public function invalidate():void{
var _local1:TweenCore = (this.gc) ? _endCaps[0] : _firstChild;
while (_local1) {
_local1.invalidate();
_local1 = _local1.nextNode;
};
}
public function get timeScale():Number{
return (this.cachedTimeScale);
}
public function prependMultiple(_arg1:Array, _arg2:String="normal", _arg3:Number=0, _arg4:Boolean=false):Array{
var _local5:TimelineLite = new TimelineLite({tweens:_arg1, align:_arg2, stagger:_arg3});
shiftChildren(_local5.duration, _arg4, 0);
insertMultiple(_arg1, 0, _arg2, _arg3);
_local5.kill();
return (_arg1);
}
override public function setEnabled(_arg1:Boolean, _arg2:Boolean=false):Boolean{
var _local3:TweenCore;
if (_arg1 == this.gc){
if (_arg1){
_local3 = _endCaps[0];
_firstChild = _local3;
_lastChild = _endCaps[1];
_endCaps = [null, null];
} else {
_local3 = _firstChild;
_endCaps = [_firstChild, _lastChild];
_firstChild = (_lastChild = null);
};
while (_local3) {
_local3.setEnabled(_arg1, true);
_local3 = _local3.nextNode;
};
};
return (super.setEnabled(_arg1, _arg2));
}
}
}//package com.greensock
Section 81
//TweenLite (com.greensock.TweenLite)
package com.greensock {
import flash.events.*;
import flash.display.*;
import 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.62;
public static var rootTimeline:SimpleTimeline;
public static var fastEaseLookup:Dictionary = new Dictionary(false);
public static var onPluginEvent:Function;
public static var rootFramesTimeline:SimpleTimeline;
public static var defaultEase:Function = TweenLite.easeOut;
public static var plugins:Object = {};
public static var masterList:Dictionary = new Dictionary(false);
public static var overwriteManager:Object;
public static var rootFrame:Number;
public static var killDelayedCallsTo:Function = TweenLite.killTweensOf;
private static var _shape:Shape = new Shape();
protected static var _reservedProps:Object = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, useFrames:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, onStart:1, onStartParams:1, onInit:1, onInitParams:1, onReverseComplete:1, onReverseCompleteParams:1, onRepeat:1, onRepeatParams:1, proxiedEase:1, easeParams:1, yoyo:1, onCompleteListener:1, onUpdateListener:1, onStartListener:1, onReverseCompleteListener:1, onRepeatListener:1, orientToBezier:1, timeScale:1, immediateRender:1, repeat:1, repeatDelay:1, timeline:1, data:1, paused:1};
public function TweenLite(_arg1:Object, _arg2:Number, _arg3:Object){
var _local5:TweenLite;
super(_arg2, _arg3);
if (_arg1 == null){
throw (new Error("Cannot tween a null object."));
};
this.target = _arg1;
if ((((this.target is TweenCore)) && (this.vars.timeScale))){
this.cachedTimeScale = 1;
};
propTweenLookup = {};
_ease = defaultEase;
_overwrite = (((!((Number(_arg3.overwrite) > -1))) || (((!(overwriteManager.enabled)) && ((_arg3.overwrite > 1)))))) ? overwriteManager.mode : int(_arg3.overwrite);
var _local4:Array = masterList[_arg1];
if (!_local4){
masterList[_arg1] = [this];
} else {
if (_overwrite == 1){
for each (_local5 in _local4) {
if (!_local5.gc){
_local5.setEnabled(false, false);
};
};
masterList[_arg1] = [this];
} else {
_local4[_local4.length] = this;
};
};
if (((this.active) || (this.vars.immediateRender))){
renderTime(0, false, true);
};
}
protected function easeProxy(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (this.vars.proxiedEase.apply(null, arguments.concat(this.vars.easeParams)));
}
override public function renderTime(_arg1:Number, _arg2:Boolean=false, _arg3:Boolean=false):void{
var _local4:Boolean;
var _local5:Number = this.cachedTime;
if (_arg1 >= this.cachedDuration){
this.cachedTotalTime = (this.cachedTime = this.cachedDuration);
this.ratio = 1;
_local4 = 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))) || ((this.cachedDuration == 0)))))) && (!(_arg2)))){
this.vars.onStart.apply(null, this.vars.onStartParams);
};
var _local6:PropTween = this.cachedPT1;
while (_local6) {
_local6.target[_local6.property] = (_local6.start + (this.ratio * _local6.change));
_local6 = _local6.nextNode;
};
if (((_hasUpdate) && (!(_arg2)))){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (((_local4) && (!(this.gc)))){
if (((_hasPlugins) && (this.cachedPT1))){
onPluginEvent("onComplete", this);
};
complete(true, _arg2);
};
}
override public function setEnabled(_arg1:Boolean, _arg2:Boolean=false):Boolean{
var _local3:Array;
if (_arg1){
_local3 = TweenLite.masterList[this.target];
if (!_local3){
TweenLite.masterList[this.target] = [this];
} else {
_local3[_local3.length] = this;
};
};
super.setEnabled(_arg1, _arg2);
if (((_notifyPluginsOfEnabled) && (this.cachedPT1))){
return (onPluginEvent((_arg1) ? "onEnable" : "onDisable", this));
};
return (false);
}
protected function init():void{
var _local1:String;
var _local2:int;
var _local3:*;
var _local4:Boolean;
var _local5:Array;
var _local6:PropTween;
if (this.vars.onInit){
this.vars.onInit.apply(null, this.vars.onInitParams);
};
if (typeof(this.vars.ease) == "function"){
_ease = this.vars.ease;
};
if (this.vars.easeParams){
this.vars.proxiedEase = _ease;
_ease = easeProxy;
};
this.cachedPT1 = null;
this.propTweenLookup = {};
for (_local1 in this.vars) {
if ((((_local1 in _reservedProps)) && (!((((_local1 == "timeScale")) && ((this.target is TweenCore))))))){
} else {
if ((((_local1 in plugins)) && (new ((plugins[_local1] as Class)).onInitTween(this.target, this.vars[_local1], this)))){
this.cachedPT1 = new PropTween(_local3, "changeFactor", 0, 1, ((_local3.overwriteProps.length)==1) ? _local3.overwriteProps[0] : "_MULTIPLE_", true, this.cachedPT1);
if (this.cachedPT1.name == "_MULTIPLE_"){
_local2 = _local3.overwriteProps.length;
while (--_local2 > -1) {
this.propTweenLookup[_local3.overwriteProps[_local2]] = this.cachedPT1;
};
} else {
this.propTweenLookup[this.cachedPT1.name] = this.cachedPT1;
};
if (_local3.priority){
this.cachedPT1.priority = _local3.priority;
_local4 = true;
};
if (((_local3.onDisable) || (_local3.onEnable))){
_notifyPluginsOfEnabled = true;
};
_hasPlugins = true;
} else {
this.cachedPT1 = new PropTween(this.target, _local1, Number(this.target[_local1]), ((typeof(this.vars[_local1]))=="number") ? (Number(this.vars[_local1]) - this.target[_local1]) : Number(this.vars[_local1]), _local1, false, this.cachedPT1);
this.propTweenLookup[_local1] = this.cachedPT1;
};
};
};
if (_local4){
onPluginEvent("onInitAllProps", this);
};
if (this.vars.runBackwards){
_local6 = this.cachedPT1;
while (_local6) {
_local6.start = (_local6.start + _local6.change);
_local6.change = -(_local6.change);
_local6 = _local6.nextNode;
};
};
_hasUpdate = Boolean(!((this.vars.onUpdate == null)));
if (_overwrittenProps){
killVars(_overwrittenProps);
if (this.cachedPT1 == null){
this.setEnabled(false, false);
};
};
if ((((((((_overwrite > 1)) && (this.cachedPT1))) && (masterList[this.target]))) && ((_local5.length > 1)))){
if (overwriteManager.manageOverwrites(this, this.propTweenLookup, _local5, _overwrite)){
init();
};
};
this.initted = true;
}
public function killVars(_arg1:Object, _arg2:Boolean=true):Boolean{
var _local3:String;
var _local4:PropTween;
var _local5:Boolean;
if (_overwrittenProps == null){
_overwrittenProps = {};
};
for (_local3 in _arg1) {
if ((_local3 in propTweenLookup)){
_local4 = propTweenLookup[_local3];
if (((_local4.isPlugin) && ((_local4.name == "_MULTIPLE_")))){
_local4.target.killProps(_arg1);
if (_local4.target.overwriteProps.length == 0){
_local4.name = "";
};
if (((!((_local3 == _local4.target.propName))) || ((_local4.name == "")))){
delete propTweenLookup[_local3];
};
};
if (_local4.name != "_MULTIPLE_"){
if (_local4.nextNode){
_local4.nextNode.prevNode = _local4.prevNode;
};
if (_local4.prevNode){
_local4.prevNode.nextNode = _local4.nextNode;
} else {
if (this.cachedPT1 == _local4){
this.cachedPT1 = _local4.nextNode;
};
};
if (((_local4.isPlugin) && (_local4.target.onDisable))){
_local4.target.onDisable();
if (_local4.target.activeDisable){
_local5 = true;
};
};
delete propTweenLookup[_local3];
};
};
if (((_arg2) && (!((_arg1 == _overwrittenProps))))){
_overwrittenProps[_local3] = 1;
};
};
return (_local5);
}
override public function invalidate():void{
if (((_notifyPluginsOfEnabled) && (this.cachedPT1))){
onPluginEvent("onDisable", this);
};
this.cachedPT1 = null;
_overwrittenProps = null;
_hasUpdate = (this.initted = (this.active = (_notifyPluginsOfEnabled = false)));
this.propTweenLookup = {};
}
public static function initClass():void{
rootFrame = 0;
rootTimeline = new SimpleTimeline(null);
rootFramesTimeline = new SimpleTimeline(null);
rootTimeline.cachedStartTime = (getTimer() * 0.001);
rootFramesTimeline.cachedStartTime = rootFrame;
rootTimeline.autoRemoveChildren = true;
rootFramesTimeline.autoRemoveChildren = true;
_shape.addEventListener(Event.ENTER_FRAME, updateAll, false, 0, true);
if (overwriteManager == null){
overwriteManager = {mode:1, enabled:false};
};
}
public static function killTweensOf(_arg1:Object, _arg2:Boolean=false, _arg3:Object=null):void{
var _local4:Array;
var _local5:int;
var _local6:TweenLite;
if ((_arg1 in masterList)){
_local4 = masterList[_arg1];
_local5 = _local4.length;
while (--_local5 > -1) {
_local6 = _local4[_local5];
if (!_local6.gc){
if (_arg2){
_local6.complete(false, false);
};
if (_arg3 != null){
_local6.killVars(_arg3);
};
if ((((_arg3 == null)) || ((((_local6.cachedPT1 == null)) && (_local6.initted))))){
_local6.setEnabled(false, false);
};
};
};
if (_arg3 == null){
delete masterList[_arg1];
};
};
}
public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
_arg3.runBackwards = true;
if (!("immediateRender" in _arg3)){
_arg3.immediateRender = true;
};
return (new TweenLite(_arg1, _arg2, _arg3));
}
protected static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (1 - (_arg1 / _arg4));
return ((1 - (_arg1 * _arg1)));
}
public static function delayedCall(_arg1:Number, _arg2:Function, _arg3:Array=null, _arg4:Boolean=false):TweenLite{
return (new TweenLite(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, immediateRender:false, useFrames:_arg4, overwrite:0}));
}
protected static function updateAll(_arg1:Event=null):void{
var _local2:Dictionary;
var _local3:Object;
var _local4:Array;
var _local5:int;
rootTimeline.renderTime((((getTimer() * 0.001) - rootTimeline.cachedStartTime) * rootTimeline.cachedTimeScale), false, false);
rootFrame = (rootFrame + 1);
rootFramesTimeline.renderTime(((rootFrame - rootFramesTimeline.cachedStartTime) * rootFramesTimeline.cachedTimeScale), false, false);
if (!(rootFrame % 60)){
_local2 = masterList;
for (_local3 in _local2) {
_local4 = _local2[_local3];
_local5 = _local4.length;
while (--_local5 > -1) {
if (TweenLite(_local4[_local5]).gc){
_local4.splice(_local5, 1);
};
};
if (_local4.length == 0){
delete _local2[_local3];
};
};
};
}
public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
return (new TweenLite(_arg1, _arg2, _arg3));
}
}
}//package com.greensock
Section 82
//Star_117 (FangedFun_fla.Star_117)
package FangedFun_fla {
import flash.display.*;
public dynamic class Star_117 extends MovieClip {
public function Star_117(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package FangedFun_fla
Section 83
//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 84
//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 85
//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 86
//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 87
//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 88
//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 89
//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 90
//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 91
//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 92
//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 93
//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 94
//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 95
//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 96
//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 97
//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 98
//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 99
//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 100
//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 101
//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 102
//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 103
//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 104
//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 105
//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 106
//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 107
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 108
//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 109
//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 110
//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 111
//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 112
//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 113
//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 114
//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 115
//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 116
//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 117
//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 118
//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 119
//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 120
//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 121
//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 122
//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 123
//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 124
//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 125
//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 126
//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 127
//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 128
//Cubic (fl.motion.easing.Cubic)
package fl.motion.easing {
public class Cubic {
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * _arg1) + 2)) + _arg2));
}
}
}//package fl.motion.easing
Section 129
//Elastic (fl.motion.easing.Elastic)
package fl.motion.easing {
public class Elastic {
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
--_arg1;
return ((-(((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6)))) + _arg2));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
return (((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6))) + _arg3) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 == 2){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * (0.3 * 1.5));
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / (2 * Math.PI)) * Math.asin((_arg3 / _arg5)));
};
if (_arg1 < 1){
--_arg1;
return (((-0.5 * ((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6)))) + _arg2));
};
--_arg1;
return ((((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _arg6))) * 0.5) + _arg3) + _arg2));
}
}
}//package fl.motion.easing
Section 130
//Linear (fl.motion.easing.Linear)
package fl.motion.easing {
public class Linear {
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
}
}//package fl.motion.easing
Section 131
//Cloud (jk.app.display.backgroundAssets.Cloud)
package jk.app.display.backgroundAssets {
import flash.display.*;
public dynamic class Cloud extends MovieClip {
}
}//package jk.app.display.backgroundAssets
Section 132
//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 133
//BackgroundBlue (jk.app.display.buttons.backgrounds.BackgroundBlue)
package jk.app.display.buttons.backgrounds {
import flash.display.*;
public dynamic class BackgroundBlue extends SimpleButton {
}
}//package jk.app.display.buttons.backgrounds
Section 134
//BackgroundBrown (jk.app.display.buttons.backgrounds.BackgroundBrown)
package jk.app.display.buttons.backgrounds {
import flash.display.*;
public dynamic class BackgroundBrown extends SimpleButton {
}
}//package jk.app.display.buttons.backgrounds
Section 135
//BackgroundGreen (jk.app.display.buttons.backgrounds.BackgroundGreen)
package jk.app.display.buttons.backgrounds {
import flash.display.*;
public dynamic class BackgroundGreen extends SimpleButton {
}
}//package jk.app.display.buttons.backgrounds
Section 136
//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 137
//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 138
//BtnEditLevel (jk.app.display.buttons.BtnEditLevel)
package jk.app.display.buttons {
import flash.display.*;
public dynamic class BtnEditLevel extends Sprite {
}
}//package jk.app.display.buttons
Section 139
//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 140
//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 141
//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 142
//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 143
//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 144
//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 145
//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 146
//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 147
//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 148
//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 149
//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 150
//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 151
//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 152
//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 153
//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 154
//Background (jk.app.display.hudAssets.Background)
package jk.app.display.hudAssets {
import flash.display.*;
public dynamic class Background extends Sprite {
}
}//package jk.app.display.hudAssets
Section 155
//Checking (jk.app.display.hudAssets.Checking)
package jk.app.display.hudAssets {
import flash.display.*;
public dynamic class Checking extends MovieClip {
}
}//package jk.app.display.hudAssets
Section 156
//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 157
//AchievementObtained (jk.app.display.windows.dialogs.AchievementObtained)
package jk.app.display.windows.dialogs {
import com.greensock.*;
import jk.engine.display.windows.*;
public class AchievementObtained extends Dialog {
override public function postInitialize():void{
TweenLite.delayedCall((_openTweenTime + _closeTweenTime), close);
}
}
}//package jk.app.display.windows.dialogs
Section 158
//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 159
//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 160
//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:"---Good---", data:"---"}, {label:"Circle", data:"AE"}, {label:"Rectangle", data:"AG"}, {label:"---Evil---", data:"---"}, {label:"Circle", data:"AB"}, {label:"Rectangle", data:"AD"}, {label:"---Platforms---", data:"---"}, {label:"For Good", data:"AF"}, {label:"For Evil", data:"AC"}, {label:"---Shapes---", data:"---"}, {label:"Circle", data:"AA"}, {label:"Rectangle", data:"AH"}, {label:"Octagon", data:"AI"}];
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 161
//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 162
//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 163
//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{
guiMgr.hud.showItem("adGame1", openTweenTime);
guiMgr.hud.showItem("adGame2", openTweenTime);
guiMgr.hud.showItem("socialButtons", openTweenTime);
txtScore.text = ("Score: " + _initOptions.score);
}
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 164
//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 cbMusic:CheckBox;
public var sliderSFXVol:Slider;
public var sliderQuality:Slider;
public function Options(){
__setProp_sliderSFXVol_Options_Layer2_0();
__setProp_sliderMusicVol_Options_Layer2_0();
__setProp_sliderQuality_Options_Layer2_0();
__setProp_cbSFX_Options_Layer2_0();
__setProp_cbMusic_Options_Layer2_0();
}
override public function initialize():void{
updateParamsValues();
}
override public function postInitialize():void{
btnOk.addEventListener(MouseEvent.CLICK, onOk_Click);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
cbMusic.addEventListener(MouseEvent.CLICK, onMusic_Click);
sliderMusicVol.addEventListener(Event.CHANGE, onMusicVol_Change);
cbSFX.addEventListener(MouseEvent.CLICK, onSFX_Click);
sliderSFXVol.addEventListener(Event.CHANGE, onSFXVol_Change);
sliderQuality.addEventListener(Event.CHANGE, onQuality_Change);
}
override public function shutdown():void{
btnOk.removeEventListener(MouseEvent.CLICK, onOk_Click);
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
cbMusic.removeEventListener(MouseEvent.CLICK, onMusic_Click);
sliderMusicVol.removeEventListener(Event.CHANGE, onMusicVol_Change);
cbSFX.removeEventListener(MouseEvent.CLICK, onSFX_Click);
sliderSFXVol.removeEventListener(Event.CHANGE, onSFXVol_Change);
sliderQuality.removeEventListener(Event.CHANGE, onQuality_Change);
}
private function onOk_Click(_arg1:MouseEvent):void{
close();
}
private function updateParamsValues():void{
cbMusic.selected = !(Main.engine.soundMgr.musicMuting);
sliderMusicVol.value = Main.engine.soundMgr.musicVol;
cbSFX.selected = !(Main.engine.soundMgr.sfxMuting);
sliderSFXVol.value = Main.engine.soundMgr.sfxVol;
sliderQuality.value = Main.engine.guiMgr.graphicsLevel;
}
private function onEnterFrame(_arg1:Event):void{
updateParamsValues();
}
private function onMusic_Click(_arg1:MouseEvent):void{
Main.engine.soundMgr.musicMuting = !(cbMusic.selected);
}
private function onMusicVol_Change(_arg1:Event):void{
Main.engine.soundMgr.musicVol = sliderMusicVol.value;
}
private function onSFX_Click(_arg1:MouseEvent):void{
Main.engine.soundMgr.sfxMuting = !(cbSFX.selected);
}
private function onSFXVol_Change(_arg1:Event):void{
Main.engine.soundMgr.sfxVol = sliderSFXVol.value;
}
private function onQuality_Change(_arg1:Event):void{
Main.engine.guiMgr.graphicsLevel = sliderQuality.value;
}
function __setProp_sliderSFXVol_Options_Layer2_0(){
try {
sliderSFXVol["componentInspectorSetting"] = true;
} catch(e:Error) {
};
sliderSFXVol.direction = "horizontal";
sliderSFXVol.enabled = true;
sliderSFXVol.liveDragging = true;
sliderSFXVol.maximum = 1;
sliderSFXVol.minimum = 0;
sliderSFXVol.snapInterval = 0.01;
sliderSFXVol.tickInterval = 0.1;
sliderSFXVol.value = 0;
sliderSFXVol.visible = true;
try {
sliderSFXVol["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_sliderMusicVol_Options_Layer2_0(){
try {
sliderMusicVol["componentInspectorSetting"] = true;
} catch(e:Error) {
};
sliderMusicVol.direction = "horizontal";
sliderMusicVol.enabled = true;
sliderMusicVol.liveDragging = true;
sliderMusicVol.maximum = 1;
sliderMusicVol.minimum = 0;
sliderMusicVol.snapInterval = 0.01;
sliderMusicVol.tickInterval = 0.1;
sliderMusicVol.value = 0;
sliderMusicVol.visible = true;
try {
sliderMusicVol["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_sliderQuality_Options_Layer2_0(){
try {
sliderQuality["componentInspectorSetting"] = true;
} catch(e:Error) {
};
sliderQuality.direction = "horizontal";
sliderQuality.enabled = true;
sliderQuality.liveDragging = true;
sliderQuality.maximum = 3;
sliderQuality.minimum = 0;
sliderQuality.snapInterval = 1;
sliderQuality.tickInterval = 1;
sliderQuality.value = 0;
sliderQuality.visible = true;
try {
sliderQuality["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_cbSFX_Options_Layer2_0(){
try {
cbSFX["componentInspectorSetting"] = true;
} catch(e:Error) {
};
cbSFX.enabled = true;
cbSFX.label = "";
cbSFX.labelPlacement = "left";
cbSFX.selected = false;
cbSFX.visible = true;
try {
cbSFX["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
function __setProp_cbMusic_Options_Layer2_0(){
try {
cbMusic["componentInspectorSetting"] = true;
} catch(e:Error) {
};
cbMusic.enabled = true;
cbMusic.label = "";
cbMusic.labelPlacement = "left";
cbMusic.selected = false;
cbMusic.visible = true;
try {
cbMusic["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
}
}//package jk.app.display.windows.dialogs
Section 165
//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{
openURL(Settings.POST_IT_HERE_URL);
}
}
}//package jk.app.display.windows.dialogs
Section 166
//SprintFinished (jk.app.display.windows.dialogs.SprintFinished)
package jk.app.display.windows.dialogs {
import flash.events.*;
import jk.engine.display.windows.*;
import flash.text.*;
import mochi.as3.*;
import jk.app.display.buttons.*;
public class SprintFinished extends ModalDialog {
public var txtLevelsBeaten:TextField;
public var btnSubmit:BtnSubmit;
public var btnOk:BtnOk;
override public function initialize():void{
guiMgr.hud.showItem("adGame1", openTweenTime);
guiMgr.hud.showItem("adGame2", openTweenTime);
guiMgr.hud.showItem("socialButtons", openTweenTime);
txtLevelsBeaten.text = ("Levels Beaten: " + _initOptions.levelsBeaten);
if (_initOptions.levelsBeaten > 9){
Main.engine.achievementMgr.obtainAchievement("Beat 10 levels in sprint");
};
}
override public function postInitialize():void{
btnSubmit.addEventListener(MouseEvent.CLICK, onSubmit_Click);
btnOk.addEventListener(MouseEvent.CLICK, onOk_Click);
}
override public function shutdown():void{
btnSubmit.removeEventListener(MouseEvent.CLICK, onSubmit_Click);
btnOk.removeEventListener(MouseEvent.CLICK, onOk_Click);
}
private function onSubmit_Click(_arg1:MouseEvent):void{
var onClose:Function;
var e = _arg1;
onClose = function ():void{
guiMgr.frozen = false;
};
if (!_initOptions.levelsBeaten){
return;
};
guiMgr.frozen = true;
MochiScores.showLeaderboard({boardID:Settings.SPRINT_LEADERBOARD_ID, score:_initOptions.levelsBeaten, onClose:onClose});
}
private function onOk_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("MainMenu", {});
}
}
}//package jk.app.display.windows.dialogs
Section 167
//ContactListener (jk.app.display.windows.sheets.gameAssets.ContactListener)
package jk.app.display.windows.sheets.gameAssets {
import Box2D.Collision.*;
import Box2D.Dynamics.*;
import jk.engine.utils.*;
import Box2D.Dynamics.Contacts.*;
import jk.app.theater.actors.*;
public class ContactListener extends b2ContactListener {
public var goodOnPlatform:Array;
public var evilOnPlatform:Array;
public var fail:Boolean;
public function ContactListener(){
goodOnPlatform = new Array();
evilOnPlatform = new Array();
}
override public function Result(_arg1:b2ContactResult):void{
if ((((_arg1.shape1.GetUserData() is Hero)) && ((_arg1.shape2.GetUserData() is Platform)))){
onHeroPlatformContact_Add(_arg1.shape1.GetUserData(), _arg1.shape2.GetUserData());
};
if ((((_arg1.shape1.GetUserData() is Platform)) && ((_arg1.shape2.GetUserData() is Hero)))){
onHeroPlatformContact_Add(_arg1.shape2.GetUserData(), _arg1.shape1.GetUserData());
};
}
override public function Remove(_arg1:b2ContactPoint):void{
if ((((_arg1.shape1.GetUserData() is Hero)) && ((_arg1.shape2.GetUserData() is Platform)))){
onHeroPlatformContact_Remove(_arg1.shape1.GetUserData(), _arg1.shape2.GetUserData());
};
if ((((_arg1.shape1.GetUserData() is Platform)) && ((_arg1.shape2.GetUserData() is Hero)))){
onHeroPlatformContact_Remove(_arg1.shape2.GetUserData(), _arg1.shape1.GetUserData());
};
}
public function clear():void{
UArray.clear(goodOnPlatform);
UArray.clear(evilOnPlatform);
fail = false;
}
private function onHeroPlatformContact_Add(_arg1:Hero, _arg2:Platform):void{
if ((_arg1 is Good)){
if ((_arg2 is GoodPlatform)){
UArray.pushUnique(goodOnPlatform, _arg1);
} else {
fail = true;
};
} else {
if ((_arg2 is EvilPlatform)){
UArray.pushUnique(evilOnPlatform, _arg1);
} else {
fail = true;
};
};
}
private function onHeroPlatformContact_Remove(_arg1:Hero, _arg2:Platform):void{
if ((((_arg1 is Good)) && ((_arg2 is GoodPlatform)))){
UArray.remove(goodOnPlatform, _arg1);
} else {
if ((((_arg1 is Evil)) && ((_arg2 is EvilPlatform)))){
UArray.remove(evilOnPlatform, _arg1);
};
};
}
}
}//package jk.app.display.windows.sheets.gameAssets
Section 168
//CursorInformer (jk.app.display.windows.sheets.gameAssets.CursorInformer)
package jk.app.display.windows.sheets.gameAssets {
import flash.display.*;
public dynamic class CursorInformer extends MovieClip {
}
}//package jk.app.display.windows.sheets.gameAssets
Section 169
//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 170
//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 171
//Theater (jk.app.display.windows.sheets.gameAssets.Theater)
package jk.app.display.windows.sheets.gameAssets {
import Box2D.Common.Math.*;
import jk.engine.theater.*;
import jk.app.theater.actors.*;
public class Theater extends Theater {
public static const GRAVITY:Number = 10;
override public function step(_arg1:Number=0.0333333333333333):void{
var _local3:int;
var _local4:Shape;
var _local2:b2Vec2 = new b2Vec2();
while (_local3 < _actors.length) {
_local4 = (_actors[_local3] as Shape);
if (!_local4){
} else {
if (_local4.gravity == Shape.GRAVITY_NONE){
} else {
if (_local4.gravity == Shape.GRAVITY_DOWN){
_local2.x = 0;
_local2.y = (GRAVITY * _local4.body.GetMass());
} else {
if (_local4.gravity == Shape.GRAVITY_LEFT){
_local2.x = (-(GRAVITY) * _local4.body.GetMass());
_local2.y = 0;
} else {
if (_local4.gravity == Shape.GRAVITY_UP){
_local2.x = 0;
_local2.y = (-(GRAVITY) * _local4.body.GetMass());
} else {
if (_local4.gravity == Shape.GRAVITY_RIGHT){
_local2.x = (GRAVITY * _local4.body.GetMass());
_local2.y = 0;
};
};
};
};
_local4.body.ApplyForce(_local2, _local4.body.GetWorldCenter());
_local4.updateLook();
};
};
_local3++;
};
super.step(_arg1);
}
}
}//package jk.app.display.windows.sheets.gameAssets
Section 172
//Theater (jk.app.display.windows.sheets.levelEditorAssets.Theater)
package jk.app.display.windows.sheets.levelEditorAssets {
import Box2D.Common.Math.*;
import jk.app.theater.actors.*;
import jk.engine.theater.edit.*;
public class Theater extends EditableTheater {
public static const GRAVITY:Number = 10;
override public function step(_arg1:Number=0.0333333333333333):void{
var _local3:int;
var _local4:Shape;
var _local2:b2Vec2 = new b2Vec2();
while (_local3 < _actors.length) {
_local4 = (_actors[_local3] as Shape);
if (!_local4){
} else {
if (_local4.gravity == Shape.GRAVITY_NONE){
} else {
if (_local4.gravity == Shape.GRAVITY_DOWN){
_local2.x = 0;
_local2.y = (GRAVITY * _local4.body.GetMass());
} else {
if (_local4.gravity == Shape.GRAVITY_LEFT){
_local2.x = (-(GRAVITY) * _local4.body.GetMass());
_local2.y = 0;
} else {
if (_local4.gravity == Shape.GRAVITY_UP){
_local2.x = 0;
_local2.y = (-(GRAVITY) * _local4.body.GetMass());
} else {
if (_local4.gravity == Shape.GRAVITY_RIGHT){
_local2.x = (GRAVITY * _local4.body.GetMass());
_local2.y = 0;
};
};
};
};
_local4.body.ApplyForce(_local2, _local4.body.GetWorldCenter());
_local4.updateLook();
};
};
_local3++;
};
super.step(_arg1);
}
}
}//package jk.app.display.windows.sheets.levelEditorAssets
Section 173
//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 174
//LevelSelectorSprint (jk.app.display.windows.sheets.levelSelectionAssets.LevelSelectorSprint)
package jk.app.display.windows.sheets.levelSelectionAssets {
import flash.display.*;
public dynamic class LevelSelectorSprint extends MovieClip {
public function LevelSelectorSprint(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package jk.app.display.windows.sheets.levelSelectionAssets
Section 175
//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 176
//BasicEye (jk.app.display.windows.sheets.mainMenuAssets.BasicEye)
package jk.app.display.windows.sheets.mainMenuAssets {
import flash.display.*;
import jk.engine.utils.*;
import flash.events.*;
public class BasicEye extends Sprite {
public function BasicEye(){
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
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{
var _local2:Number = Math.round(UMath.rad2Deg(Math.atan2(mouseY, mouseX)));
if (_local2){
rotation = (rotation + _local2);
};
}
}
}//package jk.app.display.windows.sheets.mainMenuAssets
Section 177
//Eye1 (jk.app.display.windows.sheets.mainMenuAssets.Eye1)
package jk.app.display.windows.sheets.mainMenuAssets {
public dynamic class Eye1 extends BasicEye {
}
}//package jk.app.display.windows.sheets.mainMenuAssets
Section 178
//Eye2 (jk.app.display.windows.sheets.mainMenuAssets.Eye2)
package jk.app.display.windows.sheets.mainMenuAssets {
public dynamic class Eye2 extends BasicEye {
}
}//package jk.app.display.windows.sheets.mainMenuAssets
Section 179
//Eye3 (jk.app.display.windows.sheets.mainMenuAssets.Eye3)
package jk.app.display.windows.sheets.mainMenuAssets {
public dynamic class Eye3 extends BasicEye {
}
}//package jk.app.display.windows.sheets.mainMenuAssets
Section 180
//Eye4 (jk.app.display.windows.sheets.mainMenuAssets.Eye4)
package jk.app.display.windows.sheets.mainMenuAssets {
public dynamic class Eye4 extends BasicEye {
}
}//package jk.app.display.windows.sheets.mainMenuAssets
Section 181
//Eye5 (jk.app.display.windows.sheets.mainMenuAssets.Eye5)
package jk.app.display.windows.sheets.mainMenuAssets {
public dynamic class Eye5 extends BasicEye {
}
}//package jk.app.display.windows.sheets.mainMenuAssets
Section 182
//Achievements (jk.app.display.windows.sheets.Achievements)
package jk.app.display.windows.sheets {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import com.greensock.*;
import jk.engine.display.windows.*;
import fl.motion.easing.*;
import jk.app.display.buttons.*;
public class Achievements extends Sheet {
public var star1:MovieClip;
public var star2:MovieClip;
public var star3:MovieClip;
public var star4:MovieClip;
public var star5:MovieClip;
public var star6:MovieClip;
public var star7:MovieClip;
public var btnMainMenu:BtnMainMenu;
private var _stars:Dictionary;
public function Achievements(){
_stars = new Dictionary();
_stars["Beat 5 levels"] = star1;
_stars["Beat 10 levels"] = star2;
_stars["Beat the game"] = star3;
_stars["Beat 10 levels in sprint"] = star4;
_stars["Beat a custom level"] = star5;
_stars["Submit highscores"] = star6;
_stars["Click on more games"] = star7;
}
override public function initialize():void{
var _local1:String;
var _local2:MovieClip;
guiMgr.hud.state = "Achievements";
for (_local1 in _stars) {
_local2 = _stars[_local1];
if (Main.engine.achievementMgr.isAchievementObtained(_local1)){
_local2.gotoAndStop("obtained");
_local2.addEventListener(MouseEvent.MOUSE_OVER, onStar_MouseOver);
_local2.addEventListener(MouseEvent.MOUSE_OUT, onStar_MouseOut);
};
};
}
override public function postInitialize():void{
btnMainMenu.addEventListener(MouseEvent.CLICK, onMainMenu_Click);
}
override public function shutdown():void{
var _local1:String;
var _local2:MovieClip;
btnMainMenu.removeEventListener(MouseEvent.CLICK, onMainMenu_Click);
for (_local1 in _stars) {
_local2 = _stars[_local1];
if (Main.engine.achievementMgr.isAchievementObtained(_local1)){
_local2.removeEventListener(MouseEvent.MOUSE_OVER, onStar_MouseOver);
_local2.removeEventListener(MouseEvent.MOUSE_OUT, onStar_MouseOut);
};
};
}
private function onMainMenu_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("MainMenu", {});
}
private function onStar_MouseOver(_arg1:MouseEvent):void{
var _local2:DisplayObject = (_arg1.currentTarget as DisplayObject);
setChildIndex(_local2, (numChildren - 1));
TweenLite.to(_local2, 1, {scaleX:1.5, scaleY:1.5, rotation:20, ease:Elastic.easeOut});
}
private function onStar_MouseOut(_arg1:MouseEvent):void{
TweenLite.to(_arg1.currentTarget, 1, {scaleX:1, scaleY:1, rotation:0, ease:Elastic.easeOut});
}
}
}//package jk.app.display.windows.sheets
Section 183
//Game (jk.app.display.windows.sheets.Game)
package jk.app.display.windows.sheets {
import jk.engine.utils.*;
import flash.geom.*;
import flash.events.*;
import jk.engine.common.*;
import jk.app.theater.actors.*;
import jk.engine.display.windows.*;
import jk.engine.ui.*;
import jk.app.display.windows.sheets.gameAssets.*;
public class Game extends Sheet {
private var _hintMgr:HintManager;
private var _theater:Theater;
private var _bound:Rectangle;
private var _mode:int;
private var _tickedTimer:TickedTimer;
private var _levelPack:LevelPack;
private var _score:int;
private var _sprintLevels:Array;
private var _levelsBeaten:int;
private var _time:Number;
private var _numGoods:int;
private var _goodPlatform:Boolean;
private var _numEvils:int;
private var _evilPlatform:Boolean;
private var _iterations2complete:int;
private var _contactListener:ContactListener;
private static const _NONE:int = 0;
private static const _CUSTOM:int = 1;
private static const _OFFICIAL:int = 2;
private static const _SPRINT:int = 3;
private static const _ITERATIONS_TO_COMPLETE:int = 32;
public function Game(){
_hintMgr = new HintManager();
_theater = new Theater();
_bound = new Rectangle(0, 0, Settings.WIDTH, Settings.HEIGHT);
_contactListener = new ContactListener();
_tickedTimer = new TickedTimer();
_theater.world.SetContactListener(_contactListener);
addChild(_hintMgr);
addChild(_theater);
_hintMgr.add(0, [new Level0Hint1(), new Level0Hint2()]);
}
override public function initialize():void{
var _local1:Object;
selectMode();
if (_mode == _CUSTOM){
guiMgr.hud.state = "GameCustomLevel";
_local1 = LevelCode.decode(_initOptions.levelCode);
_score = (Settings.GAME_INIT_SCORE + 1);
} else {
if (_mode == _OFFICIAL){
guiMgr.hud.state = "GameOfficialLevel";
_levelPack = _initOptions.levelPack;
_local1 = LevelCode.decode(_levelPack.getLevelCode(_initOptions.levelIndex));
_score = ((Settings.GAME_INIT_SCORE + 1) + (Settings.GAME_ADDITION_SCORE * _initOptions.levelIndex));
guiMgr.hud.txtLevelIndex.text = (((_initOptions.levelIndex + 1) + "/") + _levelPack.numLevels);
} else {
if (_mode == _SPRINT){
guiMgr.hud.state = "GameSprint";
_levelPack = _initOptions.levelPack;
if (!_sprintLevels){
startSprint();
};
_local1 = LevelCode.decode(_levelPack.getLevelCode(_sprintLevels[0]));
guiMgr.hud.txtLevelsBeaten.text = ("Beaten: " + _levelsBeaten);
guiMgr.hud.txtTime.text = ("Time: " + secondsToMinutes(_time));
} else {
close();
};
};
};
_theater.code = _local1.theater;
updateHUD();
_numGoods = _theater.numActorsOf(Good);
_goodPlatform = _theater.hasActorOf(GoodPlatform);
_numEvils = _theater.numActorsOf(Evil);
_evilPlatform = _theater.hasActorOf(EvilPlatform);
checking2complete = false;
}
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.btnMainMenu.addEventListener(MouseEvent.CLICK, onHUD_MainMenu_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);
};
_tickedTimer.tick();
}
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.btnMainMenu.removeEventListener(MouseEvent.CLICK, onHUD_MainMenu_Click);
guiMgr.hud.btnHint.removeEventListener(MouseEvent.CLICK, onHUD_Hint_Click);
_theater.actorsHolder.removeEventListener(MouseEvent.CLICK, onTheater_ActorsHolder_Click);
}
override public function postShutdown():void{
_contactListener.clear();
_theater.removeAllActors();
_hintMgr.hide();
}
private function get checking2complete():Boolean{
return (guiMgr.hud.checking.visible);
}
private function set checking2complete(_arg1:Boolean):void{
if (((_arg1) && (!(guiMgr.hud.checking.visible)))){
guiMgr.hud.checking.gotoAndPlay(1);
};
guiMgr.hud.checking.visible = _arg1;
}
private function selectMode():void{
if (_initOptions.hasOwnProperty("levelCode")){
_mode = _CUSTOM;
} else {
if (((_initOptions.hasOwnProperty("levelPack")) && (_initOptions.hasOwnProperty("levelIndex")))){
_mode = _OFFICIAL;
} else {
if (((_initOptions.hasOwnProperty("levelPack")) && (_initOptions.hasOwnProperty("sprint")))){
_mode = _SPRINT;
} else {
_mode = _NONE;
};
};
};
}
private function startSprint():void{
var _local1:int;
_sprintLevels = new Array();
while (_local1 < _levelPack.numLevels) {
_sprintLevels.push(_local1);
_local1++;
};
UArray.shuffle(_sprintLevels);
_levelsBeaten = 0;
_time = 180;
guiMgr.openWindow("Message", {title:"MESSAGE", message:"You are in the \"Sprint Mode\".\n\nTry to beat as many levels, as you can for 180 seconds!\n\nGood luck!"});
}
private function finishSprint():void{
_sprintLevels = null;
guiMgr.openWindow("SprintFinished", {levelsBeaten:_levelsBeaten});
}
private function levelFailed():void{
checking2complete = false;
if (_mode == _CUSTOM){
guiMgr.openWindow("CustomLevelFailed", {levelCode:_initOptions.levelCode});
} else {
if (_mode == _OFFICIAL){
restart();
} else {
if (_mode == _SPRINT){
restart();
};
};
};
}
private function levelComplete():void{
var _local1:int;
var _local2:Shape;
Main.engine.soundMgr.playSFX("Win");
checking2complete = false;
while (_local1 < _theater.actors.length) {
_local2 = (_theater.actors[_local1] as Shape);
if (_local2){
_theater.actors[_local1].wowMouth();
};
_local1++;
};
if (_mode == _CUSTOM){
guiMgr.openWindow("CustomLevelComplete", {levelCode:_initOptions.levelCode});
Main.engine.achievementMgr.obtainAchievement("Beat a custom level");
} else {
if (_mode == _OFFICIAL){
if (_initOptions.levelIndex == _levelPack.levelsBeaten){
_levelPack.levelsBeaten++;
};
if (_score > _levelPack.getScore(_initOptions.levelIndex)){
_levelPack.setScore(_initOptions.levelIndex, _score);
};
if (_initOptions.levelIndex < (_levelPack.numLevels - 1)){
guiMgr.openWindow("OfficialLevelComplete", {levelIndex:_initOptions.levelIndex, score:_score, levelPack:_levelPack});
if (_levelPack.levelsBeaten == 5){
Main.engine.achievementMgr.obtainAchievement("Beat 5 levels");
} else {
if (_levelPack.levelsBeaten == 10){
Main.engine.achievementMgr.obtainAchievement("Beat 10 levels");
};
};
} else {
if (!_levelPack.beaten){
_levelPack.beaten = true;
guiMgr.openWindow("LevelSelection", {levelPack:_levelPack});
guiMgr.openWindow("Message", {title:"MESSAGE", message:"Congratulations! You finished all levels!\n\nCreate your own levels and share them with friends with our editor! Also, try sprint mode.\n\nThanks for the game!"});
Main.engine.achievementMgr.obtainAchievement("Beat the game");
return;
};
guiMgr.openWindow("LevelSelection", {levelPack:_levelPack});
};
} else {
if (_mode == _SPRINT){
_sprintLevels.shift();
_levelsBeaten++;
if (_sprintLevels.length){
restart();
} else {
finishSprint();
};
};
};
};
}
private function checkWin():void{
var _local1:int;
var _local2:Hero;
if (_contactListener.fail){
levelFailed();
return;
};
while (_local1 < _theater.actors.length) {
_local2 = (_theater.actors[_local1] as Hero);
if (((_local2) && (!(_bound.contains(_local2.x, _local2.y))))){
levelFailed();
return;
};
_local1++;
};
if (((((_goodPlatform) && (!((_numGoods == _contactListener.goodOnPlatform.length))))) || (((_evilPlatform) && (!((_numEvils == _contactListener.evilOnPlatform.length))))))){
checking2complete = false;
return;
};
if (!checking2complete){
checking2complete = true;
_iterations2complete = _ITERATIONS_TO_COMPLETE;
};
_iterations2complete--;
if (!_iterations2complete){
levelComplete();
};
}
private function updateHUD():void{
if ((((_mode == _OFFICIAL)) || ((_mode == _CUSTOM)))){
if (_score != 0){
_score--;
guiMgr.hud.txtScore.text = ("Score: " + _score);
};
} else {
if (_mode == _SPRINT){
_time = (_time - (0.001 * _tickedTimer.duration));
if (_time <= 0){
guiMgr.hud.txtTime.text = "Time: 0:00";
finishSprint();
} else {
guiMgr.hud.txtTime.text = ("Time: " + secondsToMinutes(_time));
};
};
};
}
private function onEnterFrame(_arg1:Event):void{
_tickedTimer.tick();
if (guiMgr.sheetOverlapping){
return;
};
if (Main.engine.keyboardMgr.isKeyDown(KeyboardManager.R)){
restart();
};
_theater.step();
updateHUD();
checkWin();
}
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_MainMenu_Click(_arg1:MouseEvent):void{
var yesCallback:Function;
var e = _arg1;
yesCallback = function ():void{
_sprintLevels = null;
guiMgr.openWindow("MainMenu", {});
};
guiMgr.openWindow("Message", {title:"MESSAGE", message:"Do you really want to finish sprint?", yesCallback:yesCallback});
}
private function onHUD_Hint_Click(_arg1:MouseEvent):void{
openURL(Settings.HINT_URL);
}
private function onTheater_ActorsHolder_Click(_arg1:MouseEvent):void{
var _local3:Hero;
var _local2:Hero = (_theater.getActorAtMouse() as Hero);
if (((_local2) && (_local2.bitParams.getBit("clickable")))){
_local3 = (_theater.addActor(_local2.alternative, {code:_local2.code}) as Hero);
_local3.body.SetAngularVelocity(_local2.body.GetAngularVelocity());
_local3.body.SetLinearVelocity(_local2.body.GetLinearVelocity());
if ((_local2 is Good)){
UArray.remove(_contactListener.goodOnPlatform, _local2);
} else {
if ((_local2 is Evil)){
UArray.remove(_contactListener.evilOnPlatform, _local2);
};
};
_theater.removeActor(_local2);
Main.engine.soundMgr.playSFX("Click");
};
}
}
}//package jk.app.display.windows.sheets
Section 184
//LevelEditor (jk.app.display.windows.sheets.LevelEditor)
package jk.app.display.windows.sheets {
import flash.events.*;
import jk.engine.common.*;
import jk.app.theater.actors.*;
import jk.engine.display.windows.*;
import jk.app.display.windows.dialogs.*;
import jk.app.display.windows.sheets.levelEditorAssets.*;
public class LevelEditor extends Sheet {
public var theater:Theater;
private var _panel:LevelEditorPanel;
private var _needSyncTheater:Boolean;
public function LevelEditor(){
theater.dragStep = 2.5;
theater.gridStep = 0;
}
override public function initialize():void{
var _local1:Object;
guiMgr.hud.state = "LevelEditor";
_panel = (guiMgr.openWindow("LevelEditorPanel", {}) as LevelEditorPanel);
if (_initOptions.hasOwnProperty("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("Message", {title:"MESSAGE", message:"Are you sure you want to clear this level?", yesCallback:yesCallback});
}
private function onActors_Dropdown_Click(_arg1:MouseEvent):void{
if (_panel.cbActors.selectedItem.data == "---"){
theater.setAddingActor(null);
} else {
theater.setAddingActor(_panel.cbActors.selectedItem.data);
};
}
private function onTest_Click(_arg1:MouseEvent):void{
var _local2:Boolean = theater.hasActorOf(Good);
var _local3:Boolean = theater.hasActorOf(GoodPlatform);
var _local4:Boolean = theater.hasActorOf(Evil);
var _local5:Boolean = theater.hasActorOf(EvilPlatform);
if (!((((((_local2) || (_local3))) || (_local4))) || (_local5))){
guiMgr.openWindow("Message", {title:"MESSAGE", message:"Please add Hero and Platform."});
} else {
if (((_local2) && (!(_local3)))){
guiMgr.openWindow("Message", {title:"MESSAGE", message:"Please add Platform for Good."});
} else {
if (((_local4) && (!(_local5)))){
guiMgr.openWindow("Message", {title:"MESSAGE", message:"Please add Platform for Evil."});
} else {
if (((_local3) && (!(_local2)))){
guiMgr.openWindow("Message", {title:"MESSAGE", message:"Please add Good Hero."});
} else {
if (((_local5) && (!(_local4)))){
guiMgr.openWindow("Message", {title:"MESSAGE", message:"Please add Evil Hero."});
} 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 185
//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 = 20;
public var ls17:LevelSelector;
public var txtScore:TextField;
public var ls18:LevelSelector;
public var lsSprint:LevelSelectorSprint;
public var ls19:LevelSelector;
public var ls1:LevelSelector;
public var txtTotalScore:TextField;
public var ls2:LevelSelector;
public var ls3:LevelSelector;
public var btnSubmit:BtnSubmit;
public var ls4:LevelSelector;
public var ls5:LevelSelector;
public var ls10:LevelSelector;
public var btnMainMenu:BtnMainMenu;
public var ls6:LevelSelector;
public var ls20:LevelSelector;
public var ls11:LevelSelector;
public var ls7:LevelSelector;
public var ls12:LevelSelector;
public var ls13:LevelSelector;
public var ls8:LevelSelector;
public var ls14:LevelSelector;
public var ls9:LevelSelector;
public var ls15:LevelSelector;
public var ls16:LevelSelector;
private var _levelSelectors:Array;
private var _levelPack:LevelPack;
public function LevelSelection(){
var _local2:LevelSelector;
super();
_levelSelectors = new Array();
var _local1 = 1;
while (_local1 <= _LS_NUM) {
_local2 = (this[("ls" + _local1)] as LevelSelector);
_local2.levelIndex = (_local1 - 1);
_local2.txtNumber.mouseEnabled = false;
_local2.txtNumber.text = String(_local1);
_levelSelectors.push(_local2);
_local1++;
};
}
override public function initialize():void{
var _local1:int;
var _local2:LevelSelector;
guiMgr.hud.state = "LevelSelection";
_levelPack = _initOptions.levelPack;
while (_local1 < _LS_NUM) {
if (_local1 < _levelPack.numLevels){
_local2 = _levelSelectors[_local1];
if (_local1 <= _levelPack.levelsBeaten){
_local2.gotoAndStop("beaten");
if (_local1 == _levelPack.levelsBeaten){
_local2.gotoAndStop("opened");
};
_local2.buttonMode = true;
_local2.addEventListener(MouseEvent.MOUSE_OVER, onLevelSelector_MouseOver);
_local2.addEventListener(MouseEvent.MOUSE_OUT, onLevelSelector_MouseOut);
} else {
_local2.gotoAndStop("closed");
};
} else {
_levelSelectors[_local1].visible = false;
};
_local1++;
};
if (_levelPack.beaten){
lsSprint.gotoAndStop("opened");
lsSprint.buttonMode = true;
} else {
lsSprint.gotoAndStop("closed");
};
txtTotalScore.text = ("Total Score: " + _levelPack.totalScore);
}
override public function postInitialize():void{
var _local1:int;
var _local2:LevelSelector;
btnMainMenu.addEventListener(MouseEvent.CLICK, onMainMenu_Click);
btnSubmit.addEventListener(MouseEvent.CLICK, onSubmit_Click);
while (_local1 < _LS_NUM) {
if (_local1 < _levelPack.numLevels){
_local2 = _levelSelectors[_local1];
if (_local1 <= _levelPack.levelsBeaten){
_local2.addEventListener(MouseEvent.CLICK, onLevelSelector_Click);
};
};
_local1++;
};
if (_levelPack.beaten){
lsSprint.addEventListener(MouseEvent.MOUSE_OVER, onLevelSelector_MouseOver);
lsSprint.addEventListener(MouseEvent.MOUSE_OUT, onLevelSelector_MouseOut);
lsSprint.addEventListener(MouseEvent.CLICK, onLevelSelector_Click);
};
}
override public function shutdown():void{
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++;
};
if (_levelPack.beaten){
lsSprint.removeEventListener(MouseEvent.MOUSE_OVER, onLevelSelector_MouseOver);
lsSprint.removeEventListener(MouseEvent.MOUSE_OUT, onLevelSelector_MouseOut);
lsSprint.removeEventListener(MouseEvent.CLICK, onLevelSelector_Click);
};
}
private function onLevelSelector_MouseOver(_arg1:MouseEvent):void{
var _local2:* = _arg1.currentTarget;
setChildIndex(_local2, (numChildren - 1));
TweenLite.to(_local2, 1, {scaleX:1.5, scaleY:1.5, ease:Elastic.easeOut});
if (_local2 != lsSprint){
txtScore.text = ("Score: " + _levelPack.getScore(_local2.levelIndex));
};
}
private function onLevelSelector_MouseOut(_arg1:MouseEvent):void{
var _local2:* = _arg1.currentTarget;
TweenLite.to(_local2, 1, {scaleX:1, scaleY:1, ease:Elastic.easeOut});
txtScore.text = "";
}
private function onLevelSelector_Click(_arg1:MouseEvent):void{
var _local2:* = _arg1.currentTarget;
TweenLite.to(_local2, 1, {scaleX:1, scaleY:1, ease:Elastic.easeOut});
if (_local2 != lsSprint){
guiMgr.openWindow("Game", {levelIndex:_local2.levelIndex, levelPack:_levelPack});
txtScore.text = "";
} else {
guiMgr.openWindow("Game", {levelPack:_levelPack, sprint:true});
};
}
private function onMainMenu_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("MainMenu", {});
}
private function onSubmit_Click(_arg1:MouseEvent):void{
var onClose:Function;
var e = _arg1;
onClose = function ():void{
guiMgr.frozen = false;
};
if (!_levelPack.totalScore){
return;
};
guiMgr.frozen = true;
MochiScores.showLeaderboard({boardID:Settings.HIGHSCORES_LEADERBOARD_ID, score:_levelPack.totalScore, onClose:onClose});
Main.engine.achievementMgr.obtainAchievement("Submit highscores");
}
}
}//package jk.app.display.windows.sheets
Section 186
//MainMenu (jk.app.display.windows.sheets.MainMenu)
package jk.app.display.windows.sheets {
import flash.display.*;
import jk.engine.utils.*;
import flash.events.*;
import jk.engine.display.windows.*;
import mochi.as3.*;
public class MainMenu extends Sheet {
public var btnCustomLevel:SimpleButton;
public var btnMoreGames:SimpleButton;
public var btnStart:SimpleButton;
public var btnAchievements:SimpleButton;
public var btnHighscores:SimpleButton;
public var btnLevelEditor:SimpleButton;
override public function initialize():void{
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);
btnAchievements.addEventListener(MouseEvent.CLICK, onAchievements_Click);
}
override public function shutdown():void{
btnStart.removeEventListener(MouseEvent.CLICK, onStart_Click);
btnCustomLevel.removeEventListener(MouseEvent.CLICK, onCustomLevel_Click);
btnHighscores.removeEventListener(MouseEvent.CLICK, onHighscores_Click);
btnLevelEditor.removeEventListener(MouseEvent.CLICK, onLevelEditor_Click);
btnMoreGames.removeEventListener(MouseEvent.CLICK, onMoreGames_Click);
btnAchievements.removeEventListener(MouseEvent.CLICK, onAchievements_Click);
}
private function onStart_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("LevelSelection", {levelPack:Main.engine.levelMgr.getLevelPack("First")});
}
private function onCustomLevel_Click(_arg1:MouseEvent):void{
var loadCallback:Function;
var e = _arg1;
loadCallback = function (_arg1:String):void{
guiMgr.openWindow("Game", {levelCode:_arg1});
};
guiMgr.openWindow("SaveLoadLevel", {loadCallback:loadCallback});
}
private function onHighscores_Click(_arg1:MouseEvent):void{
var onClose:Function;
var e = _arg1;
onClose = function ():void{
guiMgr.frozen = false;
};
guiMgr.frozen = true;
MochiScores.showLeaderboard({boardID:Settings.HIGHSCORES_LEADERBOARD_ID, onClose:onClose});
}
private function onLevelEditor_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("LevelEditor", {});
}
private function onMoreGames_Click(_arg1:MouseEvent):void{
Main.engine.achievementMgr.obtainAchievement("Click on more games");
openURL(Settings.MAIN_MENU_MORE_GAMES_URL);
}
private function onAchievements_Click(_arg1:MouseEvent):void{
guiMgr.openWindow("Achievements", {});
}
}
}//package jk.app.display.windows.sheets
Section 187
//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 const _SPEED:Number = 35;
public var background:MovieClip;
public var cloudHolder:MovieClip;
public var homes:MovieClip;
public var trees:MovieClip;
private var _cloud:Cloud;
public function Background(){
var onComplete:Function;
super();
onComplete = function ():void{
_cloud.gotoAndStop(Math.ceil((_cloud.totalFrames * Math.random())));
_cloud.scaleX = (1 - (0.6 * Math.random()));
_cloud.scaleY = _cloud.scaleX;
_cloud.x = (-(_cloud.width) - 5);
_cloud.y = ((((Settings.HEIGHT - _cloud.height) - 200) * Math.random()) + 50);
var _local1:Object = new Object();
_local1.x = (Settings.WIDTH + 5);
_local1.ease = Linear.easeNone;
_local1.onComplete = onComplete;
var _local2:Number = ((_local1.x - _cloud.x) / _SPEED);
_local2 = (_local2 - ((0.5 * _local2) * Math.random()));
TweenLite.to(_cloud, _local2, _local1);
};
_cloud = new Cloud();
_cloud.gotoAndStop(Math.ceil((_cloud.totalFrames * Math.random())));
_cloud.scaleX = (1 - (0.4 * Math.random()));
_cloud.scaleY = _cloud.scaleX;
_cloud.x = ((((Settings.WIDTH - _cloud.width) + 10) * Math.random()) - 5);
_cloud.y = ((((Settings.HEIGHT - _cloud.height) - 200) * Math.random()) + 50);
cloudHolder.addChild(_cloud);
var vars:Object = new Object();
vars.x = (Settings.WIDTH + 5);
vars.ease = Linear.easeNone;
vars.onComplete = onComplete;
var duration:Number = ((vars.x - _cloud.x) / _SPEED);
duration = (duration - ((0.5 * duration) * Math.random()));
TweenLite.to(_cloud, duration, vars);
}
}
}//package jk.app.display
Section 188
//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 txtLevelIndex:TextField;
public var btnHint:BtnHint;
public var txtLevelsBeaten:TextField;
public var txtTime:TextField;
public var back1:Background;
public var checking:Checking;
public var back2:Background;
public var btnMainMenu:BtnMainMenu;
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 189
//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 190
//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 191
//Eye (jk.app.theater.actors.assets.evilFaceAssets.Eye)
package jk.app.theater.actors.assets.evilFaceAssets {
import flash.display.*;
public dynamic class Eye extends Sprite {
}
}//package jk.app.theater.actors.assets.evilFaceAssets
Section 192
//Eye (jk.app.theater.actors.assets.goodFaceAssets.Eye)
package jk.app.theater.actors.assets.goodFaceAssets {
import flash.display.*;
public dynamic class Eye extends Sprite {
}
}//package jk.app.theater.actors.assets.goodFaceAssets
Section 193
//Eye (jk.app.theater.actors.assets.normalFaceAssets.Eye)
package jk.app.theater.actors.assets.normalFaceAssets {
import flash.display.*;
public dynamic class Eye extends Sprite {
}
}//package jk.app.theater.actors.assets.normalFaceAssets
Section 194
//EvilFace (jk.app.theater.actors.assets.EvilFace)
package jk.app.theater.actors.assets {
import flash.display.*;
import jk.app.theater.actors.assets.evilFaceAssets.*;
public dynamic class EvilFace extends MovieClip {
public var eye1:Eye;
public var eye2:Eye;
}
}//package jk.app.theater.actors.assets
Section 195
//GoodFace (jk.app.theater.actors.assets.GoodFace)
package jk.app.theater.actors.assets {
import flash.display.*;
import jk.app.theater.actors.assets.goodFaceAssets.*;
public dynamic class GoodFace extends MovieClip {
public var eye1:Eye;
public var eye2:Eye;
}
}//package jk.app.theater.actors.assets
Section 196
//NormalFace (jk.app.theater.actors.assets.NormalFace)
package jk.app.theater.actors.assets {
import flash.display.*;
import jk.app.theater.actors.assets.normalFaceAssets.*;
public dynamic class NormalFace extends MovieClip {
public var eye1:Eye;
public var eye2:Eye;
}
}//package jk.app.theater.actors.assets
Section 197
//Evil (jk.app.theater.actors.Evil)
package jk.app.theater.actors {
import jk.app.theater.actors.assets.*;
public class Evil extends Hero {
override protected function setupFace():void{
_face = new EvilFace();
_faceHolder.addChild(_face);
}
}
}//package jk.app.theater.actors
Section 198
//EvilPlatform (jk.app.theater.actors.EvilPlatform)
package jk.app.theater.actors {
public class EvilPlatform extends Platform {
}
}//package jk.app.theater.actors
Section 199
//Good (jk.app.theater.actors.Good)
package jk.app.theater.actors {
import jk.app.theater.actors.assets.*;
public class Good extends Hero {
override protected function setupFace():void{
_face = new GoodFace();
_faceHolder.addChild(_face);
}
}
}//package jk.app.theater.actors
Section 200
//GoodPlatform (jk.app.theater.actors.GoodPlatform)
package jk.app.theater.actors {
public class GoodPlatform extends Platform {
}
}//package jk.app.theater.actors
Section 201
//Hero (jk.app.theater.actors.Hero)
package jk.app.theater.actors {
import jk.engine.theater.edit.params.*;
public class Hero extends Shape {
protected var _alternative:String;
public function get alternative():String{
return (_alternative);
}
override protected function setupBitParams():void{
super.setupBitParams();
_bitParams.addBit("clickable", true, onBitParams_Clickable_Changed);
}
override protected function setupEditableParams():void{
super.setupEditableParams();
_editableParams.replaceParam("gravity", new NumericParam("gravity", "gravity", NumericParam.POSITIVE_INTEGER, 1, 4));
_editableParams.addParam(new BooleanParam("clickable", "clickable", true));
}
override protected function resetGravity2default():void{
gravity = Shape.GRAVITY_DOWN;
_buildingParams.gravity = Shape.GRAVITY_DOWN;
}
override protected function restore2default():void{
super.restore2default();
_alternative = "";
_buildingParams.alternative = "";
}
override protected function build():void{
super.build();
_alternative = _buildingParams.alternative;
}
private function onBitParams_Clickable_Changed(_arg1:Boolean, _arg2:Boolean):void{
if (_arg2){
gotoAndStop(1);
} else {
gotoAndStop(2);
};
}
}
}//package jk.app.theater.actors
Section 202
//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("static");
}
}
}//package jk.app.theater.actors
Section 203
//Shape (jk.app.theater.actors.Shape)
package jk.app.theater.actors {
import flash.display.*;
import Box2D.Common.Math.*;
import jk.engine.theater.edit.params.*;
import jk.engine.utils.*;
import jk.app.theater.actors.assets.*;
import jk.engine.theater.actors.*;
public class Shape extends Shape {
protected var _gravity:int;
protected var _faceHolder:Sprite;
protected var _face:MovieClip;
public static const GRAVITY_NONE:int = 0;
public static const GRAVITY_DOWN:int = 1;
public static const GRAVITY_LEFT:int = 2;
public static const GRAVITY_UP:int = 3;
public static const GRAVITY_RIGHT:int = 4;
public function get gravity():int{
return (_gravity);
}
public function set gravity(_arg1:int):void{
_gravity = _arg1;
_faceHolder.visible = !((_gravity == GRAVITY_NONE));
onBitParams_Static_Change(_faceHolder.visible, !(_faceHolder.visible));
updateFaceRotation();
}
override public function get code():String{
var _local1:String = ((((((((UNumber.round2str(x, 2) + ",") + UNumber.round2str(y, 2)) + ",") + UNumber.round2str(rotation, 2)) + ",") + _bitParams.getValue()) + ",") + _gravity);
if (((!((scaleX == 1))) || (!((scaleY == 1))))){
_local1 = (_local1 + ((("," + UNumber.round2str(scaleX, 4)) + ",") + UNumber.round2str(scaleY, 4)));
};
return (_local1);
}
override public function set scaleX(_arg1:Number):void{
super.scaleX = _arg1;
updateFaceScale();
}
override public function set scaleY(_arg1:Number):void{
super.scaleY = _arg1;
updateFaceScale();
}
override public function set rotation(_arg1:Number):void{
super.rotation = _arg1;
updateFaceRotation();
}
override public function decode(_arg1:String):Object{
var _local2:Array = _arg1.split(",");
var _local3:Object = new Object();
_local3.x = Number(_local2[0]);
_local3.y = Number(_local2[1]);
_local3.rotation = Number(_local2[2]);
_local3.bitParams = int(_local2[3]);
_local3.gravity = int(_local2[4]);
if (_local2.length > 5){
_local3.scaleX = Number(_local2[5]);
_local3.scaleY = Number(_local2[6]);
};
return (_local3);
}
public function updateLook():void{
var velocity:b2Vec2;
var velocityLength:Number;
var dr:Number;
var eyeRotation:Function = function (_arg1:Sprite, _arg2:Number):void{
if (_arg2 == _arg1.rotation){
return;
};
_arg2 = (_arg2 - _arg1.rotation);
if (_arg2 < -180){
_arg2 = (_arg2 + 360);
} else {
if (_arg2 > 180){
_arg2 = (_arg2 - 360);
};
};
if (_arg2 > 0){
_arg1.rotation = (_arg1.rotation + 10);
} else {
if (_arg2 < 0){
_arg1.rotation = (_arg1.rotation - 10);
};
};
};
if (_face.visible){
velocity = _body.GetLinearVelocity();
velocityLength = velocity.Length();
if (velocityLength > 1){
dr = Math.round(UMath.rad2Deg(Math.atan2(velocity.y, velocity.x)));
eyeRotation(_face["eye1"], rotation2gravity(dr));
if (velocityLength > 4){
_face.gotoAndStop(4);
} else {
_face.gotoAndStop(3);
};
} else {
eyeRotation(_face["eye1"], 0);
if (velocityLength > 0.4){
_face.gotoAndStop(2);
} else {
_face.gotoAndStop(1);
};
};
_face["eye2"].rotation = _face["eye1"].rotation;
};
}
public function wowMouth():void{
_face.gotoAndStop(4);
}
override protected function constructor():void{
super.constructor();
_faceHolder = new Sprite();
addChild(_faceHolder);
setupFace();
}
protected function setupFace():void{
_face = new NormalFace();
_faceHolder.addChild(_face);
}
override protected function setupBitParams():void{
super.setupBitParams();
_bitParams.removeBit("static");
}
override protected function setupEditableParams():void{
super.setupEditableParams();
_editableParams.removeParam("static");
_editableParams.addParam(new NumericParam("gravity", "gravity", NumericParam.POSITIVE_INTEGER, 0, 4));
}
override protected function restore2default():void{
super.restore2default();
resetGravity2default();
resetLook2default();
}
protected function resetGravity2default():void{
gravity = GRAVITY_NONE;
_buildingParams.gravity = GRAVITY_NONE;
}
protected function resetLook2default():void{
_face["eye1"].rotation = 0;
_face["eye2"].rotation = 0;
_face.gotoAndStop(1);
}
override protected function build():void{
super.build();
gravity = _buildingParams.gravity;
}
private function rotation2gravity(_arg1:Number):Number{
if (_gravity == GRAVITY_LEFT){
return ((_arg1 + 90));
};
if (_gravity == GRAVITY_UP){
return ((_arg1 + 180));
};
if (_gravity == GRAVITY_RIGHT){
return ((_arg1 + 270));
};
return (_arg1);
}
private function updateFaceScale():void{
var _local1:Number = (0.95 * physWidth);
var _local2:Number = (0.95 * physHeight);
var _local3:Number = (_local1 - _face.width);
var _local4:Number = (_local2 - _face.height);
if ((((_local3 < 0)) || ((_local4 < 0)))){
if (_local3 < _local4){
_faceHolder.scaleX = (_local1 / (scaleX * _face.width));
_faceHolder.scaleY = ((_faceHolder.scaleX * scaleX) / scaleY);
return;
};
_faceHolder.scaleY = (_local2 / (scaleY * _face.height));
_faceHolder.scaleX = ((_faceHolder.scaleY * scaleY) / scaleX);
return;
};
_faceHolder.scaleX = (1 / scaleX);
_faceHolder.scaleY = (1 / scaleY);
}
private function updateFaceRotation():void{
_face.rotation = rotation2gravity(-(rotation));
}
}
}//package jk.app.theater.actors
Section 204
//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 205
//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 206
//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 207
//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 208
//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 beat():void{
var _local1:int;
while (_local1 < _levelCodes.length) {
setScore(_local1, (1000 + (100 * _local1)));
_local1++;
};
levelsBeaten = _levelCodes.length;
beaten = true;
}
public function unload():void{
_name = "";
UArray.clear(_levelCodes);
UArray.clear(_scores);
_levelsBeaten = 0;
_beaten = false;
}
public function getScore(_arg1:int):int{
return (_scores[_arg1]);
}
public function setScore(_arg1:int, _arg2:int):void{
if (_scores[_arg1] != _arg2){
_scores[_arg1] = _arg2;
_onChange.dispatch();
};
}
public function getLevelCode(_arg1:int):String{
if ((((_arg1 > -1)) && ((_arg1 < _levelCodes.length)))){
return (_levelCodes[_arg1]);
};
return (null);
}
}
}//package jk.engine.common
Section 209
//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 210
//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 211
//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 212
//Dummy (jk.engine.display.Dummy)
package jk.engine.display {
import flash.display.*;
public class Dummy extends Shape {
public function Dummy(_arg1:Number=700, _arg2:Number=525){
graphics.beginFill(0, 0);
graphics.drawRect(0, 0, _arg1, _arg2);
graphics.endFill();
}
}
}//package jk.engine.display
Section 213
//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 214
//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 215
//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 216
//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 217
//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 218
//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 219
//Shape (jk.engine.theater.actors.Shape)
package jk.engine.theater.actors {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import jk.engine.theater.edit.params.*;
import jk.engine.utils.*;
import jk.engine.theater.*;
import Box2D.Dynamics.Contacts.*;
public class Shape extends Actor {
protected var _body:b2Body;
protected var _originalWidth:Number;
protected var _originalHeight:Number;
public function get body():b2Body{
return (_body);
}
override public function get code():String{
var _local1:String = ((((((UNumber.round2str(x, 2) + ",") + UNumber.round2str(y, 2)) + ",") + UNumber.round2str(rotation, 2)) + ",") + _bitParams.getValue());
if (((!((scaleX == 1))) || (!((scaleY == 1))))){
_local1 = (_local1 + ((("," + UNumber.round2str(scaleX, 4)) + ",") + UNumber.round2str(scaleY, 4)));
};
return (_local1);
}
public function get physWidth():Number{
return ((scaleX * _originalWidth));
}
public function set physWidth(_arg1:Number):void{
scaleX = (_arg1 / _originalWidth);
if (_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 = (_physScale * _body.GetPosition().x);
y = (_physScale * _body.GetPosition().y);
rotation = (_rad2deg * _body.GetAngle());
};
}
override public function syncPhys():void{
if (syncPhysAllowed){
_body.SetXForm(new b2Vec2((_invPhysScale * x), (_invPhysScale * y)), (_deg2rad * rotation));
};
}
public function inContactWith(_arg1:Class):Boolean{
var _local2:b2ContactEdge = _body.m_contactList;
while (_local2) {
if ((_local2.other.GetUserData() is _arg1)){
return (true);
};
_local2 = _local2.next;
};
return (false);
}
override protected function constructor():void{
super.constructor();
_originalWidth = width;
_originalHeight = height;
}
override protected function setupBitParams():void{
_bitParams.addBit("static", false, onBitParams_Static_Change);
}
override protected function setupEditableParams():void{
_editableParams.addParam(new NumericParam("x", "x", NumericParam.REAL, 0, Settings.WIDTH));
_editableParams.addParam(new NumericParam("y", "y", NumericParam.REAL, 0, Settings.HEIGHT));
_editableParams.addParam(new NumericParam("width", "physWidth", NumericParam.POSITIVE_REAL, 15, Settings.WIDTH));
_editableParams.addParam(new NumericParam("height", "physHeight", NumericParam.POSITIVE_REAL, 15, Settings.HEIGHT));
_editableParams.addParam(new NumericParam("rotation", "rotation"));
_editableParams.addParam(new BooleanParam("static", "static", true));
}
override protected function restore2default():void{
super.restore2default();
_buildingParams.density = Settings.DEFAULT_DENSITY;
_buildingParams.friction = Settings.DEFAULT_FRICTION;
_buildingParams.restitution = Settings.DEFAULT_RESTITUTION;
_buildingParams.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 = (_invPhysScale * _buildingParams.x);
_local1.position.y = (_invPhysScale * _buildingParams.y);
_local1.angle = (_deg2rad * _buildingParams.rotation);
setupBodyDef(_local1);
_body = _theater.world.CreateBody(_local1);
if (_buildingParams.physModel == "Rectangle"){
_body.CreateShape(createRectangleDef());
} else {
if (_buildingParams.physModel == "Circle"){
_body.CreateShape(createCircleDef());
} else {
if (_buildingParams.physModel == "Convex"){
_body.CreateShape(createPolygonDef(_buildingParams.vertices));
} else {
if (_buildingParams.physModel == "Concave"){
while (_local2 < _buildingParams.polygons.length) {
_body.CreateShape(createPolygonDef(_buildingParams.polygons[_local2]));
_local2++;
};
};
};
};
};
if (!_bitParams.getDefaultValue("static")){
onBitParams_Static_Change(true, false);
};
}
override protected function destroy():void{
var _local2:b2JointEdge;
var _local1:b2JointEdge = _body.GetJointList();
while (_local1) {
_local2 = _local1;
_local1 = _local1.next;
_theater.removeActor(_local2.joint.GetUserData());
};
_theater.world.DestroyBody(_body);
_body = null;
}
override protected function setupShapeDef(_arg1:b2ShapeDef):void{
super.setupShapeDef(_arg1);
_arg1.density = _buildingParams.density;
_arg1.friction = _buildingParams.friction;
_arg1.restitution = _buildingParams.restitution;
}
protected function setupBodyDef(_arg1:b2BodyDef):void{
_arg1.userData = this;
}
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 220
//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 221
//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 222
//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 223
//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 224
//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 225
//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 226
//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 227
//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 228
//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 229
//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 230
//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 231
//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 232
//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:Shape;
protected var _addingActorHolder:Sprite;
protected var _editingActor:Actor;
protected var _addingActor:Actor;
protected var _showParamsEditor:Boolean;
protected var _paramsEditorShown:Boolean;
protected var _gridStep:Number;
public function EditableTheater(){
transformTool = new TransformTool(this);
paramsEditor = new ParamsEditor(this);
_gridHolder = new Shape();
_addingActorHolder = new Sprite();
_gridStep = 0;
_addingActorHolder.mouseChildren = false;
_addingActorHolder.mouseEnabled = false;
_addingActorHolder.alpha = 0.75;
transformTool.visible = false;
paramsEditor.visible = _showParamsEditor;
transformTool.filters = [new GlowFilter(0, 1, 5, 5, 1, 3)];
paramsEditor.filters = [new GlowFilter(0, 1, 5, 5, 1, 3)];
addChildAt(_gridHolder, 0);
addChild(_addingActorHolder);
addChild(transformTool);
addChild(paramsEditor);
_background.addEventListener(MouseEvent.MOUSE_DOWN, onBackground_MouseDown);
_actorsHolder.addEventListener(MouseEvent.MOUSE_DOWN, onActorsHolder_MouseDown);
}
public function get editingActor():Actor{
return (_editingActor);
}
public function setEditingActor(_arg1:Actor, _arg2:Boolean=false):void{
if (_editingActor == _arg1){
return;
};
if (_editingActor){
if (_addingActor){
addListeners2ActorsHolder();
};
transformTool.stopEdit();
paramsEditor.stopEdit();
transformTool.visible = false;
paramsEditor.visible = false;
_editingActor = null;
};
if (_arg1){
if (_addingActor){
removeListenersFromActorsHolder();
};
transformTool.startEdit(_arg1, _arg2);
paramsEditor.startEdit(_arg1);
transformTool.visible = true;
paramsEditor.visible = _showParamsEditor;
_editingActor = _arg1;
};
}
public function get addingActor():Actor{
return (_addingActor);
}
public function setAddingActor(_arg1:String, _arg2:String=null):void{
if (_addingActor){
if (_addingActor.className == _arg1){
if (_arg2){
_addingActor.code = _arg2;
};
setEditingActor(null);
return;
} else {
if (!_editingActor){
removeListenersFromActorsHolder();
};
_addingActorHolder.removeChild(_addingActor);
ActorPool.release(_addingActor);
_addingActor = null;
};
};
if (_arg1){
_addingActor = ActorPool.acquire(_arg1);
_addingActorHolder.addChild(_addingActor);
if (_arg2){
_addingActor.code = _arg2;
};
if (_editingActor){
setEditingActor(null);
} else {
addListeners2ActorsHolder();
};
};
}
public function get showParamsEditor():Boolean{
return (_showParamsEditor);
}
public function set showParamsEditor(_arg1:Boolean):void{
var _local2:Point;
_showParamsEditor = _arg1;
if (((_editingActor) && (((!(_addingActor)) || (((_addingActor) && (!(_addingActorHolder.visible)))))))){
paramsEditor.visible = _showParamsEditor;
if (!_paramsEditorShown){
_local2 = new Point(transformTool.btnProps.x, transformTool.btnProps.y);
_local2 = transformTool.localToGlobal(_local2);
_local2 = globalToLocal(_local2);
paramsEditor.x = _local2.x;
paramsEditor.y = _local2.y;
_paramsEditorShown = true;
};
};
}
public function get gridStep():Number{
return (_gridStep);
}
public function set gridStep(_arg1:Number):void{
var _local2:Number;
_gridStep = _arg1;
_gridHolder.graphics.clear();
if (_gridStep > 0){
_gridHolder.graphics.lineStyle(1);
_local2 = 0;
while (_local2 <= _bounds.width) {
_gridHolder.graphics.moveTo(_local2, 0);
_gridHolder.graphics.lineTo(_local2, _bounds.height);
_local2 = (_local2 + _gridStep);
};
_local2 = 0;
while (_local2 <= _bounds.height) {
_gridHolder.graphics.moveTo(0, _local2);
_gridHolder.graphics.lineTo(_bounds.width, _local2);
_local2 = (_local2 + _gridStep);
};
};
}
override public function removeActor(_arg1:Actor):void{
if (_editingActor == _arg1){
setEditingActor(null);
};
super.removeActor(_arg1);
}
override public function removeAllActors():void{
setEditingActor(null);
super.removeAllActors();
}
private function addListeners2ActorsHolder():void{
_addingActorHolder.visible = true;
startDragActor(_addingActor, true);
_actorsHolder.getLayer(_addingActor.layer).addEventListener(MouseEvent.MOUSE_OVER, onActorsHolder_Layer_MouseOver);
_actorsHolder.getLayer(_addingActor.layer).addEventListener(MouseEvent.MOUSE_OUT, onActorsHolder_Layer_MouseOut);
}
private function removeListenersFromActorsHolder():void{
_addingActorHolder.visible = false;
stopDragActor(_addingActor);
_actorsHolder.getLayer(_addingActor.layer).removeEventListener(MouseEvent.MOUSE_OVER, onActorsHolder_Layer_MouseOver);
_actorsHolder.getLayer(_addingActor.layer).removeEventListener(MouseEvent.MOUSE_OUT, onActorsHolder_Layer_MouseOut);
}
protected function onBackground_MouseDown(_arg1:MouseEvent):void{
if (_addingActor){
if (!_addingActorHolder.visible){
if (_editingActor){
if (_addingActor.className == _editingActor.className){
_addingActor.code = _editingActor.code;
};
setEditingActor(null);
};
} else {
setEditingActor(addActor(_addingActor.className, {code:_addingActor.code}), true);
};
} else {
setEditingActor(null);
};
}
protected function onActorsHolder_MouseDown(_arg1:MouseEvent):void{
var _local2:Actor = (_arg1.target as Actor);
if (((_addingActor) && (_local2))){
if (_addingActor.layer != _local2.layer){
onBackground_MouseDown(new MouseEvent(MouseEvent.MOUSE_DOWN, _arg1.bubbles, _arg1.cancelable, _arg1.localX, _arg1.localY));
return;
};
};
if (_editingActor != _local2){
setEditingActor(_local2, true);
};
}
private function onActorsHolder_Layer_MouseOver(_arg1:MouseEvent):void{
stopDragActor(_addingActor);
_addingActorHolder.visible = false;
}
private function onActorsHolder_Layer_MouseOut(_arg1:MouseEvent):void{
_addingActorHolder.visible = true;
startDragActor(_addingActor, true);
}
}
}//package jk.engine.theater.edit
Section 233
//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 234
//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 235
//Actor (jk.engine.theater.Actor)
package jk.engine.theater {
import flash.display.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import jk.engine.utils.*;
import flash.utils.*;
import jk.engine.theater.edit.*;
public class Actor extends MovieClip {
protected const _physScale:Number = 30;
protected const _invPhysScale:Number = 0.0333333333333333;
protected const _halfInvPhysScale:Number = 0.0166666666666667;
protected const _deg2rad:Number = 0.0174532925199433;
protected const _rad2deg:Number = 57.2957795130823;
var dragging:Boolean;
var dragOffsetX:Number;
var dragOffsetY:Number;
var _className:String;
protected var _buildingParams:Object;
protected var _bitParams:BitField;
protected var _editableParams:EditableParams;
protected var _transformToolPolicy:BitField;
protected var _layer:int;
protected var _theater:Theater;
public function Actor(){
constructor();
restore2default();
}
public function get className():String{
if (!_className){
_className = getQualifiedClassName(this);
};
return (_className);
}
public function get bitParams():BitField{
return (_bitParams);
}
public function get editableParams():EditableParams{
return (_editableParams);
}
public function get transformToolPolicy():BitField{
return (_transformToolPolicy);
}
public function get layer():int{
return (_layer);
}
public function get theater():Theater{
return (_theater);
}
public function get inTheater():Boolean{
return (Boolean(_theater));
}
public function get code():String{
return ("");
}
public function get syncPhysAllowed():Boolean{
return (((inTheater) && (!(dragging))));
}
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():void{
}
public function onAddingToTheater(_arg1:Theater, _arg2:Object):void{
var _local3:String;
var _local4:Object;
if (inTheater){
throw (new Error("already added to theater"));
};
_theater = _arg1;
setupActorBuildingParams(className, _buildingParams);
if (_arg2.hasOwnProperty("code")){
_local4 = decode(_arg2.code);
if (_local4.hasOwnProperty("bitParams")){
UObject.copyParams(_bitParams.decode(_local4.bitParams), _buildingParams);
delete _local4.bitParams;
};
UObject.copyParams(_local4, _buildingParams);
delete _arg2.code;
};
if (_arg2.hasOwnProperty("bitParams")){
UObject.copyParams(_bitParams.decode(_arg2.bitParams), _buildingParams);
delete _arg2.bitParams;
};
UObject.copyParams(_arg2, _buildingParams);
build();
x = _buildingParams.x;
y = _buildingParams.y;
rotation = _buildingParams.rotation;
for (_local3 in _buildingParams) {
if (_bitParams.hasBit(_local3)){
bitParams.setBit(_local3, _buildingParams[_local3]);
};
};
}
public function onRemovingFromTheater():void{
if (!inTheater){
throw (new Error("already removed from theater"));
};
destroy();
_theater = null;
}
function onRelease():void{
restore2default();
}
protected function constructor():void{
mouseChildren = false;
_buildingParams = new Object();
_bitParams = new BitField();
_editableParams = new EditableParams();
_transformToolPolicy = new BitField();
setupBitParams();
setupEditableParams();
setupTransformToolPolicy();
}
protected function setupBitParams():void{
}
protected function setupEditableParams():void{
}
protected function setupTransformToolPolicy():void{
_transformToolPolicy.addBit("copy", true);
_transformToolPolicy.addBit("delete", true);
_transformToolPolicy.addBit("drag", true);
_transformToolPolicy.addBit("params", true);
_transformToolPolicy.addBit("rotate", true);
}
protected function restore2default():void{
gotoAndStop(1);
visible = true;
alpha = 1;
rotation = 0;
scaleX = 1;
scaleY = 1;
x = 0;
y = 0;
filters = [];
_bitParams.restore2default();
UObject.clear(_buildingParams);
_buildingParams.x = 0;
_buildingParams.y = 0;
_buildingParams.rotation = 0;
_buildingParams.bitParams = _bitParams.getValue();
}
protected function build():void{
}
protected function destroy():void{
}
protected function setupShapeDef(_arg1:b2ShapeDef):void{
_arg1.userData = this;
}
protected function createRectangleDef(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0):b2PolygonDef{
if (!_arg1){
_arg1 = this.width;
};
if (!_arg2){
_arg2 = this.height;
};
var _local6:b2PolygonDef = new b2PolygonDef();
setupShapeDef(_local6);
if (((((_arg3) || (_arg4))) || (_arg5))){
_local6.SetAsOrientedBox((_halfInvPhysScale * _arg1), (_halfInvPhysScale * _arg2), new b2Vec2((_invPhysScale * _arg3), (_invPhysScale * _arg4)), (_deg2rad * _arg5));
} else {
_local6.SetAsBox((_halfInvPhysScale * _arg1), (_halfInvPhysScale * _arg2));
};
return (_local6);
}
protected function createCircleDef(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0):b2CircleDef{
if (!_arg1){
_arg1 = (0.25 * (width + height));
};
var _local4:b2CircleDef = new b2CircleDef();
setupShapeDef(_local4);
_local4.radius = (_invPhysScale * _arg1);
if (((_arg2) || (_arg3))){
_local4.localPosition.Set((_invPhysScale * _arg2), (_invPhysScale * _arg3));
};
return (_local4);
}
protected function createPolygonDef(_arg1:Array):b2PolygonDef{
var _local3:int;
var _local2:b2PolygonDef = new b2PolygonDef();
setupShapeDef(_local2);
while (_local3 < _arg1.length) {
_local2.vertices[_local3].Set(((scaleX * _invPhysScale) * _arg1[_local3][0]), ((scaleY * _invPhysScale) * _arg1[_local3][1]));
_local3++;
};
_local2.vertexCount = _arg1.length;
return (_local2);
}
}
}//package jk.engine.theater
Section 236
//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 _local4:int;
var _local2:Actor;
var _local3:int = _actors.length;
while (_local4 < _local3) {
if (_actors[_local4].className == _arg1){
_local2 = _actors[_local4];
_actors.splice(_local4, 1);
break;
};
_local4++;
};
if (!_local2){
_local2 = new ((getDefinitionByName(_arg1) as Class));
_local2._className = _arg1;
};
return (_local2);
}
public static function release(_arg1:Actor):void{
_arg1.onRelease();
UArray.pushUnique(_actors, _arg1);
}
}
}//package jk.engine.theater
Section 237
//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 238
//Theater (jk.engine.theater.Theater)
package jk.engine.theater {
import flash.display.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import jk.engine.utils.*;
import flash.geom.*;
import flash.events.*;
import jk.engine.display.*;
public class Theater extends Sprite {
protected const _invPhysScale:Number = 0.0333333333333333;
protected const _physIterations:int = 10;
public var dragBounds:Rectangle;
protected var _actors:Array;
protected var _world:b2World;
protected var _bounds:Rectangle;
protected var _background:Sprite;
protected var _actorsHolder:ActorsHolder;
protected var _draggingActors:Array;
protected var _dragStep:Number;
protected static var _someVec2:b2Vec2 = new b2Vec2();
protected static var _someAABB:b2AABB = new b2AABB();
public function Theater(){
var _local3:Dummy;
super();
_actors = new Array();
_background = new Sprite();
_actorsHolder = new ActorsHolder();
_draggingActors = new Array();
_dragStep = 0;
while (numChildren) {
_background.addChild(removeChildAt(0));
};
addChild(_background);
addChild(_actorsHolder);
if (!((width) && (height))){
_local3 = new Dummy(Settings.THEATER_WIDTH, Settings.THEATER_HEIGHT);
_local3.x = (-0.5 * _local3.width);
_local3.y = (-0.5 * _local3.height);
_background.addChild(_local3);
};
_bounds = _background.getBounds(this);
dragBounds = _bounds.clone();
var _local1:Number = 0x0200;
var _local2:b2AABB = new b2AABB();
_local2.lowerBound.Set((_invPhysScale * (_bounds.x - _local1)), (_invPhysScale * (_bounds.y - _local1)));
_local2.upperBound.Set((_invPhysScale * (_bounds.right + _local1)), (_invPhysScale * (_bounds.bottom + _local1)));
_world = new b2World(_local2, new b2Vec2(Settings.DEFAULT_GRAVITY_X, Settings.DEFAULT_GRAVITY_Y), true);
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
public function get actors():Array{
return (_actors);
}
public function get world():b2World{
return (_world);
}
public function get bounds():Rectangle{
return (_bounds);
}
public function get background():Sprite{
return (_background);
}
public function get actorsHolder():ActorsHolder{
return (_actorsHolder);
}
public function get dragStep():Number{
return (_dragStep);
}
public function set dragStep(_arg1:Number):void{
if (_arg1 < 0){
_arg1 = 0;
};
_dragStep = _arg1;
}
public function get code():String{
var _local2:int;
sortActors();
var _local1 = "";
while (_local2 < _actors.length) {
_local1 = (_local1 + ((_actors[_local2].className + ":") + _actors[_local2].code));
if (_local2 < (_actors.length - 1)){
_local1 = (_local1 + "|");
};
_local2++;
};
return (_local1);
}
public function set code(_arg1:String):void{
var _local2:Array;
var _local3:int;
var _local4:Array;
if (((_arg1) && (!((_arg1 == code))))){
removeAllActors();
_local2 = _arg1.split("|");
while (_local3 < _local2.length) {
_local4 = _local2[_local3].split(":", 2);
addActor(_local4[0], {code:_local4[1]});
_local3++;
};
};
}
public function addActor(_arg1:String, _arg2:Object):Actor{
var _local3:Actor = ActorPool.acquire(_arg1);
_local3.onAddingToTheater(this, _arg2);
_actorsHolder.addActor(_local3);
_actors.push(_local3);
sortActors();
return (_local3);
}
public function removeActor(_arg1:Actor):void{
var _local2:int;
while (_local2 < _actors.length) {
if (_actors[_local2] == _arg1){
if (_arg1.dragging){
stopDragActor(_arg1);
};
_arg1.onRemovingFromTheater();
_actorsHolder.removeActor(_arg1);
ActorPool.release(_arg1);
_actors.splice(_local2, 1);
return;
};
_local2++;
};
}
public function removeAllActors():void{
var _local1:Actor;
while (_actors.length) {
_local1 = _actors[(_actors.length - 1)];
if (_local1.dragging){
stopDragActor(_local1);
};
_local1.onRemovingFromTheater();
_actorsHolder.removeActor(_local1);
ActorPool.release(_local1);
_actors.pop();
};
}
public function readdActor(_arg1:Actor, _arg2:Object):void{
_arg1.onRemovingFromTheater();
_arg1.onRelease();
_arg1.onAddingToTheater(this, _arg2);
}
public function hasActor(_arg1:Actor):Boolean{
var _local2:int;
while (_local2 < _actors.length) {
if (_actors[_local2] == _arg1){
return (true);
};
_local2++;
};
return (false);
}
public function hasActorOf(_arg1:Class):Boolean{
var _local2:int;
while (_local2 < _actors.length) {
if ((_actors[_local2] is _arg1)){
return (true);
};
_local2++;
};
return (false);
}
public function getActorsOf(_arg1:Class, _arg2:int=2147483647):Array{
var _local4:int;
var _local3:Array = new Array();
if (_arg2 <= 0){
return (_local3);
};
while (_local4 < _actors.length) {
if ((_actors[_local4] is _arg1)){
_local3.push(_actors[_local4]);
if (_local3.length == _arg2){
break;
};
};
_local4++;
};
return (_local3);
}
public function numActorsOf(_arg1:Class):uint{
return (getActorsOf(_arg1).length);
}
public function sortActors():void{
var compareFunction:Function;
compareFunction = function (_arg1:Actor, _arg2:Actor):int{
if (_arg1.layer < _arg2.layer){
return (-1);
};
if (_arg1.layer > _arg2.layer){
return (1);
};
return (((_arg1.parent.getChildIndex(_arg1) < _arg2.parent.getChildIndex(_arg2))) ? -1 : 1);
};
_actors.sort(compareFunction);
}
public function step(_arg1:Number=0.0333333333333333):void{
var _local3:int;
world.Step(_arg1, _physIterations);
var _local2:int = _actors.length;
while (_local3 < _local2) {
_actors[_local3].step();
_local3++;
};
}
public function syncPhys():void{
var _local1:int;
while (_local1 < _actors.length) {
_actors[_local1].syncPhys();
_local1++;
};
}
public function stopAllActors():void{
var _local1:b2Body = world.GetBodyList();
while (_local1) {
_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;
_someVec2.Set((_invPhysScale * _arg1), (_invPhysScale * _arg2));
_someAABB.lowerBound.Set((_someVec2.x - 0.001), (_someVec2.y - 0.001));
_someAABB.upperBound.Set((_someVec2.x + 0.001), (_someVec2.y + 0.001));
var _local4:Array = new Array();
world.Query(_someAABB, _local4, int.MAX_VALUE);
var _local5:int = (_local4.length - 1);
while (_local5 > -1) {
if (_local4[_local5].TestPoint(_local4[_local5].GetBody().GetXForm(), _someVec2)){
_local3 = _local4[_local5].GetBody();
break;
};
_local5--;
};
return (_local3);
}
public function getBodyAtMouse():b2Body{
return (getBodyAtPoint(mouseX, mouseY));
}
public function getBodyListAtPoint(_arg1:Number, _arg2:Number):Array{
var _local3:Array = new Array();
_someVec2.Set((_invPhysScale * _arg1), (_invPhysScale * _arg2));
_someAABB.lowerBound.Set((_someVec2.x - 0.001), (_someVec2.y - 0.001));
_someAABB.upperBound.Set((_someVec2.x + 0.001), (_someVec2.y + 0.001));
var _local4:Array = new Array();
world.Query(_someAABB, _local4, int.MAX_VALUE);
var _local5:int = (_local4.length - 1);
while (_local5 > -1) {
if (_local4[_local5].TestPoint(_local4[_local5].GetBody().GetXForm(), _someVec2)){
_local3.push(_local4[_local5].GetBody());
};
_local5--;
};
return (_local3);
}
public function getBodyListAtMouse():Array{
return (getBodyListAtPoint(mouseX, mouseY));
}
public function getActorAtPoint(_arg1:Number, _arg2:Number):Actor{
var _local3:b2Body = getBodyAtPoint(_arg1, _arg2);
if (_local3){
return ((_local3.GetUserData() as Actor));
};
return (null);
}
public function getActorAtMouse():Actor{
return (getActorAtPoint(mouseX, mouseY));
}
public function startDragActor(_arg1:Actor, _arg2:Boolean=false):void{
if (_arg1.dragging){
return;
};
_arg1.dragging = true;
if (_arg2){
_arg1.dragOffsetX = 0;
_arg1.dragOffsetY = 0;
} else {
_arg1.dragOffsetX = (_arg1.x - mouseX);
_arg1.dragOffsetY = (_arg1.y - mouseY);
};
_draggingActors.push(_arg1);
}
public function stopDragActor(_arg1:Actor):void{
var _local2:int;
if (!_arg1.dragging){
return;
};
while (_local2 < _draggingActors.length) {
if (_draggingActors[_local2] == _arg1){
_arg1.dragging = false;
_draggingActors.splice(_local2, 1);
return;
};
_local2++;
};
}
protected function onAddedToStage(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
protected function onRemovedFromStage(_arg1:Event):void{
removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
}
protected function onEnterFrame(_arg1:Event):void{
var _local2:int;
var _local3:Actor;
var _local4:Number;
var _local5:Number;
while (_local2 < _draggingActors.length) {
_local3 = _draggingActors[_local2];
_local4 = (mouseX + _local3.dragOffsetX);
_local5 = (mouseY + _local3.dragOffsetY);
if ((((_local3.x == _local4)) && ((_local3.y == _local5)))){
return;
};
if (_dragStep){
_local4 = (_dragStep * Math.round((_local4 / _dragStep)));
_local5 = (_dragStep * Math.round((_local5 / _dragStep)));
};
_local3.x = _local4;
_local3.y = _local5;
URectangle.syncObjPos(_local3, dragBounds);
_local2++;
};
}
}
}//package jk.engine.theater
Section 239
//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 240
//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 241
//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 242
//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 243
//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 244
//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 245
//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 246
//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 247
//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:4.4, 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 248
//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 249
//IClearable (jk.engine.utils.IClearable)
package jk.engine.utils {
public interface IClearable {
function clear():void;
}
}//package jk.engine.utils
Section 250
//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 251
//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 252
//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 253
//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 254
//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 255
//secondsToMinutes (jk.engine.utils.secondsToMinutes)
package jk.engine.utils {
public function secondsToMinutes(_arg1:Number):String{
var _local2:Number = Math.floor((_arg1 / 60));
_arg1 = Math.floor((_arg1 % 60));
if (_arg1 < 10){
return (((_local2 + ":0") + _arg1));
};
return (((_local2 + ":") + _arg1));
}
}//package jk.engine.utils
Section 256
//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 257
//TickedTimer (jk.engine.utils.TickedTimer)
package jk.engine.utils {
import flash.utils.*;
public class TickedTimer {
protected var _lastGetTimer:int;
protected var _duration:int;
protected var _time:int;
public function TickedTimer(){
_lastGetTimer = getTimer();
}
public function get duration():int{
return (_duration);
}
public function get time():int{
return (_time);
}
public function tick():void{
_duration = (getTimer() - _lastGetTimer);
_lastGetTimer = (_lastGetTimer + _duration);
_time = (_time + _duration);
}
public function resetTime():void{
_time = 0;
}
}
}//package jk.engine.utils
Section 258
//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 259
//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 260
//UMath (jk.engine.utils.UMath)
package jk.engine.utils {
public class UMath {
public static const DEG_2_RAD:Number = 0.0174532925199433;
public static const RAD_2_DEG:Number = 57.2957795130823;
public static const PI2:Number = 6.28318530717959;
public static function deg2Rad(_arg1:Number):Number{
return ((DEG_2_RAD * _arg1));
}
public static function rad2Deg(_arg1:Number):Number{
return ((RAD_2_DEG * _arg1));
}
public static function randomBoolean():Boolean{
return (((Math.random() >= 0.5)) ? false : true);
}
public static function randomPositiveNegative():int{
return ((randomBoolean()) ? 1 : -1);
}
public static function rangeRandom(_arg1:Number, _arg2:Number):Number{
return ((_arg1 + ((_arg2 - _arg1) * Math.random())));
}
public static function randomItem(_arg1:Array){
return (_arg1[int(rangeRandom(0, _arg1.length))]);
}
}
}//package jk.engine.utils
Section 261
//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 262
//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 263
//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 264
//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 265
//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 266
//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 267
//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 268
//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 269
//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 270
//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 271
//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 272
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiServices {
public static const CONNECTED:String = "onConnected";
private static var _id:String;
private static var _container:Object;
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _timer:Timer;
private static var _preserved:Object;
private static var _servURL:String = "http://www.mochiads.com/static/lib/services/";
private static var _services:String = "services.swf";
private static var _mochiLC:String = "MochiLC.swf";
private static var _swfVersion:String;
private static var _listenChannelName:String = "__ms_";
private static var _sendChannel:LocalConnection;
private static var _sendChannelName:String;
private static var _connecting:Boolean = false;
private static var _connected:Boolean = false;
public static var netup:Boolean = true;
public static var netupAttempted:Boolean = false;
public static var onError:Object;
public static var widget:Boolean = false;
private static var _mochiLocalConnection:MovieClip;
private static var _queue:Array;
private static var _nextCallbackID:Number;
private static var _callbacks:Object;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function get id():String{
return (_id);
}
public static function get clip():Object{
return (_container);
}
public static function get childClip():Object{
return (_clip);
}
public static function getVersion():String{
return ("3.9.2 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 273
//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 274
//MochiUserData (mochi.as3.MochiUserData)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
public class MochiUserData extends EventDispatcher {
public var _loader:URLLoader;
public var key:String;// = null
public var data;// = null
public var error:Event;// = null
public var operation:String;// = null
public var callback:Function;// = null
public function MochiUserData(_arg1:String="", _arg2:Function=null){
this.key = _arg1;
this.callback = _arg2;
}
public function serialize(_arg1):ByteArray{
var _local2:ByteArray = new ByteArray();
_local2.objectEncoding = ObjectEncoding.AMF3;
_local2.writeObject(_arg1);
_local2.compress();
return (_local2);
}
public function deserialize(_arg1:ByteArray){
_arg1.objectEncoding = ObjectEncoding.AMF3;
_arg1.uncompress();
return (_arg1.readObject());
}
public function request(_arg1:String, _arg2:ByteArray):void{
var _operation = _arg1;
var _data = _arg2;
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 275
//AA (AA)
package {
import jk.app.theater.actors.*;
public dynamic class AA extends Shape {
}
}//package
Section 276
//AB (AB)
package {
import jk.app.theater.actors.*;
public dynamic class AB extends Evil {
}
}//package
Section 277
//AC (AC)
package {
import jk.app.theater.actors.*;
public dynamic class AC extends EvilPlatform {
}
}//package
Section 278
//AD (AD)
package {
import jk.app.theater.actors.*;
public dynamic class AD extends Evil {
}
}//package
Section 279
//AE (AE)
package {
import jk.app.theater.actors.*;
public dynamic class AE extends Good {
}
}//package
Section 280
//AF (AF)
package {
import jk.app.theater.actors.*;
public dynamic class AF extends GoodPlatform {
}
}//package
Section 281
//AG (AG)
package {
import jk.app.theater.actors.*;
public dynamic class AG extends Good {
}
}//package
Section 282
//AH (AH)
package {
import jk.app.theater.actors.*;
public dynamic class AH extends Shape {
}
}//package
Section 283
//AI (AI)
package {
import jk.app.theater.actors.*;
public dynamic class AI extends Shape {
}
}//package
Section 284
//CellRenderer_disabledSkin (CellRenderer_disabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_disabledSkin extends MovieClip {
}
}//package
Section 285
//CellRenderer_downSkin (CellRenderer_downSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_downSkin extends MovieClip {
}
}//package
Section 286
//CellRenderer_overSkin (CellRenderer_overSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_overSkin extends MovieClip {
}
}//package
Section 287
//CellRenderer_selectedDisabledSkin (CellRenderer_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDisabledSkin extends MovieClip {
}
}//package
Section 288
//CellRenderer_selectedDownSkin (CellRenderer_selectedDownSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDownSkin extends MovieClip {
}
}//package
Section 289
//CellRenderer_selectedOverSkin (CellRenderer_selectedOverSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedOverSkin extends MovieClip {
}
}//package
Section 290
//CellRenderer_selectedUpSkin (CellRenderer_selectedUpSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedUpSkin extends MovieClip {
}
}//package
Section 291
//CellRenderer_upSkin (CellRenderer_upSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_upSkin extends MovieClip {
}
}//package
Section 292
//CheckBox_disabledIcon (CheckBox_disabledIcon)
package {
import flash.display.*;
public dynamic class CheckBox_disabledIcon extends MovieClip {
}
}//package
Section 293
//CheckBox_downIcon (CheckBox_downIcon)
package {
import flash.display.*;
public dynamic class CheckBox_downIcon extends MovieClip {
}
}//package
Section 294
//CheckBox_overIcon (CheckBox_overIcon)
package {
import flash.display.*;
public dynamic class CheckBox_overIcon extends MovieClip {
}
}//package
Section 295
//CheckBox_selectedDisabledIcon (CheckBox_selectedDisabledIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedDisabledIcon extends MovieClip {
}
}//package
Section 296
//CheckBox_selectedDownIcon (CheckBox_selectedDownIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedDownIcon extends MovieClip {
}
}//package
Section 297
//CheckBox_selectedOverIcon (CheckBox_selectedOverIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedOverIcon extends MovieClip {
}
}//package
Section 298
//CheckBox_selectedUpIcon (CheckBox_selectedUpIcon)
package {
import flash.display.*;
public dynamic class CheckBox_selectedUpIcon extends MovieClip {
}
}//package
Section 299
//CheckBox_upIcon (CheckBox_upIcon)
package {
import flash.display.*;
public dynamic class CheckBox_upIcon extends MovieClip {
}
}//package
Section 300
//ColumnStretch_cursor (ColumnStretch_cursor)
package {
import flash.display.*;
public dynamic class ColumnStretch_cursor extends MovieClip {
}
}//package
Section 301
//ComboBox_disabledSkin (ComboBox_disabledSkin)
package {
import flash.display.*;
public dynamic class ComboBox_disabledSkin extends MovieClip {
}
}//package
Section 302
//ComboBox_downSkin (ComboBox_downSkin)
package {
import flash.display.*;
public dynamic class ComboBox_downSkin extends MovieClip {
}
}//package
Section 303
//ComboBox_overSkin (ComboBox_overSkin)
package {
import flash.display.*;
public dynamic class ComboBox_overSkin extends MovieClip {
}
}//package
Section 304
//ComboBox_upSkin (ComboBox_upSkin)
package {
import flash.display.*;
public dynamic class ComboBox_upSkin extends MovieClip {
}
}//package
Section 305
//DataGrid_skin (DataGrid_skin)
package {
import flash.display.*;
public dynamic class DataGrid_skin extends MovieClip {
}
}//package
Section 306
//DataGridCellEditor_skin (DataGridCellEditor_skin)
package {
import flash.display.*;
public dynamic class DataGridCellEditor_skin extends MovieClip {
}
}//package
Section 307
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 308
//HeaderRenderer_disabledSkin (HeaderRenderer_disabledSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_disabledSkin extends MovieClip {
}
}//package
Section 309
//HeaderRenderer_downSkin (HeaderRenderer_downSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_downSkin extends MovieClip {
}
}//package
Section 310
//HeaderRenderer_overSkin (HeaderRenderer_overSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_overSkin extends MovieClip {
}
}//package
Section 311
//HeaderRenderer_selectedDisabledSkin (HeaderRenderer_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedDisabledSkin extends MovieClip {
}
}//package
Section 312
//HeaderRenderer_selectedDownSkin (HeaderRenderer_selectedDownSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedDownSkin extends MovieClip {
}
}//package
Section 313
//HeaderRenderer_selectedOverSkin (HeaderRenderer_selectedOverSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedOverSkin extends MovieClip {
}
}//package
Section 314
//HeaderRenderer_selectedUpSkin (HeaderRenderer_selectedUpSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedUpSkin extends MovieClip {
}
}//package
Section 315
//HeaderRenderer_upSkin (HeaderRenderer_upSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_upSkin extends MovieClip {
}
}//package
Section 316
//HeaderSortArrow_ascIcon (HeaderSortArrow_ascIcon)
package {
import flash.display.*;
public dynamic class HeaderSortArrow_ascIcon extends MovieClip {
}
}//package
Section 317
//HeaderSortArrow_descIcon (HeaderSortArrow_descIcon)
package {
import flash.display.*;
public dynamic class HeaderSortArrow_descIcon extends MovieClip {
}
}//package
Section 318
//LevelPacks (LevelPacks)
package {
import flash.events.*;
import flash.net.*;
public class LevelPacks {
public static var xml:XML;
private static var _loader:URLLoader;
public static function load(_arg1:Boolean):void{
if (_arg1){
loadFromLocal();
} else {
loadFromAS3();
};
}
private static function loadFromLocal():void{
_loader = new URLLoader();
_loader.data = URLLoaderDataFormat.TEXT;
_loader.load(new URLRequest("LevelPacks.xml"));
_loader.addEventListener(Event.COMPLETE, onLoader_Complete, false, 0, true);
}
private static function onLoader_Complete(_arg1:Event):void{
_loader.removeEventListener(Event.COMPLETE, onLoader_Complete);
xml = new XML(_loader.data);
}
private static function loadFromAS3():void{
xml = new XML(<LevelPacks>
<LevelPack Name="First">
<Level>
<Code>eNptjkEKwzAMBPMgxciyJcW6mZak/ZO/mr9UNiZNoScxO8ui5ay7JUbIGwUGhAjJb2z1YcqQWWeKQWcs9C9/mUhfoK2btRS37sOUSS/3q56WBIFoRJBbfZvvFx4d7Ch6Z+/Hb59aPXzA/xkYO4rkiz8SmTAB</Code>
</Level>
<Level>
<Code>eNpdzksOgCAMRVEXVJvSjyTMmIiLcrWuxFZJjA0TOO8OWK5+NDECZQPyI8DoVz77aKUaSA0vUAKYM+RCciG50FxoLuxf7O//JjBuPj/sorH4Ewgnxhq6fnwDe1wxfw==</Code>
</Level>
<Level>
<Code>eNo1zVEKgEAIBNAONC3qai3+VRQdqgt067QthEEe4gz3cjg3KQYVA4GvZXP9IPOl06sSKnWISRIzMBNMflGb44ApczTtvLtOUgQ1NJhi5fy5xgOKktKyA/wAOaUdoA==</Code>
</Level>
<Level>
<Code>eNplzlEKgDAIBuAOZEPdnOFbNGqH6kydMbeioB4U/OQXh2NeLKkGgYQICLTPq7HqO27GyL7n3LrTjfLDauSh2MoJG8QsDv38RcWEe1CfWPEHPlQtU6NICGM/BhimDHQCSIIluA==</Code>
</Level>
<Level>
<Code>eNplzLsNgDAMBFAGMpE/CSbuolAwVFZhV2ygIs1J93S65WqHcQFSTQUQCGi46CQ0j+i/Oq1GY2ZPdQ3HtI3WTTCQa+RKGvNu9GBG/5FXhOMh79/rDcclIhc=</Code>
</Level>
<Level>
<Code>eNptj9EKgCAMRelH+gKROTfFvfVSflQf31ZGqDEYnMMd3C3rVgUDenZYbBdwOqfaiH+WKU92F0zsKLNiMEwAHx5CpGgHys2U0cRfU/ormsyQqUJR24GJVjilu/CrHPiI/GSD1uyz03MXxNM9kQ==</Code>
</Level>
<Level>
<Code>eNplj0EOwzAIBJX/oAgWY6e+9ZKoj+hP8vhAqkrYkU8zGtuwfN9HV2A1ApiYhOQM1Z7qrqQ9qqT2LjBSDc0/YTUgqU8vfkFLoJ9blCg4CQeVXDgo58IBWyrUAS0VWnkSOhcyFXjZ+Cg2Hr9FtXEwGI+jIyb9L3cBEKVLyA==</Code>
</Level>
<Level>
<Code>eNpdjNsNgCAMAB2oEtpS0P7heyj2cU0pJJr4e7m74c67MnsIJOABAUs+lGJyAiGSa7DkVcMfLS3j9Gb9w9/nVCQP1JKpo0uRpTrVmKrmjYTZztaNGDvcVNgqigbF2gdIYiR6</Code>
</Level>
<Level>
<Code>eNpdz0kSAyEIBdDKKpehqQ9I0N5lkeFQOXxQY1Wnlz4+g5fr/bFrNG5OEs7FCSyVhOTTKxWspOqsThtGalbMMBpScDCWkW4jDZmVV24IrqSZ15wfsdx0eTv4ezcBWXUyyekYEiAFaGtYlIvOJLfeo9yP+lHx/vzD5+4OKgXz9P5p+QLG9Deu</Code>
</Level>
<Level>
<Code>eNplT1sOhCAMzN4HN7SlIP0jGt0zbTz8TsX1A0MImUeZ6evbNssaA+FOFe/RFtOkgXMM6vBjiWNgdRj9vPnipYCHdeSpYBx3kr9SLgUBIgiieRhJEPDTKKwGUmYIqEBBjrbDitTqrpNYjUB4lduDqYgGsXt6VfyBElqGQuwryHMF3x70VMeilDWkp7AbIz31xOSYgPXGm4kbvQKIc4p/Ea5Qdg==</Code>
</Level>
<Level>
<Code>eNpNjVEKgDAMQz1QkbRbV9e/KaiHGp7dFQb6E0LySJanXZ6LrEpioSAm7u12qaAEUEQgifB0ZRtMUpskVtFodudhiv0HCj62xgZ6OzzXeMnb/HoB3fgbHg==</Code>
</Level>
<Level>
<Code>eNo1jesNAjEMgxkoV+XVa9p/FQgYquMxGE4PFClS7C/27TMf49RSyffuSkK+5nuIbVW2xjmlVbJyrvkcwg2mJMEkidvGLXBGwmu+hnUEeKVApiWkkW/amPxiIAmTSspHi1+PoQih92EghWFFv1rUkzT8HPGnwX4BqoUqRw==</Code>
</Level>
<Level>
<Code>eNpFTUEOgDAI80FoYIw5uS0a9VH7lv+ToQkhBFraMj3tViKEnBBmm1bdKNkECCWoQ0sRyGKIgHq71PZcP8wDe8qKQQgjyG8AWvJoD8LgB6ZqxvInhXDXZImMfujt1KFJ7A9eULUnaQ==</Code>
</Level>
<Level>
<Code>eNpVUEkOwzAIVP/jWoDXcKPpknu/48cXjCOlQkZihhnAt68cTJ1iCUQlgEfEVgIOeTE1Y5plCGjYzilDyEAODXlwbRBS9Q5SdbU3zFgt0xJbYKTpe7C1XxkduRhs5oyTw22Rvo7opga6CBUvfaYhH8aqUCJXoXvlWf/PAfd6+hndt05D3px7u3SbffbenUuelC5935w6D9EyzU/qy1+H/wDAQUdp</Code>
</Level>
<Level>
<Code>eNpj2OvoYmVsaKBjZqBjoGOoY1gD5RsaogugqzBCqPCECJiDuGBBPRMQhqk0NoaoNIYLWKAJmKCrMEGocLYyNDIFGm4KEgBxTSzhXACI/ik4</Code>
</Level>
<Level>
<Code>eNo9jEsOgDAIBT0QTYCUVtg1Nuqhuvbc0qBdzvvM9rTLuAioAAIBjY/z4tuyA7NA2tVDHK1bFm8R/00Esvgwqe6YnxqO6WRGSErhOI1KTMhPL/1fHZE=</Code>
</Level>
<Level>
<Code>eNpVzksOgDAIBFAPRA2fQpvu1I2H8kLeUsA0xiVvYMJyb+cg5lVBBIEBAS8n6c2JMyhkk7UFU4ZFp1aMuUfw0j5EvSwWCCjmit4WW58Y/uQY6je1JeQLhCBm8QZG7QN4/iTW</Code>
</Level>
<Level>
<Code>eNpdj8EOg0AIRNP/mRpgYVVuRlM993v68QXXbdoe58EwzO25HC5CYCYYCPRaHs6FIBYCfEpDUcLcZUx5vKa782yoaeXUhzMZhHNMUNAwhkxuFmfszIB8+OYcpyt1/+al9D2GJpBfsLvle9wscoLpD9TfjdXrFGkB763E6hZfqlqvWGJZ6ZIROWWkDnMPDUPUVGknaWCxdqfG69ngC78B7fNJKw==</Code>
</Level>
<Level>
<Code>eNp1jkEOAjEIRT0QNkBbsOwazYzeaU7uSmCi40LTlND3P/SfnnO1Jlw6sEZFIKBt3o0HQkWEQAgc8GFD3SJaduinSNyPRO2/xvxDuxlhinr8/WZ7PSB5e9HvjEIRufaAI/du82o9aUvrOYMvzuJVBXMYC/v6F8IENYY=</Code>
</Level>
<Level>
<Code>eNplj1sOAyEIRdMtdB2mEcRq+bOPqYty8b3ANE0zMdFwOCCczuOhJDWVVhMeWmPzmHpOVBy8tDICCLgTr/FWuSLDAWBMLbdokeNckIP4dC67WEwUysmqTSsQrYt3EFT34PTjm3JDQXO8MCv3XUN0V+nfb32wGYMd5pjKtgHlIydb+59/AN9ROpU=</Code>
</Level>
</LevelPack>
</LevelPacks>
);
}
}
}//package
Section 319
//List_skin (List_skin)
package {
import flash.display.*;
public dynamic class List_skin extends MovieClip {
}
}//package
Section 320
//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", "adGame1", "adGame2", "socialButtons"]);
engine.levelMgr.load(LevelPacks.xml);
engine.guiMgr.onSheetOpening.addListener(onGuiMgr_SheetOpening);
engine.achievementMgr.onObtain.addListener(onAchievementMgr_AchievementObtain);
engine.soundMgr.onChange.addListener(onSoundMgr_Change);
engine.keyboardMgr.onKeyDown.addListener(onKeyboardMgr_KeyDown);
setupSheets();
setupDialogs();
setupHUD();
setupSound();
setupAchievements();
setupContextMenu();
engine.load();
updateSoundOnOff();
inited = true;
engine.guiMgr.openWindow("MainMenu", {});
}
private static function setupSheets():void{
engine.guiMgr.registerWindow(MainMenu, "MainMenu");
engine.guiMgr.registerWindow(LevelEditor, "LevelEditor");
engine.guiMgr.registerWindow(LevelSelection, "LevelSelection");
engine.guiMgr.registerWindow(Game, "Game");
engine.guiMgr.registerWindow(Achievements, "Achievements");
}
private static function setupDialogs():void{
engine.guiMgr.registerWindow(Message, "Message");
engine.guiMgr.registerWindow(Options, "Options");
engine.guiMgr.registerWindow(SaveLoadLevel, "SaveLoadLevel");
engine.guiMgr.registerWindow(LevelEditorPanel, "LevelEditorPanel");
engine.guiMgr.registerWindow(CustomLevelComplete, "CustomLevelComplete");
engine.guiMgr.registerWindow(CustomLevelFailed, "CustomLevelFailed");
engine.guiMgr.registerWindow(OfficialLevelComplete, "OfficialLevelComplete");
engine.guiMgr.registerWindow(LevelEditorSettings, "LevelEditorSettings");
engine.guiMgr.registerWindow(SprintFinished, "SprintFinished");
engine.guiMgr.registerWindow(AchievementObtained, "AchievementObtained");
}
private static function setupHUD():void{
var _local1:HUD = (engine.guiMgr.hud as HUD);
_local1.addState("GameOfficialLevel", ["soundOnOff", "back2", "btnRestart", "btnHint", "checking", "btnSelectLevel", "txtScore", "txtLevelIndex"]);
_local1.addState("GameCustomLevel", ["soundOnOff", "back2", "btnRestart", "btnHint", "checking", "btnEditLevel", "txtScore"]);
_local1.addState("GameSprint", ["soundOnOff", "back1", "btnRestart", "btnHint", "checking", "btnMainMenu", "txtTime", "txtLevelsBeaten"]);
_local1.addState("MainMenu", ["soundOnOff", "adGame1", "adGame2", "socialButtons"]);
_local1.addState("LevelSelection", ["soundOnOff", "adGame1", "adGame2", "socialButtons"]);
_local1.addState("Achievements", ["soundOnOff", "adGame1", "adGame2", "socialButtons"]);
_local1.addState("LevelEditor", []);
_local1.soundOnOff.buttonMode = true;
_local1.soundOnOff.addEventListener(MouseEvent.CLICK, onHUD_SoundOnOff_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.btnShare.addEventListener(MouseEvent.CLICK, onHUD_SocialButtons_Share_Click);
}
private static function setupSound():void{
engine.soundMgr.registerMusic(SoundTheme, "Theme");
engine.soundMgr.registerSFX(SoundClick, "Click");
engine.soundMgr.registerSFX(SoundWin, "Win");
engine.soundMgr.registerSFX(SoundWind, "Wind");
engine.soundMgr.pushMusicToPlayList("Theme", 0, int.MAX_VALUE);
}
private static function setupAchievements():void{
engine.achievementMgr.registerAchievement("Beat 5 levels");
engine.achievementMgr.registerAchievement("Beat 10 levels");
engine.achievementMgr.registerAchievement("Beat the game");
engine.achievementMgr.registerAchievement("Beat 10 levels in sprint");
engine.achievementMgr.registerAchievement("Beat a custom level");
engine.achievementMgr.registerAchievement("Submit highscores");
engine.achievementMgr.registerAchievement("Click on more games");
}
private static function setupContextMenu():void{
container.contextMenu = new ContextMenu();
container.contextMenu.hideBuiltInItems();
var _local1:ContextMenuItem = new ContextMenuItem("More Games!");
_local1.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onContextMenu_MoreGames_MenuItemSelect);
container.contextMenu.customItems.push(_local1);
_local1 = new ContextMenuItem("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 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{
openURL(Settings.AD_GAME_1_URL);
}
private static function onHUD_AdGame2_Icon_Click(_arg1:MouseEvent):void{
openURL(Settings.AD_GAME_2_URL);
}
private static function onHUD_SocialButtons_Facebook_Click(_arg1:MouseEvent):void{
openURL(Settings.FACEBOOK_PAGE_URL);
}
private static function onHUD_SocialButtons_Twitter_Click(_arg1:MouseEvent):void{
openURL(Settings.TWITTER_PAGE_URL);
}
private static function onHUD_SocialButtons_Share_Click(_arg1:MouseEvent):void{
openURL((((((("http://api.addthis.com/oexchange/0.8/offer?url=" + Settings.SHARING_URL) + "&title=") + Settings.GAME_NAME) + "&username=GodvilGames") + "&description=") + Settings.SHARING_URL_DESCRIPTION));
}
private static function onGuiMgr_SheetOpening():void{
engine.soundMgr.playSFX("Wind");
}
private static function onSoundMgr_Change():void{
updateSoundOnOff();
}
private static function onAchievementMgr_AchievementObtain():void{
engine.guiMgr.openWindow("AchievementObtained", {});
}
private static function onKeyboardMgr_KeyDown(_arg1:uint):void{
if (_arg1 == KeyboardManager.M){
onHUD_SoundOnOff_Click(null);
};
}
private static function onContextMenu_MoreGames_MenuItemSelect(_arg1:ContextMenuEvent):void{
engine.achievementMgr.obtainAchievement("Click on more games");
openURL(Settings.CONTEXT_MENU_MORE_GAMES_URL);
}
private static function onContextMenu_Options_MenuItemSelect(_arg1:ContextMenuEvent):void{
engine.guiMgr.openWindow("Options", {});
}
private static function onContextMenu_MusicOff_MenuItemSelect(_arg1:ContextMenuEvent):void{
engine.soundMgr.musicMuting = true;
}
private static function onContextMenu_MusicOn_MenuItemSelect(_arg1:ContextMenuEvent):void{
engine.soundMgr.musicMuting = false;
}
private static function onContextMenu_SFXOff_MenuItemSelect(_arg1:ContextMenuEvent):void{
engine.soundMgr.sfxMuting = true;
}
private static function onContextMenu_SFXOn_MenuItemSelect(_arg1:ContextMenuEvent):void{
engine.soundMgr.sfxMuting = false;
}
}
}//package
Section 321
//Preloader (Preloader)
package {
import flash.events.*;
import flash.display.*;
import mochi.as3.*;
import com.greensock.*;
import flash.utils.*;
import fl.motion.easing.*;
import jk.engine.utils.*;
import jk.engine.utils.graphicsFill.*;
import jk.app.preloader.*;
import flash.text.*;
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);
LevelPacks.load(Settings.LOAD_LEVEL_PACKS_FROM_LOCAL);
MochiServices.connect(Settings.MOCHIADS_GAME_ID, this);
_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.BLOCKED_DOMAINS)){
gotoAndStop(2);
return;
};
stage.frameRate = Settings.FPS;
gotoAndStop(3);
getDefinitionByName("Main").init(this);
}
private function onSponsorLogo_Click(_arg1:MouseEvent):void{
openURL(Settings.PRELOADER_SPONSOR_LOGO_URL);
}
private function onGameIconsHolder_Click(_arg1:MouseEvent):void{
var _local2:MovieClip = (_arg1.target as MovieClip);
openURL((_local2.currentLabel + Settings.PRELOADER_GAME_ICON_URL_END));
}
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{
openURL(Settings.PRELOADER_BACKGROUND_URL);
}
}
}//package
Section 322
//ScrollArrowDown_disabledSkin (ScrollArrowDown_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_disabledSkin extends MovieClip {
}
}//package
Section 323
//ScrollArrowDown_downSkin (ScrollArrowDown_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_downSkin extends MovieClip {
}
}//package
Section 324
//ScrollArrowDown_overSkin (ScrollArrowDown_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_overSkin extends MovieClip {
}
}//package
Section 325
//ScrollArrowDown_upSkin (ScrollArrowDown_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_upSkin extends MovieClip {
}
}//package
Section 326
//ScrollArrowUp_disabledSkin (ScrollArrowUp_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_disabledSkin extends MovieClip {
}
}//package
Section 327
//ScrollArrowUp_downSkin (ScrollArrowUp_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_downSkin extends MovieClip {
}
}//package
Section 328
//ScrollArrowUp_overSkin (ScrollArrowUp_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_overSkin extends MovieClip {
}
}//package
Section 329
//ScrollArrowUp_upSkin (ScrollArrowUp_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_upSkin extends MovieClip {
}
}//package
Section 330
//ScrollBar_thumbIcon (ScrollBar_thumbIcon)
package {
import flash.display.*;
public dynamic class ScrollBar_thumbIcon extends MovieClip {
}
}//package
Section 331
//ScrollThumb_downSkin (ScrollThumb_downSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_downSkin extends MovieClip {
}
}//package
Section 332
//ScrollThumb_overSkin (ScrollThumb_overSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_overSkin extends MovieClip {
}
}//package
Section 333
//ScrollThumb_upSkin (ScrollThumb_upSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_upSkin extends MovieClip {
}
}//package
Section 334
//ScrollTrack_skin (ScrollTrack_skin)
package {
import flash.display.*;
public dynamic class ScrollTrack_skin extends MovieClip {
}
}//package
Section 335
//Settings (Settings)
package {
import fl.motion.easing.*;
public class Settings {
private static const _SPONSOR_URL:String = "http://www.godvilgames.com/";
private static const _SPONSOR_GAME_CODE:String = "fanged-fun";
private static const _SPONSOR_GAME_URL:String = (((_SPONSOR_URL + "games/") + _SPONSOR_GAME_CODE) + ".html");
private static const _ANALYTICS_URL:String = (("?utm_source=our_game&utm_campaign=" + _SPONSOR_GAME_CODE) + "&utm_medium=");
private static const _SPONSOR_WITH_ANALYTICS_URL:String = (_SPONSOR_URL + _ANALYTICS_URL);
public static const GAME_NAME:String = "Fanged Fun";
public static const COOKIE_FILE_NAME:String = "Fanged_Fun";
public static const MOCHIBOT_ID:String = "053a51ed";
public static const MOCHIADS_GAME_ID:String = "c60efde678f4473b";
public static const HIGHSCORES_LEADERBOARD_ID:String = "c1d76565cacf4ed7";
public static const SPRINT_LEADERBOARD_ID:String = "b8ed70a165732408";
public static const CONTEXT_MENU_MORE_GAMES_URL:String = (_SPONSOR_WITH_ANALYTICS_URL + "context_menu_more");
public static const MAIN_MENU_MORE_GAMES_URL:String = (_SPONSOR_WITH_ANALYTICS_URL + "main_menu_more");
public static const PRELOADER_SPONSOR_LOGO_URL:String = (_SPONSOR_WITH_ANALYTICS_URL + "preloader_logo");
public static const PRELOADER_GAME_ICON_URL_END:String = (_ANALYTICS_URL + "preloader_game_icon");
public static const PRELOADER_BACKGROUND_URL:String = (_SPONSOR_WITH_ANALYTICS_URL + "preloader_background");
public static const POST_IT_HERE_URL:String = ((_SPONSOR_GAME_URL + _ANALYTICS_URL) + "post_it_here");
public static const HINT_URL:String = (((((_SPONSOR_URL + "walks/") + _SPONSOR_GAME_CODE) + ".html") + _ANALYTICS_URL) + "hint");
public static const AD_GAME_1_URL:String = (((_SPONSOR_URL + "games/foxnroll-pro.html") + _ANALYTICS_URL) + "panel_game_icon_1");
public static const AD_GAME_2_URL:String = (((_SPONSOR_URL + "games/werebox.html") + _ANALYTICS_URL) + "panel_game_icon_2");
public static const FACEBOOK_PAGE_URL:String = "http://www.facebook.com/GodvilGames";
public static const TWITTER_PAGE_URL:String = "http://www.twitter.com/GodvilGames";
public static const SHARING_URL:String = _SPONSOR_GAME_URL;
public static const SHARING_URL_DESCRIPTION:String = "Funny physics-based puzzle game!";
public static const BLOCKED_DOMAINS:Array = ["7k7k.com"];
public static const LITE_BRANDED_DOMAINS:Array = ["kongregate.com", "newgrounds.com", "uploads.ungrounded.net", "godvilgames.com", "localhost"];
public static const LOAD_LEVEL_PACKS_FROM_LOCAL:Boolean = false;
public static const WIDTH:Number = 700;
public static const HEIGHT:Number = 525;
public static const THEATER_WIDTH:Number = 8192;
public static const THEATER_HEIGHT:Number = 8192;
public static const GAME_INIT_SCORE:int = 1000;
public static const GAME_ADDITION_SCORE:int = 100;
public static const FPS:int = 30;
public static const PHYS_DT:Number = 0.0333333333333333;
public static const PHYS_ITERATIONS:int = 10;
public static const PHYS_SCALE:Number = 30;
public static const INV_PHYS_SCALE:Number = 0.0333333333333333;
public static const HALF_INV_PHYS_SCALE:Number = 0.0166666666666667;
public static const DEFAULT_GRAVITY_X:Number = 0;
public static const DEFAULT_GRAVITY_Y:Number = 0;
public static const DEFAULT_DENSITY:Number = 1;
public static const DEFAULT_FRICTION:Number = 0.5;
public static const DEFAULT_RESTITUTION:Number = 0.1;
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 336
//setupActorBuildingParams (setupActorBuildingParams)
package {
public function setupActorBuildingParams(_arg1:String, _arg2:Object):void{
switch (_arg1){
case "AA":
_arg2.physModel = "Circle";
_arg2.fixedScale = true;
break;
case "AB":
_arg2.physModel = "Circle";
_arg2.fixedScale = true;
_arg2.friction = 0.1;
_arg2.density = 2;
_arg2.restitution = 0.2;
_arg2.alternative = "AD";
break;
case "AC":
_arg2.physModel = "Rectangle";
break;
case "AD":
_arg2.physModel = "Rectangle";
_arg2.fixedScale = true;
_arg2.alternative = "AB";
break;
case "AE":
_arg2.physModel = "Circle";
_arg2.fixedScale = true;
_arg2.friction = 0.1;
_arg2.density = 2;
_arg2.restitution = 0.2;
_arg2.alternative = "AG";
break;
case "AF":
_arg2.physModel = "Rectangle";
break;
case "AG":
_arg2.physModel = "Rectangle";
_arg2.fixedScale = true;
_arg2.alternative = "AE";
break;
case "AH":
_arg2.physModel = "Rectangle";
break;
case "AI":
_arg2.physModel = "Concave";
_arg2.polygons = [[[10.35, -25], [24.95, -10.35], [25, 10.35], [10.35, 25], [-10.35, 25], [-25, 10.35], [-25, -10.35], [-10.35, -25]]];
_arg2.fixedScale = true;
break;
};
}
}//package
Section 337
//SliderThumb_disabledSkin (SliderThumb_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_disabledSkin extends MovieClip {
}
}//package
Section 338
//SliderThumb_downSkin (SliderThumb_downSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_downSkin extends MovieClip {
}
}//package
Section 339
//SliderThumb_overSkin (SliderThumb_overSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_overSkin extends MovieClip {
}
}//package
Section 340
//SliderThumb_upSkin (SliderThumb_upSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_upSkin extends MovieClip {
}
}//package
Section 341
//SliderTick_skin (SliderTick_skin)
package {
import flash.display.*;
public dynamic class SliderTick_skin extends MovieClip {
}
}//package
Section 342
//SliderTrack_disabledSkin (SliderTrack_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderTrack_disabledSkin extends MovieClip {
}
}//package
Section 343
//SliderTrack_skin (SliderTrack_skin)
package {
import flash.display.*;
public dynamic class SliderTrack_skin extends MovieClip {
}
}//package
Section 344
//SoundClick (SoundClick)
package {
import flash.media.*;
public dynamic class SoundClick extends Sound {
}
}//package
Section 345
//SoundTheme (SoundTheme)
package {
import flash.media.*;
public dynamic class SoundTheme extends Sound {
}
}//package
Section 346
//SoundWin (SoundWin)
package {
import flash.media.*;
public dynamic class SoundWin extends Sound {
}
}//package
Section 347
//SoundWind (SoundWind)
package {
import flash.media.*;
public dynamic class SoundWind extends Sound {
}
}//package
Section 348
//TextArea_disabledSkin (TextArea_disabledSkin)
package {
import flash.display.*;
public dynamic class TextArea_disabledSkin extends MovieClip {
}
}//package
Section 349
//TextArea_upSkin (TextArea_upSkin)
package {
import flash.display.*;
public dynamic class TextArea_upSkin extends MovieClip {
}
}//package
Section 350
//TextInput_disabledSkin (TextInput_disabledSkin)
package {
import flash.display.*;
public dynamic class TextInput_disabledSkin extends MovieClip {
}
}//package
Section 351
//TextInput_upSkin (TextInput_upSkin)
package {
import flash.display.*;
public dynamic class TextInput_upSkin extends MovieClip {
}
}//package