Section 1
//BBsoundButtonOld_139 (99bricksfull_fla.BBsoundButtonOld_139)
package 99bricksfull_fla {
import flash.display.*;
public dynamic class BBsoundButtonOld_139 extends MovieClip {
public function BBsoundButtonOld_139(){
addFrameScript(9, frame10, 18, frame19);
}
function frame10(){
stop();
}
function frame19(){
stop();
}
}
}//package 99bricksfull_fla
Section 2
//buttonMouseOver_126 (99bricksfull_fla.buttonMouseOver_126)
package 99bricksfull_fla {
import flash.display.*;
public dynamic class buttonMouseOver_126 extends MovieClip {
public function buttonMouseOver_126(){
addFrameScript(14, frame15);
}
function frame15(){
stop();
}
}
}//package 99bricksfull_fla
Section 3
//dialogButtonTitle_218 (99bricksfull_fla.dialogButtonTitle_218)
package 99bricksfull_fla {
import flash.display.*;
import flash.text.*;
public dynamic class dialogButtonTitle_218 extends MovieClip {
public var textField:TextField;
}
}//package 99bricksfull_fla
Section 4
//focusMarkerAni_175 (99bricksfull_fla.focusMarkerAni_175)
package 99bricksfull_fla {
import flash.display.*;
public dynamic class focusMarkerAni_175 extends MovieClip {
public function focusMarkerAni_175(){
addFrameScript(19, frame20);
}
function frame20(){
gotoAndPlay("loop");
}
}
}//package 99bricksfull_fla
Section 5
//loadBar_26 (99bricksfull_fla.loadBar_26)
package 99bricksfull_fla {
import flash.display.*;
public dynamic class loadBar_26 extends MovieClip {
public function loadBar_26(){
addFrameScript(99, frame100);
}
function frame100(){
stop();
}
}
}//package 99bricksfull_fla
Section 6
//menuTitle_124 (99bricksfull_fla.menuTitle_124)
package 99bricksfull_fla {
import flash.display.*;
import flash.text.*;
public dynamic class menuTitle_124 extends MovieClip {
public var textField:TextField;
}
}//package 99bricksfull_fla
Section 7
//menuTitle_169 (99bricksfull_fla.menuTitle_169)
package 99bricksfull_fla {
import flash.display.*;
import flash.text.*;
public dynamic class menuTitle_169 extends MovieClip {
public var textField:TextField;
}
}//package 99bricksfull_fla
Section 8
//messageAreaTextfield_150 (99bricksfull_fla.messageAreaTextfield_150)
package 99bricksfull_fla {
import flash.display.*;
import flash.text.*;
public dynamic class messageAreaTextfield_150 extends MovieClip {
public var textField:TextField;
}
}//package 99bricksfull_fla
Section 9
//pausedMessageAni_2 (99bricksfull_fla.pausedMessageAni_2)
package 99bricksfull_fla {
import flash.display.*;
public dynamic class pausedMessageAni_2 extends MovieClip {
public function pausedMessageAni_2(){
addFrameScript(55, frame56);
}
function frame56(){
stop();
}
}
}//package 99bricksfull_fla
Section 10
//siteLinkButton_201 (99bricksfull_fla.siteLinkButton_201)
package 99bricksfull_fla {
import flash.display.*;
public dynamic class siteLinkButton_201 extends MovieClip {
public var detector:MovieClip;
public function siteLinkButton_201(){
addFrameScript(19, frame20, 29, frame30, 39, frame40, 49, frame50);
}
function frame20(){
stop();
}
function frame30(){
stop();
}
function frame40(){
stop();
}
function frame50(){
stop();
}
}
}//package 99bricksfull_fla
Section 11
//thumbLoaderBar_146 (99bricksfull_fla.thumbLoaderBar_146)
package 99bricksfull_fla {
import flash.display.*;
public dynamic class thumbLoaderBar_146 extends MovieClip {
public var loadBar:MovieClip;
public function thumbLoaderBar_146(){
addFrameScript(100, frame101);
}
function frame101(){
stop();
}
}
}//package 99bricksfull_fla
Section 12
//thumbLoaderBar_193 (99bricksfull_fla.thumbLoaderBar_193)
package 99bricksfull_fla {
import flash.display.*;
public dynamic class thumbLoaderBar_193 extends MovieClip {
public var loadBar:MovieClip;
public function thumbLoaderBar_193(){
addFrameScript(100, frame101);
}
function frame101(){
stop();
}
}
}//package 99bricksfull_fla
Section 13
//wbLogo_22 (99bricksfull_fla.wbLogo_22)
package 99bricksfull_fla {
import flash.display.*;
public dynamic class wbLogo_22 extends MovieClip {
public function wbLogo_22(){
addFrameScript(109, frame110);
}
function frame110(){
stop();
}
}
}//package 99bricksfull_fla
Section 14
//webLink_29 (99bricksfull_fla.webLink_29)
package 99bricksfull_fla {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public dynamic class webLink_29 extends MovieClip {
public var webLinkText:SimpleButton;
public function webLink_29(){
addFrameScript(0, frame1);
}
public function gotoWebpage(_arg1:Event):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.weirdbeard.nl/en/");
navigateToURL(_local2, "_blank");
}
function frame1(){
webLinkText.addEventListener(MouseEvent.MOUSE_UP, gotoWebpage);
}
}
}//package 99bricksfull_fla
Section 15
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
public class b2CircleDef extends b2ShapeDef {
public var localPosition:b2Vec2;
public var radius:Number;
public function b2CircleDef(){
localPosition = new b2Vec2(0, 0);
super();
type = b2Shape.e_circleShape;
radius = 1;
}
}
}//package Box2D.Collision.Shapes
Section 16
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape)
package Box2D.Collision.Shapes {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2CircleShape extends b2Shape {
public var m_radius:Number;
public var m_localPosition:b2Vec2;
public function b2CircleShape(_arg1:b2ShapeDef){
var _local2:b2CircleDef;
m_localPosition = new b2Vec2();
super(_arg1);
_local2 = (_arg1 as b2CircleDef);
m_type = e_circleShape;
m_localPosition.SetV(_local2.localPosition);
m_radius = _local2.radius;
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
_local3 = _arg1.R;
_local4 = (_arg1.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
_local5 = (_arg1.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y)));
_local4 = (_arg2.x - _local4);
_local5 = (_arg2.y - _local5);
return ((((_local4 * _local4) + (_local5 * _local5)) <= (m_radius * m_radius)));
}
public function GetLocalPosition():b2Vec2{
return (m_localPosition);
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
var _local6:b2Mat22;
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;
_local6 = _arg1.R;
_local7 = (_arg1.position.x + ((_local6.col1.x * m_localPosition.x) + (_local6.col2.x * m_localPosition.y)));
_local8 = (_arg1.position.x + ((_local6.col1.y * m_localPosition.x) + (_local6.col2.y * m_localPosition.y)));
_local9 = (_arg4.p1.x - _local7);
_local10 = (_arg4.p1.y - _local8);
_local11 = (((_local9 * _local9) + (_local10 * _local10)) - (m_radius * m_radius));
if (_local11 < 0){
return (false);
};
_local12 = (_arg4.p2.x - _arg4.p1.x);
_local13 = (_arg4.p2.y - _arg4.p1.y);
_local14 = ((_local9 * _local12) + (_local10 * _local13));
_local15 = ((_local12 * _local12) + (_local13 * _local13));
_local16 = ((_local14 * _local14) - (_local15 * _local11));
if ((((_local16 < 0)) || ((_local15 < Number.MIN_VALUE)))){
return (false);
};
_local17 = -((_local14 + Math.sqrt(_local16)));
if ((((0 <= _local17)) && ((_local17 <= (_arg5 * _local15))))){
_local17 = (_local17 / _local15);
_arg2[0] = _local17;
_arg3.x = (_local9 + (_local17 * _local12));
_arg3.y = (_local10 + (_local17 * _local13));
_arg3.Normalize();
return (true);
};
return (false);
}
override public function ComputeMass(_arg1:b2MassData):void{
_arg1.mass = (((m_density * b2Settings.b2_pi) * m_radius) * m_radius);
_arg1.center.SetV(m_localPosition);
_arg1.I = (_arg1.mass * (((0.5 * m_radius) * m_radius) + ((m_localPosition.x * m_localPosition.x) + (m_localPosition.y * m_localPosition.y))));
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local4 = _arg2.R;
_local5 = (_arg2.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
_local6 = (_arg2.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y)));
_local4 = _arg3.R;
_local7 = (_arg3.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y)));
_local8 = (_arg3.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y)));
_arg1.lowerBound.Set((((_local5 < _local7)) ? _local5 : _local7 - m_radius), (((_local6 < _local8)) ? _local6 : _local8 - m_radius));
_arg1.upperBound.Set((((_local5 > _local7)) ? _local5 : _local7 + m_radius), (((_local6 > _local8)) ? _local6 : _local8 + m_radius));
}
public function GetRadius():Number{
return (m_radius);
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:Number;
var _local3:Number;
_local2 = (m_localPosition.x - _arg1.x);
_local3 = (m_localPosition.y - _arg1.y);
_local2 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3)));
m_sweepRadius = ((_local2 + m_radius) - b2Settings.b2_toiSlop);
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
_local3 = _arg2.R;
_local4 = (_arg2.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y)));
_local5 = (_arg2.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y)));
_arg1.lowerBound.Set((_local4 - m_radius), (_local5 - m_radius));
_arg1.upperBound.Set((_local4 + m_radius), (_local5 + m_radius));
}
}
}//package Box2D.Collision.Shapes
Section 17
//b2FilterData (Box2D.Collision.Shapes.b2FilterData)
package Box2D.Collision.Shapes {
public class b2FilterData {
public var maskBits:uint;// = 0xFFFF
public var groupIndex:int;// = 0
public var categoryBits:uint;// = 1
public function b2FilterData(){
categoryBits = 1;
maskBits = 0xFFFF;
groupIndex = 0;
super();
}
public function Copy():b2FilterData{
var _local1:b2FilterData;
_local1 = new b2FilterData();
_local1.categoryBits = categoryBits;
_local1.maskBits = maskBits;
_local1.groupIndex = groupIndex;
return (_local1);
}
}
}//package Box2D.Collision.Shapes
Section 18
//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(){
mass = 0;
center = new b2Vec2(0, 0);
I = 0;
super();
}
}
}//package Box2D.Collision.Shapes
Section 19
//b2PolygonDef (Box2D.Collision.Shapes.b2PolygonDef)
package Box2D.Collision.Shapes {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PolygonDef extends b2ShapeDef {
public var vertexCount:int;
public var vertices:Array;
private static var s_mat:b2Mat22 = new b2Mat22();
public function b2PolygonDef(){
var _local1:int;
vertices = new Array(b2Settings.b2_maxPolygonVertices);
super();
type = b2Shape.e_polygonShape;
vertexCount = 0;
_local1 = 0;
while (_local1 < b2Settings.b2_maxPolygonVertices) {
vertices[_local1] = new b2Vec2();
_local1++;
};
}
public function SetAsOrientedBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2=null, _arg4:Number=0):void{
var _local5:b2Vec2;
var _local6:b2Mat22;
var _local7:int;
vertexCount = 4;
vertices[0].Set(-(_arg1), -(_arg2));
vertices[1].Set(_arg1, -(_arg2));
vertices[2].Set(_arg1, _arg2);
vertices[3].Set(-(_arg1), _arg2);
if (_arg3){
_local5 = _arg3;
_local6 = s_mat;
_local6.Set(_arg4);
_local7 = 0;
while (_local7 < vertexCount) {
_arg3 = vertices[_local7];
_arg1 = (_local5.x + ((_local6.col1.x * _arg3.x) + (_local6.col2.x * _arg3.y)));
_arg3.y = (_local5.y + ((_local6.col1.y * _arg3.x) + (_local6.col2.y * _arg3.y)));
_arg3.x = _arg1;
_local7++;
};
};
}
public function SetAsBox(_arg1:Number, _arg2:Number):void{
vertexCount = 4;
vertices[0].Set(-(_arg1), -(_arg2));
vertices[1].Set(_arg1, -(_arg2));
vertices[2].Set(_arg1, _arg2);
vertices[3].Set(-(_arg1), _arg2);
}
}
}//package Box2D.Collision.Shapes
Section 20
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape)
package Box2D.Collision.Shapes {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PolygonShape extends b2Shape {
public var m_vertices:Array;
public var m_normals:Array;
private var s_supportVec:b2Vec2;
public var m_obb:b2OBB;
public var m_coreVertices:Array;
public var m_centroid:b2Vec2;
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 _local2:b2PolygonDef;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
s_supportVec = new b2Vec2();
m_obb = new b2OBB();
m_vertices = new Array(b2Settings.b2_maxPolygonVertices);
m_normals = new Array(b2Settings.b2_maxPolygonVertices);
m_coreVertices = new Array(b2Settings.b2_maxPolygonVertices);
super(_arg1);
m_type = e_polygonShape;
_local2 = (_arg1 as b2PolygonDef);
m_vertexCount = _local2.vertexCount;
_local4 = _local3;
_local5 = _local3;
_local3 = 0;
while (_local3 < m_vertexCount) {
m_vertices[_local3] = _local2.vertices[_local3].Copy();
_local3++;
};
_local3 = 0;
while (_local3 < m_vertexCount) {
_local4 = _local3;
_local5 = (((_local3 + 1) < m_vertexCount)) ? (_local3 + 1) : 0;
_local6 = (m_vertices[_local5].x - m_vertices[_local4].x);
_local7 = (m_vertices[_local5].y - m_vertices[_local4].y);
_local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7)));
m_normals[_local3] = new b2Vec2((_local7 / _local8), (-(_local6) / _local8));
_local3++;
};
m_centroid = ComputeCentroid(_local2.vertices, _local2.vertexCount);
ComputeOBB(m_obb, m_vertices, m_vertexCount);
_local3 = 0;
while (_local3 < m_vertexCount) {
_local4 = (((_local3 - 1) >= 0)) ? (_local3 - 1) : (m_vertexCount - 1);
_local5 = _local3;
_local9 = m_normals[_local4].x;
_local10 = m_normals[_local4].y;
_local11 = m_normals[_local5].x;
_local12 = m_normals[_local5].y;
_local13 = (m_vertices[_local3].x - m_centroid.x);
_local14 = (m_vertices[_local3].y - m_centroid.y);
_local15 = (((_local9 * _local13) + (_local10 * _local14)) - b2Settings.b2_toiSlop);
_local16 = (((_local11 * _local13) + (_local12 * _local14)) - b2Settings.b2_toiSlop);
_local17 = (1 / ((_local9 * _local12) - (_local10 * _local11)));
m_coreVertices[_local3] = new b2Vec2(((_local17 * ((_local12 * _local15) - (_local10 * _local16))) + m_centroid.x), ((_local17 * ((_local9 * _local16) - (_local11 * _local15))) + m_centroid.y));
_local3++;
};
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Vec2;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:int;
var _local10:Number;
_local4 = _arg1.R;
_local5 = (_arg2.x - _arg1.position.x);
_local6 = (_arg2.y - _arg1.position.y);
_local7 = ((_local5 * _local4.col1.x) + (_local6 * _local4.col1.y));
_local8 = ((_local5 * _local4.col2.x) + (_local6 * _local4.col2.y));
_local9 = 0;
while (_local9 < m_vertexCount) {
_local3 = m_vertices[_local9];
_local5 = (_local7 - _local3.x);
_local6 = (_local8 - _local3.y);
_local3 = m_normals[_local9];
_local10 = ((_local3.x * _local5) + (_local3.y * _local6));
if (_local10 > 0){
return (false);
};
_local9++;
};
return (true);
}
public function GetCoreVertices():Array{
return (m_coreVertices);
}
override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
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 _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:int;
var _local20:Number;
var _local21:Number;
_local6 = 0;
_local7 = _arg5;
_local8 = (_arg4.p1.x - _arg1.position.x);
_local9 = (_arg4.p1.y - _arg1.position.y);
_local10 = _arg1.R;
_local12 = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
_local13 = ((_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;
_local14 = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y));
_local15 = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y));
_local16 = (_local14 - _local12);
_local17 = (_local15 - _local13);
_local18 = -1;
_local19 = 0;
while (_local19 < m_vertexCount) {
_local11 = m_vertices[_local19];
_local8 = (_local11.x - _local12);
_local9 = (_local11.y - _local13);
_local11 = m_normals[_local19];
_local20 = ((_local11.x * _local8) + (_local11.y * _local9));
_local21 = ((_local11.x * _local16) + (_local11.y * _local17));
if ((((_local21 < 0)) && ((_local20 < (_local6 * _local21))))){
_local6 = (_local20 / _local21);
_local18 = _local19;
} else {
if ((((_local21 > 0)) && ((_local20 < (_local7 * _local21))))){
_local7 = (_local20 / _local21);
};
};
if (_local7 < _local6){
return (false);
};
_local19++;
};
if (_local18 >= 0){
_arg2[0] = _local6;
_local10 = _arg1.R;
_local11 = m_normals[_local18];
_arg3.x = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_arg3.y = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
return (true);
};
return (false);
}
public function GetCentroid():b2Vec2{
return (m_centroid);
}
override public function ComputeMass(_arg1:b2MassData):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:int;
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;
_local2 = 0;
_local3 = 0;
_local4 = 0;
_local5 = 0;
_local6 = 0;
_local7 = 0;
_local8 = (1 / 3);
_local9 = 0;
while (_local9 < m_vertexCount) {
_local10 = m_vertices[_local9];
_local11 = (((_local9 + 1) < m_vertexCount)) ? m_vertices[int((_local9 + 1))] : m_vertices[0];
_local12 = (_local10.x - _local6);
_local13 = (_local10.y - _local7);
_local14 = (_local11.x - _local6);
_local15 = (_local11.y - _local7);
_local16 = ((_local12 * _local15) - (_local13 * _local14));
_local17 = (0.5 * _local16);
_local4 = (_local4 + _local17);
_local2 = (_local2 + ((_local17 * _local8) * ((_local6 + _local10.x) + _local11.x)));
_local3 = (_local3 + ((_local17 * _local8) * ((_local7 + _local10.y) + _local11.y)));
_local18 = _local6;
_local19 = _local7;
_local20 = _local12;
_local21 = _local13;
_local22 = _local14;
_local23 = _local15;
_local24 = ((_local8 * ((0.25 * (((_local20 * _local20) + (_local22 * _local20)) + (_local22 * _local22))) + ((_local18 * _local20) + (_local18 * _local22)))) + ((0.5 * _local18) * _local18));
_local25 = ((_local8 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19));
_local5 = (_local5 + (_local16 * (_local24 + _local25)));
_local9++;
};
_arg1.mass = (m_density * _local4);
_local2 = (_local2 * (1 / _local4));
_local3 = (_local3 * (1 / _local4));
_arg1.center.Set(_local2, _local3);
_arg1.I = (m_density * _local5);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:b2Vec2;
var _local5:b2Mat22;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:Number;
var _local10:int;
var _local11:Number;
_local5 = _arg1.R;
_local6 = ((_arg2 * _local5.col1.x) + (_arg3 * _local5.col1.y));
_local7 = ((_arg2 * _local5.col2.x) + (_arg3 * _local5.col2.y));
_local8 = 0;
_local4 = m_coreVertices[0];
_local9 = ((_local4.x * _local6) + (_local4.y * _local7));
_local10 = 1;
while (_local10 < m_vertexCount) {
_local4 = m_coreVertices[_local10];
_local11 = ((_local4.x * _local6) + (_local4.y * _local7));
if (_local11 > _local9){
_local8 = _local10;
_local9 = _local11;
};
_local10++;
};
_local5 = _arg1.R;
_local4 = m_coreVertices[_local8];
s_supportVec.x = (_arg1.position.x + ((_local5.col1.x * _local4.x) + (_local5.col2.x * _local4.y)));
s_supportVec.y = (_arg1.position.y + ((_local5.col1.y * _local4.x) + (_local5.col2.y * _local4.y)));
return (s_supportVec);
}
public function GetVertexCount():int{
return (m_vertexCount);
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2AABB;
var _local5:b2AABB;
_local4 = s_sweptAABB1;
_local5 = s_sweptAABB2;
ComputeAABB(_local4, _arg2);
ComputeAABB(_local5, _arg3);
_arg1.lowerBound.Set(((_local4.lowerBound.x < _local5.lowerBound.x)) ? _local4.lowerBound.x : _local5.lowerBound.x, ((_local4.lowerBound.y < _local5.lowerBound.y)) ? _local4.lowerBound.y : _local5.lowerBound.y);
_arg1.upperBound.Set(((_local4.upperBound.x > _local5.upperBound.x)) ? _local4.upperBound.x : _local5.upperBound.x, ((_local4.upperBound.y > _local5.upperBound.y)) ? _local4.upperBound.y : _local5.upperBound.y);
}
public function GetVertices():Array{
return (m_vertices);
}
public function GetNormals():Array{
return (m_normals);
}
public function GetOBB():b2OBB{
return (m_obb);
}
public function GetFirstVertex(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, m_coreVertices[0]));
}
public function Centroid(_arg1:b2XForm):b2Vec2{
return (b2Math.b2MulX(_arg1, m_centroid));
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:b2Vec2;
var _local3:int;
var _local4:Number;
var _local5:Number;
m_sweepRadius = 0;
_local3 = 0;
while (_local3 < m_vertexCount) {
_local2 = m_coreVertices[_local3];
_local4 = (_local2.x - _arg1.x);
_local5 = (_local2.y - _arg1.y);
_local4 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
if (_local4 > m_sweepRadius){
m_sweepRadius = _local4;
};
_local3++;
};
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:b2Mat22;
var _local6:b2Mat22;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local5 = s_computeMat;
_local3 = _arg2.R;
_local4 = m_obb.R.col1;
_local5.col1.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col1.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local4 = m_obb.R.col2;
_local5.col2.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col2.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local5.Abs();
_local6 = _local5;
_local4 = m_obb.extents;
_local7 = ((_local6.col1.x * _local4.x) + (_local6.col2.x * _local4.y));
_local8 = ((_local6.col1.y * _local4.x) + (_local6.col2.y * _local4.y));
_local3 = _arg2.R;
_local4 = m_obb.center;
_local9 = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)));
_local10 = (_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));
}
public static function ComputeCentroid(_arg1:Array, _arg2:int):b2Vec2{
var _local3:b2Vec2;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local3 = new b2Vec2();
_local4 = 0;
_local5 = 0;
_local6 = 0;
_local7 = (1 / 3);
_local8 = 0;
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 _local5:Array;
var _local6:Number;
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;
_local5 = new Array((b2Settings.b2_maxPolygonVertices + 1));
_local4 = 0;
while (_local4 < _arg3) {
_local5[_local4] = _arg2[_local4];
_local4++;
};
_local5[_arg3] = _local5[0];
_local6 = 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 21
//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_sweepRadius:Number;
public var m_density:Number;
public var m_filter:b2FilterData;
public var m_friction:Number;
public var m_next:b2Shape;
public var m_restitution:Number;
public var m_userData;
public var m_isSensor:Boolean;
public var m_proxyId:uint;
public var m_body:b2Body;
public static const e_polygonShape:int = 1;
public static const e_unknownShape:int = -1;
public static const e_circleShape:int = 0;
public static const e_shapeTypeCount:int = 2;
private static var s_resetAABB:b2AABB = new b2AABB();
private static var s_syncAABB:b2AABB = new b2AABB();
private static var s_proxyAABB:b2AABB = new b2AABB();
public function b2Shape(_arg1:b2ShapeDef){
m_userData = _arg1.userData;
m_friction = _arg1.friction;
m_restitution = _arg1.restitution;
m_density = _arg1.density;
m_body = null;
m_sweepRadius = 0;
m_next = null;
m_proxyId = b2Pair.b2_nullProxy;
m_filter = _arg1.filter.Copy();
m_isSensor = _arg1.isSensor;
}
public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
return (false);
}
public function GetSweepRadius():Number{
return (m_sweepRadius);
}
public function GetNext():b2Shape{
return (m_next);
}
public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
}
public function GetType():int{
return (m_type);
}
public function GetRestitution():Number{
return (m_restitution);
}
public function GetFriction():Number{
return (m_friction);
}
public function GetFilterData():b2FilterData{
return (m_filter.Copy());
}
public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
return (false);
}
public function RefilterProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
var _local3:b2AABB;
var _local4:Boolean;
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
_arg1.DestroyProxy(m_proxyId);
_local3 = s_resetAABB;
ComputeAABB(_local3, _arg2);
_local4 = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function SetFilterData(_arg1:b2FilterData):void{
m_filter = _arg1.Copy();
}
public function GetUserData(){
return (m_userData);
}
public function Synchronize(_arg1:b2BroadPhase, _arg2:b2XForm, _arg3:b2XForm):Boolean{
var _local4:b2AABB;
if (m_proxyId == b2Pair.b2_nullProxy){
return (false);
};
_local4 = s_syncAABB;
ComputeSweptAABB(_local4, _arg2, _arg3);
if (_arg1.InRange(_local4)){
_arg1.MoveProxy(m_proxyId, _local4);
return (true);
};
return (false);
}
public function ComputeMass(_arg1:b2MassData):void{
}
public function IsSensor():Boolean{
return (m_isSensor);
}
public function DestroyProxy(_arg1:b2BroadPhase):void{
if (m_proxyId != b2Pair.b2_nullProxy){
_arg1.DestroyProxy(m_proxyId);
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function UpdateSweepRadius(_arg1:b2Vec2):void{
}
public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
}
public function GetBody():b2Body{
return (m_body);
}
public function CreateProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
var _local3:b2AABB;
var _local4:Boolean;
_local3 = s_proxyAABB;
ComputeAABB(_local3, _arg2);
_local4 = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public static function Destroy(_arg1:b2Shape, _arg2):void{
}
public static function Create(_arg1:b2ShapeDef, _arg2):b2Shape{
switch (_arg1.type){
case e_circleShape:
return (new b2CircleShape(_arg1));
case e_polygonShape:
return (new b2PolygonShape(_arg1));
default:
return (null);
};
}
}
}//package Box2D.Collision.Shapes
Section 22
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef)
package Box2D.Collision.Shapes {
public class b2ShapeDef {
public var isSensor:Boolean;// = false
public var density:Number;// = 0
public var type:int;
public var restitution:Number;// = 0
public var userData;// = null
public var filter:b2FilterData;
public var friction:Number;// = 0.2
public function b2ShapeDef(){
type = b2Shape.e_unknownShape;
userData = null;
friction = 0.2;
restitution = 0;
density = 0;
isSensor = false;
filter = new b2FilterData();
super();
}
}
}//package Box2D.Collision.Shapes
Section 23
//b2AABB (Box2D.Collision.b2AABB)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2AABB {
public var upperBound:b2Vec2;
public var lowerBound:b2Vec2;
public function b2AABB(){
lowerBound = new b2Vec2();
upperBound = new b2Vec2();
super();
}
public function IsValid():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:Boolean;
_local1 = (upperBound.x - lowerBound.x);
_local2 = (upperBound.y - lowerBound.y);
_local3 = (((_local1 >= 0)) && ((_local2 >= 0)));
_local3 = ((((_local3) && (lowerBound.IsValid()))) && (upperBound.IsValid()));
return (_local3);
}
}
}//package Box2D.Collision
Section 24
//b2Bound (Box2D.Collision.b2Bound)
package Box2D.Collision {
public class b2Bound {
public var proxyId:uint;
public var stabbingCount:uint;
public var value:uint;
public function Swap(_arg1:b2Bound):void{
var _local2:uint;
var _local3:uint;
var _local4:uint;
_local2 = value;
_local3 = proxyId;
_local4 = stabbingCount;
value = _arg1.value;
proxyId = _arg1.proxyId;
stabbingCount = _arg1.stabbingCount;
_arg1.value = _local2;
_arg1.proxyId = _local3;
_arg1.stabbingCount = _local4;
}
public function IsLower():Boolean{
return (((value & 1) == 0));
}
public function IsUpper():Boolean{
return (((value & 1) == 1));
}
}
}//package Box2D.Collision
Section 25
//b2BoundValues (Box2D.Collision.b2BoundValues)
package Box2D.Collision {
public class b2BoundValues {
public var lowerValues:Array;
public var upperValues:Array;
public function b2BoundValues(){
lowerValues = [0, 0];
upperValues = [0, 0];
super();
}
}
}//package Box2D.Collision
Section 26
//b2BroadPhase (Box2D.Collision.b2BroadPhase)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2BroadPhase {
public var m_quantizationFactor:b2Vec2;
public var m_worldAABB:b2AABB;
public var m_bounds:Array;
public var m_freeProxy:uint;
public var m_proxyCount:int;
public var m_proxyPool:Array;
public var m_queryResultCount:int;
public var m_pairManager:b2PairManager;
public var m_timeStamp:uint;
public var m_queryResults:Array;
public static const b2_nullEdge:uint = b2Settings.USHRT_MAX;
public static const b2_invalid:uint = b2Settings.USHRT_MAX;
public static var s_validate:Boolean = false;
public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:b2Proxy;
var _local7:int;
m_pairManager = new b2PairManager();
m_proxyPool = new Array(b2Settings.b2_maxPairs);
m_bounds = new Array((2 * b2Settings.b2_maxProxies));
m_queryResults = new Array(b2Settings.b2_maxProxies);
m_quantizationFactor = new b2Vec2();
super();
m_pairManager.Initialize(this, _arg2);
m_worldAABB = _arg1;
m_proxyCount = 0;
_local3 = 0;
while (_local3 < b2Settings.b2_maxProxies) {
m_queryResults[_local3] = 0;
_local3++;
};
m_bounds = new Array(2);
_local3 = 0;
while (_local3 < 2) {
m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies));
_local7 = 0;
while (_local7 < (2 * b2Settings.b2_maxProxies)) {
m_bounds[_local3][_local7] = new b2Bound();
_local7++;
};
_local3++;
};
_local4 = (_arg1.upperBound.x - _arg1.lowerBound.x);
_local5 = (_arg1.upperBound.y - _arg1.lowerBound.y);
m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4);
m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5);
_local3 = 0;
while (_local3 < (b2Settings.b2_maxProxies - 1)) {
_local6 = new b2Proxy();
m_proxyPool[_local3] = _local6;
_local6.SetNext((_local3 + 1));
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
_local3++;
};
_local6 = new b2Proxy();
m_proxyPool[int((b2Settings.b2_maxProxies - 1))] = _local6;
_local6.SetNext(b2Pair.b2_nullProxy);
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
m_freeProxy = 0;
m_timeStamp = 1;
m_queryResultCount = 0;
}
public function QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{
var _local4:Array;
var _local5:Array;
var _local6:uint;
var _local7:uint;
var _local8:Array;
var _local9:Array;
var _local10:int;
var _local11:int;
var _local12:b2Proxy;
_local4 = new Array();
_local5 = new Array();
ComputeBounds(_local4, _local5, _arg1);
_local8 = [_local6];
_local9 = [_local7];
Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0);
Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1);
_local10 = 0;
_local11 = 0;
while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) {
_local12 = m_proxyPool[m_queryResults[_local11]];
_arg2[_local11] = _local12.userData;
_local11++;
_local10++;
};
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local10);
}
public function Commit():void{
m_pairManager.Commit();
}
public function GetProxy(_arg1:int):b2Proxy{
var _local2:b2Proxy;
_local2 = m_proxyPool[_arg1];
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((_local2.IsValid() == false)))){
return (null);
};
return (_local2);
}
private function IncrementTimeStamp():void{
var _local1:uint;
if (m_timeStamp == b2Settings.USHRT_MAX){
_local1 = 0;
while (_local1 < b2Settings.b2_maxProxies) {
(m_proxyPool[_local1] as b2Proxy).timeStamp = 0;
_local1++;
};
m_timeStamp = 1;
} else {
m_timeStamp++;
};
}
private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{
var _local8:uint;
var _local9:uint;
var _local10:b2Bound;
var _local11:uint;
var _local12:int;
var _local13:int;
var _local14:b2Proxy;
_local8 = BinarySearch(_arg5, _arg6, _arg3);
_local9 = BinarySearch(_arg5, _arg6, _arg4);
_local11 = _local8;
while (_local11 < _local9) {
_local10 = _arg5[_local11];
if (_local10.IsLower()){
IncrementOverlapCount(_local10.proxyId);
};
_local11++;
};
if (_local8 > 0){
_local12 = (_local8 - 1);
_local10 = _arg5[_local12];
_local13 = _local10.stabbingCount;
while (_local13) {
_local10 = _arg5[_local12];
if (_local10.IsLower()){
_local14 = m_proxyPool[_local10.proxyId];
if (_local8 <= _local14.upperBounds[_arg7]){
IncrementOverlapCount(_local10.proxyId);
_local13--;
};
};
_local12--;
};
};
_arg1[0] = _local8;
_arg2[0] = _local9;
}
private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{
var _local3:int;
var _local4:Array;
var _local5:b2Bound;
var _local6:b2Bound;
_local3 = 0;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg1.lowerBounds[_local3]];
_local6 = _local4[_arg2.upperBounds[_local3]];
if (_local5.value > _local6.value){
return (false);
};
_local5 = _local4[_arg1.upperBounds[_local3]];
_local6 = _local4[_arg2.lowerBounds[_local3]];
if (_local5.value < _local6.value){
return (false);
};
_local3++;
};
return (true);
}
private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local4 = _arg3.lowerBound.x;
_local5 = _arg3.lowerBound.y;
_local4 = b2Math.b2Min(_local4, m_worldAABB.upperBound.x);
_local5 = b2Math.b2Min(_local5, m_worldAABB.upperBound.y);
_local4 = b2Math.b2Max(_local4, m_worldAABB.lowerBound.x);
_local5 = b2Math.b2Max(_local5, m_worldAABB.lowerBound.y);
_local6 = _arg3.upperBound.x;
_local7 = _arg3.upperBound.y;
_local6 = b2Math.b2Min(_local6, m_worldAABB.upperBound.x);
_local7 = b2Math.b2Min(_local7, m_worldAABB.upperBound.y);
_local6 = b2Math.b2Max(_local6, m_worldAABB.lowerBound.x);
_local7 = b2Math.b2Max(_local7, m_worldAABB.lowerBound.y);
_arg1[0] = (uint((m_quantizationFactor.x * (_local4 - m_worldAABB.lowerBound.x))) & (b2Settings.USHRT_MAX - 1));
_arg2[0] = ((uint((m_quantizationFactor.x * (_local6 - m_worldAABB.lowerBound.x))) & 0xFFFF) | 1);
_arg1[1] = (uint((m_quantizationFactor.y * (_local5 - m_worldAABB.lowerBound.y))) & (b2Settings.USHRT_MAX - 1));
_arg2[1] = ((uint((m_quantizationFactor.y * (_local7 - m_worldAABB.lowerBound.y))) & 0xFFFF) | 1);
}
public function CreateProxy(_arg1:b2AABB, _arg2):uint{
var _local3:uint;
var _local4:b2Proxy;
var _local5:uint;
var _local6:uint;
var _local7:Array;
var _local8:Array;
var _local9:int;
var _local10:int;
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;
_local5 = m_freeProxy;
_local4 = m_proxyPool[_local5];
m_freeProxy = _local4.GetNext();
_local4.overlapCount = 0;
_local4.userData = _arg2;
_local6 = (2 * m_proxyCount);
_local7 = new Array();
_local8 = new Array();
ComputeBounds(_local7, _local8, _arg1);
_local9 = 0;
while (_local9 < 2) {
_local11 = m_bounds[_local9];
_local14 = [_local12];
_local15 = [_local13];
Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9);
_local12 = _local14[0];
_local13 = _local15[0];
_local16 = new Array();
_local18 = (_local6 - _local13);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local13 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local13 + 2);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local16 = new Array();
_local18 = (_local13 - _local12);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local12 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local12 + 1);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local13++;
_local19 = _local11[_local12];
_local20 = _local11[_local13];
_local19.value = _local7[_local9];
_local19.proxyId = _local5;
_local20.value = _local8[_local9];
_local20.proxyId = _local5;
_local21 = _local11[int((_local12 - 1))];
_local19.stabbingCount = ((_local12 == 0)) ? 0 : _local21.stabbingCount;
_local21 = _local11[int((_local13 - 1))];
_local20.stabbingCount = _local21.stabbingCount;
_local3 = _local12;
while (_local3 < _local13) {
_local21 = _local11[_local3];
_local21.stabbingCount++;
_local3++;
};
_local3 = _local12;
while (_local3 < (_local6 + 2)) {
_local19 = _local11[_local3];
_local23 = m_proxyPool[_local19.proxyId];
if (_local19.IsLower()){
_local23.lowerBounds[_local9] = _local3;
} else {
_local23.upperBounds[_local9] = _local3;
};
_local3++;
};
_local9++;
};
m_proxyCount++;
_local10 = 0;
while (_local10 < m_queryResultCount) {
m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]);
_local10++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local5);
}
public function DestroyProxy(_arg1:uint):void{
var _local2:b2Bound;
var _local3:b2Bound;
var _local4:b2Proxy;
var _local5:int;
var _local6:int;
var _local7:int;
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;
_local4 = m_proxyPool[_arg1];
_local5 = (2 * m_proxyCount);
_local6 = 0;
while (_local6 < 2) {
_local8 = m_bounds[_local6];
_local9 = _local4.lowerBounds[_local6];
_local10 = _local4.upperBounds[_local6];
_local2 = _local8[_local9];
_local11 = _local2.value;
_local3 = _local8[_local10];
_local12 = _local3.value;
_local13 = new Array();
_local15 = ((_local10 - _local9) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local9 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = _local9;
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local13 = new Array();
_local15 = ((_local5 - _local10) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local10 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = (_local10 - 1);
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = (_local5 - 2);
_local17 = _local9;
while (_local17 < _local15) {
_local2 = _local8[_local17];
_local19 = m_proxyPool[_local2.proxyId];
if (_local2.IsLower()){
_local19.lowerBounds[_local6] = _local17;
} else {
_local19.upperBounds[_local6] = _local17;
};
_local17++;
};
_local15 = (_local10 - 1);
_local18 = _local9;
while (_local18 < _local15) {
_local2 = _local8[_local18];
_local2.stabbingCount--;
_local18++;
};
Query([0], [0], _local11, _local12, _local8, (_local5 - 2), _local6);
_local6++;
};
_local7 = 0;
while (_local7 < m_queryResultCount) {
m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local7]);
_local7++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
_local4.userData = null;
_local4.overlapCount = b2_invalid;
_local4.lowerBounds[0] = b2_invalid;
_local4.lowerBounds[1] = b2_invalid;
_local4.upperBounds[0] = b2_invalid;
_local4.upperBounds[1] = b2_invalid;
_local4.SetNext(m_freeProxy);
m_freeProxy = _arg1;
m_proxyCount--;
}
public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{
var _local3:int;
var _local4:Array;
var _local5:b2Bound;
_local3 = 0;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg2.upperBounds[_local3]];
if (_arg1.lowerValues[_local3] > _local5.value){
return (false);
};
_local5 = _local4[_arg2.lowerBounds[_local3]];
if (_arg1.upperValues[_local3] < _local5.value){
return (false);
};
_local3++;
};
return (true);
}
public function Validate():void{
var _local1:b2Pair;
var _local2:b2Proxy;
var _local3:b2Proxy;
var _local4:Boolean;
var _local5:int;
var _local6:b2Bound;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local10:b2Bound;
_local5 = 0;
while (_local5 < 2) {
_local6 = m_bounds[_local5];
_local7 = (2 * m_proxyCount);
_local8 = 0;
_local9 = 0;
while (_local9 < _local7) {
_local10 = _local6[_local9];
if (_local10.IsLower() == true){
_local8++;
} else {
_local8--;
};
_local9++;
};
_local5++;
};
}
private function IncrementOverlapCount(_arg1:uint):void{
var _local2:b2Proxy;
_local2 = m_proxyPool[_arg1];
if (_local2.timeStamp < m_timeStamp){
_local2.timeStamp = m_timeStamp;
_local2.overlapCount = 1;
} else {
_local2.overlapCount = 2;
m_queryResults[m_queryResultCount] = _arg1;
m_queryResultCount++;
};
}
public function InRange(_arg1:b2AABB):Boolean{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = _arg1.lowerBound.x;
_local3 = _arg1.lowerBound.y;
_local2 = (_local2 - m_worldAABB.upperBound.x);
_local3 = (_local3 - m_worldAABB.upperBound.y);
_local4 = m_worldAABB.lowerBound.x;
_local5 = m_worldAABB.lowerBound.y;
_local4 = (_local4 - _arg1.upperBound.x);
_local5 = (_local5 - _arg1.upperBound.y);
_local2 = b2Math.b2Max(_local2, _local4);
_local3 = b2Math.b2Max(_local3, _local5);
return ((b2Math.b2Max(_local2, _local3) < 0));
}
public function MoveProxy(_arg1:uint, _arg2:b2AABB):void{
var _local3:Array;
var _local4:int;
var _local5:uint;
var _local6:uint;
var _local7:b2Bound;
var _local8:b2Bound;
var _local9:b2Bound;
var _local10:uint;
var _local11:b2Proxy;
var _local12:uint;
var _local13:b2Proxy;
var _local14:b2BoundValues;
var _local15:b2BoundValues;
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;
};
_local12 = (2 * m_proxyCount);
_local13 = m_proxyPool[_arg1];
_local14 = new b2BoundValues();
ComputeBounds(_local14.lowerValues, _local14.upperValues, _arg2);
_local15 = new b2BoundValues();
_local5 = 0;
while (_local5 < 2) {
_local7 = m_bounds[_local5][_local13.lowerBounds[_local5]];
_local15.lowerValues[_local5] = _local7.value;
_local7 = m_bounds[_local5][_local13.upperBounds[_local5]];
_local15.upperValues[_local5] = _local7.value;
_local5++;
};
_local5 = 0;
while (_local5 < 2) {
_local16 = m_bounds[_local5];
_local17 = _local13.lowerBounds[_local5];
_local18 = _local13.upperBounds[_local5];
_local19 = _local14.lowerValues[_local5];
_local20 = _local14.upperValues[_local5];
_local7 = _local16[_local17];
_local21 = (_local19 - _local7.value);
_local7.value = _local19;
_local7 = _local16[_local18];
_local22 = (_local20 - _local7.value);
_local7.value = _local20;
if (_local21 < 0){
_local6 = _local17;
while ((((_local6 > 0)) && ((_local19 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local8.proxyId];
_local8.stabbingCount++;
if (_local8.IsUpper() == true){
if (TestOverlap(_local14, _local24)){
m_pairManager.AddBufferedPair(_arg1, _local23);
};
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
if (_local22 > 0){
_local6 = _local18;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local20)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount++;
if (_local9.IsLower() == true){
if (TestOverlap(_local14, _local11)){
m_pairManager.AddBufferedPair(_arg1, _local10);
};
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local21 > 0){
_local6 = _local17;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local19)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount--;
if (_local9.IsUpper()){
if (TestOverlap(_local15, _local11)){
m_pairManager.RemoveBufferedPair(_arg1, _local10);
};
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local22 < 0){
_local6 = _local18;
while ((((_local6 > 0)) && ((_local20 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local23];
_local8.stabbingCount--;
if (_local8.IsLower() == true){
if (TestOverlap(_local15, _local24)){
m_pairManager.RemoveBufferedPair(_arg1, _local23);
};
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
_local5++;
};
}
public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:b2Bound;
_local4 = 0;
_local5 = (_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 27
//b2BufferedPair (Box2D.Collision.b2BufferedPair)
package Box2D.Collision {
public class b2BufferedPair {
public var proxyId1:uint;
public var proxyId2:uint;
}
}//package Box2D.Collision
Section 28
//b2Collision (Box2D.Collision.b2Collision)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Collision {
public static const b2_nullFeature:uint = 0xFF;
private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2();
public static function EdgeSeparation(_arg1:b2PolygonShape, _arg2:b2XForm, _arg3:int, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local6:int;
var _local7:Array;
var _local8:Array;
var _local9:int;
var _local10:Array;
var _local11:b2Mat22;
var _local12:b2Vec2;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:int;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
_local6 = _arg1.m_vertexCount;
_local7 = _arg1.m_vertices;
_local8 = _arg1.m_normals;
_local9 = _arg4.m_vertexCount;
_local10 = _arg4.m_vertices;
_local11 = _arg2.R;
_local12 = _local8[_arg3];
_local13 = ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y));
_local14 = ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y));
_local11 = _arg5.R;
_local15 = ((_local11.col1.x * _local13) + (_local11.col1.y * _local14));
_local16 = ((_local11.col2.x * _local13) + (_local11.col2.y * _local14));
_local17 = 0;
_local18 = Number.MAX_VALUE;
_local19 = 0;
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;
_local20 = (_arg2.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
_local21 = (_arg2.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local12 = _local10[_local17];
_local11 = _arg5.R;
_local22 = (_arg5.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
_local23 = (_arg5.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local22 = (_local22 - _local20);
_local23 = (_local23 - _local21);
_local24 = ((_local22 * _local13) + (_local23 * _local14));
return (_local24);
}
public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local3 = _arg2.lowerBound;
_local4 = _arg1.upperBound;
_local5 = (_local3.x - _local4.x);
_local6 = (_local3.y - _local4.y);
_local3 = _arg1.lowerBound;
_local4 = _arg2.upperBound;
_local7 = (_local3.x - _local4.x);
_local8 = (_local3.y - _local4.y);
if ((((_local5 > 0)) || ((_local6 > 0)))){
return (false);
};
if ((((_local7 > 0)) || ((_local8 > 0)))){
return (false);
};
return (true);
}
public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:int, _arg5:b2PolygonShape, _arg6:b2XForm):void{
var _local7:int;
var _local8:Array;
var _local9:int;
var _local10:Array;
var _local11:Array;
var _local12:b2Mat22;
var _local13:b2Vec2;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:int;
var _local20:ClipVertex;
var _local21:int;
var _local22:int;
var _local23:Number;
_local7 = _arg2.m_vertexCount;
_local8 = _arg2.m_normals;
_local9 = _arg5.m_vertexCount;
_local10 = _arg5.m_vertices;
_local11 = _arg5.m_normals;
_local12 = _arg3.R;
_local13 = _local8[_arg4];
_local14 = ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y));
_local15 = ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y));
_local12 = _arg6.R;
_local16 = ((_local12.col1.x * _local14) + (_local12.col1.y * _local15));
_local15 = ((_local12.col2.x * _local14) + (_local12.col2.y * _local15));
_local14 = _local16;
_local17 = 0;
_local18 = Number.MAX_VALUE;
_local19 = 0;
while (_local19 < _local9) {
_local13 = _local11[_local19];
_local23 = ((_local14 * _local13.x) + (_local15 * _local13.y));
if (_local23 < _local18){
_local18 = _local23;
_local17 = _local19;
};
_local19++;
};
_local21 = _local17;
_local22 = (((_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 _local7:int;
var _local8:Array;
var _local9:Number;
var _local10:int;
var _local11:Array;
var _local12:Number;
var _local13:b2PolygonShape;
var _local14:b2PolygonShape;
var _local15:b2XForm;
var _local16:b2XForm;
var _local17:int;
var _local18:uint;
var _local19:Number;
var _local20:Number;
var _local21:Array;
var _local22:int;
var _local23:Array;
var _local24:b2Vec2;
var _local25:b2Vec2;
var _local26:b2Vec2;
var _local27:b2Vec2;
var _local28:b2Vec2;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Array;
var _local33:Array;
var _local34:int;
var _local35:int;
var _local36:int;
var _local37:b2Vec2;
var _local38:Number;
var _local39:b2ManifoldPoint;
_arg1.pointCount = 0;
_local7 = 0;
_local8 = [_local7];
_local9 = FindMaxSeparation(_local8, _arg2, _arg3, _arg4, _arg5);
_local7 = _local8[0];
if (_local9 > 0){
return;
};
_local10 = 0;
_local11 = [_local10];
_local12 = FindMaxSeparation(_local11, _arg4, _arg5, _arg2, _arg3);
_local10 = _local11[0];
if (_local12 > 0){
return;
};
_local15 = new b2XForm();
_local16 = new b2XForm();
_local19 = 0.98;
_local20 = 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;
};
_local21 = [new ClipVertex(), new ClipVertex()];
FindIncidentEdge(_local21, _local13, _local15, _local17, _local14, _local16);
_local22 = _local13.m_vertexCount;
_local23 = _local13.m_vertices;
_local24 = _local23[_local17];
_local25 = _local24.Copy();
if ((_local17 + 1) < _local22){
_local24 = _local23[int((_local17 + 1))];
_local37 = _local24.Copy();
} else {
_local24 = _local23[0];
_local37 = _local24.Copy();
};
_local26 = b2Math.SubtractVV(_local37, _local25);
_local27 = b2Math.b2MulMV(_local15.R, b2Math.SubtractVV(_local37, _local25));
_local27.Normalize();
_local28 = b2Math.b2CrossVF(_local27, 1);
_local25 = b2Math.b2MulX(_local15, _local25);
_local37 = b2Math.b2MulX(_local15, _local37);
_local29 = b2Math.b2Dot(_local28, _local25);
_local30 = -(b2Math.b2Dot(_local27, _local25));
_local31 = b2Math.b2Dot(_local27, _local37);
_local32 = [new ClipVertex(), new ClipVertex()];
_local33 = [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();
_local35 = 0;
_local36 = 0;
while (_local36 < b2Settings.b2_maxManifoldPoints) {
_local6 = _local33[_local36];
_local38 = (b2Math.b2Dot(_local28, _local6.v) - _local29);
if (_local38 <= 0){
_local39 = _arg1.points[_local35];
_local39.separation = _local38;
_local39.localPoint1 = b2Math.b2MulXT(_arg3, _local6.v);
_local39.localPoint2 = b2Math.b2MulXT(_arg5, _local6.v);
_local39.id.key = _local6.id._key;
_local39.id.features.flip = _local18;
_local35++;
};
_local36++;
};
_arg1.pointCount = _local35;
}
public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local6:int;
var _local7:Array;
var _local8:b2Vec2;
var _local9:b2Mat22;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:int;
var _local15:Number;
var _local16:int;
var _local17:Number;
var _local18:int;
var _local19:Number;
var _local20:int;
var _local21:Number;
var _local22:int;
var _local23:Number;
var _local24:int;
var _local25:Number;
_local6 = _arg2.m_vertexCount;
_local7 = _arg2.m_normals;
_local9 = _arg5.R;
_local8 = _arg4.m_centroid;
_local10 = (_arg5.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y)));
_local11 = (_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))));
_local12 = ((_local10 * _arg3.R.col1.x) + (_local11 * _arg3.R.col1.y));
_local13 = ((_local10 * _arg3.R.col2.x) + (_local11 * _arg3.R.col2.y));
_local14 = 0;
_local15 = -(Number.MAX_VALUE);
_local16 = 0;
while (_local16 < _local6) {
_local8 = _local7[_local16];
_local25 = ((_local8.x * _local12) + (_local8.y * _local13));
if (_local25 > _local15){
_local15 = _local25;
_local14 = _local16;
};
_local16++;
};
_local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
_local18 = (((_local14 - 1) >= 0)) ? (_local14 - 1) : (_local6 - 1);
_local19 = EdgeSeparation(_arg2, _arg3, _local18, _arg4, _arg5);
if (_local19 > 0){
return (_local19);
};
_local20 = (((_local14 + 1) < _local6)) ? (_local14 + 1) : 0;
_local21 = EdgeSeparation(_arg2, _arg3, _local20, _arg4, _arg5);
if (_local21 > 0){
return (_local21);
};
if ((((_local19 > _local17)) && ((_local19 > _local21)))){
_local24 = -1;
_local22 = _local18;
_local23 = _local19;
} else {
if (_local21 > _local17){
_local24 = 1;
_local22 = _local20;
_local23 = _local21;
} else {
_arg1[0] = _local14;
return (_local17);
};
};
while (true) {
if (_local24 == -1){
_local14 = (((_local22 - 1) >= 0)) ? (_local22 - 1) : (_local6 - 1);
} else {
_local14 = (((_local22 + 1) < _local6)) ? (_local22 + 1) : 0;
};
_local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
if (_local17 > _local23){
_local22 = _local14;
_local23 = _local17;
} else {
break;
};
};
_arg1[0] = _local22;
return (_local23);
}
public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{
var _local5:ClipVertex;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:b2Vec2;
var _local13:ClipVertex;
_local6 = 0;
_local5 = _arg2[0];
_local7 = _local5.v;
_local5 = _arg2[1];
_local8 = _local5.v;
_local9 = (b2Math.b2Dot(_arg3, _local7) - _arg4);
_local10 = (b2Math.b2Dot(_arg3, _local8) - _arg4);
if (_local9 <= 0){
var _temp1 = _local6;
_local6 = (_local6 + 1);
var _local14 = _temp1;
_arg1[_local14] = _arg2[0];
};
if (_local10 <= 0){
var _temp2 = _local6;
_local6 = (_local6 + 1);
_local14 = _temp2;
_arg1[_local14] = _arg2[1];
};
if ((_local9 * _local10) < 0){
_local11 = (_local9 / (_local9 - _local10));
_local5 = _arg1[_local6];
_local12 = _local5.v;
_local12.x = (_local7.x + (_local11 * (_local8.x - _local7.x)));
_local12.y = (_local7.y + (_local11 * (_local8.y - _local7.y)));
_local5 = _arg1[_local6];
if (_local9 > 0){
_local13 = _arg2[0];
_local5.id = _local13.id;
} else {
_local13 = _arg2[1];
_local5.id = _local13.id;
};
_local6++;
};
return (_local6);
}
public static function b2CollideCircles(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2Mat22;
var _local7:b2Vec2;
var _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:b2ManifoldPoint;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
_arg1.pointCount = 0;
_local6 = _arg3.R;
_local7 = _arg2.m_localPosition;
_local8 = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
_local9 = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local6 = _arg5.R;
_local7 = _arg4.m_localPosition;
_local10 = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
_local11 = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local12 = (_local10 - _local8);
_local13 = (_local11 - _local9);
_local14 = ((_local12 * _local12) + (_local13 * _local13));
_local15 = _arg2.m_radius;
_local16 = _arg4.m_radius;
_local17 = (_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;
_local19 = _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));
_local20 = (0.5 * (_local8 + _local10));
_local21 = (0.5 * (_local9 + _local11));
_local22 = (_local20 - _arg3.position.x);
_local23 = (_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 _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:Number;
var _local20:Number;
var _local21:int;
var _local22:Array;
var _local23:Array;
var _local24:int;
var _local25:int;
var _local26:int;
var _local27:b2Vec2;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
_arg1.pointCount = 0;
_local12 = _arg5.R;
_local11 = _arg4.m_localPosition;
_local13 = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y)));
_local14 = (_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;
_local15 = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local16 = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local18 = 0;
_local19 = -(Number.MAX_VALUE);
_local20 = _arg4.m_radius;
_local21 = _arg2.m_vertexCount;
_local22 = _arg2.m_vertices;
_local23 = _arg2.m_normals;
_local24 = 0;
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;
};
_local25 = _local18;
_local26 = (((_local25 + 1) < _local21)) ? (_local25 + 1) : 0;
_local11 = _local22[_local25];
_local27 = _local22[_local26];
_local28 = (_local27.x - _local11.x);
_local29 = (_local27.y - _local11.y);
_local30 = Math.sqrt(((_local28 * _local28) + (_local29 * _local29)));
_local28 = (_local28 / _local30);
_local29 = (_local29 / _local30);
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local31 = ((_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 = 0;
};
};
_local7 = (_local15 - _local32);
_local8 = (_local16 - _local33);
_local17 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local7 = (_local7 / _local17);
_local8 = (_local8 / _local17);
if (_local17 > _local20){
return;
};
_arg1.pointCount = 1;
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local7) + (_local12.col2.x * _local8));
_arg1.normal.y = ((_local12.col1.y * _local7) + (_local12.col2.y * _local8));
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local17 - _local20);
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
}
}
}//package Box2D.Collision
Section 29
//b2ContactID (Box2D.Collision.b2ContactID)
package Box2D.Collision {
public class b2ContactID {
public var _key:uint;
public var features:Features;
public function b2ContactID(){
features = new Features();
super();
features._m_id = this;
}
public function Set(_arg1:b2ContactID):void{
key = _arg1._key;
}
public function Copy():b2ContactID{
var _local1:b2ContactID;
_local1 = new b2ContactID();
_local1.key = key;
return (_local1);
}
public function get key():uint{
return (_key);
}
public function set key(_arg1:uint):void{
_key = _arg1;
features._referenceEdge = (_key & 0xFF);
features._incidentEdge = (((_key & 0xFF00) >> 8) & 0xFF);
features._incidentVertex = (((_key & 0xFF0000) >> 16) & 0xFF);
features._flip = (((_key & 4278190080) >> 24) & 0xFF);
}
}
}//package Box2D.Collision
Section 30
//b2ContactPoint (Box2D.Collision.b2ContactPoint)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class b2ContactPoint {
public var separation:Number;
public var normal:b2Vec2;
public var position:b2Vec2;
public var restitution:Number;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var id:b2ContactID;
public var friction:Number;
public var velocity:b2Vec2;
public function b2ContactPoint(){
position = new b2Vec2();
velocity = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 31
//b2Distance (Box2D.Collision.b2Distance)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Distance {
private static var s_p2s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var s_p1s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var s_points:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()];
private static var gPoint:b2Point = new b2Point();
public static var g_GJK_Iterations:int = 0;
public static function InPoints(_arg1:b2Vec2, _arg2:Array, _arg3:int):Boolean{
var _local4:Number;
var _local5:int;
var _local6:b2Vec2;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local4 = (100 * Number.MIN_VALUE);
_local5 = 0;
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 _local8:Array;
var _local9:Array;
var _local10:Array;
var _local11:int;
var _local12:Number;
var _local13:int;
var _local14:int;
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;
_local8 = s_p1s;
_local9 = s_p2s;
_local10 = s_points;
_local11 = 0;
_arg1.SetV(_arg3.GetFirstVertex(_arg4));
_arg2.SetV(_arg5.GetFirstVertex(_arg6));
_local12 = 0;
_local13 = 20;
_local14 = 0;
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 - ((_local15 * _local19) + (_local16 * _local20))) <= (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 _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;
_local7 = _arg4.R;
_local8 = _arg3.m_localPosition;
_local9 = (_arg4.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local10 = (_arg4.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local7 = _arg6.R;
_local8 = _arg5.m_localPosition;
_local11 = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local12 = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local13 = (_local11 - _local9);
_local14 = (_local12 - _local10);
_local15 = ((_local13 * _local13) + (_local14 * _local14));
_local16 = (_arg3.m_radius - b2Settings.b2_toiSlop);
_local17 = (_arg5.m_radius - b2Settings.b2_toiSlop);
_local18 = (_local16 + _local17);
if (_local15 > (_local18 * _local18)){
_local19 = Math.sqrt(((_local13 * _local13) + (_local14 * _local14)));
_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(((_local13 * _local13) + (_local14 * _local14)));
_local13 = (_local13 / _local19);
_local14 = (_local14 / _local19);
_arg1.x = (_local9 + (_local16 * _local13));
_arg1.y = (_local10 + (_local16 * _local14));
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
};
_arg1.x = _local9;
_arg1.y = _local10;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
}
public static function ProcessThree(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:b2Vec2;
var _local13:b2Vec2;
var _local14:b2Vec2;
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 _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 _local39:Number;
var _local40:Number;
var _local41:Number;
_local6 = _arg5[0];
_local7 = _arg5[1];
_local8 = _arg5[2];
_local9 = _arg3[0];
_local10 = _arg3[1];
_local11 = _arg3[2];
_local12 = _arg4[0];
_local13 = _arg4[1];
_local14 = _arg4[2];
_local15 = _local6.x;
_local16 = _local6.y;
_local17 = _local7.x;
_local18 = _local7.y;
_local19 = _local8.x;
_local20 = _local8.y;
_local21 = (_local17 - _local15);
_local22 = (_local18 - _local16);
_local23 = (_local19 - _local15);
_local24 = (_local20 - _local16);
_local25 = (_local19 - _local17);
_local26 = (_local20 - _local18);
_local27 = -(((_local15 * _local21) + (_local16 * _local22)));
_local28 = ((_local17 * _local21) + (_local18 * _local22));
_local29 = -(((_local15 * _local23) + (_local16 * _local24)));
_local30 = ((_local19 * _local23) + (_local20 * _local24));
_local31 = -(((_local17 * _local25) + (_local18 * _local26)));
_local32 = ((_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);
};
_local33 = ((_local21 * _local24) - (_local22 * _local23));
_local34 = (_local33 * ((_local15 * _local18) - (_local16 * _local17)));
_local36 = (_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);
};
_local37 = (_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);
};
_local38 = ((_local36 + _local37) + _local34);
_local38 = (1 / _local38);
_local39 = (_local36 * _local38);
_local40 = (_local37 * _local38);
_local41 = ((1 - _local39) - _local40);
_arg1.x = (((_local39 * _local9.x) + (_local40 * _local10.x)) + (_local41 * _local11.x));
_arg1.y = (((_local39 * _local9.y) + (_local40 * _local10.y)) + (_local41 * _local11.y));
_arg2.x = (((_local39 * _local12.x) + (_local40 * _local13.x)) + (_local41 * _local14.x));
_arg2.y = (((_local39 * _local12.y) + (_local40 * _local13.y)) + (_local41 * _local14.y));
return (3);
}
public static function DistancePC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2PolygonShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local9:b2Point;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
_local9 = 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)));
_local10 = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _local9, b2Math.b2XForm_identity);
_local11 = (_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;
var _local8:int;
_local7 = _arg3.m_type;
_local8 = _arg5.m_type;
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistanceCC(_arg1, _arg2, (_arg3 as b2CircleShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistancePC(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistancePC(_arg2, _arg1, (_arg5 as b2PolygonShape), _arg6, (_arg3 as b2CircleShape), _arg4));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistanceGeneric(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2PolygonShape), _arg6));
};
return (0);
}
public static function ProcessTwo(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
_local6 = _arg5[0];
_local7 = _arg5[1];
_local8 = _arg3[0];
_local9 = _arg3[1];
_local10 = _arg4[0];
_local11 = _arg4[1];
_local12 = -(_local7.x);
_local13 = -(_local7.y);
_local14 = (_local6.x - _local7.x);
_local15 = (_local6.y - _local7.y);
_local16 = Math.sqrt(((_local14 * _local14) + (_local15 * _local15)));
_local14 = (_local14 / _local16);
_local15 = (_local15 / _local16);
_local17 = ((_local12 * _local14) + (_local13 * _local15));
if ((((_local17 <= 0)) || ((_local16 < Number.MIN_VALUE)))){
_arg1.SetV(_local9);
_arg2.SetV(_local11);
_local8.SetV(_local9);
_local10.SetV(_local11);
_local6.SetV(_local7);
return (1);
};
_local17 = (_local17 / _local16);
_arg1.x = (_local9.x + (_local17 * (_local8.x - _local9.x)));
_arg1.y = (_local9.y + (_local17 * (_local8.y - _local9.y)));
_arg2.x = (_local11.x + (_local17 * (_local10.x - _local11.x)));
_arg2.y = (_local11.y + (_local17 * (_local10.y - _local11.y)));
return (2);
}
}
}//package Box2D.Collision
Section 32
//b2Manifold (Box2D.Collision.b2Manifold)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Manifold {
public var points:Array;
public var pointCount:int;// = 0
public var normal:b2Vec2;
public function b2Manifold(){
var _local1:int;
pointCount = 0;
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ManifoldPoint();
_local1++;
};
normal = new b2Vec2();
}
public function Set(_arg1:b2Manifold):void{
var _local2:int;
pointCount = _arg1.pointCount;
_local2 = 0;
while (_local2 < b2Settings.b2_maxManifoldPoints) {
(points[_local2] as b2ManifoldPoint).Set(_arg1.points[_local2]);
_local2++;
};
normal.SetV(_arg1.normal);
}
public function Reset():void{
var _local1:int;
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
(points[_local1] as b2ManifoldPoint).Reset();
_local1++;
};
normal.SetZero();
pointCount = 0;
}
}
}//package Box2D.Collision
Section 33
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2ManifoldPoint {
public var separation:Number;
public var localPoint2:b2Vec2;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var localPoint1:b2Vec2;
public var id:b2ContactID;
public function b2ManifoldPoint(){
localPoint1 = new b2Vec2();
localPoint2 = new b2Vec2();
id = new b2ContactID();
super();
}
public function Set(_arg1:b2ManifoldPoint):void{
localPoint1.SetV(_arg1.localPoint1);
localPoint2.SetV(_arg1.localPoint2);
separation = _arg1.separation;
normalImpulse = _arg1.normalImpulse;
tangentImpulse = _arg1.tangentImpulse;
id.key = _arg1.id.key;
}
public function Reset():void{
localPoint1.SetZero();
localPoint2.SetZero();
separation = 0;
normalImpulse = 0;
tangentImpulse = 0;
id.key = 0;
}
}
}//package Box2D.Collision
Section 34
//b2OBB (Box2D.Collision.b2OBB)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2OBB {
public var R:b2Mat22;
public var center:b2Vec2;
public var extents:b2Vec2;
public function b2OBB(){
R = new b2Mat22();
center = new b2Vec2();
extents = new b2Vec2();
super();
}
}
}//package Box2D.Collision
Section 35
//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 status:uint;
public var next:uint;
public static var e_pairFinal:uint = 4;
public static var b2_tableMask:int = (b2_tableCapacity - 1);
public static var e_pairRemoved:uint = 2;
public static var b2_nullPair:uint = b2Settings.USHRT_MAX;
public static var e_pairBuffered:uint = 1;
public static var b2_nullProxy:uint = b2Settings.USHRT_MAX;
public static var b2_tableCapacity:int = b2Settings.b2_maxPairs;
public function b2Pair(){
userData = null;
super();
}
public function SetBuffered():void{
status = (status | e_pairBuffered);
}
public function IsBuffered():Boolean{
return (((status & e_pairBuffered) == e_pairBuffered));
}
public function IsFinal():Boolean{
return (((status & e_pairFinal) == e_pairFinal));
}
public function ClearRemoved():void{
status = (status & ~(e_pairRemoved));
}
public function SetFinal():void{
status = (status | e_pairFinal);
}
public function IsRemoved():Boolean{
return (((status & e_pairRemoved) == e_pairRemoved));
}
public function ClearBuffered():void{
status = (status & ~(e_pairBuffered));
}
public function SetRemoved():void{
status = (status | e_pairRemoved);
}
}
}//package Box2D.Collision
Section 36
//b2PairCallback (Box2D.Collision.b2PairCallback)
package Box2D.Collision {
public class b2PairCallback {
public function PairRemoved(_arg1, _arg2, _arg3):void{
}
public function PairAdded(_arg1, _arg2){
return (null);
}
}
}//package Box2D.Collision
Section 37
//b2PairManager (Box2D.Collision.b2PairManager)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PairManager {
public var m_pairCount:int;
public var m_pairBuffer:Array;
public var m_callback:b2PairCallback;
public var m_pairs:Array;
public var m_pairBufferCount:int;
public var m_hashTable:Array;
public var m_broadPhase:b2BroadPhase;
public var m_freePair:uint;
public function b2PairManager(){
var _local1:uint;
super();
m_hashTable = new Array(b2Pair.b2_tableCapacity);
_local1 = 0;
while (_local1 < b2Pair.b2_tableCapacity) {
m_hashTable[_local1] = b2Pair.b2_nullPair;
_local1++;
};
m_pairs = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1] = new b2Pair();
_local1++;
};
m_pairBuffer = new Array(b2Settings.b2_maxPairs);
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairBuffer[_local1] = new b2BufferedPair();
_local1++;
};
_local1 = 0;
while (_local1 < b2Settings.b2_maxPairs) {
m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy;
m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy;
m_pairs[_local1].userData = null;
m_pairs[_local1].status = 0;
m_pairs[_local1].next = (_local1 + 1);
_local1++;
};
m_pairs[int((b2Settings.b2_maxPairs - 1))].next = b2Pair.b2_nullPair;
m_pairCount = 0;
m_pairBufferCount = 0;
}
private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{
var _local4:b2Pair;
var _local5:uint;
_local5 = m_hashTable[_arg3];
_local4 = m_pairs[_local5];
while (((!((_local5 == b2Pair.b2_nullPair))) && ((Equals(_local4, _arg1, _arg2) == false)))) {
_local5 = _local4.next;
_local4 = m_pairs[_local5];
};
if (_local5 == b2Pair.b2_nullPair){
return (null);
};
return (_local4);
}
private function Find(_arg1:uint, _arg2:uint):b2Pair{
var _local3:uint;
var _local4:uint;
if (_arg1 > _arg2){
_local4 = _arg1;
_arg1 = _arg2;
_arg2 = _local4;
};
_local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
return (FindHash(_arg1, _arg2, _local3));
}
private function ValidateBuffer():void{
}
public function Commit():void{
var _local1:b2BufferedPair;
var _local2:int;
var _local3:int;
var _local4:Array;
var _local5:b2Pair;
var _local6:b2Proxy;
var _local7:b2Proxy;
_local3 = 0;
_local4 = m_broadPhase.m_proxyPool;
_local2 = 0;
while (_local2 < m_pairBufferCount) {
_local1 = m_pairBuffer[_local2];
_local5 = Find(_local1.proxyId1, _local1.proxyId2);
_local5.ClearBuffered();
_local6 = _local4[_local5.proxyId1];
_local7 = _local4[_local5.proxyId2];
if (_local5.IsRemoved()){
if (_local5.IsFinal() == true){
m_callback.PairRemoved(_local6.userData, _local7.userData, _local5.userData);
};
_local1 = m_pairBuffer[_local3];
_local1.proxyId1 = _local5.proxyId1;
_local1.proxyId2 = _local5.proxyId2;
_local3++;
} else {
if (_local5.IsFinal() == false){
_local5.userData = m_callback.PairAdded(_local6.userData, _local7.userData);
_local5.SetFinal();
};
};
_local2++;
};
_local2 = 0;
while (_local2 < _local3) {
_local1 = m_pairBuffer[_local2];
RemovePair(_local1.proxyId1, _local1.proxyId2);
_local2++;
};
m_pairBufferCount = 0;
if (b2BroadPhase.s_validate){
ValidateTable();
};
}
public function RemoveBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair;
_local4 = Find(_arg1, _arg2);
if (_local4 == null){
return;
};
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.SetRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function RemovePair(_arg1:uint, _arg2:uint){
var _local3:b2Pair;
var _local4:uint;
var _local5:uint;
var _local6:b2Pair;
var _local7:uint;
var _local8:uint;
var _local9:*;
if (_arg1 > _arg2){
_local7 = _arg1;
_arg1 = _arg2;
_arg2 = _local7;
};
_local4 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
_local5 = m_hashTable[_local4];
_local6 = null;
while (_local5 != b2Pair.b2_nullPair) {
if (Equals(m_pairs[_local5], _arg1, _arg2)){
_local8 = _local5;
_local3 = m_pairs[_local5];
if (_local6){
_local6.next = _local3.next;
} else {
m_hashTable[_local4] = _local3.next;
};
_local3 = m_pairs[_local8];
_local9 = _local3.userData;
_local3.next = m_freePair;
_local3.proxyId1 = b2Pair.b2_nullProxy;
_local3.proxyId2 = b2Pair.b2_nullProxy;
_local3.userData = null;
_local3.status = 0;
m_freePair = _local8;
m_pairCount--;
return (_local9);
} else {
_local6 = m_pairs[_local5];
_local5 = _local6.next;
};
};
return (null);
}
public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{
m_broadPhase = _arg1;
m_callback = _arg2;
}
public function AddBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair;
_local4 = AddPair(_arg1, _arg2);
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.ClearRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function AddPair(_arg1:uint, _arg2:uint):b2Pair{
var _local3:uint;
var _local4:b2Pair;
var _local5:uint;
var _local6:uint;
if (_arg1 > _arg2){
_local6 = _arg1;
_arg1 = _arg2;
_arg2 = _local6;
};
_local3 = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
_local4 = FindHash(_arg1, _arg2, _local3);
if (_local4 != null){
return (_local4);
};
_local5 = m_freePair;
_local4 = m_pairs[_local5];
m_freePair = _local4.next;
_local4.proxyId1 = _arg1;
_local4.proxyId2 = _arg2;
_local4.status = 0;
_local4.userData = null;
_local4.next = m_hashTable[_local3];
m_hashTable[_local3] = _local5;
m_pairCount++;
return (_local4);
}
private function ValidateTable():void{
}
public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{
return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2))));
}
public static function Hash(_arg1:uint, _arg2:uint):uint{
var _local3:uint;
_local3 = (((_arg2 << 16) & 4294901760) | _arg1);
_local3 = (~(_local3) + ((_local3 << 15) & 4294934528));
_local3 = (_local3 ^ ((_local3 >> 12) & 1048575));
_local3 = (_local3 + ((_local3 << 2) & 4294967292));
_local3 = (_local3 ^ ((_local3 >> 4) & 268435455));
_local3 = (_local3 * 2057);
_local3 = (_local3 ^ ((_local3 >> 16) & 0xFFFF));
return (_local3);
}
public static function Equals(_arg1:b2Pair, _arg2:uint, _arg3:uint):Boolean{
return ((((_arg1.proxyId1 == _arg2)) && ((_arg1.proxyId2 == _arg3))));
}
}
}//package Box2D.Collision
Section 38
//b2Point (Box2D.Collision.b2Point)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2Point {
public var p:b2Vec2;
public function b2Point(){
p = new b2Vec2();
super();
}
public function GetFirstVertex(_arg1:b2XForm):b2Vec2{
return (p);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
return (p);
}
}
}//package Box2D.Collision
Section 39
//b2Proxy (Box2D.Collision.b2Proxy)
package Box2D.Collision {
public class b2Proxy {
public var overlapCount:uint;
public var lowerBounds:Array;
public var upperBounds:Array;
public var userData;// = null
public var timeStamp:uint;
public function b2Proxy(){
lowerBounds = [uint(0), uint(0)];
upperBounds = [uint(0), uint(0)];
userData = null;
super();
}
public function GetNext():uint{
return (lowerBounds[0]);
}
public function IsValid():Boolean{
return (!((overlapCount == b2BroadPhase.b2_invalid)));
}
public function SetNext(_arg1:uint):void{
lowerBounds[0] = (_arg1 & 0xFFFF);
}
}
}//package Box2D.Collision
Section 40
//b2Segment (Box2D.Collision.b2Segment)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2Segment {
public var p1:b2Vec2;
public var p2:b2Vec2;
public function b2Segment(){
p1 = new b2Vec2();
p2 = new b2Vec2();
super();
}
public function TestSegment(_arg1:Array, _arg2:b2Vec2, _arg3:b2Segment, _arg4:Number):Boolean{
var _local5:b2Vec2;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
_local5 = _arg3.p1;
_local6 = (_arg3.p2.x - _local5.x);
_local7 = (_arg3.p2.y - _local5.y);
_local8 = (p2.x - p1.x);
_local9 = (p2.y - p1.y);
_local10 = _local9;
_local11 = -(_local8);
_local12 = (100 * Number.MIN_VALUE);
_local13 = -(((_local6 * _local10) + (_local7 * _local11)));
if (_local13 > _local12){
_local14 = (_local5.x - p1.x);
_local15 = (_local5.y - p1.y);
_local16 = ((_local14 * _local10) + (_local15 * _local11));
if ((((0 <= _local16)) && ((_local16 <= (_arg4 * _local13))))){
_local17 = ((-(_local7) * _local15) + (_local7 * _local14));
if (((((-(_local12) * _local13) <= _local17)) && ((_local17 <= (_local13 * (1 + _local12)))))){
_local16 = (_local16 / _local13);
_local18 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
_local10 = (_local10 / _local18);
_local11 = (_local11 / _local18);
_arg1[0] = _local16;
_arg2.Set(_local10, _local11);
return (true);
};
};
};
return (false);
}
}
}//package Box2D.Collision
Section 41
//b2TimeOfImpact (Box2D.Collision.b2TimeOfImpact)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2TimeOfImpact {
public static var s_xf1:b2XForm = new b2XForm();
public static var s_xf2:b2XForm = new b2XForm();
public static var s_p1:b2Vec2 = new b2Vec2();
public static var s_p2:b2Vec2 = new b2Vec2();
public static function TimeOfImpact(_arg1:b2Shape, _arg2:b2Sweep, _arg3:b2Shape, _arg4:b2Sweep):Number{
var _local5:Number;
var _local6:Number;
var _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:b2Vec2;
var _local18:b2Vec2;
var _local19:int;
var _local20:int;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:b2XForm;
var _local27:b2XForm;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
_local7 = _arg1.m_sweepRadius;
_local8 = _arg3.m_sweepRadius;
_local9 = _arg2.t0;
_local10 = (_arg2.c.x - _arg2.c0.x);
_local11 = (_arg2.c.y - _arg2.c0.y);
_local12 = (_arg4.c.x - _arg4.c0.x);
_local13 = (_arg4.c.y - _arg4.c0.y);
_local14 = (_arg2.a - _arg2.a0);
_local15 = (_arg4.a - _arg4.a0);
_local16 = 0;
_local17 = s_p1;
_local18 = s_p2;
_local19 = 20;
_local20 = 0;
_local21 = 0;
_local22 = 0;
_local23 = 0;
_local24 = 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 42
//ClipVertex (Box2D.Collision.ClipVertex)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class ClipVertex {
public var v:b2Vec2;
public var id:b2ContactID;
public function ClipVertex(){
v = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 43
//Features (Box2D.Collision.Features)
package Box2D.Collision {
public class Features {
public var _referenceEdge:int;
public var _incidentEdge:int;
public var _flip:int;
public var _incidentVertex:int;
public var _m_id:b2ContactID;
public function get referenceEdge():int{
return (_referenceEdge);
}
public function set incidentVertex(_arg1:int):void{
_incidentVertex = _arg1;
_m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000));
}
public function get flip():int{
return (_flip);
}
public function get incidentEdge():int{
return (_incidentEdge);
}
public function set referenceEdge(_arg1:int):void{
_referenceEdge = _arg1;
_m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF));
}
public function set flip(_arg1:int):void{
_flip = _arg1;
_m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080));
}
public function get incidentVertex():int{
return (_incidentVertex);
}
public function set incidentEdge(_arg1:int):void{
_incidentEdge = _arg1;
_m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00));
}
}
}//package Box2D.Collision
Section 44
//b2Mat22 (Box2D.Common.Math.b2Mat22)
package Box2D.Common.Math {
public class b2Mat22 {
public var col1:b2Vec2;
public var col2:b2Vec2;
public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){
var _local4:Number;
var _local5:Number;
col1 = new b2Vec2();
col2 = new b2Vec2();
super();
if (((!((_arg2 == null))) && (!((_arg3 == null))))){
col1.SetV(_arg2);
col2.SetV(_arg3);
} else {
_local4 = Math.cos(_arg1);
_local5 = Math.sin(_arg1);
col1.x = _local4;
col2.x = -(_local5);
col1.y = _local5;
col2.y = _local4;
};
}
public function SetIdentity():void{
col1.x = 1;
col2.x = 0;
col1.y = 0;
col2.y = 1;
}
public function Set(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
_local2 = Math.cos(_arg1);
_local3 = Math.sin(_arg1);
col1.x = _local2;
col2.x = -(_local3);
col1.y = _local3;
col2.y = _local2;
}
public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{
col1.SetV(_arg1);
col2.SetV(_arg2);
}
public function SetZero():void{
col1.x = 0;
col2.x = 0;
col1.y = 0;
col2.y = 0;
}
public function SetM(_arg1:b2Mat22):void{
col1.SetV(_arg1.col1);
col2.SetV(_arg1.col2);
}
public function AddM(_arg1:b2Mat22):void{
col1.x = (col1.x + _arg1.col1.x);
col1.y = (col1.y + _arg1.col1.y);
col2.x = (col2.x + _arg1.col2.x);
col2.y = (col2.y + _arg1.col2.y);
}
public function Abs():void{
col1.Abs();
col2.Abs();
}
public function Copy():b2Mat22{
return (new b2Mat22(0, col1, col2));
}
public function Invert(_arg1:b2Mat22):b2Mat22{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = col1.x;
_local3 = col2.x;
_local4 = col1.y;
_local5 = col2.y;
_local6 = ((_local2 * _local5) - (_local3 * _local4));
_local6 = (1 / _local6);
_arg1.col1.x = (_local6 * _local5);
_arg1.col2.x = (-(_local6) * _local3);
_arg1.col1.y = (-(_local6) * _local4);
_arg1.col2.y = (_local6 * _local2);
return (_arg1);
}
public function GetAngle():Number{
return (Math.atan2(col1.y, col1.x));
}
public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local4 = col1.x;
_local5 = col2.x;
_local6 = col1.y;
_local7 = col2.y;
_local8 = ((_local4 * _local7) - (_local5 * _local6));
_local8 = (1 / _local8);
_arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3)));
_arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2)));
return (_arg1);
}
}
}//package Box2D.Common.Math
Section 45
//b2Math (Box2D.Common.Math.b2Math)
package Box2D.Common.Math {
public class b2Math {
public static const b2Mat22_identity:b2Mat22 = new b2Mat22(0, new b2Vec2(1, 0), new b2Vec2(0, 1));
public static const b2XForm_identity:b2XForm = new b2XForm(b2Vec2_zero, b2Mat22_identity);
public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0);
public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x));
return (_local3);
}
public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y));
return (_local3);
}
public static function b2IsValid(_arg1:Number):Boolean{
return (isFinite(_arg1));
}
public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2MulX(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = b2MulMV(_arg1.R, _arg2);
_local3.x = (_local3.x + _arg1.position.x);
_local3.y = (_local3.y + _arg1.position.y);
return (_local3);
}
public static function b2DistanceSquared(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
return (((_local3 * _local3) + (_local4 * _local4)));
}
public static function b2Swap(_arg1:Array, _arg2:Array):void{
var _local3:*;
_local3 = _arg1[0];
_arg1[0] = _arg2[0];
_arg2[0] = _local3;
}
public static function b2AbsM(_arg1:b2Mat22):b2Mat22{
var _local2:b2Mat22;
_local2 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2));
return (_local2);
}
public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y));
return (_local3);
}
public static function b2MulXT(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
var _local4:Number;
_local3 = SubtractVV(_arg2, _arg1.position);
_local4 = ((_local3.x * _arg1.R.col1.x) + (_local3.y * _arg1.R.col1.y));
_local3.y = ((_local3.x * _arg1.R.col2.x) + (_local3.y * _arg1.R.col2.y));
_local3.x = _local4;
return (_local3);
}
public static function b2Abs(_arg1:Number):Number{
return (((_arg1 > 0)) ? _arg1 : -(_arg1));
}
public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (b2Max(_arg2, b2Min(_arg1, _arg3)));
}
public static function b2AbsV(_arg1:b2Vec2):b2Vec2{
var _local2:b2Vec2;
_local2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y));
return (_local2);
}
public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y));
return (_local3);
}
public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x)));
}
public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x));
return (_local3);
}
public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22;
_local3 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2));
return (_local3);
}
public static function b2Distance(_arg1:b2Vec2, _arg2:b2Vec2):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg1.x - _arg2.x);
_local4 = (_arg1.y - _arg2.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2Mat22;
_local3 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1));
_local4 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2));
_local5 = new b2Mat22(0, _local3, _local4);
return (_local5);
}
public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y));
return (_local3);
}
public static function b2IsPowerOfTwo(_arg1:uint):Boolean{
var _local2:Boolean;
_local2 = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0)));
return (_local2);
}
public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{
return (b2MaxV(_arg2, b2MinV(_arg1, _arg3)));
}
public static function b2RandomRange(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
_local3 = Math.random();
_local3 = (((_arg2 - _arg1) * _local3) + _arg1);
return (_local3);
}
public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2));
return (_local3);
}
public static function b2Min(_arg1:Number, _arg2:Number):Number{
return (((_arg1 < _arg2)) ? _arg1 : _arg2);
}
public static function b2Random():Number{
return (((Math.random() * 2) - 1));
}
public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{
var _local3:b2Mat22;
_local3 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2));
return (_local3);
}
public static function b2NextPowerOfTwo(_arg1:uint):uint{
_arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647));
_arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823));
_arg1 = (_arg1 | ((_arg1 >> 4) & 268435455));
_arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF));
_arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF));
return ((_arg1 + 1));
}
public static function b2Max(_arg1:Number, _arg2:Number):Number{
return (((_arg1 > _arg2)) ? _arg1 : _arg2);
}
public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{
var _local3:b2Vec2;
_local3 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y)));
return (_local3);
}
}
}//package Box2D.Common.Math
Section 46
//b2Sweep (Box2D.Common.Math.b2Sweep)
package Box2D.Common.Math {
public class b2Sweep {
public var localCenter:b2Vec2;
public var c:b2Vec2;
public var a:Number;
public var c0:b2Vec2;
public var a0:Number;
public var t0:Number;
public function b2Sweep(){
localCenter = new b2Vec2();
c0 = new b2Vec2();
c = new b2Vec2();
super();
}
public function Advance(_arg1:Number):void{
var _local2:Number;
if ((((t0 < _arg1)) && (((1 - t0) > Number.MIN_VALUE)))){
_local2 = ((_arg1 - t0) / (1 - t0));
c0.x = (((1 - _local2) * c0.x) + (_local2 * c.x));
c0.y = (((1 - _local2) * c0.y) + (_local2 * c.y));
a0 = (((1 - _local2) * a0) + (_local2 * a));
t0 = _arg1;
};
}
public function GetXForm(_arg1:b2XForm, _arg2:Number):void{
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
if ((1 - t0) > Number.MIN_VALUE){
_local4 = ((_arg2 - t0) / (1 - t0));
_arg1.position.x = (((1 - _local4) * c0.x) + (_local4 * c.x));
_arg1.position.y = (((1 - _local4) * c0.y) + (_local4 * c.y));
_local5 = (((1 - _local4) * a0) + (_local4 * a));
_arg1.R.Set(_local5);
} else {
_arg1.position.SetV(c);
_arg1.R.Set(a);
};
_local3 = _arg1.R;
_arg1.position.x = (_arg1.position.x - ((_local3.col1.x * localCenter.x) + (_local3.col2.x * localCenter.y)));
_arg1.position.y = (_arg1.position.y - ((_local3.col1.y * localCenter.x) + (_local3.col2.y * localCenter.y)));
}
}
}//package Box2D.Common.Math
Section 47
//b2Vec2 (Box2D.Common.Math.b2Vec2)
package Box2D.Common.Math {
public class b2Vec2 {
public var x:Number;
public var y:Number;
public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Set(_arg1:Number=0, _arg2:Number=0):void{
x = _arg1;
y = _arg2;
}
public function Multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function Length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function LengthSquared():Number{
return (((x * x) + (y * y)));
}
public function SetZero():void{
x = 0;
y = 0;
}
public function Add(_arg1:b2Vec2):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function MaxV(_arg1:b2Vec2):void{
x = ((x > _arg1.x)) ? x : _arg1.x;
y = ((y > _arg1.y)) ? y : _arg1.y;
}
public function SetV(_arg1:b2Vec2):void{
x = _arg1.x;
y = _arg1.y;
}
public function Negative():b2Vec2{
return (new b2Vec2(-(x), -(y)));
}
public function CrossVF(_arg1:Number):void{
var _local2:Number;
_local2 = x;
x = (_arg1 * y);
y = (-(_arg1) * _local2);
}
public function Abs():void{
if (x < 0){
x = -(x);
};
if (y < 0){
y = -(y);
};
}
public function Copy():b2Vec2{
return (new b2Vec2(x, y));
}
public function MulTM(_arg1:b2Mat22):void{
var _local2:Number;
_local2 = b2Math.b2Dot(this, _arg1.col1);
y = b2Math.b2Dot(this, _arg1.col2);
x = _local2;
}
public function IsValid():Boolean{
return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y))));
}
public function MinV(_arg1:b2Vec2):void{
x = ((x < _arg1.x)) ? x : _arg1.x;
y = ((y < _arg1.y)) ? y : _arg1.y;
}
public function MulM(_arg1:b2Mat22):void{
var _local2:Number;
_local2 = x;
x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y));
y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y));
}
public function Normalize():Number{
var _local1:Number;
var _local2:Number;
_local1 = Math.sqrt(((x * x) + (y * y)));
if (_local1 < Number.MIN_VALUE){
return (0);
};
_local2 = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
return (_local1);
}
public function Subtract(_arg1:b2Vec2):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function CrossFV(_arg1:Number):void{
var _local2:Number;
_local2 = x;
x = (-(_arg1) * y);
y = (_arg1 * _local2);
}
public static function Make(_arg1:Number, _arg2:Number):b2Vec2{
return (new b2Vec2(_arg1, _arg2));
}
}
}//package Box2D.Common.Math
Section 48
//b2XForm (Box2D.Common.Math.b2XForm)
package Box2D.Common.Math {
public class b2XForm {
public var R:b2Mat22;
public var position:b2Vec2;
public function b2XForm(_arg1:b2Vec2=null, _arg2:b2Mat22=null):void{
position = new b2Vec2();
R = new b2Mat22();
super();
if (_arg1){
position.SetV(_arg1);
R.SetM(_arg2);
};
}
public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{
position.SetV(_arg1);
R.SetM(_arg2);
}
public function Set(_arg1:b2XForm):void{
position.SetV(_arg1.position);
R.SetM(_arg1.R);
}
public function SetIdentity():void{
position.SetZero();
R.SetIdentity();
}
}
}//package Box2D.Common.Math
Section 49
//b2Color (Box2D.Common.b2Color)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Color {
private var _g:uint;// = 0
private var _b:uint;// = 0
private var _r:uint;// = 0
public function b2Color(_arg1:Number, _arg2:Number, _arg3:Number){
_r = 0;
_g = 0;
_b = 0;
super();
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
_g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1)));
_b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1)));
}
public function get color():uint{
return (((_r | (_g << 8)) | (_b << 16)));
}
public function set r(_arg1:Number):void{
_r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function set b(_arg1:Number):void{
_b = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
public function set g(_arg1:Number):void{
_g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1)));
}
}
}//package Box2D.Common
Section 50
//b2Settings (Box2D.Common.b2Settings)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Settings {
public static const b2_angularSleepTolerance:Number = 0.0111111111111111;
public static const b2_linearSleepTolerance:Number = 0.01;
public static const b2_angularSlop:Number = 0.0349065850398866;
public static const b2_linearSlop:Number = 0.005;
public static const b2_pi:Number = 3.14159265358979;
public static const b2_maxProxies:int = 0x0200;
public static const b2_maxAngularVelocitySquared:Number = 62500;
public static const b2_maxPolygonVertices:int = 8;
public static const b2_velocityThreshold:Number = 1;
public static const b2_contactBaumgarte:Number = 0.2;
public static const b2_maxPairs:int = 4096;
public static const b2_maxTOIContactsPerIsland:int = 32;
public static const b2_timeToSleep:Number = 0.5;
public static const b2_maxManifoldPoints:int = 2;
public static const b2_maxAngularVelocity:Number = 250;
public static const b2_maxAngularCorrection:Number = 0.139626340159546;
public static const USHRT_MAX:int = 0xFFFF;
public static const b2_maxLinearVelocity:Number = 200;
public static const b2_maxLinearCorrection:Number = 0.2;
public static const b2_toiSlop:Number = 0.04;
public static const b2_maxLinearVelocitySquared:Number = 40000;
public static function b2Assert(_arg1:Boolean):void{
var _local2:b2Vec2;
if (!_arg1){
_local2.x++;
};
}
}
}//package Box2D.Common
Section 51
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
public class b2CircleContact extends b2Contact {
private var m_manifolds:Array;
private var m0:b2Manifold;
public var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){
var _local3:b2ManifoldPoint;
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
_local3 = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function GetManifolds():Array{
return (m_manifolds);
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactPoint;
var _local8:b2ManifoldPoint;
_local5 = m_shape1.m_body;
_local6 = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollideCircles(m_manifold, (m_shape1 as b2CircleShape), _local5.m_xf, (m_shape2 as b2CircleShape), _local6.m_xf);
_local7 = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
m_manifoldCount = 1;
_local8 = m_manifold.points[0];
if (m0.pointCount == 0){
_local8.normalImpulse = 0;
_local8.tangentImpulse = 0;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Add(_local7);
};
} else {
_local4 = m0.points[0];
_local8.normalImpulse = _local4.normalImpulse;
_local8.tangentImpulse = _local4.tangentImpulse;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Persist(_local7);
};
};
} else {
m_manifoldCount = 0;
if ((((m0.pointCount > 0)) && (_arg1))){
_local4 = m0.points[0];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2CircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 52
//b2Contact (Box2D.Dynamics.Contacts.b2Contact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
public class b2Contact {
public var m_shape1:b2Shape;
public var m_shape2:b2Shape;
public var m_prev:b2Contact;
public var m_toi:Number;
public var m_next:b2Contact;
public var m_friction:Number;
public var m_manifoldCount:int;
public var m_node1:b2ContactEdge;
public var m_node2:b2ContactEdge;
public var m_restitution:Number;
public var m_flags:uint;
public static var e_toiFlag:uint = 8;
public static var e_nonSolidFlag:uint = 1;
public static var e_slowFlag:uint = 2;
public static var e_islandFlag:uint = 4;
public static var s_registers:Array;
public static var s_initialized:Boolean = false;
public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){
m_node1 = new b2ContactEdge();
m_node2 = new b2ContactEdge();
super();
m_flags = 0;
if (((!(_arg1)) || (!(_arg2)))){
m_shape1 = null;
m_shape2 = null;
return;
};
if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){
m_flags = (m_flags | e_nonSolidFlag);
};
m_shape1 = _arg1;
m_shape2 = _arg2;
m_manifoldCount = 0;
m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction));
m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution);
m_prev = null;
m_next = null;
m_node1.contact = null;
m_node1.prev = null;
m_node1.next = null;
m_node1.other = null;
m_node2.contact = null;
m_node2.prev = null;
m_node2.next = null;
m_node2.other = null;
}
public function GetShape1():b2Shape{
return (m_shape1);
}
public function IsSolid():Boolean{
return (((m_flags & e_nonSolidFlag) == 0));
}
public function GetNext():b2Contact{
return (m_next);
}
public function GetManifolds():Array{
return (null);
}
public function GetShape2():b2Shape{
return (m_shape2);
}
public function GetManifoldCount():int{
return (m_manifoldCount);
}
public function Update(_arg1:b2ContactListener):void{
var _local2:int;
var _local3:int;
var _local4:b2Body;
var _local5:b2Body;
_local2 = m_manifoldCount;
Evaluate(_arg1);
_local3 = m_manifoldCount;
_local4 = m_shape1.m_body;
_local5 = m_shape2.m_body;
if ((((_local3 == 0)) && ((_local2 > 0)))){
_local4.WakeUp();
_local5.WakeUp();
};
if (((((((_local4.IsStatic()) || (_local4.IsBullet()))) || (_local5.IsStatic()))) || (_local5.IsBullet()))){
m_flags = (m_flags & ~(e_slowFlag));
} else {
m_flags = (m_flags | e_slowFlag);
};
}
public function Evaluate(_arg1:b2ContactListener):void{
}
public static function InitializeRegisters():void{
var _local1:int;
var _local2:int;
s_registers = new Array(b2Shape.e_shapeTypeCount);
_local1 = 0;
while (_local1 < b2Shape.e_shapeTypeCount) {
s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount);
_local2 = 0;
while (_local2 < b2Shape.e_shapeTypeCount) {
s_registers[_local1][_local2] = new b2ContactRegister();
_local2++;
};
_local1++;
};
AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape);
AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_circleShape);
AddType(b2PolygonContact.Create, b2PolygonContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_polygonShape);
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
var _local3:int;
var _local4:int;
var _local5:b2ContactRegister;
var _local6:Function;
if (_arg1.m_manifoldCount > 0){
_arg1.m_shape1.m_body.WakeUp();
_arg1.m_shape2.m_body.WakeUp();
};
_local3 = _arg1.m_shape1.m_type;
_local4 = _arg1.m_shape2.m_type;
_local5 = s_registers[_local3][_local4];
_local6 = _local5.destroyFcn;
_local6(_arg1, _arg2);
}
public static function AddType(_arg1:Function, _arg2:Function, _arg3:int, _arg4:int):void{
s_registers[_arg3][_arg4].createFcn = _arg1;
s_registers[_arg3][_arg4].destroyFcn = _arg2;
s_registers[_arg3][_arg4].primary = true;
if (_arg3 != _arg4){
s_registers[_arg4][_arg3].createFcn = _arg1;
s_registers[_arg4][_arg3].destroyFcn = _arg2;
s_registers[_arg4][_arg3].primary = false;
};
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
var _local4:int;
var _local5:int;
var _local6:b2ContactRegister;
var _local7:Function;
var _local8:b2Contact;
var _local9:int;
var _local10:b2Manifold;
if (s_initialized == false){
InitializeRegisters();
s_initialized = true;
};
_local4 = _arg1.m_type;
_local5 = _arg2.m_type;
_local6 = s_registers[_local4][_local5];
_local7 = _local6.createFcn;
if (_local7 != null){
if (_local6.primary){
return (_local7(_arg1, _arg2, _arg3));
};
_local8 = _local7(_arg2, _arg1, _arg3);
_local9 = 0;
while (_local9 < _local8.m_manifoldCount) {
_local10 = _local8.GetManifolds()[_local9];
_local8.GetManifolds()[_local9].normal = _local10.normal.Negative();
_local9++;
};
return (_local8);
//unresolved jump
};
return (null);
}
}
}//package Box2D.Dynamics.Contacts
Section 53
//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 restitution:Number;
public var body1:b2Body;
public var manifold:b2Manifold;
public var normal:b2Vec2;
public var body2:b2Body;
public var friction:Number;
public var pointCount:int;
public function b2ContactConstraint(){
var _local1:int;
normal = new b2Vec2();
super();
points = new Array(b2Settings.b2_maxManifoldPoints);
_local1 = 0;
while (_local1 < b2Settings.b2_maxManifoldPoints) {
points[_local1] = new b2ContactConstraintPoint();
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 54
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
public class b2ContactConstraintPoint {
public var r2:b2Vec2;
public var separation:Number;
public var positionImpulse:Number;
public var normalImpulse:Number;
public var equalizedMass:Number;
public var tangentMass:Number;
public var tangentImpulse:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var normalMass:Number;
public var velocityBias:Number;
public var r1:b2Vec2;
public function b2ContactConstraintPoint(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
r1 = new b2Vec2();
r2 = new b2Vec2();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 55
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2ContactEdge {
public var next:b2ContactEdge;
public var other:b2Body;
public var contact:b2Contact;
public var prev:b2ContactEdge;
}
}//package Box2D.Dynamics.Contacts
Section 56
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister)
package Box2D.Dynamics.Contacts {
public class b2ContactRegister {
public var primary:Boolean;
public var createFcn:Function;
public var destroyFcn:Function;
}
}//package Box2D.Dynamics.Contacts
Section 57
//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 normal:b2Vec2;
public var position:b2Vec2;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var id:b2ContactID;
public function b2ContactResult(){
position = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 58
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2ContactSolver {
public var m_constraintCount:int;
public var m_constraints:Array;
public var m_allocator;
public var m_step:b2TimeStep;
public function b2ContactSolver(_arg1:b2TimeStep, _arg2:Array, _arg3:int, _arg4){
var _local5:b2Contact;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Mat22;
var _local9:int;
var _local10:b2Body;
var _local11:b2Body;
var _local12:int;
var _local13:Array;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:int;
var _local23:b2Manifold;
var _local24:Number;
var _local25:Number;
var _local26:b2ContactConstraint;
var _local27:uint;
var _local28:b2ManifoldPoint;
var _local29:b2ContactConstraintPoint;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local40:Number;
var _local41:Number;
var _local42:Number;
var _local43:Number;
var _local44:Number;
var _local45:Number;
var _local46:Number;
var _local47:Number;
m_step = new b2TimeStep();
m_constraints = new Array();
super();
m_step.dt = _arg1.dt;
m_step.inv_dt = _arg1.inv_dt;
m_step.maxIterations = _arg1.maxIterations;
m_allocator = _arg4;
m_constraintCount = 0;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
m_constraintCount = (m_constraintCount + _local5.m_manifoldCount);
_local6++;
};
_local6 = 0;
while (_local6 < m_constraintCount) {
m_constraints[_local6] = new b2ContactConstraint();
_local6++;
};
_local9 = 0;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
_local10 = _local5.m_shape1.m_body;
_local11 = _local5.m_shape2.m_body;
_local12 = _local5.m_manifoldCount;
_local13 = _local5.GetManifolds();
_local14 = _local5.m_friction;
_local15 = _local5.m_restitution;
_local16 = _local10.m_linearVelocity.x;
_local17 = _local10.m_linearVelocity.y;
_local18 = _local11.m_linearVelocity.x;
_local19 = _local11.m_linearVelocity.y;
_local20 = _local10.m_angularVelocity;
_local21 = _local11.m_angularVelocity;
_local22 = 0;
while (_local22 < _local12) {
_local23 = _local13[_local22];
_local24 = _local23.normal.x;
_local25 = _local23.normal.y;
_local26 = m_constraints[_local9];
_local26.body1 = _local10;
_local26.body2 = _local11;
_local26.manifold = _local23;
_local26.normal.x = _local24;
_local26.normal.y = _local25;
_local26.pointCount = _local23.pointCount;
_local26.friction = _local14;
_local26.restitution = _local15;
_local27 = 0;
while (_local27 < _local26.pointCount) {
_local28 = _local23.points[_local27];
_local29 = _local26.points[_local27];
_local29.normalImpulse = _local28.normalImpulse;
_local29.tangentImpulse = _local28.tangentImpulse;
_local29.separation = _local28.separation;
_local29.positionImpulse = 0;
_local29.localAnchor1.SetV(_local28.localPoint1);
_local29.localAnchor2.SetV(_local28.localPoint2);
_local8 = _local10.m_xf.R;
_local32 = (_local28.localPoint1.x - _local10.m_sweep.localCenter.x);
_local33 = (_local28.localPoint1.y - _local10.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local32) + (_local8.col2.x * _local33));
_local33 = ((_local8.col1.y * _local32) + (_local8.col2.y * _local33));
_local32 = _local30;
_local29.r1.Set(_local32, _local33);
_local8 = _local11.m_xf.R;
_local34 = (_local28.localPoint2.x - _local11.m_sweep.localCenter.x);
_local35 = (_local28.localPoint2.y - _local11.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local34) + (_local8.col2.x * _local35));
_local35 = ((_local8.col1.y * _local34) + (_local8.col2.y * _local35));
_local34 = _local30;
_local29.r2.Set(_local34, _local35);
_local36 = ((_local32 * _local32) + (_local33 * _local33));
_local37 = ((_local34 * _local34) + (_local35 * _local35));
_local38 = ((_local32 * _local24) + (_local33 * _local25));
_local39 = ((_local34 * _local24) + (_local35 * _local25));
_local40 = (_local10.m_invMass + _local11.m_invMass);
_local40 = (_local40 + ((_local10.m_invI * (_local36 - (_local38 * _local38))) + (_local11.m_invI * (_local37 - (_local39 * _local39)))));
_local29.normalMass = (1 / _local40);
_local41 = ((_local10.m_mass * _local10.m_invMass) + (_local11.m_mass * _local11.m_invMass));
_local41 = (_local41 + (((_local10.m_mass * _local10.m_invI) * (_local36 - (_local38 * _local38))) + ((_local11.m_mass * _local11.m_invI) * (_local37 - (_local39 * _local39)))));
_local29.equalizedMass = (1 / _local41);
_local42 = _local25;
_local43 = -(_local24);
_local44 = ((_local32 * _local42) + (_local33 * _local43));
_local45 = ((_local34 * _local42) + (_local35 * _local43));
_local46 = (_local10.m_invMass + _local11.m_invMass);
_local46 = (_local46 + ((_local10.m_invI * (_local36 - (_local44 * _local44))) + (_local11.m_invI * (_local37 - (_local45 * _local45)))));
_local29.tangentMass = (1 / _local46);
_local29.velocityBias = 0;
if (_local29.separation > 0){
_local29.velocityBias = (-60 * _local29.separation);
};
_local30 = (((_local18 + (-(_local21) * _local35)) - _local16) - (-(_local20) * _local33));
_local31 = (((_local19 + (_local21 * _local34)) - _local17) - (_local20 * _local32));
_local47 = ((_local26.normal.x * _local30) + (_local26.normal.y * _local31));
if (_local47 < -(b2Settings.b2_velocityThreshold)){
_local29.velocityBias = (_local29.velocityBias + (-(_local26.restitution) * _local47));
};
_local27++;
};
_local9++;
_local22++;
};
_local6++;
};
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2Mat22;
var _local5:int;
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;
_local5 = 0;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_invMass;
_local10 = _local7.m_invI;
_local11 = _local8.m_invMass;
_local12 = _local8.m_invI;
_local13 = _local6.normal.x;
_local14 = _local6.normal.y;
_local15 = _local14;
_local16 = -(_local13);
if (_arg1.warmStarting){
_local19 = _local6.pointCount;
_local18 = 0;
while (_local18 < _local19) {
_local20 = _local6.points[_local18];
_local6.points[_local18].normalImpulse = (_local20.normalImpulse * _arg1.dtRatio);
_local20.tangentImpulse = (_local20.tangentImpulse * _arg1.dtRatio);
_local21 = ((_local20.normalImpulse * _local13) + (_local20.tangentImpulse * _local15));
_local22 = ((_local20.normalImpulse * _local14) + (_local20.tangentImpulse * _local16));
_local7.m_angularVelocity = (_local7.m_angularVelocity - (_local10 * ((_local20.r1.x * _local22) - (_local20.r1.y * _local21))));
_local7.m_linearVelocity.x = (_local7.m_linearVelocity.x - (_local9 * _local21));
_local7.m_linearVelocity.y = (_local7.m_linearVelocity.y - (_local9 * _local22));
_local8.m_angularVelocity = (_local8.m_angularVelocity + (_local12 * ((_local20.r2.x * _local22) - (_local20.r2.y * _local21))));
_local8.m_linearVelocity.x = (_local8.m_linearVelocity.x + (_local11 * _local21));
_local8.m_linearVelocity.y = (_local8.m_linearVelocity.y + (_local11 * _local22));
_local18++;
};
} else {
_local19 = _local6.pointCount;
_local18 = 0;
while (_local18 < _local19) {
_local23 = _local6.points[_local18];
_local23.normalImpulse = 0;
_local23.tangentImpulse = 0;
_local18++;
};
};
_local5++;
};
}
public function SolvePositionConstraints(_arg1:Number):Boolean{
var _local2:Number;
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:int;
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;
_local2 = 0;
_local5 = 0;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_sweep.c;
_local10 = _local7.m_sweep.a;
_local11 = _local8.m_sweep.c;
_local12 = _local8.m_sweep.a;
_local13 = (_local7.m_mass * _local7.m_invMass);
_local14 = (_local7.m_mass * _local7.m_invI);
_local15 = (_local8.m_mass * _local8.m_invMass);
_local16 = (_local8.m_mass * _local8.m_invI);
_local17 = _local6.normal.x;
_local18 = _local6.normal.y;
_local19 = _local6.pointCount;
_local20 = 0;
while (_local20 < _local19) {
_local21 = _local6.points[_local20];
_local3 = _local7.m_xf.R;
_local4 = _local7.m_sweep.localCenter;
_local22 = (_local21.localAnchor1.x - _local4.x);
_local23 = (_local21.localAnchor1.y - _local4.y);
_local26 = ((_local3.col1.x * _local22) + (_local3.col2.x * _local23));
_local23 = ((_local3.col1.y * _local22) + (_local3.col2.y * _local23));
_local22 = _local26;
_local3 = _local8.m_xf.R;
_local4 = _local8.m_sweep.localCenter;
_local24 = (_local21.localAnchor2.x - _local4.x);
_local25 = (_local21.localAnchor2.y - _local4.y);
_local26 = ((_local3.col1.x * _local24) + (_local3.col2.x * _local25));
_local25 = ((_local3.col1.y * _local24) + (_local3.col2.y * _local25));
_local24 = _local26;
_local27 = (_local9.x + _local22);
_local28 = (_local9.y + _local23);
_local29 = (_local11.x + _local24);
_local30 = (_local11.y + _local25);
_local31 = (_local29 - _local27);
_local32 = (_local30 - _local28);
_local33 = (((_local31 * _local17) + (_local32 * _local18)) + _local21.separation);
_local2 = b2Math.b2Min(_local2, _local33);
_local34 = (_arg1 * b2Math.b2Clamp((_local33 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0));
_local35 = (-(_local21.equalizedMass) * _local34);
_local36 = _local21.positionImpulse;
_local21.positionImpulse = b2Math.b2Max((_local36 + _local35), 0);
_local35 = (_local21.positionImpulse - _local36);
_local37 = (_local35 * _local17);
_local38 = (_local35 * _local18);
_local9.x = (_local9.x - (_local13 * _local37));
_local9.y = (_local9.y - (_local13 * _local38));
_local10 = (_local10 - (_local14 * ((_local22 * _local38) - (_local23 * _local37))));
_local7.m_sweep.a = _local10;
_local7.SynchronizeTransform();
_local11.x = (_local11.x + (_local15 * _local37));
_local11.y = (_local11.y + (_local15 * _local38));
_local12 = (_local12 + (_local16 * ((_local24 * _local38) - (_local25 * _local37))));
_local8.m_sweep.a = _local12;
_local8.SynchronizeTransform();
_local20++;
};
_local5++;
};
return ((_local2 >= (-1.5 * b2Settings.b2_linearSlop)));
}
public function SolveVelocityConstraints():void{
var _local1:int;
var _local2:b2ContactConstraintPoint;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:b2Mat22;
var _local18:b2Vec2;
var _local19:int;
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;
_local19 = 0;
while (_local19 < m_constraintCount) {
_local20 = m_constraints[_local19];
_local21 = _local20.body1;
_local22 = _local20.body2;
_local23 = _local21.m_angularVelocity;
_local24 = _local22.m_angularVelocity;
_local25 = _local21.m_linearVelocity;
_local26 = _local22.m_linearVelocity;
_local27 = _local21.m_invMass;
_local28 = _local21.m_invI;
_local29 = _local22.m_invMass;
_local30 = _local22.m_invI;
_local31 = _local20.normal.x;
_local32 = _local20.normal.y;
_local33 = _local32;
_local34 = -(_local31);
_local35 = _local20.friction;
_local37 = _local20.pointCount;
_local1 = 0;
while (_local1 < _local37) {
_local2 = _local20.points[_local1];
_local7 = (((_local26.x + (-(_local24) * _local2.r2.y)) - _local25.x) - (-(_local23) * _local2.r1.y));
_local8 = (((_local26.y + (_local24 * _local2.r2.x)) - _local25.y) - (_local23 * _local2.r1.x));
_local9 = ((_local7 * _local31) + (_local8 * _local32));
_local11 = (-(_local2.normalMass) * (_local9 - _local2.velocityBias));
_local10 = ((_local7 * _local33) + (_local8 * _local34));
_local12 = (_local2.tangentMass * -(_local10));
_local13 = b2Math.b2Max((_local2.normalImpulse + _local11), 0);
_local11 = (_local13 - _local2.normalImpulse);
_local38 = (_local35 * _local2.normalImpulse);
_local14 = b2Math.b2Clamp((_local2.tangentImpulse + _local12), -(_local38), _local38);
_local12 = (_local14 - _local2.tangentImpulse);
_local15 = ((_local11 * _local31) + (_local12 * _local33));
_local16 = ((_local11 * _local32) + (_local12 * _local34));
_local25.x = (_local25.x - (_local27 * _local15));
_local25.y = (_local25.y - (_local27 * _local16));
_local23 = (_local23 - (_local28 * ((_local2.r1.x * _local16) - (_local2.r1.y * _local15))));
_local26.x = (_local26.x + (_local29 * _local15));
_local26.y = (_local26.y + (_local29 * _local16));
_local24 = (_local24 + (_local30 * ((_local2.r2.x * _local16) - (_local2.r2.y * _local15))));
_local2.normalImpulse = _local13;
_local2.tangentImpulse = _local14;
_local1++;
};
_local21.m_angularVelocity = _local23;
_local22.m_angularVelocity = _local24;
_local19++;
};
}
public function FinalizeVelocityConstraints():void{
var _local1:int;
var _local2:b2ContactConstraint;
var _local3:b2Manifold;
var _local4:int;
var _local5:b2ManifoldPoint;
var _local6:b2ContactConstraintPoint;
_local1 = 0;
while (_local1 < m_constraintCount) {
_local2 = m_constraints[_local1];
_local3 = _local2.manifold;
_local4 = 0;
while (_local4 < _local2.pointCount) {
_local5 = _local3.points[_local4];
_local6 = _local2.points[_local4];
_local5.normalImpulse = _local6.normalImpulse;
_local5.tangentImpulse = _local6.tangentImpulse;
_local4++;
};
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 59
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
public class b2NullContact extends b2Contact {
override public function GetManifolds():Array{
return (null);
}
override public function Evaluate(_arg1:b2ContactListener):void{
}
}
}//package Box2D.Dynamics.Contacts
Section 60
//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;
private var m0:b2Manifold;
public var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){
var _local3:b2ManifoldPoint;
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polygonShape));
b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape));
m_manifold.pointCount = 0;
_local3 = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function GetManifolds():Array{
return (m_manifolds);
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:int;
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2ManifoldPoint;
var _local6:b2Body;
var _local7:b2Body;
var _local8:Array;
var _local9:b2ContactPoint;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
_local6 = m_shape1.m_body;
_local7 = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygonAndCircle(m_manifold, (m_shape1 as b2PolygonShape), _local6.m_xf, (m_shape2 as b2CircleShape), _local7.m_xf);
_local8 = [false, false];
_local9 = s_evalCP;
_local9.shape1 = m_shape1;
_local9.shape2 = m_shape2;
_local9.friction = m_friction;
_local9.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local2 = 0;
while (_local2 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local2];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local8[_local13] == true){
} else {
_local5 = m0.points[_local13];
if (_local5.id._key == _local12){
_local8[_local13] = true;
_local10.normalImpulse = _local5.normalImpulse;
_local10.tangentImpulse = _local5.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Persist(_local9);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Add(_local9);
};
_local2++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local2 = 0;
while (_local2 < m0.pointCount) {
if (_local8[_local2]){
} else {
_local5 = m0.points[_local2];
_local9.position = _local6.GetWorldPoint(_local5.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local5.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local5.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m0.normal);
_local9.separation = _local5.separation;
_local9.id.key = _local5.id._key;
_arg1.Remove(_local9);
};
_local2++;
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolyAndCircleContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 61
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
public class b2PolygonContact extends b2Contact {
private var m_manifolds:Array;
private var m0:b2Manifold;
public var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolygonContact(_arg1:b2Shape, _arg2:b2Shape):void{
m0 = new b2Manifold();
m_manifolds = [new b2Manifold()];
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
}
override public function GetManifolds():Array{
return (m_manifolds);
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactPoint;
var _local8:int;
var _local9:Array;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
_local5 = m_shape1.m_body;
_local6 = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygons(m_manifold, (m_shape1 as b2PolygonShape), _local5.m_xf, (m_shape2 as b2PolygonShape), _local6.m_xf);
_local9 = [false, false];
_local7 = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local8 = 0;
while (_local8 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local8];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local9[_local13] == true){
} else {
_local4 = m0.points[_local13];
if (_local4.id._key == _local12){
_local9[_local13] = true;
_local10.normalImpulse = _local4.normalImpulse;
_local10.tangentImpulse = _local4.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Persist(_local7);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Add(_local7);
};
_local8++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local8 = 0;
while (_local8 < m0.pointCount) {
if (_local9[_local8]){
} else {
_local4 = m0.points[_local8];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
_local8++;
};
}
public static function Destroy(_arg1:b2Contact, _arg2):void{
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
return (new b2PolygonContact(_arg1, _arg2));
}
}
}//package Box2D.Dynamics.Contacts
Section 62
//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_mass:Number;
public var m_u:b2Vec2;
public var m_impulse:Number;
public var m_dampingRatio:Number;
public var m_frequencyHz:Number;
public var m_localAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_bias:Number;
public var m_gamma:Number;
public var m_length:Number;
public function b2DistanceJoint(_arg1:b2DistanceJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_u = new b2Vec2();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_length = _arg1.length;
m_frequencyHz = _arg1.frequencyHz;
m_dampingRatio = _arg1.dampingRatio;
m_impulse = 0;
m_gamma = 0;
m_bias = 0;
m_inv_dt = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2;
_local1 = new b2Vec2();
_local1.SetV(m_u);
_local1.Multiply((m_inv_dt * m_impulse));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Mat22;
var _local2:b2Body;
var _local3:b2Body;
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;
if (m_frequencyHz > 0){
return (true);
};
_local2 = m_body1;
_local3 = m_body2;
_local1 = _local2.m_xf.R;
_local4 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local5 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local1.col1.x * _local4) + (_local1.col2.x * _local5));
_local5 = ((_local1.col1.y * _local4) + (_local1.col2.y * _local5));
_local4 = _local6;
_local1 = _local3.m_xf.R;
_local7 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local8 = (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;
_local9 = (((_local3.m_sweep.c.x + _local7) - _local2.m_sweep.c.x) - _local4);
_local10 = (((_local3.m_sweep.c.y + _local8) - _local2.m_sweep.c.y) - _local5);
_local11 = Math.sqrt(((_local9 * _local9) + (_local10 * _local10)));
_local9 = (_local9 / _local11);
_local10 = (_local10 / _local11);
_local12 = (_local11 - m_length);
_local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local13 = (-(m_mass) * _local12);
m_u.Set(_local9, _local10);
_local14 = (_local13 * m_u.x);
_local15 = (_local13 * m_u.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x - (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y - (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a - (_local2.m_invI * ((_local4 * _local15) - (_local5 * _local14))));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + (_local3.m_invMass * _local14));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + (_local3.m_invMass * _local15));
_local3.m_sweep.a = (_local3.m_sweep.a + (_local3.m_invI * ((_local7 * _local15) - (_local8 * _local14))));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((b2Math.b2Abs(_local12) < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:Number;
var _local4:b2Body;
var _local5:b2Body;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
m_inv_dt = _arg1.inv_dt;
_local4 = m_body1;
_local5 = m_body2;
_local2 = _local4.m_xf.R;
_local6 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local6) + (_local2.col2.x * _local7));
_local7 = ((_local2.col1.y * _local6) + (_local2.col2.y * _local7));
_local6 = _local3;
_local2 = _local5.m_xf.R;
_local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local3;
m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6);
m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7);
_local10 = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y)));
if (_local10 > b2Settings.b2_linearSlop){
m_u.Multiply((1 / _local10));
} else {
m_u.SetZero();
};
_local11 = ((_local6 * m_u.y) - (_local7 * m_u.x));
_local12 = ((_local8 * m_u.y) - (_local9 * m_u.x));
_local13 = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12));
m_mass = (1 / _local13);
if (m_frequencyHz > 0){
_local14 = (_local10 - m_length);
_local15 = ((2 * Math.PI) * m_frequencyHz);
_local16 = (((2 * m_mass) * m_dampingRatio) * _local15);
_local17 = ((m_mass * _local15) * _local15);
m_gamma = (1 / (_arg1.dt * (_local16 + (_arg1.dt * _local17))));
m_bias = (((_local14 * _arg1.dt) * _local17) * m_gamma);
m_mass = (1 / (_local13 + m_gamma));
};
if (_arg1.warmStarting){
m_impulse = (m_impulse * _arg1.dtRatio);
_local18 = (m_impulse * m_u.x);
_local19 = (m_impulse * m_u.y);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x - (_local4.m_invMass * _local18));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y - (_local4.m_invMass * _local19));
_local4.m_angularVelocity = (_local4.m_angularVelocity - (_local4.m_invI * ((_local6 * _local19) - (_local7 * _local18))));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + (_local5.m_invMass * _local18));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + (_local5.m_invMass * _local19));
_local5.m_angularVelocity = (_local5.m_angularVelocity + (_local5.m_invI * ((_local8 * _local19) - (_local9 * _local18))));
} else {
m_impulse = 0;
};
}
override public function GetReactionTorque():Number{
return (0);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
_local3 = m_body1;
_local4 = m_body2;
_local2 = _local3.m_xf.R;
_local5 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local6 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6));
_local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6));
_local5 = _local7;
_local2 = _local4.m_xf.R;
_local8 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local9 = (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;
_local10 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local6));
_local11 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local5));
_local12 = (_local4.m_linearVelocity.x + (-(_local4.m_angularVelocity) * _local9));
_local13 = (_local4.m_linearVelocity.y + (_local4.m_angularVelocity * _local8));
_local14 = ((m_u.x * (_local12 - _local10)) + (m_u.y * (_local13 - _local11)));
_local15 = (-(m_mass) * ((_local14 + m_bias) + (m_gamma * m_impulse)));
m_impulse = (m_impulse + _local15);
_local16 = (_local15 * m_u.x);
_local17 = (_local15 * m_u.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x - (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y - (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity - (_local3.m_invI * ((_local5 * _local17) - (_local6 * _local16))));
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + (_local4.m_invMass * _local16));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + (_local4.m_invMass * _local17));
_local4.m_angularVelocity = (_local4.m_angularVelocity + (_local4.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
}
}
}//package Box2D.Dynamics.Joints
Section 63
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2DistanceJointDef extends b2JointDef {
public var length:Number;
public var dampingRatio:Number;
public var frequencyHz:Number;
public var localAnchor2:b2Vec2;
public var localAnchor1:b2Vec2;
public function b2DistanceJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_distanceJoint;
length = 1;
frequencyHz = 0;
dampingRatio = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
var _local5:Number;
var _local6:Number;
body1 = _arg1;
body2 = _arg2;
localAnchor1.SetV(body1.GetLocalPoint(_arg3));
localAnchor2.SetV(body2.GetLocalPoint(_arg4));
_local5 = (_arg4.x - _arg3.x);
_local6 = (_arg4.y - _arg3.y);
length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
frequencyHz = 0;
dampingRatio = 0;
}
}
}//package Box2D.Dynamics.Joints
Section 64
//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_force:Number;
public var m_mass:Number;
public var m_prismatic1:b2PrismaticJoint;
public var m_prismatic2:b2PrismaticJoint;
public var m_ground1:b2Body;
public var m_ground2:b2Body;
public var m_constant:Number;
public var m_revolute1:b2RevoluteJoint;
public var m_revolute2:b2RevoluteJoint;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_ratio:Number;
public var m_J:b2Jacobian;
public function b2GearJoint(_arg1:b2GearJointDef){
var _local2:int;
var _local3:int;
var _local4:Number;
var _local5:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_J = new b2Jacobian();
super(_arg1);
_local2 = _arg1.joint1.m_type;
_local3 = _arg1.joint2.m_type;
m_revolute1 = null;
m_prismatic1 = null;
m_revolute2 = null;
m_prismatic2 = null;
m_ground1 = _arg1.joint1.m_body1;
m_body1 = _arg1.joint1.m_body2;
if (_local2 == b2Joint.e_revoluteJoint){
m_revolute1 = (_arg1.joint1 as b2RevoluteJoint);
m_groundAnchor1.SetV(m_revolute1.m_localAnchor1);
m_localAnchor1.SetV(m_revolute1.m_localAnchor2);
_local4 = m_revolute1.GetJointAngle();
} else {
m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint);
m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1);
m_localAnchor1.SetV(m_prismatic1.m_localAnchor2);
_local4 = m_prismatic1.GetJointTranslation();
};
m_ground2 = _arg1.joint2.m_body1;
m_body2 = _arg1.joint2.m_body2;
if (_local3 == b2Joint.e_revoluteJoint){
m_revolute2 = (_arg1.joint2 as b2RevoluteJoint);
m_groundAnchor2.SetV(m_revolute2.m_localAnchor1);
m_localAnchor2.SetV(m_revolute2.m_localAnchor2);
_local5 = m_revolute2.GetJointAngle();
} else {
m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint);
m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1);
m_localAnchor2.SetV(m_prismatic2.m_localAnchor2);
_local5 = m_prismatic2.GetJointTranslation();
};
m_ratio = _arg1.ratio;
m_constant = (_local4 + (m_ratio * _local5));
m_force = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2;
_local1 = new b2Vec2((m_force * m_J.linear2.x), (m_force * m_J.linear2.y));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local1 = 0;
_local2 = m_body1;
_local3 = m_body2;
if (m_revolute1){
_local4 = m_revolute1.GetJointAngle();
} else {
_local4 = m_prismatic1.GetJointTranslation();
};
if (m_revolute2){
_local5 = m_revolute2.GetJointAngle();
} else {
_local5 = m_prismatic2.GetJointTranslation();
};
_local6 = (m_constant - (_local4 + (m_ratio * _local5)));
_local7 = (-(m_mass) * _local6);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + ((_local2.m_invMass * _local7) * m_J.linear1.x));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + ((_local2.m_invMass * _local7) * m_J.linear1.y));
_local2.m_sweep.a = (_local2.m_sweep.a + ((_local2.m_invI * _local7) * m_J.angular1));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local3.m_invMass * _local7) * m_J.linear2.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local3.m_invMass * _local7) * m_J.linear2.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local3.m_invI * _local7) * m_J.angular2));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((_local1 < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Body;
var _local5:b2Body;
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 _local14:Number;
var _local15:Number;
_local2 = m_ground1;
_local3 = m_ground2;
_local4 = m_body1;
_local5 = m_body2;
_local14 = 0;
m_J.SetZero();
if (m_revolute1){
m_J.angular1 = -1;
_local14 = (_local14 + _local4.m_invI);
} else {
_local10 = _local2.m_xf.R;
_local11 = m_prismatic1.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local4.m_xf.R;
_local8 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linear1.Set(-(_local6), -(_local7));
m_J.angular1 = -(_local12);
_local14 = (_local14 + (_local4.m_invMass + ((_local4.m_invI * _local12) * _local12)));
};
if (m_revolute2){
m_J.angular2 = -(m_ratio);
_local14 = (_local14 + ((m_ratio * m_ratio) * _local5.m_invI));
} else {
_local10 = _local3.m_xf.R;
_local11 = m_prismatic2.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local5.m_xf.R;
_local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linear2.Set((-(m_ratio) * _local6), (-(m_ratio) * _local7));
m_J.angular2 = (-(m_ratio) * _local12);
_local14 = (_local14 + ((m_ratio * m_ratio) * (_local5.m_invMass + ((_local5.m_invI * _local12) * _local12))));
};
m_mass = (1 / _local14);
if (_arg1.warmStarting){
_local15 = (_arg1.dt * m_force);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * _local15) * m_J.linear1.x));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * _local15) * m_J.linear1.y));
_local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * _local15) * m_J.angular1));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * _local15) * m_J.linear2.x));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * _local15) * m_J.linear2.y));
_local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * _local15) * m_J.angular2));
} else {
m_force = 0;
};
}
override public function GetReactionTorque():Number{
var _local1:b2Mat22;
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local1 = m_body2.m_xf.R;
_local2 = (m_localAnchor1.x - m_body2.m_sweep.localCenter.x);
_local3 = (m_localAnchor1.y - m_body2.m_sweep.localCenter.y);
_local4 = ((_local1.col1.x * _local2) + (_local1.col2.x * _local3));
_local3 = ((_local1.col1.y * _local2) + (_local1.col2.y * _local3));
_local2 = _local4;
_local4 = ((m_force * m_J.angular2) - ((_local2 * (m_force * m_J.linear2.y)) - (_local3 * (m_force * m_J.linear2.x))));
return (_local4);
}
public function GetRatio():Number{
return (m_ratio);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local5 = ((-(_arg1.inv_dt) * m_mass) * _local4);
m_force = (m_force + _local5);
_local6 = (_arg1.dt * _local5);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local6) * m_J.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local6) * m_J.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local6) * m_J.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local6) * m_J.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local6) * m_J.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local6) * m_J.angular2));
}
}
}//package Box2D.Dynamics.Joints
Section 65
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef)
package Box2D.Dynamics.Joints {
public class b2GearJointDef extends b2JointDef {
public var joint2:b2Joint;
public var joint1:b2Joint;
public var ratio:Number;
public function b2GearJointDef(){
type = b2Joint.e_gearJoint;
joint1 = null;
joint2 = null;
ratio = 1;
}
}
}//package Box2D.Dynamics.Joints
Section 66
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2Jacobian {
public var linear1:b2Vec2;
public var linear2:b2Vec2;
public var angular2:Number;
public var angular1:Number;
public function b2Jacobian(){
linear1 = new b2Vec2();
linear2 = new b2Vec2();
super();
}
public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{
linear1.SetV(_arg1);
angular1 = _arg2;
linear2.SetV(_arg3);
angular2 = _arg4;
}
public function SetZero():void{
linear1.SetZero();
angular1 = 0;
linear2.SetZero();
angular2 = 0;
}
public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{
return ((((((linear1.x * _arg1.x) + (linear1.y * _arg1.y)) + (angular1 * _arg2)) + ((linear2.x * _arg3.x) + (linear2.y * _arg3.y))) + (angular2 * _arg4)));
}
}
}//package Box2D.Dynamics.Joints
Section 67
//b2Joint (Box2D.Dynamics.Joints.b2Joint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2Joint {
public var m_islandFlag:Boolean;
public var m_body1:b2Body;
public var m_prev:b2Joint;
public var m_next:b2Joint;
public var m_type:int;
public var m_collideConnected:Boolean;
public var m_node1:b2JointEdge;
public var m_node2:b2JointEdge;
public var m_inv_dt:Number;
public var m_userData;
public var m_body2:b2Body;
public static const e_unknownJoint:int = 0;
public static const e_inactiveLimit:int = 0;
public static const e_atUpperLimit:int = 2;
public static const e_atLowerLimit:int = 1;
public static const e_gearJoint:int = 6;
public static const e_revoluteJoint:int = 1;
public static const e_equalLimits:int = 3;
public static const e_distanceJoint:int = 3;
public static const e_pulleyJoint:int = 4;
public static const e_prismaticJoint:int = 2;
public static const e_mouseJoint:int = 5;
public function b2Joint(_arg1:b2JointDef){
m_node1 = new b2JointEdge();
m_node2 = new b2JointEdge();
super();
m_type = _arg1.type;
m_prev = null;
m_next = null;
m_body1 = _arg1.body1;
m_body2 = _arg1.body2;
m_collideConnected = _arg1.collideConnected;
m_islandFlag = false;
m_userData = _arg1.userData;
}
public function GetAnchor1():b2Vec2{
return (null);
}
public function GetAnchor2():b2Vec2{
return (null);
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
}
public function GetType():int{
return (m_type);
}
public function GetBody2():b2Body{
return (m_body2);
}
public function GetNext():b2Joint{
return (m_next);
}
public function GetReactionTorque():Number{
return (0);
}
public function GetUserData(){
return (m_userData);
}
public function GetReactionForce():b2Vec2{
return (null);
}
public function SolvePositionConstraints():Boolean{
return (false);
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetBody1():b2Body{
return (m_body1);
}
public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
}
public function InitPositionConstraints():void{
}
public static function Destroy(_arg1:b2Joint, _arg2):void{
}
public static function Create(_arg1:b2JointDef, _arg2):b2Joint{
var _local3:b2Joint;
_local3 = null;
switch (_arg1.type){
case e_distanceJoint:
_local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef));
break;
case e_mouseJoint:
_local3 = new b2MouseJoint((_arg1 as b2MouseJointDef));
break;
case e_prismaticJoint:
_local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef));
break;
case e_revoluteJoint:
_local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef));
break;
case e_pulleyJoint:
_local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef));
break;
case e_gearJoint:
_local3 = new b2GearJoint((_arg1 as b2GearJointDef));
break;
default:
break;
};
return (_local3);
}
}
}//package Box2D.Dynamics.Joints
Section 68
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointDef {
public var collideConnected:Boolean;
public var body1:b2Body;
public var body2:b2Body;
public var userData;
public var type:int;
public function b2JointDef(){
type = b2Joint.e_unknownJoint;
userData = null;
body1 = null;
body2 = null;
collideConnected = false;
}
}
}//package Box2D.Dynamics.Joints
Section 69
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
public class b2JointEdge {
public var joint:b2Joint;
public var other:b2Body;
public var next:b2JointEdge;
public var prev:b2JointEdge;
}
}//package Box2D.Dynamics.Joints
Section 70
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2MouseJoint extends b2Joint {
public var m_beta:Number;
public var m_mass:b2Mat22;
public var m_target:b2Vec2;
public var m_impulse:b2Vec2;
public var m_localAnchor:b2Vec2;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K:b2Mat22;
public var m_gamma:Number;
public var m_C:b2Vec2;
public var m_maxForce:Number;
public function b2MouseJoint(_arg1:b2MouseJointDef){
var _local2:Number;
var _local3:Number;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
m_localAnchor = new b2Vec2();
m_target = new b2Vec2();
m_impulse = new b2Vec2();
m_mass = new b2Mat22();
m_C = new b2Vec2();
super(_arg1);
m_target.SetV(_arg1.target);
_local2 = (m_target.x - m_body2.m_xf.position.x);
_local3 = (m_target.y - m_body2.m_xf.position.y);
_local4 = m_body2.m_xf.R;
m_localAnchor.x = ((_local2 * _local4.col1.x) + (_local3 * _local4.col1.y));
m_localAnchor.y = ((_local2 * _local4.col2.x) + (_local3 * _local4.col2.y));
m_maxForce = _arg1.maxForce;
m_impulse.SetZero();
_local5 = m_body2.m_mass;
_local6 = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz);
_local7 = (((2 * _local5) * _arg1.dampingRatio) * _local6);
_local8 = ((_arg1.timeStep * _local5) * (_local6 * _local6));
m_gamma = (1 / (_local7 + _local8));
m_beta = (_local8 / (_local7 + _local8));
}
override public function GetAnchor1():b2Vec2{
return (m_target);
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor));
}
override public function GetReactionForce():b2Vec2{
return (m_impulse);
}
override public function SolvePositionConstraints():Boolean{
return (true);
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
_local2 = m_body2;
_local3 = _local2.m_xf.R;
_local4 = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
_local5 = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local7 = _local2.m_invMass;
_local8 = _local2.m_invI;
K1.col1.x = _local7;
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = _local7;
K2.col1.x = ((_local8 * _local5) * _local5);
K2.col2.x = ((-(_local8) * _local4) * _local5);
K2.col1.y = ((-(_local8) * _local4) * _local5);
K2.col2.y = ((_local8 * _local4) * _local4);
K.SetM(K1);
K.AddM(K2);
K.col1.x = (K.col1.x + m_gamma);
K.col2.y = (K.col2.y + m_gamma);
K.Invert(m_mass);
m_C.x = ((_local2.m_sweep.c.x + _local4) - m_target.x);
m_C.y = ((_local2.m_sweep.c.y + _local5) - m_target.y);
_local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98);
_local9 = (_arg1.dt * m_impulse.x);
_local10 = (_arg1.dt * m_impulse.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local7 * _local9));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local7 * _local10));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local8 * ((_local4 * _local10) - (_local5 * _local9))));
}
override public function GetReactionTorque():Number{
return (0);
}
public function SetTarget(_arg1:b2Vec2):void{
if (m_body2.IsSleeping()){
m_body2.WakeUp();
};
m_target = _arg1;
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Mat22;
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;
_local2 = m_body2;
_local3 = _local2.m_xf.R;
_local6 = (m_localAnchor.x - _local2.m_sweep.localCenter.x);
_local7 = (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;
_local8 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local7));
_local9 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local6));
_local3 = m_mass;
_local4 = ((_local8 + ((m_beta * _arg1.inv_dt) * m_C.x)) + ((m_gamma * _arg1.dt) * m_impulse.x));
_local5 = ((_local9 + ((m_beta * _arg1.inv_dt) * m_C.y)) + ((m_gamma * _arg1.dt) * m_impulse.y));
_local10 = (-(_arg1.inv_dt) * ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)));
_local11 = (-(_arg1.inv_dt) * ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)));
_local12 = m_impulse.x;
_local13 = m_impulse.y;
m_impulse.x = (m_impulse.x + _local10);
m_impulse.y = (m_impulse.y + _local11);
_local14 = m_impulse.Length();
if (_local14 > m_maxForce){
m_impulse.Multiply((m_maxForce / _local14));
};
_local10 = (m_impulse.x - _local12);
_local11 = (m_impulse.y - _local13);
_local15 = (_arg1.dt * _local10);
_local16 = (_arg1.dt * _local11);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
}
}
}//package Box2D.Dynamics.Joints
Section 71
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
public class b2MouseJointDef extends b2JointDef {
public var frequencyHz:Number;
public var dampingRatio:Number;
public var maxForce:Number;
public var target:b2Vec2;
public var timeStep:Number;
public function b2MouseJointDef(){
target = new b2Vec2();
super();
type = b2Joint.e_mouseJoint;
maxForce = 0;
frequencyHz = 5;
dampingRatio = 0.7;
timeStep = (1 / 60);
}
}
}//package Box2D.Dynamics.Joints
Section 72
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2PrismaticJoint extends b2Joint {
public var m_limitForce:Number;
public var m_refAngle:Number;
public var m_lowerTranslation:Number;
public var m_localXAxis1:b2Vec2;
public var m_torque:Number;
public var m_enableLimit:Boolean;
public var m_motorForce:Number;
public var m_force:Number;
public var m_localYAxis1:b2Vec2;
public var m_motorMass:Number;
public var m_maxMotorForce:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_angularMass:Number;
public var m_limitState:int;
public var m_linearMass:Number;
public var m_upperTranslation:Number;
public var m_motorJacobian:b2Jacobian;
public var m_limitPositionImpulse:Number;
public var m_motorSpeed:Number;
public var m_linearJacobian:b2Jacobian;
public var m_enableMotor:Boolean;
public function b2PrismaticJoint(_arg1:b2PrismaticJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_localXAxis1 = new b2Vec2();
m_localYAxis1 = new b2Vec2();
m_linearJacobian = new b2Jacobian();
m_motorJacobian = new b2Jacobian();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_localXAxis1.SetV(_arg1.localAxis1);
m_localYAxis1.x = -(m_localXAxis1.y);
m_localYAxis1.y = m_localXAxis1.x;
m_refAngle = _arg1.referenceAngle;
m_linearJacobian.SetZero();
m_linearMass = 0;
m_force = 0;
m_angularMass = 0;
m_torque = 0;
m_motorJacobian.SetZero();
m_motorMass = 0;
m_motorForce = 0;
m_limitForce = 0;
m_limitPositionImpulse = 0;
m_lowerTranslation = _arg1.lowerTranslation;
m_upperTranslation = _arg1.upperTranslation;
m_maxMotorForce = _arg1.maxMotorForce;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function GetUpperLimit():Number{
return (m_upperTranslation);
}
public function GetLowerLimit():Number{
return (m_lowerTranslation);
}
public function GetJointTranslation():Number{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:b2Vec2;
var _local6:Number;
var _local7:Number;
var _local8:b2Vec2;
var _local9:Number;
_local1 = m_body1;
_local2 = m_body2;
_local4 = _local1.GetWorldPoint(m_localAnchor1);
_local5 = _local2.GetWorldPoint(m_localAnchor2);
_local6 = (_local5.x - _local4.x);
_local7 = (_local5.y - _local4.y);
_local8 = _local1.GetWorldVector(m_localXAxis1);
_local9 = ((_local8.x * _local6) + (_local8.y * _local7));
return (_local9);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerTranslation = _arg1;
m_upperTranslation = _arg2;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Mat22;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = m_body1.m_xf.R;
_local2 = (m_limitForce * ((_local1.col1.x * m_localXAxis1.x) + (_local1.col2.x * m_localXAxis1.y)));
_local3 = (m_limitForce * ((_local1.col1.y * m_localXAxis1.x) + (_local1.col2.y * m_localXAxis1.y)));
_local4 = (m_force * ((_local1.col1.x * m_localYAxis1.x) + (_local1.col2.x * m_localYAxis1.y)));
_local5 = (m_force * ((_local1.col1.y * m_localYAxis1.x) + (_local1.col2.y * m_localYAxis1.y)));
return (new b2Vec2(((m_limitForce * _local2) + (m_force * _local4)), ((m_limitForce * _local3) + (m_force * _local5))));
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9: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 _local21:Number;
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;
_local3 = m_body1;
_local4 = m_body2;
_local5 = _local3.m_invMass;
_local6 = _local4.m_invMass;
_local7 = _local3.m_invI;
_local8 = _local4.m_invI;
_local9 = _local3.m_xf.R;
_local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
_local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
_local15 = (_local3.m_sweep.c.x + _local11);
_local16 = (_local3.m_sweep.c.y + _local12);
_local17 = (_local4.m_sweep.c.x + _local13);
_local18 = (_local4.m_sweep.c.y + _local14);
_local19 = (_local17 - _local15);
_local20 = (_local18 - _local16);
_local9 = _local3.m_xf.R;
_local21 = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y));
_local22 = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y));
_local23 = ((_local21 * _local19) + (_local22 * _local20));
_local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local24 = (-(m_linearMass) * _local23);
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local24) * m_linearJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local24) * m_linearJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local24) * m_linearJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local24) * m_linearJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local24) * m_linearJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local24) * m_linearJacobian.angular2));
_local25 = b2Math.b2Abs(_local23);
_local26 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_refAngle);
_local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local27 = (-(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();
_local28 = b2Math.b2Abs(_local26);
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local9 = _local3.m_xf.R;
_local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
_local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
_local15 = (_local3.m_sweep.c.x + _local11);
_local16 = (_local3.m_sweep.c.y + _local12);
_local17 = (_local4.m_sweep.c.x + _local13);
_local18 = (_local4.m_sweep.c.y + _local14);
_local19 = (_local17 - _local15);
_local20 = (_local18 - _local16);
_local9 = _local3.m_xf.R;
_local29 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y));
_local30 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y));
_local31 = ((_local29 * _local19) + (_local30 * _local20));
_local32 = 0;
if (m_limitState == e_equalLimits){
_local1 = b2Math.b2Clamp(_local31, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local25 = b2Math.b2Max(_local25, b2Math.b2Abs(_local26));
} else {
if (m_limitState == e_atLowerLimit){
_local1 = (_local31 - m_lowerTranslation);
_local25 = b2Math.b2Max(_local25, -(_local1));
_local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
} else {
if (m_limitState == e_atUpperLimit){
_local1 = (_local31 - m_upperTranslation);
_local25 = b2Math.b2Max(_local25, _local1);
_local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
};
};
};
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local32) * m_motorJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local32) * m_motorJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local32) * m_motorJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local32) * m_motorJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local32) * m_motorJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local32) * m_motorJacobian.angular2));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local25 <= b2Settings.b2_linearSlop)) && ((_local28 <= b2Settings.b2_angularSlop))));
}
public function GetJointSpeed():Number{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
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:b2Vec2;
var _local16:b2Vec2;
var _local17:b2Vec2;
var _local18:Number;
var _local19:Number;
var _local20:Number;
_local1 = m_body1;
_local2 = m_body2;
_local3 = _local1.m_xf.R;
_local4 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local5 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local3 = _local2.m_xf.R;
_local7 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local8 = (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;
_local9 = (_local1.m_sweep.c.x + _local4);
_local10 = (_local1.m_sweep.c.y + _local5);
_local11 = (_local2.m_sweep.c.x + _local7);
_local12 = (_local2.m_sweep.c.y + _local8);
_local13 = (_local11 - _local9);
_local14 = (_local12 - _local10);
_local15 = _local1.GetWorldVector(m_localXAxis1);
_local16 = _local1.m_linearVelocity;
_local17 = _local2.m_linearVelocity;
_local18 = _local1.m_angularVelocity;
_local19 = _local2.m_angularVelocity;
_local20 = (((_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 SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local6 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (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;
_local10 = _local2.m_invMass;
_local11 = _local3.m_invMass;
_local12 = _local2.m_invI;
_local13 = _local3.m_invI;
_local4 = _local2.m_xf.R;
_local14 = ((_local4.col1.x * m_localYAxis1.x) + (_local4.col2.x * m_localYAxis1.y));
_local15 = ((_local4.col1.y * m_localYAxis1.x) + (_local4.col2.y * m_localYAxis1.y));
_local16 = ((_local3.m_sweep.c.x + _local8) - _local2.m_sweep.c.x);
_local17 = ((_local3.m_sweep.c.y + _local9) - _local2.m_sweep.c.y);
m_linearJacobian.linear1.x = -(_local14);
m_linearJacobian.linear1.y = -(_local15);
m_linearJacobian.linear2.x = _local14;
m_linearJacobian.linear2.y = _local15;
m_linearJacobian.angular1 = -(((_local16 * _local15) - (_local17 * _local14)));
m_linearJacobian.angular2 = ((_local8 * _local15) - (_local9 * _local14));
m_linearMass = (((_local10 + ((_local12 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local11) + ((_local13 * m_linearJacobian.angular2) * m_linearJacobian.angular2));
m_linearMass = (1 / m_linearMass);
m_angularMass = (_local12 + _local13);
if (m_angularMass > Number.MIN_VALUE){
m_angularMass = (1 / m_angularMass);
};
if (((m_enableLimit) || (m_enableMotor))){
_local4 = _local2.m_xf.R;
_local18 = ((_local4.col1.x * m_localXAxis1.x) + (_local4.col2.x * m_localXAxis1.y));
_local19 = ((_local4.col1.y * m_localXAxis1.x) + (_local4.col2.y * m_localXAxis1.y));
m_motorJacobian.linear1.x = -(_local18);
m_motorJacobian.linear1.y = -(_local19);
m_motorJacobian.linear2.x = _local18;
m_motorJacobian.linear2.y = _local19;
m_motorJacobian.angular1 = -(((_local16 * _local19) - (_local17 * _local18)));
m_motorJacobian.angular2 = ((_local8 * _local19) - (_local9 * _local18));
m_motorMass = (((_local10 + ((_local12 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local11) + ((_local13 * m_motorJacobian.angular2) * m_motorJacobian.angular2));
m_motorMass = (1 / m_motorMass);
if (m_enableLimit){
_local20 = (_local16 - _local6);
_local21 = (_local17 - _local7);
_local22 = ((_local18 * _local20) + (_local19 * _local21));
if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){
m_limitState = e_equalLimits;
} else {
if (_local22 <= m_lowerTranslation){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local22 >= m_upperTranslation){
if (m_limitState != e_atUpperLimit){
m_limitForce = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitForce = 0;
};
};
};
};
};
if (m_enableMotor == false){
m_motorForce = 0;
};
if (m_enableLimit == false){
m_limitForce = 0;
};
if (_arg1.warmStarting){
_local23 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.x)));
_local24 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.y)));
_local25 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.x)));
_local26 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.y)));
_local27 = (_arg1.dt * (((m_force * m_linearJacobian.angular1) - m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular1)));
_local28 = (_arg1.dt * (((m_force * m_linearJacobian.angular2) + m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular2)));
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local10 * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local10 * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local12 * _local27));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local11 * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local11 * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local13 * _local28));
} else {
m_force = 0;
m_torque = 0;
m_limitForce = 0;
m_motorForce = 0;
};
m_limitPositionImpulse = 0;
}
public function GetMotorForce():Number{
return (m_motorForce);
}
public function SetMaxMotorForce(_arg1:Number):void{
m_maxMotorForce = _arg1;
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
override public function GetReactionTorque():Number{
return (m_torque);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_invMass;
_local5 = _local3.m_invMass;
_local6 = _local2.m_invI;
_local7 = _local3.m_invI;
_local9 = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local10 = ((-(_arg1.inv_dt) * m_linearMass) * _local9);
m_force = (m_force + _local10);
_local11 = (_arg1.dt * _local10);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_linearJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_linearJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_linearJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_linearJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_linearJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_linearJacobian.angular2));
_local12 = (_local3.m_angularVelocity - _local2.m_angularVelocity);
_local13 = ((-(_arg1.inv_dt) * m_angularMass) * _local12);
m_torque = (m_torque + _local13);
_local14 = (_arg1.dt * _local13);
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local6 * _local14));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local7 * _local14));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local15 = (m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - m_motorSpeed);
_local16 = ((-(_arg1.inv_dt) * m_motorMass) * _local15);
_local17 = m_motorForce;
m_motorForce = b2Math.b2Clamp((m_motorForce + _local16), -(m_maxMotorForce), m_maxMotorForce);
_local16 = (m_motorForce - _local17);
_local11 = (_arg1.dt * _local16);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local18 = m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity);
_local19 = ((-(_arg1.inv_dt) * m_motorMass) * _local18);
if (m_limitState == e_equalLimits){
m_limitForce = (m_limitForce + _local19);
} else {
if (m_limitState == e_atLowerLimit){
_local8 = m_limitForce;
m_limitForce = b2Math.b2Max((m_limitForce + _local19), 0);
_local19 = (m_limitForce - _local8);
} else {
if (m_limitState == e_atUpperLimit){
_local8 = m_limitForce;
m_limitForce = b2Math.b2Min((m_limitForce + _local19), 0);
_local19 = (m_limitForce - _local8);
};
};
};
_local11 = (_arg1.dt * _local19);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2));
};
}
}
}//package Box2D.Dynamics.Joints
Section 73
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2PrismaticJointDef extends b2JointDef {
public var localAxis1:b2Vec2;
public var referenceAngle:Number;
public var maxMotorForce:Number;
public var motorSpeed:Number;
public var upperTranslation:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var enableLimit:Boolean;
public var enableMotor:Boolean;
public var lowerTranslation:Number;
public function b2PrismaticJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
localAxis1 = new b2Vec2();
super();
type = b2Joint.e_prismaticJoint;
localAxis1.Set(1, 0);
referenceAngle = 0;
enableLimit = false;
lowerTranslation = 0;
upperTranslation = 0;
enableMotor = false;
maxMotorForce = 0;
motorSpeed = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1 = body1.GetLocalPoint(_arg3);
localAnchor2 = body2.GetLocalPoint(_arg3);
localAxis1 = body1.GetLocalVector(_arg4);
referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 74
//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_maxLength2:Number;
public var m_limitForce1:Number;
public var m_maxLength1:Number;
public var m_limitState1:int;
public var m_limitState2:int;
public var m_limitPositionImpulse2:Number;
public var m_force:Number;
public var m_limitPositionImpulse1:Number;
public var m_constant:Number;
public var m_state:int;
public var m_ratio:Number;
public var m_groundAnchor1:b2Vec2;
public var m_groundAnchor2:b2Vec2;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_positionImpulse:Number;
public var m_limitMass2:Number;
public var m_limitMass1:Number;
public var m_pulleyMass:Number;
public var m_u1:b2Vec2;
public var m_u2:b2Vec2;
public var m_limitForce2:Number;
public static const b2_minPulleyLength:Number = 2;
public function b2PulleyJoint(_arg1:b2PulleyJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_u1 = new b2Vec2();
m_u2 = new b2Vec2();
super(_arg1);
m_ground = m_body1.m_world.m_groundBody;
m_groundAnchor1.x = (_arg1.groundAnchor1.x - m_ground.m_xf.position.x);
m_groundAnchor1.y = (_arg1.groundAnchor1.y - m_ground.m_xf.position.y);
m_groundAnchor2.x = (_arg1.groundAnchor2.x - m_ground.m_xf.position.x);
m_groundAnchor2.y = (_arg1.groundAnchor2.y - m_ground.m_xf.position.y);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_ratio = _arg1.ratio;
m_constant = (_arg1.length1 + (m_ratio * _arg1.length2));
m_maxLength1 = b2Math.b2Min(_arg1.maxLength1, (m_constant - (m_ratio * b2_minPulleyLength)));
m_maxLength2 = b2Math.b2Min(_arg1.maxLength2, ((m_constant - b2_minPulleyLength) / m_ratio));
m_force = 0;
m_limitForce1 = 0;
m_limitForce2 = 0;
}
public function GetGroundAnchor2():b2Vec2{
var _local1:b2Vec2;
_local1 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor2);
return (_local1);
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2;
_local1 = m_u2.Copy();
_local1.Multiply(m_force);
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Body;
var _local2:b2Body;
var _local3:b2Mat22;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
_local1 = m_body1;
_local2 = m_body2;
_local4 = (m_ground.m_xf.position.x + m_groundAnchor1.x);
_local5 = (m_ground.m_xf.position.y + m_groundAnchor1.y);
_local6 = (m_ground.m_xf.position.x + m_groundAnchor2.x);
_local7 = (m_ground.m_xf.position.y + m_groundAnchor2.y);
_local23 = 0;
if (m_state == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local16 = m_u1.Length();
_local17 = m_u2.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local16));
} else {
m_u1.SetZero();
};
if (_local17 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = ((m_constant - _local16) - (m_ratio * _local17));
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_pulleyMass) * _local18);
_local20 = m_positionImpulse;
m_positionImpulse = b2Math.b2Max(0, (m_positionImpulse + _local19));
_local19 = (m_positionImpulse - _local20);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local14 = ((-(m_ratio) * _local19) * m_u2.x);
_local15 = ((-(m_ratio) * _local19) * m_u2.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local1.SynchronizeTransform();
_local2.SynchronizeTransform();
};
if (m_limitState1 == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
_local16 = m_u1.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.x = (m_u1.x * (1 / _local16));
m_u1.y = (m_u1.y * (1 / _local16));
} else {
m_u1.SetZero();
};
_local18 = (m_maxLength1 - _local16);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass1) * _local18);
_local21 = m_limitPositionImpulse1;
m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + _local19));
_local19 = (m_limitPositionImpulse1 - _local21);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local1.SynchronizeTransform();
};
if (m_limitState2 == e_atUpperLimit){
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local17 = m_u2.Length();
if (_local17 > b2Settings.b2_linearSlop){
m_u2.x = (m_u2.x * (1 / _local17));
m_u2.y = (m_u2.y * (1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = (m_maxLength2 - _local17);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass2) * _local18);
_local21 = m_limitPositionImpulse2;
m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19));
_local19 = (m_limitPositionImpulse2 - _local21);
_local14 = (-(_local19) * m_u2.x);
_local15 = (-(_local19) * m_u2.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local2.SynchronizeTransform();
};
return ((_local23 < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local5 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local6 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (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;
_local10 = (_local2.m_sweep.c.x + _local5);
_local11 = (_local2.m_sweep.c.y + _local6);
_local12 = (_local3.m_sweep.c.x + _local8);
_local13 = (_local3.m_sweep.c.y + _local9);
_local14 = (m_ground.m_xf.position.x + m_groundAnchor1.x);
_local15 = (m_ground.m_xf.position.y + m_groundAnchor1.y);
_local16 = (m_ground.m_xf.position.x + m_groundAnchor2.x);
_local17 = (m_ground.m_xf.position.y + m_groundAnchor2.y);
m_u1.Set((_local10 - _local14), (_local11 - _local15));
m_u2.Set((_local12 - _local16), (_local13 - _local17));
_local18 = m_u1.Length();
_local19 = m_u2.Length();
if (_local18 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local18));
} else {
m_u1.SetZero();
};
if (_local19 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local19));
} else {
m_u2.SetZero();
};
_local20 = ((m_constant - _local18) - (m_ratio * _local19));
if (_local20 > 0){
m_state = e_inactiveLimit;
m_force = 0;
} else {
m_state = e_atUpperLimit;
m_positionImpulse = 0;
};
if (_local18 < m_maxLength1){
m_limitState1 = e_inactiveLimit;
m_limitForce1 = 0;
} else {
m_limitState1 = e_atUpperLimit;
m_limitPositionImpulse1 = 0;
};
if (_local19 < m_maxLength2){
m_limitState2 = e_inactiveLimit;
m_limitForce2 = 0;
} else {
m_limitState2 = e_atUpperLimit;
m_limitPositionImpulse2 = 0;
};
_local21 = ((_local5 * m_u1.y) - (_local6 * m_u1.x));
_local22 = ((_local8 * m_u2.y) - (_local9 * m_u2.x));
m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21));
m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22));
m_pulleyMass = (m_limitMass1 + ((m_ratio * m_ratio) * m_limitMass2));
m_limitMass1 = (1 / m_limitMass1);
m_limitMass2 = (1 / m_limitMass2);
m_pulleyMass = (1 / m_pulleyMass);
if (_arg1.warmStarting){
_local23 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.x);
_local24 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.y);
_local25 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.x);
_local26 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local24) - (_local6 * _local23))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local26) - (_local9 * _local25))));
} else {
m_force = 0;
m_limitForce1 = 0;
m_limitForce2 = 0;
};
}
override public function GetReactionTorque():Number{
return (0);
}
public function GetRatio():Number{
return (m_ratio);
}
public function GetLength2():Number{
var _local1:b2Vec2;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = m_body2.GetWorldPoint(m_localAnchor2);
_local2 = (m_ground.m_xf.position.x + m_groundAnchor2.x);
_local3 = (m_ground.m_xf.position.y + m_groundAnchor2.y);
_local4 = (_local1.x - _local2);
_local5 = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local5 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local6 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
if (m_state == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = (-(((m_u1.x * _local10) + (m_u1.y * _local11))) - (m_ratio * ((m_u2.x * _local12) + (m_u2.y * _local13))));
_local19 = ((-(_arg1.inv_dt) * m_pulleyMass) * _local18);
_local20 = m_force;
m_force = b2Math.b2Max(0, (m_force + _local19));
_local19 = (m_force - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * m_u1.y);
_local16 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.x);
_local17 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
if (m_limitState1 == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local18 = -(((m_u1.x * _local10) + (m_u1.y * _local11)));
_local19 = ((-(_arg1.inv_dt) * m_limitMass1) * _local18);
_local20 = m_limitForce1;
m_limitForce1 = b2Math.b2Max(0, (m_limitForce1 + _local19));
_local19 = (m_limitForce1 - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * m_u1.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
};
if (m_limitState2 == e_atUpperLimit){
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = -(((m_u2.x * _local12) + (m_u2.y * _local13)));
_local19 = ((-(_arg1.inv_dt) * m_limitMass2) * _local18);
_local20 = m_limitForce2;
m_limitForce2 = b2Math.b2Max(0, (m_limitForce2 + _local19));
_local19 = (m_limitForce2 - _local20);
_local16 = ((-(_arg1.dt) * _local19) * m_u2.x);
_local17 = ((-(_arg1.dt) * _local19) * m_u2.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
}
public function GetLength1():Number{
var _local1:b2Vec2;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = m_body1.GetWorldPoint(m_localAnchor1);
_local2 = (m_ground.m_xf.position.x + m_groundAnchor1.x);
_local3 = (m_ground.m_xf.position.y + m_groundAnchor1.y);
_local4 = (_local1.x - _local2);
_local5 = (_local1.y - _local3);
return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5))));
}
public function GetGroundAnchor1():b2Vec2{
var _local1:b2Vec2;
_local1 = m_ground.m_xf.position.Copy();
_local1.Add(m_groundAnchor1);
return (_local1);
}
}
}//package Box2D.Dynamics.Joints
Section 75
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2PulleyJointDef extends b2JointDef {
public var maxLength2:Number;
public var length1:Number;
public var length2:Number;
public var maxLength1:Number;
public var ratio:Number;
public var groundAnchor1:b2Vec2;
public var groundAnchor2:b2Vec2;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public function b2PulleyJointDef(){
groundAnchor1 = new b2Vec2();
groundAnchor2 = new b2Vec2();
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_pulleyJoint;
groundAnchor1.Set(-1, 1);
groundAnchor2.Set(1, 1);
localAnchor1.Set(-1, 0);
localAnchor2.Set(1, 0);
length1 = 0;
maxLength1 = 0;
length2 = 0;
maxLength2 = 0;
ratio = 1;
collideConnected = true;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2, _arg5:b2Vec2, _arg6:b2Vec2, _arg7:Number):void{
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
body1 = _arg1;
body2 = _arg2;
groundAnchor1.SetV(_arg3);
groundAnchor2.SetV(_arg4);
localAnchor1 = body1.GetLocalPoint(_arg5);
localAnchor2 = body2.GetLocalPoint(_arg6);
_local8 = (_arg5.x - _arg3.x);
_local9 = (_arg5.y - _arg3.y);
length1 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local10 = (_arg6.x - _arg4.x);
_local11 = (_arg6.y - _arg4.y);
length2 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
ratio = _arg7;
_local12 = (length1 + (ratio * length2));
maxLength1 = (_local12 - (ratio * b2PulleyJoint.b2_minPulleyLength));
maxLength2 = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / ratio);
}
}
}//package Box2D.Dynamics.Joints
Section 76
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Common.*;
public class b2RevoluteJoint extends b2Joint {
public var m_limitForce:Number;
public var m_motorForce:Number;
public var m_pivotMass:b2Mat22;
public var m_enableLimit:Boolean;
public var m_limitState:int;
public var m_motorMass:Number;
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
private var K1:b2Mat22;
private var K2:b2Mat22;
private var K3:b2Mat22;
private var K:b2Mat22;
public var m_pivotForce:b2Vec2;
public var m_motorSpeed:Number;
public var m_enableMotor:Boolean;
public var m_limitPositionImpulse:Number;
public var m_maxMotorTorque:Number;
public var m_referenceAngle:Number;
public var m_lowerAngle:Number;
public var m_upperAngle:Number;
public static var tImpulse:b2Vec2 = new b2Vec2();
public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){
K = new b2Mat22();
K1 = new b2Mat22();
K2 = new b2Mat22();
K3 = new b2Mat22();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_pivotForce = new b2Vec2();
m_pivotMass = new b2Mat22();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_referenceAngle = _arg1.referenceAngle;
m_pivotForce.Set(0, 0);
m_motorForce = 0;
m_limitForce = 0;
m_limitPositionImpulse = 0;
m_lowerAngle = _arg1.lowerAngle;
m_upperAngle = _arg1.upperAngle;
m_maxMotorTorque = _arg1.maxMotorTorque;
m_motorSpeed = _arg1.motorSpeed;
m_enableLimit = _arg1.enableLimit;
m_enableMotor = _arg1.enableMotor;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
public function EnableMotor(_arg1:Boolean):void{
m_enableMotor = _arg1;
}
public function GetUpperLimit():Number{
return (m_upperAngle);
}
public function GetLowerLimit():Number{
return (m_lowerAngle);
}
public function SetLimits(_arg1:Number, _arg2:Number):void{
m_lowerAngle = _arg1;
m_upperAngle = _arg2;
}
public function GetMotorSpeed():Number{
return (m_motorSpeed);
}
override public function GetReactionForce():b2Vec2{
return (m_pivotForce);
}
override public function SolvePositionConstraints():Boolean{
var _local1:Number;
var _local2:Number;
var _local3:b2Body;
var _local4:b2Body;
var _local5:Number;
var _local6:b2Mat22;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
_local3 = m_body1;
_local4 = m_body2;
_local5 = 0;
_local6 = _local3.m_xf.R;
_local7 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local8 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local9 = ((_local6.col1.x * _local7) + (_local6.col2.x * _local8));
_local8 = ((_local6.col1.y * _local7) + (_local6.col2.y * _local8));
_local7 = _local9;
_local6 = _local4.m_xf.R;
_local10 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local11 = (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;
_local12 = (_local3.m_sweep.c.x + _local7);
_local13 = (_local3.m_sweep.c.y + _local8);
_local14 = (_local4.m_sweep.c.x + _local10);
_local15 = (_local4.m_sweep.c.y + _local11);
_local16 = (_local14 - _local12);
_local17 = (_local15 - _local13);
_local5 = Math.sqrt(((_local16 * _local16) + (_local17 * _local17)));
_local18 = _local3.m_invMass;
_local19 = _local4.m_invMass;
_local20 = _local3.m_invI;
_local21 = _local4.m_invI;
K1.col1.x = (_local18 + _local19);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local18 + _local19);
K2.col1.x = ((_local20 * _local8) * _local8);
K2.col2.x = ((-(_local20) * _local7) * _local8);
K2.col1.y = ((-(_local20) * _local7) * _local8);
K2.col2.y = ((_local20 * _local7) * _local7);
K3.col1.x = ((_local21 * _local11) * _local11);
K3.col2.x = ((-(_local21) * _local10) * _local11);
K3.col1.y = ((-(_local21) * _local10) * _local11);
K3.col2.y = ((_local21 * _local10) * _local10);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Solve(tImpulse, -(_local16), -(_local17));
_local22 = tImpulse.x;
_local23 = 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();
_local24 = 0;
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local25 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_referenceAngle);
_local26 = 0;
if (m_limitState == e_equalLimits){
_local2 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local24 = b2Math.b2Abs(_local2);
} else {
if (m_limitState == e_atLowerLimit){
_local2 = (_local25 - m_lowerAngle);
_local24 = b2Math.b2Max(0, -(_local2));
_local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
} else {
if (m_limitState == e_atUpperLimit){
_local2 = (_local25 - m_upperAngle);
_local24 = b2Math.b2Max(0, _local2);
_local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
};
};
};
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local26));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local26));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local24 <= b2Settings.b2_angularSlop))));
}
public function GetJointSpeed():Number{
return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity));
}
public function SetMotorSpeed(_arg1:Number):void{
m_motorSpeed = _arg1;
}
public function SetMaxMotorTorque(_arg1:Number):void{
m_maxMotorTorque = _arg1;
}
public function GetJointAngle():Number{
return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - m_referenceAngle));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
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;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local6 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (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;
_local10 = _local2.m_invMass;
_local11 = _local3.m_invMass;
_local12 = _local2.m_invI;
_local13 = _local3.m_invI;
K1.col1.x = (_local10 + _local11);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local10 + _local11);
K2.col1.x = ((_local12 * _local7) * _local7);
K2.col2.x = ((-(_local12) * _local6) * _local7);
K2.col1.y = ((-(_local12) * _local6) * _local7);
K2.col2.y = ((_local12 * _local6) * _local6);
K3.col1.x = ((_local13 * _local9) * _local9);
K3.col2.x = ((-(_local13) * _local8) * _local9);
K3.col1.y = ((-(_local13) * _local8) * _local9);
K3.col2.y = ((_local13 * _local8) * _local8);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Invert(m_pivotMass);
m_motorMass = (1 / (_local12 + _local13));
if (m_enableMotor == false){
m_motorForce = 0;
};
if (m_enableLimit){
_local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - m_referenceAngle);
if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){
m_limitState = e_equalLimits;
} else {
if (_local14 <= m_lowerAngle){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local14 >= m_upperAngle){
if (m_limitState != e_atUpperLimit){
m_limitForce = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitForce = 0;
};
};
};
} else {
m_limitForce = 0;
};
if (_arg1.warmStarting){
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - ((_arg1.dt * _local10) * m_pivotForce.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - ((_arg1.dt * _local10) * m_pivotForce.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_arg1.dt * _local12) * ((((_local6 * m_pivotForce.y) - (_local7 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_arg1.dt * _local11) * m_pivotForce.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_arg1.dt * _local11) * m_pivotForce.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_arg1.dt * _local13) * ((((_local8 * m_pivotForce.y) - (_local9 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
} else {
m_pivotForce.SetZero();
m_motorForce = 0;
m_limitForce = 0;
};
m_limitPositionImpulse = 0;
}
public function EnableLimit(_arg1:Boolean):void{
m_enableLimit = _arg1;
}
public function GetMotorTorque():Number{
return (m_motorForce);
}
override public function GetReactionTorque():Number{
return (m_limitForce);
}
public function IsLimitEnabled():Boolean{
return (m_enableLimit);
}
public function IsMotorEnabled():Boolean{
return (m_enableMotor);
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2Mat22;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
_local2 = m_body1;
_local3 = m_body2;
_local4 = _local2.m_xf.R;
_local6 = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
_local8 = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
_local9 = (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;
_local11 = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local7));
_local12 = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local6));
_local13 = (-(_arg1.inv_dt) * ((m_pivotMass.col1.x * _local11) + (m_pivotMass.col2.x * _local12)));
_local14 = (-(_arg1.inv_dt) * ((m_pivotMass.col1.y * _local11) + (m_pivotMass.col2.y * _local12)));
m_pivotForce.x = (m_pivotForce.x + _local13);
m_pivotForce.y = (m_pivotForce.y + _local14);
_local15 = (_arg1.dt * _local13);
_local16 = (_arg1.dt * _local14);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local16) - (_local9 * _local15))));
if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){
_local17 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - m_motorSpeed);
_local18 = ((-(_arg1.inv_dt) * m_motorMass) * _local17);
_local19 = m_motorForce;
m_motorForce = b2Math.b2Clamp((m_motorForce + _local18), -(m_maxMotorTorque), m_maxMotorTorque);
_local18 = (m_motorForce - _local19);
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local18));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local18));
};
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local20 = (_local3.m_angularVelocity - _local2.m_angularVelocity);
_local21 = ((-(_arg1.inv_dt) * m_motorMass) * _local20);
if (m_limitState == e_equalLimits){
m_limitForce = (m_limitForce + _local21);
} else {
if (m_limitState == e_atLowerLimit){
_local10 = m_limitForce;
m_limitForce = b2Math.b2Max((m_limitForce + _local21), 0);
_local21 = (m_limitForce - _local10);
} else {
if (m_limitState == e_atUpperLimit){
_local10 = m_limitForce;
m_limitForce = b2Math.b2Min((m_limitForce + _local21), 0);
_local21 = (m_limitForce - _local10);
};
};
};
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local21));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local21));
};
}
}
}//package Box2D.Dynamics.Joints
Section 77
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
public class b2RevoluteJointDef extends b2JointDef {
public var referenceAngle:Number;
public var upperAngle:Number;
public var lowerAngle:Number;
public var motorSpeed:Number;
public var maxMotorTorque:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var enableLimit:Boolean;
public var enableMotor:Boolean;
public function b2RevoluteJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_revoluteJoint;
localAnchor1.Set(0, 0);
localAnchor2.Set(0, 0);
referenceAngle = 0;
lowerAngle = 0;
upperAngle = 0;
maxMotorTorque = 0;
motorSpeed = 0;
enableLimit = false;
enableMotor = false;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1 = body1.GetLocalPoint(_arg3);
localAnchor2 = body2.GetLocalPoint(_arg3);
referenceAngle = (body2.GetAngle() - body1.GetAngle());
}
}
}//package Box2D.Dynamics.Joints
Section 78
//b2Body (Box2D.Dynamics.b2Body)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2Body {
public var m_next:b2Body;
public var m_contactList:b2ContactEdge;
public var m_angularVelocity:Number;
public var m_shapeList:b2Shape;
public var m_force:b2Vec2;
public var m_mass:Number;
public var m_sweep:b2Sweep;
public var m_xf:b2XForm;
public var m_torque:Number;
public var m_userData;
public var m_flags:uint;
public var m_world:b2World;
public var m_prev:b2Body;
public var m_invMass:Number;
public var m_type:int;
public var m_linearDamping:Number;
public var m_angularDamping:Number;
public var m_invI:Number;
public var m_linearVelocity:b2Vec2;
public var m_sleepTime:Number;
public var m_shapeCount:int;
public var m_jointList:b2JointEdge;
public var m_I:Number;
public static var e_fixedRotationFlag:uint = 64;
public static var e_frozenFlag:uint = 2;
public static var e_maxTypes:uint = 3;
public static var e_sleepFlag:uint = 8;
private static var s_massData:b2MassData = new b2MassData();
public static var e_bulletFlag:uint = 32;
public static var e_staticType:uint = 1;
public static var e_islandFlag:uint = 4;
public static var e_allowSleepFlag:uint = 16;
private static var s_xf1:b2XForm = new b2XForm();
public static var e_dynamicType:uint = 2;
public function b2Body(_arg1:b2BodyDef, _arg2:b2World){
var _local3:b2Mat22;
var _local4:b2Vec2;
m_xf = new b2XForm();
m_sweep = new b2Sweep();
m_linearVelocity = new b2Vec2();
m_force = new b2Vec2();
super();
m_flags = 0;
if (_arg1.isBullet){
m_flags = (m_flags | e_bulletFlag);
};
if (_arg1.fixedRotation){
m_flags = (m_flags | e_fixedRotationFlag);
};
if (_arg1.allowSleep){
m_flags = (m_flags | e_allowSleepFlag);
};
if (_arg1.isSleeping){
m_flags = (m_flags | e_sleepFlag);
};
m_world = _arg2;
m_xf.position.SetV(_arg1.position);
m_xf.R.Set(_arg1.angle);
m_sweep.localCenter.SetV(_arg1.massData.center);
m_sweep.t0 = 1;
m_sweep.a0 = (m_sweep.a = _arg1.angle);
_local3 = m_xf.R;
_local4 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_jointList = null;
m_contactList = null;
m_prev = null;
m_next = null;
m_linearDamping = _arg1.linearDamping;
m_angularDamping = _arg1.angularDamping;
m_force.Set(0, 0);
m_torque = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_sleepTime = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.massData.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.massData.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
m_userData = _arg1.userData;
m_shapeList = null;
m_shapeCount = 0;
}
public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{
return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_arg1.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_arg1.x - m_sweep.c.x)))));
}
public function SetLinearVelocity(_arg1:b2Vec2):void{
m_linearVelocity.SetV(_arg1);
}
public function WakeUp():void{
m_flags = (m_flags & ~(e_sleepFlag));
m_sleepTime = 0;
}
public function GetLocalCenter():b2Vec2{
return (m_sweep.localCenter);
}
public function ApplyTorque(_arg1:Number):void{
if (IsSleeping()){
WakeUp();
};
m_torque = (m_torque + _arg1);
}
public function IsFrozen():Boolean{
return (((m_flags & e_frozenFlag) == e_frozenFlag));
}
public function IsDynamic():Boolean{
return ((m_type == e_dynamicType));
}
public function GetLinearVelocity():b2Vec2{
return (m_linearVelocity);
}
public function SynchronizeTransform():void{
var _local1:b2Mat22;
var _local2:b2Vec2;
m_xf.R.Set(m_sweep.a);
_local1 = m_xf.R;
_local2 = m_sweep.localCenter;
m_xf.position.x = (m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y)));
m_xf.position.y = (m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y)));
}
public function GetInertia():Number{
return (m_I);
}
public function IsSleeping():Boolean{
return (((m_flags & e_sleepFlag) == e_sleepFlag));
}
public function SetMassFromShapes():void{
var _local1:b2Shape;
var _local2:Number;
var _local3:Number;
var _local4:b2MassData;
var _local5:b2Mat22;
var _local6:b2Vec2;
var _local7:int;
if (m_world.m_lock == true){
return;
};
m_mass = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
_local2 = 0;
_local3 = 0;
_local4 = s_massData;
_local1 = m_shapeList;
while (_local1) {
_local1.ComputeMass(_local4);
m_mass = (m_mass + _local4.mass);
_local2 = (_local2 + (_local4.mass * _local4.center.x));
_local3 = (_local3 + (_local4.mass * _local4.center.y));
m_I = (m_I + _local4.I);
_local1 = _local1.m_next;
};
if (m_mass > 0){
m_invMass = (1 / m_mass);
_local2 = (_local2 * m_invMass);
_local3 = (_local3 * m_invMass);
};
if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){
m_I = (m_I - (m_mass * ((_local2 * _local2) + (_local3 * _local3))));
m_invI = (1 / m_I);
} else {
m_I = 0;
m_invI = 0;
};
m_sweep.localCenter.Set(_local2, _local3);
_local5 = m_xf.R;
_local6 = m_sweep.localCenter;
m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y));
m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
_local1 = m_shapeList;
while (_local1) {
_local1.UpdateSweepRadius(m_sweep.localCenter);
_local1 = _local1.m_next;
};
_local7 = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local7 != m_type){
_local1 = m_shapeList;
while (_local1) {
_local1.RefilterProxy(m_world.m_broadPhase, m_xf);
_local1 = _local1.m_next;
};
};
}
public function PutToSleep():void{
m_flags = (m_flags | e_sleepFlag);
m_sleepTime = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_force.SetZero();
m_torque = 0;
}
public function GetJointList():b2JointEdge{
return (m_jointList);
}
public function SetXForm(_arg1:b2Vec2, _arg2:Number):Boolean{
var _local3:b2Shape;
var _local4:b2Mat22;
var _local5:b2Vec2;
var _local6:Boolean;
var _local7:Boolean;
if (m_world.m_lock == true){
return (true);
};
if (IsFrozen()){
return (false);
};
m_xf.R.Set(_arg2);
m_xf.position.SetV(_arg1);
_local4 = m_xf.R;
_local5 = m_sweep.localCenter;
m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y));
m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_sweep.a0 = (m_sweep.a = _arg2);
_local6 = false;
_local3 = m_shapeList;
while (_local3) {
_local7 = _local3.Synchronize(m_world.m_broadPhase, m_xf, m_xf);
if (_local7 == false){
_local6 = true;
break;
};
_local3 = _local3.m_next;
};
if (_local6 == true){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local3 = m_shapeList;
while (_local3) {
_local3.DestroyProxy(m_world.m_broadPhase);
_local3 = _local3.m_next;
};
return (false);
};
m_world.m_broadPhase.Commit();
return (true);
}
public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulXT(m_xf, _arg1));
}
public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
m_force.x = (m_force.x + _arg1.x);
m_force.y = (m_force.y + _arg1.y);
m_torque = (m_torque + (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x)));
}
public function SynchronizeShapes():Boolean{
var _local1:b2XForm;
var _local2:b2Mat22;
var _local3:b2Vec2;
var _local4:b2Shape;
var _local5:Boolean;
_local1 = s_xf1;
_local1.R.Set(m_sweep.a0);
_local2 = _local1.R;
_local3 = m_sweep.localCenter;
_local1.position.x = (m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y)));
_local1.position.y = (m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y)));
_local5 = true;
_local4 = m_shapeList;
while (_local4) {
_local5 = _local4.Synchronize(m_world.m_broadPhase, _local1, m_xf);
if (_local5 == false){
break;
};
_local4 = _local4.m_next;
};
if (_local5 == false){
m_flags = (m_flags | e_frozenFlag);
m_linearVelocity.SetZero();
m_angularVelocity = 0;
_local4 = m_shapeList;
while (_local4) {
_local4.DestroyProxy(m_world.m_broadPhase);
_local4 = _local4.m_next;
};
return (false);
};
if (m_userData != null){
m_userData.update();
};
return (true);
}
public function GetAngle():Number{
return (m_sweep.a);
}
public function GetXForm():b2XForm{
return (m_xf);
}
public function ApplyImpulse(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
m_linearVelocity.x = (m_linearVelocity.x + (m_invMass * _arg1.x));
m_linearVelocity.y = (m_linearVelocity.y + (m_invMass * _arg1.y));
m_angularVelocity = (m_angularVelocity + (m_invI * (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x))));
}
public function GetNext():b2Body{
return (m_next);
}
public function GetMass():Number{
return (m_mass);
}
public function GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22;
var _local3:b2Vec2;
_local2 = m_xf.R;
_local3 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_local3.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_local3.x - m_sweep.c.x)))));
}
public function GetAngularVelocity():Number{
return (m_angularVelocity);
}
public function SetAngularVelocity(_arg1:Number):void{
m_angularVelocity = _arg1;
}
public function SetMass(_arg1:b2MassData):void{
var _local2:b2Shape;
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:int;
if (m_world.m_lock == true){
return;
};
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
m_sweep.localCenter.SetV(_arg1.center);
_local3 = m_xf.R;
_local4 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
_local2 = m_shapeList;
while (_local2) {
_local2.UpdateSweepRadius(m_sweep.localCenter);
_local2 = _local2.m_next;
};
_local5 = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local5 != m_type){
_local2 = m_shapeList;
while (_local2) {
_local2.RefilterProxy(m_world.m_broadPhase, m_xf);
_local2 = _local2.m_next;
};
};
}
public function IsStatic():Boolean{
return ((m_type == e_staticType));
}
public function GetWorldVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulMV(m_xf.R, _arg1));
}
public function GetShapeList():b2Shape{
return (m_shapeList);
}
public function Advance(_arg1:Number):void{
m_sweep.Advance(_arg1);
m_sweep.c.SetV(m_sweep.c0);
m_sweep.a = m_sweep.a0;
SynchronizeTransform();
}
public function SetBullet(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_bulletFlag);
} else {
m_flags = (m_flags & ~(e_bulletFlag));
};
}
public function CreateShape(_arg1:b2ShapeDef):b2Shape{
var _local2:b2Shape;
if (m_world.m_lock == true){
return (null);
};
_local2 = b2Shape.Create(_arg1, m_world.m_blockAllocator);
_local2.m_next = m_shapeList;
m_shapeList = _local2;
m_shapeCount++;
_local2.m_body = this;
_local2.CreateProxy(m_world.m_broadPhase, m_xf);
_local2.UpdateSweepRadius(m_sweep.localCenter);
return (_local2);
}
public function IsConnected(_arg1:b2Body):Boolean{
var _local2:b2JointEdge;
_local2 = m_jointList;
while (_local2) {
if (_local2.other == _arg1){
return ((_local2.joint.m_collideConnected == false));
};
_local2 = _local2.next;
};
return (false);
}
public function DestroyShape(_arg1:b2Shape):void{
var _local2:b2Shape;
var _local3:b2Shape;
var _local4:Boolean;
if (m_world.m_lock == true){
return;
};
_arg1.DestroyProxy(m_world.m_broadPhase);
_local2 = m_shapeList;
_local3 = null;
_local4 = false;
while (_local2 != null) {
if (_local2 == _arg1){
if (_local3){
_local3.m_next = _arg1.m_next;
} else {
m_shapeList = _arg1.m_next;
};
_local4 = true;
break;
};
_local3 = _local2;
_local2 = _local2.m_next;
};
_arg1.m_body = null;
_arg1.m_next = null;
m_shapeCount--;
b2Shape.Destroy(_arg1, m_world.m_blockAllocator);
}
public function GetUserData(){
return (m_userData);
}
public function IsBullet():Boolean{
return (((m_flags & e_bulletFlag) == e_bulletFlag));
}
public function GetWorldCenter():b2Vec2{
return (m_sweep.c);
}
public function AllowSleeping(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_allowSleepFlag);
} else {
m_flags = (m_flags & ~(e_allowSleepFlag));
WakeUp();
};
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetLocalVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_xf.R, _arg1));
}
public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22;
var _local3:b2Vec2;
_local2 = m_xf.R;
_local3 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (_local3);
}
public function GetWorld():b2World{
return (m_world);
}
public function GetPosition():b2Vec2{
return (m_xf.position);
}
}
}//package Box2D.Dynamics
Section 79
//b2BodyDef (Box2D.Dynamics.b2BodyDef)
package Box2D.Dynamics {
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
public class b2BodyDef {
public var isSleeping:Boolean;
public var position:b2Vec2;
public var isBullet:Boolean;
public var allowSleep:Boolean;
public var userData;
public var angularDamping:Number;
public var fixedRotation:Boolean;
public var angle:Number;
public var linearDamping:Number;
public var massData:b2MassData;
public function b2BodyDef(){
massData = new b2MassData();
position = new b2Vec2();
super();
massData.center.SetZero();
massData.mass = 0;
massData.I = 0;
userData = null;
position.Set(0, 0);
angle = 0;
linearDamping = 0;
angularDamping = 0;
allowSleep = true;
isSleeping = false;
fixedRotation = false;
isBullet = false;
}
}
}//package Box2D.Dynamics
Section 80
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener)
package Box2D.Dynamics {
public class b2BoundaryListener {
public function Violation(_arg1:b2Body):void{
}
}
}//package Box2D.Dynamics
Section 81
//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;
var _local4:b2FilterData;
var _local5:Boolean;
_local3 = _arg1.GetFilterData();
_local4 = _arg2.GetFilterData();
if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){
return ((_local3.groupIndex > 0));
};
_local5 = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0))));
return (_local5);
}
}
}//package Box2D.Dynamics
Section 82
//b2ContactListener (Box2D.Dynamics.b2ContactListener)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactListener {
public function Add(_arg1:b2ContactPoint):void{
}
public function Remove(_arg1:b2ContactPoint):void{
}
public function Persist(_arg1:b2ContactPoint):void{
}
public function Result(_arg1:b2ContactResult):void{
}
}
}//package Box2D.Dynamics
Section 83
//b2ContactManager (Box2D.Dynamics.b2ContactManager)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactManager extends b2PairCallback {
public var m_world:b2World;
public var m_destroyImmediate:Boolean;
public var m_nullContact:b2NullContact;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2ContactManager(){
m_nullContact = new b2NullContact();
super();
m_world = null;
m_destroyImmediate = false;
}
override public function PairAdded(_arg1, _arg2){
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2Contact;
_local3 = (_arg1 as b2Shape);
_local4 = (_arg2 as b2Shape);
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((_local5.IsStatic()) && (_local6.IsStatic()))){
return (m_nullContact);
};
if (_local3.m_body == _local4.m_body){
return (m_nullContact);
};
if (_local6.IsConnected(_local5)){
return (m_nullContact);
};
if (((!((m_world.m_contactFilter == null))) && ((m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){
return (m_nullContact);
};
_local7 = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator);
if (_local7 == null){
return (m_nullContact);
};
_local3 = _local7.m_shape1;
_local4 = _local7.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local7.m_prev = null;
_local7.m_next = m_world.m_contactList;
if (m_world.m_contactList != null){
m_world.m_contactList.m_prev = _local7;
};
m_world.m_contactList = _local7;
_local7.m_node1.contact = _local7;
_local7.m_node1.other = _local6;
_local7.m_node1.prev = null;
_local7.m_node1.next = _local5.m_contactList;
if (_local5.m_contactList != null){
_local5.m_contactList.prev = _local7.m_node1;
};
_local5.m_contactList = _local7.m_node1;
_local7.m_node2.contact = _local7;
_local7.m_node2.other = _local5;
_local7.m_node2.prev = null;
_local7.m_node2.next = _local6.m_contactList;
if (_local6.m_contactList != null){
_local6.m_contactList.prev = _local7.m_node2;
};
_local6.m_contactList = _local7.m_node2;
m_world.m_contactCount++;
return (_local7);
}
override public function PairRemoved(_arg1, _arg2, _arg3):void{
var _local4:b2Contact;
if (_arg3 == null){
return;
};
_local4 = (_arg3 as b2Contact);
if (_local4 == m_nullContact){
return;
};
Destroy(_local4);
}
public function Destroy(_arg1:b2Contact):void{
var _local2:b2Shape;
var _local3:b2Shape;
var _local4:int;
var _local5:b2Body;
var _local6:b2Body;
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;
_local2 = _arg1.m_shape1;
_local3 = _arg1.m_shape2;
_local4 = _arg1.m_manifoldCount;
if ((((_local4 > 0)) && (m_world.m_contactListener))){
_local7 = _local2.m_body;
_local8 = _local3.m_body;
_local9 = _arg1.GetManifolds();
_local10 = s_evalCP;
_local10.shape1 = _arg1.m_shape1;
_local10.shape2 = _arg1.m_shape1;
_local10.friction = _arg1.m_friction;
_local10.restitution = _arg1.m_restitution;
_local11 = 0;
while (_local11 < _local4) {
_local12 = _local9[_local11];
_local10.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local10.position = _local7.GetWorldPoint(_local14.localPoint1);
_local15 = _local7.GetLinearVelocityFromLocalPoint(_local14.localPoint1);
_local16 = _local8.GetLinearVelocityFromLocalPoint(_local14.localPoint2);
_local10.velocity.Set((_local16.x - _local15.x), (_local16.y - _local15.y));
_local10.separation = _local14.separation;
_local10.id.key = _local14.id._key;
m_world.m_contactListener.Remove(_local10);
_local13++;
};
_local11++;
};
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_world.m_contactList){
m_world.m_contactList = _arg1.m_next;
};
_local5 = _local2.m_body;
_local6 = _local3.m_body;
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local5.m_contactList){
_local5.m_contactList = _arg1.m_node1.next;
};
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local6.m_contactList){
_local6.m_contactList = _arg1.m_node2.next;
};
b2Contact.Destroy(_arg1, m_world.m_blockAllocator);
m_world.m_contactCount--;
}
public function Collide():void{
var _local1:b2Contact;
var _local2:b2Body;
var _local3:b2Body;
_local1 = m_world.m_contactList;
while (_local1) {
_local2 = _local1.m_shape1.m_body;
_local3 = _local1.m_shape2.m_body;
if (((_local2.IsSleeping()) && (_local3.IsSleeping()))){
} else {
_local1.Update(m_world.m_contactListener);
};
_local1 = _local1.m_next;
};
}
}
}//package Box2D.Dynamics
Section 84
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw)
package Box2D.Dynamics {
import flash.display.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2DebugDraw {
public var m_xformScale:Number;// = 1
public var m_fillAlpha:Number;// = 1
public var m_alpha:Number;// = 1
public var m_lineThickness:Number;// = 1
public var m_drawFlags:uint;
public var m_sprite:Sprite;
public var m_drawScale:Number;// = 1
public static var e_coreShapeBit:uint = 4;
public static var e_shapeBit:uint = 1;
public static var e_centerOfMassBit:uint = 64;
public static var e_aabbBit:uint = 8;
public static var e_obbBit:uint = 16;
public static var e_pairBit:uint = 32;
public static var e_jointBit:uint = 2;
public function b2DebugDraw(){
m_drawScale = 1;
m_lineThickness = 1;
m_alpha = 1;
m_fillAlpha = 1;
m_xformScale = 1;
super();
m_drawFlags = 0;
}
public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
var _local4:int;
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.beginFill(_arg3.color, m_fillAlpha);
_local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
m_sprite.graphics.endFill();
}
public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
}
public function DrawXForm(_arg1:b2XForm):void{
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF0000, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col1.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col1.y)) * m_drawScale));
m_sprite.graphics.lineStyle(m_lineThickness, 0xFF00, m_alpha);
m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col2.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col2.y)) * m_drawScale));
}
public function ClearFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags & ~(_arg1));
}
public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha);
m_sprite.graphics.moveTo(0, 0);
m_sprite.graphics.beginFill(_arg4.color, m_fillAlpha);
m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale));
m_sprite.graphics.endFill();
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
m_sprite.graphics.lineTo(((_arg1.x + (_arg3.x * _arg2)) * m_drawScale), ((_arg1.y + (_arg3.y * _arg2)) * m_drawScale));
}
public function SetFlags(_arg1:uint):void{
m_drawFlags = _arg1;
}
public function AppendFlags(_arg1:uint):void{
m_drawFlags = (m_drawFlags | _arg1);
}
public function DrawSegment(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Color):void{
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale));
m_sprite.graphics.lineTo((_arg2.x * m_drawScale), (_arg2.y * m_drawScale));
}
public function GetFlags():uint{
return (m_drawFlags);
}
public function DrawPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{
var _local4:int;
m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha);
m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
_local4 = 1;
while (_local4 < _arg2) {
m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale));
_local4++;
};
m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale));
}
}
}//package Box2D.Dynamics
Section 85
//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 86
//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_joints:Array;
public var m_listener:b2ContactListener;
public var m_positionIterationCount:int;
public var m_bodyCapacity:int;
public var m_bodies:Array;
public var m_jointCapacity:int;
public var m_contactCount:int;
public var m_contacts:Array;
public var m_contactCapacity:int;
public var m_jointCount:int;
public var m_allocator;
public var m_bodyCount:int;
private static var s_reportCR:b2ContactResult = new b2ContactResult();
public function b2Island(_arg1:int, _arg2:int, _arg3:int, _arg4, _arg5:b2ContactListener){
var _local6:int;
super();
m_bodyCapacity = _arg1;
m_contactCapacity = _arg2;
m_jointCapacity = _arg3;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_allocator = _arg4;
m_listener = _arg5;
m_bodies = new Array(_arg1);
_local6 = 0;
while (_local6 < _arg1) {
m_bodies[_local6] = null;
_local6++;
};
m_contacts = new Array(_arg2);
_local6 = 0;
while (_local6 < _arg2) {
m_contacts[_local6] = null;
_local6++;
};
m_joints = new Array(_arg3);
_local6 = 0;
while (_local6 < _arg3) {
m_joints[_local6] = null;
_local6++;
};
m_positionIterationCount = 0;
}
public function AddBody(_arg1:b2Body):void{
var _local2 = m_bodyCount++;
m_bodies[_local2] = _arg1;
}
public function AddJoint(_arg1:b2Joint):void{
var _local2 = m_jointCount++;
m_joints[_local2] = _arg1;
}
public function Report(_arg1:Array):void{
var _local2:b2Mat22;
var _local3:b2Vec2;
var _local4:int;
var _local5:b2Contact;
var _local6:b2ContactConstraint;
var _local7:b2ContactResult;
var _local8:b2Body;
var _local9:int;
var _local10:Array;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2ContactConstraintPoint;
if (m_listener == null){
return;
};
_local4 = 0;
while (_local4 < m_contactCount) {
_local5 = m_contacts[_local4];
_local6 = _arg1[_local4];
_local7 = s_reportCR;
_local7.shape1 = _local5.m_shape1;
_local7.shape2 = _local5.m_shape2;
_local8 = _local7.shape1.m_body;
_local9 = _local5.m_manifoldCount;
_local10 = _local5.GetManifolds();
_local11 = 0;
while (_local11 < _local9) {
_local12 = _local10[_local11];
_local7.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local15 = _local6.points[_local13];
_local7.position = _local8.GetWorldPoint(_local14.localPoint1);
_local7.normalImpulse = _local15.normalImpulse;
_local7.tangentImpulse = _local15.tangentImpulse;
_local7.id.key = _local14.id.key;
m_listener.Result(_local7);
_local13++;
};
_local11++;
};
_local4++;
};
}
public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2, _arg3:Boolean, _arg4:Boolean):void{
var _local5:int;
var _local6:b2Body;
var _local7:b2Joint;
var _local8:b2ContactSolver;
var _local9:int;
var _local10:Boolean;
var _local11:Boolean;
var _local12:Boolean;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x))));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y))));
_local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque));
_local6.m_force.SetZero();
_local6.m_torque = 0;
_local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1));
_local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1));
if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){
_local6.m_linearVelocity.Normalize();
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity);
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity);
};
if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){
if (_local6.m_angularVelocity < 0){
_local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity);
} else {
_local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity;
};
};
};
_local5++;
};
_local8 = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local8.InitVelocityConstraints(_arg1);
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitVelocityConstraints(_arg1);
_local5++;
};
_local5 = 0;
while (_local5 < _arg1.maxIterations) {
_local8.SolveVelocityConstraints();
_local9 = 0;
while (_local9 < m_jointCount) {
_local7 = m_joints[_local9];
_local7.SolveVelocityConstraints(_arg1);
_local9++;
};
_local5++;
};
_local8.FinalizeVelocityConstraints();
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_sweep.c0.SetV(_local6.m_sweep.c);
_local6.m_sweep.a0 = _local6.m_sweep.a;
_local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_arg1.dt * _local6.m_linearVelocity.x));
_local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_arg1.dt * _local6.m_linearVelocity.y));
_local6.m_sweep.a = (_local6.m_sweep.a + (_arg1.dt * _local6.m_angularVelocity));
_local6.SynchronizeTransform();
};
_local5++;
};
if (_arg3){
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitPositionConstraints();
_local5++;
};
m_positionIterationCount = 0;
while (m_positionIterationCount < _arg1.maxIterations) {
_local10 = _local8.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
_local11 = true;
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local12 = _local7.SolvePositionConstraints();
_local11 = ((_local11) && (_local12));
_local5++;
};
if (((_local10) && (_local11))){
break;
};
m_positionIterationCount++;
};
};
Report(_local8.m_constraints);
if (_arg4){
_local13 = Number.MAX_VALUE;
_local14 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance);
_local15 = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance);
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.m_invMass == 0){
} else {
if ((_local6.m_flags & b2Body.e_allowSleepFlag) == 0){
_local6.m_sleepTime = 0;
_local13 = 0;
};
if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local15)))) || ((b2Math.b2Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local14)))){
_local6.m_sleepTime = 0;
_local13 = 0;
} else {
_local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt);
_local13 = b2Math.b2Min(_local13, _local6.m_sleepTime);
};
};
_local5++;
};
if (_local13 >= b2Settings.b2_timeToSleep){
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
m_bodies[_local5].m_flags = (_local6.m_flags | b2Body.e_sleepFlag);
_local6.m_linearVelocity.SetZero();
_local6.m_angularVelocity = 0;
_local5++;
};
};
};
}
public function AddContact(_arg1:b2Contact):void{
var _local2 = m_contactCount++;
m_contacts[_local2] = _arg1;
}
public function Clear():void{
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:int;
var _local3:b2ContactSolver;
var _local4:Number;
var _local5:b2Body;
var _local6:Boolean;
_local3 = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local3.SolveVelocityConstraints();
_local2++;
};
_local2 = 0;
while (_local2 < m_bodyCount) {
_local5 = m_bodies[_local2];
if (_local5.IsStatic()){
} else {
_local5.m_sweep.c0.SetV(_local5.m_sweep.c);
_local5.m_sweep.a0 = _local5.m_sweep.a;
_local5.m_sweep.c.x = (_local5.m_sweep.c.x + (_arg1.dt * _local5.m_linearVelocity.x));
_local5.m_sweep.c.y = (_local5.m_sweep.c.y + (_arg1.dt * _local5.m_linearVelocity.y));
_local5.m_sweep.a = (_local5.m_sweep.a + (_arg1.dt * _local5.m_angularVelocity));
_local5.SynchronizeTransform();
};
_local2++;
};
_local4 = 0.75;
_local2 = 0;
while (_local2 < _arg1.maxIterations) {
_local6 = _local3.SolvePositionConstraints(_local4);
if (_local6){
break;
};
_local2++;
};
Report(_local3.m_constraints);
}
}
}//package Box2D.Dynamics
Section 87
//b2TimeStep (Box2D.Dynamics.b2TimeStep)
package Box2D.Dynamics {
public class b2TimeStep {
public var warmStarting:Boolean;
public var positionCorrection:Boolean;
public var dt:Number;
public var maxIterations:int;
public var dtRatio:Number;
public var inv_dt:Number;
}
}//package Box2D.Dynamics
Section 88
//b2World (Box2D.Dynamics.b2World)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2World {
public var m_inv_dt0:Number;
public var m_boundaryListener:b2BoundaryListener;
public var m_contactList:b2Contact;
public var m_blockAllocator;
public var m_contactListener:b2ContactListener;
public var m_allowSleep:Boolean;
public var m_broadPhase:b2BroadPhase;
public var m_destructionListener:b2DestructionListener;
public var m_jointCount:int;
public var m_bodyCount:int;
public var m_lock:Boolean;
public var m_positionIterationCount:int;
public var m_groundBody:b2Body;
public var m_contactCount:int;
public var m_debugDraw:b2DebugDraw;
public var m_contactFilter:b2ContactFilter;
public var m_bodyList:b2Body;
public var m_stackAllocator;
public var m_jointList:b2Joint;
public var m_gravity:b2Vec2;
public var m_contactManager:b2ContactManager;
private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8);
public static var m_continuousPhysics:Boolean;
public static var m_warmStarting:Boolean;
private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6);
public static var m_positionCorrection:Boolean;
private static var s_xf:b2XForm = new b2XForm();
public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){
var _local4:b2BodyDef;
m_contactManager = new b2ContactManager();
super();
m_destructionListener = null;
m_boundaryListener = null;
m_contactFilter = b2ContactFilter.b2_defaultFilter;
m_contactListener = null;
m_debugDraw = null;
m_bodyList = null;
m_contactList = null;
m_jointList = null;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_positionCorrection = true;
m_warmStarting = true;
m_continuousPhysics = true;
m_allowSleep = _arg3;
m_gravity = _arg2;
m_lock = false;
m_inv_dt0 = 0;
m_contactManager.m_world = this;
m_broadPhase = new b2BroadPhase(_arg1, m_contactManager);
_local4 = new b2BodyDef();
m_groundBody = CreateBody(_local4);
}
public function DrawJoint(_arg1:b2Joint):void{
var _local2:b2Body;
var _local3:b2Body;
var _local4:b2XForm;
var _local5:b2XForm;
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Color;
var _local11:b2PulleyJoint;
var _local12:b2Vec2;
var _local13:b2Vec2;
_local2 = _arg1.m_body1;
_local3 = _arg1.m_body2;
_local4 = _local2.m_xf;
_local5 = _local3.m_xf;
_local6 = _local4.position;
_local7 = _local5.position;
_local8 = _arg1.GetAnchor1();
_local9 = _arg1.GetAnchor2();
_local10 = s_jointColor;
switch (_arg1.m_type){
case b2Joint.e_distanceJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
case b2Joint.e_pulleyJoint:
_local11 = (_arg1 as b2PulleyJoint);
_local12 = _local11.GetGroundAnchor1();
_local13 = _local11.GetGroundAnchor2();
m_debugDraw.DrawSegment(_local12, _local8, _local10);
m_debugDraw.DrawSegment(_local13, _local9, _local10);
m_debugDraw.DrawSegment(_local12, _local13, _local10);
break;
case b2Joint.e_mouseJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
default:
if (_local2 != m_groundBody){
m_debugDraw.DrawSegment(_local6, _local8, _local10);
};
m_debugDraw.DrawSegment(_local8, _local9, _local10);
if (_local3 != m_groundBody){
m_debugDraw.DrawSegment(_local7, _local9, _local10);
};
};
}
public function Refilter(_arg1:b2Shape):void{
_arg1.RefilterProxy(m_broadPhase, _arg1.m_body.m_xf);
}
public function SetDebugDraw(_arg1:b2DebugDraw):void{
m_debugDraw = _arg1;
}
public function SetContinuousPhysics(_arg1:Boolean):void{
m_continuousPhysics = _arg1;
}
public function GetProxyCount():int{
return (m_broadPhase.m_proxyCount);
}
public function DrawDebugData():void{
var _local1:uint;
var _local2:int;
var _local3:b2Body;
var _local4:b2Shape;
var _local5:b2Joint;
var _local6:b2BroadPhase;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Color;
var _local11:b2XForm;
var _local12:b2AABB;
var _local13:b2AABB;
var _local14:Array;
var _local15:Boolean;
var _local16:uint;
var _local17:b2Pair;
var _local18:b2Proxy;
var _local19:b2Proxy;
var _local20:b2Vec2;
var _local21:b2Vec2;
var _local22:b2Proxy;
var _local23:b2PolygonShape;
var _local24:b2OBB;
var _local25:b2Vec2;
var _local26:b2Mat22;
var _local27:b2Vec2;
var _local28:Number;
if (m_debugDraw == null){
return;
};
m_debugDraw.m_sprite.graphics.clear();
_local1 = m_debugDraw.GetFlags();
_local7 = new b2Vec2();
_local8 = new b2Vec2();
_local9 = new b2Vec2();
_local10 = new b2Color(0, 0, 0);
_local12 = new b2AABB();
_local13 = new b2AABB();
_local14 = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()];
if ((_local1 & b2DebugDraw.e_shapeBit)){
_local15 = ((_local1 & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local3.IsStatic()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.9, 0.5), _local15);
} else {
if (_local3.IsSleeping()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.5, 0.9), _local15);
} else {
DrawShape(_local4, _local11, new b2Color(0.9, 0.9, 0.9), _local15);
};
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_jointBit)){
_local5 = m_jointList;
while (_local5) {
DrawJoint(_local5);
_local5 = _local5.m_next;
};
};
if ((_local1 & b2DebugDraw.e_pairBit)){
_local6 = m_broadPhase;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.9, 0.3);
_local2 = 0;
while (_local2 < b2Pair.b2_tableCapacity) {
_local16 = _local6.m_pairManager.m_hashTable[_local2];
while (_local16 != b2Pair.b2_nullPair) {
_local17 = _local6.m_pairManager.m_pairs[_local16];
_local18 = _local6.m_proxyPool[_local17.proxyId1];
_local19 = _local6.m_proxyPool[_local17.proxyId2];
_local12.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.lowerBounds[0]].value));
_local12.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.lowerBounds[1]].value));
_local12.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.upperBounds[0]].value));
_local12.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.upperBounds[1]].value));
_local13.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.lowerBounds[0]].value));
_local13.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.lowerBounds[1]].value));
_local13.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.upperBounds[0]].value));
_local13.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.upperBounds[1]].value));
_local8.x = (0.5 * (_local12.lowerBound.x + _local12.upperBound.x));
_local8.y = (0.5 * (_local12.lowerBound.y + _local12.upperBound.y));
_local9.x = (0.5 * (_local13.lowerBound.x + _local13.upperBound.x));
_local9.y = (0.5 * (_local13.lowerBound.y + _local13.upperBound.y));
m_debugDraw.DrawSegment(_local8, _local9, _local10);
_local16 = _local17.next;
};
_local2++;
};
};
if ((_local1 & b2DebugDraw.e_aabbBit)){
_local6 = m_broadPhase;
_local20 = _local6.m_worldAABB.lowerBound;
_local21 = _local6.m_worldAABB.upperBound;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.3, 0.9);
_local2 = 0;
while (_local2 < b2Settings.b2_maxProxies) {
_local22 = _local6.m_proxyPool[_local2];
if (_local22.IsValid() == false){
} else {
_local12.lowerBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.lowerBounds[0]].value));
_local12.lowerBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.lowerBounds[1]].value));
_local12.upperBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.upperBounds[0]].value));
_local12.upperBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.upperBounds[1]].value));
_local14[0].Set(_local12.lowerBound.x, _local12.lowerBound.y);
_local14[1].Set(_local12.upperBound.x, _local12.lowerBound.y);
_local14[2].Set(_local12.upperBound.x, _local12.upperBound.y);
_local14[3].Set(_local12.lowerBound.x, _local12.upperBound.y);
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local2++;
};
_local14[0].Set(_local20.x, _local20.y);
_local14[1].Set(_local21.x, _local20.y);
_local14[2].Set(_local21.x, _local21.y);
_local14[3].Set(_local20.x, _local21.y);
m_debugDraw.DrawPolygon(_local14, 4, new b2Color(0.3, 0.9, 0.9));
};
if ((_local1 & b2DebugDraw.e_obbBit)){
_local10.Set(0.5, 0.3, 0.5);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local4.m_type != b2Shape.e_polygonShape){
} else {
_local23 = (_local4 as b2PolygonShape);
_local24 = _local23.GetOBB();
_local25 = _local24.extents;
_local14[0].Set(-(_local25.x), -(_local25.y));
_local14[1].Set(_local25.x, -(_local25.y));
_local14[2].Set(_local25.x, _local25.y);
_local14[3].Set(-(_local25.x), _local25.y);
_local2 = 0;
while (_local2 < 4) {
_local26 = _local24.R;
_local27 = _local14[_local2];
_local28 = (_local24.center.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local24.center.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local26 = _local11.R;
_local28 = (_local11.position.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local11.position.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local2++;
};
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_centerOfMassBit)){
_local3 = m_bodyList;
while (_local3) {
_local11 = s_xf;
_local11.R = _local3.m_xf.R;
_local11.position = _local3.GetWorldCenter();
m_debugDraw.DrawXForm(_local11);
_local3 = _local3.m_next;
};
};
}
public function DestroyBody(_arg1:b2Body):void{
var _local2:b2JointEdge;
var _local3:b2Shape;
var _local4:b2JointEdge;
var _local5:b2Shape;
if (m_lock == true){
return;
};
_local2 = _arg1.m_jointList;
while (_local2) {
_local4 = _local2;
_local2 = _local2.next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeJoint(_local4.joint);
};
DestroyJoint(_local4.joint);
};
_local3 = _arg1.m_shapeList;
while (_local3) {
_local5 = _local3;
_local3 = _local3.m_next;
if (m_destructionListener){
m_destructionListener.SayGoodbyeShape(_local5);
};
_local5.DestroyProxy(m_broadPhase);
b2Shape.Destroy(_local5, m_blockAllocator);
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_bodyList){
m_bodyList = _arg1.m_next;
};
m_bodyCount--;
}
public function SetContactFilter(_arg1:b2ContactFilter):void{
m_contactFilter = _arg1;
}
public function GetGroundBody():b2Body{
return (m_groundBody);
}
public function DrawShape(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{
var _local5:b2Color;
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;
_local5 = s_coreColor;
switch (_arg1.m_type){
case b2Shape.e_circleShape:
_local6 = (_arg1 as b2CircleShape);
_local7 = b2Math.b2MulX(_arg2, _local6.m_localPosition);
_local8 = _local6.m_radius;
_local9 = _arg2.R.col1;
m_debugDraw.DrawSolidCircle(_local7, _local8, _local9, _arg3);
if (_arg4){
m_debugDraw.DrawCircle(_local7, (_local8 - b2Settings.b2_toiSlop), _local5);
};
break;
case b2Shape.e_polygonShape:
_local11 = (_arg1 as b2PolygonShape);
_local12 = _local11.GetVertexCount();
_local13 = _local11.GetVertices();
_local14 = new Array(b2Settings.b2_maxPolygonVertices);
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local13[_local10]);
_local10++;
};
m_debugDraw.DrawSolidPolygon(_local14, _local12, _arg3);
if (_arg4){
_local15 = _local11.GetCoreVertices();
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]);
_local10++;
};
m_debugDraw.DrawPolygon(_local14, _local12, _local5);
};
break;
};
}
public function GetContactCount():int{
return (m_contactCount);
}
public function Solve(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Island;
var _local4:b2Contact;
var _local5:b2Joint;
var _local6:int;
var _local7:Array;
var _local8:b2Body;
var _local9:int;
var _local10:int;
var _local11:b2Body;
var _local12:b2ContactEdge;
var _local13:b2JointEdge;
var _local14:Boolean;
m_positionIterationCount = 0;
_local3 = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator, m_contactListener);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2 = _local2.m_next;
};
_local4 = m_contactList;
while (_local4) {
_local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag));
_local4 = _local4.m_next;
};
_local5 = m_jointList;
while (_local5) {
_local5.m_islandFlag = false;
_local5 = _local5.m_next;
};
_local6 = m_bodyCount;
_local7 = new Array(_local6);
_local8 = m_bodyList;
while (_local8) {
if ((_local8.m_flags & ((b2Body.e_islandFlag | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){
} else {
if (_local8.IsStatic()){
} else {
_local3.Clear();
_local9 = 0;
var _temp1 = _local9;
_local9 = (_local9 + 1);
var _local15 = _temp1;
_local7[_local15] = _local8;
_local8.m_flags = (_local8.m_flags | b2Body.e_islandFlag);
while (_local9 > 0) {
--_local9;
_local2 = _local7[_local9];
_local3.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local12 = _local2.m_contactList;
while (_local12) {
if ((_local12.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag))){
} else {
if (_local12.contact.m_manifoldCount == 0){
} else {
_local3.AddContact(_local12.contact);
_local12.contact.m_flags = (_local12.contact.m_flags | b2Contact.e_islandFlag);
_local11 = _local12.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp2 = _local9;
_local9 = (_local9 + 1);
var _local16 = _temp2;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
};
_local12 = _local12.next;
};
_local13 = _local2.m_jointList;
while (_local13) {
if (_local13.joint.m_islandFlag == true){
} else {
_local3.AddJoint(_local13.joint);
_local13.joint.m_islandFlag = true;
_local11 = _local13.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp3 = _local9;
_local9 = (_local9 + 1);
_local16 = _temp3;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
_local13 = _local13.next;
};
};
};
_local3.Solve(_arg1, m_gravity, m_positionCorrection, m_allowSleep);
if (_local3.m_positionIterationCount > m_positionIterationCount){
m_positionIterationCount = _local3.m_positionIterationCount;
};
_local10 = 0;
while (_local10 < _local3.m_bodyCount) {
_local2 = _local3.m_bodies[_local10];
if (_local2.IsStatic()){
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
};
_local10++;
};
};
};
_local8 = _local8.m_next;
};
_local2 = m_bodyList;
while (_local2) {
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local14 = _local2.SynchronizeShapes();
if ((((_local14 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
};
};
_local2 = _local2.m_next;
};
m_broadPhase.Commit();
}
public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{
var _local4:Array;
var _local5:int;
var _local6:int;
_local4 = new Array(_arg3);
_local5 = m_broadPhase.QueryAABB(_arg1, _local4, _arg3);
_local6 = 0;
while (_local6 < _local5) {
_arg2[_local6] = _local4[_local6];
_local6++;
};
return (_local5);
}
public function SetGravity(_arg1:b2Vec2):void{
m_gravity = _arg1;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactEdge;
var _local8:b2Island;
var _local9:int;
var _local10:Array;
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;
_local8 = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener);
_local9 = m_bodyCount;
_local10 = new Array(_local9);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2.m_sweep.t0 = 0;
_local2 = _local2.m_next;
};
_local11 = m_contactList;
while (_local11) {
_local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local11 = _local11.m_next;
};
while (true) {
_local12 = null;
_local13 = 1;
_local11 = m_contactList;
for (;_local11;(_local11 = _local11.m_next)) {
if ((_local11.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){
} else {
_local18 = 1;
if ((_local11.m_flags & b2Contact.e_toiFlag)){
_local18 = _local11.m_toi;
} else {
_local3 = _local11.m_shape1;
_local4 = _local11.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((((_local5.IsStatic()) || (_local5.IsSleeping()))) && (((_local6.IsStatic()) || (_local6.IsSleeping()))))){
continue;
};
_local19 = _local5.m_sweep.t0;
if (_local5.m_sweep.t0 < _local6.m_sweep.t0){
_local19 = _local6.m_sweep.t0;
_local5.m_sweep.Advance(_local19);
} else {
if (_local6.m_sweep.t0 < _local5.m_sweep.t0){
_local19 = _local5.m_sweep.t0;
_local6.m_sweep.Advance(_local19);
};
};
_local18 = b2TimeOfImpact.TimeOfImpact(_local11.m_shape1, _local5.m_sweep, _local11.m_shape2, _local6.m_sweep);
if ((((_local18 > 0)) && ((_local18 < 1)))){
_local18 = (((1 - _local18) * _local19) + _local18);
if (_local18 > 1){
_local18 = 1;
};
};
_local11.m_toi = _local18;
_local11.m_flags = (_local11.m_flags | b2Contact.e_toiFlag);
};
if ((((Number.MIN_VALUE < _local18)) && ((_local18 < _local13)))){
_local12 = _local11;
_local13 = _local18;
};
};
};
if ((((_local12 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local13)))){
break;
};
_local3 = _local12.m_shape1;
_local4 = _local12.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local5.Advance(_local13);
_local6.Advance(_local13);
_local12.Update(m_contactListener);
_local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag));
if (_local12.m_manifoldCount == 0){
} else {
_local14 = _local5;
if (_local14.IsStatic()){
_local14 = _local6;
};
_local8.Clear();
_local15 = 0;
var _temp1 = _local15;
_local15 = (_local15 + 1);
var _local22 = _temp1;
_local10[_local22] = _local14;
_local14.m_flags = (_local14.m_flags | b2Body.e_islandFlag);
while (_local15 > 0) {
--_local15;
_local2 = _local10[_local15];
_local8.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
if (_local2.IsStatic()){
} else {
_local7 = _local2.m_contactList;
while (_local7) {
if (_local8.m_contactCount == _local8.m_contactCapacity){
} else {
if ((_local7.contact.m_flags & ((b2Contact.e_islandFlag | b2Contact.e_slowFlag) | b2Contact.e_nonSolidFlag))){
} else {
if (_local7.contact.m_manifoldCount == 0){
} else {
_local8.AddContact(_local7.contact);
_local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag);
_local20 = _local7.other;
if ((_local20.m_flags & b2Body.e_islandFlag)){
} else {
if (_local20.IsStatic() == false){
_local20.Advance(_local13);
_local20.WakeUp();
};
var _temp2 = _local15;
_local15 = (_local15 + 1);
var _local23 = _temp2;
_local10[_local23] = _local20;
_local20.m_flags = (_local20.m_flags | b2Body.e_islandFlag);
};
};
};
};
_local7 = _local7.next;
};
};
};
_local16 = new b2TimeStep();
_local16.dt = ((1 - _local13) * _arg1.dt);
_local16.inv_dt = (1 / _local16.dt);
_local16.maxIterations = _arg1.maxIterations;
_local8.SolveTOI(_local16);
_local17 = 0;
while (_local17 < _local8.m_bodyCount) {
_local2 = _local8.m_bodies[_local17];
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local21 = _local2.SynchronizeShapes();
if ((((_local21 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
_local7 = _local2.m_contactList;
while (_local7) {
_local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag));
_local7 = _local7.next;
};
};
};
_local17++;
};
_local17 = 0;
while (_local17 < _local8.m_contactCount) {
_local11 = _local8.m_contacts[_local17];
_local8.m_contacts[_local17].m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local17++;
};
m_broadPhase.Commit();
};
};
}
public function GetJointList():b2Joint{
return (m_jointList);
}
public function Validate():void{
m_broadPhase.Validate();
}
public function GetPairCount():int{
return (m_broadPhase.m_pairManager.m_pairCount);
}
public function GetBodyList():b2Body{
return (m_bodyList);
}
public function SetWarmStarting(_arg1:Boolean):void{
m_warmStarting = _arg1;
}
public function SetPositionCorrection(_arg1:Boolean):void{
m_positionCorrection = _arg1;
}
public function CreateJoint(_arg1:b2JointDef):b2Joint{
var _local2:b2Joint;
var _local3:b2Body;
var _local4:b2Shape;
_local2 = b2Joint.Create(_arg1, m_blockAllocator);
_local2.m_prev = null;
_local2.m_next = m_jointList;
if (m_jointList){
m_jointList.m_prev = _local2;
};
m_jointList = _local2;
m_jointCount++;
_local2.m_node1.joint = _local2;
_local2.m_node1.other = _local2.m_body2;
_local2.m_node1.prev = null;
_local2.m_node1.next = _local2.m_body1.m_jointList;
if (_local2.m_body1.m_jointList){
_local2.m_body1.m_jointList.prev = _local2.m_node1;
};
_local2.m_body1.m_jointList = _local2.m_node1;
_local2.m_node2.joint = _local2;
_local2.m_node2.other = _local2.m_body1;
_local2.m_node2.prev = null;
_local2.m_node2.next = _local2.m_body2.m_jointList;
if (_local2.m_body2.m_jointList){
_local2.m_body2.m_jointList.prev = _local2.m_node2;
};
_local2.m_body2.m_jointList = _local2.m_node2;
if (_arg1.collideConnected == false){
_local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2;
_local4 = _local3.m_shapeList;
while (_local4) {
_local4.RefilterProxy(m_broadPhase, _local3.m_xf);
_local4 = _local4.m_next;
};
};
return (_local2);
}
public function DestroyJoint(_arg1:b2Joint):void{
var _local2:Boolean;
var _local3:b2Body;
var _local4:b2Body;
var _local5:b2Body;
var _local6:b2Shape;
_local2 = _arg1.m_collideConnected;
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_jointList){
m_jointList = _arg1.m_next;
};
_local3 = _arg1.m_body1;
_local4 = _arg1.m_body2;
_local3.WakeUp();
_local4.WakeUp();
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local3.m_jointList){
_local3.m_jointList = _arg1.m_node1.next;
};
_arg1.m_node1.prev = null;
_arg1.m_node1.next = null;
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local4.m_jointList){
_local4.m_jointList = _arg1.m_node2.next;
};
_arg1.m_node2.prev = null;
_arg1.m_node2.next = null;
b2Joint.Destroy(_arg1, m_blockAllocator);
m_jointCount--;
if (_local2 == false){
_local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4;
_local6 = _local5.m_shapeList;
while (_local6) {
_local6.RefilterProxy(m_broadPhase, _local5.m_xf);
_local6 = _local6.m_next;
};
};
}
public function SetContactListener(_arg1:b2ContactListener):void{
m_contactListener = _arg1;
}
public function CreateBody(_arg1:b2BodyDef):b2Body{
var _local2:b2Body;
if (m_lock == true){
return (null);
};
_local2 = new b2Body(_arg1, this);
_local2.m_prev = null;
_local2.m_next = m_bodyList;
if (m_bodyList){
m_bodyList.m_prev = _local2;
};
m_bodyList = _local2;
m_bodyCount++;
return (_local2);
}
public function SetBoundaryListener(_arg1:b2BoundaryListener):void{
m_boundaryListener = _arg1;
}
public function SetDestructionListener(_arg1:b2DestructionListener):void{
m_destructionListener = _arg1;
}
public function Step(_arg1:Number, _arg2:int):void{
var _local3:b2TimeStep;
m_lock = true;
_local3 = new b2TimeStep();
_local3.dt = _arg1;
_local3.maxIterations = _arg2;
if (_arg1 > 0){
_local3.inv_dt = (1 / _arg1);
} else {
_local3.inv_dt = 0;
};
_local3.dtRatio = (m_inv_dt0 * _arg1);
_local3.positionCorrection = m_positionCorrection;
_local3.warmStarting = m_warmStarting;
m_contactManager.Collide();
if (_local3.dt > 0){
Solve(_local3);
};
if (((m_continuousPhysics) && ((_local3.dt > 0)))){
SolveTOI(_local3);
};
DrawDebugData();
m_inv_dt0 = _local3.inv_dt;
m_lock = false;
}
public function GetBodyCount():int{
return (m_bodyCount);
}
public function GetJointCount():int{
return (m_jointCount);
}
}
}//package Box2D.Dynamics
Section 89
//AuxFunctions (caurina.transitions.AuxFunctions)
package caurina.transitions {
public class AuxFunctions {
public static function concatObjects(... _args):Object{
var _local2:Object;
var _local3:Object;
var _local4:int;
var _local5:String;
_local2 = {};
_local4 = 0;
while (_local4 < _args.length) {
_local3 = _args[_local4];
for (_local5 in _local3) {
if (_local3[_local5] == null){
delete _local2[_local5];
} else {
_local2[_local5] = _local3[_local5];
};
};
_local4++;
};
return (_local2);
}
public static function numberToG(_arg1:Number):Number{
return (((_arg1 & 0xFF00) >> 8));
}
public static function numberToR(_arg1:Number):Number{
return (((_arg1 & 0xFF0000) >> 16));
}
public static function isInArray(_arg1:String, _arg2:Array):Boolean{
var _local3:uint;
var _local4:uint;
_local3 = _arg2.length;
_local4 = 0;
while (_local4 < _local3) {
if (_arg2[_local4] == _arg1){
return (true);
};
_local4++;
};
return (false);
}
public static function getObjectLength(_arg1:Object):uint{
var _local2:uint;
var _local3:String;
_local2 = 0;
for (_local3 in _arg1) {
_local2++;
};
return (_local2);
}
public static function numberToB(_arg1:Number):Number{
return ((_arg1 & 0xFF));
}
}
}//package caurina.transitions
Section 90
//Equations (caurina.transitions.Equations)
package caurina.transitions {
public class Equations {
public static function easeOutBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
if (_arg1 < (1 / 2.75)){
return (((_arg3 * ((7.5625 * _arg1) * _arg1)) + _arg2));
};
if (_arg1 < (2 / 2.75)){
_arg1 = (_arg1 - (1.5 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.75)) + _arg2));
};
if (_arg1 < (2.5 / 2.75)){
_arg1 = (_arg1 - (2.25 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.9375)) + _arg2));
};
_arg1 = (_arg1 - (2.625 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.984375)) + _arg2));
}
public static function easeInOutElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number;
var _local7:Number;
var _local8:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 == 2){
return ((_arg2 + _arg3));
};
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * (0.3 * 1.5)) : _arg5.period;
_local8 = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
if (_arg1 < 1){
--_arg1;
return (((-0.5 * ((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2));
};
--_arg1;
return ((((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) * 0.5) + _arg3) + _arg2));
}
public static function easeInOutQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * _arg1) * _arg1) + _arg2));
};
--_arg1;
return ((((-(_arg3) / 2) * ((_arg1 * (_arg1 - 2)) - 1)) + _arg2));
}
public static function easeInOutBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (((easeInBounce((_arg1 * 2), 0, _arg3, _arg4) * 0.5) + _arg2));
};
return ((((easeOutBounce(((_arg1 * 2) - _arg4), 0, _arg3, _arg4) * 0.5) + (_arg3 * 0.5)) + _arg2));
}
public static function easeInOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number;
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
_local6 = (_local6 * 1.525);
return ((((_arg3 / 2) * ((_arg1 * _arg1) * (((_local6 + 1) * _arg1) - _local6))) + _arg2));
};
_arg1 = (_arg1 - 2);
_local6 = (_local6 * 1.525);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 2)) + _arg2));
}
public static function easeOutInCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutCubic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInCubic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number;
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 1)) + _arg2));
}
public static function easeInOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((-(_arg3) / 2) * (Math.cos(((Math.PI * _arg1) / _arg4)) - 1)) + _arg2));
}
public static function easeInBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number;
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * (((_local6 + 1) * _arg1) - _local6)) + _arg2));
}
public static function easeInQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeOutInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuint((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuint(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutBounce((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInBounce(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function init():void{
Tweener.registerTransition("easenone", easeNone);
Tweener.registerTransition("linear", easeNone);
Tweener.registerTransition("easeinquad", easeInQuad);
Tweener.registerTransition("easeoutquad", easeOutQuad);
Tweener.registerTransition("easeinoutquad", easeInOutQuad);
Tweener.registerTransition("easeoutinquad", easeOutInQuad);
Tweener.registerTransition("easeincubic", easeInCubic);
Tweener.registerTransition("easeoutcubic", easeOutCubic);
Tweener.registerTransition("easeinoutcubic", easeInOutCubic);
Tweener.registerTransition("easeoutincubic", easeOutInCubic);
Tweener.registerTransition("easeinquart", easeInQuart);
Tweener.registerTransition("easeoutquart", easeOutQuart);
Tweener.registerTransition("easeinoutquart", easeInOutQuart);
Tweener.registerTransition("easeoutinquart", easeOutInQuart);
Tweener.registerTransition("easeinquint", easeInQuint);
Tweener.registerTransition("easeoutquint", easeOutQuint);
Tweener.registerTransition("easeinoutquint", easeInOutQuint);
Tweener.registerTransition("easeoutinquint", easeOutInQuint);
Tweener.registerTransition("easeinsine", easeInSine);
Tweener.registerTransition("easeoutsine", easeOutSine);
Tweener.registerTransition("easeinoutsine", easeInOutSine);
Tweener.registerTransition("easeoutinsine", easeOutInSine);
Tweener.registerTransition("easeincirc", easeInCirc);
Tweener.registerTransition("easeoutcirc", easeOutCirc);
Tweener.registerTransition("easeinoutcirc", easeInOutCirc);
Tweener.registerTransition("easeoutincirc", easeOutInCirc);
Tweener.registerTransition("easeinexpo", easeInExpo);
Tweener.registerTransition("easeoutexpo", easeOutExpo);
Tweener.registerTransition("easeinoutexpo", easeInOutExpo);
Tweener.registerTransition("easeoutinexpo", easeOutInExpo);
Tweener.registerTransition("easeinelastic", easeInElastic);
Tweener.registerTransition("easeoutelastic", easeOutElastic);
Tweener.registerTransition("easeinoutelastic", easeInOutElastic);
Tweener.registerTransition("easeoutinelastic", easeOutInElastic);
Tweener.registerTransition("easeinback", easeInBack);
Tweener.registerTransition("easeoutback", easeOutBack);
Tweener.registerTransition("easeinoutback", easeInOutBack);
Tweener.registerTransition("easeoutinback", easeOutInBack);
Tweener.registerTransition("easeinbounce", easeInBounce);
Tweener.registerTransition("easeoutbounce", easeOutBounce);
Tweener.registerTransition("easeinoutbounce", easeInOutBounce);
Tweener.registerTransition("easeoutinbounce", easeOutInBounce);
}
public static function easeOutExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg1)==_arg4) ? (_arg2 + _arg3) : (((_arg3 * 1.001) * (-(Math.pow(2, ((-10 * _arg1) / _arg4))) + 1)) + _arg2));
}
public static function easeOutInBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutBack((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInBack(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg1)==0) ? _arg2 : (((_arg3 * Math.pow(2, (10 * ((_arg1 / _arg4) - 1)))) + _arg2) - (_arg3 * 0.001)));
}
public static function easeInCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((-(_arg3) / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) + 1)) + _arg2));
}
public static function easeInQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((_arg3 * _arg1) * _arg1) + _arg2));
}
public static function easeInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg3 - easeOutBounce((_arg4 - _arg1), 0, _arg3, _arg4)) + _arg2));
}
public static function easeOutInExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutExpo((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInExpo(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((-(_arg3) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 1)) + _arg2));
}
public static function easeInSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((-(_arg3) * Math.cos(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg3) + _arg2));
}
public static function easeInOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((-(_arg3) / 2) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 2)) + _arg2));
}
public static function easeOutQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function easeOutInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutElastic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInElastic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number;
var _local7:Number;
var _local8:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period;
_local8 = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
--_arg1;
return ((-(((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2));
}
public static function easeOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeOutQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeOutInQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuad((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuad(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg3 * Math.sin(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg2));
}
public static function easeInOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):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));
}
public static function easeInOutQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 2)) + _arg2));
}
public static function easeInCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((-(_arg3) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
}
public static function easeOutInSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutSine((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInSine(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInOutExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 == 0){
return (_arg2);
};
if (_arg1 == _arg4){
return ((_arg2 + _arg3));
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * Math.pow(2, (10 * (_arg1 - 1)))) + _arg2) - (_arg3 * 0.0005)));
};
--_arg1;
return (((((_arg3 / 2) * 1.0005) * (-(Math.pow(2, (-10 * _arg1))) + 2)) + _arg2));
}
public static function easeOutElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number;
var _local7:Number;
var _local8:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period;
_local8 = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
return (((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) + _arg3) + _arg2));
}
public static function easeOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * Math.sqrt((1 - (_arg1 * _arg1)))) + _arg2));
}
public static function easeOutInQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuart((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuart(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutInCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutCirc((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInCirc(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
}
}//package caurina.transitions
Section 91
//PropertyInfoObj (caurina.transitions.PropertyInfoObj)
package caurina.transitions {
public class PropertyInfoObj {
public var originalValueComplete:Object;
public var modifierParameters:Array;
public var isSpecialProperty:Boolean;
public var hasModifier:Boolean;
public var valueComplete:Number;
public var extra:Object;
public var valueStart:Number;
public var modifierFunction:Function;
public var arrayIndex:Number;
public function PropertyInfoObj(_arg1:Number, _arg2:Number, _arg3:Object, _arg4:Number, _arg5:Object, _arg6:Boolean, _arg7:Function, _arg8:Array){
valueStart = _arg1;
valueComplete = _arg2;
originalValueComplete = _arg3;
arrayIndex = _arg4;
extra = _arg5;
isSpecialProperty = _arg6;
hasModifier = Boolean(_arg7);
modifierFunction = _arg7;
modifierParameters = _arg8;
}
public function toString():String{
var _local1:String;
_local1 = "\n[PropertyInfoObj ";
_local1 = (_local1 + ("valueStart:" + String(valueStart)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("valueComplete:" + String(valueComplete)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("originalValueComplete:" + String(originalValueComplete)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("arrayIndex:" + String(arrayIndex)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("extra:" + String(extra)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("isSpecialProperty:" + String(isSpecialProperty)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("hasModifier:" + String(hasModifier)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("modifierFunction:" + String(modifierFunction)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("modifierParameters:" + String(modifierParameters)));
_local1 = (_local1 + "]\n");
return (_local1);
}
public function clone():PropertyInfoObj{
var _local1:PropertyInfoObj;
_local1 = new PropertyInfoObj(valueStart, valueComplete, originalValueComplete, arrayIndex, extra, isSpecialProperty, modifierFunction, modifierParameters);
return (_local1);
}
}
}//package caurina.transitions
Section 92
//SpecialProperty (caurina.transitions.SpecialProperty)
package caurina.transitions {
public class SpecialProperty {
public var parameters:Array;
public var preProcess:Function;
public var setValue:Function;
public var getValue:Function;
public function SpecialProperty(_arg1:Function, _arg2:Function, _arg3:Array=null, _arg4:Function=null){
getValue = _arg1;
setValue = _arg2;
parameters = _arg3;
preProcess = _arg4;
}
public function toString():String{
var _local1:String;
_local1 = "";
_local1 = (_local1 + "[SpecialProperty ");
_local1 = (_local1 + ("getValue:" + String(getValue)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("setValue:" + String(setValue)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("parameters:" + String(parameters)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("preProcess:" + String(preProcess)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 93
//SpecialPropertyModifier (caurina.transitions.SpecialPropertyModifier)
package caurina.transitions {
public class SpecialPropertyModifier {
public var getValue:Function;
public var modifyValues:Function;
public function SpecialPropertyModifier(_arg1:Function, _arg2:Function){
modifyValues = _arg1;
getValue = _arg2;
}
public function toString():String{
var _local1:String;
_local1 = "";
_local1 = (_local1 + "[SpecialPropertyModifier ");
_local1 = (_local1 + ("modifyValues:" + String(modifyValues)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("getValue:" + String(getValue)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 94
//SpecialPropertySplitter (caurina.transitions.SpecialPropertySplitter)
package caurina.transitions {
public class SpecialPropertySplitter {
public var parameters:Array;
public var splitValues:Function;
public function SpecialPropertySplitter(_arg1:Function, _arg2:Array){
splitValues = _arg1;
parameters = _arg2;
}
public function toString():String{
var _local1:String;
_local1 = "";
_local1 = (_local1 + "[SpecialPropertySplitter ");
_local1 = (_local1 + ("splitValues:" + String(splitValues)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("parameters:" + String(parameters)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 95
//Tweener (caurina.transitions.Tweener)
package caurina.transitions {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class Tweener {
private static var _timeScale:Number = 1;
private static var _currentTimeFrame:Number;
private static var _specialPropertySplitterList:Object;
private static var _engineExists:Boolean = false;
private static var _specialPropertyModifierList:Object;
private static var _currentTime:Number;
private static var _tweenList:Array;
private static var _specialPropertyList:Object;
private static var _transitionList:Object;
private static var _inited:Boolean = false;
private static var __tweener_controller__:MovieClip;
public static function registerSpecialPropertyModifier(_arg1:String, _arg2:Function, _arg3:Function):void{
var _local4:SpecialPropertyModifier;
if (!_inited){
init();
};
_local4 = new SpecialPropertyModifier(_arg2, _arg3);
_specialPropertyModifierList[_arg1] = _local4;
}
public static function registerSpecialProperty(_arg1:String, _arg2:Function, _arg3:Function, _arg4:Array=null, _arg5:Function=null):void{
var _local6:SpecialProperty;
if (!_inited){
init();
};
_local6 = new SpecialProperty(_arg2, _arg3, _arg4, _arg5);
_specialPropertyList[_arg1] = _local6;
}
public static function init(... _args):void{
_inited = true;
_transitionList = new Object();
Equations.init();
_specialPropertyList = new Object();
_specialPropertyModifierList = new Object();
_specialPropertySplitterList = new Object();
}
private static function updateTweens():Boolean{
var _local1:int;
if (_tweenList.length == 0){
return (false);
};
_local1 = 0;
while (_local1 < _tweenList.length) {
if ((((_tweenList[_local1] == undefined)) || (!(_tweenList[_local1].isPaused)))){
if (!updateTweenByIndex(_local1)){
removeTweenByIndex(_local1);
};
if (_tweenList[_local1] == null){
removeTweenByIndex(_local1, true);
_local1--;
};
};
_local1++;
};
return (true);
}
public static function addCaller(_arg1:Object=null, _arg2:Object=null):Boolean{
var _local3:Number;
var _local4:Array;
var _local5:Object;
var _local6:Number;
var _local7:Number;
var _local8:Function;
var _local9:TweenListObj;
var _local10:Number;
var _local11:String;
if (!Boolean(_arg1)){
return (false);
};
if ((_arg1 is Array)){
_local4 = _arg1.concat();
} else {
_local4 = [_arg1];
};
_local5 = _arg2;
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
_local6 = (isNaN(_local5.time)) ? 0 : _local5.time;
_local7 = (isNaN(_local5.delay)) ? 0 : _local5.delay;
if (typeof(_local5.transition) == "string"){
_local11 = _local5.transition.toLowerCase();
_local8 = _transitionList[_local11];
} else {
_local8 = _local5.transition;
};
if (!Boolean(_local8)){
_local8 = _transitionList["easeoutexpo"];
};
_local3 = 0;
while (_local3 < _local4.length) {
if (_local5.useFrames == true){
_local9 = new TweenListObj(_local4[_local3], (_currentTimeFrame + (_local7 / _timeScale)), (_currentTimeFrame + ((_local7 + _local6) / _timeScale)), true, _local8, _local5.transitionParams);
} else {
_local9 = new TweenListObj(_local4[_local3], (_currentTime + ((_local7 * 1000) / _timeScale)), (_currentTime + (((_local7 * 1000) + (_local6 * 1000)) / _timeScale)), false, _local8, _local5.transitionParams);
};
_local9.properties = null;
_local9.onStart = _local5.onStart;
_local9.onUpdate = _local5.onUpdate;
_local9.onComplete = _local5.onComplete;
_local9.onOverwrite = _local5.onOverwrite;
_local9.onStartParams = _local5.onStartParams;
_local9.onUpdateParams = _local5.onUpdateParams;
_local9.onCompleteParams = _local5.onCompleteParams;
_local9.onOverwriteParams = _local5.onOverwriteParams;
_local9.onStartScope = _local5.onStartScope;
_local9.onUpdateScope = _local5.onUpdateScope;
_local9.onCompleteScope = _local5.onCompleteScope;
_local9.onOverwriteScope = _local5.onOverwriteScope;
_local9.onErrorScope = _local5.onErrorScope;
_local9.isCaller = true;
_local9.count = _local5.count;
_local9.waitFrames = _local5.waitFrames;
_tweenList.push(_local9);
if ((((_local6 == 0)) && ((_local7 == 0)))){
_local10 = (_tweenList.length - 1);
updateTweenByIndex(_local10);
removeTweenByIndex(_local10);
};
_local3++;
};
return (true);
}
public static function pauseAllTweens():Boolean{
var _local1:Boolean;
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
_local1 = false;
_local2 = 0;
while (_local2 < _tweenList.length) {
pauseTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
public static function removeTweens(_arg1:Object, ... _args):Boolean{
var _local3:Array;
var _local4:uint;
_local3 = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && (!(AuxFunctions.isInArray(_args[_local4], _local3))))){
_local3.push(_args[_local4]);
};
_local4++;
};
return (affectTweens(removeTweenByIndex, _arg1, _local3));
}
public static function splitTweens(_arg1:Number, _arg2:Array):uint{
var _local3:TweenListObj;
var _local4:TweenListObj;
var _local5:uint;
var _local6:String;
var _local7:Boolean;
_local3 = _tweenList[_arg1];
_local4 = _local3.clone(false);
_local5 = 0;
while (_local5 < _arg2.length) {
_local6 = _arg2[_local5];
if (Boolean(_local3.properties[_local6])){
_local3.properties[_local6] = undefined;
delete _local3.properties[_local6];
};
_local5++;
};
for (_local6 in _local4.properties) {
_local7 = false;
_local5 = 0;
while (_local5 < _arg2.length) {
if (_arg2[_local5] == _local6){
_local7 = true;
break;
};
_local5++;
};
if (!_local7){
_local4.properties[_local6] = undefined;
delete _local4.properties[_local6];
};
};
_tweenList.push(_local4);
return ((_tweenList.length - 1));
}
public static function updateFrame():void{
_currentTimeFrame++;
}
public static function resumeTweenByIndex(_arg1:Number):Boolean{
var _local2:TweenListObj;
var _local3:Number;
_local2 = _tweenList[_arg1];
if ((((_local2 == null)) || (!(_local2.isPaused)))){
return (false);
};
_local3 = getCurrentTweeningTime(_local2);
_local2.timeStart = (_local2.timeStart + (_local3 - _local2.timePaused));
_local2.timeComplete = (_local2.timeComplete + (_local3 - _local2.timePaused));
_local2.timePaused = undefined;
_local2.isPaused = false;
return (true);
}
public static function getVersion():String{
return ("AS3 1.31.71");
}
public static function onEnterFrame(_arg1:Event):void{
var _local2:Boolean;
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
updateTime();
updateFrame();
_local2 = false;
_local2 = updateTweens();
}
public static function updateTime():void{
_currentTime = getTimer();
}
private static function updateTweenByIndex(_arg1:Number):Boolean{
var tTweening:TweenListObj;
var isOver:Boolean;
var mustUpdate:Boolean;
var nv:Number;
var t:Number;
var b:Number;
var c:Number;
var d:Number;
var pName:String;
var eventScope:Object;
var tScope:Object;
var cTime:Number;
var tProperty:Object;
var pv:Number;
var i = _arg1;
tTweening = _tweenList[i];
if ((((tTweening == null)) || (!(Boolean(tTweening.scope))))){
return (false);
};
isOver = false;
cTime = getCurrentTweeningTime(tTweening);
if (cTime >= tTweening.timeStart){
tScope = tTweening.scope;
if (tTweening.isCaller){
do {
t = (((tTweening.timeComplete - tTweening.timeStart) / tTweening.count) * (tTweening.timesCalled + 1));
b = tTweening.timeStart;
c = (tTweening.timeComplete - tTweening.timeStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, b, c, d);
} while (!(cTime >= nv));
} else {
mustUpdate = (((((tTweening.skipUpdates < 1)) || (!(tTweening.skipUpdates)))) || ((tTweening.updatesSkipped >= tTweening.skipUpdates)));
if (cTime >= tTweening.timeComplete){
isOver = true;
mustUpdate = true;
};
if (!tTweening.hasStarted){
if (Boolean(tTweening.onStart)){
eventScope = (Boolean(tTweening.onStartScope)) ? tTweening.onStartScope : tScope;
try {
tTweening.onStart.apply(eventScope, tTweening.onStartParams);
} catch(e:Error) {
handleError(tTweening, e, "onStart");
};
};
for (pName in tTweening.properties) {
if (tTweening.properties[pName].isSpecialProperty){
if (Boolean(_specialPropertyList[pName].preProcess)){
tTweening.properties[pName].valueComplete = _specialPropertyList[pName].preProcess(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].originalValueComplete, tTweening.properties[pName].extra);
};
pv = _specialPropertyList[pName].getValue(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra);
} else {
pv = tScope[pName];
};
tTweening.properties[pName].valueStart = (isNaN(pv)) ? tTweening.properties[pName].valueComplete : pv;
};
mustUpdate = true;
tTweening.hasStarted = true;
};
if (mustUpdate){
for (pName in tTweening.properties) {
tProperty = tTweening.properties[pName];
if (isOver){
nv = tProperty.valueComplete;
} else {
if (tProperty.hasModifier){
t = (cTime - tTweening.timeStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, 0, 1, d, tTweening.transitionParams);
nv = tProperty.modifierFunction(tProperty.valueStart, tProperty.valueComplete, nv, tProperty.modifierParameters);
} else {
t = (cTime - tTweening.timeStart);
b = tProperty.valueStart;
c = (tProperty.valueComplete - tProperty.valueStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, b, c, d, tTweening.transitionParams);
};
};
if (tTweening.rounded){
nv = Math.round(nv);
};
if (tProperty.isSpecialProperty){
_specialPropertyList[pName].setValue(tScope, nv, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra);
} else {
tScope[pName] = nv;
};
};
tTweening.updatesSkipped = 0;
if (Boolean(tTweening.onUpdate)){
eventScope = (Boolean(tTweening.onUpdateScope)) ? tTweening.onUpdateScope : tScope;
try {
tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams);
} catch(e:Error) {
handleError(tTweening, e, "onUpdate");
};
};
} else {
tTweening.updatesSkipped++;
};
};
if (((isOver) && (Boolean(tTweening.onComplete)))){
eventScope = (Boolean(tTweening.onCompleteScope)) ? tTweening.onCompleteScope : tScope;
try {
tTweening.onComplete.apply(eventScope, tTweening.onCompleteParams);
} catch(e:Error) {
handleError(tTweening, e, "onComplete");
};
};
return (!(isOver));
};
return (true);
}
public static function setTimeScale(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
if (isNaN(_arg1)){
_arg1 = 1;
};
if (_arg1 < 1E-5){
_arg1 = 1E-5;
};
if (_arg1 != _timeScale){
if (_tweenList != null){
_local2 = 0;
while (_local2 < _tweenList.length) {
_local3 = getCurrentTweeningTime(_tweenList[_local2]);
_tweenList[_local2].timeStart = (_local3 - (((_local3 - _tweenList[_local2].timeStart) * _timeScale) / _arg1));
_tweenList[_local2].timeComplete = (_local3 - (((_local3 - _tweenList[_local2].timeComplete) * _timeScale) / _arg1));
if (_tweenList[_local2].timePaused != undefined){
_tweenList[_local2].timePaused = (_local3 - (((_local3 - _tweenList[_local2].timePaused) * _timeScale) / _arg1));
};
_local2++;
};
};
_timeScale = _arg1;
};
}
public static function resumeAllTweens():Boolean{
var _local1:Boolean;
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
_local1 = false;
_local2 = 0;
while (_local2 < _tweenList.length) {
resumeTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
private static function handleError(_arg1:TweenListObj, _arg2:Error, _arg3:String):void{
var eventScope:Object;
var pTweening = _arg1;
var pError = _arg2;
var pCallBackName = _arg3;
if (((Boolean(pTweening.onError)) && ((pTweening.onError is Function)))){
eventScope = (Boolean(pTweening.onErrorScope)) ? pTweening.onErrorScope : pTweening.scope;
try {
pTweening.onError.apply(eventScope, [pTweening.scope, pError]);
} catch(metaError:Error) {
printError(((((String(pTweening.scope) + " raised an error while executing the 'onError' handler. Original error:\n ") + pError.getStackTrace()) + "\nonError error: ") + metaError.getStackTrace()));
};
} else {
if (!Boolean(pTweening.onError)){
printError(((((String(pTweening.scope) + " raised an error while executing the '") + pCallBackName) + "'handler. \n") + pError.getStackTrace()));
};
};
}
private static function startEngine():void{
_engineExists = true;
_tweenList = new Array();
__tweener_controller__ = new MovieClip();
_currentTimeFrame = 0;
updateTime();
}
public static function removeAllTweens():Boolean{
var _local1:Boolean;
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
_local1 = false;
_local2 = 0;
while (_local2 < _tweenList.length) {
removeTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
public static function addTween(_arg1:Object=null, _arg2:Object=null):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:String;
var _local6:Array;
var _local7:Object;
var _local8:Number;
var _local9:Number;
var _local10:Array;
var _local11:Object;
var _local12:Object;
var _local13:Function;
var _local14:Object;
var _local15:TweenListObj;
var _local16:Number;
var _local17:Array;
var _local18:Array;
var _local19:Array;
var _local20:String;
if (!Boolean(_arg1)){
return (false);
};
if ((_arg1 is Array)){
_local6 = _arg1.concat();
} else {
_local6 = [_arg1];
};
_local7 = TweenListObj.makePropertiesChain(_arg2);
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
_local8 = (isNaN(_local7.time)) ? 0 : _local7.time;
_local9 = (isNaN(_local7.delay)) ? 0 : _local7.delay;
_local10 = new Array();
_local11 = {time:true, delay:true, useFrames:true, skipUpdates:true, transition:true, transitionParams:true, onStart:true, onUpdate:true, onComplete:true, onOverwrite:true, onError:true, rounded:true, onStartParams:true, onUpdateParams:true, onCompleteParams:true, onOverwriteParams:true, onStartScope:true, onUpdateScope:true, onCompleteScope:true, onOverwriteScope:true, onErrorScope:true};
_local12 = new Object();
for (_local5 in _local7) {
if (!_local11[_local5]){
if (_specialPropertySplitterList[_local5]){
_local17 = _specialPropertySplitterList[_local5].splitValues(_local7[_local5], _specialPropertySplitterList[_local5].parameters);
_local3 = 0;
while (_local3 < _local17.length) {
if (_specialPropertySplitterList[_local17[_local3].name]){
_local18 = _specialPropertySplitterList[_local17[_local3].name].splitValues(_local17[_local3].value, _specialPropertySplitterList[_local17[_local3].name].parameters);
_local4 = 0;
while (_local4 < _local18.length) {
_local10[_local18[_local4].name] = {valueStart:undefined, valueComplete:_local18[_local4].value, arrayIndex:_local18[_local4].arrayIndex, isSpecialProperty:false};
_local4++;
};
} else {
_local10[_local17[_local3].name] = {valueStart:undefined, valueComplete:_local17[_local3].value, arrayIndex:_local17[_local3].arrayIndex, isSpecialProperty:false};
};
_local3++;
};
} else {
if (_specialPropertyModifierList[_local5] != undefined){
_local19 = _specialPropertyModifierList[_local5].modifyValues(_local7[_local5]);
_local3 = 0;
while (_local3 < _local19.length) {
_local12[_local19[_local3].name] = {modifierParameters:_local19[_local3].parameters, modifierFunction:_specialPropertyModifierList[_local5].getValue};
_local3++;
};
} else {
_local10[_local5] = {valueStart:undefined, valueComplete:_local7[_local5]};
};
};
};
};
for (_local5 in _local10) {
if (_specialPropertyList[_local5] != undefined){
_local10[_local5].isSpecialProperty = true;
} else {
if (_local6[0][_local5] == undefined){
printError((((("The property '" + _local5) + "' doesn't seem to be a normal object property of ") + String(_local6[0])) + " or a registered special property."));
};
};
};
for (_local5 in _local12) {
if (_local10[_local5] != undefined){
_local10[_local5].modifierParameters = _local12[_local5].modifierParameters;
_local10[_local5].modifierFunction = _local12[_local5].modifierFunction;
};
};
if (typeof(_local7.transition) == "string"){
_local20 = _local7.transition.toLowerCase();
_local13 = _transitionList[_local20];
} else {
_local13 = _local7.transition;
};
if (!Boolean(_local13)){
_local13 = _transitionList["easeoutexpo"];
};
_local3 = 0;
while (_local3 < _local6.length) {
_local14 = new Object();
for (_local5 in _local10) {
_local14[_local5] = new PropertyInfoObj(_local10[_local5].valueStart, _local10[_local5].valueComplete, _local10[_local5].valueComplete, _local10[_local5].arrayIndex, {}, _local10[_local5].isSpecialProperty, _local10[_local5].modifierFunction, _local10[_local5].modifierParameters);
};
if (_local7.useFrames == true){
_local15 = new TweenListObj(_local6[_local3], (_currentTimeFrame + (_local9 / _timeScale)), (_currentTimeFrame + ((_local9 + _local8) / _timeScale)), true, _local13, _local7.transitionParams);
} else {
_local15 = new TweenListObj(_local6[_local3], (_currentTime + ((_local9 * 1000) / _timeScale)), (_currentTime + (((_local9 * 1000) + (_local8 * 1000)) / _timeScale)), false, _local13, _local7.transitionParams);
};
_local15.properties = _local14;
_local15.onStart = _local7.onStart;
_local15.onUpdate = _local7.onUpdate;
_local15.onComplete = _local7.onComplete;
_local15.onOverwrite = _local7.onOverwrite;
_local15.onError = _local7.onError;
_local15.onStartParams = _local7.onStartParams;
_local15.onUpdateParams = _local7.onUpdateParams;
_local15.onCompleteParams = _local7.onCompleteParams;
_local15.onOverwriteParams = _local7.onOverwriteParams;
_local15.onStartScope = _local7.onStartScope;
_local15.onUpdateScope = _local7.onUpdateScope;
_local15.onCompleteScope = _local7.onCompleteScope;
_local15.onOverwriteScope = _local7.onOverwriteScope;
_local15.onErrorScope = _local7.onErrorScope;
_local15.rounded = _local7.rounded;
_local15.skipUpdates = _local7.skipUpdates;
removeTweensByTime(_local15.scope, _local15.properties, _local15.timeStart, _local15.timeComplete);
_tweenList.push(_local15);
if ((((_local8 == 0)) && ((_local9 == 0)))){
_local16 = (_tweenList.length - 1);
updateTweenByIndex(_local16);
removeTweenByIndex(_local16);
};
_local3++;
};
return (true);
}
public static function registerTransition(_arg1:String, _arg2:Function):void{
if (!_inited){
init();
};
_transitionList[_arg1] = _arg2;
}
public static function printError(_arg1:String):void{
}
private static function affectTweens(_arg1:Function, _arg2:Object, _arg3:Array):Boolean{
var _local4:Boolean;
var _local5:uint;
var _local6:Array;
var _local7:uint;
var _local8:uint;
var _local9:uint;
_local4 = false;
if (!Boolean(_tweenList)){
return (false);
};
_local5 = 0;
while (_local5 < _tweenList.length) {
if (((_tweenList[_local5]) && ((_tweenList[_local5].scope == _arg2)))){
if (_arg3.length == 0){
_arg1(_local5);
_local4 = true;
} else {
_local6 = new Array();
_local7 = 0;
while (_local7 < _arg3.length) {
if (Boolean(_tweenList[_local5].properties[_arg3[_local7]])){
_local6.push(_arg3[_local7]);
};
_local7++;
};
if (_local6.length > 0){
_local8 = AuxFunctions.getObjectLength(_tweenList[_local5].properties);
if (_local8 == _local6.length){
_arg1(_local5);
_local4 = true;
} else {
_local9 = splitTweens(_local5, _local6);
_arg1(_local9);
_local4 = true;
};
};
};
};
_local5++;
};
return (_local4);
}
public static function getTweens(_arg1:Object):Array{
var _local2:uint;
var _local3:String;
var _local4:Array;
if (!Boolean(_tweenList)){
return ([]);
};
_local4 = new Array();
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
for (_local3 in _tweenList[_local2].properties) {
_local4.push(_local3);
};
};
_local2++;
};
return (_local4);
}
public static function isTweening(_arg1:Object):Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
return (true);
};
_local2++;
};
return (false);
}
public static function pauseTweenByIndex(_arg1:Number):Boolean{
var _local2:TweenListObj;
_local2 = _tweenList[_arg1];
if ((((_local2 == null)) || (_local2.isPaused))){
return (false);
};
_local2.timePaused = getCurrentTweeningTime(_local2);
_local2.isPaused = true;
return (true);
}
public static function getCurrentTweeningTime(_arg1:Object):Number{
return ((_arg1.useFrames) ? _currentTimeFrame : _currentTime);
}
public static function getTweenCount(_arg1:Object):Number{
var _local2:uint;
var _local3:Number;
if (!Boolean(_tweenList)){
return (0);
};
_local3 = 0;
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
_local3 = (_local3 + AuxFunctions.getObjectLength(_tweenList[_local2].properties));
};
_local2++;
};
return (_local3);
}
private static function stopEngine():void{
_engineExists = false;
_tweenList = null;
_currentTime = 0;
_currentTimeFrame = 0;
__tweener_controller__ = null;
}
public static function removeTweensByTime(_arg1:Object, _arg2:Object, _arg3:Number, _arg4:Number):Boolean{
var removed:Boolean;
var removedLocally:Boolean;
var i:uint;
var tl:uint;
var pName:String;
var eventScope:Object;
var p_scope = _arg1;
var p_properties = _arg2;
var p_timeStart = _arg3;
var p_timeComplete = _arg4;
removed = false;
tl = _tweenList.length;
i = 0;
while (i < tl) {
if (((Boolean(_tweenList[i])) && ((p_scope == _tweenList[i].scope)))){
if ((((p_timeComplete > _tweenList[i].timeStart)) && ((p_timeStart < _tweenList[i].timeComplete)))){
removedLocally = false;
for (pName in _tweenList[i].properties) {
if (Boolean(p_properties[pName])){
if (Boolean(_tweenList[i].onOverwrite)){
eventScope = (Boolean(_tweenList[i].onOverwriteScope)) ? _tweenList[i].onOverwriteScope : _tweenList[i].scope;
try {
_tweenList[i].onOverwrite.apply(eventScope, _tweenList[i].onOverwriteParams);
} catch(e:Error) {
handleError(_tweenList[i], e, "onOverwrite");
};
};
_tweenList[i].properties[pName] = undefined;
delete _tweenList[i].properties[pName];
removedLocally = true;
removed = true;
};
};
if (removedLocally){
if (AuxFunctions.getObjectLength(_tweenList[i].properties) == 0){
removeTweenByIndex(i);
};
};
};
};
i = (i + 1);
};
return (removed);
}
public static function registerSpecialPropertySplitter(_arg1:String, _arg2:Function, _arg3:Array=null):void{
var _local4:SpecialPropertySplitter;
if (!_inited){
init();
};
_local4 = new SpecialPropertySplitter(_arg2, _arg3);
_specialPropertySplitterList[_arg1] = _local4;
}
public static function removeTweenByIndex(_arg1:Number, _arg2:Boolean=false):Boolean{
_tweenList[_arg1] = null;
if (_arg2){
_tweenList.splice(_arg1, 1);
};
return (true);
}
public static function resumeTweens(_arg1:Object, ... _args):Boolean{
var _local3:Array;
var _local4:uint;
_local3 = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && (!(AuxFunctions.isInArray(_args[_local4], _local3))))){
_local3.push(_args[_local4]);
};
_local4++;
};
return (affectTweens(resumeTweenByIndex, _arg1, _local3));
}
public static function pauseTweens(_arg1:Object, ... _args):Boolean{
var _local3:Array;
var _local4:uint;
_local3 = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && (!(AuxFunctions.isInArray(_args[_local4], _local3))))){
_local3.push(_args[_local4]);
};
_local4++;
};
return (affectTweens(pauseTweenByIndex, _arg1, _local3));
}
}
}//package caurina.transitions
Section 96
//TweenListObj (caurina.transitions.TweenListObj)
package caurina.transitions {
public class TweenListObj {
public var onUpdate:Function;
public var useFrames:Boolean;
public var hasStarted:Boolean;
public var onOverwriteParams:Array;
public var timeStart:Number;
public var count:Number;
public var timeComplete:Number;
public var onStartParams:Array;
public var onUpdateScope:Object;
public var rounded:Boolean;
public var onUpdateParams:Array;
public var properties:Object;
public var onComplete:Function;
public var transitionParams:Object;
public var updatesSkipped:Number;
public var onStart:Function;
public var onOverwriteScope:Object;
public var skipUpdates:Number;
public var onStartScope:Object;
public var scope:Object;
public var transition:Function;
public var timePaused:Number;
public var onCompleteParams:Array;
public var timesCalled:Number;
public var isCaller:Boolean;
public var onError:Function;
public var onErrorScope:Object;
public var onOverwrite:Function;
public var isPaused:Boolean;
public var waitFrames:Boolean;
public var onCompleteScope:Object;
public function TweenListObj(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Boolean, _arg5:Function, _arg6:Object){
scope = _arg1;
timeStart = _arg2;
timeComplete = _arg3;
useFrames = _arg4;
transition = _arg5;
transitionParams = _arg6;
properties = new Object();
isPaused = false;
timePaused = undefined;
isCaller = false;
updatesSkipped = 0;
timesCalled = 0;
skipUpdates = 0;
hasStarted = false;
}
public function clone(_arg1:Boolean):TweenListObj{
var _local2:TweenListObj;
var _local3:String;
_local2 = new TweenListObj(scope, timeStart, timeComplete, useFrames, transition, transitionParams);
_local2.properties = new Array();
for (_local3 in properties) {
_local2.properties[_local3] = properties[_local3].clone();
};
_local2.skipUpdates = skipUpdates;
_local2.updatesSkipped = updatesSkipped;
if (!_arg1){
_local2.onStart = onStart;
_local2.onUpdate = onUpdate;
_local2.onComplete = onComplete;
_local2.onOverwrite = onOverwrite;
_local2.onError = onError;
_local2.onStartParams = onStartParams;
_local2.onUpdateParams = onUpdateParams;
_local2.onCompleteParams = onCompleteParams;
_local2.onOverwriteParams = onOverwriteParams;
_local2.onStartScope = onStartScope;
_local2.onUpdateScope = onUpdateScope;
_local2.onCompleteScope = onCompleteScope;
_local2.onOverwriteScope = onOverwriteScope;
_local2.onErrorScope = onErrorScope;
};
_local2.rounded = rounded;
_local2.isPaused = isPaused;
_local2.timePaused = timePaused;
_local2.isCaller = isCaller;
_local2.count = count;
_local2.timesCalled = timesCalled;
_local2.waitFrames = waitFrames;
_local2.hasStarted = hasStarted;
return (_local2);
}
public function toString():String{
var _local1:String;
var _local2:Boolean;
var _local3:String;
_local1 = "\n[TweenListObj ";
_local1 = (_local1 + ("scope:" + String(scope)));
_local1 = (_local1 + ", properties:");
_local2 = true;
for (_local3 in properties) {
if (!_local2){
_local1 = (_local1 + ",");
};
_local1 = (_local1 + ("[name:" + properties[_local3].name));
_local1 = (_local1 + (",valueStart:" + properties[_local3].valueStart));
_local1 = (_local1 + (",valueComplete:" + properties[_local3].valueComplete));
_local1 = (_local1 + "]");
_local2 = false;
};
_local1 = (_local1 + (", timeStart:" + String(timeStart)));
_local1 = (_local1 + (", timeComplete:" + String(timeComplete)));
_local1 = (_local1 + (", useFrames:" + String(useFrames)));
_local1 = (_local1 + (", transition:" + String(transition)));
_local1 = (_local1 + (", transitionParams:" + String(transitionParams)));
if (skipUpdates){
_local1 = (_local1 + (", skipUpdates:" + String(skipUpdates)));
};
if (updatesSkipped){
_local1 = (_local1 + (", updatesSkipped:" + String(updatesSkipped)));
};
if (Boolean(onStart)){
_local1 = (_local1 + (", onStart:" + String(onStart)));
};
if (Boolean(onUpdate)){
_local1 = (_local1 + (", onUpdate:" + String(onUpdate)));
};
if (Boolean(onComplete)){
_local1 = (_local1 + (", onComplete:" + String(onComplete)));
};
if (Boolean(onOverwrite)){
_local1 = (_local1 + (", onOverwrite:" + String(onOverwrite)));
};
if (Boolean(onError)){
_local1 = (_local1 + (", onError:" + String(onError)));
};
if (onStartParams){
_local1 = (_local1 + (", onStartParams:" + String(onStartParams)));
};
if (onUpdateParams){
_local1 = (_local1 + (", onUpdateParams:" + String(onUpdateParams)));
};
if (onCompleteParams){
_local1 = (_local1 + (", onCompleteParams:" + String(onCompleteParams)));
};
if (onOverwriteParams){
_local1 = (_local1 + (", onOverwriteParams:" + String(onOverwriteParams)));
};
if (onStartScope){
_local1 = (_local1 + (", onStartScope:" + String(onStartScope)));
};
if (onUpdateScope){
_local1 = (_local1 + (", onUpdateScope:" + String(onUpdateScope)));
};
if (onCompleteScope){
_local1 = (_local1 + (", onCompleteScope:" + String(onCompleteScope)));
};
if (onOverwriteScope){
_local1 = (_local1 + (", onOverwriteScope:" + String(onOverwriteScope)));
};
if (onErrorScope){
_local1 = (_local1 + (", onErrorScope:" + String(onErrorScope)));
};
if (rounded){
_local1 = (_local1 + (", rounded:" + String(rounded)));
};
if (isPaused){
_local1 = (_local1 + (", isPaused:" + String(isPaused)));
};
if (timePaused){
_local1 = (_local1 + (", timePaused:" + String(timePaused)));
};
if (isCaller){
_local1 = (_local1 + (", isCaller:" + String(isCaller)));
};
if (count){
_local1 = (_local1 + (", count:" + String(count)));
};
if (timesCalled){
_local1 = (_local1 + (", timesCalled:" + String(timesCalled)));
};
if (waitFrames){
_local1 = (_local1 + (", waitFrames:" + String(waitFrames)));
};
if (hasStarted){
_local1 = (_local1 + (", hasStarted:" + String(hasStarted)));
};
_local1 = (_local1 + "]\n");
return (_local1);
}
public static function makePropertiesChain(_arg1:Object):Object{
var _local2:Object;
var _local3:Object;
var _local4:Object;
var _local5:Object;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local2 = _arg1.base;
if (_local2){
_local3 = {};
if ((_local2 is Array)){
_local4 = [];
_local8 = 0;
while (_local8 < _local2.length) {
_local4.push(_local2[_local8]);
_local8++;
};
} else {
_local4 = [_local2];
};
_local4.push(_arg1);
_local6 = _local4.length;
_local7 = 0;
while (_local7 < _local6) {
if (_local4[_local7]["base"]){
_local5 = AuxFunctions.concatObjects(makePropertiesChain(_local4[_local7]["base"]), _local4[_local7]);
} else {
_local5 = _local4[_local7];
};
_local3 = AuxFunctions.concatObjects(_local3, _local5);
_local7++;
};
if (_local3["base"]){
delete _local3["base"];
};
return (_local3);
//unresolved jump
};
return (_arg1);
}
}
}//package caurina.transitions
Section 97
//MemoryCrypto (com.electrotank.util.MemoryCrypto)
package com.electrotank.util {
import com.meychi.ascrypt3.*;
public class MemoryCrypto {
private static var crypto:TEA = null;
private static var INCREMENT:int = 0;
private static var initialized:Boolean = false;
private static var key:String = null;
private static var MULTIPLY:int = 2;
private static var DECREMENT:int = 1;
private static var dataHolder:Object = null;
private static var DIVIDE:int = 3;
public static function incrementValue(_arg1:String, _arg2:Number):Number{
return (processValue(_arg1, _arg2, INCREMENT));
}
public static function getValue(_arg1:String):Number{
var _local2:Number;
initIfNeeded();
_local2 = 0;
if (!isValueSet(_arg1)){
setValue(_arg1, _local2);
} else {
_local2 = new Number(crypto.decrypt(dataHolder[_arg1], key));
};
return (_local2);
}
private static function processValue(_arg1:String, _arg2:Number, _arg3:int):Number{
var _local4:Number;
initIfNeeded();
_local4 = getValue(_arg1);
switch (_arg3){
case INCREMENT:
_local4 = (_local4 + _arg2);
break;
case DECREMENT:
_local4 = (_local4 - _arg2);
break;
case MULTIPLY:
_local4 = (_local4 * _arg2);
break;
case DIVIDE:
_local4 = (_local4 / _arg2);
break;
};
setValue(_arg1, _local4);
return (_local4);
}
public static function reset():void{
initialized = false;
initIfNeeded();
}
public static function decrementValue(_arg1:String, _arg2:Number):Number{
return (processValue(_arg1, _arg2, DECREMENT));
}
private static function initIfNeeded():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:String;
if (!initialized){
_local1 = Math.random();
_local2 = new String(_local1);
_local2 = _local2.substr(2, (_local2.length - 2));
_local3 = Math.random();
_local4 = new String(_local3);
_local4 = _local4.substr(2, (_local4.length - 2));
key = (_local2 + _local4);
crypto = new TEA();
dataHolder = new Object();
initialized = true;
};
}
public static function multiplyValue(_arg1:String, _arg2:Number):Number{
return (processValue(_arg1, _arg2, MULTIPLY));
}
public static function setValue(_arg1:String, _arg2:Number):Number{
initIfNeeded();
dataHolder[_arg1] = crypto.encrypt(_arg2.toString(), key);
return (_arg2);
}
public static function divideValue(_arg1:String, _arg2:Number):Number{
if (_arg2 == 0){
throw (new Error("Amount can't be zero when dividing!"));
};
return (processValue(_arg1, _arg2, DIVIDE));
}
public static function isValueSet(_arg1:String):Boolean{
var _local2:Boolean;
initIfNeeded();
_local2 = false;
if (dataHolder[_arg1] != null){
_local2 = true;
};
return (_local2);
}
}
}//package com.electrotank.util
Section 98
//KongregateEvent (com.kongregate.as3.client.events.KongregateEvent)
package com.kongregate.as3.client.events {
import flash.events.*;
public class KongregateEvent extends Event {
public static const COMPLETE:String = "component_api_available";
public function KongregateEvent(_arg1:String){
super(_arg1);
}
}
}//package com.kongregate.as3.client.events
Section 99
//AbstractShadowService (com.kongregate.as3.client.services.AbstractShadowService)
package com.kongregate.as3.client.services {
import flash.events.*;
public class AbstractShadowService extends EventDispatcher {
protected function alert(_arg1:String, _arg2:String, _arg3="", _arg4:String=""):void{
trace(((((((("Kongregate API: " + _arg1) + ".") + _arg2) + "(") + _arg3) + ") ") + _arg4));
}
}
}//package com.kongregate.as3.client.services
Section 100
//HighScoreServiceShadow (com.kongregate.as3.client.services.HighScoreServiceShadow)
package com.kongregate.as3.client.services {
public class HighScoreServiceShadow extends AbstractShadowService implements IHighScoreServices {
private var mode:String;
public function HighScoreServiceShadow(){
mode = "";
}
public function submit(_arg1:Number, _arg2:String=null):void{
alert("IHighScoreServices", "submit", arguments);
}
public function connect():Boolean{
alert("IKongregateServices", "connect");
return (true);
}
public function requestList(_arg1:Function):void{
alert("IHighScoreServices", "requestList", "", (("[Mode: " + mode) + "]"));
_arg1({success:false});
}
public function setMode(_arg1:String):void{
alert("IHighScoreServices", "setMode", arguments);
this.mode = _arg1;
}
}
}//package com.kongregate.as3.client.services
Section 101
//IHighScoreServices (com.kongregate.as3.client.services.IHighScoreServices)
package com.kongregate.as3.client.services {
public interface IHighScoreServices {
function setMode(_arg1:String):void;
function submit(_arg1:Number, _arg2:String=null):void;
function requestList(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 102
//IKongregateServices (com.kongregate.as3.client.services.IKongregateServices)
package com.kongregate.as3.client.services {
import flash.events.*;
public interface IKongregateServices extends IEventDispatcher {
function getPlayerInfo(_arg1:Function):void;
function connect(_arg1:Number=-1):Boolean;
}
}//package com.kongregate.as3.client.services
Section 103
//IStatServices (com.kongregate.as3.client.services.IStatServices)
package com.kongregate.as3.client.services {
public interface IStatServices {
function submitArray(_arg1:Array):void;
function submit(_arg1:String, _arg2:Number):void;
}
}//package com.kongregate.as3.client.services
Section 104
//IUserServices (com.kongregate.as3.client.services.IUserServices)
package com.kongregate.as3.client.services {
public interface IUserServices {
function getName():String;
function getPlayerInfo(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 105
//KongregateServiceShadow (com.kongregate.as3.client.services.KongregateServiceShadow)
package com.kongregate.as3.client.services {
public class KongregateServiceShadow extends AbstractShadowService implements IKongregateServices {
public function getName():String{
alert("IKongregateServices", "getName");
return ("Guest");
}
public function connect(_arg1:Number=-1):Boolean{
alert("IKongregateServices", "connect", arguments);
return (true);
}
public function getPlayerInfo(_arg1:Function):void{
alert("IKongregateServices", "getPlayerInfo");
_arg1(new Object());
}
}
}//package com.kongregate.as3.client.services
Section 106
//StatServiceShadow (com.kongregate.as3.client.services.StatServiceShadow)
package com.kongregate.as3.client.services {
public class StatServiceShadow extends AbstractShadowService implements IStatServices {
public function submitArray(_arg1:Array):void{
alert("IStatServices", "submitArray", arguments);
}
public function submit(_arg1:String, _arg2:Number):void{
alert("IStatServices", "submitStat", arguments);
}
}
}//package com.kongregate.as3.client.services
Section 107
//UserServiceShadow (com.kongregate.as3.client.services.UserServiceShadow)
package com.kongregate.as3.client.services {
public class UserServiceShadow extends AbstractShadowService implements IUserServices {
public function getName():String{
alert("UserService", "getName");
return ("Guest");
}
public function getPlayerInfo(_arg1:Function):void{
alert("UserService", "getPlayerInfo");
_arg1({isGuest:true, name:"Guest", points:0, level:0, isMode:false, isAdmin:false, isDeveloper:false, avatarPath:"", chatAvatarPath:""});
}
}
}//package com.kongregate.as3.client.services
Section 108
//IAPIBootstrap (com.kongregate.as3.client.IAPIBootstrap)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
public interface IAPIBootstrap {
function init(_arg1:Event=null, _arg2:Stage=null):void;
function hideLog():void;
function showLog(_arg1:int=0):void;
}
}//package com.kongregate.as3.client
Section 109
//KongregateAPI (com.kongregate.as3.client.KongregateAPI)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import com.kongregate.as3.client.services.*;
import com.kongregate.as3.client.events.*;
import flash.system.*;
import flash.net.*;
import flash.errors.*;
public class KongregateAPI extends Sprite {
private const VERSION:Number = 1;
private var loader:Loader;
private var loadedDomain:ApplicationDomain;
private static const CLASS_USER:String = "com.kongregate.as3.client.services.UserServices";
private static const CLASS_STATS:String = "com.kongregate.as3.client.services.StatServices";
private static const CLASS_SERVICES:String = "com.kongregate.as3.client.services.KongregateServices";
private static const CLASS_SCORES:String = "com.kongregate.as3.client.services.HighScoreServices";
private static const DEBUG_API_URL:String = "//Linuxpc/kongregate/public/flash/API_AS3.swf";
private static var _connected:Boolean;
private static var kUser:IUserServices;
private static var _loaded:Boolean;
private static var kServices:IKongregateServices;
private static var kScores:IHighScoreServices;
private static var mInstance:KongregateAPI;
private static var kStats:IStatServices;
private static var kAPI:IAPIBootstrap;
public function KongregateAPI(){
if (mInstance != null){
throw (new Error("Warning: KongregateAPI has been added to stage more than once or accessed improperly. Use getInstance() or a stage reference to access."));
};
mInstance = this;
this.addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
}
public function get loaded():Boolean{
return (_loaded);
}
public function get connected():Boolean{
return (_connected);
}
private function alertConnected(_arg1:TimerEvent=null):void{
var _local2:KongregateEvent;
var _local3:Boolean;
_local2 = new KongregateEvent(KongregateEvent.COMPLETE);
_local3 = this.dispatchEvent(_local2);
}
private function init(_arg1:Event):void{
var _local2:Object;
var _local3:String;
var _local4:URLRequest;
var _local5:LoaderContext;
this.removeEventListener(Event.ADDED_TO_STAGE, init);
_loaded = false;
_connected = false;
_local2 = LoaderInfo(root.loaderInfo).parameters;
_local3 = _local2.api_path;
if (_local3 == null){
trace("Alert: Kongregate API could not be loaded, due to local testing. API will load when the game is uploaded.");
createShadowServices();
return;
};
Security.allowDomain("*.kongregate.com");
Security.allowDomain("kongregatetrunk.com");
_local4 = new URLRequest(_local3);
_local5 = new LoaderContext(false);
_local5.applicationDomain = ApplicationDomain.currentDomain;
_local5.securityDomain = SecurityDomain.currentDomain;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.load(_local4, _local5);
}
public function get api():IAPIBootstrap{
return (kAPI);
}
private function loadComplete(_arg1:Event):void{
getServices();
}
public function get scores():IHighScoreServices{
return (kScores);
}
private function ioErrorHandler(_arg1:IOErrorEvent):void{
throw (new IOError(("API file not found. " + _arg1)));
}
public function get services():IKongregateServices{
return (kServices);
}
public function get stats():IStatServices{
return (kStats);
}
private function createShadowServices():void{
var _local1:Timer;
trace(">>> Kongregate Shadow Services instantiated for local development..");
kServices = new KongregateServiceShadow();
kScores = new HighScoreServiceShadow();
kStats = new StatServiceShadow();
kUser = new UserServiceShadow();
_local1 = new Timer(200, 1);
_local1.addEventListener(TimerEvent.TIMER_COMPLETE, alertConnected);
_local1.start();
_connected = true;
}
public function get user():IUserServices{
return (kUser);
}
private function getServices():void{
var _local1:ApplicationDomain;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local1 = ApplicationDomain.currentDomain;
kAPI = IAPIBootstrap(loader.getChildAt(0));
this.addChild(loader);
_local2 = _local1.getDefinition(CLASS_SERVICES);
trace(_local2);
kServices = _local2.getInstance();
_local3 = _local1.getDefinition(CLASS_SCORES);
kScores = _local3.getInstance();
_local4 = _local1.getDefinition(CLASS_STATS);
kStats = _local4.getInstance();
_local5 = _local1.getDefinition(CLASS_USER);
kUser = _local5.getInstance();
kServices.connect(VERSION);
_loaded = true;
_connected = true;
alertConnected();
}
public static function getInstance():KongregateAPI{
if (!mInstance){
throw (new IllegalOperationError("You must add the Kongregate API component to the stage before attempting to access it."));
};
return (mInstance);
}
}
}//package com.kongregate.as3.client
Section 110
//TEA (com.meychi.ascrypt3.TEA)
package com.meychi.ascrypt3 {
public class TEA {
public function encrypt(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:Array;
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;
_local3 = charsToLongs(strToChars(_arg1));
_local4 = charsToLongs(strToChars(_arg2));
_local5 = _local3.length;
if (_local5 == 0){
return ("");
};
if (_local5 == 1){
var _temp1 = _local5;
_local5 = (_local5 + 1);
var _local14 = _temp1;
_local3[_local14] = 0;
};
_local6 = _local3[(_local5 - 1)];
_local7 = _local3[0];
_local8 = 2654435769;
_local11 = Math.floor((6 + (52 / _local5)));
_local12 = 0;
while (_local11-- > 0) {
_local12 = (_local12 + _local8);
_local10 = ((_local12 >>> 2) & 3);
_local13 = 0;
while (_local13 < (_local5 - 1)) {
_local7 = _local3[(_local13 + 1)];
_local9 = ((((_local6 >>> 5) ^ (_local7 << 2)) + ((_local7 >>> 3) ^ (_local6 << 4))) ^ ((_local12 ^ _local7) + (_local4[((_local13 & 3) ^ _local10)] ^ _local6)));
_local6 = (_local3[_local13] = (_local3[_local13] + _local9));
_local13++;
};
_local7 = _local3[0];
_local9 = ((((_local6 >>> 5) ^ (_local7 << 2)) + ((_local7 >>> 3) ^ (_local6 << 4))) ^ ((_local12 ^ _local7) + (_local4[((_local13 & 3) ^ _local10)] ^ _local6)));
_local6 = (_local3[(_local5 - 1)] = (_local3[(_local5 - 1)] + _local9));
};
return (charsToHex(longsToChars(_local3)));
}
public function decrypt(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:Array;
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;
_local3 = charsToLongs(hexToChars(_arg1));
_local4 = charsToLongs(strToChars(_arg2));
_local5 = _local3.length;
if (_local5 == 0){
return ("");
};
_local6 = _local3[(_local5 - 1)];
_local7 = _local3[0];
_local8 = 2654435769;
_local11 = Math.floor((6 + (52 / _local5)));
_local12 = (_local11 * _local8);
while (_local12 != 0) {
_local10 = ((_local12 >>> 2) & 3);
_local13 = (_local5 - 1);
while (_local13 > 0) {
_local6 = _local3[(_local13 - 1)];
_local9 = ((((_local6 >>> 5) ^ (_local7 << 2)) + ((_local7 >>> 3) ^ (_local6 << 4))) ^ ((_local12 ^ _local7) + (_local4[((_local13 & 3) ^ _local10)] ^ _local6)));
_local7 = (_local3[_local13] = (_local3[_local13] - _local9));
_local13--;
};
_local6 = _local3[(_local5 - 1)];
_local9 = ((((_local6 >>> 5) ^ (_local7 << 2)) + ((_local7 >>> 3) ^ (_local6 << 4))) ^ ((_local12 ^ _local7) + (_local4[((_local13 & 3) ^ _local10)] ^ _local6)));
_local7 = (_local3[0] = (_local3[0] - _local9));
_local12 = (_local12 - _local8);
};
return (charsToStr(longsToChars(_local3)));
}
private static function strToChars(_arg1:String):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array();
_local3 = 0;
while (_local3 < _arg1.length) {
_local2.push(_arg1.charCodeAt(_local3));
_local3++;
};
return (_local2);
}
private static function charsToHex(_arg1:Array):String{
var _local2:String;
var _local3:Array;
var _local4:Number;
_local2 = new String("");
_local3 = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
_local4 = 0;
while (_local4 < _arg1.length) {
_local2 = (_local2 + (_local3[(_arg1[_local4] >> 4)] + _local3[(_arg1[_local4] & 15)]));
_local4++;
};
return (_local2);
}
private static function hexToChars(_arg1:String):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array();
_local3 = ((_arg1.substr(0, 2))=="0x") ? 2 : 0;
while (_local3 < _arg1.length) {
_local2.push(parseInt(_arg1.substr(_local3, 2), 16));
_local3 = (_local3 + 2);
};
return (_local2);
}
private static function charsToStr(_arg1:Array):String{
var _local2:String;
var _local3:Number;
_local2 = new String("");
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode(_arg1[_local3]));
_local3++;
};
return (_local2);
}
private static function longsToChars(_arg1:Array):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array();
_local3 = 0;
while (_local3 < _arg1.length) {
_local2.push((_arg1[_local3] & 0xFF), ((_arg1[_local3] >>> 8) & 0xFF), ((_arg1[_local3] >>> 16) & 0xFF), ((_arg1[_local3] >>> 24) & 0xFF));
_local3++;
};
return (_local2);
}
private static function charsToLongs(_arg1:Array):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array(Math.ceil((_arg1.length / 4)));
_local3 = 0;
while (_local3 < _local2.length) {
_local2[_local3] = (((_arg1[(_local3 * 4)] + (_arg1[((_local3 * 4) + 1)] << 8)) + (_arg1[((_local3 * 4) + 2)] << 16)) + (_arg1[((_local3 * 4) + 3)] << 24));
_local3++;
};
return (_local2);
}
}
}//package com.meychi.ascrypt3
Section 111
//PM_PRNG (de.polygonal.math.PM_PRNG)
package de.polygonal.math {
public class PM_PRNG {
public var seed:uint;
public function PM_PRNG(){
seed = 1;
}
public function nextIntRange(_arg1:Number, _arg2:Number):uint{
_arg1 = (_arg1 - 0.4999);
_arg2 = (_arg2 + 0.4999);
return (Math.round((_arg1 + ((_arg2 - _arg1) * nextDouble()))));
}
public function nextDouble():Number{
return ((gen() / 2147483647));
}
public function nextDoubleRange(_arg1:Number, _arg2:Number):Number{
return ((_arg1 + ((_arg2 - _arg1) * nextDouble())));
}
public function nextInt():uint{
return (gen());
}
private function gen():uint{
return ((seed = ((seed * 16807) % 2147483647)));
}
}
}//package de.polygonal.math
Section 112
//wav (dropping_1.wav)
package dropping_1 {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package dropping_1
Section 113
//wav (dropping_2.wav)
package dropping_2 {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package dropping_2
Section 114
//wav (dropping_3.wav)
package dropping_3 {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package dropping_3
Section 115
//BaseScrollPane (fl.containers.BaseScrollPane)
package fl.containers {
import fl.core.*;
import flash.events.*;
import flash.display.*;
import fl.controls.*;
import flash.geom.*;
import fl.events.*;
public class BaseScrollPane extends UIComponent {
protected var defaultLineScrollSize:Number;// = 4
protected var _maxHorizontalScrollPosition:Number;// = 0
protected var vScrollBar:Boolean;
protected var disabledOverlay:Shape;
protected var hScrollBar:Boolean;
protected var availableWidth:Number;
protected var _verticalPageScrollSize:Number;// = 0
protected var vOffset:Number;// = 0
protected var _verticalScrollBar:ScrollBar;
protected var useFixedHorizontalScrolling:Boolean;// = false
protected var contentWidth:Number;// = 0
protected var contentHeight:Number;// = 0
protected var _horizontalPageScrollSize:Number;// = 0
protected var background:DisplayObject;
protected var _useBitmpScrolling:Boolean;// = false
protected var contentPadding:Number;// = 0
protected var availableHeight:Number;
protected var _horizontalScrollBar:ScrollBar;
protected var contentScrollRect:Rectangle;
protected var _horizontalScrollPolicy:String;
protected var _verticalScrollPolicy:String;
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};
public function BaseScrollPane(){
contentWidth = 0;
contentHeight = 0;
contentPadding = 0;
vOffset = 0;
_maxHorizontalScrollPosition = 0;
_horizontalPageScrollSize = 0;
_verticalPageScrollSize = 0;
defaultLineScrollSize = 4;
useFixedHorizontalScrolling = false;
_useBitmpScrolling = false;
super();
}
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));
}
public function get verticalScrollPosition():Number{
return (_verticalScrollBar.scrollPosition);
}
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);
};
}
public function set verticalScrollPosition(_arg1:Number):void{
drawNow();
_verticalScrollBar.scrollPosition = _arg1;
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, false);
}
protected function setContentSize(_arg1:Number, _arg2:Number):void{
if ((((((contentWidth == _arg1)) || (useFixedHorizontalScrolling))) && ((contentHeight == _arg2)))){
return;
};
contentWidth = _arg1;
contentHeight = _arg2;
invalidate(InvalidationType.SIZE);
}
public function get horizontalScrollPosition():Number{
return (_horizontalScrollBar.scrollPosition);
}
public function get horizontalScrollBar():ScrollBar{
return (_horizontalScrollBar);
}
override public function set enabled(_arg1:Boolean):void{
if (enabled == _arg1){
return;
};
_verticalScrollBar.enabled = _arg1;
_horizontalScrollBar.enabled = _arg1;
super.enabled = _arg1;
}
public function get verticalLineScrollSize():Number{
return (_verticalScrollBar.lineScrollSize);
}
public function get horizontalScrollPolicy():String{
return (_horizontalScrollPolicy);
}
protected function calculateAvailableSize():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = ScrollBar.WIDTH;
_local2 = (contentPadding = Number(getStyleValue("contentPadding")));
_local3 = ((height - (2 * _local2)) - vOffset);
vScrollBar = (((_verticalScrollPolicy == ScrollPolicy.ON)) || ((((_verticalScrollPolicy == ScrollPolicy.AUTO)) && ((contentHeight > _local3)))));
_local4 = ((width - (vScrollBar) ? _local1 : 0) - (2 * _local2));
_local5 = (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;
}
public function get maxVerticalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentHeight - availableHeight)));
}
public function set horizontalScrollPosition(_arg1:Number):void{
drawNow();
_horizontalScrollBar.scrollPosition = _arg1;
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, false);
}
public function get horizontalLineScrollSize():Number{
return (_horizontalScrollBar.lineScrollSize);
}
public function set verticalPageScrollSize(_arg1:Number):void{
_verticalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get verticalScrollPolicy():String{
return (_verticalScrollPolicy);
}
protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
public function get useBitmapScrolling():Boolean{
return (_useBitmpScrolling);
}
protected function handleScroll(_arg1:ScrollEvent):void{
if (_arg1.target == _verticalScrollBar){
setVerticalScrollPosition(_arg1.position);
} else {
setHorizontalScrollPosition(_arg1.position);
};
}
public function set verticalLineScrollSize(_arg1:Number):void{
_verticalScrollBar.lineScrollSize = _arg1;
}
public function get verticalScrollBar():ScrollBar{
return (_verticalScrollBar);
}
protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
}
public function set horizontalPageScrollSize(_arg1:Number):void{
_horizontalPageScrollSize = _arg1;
invalidate(InvalidationType.SIZE);
}
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();
}
public function set horizontalScrollPolicy(_arg1:String):void{
_horizontalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function configUI():void{
var _local1:Graphics;
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();
_local1 = disabledOverlay.graphics;
_local1.beginFill(0xFFFFFF);
_local1.drawRect(0, 0, width, height);
_local1.endFill();
addEventListener(MouseEvent.MOUSE_WHEEL, handleWheel, false, 0, true);
}
protected function calculateContentWidth():void{
}
public function get verticalPageScrollSize():Number{
if (isNaN(availableHeight)){
drawNow();
};
return (((((_verticalPageScrollSize == 0)) && (!(isNaN(availableHeight))))) ? availableHeight : _verticalPageScrollSize);
}
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 drawBackground():void{
var _local1:DisplayObject;
_local1 = background;
background = getDisplayObjectInstance(getStyleValue("skin"));
background.width = width;
background.height = height;
addChildAt(background, 0);
if (((!((_local1 == null))) && (!((_local1 == background))))){
removeChild(_local1);
};
}
public function set horizontalLineScrollSize(_arg1:Number):void{
_horizontalScrollBar.lineScrollSize = _arg1;
}
public function get horizontalPageScrollSize():Number{
if (isNaN(availableWidth)){
drawNow();
};
return (((((_horizontalPageScrollSize == 0)) && (!(isNaN(availableWidth))))) ? availableWidth : _horizontalPageScrollSize);
}
public function get maxHorizontalScrollPosition():Number{
drawNow();
return (Math.max(0, (contentWidth - availableWidth)));
}
protected function setStyles():void{
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
}
protected function updateChildren():void{
_verticalScrollBar.enabled = (_horizontalScrollBar.enabled = enabled);
_verticalScrollBar.drawNow();
_horizontalScrollBar.drawNow();
}
public function set verticalScrollPolicy(_arg1:String):void{
_verticalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
public function set useBitmapScrolling(_arg1:Boolean):void{
_useBitmpScrolling = _arg1;
invalidate(InvalidationType.STATE);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, ScrollBar.getStyleDefinition()));
}
}
}//package fl.containers
Section 116
//ScrollPane (fl.containers.ScrollPane)
package fl.containers {
import fl.core.*;
import flash.events.*;
import flash.display.*;
import fl.controls.*;
import fl.managers.*;
import fl.events.*;
import flash.system.*;
import flash.net.*;
import flash.ui.*;
public class ScrollPane extends BaseScrollPane implements IFocusManagerComponent {
protected var scrollDragHPos:Number;
protected var loader:Loader;
protected var yOffset:Number;
protected var currentContent:Object;
protected var xOffset:Number;
protected var _source:Object;// = ""
protected var scrollDragVPos:Number;
protected var _scrollDrag:Boolean;// = false
protected var contentClip:Sprite;
private static var defaultStyles:Object = {upSkin:"ScrollPane_upSkin", disabledSkin:"ScrollPane_disabledSkin", focusRectSkin:null, focusRectPadding:null, contentPadding:0};
public function ScrollPane(){
_source = "";
_scrollDrag = false;
super();
}
public function get source():Object{
return (_source);
}
public function set source(_arg1:Object):void{
var _local2:*;
clearContent();
if (isLivePreview){
return;
};
_source = _arg1;
if ((((_source == "")) || ((_source == null)))){
return;
};
currentContent = getDisplayObjectInstance(_arg1);
if (currentContent != null){
_local2 = contentClip.addChild((currentContent as DisplayObject));
dispatchEvent(new Event(Event.INIT));
update();
} else {
load(new URLRequest(_source.toString()));
};
}
public function get bytesLoaded():Number{
return (((((loader == null)) || ((loader.contentLoaderInfo == null)))) ? 0 : loader.contentLoaderInfo.bytesLoaded);
}
protected function doDrag(_arg1:MouseEvent):void{
var _local2:*;
var _local3:*;
_local2 = (scrollDragVPos - (mouseY - yOffset));
_verticalScrollBar.setScrollPosition(_local2);
setVerticalScrollPosition(_verticalScrollBar.scrollPosition, true);
_local3 = (scrollDragHPos - (mouseX - xOffset));
_horizontalScrollBar.setScrollPosition(_local3);
setHorizontalScrollPosition(_horizontalScrollBar.scrollPosition, true);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:int;
_local2 = calculateAvailableHeight();
switch (_arg1.keyCode){
case Keyboard.DOWN:
verticalScrollPosition++;
break;
case Keyboard.UP:
verticalScrollPosition--;
break;
case Keyboard.RIGHT:
horizontalScrollPosition++;
break;
case Keyboard.LEFT:
horizontalScrollPosition--;
break;
case Keyboard.END:
verticalScrollPosition = maxVerticalScrollPosition;
break;
case Keyboard.HOME:
verticalScrollPosition = 0;
break;
case Keyboard.PAGE_UP:
verticalScrollPosition = (verticalScrollPosition - _local2);
break;
case Keyboard.PAGE_DOWN:
verticalScrollPosition = (verticalScrollPosition + _local2);
break;
};
}
protected function doStartDrag(_arg1:MouseEvent):void{
if (!enabled){
return;
};
xOffset = mouseX;
yOffset = mouseY;
scrollDragHPos = horizontalScrollPosition;
scrollDragVPos = verticalScrollPosition;
stage.addEventListener(MouseEvent.MOUSE_MOVE, doDrag, false, 0, true);
}
public function get content():DisplayObject{
var _local1:Object;
_local1 = currentContent;
if ((_local1 is URLRequest)){
_local1 = loader.content;
};
return ((_local1 as DisplayObject));
}
public function get percentLoaded():Number{
if (loader != null){
return (Math.round(((bytesLoaded / bytesTotal) * 100)));
};
return (0);
}
protected function endDrag(_arg1:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, doDrag);
}
public function update():void{
var _local1:DisplayObject;
_local1 = contentClip.getChildAt(0);
setContentSize(_local1.width, _local1.height);
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:*;
_local3 = contentClip.scrollRect;
_local3.x = _arg1;
contentClip.scrollRect = _local3;
}
public function refreshPane():void{
if ((_source is URLRequest)){
_source = _source.url;
};
source = _source;
}
protected function passEvent(_arg1:Event):void{
dispatchEvent(_arg1);
}
protected function calculateAvailableHeight():Number{
var _local1:Number;
_local1 = Number(getStyleValue("contentPadding"));
return (((height - (_local1 * 2)) - ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0));
}
public function load(_arg1:URLRequest, _arg2:LoaderContext=null):void{
if (_arg2 == null){
_arg2 = new LoaderContext(false, ApplicationDomain.currentDomain);
};
clearContent();
initLoader();
currentContent = (_source = _arg1);
loader.load(_arg1, _arg2);
}
override protected function handleScroll(_arg1:ScrollEvent):void{
passEvent(_arg1);
super.handleScroll(_arg1);
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:*;
_local3 = contentClip.scrollRect;
_local3.y = _arg1;
contentClip.scrollRect = _local3;
}
protected function initLoader():void{
loader = new Loader();
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, passEvent, false, 0, true);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onContentLoad, false, 0, true);
loader.contentLoaderInfo.addEventListener(Event.INIT, passEvent, false, 0, true);
contentClip.addChild(loader);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
drawBackground();
};
if (isInvalid(InvalidationType.STATE)){
setScrollDrag();
};
super.draw();
}
override protected function configUI():void{
super.configUI();
contentClip = new Sprite();
addChild(contentClip);
contentClip.scrollRect = contentScrollRect;
_horizontalScrollPolicy = ScrollPolicy.AUTO;
_verticalScrollPolicy = ScrollPolicy.AUTO;
}
public function set scrollDrag(_arg1:Boolean):void{
_scrollDrag = _arg1;
invalidate(InvalidationType.STATE);
}
protected function clearContent():void{
if (contentClip.numChildren == 0){
return;
};
contentClip.removeChildAt(0);
currentContent = null;
if (loader != null){
try {
loader.close();
} catch(e) {
};
try {
loader.unload();
} catch(e) {
};
loader = null;
};
}
override protected function drawLayout():void{
super.drawLayout();
contentScrollRect = contentClip.scrollRect;
contentScrollRect.width = availableWidth;
contentScrollRect.height = availableHeight;
contentClip.cacheAsBitmap = useBitmapScrolling;
contentClip.scrollRect = contentScrollRect;
contentClip.x = (contentClip.y = contentPadding);
}
override protected function drawBackground():void{
var _local1:DisplayObject;
_local1 = background;
background = getDisplayObjectInstance(getStyleValue((enabled) ? "upSkin" : "disabledSkin"));
background.width = width;
background.height = height;
addChildAt(background, 0);
if (((!((_local1 == null))) && (!((_local1 == background))))){
removeChild(_local1);
};
}
public function get bytesTotal():Number{
return (((((loader == null)) || ((loader.contentLoaderInfo == null)))) ? 0 : loader.contentLoaderInfo.bytesTotal);
}
protected function onContentLoad(_arg1:Event):void{
var _local2:*;
update();
_local2 = calculateAvailableHeight();
calculateAvailableSize();
horizontalScrollBar.setScrollProperties(availableWidth, 0, (useFixedHorizontalScrolling) ? _maxHorizontalScrollPosition : (contentWidth - availableWidth), availableWidth);
verticalScrollBar.setScrollProperties(_local2, 0, (contentHeight - _local2), _local2);
passEvent(_arg1);
}
public function get scrollDrag():Boolean{
return (_scrollDrag);
}
protected function setScrollDrag():void{
if (_scrollDrag){
contentClip.addEventListener(MouseEvent.MOUSE_DOWN, doStartDrag, false, 0, true);
stage.addEventListener(MouseEvent.MOUSE_UP, endDrag, false, 0, true);
} else {
contentClip.removeEventListener(MouseEvent.MOUSE_DOWN, doStartDrag);
stage.removeEventListener(MouseEvent.MOUSE_UP, endDrag);
removeEventListener(MouseEvent.MOUSE_MOVE, doDrag);
};
contentClip.buttonMode = _scrollDrag;
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseScrollPane.getStyleDefinition()));
}
}
}//package fl.containers
Section 117
//UILoader (fl.containers.UILoader)
package fl.containers {
import fl.core.*;
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import fl.events.*;
import flash.system.*;
import flash.net.*;
public class UILoader extends UIComponent {
protected var loader:Loader;
protected var _autoLoad:Boolean;// = true
protected var _source:Object;
protected var contentClip:Sprite;
protected var _maintainAspectRatio:Boolean;// = true
protected var contentInited:Boolean;// = false
protected var _scaleContent:Boolean;// = true
private static var defaultStyles:Object = {};
public function UILoader(){
_scaleContent = true;
_autoLoad = true;
contentInited = false;
_maintainAspectRatio = true;
super();
}
public function get maintainAspectRatio():Boolean{
return (_maintainAspectRatio);
}
public function set maintainAspectRatio(_arg1:Boolean):void{
_maintainAspectRatio = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get source():Object{
return (_source);
}
protected function _unload(_arg1:Boolean=false):void{
var throwError = _arg1;
if (loader != null){
clearLoadEvents();
contentClip.removeChild(loader);
try {
loader.close();
} catch(e:Error) {
};
try {
loader.unload();
} catch(e) {
if (throwError){
throw (e);
};
};
loader = null;
return;
};
contentInited = false;
if (contentClip.numChildren){
contentClip.removeChildAt(0);
};
}
public function get bytesLoaded():uint{
return (((((loader == null)) || ((loader.contentLoaderInfo == null)))) ? 0 : loader.contentLoaderInfo.bytesLoaded);
}
public function set source(_arg1:Object):void{
if (_arg1 == ""){
return;
};
_source = _arg1;
_unload();
if (((_autoLoad) && (!((_source == null))))){
load();
};
}
public function set autoLoad(_arg1:Boolean):void{
_autoLoad = _arg1;
if (((((((_autoLoad) && ((loader == null)))) && (!((_source == null))))) && (!((_source == ""))))){
load();
};
}
public function get content():DisplayObject{
if (loader != null){
return (loader.content);
};
if (contentClip.numChildren){
return (contentClip.getChildAt(0));
};
return (null);
}
public function get percentLoaded():Number{
return (((bytesTotal)<=0) ? 0 : ((bytesLoaded / bytesTotal) * 100));
}
protected function handleError(_arg1:Event):void{
passEvent(_arg1);
clearLoadEvents();
loader.contentLoaderInfo.removeEventListener(Event.INIT, handleInit);
}
public function load(_arg1:URLRequest=null, _arg2:LoaderContext=null):void{
var _local3:DisplayObject;
_unload();
if ((((((_arg1 == null)) || ((_arg1.url == null)))) && ((((_source == null)) || ((_source == "")))))){
return;
};
_local3 = getDisplayObjectInstance(source);
if (_local3 != null){
contentClip.addChild(_local3);
contentInited = true;
invalidate(InvalidationType.SIZE);
return;
};
if (_arg1 == null){
_arg1 = new URLRequest(_source.toString());
};
if (_arg2 == null){
_arg2 = new LoaderContext(false, ApplicationDomain.currentDomain);
};
initLoader();
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, handleError, false, 0, true);
loader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, handleError, false, 0, true);
loader.contentLoaderInfo.addEventListener(Event.OPEN, passEvent, false, 0, true);
loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, passEvent, false, 0, true);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleComplete, false, 0, true);
loader.contentLoaderInfo.addEventListener(Event.INIT, handleInit, false, 0, true);
loader.contentLoaderInfo.addEventListener(HTTPStatusEvent.HTTP_STATUS, passEvent, false, 0, true);
loader.load(_arg1, _arg2);
}
public function unload():void{
_source = null;
_unload(true);
}
protected function passEvent(_arg1:Event):void{
dispatchEvent(_arg1);
}
public function loadBytes(_arg1:ByteArray, _arg2:LoaderContext=null):void{
var bytes = _arg1;
var context = _arg2;
_unload();
initLoader();
try {
loader.loadBytes(bytes, context);
} catch(error) {
throw (error);
};
}
public function get autoLoad():Boolean{
return (_autoLoad);
}
protected function sizeContent(_arg1:DisplayObject, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):void{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
_local6 = _arg4;
_local7 = _arg5;
if (_maintainAspectRatio){
_local8 = (_arg4 / _arg5);
_local9 = (_arg2 / _arg3);
if (_local8 < _local9){
_local7 = (_local6 / _local9);
} else {
_local6 = (_local7 * _local9);
};
};
_arg1.width = _local6;
_arg1.height = _local7;
_arg1.x = ((_arg4 / 2) - (_local6 / 2));
_arg1.y = ((_arg5 / 2) - (_local7 / 2));
}
protected function initLoader():void{
loader = new Loader();
contentClip.addChild(loader);
}
override protected function draw():void{
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
override protected function configUI():void{
super.configUI();
contentClip = new Sprite();
addChild(contentClip);
}
protected function handleInit(_arg1:Event):void{
loader.contentLoaderInfo.removeEventListener(Event.INIT, handleInit);
contentInited = true;
passEvent(_arg1);
invalidate(InvalidationType.SIZE);
}
protected function handleComplete(_arg1:Event):void{
clearLoadEvents();
passEvent(_arg1);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if (((!(_scaleContent)) && ((_width > 0)))){
return;
};
super.setSize(_arg1, _arg2);
}
protected function drawLayout():void{
var _local1:Boolean;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:LoaderInfo;
if (!contentInited){
return;
};
_local1 = false;
if (loader){
_local6 = loader.contentLoaderInfo;
_local2 = _local6.width;
_local3 = _local6.height;
} else {
_local2 = contentClip.width;
_local3 = contentClip.height;
};
_local4 = _width;
_local5 = _height;
if (!_scaleContent){
_width = contentClip.width;
_height = contentClip.height;
} else {
sizeContent(contentClip, _local2, _local3, _width, _height);
};
if (((!((_local4 == _width))) || (!((_local5 == _height))))){
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, true));
};
}
public function get bytesTotal():uint{
return (((((loader == null)) || ((loader.contentLoaderInfo == null)))) ? 0 : loader.contentLoaderInfo.bytesTotal);
}
public function set scaleContent(_arg1:Boolean):void{
if (_scaleContent == _arg1){
return;
};
_scaleContent = _arg1;
invalidate(InvalidationType.SIZE);
}
protected function clearLoadEvents():void{
loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, handleError);
loader.contentLoaderInfo.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, handleError);
loader.contentLoaderInfo.removeEventListener(Event.OPEN, passEvent);
loader.contentLoaderInfo.removeEventListener(ProgressEvent.PROGRESS, passEvent);
loader.contentLoaderInfo.removeEventListener(HTTPStatusEvent.HTTP_STATUS, passEvent);
loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, handleComplete);
}
public function get scaleContent():Boolean{
return (_scaleContent);
}
public function close():void{
try {
loader.close();
} catch(error) {
throw (error);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.containers
Section 118
//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 _data:Object;
protected var _listData:ListData;
private static var defaultStyles:Object = {textPadding:1, textFormat:null, upSkin:"DataGridCellEditor_skin"};
public function DataGridCellEditor():void{
}
public function get selected():Boolean{
return (false);
}
public function set listData(_arg1:ListData):void{
_listData = _arg1;
text = _listData.label;
}
public function setMouseState(_arg1:String):void{
}
public function set selected(_arg1:Boolean):void{
}
public function set data(_arg1:Object):void{
_data = _arg1;
}
public function get listData():ListData{
return (_listData);
}
public function get data():Object{
return (_data);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls.dataGridClasses
Section 119
//DataGridColumn (fl.controls.dataGridClasses.DataGridColumn)
package fl.controls.dataGridClasses {
import fl.core.*;
import fl.controls.*;
public class DataGridColumn {
private var _headerText:String;
public var editorDataField:String;// = "text"
private var forceImport:DataGridCellEditor;
private var _headerRenderer:Object;
public var sortOptions:uint;// = 0
private var _cellRenderer:Object;
private var _columnName:String;
public var resizable:Boolean;// = true
private var _sortCompareFunction:Function;
private var _visible:Boolean;// = true
public var sortDescending:Boolean;// = false
public var owner:DataGrid;
private var _imeMode:String;
private var _width:Number;// = 100
public var editable:Boolean;// = true
public var itemEditor:Object;// = "fl.controls.dataGridClasses.DataGridCellEditor"
public var explicitWidth:Number;
private var _minWidth:Number;// = 20
private var _labelFunction:Function;
public var sortable:Boolean;// = true
public var colNum:Number;
public var dataField:String;
public function DataGridColumn(_arg1:String=null){
_minWidth = 20;
_width = 100;
_visible = true;
sortable = true;
resizable = true;
editable = true;
itemEditor = "fl.controls.dataGridClasses.DataGridCellEditor";
editorDataField = "text";
sortDescending = false;
sortOptions = 0;
super();
if (_arg1){
dataField = _arg1;
headerText = _arg1;
};
}
public function set headerRenderer(_arg1:Object):void{
_headerRenderer = _arg1;
if (owner){
owner.invalidate(InvalidationType.DATA);
};
}
public function get imeMode():String{
return (_imeMode);
}
public function setWidth(_arg1:Number):void{
_width = _arg1;
}
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 set cellRenderer(_arg1:Object):void{
_cellRenderer = _arg1;
if (owner){
owner.invalidate(InvalidationType.DATA);
};
}
public function get minWidth():Number{
return (_minWidth);
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
public function toString():String{
return ("[object DataGridColumn]");
}
public function get visible():Boolean{
return (_visible);
}
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 set minWidth(_arg1:Number):void{
_minWidth = _arg1;
if (_width < _arg1){
_width = _arg1;
};
if (owner){
owner.invalidate(InvalidationType.SIZE);
};
}
public function set headerText(_arg1:String):void{
_headerText = _arg1;
if (owner){
owner.invalidate(InvalidationType.DATA);
};
}
public function set sortCompareFunction(_arg1:Function):void{
_sortCompareFunction = _arg1;
}
public function get width():Number{
return (_width);
}
public function get cellRenderer():Object{
return (_cellRenderer);
}
public function set labelFunction(_arg1:Function):void{
if (_labelFunction == _arg1){
return;
};
_labelFunction = _arg1;
if (owner){
owner.invalidate(InvalidationType.DATA);
};
}
public function get headerText():String{
return (((_headerText)!=null) ? _headerText : dataField);
}
public function get sortCompareFunction():Function{
return (_sortCompareFunction);
}
public function get headerRenderer():Object{
return (_headerRenderer);
}
public function get labelFunction():Function{
return (_labelFunction);
}
public function set visible(_arg1:Boolean):void{
if (_visible != _arg1){
_visible = _arg1;
if (owner){
owner.invalidate(InvalidationType.SIZE);
};
};
}
}
}//package fl.controls.dataGridClasses
Section 120
//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 set column(_arg1:uint):void{
_column = _arg1;
}
public function get column():uint{
return (_column);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = Number(getStyleValue("textPadding"));
textField.height = (textField.textHeight + 4);
textField.visible = (label.length > 0);
_local2 = (textField.textWidth + 4);
_local3 = (textField.textHeight + 4);
_local4 = ((icon)==null) ? 0 : (icon.width + 4);
_local5 = 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 121
//CellRenderer (fl.controls.listClasses.CellRenderer)
package fl.controls.listClasses {
import flash.events.*;
import fl.controls.*;
public class CellRenderer extends LabelButton implements ICellRenderer {
protected var _data:Object;
protected var _listData:ListData;
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 protected function toggleSelected(_arg1:MouseEvent):void{
}
override public function get selected():Boolean{
return (super.selected);
}
public function set listData(_arg1:ListData):void{
_listData = _arg1;
label = _listData.label;
setStyle("icon", _listData.icon);
}
override public function set selected(_arg1:Boolean):void{
super.selected = _arg1;
}
public function set data(_arg1:Object):void{
_data = _arg1;
}
public function get listData():ListData{
return (_listData);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
super.setSize(_arg1, _arg2);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = 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 function get data():Object{
return (_data);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls.listClasses
Section 122
//ICellRenderer (fl.controls.listClasses.ICellRenderer)
package fl.controls.listClasses {
public interface ICellRenderer {
function setSize(_arg1:Number, _arg2:Number):void;
function get listData():ListData;
function get data():Object;
function setMouseState(_arg1:String):void;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function set data(_arg1:Object):void;
function set selected(_arg1:Boolean):void;
function set listData(_arg1:ListData):void;
function get selected():Boolean;
}
}//package fl.controls.listClasses
Section 123
//ImageCell (fl.controls.listClasses.ImageCell)
package fl.controls.listClasses {
import flash.events.*;
import flash.display.*;
import fl.containers.*;
public class ImageCell extends CellRenderer implements ICellRenderer {
protected var loader:UILoader;
protected var textOverlay:Shape;
private static var defaultStyles:Object = {imagePadding:1, textOverlayAlpha:0.7};
public function ImageCell(){
loader = new UILoader();
loader.addEventListener(IOErrorEvent.IO_ERROR, handleErrorEvent, false, 0, true);
loader.autoLoad = true;
loader.scaleContent = true;
addChild(loader);
}
public function get source():Object{
return (loader.source);
}
public function set source(_arg1:Object):void{
loader.source = _arg1;
}
override public function set listData(_arg1:ListData):void{
var _local2:Object;
_listData = _arg1;
label = _listData.label;
_local2 = (_listData as TileListData).source;
if (source != _local2){
source = _local2;
};
}
override protected function draw():void{
super.draw();
}
override protected function configUI():void{
var _local1:Graphics;
super.configUI();
textOverlay = new Shape();
_local1 = textOverlay.graphics;
_local1.beginFill(0xFFFFFF);
_local1.drawRect(0, 0, 100, 100);
_local1.endFill();
}
override public function get listData():ListData{
return (_listData);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local1 = (getStyleValue("imagePadding") as Number);
loader.move(_local1, _local1);
_local2 = (width - (_local1 * 2));
_local3 = (height - (_local1 * 2));
if (((!((loader.width == _local2))) && (!((loader.height == _local3))))){
loader.setSize(_local2, _local3);
};
loader.drawNow();
if ((((_label == "")) || ((_label == null)))){
if (contains(textField)){
removeChild(textField);
};
if (contains(textOverlay)){
removeChild(textOverlay);
};
} else {
_local4 = (getStyleValue("textPadding") as Number);
textField.width = Math.min((width - (_local4 * 2)), (textField.textWidth + 5));
textField.height = (textField.textHeight + 5);
textField.x = Math.max(_local4, ((width / 2) - (textField.width / 2)));
textField.y = ((height - textField.height) - _local4);
textOverlay.x = _local1;
textOverlay.height = (textField.height + (_local4 * 2));
textOverlay.y = ((height - textOverlay.height) - _local1);
textOverlay.width = (width - (_local1 * 2));
textOverlay.alpha = (getStyleValue("textOverlayAlpha") as Number);
addChild(textOverlay);
addChild(textField);
};
background.width = width;
background.height = height;
}
protected function handleErrorEvent(_arg1:IOErrorEvent):void{
dispatchEvent(_arg1);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, CellRenderer.getStyleDefinition()));
}
}
}//package fl.controls.listClasses
Section 124
//ListData (fl.controls.listClasses.ListData)
package fl.controls.listClasses {
import fl.core.*;
public class ListData {
protected var _index:uint;
protected var _owner:UIComponent;
protected var _label:String;
protected var _icon:Object;// = null
protected var _row:uint;
protected var _column:uint;
public function ListData(_arg1:String, _arg2:Object, _arg3:UIComponent, _arg4:uint, _arg5:uint, _arg6:uint=0){
_icon = null;
super();
_label = _arg1;
_icon = _arg2;
_owner = _arg3;
_index = _arg4;
_row = _arg5;
_column = _arg6;
}
public function get owner():UIComponent{
return (_owner);
}
public function get label():String{
return (_label);
}
public function get row():uint{
return (_row);
}
public function get index():uint{
return (_index);
}
public function get icon():Object{
return (_icon);
}
public function get column():uint{
return (_column);
}
}
}//package fl.controls.listClasses
Section 125
//TileListData (fl.controls.listClasses.TileListData)
package fl.controls.listClasses {
import fl.core.*;
public class TileListData extends ListData {
protected var _source:Object;
public function TileListData(_arg1:String, _arg2:Object, _arg3:Object, _arg4:UIComponent, _arg5:uint, _arg6:uint, _arg7:uint=0){
super(_arg1, _arg2, _arg4, _arg5, _arg6, _arg7);
_source = _arg3;
}
public function get source():Object{
return (_source);
}
}
}//package fl.controls.listClasses
Section 126
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import fl.core.*;
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import fl.events.*;
public class BaseButton extends UIComponent {
protected var _selected:Boolean;// = false
private var unlockedMouseState:String;
protected var pressTimer:Timer;
protected var mouseState:String;
protected var background:DisplayObject;
private var _mouseStateLocked:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
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(){
_selected = false;
_autoRepeat = false;
_mouseStateLocked = false;
super();
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
protected function endPress():void{
pressTimer.reset();
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
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();
};
};
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
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));
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
override public function get enabled():Boolean{
return (super.enabled);
}
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 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 drawLayout():void{
background.width = width;
background.height = height;
}
protected function drawBackground():void{
var _local1:String;
var _local2:DisplayObject;
_local1 = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
_local2 = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 127
//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 emphasizedBorder:DisplayObject;
protected var _emphasized:Boolean;// = false
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function Button(){
_emphasized = false;
super();
}
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));
};
}
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));
};
}
public function get emphasized():Boolean{
return (_emphasized);
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
protected function drawEmphasized():void{
var _local1:Object;
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
_local1 = 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));
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 128
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement)
package fl.controls {
public class ButtonLabelPlacement {
public static const TOP:String = "top";
public static const LEFT:String = "left";
public static const BOTTOM:String = "bottom";
public static const RIGHT:String = "right";
}
}//package fl.controls
Section 129
//DataGrid (fl.controls.DataGrid)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import fl.data.*;
import fl.managers.*;
import fl.events.*;
import fl.controls.dataGridClasses.*;
import flash.ui.*;
public class DataGrid extends SelectableList implements IFocusManagerComponent {
protected var _showHeaders:Boolean;// = true
protected var _sortIndex:int;// = -1
protected var _minColumnWidth:Number;
protected var _headerRenderer:Object;
public var sortableColumns:Boolean;// = true
protected var activeCellRenderersMap:Dictionary;
protected var _labelFunction:Function;
protected var headerSortArrow:Sprite;
protected var _sortDescending:Boolean;// = false
protected var losingFocus:Boolean;// = false
protected var maxHeaderHeight:Number;// = 25
protected var minColumnWidthInvalid:Boolean;// = false
protected var _rowHeight:Number;// = 20
protected var _cellRenderer:Object;
protected var proposedEditedItemPosition;
public var editable:Boolean;// = false
protected var dragHandlesMap:Dictionary;
protected var header:Sprite;
protected var availableCellRenderersMap:Dictionary;
protected var _columns:Array;
public var resizableColumns:Boolean;// = true
protected var columnStretchStartWidth:Number;
protected var actualRowIndex:int;
protected var _editedItemPosition:Object;
protected var editedItemPositionChanged:Boolean;// = false
protected var actualColIndex:int;
protected var columnStretchCursor:Sprite;
protected var visibleColumns:Array;
protected var headerMask:Sprite;
public var itemEditorInstance:Object;
protected var displayableColumns:Array;
protected var columnStretchIndex:Number;// = -1
protected var columnsInvalid:Boolean;// = true
protected var currentHoveredRow:int;// = -1
protected var isPressed:Boolean;// = false
protected var lastSortIndex:int;// = -1
protected var columnStretchStartX:Number;
protected var _headerHeight:Number;// = 25
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(){
_rowHeight = 20;
_headerHeight = 25;
_showHeaders = true;
columnsInvalid = true;
minColumnWidthInvalid = false;
columnStretchIndex = -1;
_sortIndex = -1;
lastSortIndex = -1;
_sortDescending = false;
editedItemPositionChanged = false;
isPressed = false;
losingFocus = false;
maxHeaderHeight = 25;
currentHoveredRow = -1;
editable = false;
resizableColumns = true;
sortableColumns = true;
super();
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 protected function drawList():void{
var _local1:uint;
var _local2:uint;
var _local3:Number;
var _local4:Number;
var _local5:uint;
var _local6:Object;
var _local7:ICellRenderer;
var _local8:Array;
var _local9:DataGridColumn;
var _local10:Boolean;
var _local11:Dictionary;
var _local12:DataGridColumn;
var _local13:Sprite;
var _local14:UIComponent;
var _local15:Array;
var _local16:uint;
var _local17:uint;
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;
_local1 = Math.min(Math.max((length - 1), 0), Math.floor((_verticalScrollPosition / rowHeight)));
_local2 = Math.min(Math.max((length - 1), 0), ((_local1 + rowCount) + 1));
_local10 = list.hitTestPoint(stage.mouseX, stage.mouseY);
calculateColumnSizes();
_local11 = (renderedItems = new Dictionary(true));
if (length > 0){
_local5 = _local1;
while (_local5 <= _local2) {
_local11[_dataProvider.getItemAt(_local5)] = true;
_local5++;
};
};
_local3 = 0;
_local12 = (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);
_local15 = [];
_local16 = visibleColumns.length;
_local17 = 0;
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, _local17);
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);
}
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 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();
};
}
public function get editedItemPosition():Object{
if (_editedItemPosition){
return ({rowIndex:_editedItemPosition.rowIndex, columnIndex:_editedItemPosition.columnIndex});
};
return (_editedItemPosition);
}
protected function setEditedItemPosition(_arg1:Object):void{
editedItemPositionChanged = true;
proposedEditedItemPosition = _arg1;
if (((_arg1) && (!((_arg1.rowIndex == selectedIndex))))){
selectedIndex = _arg1.rowIndex;
};
invalidate(InvalidationType.DATA);
}
public function set headerHeight(_arg1:Number):void{
maxHeaderHeight = _arg1;
_headerHeight = Math.max(0, _arg1);
invalidate(InvalidationType.SIZE);
}
protected function handleHeaderResizeDown(_arg1:MouseEvent):void{
var _local2:Sprite;
var _local3:Number;
var _local4:DataGridColumn;
_local2 = (_arg1.currentTarget as Sprite);
_local3 = dragHandlesMap[_local2];
_local4 = 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 deactivateHandler(_arg1:Event):void{
if (itemEditorInstance){
endEdit(DataGridEventReason.OTHER);
losingFocus = true;
setFocus();
};
}
protected function keyFocusChangeHandler(_arg1:FocusEvent):void{
if ((((((_arg1.keyCode == Keyboard.TAB)) && (!(_arg1.isDefaultPrevented())))) && (findNextItemRenderer(_arg1.shiftKey)))){
_arg1.preventDefault();
};
}
override protected function handleDataChange(_arg1:DataChangeEvent):void{
super.handleDataChange(_arg1);
if (_columns == null){
_columns = [];
};
if (_columns.length == 0){
createColumnsFromDataProvider();
};
}
public function set editedItemPosition(_arg1:Object):void{
var _local2:Object;
_local2 = {rowIndex:_arg1.rowIndex, columnIndex:_arg1.columnIndex};
setEditedItemPosition(_local2);
}
override public function itemToCellRenderer(_arg1:Object):ICellRenderer{
return (null);
}
public function getCellRendererAt(_arg1:uint, _arg2:uint):ICellRenderer{
var _local3:DataGridColumn;
var _local4:Array;
var _local5:uint;
var _local6:ICellRenderer;
_local3 = (_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);
}
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();
}
protected function handleHeaderResizeUp(_arg1:MouseEvent):void{
var _local2:Sprite;
var _local3:DataGridColumn;
var _local4:HeaderRenderer;
var _local5:uint;
var _local6:DataGridEvent;
_local2 = (_arg1.currentTarget as Sprite);
_local3 = (_columns[columnStretchIndex] as DataGridColumn);
_local5 = 0;
while (_local5 < header.numChildren) {
_local4 = (header.getChildAt(_local5) as HeaderRenderer);
if (((_local4) && ((_local4.column == columnStretchIndex)))){
break;
};
_local5++;
};
_local6 = 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 handleHeaderResizeOver(_arg1:MouseEvent):void{
if (columnStretchIndex == -1){
showColumnStretchCursor();
};
}
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);
};
}
public function createItemEditor(_arg1:uint, _arg2:uint):void{
var _local3:DataGridColumn;
var _local4:ICellRenderer;
var _local5:Sprite;
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;
};
};
_local3 = (_columns[_arg1] as DataGridColumn);
_local4 = getCellRendererAt(_arg2, _arg1);
if (!itemEditorInstance){
itemEditorInstance = getDisplayObjectInstance(_local3.itemEditor);
itemEditorInstance.tabEnabled = false;
list.addChild(DisplayObject(itemEditorInstance));
};
list.setChildIndex(DisplayObject(itemEditorInstance), (list.numChildren - 1));
_local5 = (_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);
}
private function itemEditorFocusOutHandler(_arg1:FocusEvent):void{
if (((_arg1.relatedObject) && (contains(_arg1.relatedObject)))){
return;
};
if (!_arg1.relatedObject){
return;
};
if (itemEditorInstance){
endEdit(DataGridEventReason.OTHER);
};
}
override public function get horizontalScrollPolicy():String{
return (_horizontalScrollPolicy);
}
override protected function updateRendererStyles():void{
var _local1:Array;
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:String;
_local1 = [];
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 = {};
}
public function set minColumnWidth(_arg1:Number):void{
_minColumnWidth = _arg1;
columnsInvalid = true;
minColumnWidthInvalid = true;
invalidate(InvalidationType.SIZE);
}
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 findNextEnterItemRenderer(_arg1:KeyboardEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:DataGridEvent;
if (proposedEditedItemPosition !== undefined){
return;
};
_local2 = _editedItemPosition.rowIndex;
_local3 = _editedItemPosition.columnIndex;
_local4 = (_editedItemPosition.rowIndex + (_arg1.shiftKey) ? -1 : 1);
if ((((_local4 >= 0)) && ((_local4 < length)))){
_local2 = _local4;
};
_local5 = 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();
};
}
public function get imeMode():String{
return (_imeMode);
}
public function editField(_arg1:uint, _arg2:String, _arg3:Object):void{
var _local4:Object;
_local4 = getItemAt(_arg1);
_local4[_arg2] = _arg3;
replaceItemAt(_local4, _arg1);
}
protected function calculateAvailableHeight():Number{
var _local1:Number;
var _local2:Number;
_local1 = Number(getStyleValue("contentPadding"));
_local2 = ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0;
return ((((height - (_local1 * 2)) - _local2) - (showHeaders) ? headerHeight : 0));
}
protected function mouseUpHandler(_arg1:MouseEvent):void{
if (((!(enabled)) || (!(selectable)))){
return;
};
isPressed = false;
}
override protected function moveSelectionHorizontally(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
public function resizeColumn(_arg1:int, _arg2:Number):void{
var _local3:DataGridColumn;
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;
};
_local3 = (_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 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);
};
}
override protected function draw():void{
var _local1:Boolean;
_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 public function set horizontalScrollPolicy(_arg1:String):void{
super.horizontalScrollPolicy = _arg1;
columnsInvalid = true;
}
protected function getVisibleColumnIndex(_arg1:DataGridColumn):int{
var _local2:uint;
_local2 = 0;
while (_local2 < visibleColumns.length) {
if (_arg1 == visibleColumns[_local2]){
return (_local2);
};
_local2++;
};
return (-1);
}
protected function itemRendererContains(_arg1:Object, _arg2:DisplayObject):Boolean{
if (((((!(_arg2)) || (!(_arg1)))) || (!((_arg1 is DisplayObjectContainer))))){
return (false);
};
return (DisplayObjectContainer(_arg1).contains(_arg2));
}
override protected function configUI():void{
var _local1:Graphics;
useFixedHorizontalScrolling = false;
super.configUI();
headerMask = new Sprite();
_local1 = 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;
}
public function columnItemToLabel(_arg1:uint, _arg2:Object):String{
var _local3:DataGridColumn;
_local3 = (_columns[_arg1] as DataGridColumn);
if (_local3 != null){
return (_local3.itemToLabel(_arg2));
};
return (" ");
}
protected function endEdit(_arg1:String):Boolean{
var _local2:DataGridEvent;
if (!editedItemRenderer){
return (true);
};
_local2 = new DataGridEvent(DataGridEvent.ITEM_EDIT_END, false, true, editedItemPosition.columnIndex, editedItemPosition.rowIndex, editedItemRenderer, _columns[editedItemPosition.columnIndex].dataField, _arg1);
dispatchEvent(_local2);
return (!(_local2.isDefaultPrevented()));
}
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;
}
protected function commitEditedItemPosition(_arg1:Object):void{
var _local2:ICellRenderer;
var _local3:DataGridEvent;
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);
_local2 = getCellRendererAt(actualRowIndex, actualColIndex);
_local3 = 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 handleHeaderRendererClick(_arg1:MouseEvent):void{
var _local2:HeaderRenderer;
var _local3:uint;
var _local4:DataGridColumn;
var _local5:uint;
var _local6:DataGridEvent;
if (!_enabled){
return;
};
_local2 = (_arg1.currentTarget as HeaderRenderer);
_local3 = _local2.column;
_local4 = (_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 get showHeaders():Boolean{
return (_showHeaders);
}
public function get sortIndex():int{
return (_sortIndex);
}
public function set labelFunction(_arg1:Function):void{
if (_labelFunction == _arg1){
return;
};
_labelFunction = _arg1;
invalidate(InvalidationType.DATA);
}
public function getColumnIndex(_arg1:String):int{
var _local2:uint;
var _local3:DataGridColumn;
_local2 = 0;
while (_local2 < _columns.length) {
_local3 = (_columns[_local2] as DataGridColumn);
if (_local3.dataField == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
}
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 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);
};
};
}
public function addColumnAt(_arg1, _arg2:uint):DataGridColumn{
var _local3:DataGridColumn;
var _local4:*;
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++;
};
};
_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 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;
};
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
protected function doKeySelection(_arg1:int, _arg2:Boolean, _arg3:Boolean):void{
var _local4:Boolean;
var _local5:int;
var _local6:Array;
var _local7:int;
var _local8:int;
_local4 = false;
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);
}
public function get headerHeight():Number{
return (_headerHeight);
}
public function getColumnCount():uint{
return (_columns.length);
}
protected function sortByColumn(_arg1:int):void{
var _local2:DataGridColumn;
var _local3:Boolean;
var _local4:uint;
_local2 = (columns[_arg1] as DataGridColumn);
if (((((!(enabled)) || (!(_local2)))) || (!(_local2.sortable)))){
return;
};
_local3 = _local2.sortDescending;
_local4 = _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;
};
};
}
public function get minColumnWidth():Number{
return (_minColumnWidth);
}
protected function isHovered(_arg1:ICellRenderer):Boolean{
var _local2:uint;
var _local3:Number;
var _local4:Point;
_local2 = Math.min(Math.max((length - 1), 0), Math.floor((_verticalScrollPosition / rowHeight)));
_local3 = ((_arg1.listData.row - _local2) * rowHeight);
_local4 = list.globalToLocal(new Point(0, stage.mouseY));
return ((((_local4.y > _local3)) && ((_local4.y < (_local3 + rowHeight)))));
}
protected function mouseDownHandler(_arg1:MouseEvent):void{
if (((!(enabled)) || (!(selectable)))){
return;
};
isPressed = true;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
header.mouseChildren = _enabled;
}
override protected function moveSelectionVertically(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
var _local4:int;
var _local5:int;
var _local6:int;
_local4 = Math.max(Math.floor((calculateAvailableHeight() / rowHeight)), 1);
_local5 = -1;
_local6 = 0;
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 handleHeaderResizeOut(_arg1:MouseEvent):void{
if (columnStretchIndex == -1){
showColumnStretchCursor(false);
};
}
public function removeAllColumns():void{
if (_columns.length > 0){
removeCellRenderers();
_columns = [];
invalidate(InvalidationType.SIZE);
columnsInvalid = true;
};
}
public function set rowCount(_arg1:uint):void{
var _local2:Number;
var _local3:Number;
_local2 = Number(getStyleValue("contentPadding"));
_local3 = ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && (hScrollBar))))) ? 15 : 0;
height = ((((rowHeight * _arg1) + (2 * _local2)) + _local3) + (showHeaders) ? headerHeight : 0);
}
protected function removeCellRenderers():void{
var _local1:uint;
_local1 = 0;
while (_local1 < _columns.length) {
removeCellRenderersByColumn((_columns[_local1] as DataGridColumn));
_local1++;
};
}
public function removeColumnAt(_arg1:uint):DataGridColumn{
var _local2:DataGridColumn;
var _local3:uint;
_local2 = (_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);
}
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;
}
public function get labelFunction():Function{
return (_labelFunction);
}
override protected function handleCellRendererClick(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:DataGridColumn;
var _local4:DataGridEvent;
super.handleCellRendererClick(_arg1);
_local2 = (_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);
};
};
}
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 positionColumnStretchCursor(_arg1:MouseEvent):void{
columnStretchCursor.x = _arg1.stageX;
columnStretchCursor.y = _arg1.stageY;
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
if (itemEditorInstance){
endEdit(DataGridEventReason.OTHER);
};
invalidate(InvalidationType.SCROLL);
super.setVerticalScrollPosition(_arg1, true);
}
public function get sortDescending():Boolean{
return (_sortDescending);
}
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);
};
};
};
};
}
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));
};
};
}
override public function get rowCount():uint{
return (Math.ceil((calculateAvailableHeight() / rowHeight)));
}
public function addColumn(_arg1):DataGridColumn{
return (addColumnAt(_arg1, _columns.length));
}
protected function removeCellRenderersByColumn(_arg1:DataGridColumn):void{
var _local2:Array;
if (_arg1 == null){
return;
};
_local2 = activeCellRenderersMap[_arg1];
if (_local2 != null){
while (_local2.length > 0) {
list.removeChild((_local2.pop() as DisplayObject));
};
};
}
override protected function handleCellRendererMouseEvent(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:int;
var _local4:String;
var _local5:uint;
var _local6:DataGridColumn;
var _local7:ICellRenderer;
_local2 = (_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 handleHeaderResizeMove(_arg1:MouseEvent):void{
var _local2:Number;
var _local3:Number;
_local2 = (_arg1.stageX - columnStretchStartX);
_local3 = (columnStretchStartWidth + _local2);
resizeColumn(columnStretchIndex, _local3);
}
public function set rowHeight(_arg1:Number):void{
_rowHeight = Math.max(0, _arg1);
invalidate(InvalidationType.SIZE);
}
protected function scrollToPosition(_arg1:int, _arg2:int):void{
var _local3:Number;
var _local4:Number;
var _local5:uint;
var _local6:Number;
var _local7:DataGridColumn;
var _local8:DataGridColumn;
_local3 = verticalScrollPosition;
_local4 = horizontalScrollPosition;
scrollToIndex(_arg1);
_local6 = 0;
_local7 = (_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 findNextItemRenderer(_arg1:Boolean):Boolean{
var _local2:int;
var _local3:int;
var _local4:Boolean;
var _local5:int;
var _local6:int;
var _local7:String;
var _local8:DataGridEvent;
if (!_editedItemPosition){
return (false);
};
if (proposedEditedItemPosition !== undefined){
return (false);
};
_local2 = _editedItemPosition.rowIndex;
_local3 = _editedItemPosition.columnIndex;
_local4 = false;
_local5 = (_arg1) ? -1 : 1;
_local6 = (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);
}
override public function set dataProvider(_arg1:DataProvider):void{
super.dataProvider = _arg1;
if (_columns == null){
_columns = [];
};
if (_columns.length == 0){
createColumnsFromDataProvider();
};
removeCellRenderers();
}
override public function setSize(_arg1:Number, _arg2:Number):void{
super.setSize(_arg1, _arg2);
columnsInvalid = true;
}
override public function scrollToIndex(_arg1:int):void{
var _local2:int;
var _local3:int;
var _local4:Number;
drawNow();
_local2 = (Math.floor(((_verticalScrollPosition + availableHeight) / rowHeight)) - 1);
_local3 = 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 calculateColumnSizes():void{
var _local1:Number;
var _local2:int;
var _local3:int;
var _local4:Number;
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;
_local4 = 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));
};
};
};
}
public function set showHeaders(_arg1:Boolean):void{
_showHeaders = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function initializeAccessibility():void{
if (DataGrid.createAccessibilityImplementation != null){
DataGrid.createAccessibilityImplementation(this);
};
}
public function getColumnAt(_arg1:uint):DataGridColumn{
return ((_columns[_arg1] as DataGridColumn));
}
public function get rowHeight():Number{
return (_rowHeight);
}
public function set columns(_arg1:Array):void{
var _local2:uint;
removeCellRenderers();
_columns = [];
_local2 = 0;
while (_local2 < _arg1.length) {
addColumn(_arg1[_local2]);
_local2++;
};
}
public function get editedItemRenderer():ICellRenderer{
if (!itemEditorInstance){
return (null);
};
return (getCellRendererAt(actualRowIndex, actualColIndex));
}
public function get columns():Array{
return (_columns.slice(0));
}
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 static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, SelectableList.getStyleDefinition(), ScrollBar.getStyleDefinition()));
}
}
}//package fl.controls
Section 130
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import fl.core.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
import fl.managers.*;
import fl.events.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var mode:String;// = "center"
public var textField:TextField;
protected var _label:String;// = "Label"
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 LabelButton(){
_labelPlacement = ButtonLabelPlacement.RIGHT;
_toggle = false;
_label = "Label";
mode = "center";
super();
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
public function get labelPlacement():String{
return (_labelPlacement);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
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 public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
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);
}
public function get label():String{
return (_label);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
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();
}
public function get toggle():Boolean{
return (_toggle);
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function drawLayout():void{
var _local1:Number;
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local1 = Number(getStyleValue("textPadding"));
_local2 = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
_local3 = (textField.textWidth + 4);
_local4 = (textField.textHeight + 4);
_local5 = ((icon)==null) ? 0 : (icon.width + _local1);
_local6 = ((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 initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
protected function drawIcon():void{
var _local1:DisplayObject;
var _local2:String;
var _local3:Object;
_local1 = icon;
_local2 = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
_local3 = 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);
};
}
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);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 131
//List (fl.controls.List)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import fl.managers.*;
import flash.ui.*;
public class List extends SelectableList implements IFocusManagerComponent {
protected var _labelField:String;// = "label"
protected var _rowHeight:Number;// = 20
protected var _cellRenderer:Object;
protected var _iconField:String;// = "icon"
protected var _labelFunction:Function;
protected var _iconFunction:Function;
private static var defaultStyles:Object = {focusRectSkin:null, focusRectPadding:null};
public static var createAccessibilityImplementation:Function;
public function List(){
_rowHeight = 20;
_labelField = "label";
_iconField = "icon";
super();
}
public function get iconField():String{
return (_iconField);
}
protected function doKeySelection(_arg1:int, _arg2:Boolean, _arg3:Boolean):void{
var _local4:Boolean;
var _local5:int;
var _local6:Array;
var _local7:int;
var _local8:int;
_local4 = false;
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 protected function drawList():void{
var _local1:Rectangle;
var _local2:uint;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:ICellRenderer;
var _local7:Dictionary;
var _local8:Dictionary;
var _local9:Boolean;
var _local10:String;
var _local11:Object;
var _local12:Sprite;
var _local13:String;
listHolder.x = (listHolder.y = contentPadding);
_local1 = listHolder.scrollRect;
_local1.x = _horizontalScrollPosition;
_local1.y = (Math.floor(_verticalScrollPosition) % rowHeight);
listHolder.scrollRect = _local1;
listHolder.cacheAsBitmap = useBitmapScrolling;
_local2 = Math.floor((_verticalScrollPosition / rowHeight));
_local3 = Math.min(length, ((_local2 + rowCount) + 1));
_local7 = (renderedItems = new Dictionary(true));
_local4 = _local2;
while (_local4 < _local3) {
_local7[_dataProvider.getItemAt(_local4)] = true;
_local4++;
};
_local8 = 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["setStyle"] != null){
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++;
};
}
public function get iconFunction():Function{
return (_iconFunction);
}
public function set iconField(_arg1:String):void{
if (_arg1 == _iconField){
return;
};
_iconField = _arg1;
invalidate(InvalidationType.DATA);
}
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 public function itemToLabel(_arg1:Object):String{
if (_labelFunction != null){
return (String(_labelFunction(_arg1)));
};
return (((_arg1[_labelField])!=null) ? String(_arg1[_labelField]) : "");
}
public function get labelField():String{
return (_labelField);
}
override protected function moveSelectionVertically(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
var _local4:int;
var _local5:int;
var _local6:int;
_local4 = Math.max(Math.floor((calculateAvailableHeight() / rowHeight)), 1);
_local5 = -1;
_local6 = 0;
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();
};
}
public function set labelField(_arg1:String):void{
if (_arg1 == _labelField){
return;
};
_labelField = _arg1;
invalidate(InvalidationType.DATA);
}
public function set rowCount(_arg1:uint):void{
var _local2:Number;
var _local3:Number;
_local2 = Number(getStyleValue("contentPadding"));
_local3 = ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0;
height = (((rowHeight * _arg1) + (2 * _local2)) + _local3);
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
list.x = -(_arg1);
super.setHorizontalScrollPosition(_arg1, true);
}
public function set iconFunction(_arg1:Function):void{
if (_iconFunction == _arg1){
return;
};
_iconFunction = _arg1;
invalidate(InvalidationType.DATA);
}
public function get labelFunction():Function{
return (_labelFunction);
}
override protected function moveSelectionHorizontally(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
invalidate(InvalidationType.SCROLL);
super.setVerticalScrollPosition(_arg1, true);
}
protected function calculateAvailableHeight():Number{
var _local1:Number;
_local1 = Number(getStyleValue("contentPadding"));
return (((height - (_local1 * 2)) - ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0));
}
override protected function draw():void{
var _local1:Boolean;
_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 configUI():void{
useFixedHorizontalScrolling = true;
_horizontalScrollPolicy = ScrollPolicy.AUTO;
_verticalScrollPolicy = ScrollPolicy.AUTO;
super.configUI();
}
override public function get rowCount():uint{
return (Math.ceil((calculateAvailableHeight() / rowHeight)));
}
override protected function initializeAccessibility():void{
if (List.createAccessibilityImplementation != null){
List.createAccessibilityImplementation(this);
};
}
override public function scrollToIndex(_arg1:int):void{
var _local2:uint;
var _local3:uint;
drawNow();
_local2 = (Math.floor(((_verticalScrollPosition + availableHeight) / rowHeight)) - 1);
_local3 = Math.ceil((_verticalScrollPosition / rowHeight));
if (_arg1 < _local3){
verticalScrollPosition = (_arg1 * rowHeight);
} else {
if (_arg1 > _local2){
verticalScrollPosition = (((_arg1 + 1) * rowHeight) - availableHeight);
};
};
}
public function get rowHeight():Number{
return (_rowHeight);
}
public function set labelFunction(_arg1:Function):void{
if (_labelFunction == _arg1){
return;
};
_labelFunction = _arg1;
invalidate(InvalidationType.DATA);
}
public function set rowHeight(_arg1:Number):void{
_rowHeight = _arg1;
invalidate(InvalidationType.SIZE);
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, SelectableList.getStyleDefinition()));
}
}
}//package fl.controls
Section 132
//NumericStepper (fl.controls.NumericStepper)
package fl.controls {
import fl.core.*;
import flash.events.*;
import flash.display.*;
import fl.managers.*;
import fl.events.*;
import flash.ui.*;
public class NumericStepper extends UIComponent implements IFocusManagerComponent {
protected var upArrow:BaseButton;
protected var _stepSize:Number;// = 1
protected var downArrow:BaseButton;
protected var _value:Number;// = 1
protected var _minimum:Number;// = 0
protected var _maximum:Number;// = 10
protected var _precision:Number;
protected var inputField:TextInput;
protected static const DOWN_ARROW_STYLES:Object = {disabledSkin:"downArrowDisabledSkin", downSkin:"downArrowDownSkin", overSkin:"downArrowOverSkin", upSkin:"downArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const TEXT_INPUT_STYLES:Object = {upSkin:"upSkin", disabledSkin:"disabledSkin", textPadding:"textPadding", textFormat:"textFormat", disabledTextFormat:"disabledTextFormat", embedFonts:"embedFonts"};
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:"NumericStepperDownArrow_disabledSkin", downArrowDownSkin:"NumericStepperDownArrow_downSkin", downArrowOverSkin:"NumericStepperDownArrow_overSkin", downArrowUpSkin:"NumericStepperDownArrow_upSkin", upArrowDisabledSkin:"NumericStepperUpArrow_disabledSkin", upArrowDownSkin:"NumericStepperUpArrow_downSkin", upArrowOverSkin:"NumericStepperUpArrow_overSkin", upArrowUpSkin:"NumericStepperUpArrow_upSkin", upSkin:"TextInput_upSkin", disabledSkin:"TextInput_disabledSkin", focusRect:null, focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35, embedFonts:false};
public function NumericStepper(){
_maximum = 10;
_minimum = 0;
_value = 1;
_stepSize = 1;
super();
setStyles();
stepSize = _stepSize;
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
};
}
public function get minimum():Number{
return (_minimum);
}
public function set imeMode(_arg1:String):void{
inputField.imeMode = _arg1;
}
public function set minimum(_arg1:Number):void{
_minimum = _arg1;
if (_value < _minimum){
setValue(_minimum, false);
};
}
public function get maximum():Number{
return (_maximum);
}
override protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((((_arg1 == inputField)) || (super.isOurFocus(_arg1))));
}
public function get nextValue():Number{
var _local1:Number;
_local1 = (_value + _stepSize);
return ((inRange(_local1)) ? _local1 : _value);
}
public function set maximum(_arg1:Number):void{
_maximum = _arg1;
if (_value > _maximum){
setValue(_maximum, false);
};
}
protected function setValue(_arg1:Number, _arg2:Boolean=true):void{
var _local3:Number;
if (_arg1 == _value){
return;
};
_local3 = _value;
_value = getValidValue(_arg1);
inputField.text = _value.toString();
if (_arg2){
dispatchEvent(new Event(Event.CHANGE, true));
};
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:Number;
if (!enabled){
return;
};
_arg1.stopImmediatePropagation();
_local2 = Number(inputField.text);
switch (_arg1.keyCode){
case Keyboard.END:
setValue(maximum);
break;
case Keyboard.HOME:
setValue(minimum);
break;
case Keyboard.UP:
setValue(nextValue);
break;
case Keyboard.DOWN:
setValue(previousValue);
break;
case Keyboard.ENTER:
setValue(_local2);
break;
};
}
override public function set enabled(_arg1:Boolean):void{
if (_arg1 == enabled){
return;
};
super.enabled = _arg1;
upArrow.enabled = (downArrow.enabled = (inputField.enabled = _arg1));
}
protected function onTextChange(_arg1:Event):void{
_arg1.stopImmediatePropagation();
}
public function get previousValue():Number{
var _local1:Number;
_local1 = (_value - _stepSize);
return ((inRange(_local1)) ? _local1 : _value);
}
protected function getValidValue(_arg1:Number):Number{
var _local2:Number;
if (isNaN(_arg1)){
return (_value);
};
_local2 = Number((_stepSize * Math.round((_arg1 / _stepSize))).toFixed(_precision));
if (_local2 > maximum){
return (maximum);
};
if (_local2 < minimum){
return (minimum);
};
return (_local2);
}
public function set value(_arg1:Number):void{
setValue(_arg1, false);
}
public function get stepSize():Number{
return (_stepSize);
}
protected function passEvent(_arg1:Event):void{
dispatchEvent(_arg1);
}
public function get imeMode():String{
return (inputField.imeMode);
}
protected function stepperPressHandler(_arg1:ComponentEvent):void{
setValue(Number(inputField.text), false);
switch (_arg1.currentTarget){
case upArrow:
setValue(nextValue);
break;
case downArrow:
setValue(previousValue);
};
inputField.setFocus();
inputField.textField.setSelection(0, 0);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
if (_arg1.eventPhase == 3){
setValue(Number(inputField.text));
};
super.focusOutHandler(_arg1);
}
protected function inRange(_arg1:Number):Boolean{
return ((((_arg1 >= _minimum)) && ((_arg1 <= _maximum))));
}
override public function get enabled():Boolean{
return (super.enabled);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
setStyles();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
validate();
}
override protected function configUI():void{
super.configUI();
upArrow = new BaseButton();
copyStylesToChild(upArrow, UP_ARROW_STYLES);
upArrow.autoRepeat = true;
upArrow.setSize(21, 12);
upArrow.focusEnabled = false;
addChild(upArrow);
downArrow = new BaseButton();
copyStylesToChild(downArrow, DOWN_ARROW_STYLES);
downArrow.autoRepeat = true;
downArrow.setSize(21, 12);
downArrow.focusEnabled = false;
addChild(downArrow);
inputField = new TextInput();
copyStylesToChild(inputField, TEXT_INPUT_STYLES);
inputField.restrict = "0-9\\-\\.\\,";
inputField.text = _value.toString();
inputField.setSize(21, 24);
inputField.focusTarget = (this as IFocusManagerComponent);
inputField.focusEnabled = false;
inputField.addEventListener(FocusEvent.FOCUS_IN, passEvent);
inputField.addEventListener(FocusEvent.FOCUS_OUT, passEvent);
addChild(inputField);
inputField.addEventListener(Event.CHANGE, onTextChange, false, 0, true);
upArrow.addEventListener(ComponentEvent.BUTTON_DOWN, stepperPressHandler, false, 0, true);
downArrow.addEventListener(ComponentEvent.BUTTON_DOWN, stepperPressHandler, false, 0, true);
}
public function get value():Number{
return (_value);
}
protected function inStep(_arg1:Number):Boolean{
return ((((_arg1 - _minimum) % _stepSize) == 0));
}
protected function drawLayout():void{
var _local1:Number;
var _local2:Number;
_local1 = (width - upArrow.width);
_local2 = (height / 2);
inputField.setSize(_local1, height);
upArrow.height = _local2;
downArrow.height = Math.floor(_local2);
downArrow.move(_local1, _local2);
upArrow.move(_local1, 0);
downArrow.drawNow();
upArrow.drawNow();
inputField.drawNow();
}
override public function setFocus():void{
if (stage){
stage.focus = inputField.textField;
};
}
protected function getPrecision():Number{
var _local1:String;
_local1 = _stepSize.toString();
if (_local1.indexOf(".") == -1){
return (0);
};
return (_local1.split(".").pop().length);
}
public function get textField():TextInput{
return (inputField);
}
public function set stepSize(_arg1:Number):void{
_stepSize = _arg1;
_precision = getPrecision();
setValue(_value);
}
protected function setStyles():void{
copyStylesToChild(downArrow, DOWN_ARROW_STYLES);
copyStylesToChild(upArrow, UP_ARROW_STYLES);
copyStylesToChild(inputField, TEXT_INPUT_STYLES);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 133
//RadioButton (fl.controls.RadioButton)
package fl.controls {
import flash.events.*;
import flash.display.*;
import fl.managers.*;
import flash.ui.*;
public class RadioButton extends LabelButton implements IFocusManagerGroup {
protected var _value:Object;
protected var defaultGroupName:String;// = "RadioButtonGroup"
protected var _group:RadioButtonGroup;
private static var defaultStyles:Object = {icon:null, upIcon:"RadioButton_upIcon", downIcon:"RadioButton_downIcon", overIcon:"RadioButton_overIcon", disabledIcon:"RadioButton_disabledIcon", selectedDisabledIcon:"RadioButton_selectedDisabledIcon", selectedUpIcon:"RadioButton_selectedUpIcon", selectedDownIcon:"RadioButton_selectedDownIcon", selectedOverIcon:"RadioButton_selectedOverIcon", focusRectSkin:null, focusRectPadding:null, textFormat:null, disabledTextFormat:null, embedFonts:null, textPadding:5};
public static var createAccessibilityImplementation:Function;
public function RadioButton(){
defaultGroupName = "RadioButtonGroup";
super();
mode = "border";
groupName = defaultGroupName;
}
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 * 2));
uiFocusRect.height = (background.height + (_local2 * 2));
};
}
private function setThis():void{
var _local1:RadioButtonGroup;
_local1 = _group;
if (_local1 != null){
if (_local1.selection != this){
_local1.selection = this;
};
} else {
super.selected = true;
};
}
override public function get autoRepeat():Boolean{
return (false);
}
override public function set autoRepeat(_arg1:Boolean):void{
}
protected function handleClick(_arg1:MouseEvent):void{
if (_group == null){
return;
};
_group.dispatchEvent(new MouseEvent(MouseEvent.CLICK, true));
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case Keyboard.DOWN:
setNext(!(_arg1.ctrlKey));
_arg1.stopPropagation();
break;
case Keyboard.UP:
setPrev(!(_arg1.ctrlKey));
_arg1.stopPropagation();
break;
case Keyboard.LEFT:
setPrev(!(_arg1.ctrlKey));
_arg1.stopPropagation();
break;
case Keyboard.RIGHT:
setNext(!(_arg1.ctrlKey));
_arg1.stopPropagation();
break;
case Keyboard.SPACE:
setThis();
_toggle = false;
default:
super.keyDownHandler(_arg1);
break;
};
}
private function setNext(_arg1:Boolean=true):void{
var _local2:RadioButtonGroup;
var _local3:IFocusManager;
var _local4:int;
var _local5:Number;
var _local6:int;
var _local7:*;
_local2 = _group;
if (_local2 == null){
return;
};
_local3 = focusManager;
if (_local3){
_local3.showFocusIndicator = true;
};
_local4 = _local2.getRadioButtonIndex(this);
_local5 = _local2.numRadioButtons;
_local6 = _local4;
if (_local4 != -1){
do {
_local6++;
_local6 = ((_local6)>(_local2.numRadioButtons - 1)) ? 0 : _local6;
_local7 = _local2.getRadioButtonAt(_local6);
if (((_local7) && (_local7.enabled))){
if (_arg1){
_local2.selection = _local7;
};
_local7.setFocus();
return;
};
if (((_arg1) && (!((_local2.getRadioButtonAt(_local6) == _local2.selection))))){
_local2.selection = this;
};
this.drawFocus(true);
} while (_local6 != _local4);
};
}
public function get group():RadioButtonGroup{
return (_group);
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
super.keyUpHandler(_arg1);
if ((((_arg1.keyCode == Keyboard.SPACE)) && (!(_toggle)))){
_toggle = true;
};
}
override public function get selected():Boolean{
return (super.selected);
}
override public function set toggle(_arg1:Boolean):void{
throw (new Error("Warning: You cannot change a RadioButtons toggle."));
}
public function set value(_arg1:Object):void{
_value = _arg1;
}
public function set group(_arg1:RadioButtonGroup):void{
groupName = _arg1.name;
}
override public function set selected(_arg1:Boolean):void{
if ((((_arg1 == false)) || (selected))){
return;
};
if (_group != null){
_group.selection = this;
} else {
super.selected = _arg1;
};
}
override protected function draw():void{
super.draw();
}
override public function get toggle():Boolean{
return (true);
}
override protected function configUI():void{
var _local1:Shape;
var _local2:Graphics;
super.configUI();
super.toggle = true;
_local1 = new Shape();
_local2 = _local1.graphics;
_local2.beginFill(0, 0);
_local2.drawRect(0, 0, 100, 100);
_local2.endFill();
background = (_local1 as DisplayObject);
addChildAt(background, 0);
addEventListener(MouseEvent.CLICK, handleClick, false, 0, true);
}
public function set groupName(_arg1:String):void{
if (_group != null){
_group.removeRadioButton(this);
_group.removeEventListener(Event.CHANGE, handleChange);
};
_group = ((_arg1)==null) ? null : RadioButtonGroup.getGroup(_arg1);
if (_group != null){
_group.addRadioButton(this);
_group.addEventListener(Event.CHANGE, handleChange, false, 0, true);
};
}
public function get value():Object{
return (_value);
}
override protected function drawLayout():void{
var _local1:Number;
super.drawLayout();
_local1 = 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 protected function initializeAccessibility():void{
if (RadioButton.createAccessibilityImplementation != null){
RadioButton.createAccessibilityImplementation(this);
};
}
public function get groupName():String{
return (((_group)==null) ? null : _group.name);
}
private function setPrev(_arg1:Boolean=true):void{
var _local2:RadioButtonGroup;
var _local3:IFocusManager;
var _local4:int;
var _local5:int;
var _local6:*;
_local2 = _group;
if (_local2 == null){
return;
};
_local3 = focusManager;
if (_local3){
_local3.showFocusIndicator = true;
};
_local4 = _local2.getRadioButtonIndex(this);
_local5 = _local4;
if (_local4 != -1){
do {
--_local5;
_local5 = ((_local5)==-1) ? (_local2.numRadioButtons - 1) : _local5;
_local6 = _local2.getRadioButtonAt(_local5);
if (((_local6) && (_local6.enabled))){
if (_arg1){
_local2.selection = _local6;
};
_local6.setFocus();
return;
};
if (((_arg1) && (!((_local2.getRadioButtonAt(_local5) == _local2.selection))))){
_local2.selection = this;
};
this.drawFocus(true);
} while (_local5 != _local4);
};
}
protected function handleChange(_arg1:Event):void{
super.selected = (_group.selection == this);
dispatchEvent(new Event(Event.CHANGE, true));
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 134
//RadioButtonGroup (fl.controls.RadioButtonGroup)
package fl.controls {
import flash.events.*;
public class RadioButtonGroup extends EventDispatcher {
protected var _selection:RadioButton;
protected var radioButtons:Array;
protected var _name:String;
private static var groups:Object;
private static var groupCount:uint = 0;
public function RadioButtonGroup(_arg1:String){
_name = _arg1;
radioButtons = [];
registerGroup(this);
}
public function getRadioButtonIndex(_arg1:RadioButton):int{
var _local2:int;
var _local3:RadioButton;
_local2 = 0;
while (_local2 < radioButtons.length) {
_local3 = (radioButtons[_local2] as RadioButton);
if (_local3 == _arg1){
return (_local2);
};
_local2++;
};
return (-1);
}
public function get numRadioButtons():int{
return (radioButtons.length);
}
public function get name():String{
return (_name);
}
public function get selection():RadioButton{
return (_selection);
}
public function set selection(_arg1:RadioButton):void{
if ((((((_selection == _arg1)) || ((_arg1 == null)))) || ((getRadioButtonIndex(_arg1) == -1)))){
return;
};
_selection = _arg1;
dispatchEvent(new Event(Event.CHANGE, true));
}
public function set selectedData(_arg1:Object):void{
var _local2:int;
var _local3:RadioButton;
_local2 = 0;
while (_local2 < radioButtons.length) {
_local3 = (radioButtons[_local2] as RadioButton);
if (_local3.value == _arg1){
selection = _local3;
return;
};
_local2++;
};
}
public function removeRadioButton(_arg1:RadioButton):void{
var _local2:int;
_local2 = getRadioButtonIndex(_arg1);
if (_local2 != -1){
radioButtons.splice(_local2, 1);
};
if (_selection == _arg1){
_selection = null;
};
}
public function addRadioButton(_arg1:RadioButton):void{
if (_arg1.groupName != name){
_arg1.groupName = name;
return;
};
radioButtons.push(_arg1);
if (_arg1.selected){
selection = _arg1;
};
}
public function getRadioButtonAt(_arg1:int):RadioButton{
return (RadioButton(radioButtons[_arg1]));
}
public function get selectedData():Object{
var _local1:RadioButton;
_local1 = _selection;
return (((_local1)==null) ? null : _local1.value);
}
public static function getGroup(_arg1:String):RadioButtonGroup{
var _local2:RadioButtonGroup;
if (groups == null){
groups = {};
};
_local2 = (groups[_arg1] as RadioButtonGroup);
if (_local2 == null){
_local2 = new RadioButtonGroup(_arg1);
if ((++groupCount % 20) == 0){
cleanUpGroups();
};
};
return (_local2);
}
private static function registerGroup(_arg1:RadioButtonGroup):void{
if (groups == null){
groups = {};
};
groups[_arg1.name] = _arg1;
}
private static function cleanUpGroups():void{
var _local1:String;
var _local2:RadioButtonGroup;
for (_local1 in groups) {
_local2 = (groups[_local1] as RadioButtonGroup);
if (_local2.radioButtons.length == 0){
delete groups[_local1];
};
};
}
}
}//package fl.controls
Section 135
//ScrollBar (fl.controls.ScrollBar)
package fl.controls {
import fl.core.*;
import flash.events.*;
import fl.events.*;
public class ScrollBar extends UIComponent {
private var _direction:String;// = "vertical"
protected var inDrag:Boolean;// = false
protected var upArrow:BaseButton;
private var _pageScrollSize:Number;// = 0
protected var downArrow:BaseButton;
private var _pageSize:Number;// = 10
private var thumbScrollOffset:Number;
private var _maxScrollPosition:Number;// = 0
private var _scrollPosition:Number;// = 0
protected var track:BaseButton;
private var _minScrollPosition:Number;// = 0
private var _lineScrollSize:Number;// = 1
protected var thumb:LabelButton;
protected static const THUMB_STYLES:Object = {disabledSkin:"thumbDisabledSkin", downSkin:"thumbDownSkin", overSkin:"thumbOverSkin", upSkin:"thumbUpSkin", icon:"thumbIcon", textPadding:0};
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 UP_ARROW_STYLES:Object = {disabledSkin:"upArrowDisabledSkin", downSkin:"upArrowDownSkin", overSkin:"upArrowOverSkin", upSkin:"upArrowUpSkin", repeatDelay:"repeatDelay", repeatInterval:"repeatInterval"};
protected static const TRACK_STYLES:Object = {disabledSkin:"trackDisabledSkin", downSkin:"trackDownSkin", overSkin:"trackOverSkin", upSkin:"trackUpSkin", 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(){
_pageSize = 10;
_pageScrollSize = 0;
_lineScrollSize = 1;
_minScrollPosition = 0;
_maxScrollPosition = 0;
_scrollPosition = 0;
_direction = ScrollBarDirection.VERTICAL;
inDrag = false;
super();
setStyles();
focusEnabled = false;
}
public function get minScrollPosition():Number{
return (_minScrollPosition);
}
public function set minScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _arg1, _maxScrollPosition);
}
public function setScrollPosition(_arg1:Number, _arg2:Boolean=true):void{
var _local3:Number;
_local3 = scrollPosition;
_scrollPosition = Math.max(_minScrollPosition, Math.min(_maxScrollPosition, _arg1));
if (_local3 == _scrollPosition){
return;
};
if (_arg2){
dispatchEvent(new ScrollEvent(_direction, (scrollPosition - _local3), scrollPosition));
};
updateThumb();
}
public function set scrollPosition(_arg1:Number):void{
setScrollPosition(_arg1, true);
}
public function get pageScrollSize():Number{
return (((_pageScrollSize)==0) ? _pageSize : _pageScrollSize);
}
public function set pageSize(_arg1:Number):void{
if (_arg1 > 0){
_pageSize = _arg1;
};
}
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();
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
downArrow.enabled = (track.enabled = (thumb.enabled = (upArrow.enabled = ((enabled) && ((_maxScrollPosition > _minScrollPosition))))));
updateThumb();
}
protected function updateThumb():void{
var _local1:Number;
_local1 = ((_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;
};
}
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 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 set pageScrollSize(_arg1:Number):void{
if (_arg1 >= 0){
_pageScrollSize = _arg1;
};
}
protected function handleThumbDrag(_arg1:MouseEvent):void{
var _local2:Number;
_local2 = Math.max(0, Math.min((track.height - thumb.height), ((mouseY - track.y) - thumbScrollOffset)));
setScrollPosition((((_local2 / (track.height - thumb.height)) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition));
}
public function set direction(_arg1:String):void{
var _local2:Boolean;
if (_direction == _arg1){
return;
};
_direction = _arg1;
if (isLivePreview){
return;
};
setScaleY(1);
_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);
}
public function set lineScrollSize(_arg1:Number):void{
if (_arg1 > 0){
_lineScrollSize = _arg1;
};
}
override public function get height():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.width : super.height);
}
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)));
};
};
};
};
}
public function get pageSize():Number{
return (_pageSize);
}
public function set maxScrollPosition(_arg1:Number):void{
setScrollProperties(_pageSize, _minScrollPosition, _arg1);
}
public function get scrollPosition():Number{
return (_scrollPosition);
}
override public function get enabled():Boolean{
return (super.enabled);
}
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();
}
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;
}
public function get direction():String{
return (_direction);
}
public function get lineScrollSize():Number{
return (_lineScrollSize);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if (_direction == ScrollBarDirection.HORIZONTAL){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
}
public function get maxScrollPosition():Number{
return (_maxScrollPosition);
}
override public function get width():Number{
return (((_direction)==ScrollBarDirection.HORIZONTAL) ? super.height : super.width);
}
protected function setStyles():void{
copyStylesToChild(downArrow, DOWN_ARROW_STYLES);
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
copyStylesToChild(upArrow, UP_ARROW_STYLES);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 136
//ScrollBarDirection (fl.controls.ScrollBarDirection)
package fl.controls {
public class ScrollBarDirection {
public static const HORIZONTAL:String = "horizontal";
public static const VERTICAL:String = "vertical";
}
}//package fl.controls
Section 137
//ScrollPolicy (fl.controls.ScrollPolicy)
package fl.controls {
public class ScrollPolicy {
public static const OFF:String = "off";
public static const ON:String = "on";
public static const AUTO:String = "auto";
}
}//package fl.controls
Section 138
//SelectableList (fl.controls.SelectableList)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import fl.data.*;
import fl.managers.*;
import fl.events.*;
import fl.containers.*;
import flash.ui.*;
public class SelectableList extends BaseScrollPane implements IFocusManagerComponent {
protected var invalidItems:Dictionary;
protected var renderedItems:Dictionary;
protected var listHolder:Sprite;
protected var _allowMultipleSelection:Boolean;// = false
protected var lastCaretIndex:int;// = -1
protected var _selectedIndices:Array;
protected var availableCellRenderers:Array;
protected var list:Sprite;
protected var caretIndex:int;// = -1
protected var updatedRendererStyles:Object;
protected var preChangeItems:Array;
protected var activeCellRenderers:Array;
protected var rendererStyles:Object;
protected var _verticalScrollPosition:Number;
protected var _dataProvider:DataProvider;
protected var _horizontalScrollPosition:Number;
private var collectionItemImport:SimpleCollectionItem;
protected var _selectable:Boolean;// = true
private static var defaultStyles:Object = {skin:"List_skin", cellRenderer:CellRenderer, contentPadding:null, disabledAlpha:null};
public static var createAccessibilityImplementation:Function;
public function SelectableList(){
_allowMultipleSelection = false;
_selectable = true;
caretIndex = -1;
lastCaretIndex = -1;
super();
activeCellRenderers = [];
availableCellRenderers = [];
invalidItems = new Dictionary(true);
renderedItems = new Dictionary(true);
_selectedIndices = [];
if (dataProvider == null){
dataProvider = new DataProvider();
};
verticalScrollPolicy = ScrollPolicy.AUTO;
rendererStyles = {};
updatedRendererStyles = {};
}
protected function drawList():void{
}
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 sortItemsOn(_arg1:String, _arg2:Object=null){
return (_dataProvider.sortOn(_arg1, _arg2));
}
public function removeItemAt(_arg1:uint):Object{
return (_dataProvider.removeItemAt(_arg1));
}
public function get selectedItem():Object{
return (((_selectedIndices.length)==0) ? null : _dataProvider.getItemAt(selectedIndex));
}
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;
};
}
public function get selectable():Boolean{
return (_selectable);
}
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 getNextIndexAtLetter(_arg1:String, _arg2:int=-1):int{
var _local3:int;
var _local4:Number;
var _local5:Number;
var _local6:Object;
var _local7:String;
if (length == 0){
return (-1);
};
_arg1 = _arg1.toUpperCase();
_local3 = (length - 1);
_local4 = 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 invalidateList():void{
_invalidateList();
invalidate(InvalidationType.DATA);
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
list.mouseChildren = _enabled;
}
public function get selectedIndices():Array{
return (_selectedIndices.concat());
}
public function set selectable(_arg1:Boolean):void{
if (_arg1 == _selectable){
return;
};
if (!_arg1){
selectedIndices = [];
};
_selectable = _arg1;
}
public function itemToLabel(_arg1:Object):String{
return (_arg1["label"]);
}
public function addItemAt(_arg1:Object, _arg2:uint):void{
_dataProvider.addItemAt(_arg1, _arg2);
invalidateList();
}
public function replaceItemAt(_arg1:Object, _arg2:uint):Object{
return (_dataProvider.replaceItemAt(_arg1, _arg2));
}
protected function handleDataChange(_arg1:DataChangeEvent):void{
var _local2:int;
var _local3:int;
var _local4:String;
var _local5:uint;
_local2 = _arg1.startIndex;
_local3 = _arg1.endIndex;
_local4 = _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 _invalidateList():void{
availableCellRenderers = [];
while (activeCellRenderers.length > 0) {
list.removeChild((activeCellRenderers.pop() as DisplayObject));
};
}
protected function updateRendererStyles():void{
var _local1:Array;
var _local2:uint;
var _local3:uint;
var _local4:String;
_local1 = availableCellRenderers.concat(activeCellRenderers);
_local2 = _local1.length;
_local3 = 0;
while (_local3 < _local2) {
if (_local1[_local3].setStyle == null){
} else {
for (_local4 in updatedRendererStyles) {
_local1[_local3].setStyle(_local4, updatedRendererStyles[_local4]);
};
_local1[_local3].drawNow();
};
_local3++;
};
updatedRendererStyles = {};
}
public function set selectedItem(_arg1:Object):void{
var _local2:int;
_local2 = _dataProvider.getItemIndex(_arg1);
selectedIndex = _local2;
}
public function sortItems(... _args){
return (_dataProvider.sort.apply(_dataProvider, _args));
}
public function removeAll():void{
_dataProvider.removeAll();
}
protected function handleCellRendererChange(_arg1:Event):void{
var _local2:ICellRenderer;
var _local3:uint;
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
_dataProvider.invalidateItemAt(_local3);
}
protected function moveSelectionVertically(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:Number;
if (_arg1 == _horizontalScrollPosition){
return;
};
_local3 = (_arg1 - _horizontalScrollPosition);
_horizontalScrollPosition = _arg1;
if (_arg2){
dispatchEvent(new ScrollEvent(ScrollBarDirection.HORIZONTAL, _local3, _arg1));
};
}
public function scrollToSelected():void{
scrollToIndex(selectedIndex);
}
public function invalidateItem(_arg1:Object):void{
if (renderedItems[_arg1] == null){
return;
};
invalidItems[_arg1] = true;
invalidate(InvalidationType.DATA);
}
protected function handleCellRendererClick(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:uint;
var _local4:int;
var _local5:int;
var _local6:uint;
if (!_enabled){
return;
};
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
if (((!(dispatchEvent(new ListEvent(ListEvent.ITEM_CLICK, false, true, _local2.listData.column, _local2.listData.row, _local3, _local2.data)))) || (!(_selectable)))){
return;
};
_local4 = 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);
}
public function get length():uint{
return (_dataProvider.length);
}
public function get allowMultipleSelection():Boolean{
return (_allowMultipleSelection);
}
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 function getRendererStyle(_arg1:String, _arg2:int=-1):Object{
return (rendererStyles[_arg1]);
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
var _local3:Number;
if (_arg1 == _verticalScrollPosition){
return;
};
_local3 = (_arg1 - _verticalScrollPosition);
_verticalScrollPosition = _arg1;
if (_arg2){
dispatchEvent(new ScrollEvent(ScrollBarDirection.VERTICAL, _local3, _arg1));
};
}
protected function moveSelectionHorizontally(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
}
public function set selectedIndices(_arg1:Array):void{
if (!_selectable){
return;
};
_selectedIndices = ((_arg1)==null) ? [] : _arg1.concat();
invalidate(InvalidationType.SELECTED);
}
public function get selectedIndex():int{
return (((_selectedIndices.length)==0) ? -1 : _selectedIndices[(_selectedIndices.length - 1)]);
}
override protected function draw():void{
super.draw();
}
override protected function configUI():void{
super.configUI();
listHolder = new Sprite();
addChild(listHolder);
listHolder.scrollRect = contentScrollRect;
list = new Sprite();
listHolder.addChild(list);
}
public function addItem(_arg1:Object):void{
_dataProvider.addItem(_arg1);
invalidateList();
}
protected function handleCellRendererMouseEvent(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:String;
_local2 = (_arg1.target as ICellRenderer);
_local3 = ((_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));
}
public function clearRendererStyle(_arg1:String, _arg2:int=-1):void{
delete rendererStyles[_arg1];
updatedRendererStyles[_arg1] = null;
invalidate(InvalidationType.RENDERER_STYLES);
}
protected function handleCellRendererDoubleClick(_arg1:MouseEvent):void{
var _local2:ICellRenderer;
var _local3:uint;
if (!_enabled){
return;
};
_local2 = (_arg1.currentTarget as ICellRenderer);
_local3 = _local2.listData.index;
dispatchEvent(new ListEvent(ListEvent.ITEM_DOUBLE_CLICK, false, true, _local2.listData.column, _local2.listData.row, _local3, _local2.data));
}
public function get rowCount():uint{
return (0);
}
public function isItemSelected(_arg1:Object):Boolean{
return ((selectedItems.indexOf(_arg1) > -1));
}
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 protected function drawLayout():void{
super.drawLayout();
contentScrollRect = listHolder.scrollRect;
contentScrollRect.width = availableWidth;
contentScrollRect.height = availableHeight;
listHolder.scrollRect = contentScrollRect;
}
public function getItemAt(_arg1:uint):Object{
return (_dataProvider.getItemAt(_arg1));
}
override protected function initializeAccessibility():void{
if (SelectableList.createAccessibilityImplementation != null){
SelectableList.createAccessibilityImplementation(this);
};
}
public function scrollToIndex(_arg1:int):void{
}
public function removeItem(_arg1:Object):Object{
return (_dataProvider.removeItem(_arg1));
}
public function get dataProvider():DataProvider{
return (_dataProvider);
}
public function set maxHorizontalScrollPosition(_arg1:Number):void{
_maxHorizontalScrollPosition = _arg1;
invalidate(InvalidationType.SIZE);
}
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 invalidateItemAt(_arg1:uint):void{
var _local2:Object;
_local2 = _dataProvider.getItemAt(_arg1);
if (_local2 != null){
invalidateItem(_local2);
};
}
public function set selectedItems(_arg1:Array):void{
var _local2:Array;
var _local3:uint;
var _local4:int;
if (_arg1 == null){
selectedIndices = null;
return;
};
_local2 = [];
_local3 = 0;
while (_local3 < _arg1.length) {
_local4 = _dataProvider.getItemIndex(_arg1[_local3]);
if (_local4 != -1){
_local2.push(_local4);
};
_local3++;
};
selectedIndices = _local2;
}
public function clearSelection():void{
selectedIndex = -1;
}
override public function get maxHorizontalScrollPosition():Number{
return (_maxHorizontalScrollPosition);
}
public function get selectedItems():Array{
var _local1:Array;
var _local2:uint;
_local1 = [];
_local2 = 0;
while (_local2 < _selectedIndices.length) {
_local1.push(_dataProvider.getItemAt(_selectedIndices[_local2]));
_local2++;
};
return (_local1);
}
public function set selectedIndex(_arg1:int):void{
selectedIndices = ((_arg1)==-1) ? null : [_arg1];
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseScrollPane.getStyleDefinition()));
}
}
}//package fl.controls
Section 139
//TextArea (fl.controls.TextArea)
package fl.controls {
import fl.core.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
import fl.managers.*;
import fl.events.*;
import flash.system.*;
import flash.ui.*;
public class TextArea extends UIComponent implements IFocusManagerComponent {
protected var _html:Boolean;// = false
protected var _verticalScrollBar:UIScrollBar;
protected var _savedHTML:String;
protected var background:DisplayObject;
protected var _horizontalScrollBar:UIScrollBar;
protected var _horizontalScrollPolicy:String;// = "auto"
protected var _editable:Boolean;// = true
protected var textHasChanged:Boolean;// = false
public var textField:TextField;
protected var _wordWrap:Boolean;// = true
protected var _verticalScrollPolicy:String;// = "auto"
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 TextArea(){
_editable = true;
_wordWrap = true;
_horizontalScrollPolicy = ScrollPolicy.AUTO;
_verticalScrollPolicy = ScrollPolicy.AUTO;
_html = false;
textHasChanged = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
if (focusTarget != null){
focusTarget.drawFocus(_arg1);
return;
};
super.drawFocus(_arg1);
}
public function set imeMode(_arg1:String):void{
_imeMode = _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));
}
public function get verticalScrollPosition():Number{
return (textField.scrollV);
}
override protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((((_arg1 == textField)) || (super.isOurFocus(_arg1))));
}
public function set verticalScrollPosition(_arg1:Number):void{
drawNow();
textField.scrollV = _arg1;
}
protected function handleKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ENTER){
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER, true));
};
}
public function set text(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
return;
};
textField.text = _arg1;
_html = false;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
textHasChanged = true;
}
protected function updateTextFieldType():void{
textField.type = (((enabled) && (_editable))) ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
textField.selectable = enabled;
textField.wordWrap = _wordWrap;
textField.multiline = true;
}
public function get selectionEndIndex():int{
return (textField.selectionEndIndex);
}
public function get editable():Boolean{
return (_editable);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
setIMEMode(true);
if (_arg1.target == this){
stage.focus = textField;
};
_local2 = focusManager;
if (_local2){
if (editable){
_local2.showFocusIndicator = true;
};
_local2.defaultButtonEnabled = false;
};
super.focusInHandler(_arg1);
if (editable){
setIMEMode(true);
};
}
public function get wordWrap():Boolean{
return (_wordWrap);
}
public function get selectionBeginIndex():int{
return (textField.selectionBeginIndex);
}
public function get horizontalScrollBar():UIScrollBar{
return (_horizontalScrollBar);
}
public function set alwaysShowSelection(_arg1:Boolean):void{
textField.alwaysShowSelection = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseChildren = enabled;
invalidate(InvalidationType.STATE);
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
public function get horizontalScrollPosition():Number{
return (textField.scrollH);
}
public function set condenseWhite(_arg1:Boolean):void{
textField.condenseWhite = _arg1;
invalidate(InvalidationType.DATA);
}
public function get horizontalScrollPolicy():String{
return (_horizontalScrollPolicy);
}
public function set displayAsPassword(_arg1:Boolean):void{
textField.displayAsPassword = _arg1;
}
public function get maxVerticalScrollPosition():int{
return (textField.maxScrollV);
}
public function set horizontalScrollPosition(_arg1:Number):void{
drawNow();
textField.scrollH = _arg1;
}
public function get textHeight():Number{
drawNow();
return (textField.textHeight);
}
public function get textWidth():Number{
drawNow();
return (textField.textWidth);
}
public function get restrict():String{
return (textField.restrict);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
invalidate(InvalidationType.STATE);
}
protected function updateScrollBars(){
_horizontalScrollBar.update();
_verticalScrollBar.update();
_verticalScrollBar.enabled = enabled;
_horizontalScrollBar.enabled = enabled;
_horizontalScrollBar.drawNow();
_verticalScrollBar.drawNow();
}
public function get maxChars():int{
return (textField.maxChars);
}
public function get length():Number{
return (textField.text.length);
}
public function set wordWrap(_arg1:Boolean):void{
_wordWrap = _arg1;
invalidate(InvalidationType.STATE);
}
public function get verticalScrollPolicy():String{
return (_verticalScrollPolicy);
}
public function getLineMetrics(_arg1:int):TextLineMetrics{
return (textField.getLineMetrics(_arg1));
}
public function get imeMode():String{
return (IME.conversionMode);
}
protected function handleScroll(_arg1:ScrollEvent):void{
dispatchEvent(_arg1);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
_local2 = focusManager;
if (_local2){
_local2.defaultButtonEnabled = true;
};
setSelection(0, 0);
super.focusOutHandler(_arg1);
if (editable){
setIMEMode(false);
};
}
protected function delayedLayoutUpdate(_arg1:Event):void{
if (textHasChanged){
textHasChanged = false;
drawLayout();
return;
};
removeEventListener(Event.ENTER_FRAME, delayedLayoutUpdate);
}
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 text():String{
return (textField.text);
}
public function get verticalScrollBar():UIScrollBar{
return (_verticalScrollBar);
}
override public function get enabled():Boolean{
return (super.enabled);
}
public function get condenseWhite():Boolean{
return (textField.condenseWhite);
}
public function set horizontalScrollPolicy(_arg1:String):void{
_horizontalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get displayAsPassword():Boolean{
return (textField.displayAsPassword);
}
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 handleTextInput(_arg1:TextEvent):void{
_arg1.stopPropagation();
dispatchEvent(new TextEvent(TextEvent.TEXT_INPUT, true, false, _arg1.text));
}
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 setTextSize(_arg1:Number, _arg2:Number, _arg3:Number):void{
var _local4:Number;
var _local5:Number;
_local4 = (_arg1 - (_arg3 * 2));
_local5 = (_arg2 - (_arg3 * 2));
if (_local4 != textField.width){
textField.width = _local4;
};
if (_local5 != textField.height){
textField.height = _local5;
};
}
public function appendText(_arg1:String):void{
textField.appendText(_arg1);
invalidate(InvalidationType.DATA);
}
protected function needVScroll():Boolean{
if (_verticalScrollPolicy == ScrollPolicy.OFF){
return (false);
};
if (_verticalScrollPolicy == ScrollPolicy.ON){
return (true);
};
return ((textField.maxScrollV > 1));
}
public function setSelection(_arg1:int, _arg2:int):void{
textField.setSelection(_arg1, _arg2);
}
public function get alwaysShowSelection():Boolean{
return (textField.alwaysShowSelection);
}
public function get htmlText():String{
return (textField.htmlText);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
textField.restrict = _arg1;
}
protected function drawBackground():void{
var _local1:DisplayObject;
var _local2:String;
_local1 = background;
_local2 = (enabled) ? "upSkin" : "disabledSkin";
background = getDisplayObjectInstance(getStyleValue(_local2));
if (background != null){
addChildAt(background, 0);
};
if (((((!((_local1 == null))) && (!((_local1 == background))))) && (contains(_local1)))){
removeChild(_local1);
};
}
public function set maxChars(_arg1:int):void{
textField.maxChars = _arg1;
}
public function get maxHorizontalScrollPosition():int{
return (textField.maxScrollH);
}
protected function drawLayout():void{
var _local1:Number;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
var _local5:Boolean;
_local1 = Number(getStyleValue("textPadding"));
textField.x = (textField.y = _local1);
background.width = width;
background.height = height;
_local2 = height;
_local3 = needVScroll();
_local4 = (width - (_local3) ? _verticalScrollBar.width : 0);
_local5 = 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 setStyles():void{
copyStylesToChild(_verticalScrollBar, SCROLL_BAR_STYLES);
copyStylesToChild(_horizontalScrollBar, SCROLL_BAR_STYLES);
}
protected function needHScroll():Boolean{
if (_horizontalScrollPolicy == ScrollPolicy.OFF){
return (false);
};
if (_horizontalScrollPolicy == ScrollPolicy.ON){
return (true);
};
return ((textField.maxScrollH > 0));
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
if (_html){
textField.htmlText = _savedHTML;
};
}
public function set verticalScrollPolicy(_arg1:String):void{
_verticalScrollPolicy = _arg1;
invalidate(InvalidationType.SIZE);
}
protected function handleChange(_arg1:Event):void{
_arg1.stopPropagation();
dispatchEvent(new Event(Event.CHANGE, true));
invalidate(InvalidationType.DATA);
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(defaultStyles, ScrollBar.getStyleDefinition()));
}
}
}//package fl.controls
Section 140
//TextInput (fl.controls.TextInput)
package fl.controls {
import fl.core.*;
import flash.events.*;
import flash.display.*;
import flash.text.*;
import fl.managers.*;
import fl.events.*;
import flash.ui.*;
public class TextInput extends UIComponent implements IFocusManagerComponent {
protected var _html:Boolean;// = false
protected var _savedHTML:String;
protected var background:DisplayObject;
protected var _editable:Boolean;// = true
public var textField:TextField;
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 TextInput(){
_editable = true;
_html = false;
super();
}
override public function drawFocus(_arg1:Boolean):void{
if (focusTarget != null){
focusTarget.drawFocus(_arg1);
return;
};
super.drawFocus(_arg1);
}
public function set imeMode(_arg1:String):void{
_imeMode = _arg1;
}
override protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((((_arg1 == textField)) || (super.isOurFocus(_arg1))));
}
protected function handleKeyDown(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.ENTER){
dispatchEvent(new ComponentEvent(ComponentEvent.ENTER, true));
};
}
public function set text(_arg1:String):void{
textField.text = _arg1;
_html = false;
invalidate(InvalidationType.DATA);
invalidate(InvalidationType.STYLES);
}
protected function updateTextFieldType():void{
textField.type = (((enabled) && (editable))) ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
textField.selectable = enabled;
}
public function get selectionEndIndex():int{
return (textField.selectionEndIndex);
}
public function get editable():Boolean{
return (_editable);
}
override protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (_arg1.target == this){
stage.focus = textField;
};
_local2 = 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);
};
}
public function get selectionBeginIndex():int{
return (textField.selectionBeginIndex);
}
public function set alwaysShowSelection(_arg1:Boolean):void{
textField.alwaysShowSelection = _arg1;
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
updateTextFieldType();
}
protected function setEmbedFont(){
var _local1:Object;
_local1 = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
public function get horizontalScrollPosition():int{
return (textField.scrollH);
}
public function set condenseWhite(_arg1:Boolean):void{
textField.condenseWhite = _arg1;
}
public function set displayAsPassword(_arg1:Boolean):void{
textField.displayAsPassword = _arg1;
}
public function set horizontalScrollPosition(_arg1:int):void{
textField.scrollH = _arg1;
}
public function get restrict():String{
return (textField.restrict);
}
public function get textWidth():Number{
return (textField.textWidth);
}
public function get textHeight():Number{
return (textField.textHeight);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
updateTextFieldType();
}
public function get maxChars():int{
return (textField.maxChars);
}
public function get length():int{
return (textField.length);
}
public function getLineMetrics(_arg1:int):TextLineMetrics{
return (textField.getLineMetrics(_arg1));
}
public function get imeMode():String{
return (_imeMode);
}
override protected function focusOutHandler(_arg1:FocusEvent):void{
super.focusOutHandler(_arg1);
if (editable){
setIMEMode(false);
};
}
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 text():String{
return (textField.text);
}
override public function get enabled():Boolean{
return (super.enabled);
}
public function get condenseWhite():Boolean{
return (textField.condenseWhite);
}
public function get alwaysShowSelection():Boolean{
return (textField.alwaysShowSelection);
}
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 handleTextInput(_arg1:TextEvent):void{
_arg1.stopPropagation();
dispatchEvent(new TextEvent(TextEvent.TEXT_INPUT, true, false, _arg1.text));
}
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);
}
public function setSelection(_arg1:int, _arg2:int):void{
textField.setSelection(_arg1, _arg2);
}
public function get displayAsPassword():Boolean{
return (textField.displayAsPassword);
}
public function appendText(_arg1:String):void{
textField.appendText(_arg1);
}
public function set restrict(_arg1:String):void{
if (((componentInspectorSetting) && ((_arg1 == "")))){
_arg1 = null;
};
textField.restrict = _arg1;
}
public function get htmlText():String{
return (textField.htmlText);
}
protected function drawBackground():void{
var _local1:DisplayObject;
var _local2:String;
_local1 = background;
_local2 = (enabled) ? "upSkin" : "disabledSkin";
background = getDisplayObjectInstance(getStyleValue(_local2));
if (background == null){
return;
};
addChildAt(background, 0);
if (((((!((_local1 == null))) && (!((_local1 == background))))) && (contains(_local1)))){
removeChild(_local1);
};
}
override public function setFocus():void{
stage.focus = textField;
}
protected function drawLayout():void{
var _local1:Number;
_local1 = 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);
}
public function set maxChars(_arg1:int):void{
textField.maxChars = _arg1;
}
public function get maxHorizontalScrollPosition():int{
return (textField.maxScrollH);
}
protected function drawTextFormat():void{
var _local1:Object;
var _local2:TextFormat;
var _local3:TextFormat;
_local1 = UIComponent.getStyleDefinition();
_local2 = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
_local3 = (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 handleChange(_arg1:Event):void{
_arg1.stopPropagation();
dispatchEvent(new Event(Event.CHANGE, true));
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 141
//TileList (fl.controls.TileList)
package fl.controls {
import fl.controls.listClasses.*;
import fl.core.*;
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import fl.data.*;
import fl.managers.*;
import flash.ui.*;
public class TileList extends SelectableList implements IFocusManagerComponent {
protected var _labelField:String;// = "label"
protected var _scrollPolicy:String;// = "auto"
protected var _labelFunction:Function;
protected var _scrollDirection:String;// = "horizontal"
protected var _iconFunction:Function;
private var collectionItemImport:TileListCollectionItem;
protected var _rowHeight:Number;// = 50
protected var _cellRenderer:Object;
protected var _columnWidth:Number;// = 50
protected var _iconField:String;// = "icon"
protected var _sourceFunction:Function;
protected var __rowCount:uint;// = 0
protected var __columnCount:uint;// = 0
protected var _sourceField:String;// = "source"
protected var oldLength:uint;// = 0
private static var defaultStyles:Object = {cellRenderer:ImageCell, focusRectSkin:null, focusRectPadding:null, skin:"TileList_skin"};
public static var createAccessibilityImplementation:Function;
public function TileList(){
_rowHeight = 50;
_columnWidth = 50;
_scrollDirection = ScrollBarDirection.HORIZONTAL;
_scrollPolicy = ScrollPolicy.AUTO;
oldLength = 0;
_labelField = "label";
_iconField = "icon";
_sourceField = "source";
__rowCount = 0;
__columnCount = 0;
super();
}
public function get iconField():String{
return (_iconField);
}
override protected function drawList():void{
var _local1:uint;
var _local2:uint;
var _local3:Object;
var _local4:ICellRenderer;
var _local5:uint;
var _local6:uint;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:uint;
var _local12:uint;
var _local13:Array;
var _local14:Dictionary;
var _local15:Dictionary;
var _local16:uint;
var _local17:uint;
var _local18:uint;
var _local19:uint;
var _local20:Boolean;
var _local21:String;
var _local22:Object;
var _local23:Object;
var _local24:Sprite;
var _local25:String;
var _local26:UIComponent;
_local5 = rowCount;
_local6 = columnCount;
_local7 = columnWidth;
_local8 = rowHeight;
_local9 = 0;
_local10 = 0;
listHolder.x = (listHolder.y = contentPadding);
contentScrollRect = listHolder.scrollRect;
contentScrollRect.x = (Math.floor(_horizontalScrollPosition) % _local7);
contentScrollRect.y = (Math.floor(_verticalScrollPosition) % _local8);
listHolder.scrollRect = contentScrollRect;
listHolder.cacheAsBitmap = useBitmapScrolling;
_local13 = [];
if (_scrollDirection == ScrollBarDirection.HORIZONTAL){
_local16 = ((availableWidth / _local7) << 0);
_local17 = Math.max(_local16, Math.ceil((length / _local5)));
_local9 = ((_horizontalScrollPosition / _local7) << 0);
_local6 = Math.max(_local16, Math.min((_local17 - _local9), (_local6 + 1)));
_local12 = 0;
while (_local12 < _local5) {
_local11 = 0;
while (_local11 < _local6) {
_local2 = (((_local12 * _local17) + _local9) + _local11);
if (_local2 >= length){
break;
};
_local13.push(_local2);
_local11++;
};
_local12++;
};
} else {
_local5++;
_local10 = ((_verticalScrollPosition / _local8) << 0);
_local18 = Math.floor((_local10 * _local6));
_local19 = Math.min(length, (_local18 + (_local5 * _local6)));
_local1 = _local18;
while (_local1 < _local19) {
_local13.push(_local1);
_local1++;
};
};
_local14 = (renderedItems = new Dictionary(true));
for each (_local2 in _local13) {
_local14[_dataProvider.getItemAt(_local2)] = true;
};
_local15 = new Dictionary(true);
while (activeCellRenderers.length > 0) {
_local4 = activeCellRenderers.pop();
_local3 = _local4.data;
if ((((_local14[_local3] == null)) || ((invalidItems[_local3] == true)))){
availableCellRenderers.push(_local4);
} else {
_local15[_local3] = _local4;
invalidItems[_local3] = true;
};
list.removeChild((_local4 as DisplayObject));
};
invalidItems = new Dictionary(true);
_local1 = 0;
for each (_local2 in _local13) {
_local11 = (_local1 % _local6);
_local12 = ((_local1 / _local6) << 0);
_local20 = false;
_local3 = _dataProvider.getItemAt(_local2);
if (_local15[_local3] != null){
_local20 = true;
_local4 = _local15[_local3];
delete _local15[_local3];
} else {
if (availableCellRenderers.length > 0){
_local4 = (availableCellRenderers.pop() as ICellRenderer);
} else {
_local4 = (getDisplayObjectInstance(getStyleValue("cellRenderer")) as ICellRenderer);
_local24 = (_local4 as Sprite);
if (_local24 != null){
_local24.addEventListener(MouseEvent.CLICK, handleCellRendererClick, false, 0, true);
_local24.addEventListener(MouseEvent.ROLL_OVER, handleCellRendererMouseEvent, false, 0, true);
_local24.addEventListener(MouseEvent.ROLL_OUT, handleCellRendererMouseEvent, false, 0, true);
_local24.addEventListener(Event.CHANGE, handleCellRendererChange, false, 0, true);
_local24.doubleClickEnabled = true;
_local24.addEventListener(MouseEvent.DOUBLE_CLICK, handleCellRendererDoubleClick, false, 0, true);
if (_local24["setStyle"] != null){
for (_local25 in rendererStyles) {
var _local31 = _local24;
_local31["setStyle"](_local25, rendererStyles[_local25]);
};
};
};
};
};
list.addChild((_local4 as Sprite));
activeCellRenderers.push(_local4);
_local4.y = (_local8 * _local12);
_local4.x = (_local7 * _local11);
_local4.setSize(columnWidth, rowHeight);
_local21 = itemToLabel(_local3);
_local22 = null;
if (_iconFunction != null){
_local22 = _iconFunction(_local3);
} else {
if (_iconField != null){
_local22 = _local3[_iconField];
};
};
_local23 = null;
if (_sourceFunction != null){
_local23 = _sourceFunction(_local3);
} else {
if (_sourceField != null){
_local23 = _local3[_sourceField];
};
};
if (!_local20){
_local4.data = _local3;
};
_local4.listData = (new TileListData(_local21, _local22, _local23, this, _local2, (_local10 + _local12), (_local9 + _local11)) as ListData);
_local4.selected = !((_selectedIndices.indexOf(_local2) == -1));
if ((_local4 is UIComponent)){
_local26 = (_local4 as UIComponent);
_local26.drawNow();
};
_local1++;
};
}
public function get columnWidth():Number{
return (_columnWidth);
}
public function set iconField(_arg1:String):void{
if (_arg1 == _iconField){
return;
};
_iconField = _arg1;
invalidate(InvalidationType.DATA);
}
public function set columnWidth(_arg1:Number):void{
if (_columnWidth == _arg1){
return;
};
_columnWidth = _arg1;
invalidate(InvalidationType.SIZE);
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local2:int;
_arg1.stopPropagation();
if (!selectable){
return;
};
switch (_arg1.keyCode){
case Keyboard.UP:
case Keyboard.DOWN:
moveSelectionVertically(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
break;
case Keyboard.PAGE_UP:
case Keyboard.PAGE_DOWN:
case Keyboard.END:
case Keyboard.HOME:
if (_scrollDirection == ScrollBarDirection.HORIZONTAL){
moveSelectionHorizontally(_arg1.keyCode, ((_arg1.shiftKey) && (_allowMultipleSelection)), ((_arg1.ctrlKey) && (_allowMultipleSelection)));
} else {
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;
default:
_local2 = getNextIndexAtLetter(String.fromCharCode(_arg1.keyCode), selectedIndex);
if (_local2 > -1){
selectedIndex = _local2;
scrollToSelected();
};
break;
};
}
override public function get horizontalScrollPolicy():String{
return (null);
}
public function set scrollPolicy(_arg1:String):void{
if (((!(componentInspectorSetting)) && ((_scrollPolicy == _arg1)))){
return;
};
_scrollPolicy = _arg1;
if (direction == ScrollBarDirection.HORIZONTAL){
_horizontalScrollPolicy = _arg1;
_verticalScrollPolicy = ScrollPolicy.OFF;
} else {
_verticalScrollPolicy = _arg1;
_horizontalScrollPolicy = ScrollPolicy.OFF;
};
invalidate(InvalidationType.SIZE);
}
public function set labelField(_arg1:String):void{
if (_arg1 == _labelField){
return;
};
_labelField = _arg1;
invalidate(InvalidationType.DATA);
}
override public function get verticalScrollPolicy():String{
return (null);
}
public function get innerWidth():Number{
var _local1:Number;
drawNow();
_local1 = (getStyleValue("contentPadding") as Number);
return (((width - (_local1 * 2)) - (_verticalScrollBar.visible) ? _verticalScrollBar.width : 0));
}
protected function calculateAvailableHeight():Number{
var _local1:Number;
_local1 = Number(getStyleValue("contentPadding"));
return (((height - (_local1 * 2)) - ((((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_horizontalScrollPolicy == ScrollPolicy.AUTO)) && ((_maxHorizontalScrollPosition > 0)))))) ? 15 : 0));
}
public function get sourceFunction():Function{
return (_sourceFunction);
}
override protected function moveSelectionHorizontally(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
var _local4:uint;
var _local5:int;
var _local6:int;
var _local7:*;
_local4 = Math.ceil((Math.max((rowCount * columnCount), length) / rowCount));
switch (_arg1){
case Keyboard.LEFT:
_local5 = Math.max(0, (selectedIndex - 1));
break;
case Keyboard.RIGHT:
_local5 = Math.min((length - 1), (selectedIndex + 1));
break;
case Keyboard.HOME:
_local5 = 0;
break;
case Keyboard.END:
_local5 = (length - 1);
break;
case Keyboard.PAGE_UP:
_local6 = (selectedIndex - (selectedIndex % _local4));
_local5 = Math.max(0, Math.max(_local6, (selectedIndex - columnCount)));
break;
case Keyboard.PAGE_DOWN:
_local7 = (((selectedIndex - (selectedIndex % _local4)) + _local4) - 1);
_local5 = Math.min((length - 1), Math.min(_local7, (selectedIndex + _local4)));
break;
};
doKeySelection(_local5, _arg2, _arg3);
scrollToSelected();
}
override protected function draw():void{
var _local1:Boolean;
if (direction == ScrollBarDirection.VERTICAL){
if (__rowCount > 0){
rowCount = __rowCount;
};
if (__columnCount > 0){
columnCount = __columnCount;
};
} else {
if (__columnCount > 0){
columnCount = __columnCount;
};
if (__rowCount > 0){
rowCount = __rowCount;
};
};
_local1 = !((oldLength == length));
oldLength = 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();
_maxHorizontalScrollPosition = Math.max(0, (contentWidth - availableWidth));
};
updateChildren();
validate();
}
override public function set horizontalScrollPolicy(_arg1:String):void{
}
override protected function configUI():void{
super.configUI();
_horizontalScrollPolicy = scrollPolicy;
_verticalScrollPolicy = ScrollPolicy.OFF;
}
override protected function drawLayout():void{
var _local1:uint;
var _local2:uint;
_horizontalScrollPolicy = ((_scrollDirection)==ScrollBarDirection.HORIZONTAL) ? _scrollPolicy : ScrollPolicy.OFF;
_verticalScrollPolicy = ((_scrollDirection)!=ScrollBarDirection.HORIZONTAL) ? _scrollPolicy : ScrollPolicy.OFF;
if (_scrollDirection == ScrollBarDirection.HORIZONTAL){
_local1 = rowCount;
contentHeight = (_local1 * _rowHeight);
contentWidth = (_columnWidth * Math.ceil((length / _local1)));
} else {
_local2 = columnCount;
contentWidth = (_local2 * _columnWidth);
contentHeight = (_rowHeight * Math.ceil((length / _local2)));
};
super.drawLayout();
}
public function get sourceField():String{
return (_sourceField);
}
override public function get maxHorizontalScrollPosition():Number{
drawNow();
return (_maxHorizontalScrollPosition);
}
public function set labelFunction(_arg1:Function):void{
if (_labelFunction == _arg1){
return;
};
_labelFunction = _arg1;
invalidate(InvalidationType.DATA);
}
override public function set verticalScrollPolicy(_arg1:String):void{
}
protected function doKeySelection(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
var _local4:Array;
var _local5:Boolean;
var _local6:uint;
var _local7:int;
_local4 = selectedIndices;
_local5 = false;
if ((((_arg1 < 0)) || ((_arg1 > (length - 1))))){
} else {
if (((((_arg2) && ((_local4.length > 0)))) && (!((_arg1 == _local4[0]))))){
_local6 = _local4[0];
_local4 = [];
if (_arg1 < _local6){
_local7 = _local6;
while (_local7 >= _arg1) {
_local4.push(_local7);
_local7--;
};
} else {
_local7 = _local6;
while (_local7 <= _arg1) {
_local4.push(_local7);
_local7++;
};
};
_local5 = true;
} else {
_local4 = [_arg1];
caretIndex = _arg1;
_local5 = true;
};
};
selectedIndices = _local4;
if (_local5){
dispatchEvent(new Event(Event.CHANGE));
};
invalidate(InvalidationType.DATA);
}
public function set sourceFunction(_arg1:Function):void{
_sourceFunction = _arg1;
invalidate(InvalidationType.DATA);
}
public function get scrollPolicy():String{
return (_scrollPolicy);
}
public function get labelField():String{
return (_labelField);
}
override protected function moveSelectionVertically(_arg1:uint, _arg2:Boolean, _arg3:Boolean):void{
var _local4:uint;
var _local5:uint;
var _local6:uint;
var _local7:int;
var _local8:int;
_local4 = Math.max(1, ((Math.max(contentHeight, availableHeight) / _rowHeight) << 0));
_local5 = Math.ceil((Math.max((columnCount * rowCount), length) / _local4));
_local6 = Math.ceil((length / _local5));
switch (_arg1){
case Keyboard.UP:
_local7 = (selectedIndex - _local5);
break;
case Keyboard.DOWN:
_local7 = (selectedIndex + _local5);
break;
case Keyboard.HOME:
_local7 = 0;
break;
case Keyboard.END:
_local7 = (length - 1);
break;
case Keyboard.PAGE_DOWN:
_local8 = (selectedIndex + (_local5 * (_local6 - 1)));
if (_local8 >= length){
_local8 = (_local8 - _local5);
};
_local7 = Math.min((length - 1), _local8);
break;
case Keyboard.PAGE_UP:
_local8 = (selectedIndex - (_local5 * (_local6 - 1)));
if (_local8 < 0){
_local8 = (_local8 + _local5);
};
_local7 = Math.max(0, _local8);
break;
};
doKeySelection(_local7, _arg2, _arg3);
scrollToSelected();
}
override public function itemToLabel(_arg1:Object):String{
if (_labelFunction != null){
return (String(_labelFunction(_arg1)));
};
if (_arg1[_labelField] == null){
return ("");
};
return (String(_arg1[_labelField]));
}
public function set rowCount(_arg1:uint):void{
var _local2:Number;
var _local3:*;
if (_arg1 == 0){
return;
};
if (componentInspectorSetting){
__rowCount = _arg1;
return;
};
__rowCount = 0;
_local2 = Number(getStyleValue("contentPadding"));
_local3 = (((((Math.ceil((length / _arg1)) > ((width / columnWidth) >> 0))) && ((_scrollPolicy == ScrollPolicy.AUTO)))) || ((_scrollPolicy == ScrollPolicy.ON)));
height = (((rowHeight * _arg1) + (2 * _local2)) + ((((_scrollDirection == ScrollBarDirection.HORIZONTAL)) && (_local3))) ? ScrollBar.WIDTH : 0);
}
public function set columnCount(_arg1:uint):void{
var _local2:Number;
var _local3:Boolean;
if (_arg1 == 0){
return;
};
if (componentInspectorSetting){
__columnCount = _arg1;
return;
};
__columnCount = 0;
_local2 = Number(getStyleValue("contentPadding"));
_local3 = (((((Math.ceil((length / _arg1)) > ((height / rowHeight) >> 0))) && ((_scrollPolicy == ScrollPolicy.AUTO)))) || ((_scrollPolicy == ScrollPolicy.ON)));
width = (((columnWidth * _arg1) + (2 * _local2)) + ((((_scrollDirection == ScrollBarDirection.VERTICAL)) && (_local3))) ? 15 : 0);
}
override protected function setHorizontalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
invalidate(InvalidationType.SCROLL);
super.setHorizontalScrollPosition(_arg1, true);
}
public function set iconFunction(_arg1:Function):void{
if (_iconFunction == _arg1){
return;
};
_iconFunction = _arg1;
invalidate(InvalidationType.DATA);
}
public function get labelFunction():Function{
return (_labelFunction);
}
public function set direction(_arg1:String):void{
if (_scrollDirection == _arg1){
return;
};
_scrollDirection = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get innerHeight():Number{
var _local1:Number;
drawNow();
_local1 = (getStyleValue("contentPadding") as Number);
return (((height - (_local1 * 2)) - (_horizontalScrollBar.visible) ? _horizontalScrollBar.height : 0));
}
override protected function setVerticalScrollPosition(_arg1:Number, _arg2:Boolean=false):void{
invalidate(InvalidationType.SCROLL);
super.setVerticalScrollPosition(_arg1, true);
}
public function set sourceField(_arg1:String):void{
_sourceField = _arg1;
invalidate(InvalidationType.DATA);
}
override public function get rowCount():uint{
var _local1:Number;
var _local2:uint;
var _local3:uint;
_local1 = Number(getStyleValue("contentPadding"));
_local2 = Math.max(1, (((_width - (2 * _local1)) / _columnWidth) << 0));
_local3 = Math.max(1, (((_height - (2 * _local1)) / _rowHeight) << 0));
if (_scrollDirection == ScrollBarDirection.HORIZONTAL){
if ((((_scrollPolicy == ScrollPolicy.ON)) || ((((_scrollPolicy == ScrollPolicy.AUTO)) && ((length > (_local2 * _local3))))))){
_local3 = Math.max(1, ((((_height - (2 * _local1)) - 15) / _rowHeight) << 0));
};
} else {
_local3 = Math.max(1, Math.ceil(((_height - (2 * _local1)) / _rowHeight)));
};
return (_local3);
}
public function set rowHeight(_arg1:Number):void{
if (_rowHeight == _arg1){
return;
};
_rowHeight = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get columnCount():uint{
var _local1:Number;
var _local2:uint;
var _local3:uint;
_local1 = Number(getStyleValue("contentPadding"));
_local2 = Math.max(1, (((_width - (2 * _local1)) / _columnWidth) << 0));
_local3 = Math.max(1, (((_height - (2 * _local1)) / _rowHeight) << 0));
if (_scrollDirection != ScrollBarDirection.HORIZONTAL){
if ((((_scrollPolicy == ScrollPolicy.ON)) || ((((_scrollPolicy == ScrollPolicy.AUTO)) && ((length > (_local2 * _local3))))))){
_local2 = Math.max(1, ((((_width - (2 * _local1)) - 15) / _columnWidth) << 0));
};
} else {
_local2 = Math.max(1, Math.ceil(((_width - (2 * _local1)) / _columnWidth)));
};
return (_local2);
}
public function get iconFunction():Function{
return (_iconFunction);
}
override public function set dataProvider(_arg1:DataProvider):void{
super.dataProvider = _arg1;
}
public function get direction():String{
return (_scrollDirection);
}
override public function scrollToIndex(_arg1:int):void{
var _local2:uint;
var _local3:Number;
var _local4:Number;
drawNow();
_local2 = Math.max(1, ((contentWidth / _columnWidth) << 0));
if (_scrollDirection == ScrollBarDirection.VERTICAL){
if (rowHeight > availableHeight){
return;
};
_local3 = (((_arg1 / _local2) >> 0) * rowHeight);
if (_local3 < verticalScrollPosition){
verticalScrollPosition = _local3;
} else {
if (_local3 > ((verticalScrollPosition + availableHeight) - rowHeight)){
verticalScrollPosition = ((_local3 + rowHeight) - availableHeight);
};
};
} else {
if (columnWidth > availableWidth){
return;
};
_local4 = ((_arg1 % _local2) * columnWidth);
if (_local4 < horizontalScrollPosition){
horizontalScrollPosition = _local4;
} else {
if (_local4 > ((horizontalScrollPosition + availableWidth) - columnWidth)){
horizontalScrollPosition = ((_local4 + columnWidth) - availableWidth);
};
};
};
}
override protected function initializeAccessibility():void{
if (TileList.createAccessibilityImplementation != null){
TileList.createAccessibilityImplementation(this);
};
}
public function get rowHeight():Number{
return (_rowHeight);
}
override public function get dataProvider():DataProvider{
return (super.dataProvider);
}
override public function set maxHorizontalScrollPosition(_arg1:Number):void{
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, SelectableList.getStyleDefinition(), ScrollBar.getStyleDefinition()));
}
}
}//package fl.controls
Section 142
//UIScrollBar (fl.controls.UIScrollBar)
package fl.controls {
import fl.core.*;
import flash.events.*;
import flash.text.*;
import fl.events.*;
public class UIScrollBar extends ScrollBar {
protected var inScroll:Boolean;// = false
protected var _scrollTarget:TextField;
protected var inEdit:Boolean;// = false
private static var defaultStyles:Object = {};
public function UIScrollBar(){
inEdit = false;
inScroll = false;
super();
}
protected function handleTargetScroll(_arg1:Event):void{
if (inDrag){
return;
};
if (!enabled){
return;
};
inEdit = true;
updateScrollTargetProperties();
scrollPosition = ((direction)==ScrollBarDirection.HORIZONTAL) ? _scrollTarget.scrollH : _scrollTarget.scrollV;
inEdit = false;
}
override public function set minScrollPosition(_arg1:Number):void{
super.minScrollPosition = ((_arg1)<0) ? 0 : _arg1;
}
override public function setScrollPosition(_arg1:Number, _arg2:Boolean=true):void{
super.setScrollPosition(_arg1, _arg2);
if (!_scrollTarget){
inScroll = false;
return;
};
updateTargetScroll();
}
override public function setScrollProperties(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number=0):void{
var _local5:Number;
var _local6:Number;
_local5 = _arg3;
_local6 = ((_arg2)<0) ? 0 : _arg2;
if (_scrollTarget != null){
if (direction == ScrollBarDirection.HORIZONTAL){
_local5 = ((_arg3)>_scrollTarget.maxScrollH) ? _scrollTarget.maxScrollH : _local5;
} else {
_local5 = ((_arg3)>_scrollTarget.maxScrollV) ? _scrollTarget.maxScrollV : _local5;
};
};
super.setScrollProperties(_arg1, _local6, _local5, _arg4);
}
public function get scrollTargetName():String{
return (_scrollTarget.name);
}
public function get scrollTarget():TextField{
return (_scrollTarget);
}
protected function updateScrollTargetProperties():void{
var _local1:Boolean;
var _local2:Number;
if (_scrollTarget == null){
setScrollProperties(pageSize, minScrollPosition, maxScrollPosition, pageScrollSize);
scrollPosition = 0;
} else {
_local1 = (direction == ScrollBarDirection.HORIZONTAL);
_local2 = (_local1) ? _scrollTarget.width : 10;
setScrollProperties(_local2, (_local1) ? 0 : 1, (_local1) ? _scrollTarget.maxScrollH : _scrollTarget.maxScrollV, pageScrollSize);
scrollPosition = (_local1) ? _scrollTarget.scrollH : _scrollTarget.scrollV;
};
}
public function update():void{
inEdit = true;
updateScrollTargetProperties();
inEdit = false;
}
public function set scrollTargetName(_arg1:String):void{
var target = _arg1;
try {
scrollTarget = (parent.getChildByName(target) as TextField);
} catch(error:Error) {
throw (new Error("ScrollTarget not found, or is not a TextField"));
};
}
override public function set direction(_arg1:String):void{
if (isLivePreview){
return;
};
super.direction = _arg1;
updateScrollTargetProperties();
}
protected function handleTargetChange(_arg1:Event):void{
inEdit = true;
setScrollPosition(((direction)==ScrollBarDirection.HORIZONTAL) ? _scrollTarget.scrollH : _scrollTarget.scrollV, true);
updateScrollTargetProperties();
inEdit = false;
}
override public function set maxScrollPosition(_arg1:Number):void{
var _local2:Number;
_local2 = _arg1;
if (_scrollTarget != null){
if (direction == ScrollBarDirection.HORIZONTAL){
_local2 = ((_local2)>_scrollTarget.maxScrollH) ? _scrollTarget.maxScrollH : _local2;
} else {
_local2 = ((_local2)>_scrollTarget.maxScrollV) ? _scrollTarget.maxScrollV : _local2;
};
};
super.maxScrollPosition = _local2;
}
protected function updateTargetScroll(_arg1:ScrollEvent=null):void{
if (inEdit){
return;
};
if (direction == ScrollBarDirection.HORIZONTAL){
_scrollTarget.scrollH = scrollPosition;
} else {
_scrollTarget.scrollV = scrollPosition;
};
}
override protected function draw():void{
if (isInvalid(InvalidationType.DATA)){
updateScrollTargetProperties();
};
super.draw();
}
public function set scrollTarget(_arg1:TextField):void{
if (_scrollTarget != null){
_scrollTarget.removeEventListener(Event.CHANGE, handleTargetChange, false);
_scrollTarget.removeEventListener(TextEvent.TEXT_INPUT, handleTargetChange, false);
_scrollTarget.removeEventListener(Event.SCROLL, handleTargetScroll, false);
removeEventListener(ScrollEvent.SCROLL, updateTargetScroll, false);
};
_scrollTarget = _arg1;
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);
addEventListener(ScrollEvent.SCROLL, updateTargetScroll, false, 0, true);
};
invalidate(InvalidationType.DATA);
}
override public function get direction():String{
return (super.direction);
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(defaultStyles, ScrollBar.getStyleDefinition()));
}
}
}//package fl.controls
Section 143
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 144
//InvalidationType (fl.core.InvalidationType)
package fl.core {
public class InvalidationType {
public static const SIZE:String = "size";
public static const ALL:String = "all";
public static const DATA:String = "data";
public static const SCROLL:String = "scroll";
public static const STATE:String = "state";
public static const STYLES:String = "styles";
public static const SELECTED:String = "selected";
public static const RENDERER_STYLES:String = "rendererStyles";
}
}//package fl.core
Section 145
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
import fl.managers.*;
import fl.events.*;
import flash.system.*;
public class UIComponent extends Sprite {
protected var _enabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var startHeight:Number;
protected var _height:Number;
protected var _oldIMEMode:String;// = null
protected var startWidth:Number;
public var focusTarget:IFocusManagerComponent;
protected var errorCaught:Boolean;// = false
protected var uiFocusRect:DisplayObject;
protected var _width:Number;
public var version:String;// = "3.0.0.15"
protected var isFocused:Boolean;// = false
protected var callLaterMethods:Dictionary;
private var _focusEnabled:Boolean;// = true
private var tempText:TextField;
protected var invalidateFlag:Boolean;// = false
protected var _inspector:Boolean;// = false
protected var sharedStyles:Object;
protected var invalidHash:Object;
protected var isLivePreview:Boolean;// = false
protected var _imeMode:String;// = null
protected var instanceStyles:Object;
protected var _x:Number;
protected var _y:Number;
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)};
public static var createAccessibilityImplementation:Function;
private static var focusManagers:Dictionary = new Dictionary(false);
public function UIComponent(){
version = "3.0.0.15";
isLivePreview = false;
invalidateFlag = false;
_enabled = true;
isFocused = false;
_focusEnabled = true;
_mouseFocusEnabled = true;
_imeMode = null;
_oldIMEMode = null;
errorCaught = false;
_inspector = false;
super();
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 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);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var _local2:Dictionary;
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;
_local2 = callLaterMethods;
for (_local3 in _local2) {
_local3();
delete _local2[_local3];
};
inCallLaterPhase = false;
}
private function addedHandler(_arg1:Event):void{
removeEventListener("addedToStage", addedHandler);
initializeFocusManager();
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
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;
};
};
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
override public function get visible():Boolean{
return (super.visible);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
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 set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
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);
};
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var classDef:Object;
var skin = _arg1;
classDef = null;
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 copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function beforeComponentParameters():void{
}
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);
};
}
protected function createFocusManager():void{
if (focusManagers[stage] == null){
focusManagers[stage] = new FocusManager(stage);
};
}
override public function set visible(_arg1:Boolean):void{
var _local2:String;
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
_local2 = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
public function drawNow():void{
draw();
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
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 focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function validate():void{
invalidHash = {};
}
override public function get height():Number{
return (_height);
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function get enabled():Boolean{
return (_enabled);
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function getScaleY():Number{
return (super.scaleY);
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
protected function afterComponentParameters():void{
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function configUI():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
isLivePreview = checkLivePreview();
_local1 = rotation;
rotation = 0;
_local2 = super.width;
_local3 = 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 setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
private function initializeFocusManager():void{
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
};
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
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);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public function get focusManager():IFocusManager{
var _local1:DisplayObject;
_local1 = this;
while (_local1) {
if (UIComponent.focusManagers[_local1] != null){
return (IFocusManager(UIComponent.focusManagers[_local1]));
};
_local1 = _local1.parent;
};
return (null);
}
override public function get width():Number{
return (_width);
}
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));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local2:Object;
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local6:String;
_local2 = {};
_local3 = _args.length;
_local4 = 0;
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 146
//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);
};
}
protected function dispatchPreChangeEvent(_arg1:String, _arg2:Array, _arg3:int, _arg4:int):void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.PRE_DATA_CHANGE, _arg1, _arg2, _arg3, _arg4));
}
public function invalidateItemAt(_arg1:int):void{
checkIndex(_arg1, (data.length - 1));
dispatchChangeEvent(DataChangeType.INVALIDATE, [data[_arg1]], _arg1, _arg1);
}
public function getItemIndex(_arg1:Object):int{
return (data.indexOf(_arg1));
}
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());
//unresolved jump
};
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 TypeError((("Error: Type Coercion failed: cannot convert " + _arg1) + " to Array or DataProvider.")));
}
public function removeItemAt(_arg1:uint):Object{
var _local2:Array;
checkIndex(_arg1, (data.length - 1));
dispatchPreChangeEvent(DataChangeType.REMOVE, data.slice(_arg1, (_arg1 + 1)), _arg1, _arg1);
_local2 = data.splice(_arg1, 1);
dispatchChangeEvent(DataChangeType.REMOVE, _local2, _arg1, _arg1);
return (_local2[0]);
}
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 sortOn(_arg1:Object, _arg2:Object=null){
var _local3:Array;
dispatchPreChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
_local3 = data.sortOn(_arg1, _arg2);
dispatchChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
return (_local3);
}
public function sort(... _args){
var _local2:Array;
dispatchPreChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
_local2 = data.sort.apply(data, _args);
dispatchChangeEvent(DataChangeType.SORT, data.concat(), 0, (data.length - 1));
return (_local2);
}
public function addItems(_arg1:Object):void{
addItemsAt(_arg1, data.length);
}
public function concat(_arg1:Object):void{
addItems(_arg1);
}
public function clone():DataProvider{
return (new DataProvider(data));
}
public function toArray():Array{
return (data.concat());
}
public function get length():uint{
return (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 getItemAt(_arg1:uint):Object{
checkIndex(_arg1, (data.length - 1));
return (data[_arg1]);
}
override public function toString():String{
return ((("DataProvider [" + data.join(" , ")) + "]"));
}
public function invalidateItem(_arg1:Object):void{
var _local2:uint;
_local2 = getItemIndex(_arg1);
if (_local2 == -1){
return;
};
invalidateItemAt(_local2);
}
protected function dispatchChangeEvent(_arg1:String, _arg2:Array, _arg3:int, _arg4:int):void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.DATA_CHANGE, _arg1, _arg2, _arg3, _arg4));
}
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) + ")")));
};
}
public function addItemsAt(_arg1:Object, _arg2:uint):void{
var _local3:Array;
checkIndex(_arg2, data.length);
_local3 = 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 replaceItem(_arg1:Object, _arg2:Object):Object{
var _local3:int;
_local3 = getItemIndex(_arg2);
if (_local3 != -1){
return (replaceItemAt(_arg1, _local3));
};
return (null);
}
public function removeItem(_arg1:Object):Object{
var _local2:int;
_local2 = getItemIndex(_arg1);
if (_local2 != -1){
return (removeItemAt(_local2));
};
return (null);
}
public function merge(_arg1:Object):void{
var _local2:Array;
var _local3:uint;
var _local4:uint;
var _local5:uint;
var _local6:Object;
_local2 = getDataFromObject(_arg1);
_local3 = _local2.length;
_local4 = data.length;
dispatchPreChangeEvent(DataChangeType.ADD, data.slice(_local4, data.length), _local4, (this.data.length - 1));
_local5 = 0;
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 replaceItemAt(_arg1:Object, _arg2:uint):Object{
var _local3:Array;
checkIndex(_arg2, (data.length - 1));
_local3 = [data[_arg2]];
dispatchPreChangeEvent(DataChangeType.REPLACE, _local3, _arg2, _arg2);
data[_arg2] = _arg1;
dispatchChangeEvent(DataChangeType.REPLACE, _local3, _arg2, _arg2);
return (_local3[0]);
}
public function invalidate():void{
dispatchEvent(new DataChangeEvent(DataChangeEvent.DATA_CHANGE, DataChangeType.INVALIDATE_ALL, data.concat(), 0, data.length));
}
public function removeAll():void{
var _local1:Array;
_local1 = data.concat();
dispatchPreChangeEvent(DataChangeType.REMOVE_ALL, _local1, 0, _local1.length);
data = [];
dispatchChangeEvent(DataChangeType.REMOVE_ALL, _local1, 0, _local1.length);
}
}
}//package fl.data
Section 147
//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 148
//TileListCollectionItem (fl.data.TileListCollectionItem)
package fl.data {
public dynamic class TileListCollectionItem {
public var label:String;
public var source:String;
public function toString():String{
return ((((("[TileListCollectionItem: " + label) + ",") + source) + "]"));
}
}
}//package fl.data
Section 149
//ComponentEvent (fl.events.ComponentEvent)
package fl.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const HIDE:String = "hide";
public static const BUTTON_DOWN:String = "buttonDown";
public static const MOVE:String = "move";
public static const RESIZE:String = "resize";
public static const ENTER:String = "enter";
public static const LABEL_CHANGE:String = "labelChange";
public static const SHOW:String = "show";
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 150
//DataChangeEvent (fl.events.DataChangeEvent)
package fl.events {
import flash.events.*;
public class DataChangeEvent extends Event {
protected var _items:Array;
protected var _endIndex:uint;
protected var _changeType:String;
protected var _startIndex:uint;
public static const PRE_DATA_CHANGE:String = "preDataChange";
public static const DATA_CHANGE:String = "dataChange";
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 startIndex():uint{
return (_startIndex);
}
public function get items():Array{
return (_items);
}
override public function clone():Event{
return (new DataChangeEvent(type, _changeType, _items, _startIndex, _endIndex));
}
override public function toString():String{
return (formatToString("DataChangeEvent", "type", "changeType", "startIndex", "endIndex", "bubbles", "cancelable"));
}
public function get endIndex():uint{
return (_endIndex);
}
}
}//package fl.events
Section 151
//DataChangeType (fl.events.DataChangeType)
package fl.events {
public class DataChangeType {
public static const ADD:String = "add";
public static const REMOVE:String = "remove";
public static const REMOVE_ALL:String = "removeAll";
public static const CHANGE:String = "change";
public static const REPLACE:String = "replace";
public static const INVALIDATE:String = "invalidate";
public static const INVALIDATE_ALL:String = "invalidateAll";
public static const SORT:String = "sort";
}
}//package fl.events
Section 152
//DataGridEvent (fl.events.DataGridEvent)
package fl.events {
import flash.events.*;
public class DataGridEvent extends ListEvent {
protected var _itemRenderer:Object;
protected var _reason:String;
protected var _dataField:String;
public static const ITEM_EDIT_BEGIN:String = "itemEditBegin";
public static const ITEM_EDIT_END:String = "itemEditEnd";
public static const ITEM_EDIT_BEGINNING:String = "itemEditBeginning";
public static const HEADER_RELEASE:String = "headerRelease";
public static const ITEM_FOCUS_IN:String = "itemFocusIn";
public static const ITEM_FOCUS_OUT:String = "itemFocusOut";
public static const COLUMN_STRETCH:String = "columnStretch";
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 reason():String{
return (_reason);
}
public function set dataField(_arg1:String):void{
_dataField = _arg1;
}
override public function toString():String{
return (formatToString("DataGridEvent", "type", "bubbles", "cancelable", "columnIndex", "rowIndex", "itemRenderer", "dataField", "reason"));
}
public function get dataField():String{
return (_dataField);
}
override public function clone():Event{
return (new DataGridEvent(type, bubbles, cancelable, columnIndex, int(rowIndex), _itemRenderer, _dataField, _reason));
}
public function get itemRenderer():Object{
return (_itemRenderer);
}
}
}//package fl.events
Section 153
//DataGridEventReason (fl.events.DataGridEventReason)
package fl.events {
public final class DataGridEventReason {
public static const OTHER:String = "other";
public static const CANCELLED:String = "cancelled";
public static const NEW_COLUMN:String = "newColumn";
public static const NEW_ROW:String = "newRow";
}
}//package fl.events
Section 154
//ListEvent (fl.events.ListEvent)
package fl.events {
import flash.events.*;
public class ListEvent extends Event {
protected var _index:int;
protected var _item:Object;
protected var _columnIndex:int;
protected var _rowIndex:int;
public static const ITEM_DOUBLE_CLICK:String = "itemDoubleClick";
public static const ITEM_ROLL_OUT:String = "itemRollOut";
public static const ITEM_ROLL_OVER:String = "itemRollOver";
public static const ITEM_CLICK:String = "itemClick";
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 index():int{
return (_index);
}
public function get item():Object{
return (_item);
}
public function get columnIndex():int{
return (_columnIndex);
}
override public function clone():Event{
return (new ListEvent(type, bubbles, cancelable, _columnIndex, _rowIndex));
}
override public function toString():String{
return (formatToString("ListEvent", "type", "bubbles", "cancelable", "columnIndex", "rowIndex", "index", "item"));
}
}
}//package fl.events
Section 155
//ScrollEvent (fl.events.ScrollEvent)
package fl.events {
import flash.events.*;
public class ScrollEvent extends Event {
private var _position:Number;
private var _direction:String;
private var _delta: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;
}
override public function clone():Event{
return (new ScrollEvent(_direction, _delta, _position));
}
public function get position():Number{
return (_position);
}
override public function toString():String{
return (formatToString("ScrollEvent", "type", "bubbles", "cancelable", "direction", "delta", "position"));
}
public function get delta():Number{
return (_delta);
}
public function get direction():String{
return (_direction);
}
}
}//package fl.events
Section 156
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import fl.core.*;
import flash.events.*;
import flash.display.*;
import fl.controls.*;
import flash.utils.*;
import flash.text.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var focusableObjects:Dictionary;
private var _showFocusIndicator:Boolean;// = true
private var defButton:Button;
private var focusableCandidates:Array;
private var _form:DisplayObjectContainer;
private var _defaultButtonEnabled:Boolean;// = true
private var activated:Boolean;// = false
private var _defaultButton:Button;
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var lastAction:String;
public function FocusManager(_arg1:DisplayObjectContainer){
activated = false;
calculateCandidates = true;
_showFocusIndicator = true;
_defaultButtonEnabled = true;
super();
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
addFocusables(DisplayObject(_arg1));
_arg1.addEventListener(Event.ADDED, addedHandler);
_arg1.addEventListener(Event.REMOVED, removedHandler);
activate();
};
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local5:int;
var _local6:int;
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
_local5 = focusableCandidates.length;
_local6 = _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);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
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);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
} 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);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
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 getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function focusOutHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
_local2 = (_arg1.target as InteractiveObject);
}
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);
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var _local2:InteractiveObject;
_local2 = _arg1;
while (_arg1) {
if ((((_arg1 is IFocusManagerComponent)) && (IFocusManagerComponent(_arg1).focusEnabled))){
return (_arg1);
};
_arg1 = _arg1.parent;
};
return (_local2);
}
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 removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject;
_local2 = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
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);
}
private function tabChildrenChangeHandler(_arg1:Event):void{
var _local2:DisplayObjectContainer;
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
_local2 = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject;
_local1 = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
var _local3:TextField;
var _local4:SimpleButton;
_local2 = 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);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button;
_local2 = (_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;
};
};
}
private function deactivateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
if (!hasFocusableObjects()){
return;
};
_local2 = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
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 keyFocusChangeHandler(_arg1:FocusEvent):void{
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int;
var _local3:int;
_local2 = focusableCandidates.length;
_local3 = 0;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
public function hideFocus():void{
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local3:DisplayObject;
var _local4:InteractiveObject;
_local3 = 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);
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);
};
};
removeFocusables(_local3);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var _local3:String;
var _local4:String;
var _local5:int;
var _local6:String;
var _local7:String;
var _local8:String;
var _local9:DisplayObject;
var _local10:DisplayObject;
_local3 = "";
_local4 = "";
_local8 = "0000";
_local9 = DisplayObject(_arg1);
_local10 = 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);
}
public function get defaultButton():Button{
return (_defaultButton);
}
private function activateHandler(_arg1:Event):void{
var _local2:InteractiveObject;
_local2 = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
public function showFocus():void{
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local2:DisplayObject;
var _local3:String;
var _local4:int;
var _local5:Boolean;
var _local6:int;
var _local7:int;
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
_local2 = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
_local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
_local4 = getIndexOfFocusedObject(_local2);
_local5 = false;
_local6 = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
_local7 = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function mouseDownHandler(_arg1:MouseEvent):void{
var _local2:InteractiveObject;
if (_arg1.isDefaultPrevented()){
return;
};
_local2 = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1.parent;
while (((((_local2) && (!((_local2 is Stage))))) && (!(((_local2.parent) && ((_local2.parent is Stage))))))) {
if (!_local2.tabChildren){
return (false);
};
_local2 = _local2.parent;
};
return (true);
}
public function get nextTabIndex():int{
return (0);
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local2:InteractiveObject;
var _local3:Button;
_local2 = 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 tabEnabledChangeHandler(_arg1:Event):void{
var _local2:InteractiveObject;
var _local3:Boolean;
calculateCandidates = true;
_local2 = InteractiveObject(_arg1.target);
_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];
};
};
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function activate():void{
if (activated){
return;
};
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);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, 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);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
}
}//package fl.managers
Section 157
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import flash.display.*;
import fl.controls.*;
public interface IFocusManager {
function getFocus():InteractiveObject;
function deactivate():void;
function set defaultButton(_arg1:Button):void;
function set showFocusIndicator(_arg1:Boolean):void;
function get defaultButtonEnabled():Boolean;
function get nextTabIndex():int;
function get defaultButton():Button;
function get showFocusIndicator():Boolean;
function setFocus(_arg1:InteractiveObject):void;
function activate():void;
function showFocus():void;
function set defaultButtonEnabled(_arg1:Boolean):void;
function hideFocus():void;
function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
}
}//package fl.managers
Section 158
//IFocusManagerComponent (fl.managers.IFocusManagerComponent)
package fl.managers {
public interface IFocusManagerComponent {
function set focusEnabled(_arg1:Boolean):void;
function drawFocus(_arg1:Boolean):void;
function setFocus():void;
function get focusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function get mouseFocusEnabled():Boolean;
}
}//package fl.managers
Section 159
//IFocusManagerGroup (fl.managers.IFocusManagerGroup)
package fl.managers {
public interface IFocusManagerGroup {
function set groupName(_arg1:String):void;
function set selected(_arg1:Boolean):void;
function get groupName():String;
function get selected():Boolean;
}
}//package fl.managers
Section 160
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import fl.core.*;
import flash.utils.*;
import flash.text.*;
public class StyleManager {
private var globalStyles:Object;
private var classToDefaultStylesDict:Dictionary;
private var styleToClassesHash:Object;
private var classToStylesDict:Dictionary;
private var classToInstancesDict:Dictionary;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _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);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class;
var _local5:Object;
_local4 = getClassDef(_arg1);
_local5 = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local2:StyleManager;
var _local3:Class;
var _local4:Object;
var _local5:String;
_local2 = getInstance();
_local3 = getClassDef(_arg1);
_local4 = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class;
var _local4:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local3:Dictionary;
var _local4:Object;
var _local5:UIComponent;
_local3 = 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));
};
};
}
private static function invalidateStyle(_arg1:String):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
public static function registerInstance(_arg1:UIComponent):void{
var inst:StyleManager;
var classDef:Class;
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
inst = getInstance();
classDef = 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;
inst.classToStylesDict[classDef] = {};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class;
var _local4:StyleManager;
var _local5:Object;
_local3 = getClassDef(_arg1);
_local4 = getInstance();
_local5 = _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 setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object;
_local3 = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
}
}//package fl.managers
Section 161
//AssetData (Game.Data.AssetData)
package Game.Data {
import flash.events.*;
import flash.display.*;
import WBE.Managers.*;
import flash.utils.*;
public class AssetData {
public var gridWidth:Number;// = 20
public var bgGraphicsDict:Dictionary;
public var graphicsDict:Dictionary;
public var gridHeight:Number;// = 20
private var xGridOffset:Number;// = 0
private var yGridOffset:Number;// = 0
public var audioDict:Dictionary;
public var assetLibs:Dictionary;
private static var allowInstantiation:Boolean;
private static var instance:AssetData;
public function AssetData():void{
xGridOffset = 0;
yGridOffset = 0;
gridWidth = 20;
gridHeight = 20;
super();
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use AssetData.getInstance() instead of new."));
};
this.assetLibs = new Dictionary();
this.graphicsDict = new Dictionary();
this.graphicsDict["inputFieldError"] = {mcName:"BBinputFieldErrorMC"};
this.graphicsDict["activityIndicator"] = {mcName:"loadSpinner"};
this.graphicsDict["Console"] = {mcName:"BBconsoleMC"};
this.graphicsDict["button"] = {mcName:"pixelButton"};
this.graphicsDict["gameMenuButton"] = {mcName:"gameMenuButton"};
this.graphicsDict["player"] = {mcName:"BBplayer1MC"};
this.graphicsDict["mochi"] = {mcName:"mochi"};
this.graphicsDict["Console"] = {mcName:"BBconsoleMC"};
this.graphicsDict["DialogMC"] = {mcName:"DialogMC"};
this.graphicsDict["dialogButton"] = {mcName:"pixelButton"};
this.graphicsDict["modalLayer"] = {mcName:"modalLayer"};
this.graphicsDict["modalLayerClose_btn"] = {mcName:"modalLayerClose_btn"};
this.graphicsDict["soundButton"] = {mcName:"BBsoundButton"};
this.graphicsDict["musicButton"] = {mcName:"BBmusicButton"};
this.graphicsDict["backButton"] = {mcName:"BBopenMenuButton"};
this.graphicsDict["zoomButton"] = {mcName:"BBzoomButton"};
this.graphicsDict["highScoreHighlight"] = {mcName:"highscoreHighlight"};
this.graphicsDict["block1"] = {mcName:"Block1"};
this.graphicsDict["block2"] = {mcName:"Block2"};
this.graphicsDict["block3"] = {mcName:"Block3"};
this.graphicsDict["block4"] = {mcName:"Block4"};
this.graphicsDict["block5"] = {mcName:"Block5"};
this.graphicsDict["block6"] = {mcName:"Block6"};
this.graphicsDict["block7"] = {mcName:"Block7"};
this.graphicsDict["ground"] = {mcName:"Ground"};
this.graphicsDict["curHeightLine"] = {mcName:"curHeightLine"};
this.graphicsDict["maxHeightLine"] = {mcName:"maxHeightLine"};
this.graphicsDict["maxHeightLabel"] = {mcName:"maxHeightLabel"};
this.graphicsDict["upArrow"] = {mcName:"upArrow"};
this.graphicsDict["mainBG"] = {mcName:"mainBackground_mc"};
this.graphicsDict["mainMenuBG"] = {mcName:"mainMenuBG"};
this.graphicsDict["showscoreMenuBG"] = {mcName:"mainMenuBG"};
this.graphicsDict["gameoverMenuBG"] = {mcName:"mainMenuBG"};
this.graphicsDict["highScoreMenuBG"] = {mcName:"mainMenuBG"};
this.graphicsDict["submitScoreMenuBG"] = {mcName:"mainMenuBG"};
this.graphicsDict["gameMenuBG"] = {mcName:"gameMenuBG"};
this.graphicsDict["controlsMC"] = {mcName:"controlsMC"};
this.graphicsDict["pausedMessageMC"] = {mcName:"pausedMessageMC"};
this.graphicsDict["pausedMessageBG"] = {mcName:"pausedMessageBG"};
this.graphicsDict["tooltip"] = {mcName:"tooltip"};
this.graphicsDict["wbIntro"] = {mcName:"wbIntro"};
this.graphicsDict["kongregateIntro"] = {mcName:"KongregateIntro"};
this.bgGraphicsDict = new Dictionary();
this.bgGraphicsDict["grid"] = {mcName:"grid", gZ:-2, scaleWithZ:false, parralax:false, blurWithZ:false, vertiFixed:true};
this.bgGraphicsDict["messageAreaMC"] = {mcName:"messageAreaMC", gZ:-1, scaleWithZ:false, parralax:false, blurWithZ:false, vertiFixed:true, backgroundID:"messageArea"};
this.audioDict = new Dictionary();
this.audioDict["dropSound"] = {acName:"humm.wav", volume:0.8};
this.audioDict["message"] = {acName:"message", volume:0.25};
this.audioDict["bgm"] = {acName:"bgm"};
this.audioDict["crashSound1"] = {acName:"dropping_1.wav", volume:0.8};
this.audioDict["crashSound2"] = {acName:"dropping_2.wav", volume:0.8};
this.audioDict["crashSound3"] = {acName:"dropping_3.wav", volume:0.8};
this.audioDict["popSound"] = {acName:"popSound.wav", volume:1};
}
public function convertObjectOrientation(_arg1:MovieClip):void{
var _local2:Object;
_local2 = convertOrientation(_arg1.xPos, _arg1.yPos, _arg1.getRotation());
_arg1.x = _local2.x;
_arg1.y = _local2.y;
_arg1.rotation = _local2.rot;
}
public function convertOrientationBack(_arg1:int, _arg2:int):Array{
return ([Math.floor(((_arg1 - this.xGridOffset) / this.gridWidth)), Math.floor(((_arg2 - this.yGridOffset) / this.gridHeight))]);
}
public function toString():String{
return ("AssetData");
}
public function convertOrientation(_arg1:Number, _arg2:Number, _arg3:Number):Object{
return ({x:_arg1, y:-(_arg2), rot:_arg3});
}
public static function getInstance(_arg1:Object):AssetData{
if ((_arg1 is wbAssetManager)){
if (instance == null){
allowInstantiation = true;
instance = new (AssetData);
allowInstantiation = false;
};
return (instance);
//unresolved jump
};
wbStateManager.getInstance().error(("Unauthorized call of AssetData.getInstance by: " + _arg1));
return (null);
}
}
}//package Game.Data
Section 162
//DatabaseData (Game.Data.DatabaseData)
package Game.Data {
import WBE.Managers.*;
import flash.utils.*;
public class DatabaseData {
public var WBurl:String;// = "http://www.weirdbeard.nl/php/"
public var key:String;// = "powertothemonkeykfgdsfkdjsbfsdkjfbdskjfbdskjfbdsi92321321557"
public var dbData:Dictionary;
public var gameName:String;// = "tettow"
public var dbActions:Dictionary;
private static var allowInstantiation:Boolean;
private static var instance:DatabaseData;
public function DatabaseData(){
gameName = "tettow";
key = "powertothemonkeykfgdsfkdjsbfsdkjfbdskjfbdskjfbdsi92321321557";
WBurl = "http://www.weirdbeard.nl/php/";
super();
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use MenuData.getInstance() instead of new."));
};
this.dbActions = new Dictionary();
this.dbActions["writescore"] = {input:"writescore"};
this.dbActions["updatescore"] = {input:"updatescore"};
this.dbActions["highscore"] = {input:"highscore", callbackWithObject:true};
this.dbActions["newsession"] = {input:"newsession"};
this.dbActions["newplaythrough"] = {input:"newplaythrough"};
this.dbActions["updatesessionPlay"] = {input:"updatesessionPlay"};
this.dbActions["updatesessionRegister"] = {input:"updatesessionRegister"};
this.dbActions["newstatistics"] = {input:"newstatistics"};
this.dbData = new Dictionary();
this.dbData["writescore"] = new Dictionary();
this.dbData["writescore"]["insert"] = [{column:"name", type:String, form:"score", element:"name"}, {column:"score", type:int, varData:"realMaxHeight"}, {column:"difficulty", type:int, varData:"difficulty"}, {column:"created", defaultData:"CURRENT_TIMESTAMP", type:Number}];
this.dbData["writescore"]["where"] = [{column:"difficulty", varData:"difficulty", type:int}];
this.dbData["writescore"]["sort"] = {column:"score", direction:"DESC"};
this.dbData["writescore"]["recordid"] = {recordid:"playerid"};
this.dbData["highscore"] = new Dictionary();
this.dbData["highscore"]["select"] = [{column:"score"}, {column:"name"}];
this.dbData["highscore"]["where"] = [{column:"Difficulty", varData:"difficulty", type:int}];
this.dbData["highscore"]["sort"] = {column:"score", top:15, direction:"DESC"};
this.dbData["updatescore"] = new Dictionary();
this.dbData["updatescore"]["update"] = [{column:"score", varData:"score", type:int}, {column:"name", form:"score", element:"name", type:String}];
this.dbData["updatescore"]["where"] = [{column:"difficulty", varData:"difficulty", type:int}];
this.dbData["newsession"] = new Dictionary();
this.dbData["newsession"]["insert"] = [{column:"created", defaultData:"CURRENT_TIMESTAMP", type:Number}];
this.dbData["newsession"]["table"] = {table:"sessions"};
this.dbData["newsession"]["recordid"] = {recordid:"sessionid"};
this.dbData["newplaythrough"] = new Dictionary();
this.dbData["newplaythrough"]["insert"] = [{column:"sessionid", varData:"sessionid", type:int}, {column:"difficulty", varData:"difficulty", type:int}, {column:"created", defaultData:"CURRENT_TIMESTAMP", type:Number}];
this.dbData["newplaythrough"]["table"] = {table:"playthroughs"};
this.dbData["newplaythrough"]["recordid"] = {recordid:"playthroughid"};
this.dbData["updatesessionPlay"] = new Dictionary();
this.dbData["updatesessionPlay"]["update"] = [{column:"started", defaultData:"true", type:int}];
this.dbData["updatesessionPlay"]["where"] = [{column:"id", varData:"sessionid", type:int}];
this.dbData["updatesessionPlay"]["table"] = {table:"sessions"};
this.dbData["updatesessionRegister"] = new Dictionary();
this.dbData["updatesessionRegister"]["update"] = [{column:"registered", defaultData:"true", type:int}, {column:"playerid", varData:"playerid", type:int}];
this.dbData["updatesessionRegister"]["where"] = [{column:"id", varData:"playthroughid", type:int}];
this.dbData["updatesessionRegister"]["table"] = {table:"playthroughs"};
this.dbData["newstatistics"] = new Dictionary();
this.dbData["newstatistics"]["insert"] = [{column:"playthroughid", varData:"playthroughid", type:int}, {column:"difficulty", varData:"difficulty", type:int}, {column:"framerate", varData:"levelFrameRate", type:Number}, {column:"dev_framerate", varData:"levelDevFrameRate", type:Number}, {column:"leveltime", varData:"levelTime", type:int}, {column:"created", defaultData:"CURRENT_TIMESTAMP", type:Number}];
this.dbData["newstatistics"]["table"] = {table:"levelstatistics"};
}
public function toString():String{
return ("DatabaseData");
}
public static function getInstance(_arg1:Object):DatabaseData{
if ((_arg1 is wbDatabaseManager)){
if (instance == null){
allowInstantiation = true;
instance = new (DatabaseData);
allowInstantiation = false;
};
return (instance);
//unresolved jump
};
wbStateManager.getInstance().error(("Unauthorized call of DatabaseData.getInstance by: " + _arg1));
return (null);
}
}
}//package Game.Data
Section 163
//GameInputData (Game.Data.GameInputData)
package Game.Data {
import WBE.Managers.*;
import flash.utils.*;
public class GameInputData {
public var keyMapping:Dictionary;
private static var allowInstantiation:Boolean;
private static var instance:GameInputData;
public function GameInputData():void{
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use GameInput.getInstance() instead of new."));
};
this.keyMapping = new Dictionary();
this.keyMapping["left"] = {keys:["left", "a"], condition:"e", conditionVal:1, downValue:1, upValue:0, func:wbStateManager.getGameState().moveLeft};
this.keyMapping["up"] = {keys:["up", "w", "space"], condition:"e", conditionVal:1, downValue:1, upValue:0, func:wbStateManager.getGameState().moveUp};
this.keyMapping["right"] = {keys:["right", "d"], condition:"e", conditionVal:1, downValue:1, upValue:0, func:wbStateManager.getGameState().moveRight};
this.keyMapping["down"] = {keys:["down", "s"], condition:"e", conditionVal:1, downValue:1, upValue:0, func:wbStateManager.getGameState().moveDown};
this.keyMapping["zoom"] = {keys:["z", "2"], condition:"e", conditionVal:1, downValue:1, upValue:0, func:wbStateManager.getGameState().zoom};
this.keyMapping["pause"] = {keys:["p", "esc"], condition:"e", conditionVal:1, upValue:"Default", func:wbStateManager.getInstance().toggleGameMenu};
this.keyMapping["discardBlock"] = {keys:["c"], condition:"e", conditionVal:1, func:wbStateManager.getGameState().discardBlock};
}
public function removeInstance():void{
instance = null;
allowInstantiation = true;
}
public function toString():String{
return ("GameInputData");
}
public static function getInstance(_arg1:Object):GameInputData{
if ((_arg1 is wbGameInputManager)){
if (instance == null){
allowInstantiation = true;
instance = new (GameInputData);
allowInstantiation = false;
};
return (instance);
//unresolved jump
};
wbStateManager.getInstance().error(("Unauthorized call of GameInputData.getInstance by: " + _arg1));
return (null);
}
}
}//package Game.Data
Section 164
//GameMenuData (Game.Data.GameMenuData)
package Game.Data {
import WBE.Managers.*;
import flash.utils.*;
import WBE.UI.*;
import Game.Modes.*;
public class GameMenuData {
public var interfaces:Dictionary;
private static var allowInstantiation:Boolean;
private static var instance:GameMenuData;
public function GameMenuData(){
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use GameMenuData.getInstance() instead of new."));
};
this.interfaces = new Dictionary();
this.interfaces["Default"] = new Dictionary();
this.interfaces["Default"]["back"] = {label:"Main Menu", type:"Button", mc:"gameMenuButton", action:"exit", exit:"back", confirm:true, confirmtext:"Are you sure? \n\n Your current highscore will not be submitted."};
this.interfaces["Default"]["resume"] = {label:"Resume", type:"Button", mc:"gameMenuButton", action:"func", func:wbStateManager.getInstance().closeGameMenu};
this.interfaces["Default"]["howToPlay"] = {label:"How To Play", type:"Button", mc:"gameMenuButton", action:"func", func:wbStateManager.getInstance().openInfoWindow, funcArgs:["HowToPlay"]};
this.interfaces["Default"]["reset"] = {label:"Reset", type:"Button", mc:"gameMenuButton", action:"exit", exit:"reset", confirm:true, confirmtext:"Are you sure? \n\n Your current highscore will not be submitted."};
this.interfaces["Default"]["submit"] = {label:"Submit Score", type:"Button", mc:"gameMenuButton", action:"func", func:PlayMode(wbStateManager.getGameState().getCurrentMode()).endMode};
}
public function getGameMenuData(_arg1:String):Dictionary{
return (this.interfaces[_arg1]);
}
public function toString():String{
return ("GameMenuData");
}
public static function getInstance(_arg1:Object):GameMenuData{
if ((_arg1 is wbGameMenu)){
if (instance == null){
allowInstantiation = true;
instance = new (GameMenuData);
allowInstantiation = false;
};
return (instance);
//unresolved jump
};
wbStateManager.getInstance().error(("Unauthorized call of GameMenuData.getInstance by: " + _arg1));
return (null);
}
}
}//package Game.Data
Section 165
//InfoWindowData (Game.Data.InfoWindowData)
package Game.Data {
import WBE.Managers.*;
import flash.utils.*;
import WBE.UI.*;
public class InfoWindowData {
private var infoWindows:Dictionary;
private static var allowInstantiation:Boolean;
private static var instance:InfoWindowData;
public function InfoWindowData(){
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use InfoWindowData.getInstance() instead of new."));
};
this.infoWindows = new Dictionary();
this.infoWindows["HowToPlay"] = new Dictionary();
this.infoWindows["HowToPlay"]["close"] = {label:"Close", type:"Button", keyBind:["esc", "p"], action:"parentFunc", func:"close"};
}
public function toString():String{
return ("InfoWindowData");
}
public function getInfoWindowData(_arg1:String):Dictionary{
return (this.infoWindows[_arg1]);
}
public static function getInstance(_arg1:Object):InfoWindowData{
if ((_arg1 is wbInfoWindow)){
if (instance == null){
allowInstantiation = true;
instance = new (InfoWindowData);
allowInstantiation = false;
};
return (instance);
//unresolved jump
};
wbStateManager.getInstance().error(("Unauthorized call of InfoWindowData.getInstance by: " + _arg1));
return (null);
}
}
}//package Game.Data
Section 166
//InterfaceData (Game.Data.InterfaceData)
package Game.Data {
import WBE.Managers.*;
import flash.utils.*;
import WBE.UI.*;
import Game.Modes.*;
public class InterfaceData {
public var interfaces:Dictionary;
private static var allowInstantiation:Boolean;
private static var instance:InterfaceData;
public function InterfaceData(){
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use InterfaceData.getInstance() instead of new."));
};
this.interfaces = new Dictionary();
this.interfaces["Play"] = new Dictionary();
this.interfaces["Play"]["zoom"] = {type:"Button", mc:"zoomButton", filterSet:"glowFilter", action:"func", func:zoomIn, downFunc:zoomOut, tooltip:"Hold to zoom out [z]"};
this.interfaces["Play"]["back"] = {type:"Button", mc:"backButton", filterSet:"glowFilter", action:"gameMenu", tooltip:"Open pause menu [p]", menuType:"Default"};
this.interfaces["Play"]["sound"] = {type:"AudioButton", mc:"soundButton", filterSet:"glowFilter", audioType:"mute", tooltip:"Toggle mute"};
this.interfaces["Play"]["music"] = {type:"AudioButton", mc:"musicButton", filterSet:"glowFilter", audioType:"music", tooltip:"Toggle music"};
this.interfaces["Play"]["maxHeight"] = {type:"MaxHeightLine", format:"maxHeightLine", varData:"maxHeight"};
this.interfaces["Play"]["curHeight"] = {type:"HeightLine", format:"heightLine", varData:"curHeight"};
this.interfaces["Play"]["blocks"] = {type:"Output", format:"blocksLeft", varData:"blocks"};
this.interfaces["Test"] = new Dictionary();
this.interfaces["Test"]["back"] = {type:"Button", mc:"backButton", filterSet:"glowFilter", action:"exit", tooltip:"Back to main menu", exit:"back", confirm:true};
this.interfaces["Test"]["sound"] = {type:"AudioButton", mc:"soundButton", filterSet:"glowFilter", audioType:"mute", tooltip:"Toggle mute"};
this.interfaces["Test"]["music"] = {type:"AudioButton", mc:"musicButton", filterSet:"glowFilter", audioType:"music", tooltip:"Toggle music"};
this.interfaces["Test"]["maxHeight"] = {type:"MaxHeightLine", format:"maxHeightLine", varData:"maxHeight"};
this.interfaces["Test"]["curHeight"] = {type:"HeightLine", format:"heightLine", varData:"curHeight"};
this.interfaces["Test"]["blocks"] = {type:"Output", format:"blocksLeft", varData:"blocks"};
}
public function zoomIn(){
PlayMode(wbStateManager.getGameState().getCurrentMode()).zoom(0);
}
public function zoomOut(){
PlayMode(wbStateManager.getGameState().getCurrentMode()).zoom(1);
}
public function toString():String{
return ("InterfaceData");
}
public static function getInstance(_arg1:Object):InterfaceData{
if ((_arg1 is wbInterface)){
if (instance == null){
allowInstantiation = true;
instance = new (InterfaceData);
allowInstantiation = false;
};
return (instance);
//unresolved jump
};
wbStateManager.getInstance().error(("Unauthorized call of InterfaceData.getInstance by: " + _arg1));
return (null);
}
}
}//package Game.Data
Section 167
//MenuData (Game.Data.MenuData)
package Game.Data {
import WBE.Managers.*;
import flash.utils.*;
import WBE.States.*;
import Game.UI.*;
public class MenuData {
public var menus:Dictionary;
private static var allowInstantiation:Boolean;
private static var instance:MenuData;
public function MenuData(){
var _local1:Array;
super();
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use MenuData.getInstance() instead of new."));
};
_local1 = [UI_HeightLine, UI_MaxHeightLine];
this.menus = new Dictionary();
this.menus["main"] = new Dictionary();
this.menus["main"]["start1"] = {label:"Play", type:"Button", action:"exit", exit:"easy", index:1};
this.menus["main"]["toKonSite"] = {type:"MCButton", action:"externalLink", tooltip:"To Kongregate", url:"http://www.kongregate.com/?gamereferral=99-bricks"};
this.menus["main"]["toWBSite"] = {type:"MCButton", action:"externalLink", tooltip:"To our website", url:"http://www.weirdbeard.nl/en/"};
this.menus["main"]["sound"] = {type:"AudioButton", mc:"soundButton", filterSet:"glowFilter", audioType:"mute", tooltip:"Toggle mute"};
this.menus["main"]["music"] = {type:"AudioButton", mc:"musicButton", filterSet:"glowFilter", audioType:"music", tooltip:"Toggle music"};
this.menus["main"]["howToPlay"] = {label:"How To Play", type:"Button", action:"func", func:wbStateManager.getInstance().openInfoWindow, funcArgs:["HowToPlay"]};
this.menus["gameover"] = new Dictionary();
this.menus["gameover"]["score"] = {label:"Score", type:"Output", filterSet:"outputFilter", format:"endScore", varData:"realMaxHeight"};
this.menus["gameover"]["message"] = {type:"Output", varData:"scoreMessage", htmlText:true, multiline:true};
this.menus["gameover"]["back"] = {label:"Menu", type:"Button", action:"exit", exit:"back"};
this.menus["gameover"]["playAgain"] = {label:"Play Again", type:"Button", action:"exit", exit:"playAgain", index:1};
this.menus["gameover"]["toKonSite"] = {type:"MCButton", action:"externalLink", tooltip:"To Kongregate", url:"http://www.kongregate.com/?gamereferral=99-bricks"};
this.menus["gameover"]["toWBSite"] = {type:"MCButton", action:"externalLink", tooltip:"To our website", url:"http://www.weirdbeard.nl/en/"};
}
public function toString():String{
return ("MenuData");
}
public static function getInstance(_arg1:Object):MenuData{
if ((_arg1 is wbMenuState)){
if (instance == null){
allowInstantiation = true;
instance = new (MenuData);
allowInstantiation = false;
};
return (instance);
//unresolved jump
};
wbStateManager.getInstance().error(("Unauthorized call of MenuData.getInstance by: " + _arg1));
return (null);
}
}
}//package Game.Data
Section 168
//SettingsData (Game.Data.SettingsData)
package Game.Data {
import WBE.Managers.*;
import flash.utils.*;
import flash.text.*;
import flash.filters.*;
public class SettingsData {
public var points:Dictionary;
public var urls:Dictionary;
public var filterSets:Dictionary;
public var textFormats:Dictionary;
public var settings:Dictionary;
public var worldSettings:Dictionary;
private static var allowInstantiation:Boolean;
private static var instance:SettingsData;
public function SettingsData(){
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use SettingsData.getInstance() instead of new."));
};
this.settings = new Dictionary();
this.settings["debug"] = false;
this.settings["gameName"] = "tettow";
this.settings["logPriority"] = 0;
this.settings["logTime"] = false;
this.settings["logConsole"] = true;
this.settings["logTrace"] = true;
this.settings["allowedURLs"] = [];
this.settings["libPath"] = "";
this.worldSettings = new Dictionary();
this.worldSettings["cyclical"] = false;
this.worldSettings["width"] = 400;
this.worldSettings["height"] = 500;
this.worldSettings["doCollision"] = false;
this.worldSettings["ghostMode"] = false;
this.worldSettings["drawShadows"] = true;
this.worldSettings["pixelShift"] = false;
this.points = new Dictionary();
this.textFormats = new Dictionary();
this.textFormats["default"] = new TextFormat();
this.textFormats["default"].size = 16;
this.textFormats["default"].color = 0xFFFFFF;
this.textFormats["default"].font = "Samson";
this.textFormats["default"].align = "center";
this.textFormats["default"].bold = false;
this.textFormats["debug"] = new TextFormat();
this.textFormats["debug"].size = 10;
this.textFormats["debug"].color = 0xFFFFFF;
this.textFormats["debug"].font = "Samson";
this.textFormats["debug"].align = "left";
this.textFormats["tooltip"] = new TextFormat();
this.textFormats["tooltip"].size = 10;
this.textFormats["tooltip"].color = 0xFFFFFF;
this.textFormats["tooltip"].font = "Samson";
this.textFormats["heightLine"] = new TextFormat();
this.textFormats["heightLine"].size = 14;
this.textFormats["heightLine"].color = 0xFFFFFF;
this.textFormats["heightLine"].font = "Samson";
this.textFormats["heightLine"].align = "right";
this.textFormats["heightLine"].bold = false;
this.textFormats["maxHeightLine"] = new TextFormat();
this.textFormats["maxHeightLine"].size = 14;
this.textFormats["maxHeightLine"].color = 0xFFFFFF;
this.textFormats["maxHeightLine"].font = "Samson";
this.textFormats["maxHeightLine"].align = "left";
this.textFormats["maxHeightLine"].bold = false;
this.textFormats["highScoreHeader"] = new TextFormat();
this.textFormats["highScoreHeader"].size = 16;
this.textFormats["highScoreHeader"].color = 0xFFFFFF;
this.textFormats["highScoreHeader"].font = "Samson";
this.textFormats["highScoreHeader"].align = "left";
this.textFormats["highScoreHeader"].bold = false;
this.textFormats["highScoreData"] = new TextFormat();
this.textFormats["highScoreData"].size = 14;
this.textFormats["highScoreData"].color = 0xFFFFFF;
this.textFormats["highScoreData"].font = "Samson";
this.textFormats["highScoreData"].align = "left";
this.textFormats["highScoreData"].bold = false;
this.textFormats["rank"] = new TextFormat();
this.textFormats["rank"].size = 16;
this.textFormats["rank"].color = 0xFFFFFF;
this.textFormats["rank"].font = "Samson";
this.textFormats["rank"].align = "right";
this.textFormats["rank"].bold = false;
this.textFormats["totalPlayers"] = new TextFormat();
this.textFormats["totalPlayers"].size = 16;
this.textFormats["totalPlayers"].color = 0xFFFFFF;
this.textFormats["totalPlayers"].font = "Samson";
this.textFormats["totalPlayers"].align = "left";
this.textFormats["totalPlayers"].bold = false;
this.textFormats["input"] = new TextFormat();
this.textFormats["input"].size = 20;
this.textFormats["input"].color = 0;
this.textFormats["input"].font = "Samson";
this.textFormats["input"].align = "left";
this.textFormats["input"].bold = false;
this.textFormats["blocksLeft"] = new TextFormat();
this.textFormats["blocksLeft"].size = 55;
this.textFormats["blocksLeft"].color = 0xFFFFFF;
this.textFormats["blocksLeft"].font = "LLPixel";
this.textFormats["blocksLeft"].align = "right";
this.textFormats["endScore"] = new TextFormat();
this.textFormats["endScore"].size = 40;
this.textFormats["endScore"].color = 0xFFFFFF;
this.textFormats["endScore"].font = "LLPixel";
this.textFormats["endScore"].align = "center";
this.filterSets = new Dictionary();
this.filterSets["shadowFilter"] = [new DropShadowFilter(5, 45, 0, 1, 2, 2)];
this.filterSets["glowFilter"] = [new GlowFilter(0xFFFFFF, 1, 20, 20, 1, 1, false, false)];
this.urls = new Dictionary();
}
public function toString():String{
return ("SettingsData");
}
public static function getInstance(_arg1:Object):SettingsData{
if ((_arg1 is wbSettingsManager)){
if (instance == null){
allowInstantiation = true;
instance = new (SettingsData);
allowInstantiation = false;
};
return (instance);
//unresolved jump
};
wbStateManager.getInstance().error(("Unauthorized call of settingsData.getInstance by: " + _arg1));
return (null);
}
}
}//package Game.Data
Section 169
//StateData (Game.Data.StateData)
package Game.Data {
import WBE.Managers.*;
import flash.utils.*;
import WBE.States.*;
import Game.States.*;
public class StateData {
public var states:Dictionary;
public var startState:String;// = "main"
private static var allowInstantiation:Boolean;
private static var instance:StateData;
public function StateData(){
var _local1:Array;
startState = "main";
super();
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use StateData.getInstance() instead of new."));
};
_local1 = [GameState, wbMenuState];
this.states = new Dictionary();
this.states["main"] = {type:"Menu", args:{id:"main"}, next:[["easy", "easy"], ["test", "test"], ["highScore", "highScore"]]};
this.states["easy"] = {type:"Game", args:{mode:"Play", difficulty:0}, next:[["back", "main"], ["reset", "easy"], ["gameover", "gameover"]]};
this.states["test"] = {type:"Game", args:{mode:"Test", difficulty:0}, next:[["back", "main"], ["gameover", "gameover"]]};
this.states["gameover"] = {type:"Menu", args:{id:"gameover"}, next:[["back", "main"], ["playAgain", "easy"]]};
this.states["highScore"] = {type:"Menu", args:{id:"highScore"}, next:[["back", "main"], ["playAgain", "easy"]]};
}
public function removeInstance():void{
}
public function toString():String{
return ("StateData");
}
public static function getInstance(_arg1:Object):StateData{
if ((_arg1 is wbStateManager)){
if (instance == null){
allowInstantiation = true;
instance = new (StateData);
allowInstantiation = false;
};
return (instance);
//unresolved jump
};
wbStateManager.getInstance().error(("Unauthorized call of StateData.getInstance by: " + _arg1));
return (null);
}
}
}//package Game.Data
Section 170
//VarData (Game.Data.VarData)
package Game.Data {
import WBE.Managers.*;
import flash.utils.*;
import com.kongregate.as3.client.*;
public class VarData {
public var vars:Dictionary;
public var forms:Dictionary;
public var varFunctions:Dictionary;
private static var allowInstantiation:Boolean;
private static var instance:VarData;
public function VarData(){
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use VarData.getInstance() instead of new."));
};
this.vars = new Dictionary();
this.vars["blocks"] = {value:0, type:int};
this.vars["maxHeight"] = {value:0, type:Number};
this.vars["curHeight"] = {value:0, type:Number};
this.vars["difficulty"] = {value:0, type:int};
this.vars["allBricksSaved"] = {value:true, type:Boolean};
this.vars["nextBlockID"] = {value:0, type:int};
this.vars["difficulty"] = {value:0, type:int};
this.vars["towerHeightIndex"] = {value:100, type:int};
this.vars["towerHeightMark0"] = {value:250, type:int};
this.vars["towerHeightMark1"] = {value:500, type:int};
this.vars["towerHeightMark2"] = {value:750, type:int};
this.vars["towerHeightMark3"] = {value:1000, type:int};
this.vars["bricksSavedIndex"] = {value:0, type:int};
this.vars["bricksSavedMark0"] = {value:33, type:int};
this.vars["bricksSavedMark1"] = {value:66, type:int};
this.vars["bricksSavedMark2"] = {value:99, type:int};
this.varFunctions = new Dictionary();
this.varFunctions["currentLevel"] = getCurrentLevel;
this.varFunctions["realCurHeight"] = getCurHeight;
this.varFunctions["realMaxHeight"] = getMaxHeight;
this.varFunctions["scoreMessage"] = getScoreMessage;
this.forms = new Dictionary();
this.forms["score"] = new Dictionary();
this.forms["score"]["name"] = "";
}
private function getScoreMessage():String{
var _local1:KongregateAPI;
_local1 = KongregateAPI.getInstance();
if (_local1.loaded){
if (_local1.user.getName().toLowerCase().indexOf("guest") == 0){
return ("Your score was not submitted, because you are not signed in. Sign in to submit your score the next time!");
};
return ((("Hello " + _local1.user.getName()) + "!<br> Your score has been submitted!"));
} else {
};
return (!NULL!);
}
private function getCurrentLevel():String{
return ((("" + wbVarManager.getInstance().getVar("levelNr")) + " / 10"));
}
private function getCurHeight():Number{
return ((roundToOneDigit((wbVarManager.getInstance().getVar("curHeight") / 20)) * 10));
}
private function getMaxHeight():Number{
return ((roundToOneDigit((wbVarManager.getInstance().getVar("maxHeight") / 20)) * 10));
}
private function roundToOneDigit(_arg1:Number):Number{
return ((Math.round((_arg1 * 10)) / 10));
}
public function removeInstance():void{
}
public static function getInstance(_arg1:Object):VarData{
if ((_arg1 is wbVarManager)){
if (instance == null){
allowInstantiation = true;
instance = new (VarData);
allowInstantiation = false;
};
return (instance);
//unresolved jump
};
wbStateManager.getInstance().error(("Unauthorized call of varData.getInstance by: " + _arg1));
return (null);
}
}
}//package Game.Data
Section 171
//Block (Game.GameWorld.Block)
package Game.GameWorld {
import flash.geom.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import WBE.GameWorld.*;
public class Block extends wbDynamicObject {
private var fallingSpeed:Number;// = 0.03
private var blockShapes2:Array;
private var prevProp:Object;
public var physicsObject;
private var static:Boolean;// = false
private var shapeID;
private var moveFactor;// = 0
private var noRotate;// = true
private var noMove;// = true
private var physicsScale:Number;// = 20
private var xMoveCounter:int;// = 0
private var blockType:int;// = 2
private var xMoveWait:int;// = 6
private var physicsWorld;
private var maxX:Number;// = 200
public var sensor;
private var prevChange;// = 0
private var nextX:Number;
private var nextY:Number;
private var blockShapes:Array;
public function Block(_arg1, _arg2, _arg3, _arg4, _arg5=0, _arg6:Boolean=true){
fallingSpeed = 0.03;
blockType = 2;
physicsScale = 20;
blockShapes = [[[-1, -0.5], [0, -0.5], [0, 0.5], [1, 0.5]], [[-1.5, 0], [-0.5, 0], [0.5, 0], [1.5, 0]], [[-1, 0.5], [0, 0.5], [0, -0.5], [1, -0.5]], [[-0.5, -0.5], [-0.5, 0.5], [0.5, -0.5], [0.5, 0.5]], [[-1, -0.5], [0, -0.5], [0, 0.5], [1, -0.5]], [[-1, -0.5], [0, -0.5], [1, -0.5], [1, 0.5]], [[-1, 0.5], [0, 0.5], [1, 0.5], [1, -0.5]]];
blockShapes2 = [[{w:2, h:1, x:-0.5, y:-0.5}, {w:2, h:1, x:0.5, y:0.5}], [{w:4, h:1, x:0, y:0}], [{w:2, h:1, x:0.5, y:-0.5}, {w:2, h:1, x:-0.5, y:0.5}], [{w:2, h:2, x:0, y:0}], [{w:3, h:1, x:0, y:-0.5}, {w:1, h:1, x:0, y:0.5}], [{w:3, h:1, x:0, y:-0.5}, {w:1, h:1, x:1, y:0.5}], [{w:3, h:1, x:0, y:0.5}, {w:1, h:1, x:1, y:-0.5}]];
noRotate = true;
noMove = true;
moveFactor = 0;
prevChange = 0;
static = false;
xMoveCounter = 0;
xMoveWait = 6;
maxX = 200;
this.id = ("block" + (_arg3 + 1));
super();
this.xPos = _arg1;
this.yPos = _arg2;
this.nextX = this.xPos;
this.nextY = this.yPos;
this.physicsWorld = _arg4;
this.shapeID = _arg3;
this.rotationZ = _arg5;
if (_arg6){
if (blockType == 1){
sensor = _arg4.createSensor2((_arg1 / physicsScale), (-(_arg2) / physicsScale), ((this.rotationZ * Math.PI) / 180), this.blockShapes[_arg3], this);
} else {
sensor = _arg4.createSensor((_arg1 / physicsScale), (-(_arg2) / physicsScale), ((this.rotationZ * Math.PI) / 180), this.blockShapes2[_arg3], this);
};
sensor.m_userData = this;
};
}
public function getRealHeight():Number{
return (-(this.getBounds(this.parent).top));
}
override public function toString():String{
return (("Block" + this.blockType));
}
public function getRealXbounds():Object{
var _local1:Rectangle;
_local1 = this.getBounds(this.parent);
return ({left:_local1.left, right:_local1.right});
}
override public function update():void{
if (this.physicsObject != null){
this.xPos = (this.physicsObject.GetPosition().x * physicsScale);
this.yPos = (-(this.physicsObject.GetPosition().y) * physicsScale);
this.rotationZ = ((this.physicsObject.GetAngle() / Math.PI) * 180);
} else {
this.sensor.SetLinearVelocity(new b2Vec2(0, 0));
this.nextY = (this.nextY - (this.fallingSpeed * physicsScale));
this.xPos = (this.sensor.GetPosition().x * physicsScale);
this.yPos = (-(this.sensor.GetPosition().y) * physicsScale);
this.sensor.SetXForm(new b2Vec2((this.nextX / physicsScale), (-(this.nextY) / physicsScale)), ((this.getRotation() * Math.PI) / 180));
};
}
public function convertToDynamic(){
if (this.static){
if (this.physicsObject.IsStatic()){
this.physicsObject.m_type = this.prevProp.m_type;
this.physicsObject.m_mass = this.prevProp.m_mass;
this.physicsObject.m_invMass = this.prevProp.m_invMass;
this.physicsObject.m_I = this.prevProp.m_I;
this.physicsObject.m_invI = this.prevProp.m_invI;
};
if (this.physicsObject.IsDynamic()){
this.static = false;
};
};
}
public function convertToPhysics(){
if (this.sensor != null){
if (blockType == 1){
this.setPhysicsObject(physicsWorld.createBlock2(sensor.GetPosition().x, sensor.GetPosition().y, sensor.GetAngle(), this.blockShapes[shapeID], this));
} else {
this.setPhysicsObject(physicsWorld.createBlock(sensor.GetPosition().x, sensor.GetPosition().y, sensor.GetAngle(), this.blockShapes2[shapeID], this));
};
this.physicsWorld.m_world.DestroyBody(this.sensor);
this.sensor = null;
};
}
public function isStable():Boolean{
if (this.physicsObject == null){
if (this.sensor.GetLinearVelocity().Length() < 0.1){
return (true);
};
return (false);
} else {
//unresolved if
};
return (!NULL!);
return (false);
}
public function setPhysicsObject(_arg1){
this.physicsObject = _arg1;
this.physicsObject.m_userData = this;
}
public function setStatic(){
this.prevProp = new Object();
this.prevProp.m_type = this.physicsObject.m_type;
this.prevProp.m_mass = this.physicsObject.m_mass;
this.prevProp.m_invMass = this.physicsObject.m_invMass;
this.prevProp.m_I = this.physicsObject.m_I;
this.prevProp.m_invI = this.physicsObject.m_invI;
this.physicsObject.m_type = b2Body.e_staticType;
this.physicsObject.m_mass = 0;
this.physicsObject.m_invMass = 0;
this.physicsObject.m_I = 0;
this.physicsObject.m_invI = 0;
}
public function convertToStatic(){
if (!this.static){
if (this.isStable()){
if (!this.physicsObject.IsStatic()){
this.setStatic();
};
};
if (this.physicsObject.IsStatic()){
this.prevProp.colorT = this.mc.transform.colorTransform;
this.static = true;
};
};
}
public function move(_arg1){
var _local2:*;
var _local3:*;
_local2 = (-(_arg1[0]) + _arg1[2]);
if (prevChange != _local2){
xMoveCounter = 0;
this.nextX = (this.nextX + ((0.5 * _local2) * physicsScale));
} else {
xMoveCounter++;
if ((((xMoveCounter >= xMoveWait)) && (((xMoveCounter % 2) == 0)))){
this.nextX = (this.nextX + ((0.5 * _local2) * physicsScale));
};
};
prevChange = _local2;
if (this.nextX > this.maxX){
this.nextX = this.maxX;
} else {
if (this.nextX < -(this.maxX)){
this.nextX = -(this.maxX);
};
};
if (moveFactor > 1){
moveFactor = 1;
};
this.nextY = (this.nextY - ((0.4 * _arg1[3]) * physicsScale));
if (_arg1[1] == 0){
this.noRotate = true;
} else {
if (this.noRotate){
_local3 = this.getRotation();
_local3 = (_local3 + 90);
if (_local3 >= 360){
_local3 = 0;
};
this.setRotation(_local3);
this.noRotate = false;
};
};
}
}
}//package Game.GameWorld
Section 172
//ContactListener (Game.GameWorld.ContactListener)
package Game.GameWorld {
import WBE.Managers.*;
import Box2D.Collision.*;
import Box2D.Dynamics.*;
import Game.Modes.*;
public class ContactListener extends b2ContactListener {
override public function Persist(_arg1:b2ContactPoint):void{
}
override public function Add(_arg1:b2ContactPoint):void{
PlayMode(wbStateManager.getGameState().getCurrentMode()).contactAdd(_arg1.shape1.m_body, _arg1.shape2.m_body);
}
override public function Remove(_arg1:b2ContactPoint):void{
}
}
}//package Game.GameWorld
Section 173
//LevelControl (Game.GameWorld.LevelControl)
package Game.GameWorld {
public class LevelControl {
private static var allowInstantiation:Boolean;
private static var instance:LevelControl;
public function LevelControl(){
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use LevelControl.getInstance() instead of new."));
};
}
public function init():void{
}
public function removeInstance():void{
instance = null;
allowInstantiation = true;
}
public function toString():String{
return ("LevelControl");
}
public function step():void{
}
public static function getInstance():LevelControl{
if (instance == null){
allowInstantiation = true;
instance = new (LevelControl);
allowInstantiation = false;
};
return (instance);
}
}
}//package Game.GameWorld
Section 174
//PhysicsWorld (Game.GameWorld.PhysicsWorld)
package Game.GameWorld {
import flash.display.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class PhysicsWorld extends Sprite {
public var m_physScale:Number;// = 20
private var floor;
private var bottom;
private var blockSize;// = 10
public var m_iterations:int;// = 10
public var m_world:b2World;
private var blockRestitution;// = 0
private var blockFriction;// = 0.5
public var m_timeStep:Number;// = 0.0333333333333333
public var m_sprite:Sprite;
public function PhysicsWorld(){
var _local1:b2AABB;
var _local2:b2Vec2;
var _local3:Boolean;
var _local4:b2PolygonDef;
var _local5:b2BodyDef;
var _local6:b2Body;
m_iterations = 10;
m_timeStep = (1 / 30);
m_physScale = 20;
blockSize = 10;
blockFriction = 0.5;
blockRestitution = 0;
super();
m_sprite = new Sprite();
addChild(m_sprite);
_local1 = new b2AABB();
_local1.lowerBound.Set(-100, -400);
_local1.upperBound.Set(100, 50);
_local2 = new b2Vec2(0, 9.8);
_local3 = false;
m_world = new b2World(_local1, _local2, _local3);
m_world.SetContactListener(new ContactListener());
_local4 = new b2PolygonDef();
_local5 = new b2BodyDef();
_local4.SetAsBox(((160 / m_physScale) / 2), (20 / m_physScale));
_local5.position.Set(((0 / m_physScale) / 2), (20 / m_physScale));
_local6 = m_world.CreateBody(_local5);
_local6.CreateShape(_local4);
_local6.SetMassFromShapes();
this.bottom = _local6;
this.bottom.m_userData = "bottom";
_local4.SetAsBox(((4000 / m_physScale) / 2), (20 / m_physScale));
_local5.position.Set(((0 / m_physScale) / 2), (100 / m_physScale));
_local6 = m_world.CreateBody(_local5);
_local6.CreateShape(_local4);
_local6.SetMassFromShapes();
this.floor = _local6;
this.floor.m_userData = "floor";
}
public function createSensor2(_arg1, _arg2, _arg3, _arg4, _arg5){
var _local6:b2BodyDef;
var _local7:b2Body;
var _local8:b2PolygonDef;
var _local9:b2PolygonDef;
var _local10:b2PolygonDef;
var _local11:b2PolygonDef;
var _local12:*;
var _local13:*;
var _local14:Number;
_local6 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local9 = new b2PolygonDef();
_local10 = new b2PolygonDef();
_local11 = new b2PolygonDef();
_local12 = 0.1;
_local13 = 0;
_local14 = 2;
_local8.density = _local12;
_local8.friction = blockFriction;
_local8.restitution = _local13;
_local8.isSensor = true;
_local8.SetAsOrientedBox(((blockSize - _local14) / m_physScale), ((blockSize - _local14) / m_physScale), new b2Vec2((((_arg4[0][0] * blockSize) * 2) / m_physScale), (((_arg4[0][1] * blockSize) * 2) / m_physScale)));
_local9.density = _local12;
_local9.friction = blockFriction;
_local9.restitution = _local13;
_local9.isSensor = true;
_local9.SetAsOrientedBox(((blockSize - _local14) / m_physScale), ((blockSize - _local14) / m_physScale), new b2Vec2((((_arg4[1][0] * blockSize) * 2) / m_physScale), (((_arg4[1][1] * blockSize) * 2) / m_physScale)));
_local10.density = _local12;
_local10.friction = blockFriction;
_local10.restitution = _local13;
_local10.isSensor = true;
_local10.SetAsOrientedBox(((blockSize - _local14) / m_physScale), ((blockSize - _local14) / m_physScale), new b2Vec2((((_arg4[2][0] * blockSize) * 2) / m_physScale), (((_arg4[2][1] * blockSize) * 2) / m_physScale)));
_local11.density = _local12;
_local11.friction = blockFriction;
_local11.restitution = _local13;
_local11.isSensor = true;
_local11.SetAsOrientedBox(((blockSize - _local14) / m_physScale), ((blockSize - _local14) / m_physScale), new b2Vec2((((_arg4[3][0] * blockSize) * 2) / m_physScale), (((_arg4[3][1] * blockSize) * 2) / m_physScale)));
_local6.position.Set(_arg1, _arg2);
_local6.angle = _arg3;
_local6.userData = _arg5;
_local7 = m_world.CreateBody(_local6);
_local7.CreateShape(_local8);
_local7.CreateShape(_local9);
_local7.CreateShape(_local10);
_local7.CreateShape(_local11);
return (_local7);
}
public function createBlock2(_arg1, _arg2, _arg3, _arg4, _arg5){
var _local6:b2BodyDef;
var _local7:b2Body;
var _local8:b2PolygonDef;
var _local9:b2PolygonDef;
var _local10:b2PolygonDef;
var _local11:b2PolygonDef;
_local6 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local9 = new b2PolygonDef();
_local10 = new b2PolygonDef();
_local11 = new b2PolygonDef();
_local8.density = computeDensity((((_arg4[0][1] * blockSize) * 2) / m_physScale));
_local8.friction = blockFriction;
_local8.restitution = blockRestitution;
_local8.SetAsOrientedBox((blockSize / m_physScale), (blockSize / m_physScale), new b2Vec2((((_arg4[0][0] * blockSize) * 2) / m_physScale), (((_arg4[0][1] * blockSize) * 2) / m_physScale)));
_local9.density = computeDensity((((_arg4[1][1] * blockSize) * 2) / m_physScale));
_local9.friction = blockFriction;
_local9.restitution = blockRestitution;
_local9.SetAsOrientedBox((blockSize / m_physScale), (blockSize / m_physScale), new b2Vec2((((_arg4[1][0] * blockSize) * 2) / m_physScale), (((_arg4[1][1] * blockSize) * 2) / m_physScale)));
_local10.density = computeDensity((((_arg4[2][1] * blockSize) * 2) / m_physScale));
_local10.friction = blockFriction;
_local10.restitution = blockRestitution;
_local10.SetAsOrientedBox((blockSize / m_physScale), (blockSize / m_physScale), new b2Vec2((((_arg4[2][0] * blockSize) * 2) / m_physScale), (((_arg4[2][1] * blockSize) * 2) / m_physScale)));
_local11.density = computeDensity((((_arg4[3][1] * blockSize) * 2) / m_physScale));
_local11.friction = blockFriction;
_local11.restitution = blockRestitution;
_local11.SetAsOrientedBox((blockSize / m_physScale), (blockSize / m_physScale), new b2Vec2((((_arg4[3][0] * blockSize) * 2) / m_physScale), (((_arg4[3][1] * blockSize) * 2) / m_physScale)));
_local6.position.Set(_arg1, _arg2);
_local6.angle = _arg3;
_local6.userData = _arg5;
_local7 = m_world.CreateBody(_local6);
_local7.CreateShape(_local8);
_local7.CreateShape(_local9);
_local7.CreateShape(_local10);
_local7.CreateShape(_local11);
_local7.SetMassFromShapes();
return (_local7);
}
private function computeDensity(_arg1){
var _local2:*;
_local2 = 0.5;
return (_local2);
}
public function step():void{
m_world.Step(m_timeStep, m_iterations);
}
public function createSensor(_arg1, _arg2, _arg3, _arg4, _arg5){
var _local6:b2BodyDef;
var _local7:b2Body;
var _local8:*;
var _local9:*;
var _local10:Number;
var _local11:Array;
var _local12:b2PolygonDef;
var _local13:int;
_local6 = new b2BodyDef();
_local8 = 1;
_local9 = 0;
_local10 = 2;
_local11 = new Array();
_local13 = 0;
while (_local13 < _arg4.length) {
_local12 = new b2PolygonDef();
_local12.density = _local8;
_local12.SetAsOrientedBox((((_arg4[_local13].w * blockSize) - _local10) / m_physScale), (((_arg4[_local13].h * blockSize) - _local10) / m_physScale), new b2Vec2((((_arg4[_local13].x * blockSize) * 2) / m_physScale), (((_arg4[_local13].y * blockSize) * 2) / m_physScale)));
_local11.push(_local12);
_local13++;
};
_local6.position.Set(_arg1, _arg2);
_local6.angle = _arg3;
_local6.userData = _arg5;
_local7 = m_world.CreateBody(_local6);
_local13 = 0;
while (_local13 < _local11.length) {
_local7.CreateShape(_local11[_local13]);
_local13++;
};
_local7.SetMassFromShapes();
return (_local7);
}
public function createBlock(_arg1, _arg2, _arg3, _arg4, _arg5){
var _local6:b2BodyDef;
var _local7:b2Body;
var _local8:b2PolygonDef;
var _local9:b2PolygonDef;
var _local10:b2PolygonDef;
var _local11:b2PolygonDef;
var _local12:Array;
var _local13:*;
var _local14:b2PolygonDef;
var _local15:int;
_local6 = new b2BodyDef();
_local8 = new b2PolygonDef();
_local9 = new b2PolygonDef();
_local10 = new b2PolygonDef();
_local11 = new b2PolygonDef();
_local12 = new Array();
_local13 = 0.5;
_local15 = 0;
while (_local15 < _arg4.length) {
_local14 = new b2PolygonDef();
_local14.density = _local13;
_local14.friction = blockFriction;
_local14.restitution = blockRestitution;
_local14.SetAsOrientedBox(((_arg4[_local15].w * blockSize) / m_physScale), ((_arg4[_local15].h * blockSize) / m_physScale), new b2Vec2((((_arg4[_local15].x * blockSize) * 2) / m_physScale), (((_arg4[_local15].y * blockSize) * 2) / m_physScale)));
_local12.push(_local14);
_local15++;
};
_local6.position.Set(_arg1, _arg2);
_local6.angle = _arg3;
_local6.userData = _arg5;
_local7 = m_world.CreateBody(_local6);
_local15 = 0;
while (_local15 < _local12.length) {
_local7.CreateShape(_local12[_local15]);
_local15++;
};
_local7.SetMassFromShapes();
return (_local7);
}
}
}//package Game.GameWorld
Section 175
//Player (Game.GameWorld.Player)
package Game.GameWorld {
import flash.display.*;
import WBE.GameWorld.*;
import WBE.Cameras.*;
public class Player extends wbGameObject {
private var camera:wbPlayerCam;
private var keysDown:Array;
private static var allowInstantiation:Boolean;
private static var instance:Player;
public function Player():void{
this.id = "player";
super();
this.xPos = 0;
this.yPos = 0;
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use Player.getInstance() instead of new."));
};
this.camera = wbPlayerCam.getInstance();
}
public function init():void{
if (shadowMC != null){
World.getInstance().addShadow(this);
};
}
override public function collide(_arg1:MovieClip):void{
}
public function removeInstance():void{
instance = null;
allowInstantiation = true;
}
override public function toString():String{
return ("Player");
}
public function changeAnimation(_arg1:String, _arg2:Boolean=false):void{
if (((_arg2) || (!((this.getMC().currentLabel == _arg1))))){
this.getMC().gotoAndPlay(_arg1);
};
}
override public function update():void{
}
public static function getInstance():Player{
if (instance == null){
allowInstantiation = true;
instance = new (Player);
allowInstantiation = false;
};
return (instance);
}
}
}//package Game.GameWorld
Section 176
//World (Game.GameWorld.World)
package Game.GameWorld {
import flash.display.*;
import WBE.Managers.*;
import WBE.GameWorld.*;
import WBE.Cameras.*;
public class World extends wbWorld {
public var gridMC:MovieClip;
private static var allowInstantiation:Boolean;
private static var instance:World;
public function World(){
super(this);
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use World.getInstance() instead of new."));
};
}
override public function init():void{
var _local1:*;
super.init();
wbPlayerCam.getInstance().getStaticBackgroundLayer().addChild(wbAssetManager.getInstance().getGraphics("mainBG"));
for (_local1 in this.backgroundList) {
if (this.backgroundList[_local1].id == "grid"){
this.gridMC = _local1;
break;
};
};
}
public function removeInstance():void{
instance = null;
allowInstantiation = true;
super.removeWorld();
}
override public function toString():String{
return ("World");
}
override public function step():void{
super.step();
this.gridMC.height = (wbSettingsManager.getInstance().getWorldSettings("height") / wbPlayerCam.getInstance().zToScale(wbPlayerCam.getInstance().getZ()));
}
public static function getInstance():World{
if (instance == null){
allowInstantiation = true;
instance = new (World);
allowInstantiation = false;
};
return (instance);
}
}
}//package Game.GameWorld
Section 177
//Mode (Game.Modes.Mode)
package Game.Modes {
import WBE.Managers.*;
import Game.GameWorld.*;
import WBE.Modes.*;
public class Mode extends wbMode {
protected var level:LevelControl;
public function Mode(_arg1:Object):void{
super(_arg1);
this.level = LevelControl.getInstance();
wbVarManager.getInstance().setVar("difficulty", _arg1.difficulty);
}
override public function remove():void{
super.remove();
}
}
}//package Game.Modes
Section 178
//PlayMode (Game.Modes.PlayMode)
package Game.Modes {
import flash.events.*;
import flash.display.*;
import WBE.Managers.*;
import flash.utils.*;
import caurina.transitions.*;
import Game.GameWorld.*;
import com.kongregate.as3.client.*;
import WBE.UI.*;
import WBE.Cameras.*;
import flash.filters.*;
public class PlayMode extends Mode {
protected var maxBlocks:int;// = 99
protected var curZoomLevel:int;// = 0
private var _discardAnimationGuide:Number;
protected var nextBlockToCome:Block;
protected var cameraPanY:Number;// = 10
protected var camera:wbPlayerCam;
protected var minBrickX:Number;// = 1000
protected var currHighestBlockY:Number;// = 0
protected var towerWidthTarget:int;// = 160
protected var highestBlockY:Number;// = 0
protected var doNextBlock:Boolean;// = false
protected var messageArea:MovieClip;
protected var topSpacing:Number;
protected var startY;// = -30
protected var discardHintGiven:Boolean;// = false
protected var bricksTouchedTowerCounter:Number;// = 0
protected var towerWidthTargetReached:Boolean;// = false
private var _dropAnimationGuide:Number;
protected var highestY:Number;// = 0
protected var glowingBlock:Block;
private var glowFilter:GlowFilter;
protected var discardingBlock:Block;
protected var blocksToRemove:Array;
protected var blocks:Dictionary;
protected var ground:MovieClip;
protected var platformHeight:Number;// = 20
protected var cameraMoved:Boolean;// = false
protected var physicsWorld;
protected var currentBlock:Block;
protected var world:World;
private var discardGlowFilter:GlowFilter;
protected var submitHintScoreDiff:Number;// = 100
protected var maxBrickX:Number;// = -1000
protected var allowZoom:Boolean;
protected var firstBlock:Boolean;// = true
protected var zoomFrameNr:int;
protected var minSpawnHeight:Number;
protected var cameraZ:Number;// = 10000
protected var line:MovieClip;
protected var submitHintGiven:Boolean;// = false
public function PlayMode(_arg1:Object):void{
var _local2:*;
towerWidthTarget = 160;
towerWidthTargetReached = false;
bricksTouchedTowerCounter = 0;
minBrickX = 1000;
maxBrickX = -1000;
maxBlocks = 99;
cameraPanY = 10;
cameraZ = 10000;
platformHeight = 20;
submitHintScoreDiff = 100;
camera = wbPlayerCam.getInstance();
curZoomLevel = 0;
minSpawnHeight = (wbSettingsManager.getInstance().getWorldSettings("height") + 20);
topSpacing = (wbSettingsManager.getInstance().getWorldSettings("height") / 2);
startY = -30;
highestY = 0;
highestBlockY = 0;
currHighestBlockY = 0;
doNextBlock = false;
firstBlock = true;
submitHintGiven = false;
discardHintGiven = false;
cameraMoved = false;
super(_arg1);
this.world = World.getInstance();
this.level.init();
this.ground = MovieClip(wbAssetManager.getInstance().getGraphics("ground"));
this.world.addChild(ground);
this.ground.y = 0;
_local2 = (1 / camera.zToScale(this.cameraZ));
this.allowZoom = true;
wbVarManager.getInstance().setVar("curHeight", 0);
wbVarManager.getInstance().setVar("maxHeight", 0);
wbVarManager.getInstance().setVar("allBricksSaved", true);
wbVarManager.getInstance().setVar("towerHeightIndex", 0);
wbVarManager.getInstance().setVar("bricksSavedIndex", 0);
wbVarManager.getInstance().setVar("blocks", 99);
this.physicsWorld = new PhysicsWorld();
this.world.addChild(this.physicsWorld);
this.blocks = new Dictionary();
this.messageArea = world.getBackgroundByBackgroundID("messageArea");
this.messageArea.textMC.textField.selectable = false;
camera.setZ(this.cameraZ);
this.setCamera(false);
this.stepFunctions["play"] = {func:playStep, type:"loop", next:"initZoom"};
this.stepFunctions["initZoom"] = {func:initZoom, type:"single", next:"zoom"};
this.stepFunctions["zoom"] = {func:zoomStep, type:"loop", next:"end"};
this.stepFunctions["end"] = {func:endMode, type:"stop", next:"end"};
this.currentStep = "play";
this.blocksToRemove = new Array();
wbDebugManager.getInstance().startMeasuring();
wbVarManager.getInstance().setVar("nextBlockID", Math.floor((wbVarManager.random() * 7)));
wbAudioManager.getInstance().playBGM("bgm");
setGameMessage("build the highest tower!", 210, true);
}
protected function initZoom(){
var _local1:wbInterface;
_local1 = wbInterface.getInstance();
_local1.hideItem("zoom");
this.allowZoom = false;
this.curZoomLevel = 1;
this.setCamera(true, 200);
this.zoomFrameNr = wbVarManager.getInstance().getVar("frameNr");
}
public function requestAddBlock(){
if (wbVarManager.getInstance().getVar("blocks") > 0){
checkBlockMessage();
this.addBlock();
} else {
this.currentBlock = null;
this.determineHighestY();
this.checkHeight();
this.nextPhase();
};
}
public function get discardAnimationGuide():Number{
return (_discardAnimationGuide);
}
protected function playStep():void{
var _local1:int;
if (this.firstBlock){
this.firstBlock = false;
this.addBlock();
};
if (wbVarManager.getInstance().getVar("blocks") >= 0){
this.currentBlock.update();
};
this.determineHighestY();
this.setCamera();
this.checkHeight();
statsCheckTowerHeight();
this.physicsWorld.step();
if (this.doNextBlock){
this.doNextBlock = false;
this.nextBlock();
};
_local1 = 0;
while (_local1 < this.blocksToRemove.length) {
this.blockHitBottom(this.blocksToRemove[_local1]);
_local1++;
};
blocksToRemove = new Array();
}
public function set discardAnimationGuide(_arg1:Number):void{
this._discardAnimationGuide = _arg1;
this.discardGlowFilter.blurX = (this._discardAnimationGuide * 100);
this.discardGlowFilter.alpha = (1 - _arg1);
this.discardingBlock.filters = [this.discardGlowFilter];
this.discardingBlock.alpha = (1 - _arg1);
}
public function endMode():void{
var _local1:KongregateAPI;
wbStateManager.getInstance().closeGameMenu();
_local1 = KongregateAPI.getInstance();
if (((_local1.loaded) && (!((_local1.user.getName() == "Guest"))))){
_local1.scores.submit(wbVarManager.getInstance().getVar("realMaxHeight"));
};
wbDebugManager.getInstance().stopMeasuring();
wbStateManager.getGameState().requestExit("gameover");
}
protected function setCamera(_arg1:Boolean=true, _arg2:Number=20):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
if (this.curZoomLevel == 1){
_local7 = (1.6 * (highestY + this.platformHeight));
_local8 = (wbSettingsManager.getInstance().getWorldSettings("height") / _local7);
_local9 = this.camera.scaleToZ(_local8);
if (_local9 < (this.cameraZ * 1.1)){
_local9 = (this.cameraZ * 1.1);
};
_local3 = _local9;
} else {
_local3 = this.cameraZ;
};
if (_arg1){
camera.moveToZ(_local3, _arg2);
} else {
camera.setZ(_local3);
};
_local4 = camera.zToScale(_local3);
_local5 = (((wbSettingsManager.getInstance().getWorldSettings("height") / 2) - this.platformHeight) / _local4);
if (this.curZoomLevel == 1){
_local6 = _local5;
} else {
_local10 = ((highestY + (wbSettingsManager.getInstance().getWorldSettings("height") / 2)) - this.topSpacing);
if (_local10 > _local5){
_local6 = _local10;
} else {
_local6 = _local5;
};
if (((!(this.cameraMoved)) && ((_local6 > _local5)))){
this.cameraMoved = true;
setGameMessage("Hold the 'z' key to zoom out.");
};
};
if (_arg1){
camera.moveToY(_local6, _arg2);
} else {
camera.setY(_local6);
};
this.updateMessageArea();
}
private function endZoom(_arg1:Event):void{
wbStateManager.getInstance().stage.removeEventListener(MouseEvent.MOUSE_UP, endZoom);
wbStateManager.getInstance().stage.removeEventListener(KeyboardEvent.KEY_DOWN, endZoom);
this.nextPhase();
}
protected function checkHeight(){
wbVarManager.getInstance().setVar("curHeight", Math.floor(highestY));
if (highestY > wbVarManager.getInstance().getVar("maxHeight")){
wbVarManager.getInstance().setVar("maxHeight", Math.floor(highestY));
};
if (!this.submitHintGiven){
if (wbVarManager.getInstance().getVar("realCurHeight") < (wbVarManager.getInstance().getVar("realMaxHeight") - this.submitHintScoreDiff)){
this.setGameMessage("You can submit your score from the pause menu ('p' key)");
this.submitHintGiven = true;
};
};
}
public function nextLevel(){
}
private function removeSelectGlow(){
}
protected function zoomStep():void{
if ((this.zoomFrameNr + 40) == wbVarManager.getInstance().getVar("frameNr")){
setGameMessage("Your tower is complete!\nBask in its glory.\n\nPress any key to continue.", -1);
wbStateManager.getInstance().stage.addEventListener(MouseEvent.MOUSE_UP, endZoom);
wbStateManager.getInstance().stage.addEventListener(KeyboardEvent.KEY_UP, endZoom);
};
this.updateMessageArea();
}
public function nextBlock():void{
wbVarManager.getInstance().addToVar("blocks", -1);
if (this.currentBlock != null){
this.playMaterializeAnimation();
this.bricksTouchedTowerCounter++;
this.currentBlock.convertToPhysics();
statsCheckAllBricksSaved();
};
requestAddBlock();
}
public function set dropAnimationGuide(_arg1:Number):void{
this._dropAnimationGuide = _arg1;
this.glowFilter.blurX = (this._dropAnimationGuide * 100);
this.glowFilter.alpha = (1 - _arg1);
this.glowingBlock.filters = [this.glowFilter];
}
public function contactAdd(_arg1, _arg2):void{
if (_arg1.m_userData == "floor"){
this.blocksToRemove.push(_arg2.m_userData);
} else {
if (_arg2.m_userData == "floor"){
this.blocksToRemove.push(_arg2.m_userData);
} else {
if ((((_arg1.m_userData == this.currentBlock)) || ((_arg2.m_userData == this.currentBlock)))){
this.doNextBlock = true;
};
};
};
}
protected function addBlock(){
var _local1:*;
var _local2:*;
this.currentBlock = null;
this.determineHighestY();
_local1 = (highestY + this.topSpacing);
if (_local1 < this.minSpawnHeight){
_local1 = this.minSpawnHeight;
};
this.currentBlock = new Block(0, _local1, wbVarManager.getInstance().getVar("nextBlockID"), this.physicsWorld);
this.blocks[this.currentBlock] = 0;
world.addStaticObject(this.currentBlock, 1);
_local2 = wbInterface.getInstance();
if (nextBlockToCome != null){
_local2.removeChild(nextBlockToCome);
};
if (wbVarManager.getInstance().getVar("blocks") > 1){
wbVarManager.getInstance().setVar("nextBlockID", Math.floor((wbVarManager.random() * 7)));
this.nextBlockToCome = new Block(0, 0, wbVarManager.getInstance().getVar("nextBlockID"), this.physicsWorld, 0, false);
this.nextBlockToCome.x = 350;
this.nextBlockToCome.y = 50;
_local2.addChild(this.nextBlockToCome);
};
}
protected function statsCheckTowerHeight(){
var _local1:*;
var _local2:KongregateAPI;
if (wbVarManager.getInstance().getVar("towerHeightIndex") >= 5){
return;
};
_local1 = wbVarManager.getInstance().getVar("realCurHeight");
_local2 = KongregateAPI.getInstance();
if (_local1 >= wbVarManager.getInstance().getVar(("towerHeightMark" + wbVarManager.getInstance().getVar("towerHeightIndex")))){
_local2.stats.submit(("height" + wbVarManager.getInstance().getVar(("towerHeightMark" + wbVarManager.getInstance().getVar("towerHeightIndex")))), 1);
wbVarManager.getInstance().addToVar("towerHeightIndex", 1);
statsCheckTowerHeight();
};
}
public function discardBlock(){
if (this.currentStep == "play"){
wbVarManager.getInstance().setVar("allBricksSaved", false);
wbVarManager.getInstance().addToVar("blocks", -1);
if (this.currentBlock != null){
this.physicsWorld.m_world.DestroyBody(this.currentBlock.sensor);
if (this.discardingBlock != null){
this.world.removeStaticObject(this.discardingBlock);
};
playDiscardAnimation(this.currentBlock);
delete this.blocks[this.currentBlock];
};
requestAddBlock();
};
}
public function blockHitBottom(_arg1){
var _local2:Number;
if (this.blocks[_arg1] != null){
_local2 = (Math.floor((wbVarManager.random() * 3)) + 1);
wbAudioManager.getInstance().playSound(("crashSound" + _local2));
if (_arg1 == this.currentBlock){
this.currentBlock = null;
this.nextBlock();
};
if (_arg1.sensor != null){
this.physicsWorld.m_world.DestroyBody(_arg1.sensor);
if (!this.discardHintGiven){
this.setGameMessage("Press the 'c' key to discard a block.");
this.discardHintGiven = true;
};
} else {
this.physicsWorld.m_world.DestroyBody(_arg1.physicsObject);
};
this.world.removeStaticObject(_arg1);
delete this.blocks[_arg1];
wbVarManager.getInstance().setVar("allBricksSaved", false);
};
}
private function playMaterializeAnimation(){
this.glowingBlock = this.currentBlock;
this.glowFilter = new GlowFilter(0xFFFFFF, 2, 10, 10, 2, 1);
this.glowingBlock.filters = [this.glowFilter];
_dropAnimationGuide = 0;
Tweener.addTween(this, {dropAnimationGuide:1, time:15, useFrames:true, transition:"easeOutExpo", onComplete:function ():void{
this.glowingBlock.filters = [];
}});
wbAudioManager.getInstance().playSound("dropSound");
}
protected function newStatisticsCreated():void{
}
private function hideMessageArea(_arg1:Number=0):void{
var msgArea:*;
var delay = _arg1;
if (delay > 0){
msgArea = this.messageArea;
Tweener.addTween(this.messageArea.textMC, {x:-300, time:30, delay:delay, useFrames:true, transition:"easeInExpo", onComplete:function ():void{
msgArea.visible = false;
}});
};
}
public function get dropAnimationGuide():Number{
return (_dropAnimationGuide);
}
protected function determineHighestY():void{
var _local1:Number;
var _local2:*;
var _local3:*;
this.highestY = 0;
this.highestBlockY = 0;
for (_local2 in blocks) {
if (_local2 != currentBlock){
var _local6 = blocks;
var _local7 = _local2;
var _local8 = (_local6[_local7] + 1);
_local6[_local7] = _local8;
_local1 = _local2.getRealHeight();
if (_local1 > highestY){
highestY = _local1;
};
_local3 = _local2.getRealXbounds();
if (_local3.left < this.minBrickX){
this.minBrickX = _local3.left;
};
if (_local3.right > this.maxBrickX){
this.maxBrickX = _local3.right;
};
};
highestBlockY = highestY;
if (currentBlock != null){
_local1 = this.currentBlock.getRealHeight();
if (_local1 > highestBlockY){
highestBlockY = _local1;
};
};
};
}
protected function updateMessageArea(){
this.messageArea.scaleX = (this.messageArea.scaleY = (1 / this.camera.zToScale(this.camera.getZ())));
}
protected function statsCheckTowerWidth(){
var _local1:Number;
var _local2:KongregateAPI;
if (this.towerWidthTargetReached){
return;
};
_local1 = ((this.maxBrickX - this.minBrickX) / 2);
_local2 = KongregateAPI.getInstance();
if (_local1 >= this.towerWidthTarget){
towerWidthTargetReached = true;
};
}
public function zoom(_arg1:int):void{
if (this.allowZoom){
this.curZoomLevel = _arg1;
this.setCamera();
};
}
public function move(_arg1){
if (this.currentBlock != null){
this.currentBlock.move(_arg1);
};
}
private function playDiscardAnimation(_arg1:Block){
var discardBlock = _arg1;
this.discardingBlock = discardBlock;
this.discardGlowFilter = new GlowFilter(0xFFFFFF, 2, 10, 10, 2, 1);
this.discardingBlock.filters = [this.discardGlowFilter];
_discardAnimationGuide = 0;
Tweener.addTween(this, {discardAnimationGuide:1, time:15, useFrames:true, transition:"easeOutExpo", onComplete:function ():void{
this.discardingBlock.filters = [];
this.world.removeStaticObject(this.discardingBlock);
this.discardingBlock = null;
}});
wbAudioManager.getInstance().playSound("popSound");
}
private function checkBlockMessage(){
var _local1:Number;
_local1 = wbVarManager.getInstance().getVar("blocks");
if ((((((_local1 == 10)) || ((_local1 == 25)))) || ((_local1 == 50)))){
setGameMessage((_local1 + " bricks left..."), 90);
};
}
private function setGameMessage(_arg1:String, _arg2:Number=210, _arg3:Boolean=false){
this.messageArea.textMC.textField.text = _arg1;
Tweener.removeTweens(this.messageArea.textMC);
showMessageArea(_arg3);
hideMessageArea(_arg2);
}
private function showMessageArea(_arg1:Boolean):void{
this.messageArea.visible = true;
if (!_arg1){
wbAudioManager.getInstance().playSound("message");
this.messageArea.textMC.x = -300;
Tweener.addTween(this.messageArea.textMC, {x:0, time:30, useFrames:true, transition:"easeOutExpo"});
} else {
this.messageArea.textMC.x = 0;
};
}
protected function statsCheckAllBricksSaved(){
var _local1:KongregateAPI;
if (!wbVarManager.getInstance().getVar("allBricksSaved")){
return;
};
if (wbVarManager.getInstance().getVar("bricksSavedIndex") >= 3){
return;
};
_local1 = KongregateAPI.getInstance();
if (this.bricksTouchedTowerCounter >= wbVarManager.getInstance().getVar(("bricksSavedMark" + wbVarManager.getInstance().getVar("bricksSavedIndex")))){
_local1.stats.submit(("towerof" + wbVarManager.getInstance().getVar(("bricksSavedMark" + wbVarManager.getInstance().getVar("bricksSavedIndex")))), 1);
wbVarManager.getInstance().addToVar("bricksSavedIndex", 1);
statsCheckAllBricksSaved();
};
}
}
}//package Game.Modes
Section 179
//TestMode (Game.Modes.TestMode)
package Game.Modes {
import WBE.Managers.*;
import Game.GameWorld.*;
public class TestMode extends PlayMode {
private var towerI;// = 0
public function TestMode(_arg1:Object):void{
towerI = 0;
super(_arg1);
this.cameraZ = 30000;
this.maxBlocks = 10;
this.curZoomLevel = 1;
this.setCamera(false);
wbVarManager.getInstance().setVar("blocks", 0);
}
override protected function playStep():void{
this.determineHighestY();
this.checkHeight();
this.physicsWorld.step();
}
public function buildTower(){
var _local1:*;
var _local2:*;
var _local3:Number;
var _local4:*;
var _local5:*;
var _local6:*;
_local2 = 6;
_local3 = 20;
_local4 = towerI;
_local5 = -2;
_local6 = 4;
if ((_local4 % 2) != 0){
_local5++;
_local6--;
};
createBlock((-2.5 * _local3), (((_local2 * _local4) + 1) * _local3), 180, 4);
createBlock((0 * _local3), (((_local2 * _local4) + 1) * _local3), 0, 3);
createBlock((2.5 * _local3), (((_local2 * _local4) + 1) * _local3), 180, 4);
createBlock((-3 * _local3), (((_local2 * _local4) + 2.5) * _local3), 90, 0);
createBlock((-1 * _local3), (((_local2 * _local4) + 2.5) * _local3), 90, 0);
createBlock((1 * _local3), (((_local2 * _local4) + 2.5) * _local3), 90, 2);
createBlock((3 * _local3), (((_local2 * _local4) + 2.5) * _local3), 90, 4);
createBlock((-3 * _local3), (((_local2 * _local4) + 4.5) * _local3), 270, 4);
createBlock((-0.5 * _local3), (((_local2 * _local4) + 4) * _local3), 180, 6);
createBlock((2 * _local3), (((_local2 * _local4) + 4) * _local3), 0, 3);
createBlock((2.5 * _local3), (((_local2 * _local4) + 5) * _local3), 0, 5);
createBlock((-1 * _local3), (((_local2 * _local4) + 5.5) * _local3), 0, 1);
towerI++;
}
override protected function addBlock(){
var _local1:*;
if (this.maxBlocks > 0){
this.currentBlock = null;
this.determineHighestY();
_local1 = (highestY + this.topSpacing);
if (_local1 < this.minSpawnHeight){
_local1 = this.minSpawnHeight;
};
this.currentBlock = new Block(0, _local1, Math.floor((Math.random() * 7)), this.physicsWorld);
this.blocks[this.currentBlock] = 0;
world.addStaticObject(this.currentBlock, 1);
this.currentBlock.convertToPhysics();
this.maxBlocks--;
};
}
override public function blockHitBottom(_arg1){
if (this.blocks[_arg1] != null){
this.world.removeStaticObject(_arg1);
delete this.blocks[_arg1];
this.maxBlocks++;
};
}
override protected function determineHighestY():void{
var _local1:Number;
var _local2:*;
this.highestY = 0;
this.highestBlockY = 0;
for (_local2 in blocks) {
var _local5 = blocks;
var _local6 = _local2;
var _local7 = (_local5[_local6] + 1);
_local5[_local6] = _local7;
_local1 = _local2.getRealHeight();
if (_local1 > highestY){
highestY = _local1;
};
};
}
override public function move(_arg1){
}
override public function zoom(_arg1:int):void{
if (_arg1 == 1){
this.buildTower();
this.setCamera();
};
}
private function createBlock(_arg1, _arg2, _arg3, _arg4){
var _local5:*;
_local5 = new Block(_arg1, _arg2, _arg4, this.physicsWorld, _arg3);
world.addStaticObject(_local5, 1);
_local5.convertToPhysics();
this.blocks[_local5] = 0;
wbVarManager.getInstance().addToVar("blocks", 1);
}
}
}//package Game.Modes
Section 180
//GameState (Game.States.GameState)
package Game.States {
import WBE.States.*;
import Game.Modes.*;
public class GameState extends wbGameState {
private var keysDown:Array;
private var availableModes:Array;
public function GameState(_arg1:Object){
availableModes = [PlayMode, TestMode];
keysDown = [0, 0, 0, 0];
super(_arg1);
}
public function moveDown(_arg1:int):void{
this.keysDown[3] = _arg1;
}
private function newplaythroughCreated():void{
}
public function moveUp(_arg1:int):void{
this.keysDown[1] = _arg1;
}
override public function toString():String{
return ("GameState");
}
public function moveLeft(_arg1:int):void{
this.keysDown[0] = _arg1;
}
public function discardBlock():void{
PlayMode(this.mode).discardBlock();
}
override public function step():String{
var _local1:String;
_local1 = super.step();
PlayMode(this.mode).move(this.keysDown);
return (_local1);
}
public function moveRight(_arg1:int):void{
this.keysDown[2] = _arg1;
}
public function zoom(_arg1:int):void{
PlayMode(this.mode).zoom(_arg1);
}
}
}//package Game.States
Section 181
//UI_HeightLine (Game.UI.UI_HeightLine)
package Game.UI {
import flash.display.*;
import WBE.Managers.*;
import flash.text.*;
import caurina.transitions.*;
import WBE.States.*;
import WBE.UI.*;
import WBE.Cameras.*;
public class UI_HeightLine extends wbUI_Item {
private var line:MovieClip;
private var outputField:TextField;
public function UI_HeightLine(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:wbState){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
this.outputField = new TextField();
this.addChild(outputField);
this.line = MovieClip(wbAssetManager.getInstance().getGraphics("curHeightLine"));
this.addChild(this.line);
this.outputField.width = 50;
this.outputField.height = 20;
this.outputField.x = (this.line.width - this.outputField.width);
this.outputField.y = -20;
this.outputField.embedFonts = true;
this.outputField.selectable = false;
this.outputField.defaultTextFormat = wbSettingsManager.getInstance().getTextFormat(_arg1.format);
this.outputField.text = String((roundToOneDigit((wbVarManager.getInstance().getVar(this.itemData.varData) / 20)) * 10));
this.x = _arg2;
this.y = _arg3;
}
private function roundToOneDigit(_arg1:Number):Number{
return ((Math.round((_arg1 * 10)) / 10));
}
override public function toString():String{
return ("UI_HeightLine");
}
public function getText():String{
return (this.outputField.text);
}
public function update():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = wbSettingsManager.getInstance().getWorldSettings("height");
_local2 = wbVarManager.getInstance().getVar(this.itemData.varData);
this.outputField.text = String((roundToOneDigit((_local2 / 20)) * 10));
_local3 = wbPlayerCam.getInstance().zToScale(wbPlayerCam.getInstance().zPos);
_local4 = wbPlayerCam.getInstance().yPos;
_local5 = ((_local2 * _local3) - ((_local4 * _local3) - (_local1 / 2)));
this.line.line.height = (_local5 * 2);
Tweener.addTween(this, {y:(_local1 - _local5), time:20, useFrames:true});
}
}
}//package Game.UI
Section 182
//UI_MaxHeightLine (Game.UI.UI_MaxHeightLine)
package Game.UI {
import flash.display.*;
import WBE.Managers.*;
import flash.text.*;
import caurina.transitions.*;
import WBE.States.*;
import WBE.UI.*;
import WBE.Cameras.*;
public class UI_MaxHeightLine extends wbUI_Item {
private var line:MovieClip;
private var upArrow:MovieClip;
private var label:MovieClip;
private var outputField:TextField;
public function UI_MaxHeightLine(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:wbState){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
this.outputField = new TextField();
this.addChild(outputField);
this.line = MovieClip(wbAssetManager.getInstance().getGraphics("maxHeightLine"));
this.addChild(this.line);
this.label = MovieClip(wbAssetManager.getInstance().getGraphics("maxHeightLabel"));
this.addChild(this.label);
this.upArrow = MovieClip(wbAssetManager.getInstance().getGraphics("upArrow"));
this.addChild(this.upArrow);
this.upArrow.visible = false;
this.upArrow.x = (this.line.width / 2);
this.outputField.width = 50;
this.outputField.height = 20;
this.outputField.x = 3;
this.outputField.y = -20;
this.outputField.embedFonts = true;
this.outputField.selectable = false;
this.outputField.defaultTextFormat = wbSettingsManager.getInstance().getTextFormat(_arg1.format);
this.outputField.text = String((roundToOneDigit((wbVarManager.getInstance().getVar(this.itemData.varData) / 20)) * 10));
this.x = _arg2;
this.y = _arg3;
}
private function roundToOneDigit(_arg1:Number):Number{
return ((Math.round((_arg1 * 10)) / 10));
}
override public function toString():String{
return ("UI_MaxHeightLine");
}
public function getText():String{
return (this.outputField.text);
}
public function update():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local1 = wbSettingsManager.getInstance().getWorldSettings("height");
_local2 = wbVarManager.getInstance().getVar(this.itemData.varData);
this.outputField.text = String((roundToOneDigit((_local2 / 20)) * 10));
_local3 = wbPlayerCam.getInstance().zToScale(wbPlayerCam.getInstance().zPos);
_local4 = wbPlayerCam.getInstance().yPos;
_local5 = ((_local2 * _local3) - ((_local4 * _local3) - (_local1 / 2)));
this.line.line.height = (_local5 * 2);
Tweener.addTween(this, {y:(_local1 - _local5), time:20, useFrames:true});
_local6 = 15;
if ((_local5 + _local6) > _local1){
_local7 = (_local1 - _local5);
if (_local7 < 0){
_local7 = 0;
} else {
_local7 = (_local7 + 4);
};
this.upArrow.visible = true;
this.label.y = ((-(this.y) + (_local1 / 2)) + _local7);
this.outputField.y = ((-(this.y) + 4) + _local7);
this.upArrow.y = (-(this.y) + _local7);
} else {
this.upArrow.visible = false;
this.label.y = (_local5 / 2);
this.outputField.y = -20;
};
if (_local5 < this.label.height){
this.label.visible = false;
} else {
this.label.visible = true;
};
}
}
}//package Game.UI
Section 183
//mainFull (Game.mainFull)
package Game {
import flash.events.*;
import flash.display.*;
import WBE.Managers.*;
import flash.utils.*;
import WBE.States.*;
import com.kongregate.as3.client.*;
import com.kongregate.as3.client.events.*;
public class mainFull extends MovieClip {
private var mochiMC:MovieClip;
private var introClip:MovieClip;
private var nextFrameTime:int;
private var stepping:Boolean;// = false
private var sm:wbStateManager;
private var kongregateFrame:int;// = 0
private var interval:int;
private var kongregate:KongregateAPI;
private var currentStepFunction:Object;
private var initCount:int;// = 0
private var frameRate:int;// = 30
public function mainFull(){
initCount = 0;
frameRate = 30;
stepping = false;
kongregateFrame = 0;
super();
wbVarManager.getInstance().setVar("gameURL", this.loaderInfo.loaderURL);
if (((wbSettingsManager.getInstance().getSettings("debug")) || (this.isAllowedURL(this.loaderInfo.loaderURL, wbSettingsManager.getInstance().getSettings("allowedURLs"))))){
this.kongregate = new KongregateAPI();
this.addChild(kongregate);
kongregate.addEventListener(KongregateEvent.COMPLETE, kongregateConnected);
};
}
private function startEngine():void{
this.addEventListener(Event.ENTER_FRAME, step);
}
private function checkFrame():void{
if (((!(this.stepping)) && ((getTimer() >= this.nextFrameTime)))){
this.nextFrameTime = (this.nextFrameTime + (1000 / this.frameRate));
this.step(new Event("o"));
};
}
private function kongregateStep():void{
if (kongregateFrame == 150){
this.loadIntroClip();
};
this.kongregateFrame++;
}
public function mochiDone():void{
this.removeChild(this.mochiMC);
this.loadKongregateIntro();
}
override public function toString():String{
return ("mainFull");
}
private function introStep():void{
if (this.introClip != null){
this.introClip.mainMC.loadBar.gotoAndStop(wbAssetManager.getInstance().getLibLoadProgress());
if (this.introClip.mainMC.currentLabel == "end"){
this.currentStepFunction = loadGraphicsStep;
};
};
}
private function isAllowedURL(_arg1:String, _arg2:Array):Boolean{
var _local3:int;
if (_arg2.length == 0){
return (true);
};
_local3 = 0;
while (_local3 < _arg2.length) {
if (_arg1.indexOf(_arg2[_local3]) == 0){
return (true);
};
_local3++;
};
return (false);
}
private function kongregateConnected(_arg1:KongregateEvent):void{
if (this.kongregate.loaded){
this.loadKongregateIntro();
} else {
this.loadMochi();
};
this.sm = wbStateManager.getInstance();
this.addChild(sm);
}
private function loadMochi():void{
if (!wbSettingsManager.getInstance().getSettings("debug")){
this.mochiMC = new mochi();
this.addChild(this.mochiMC);
mochiMC.setMain(this);
} else {
this.loadKongregateIntro();
};
}
private function introLoaded(_arg1:MovieClip):void{
this.introClip = _arg1;
this.addChild(this.introClip);
wbAssetManager.getInstance().init();
if (introClip.mainMC == null){
};
introClip.mainMC.x = (wbSettingsManager.getInstance().getWorldSettings("width") / 2);
introClip.mainMC.y = (wbSettingsManager.getInstance().getWorldSettings("height") / 2);
}
private function loadKongregateIntro():void{
var _local1:MovieClip;
if (!wbSettingsManager.getInstance().getSettings("debug")){
_local1 = new KongregateIntro();
kongregateIntroLoaded(_local1);
} else {
this.loadIntroClip();
};
}
private function loadIntroClip():void{
var _local1:MovieClip;
if (!wbSettingsManager.getInstance().getSettings("debug")){
if (this.introClip != null){
this.removeChild(this.introClip);
this.introClip = null;
};
_local1 = new wbIntro();
this.currentStepFunction = introStep;
this.introLoaded(_local1);
} else {
wbAssetManager.getInstance().init();
this.currentStepFunction = loadGraphicsStep;
};
this.startEngine();
}
public function getSourceURL():String{
var _local1:String;
_local1 = wbVarManager.getInstance().getVar("gameURL");
return (_local1.substring(0, (_local1.lastIndexOf("/") + 1)));
}
public function step(_arg1:Event):void{
this.stepping = true;
this.currentStepFunction.call();
this.stepping = false;
}
private function kongregateIntroLoaded(_arg1:MovieClip):void{
this.introClip = new MovieClip();
this.introClip.addChild(_arg1);
this.addChild(this.introClip);
introClip.x = ((wbSettingsManager.getInstance().getWorldSettings("width") - this.introClip.width) / 2);
introClip.y = ((wbSettingsManager.getInstance().getWorldSettings("height") - this.introClip.height) / 2);
this.currentStepFunction = kongregateStep;
this.startEngine();
}
private function stateManagerStep():void{
this.sm.step();
}
private function loadGraphicsStep():void{
if (wbAssetManager.getInstance().libLoadingCompleted()){
if (this.introClip != null){
this.removeChild(this.introClip);
this.introClip = null;
};
this.currentStepFunction = initStateManagerStep;
};
}
private function initStateManagerStep():void{
if (this.initCount == 0){
this.sm.init();
} else {
if (this.initCount == 2){
this.currentStepFunction = stateManagerStep;
};
};
this.initCount++;
}
}
}//package Game
Section 184
//wav (humm.wav)
package humm {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package humm
Section 185
//wav (popSound.wav)
package popSound {
import flash.media.*;
public dynamic class wav extends Sound {
}
}//package popSound
Section 186
//wbPlayerCam (WBE.Cameras.wbPlayerCam)
package WBE.Cameras {
import flash.display.*;
import WBE.Managers.*;
import caurina.transitions.*;
import Game.GameWorld.*;
public class wbPlayerCam extends MovieClip {
private var bottomBound:Number;
private var scaleLayer:MovieClip;
private var xChange:Number;// = 0
private var effectLayer:MovieClip;
private var _zPos:Number;
private var speed:Number;
private var destRotation:Number;
private var callBack:Function;
private var f:Number;// = 10
private var staticBackgroundLayer:MovieClip;
private var tweenSpeed:Boolean;
private var xSpeed:Number;// = 0
private var oneZ:Number;
private var rightBound:Number;
private var zChange:Number;// = 0
private var rotationChange:Number;// = 0
private var worldLayer:MovieClip;
private var pixelShiftLayer:MovieClip;
private var totalDist:Number;
private var topBound:Number;
private var _rotationZ:Number;
private var backgroundsLayer:MovieClip;
private var ySpeed:Number;// = 0
private var rotationSpeed:Number;// = 0
private var moveStarted:Boolean;// = false
private var yChange:Number;// = 0
private var standardSpeed:Number;// = 0.02
private var foregroundsLayer:MovieClip;
private var _xPos:Number;
private var pixelShift:Number;// = 1
private var leftBound:Number;
private var rotLayer:MovieClip;
private var desiredSpeed:Number;
private var zoom:Number;// = 1000
private var zSpeed:Number;// = 0
private var destY:Number;
private var destZ:Number;
private var _yPos:Number;
private var destX:Number;
private static var allowInstantiation:Boolean;
private static var instance:wbPlayerCam;
public function wbPlayerCam(){
f = 10;
zoom = 1000;
zSpeed = 0;
xSpeed = 0;
ySpeed = 0;
rotationSpeed = 0;
xChange = 0;
yChange = 0;
rotationChange = 0;
zChange = 0;
oneZ = (zoom * f);
standardSpeed = (1 / 50);
speed = standardSpeed;
moveStarted = false;
pixelShift = 1;
super();
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use wbPlayerCam.getInstance() instead of new."));
};
}
public function setRotation(_arg1:Number):void{
this.rotationZ = _arg1;
}
public function setScale(_arg1:Number):void{
setZ(scaleToZ(_arg1));
}
public function moveTo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
this.callBack = null;
this.destX = _arg1;
this.destY = _arg2;
this.destZ = _arg3;
this.destRotation = _arg4;
this.xChange = Math.abs((this.getX() - this.destX));
this.yChange = Math.abs((this.getY() - this.destY));
this.zChange = Math.abs((this.getZ() - this.destZ));
this.rotationChange = Math.abs((this.getRotation() - this.destRotation));
}
public function setX(_arg1:Number):void{
this.xPos = _arg1;
}
public function setY(_arg1:Number):void{
this.yPos = _arg1;
}
public function setZ(_arg1:Number):void{
this.zPos = _arg1;
}
public function set yPos(_arg1:Number):void{
if (this._yPos != _arg1){
if (((!(isNaN(this.bottomBound))) && ((_arg1 < this.bottomBound)))){
this._yPos = this.bottomBound;
} else {
if (((!(isNaN(this.topBound))) && ((_arg1 > this.topBound)))){
this._yPos = this.topBound;
} else {
this._yPos = _arg1;
};
};
this.worldLayer.y = this._yPos;
World.getInstance().setBackgoundsY(this._yPos);
};
}
public function setBottomBound(_arg1:Number):void{
this.bottomBound = (_arg1 + (wbSettingsManager.getInstance().getWorldSettings("height") / 2));
}
override public function toString():String{
return ("wbPlayerCam");
}
public function attachWorld(_arg1:MovieClip):void{
worldLayer.addChild(_arg1);
}
public function moveRotation(_arg1:Number):void{
if (((!((_arg1 == 0))) && ((Math.abs(_arg1) < 0.01)))){
_arg1 = ((_arg1 / Math.abs(_arg1)) * 0.01);
};
this.rotationZ = (this.rotationZ + _arg1);
this.setRotation(this.rotationZ);
}
public function moveX(_arg1:Number):void{
var _local2:Number;
if (_arg1 != 0){
_local2 = (this.xPos + _arg1);
setX(_local2);
};
}
public function moveY(_arg1:Number):void{
var _local2:Number;
if (_arg1 != 0){
_local2 = (this.yPos + _arg1);
setY(_local2);
};
}
public function moveZ(_arg1:Number):void{
if (((!((_arg1 == 0))) && ((Math.abs(_arg1) < 0.001)))){
_arg1 = ((_arg1 / Math.abs(_arg1)) * 0.001);
};
this.zPos = (this.zPos + _arg1);
this.setZ(this.zPos);
}
public function get rotationZ():Number{
return (this._rotationZ);
}
public function getStaticBackgroundLayer():MovieClip{
return (this.staticBackgroundLayer);
}
public function get xPos():Number{
return (this._xPos);
}
public function setRightBound(_arg1:Number):void{
this.rightBound = (_arg1 - (wbSettingsManager.getInstance().getWorldSettings("width") / 2));
}
public function update():void{
var _local1:Boolean;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
if (this.moveStarted){
if (this.tweenSpeed){
this.setSpeed();
};
_local1 = false;
_local2 = this.getZ();
if (this.getZ() < this.destZ){
this.moveZ(zSpeed);
if (this.getZ() > this.destZ){
this.setZ(this.destZ);
} else {
_local1 = true;
};
} else {
if (this.getZ() > this.destZ){
this.moveZ(-(zSpeed));
if (this.getZ() <= this.destZ){
this.setZ(this.destZ);
} else {
_local1 = true;
};
};
};
if (zChange > 0.01){
_local4 = Math.abs((_local2 - this.getZ()));
_local3 = (_local4 / zChange);
} else {
_local3 = speed;
};
if (_local3 == 0){
_local3 = speed;
};
if (this.getX() > this.destX){
this.moveX((-(xChange) * _local3));
if (this.getX() < this.destX){
this.setX(this.destX);
} else {
_local1 = true;
};
} else {
if (this.getX() < this.destX){
this.moveX((xChange * _local3));
if (this.getX() > this.destX){
this.setX(this.destX);
} else {
_local1 = true;
};
};
};
if (this.getY() > this.destY){
this.moveY((-(yChange) * _local3));
if (this.getY() < this.destY){
this.setY(this.destY);
} else {
_local1 = true;
};
} else {
if (this.getY() < this.destY){
this.moveY((yChange * _local3));
if (this.getY() > this.destY){
this.setY(this.destY);
} else {
_local1 = true;
};
};
};
if (rotationSpeed > 0){
if (this.getRotation() < this.destRotation){
this.moveRotation((rotationChange * _local3));
if (this.getRotation() >= this.destRotation){
this.setRotation(this.destRotation);
} else {
_local1 = true;
};
} else {
if (this.getRotation() > this.destRotation){
_local5 = this.getRotation();
this.moveRotation((rotationChange * _local3));
if ((((_local5 > this.getRotation())) && ((this.getRotation() >= this.destRotation)))){
this.setRotation(this.destRotation);
} else {
_local1 = true;
};
};
};
} else {
if (this.getRotation() > this.destRotation){
this.moveRotation((rotationChange * _local3));
if (this.getRotation() <= this.destRotation){
this.setRotation(this.destRotation);
} else {
_local1 = true;
};
} else {
if (this.getRotation() < this.destRotation){
_local5 = this.getRotation();
this.moveRotation((rotationChange * _local3));
if ((((_local5 < this.getRotation())) && ((this.getRotation() <= this.destRotation)))){
this.setRotation(this.destRotation);
} else {
_local1 = true;
};
};
};
};
if (!_local1){
moveStarted = false;
if (this.callBack != null){
this.callBack.call();
this.callBack = null;
};
};
};
if (wbSettingsManager.getInstance().getWorldSettings("pixelShift")){
this.x = (this.x + this.pixelShift);
this.pixelShiftLayer.x = (this.pixelShiftLayer.x - this.pixelShift);
this.y = (this.y + this.pixelShift);
this.pixelShiftLayer.y = (this.pixelShiftLayer.y - this.pixelShift);
this.pixelShift = -(this.pixelShift);
};
}
public function getBackgroundsLayer():MovieClip{
return (this.backgroundsLayer);
}
public function resetBounds():void{
this.leftBound = NaN;
this.rightBound = NaN;
this.topBound = NaN;
this.bottomBound = NaN;
}
private function setSpeed():void{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
_local1 = Math.sqrt((Math.pow(Math.abs((this.getX() - this.destX)), 2) + Math.pow(Math.abs((this.getY() - this.destY)), 2)));
_local2 = ((this.totalDist - _local1) / this.totalDist);
_local3 = this.desiredSpeed;
_local4 = 0.5;
_local5 = 0.2;
_local6 = (_local3 * Math.exp((-(Math.pow((_local2 - _local4), 2)) / (2 * Math.pow(_local5, 2)))));
this.speed = _local6;
if (this.speed < (1 / 5000)){
this.speed = (1 / 5000);
};
}
public function init():void{
this.staticBackgroundLayer = new MovieClip();
this.addChild(this.staticBackgroundLayer);
this.effectLayer = new MovieClip();
this.addChild(this.effectLayer);
pixelShiftLayer = new MovieClip();
this.addChild(pixelShiftLayer);
rotLayer = new MovieClip();
pixelShiftLayer.addChild(rotLayer);
scaleLayer = new MovieClip();
rotLayer.addChild(scaleLayer);
backgroundsLayer = new MovieClip();
scaleLayer.addChild(backgroundsLayer);
worldLayer = new MovieClip();
scaleLayer.addChild(worldLayer);
foregroundsLayer = new MovieClip();
scaleLayer.addChild(foregroundsLayer);
this.x = (wbSettingsManager.getInstance().getWorldSettings("width") / 2);
this.y = (wbSettingsManager.getInstance().getWorldSettings("height") / 2);
this.setX(0);
this.setY(0);
this.setZ(oneZ);
this.setRotation(0);
this.destX = this.xPos;
this.destY = this.yPos;
this.destZ = this.zPos;
this.destRotation = this.rotationZ;
this.zSpeed = this.standardSpeed;
}
public function getForegroundsLayer():MovieClip{
return (this.foregroundsLayer);
}
public function get yPos():Number{
return (this._yPos);
}
public function getEffectLayer():MovieClip{
return (this.effectLayer);
}
public function set zPos(_arg1:Number):void{
var _local2:Number;
if (this._zPos != _arg1){
this._zPos = _arg1;
_local2 = this.zToScale(this._zPos);
this.scaleLayer.scaleX = _local2;
this.scaleLayer.scaleY = _local2;
};
}
public function removeInstance():void{
instance = null;
allowInstantiation = true;
}
public function getRotation():Number{
return (this.rotationZ);
}
public function set rotationZ(_arg1:Number):void{
if (_arg1 > 360){
_arg1 = (_arg1 - 360);
} else {
if (_arg1 < 0){
_arg1 = (_arg1 + 360);
};
};
this._rotationZ = _arg1;
this.rotLayer.rotation = -(this._rotationZ);
}
public function removeWorld(_arg1:MovieClip):void{
worldLayer.removeChild(_arg1);
}
public function moveToWithCallback(_arg1:Number, _arg2:Number, _arg3:Function, _arg4:String=null, _arg5:Number=NaN):void{
this.callBack = _arg3;
if (((!(isNaN(this.leftBound))) && ((_arg1 < this.leftBound)))){
this.destX = this.leftBound;
} else {
if (((!(isNaN(this.rightBound))) && ((_arg1 > this.rightBound)))){
this.destX = this.rightBound;
} else {
this.destX = _arg1;
};
};
if (((!(isNaN(this.bottomBound))) && ((_arg2 < this.bottomBound)))){
this.destY = this.bottomBound;
} else {
if (((!(isNaN(this.topBound))) && ((_arg2 > this.topBound)))){
this.destY = this.topBound;
} else {
this.destY = _arg2;
};
};
this.destZ = this.zPos;
this.destRotation = this.rotationZ;
this.xChange = Math.abs((this.getX() - this.destX));
this.yChange = Math.abs((this.getY() - this.destY));
this.zChange = 0;
this.rotationChange = 0;
this.totalDist = Math.sqrt((Math.pow(this.xChange, 2) + Math.pow(this.yChange, 2)));
this.tweenSpeed = false;
switch (_arg4){
case "time":
this.speed = (1 / _arg5);
break;
case "speed":
this.speed = (1 / (this.totalDist / _arg5));
break;
case "tween":
this.desiredSpeed = (1 / _arg5);
this.tweenSpeed = true;
default:
this.speed = this.standardSpeed;
};
this.moveStarted = true;
}
public function set xPos(_arg1:Number):void{
if (this._xPos != _arg1){
if (((!(isNaN(this.leftBound))) && ((_arg1 < this.leftBound)))){
this._xPos = this.leftBound;
} else {
if (((!(isNaN(this.rightBound))) && ((_arg1 > this.rightBound)))){
this._xPos = this.rightBound;
} else {
this._xPos = _arg1;
};
};
this.worldLayer.x = -(this._xPos);
World.getInstance().setBackgoundsX(this._xPos);
};
}
public function get zPos():Number{
return (this._zPos);
}
public function setLeftBound(_arg1:Number):void{
this.leftBound = (_arg1 + (wbSettingsManager.getInstance().getWorldSettings("width") / 2));
}
public function scaleToZ(_arg1:Number):Number{
return (((zoom * f) / _arg1));
}
public function moveToX(_arg1:Number, _arg2:Number=20):void{
Tweener.removeTweens(this, "xPos");
Tweener.addTween(this, {xPos:_arg1, time:_arg2, useFrames:true, transition:"easeOutExpo"});
}
public function moveToY(_arg1:Number, _arg2:Number=20):void{
Tweener.removeTweens(this, "yPos");
Tweener.addTween(this, {yPos:_arg1, time:_arg2, useFrames:true, transition:"easeOutExpo"});
}
public function setTopBound(_arg1:Number):void{
this.topBound = (_arg1 - (wbSettingsManager.getInstance().getWorldSettings("height") / 2));
}
public function moveToZ(_arg1:Number, _arg2:Number=20):void{
Tweener.removeTweens(this, "zPos");
Tweener.addTween(this, {zPos:_arg1, time:_arg2, useFrames:true, transition:"easeOutExpo"});
}
public function zToScale(_arg1:Number):Number{
return (((zoom * f) / _arg1));
}
public function getX():Number{
return (this.xPos);
}
public function getY():Number{
return (yPos);
}
public function getZ():Number{
return (zPos);
}
public static function getInstance():wbPlayerCam{
if (instance == null){
allowInstantiation = true;
instance = new (wbPlayerCam);
allowInstantiation = false;
};
return (instance);
}
}
}//package WBE.Cameras
Section 187
//Log (WBE.Debug.Log)
package WBE.Debug {
import WBE.Managers.*;
public class Log {
private var writeToTrace:Boolean;// = true
private var includeTime:Boolean;// = true
private var lowestPriority:int;
private var writeToConsole:Boolean;// = true
private static var allowInstantiation:Boolean;
private static var instance:Log;
public function Log(){
includeTime = true;
writeToConsole = true;
writeToTrace = true;
super();
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use Log.getInstance() instead of new."));
};
this.lowestPriority = wbSettingsManager.getInstance().getSettings("logPriority");
this.includeTime = wbSettingsManager.getInstance().getSettings("logTime");
this.writeToConsole = wbSettingsManager.getInstance().getSettings("logConsole");
this.writeToTrace = wbSettingsManager.getInstance().getSettings("logTrace");
}
public function toString():String{
return ("Log");
}
public function removeInstance():void{
instance = null;
allowInstantiation = true;
}
public function write(_arg1, _arg2:int, _arg3:String="", _arg4:String=""):void{
var _local5:String;
if (_arg2 >= this.lowestPriority){
_local5 = new String();
if (this.includeTime){
_local5 = (_local5 + (new Date().toString() + " "));
};
if (_arg3 != ""){
_local5 = (_local5 + (_arg3 + "::"));
};
if (_arg4 != ""){
_local5 = (_local5 + (_arg4 + ":"));
};
if (!(((_arg3 == "")) && ((_arg4 == "")))){
_local5 = (_local5 + " ");
};
_local5 = (_local5 + _arg1);
if (this.writeToConsole){
wbConsole.getInstance().write(_local5);
};
if (this.writeToTrace){
};
};
}
public static function i(_arg1:Object):void{
var _local2:String;
_local2 = "";
_local2 = _arg1.toString();
Log.getInstance().write("init", -5, _local2, "");
}
public static function t(_arg1, _arg2:Object=null, _arg3:String=""):void{
var _local4:String;
_local4 = "";
if (_arg2 != null){
_local4 = _arg2.toString();
};
Log.getInstance().write(_arg1, 0, _local4, _arg3);
}
public static function f(_arg1:Object, _arg2:String):void{
var _local3:String;
_local3 = "";
_local3 = _arg1.toString();
Log.getInstance().write("execute", -4, _local3, _arg2);
}
public static function w(_arg1, _arg2:Object=null, _arg3:String=""):void{
var _local4:String;
_local4 = "";
if (_arg2 != null){
_local4 = _arg2.toString();
};
Log.getInstance().write(_arg1, 0, _local4, _arg3);
}
public static function wp(_arg1, _arg2:int, _arg3:Object=null, _arg4:String=""):void{
var _local5:String;
_local5 = "";
if (_arg3 != null){
_local5 = _arg3.toString();
};
Log.getInstance().write(_arg1, _arg2, _local5, _arg4);
}
public static function getInstance():Log{
if (instance == null){
allowInstantiation = true;
instance = new (Log);
allowInstantiation = false;
};
return (instance);
}
public static function io(_arg1, _arg2:Object=null, _arg3:String=""):void{
var _local4:String;
_local4 = "";
if (_arg2 != null){
_local4 = _arg2.toString();
};
Log.getInstance().write(_arg1, -3, _local4, _arg3);
}
}
}//package WBE.Debug
Section 188
//wbConsole (WBE.Debug.wbConsole)
package WBE.Debug {
import flash.events.*;
import flash.display.*;
import WBE.Managers.*;
public class wbConsole extends MovieClip {
private var mc:MovieClip;
private static var allowInstantiation:Boolean;
private static var instance:wbConsole;
public function wbConsole(){
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use wbConsole.getInstance() instead of new."));
};
this.mc = MovieClip(wbAssetManager.getInstance().getGraphics("Console"));
this.addChild(this.mc);
this.mc.background.addEventListener(MouseEvent.MOUSE_DOWN, downMouse);
this.mc.background.addEventListener(MouseEvent.MOUSE_UP, upMouse);
this.visible = false;
}
public function downMouse(_arg1:MouseEvent):void{
this.startDrag();
}
public function removeInstance():void{
instance = null;
allowInstantiation = true;
}
public function toggle():void{
this.visible = !(this.visible);
}
override public function toString():String{
return ("wbConsole");
}
public function upMouse(_arg1:MouseEvent):void{
this.stopDrag();
}
public function write(_arg1:String):void{
var _local2:String;
_local2 = ((_arg1 + "\n") + this.mc.outputPane.text);
this.mc.outputPane.text = _local2;
}
public static function getInstance():wbConsole{
if (instance == null){
allowInstantiation = true;
instance = new (wbConsole);
allowInstantiation = false;
};
return (instance);
}
}
}//package WBE.Debug
Section 189
//wbDynamicObject (WBE.GameWorld.wbDynamicObject)
package WBE.GameWorld {
import flash.display.*;
import flash.geom.*;
public class wbDynamicObject extends wbGameObject {
private var speed:Point;
override public function collide(_arg1:MovieClip):void{
}
override public function toString():String{
return ("wbDynamicObject");
}
override public function update():void{
}
}
}//package WBE.GameWorld
Section 190
//wbGameObject (WBE.GameWorld.wbGameObject)
package WBE.GameWorld {
import flash.events.*;
import flash.display.*;
import WBE.Managers.*;
public class wbGameObject extends MovieClip {
protected var _yPos:Number;
private var removeCounter:int;
private var removeCallBack:Object;
protected var id:String;
protected var _rotationZ:Number;// = 0
protected var hitBox:MovieClip;
private var worldWidth:int;
private var worldHeight:int;
protected var state:int;
private var cyclical:Boolean;
protected var _xPos:Number;
protected var mc:MovieClip;
protected var shadowMC:DisplayObject;
private var gm:wbAssetManager;
public static var HIT:int = 1;
public static var DEAD:int = 3;
public static var NORMAL:int = 0;
public static var DYING:int = 2;
public function wbGameObject():void{
var _local1:MovieClip;
cyclical = Boolean(wbSettingsManager.getInstance().getWorldSettings("cyclical"));
worldWidth = wbSettingsManager.getInstance().getWorldSettings("width");
worldHeight = wbSettingsManager.getInstance().getWorldSettings("height");
_rotationZ = 0;
super();
gm = wbAssetManager.getInstance();
this.state = wbGameObject.NORMAL;
_local1 = MovieClip(gm.getGraphics(this.id));
this.mc = _local1;
this.hitBox = this.mc.hitBox;
this.shadowMC = gm.getShadowMC(this.id);
this.addChild(this.mc);
this.updateGraphics();
}
public function setRotation(_arg1:Number):void{
this._rotationZ = _arg1;
this.updateGraphics();
}
public function destroy(_arg1:Object):void{
this.stage.removeEventListener(Event.ENTER_FRAME, monitorDeath);
_arg1.call(_arg1, this);
}
public function getShadow():DisplayObject{
return (this.shadowMC);
}
public function getHitBox():MovieClip{
return (this.hitBox);
}
protected function startRemoval():void{
this.state = wbGameObject.DEAD;
}
public function collide(_arg1:MovieClip):void{
}
public function set rotationZ(_arg1:Number):void{
this._rotationZ = _arg1;
this.updateGraphics();
}
public function getRotation():Number{
return (this._rotationZ);
}
public function set yPos(_arg1:Number):void{
this._yPos = _arg1;
this.updateGraphics();
}
override public function toString():String{
return ("wbGameObject");
}
public function set xPos(_arg1:Number):void{
this._xPos = _arg1;
this.updateGraphics();
}
public function updateGraphics():void{
if (cyclical){
if (this._xPos <= (-(worldWidth) / 2)){
this._xPos = (this._xPos + worldWidth);
} else {
if (this._xPos > (worldWidth / 2)){
this._xPos = (this._xPos - worldWidth);
};
};
if (this._yPos <= (-(worldHeight) / 2)){
this._yPos = (this._yPos + worldHeight);
} else {
if (this._yPos > (worldHeight / 2)){
this._yPos = (this._yPos - worldHeight);
};
};
};
gm = wbAssetManager.getInstance();
this.gm.convertObjectOrientation(this);
if (shadowMC != null){
this.shadowMC.x = this.x;
this.shadowMC.y = this.y;
};
}
public function getMC():MovieClip{
return (this.mc);
}
public function get yPos():Number{
return (this._yPos);
}
public function remove(_arg1:Object):void{
this.state = wbGameObject.DYING;
this.removeCallBack = _arg1;
this.stage.addEventListener(Event.ENTER_FRAME, monitorDeath);
this.removeCounter = 0;
this.startRemoval();
}
private function monitorDeath(_arg1:Event):void{
this.removeCounter++;
if (this.removeCounter > 1000){
wbStateManager.getInstance().error((("The object with id " + this.id) + " was removed, but the state was never set to DEAD"), this);
};
if (this.state == wbGameObject.DEAD){
this.destroy(this.removeCallBack);
};
}
public function get rotationZ():Number{
return (this._rotationZ);
}
public function update():void{
}
public function removeShadow():void{
this.shadowMC = null;
}
public function get xPos():Number{
return (this._xPos);
}
public function getState():int{
return (this.state);
}
public function getID():String{
return (this.id);
}
}
}//package WBE.GameWorld
Section 191
//wbWorld (WBE.GameWorld.wbWorld)
package WBE.GameWorld {
import flash.display.*;
import WBE.Managers.*;
import flash.utils.*;
import WBE.Helpers.*;
import Game.GameWorld.*;
import WBE.Cameras.*;
import flash.filters.*;
public class wbWorld extends MovieClip {
protected var backgroundList:Dictionary;
private var backgroundOffsetX:int;// = 0
protected var shadowMask:MovieClip;
private var backgroundOffsetY:int;// = 0
protected var worldWidth:int;
protected var objectLayer:MovieClip;
protected var objectLayers:Dictionary;
protected var worldHeight:int;
protected var cyclical:Boolean;
protected var staticObjects:Dictionary;
protected var dynamicObjects:Dictionary;
protected var player:Player;
protected var doCollision:Boolean;
protected var playerLayer:MovieClip;
protected static var shadowLayer:int = 2;
public function wbWorld(_arg1:Object){
cyclical = Boolean(wbSettingsManager.getInstance().getWorldSettings("cyclical"));
doCollision = Boolean(wbSettingsManager.getInstance().getWorldSettings("doCollision"));
worldWidth = wbSettingsManager.getInstance().getWorldSettings("width");
worldHeight = wbSettingsManager.getInstance().getWorldSettings("height");
backgroundOffsetX = 0;
backgroundOffsetY = 0;
super();
if (!(_arg1 is World)){
throw (new Error("Error: wbWorld must be created from World."));
};
}
public function setBackgoundsY(_arg1:Number):void{
var _local2:Object;
for each (_local2 in this.backgroundList) {
if (_local2.vertiFixed){
} else {
if (_local2.parralax){
_local2.mc.y = (((-(_arg1) + this.backgroundOffsetY) + _local2.yOffset) / _local2.bgZ);
} else {
_local2.mc.y = ((-(_arg1) + this.backgroundOffsetY) + _local2.yOffset);
};
};
};
}
public function setBackgoundsX(_arg1:Number):void{
var _local2:Object;
for each (_local2 in this.backgroundList) {
if (_local2.horiFixed){
} else {
if (_local2.parralax){
_local2.mc.x = (((_arg1 + this.backgroundOffsetX) + _local2.xOffset) / _local2.bgZ);
} else {
_local2.mc.x = ((_arg1 + this.backgroundOffsetX) + _local2.xOffset);
};
};
};
}
public function emptyLayer(_arg1:int):void{
var _local2:int;
var _local3:Object;
var _local4:int;
if (_arg1 >= shadowLayer){
_local2 = (_arg1 + 1);
} else {
_local2 = _arg1;
};
if (objectLayers[_local2] != null){
_local4 = objectLayers[_local2].numChildren;
for each (_local3 in this.dynamicObjects) {
if (_local3.layer == _local2){
_local3.object.destroy(destroyDynamicObject);
};
};
for each (_local3 in this.staticObjects) {
if (_local3.layer == _local2){
_local3.object.destroy(destroyStaticObject);
};
};
};
}
public function init():void{
this.objectLayer = new MovieClip();
this.addChild(this.objectLayer);
this.backgroundList = new Dictionary();
World.getInstance().deleteBackgrounds();
wbAssetManager.getInstance().getBackgroundData();
this.playerLayer = new MovieClip();
this.addChild(this.playerLayer);
this.staticObjects = new Dictionary(true);
this.dynamicObjects = new Dictionary(true);
this.objectLayers = new Dictionary();
}
public function getBackgroundByBackgroundID(_arg1:String):MovieClip{
var _local2:Object;
for each (_local2 in this.backgroundList) {
if (_local2.backgroundID == _arg1){
return (_local2.mc);
};
};
wbStateManager.getInstance().error((("background with backgroundID" + _arg1) + " does not exist"));
return (null);
}
public function setBackgroundOffset(_arg1:Number, _arg2:Number):void{
this.backgroundOffsetX = _arg1;
this.backgroundOffsetY = _arg2;
}
public function addShadow(_arg1:MovieClip):void{
var _local2:MovieClip;
if (this.objectLayers[shadowLayer] == null){
createLayersBelow(shadowLayer);
createShadowLayer();
};
_local2 = _arg1.getShadow();
if (_local2 == null){
return;
};
shadowMask.addChild(_local2);
_local2.x = _arg1.x;
_local2.y = _arg1.y;
_local2.scaleX = _arg1.getMC().scaleX;
_local2.scaleY = _arg1.getMC().scaleY;
}
public function addDynamicObject(_arg1:wbGameObject, _arg2:int):void{
var _local3:int;
if (_arg2 >= shadowLayer){
_local3 = (_arg2 + 1);
} else {
_local3 = _arg2;
};
createLayersBelow(_local3);
this.dynamicObjects[_arg1] = {object:_arg1, layer:_local3};
if (this.objectLayers[_local3] == null){
this.objectLayers[_local3] = new MovieClip();
this.objectLayer.addChildAt(this.objectLayers[_local3], _local3);
};
this.objectLayers[_local3].addChild(_arg1);
if (_arg1.getShadow() != null){
addShadow(_arg1);
};
}
public function deleteBackgrounds():void{
var _local1:Object;
for each (_local1 in this.backgroundList) {
if (wbPlayerCam.getInstance().getBackgroundsLayer().getChildByName(_local1.mc.name) != null){
wbPlayerCam.getInstance().getBackgroundsLayer().removeChild(_local1.mc);
} else {
if (wbPlayerCam.getInstance().getForegroundsLayer().getChildByName(_local1.mc.name) != null){
wbPlayerCam.getInstance().getForegroundsLayer().removeChild(_local1.mc);
};
};
delete _local1.mc;
};
this.backgroundList = new Dictionary();
}
public function getDistance(_arg1:wbGameObject, _arg2:wbGameObject):Number{
var _local3:int;
var _local4:int;
var _local5:Number;
_local3 = Math.abs((_arg2.x - _arg1.x));
_local4 = Math.abs((_arg2.y - _arg1.y));
if (cyclical){
if (_local3 > (this.worldWidth / 2)){
_local3 = (this.worldWidth - _local3);
};
if (_local4 > (this.worldHeight / 2)){
_local4 = (this.worldHeight - _local4);
};
};
_local5 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
return (_local5);
}
override public function toString():String{
return ("wbWorld");
}
public function removeWorld():void{
var _local1:Object;
for each (_local1 in this.dynamicObjects) {
_local1.object.destroy(destroyDynamicObject);
};
for each (_local1 in this.staticObjects) {
_local1.object.destroy(destroyStaticObject);
};
this.removeChild(this.objectLayer);
this.removeChild(this.playerLayer);
}
public function destroyStaticObject(_arg1:wbGameObject):void{
if (staticObjects[_arg1] != null){
if (_arg1.getShadow() != null){
removeShadow(_arg1);
};
objectLayers[staticObjects[_arg1].layer].removeChild(_arg1);
delete this.staticObjects[_arg1];
};
}
private function createShadowLayer():void{
var _local1:MovieClip;
_local1 = new MovieClip();
_local1.graphics.beginFill(0);
_local1.graphics.drawRect((-(worldWidth) / 2), (-(worldHeight) / 2), (worldWidth * 2), (worldHeight * 2));
_local1.graphics.endFill();
_local1.alpha = 0.3;
this.objectLayers[shadowLayer] = _local1;
this.objectLayer.addChildAt(this.objectLayers[shadowLayer], shadowLayer);
this.shadowMask = new MovieClip();
this.objectLayers[shadowLayer].mask = this.shadowMask;
this.objectLayers[shadowLayer].addChild(shadowMask);
}
public function destroyDynamicObject(_arg1:wbGameObject):void{
if (dynamicObjects[_arg1] != null){
if (_arg1.getShadow() != null){
removeShadow(_arg1);
};
objectLayers[dynamicObjects[_arg1].layer].removeChild(_arg1);
delete this.dynamicObjects[_arg1];
};
}
private function sortBackgrounds():void{
var _local1:Array;
var _local2:Object;
var _local3:Number;
_local1 = new Array();
for each (_local2 in this.backgroundList) {
_local1.push(_local2);
};
_local1.sortOn("bgZ", Array.NUMERIC);
_local3 = 0;
while (_local3 < _local1.length) {
if (_local1[_local3].bgZ <= 0){
wbPlayerCam.getInstance().getBackgroundsLayer().addChild(_local1[_local3].mc);
} else {
wbPlayerCam.getInstance().getForegroundsLayer().addChild(_local1[_local3].mc);
};
_local3++;
};
}
public function addStaticObject(_arg1:wbGameObject, _arg2:int):void{
var _local3:int;
if (_arg2 >= shadowLayer){
_local3 = (_arg2 + 1);
} else {
_local3 = _arg2;
};
createLayersBelow(_local3);
this.staticObjects[_arg1] = {object:_arg1, layer:_local3};
if (this.objectLayers[_local3] == null){
this.objectLayers[_local3] = new MovieClip();
this.objectLayer.addChildAt(this.objectLayers[_local3], _local3);
};
this.objectLayers[_local3].addChild(_arg1);
if (_arg1.getShadow() != null){
this.addShadow(_arg1);
};
}
public function attachBackground(_arg1:Object):void{
var _local2:Number;
var _local3:BlurFilter;
var _local4:Array;
var _local5:Number;
_arg1.mc.x = (_arg1.mc.x + this.backgroundOffsetX);
_arg1.mc.y = (_arg1.mc.y + this.backgroundOffsetY);
_arg1.mc.x = (_arg1.mc.x + _arg1.xOffset);
_arg1.mc.y = (_arg1.mc.y + _arg1.yOffset);
setBackgoundsX(wbPlayerCam.getInstance().getX());
setBackgoundsY(wbPlayerCam.getInstance().getY());
if (_arg1.blurWithZ){
_local2 = (Math.sqrt(Math.abs(_arg1.bgZ)) * 5);
_local3 = new BlurFilter(_local2, _local2);
_local4 = _arg1.mc.filters;
_local4.push(_local3);
_arg1.mc.filters = _local4;
};
if (_arg1.scaleWithZ){
_local5 = 1;
if (_arg1.bgZ < 0){
_local5 = Math.abs((1 / ((_arg1.bgZ - 10) / 10)));
};
if (_arg1.bgZ > 0){
_local5 = (1 * ((_arg1.bgZ + 10) / 10));
};
_arg1.mc.scaleX = (_arg1.mc.scaleX * _local5);
_arg1.mc.scaleY = (_arg1.mc.scaleY * _local5);
};
this.backgroundList[_arg1.mc] = _arg1;
sortBackgrounds();
}
public function getRelativePosition(_arg1:wbGameObject, _arg2:wbGameObject):wbVector2{
var _local3:int;
var _local4:int;
_local3 = (_arg2.xPos - _arg1.xPos);
_local4 = (_arg2.yPos - _arg1.yPos);
if (cyclical){
if (_local3 <= (-(this.worldWidth) / 2)){
_local3 = (_local3 + this.worldWidth);
} else {
if (_local3 > (this.worldWidth / 2)){
_local3 = (_local3 - this.worldWidth);
};
};
if (_local4 <= (-(this.worldHeight) / 2)){
_local4 = (_local4 + this.worldHeight);
} else {
if (_local4 > (this.worldHeight / 2)){
_local4 = (_local4 - this.worldHeight);
};
};
};
return (new wbVector2(_local3, _local4));
}
public function removeDynamicObject(_arg1:wbGameObject):void{
if (dynamicObjects[_arg1] != null){
if (_arg1.getShadow() != null){
removeShadow(_arg1);
};
_arg1.remove(destroyDynamicObject);
};
}
private function checkCollisions():void{
var _local1:Object;
if (player){
for each (_local1 in this.staticObjects) {
if (_local1.object.getState() == wbGameObject.NORMAL){
if (this.player.getHitBox().hitTestObject(_local1.object.getHitBox())){
this.player.collide(_local1.object);
};
};
};
for each (_local1 in this.dynamicObjects) {
if (_local1.object.getState() == wbGameObject.NORMAL){
if (this.player.getHitBox().hitTestObject(_local1.object.getHitBox())){
this.player.collide(_local1.object);
};
};
};
};
}
private function createLayersBelow(_arg1:int):void{
var _local2:int;
_local2 = 0;
while (_local2 < _arg1) {
if (this.objectLayers[_local2] == null){
if (_local2 == shadowLayer){
this.createShadowLayer();
} else {
this.objectLayers[_local2] = new MovieClip();
this.objectLayer.addChildAt(this.objectLayers[_local2], _local2);
};
};
_local2++;
};
}
public function step():void{
var _local1:Object;
if (doCollision){
this.checkCollisions();
};
for each (_local1 in this.dynamicObjects) {
_local1.object.update();
};
if (this.player){
this.player.update();
};
}
public function getDynamicObjects():Dictionary{
return (this.dynamicObjects);
}
public function removeShadow(_arg1:wbGameObject):void{
shadowMask.removeChild(_arg1.getShadow());
_arg1.removeShadow();
}
public function getObjectNr():int{
var _local1:int;
var _local2:MovieClip;
_local1 = 0;
for each (_local2 in objectLayers) {
_local1 = (_local1 + _local2.numChildren);
};
return (_local1);
}
public function addPlayer():Player{
this.player = Player.getInstance();
this.playerLayer.addChild(player);
return (this.player);
}
public function removeStaticObject(_arg1:wbGameObject):void{
if (staticObjects[_arg1] != null){
if (_arg1.getShadow() != null){
removeShadow(_arg1);
};
_arg1.remove(destroyStaticObject);
};
}
}
}//package WBE.GameWorld
Section 192
//MD5 (WBE.Helpers.MD5)
package WBE.Helpers {
public class MD5 {
public static const HEX_FORMAT_LOWERCASE:uint = 0;
public static const HEX_FORMAT_UPPERCASE:uint = 1;
public static const BASE64_PAD_CHARACTER_DEFAULT_COMPLIANCE:String = "";
public static const BASE64_PAD_CHARACTER_RFC_COMPLIANCE:String = "=";
public static var hexcase:uint = 0;
public static var b64pad:String = "";
public static function md5_gg(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 & _arg4) | (_arg3 & ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function md5_cmn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Number{
return (safe_add(bit_rol(safe_add(safe_add(_arg2, _arg1), safe_add(_arg4, _arg6)), _arg5), _arg3));
}
public static function binl_md5(_arg1:Array, _arg2:Number):Array{
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;
_arg1[(_arg2 >> 5)] = (_arg1[(_arg2 >> 5)] | (128 << (_arg2 % 32)));
_arg1[((((_arg2 + 64) >>> 9) << 4) + 14)] = _arg2;
_local3 = 1732584193;
_local4 = -271733879;
_local5 = -1732584194;
_local6 = 271733878;
_local7 = 0;
while (_local7 < _arg1.length) {
_local8 = _local3;
_local9 = _local4;
_local10 = _local5;
_local11 = _local6;
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 0)], 7, -680876936);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 1)], 12, -389564586);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 2)], 17, 606105819);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 3)], 22, -1044525330);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 4)], 7, -176418897);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 5)], 12, 1200080426);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 6)], 17, -1473231341);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 7)], 22, -45705983);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 8)], 7, 1770035416);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 9)], 12, -1958414417);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 10)], 17, -42063);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 11)], 22, -1990404162);
_local3 = md5_ff(_local3, _local4, _local5, _local6, _arg1[(_local7 + 12)], 7, 1804603682);
_local6 = md5_ff(_local6, _local3, _local4, _local5, _arg1[(_local7 + 13)], 12, -40341101);
_local5 = md5_ff(_local5, _local6, _local3, _local4, _arg1[(_local7 + 14)], 17, -1502002290);
_local4 = md5_ff(_local4, _local5, _local6, _local3, _arg1[(_local7 + 15)], 22, 1236535329);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 1)], 5, -165796510);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 6)], 9, -1069501632);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 11)], 14, 643717713);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 0)], 20, -373897302);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 5)], 5, -701558691);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 10)], 9, 38016083);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 15)], 14, -660478335);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 4)], 20, -405537848);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 9)], 5, 568446438);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 14)], 9, -1019803690);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 3)], 14, -187363961);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 8)], 20, 1163531501);
_local3 = md5_gg(_local3, _local4, _local5, _local6, _arg1[(_local7 + 13)], 5, -1444681467);
_local6 = md5_gg(_local6, _local3, _local4, _local5, _arg1[(_local7 + 2)], 9, -51403784);
_local5 = md5_gg(_local5, _local6, _local3, _local4, _arg1[(_local7 + 7)], 14, 1735328473);
_local4 = md5_gg(_local4, _local5, _local6, _local3, _arg1[(_local7 + 12)], 20, -1926607734);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 5)], 4, -378558);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 8)], 11, -2022574463);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 11)], 16, 1839030562);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 14)], 23, -35309556);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 1)], 4, -1530992060);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 4)], 11, 1272893353);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 7)], 16, -155497632);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 10)], 23, -1094730640);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 13)], 4, 681279174);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 0)], 11, -358537222);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 3)], 16, -722521979);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 6)], 23, 76029189);
_local3 = md5_hh(_local3, _local4, _local5, _local6, _arg1[(_local7 + 9)], 4, -640364487);
_local6 = md5_hh(_local6, _local3, _local4, _local5, _arg1[(_local7 + 12)], 11, -421815835);
_local5 = md5_hh(_local5, _local6, _local3, _local4, _arg1[(_local7 + 15)], 16, 530742520);
_local4 = md5_hh(_local4, _local5, _local6, _local3, _arg1[(_local7 + 2)], 23, -995338651);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 0)], 6, -198630844);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 7)], 10, 1126891415);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 14)], 15, -1416354905);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 5)], 21, -57434055);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 12)], 6, 1700485571);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 3)], 10, -1894986606);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 10)], 15, -1051523);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 1)], 21, -2054922799);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 8)], 6, 1873313359);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 15)], 10, -30611744);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 6)], 15, -1560198380);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 13)], 21, 1309151649);
_local3 = md5_ii(_local3, _local4, _local5, _local6, _arg1[(_local7 + 4)], 6, -145523070);
_local6 = md5_ii(_local6, _local3, _local4, _local5, _arg1[(_local7 + 11)], 10, -1120210379);
_local5 = md5_ii(_local5, _local6, _local3, _local4, _arg1[(_local7 + 2)], 15, 718787259);
_local4 = md5_ii(_local4, _local5, _local6, _local3, _arg1[(_local7 + 9)], 21, -343485551);
_local3 = safe_add(_local3, _local8);
_local4 = safe_add(_local4, _local9);
_local5 = safe_add(_local5, _local10);
_local6 = safe_add(_local6, _local11);
_local7 = (_local7 + 16);
};
return ([_local3, _local4, _local5, _local6]);
}
public static function str2rstr_utf16le(_arg1:String):String{
var _local2:String;
var _local3:Number;
_local2 = "";
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode((_arg1.charCodeAt(_local3) & 0xFF), ((_arg1.charCodeAt(_local3) >>> 8) & 0xFF)));
_local3++;
};
return (_local2);
}
public static function hex_hmac_md5(_arg1:String, _arg2:String):String{
return (rstr2hex(rstr_hmac_md5(str2rstr_utf8(_arg1), str2rstr_utf8(_arg2))));
}
public static function binl2rstr(_arg1:Array):String{
var _local2:String;
var _local3:Number;
_local2 = "";
_local3 = 0;
while (_local3 < (_arg1.length * 32)) {
_local2 = (_local2 + String.fromCharCode(((_arg1[(_local3 >> 5)] >>> (_local3 % 32)) & 0xFF)));
_local3 = (_local3 + 8);
};
return (_local2);
}
public static function md5_ff(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 & _arg3) | (~(_arg2) & _arg4)), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function md5_ii(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn((_arg3 ^ (_arg2 | ~(_arg4))), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function rstr2binl(_arg1:String):Array{
var _local2:Array;
var _local3:Number;
_local2 = new Array((_arg1.length >> 2));
_local3 = 0;
while (_local3 < _local2.length) {
_local2[_local3] = 0;
_local3++;
};
_local3 = 0;
while (_local3 < (_arg1.length * 8)) {
_local2[(_local3 >> 5)] = (_local2[(_local3 >> 5)] | ((_arg1.charCodeAt((_local3 / 8)) & 0xFF) << (_local3 % 32)));
_local3 = (_local3 + 8);
};
return (_local2);
}
public static function md5_vm_test():Boolean{
return ((hex_md5("abc") == "900150983cd24fb0d6963f7d28e17f72"));
}
public static function b64_md5(_arg1:String):String{
return (rstr2b64(rstr_md5(str2rstr_utf8(_arg1))));
}
public static function any_hmac_md5(_arg1:String, _arg2:String, _arg3:String):String{
return (rstr2any(rstr_hmac_md5(str2rstr_utf8(_arg1), str2rstr_utf8(_arg2)), _arg3));
}
public static function hex_md5(_arg1:String):String{
return (rstr2hex(rstr_md5(str2rstr_utf8(_arg1))));
}
public static function bit_rol(_arg1:Number, _arg2:Number):Number{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
public static function encrypt(_arg1:String):String{
return (hex_md5(_arg1));
}
public static function md5_hh(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Number{
return (md5_cmn(((_arg2 ^ _arg3) ^ _arg4), _arg1, _arg2, _arg5, _arg6, _arg7));
}
public static function rstr2hex(_arg1:String):String{
var _local2:String;
var _local3:String;
var _local4:Number;
var _local5:Number;
_local2 = (hexcase) ? "0123456789ABCDEF" : "0123456789abcdef";
_local3 = "";
_local5 = 0;
while (_local5 < _arg1.length) {
_local4 = _arg1.charCodeAt(_local5);
_local3 = (_local3 + (_local2.charAt(((_local4 >>> 4) & 15)) + _local2.charAt((_local4 & 15))));
_local5++;
};
return (_local3);
}
public static function any_md5(_arg1:String, _arg2:String):String{
return (rstr2any(rstr_md5(str2rstr_utf8(_arg1)), _arg2));
}
public static function b64_hmac_md5(_arg1:String, _arg2:String):String{
return (rstr2b64(rstr_hmac_md5(str2rstr_utf8(_arg1), str2rstr_utf8(_arg2))));
}
public static function rstr2b64(_arg1:String):String{
var _local2:String;
var _local3:String;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
_local2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
_local3 = "";
_local4 = _arg1.length;
_local5 = 0;
while (_local5 < _local4) {
_local6 = (((_arg1.charCodeAt(_local5) << 16) | (((_local5 + 1) < _local4)) ? (_arg1.charCodeAt((_local5 + 1)) << 8) : 0) | (((_local5 + 2) < _local4)) ? _arg1.charCodeAt((_local5 + 2)) : 0);
_local7 = 0;
while (_local7 < 4) {
if (((_local5 * 8) + (_local7 * 6)) > (_arg1.length * 8)){
_local3 = (_local3 + b64pad);
} else {
_local3 = (_local3 + _local2.charAt(((_local6 >>> (6 * (3 - _local7))) & 63)));
};
_local7++;
};
_local5 = (_local5 + 3);
};
return (_local3);
}
public static function safe_add(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
_local3 = ((_arg1 & 0xFFFF) + (_arg2 & 0xFFFF));
_local4 = (((_arg1 >> 16) + (_arg2 >> 16)) + (_local3 >> 16));
return (((_local4 << 16) | (_local3 & 0xFFFF)));
}
public static function str2rstr_utf8(_arg1:String):String{
var _local2:String;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = "";
_local3 = -1;
while (++_local3 < _arg1.length) {
_local4 = _arg1.charCodeAt(_local3);
_local5 = (((_local3 + 1) < _arg1.length)) ? _arg1.charCodeAt((_local3 + 1)) : 0;
if ((((((((0xD800 <= _local4)) && ((_local4 <= 56319)))) && ((0xDC00 <= _local5)))) && ((_local5 <= 57343)))){
_local4 = ((65536 + ((_local4 & 1023) << 10)) + (_local5 & 1023));
_local3++;
};
if (_local4 <= 127){
_local2 = (_local2 + String.fromCharCode(_local4));
} else {
if (_local4 <= 2047){
_local2 = (_local2 + String.fromCharCode((192 | ((_local4 >>> 6) & 31)), (128 | (_local4 & 63))));
} else {
if (_local4 <= 0xFFFF){
_local2 = (_local2 + String.fromCharCode((224 | ((_local4 >>> 12) & 15)), (128 | ((_local4 >>> 6) & 63)), (128 | (_local4 & 63))));
} else {
if (_local4 <= 2097151){
_local2 = (_local2 + String.fromCharCode((240 | ((_local4 >>> 18) & 7)), (128 | ((_local4 >>> 12) & 63)), (128 | ((_local4 >>> 6) & 63)), (128 | (_local4 & 63))));
};
};
};
};
};
return (_local2);
}
public static function rstr_hmac_md5(_arg1:String, _arg2:String):String{
var _local3:Array;
var _local4:Array;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = rstr2binl(_arg1);
if (_local3.length > 16){
_local3 = binl_md5(_local3, (_arg1.length * 8));
};
_local4 = new Array(16);
_local5 = new Array(16);
_local6 = 0;
while (_local6 < 16) {
_local4[_local6] = (_local3[_local6] ^ 909522486);
_local5[_local6] = (_local3[_local6] ^ 1549556828);
_local6++;
};
_local7 = binl_md5(_local4.concat(rstr2binl(_arg2)), (0x0200 + (_arg2.length * 8)));
return (binl2rstr(binl_md5(_local5.concat(_local7), (0x0200 + 128))));
}
public static function str2rstr_utf16be(_arg1:String):String{
var _local2:String;
var _local3:Number;
_local2 = "";
_local3 = 0;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode(((_arg1.charCodeAt(_local3) >>> 8) & 0xFF), (_arg1.charCodeAt(_local3) & 0xFF)));
_local3++;
};
return (_local2);
}
public static function rstr2any(_arg1:String, _arg2:String):String{
var _local3:Number;
var _local4:Array;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Array;
var _local9:Array;
var _local10:String;
_local3 = _arg2.length;
_local4 = [];
_local9 = new Array((_arg1.length / 2));
_local5 = 0;
while (_local5 < _local9.length) {
_local9[_local5] = ((_arg1.charCodeAt((_local5 * 2)) << 8) | _arg1.charCodeAt(((_local5 * 2) + 1)));
_local5++;
};
while (_local9.length > 0) {
_local8 = [];
_local7 = 0;
_local5 = 0;
while (_local5 < _local9.length) {
_local7 = ((_local7 << 16) + _local9[_local5]);
_local6 = Math.floor((_local7 / _local3));
_local7 = (_local7 - (_local6 * _local3));
if ((((_local8.length > 0)) || ((_local6 > 0)))){
_local8[_local8.length] = _local6;
};
_local5++;
};
_local4[_local4.length] = _local7;
_local9 = _local8;
};
_local10 = "";
_local5 = (_local4.length - 1);
while (_local5 >= 0) {
_local10 = (_local10 + _arg2.charAt(_local4[_local5]));
_local5--;
};
return (_local10);
}
public static function rstr_md5(_arg1:String):String{
return (binl2rstr(binl_md5(rstr2binl(_arg1), (_arg1.length * 8))));
}
}
}//package WBE.Helpers
Section 193
//wbDatabaseConnection (WBE.Helpers.wbDatabaseConnection)
package WBE.Helpers {
import flash.events.*;
import WBE.Managers.*;
import flash.utils.*;
import flash.net.*;
import Game.Modes.*;
public class wbDatabaseConnection {
private var callback:Object;
private var callbackWithObject:Boolean;
private var sendXML:XML;
private var requestWB:URLRequest;
private var key:String;
public function wbDatabaseConnection(_arg1:String, _arg2:String, _arg3:String):void{
this.key = _arg2;
this.requestWB = new URLRequest();
this.requestWB.url = (((_arg3 + "standard") + _arg1) + ".php");
this.sendXML = new XML();
this.sendXML = <db></db>
;
this.sendXML["game"] = _arg1;
}
private function loaderMissing(_arg1:IOErrorEvent):void{
}
public function doAction(_arg1:Dictionary, _arg2:Object, _arg3:Boolean=false):void{
var _local4:String;
var _local5:String;
this.callback = _arg2;
this.callbackWithObject = _arg3;
for (_local5 in _arg1) {
switch (_local5){
case "table":
this.sendXML["table"] = _arg1[_local5].table;
break;
case "recordid":
this.sendXML["recordid"] = _arg1[_local5].recordid;
break;
case "select":
this.sendXML["action"] = _local5;
for (_local4 in _arg1[_local5]) {
this.sendXML[_local5][_local4] = _arg1[_local5][_local4].column;
};
break;
case "sort":
this.sendXML[_local5].column = _arg1[_local5].column;
this.sendXML[_local5].direction = _arg1[_local5].direction;
if (_arg1[_local5].top){
this.sendXML[_local5].top = _arg1[_local5].top;
};
break;
case "custom":
case "insert":
case "update":
this.sendXML["action"] = _local5;
case "where":
case "default":
for (_local4 in _arg1[_local5]) {
this.sendXML[_local5][_arg1[_local5][_local4].column] = _arg1[_local5][_local4].value;
this.sendXML[_local5][_arg1[_local5][_local4].column].@type = _arg1[_local5][_local4].type;
};
break;
};
};
sendData();
}
public function toString():String{
return ("wbDatabaseConnection");
}
private function sendData():void{
var _local1:URLLoader;
var _local2:URLVariables;
var _local3:String;
_local1 = new URLLoader();
_local2 = new URLVariables();
_local3 = MD5.hex_hmac_md5(this.key, this.sendXML);
_local2.xmlData = String(this.sendXML);
_local2.hashData = _local3;
this.requestWB.data = _local2;
_local1.load(this.requestWB);
_local1.addEventListener(Event.COMPLETE, receiveData);
_local1.addEventListener(IOErrorEvent.IO_ERROR, loaderMissing);
}
private function receiveData(_arg1:Event):void{
var _local2:XML;
var _local3:Object;
var _local4:String;
var _local5:*;
var _local6:Class;
var _local7:int;
_local2 = new XML(_arg1.target.data);
if (((this.callbackWithObject) && (!((this.callback == null))))){
_local3 = {xml:_local2};
this.callback.call(this.callback, _local3);
this.callback = null;
} else {
if (this.callback != null){
_local7 = 0;
while (_local7 < _local2.children().length()) {
_local4 = String(_local2.children()[_local7].name());
_local5 = _local2.children()[_local7];
_local6 = wbVarManager.getInstance().getVarType(_local4);
wbVarManager.getInstance().setVar(_local4, _local6(_local5));
_local7++;
};
this.callback.call(this.callback);
this.callback = null;
};
};
}
}
}//package WBE.Helpers
Section 194
//wbFormValidator (WBE.Helpers.wbFormValidator)
package WBE.Helpers {
import WBE.Managers.*;
public class wbFormValidator {
private static var allowInstantiation:Boolean;
private static var instance:wbFormValidator;
public function wbFormValidator(){
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use wbFormValidator.getInstance() instead of new."));
};
}
public function validateField(_arg1:String, _arg2):Boolean{
switch (_arg1){
case "obligatory":
if (_arg2 == ""){
return (false);
};
break;
case "email":
if (_arg2.indexOf("@") == -1){
return (false);
};
break;
case "default":
wbStateManager.getInstance().error(("Default error: " + _arg1), this);
break;
};
return (true);
}
public function toString():String{
return ("wbFormValidator");
}
public static function getInstance():wbFormValidator{
if (instance == null){
allowInstantiation = true;
instance = new (wbFormValidator);
allowInstantiation = false;
};
return (instance);
}
}
}//package WBE.Helpers
Section 195
//wbKeyConverter (WBE.Helpers.wbKeyConverter)
package WBE.Helpers {
import WBE.Debug.*;
public class wbKeyConverter {
public function toString():String{
return ("wbKeyConverter");
}
public function getKeyCode(_arg1:String):int{
var _local2:int;
switch (_arg1){
case "left":
_local2 = 37;
break;
case "up":
_local2 = 38;
break;
case "right":
_local2 = 39;
break;
case "down":
_local2 = 40;
break;
case "space":
_local2 = 32;
break;
case "enter":
_local2 = 13;
break;
case "esc":
_local2 = 27;
break;
case "backspace":
_local2 = 8;
break;
case "shift":
_local2 = 16;
break;
case "ctrl":
_local2 = 17;
break;
case "alt":
_local2 = 18;
break;
case "caps":
_local2 = 20;
break;
case "tab":
_local2 = 9;
break;
case "del":
_local2 = 46;
break;
case "'":
_local2 = 22;
break;
case ",":
_local2 = 188;
break;
case "-":
_local2 = 189;
break;
case ".":
_local2 = 190;
break;
case "/":
_local2 = 191;
break;
case "0":
_local2 = 48;
break;
case "1":
_local2 = 49;
break;
case "2":
_local2 = 50;
break;
case "3":
_local2 = 51;
break;
case "4":
_local2 = 52;
break;
case "5":
_local2 = 53;
break;
case "6":
_local2 = 54;
break;
case "7":
_local2 = 55;
break;
case "8":
_local2 = 56;
break;
case "9":
_local2 = 57;
break;
case ";":
_local2 = 186;
break;
case "=":
_local2 = 187;
break;
case "a":
_local2 = 65;
break;
case "b":
_local2 = 66;
break;
case "c":
_local2 = 67;
break;
case "d":
_local2 = 68;
break;
case "e":
_local2 = 69;
break;
case "f":
_local2 = 70;
break;
case "g":
_local2 = 71;
break;
case "h":
_local2 = 72;
break;
case "i":
_local2 = 73;
break;
case "j":
_local2 = 74;
break;
case "k":
_local2 = 75;
break;
case "l":
_local2 = 76;
break;
case "m":
_local2 = 77;
break;
case "n":
_local2 = 78;
break;
case "o":
_local2 = 79;
break;
case "p":
_local2 = 80;
break;
case "q":
_local2 = 81;
break;
case "r":
_local2 = 82;
break;
case "s":
_local2 = 83;
break;
case "t":
_local2 = 84;
break;
case "u":
_local2 = 85;
break;
case "v":
_local2 = 86;
break;
case "w":
_local2 = 87;
break;
case "x":
_local2 = 88;
break;
case "y":
_local2 = 89;
break;
case "z":
_local2 = 90;
break;
case "[":
_local2 = 219;
break;
case "\\":
_local2 = 220;
break;
case "]":
_local2 = 221;
break;
case "`":
_local2 = 192;
break;
case "§":
_local2 = 167;
break;
default:
Log.w((("Error: " + _arg1) + " is unknown"), this);
};
return (_local2);
}
}
}//package WBE.Helpers
Section 196
//wbVector2 (WBE.Helpers.wbVector2)
package WBE.Helpers {
public class wbVector2 {
public var x:Number;
public var y:Number;
public function wbVector2(_arg1:Number, _arg2:Number){
this.x = _arg1;
this.y = _arg2;
}
public function sub(_arg1:wbVector2):wbVector2{
return (new wbVector2((this.x - _arg1.x), (this.y - _arg1.y)));
}
public function angleRad(_arg1:wbVector2):Number{
var _local2:Number;
_local2 = Math.acos((this.dot(_arg1) / (this.length() * _arg1.length())));
return (_local2);
}
public function subbed(_arg1:wbVector2):void{
this.x = (this.x - _arg1.x);
this.y = (this.y - _arg1.y);
}
public function dot(_arg1:wbVector2):Number{
return (((this.x * _arg1.x) + (this.y * _arg1.y)));
}
public function scale(_arg1:Number):wbVector2{
return (new wbVector2((this.x * _arg1), (this.y * _arg1)));
}
public function added(_arg1:wbVector2):void{
this.x = (this.x + _arg1.x);
this.y = (this.y + _arg1.y);
}
public function rotateRad(_arg1:Number):wbVector2{
return (new wbVector2(((Math.cos(_arg1) * this.x) - (Math.sin(_arg1) * this.y)), ((Math.sin(_arg1) * this.x) + (Math.sin(_arg1) * this.y))));
}
public function project(_arg1:wbVector2):wbVector2{
return (_arg1.scale((this.dot(_arg1) / _arg1.length())));
}
public function scaled(_arg1:Number):void{
this.x = (this.x * _arg1);
this.y = (this.y * _arg1);
}
public function reset():void{
this.x = 0;
this.y = 0;
}
public function add(_arg1:wbVector2):wbVector2{
return (new wbVector2((this.x + _arg1.x), (this.y + _arg1.y)));
}
public function set(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
public function length():Number{
return (Math.sqrt((Math.pow(this.x, 2) + Math.pow(this.y, 2))));
}
public function normal():wbVector2{
return (new wbVector2((this.x / this.length()), (this.y / this.length())));
}
public function rotateDeg(_arg1:Number):wbVector2{
_arg1 = ((_arg1 / 180) * Math.PI);
return (new wbVector2(((Math.cos(_arg1) * this.x) - (Math.sin(_arg1) * this.y)), ((Math.sin(_arg1) * this.x) + (Math.sin(_arg1) * this.y))));
}
public function toString():String{
return (((x + ":") + y));
}
public function angleDeg(_arg1:wbVector2):Number{
var _local2:Number;
_local2 = Math.acos((this.dot(_arg1) / (this.length() * _arg1.length())));
_local2 = ((_local2 / Math.PI) * 180);
return (_local2);
}
public function equal(_arg1:wbVector2):Boolean{
if ((((this.x == _arg1.x)) && ((this.y == _arg1.y)))){
return (true);
};
return (false);
}
public function distance(_arg1:wbVector2):Number{
return (Math.sqrt((Math.pow((this.x - _arg1.x), 2) + Math.pow((this.y - _arg1.y), 2))));
}
public function setX(_arg1:Number):void{
this.x = _arg1;
}
public function normalized():void{
var _local1:Number;
_local1 = this.length();
this.x = (this.x / _local1);
this.y = (this.y / _local1);
}
public function copy(_arg1:wbVector2):void{
this.x = _arg1.x;
this.y = _arg1.y;
}
public function setY(_arg1:Number):void{
this.y = _arg1;
}
}
}//package WBE.Helpers
Section 197
//wbAssetManager (WBE.Managers.wbAssetManager)
package WBE.Managers {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import Game.Data.*;
import Game.GameWorld.*;
import flash.media.*;
public class wbAssetManager {
private var externalAssetManager:wbExternalAssetManager;
private var libManager:wbLibManager;
private var assetData:AssetData;
private static var allowInstantiation:Boolean;
private static var instance:wbAssetManager;
public function wbAssetManager():void{
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use wbAssetManager.getInstance() instead of new."));
};
}
private function getGraphicInfo(_arg1:String, _arg2:Boolean=false):Object{
var _local3:Object;
_local3 = assetData.graphicsDict[_arg1];
if (_local3 == null){
if (_arg2){
return (null);
};
return (null);
//unresolved jump
};
return (_local3);
}
public function getGridHeight():Number{
return (assetData.gridHeight);
}
public function stopPlaying(_arg1:DisplayObject):void{
var _local2:int;
if (_arg1 != null){
if (_arg1.hasOwnProperty("stop")){
MovieClip(_arg1).stop();
};
if (_arg1.hasOwnProperty("numChildren")){
_local2 = 0;
while (_local2 < DisplayObjectContainer(_arg1).numChildren) {
stopPlaying(DisplayObjectContainer(_arg1).getChildAt(_local2));
_local2++;
};
};
};
}
public function libLoadingCompleted():Boolean{
return (this.libManager.loadingComplete());
}
public function makeRepetativeBackground(_arg1:Number, _arg2:Number):MovieClip{
var _local3:MovieClip;
var _local4:MovieClip;
var _local5:BitmapData;
var _local6:Matrix;
var _local7:MovieClip;
_local3 = new MovieClip();
_local4 = MovieClip(getGraphics("bgFill"));
_local3.addChild(_local4);
_local4.x = (_local4.width / 2);
_local4.y = (_local4.height / 2);
_local5 = new BitmapData(_local4.width, _local4.height, false, 0xFFFFFF);
_local6 = new Matrix();
_local6.rotate((Math.PI / 4));
_local5.draw(_local3, new Matrix());
_local7 = new MovieClip();
_local7.graphics.beginBitmapFill(_local5, _local6, true);
_local7.graphics.drawRect((-(_arg1) / 2), (-(_arg2) / 2), _arg1, _arg2);
_local7.graphics.endFill();
return (_local7);
}
public function getGraphics(_arg1:String, _arg2:Boolean=false):DisplayObject{
var _local3:Object;
_local3 = getGraphicInfo(_arg1, _arg2);
if (_local3 == null){
_local3 = {mcName:_arg1};
};
if (_local3.external){
return (DisplayObject(this.externalAssetManager.getGraphicalAsset(_local3.url)));
};
return (getDisplayObject(_local3, false, _arg2));
}
public function convertOrientation(_arg1:Number, _arg2:Number, _arg3:Number):Object{
return (this.assetData.convertOrientation(_arg1, _arg2, _arg3));
}
public function convertObjectOrientation(_arg1:MovieClip):void{
this.assetData.convertObjectOrientation(_arg1);
}
public function init():void{
this.assetData = AssetData.getInstance(this);
this.libManager = new wbLibManager(this.assetData.assetLibs);
this.externalAssetManager = new wbExternalAssetManager();
}
public function getAudio(_arg1:String):Object{
var acData:Object;
var asset:Object;
var mcClass:Object;
var id = _arg1;
acData = getAudioInfo(id);
if (acData.external){
return (this.externalAssetManager.getAudioAsset(acData.url));
};
asset = this.libManager.getAssetFromLibs(acData.acName);
if (asset == null){
try {
mcClass = getDefinitionByName(acData.acName);
asset = new (mcClass);
} catch(error:ReferenceError) {
wbStateManager.getInstance().error((id + ": audio item not found in libraries"));
asset = null;
};
};
return ({sound:Sound(asset), volume:acData.volume});
}
public function getLibLoadProgress():int{
return (this.libManager.getLoadProgress());
}
public function convertOrientationBack(_arg1:int, _arg2:int):Array{
return (this.assetData.convertOrientationBack(_arg1, _arg2));
}
public function getGridWidth():Number{
return (assetData.gridWidth);
}
private function getDisplayObject(_arg1:Object, _arg2:Boolean=false, _arg3:Boolean=false):DisplayObject{
var xScale:Number;
var yScale:Number;
var mcName:String;
var mc:DisplayObject;
var mcClass:Object;
var color:ColorTransform;
var mcData = _arg1;
var getShadow = _arg2;
var supressExistanceError = _arg3;
xScale = 1;
yScale = 1;
mcName = mcData.mcName;
if (getShadow){
if ((((((mcData.showShadow == undefined)) || (mcData.showShadow))) && (wbSettingsManager.getInstance().getWorldSettings("drawShadows")))){
mcName = (mcName + "shadow");
} else {
return (null);
};
};
mc = DisplayObject(this.libManager.getAssetFromLibs(mcName));
if (mc == null){
try {
mcClass = getDefinitionByName(mcName);
mc = new (mcClass);
} catch(error:ReferenceError) {
if (supressExistanceError){
return (null);
};
if (getShadow){
return (null);
};
wbStateManager.getInstance().error((mcName + ": graphical item not found in libraries"));
mc = null;
};
};
if (mcData.colTrans){
color = new ColorTransform();
color.redOffset = mcData.colTrans[0];
color.greenOffset = mcData.colTrans[1];
color.blueOffset = mcData.colTrans[2];
mc.transform.colorTransform = color;
};
if (mcData.sizes){
xScale = (mcData.sizes[0] / mc.width);
yScale = (mcData.sizes[1] / mc.height);
} else {
if (mcData.scale){
var _local5 = mcData.scale;
yScale = _local5;
xScale = _local5;
};
};
mc.scaleX = xScale;
mc.scaleY = yScale;
if (mcData.alpha){
mc.alpha = mcData.alpha;
};
if (wbSettingsManager.getInstance().getWorldSettings("ghostMode")){
mc.alpha = 0.5;
};
return (mc);
}
public function getShadowMC(_arg1:String):DisplayObject{
var _local2:Object;
_local2 = getGraphicInfo(_arg1);
return (getDisplayObject(_local2, true));
}
private function getAudioInfo(_arg1:String, _arg2:Boolean=false):Object{
var _local3:Object;
_local3 = assetData.audioDict[_arg1];
if (_local3 == null){
if (_arg2){
return (null);
};
return (null);
//unresolved jump
};
return (_local3);
}
public function getBackgroundData():void{
var _local1:String;
var _local2:Object;
var _local3:String;
for (_local1 in this.assetData.bgGraphicsDict) {
_local2 = this.assetData.bgGraphicsDict[_local1];
_local3 = _local1;
_local2.mc = MovieClip(getDisplayObject(_local2));
_local2.id = _local3;
if (_local2.bgZ == undefined){
_local2.bgZ = -100;
};
if (_local2.xOffset == undefined){
_local2.xOffset = 0;
};
if (_local2.yOffset == undefined){
_local2.yOffset = 0;
};
World.getInstance().attachBackground(_local2);
};
}
public function toString():String{
return ("wbAssetManager");
}
public function getColorTransform(_arg1:Number):ColorTransform{
var _local2:Number;
_local2 = 0.6;
switch (_arg1){
case 1:
return (new ColorTransform(2, _local2, _local2));
case 2:
return (new ColorTransform(2, 2, _local2));
case 3:
return (new ColorTransform(_local2, _local2, 2));
case 4:
return (new ColorTransform(_local2, 2, _local2));
};
return (new ColorTransform(2, 2, 2));
}
public static function getInstance():wbAssetManager{
if (instance == null){
allowInstantiation = true;
instance = new (wbAssetManager);
allowInstantiation = false;
};
return (instance);
}
}
}//package WBE.Managers
Section 198
//wbAudioManager (WBE.Managers.wbAudioManager)
package WBE.Managers {
import flash.utils.*;
import flash.media.*;
public class wbAudioManager {
private var muteOff:Boolean;// = true
public var volume:Number;// = 1
private var prevSoundOn:Boolean;
private var currentBGM:String;
private var playing:Dictionary;
private var prevMusicOn:Boolean;
private var sounds:Dictionary;
private var bgmPlaying:Boolean;// = false
private var soundsPlaying:int;
private var maxSounds:int;// = 3
public var soundOn:Boolean;// = true
private var bgm:Object;
private var audioOn:Boolean;// = true
private var musicOn:Boolean;// = true
private var loopedSounds:Dictionary;
private var bgmC:SoundChannel;
private var soundChannels:Dictionary;
private static var allowInstantiation:Boolean;
private static var instance:wbAudioManager;
public function wbAudioManager(){
maxSounds = 3;
soundOn = true;
musicOn = true;
audioOn = true;
muteOff = true;
volume = 1;
bgmC = new SoundChannel();
bgmPlaying = false;
super();
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use wbAudioManager.getInstance() instead of new."));
};
this.sounds = new Dictionary();
this.loopedSounds = new Dictionary();
this.soundChannels = new Dictionary();
this.playing = new Dictionary();
}
public function toggleMute():void{
if (this.muteOff){
this.prevSoundOn = this.soundOn;
this.prevMusicOn = this.musicOn;
this.toggleSound(false);
this.toggleMusic(false);
this.muteOff = false;
} else {
this.muteOff = true;
this.toggleSound(this.prevSoundOn);
this.toggleMusic(this.prevMusicOn);
};
}
public function isMuteOff():Boolean{
return (this.muteOff);
}
public function toggleSound(_arg1=null):void{
var _local2:String;
if (!this.muteOff){
if (_arg1 != null){
this.prevMusicOn = _arg1;
} else {
this.prevMusicOn = !(this.prevMusicOn);
};
} else {
if (_arg1 != null){
this.soundOn = _arg1;
} else {
this.soundOn = !(this.soundOn);
};
if (!this.soundOn){
for (_local2 in this.soundChannels) {
this.soundChannels[_local2].stop();
this.playing[_local2] = false;
};
} else {
for (_local2 in this.loopedSounds) {
this.playSound(_local2, true);
};
};
};
}
public function setVolume(_arg1:Number):void{
var _local2:SoundTransform;
var _local3:Number;
var _local4:String;
this.volume = _arg1;
if (this.volume < 0){
this.volume = 0;
};
if (this.volume > 1){
this.volume = 1;
};
for (_local4 in this.soundChannels) {
if (this.playing[_local4]){
_local3 = 1;
if (this.sounds[_local4].volume != null){
_local3 = this.sounds[_local4].volume;
};
_local2 = new SoundTransform((volume * _local3), 0);
this.soundChannels[_local4].soundTransform = _local2;
};
};
_local3 = 1;
if (this.bgm.volume != null){
_local3 = this.bgm.volume;
};
_local2 = new SoundTransform((volume * _local3), 0);
if (this.bgmPlaying){
this.bgmC.soundTransform = _local2;
};
}
public function stopSound(_arg1:String):void{
if (((!((this.sounds[_arg1] == null))) && (this.playing[_arg1]))){
this.soundChannels[_arg1].stop();
this.playing[_arg1] = false;
if (this.loopedSounds[_arg1] != null){
delete this.loopedSounds[_arg1];
};
};
}
public function toggleMusic(_arg1=null):void{
var _local2:SoundTransform;
if (!this.muteOff){
if (_arg1 != null){
this.prevMusicOn = _arg1;
} else {
this.prevMusicOn = !(this.prevMusicOn);
};
} else {
if (_arg1 != null){
this.musicOn = _arg1;
} else {
this.musicOn = !(this.musicOn);
};
if (!this.musicOn){
this.bgmC.stop();
} else {
if (this.bgmPlaying){
_local2 = new SoundTransform(volume, 0);
this.bgmC = this.bgm.sound.play(0, 100000, _local2);
};
};
};
}
public function playSound(_arg1:String, _arg2:Boolean=false):void{
var _local3:Number;
var _local4:SoundTransform;
if (this.soundOn){
if (this.sounds[_arg1] == null){
this.sounds[_arg1] = wbAssetManager.getInstance().getAudio(_arg1);
this.soundChannels[_arg1] = new SoundChannel();
if (_arg2){
this.loopedSounds[_arg1] = 0;
};
this.playing[_arg1] = false;
};
_local3 = 1;
if (this.sounds[_arg1].volume != null){
_local3 = this.sounds[_arg1].volume;
};
_local4 = new SoundTransform((volume * _local3), 0);
if (_arg2){
this.soundChannels[_arg1] = this.sounds[_arg1].sound.play(0, 100000, _local4);
} else {
this.soundChannels[_arg1] = this.sounds[_arg1].sound.play(0, 0, _local4);
};
this.playing[_arg1] = true;
};
}
public function toggleAll():void{
this.audioOn = !(this.audioOn);
this.toggleSound(this.audioOn);
this.toggleMusic(this.audioOn);
}
public function isSoundOn():Boolean{
return (this.soundOn);
}
public function isAllOn():Boolean{
return (this.audioOn);
}
public function isMusicOn():Boolean{
return (this.musicOn);
}
public function stopSounds():void{
var _local1:String;
for (_local1 in this.soundChannels) {
this.stopSound(_local1);
};
}
public function changeVolume(_arg1:int):void{
this.setVolume((this.volume + (_arg1 * 0.2)));
}
public function toString():String{
return ("wbAudioManager");
}
public function stopBGM():void{
this.bgmC.stop();
this.bgmPlaying = false;
}
public function playBGM(_arg1:String):void{
var _local2:Number;
var _local3:SoundTransform;
if (((!(this.bgmPlaying)) || (!((this.currentBGM == _arg1))))){
this.currentBGM = _arg1;
this.bgmC.stop();
this.bgm = wbAssetManager.getInstance().getAudio(_arg1);
this.bgmC = new SoundChannel();
this.bgmPlaying = true;
if (this.musicOn){
_local2 = 1;
if (this.bgm.volume != null){
_local2 = this.bgm.volume;
};
_local3 = new SoundTransform((this.volume * _local2), 0);
this.bgmC = this.bgm.sound.play(0, 100000, _local3);
};
};
}
public function pause(_arg1:Boolean):void{
var _local2:String;
if (_arg1){
if (this.musicOn){
this.bgmC.stop();
};
if (this.soundOn){
for (_local2 in this.soundChannels) {
this.soundChannels[_local2].stop();
this.playing[_local2] = false;
};
};
} else {
if (this.musicOn){
if (this.bgmPlaying){
this.bgmC = this.bgm.sound.play(0, 100000);
};
};
if (this.soundOn){
for (_local2 in this.loopedSounds) {
this.playSound(_local2, true);
};
};
};
}
public static function getInstance():wbAudioManager{
if (instance == null){
allowInstantiation = true;
instance = new (wbAudioManager);
allowInstantiation = false;
};
return (instance);
}
}
}//package WBE.Managers
Section 199
//wbDatabaseManager (WBE.Managers.wbDatabaseManager)
package WBE.Managers {
import flash.utils.*;
import Game.Data.*;
import WBE.Debug.*;
import WBE.Helpers.*;
public class wbDatabaseManager {
private var data:Dictionary;
private var actions:Dictionary;
private static var allowInstantiation:Boolean;
private static var instance:wbDatabaseManager;
public function wbDatabaseManager(){
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use wbDatabaseManager.getInstance() instead of new."));
};
}
public function init():void{
this.actions = DatabaseData.getInstance(this).dbActions;
this.data = DatabaseData.getInstance(this).dbData;
}
private function getValues(_arg1:Dictionary):Dictionary{
var _local2:Object;
var _local3:Object;
var _local4:int;
for (_local3 in _arg1) {
_local4 = 0;
while (_local4 < _arg1[_local3].length) {
_local2 = _arg1[_local3][_local4];
if (_local2.defaultData != undefined){
Log.wp(_local2.defaultData, -1, this);
_local2.value = _local2.defaultData;
} else {
if (_local2.varData != undefined){
Log.wp(_local2.varData, -1, this);
_local2.value = wbVarManager.getInstance().getVar(_local2.varData);
} else {
if (_local2.form != undefined){
Log.wp(wbVarManager.getInstance().getForm(_local2.form), -1, this);
_local2.value = wbVarManager.getInstance().getForm(_local2.form)[_local2.element];
} else {
if (_local2.varDataObject != undefined){
Log.wp(_local2.varDataObject, -1, this);
_local2.value = wbVarManager.getInstance().getVar(_local2.varDataObject)[_local2.property];
};
};
};
};
_local4++;
};
};
return (_arg1);
}
public function doAction(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
var _local4:Boolean;
var _local5:Dictionary;
var _local6:Object;
var _local7:Object;
var _local8:int;
var _local9:int;
_local4 = this.actions[_arg1].callbackWithObject;
_local5 = new Dictionary();
_local5 = this.data[actions[_arg1].input];
_local5 = getValues(_local5);
if (_arg3 != null){
_local8 = 0;
while (_local8 < _arg3.length) {
_local6 = _arg3[_local8];
_local9 = 0;
while (_local9 < _local5[_local6.dictName].length) {
if (_local5[_local6.dictName][_local9].varData == _local6.gameType){
_local5[_local6.dictName][_local9].value = _local6.value;
};
_local9++;
};
_local8++;
};
};
_local7 = DatabaseData.getInstance(this);
new wbDatabaseConnection(_local7.gameName, _local7.key, _local7.WBurl).doAction(_local5, _arg2, _local4);
}
public function toString():String{
return ("wbDatabaseManager");
}
public static function getInstance():wbDatabaseManager{
if (instance == null){
allowInstantiation = true;
instance = new (wbDatabaseManager);
allowInstantiation = false;
};
return (instance);
}
}
}//package WBE.Managers
Section 200
//wbDebugManager (WBE.Managers.wbDebugManager)
package WBE.Managers {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
public class wbDebugManager extends MovieClip {
private var maxCounter:Number;
private var measurePrevTime:int;
private var aveText:TextField;
private var frameRateMC:MovieClip;
private var frameRateArray:Array;
private var measureStartTime:int;
private var measureAve:Number;// = 0
private var frateText:TextField;
private var frameCount:int;// = 30
private var curFrameRate:Number;
private var displayDebug:Boolean;// = false
private var measuring:Boolean;// = false
private var keysDown:Array;
private var maxfRateArrayLength:Number;// = 100
private var frameCounter:int;
private var variationText:TextField;
private var measureStd:Number;// = 0
private var setFrameText:TextField;
private static var allowInstantiation:Boolean;
private static var instance:wbDebugManager;
public function wbDebugManager(){
keysDown = [0, 0];
frameCount = 30;
displayDebug = false;
measuring = false;
measureAve = 0;
measureStd = 0;
maxfRateArrayLength = 100;
super();
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use wbDebugManager.getInstance() instead of new."));
};
}
private function calculateAvgStd(){
var _local1:Number;
var _local2:Number;
var _local3:int;
var _local4:*;
_local1 = 0;
_local2 = 0;
_local4 = this.frameRateArray.length;
_local3 = 0;
while (_local3 < _local4) {
_local1 = (_local1 + this.frameRateArray[_local3]);
_local3++;
};
_local1 = (_local1 / _local4);
_local3 = 0;
while (_local3 < _local4) {
_local2 = (_local2 + Math.sqrt(Math.pow((this.frameRateArray[_local3] - _local1), 2)));
_local3++;
};
_local2 = (_local2 / _local4);
return ({avg:_local1, std:_local2, arrayLength:_local4});
}
public function init():void{
this.mouseEnabled = false;
this.frameRateMC = new MovieClip();
this.frameRateMC.mouseEnabled = false;
this.addChild(this.frameRateMC);
this.aveText = new TextField();
this.aveText.defaultTextFormat = wbSettingsManager.getInstance().getTextFormat("debug");
this.aveText.mouseEnabled = false;
this.aveText.selectable = false;
this.aveText.x = 10;
this.aveText.y = 20;
this.frateText = new TextField();
this.frateText.defaultTextFormat = wbSettingsManager.getInstance().getTextFormat("debug");
this.frateText.mouseEnabled = false;
this.frateText.selectable = false;
this.frateText.x = 10;
this.frateText.y = 10;
this.variationText = new TextField();
this.variationText.defaultTextFormat = wbSettingsManager.getInstance().getTextFormat("debug");
this.variationText.mouseEnabled = false;
this.variationText.selectable = false;
this.variationText.x = 10;
this.variationText.y = 30;
this.setFrameText = new TextField();
this.setFrameText.defaultTextFormat = wbSettingsManager.getInstance().getTextFormat("debug");
this.setFrameText.mouseEnabled = false;
this.setFrameText.selectable = false;
this.setFrameText.x = 10;
this.setFrameText.y = 40;
this.frameRateMC.addChild(this.frateText);
this.frameRateMC.addChild(this.aveText);
this.frameRateMC.addChild(this.variationText);
this.frameRateMC.addChild(this.setFrameText);
}
private function controlUp(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case 219:
keysDown[0] = 0;
break;
case 221:
keysDown[1] = 0;
break;
};
}
override public function toString():String{
return ("wbDebugManager");
}
private function setDebuggerText():void{
var _local1:Number;
var _local2:Number;
_local1 = (this.measureAve / (this.maxCounter * this.maxfRateArrayLength));
_local2 = (this.measureStd / (this.maxCounter * this.maxfRateArrayLength));
this.frateText.text = ("Rate: " + curFrameRate);
if (isNaN(_local1)){
this.aveText.text = "Ave: Calculating";
} else {
this.aveText.text = ("Ave: " + _local1);
};
if (isNaN(_local2)){
this.variationText.text = "Stdev: Calculating";
} else {
this.variationText.text = ("Stdev: " + _local2);
};
setFrameText.text = (((("Set: " + wbSettingsManager.getInstance().getSettings("frameRate")) + " (") + this.stage.frameRate) + ")");
}
public function startMeasuring():void{
this.frameRateArray = new Array();
this.measuring = true;
this.measureStartTime = getTimer();
this.measurePrevTime = getTimer();
this.measureAve = 0;
this.measureStd = 0;
this.maxCounter = 0;
}
public function off():void{
this.stage.removeEventListener(KeyboardEvent.KEY_UP, controlUp);
this.stage.removeEventListener(KeyboardEvent.KEY_DOWN, controlDown);
this.displayDebug = false;
}
private function controlDown(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case 219:
keysDown[0] = 1;
break;
case 221:
keysDown[1] = 1;
break;
};
}
public function stopMeasuring():void{
var _local1:int;
var _local2:int;
var _local3:Object;
var _local4:Number;
var _local5:Number;
this.measuring = false;
_local1 = getTimer();
_local2 = ((_local1 - this.measureStartTime) / 1000);
_local3 = calculateAvgStd();
if (_local3.arrayLength > 0){
this.measureStd = (this.measureStd + (_local3.std * _local3.arrayLength));
this.measureAve = (this.measureAve + (_local3.avg * _local3.arrayLength));
};
_local4 = (this.measureAve / ((this.maxCounter * this.maxfRateArrayLength) + _local3.arrayLength));
_local5 = (this.measureStd / ((this.maxCounter * this.maxfRateArrayLength) + _local3.arrayLength));
wbVarManager.getInstance().setVar("levelFrameRate", Math.round(_local4));
wbVarManager.getInstance().setVar("levelDevFrameRate", Math.round(_local5));
wbVarManager.getInstance().setVar("levelTime", int(_local2));
}
public function step():void{
var _local1:int;
var _local2:Object;
var _local3:int;
var _local4:int;
if (this.measuring){
_local1 = getTimer();
if (_local1 != this.measurePrevTime){
this.curFrameRate = (1000 / (_local1 - this.measurePrevTime));
this.measurePrevTime = _local1;
this.frameRateArray.push(this.curFrameRate);
};
if (this.frameRateArray.length == this.maxfRateArrayLength){
this.maxCounter++;
_local2 = calculateAvgStd();
this.frameRateArray = new Array();
this.measureStd = (this.measureStd + (_local2.std * _local2.arrayLength));
this.measureAve = (this.measureAve + (_local2.avg * _local2.arrayLength));
};
};
if (this.displayDebug){
if (!this.measuring){
startMeasuring();
};
this.frameCounter--;
if (this.frameCounter <= 0){
setDebuggerText();
this.frameCounter = this.frameCount;
};
_local3 = (-(keysDown[0]) + keysDown[1]);
if (_local3 != 0){
_local4 = (wbSettingsManager.getInstance().getSettings("frameRate") + _local3);
if (_local4 < 1){
_local4 = 1;
} else {
if (_local4 > 120){
_local4 = 120;
};
};
wbSettingsManager.getInstance().setSettings("frameRate", _local4);
};
};
}
public function on():void{
this.stage.addEventListener(KeyboardEvent.KEY_UP, controlUp);
this.stage.addEventListener(KeyboardEvent.KEY_DOWN, controlDown);
setFrameText.text = (((("Set: " + wbSettingsManager.getInstance().getSettings("frameRate")) + " (") + this.stage.frameRate) + ")");
this.displayDebug = true;
}
public static function getInstance():wbDebugManager{
if (instance == null){
allowInstantiation = true;
instance = new (wbDebugManager);
allowInstantiation = false;
};
return (instance);
}
}
}//package WBE.Managers
Section 201
//wbExternalAssetManager (WBE.Managers.wbExternalAssetManager)
package WBE.Managers {
import flash.net.*;
import flash.media.*;
public class wbExternalAssetManager {
public function wbExternalAssetManager():void{
}
public function getAudioAsset(_arg1:String){
var _local2:URLRequest;
var _local3:Sound;
_local2 = new URLRequest(_arg1);
_local3 = new Sound();
_local3.load(_local2);
_local3.play();
}
public function getGraphicalAsset(_arg1:String){
}
public function toString():String{
return ("wbExternalAssetManager");
}
}
}//package WBE.Managers
Section 202
//wbGameInputManager (WBE.Managers.wbGameInputManager)
package WBE.Managers {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import Game.Data.*;
import WBE.Helpers.*;
public class wbGameInputManager {
private var stageRef:Stage;
private var keysDown:Dictionary;
private static var allowInstantiation:Boolean;
private static var instance:wbGameInputManager;
public function wbGameInputManager(){
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use wbGameInputManager.getInstance() instead of new."));
};
}
private function upKey(_arg1:KeyboardEvent):void{
var _local2:int;
var _local3:Object;
if (this.keysDown[_arg1.keyCode] != null){
this.keysDown[_arg1.keyCode].counter = 0;
};
if (!wbStateManager.getInstance().isModalLayerOn()){
if (this.keysDown[_arg1.keyCode] != null){
_local2 = 0;
while (_local2 < this.keysDown[_arg1.keyCode].listeners.length) {
_local3 = this.keysDown[_arg1.keyCode].listeners[_local2];
if (_local3.upValue != null){
_local3.func.call(_local3.func, _local3.upValue);
} else {
_local3.func.call();
};
_local2++;
};
};
};
}
private function addEventListeners():void{
this.stageRef.addEventListener(KeyboardEvent.KEY_DOWN, downKey);
this.stageRef.addEventListener(KeyboardEvent.KEY_UP, upKey);
}
private function conditionMet(_arg1:Object, _arg2:int):Boolean{
switch (_arg1.condition){
case "e":
if (_arg2 == _arg1.conditionVal){
return (true);
};
return (false);
};
return (false);
}
private function removeEventListeners():void{
this.stageRef.removeEventListener(KeyboardEvent.KEY_DOWN, downKey);
this.stageRef.removeEventListener(KeyboardEvent.KEY_UP, upKey);
}
public function init(_arg1:Stage):void{
var _local2:Dictionary;
var _local3:int;
var _local4:Object;
var _local5:int;
this.stageRef = _arg1;
this.keysDown = new Dictionary();
_local2 = GameInputData.getInstance(this).keyMapping;
for each (_local4 in _local2) {
_local5 = 0;
while (_local5 < _local4.keys.length) {
_local3 = new wbKeyConverter().getKeyCode(_local4.keys[_local5]);
if (this.keysDown[_local3] == null){
this.keysDown[_local3] = new Object();
this.keysDown[_local3].listeners = new Array();
this.keysDown[_local3].counter = 0;
};
this.keysDown[_local3].listeners.push(_local4);
_local5++;
};
};
addEventListeners();
}
public function removeInstance():void{
instance = null;
allowInstantiation = true;
removeEventListeners();
GameInputData.getInstance(this).removeInstance();
}
public function toString():String{
return ("wbGameInputManager");
}
public function focusLost():void{
var _local1:*;
var _local2:int;
var _local3:Object;
for (_local1 in this.keysDown) {
if (((!((this.keysDown[_local1] == null))) && ((this.keysDown[_local1].counter > 0)))){
this.keysDown[_local1].counter = 0;
_local2 = 0;
while (_local2 < this.keysDown[_local1].listeners.length) {
_local3 = this.keysDown[_local1].listeners[_local2];
if (_local3.upValue != null){
_local3.func.call(_local3.func, _local3.upValue);
} else {
_local3.func.call();
};
_local2++;
};
};
};
}
private function downKey(_arg1:KeyboardEvent):void{
var _local2:int;
var _local3:Object;
if (!wbStateManager.getInstance().isModalLayerOn()){
if (this.keysDown[_arg1.keyCode] != null){
this.keysDown[_arg1.keyCode].counter++;
_local2 = 0;
while (_local2 < this.keysDown[_arg1.keyCode].listeners.length) {
_local3 = this.keysDown[_arg1.keyCode].listeners[_local2];
if (this.conditionMet(_local3, this.keysDown[_arg1.keyCode].counter)){
if (_local3.downValue != null){
_local3.func.call(_local3.func, _local3.downValue);
};
};
_local2++;
};
};
};
}
public static function getInstance():wbGameInputManager{
if (instance == null){
allowInstantiation = true;
instance = new (wbGameInputManager);
allowInstantiation = false;
};
return (instance);
}
}
}//package WBE.Managers
Section 203
//wbLibManager (WBE.Managers.wbLibManager)
package WBE.Managers {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.system.*;
import flash.net.*;
public class wbLibManager {
private var libPriorityList:Array;
private var libDict:Dictionary;
private var loadingCounter:int;
private var loadingDone:Boolean;// = false
private var totalLoadSize:Number;// = 0
private var loadProgress:Dictionary;
private static var allowInstantiation:Boolean;
private static var instance:wbLibManager;
public function wbLibManager(_arg1:Dictionary){
var _local2:Object;
loadingDone = false;
totalLoadSize = 0;
super();
this.libDict = new Dictionary();
this.loadProgress = new Dictionary();
this.loadingCounter = 0;
for each (_local2 in _arg1) {
this.loadingCounter++;
loadLib(_local2.url);
};
updateLibPriorityList(_arg1);
}
private function libProgress(_arg1:ProgressEvent):void{
this.loadProgress[_arg1.target] = _arg1.bytesLoaded;
}
private function urlError(_arg1:Event):void{
wbStateManager.getInstance().error((("library " + _arg1.target) + " not found"));
}
public function loadingComplete():Boolean{
return ((this.loadingCounter == 0));
}
public function getSourceURL():String{
var _local1:String;
_local1 = wbVarManager.getInstance().getVar("gameURL");
return (_local1.substring(0, (_local1.lastIndexOf("/") + 1)));
}
public function getLoadProgress():int{
var _local1:Number;
var _local2:Number;
if (this.totalLoadSize == 0){
return (100);
};
_local1 = 0;
for each (_local2 in this.loadProgress) {
_local1 = (_local1 + _local2);
};
return (Math.round(((100 * _local1) / this.totalLoadSize)));
}
public function libLoaded(_arg1:Event):void{
this.loadingCounter--;
}
public function toString():String{
return ("wbLibManager");
}
private function isNotNull(_arg1, _arg2:int, _arg3:Array):Boolean{
return (!((_arg1 == null)));
}
public function getAssetFromLibs(_arg1:String):Object{
var i:Number;
var mc:Object;
var mcClass:Object;
var lib:Loader;
var id = _arg1;
i = 0;
while (i < this.libPriorityList.length) {
lib = libDict[this.libPriorityList[i]];
try {
mcClass = Class(lib.contentLoaderInfo.applicationDomain.getDefinition(id));
} catch(e:Error) {
mcClass = null;
};
if (mcClass != null){
return (new (mcClass));
};
i = (i + 1);
};
return (null);
}
private function libInit(_arg1:Event):void{
totalLoadSize = (totalLoadSize + _arg1.target.bytesTotal);
}
private function updateLibPriorityList(_arg1:Dictionary):void{
var _local2:Array;
var _local3:String;
this.libPriorityList = new Array();
_local2 = new Array();
for (_local3 in _arg1) {
if (_arg1[_local3].priority != null){
this.libPriorityList[_arg1[_local3].priority] = _arg1[_local3].url;
} else {
_local2.push(_arg1[_local3].url);
};
};
this.libPriorityList = this.libPriorityList.concat(_local2);
this.libPriorityList = this.libPriorityList.filter(isNotNull);
this.libPriorityList = this.libPriorityList.reverse();
}
public function loadLib(_arg1:String):void{
var _local2:LoaderContext;
var _local3:Loader;
_local2 = new LoaderContext();
_local2.applicationDomain = new ApplicationDomain();
_local3 = new Loader();
_local3.contentLoaderInfo.addEventListener(Event.INIT, libInit);
_local3.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, libProgress);
_local3.contentLoaderInfo.addEventListener(Event.COMPLETE, libLoaded);
_local3.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, urlError);
_local3.load(new URLRequest(((getSourceURL() + wbSettingsManager.getInstance().getSettings("libPath")) + _arg1)));
this.libDict[_arg1] = _local3;
}
}
}//package WBE.Managers
Section 204
//wbSettingsManager (WBE.Managers.wbSettingsManager)
package WBE.Managers {
import flash.utils.*;
import flash.text.*;
import Game.Data.*;
public class wbSettingsManager {
private var settingsData:SettingsData;
private static var allowInstantiation:Boolean;
private static var instance:wbSettingsManager;
public function wbSettingsManager(){
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use wbwbSettingsManager.getInstance() instead of new."));
};
settingsData = SettingsData.getInstance(this);
}
public function getSettings(_arg1:String){
return (settingsData.settings[_arg1]);
}
public function setSettings(_arg1:String, _arg2):void{
settingsData.settings[_arg1] = _arg2;
}
public function removeInstance():void{
}
public function getTextFormat(_arg1:String):TextFormat{
if (settingsData.textFormats[_arg1] != null){
return (settingsData.textFormats[_arg1]);
};
return (settingsData.textFormats["default"]);
}
public function toggleTurbo(){
settingsData.settings["turbo"] = !(settingsData.settings["turbo"]);
}
public function toString():String{
return ("wbSettingsManager");
}
public function getURL(_arg1:String):String{
return (settingsData.urls[_arg1]);
}
public function getFilterSet(_arg1:String):Array{
return (settingsData.filterSets[_arg1]);
}
public function getPoints(_arg1:Object):Dictionary{
if ((_arg1 is wbVarManager)){
return (settingsData.points);
};
wbStateManager.getInstance().error("Illegal call, this function can only be called by called by wbVarManager", this, "getPoints");
return (null);
}
public function getWorldSettings(_arg1:String):int{
return (settingsData.worldSettings[_arg1]);
}
public static function getInstance():wbSettingsManager{
if (instance == null){
allowInstantiation = true;
instance = new (wbSettingsManager);
allowInstantiation = false;
};
return (instance);
}
}
}//package WBE.Managers
Section 205
//wbStateManager (WBE.Managers.wbStateManager)
package WBE.Managers {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import Game.Data.*;
import WBE.Debug.*;
import caurina.transitions.*;
import WBE.States.*;
import Game.States.*;
import WBE.UI.*;
public class wbStateManager extends MovieClip {
private var states:Dictionary;
private var prevDisabledMode:String;
private var modalLayerClip:MovieClip;
private var nextStateData:Object;
private var infoWindow:MovieClip;
private var bg:MovieClip;
private var overlay:MovieClip;
private var currentStateData:Object;
private var modalLayers:Dictionary;
private var gameMenu:MovieClip;
private var prevMode:String;
private var currentStateNr:int;
private var dm:wbDebugManager;
private var currentState:wbState;
private var modalLayer:MovieClip;
public var frameRateOn:Boolean;// = false
private var vm:wbVarManager;
private var modalLayerShown:Boolean;// = false
private var back:MovieClip;
private var disabledMC:MovieClip;
private var prevGameArgs:Object;
private var nextState:wbState;
private var animation:MovieClip;
private var lastState:int;
private var mode:String;// = "state"
private var databaseManager:wbDatabaseManager;
private var activityIndicator:MovieClip;
private static var allowInstantiation:Boolean;
private static var instance:wbStateManager;
public function wbStateManager():void{
frameRateOn = false;
mode = "state";
modalLayerShown = false;
super();
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use wbStateManager.getInstance() instead of new."));
};
}
public function error(_arg1:String, _arg2:Object=null, _arg3:String=""):void{
this.mode = "error";
Log.w(("There was an error: " + _arg1), _arg2, _arg3);
}
public function exitState(_arg1:String):void{
this.getNextState(_arg1);
}
private function stageDeactivate(_arg1:Event):void{
this.setDisabled(true);
}
public function removeFromOverlay(_arg1:DisplayObject):void{
if (this.overlay.getChildByName(_arg1.name)){
this.overlay.removeChild(_arg1);
if (this.overlay.numChildren == 0){
this.overlay.visible = false;
};
};
}
public function music(_arg1:MouseEvent):void{
this.toggleMusic();
}
private function removeModalLayer(_arg1:MovieClip):void{
_arg1.modal_bg.removeEventListener(MouseEvent.MOUSE_DOWN, modalLayerBlockMouse);
_arg1.modal_bg.removeEventListener(MouseEvent.MOUSE_MOVE, modalLayerBlockMouse);
_arg1.modal_bg.removeEventListener(MouseEvent.MOUSE_OUT, modalLayerBlockMouse);
_arg1.modal_bg.removeEventListener(MouseEvent.MOUSE_OVER, modalLayerBlockMouse);
_arg1.modal_bg.removeEventListener(MouseEvent.MOUSE_UP, modalLayerBlockMouse);
_arg1.modal_bg.removeEventListener(MouseEvent.MOUSE_WHEEL, modalLayerBlockMouse);
}
public function openInfoWindow(_arg1:String):void{
this.setPause(true);
this.infoWindow = new wbInfoWindow(_arg1, this.currentState);
this.addToModalLayer(this.infoWindow, false);
}
public function closeInfoWindow():void{
this.setPause(false);
if (this.infoWindow != null){
this.removeFromModalLayer(this.infoWindow);
this.infoWindow = null;
};
}
public function toggleSound():void{
wbAudioManager.getInstance().toggleSound();
}
public function start():void{
var _local1:wbConsole;
if (this.currentState != null){
throw (new Error("wbStateManager allready started"));
};
if (this.mode != "error"){
this.currentStateData = StateData.getInstance(this).states[StateData.getInstance(this).startState];
this.currentStateData.id = StateData.getInstance(this).startState;
this.currentState = this.createStateFromData(this.currentStateData);
this.back.addChild(this.currentState);
this.currentState.enter();
if (wbSettingsManager.getInstance().getSettings("debug")){
if (this.frameRateOn){
this.overlay.addChild(this.dm);
this.dm.on();
};
_local1 = wbConsole.getInstance();
this.overlay.addChild(_local1);
};
this.stage.addEventListener(KeyboardEvent.KEY_UP, controlUp);
};
}
override public function toString():String{
return ("wbStateManager");
}
private function stageFocusOut(_arg1:Event):void{
this.stage.stageFocusRect = false;
this.stage.focus = this.currentState;
}
public function showOverlay():void{
this.overlay.visible = true;
}
public function createStateFromData(_arg1:Object):wbState{
var stateName:String;
var stateClass:Object;
var state:wbState;
var stateData = _arg1;
stateName = (stateData.type + "State");
try {
stateClass = (getDefinitionByName(("Game.States." + stateName)) as Class);
} catch(e:ReferenceError) {
try {
stateClass = (getDefinitionByName(("WBE.States.wb" + stateName)) as Class);
} catch(e:ReferenceError) {
this.error((stateName + " could not be found"));
};
};
state = new stateClass(stateData.args);
return (state);
}
public function getNextState(_arg1:String):void{
this.closeGameMenu();
if (this.mode == "db"){
this.removeChild(this.activityIndicator);
this.bg = null;
this.activityIndicator = null;
};
this.currentStateData = findNextState(currentStateData.id, _arg1);
if (((!((this.currentStateData.type == "anim"))) && (!((this.currentState == null))))){
this.currentState.exit();
this.back.removeChild(this.currentState);
delete ??getglobalscope
[this.back.getChildByName(this.currentState.name)];
};
switch (this.currentStateData.type){
case "db":
this.currentState = null;
this.activityIndicator = MovieClip(wbAssetManager.getInstance().getGraphics("activityIndicator"));
this.activityIndicator.x = (wbSettingsManager.getInstance().getWorldSettings("width") / 2);
this.activityIndicator.y = (wbSettingsManager.getInstance().getWorldSettings("height") / 2);
this.addChild(this.activityIndicator);
wbDatabaseManager.getInstance().doAction(this.currentStateData.args.type, dbDone);
this.mode = "db";
break;
case "anim":
this.animation = MovieClip(wbAssetManager.getInstance().getGraphics(this.currentStateData.args.id));
this.addChild(this.animation);
this.animation.addEventListener(MouseEvent.MOUSE_DOWN, modalLayerBlockMouse);
this.animation.addEventListener(MouseEvent.MOUSE_MOVE, modalLayerBlockMouse);
this.animation.addEventListener(MouseEvent.MOUSE_OUT, modalLayerBlockMouse);
this.animation.addEventListener(MouseEvent.MOUSE_OVER, modalLayerBlockMouse);
this.animation.addEventListener(MouseEvent.MOUSE_UP, modalLayerBlockMouse);
this.animation.addEventListener(MouseEvent.MOUSE_WHEEL, modalLayerBlockMouse);
this.mode = "anim";
break;
default:
this.mode = "state";
this.currentState = this.createStateFromData(this.currentStateData);
this.back.addChild(this.currentState);
this.currentState.enter();
break;
};
}
public function closeGameMenu():void{
this.setPause(false);
if (this.gameMenu != null){
this.gameMenu.remove();
this.removeFromModalLayer(this.gameMenu);
this.gameMenu = null;
};
}
public function hideOverlay():void{
this.overlay.visible = false;
}
public function setPause(_arg1:Boolean):void{
if (((_arg1) && (!((this.mode == "pause"))))){
this.prevMode = this.mode;
this.mode = "pause";
} else {
if (((!(_arg1)) && ((this.mode == "pause")))){
this.mode = this.prevMode;
};
};
}
private function createModalLayer():MovieClip{
var _local1:MovieClip;
_local1 = MovieClip(wbAssetManager.getInstance().getGraphics("modalLayer"));
_local1.alpha = 0.5;
_local1.modal_bg.width = wbSettingsManager.getInstance().getWorldSettings("width");
_local1.modal_bg.height = wbSettingsManager.getInstance().getWorldSettings("height");
_local1.modal_bg.addEventListener(MouseEvent.MOUSE_DOWN, modalLayerBlockMouse);
_local1.modal_bg.addEventListener(MouseEvent.MOUSE_MOVE, modalLayerBlockMouse);
_local1.modal_bg.addEventListener(MouseEvent.MOUSE_OUT, modalLayerBlockMouse);
_local1.modal_bg.addEventListener(MouseEvent.MOUSE_OVER, modalLayerBlockMouse);
_local1.modal_bg.addEventListener(MouseEvent.MOUSE_UP, modalLayerBlockMouse);
_local1.modal_bg.addEventListener(MouseEvent.MOUSE_WHEEL, modalLayerBlockMouse);
_local1.modal_bg.useHandCursor = false;
return (_local1);
}
public function closeModalLayer(_arg1:Event):void{
this.removeFromModalLayer(_arg1.currentTarget.parent.getChildByName("mc"));
}
public function step():void{
var _local1:String;
switch (this.mode){
case "state":
Tweener.onEnterFrame(new Event(""));
_local1 = this.currentState.step();
if (_local1 != ""){
this.getNextState(_local1);
};
break;
case "db":
break;
case "anim":
if (this.animation.currentLabel == "end"){
this.removeChild(this.animation);
this.animation.removeEventListener(MouseEvent.MOUSE_DOWN, modalLayerBlockMouse);
this.animation.removeEventListener(MouseEvent.MOUSE_MOVE, modalLayerBlockMouse);
this.animation.removeEventListener(MouseEvent.MOUSE_OUT, modalLayerBlockMouse);
this.animation.removeEventListener(MouseEvent.MOUSE_OVER, modalLayerBlockMouse);
this.animation.removeEventListener(MouseEvent.MOUSE_UP, modalLayerBlockMouse);
this.animation.removeEventListener(MouseEvent.MOUSE_WHEEL, modalLayerBlockMouse);
if (this.currentState != null){
this.currentState.exit();
this.back.removeChild(this.currentState);
delete ??getglobalscope
[this.back.getChildByName(this.currentState.name)];
};
this.currentState = null;
this.getNextState("end");
};
break;
case "error":
break;
case "pause":
break;
};
this.dm.step();
this.vm.step();
}
public function addToModalLayer(_arg1:MovieClip, _arg2:Boolean=true):void{
var _local3:MovieClip;
var _local4:MovieClip;
var _local5:DisplayObject;
var _local6:Number;
_local3 = new MovieClip();
_local4 = this.createModalLayer();
_local4.name = "modalLayer";
_local3.addChild(_local4);
_arg1.x = ((_local3.width / 2) - (_arg1.width / 2));
_arg1.y = ((_local3.height / 2) - (_arg1.height / 2));
_local3.addChild(_arg1);
_arg1.name = "mc";
this.modalLayers[_arg1] = _local3;
this.modalLayerClip.addChild(_local3);
if (_arg2){
_local5 = DisplayObject(wbAssetManager.getInstance().getGraphics("modalLayerClose_btn"));
_local6 = 5;
_local5.addEventListener(MouseEvent.MOUSE_UP, closeModalLayer);
_local5.x = (((_arg1.x + _arg1.width) - _local5.width) - _local6);
_local5.y = (_arg1.y + _local6);
_local3.addChild(_local5);
};
}
public function setPrevGameArgs(_arg1:Object):void{
this.prevGameArgs = _arg1;
}
private function mouseUpDisabled(_arg1:Event):void{
_arg1.stopImmediatePropagation();
this.setDisabled(false);
}
public function openGameMenu(_arg1:String):void{
this.setPause(true);
this.gameMenu = new wbGameMenu(_arg1, this.currentState);
this.addToModalLayer(this.gameMenu, false);
}
public function belongsToCurrentState(_arg1:MovieClip):Boolean{
var _local2:DisplayObjectContainer;
_local2 = _arg1;
while (_local2 != null) {
if (_local2 == this.states[this.currentStateNr]){
return (true);
};
_local2 = _local2.parent;
};
return (false);
}
public function setDisabled(_arg1:Boolean):void{
var _local2:MovieClip;
var _local3:MovieClip;
if (((_arg1) && ((this.disabledMC == null)))){
this.prevDisabledMode = this.mode;
this.mode = "pause";
this.disabledMC = new MovieClip();
_local2 = MovieClip(wbAssetManager.getInstance().getGraphics("pausedMessageBG"));
_local3 = MovieClip(wbAssetManager.getInstance().getGraphics("pausedMessageMC"));
_local2.width = wbSettingsManager.getInstance().getWorldSettings("width");
_local2.height = wbSettingsManager.getInstance().getWorldSettings("height");
this.disabledMC.addChild(_local2);
this.disabledMC.addChild(_local3);
_local3.x = (_local2.width / 2);
_local3.y = (_local2.height / 2);
_local3.mouseEnabled = false;
this.addToModalLayer(this.disabledMC, false);
this.disabledMC.addEventListener(MouseEvent.MOUSE_UP, mouseUpDisabled);
wbAudioManager.getInstance().pause(true);
wbGameInputManager.getInstance().focusLost();
} else {
if (((!(_arg1)) && (!((this.disabledMC == null))))){
this.mode = this.prevDisabledMode;
this.disabledMC.removeEventListener(MouseEvent.MOUSE_UP, mouseUpDisabled);
this.removeFromModalLayer(this.disabledMC);
this.disabledMC = null;
wbAudioManager.getInstance().pause(false);
};
};
}
public function togglePause():void{
if (this.mode == "pause"){
this.setPause(false);
} else {
this.setPause(true);
};
}
public function getCurrentState():wbState{
return (this.currentState);
}
public function init():void{
this.states = new Dictionary(true);
this.currentStateNr = 0;
this.lastState = 0;
this.back = new MovieClip();
this.overlay = new MovieClip();
this.modalLayerClip = new MovieClip();
this.modalLayers = new Dictionary();
this.addChild(back);
this.addChild(wbTooltipManager.getInstance());
this.addChild(overlay);
this.addChild(this.modalLayerClip);
this.overlay.mouseEnabled = false;
this.dm = wbDebugManager.getInstance();
this.dm.init();
this.vm = wbVarManager.getInstance();
this.addStageListeners();
this.start();
}
public function push(_arg1:wbState):void{
this.lastState++;
this.states[this.lastState] = _arg1;
}
public function controlUp(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case 65:
if (((_arg1.altKey) || (_arg1.shiftKey))){
this.toggleConsole();
};
break;
case 192:
this.toggleConsole();
break;
case 68:
if (((_arg1.altKey) || (_arg1.shiftKey))){
this.toggleDebug();
};
break;
case 56:
break;
case 57:
break;
};
}
public function dbDone():void{
this.getNextState("done");
}
public function isPaused():Boolean{
return ((this.mode == "pause"));
}
public function toggleMusic():void{
wbAudioManager.getInstance().toggleMusic();
}
private function stageFocusIn(_arg1:Event):void{
}
public function toggleDebug():void{
Log.w("toggleDebug");
if (wbSettingsManager.getInstance().getSettings("debug")){
if (this.frameRateOn){
this.dm.off();
this.overlay.removeChild(this.dm);
} else {
this.overlay.addChild(this.dm);
this.dm.on();
};
this.frameRateOn = !(this.frameRateOn);
};
}
public function toggleConsole():void{
Log.w("toggleConsole");
if (wbSettingsManager.getInstance().getSettings("debug")){
wbConsole.getInstance().toggle();
};
}
public function endGame():void{
wbVarManager.getInstance().stopTime();
}
public function showModalLayer():void{
this.modalLayer = this.createModalLayer();
this.modalLayerClip.addChild(this.modalLayer);
this.modalLayerShown = true;
}
public function dbSessionCreated():void{
}
public function removeFromModalLayer(_arg1:MovieClip):void{
if (this.modalLayers[_arg1] != null){
this.removeModalLayer(this.modalLayers[_arg1].getChildByName("modalLayer"));
this.modalLayerClip.removeChild(this.modalLayers[_arg1]);
delete this.modalLayers[_arg1];
};
}
public function findNextState(_arg1:String, _arg2:String):Object{
var _local3:String;
var _local4:Array;
var _local5:int;
var _local6:String;
var _local7:Object;
_local3 = "getNextState";
Log.w(((("currentStateID: " + _arg1) + " exitCode: ") + _arg2), this, _local3);
_local4 = StateData.getInstance(this).states[_arg1].next;
_local5 = 0;
while (_local5 < _local4.length) {
if (_local4[_local5][0] == _arg2){
_local6 = _local4[_local5][1];
_local7 = StateData.getInstance(this).states[_local6];
_local7.id = _local6;
return (_local7);
};
_local5++;
};
throw (new Error("No next state could be found"));
}
public function addToOverlay(_arg1:DisplayObject):void{
this.overlay.addChild(_arg1);
this.overlay.visible = true;
}
public function getPrevGameArgs():Object{
return (this.prevGameArgs);
}
public function audio(_arg1:MouseEvent):void{
this.toggleSound();
}
private function addStageListeners():void{
this.stage.addEventListener(Event.DEACTIVATE, stageDeactivate);
this.stage.addEventListener(FocusEvent.FOCUS_IN, stageFocusIn);
this.stage.addEventListener(FocusEvent.FOCUS_OUT, stageFocusOut);
}
private function modalLayerBlockMouse(_arg1:MouseEvent):void{
_arg1.stopImmediatePropagation();
}
public function toggleGameMenu(_arg1:String):void{
if (this.gameMenu != null){
this.closeGameMenu();
} else {
this.openGameMenu(_arg1);
};
}
public function isModalLayerOn():Boolean{
return (this.modalLayerShown);
}
public static function getGameState():GameState{
var _local1:wbState;
_local1 = wbStateManager.getInstance().getCurrentState();
if ((_local1 is GameState)){
return (GameState(_local1));
};
return (null);
}
public static function getInstance():wbStateManager{
if (instance == null){
allowInstantiation = true;
instance = new (wbStateManager);
allowInstantiation = false;
};
return (instance);
}
}
}//package WBE.Managers
Section 206
//wbTooltipManager (WBE.Managers.wbTooltipManager)
package WBE.Managers {
import flash.events.*;
import flash.display.*;
import caurina.transitions.*;
public class wbTooltipManager extends MovieClip {
private var tooltip:MovieClip;
private var tooltipCaller:Object;
private static var allowInstantiation:Boolean;
private static var instance:wbTooltipManager;
public function wbTooltipManager(){
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use wbTooltipManager.getInstance() instead of new."));
};
this.mouseEnabled = false;
this.mouseChildren = false;
}
public function removeInstance():void{
}
private function moveMouse(_arg1:MouseEvent):void{
if (this.tooltip != null){
this.positionTooltip(_arg1.stageX, _arg1.stageY);
};
_arg1.updateAfterEvent();
}
override public function toString():String{
return ("wbTooltipManager");
}
public function hideTooltip(_arg1:Object):void{
var caller = _arg1;
if (this.tooltipCaller == caller){
if (this.tooltip != null){
this.removeChild(this.tooltip);
};
this.tooltip = null;
this.tooltipCaller = null;
try {
this.stage.removeEventListener(MouseEvent.MOUSE_MOVE, moveMouse);
} catch(e:Error) {
};
};
}
public function showTooltip(_arg1:Object, _arg2:String):void{
if (this.tooltipCaller != _arg1){
if (this.tooltip != null){
this.tooltipCaller.removeChild(this.tooltip);
};
this.tooltipCaller = _arg1;
this.tooltip = MovieClip(wbAssetManager.getInstance().getGraphics("tooltip"));
this.tooltip.alpha = 0;
this.tooltip.textField.text = _arg2;
this.tooltip.textField.embedFonts = true;
this.tooltip.bg.width = (this.tooltip.textField.textWidth + 6);
this.tooltip.textField.width = this.tooltip.bg.width;
this.addChild(this.tooltip);
this.positionTooltip(this.stage.mouseX, this.stage.mouseY);
this.stage.addEventListener(MouseEvent.MOUSE_MOVE, moveMouse);
Tweener.addTween(this.tooltip, {alpha:1, delay:20, time:40, useFrames:true, transition:"easeOutExpo"});
};
}
private function positionTooltip(_arg1:Number, _arg2:Number):void{
var _local3:Number;
this.tooltip.x = _arg1;
this.tooltip.y = _arg2;
_local3 = wbSettingsManager.getInstance().getWorldSettings("width");
if ((this.tooltip.x + this.tooltip.width) > _local3){
this.tooltip.x = (_local3 - this.tooltip.width);
};
if ((this.tooltip.y - this.tooltip.height) < 0){
this.tooltip.y = this.tooltip.height;
};
}
public function getTooltip():MovieClip{
return (this.tooltip);
}
public static function getInstance():wbTooltipManager{
if (instance == null){
allowInstantiation = true;
instance = new (wbTooltipManager);
allowInstantiation = false;
};
return (instance);
}
}
}//package WBE.Managers
Section 207
//wbVarManager (WBE.Managers.wbVarManager)
package WBE.Managers {
import flash.utils.*;
import Game.Data.*;
import WBE.Debug.*;
import de.polygonal.math.*;
import com.electrotank.util.*;
public class wbVarManager {
private var totalScores:Dictionary;
private var timing:Boolean;
private var levelScores:Dictionary;
private var currentScore:Number;
private var frameTimers:Array;
private var prevTime:int;
private var randomizer:PM_PRNG;
private var points:Dictionary;
private var frameNr:int;// = 0
private var vars:Dictionary;
private var forms:Dictionary;
private var rank:Number;
private var varFunctions:Dictionary;
private static var allowInstantiation:Boolean;
private static var instance:wbVarManager;
public function wbVarManager(){
frameNr = 0;
super();
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use wbVarManager.getInstance() instead of new."));
};
this.vars = new Dictionary();
this.forms = VarData.getInstance(this).forms;
this.vars["mode"] = {value:"", type:String};
this.vars["frameNr"] = {value:0, type:int};
this.vars["time"] = {value:0, type:int};
this.vars["score"] = {value:0, type:int};
this.vars["rank"] = {value:0, type:int};
this.vars["totalPlayers"] = {value:0, type:int};
this.vars["playerid"] = {value:0, type:int};
this.vars["sessionid"] = {value:0, type:int};
this.vars["playthroughid"] = {value:0, type:int};
this.vars["levelFrameRate"] = {type:Number};
this.vars["levelDevFrameRate"] = {type:Number};
this.vars["levelTime"] = {type:Number};
this.vars["gameURL"] = {value:"", type:String};
this.initVars();
this.varFunctions = VarData.getInstance(this).varFunctions;
this.frameTimers = new Array();
this.totalScores = new Dictionary();
this.levelScores = new Dictionary();
this.points = wbSettingsManager.getInstance().getPoints(this);
this.randomizer = new PM_PRNG();
this.randomizer.seed = Math.floor((Math.random() * 1000));
this.randomizer.nextDouble();
}
public function _random():Number{
return (this.randomizer.nextDouble());
}
public function getForm(_arg1:String):Object{
var _local2:String;
_local2 = "getForm";
Log.w(_arg1, this, _local2);
if (this.forms[_arg1] != null){
return (this.forms[_arg1]);
};
wbStateManager.getInstance().error((("Form " + _arg1) + " does not exist"), this, _local2);
return (null);
}
public function addToVar(_arg1:String, _arg2){
var _local3:String;
_local3 = "addToVar";
if ((((this.vars[_arg1].type == int)) || ((this.vars[_arg1].type == Number)))){
MemoryCrypto.incrementValue(_arg1, _arg2);
} else {
wbStateManager.getInstance().error(((("Error: Can only add to vars of type int or Number " + _arg1) + " is of type ") + this.vars[_arg1].type), this, _local3);
};
}
public function setForm(_arg1:String, _arg2:Object):void{
var _local3:String;
_local3 = "setForm";
Log.w(_arg1, this, _local3);
if (this.forms[_arg1] != null){
this.forms[_arg1] = _arg2;
} else {
wbStateManager.getInstance().error((("Form " + _arg1) + " does not exist"), this, _local3);
};
}
public function getVarType(_arg1:String):Class{
if (this.vars[_arg1] != null){
return (this.vars[_arg1].type);
};
throw (new Error((("variable " + _arg1) + " does not exist.")));
}
public function step():void{
var _local1:Number;
MemoryCrypto.incrementValue("frameNr", 1);
if (this.timing){
_local1 = new Date().getTime();
MemoryCrypto.incrementValue("time", (_local1 - prevTime));
prevTime = _local1;
};
checkFrameTimers();
}
private function checkFrameTimers():void{
var _local1:Object;
if (this.frameTimers.length > 0){
_local1 = this.frameTimers[(this.frameTimers.length - 1)];
if (_local1.endFrame <= MemoryCrypto.getValue("frameNr")){
_local1.callback.call();
this.frameTimers.pop();
this.checkFrameTimers();
};
};
}
public function startTime():void{
this.timing = true;
MemoryCrypto.setValue("time", 0);
this.prevTime = new Date().getTime();
}
public function resumeTime():void{
this.timing = true;
this.prevTime = new Date().getTime();
}
public function initVars():void{
var _local1:Dictionary;
var _local2:String;
_local1 = VarData.getInstance(this).vars;
for (_local2 in _local1) {
this.vars[_local2] = _local1[_local2];
};
for (_local2 in this.vars) {
if ((((((this.vars[_local2].type == int)) || ((this.vars[_local2].type == Number)))) && (!((this.vars[_local2].valueOf == null))))){
MemoryCrypto.setValue(_local2, this.vars[_local2].value);
};
};
}
public function setVar(_arg1:String, _arg2):void{
var _local3:String;
_local3 = "setVar";
if (this.vars[_arg1] != null){
if ((_arg2 is this.vars[_arg1].type)){
if ((((this.vars[_arg1].type == int)) || ((this.vars[_arg1].type == Number)))){
MemoryCrypto.setValue(_arg1, _arg2);
} else {
this.vars[_arg1].value = _arg2;
};
} else {
wbStateManager.getInstance().error(((("Type error: Variable " + _arg1) + " is of type ") + this.vars[_arg1].type), this, _local3);
};
} else {
wbStateManager.getInstance().error((("variable " + _arg1) + " does not exist."), this, _local3);
};
}
public function addScore(_arg1:String, _arg2:Number=NaN):void{
if (this.levelScores[_arg1]){
var _local3 = this.levelScores;
var _local4 = _arg1;
var _local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
} else {
this.levelScores[_arg1] = 1;
};
if (isNaN(_arg2)){
if (this.points[_arg1]){
MemoryCrypto.incrementValue("score", this.points[_arg1]);
};
} else {
MemoryCrypto.incrementValue("score", _arg2);
};
}
public function addFrameTimer(_arg1:int, _arg2:Object):void{
this.frameTimers.push({endFrame:(MemoryCrypto.getValue("frameNr") + _arg1), callback:_arg2});
this.frameTimers.sortOn("endFrame", Array.DESCENDING);
}
public function getCurrentTime():Number{
return ((MemoryCrypto.getValue("time") / 1000));
}
public function getVar(_arg1:String){
if (this.vars[_arg1] != null){
if ((((this.vars[_arg1].type == int)) || ((this.vars[_arg1].type == Number)))){
return (MemoryCrypto.getValue(_arg1));
};
return (this.vars[_arg1].value);
//unresolved jump
};
if (this.varFunctions[_arg1] != null){
return (this.varFunctions[_arg1].call());
};
throw (new Error((("variable " + _arg1) + " does not exist.")));
}
public function removeInstance():void{
}
public function toString():String{
return ("wbVarManager");
}
public function stopTime():void{
this.timing = false;
}
public static function random():Number{
return (wbVarManager.getInstance()._random());
}
public static function getInstance():wbVarManager{
if (instance == null){
allowInstantiation = true;
instance = new (wbVarManager);
allowInstantiation = false;
};
return (instance);
}
}
}//package WBE.Managers
Section 208
//wbMode (WBE.Modes.wbMode)
package WBE.Modes {
import WBE.Managers.*;
import flash.utils.*;
import flash.text.*;
public class wbMode {
protected var currentStep:String;
protected var announce:TextField;
protected var stepFunctions:Dictionary;
protected var stepPhase:int;// = 0
private var doCurrentStep:Boolean;// = true
public function wbMode(_arg1:Object):void{
var _local2:TextFormat;
doCurrentStep = true;
stepPhase = 0;
super();
_local2 = new TextFormat();
_local2.color = 0xFFFF00;
_local2.size = 40;
_local2.font = "Trajan Pro";
_local2.align = "center";
_local2.bold = true;
this.announce = new TextField();
this.announce.defaultTextFormat = _local2;
this.announce.x = 200;
this.announce.y = 200;
this.announce.width = 200;
this.announce.height = 100;
this.stepFunctions = new Dictionary();
this.stepFunctions["default"] = {func:defaultStep, type:"loop", next:"default"};
this.currentStep = "default";
}
protected function removeSub():void{
}
public function remove():void{
this.removeSub();
}
public function nextPhase(_arg1:String=""):void{
if (_arg1 == ""){
this.currentStep = this.stepFunctions[this.currentStep].next;
} else {
this.currentStep = _arg1;
};
this.doCurrentStep = true;
switch (this.stepFunctions[this.currentStep].type){
case "loop":
break;
case "single":
break;
case "stop":
break;
case "wait":
wbVarManager.getInstance().addFrameTimer(this.stepFunctions[this.currentStep].time, waitDone);
break;
};
}
public function step():void{
var _local1:String;
if (this.stepFunctions[this.currentStep].type == "stop"){
if (this.doCurrentStep){
this.stepFunctions[this.currentStep].func.call();
this.doCurrentStep = false;
};
} else {
_local1 = this.stepFunctions[this.currentStep].type;
this.stepFunctions[this.currentStep].func.call();
if (_local1 == "single"){
this.nextPhase();
};
};
}
private function waitDone():void{
this.nextPhase();
}
private function defaultStep():void{
}
}
}//package WBE.Modes
Section 209
//wbGameState (WBE.States.wbGameState)
package WBE.States {
import flash.display.*;
import WBE.Managers.*;
import flash.utils.*;
import Game.GameWorld.*;
import WBE.UI.*;
import WBE.Cameras.*;
import Game.Modes.*;
public class wbGameState extends wbState {
private var cameraLayer:MovieClip;
protected var interf:wbInterface;
protected var camera:wbPlayerCam;
protected var modeType:String;
protected var gameLoaded:Boolean;// = false
protected var world:World;
protected var mode:Mode;
protected var args:Object;
private var pause:Boolean;// = false
public function wbGameState(_arg1:Object):void{
var _local2:wbStateManager;
pause = false;
gameLoaded = false;
camera = wbPlayerCam.getInstance();
interf = wbInterface.getInstance();
world = World.getInstance();
super();
this.args = _arg1;
_local2 = wbStateManager.getInstance();
this.cameraLayer = new MovieClip();
this.addChild(this.cameraLayer);
this.cameraLayer.addChild(camera);
this.addChild(interf);
}
override public function exit():void{
wbGameInputManager.getInstance().removeInstance();
this.camera.removeInstance();
this.interf.removeInstance();
this.world.removeInstance();
this.camera.removeWorld(world);
}
override public function toString():String{
return ("wbGameState");
}
public function getCurrentMode():Mode{
return (this.mode);
}
protected function loadGameDone():void{
var _local1:String;
var _local2:Class;
this.gameLoaded = true;
this.camera.init();
this.world.init();
this.interf.init(this.args.mode, this);
this.camera.attachWorld(this.world);
this.stage.stageFocusRect = false;
this.stage.focus = this;
wbGameInputManager.getInstance().init(this.stage);
this.modeType = this.args.mode;
wbStateManager.getInstance().setPrevGameArgs(this.args);
_local1 = (("Game.Modes." + this.modeType) + "Mode");
_local2 = (getDefinitionByName(_local1) as Class);
this.mode = new _local2(this.args);
}
override public function step():String{
if (this.gameLoaded){
this.interf.update();
this.world.step();
this.camera.update();
this.mode.step();
};
return (super.step());
}
override public function enter():void{
this.loadGame();
}
protected function loadGame():void{
this.loadGameDone();
}
}
}//package WBE.States
Section 210
//wbMenuState (WBE.States.wbMenuState)
package WBE.States {
import flash.display.*;
import WBE.Managers.*;
import flash.utils.*;
import Game.Data.*;
import WBE.Debug.*;
import WBE.Helpers.*;
import WBE.UI.*;
public class wbMenuState extends wbState {
private var menuGraphics:MovieClip;
private var forms:Dictionary;
private var ui_items:Dictionary;
private var md:Dictionary;
private var menuID:String;
public function wbMenuState(_arg1:Object){
this.menuID = _arg1.id;
this.md = MenuData.getInstance(this).menus[this.menuID];
}
override public function validate():Boolean{
var _local1:Object;
var _local2:String;
var _local3:int;
var _local4:Object;
for (_local2 in this.forms) {
_local1 = new Object();
_local3 = 0;
while (_local3 < this.forms[_local2].length) {
if (wbFormValidator.getInstance().validateField(this.forms[_local2][_local3].getItemData().validate, this.forms[_local2][_local3].getText())){
_local1[this.forms[_local2][_local3].getID()] = this.forms[_local2][_local3].getText();
} else {
for (_local4 in this.ui_items) {
if (this.ui_items[_local4] == "wbUI_Input"){
this.ui_items[_local4].showErrorBox();
};
};
return (false);
};
_local3++;
};
wbVarManager.getInstance().setForm(_local2, _local1);
};
return (true);
}
override public function exit():void{
var _local1:wbUI_Item;
for each (_local1 in this.ui_items) {
_local1.remove();
};
wbAssetManager.getInstance().stopPlaying(this.menuGraphics);
this.removeChild(this.menuGraphics);
}
override public function getBackground():MovieClip{
return (this.menuGraphics);
}
override public function toString():String{
return ("wbMenuState");
}
override public function step():String{
return (super.step());
}
override public function enter():void{
var _local1:MovieClip;
var _local2:Boolean;
var _local3:wbUI;
this.stage.stageFocusRect = false;
this.stage.focus = this;
_local1 = MovieClip(wbAssetManager.getInstance().getGraphics((this.menuID + "MenuBG"), true));
if (_local1 != null){
this.addChild(_local1);
} else {
Log.w((("warning: " + this.menuID) + "MenuBG not found"));
};
this.menuGraphics = MovieClip(wbAssetManager.getInstance().getGraphics((this.menuID + "Menu"), true));
_local2 = true;
if (this.menuGraphics == null){
_local2 = false;
this.menuGraphics = new MovieClip();
};
this.addChild(this.menuGraphics);
_local3 = new wbUI(this.md, this.menuGraphics, this, _local2);
this.ui_items = _local3.getItems();
this.forms = _local3.getForms();
}
}
}//package WBE.States
Section 211
//wbState (WBE.States.wbState)
package WBE.States {
import flash.display.*;
public class wbState extends MovieClip {
private var exitCode:String;
public function wbState(){
this.exitCode = "";
}
public function enter():void{
}
public function exit():void{
}
public function validate():Boolean{
return (true);
}
public function getBackground():MovieClip{
return (new MovieClip());
}
override public function toString():String{
return ("wbState");
}
public function requestExit(_arg1:String):void{
this.exitCode = _arg1;
}
public function step():String{
return (this.exitCode);
}
}
}//package WBE.States
Section 212
//wbDialog (WBE.UI.wbDialog)
package WBE.UI {
import flash.display.*;
import WBE.Managers.*;
import flash.utils.*;
public class wbDialog extends MovieClip {
private var buttonData:Array;
private var funcMapping:Dictionary;
private var keyMapping:Dictionary;
private var prevFocus:InteractiveObject;
private var buttons:Array;
private var mc:MovieClip;
public function wbDialog(_arg1:Array, _arg2:String){
var _local3:wbStateManager;
var _local4:MovieClip;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:int;
super();
this.buttonData = _arg1;
_local3 = wbStateManager.getInstance();
this.mc = MovieClip(wbAssetManager.getInstance().getGraphics("DialogMC"));
this.addChild(this.mc);
this.prevFocus = _local3.stage.focus;
this.mc.text.text = _arg2;
this.keyMapping = new Dictionary();
this.funcMapping = new Dictionary();
this.buttons = new Array();
_local5 = (((this.mc.width - 20) / this.buttonData.length) - 20);
_local6 = 20;
_local7 = 235;
_local9 = 0;
while (_local9 < this.buttonData.length) {
this.funcMapping[_local9] = this.buttonData[_local9].func;
this.buttonData[_local9].action = "func";
this.buttonData[_local9].funcArgs = [_local9];
this.buttonData[_local9].func = callFunction;
if (this.buttonData[_local9].format == null){
this.buttonData[_local9].format = "button";
};
if (this.buttonData[_local9].mc == null){
this.buttonData[_local9].mc = "dialogButton";
};
_local4 = new wbUI_Button(this.buttonData[_local9], _local6, _local7, _local5, 40, null);
_local6 = (_local6 + (_local4.width + 20));
this.addChild(_local4);
this.buttons.push(_local4);
_local9++;
};
_local3.addToModalLayer(this, false);
}
private function callFunction(_arg1:int):void{
if (this.funcMapping[_arg1] != null){
this.funcMapping[_arg1].call();
};
this.remove();
}
private function remove():void{
var _local1:int;
var _local2:wbStateManager;
_local1 = 0;
while (_local1 < this.buttons.length) {
this.buttons[_local1].remove();
_local1++;
};
_local2 = wbStateManager.getInstance();
this.removeChild(this.mc);
_local2.removeFromModalLayer(this);
if (this.prevFocus != null){
_local2.stage.stageFocusRect = false;
_local2.stage.focus = this.prevFocus;
};
}
}
}//package WBE.UI
Section 213
//wbGameMenu (WBE.UI.wbGameMenu)
package WBE.UI {
import flash.display.*;
import WBE.Managers.*;
import flash.utils.*;
import Game.Data.*;
import WBE.States.*;
public class wbGameMenu extends MovieClip {
private var bg:MovieClip;
private var menu:MovieClip;
private var sm:wbStateManager;
private var prevFocus:InteractiveObject;
private var gameMenuData:Dictionary;
private var gameMenuItems:Dictionary;
public function wbGameMenu(_arg1:String, _arg2:wbState){
var _local3:Boolean;
var _local4:wbUI;
super();
this.gameMenuData = GameMenuData.getInstance(this).getGameMenuData(_arg1);
this.sm = wbStateManager.getInstance();
this.bg = MovieClip(wbAssetManager.getInstance().getGraphics("gameMenuBG"));
this.menu = MovieClip(wbAssetManager.getInstance().getGraphics((_arg1 + "GameMenu"), true));
this.addChild(this.bg);
this.prevFocus = sm.stage.focus;
_local3 = false;
if (this.menu == null){
_local3 = false;
this.menu = new MovieClip();
};
this.addChild(this.menu);
_local4 = new wbUI(gameMenuData, this.menu, _arg2, _local3);
this.gameMenuItems = _local4.getItems();
}
override public function toString():String{
return ("wbGameMenu");
}
public function remove():void{
var _local1:wbUI_Item;
for each (_local1 in this.gameMenuItems) {
_local1.remove();
};
this.removeChild(this.bg);
this.removeChild(this.menu);
if (this.prevFocus != null){
sm.stage.stageFocusRect = false;
sm.stage.focus = this.prevFocus;
};
}
}
}//package WBE.UI
Section 214
//wbInfoWindow (WBE.UI.wbInfoWindow)
package WBE.UI {
import flash.display.*;
import WBE.Managers.*;
import flash.utils.*;
import Game.Data.*;
import WBE.States.*;
public class wbInfoWindow extends MovieClip {
private var infoWindowData:Dictionary;
private var infoWindowItems:Dictionary;
private var infoWindow:MovieClip;
private var sm:wbStateManager;
private var prevFocus:InteractiveObject;
public function wbInfoWindow(_arg1:String, _arg2:wbState){
var _local3:Boolean;
var _local4:wbUI;
super();
this.infoWindowData = InfoWindowData.getInstance(this).getInfoWindowData(_arg1);
this.sm = wbStateManager.getInstance();
this.infoWindow = MovieClip(wbAssetManager.getInstance().getGraphics((_arg1 + "InfoWindow"), true));
this.prevFocus = sm.stage.focus;
_local3 = false;
if (this.infoWindow == null){
_local3 = false;
this.infoWindow = new MovieClip();
};
this.addChild(this.infoWindow);
_local4 = new wbUI(infoWindowData, this.infoWindow, _arg2, _local3);
this.infoWindowItems = _local4.getItems();
}
public function buttonFunc(_arg1:String):void{
switch (_arg1){
case "close":
this.sm.removeFromModalLayer(this);
break;
};
}
override public function toString():String{
return ("wbinfoWindow");
}
private function remove():void{
var _local1:wbUI_Item;
for each (_local1 in this.infoWindowItems) {
_local1.remove();
};
this.removeChild(this.infoWindow);
if (this.prevFocus != null){
sm.stage.stageFocusRect = false;
sm.stage.focus = this.prevFocus;
};
}
}
}//package WBE.UI
Section 215
//wbInterface (WBE.UI.wbInterface)
package WBE.UI {
import flash.display.*;
import WBE.Managers.*;
import flash.utils.*;
import Game.Data.*;
import WBE.States.*;
public class wbInterface extends MovieClip {
private var interfaceItems:Dictionary;
private var interf:MovieClip;
private static var allowInstantiation:Boolean;
private static var instance:wbInterface;
public function wbInterface(){
if (!allowInstantiation){
throw (new Error("Error: Instantiation failed: Use wbInterface.getInstance() instead of new."));
};
}
public function init(_arg1:String, _arg2:wbState):void{
var _local3:Dictionary;
var _local4:Boolean;
var _local5:wbUI;
var _local6:*;
_local3 = InterfaceData.getInstance(this).interfaces[_arg1];
this.interf = MovieClip(wbAssetManager.getInstance().getGraphics((_arg1 + "Interface"), true));
_local4 = false;
if (this.interf == null){
_local4 = false;
this.interf = new MovieClip();
};
this.addChild(this.interf);
_local5 = new wbUI(_local3, interf, _arg2, _local4);
this.interfaceItems = _local5.getItems();
for each (_local6 in this.interfaceItems) {
};
}
public function removeInstance():void{
var _local1:wbUI_Item;
for each (_local1 in this.interfaceItems) {
_local1.remove();
};
wbAssetManager.getInstance().stopPlaying(this.interf);
this.removeChild(this.interf);
instance = null;
allowInstantiation = true;
}
override public function toString():String{
return ("wbInterface");
}
public function hideItem(_arg1:String):void{
if (this.interfaceItems[_arg1] != null){
this.interfaceItems[_arg1].visible = false;
};
}
public function showItem(_arg1:String):void{
if (this.interfaceItems[_arg1] != null){
this.interfaceItems[_arg1].visible = true;
};
}
public function update():void{
var item:Object;
for each (item in this.interfaceItems) {
try {
item.update();
} catch(e:Error) {
};
};
}
public static function getInstance():wbInterface{
if (instance == null){
allowInstantiation = true;
instance = new (wbInterface);
allowInstantiation = false;
};
return (instance);
}
}
}//package WBE.UI
Section 216
//wbUI (WBE.UI.wbUI)
package WBE.UI {
import flash.display.*;
import WBE.Managers.*;
import flash.utils.*;
import WBE.Debug.*;
import WBE.States.*;
import Game.UI.*;
public class wbUI {
private var availableUI_Items:Array;
private var uiItems:Dictionary;
private var forms:Dictionary;
public function wbUI(_arg1:Dictionary, _arg2:MovieClip, _arg3:wbState, _arg4:Boolean=true):void{
var defaultButtonWidth:Number;
var defaultButtonheight:Number;
var padding:Number;
var lastBottomY:Number;
var lastRightX:Number;
var uiItemCon:DisplayObject;
var uiItem:wbUI_Item;
var indexedData:Array;
var unindexedData:Array;
var key:String;
var i:int;
var item:String;
var mc:MovieClip;
var conLabel:String;
var uiClassName:String;
var uiClass:Object;
var childMC:DisplayObject;
var toRemove:Array;
var uiData = _arg1;
var parentMC = _arg2;
var state = _arg3;
var conDetected = _arg4;
uiItems = new Dictionary();
forms = new Dictionary();
availableUI_Items = [wbInterface, wbUI_Button, wbUI_Output, wbUI_Input, wbUI_MCButton, wbUI_HighScoreList, wbUI_RadioButton, wbUI_ToggleButton, wbUI_AudioButton];
super();
Log.i(this);
defaultButtonWidth = 100;
defaultButtonheight = 40;
padding = 5;
lastBottomY = padding;
lastRightX = padding;
indexedData = new Array();
unindexedData = new Array();
for (key in uiData) {
if (uiData[key].index != null){
indexedData[uiData[key].index] = key;
} else {
unindexedData.push(key);
};
};
indexedData = indexedData.concat(unindexedData);
i = 0;
while (i < indexedData.length) {
item = indexedData[i];
if (item == null){
} else {
if (((!(wbSettingsManager.getInstance().getSettings("debug"))) && ((uiData[item].debug == true)))){
} else {
if (uiData[item].type == "MCButton"){
if (!conDetected){
wbStateManager.getInstance().error(((("MCbutton " + uiData[item].label) + " declared, but no parentMC given in ") + item), this);
};
mc = MovieClip(parentMC.getChildByName(item));
uiItem = new wbUI_MCButton(mc, uiData[item], state);
} else {
conLabel = (item + "Con");
try {
uiClassName = ("UI_" + uiData[item].type);
uiClass = (getDefinitionByName(("Game.UI." + uiClassName)) as Class);
} catch(e:ReferenceError) {
try {
uiClassName = ("wbUI_" + uiData[item].type);
uiClass = (getDefinitionByName(("WBE.UI." + uiClassName)) as Class);
} catch(e:ReferenceError) {
wbStateManager.getInstance().error((uiClassName + " could not be found"));
break;
};
};
uiItemCon = parentMC.getChildByName(conLabel);
if (uiItemCon == null){
uiItem = new uiClass(uiData[item], lastRightX, lastBottomY, defaultButtonWidth, defaultButtonheight, state);
lastBottomY = (lastBottomY + (defaultButtonheight + padding));
if ((lastBottomY + defaultButtonheight) > wbSettingsManager.getInstance().getWorldSettings("height")){
lastBottomY = padding;
lastRightX = (lastRightX + (defaultButtonWidth + padding));
};
} else {
uiItem = new uiClass(uiData[item], uiItemCon.x, uiItemCon.y, uiItemCon.width, uiItemCon.height, state);
parentMC.removeChild(uiItemCon);
};
if (uiData[item].form != null){
if (this.forms[uiData[item].form] == null){
this.forms[uiData[item].form] = new Array();
};
this.forms[uiData[item].form].push(uiItem);
};
uiItem.name = item;
parentMC.addChild(uiItem);
if (uiData[item].type == "Input"){
uiItem.setCursorFocus();
};
};
this.uiItems[uiItem.name] = uiItem;
uiItem.init();
};
};
i = (i + 1);
};
if (!wbSettingsManager.getInstance().getSettings("debug")){
toRemove = new Array();
i = 0;
while (i < parentMC.numChildren) {
childMC = parentMC.getChildAt(i);
if (childMC.name.lastIndexOf("Con") == (childMC.name.length - 3)){
toRemove.push(childMC);
};
i = (i + 1);
};
i = 0;
while (i < toRemove.length) {
parentMC.removeChild(toRemove[i]);
i = (i + 1);
};
};
}
public function getForms():Dictionary{
return (this.forms);
}
public function getItems():Dictionary{
return (this.uiItems);
}
}
}//package WBE.UI
Section 217
//wbUI_AudioButton (WBE.UI.wbUI_AudioButton)
package WBE.UI {
import WBE.Managers.*;
import WBE.States.*;
public class wbUI_AudioButton extends wbUI_ToggleButton {
public function wbUI_AudioButton(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:wbState){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
switch (_arg1.audioType){
case "music":
this.itemData.func = wbAudioManager.getInstance().toggleMusic;
this.toggledOn = wbAudioManager.getInstance().isMusicOn();
break;
case "sound":
this.itemData.func = wbAudioManager.getInstance().toggleSound;
this.toggledOn = wbAudioManager.getInstance().isSoundOn();
break;
case "mute":
this.itemData.func = wbAudioManager.getInstance().toggleMute;
this.toggledOn = wbAudioManager.getInstance().isMuteOff();
break;
case "all":
this.itemData.func = wbAudioManager.getInstance().toggleAll;
this.toggledOn = wbAudioManager.getInstance().isAllOn();
break;
};
_arg1.action = "func";
this.updateToggleGraphics();
}
override public function toString():String{
return ("wbUI_AudioButton");
}
}
}//package WBE.UI
Section 218
//wbUI_Button (WBE.UI.wbUI_Button)
package WBE.UI {
import flash.events.*;
import flash.display.*;
import WBE.Managers.*;
import flash.text.*;
import WBE.Debug.*;
import WBE.Helpers.*;
import WBE.States.*;
import flash.net.*;
public class wbUI_Button extends wbUI_Item {
private var toolTip:String;
protected var button:MovieClip;
private var hasDownEvent;// = false
protected var mouseIsDown;// = false
public function wbUI_Button(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:wbState){
mouseIsDown = false;
hasDownEvent = false;
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
if (this.itemData.keyBind){
if (!(this.itemData.keyBind is Array)){
this.itemData.keyBind = [this.itemData.keyBind];
};
wbStateManager.getInstance().stage.addEventListener(KeyboardEvent.KEY_UP, upKey);
};
this.addButton();
if (this.button.detector != null){
this.button.detector.addEventListener(MouseEvent.MOUSE_UP, buttonPushed);
this.button.detector.addEventListener(MouseEvent.MOUSE_DOWN, onDownMouse);
this.button.detector.addEventListener(MouseEvent.MOUSE_OVER, onOverMouse);
this.button.detector.addEventListener(MouseEvent.MOUSE_OUT, onOutMouse);
} else {
this.button.addEventListener(MouseEvent.MOUSE_UP, buttonPushed);
};
this.hasDownEvent = !((this.itemData.downFunc == null));
}
private function onDownMouse(_arg1:MouseEvent):void{
_arg1.stopImmediatePropagation();
this.mouseIsDown = true;
if (this.button.currentLabel != "down"){
this.button.gotoAndPlay("down");
};
if (this.hasDownEvent){
this.requestAction(true);
};
wbStateManager.getInstance().stage.addEventListener(MouseEvent.MOUSE_UP, stageMouseUp);
}
protected function buttonPushed(_arg1:MouseEvent):void{
if (this.mouseIsDown){
_arg1.stopImmediatePropagation();
this.mouseIsDown = false;
wbStateManager.getInstance().stage.removeEventListener(MouseEvent.MOUSE_UP, stageMouseUp);
this.requestAction();
if (this.button.currentLabel != "hit"){
this.button.gotoAndPlay("hit");
};
};
}
private function onOverMouse(_arg1:MouseEvent):void{
_arg1.stopPropagation();
if (this.button.currentLabel != "over"){
this.button.gotoAndPlay("over");
};
}
override protected function removeTooltipListeners():void{
wbTooltipManager.getInstance().hideTooltip(this);
if (this.button.detector != null){
this.button.detector.removeEventListener(MouseEvent.MOUSE_OVER, showTooltip);
this.button.detector.removeEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
} else {
this.button.removeEventListener(MouseEvent.MOUSE_OVER, showTooltip);
this.button.removeEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
};
}
override protected function addTooltipListeners():void{
if (this.button.detector != null){
this.button.detector.addEventListener(MouseEvent.MOUSE_OVER, showTooltip);
this.button.detector.addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
} else {
this.button.addEventListener(MouseEvent.MOUSE_OVER, showTooltip);
this.button.addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
};
}
protected function upKey(_arg1:KeyboardEvent):void{
var _local2:int;
_local2 = 0;
while (_local2 < this.itemData.keyBind.length) {
if (_arg1.keyCode == new wbKeyConverter().getKeyCode(this.itemData.keyBind[_local2])){
this.requestAction();
return;
};
_local2++;
};
}
override public function toString():String{
return ("wbUI_Button");
}
private function addKeyBindToLabel(_arg1:TextField):void{
var _local2:TextFormat;
var _local3:int;
var _local4:int;
if (this.itemData.keyBind){
_local2 = _arg1.getTextFormat();
_local2.underline = true;
_local3 = 0;
while (_local3 < this.itemData.keyBind.length) {
_local4 = _arg1.text.indexOf(this.itemData.keyBind[_local3].toUpperCase());
if (_local4 != -1){
_arg1.replaceText(_local4, (_local4 + this.itemData.keyBind[_local3].length), this.itemData.keyBind[_local3].toUpperCase());
_arg1.setTextFormat(_local2, _local4, (_local4 + this.itemData.keyBind[_local3].length));
return;
};
_local4 = _arg1.text.indexOf(this.itemData.keyBind[_local3]);
if (_local4 != -1){
_arg1.replaceText(_local4, (_local4 + this.itemData.keyBind[_local3].length), this.itemData.keyBind[_local3]);
_arg1.setTextFormat(_local2, _local4, (_local4 + this.itemData.keyBind[_local3].length));
return;
};
_local3++;
};
_arg1.appendText(((" (" + this.itemData.keyBind[0]) + ")"));
};
}
private function addText():void{
var _local1:String;
var _local2:Number;
var _local3:Number;
var _local4:TextField;
var _local5:TextFormat;
_local1 = this.itemData.label;
if (_local1 == null){
_local1 = "";
};
if (this.button.title != null){
this.button.title.textField.text = _local1;
if (this.itemData.keyLabel == true){
this.addKeyBindToLabel(this.button.title.textField);
};
_local2 = this.button.title.textField.width;
_local3 = this.button.title.textField.height;
if (this.button.scaleX < this.button.scaleY){
this.button.title.textField.scaleY = (this.button.scaleX / this.button.scaleY);
} else {
this.button.title.textField.scaleX = (this.button.scaleY / this.button.scaleX);
};
this.button.title.textField.x = (this.button.title.textField.x + ((_local2 - this.button.title.textField.width) / 2));
this.button.title.textField.y = (this.button.title.textField.y + ((_local3 - this.button.title.textField.height) / 2));
} else {
this.toolTip = this.itemData.toolTip;
_local4 = new TextField();
_local4.width = this.itemWidth;
_local4.height = this.itemHeight;
_local4.y = (_local4.y + (this.itemHeight / 4));
_local4.selectable = false;
_local4.mouseEnabled = false;
_local4.text = _local1;
_local5 = wbSettingsManager.getInstance().getTextFormat(this.itemData.format);
_local4.setTextFormat(_local5);
this.addKeyBindToLabel(_local4);
this.addChild(_local4);
};
}
override public function remove():void{
super.remove();
if (this.button.detector != null){
this.button.detector.removeEventListener(MouseEvent.MOUSE_UP, buttonPushed);
this.button.detector.removeEventListener(MouseEvent.MOUSE_DOWN, onDownMouse);
this.button.detector.removeEventListener(MouseEvent.MOUSE_OVER, onOverMouse);
this.button.detector.removeEventListener(MouseEvent.MOUSE_OUT, onOutMouse);
} else {
this.button.removeEventListener(MouseEvent.MOUSE_UP, buttonPushed);
};
if (this.getChildByName(this.button.name) != null){
this.removeChild(this.button);
};
if (this.itemData.keyBind){
wbStateManager.getInstance().stage.removeEventListener(KeyboardEvent.KEY_UP, upKey);
};
}
protected function addButton():void{
if (this.itemData.mc == null){
this.button = MovieClip(wbAssetManager.getInstance().getGraphics("button"));
} else {
this.button = MovieClip(wbAssetManager.getInstance().getGraphics(this.itemData.mc));
};
this.addChild(this.button);
this.button.width = this.itemWidth;
this.button.height = this.itemHeight;
this.x = this.xPos;
this.y = this.yPos;
this.button.buttonMode = true;
addText();
}
protected function doAction(_arg1:Boolean=false):void{
var mouseDownAction = _arg1;
switch (this.itemData.action){
case "exit":
if (wbStateManager.getInstance().isPaused()){
wbStateManager.getInstance().exitState(this.itemData.exit);
} else {
this.state.requestExit(this.itemData.exit);
};
break;
case "gameMenu":
wbStateManager.getInstance().openGameMenu(this.itemData.menuType);
break;
case "validate":
if (this.state.validate()){
this.state.requestExit(this.itemData.exit);
};
break;
case "func":
if (!mouseDownAction){
if (this.itemData.funcArgs != null){
this.itemData.func.call(this.itemData.func, this.itemData.funcArgs);
} else {
this.itemData.func.call();
};
} else {
if (this.itemData.downFuncArgs != null){
this.itemData.downFunc.call(this.itemData.downFunc, this.itemData.downFuncArgs);
} else {
this.itemData.downFunc.call();
};
};
break;
case "parentFunc":
try {
Object(this.parent.parent).buttonFunc(this.itemData.func);
} catch(e:Error) {
Log.w((this.parent.parent + " does not have function buttonFunc"), this);
};
break;
case "externalLink":
navigateToURL(new URLRequest(this.itemData.url), "_blank");
break;
case "default":
wbStateManager.getInstance().error(("Default error: " + this.itemData.action), this);
};
}
protected function requestAction(_arg1:Boolean=false):void{
var _local2:String;
var _local3:Array;
if (_arg1){
this.doAction(true);
return;
};
if (this.itemData.confirm){
_local3 = [{label:"Yes", func:doAction}, {label:"No", func:null}];
if (this.itemData.confirmtext != null){
_local2 = this.itemData.confirmtext;
} else {
_local2 = "Are you sure?";
};
new wbDialog(_local3, _local2);
} else {
this.doAction();
};
}
private function stageMouseUp(_arg1:Event):void{
var e = _arg1;
this.mouseIsDown = false;
wbStateManager.getInstance().stage.removeEventListener(MouseEvent.MOUSE_UP, stageMouseUp);
if (this.hasDownEvent){
try {
requestAction();
} catch(e:Error) {
Log.w("down action could not be executed", this);
};
};
}
private function onOutMouse(_arg1:MouseEvent):void{
_arg1.stopPropagation();
if (this.button.currentLabel != "out"){
this.button.gotoAndPlay("up");
};
}
}
}//package WBE.UI
Section 219
//wbUI_HighScoreList (WBE.UI.wbUI_HighScoreList)
package WBE.UI {
import flash.display.*;
import fl.controls.*;
import WBE.Managers.*;
import flash.text.*;
import WBE.States.*;
import fl.data.*;
import fl.controls.dataGridClasses.*;
public class wbUI_HighScoreList extends wbUI_Item {
private var toolTip:String;
private var myDataGrid:DataGrid;
private var highScoresAvailable:Boolean;
private var highScoreList:DisplayObject;
private var activityIndicator:MovieClip;
private var highScoreData:Object;
public function wbUI_HighScoreList(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:wbState):void{
var _local7:*;
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
this.myDataGrid = new DataGrid();
this.myDataGrid.x = _arg2;
this.myDataGrid.y = _arg3;
this.myDataGrid.width = _arg4;
this.myDataGrid.height = _arg5;
this.myDataGrid.resizableColumns = false;
this.activityIndicator = MovieClip(wbAssetManager.getInstance().getGraphics("activityIndicator"));
this.activityIndicator.x = (_arg2 + (_arg4 / 2));
this.activityIndicator.y = (_arg3 + (_arg5 / 2));
this.addChild(this.activityIndicator);
this.highScoreData = _arg1;
this.highScoresAvailable = false;
if (this.highScoreData.args.gameType != null){
if (this.highScoreData.args.value == null){
_local7 = wbVarManager.getInstance().getVar(this.highScoreData.args.gameType);
} else {
_local7 = this.highScoreData.args.value;
};
wbDatabaseManager.getInstance().doAction("highscore", receiveData, [{dictName:"where", gameType:this.highScoreData.args.gameType, value:_local7}]);
} else {
wbDatabaseManager.getInstance().doAction("highscore", receiveData);
};
}
public function receiveData(_arg1:Object):void{
if (_arg1.xml.children().length() > 0){
this.highScoresAvailable = true;
createTable(XML(_arg1.xml));
};
}
private function createTable(_arg1:XML):void{
var _local2:DataProvider;
var _local3:Array;
var _local4:int;
var _local5:HeaderRenderer;
var _local6:HeaderRenderer;
var _local7:HeaderRenderer;
var _local8:Number;
var _local9:DisplayObject;
_local2 = new DataProvider(_arg1);
_local3 = [];
_local4 = 0;
while (_local4 < _arg1.children()[0].children().length()) {
_local3[_local4] = new DataGridColumn(String(_arg1.children()[0].children()[_local4].name()));
_local4++;
};
_local3[0].width = 10;
_local3[1].width = 12;
_local3[2].width = 30;
_local4 = 0;
while (_local4 < _arg1.children()[0].children().length()) {
this.myDataGrid.addColumn(_local3[_local4]);
_local4++;
};
_local5 = new HeaderRenderer();
_local5.setStyle("embedFonts", true);
_local6 = new HeaderRenderer();
_local6.setStyle("embedFonts", true);
_local7 = new HeaderRenderer();
_local7.setStyle("embedFonts", true);
_local3[0].headerRenderer = _local5;
_local3[1].headerRenderer = _local6;
_local3[2].headerRenderer = _local7;
this.myDataGrid.setRendererStyle("embedFonts", true);
this.myDataGrid.setRendererStyle("textFormat", wbSettingsManager.getInstance().getTextFormat(highScoreData.columnFormat));
this.myDataGrid.setStyle("headerTextFormat", wbSettingsManager.getInstance().getTextFormat(highScoreData.headerFormat));
this.myDataGrid.dataProvider = _local2;
this.myDataGrid.sortableColumns = false;
this.myDataGrid.selectable = false;
this.myDataGrid.mouseChildren = false;
_local8 = wbVarManager.getInstance().getVar("rank");
if ((((_local8 > 0)) && ((_local8 <= this.highScoreData.args.listSize)))){
_local9 = wbAssetManager.getInstance().getGraphics("highScoreHighlight");
_local9.x = this.myDataGrid.x;
_local9.y = (((this.myDataGrid.rowHeight * (_local8 - 1)) + this.myDataGrid.headerHeight) + this.yPos);
_local9.width = this.myDataGrid.width;
_local9.height = this.myDataGrid.rowHeight;
this.addChild(_local9);
};
this.removeChild(this.activityIndicator);
this.addChild(myDataGrid);
}
override public function toString():String{
return ("wbUI_HighScoreList");
}
override public function remove():void{
super.remove();
if (this.highScoresAvailable){
this.removeChild(this.myDataGrid);
this.highScoresAvailable = false;
};
}
}
}//package WBE.UI
Section 220
//wbUI_Input (WBE.UI.wbUI_Input)
package WBE.UI {
import flash.display.*;
import fl.controls.*;
import WBE.Managers.*;
import WBE.States.*;
public class wbUI_Input extends wbUI_Item {
private var inputField:TextInput;
private var errorBox:MovieClip;
public function wbUI_Input(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:wbState){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
this.errorBox = MovieClip(wbAssetManager.getInstance().getGraphics("inputFieldError"));
this.errorBox.x = (this.errorBox.x - 5);
this.errorBox.y = (this.errorBox.y - 5);
this.errorBox.width = (_arg4 + 10);
this.errorBox.height = (_arg5 + 10);
this.errorBox.visible = false;
this.addChild(errorBox);
this.inputField = new TextInput();
this.addChild(inputField);
this.inputField.width = _arg4;
this.inputField.height = _arg5;
this.inputField.textField.type = "input";
this.inputField.maxChars = _arg1.maxChars;
if (_arg1.restrict){
this.inputField.restrict = _arg1.restrict;
} else {
this.inputField.restrict = "^{}[]()'\"";
};
this.x = _arg2;
this.y = _arg3;
this.inputField.tabIndex = this.itemData.tabIndex;
this.inputField.maxChars = this.itemData.maxChars;
this.inputField.setStyle("embedFonts", true);
this.inputField.setStyle("textFormat", wbSettingsManager.getInstance().getTextFormat(_arg1.format));
this.inputField.textField.text = wbVarManager.getInstance().getForm(_arg1.form)[_arg1.id];
}
public function hideErrorBox():void{
this.errorBox.visible = false;
}
override public function setCursorFocus():void{
if (this.itemData.focus){
this.stage.focus = this.inputField.textField;
this.inputField.textField.setSelection(0, this.inputField.textField.text.length);
};
}
override public function toString():String{
return ("wbUI_Input");
}
public function getText():String{
return (this.inputField.text);
}
public function showErrorBox():void{
this.errorBox.visible = true;
}
public function getID():String{
return (this.itemData.id);
}
}
}//package WBE.UI
Section 221
//wbUI_Item (WBE.UI.wbUI_Item)
package WBE.UI {
import flash.events.*;
import flash.display.*;
import WBE.Managers.*;
import WBE.States.*;
public class wbUI_Item extends MovieClip {
protected var itemHeight:Number;
protected var yPos:Number;
protected var itemData:Object;
protected var state:wbState;
protected var itemWidth:Number;
protected var xPos:Number;
public function wbUI_Item(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:wbState){
this.itemData = _arg1;
this.xPos = _arg2;
this.yPos = _arg3;
this.itemWidth = _arg4;
this.itemHeight = _arg5;
this.state = _arg6;
this.filters = wbSettingsManager.getInstance().getFilterSet(_arg1.filterSet);
}
public function init():void{
if (this.itemData.tooltip != null){
this.addTooltipListeners();
};
}
protected function removeTooltipListeners():void{
wbTooltipManager.getInstance().hideTooltip(this);
try {
this.removeEventListener(MouseEvent.MOUSE_OVER, showTooltip);
this.removeEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
} catch(e:Error) {
};
}
protected function addTooltipListeners():void{
this.addEventListener(MouseEvent.MOUSE_OVER, showTooltip);
this.addEventListener(MouseEvent.MOUSE_OUT, hideTooltip);
}
override public function toString():String{
return ("wbUI_Item");
}
protected function hideTooltip(_arg1:MouseEvent):void{
wbTooltipManager.getInstance().hideTooltip(this);
}
public function remove():void{
if (this.itemData.tooltip != null){
this.removeTooltipListeners();
};
}
public function setCursorFocus():void{
}
protected function showTooltip(_arg1:MouseEvent):void{
wbTooltipManager.getInstance().showTooltip(this, this.itemData.tooltip);
}
public function getItemData():Object{
return (this.itemData);
}
}
}//package WBE.UI
Section 222
//wbUI_MCButton (WBE.UI.wbUI_MCButton)
package WBE.UI {
import flash.display.*;
import WBE.States.*;
public class wbUI_MCButton extends wbUI_Button {
private var mc:MovieClip;
public function wbUI_MCButton(_arg1:MovieClip, _arg2:Object, _arg3:wbState){
this.mc = _arg1;
super(_arg2, 0, 0, 0, 0, _arg3);
}
override protected function addButton():void{
this.button = MovieClip(this.mc);
this.mc.buttonMode = true;
}
override public function toString():String{
return ("wbUI_MCButton");
}
}
}//package WBE.UI
Section 223
//wbUI_Output (WBE.UI.wbUI_Output)
package WBE.UI {
import WBE.Managers.*;
import flash.text.*;
import WBE.States.*;
public class wbUI_Output extends wbUI_Item {
private var outputField:TextField;
public function wbUI_Output(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:wbState){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
this.outputField = new TextField();
this.addChild(outputField);
this.outputField.width = _arg4;
this.outputField.height = _arg5;
this.outputField.embedFonts = true;
this.outputField.selectable = false;
this.outputField.defaultTextFormat = wbSettingsManager.getInstance().getTextFormat(_arg1.format);
if (this.itemData.multiline == true){
this.outputField.multiline = this.itemData.multiline;
this.outputField.wordWrap = this.itemData.multiline;
};
if (this.itemData.htmlText == true){
this.outputField.htmlText = wbVarManager.getInstance().getVar(this.itemData.varData);
} else {
this.outputField.text = wbVarManager.getInstance().getVar(this.itemData.varData);
};
this.x = _arg2;
this.y = _arg3;
}
override public function toString():String{
return ("wbUI_Output");
}
public function getText():String{
return (this.outputField.text);
}
public function update():void{
this.outputField.text = wbVarManager.getInstance().getVar(this.itemData.varData);
}
}
}//package WBE.UI
Section 224
//wbUI_RadioButton (WBE.UI.wbUI_RadioButton)
package WBE.UI {
import fl.controls.*;
import WBE.States.*;
public class wbUI_RadioButton extends wbUI_Item {
private var btn:RadioButton;
public function wbUI_RadioButton(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:wbState){
super(itemData, _arg2, _arg3, _arg4, _arg5, _arg6);
this.btn = new RadioButton();
this.btn.selected = false;
this.addChild(btn);
this.btn.move(10, 10);
this.x = _arg2;
this.y = _arg3;
this.btn.tabEnabled = false;
this.btn.tabIndex = -1;
}
override public function toString():String{
return ("wbUI_RadioButton");
}
}
}//package WBE.UI
Section 225
//wbUI_ToggleButton (WBE.UI.wbUI_ToggleButton)
package WBE.UI {
import flash.events.*;
import flash.display.*;
import WBE.Managers.*;
import WBE.States.*;
public class wbUI_ToggleButton extends wbUI_Button {
protected var toggledOn:Boolean;// = true
public function wbUI_ToggleButton(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:wbState){
toggledOn = true;
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6);
updateToggleGraphics();
}
override protected function buttonPushed(_arg1:MouseEvent):void{
if (this.mouseIsDown){
_arg1.stopImmediatePropagation();
this.toggledOn = !(this.toggledOn);
updateToggleGraphics();
super.buttonPushed(_arg1);
};
}
override protected function addButton():void{
this.button = MovieClip(wbAssetManager.getInstance().getGraphics(this.itemData.mc));
this.addChild(this.button);
this.button.width = this.itemWidth;
this.button.height = this.itemHeight;
this.button.buttonMode = true;
this.x = this.xPos;
this.y = this.yPos;
}
override public function toString():String{
return ("wbUI_ToggleButton");
}
public function updateToggleGraphics():void{
if (this.button.toggledOn != null){
this.button.toggledOn.visible = this.toggledOn;
};
if (this.button.toggledOff != null){
this.button.toggledOff.visible = !(this.toggledOn);
};
}
}
}//package WBE.UI
Section 226
//BBbackButton (BBbackButton)
package {
import flash.display.*;
public dynamic class BBbackButton extends MovieClip {
public var detector:MovieClip;
public function BBbackButton(){
addFrameScript(19, frame20, 35, frame36, 45, frame46, 55, frame56);
}
function frame20(){
stop();
}
function frame36(){
gotoAndPlay("over");
}
function frame46(){
stop();
}
function frame56(){
stop();
}
}
}//package
Section 227
//BBball (BBball)
package {
import flash.display.*;
public dynamic class BBball extends MovieClip {
}
}//package
Section 228
//BBballMC (BBballMC)
package {
import flash.display.*;
public dynamic class BBballMC extends MovieClip {
public var hitBox:MovieClip;
public function BBballMC(){
addFrameScript(9, frame10, 18, frame19, 28, frame29, 38, frame39, 48, frame49, 58, frame59, 69, frame70, 75, frame76, 100, frame101, 110, frame111);
}
function frame70(){
gotoAndPlay("jumpDown");
}
function frame76(){
stop();
}
function frame10(){
gotoAndPlay("idle");
}
function frame19(){
gotoAndPlay("movingUp");
}
function frame29(){
gotoAndPlay("movingDown");
}
function frame111(){
stop();
}
function frame101(){
stop();
}
function frame39(){
gotoAndPlay("movingLeft");
}
function frame49(){
gotoAndPlay("movingRight");
}
function frame59(){
gotoAndPlay("jumpUp");
}
}
}//package
Section 229
//BBballMCshadow (BBballMCshadow)
package {
import flash.display.*;
public dynamic class BBballMCshadow extends MovieClip {
}
}//package
Section 230
//bbBlock (bbBlock)
package {
import flash.display.*;
public dynamic class bbBlock extends MovieClip {
}
}//package
Section 231
//BBblockMC (BBblockMC)
package {
import flash.display.*;
public dynamic class BBblockMC extends MovieClip {
public var hitBox:MovieClip;
public function BBblockMC(){
addFrameScript(9, frame10, 18, frame19, 28, frame29, 38, frame39, 48, frame49, 58, frame59, 69, frame70, 75, frame76, 89, frame90, 99, frame100);
}
function frame70(){
gotoAndPlay("jumpDown");
}
function frame76(){
stop();
}
function frame90(){
stop();
}
function frame10(){
gotoAndPlay("idle");
}
function frame100(){
stop();
}
function frame19(){
gotoAndPlay("movingUp");
}
function frame29(){
gotoAndPlay("movingDown");
}
function frame39(){
gotoAndPlay("movingLeft");
}
function frame49(){
gotoAndPlay("movingRight");
}
function frame59(){
gotoAndPlay("jumpUp");
}
}
}//package
Section 232
//BBblockMCshadow (BBblockMCshadow)
package {
import flash.display.*;
public dynamic class BBblockMCshadow extends MovieClip {
}
}//package
Section 233
//BBconsoleMC (BBconsoleMC)
package {
import flash.display.*;
import fl.controls.*;
public dynamic class BBconsoleMC extends MovieClip {
public var outputPane:TextArea;
public var background:MovieClip;
}
}//package
Section 234
//BBdiscMC (BBdiscMC)
package {
import flash.display.*;
public dynamic class BBdiscMC extends MovieClip {
public var hitBox:MovieClip;
public function BBdiscMC(){
addFrameScript(9, frame10, 18, frame19, 28, frame29, 38, frame39, 48, frame49, 58, frame59, 69, frame70, 75, frame76, 89, frame90, 99, frame100);
}
function frame70(){
gotoAndPlay("jumpDown");
}
function frame76(){
stop();
}
function frame90(){
stop();
}
function frame10(){
gotoAndPlay("idle");
}
function frame100(){
stop();
}
function frame19(){
gotoAndPlay("movingUp");
}
function frame29(){
gotoAndPlay("movingDown");
}
function frame39(){
gotoAndPlay("movingLeft");
}
function frame49(){
gotoAndPlay("movingRight");
}
function frame59(){
gotoAndPlay("jumpUp");
}
}
}//package
Section 235
//BBemptyButton (BBemptyButton)
package {
import flash.display.*;
public dynamic class BBemptyButton extends MovieClip {
public var title:MovieClip;
public var detector:MovieClip;
public function BBemptyButton(){
addFrameScript(19, frame20, 29, frame30, 39, frame40, 49, frame50);
}
function frame20(){
stop();
}
function frame30(){
stop();
}
function frame40(){
stop();
}
function frame50(){
stop();
}
}
}//package
Section 236
//BBemptyButtonBtn (BBemptyButtonBtn)
package {
import flash.display.*;
public dynamic class BBemptyButtonBtn extends SimpleButton {
}
}//package
Section 237
//BBinputFieldErrorMC (BBinputFieldErrorMC)
package {
import flash.display.*;
public dynamic class BBinputFieldErrorMC extends MovieClip {
}
}//package
Section 238
//BBmusicButton (BBmusicButton)
package {
import flash.display.*;
public dynamic class BBmusicButton extends MovieClip {
public var detector:MovieClip;
public var toggledOff:MovieClip;
public function BBmusicButton(){
addFrameScript(19, frame20, 29, frame30, 39, frame40, 49, frame50);
}
function frame20(){
stop();
}
function frame30(){
stop();
}
function frame40(){
stop();
}
function frame50(){
stop();
}
}
}//package
Section 239
//BBopenMenuButton (BBopenMenuButton)
package {
import flash.display.*;
public dynamic class BBopenMenuButton extends MovieClip {
public var detector:MovieClip;
public function BBopenMenuButton(){
addFrameScript(19, frame20, 35, frame36, 45, frame46, 55, frame56);
}
function frame20(){
stop();
}
function frame36(){
stop();
}
function frame46(){
stop();
}
function frame56(){
stop();
}
}
}//package
Section 240
//BBplayer1MC (BBplayer1MC)
package {
import flash.display.*;
public dynamic class BBplayer1MC extends MovieClip {
public var hitBox:MovieClip;
public function BBplayer1MC(){
addFrameScript(9, frame10, 18, frame19, 28, frame29, 38, frame39, 48, frame49, 58, frame59, 69, frame70, 75, frame76, 89, frame90, 99, frame100);
}
function frame70(){
gotoAndPlay("jumpDown");
}
function frame76(){
stop();
}
function frame90(){
stop();
}
function frame10(){
gotoAndPlay("idle");
}
function frame100(){
stop();
}
function frame19(){
gotoAndPlay("movingUp");
}
function frame29(){
gotoAndPlay("movingDown");
}
function frame39(){
gotoAndPlay("movingLeft");
}
function frame49(){
gotoAndPlay("movingRight");
}
function frame59(){
gotoAndPlay("jumpUp");
}
}
}//package
Section 241
//BBplayer1MCshadow (BBplayer1MCshadow)
package {
import flash.display.*;
public dynamic class BBplayer1MCshadow extends MovieClip {
}
}//package
Section 242
//BBselectEndTileMC (BBselectEndTileMC)
package {
import flash.display.*;
public dynamic class BBselectEndTileMC extends MovieClip {
public var bg:MovieClip;
public function BBselectEndTileMC(){
addFrameScript(59, frame60, 70, frame71);
}
function frame71(){
gotoAndPlay("idle");
}
function frame60(){
gotoAndPlay("idle");
}
}
}//package
Section 243
//BBselectTileMC (BBselectTileMC)
package {
import flash.display.*;
public dynamic class BBselectTileMC extends MovieClip {
public var bg:MovieClip;
public function BBselectTileMC(){
addFrameScript(60, frame61);
}
function frame61(){
gotoAndPlay("idle");
}
}
}//package
Section 244
//BBsoundButton (BBsoundButton)
package {
import flash.display.*;
public dynamic class BBsoundButton extends MovieClip {
public var toggledOn:MovieClip;
public var detector:MovieClip;
public var toggledOff:MovieClip;
public function BBsoundButton(){
addFrameScript(19, frame20, 29, frame30, 39, frame40, 49, frame50);
}
function frame20(){
stop();
}
function frame30(){
stop();
}
function frame40(){
stop();
}
function frame50(){
stop();
}
}
}//package
Section 245
//BBtileMC (BBtileMC)
package {
import flash.display.*;
public dynamic class BBtileMC extends MovieClip {
public var hitBox:MovieClip;
public function BBtileMC(){
addFrameScript(9, frame10, 18, frame19, 28, frame29, 38, frame39, 48, frame49, 58, frame59, 69, frame70, 75, frame76, 89, frame90, 99, frame100);
}
function frame70(){
gotoAndPlay("jumpDown");
}
function frame76(){
stop();
}
function frame90(){
stop();
}
function frame10(){
gotoAndPlay("idle");
}
function frame100(){
stop();
}
function frame19(){
gotoAndPlay("movingUp");
}
function frame29(){
gotoAndPlay("movingDown");
}
function frame39(){
gotoAndPlay("movingLeft");
}
function frame49(){
gotoAndPlay("movingRight");
}
function frame59(){
gotoAndPlay("jumpUp");
}
}
}//package
Section 246
//BBzoomButton (BBzoomButton)
package {
import flash.display.*;
public dynamic class BBzoomButton extends MovieClip {
public var detector:MovieClip;
public function BBzoomButton(){
addFrameScript(19, frame20, 35, frame36, 45, frame46, 55, frame56);
}
function frame20(){
stop();
}
function frame36(){
stop();
}
function frame46(){
stop();
}
function frame56(){
stop();
}
}
}//package
Section 247
//bgm (bgm)
package {
import flash.media.*;
public dynamic class bgm extends Sound {
}
}//package
Section 248
//Block1 (Block1)
package {
import flash.display.*;
public dynamic class Block1 extends MovieClip {
}
}//package
Section 249
//Block2 (Block2)
package {
import flash.display.*;
public dynamic class Block2 extends MovieClip {
}
}//package
Section 250
//Block3 (Block3)
package {
import flash.display.*;
public dynamic class Block3 extends MovieClip {
}
}//package
Section 251
//Block4 (Block4)
package {
import flash.display.*;
public dynamic class Block4 extends MovieClip {
}
}//package
Section 252
//Block5 (Block5)
package {
import flash.display.*;
public dynamic class Block5 extends MovieClip {
}
}//package
Section 253
//Block6 (Block6)
package {
import flash.display.*;
public dynamic class Block6 extends MovieClip {
}
}//package
Section 254
//Block7 (Block7)
package {
import flash.display.*;
public dynamic class Block7 extends MovieClip {
}
}//package
Section 255
//CellRenderer_disabledSkin (CellRenderer_disabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_disabledSkin extends MovieClip {
}
}//package
Section 256
//CellRenderer_downSkin (CellRenderer_downSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_downSkin extends MovieClip {
}
}//package
Section 257
//CellRenderer_overSkin (CellRenderer_overSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_overSkin extends MovieClip {
}
}//package
Section 258
//CellRenderer_selectedDisabledSkin (CellRenderer_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDisabledSkin extends MovieClip {
}
}//package
Section 259
//CellRenderer_selectedDownSkin (CellRenderer_selectedDownSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedDownSkin extends MovieClip {
}
}//package
Section 260
//CellRenderer_selectedOverSkin (CellRenderer_selectedOverSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedOverSkin extends MovieClip {
}
}//package
Section 261
//CellRenderer_selectedUpSkin (CellRenderer_selectedUpSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_selectedUpSkin extends MovieClip {
}
}//package
Section 262
//CellRenderer_upSkin (CellRenderer_upSkin)
package {
import flash.display.*;
public dynamic class CellRenderer_upSkin extends MovieClip {
}
}//package
Section 263
//ColumnStretch_cursor (ColumnStretch_cursor)
package {
import flash.display.*;
public dynamic class ColumnStretch_cursor extends MovieClip {
}
}//package
Section 264
//curHeightLine (curHeightLine)
package {
import flash.display.*;
public dynamic class curHeightLine extends MovieClip {
public var line:MovieClip;
}
}//package
Section 265
//DataGrid_skin (DataGrid_skin)
package {
import flash.display.*;
public dynamic class DataGrid_skin extends MovieClip {
}
}//package
Section 266
//DataGridCellEditor_skin (DataGridCellEditor_skin)
package {
import flash.display.*;
public dynamic class DataGridCellEditor_skin extends MovieClip {
}
}//package
Section 267
//DefaultGameMenu (DefaultGameMenu)
package {
import flash.display.*;
public dynamic class DefaultGameMenu extends MovieClip {
public var backCon:MovieClip;
public var resumeCon:MovieClip;
public var howToPlayCon:MovieClip;
public var submitCon:MovieClip;
public var resetCon:MovieClip;
}
}//package
Section 268
//dialogButton (dialogButton)
package {
import flash.display.*;
public dynamic class dialogButton extends MovieClip {
public var title:MovieClip;
public var detector:MovieClip;
public function dialogButton(){
addFrameScript(19, frame20, 29, frame30, 39, frame40, 49, frame50);
}
function frame20(){
stop();
}
function frame30(){
stop();
}
function frame40(){
stop();
}
function frame50(){
stop();
}
}
}//package
Section 269
//DialogMC (DialogMC)
package {
import flash.display.*;
import flash.text.*;
public dynamic class DialogMC extends MovieClip {
public var text:TextField;
}
}//package
Section 270
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 271
//gameMenuBG (gameMenuBG)
package {
import flash.display.*;
public dynamic class gameMenuBG extends MovieClip {
}
}//package
Section 272
//gameMenuButton (gameMenuButton)
package {
import flash.display.*;
public dynamic class gameMenuButton extends MovieClip {
public var title:MovieClip;
public var detector:MovieClip;
public function gameMenuButton(){
addFrameScript(32, frame33, 65, frame66, 75, frame76, 85, frame86);
}
function frame76(){
stop();
}
function frame86(){
stop();
}
function frame33(){
gotoAndPlay("up");
}
function frame66(){
gotoAndPlay("over");
}
}
}//package
Section 273
//gameoverMenu (gameoverMenu)
package {
import flash.display.*;
public dynamic class gameoverMenu extends MovieClip {
public var toKonSite:kongregateLink;
public var backCon:MovieClip;
public var playAgainCon:MovieClip;
public var messageCon:MovieClip;
public var scoreCon:MovieClip;
public var toWBSite:MovieClip;
}
}//package
Section 274
//grid (grid)
package {
import flash.display.*;
public dynamic class grid extends MovieClip {
}
}//package
Section 275
//Ground (Ground)
package {
import flash.display.*;
public dynamic class Ground extends MovieClip {
}
}//package
Section 276
//HeaderRenderer_disabledSkin (HeaderRenderer_disabledSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_disabledSkin extends MovieClip {
}
}//package
Section 277
//HeaderRenderer_downSkin (HeaderRenderer_downSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_downSkin extends MovieClip {
}
}//package
Section 278
//HeaderRenderer_overSkin (HeaderRenderer_overSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_overSkin extends MovieClip {
}
}//package
Section 279
//HeaderRenderer_selectedDisabledSkin (HeaderRenderer_selectedDisabledSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedDisabledSkin extends MovieClip {
}
}//package
Section 280
//HeaderRenderer_selectedDownSkin (HeaderRenderer_selectedDownSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedDownSkin extends MovieClip {
}
}//package
Section 281
//HeaderRenderer_selectedOverSkin (HeaderRenderer_selectedOverSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedOverSkin extends MovieClip {
}
}//package
Section 282
//HeaderRenderer_selectedUpSkin (HeaderRenderer_selectedUpSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_selectedUpSkin extends MovieClip {
}
}//package
Section 283
//HeaderRenderer_upSkin (HeaderRenderer_upSkin)
package {
import flash.display.*;
public dynamic class HeaderRenderer_upSkin extends MovieClip {
}
}//package
Section 284
//HeaderSortArrow_ascIcon (HeaderSortArrow_ascIcon)
package {
import flash.display.*;
public dynamic class HeaderSortArrow_ascIcon extends MovieClip {
}
}//package
Section 285
//HeaderSortArrow_descIcon (HeaderSortArrow_descIcon)
package {
import flash.display.*;
public dynamic class HeaderSortArrow_descIcon extends MovieClip {
}
}//package
Section 286
//highscoreHighlight (highscoreHighlight)
package {
import flash.display.*;
public dynamic class highscoreHighlight extends MovieClip {
}
}//package
Section 287
//highScoreMenu (highScoreMenu)
package {
import flash.display.*;
public dynamic class highScoreMenu extends MovieClip {
public var backCon:MovieClip;
public var highScoreListCon:MovieClip;
public var toWBSite:MovieClip;
}
}//package
Section 288
//HowToPlayInfoWindow (HowToPlayInfoWindow)
package {
import flash.display.*;
public dynamic class HowToPlayInfoWindow extends MovieClip {
public var closeCon:MovieClip;
}
}//package
Section 289
//interfaceItemCon (interfaceItemCon)
package {
import flash.display.*;
public dynamic class interfaceItemCon extends MovieClip {
}
}//package
Section 290
//Kongintro (Kongintro)
package {
import flash.display.*;
public dynamic class Kongintro extends MovieClip {
}
}//package
Section 291
//KongregateIntro (KongregateIntro)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
public dynamic class KongregateIntro extends MovieClip {
public function KongregateIntro(){
addFrameScript(0, frame1);
}
function frame1(){
this.addEventListener(MouseEvent.MOUSE_UP, gotoKongregate);
}
public function gotoKongregate(_arg1:MouseEvent){
var _local2:URLRequest;
_local2 = new URLRequest("http://www.kongregate.com/?gamereferral=99-bricks");
navigateToURL(_local2, "_blank");
}
}
}//package
Section 292
//kongregateLink (kongregateLink)
package {
import flash.display.*;
public dynamic class kongregateLink extends MovieClip {
public var detector:MovieClip;
}
}//package
Section 293
//List_skin (List_skin)
package {
import flash.display.*;
public dynamic class List_skin extends MovieClip {
}
}//package
Section 294
//LLPixel (LLPixel)
package {
import flash.text.*;
public dynamic class LLPixel extends Font {
}
}//package
Section 295
//load (load)
package {
import flash.display.*;
public dynamic class load extends MovieClip {
public var loadBar:MovieClip;
public function load(){
addFrameScript(183, frame184);
}
function frame184(){
stop();
}
}
}//package
Section 296
//load2 (load2)
package {
import flash.display.*;
public dynamic class load2 extends MovieClip {
}
}//package
Section 297
//loadScreen (loadScreen)
package {
import flash.display.*;
public dynamic class loadScreen extends MovieClip {
public var loadBar:MovieClip;
}
}//package
Section 298
//loadSpinner (loadSpinner)
package {
import flash.display.*;
public dynamic class loadSpinner extends MovieClip {
}
}//package
Section 299
//mainBackground_mc (mainBackground_mc)
package {
import flash.display.*;
public dynamic class mainBackground_mc extends MovieClip {
}
}//package
Section 300
//mainMenu (mainMenu)
package {
import flash.display.*;
public dynamic class mainMenu extends MovieClip {
public var start1Con:MovieClip;
public var soundCon:interfaceItemCon;
public var musicCon:interfaceItemCon;
public var howToPlayCon:MovieClip;
public var toWBSite:MovieClip;
public var toKonSite:kongregateLink;
}
}//package
Section 301
//mainMenuBG (mainMenuBG)
package {
import flash.display.*;
public dynamic class mainMenuBG extends MovieClip {
}
}//package
Section 302
//maxHeightLabel (maxHeightLabel)
package {
import flash.display.*;
public dynamic class maxHeightLabel extends MovieClip {
}
}//package
Section 303
//maxHeightLine (maxHeightLine)
package {
import flash.display.*;
public dynamic class maxHeightLine extends MovieClip {
public var line:MovieClip;
}
}//package
Section 304
//MenuBG (MenuBG)
package {
import flash.display.*;
public dynamic class MenuBG extends MovieClip {
}
}//package
Section 305
//message (message)
package {
import flash.media.*;
public dynamic class message extends Sound {
}
}//package
Section 306
//messageAreaMC (messageAreaMC)
package {
import flash.display.*;
public dynamic class messageAreaMC extends MovieClip {
public var textMC:MovieClip;
}
}//package
Section 307
//mochi (mochi)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.system.*;
import flash.net.*;
import mochi.*;
import flash.media.*;
import flash.filters.*;
import flash.ui.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.printing.*;
import flash.xml.*;
public dynamic class mochi extends MovieClip {
public var main:Object;
public function mochi(){
addFrameScript(0, frame1, 1, frame2);
}
public function setMain(_arg1:Object):void{
main = _arg1;
}
function frame1(){
MochiAd.showPreGameAd({clip:this, id:"5ef5e5e8938af8cf", res:"400x500", background:7709891, color:80492, outline:0xFFFFFF, no_bg:true});
}
function frame2(){
stop();
main.mochiDone();
}
}
}//package
Section 308
//MochiAd (mochi.MochiAd)
package mochi {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.system.*;
import flash.net.*;
public class MochiAd {
public static function getVersion():String{
return ("2.7");
}
public static function showClickAwayAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
sendHostProgress = false;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
};
return (_local3);
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime()));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array;
var _local4:Number;
_local3 = _arg2.split(".");
_local4 = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
options.ad_progress(_local10);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7});
if (_local7 == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local11 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package mochi
Section 309
//modalLayer (modalLayer)
package {
import flash.display.*;
public dynamic class modalLayer extends MovieClip {
public var modal_bg:SimpleButton;
}
}//package
Section 310
//modalLayerClose_btn (modalLayerClose_btn)
package {
import flash.display.*;
public dynamic class modalLayerClose_btn extends SimpleButton {
}
}//package
Section 311
//NumericStepperDownArrow_disabledSkin (NumericStepperDownArrow_disabledSkin)
package {
import flash.display.*;
public dynamic class NumericStepperDownArrow_disabledSkin extends MovieClip {
}
}//package
Section 312
//NumericStepperDownArrow_downSkin (NumericStepperDownArrow_downSkin)
package {
import flash.display.*;
public dynamic class NumericStepperDownArrow_downSkin extends MovieClip {
}
}//package
Section 313
//NumericStepperDownArrow_overSkin (NumericStepperDownArrow_overSkin)
package {
import flash.display.*;
public dynamic class NumericStepperDownArrow_overSkin extends MovieClip {
}
}//package
Section 314
//NumericStepperDownArrow_upSkin (NumericStepperDownArrow_upSkin)
package {
import flash.display.*;
public dynamic class NumericStepperDownArrow_upSkin extends MovieClip {
}
}//package
Section 315
//NumericStepperUpArrow_disabledSkin (NumericStepperUpArrow_disabledSkin)
package {
import flash.display.*;
public dynamic class NumericStepperUpArrow_disabledSkin extends MovieClip {
}
}//package
Section 316
//NumericStepperUpArrow_downSkin (NumericStepperUpArrow_downSkin)
package {
import flash.display.*;
public dynamic class NumericStepperUpArrow_downSkin extends MovieClip {
}
}//package
Section 317
//NumericStepperUpArrow_overSkin (NumericStepperUpArrow_overSkin)
package {
import flash.display.*;
public dynamic class NumericStepperUpArrow_overSkin extends MovieClip {
}
}//package
Section 318
//NumericStepperUpArrow_upSkin (NumericStepperUpArrow_upSkin)
package {
import flash.display.*;
public dynamic class NumericStepperUpArrow_upSkin extends MovieClip {
}
}//package
Section 319
//pausedMessageBG (pausedMessageBG)
package {
import flash.display.*;
public dynamic class pausedMessageBG extends MovieClip {
}
}//package
Section 320
//pausedMessageMC (pausedMessageMC)
package {
import flash.display.*;
public dynamic class pausedMessageMC extends MovieClip {
}
}//package
Section 321
//pixelButton (pixelButton)
package {
import flash.display.*;
public dynamic class pixelButton extends MovieClip {
public var title:MovieClip;
public var detector:MovieClip;
public function pixelButton(){
addFrameScript(32, frame33, 65, frame66, 75, frame76, 85, frame86);
}
function frame76(){
stop();
}
function frame86(){
stop();
}
function frame33(){
gotoAndPlay("up");
}
function frame66(){
gotoAndPlay("over");
}
}
}//package
Section 322
//PlayInterface (PlayInterface)
package {
import flash.display.*;
public dynamic class PlayInterface extends MovieClip {
public var soundCon:interfaceItemCon;
public var backCon:interfaceItemCon;
public var blocksCon:interfaceItemCon;
public var musicCon:interfaceItemCon;
public var curHeightCon:interfaceItemCon;
public var zoomCon:interfaceItemCon;
public var maxHeightCon:interfaceItemCon;
}
}//package
Section 323
//ScrollArrowDown_disabledSkin (ScrollArrowDown_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_disabledSkin extends MovieClip {
}
}//package
Section 324
//ScrollArrowDown_downSkin (ScrollArrowDown_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_downSkin extends MovieClip {
}
}//package
Section 325
//ScrollArrowDown_overSkin (ScrollArrowDown_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_overSkin extends MovieClip {
}
}//package
Section 326
//ScrollArrowDown_upSkin (ScrollArrowDown_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowDown_upSkin extends MovieClip {
}
}//package
Section 327
//ScrollArrowUp_disabledSkin (ScrollArrowUp_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_disabledSkin extends MovieClip {
}
}//package
Section 328
//ScrollArrowUp_downSkin (ScrollArrowUp_downSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_downSkin extends MovieClip {
}
}//package
Section 329
//ScrollArrowUp_overSkin (ScrollArrowUp_overSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_overSkin extends MovieClip {
}
}//package
Section 330
//ScrollArrowUp_upSkin (ScrollArrowUp_upSkin)
package {
import flash.display.*;
public dynamic class ScrollArrowUp_upSkin extends MovieClip {
}
}//package
Section 331
//ScrollBar_thumbIcon (ScrollBar_thumbIcon)
package {
import flash.display.*;
public dynamic class ScrollBar_thumbIcon extends MovieClip {
}
}//package
Section 332
//ScrollPane_disabledSkin (ScrollPane_disabledSkin)
package {
import flash.display.*;
public dynamic class ScrollPane_disabledSkin extends MovieClip {
}
}//package
Section 333
//ScrollPane_upSkin (ScrollPane_upSkin)
package {
import flash.display.*;
public dynamic class ScrollPane_upSkin extends MovieClip {
}
}//package
Section 334
//ScrollThumb_downSkin (ScrollThumb_downSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_downSkin extends MovieClip {
}
}//package
Section 335
//ScrollThumb_overSkin (ScrollThumb_overSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_overSkin extends MovieClip {
}
}//package
Section 336
//ScrollThumb_upSkin (ScrollThumb_upSkin)
package {
import flash.display.*;
public dynamic class ScrollThumb_upSkin extends MovieClip {
}
}//package
Section 337
//ScrollTrack_skin (ScrollTrack_skin)
package {
import flash.display.*;
public dynamic class ScrollTrack_skin extends MovieClip {
}
}//package
Section 338
//showscoreMenu (showscoreMenu)
package {
import flash.display.*;
public dynamic class showscoreMenu extends MovieClip {
public var backCon:MovieClip;
public var playAgainCon:MovieClip;
public var messageCon:MovieClip;
public var scoreCon:MovieClip;
}
}//package
Section 339
//stencilButton (stencilButton)
package {
import flash.display.*;
public dynamic class stencilButton extends MovieClip {
public var title:MovieClip;
public var detector:MovieClip;
public function stencilButton(){
addFrameScript(19, frame20, 29, frame30, 39, frame40, 49, frame50);
}
function frame20(){
stop();
}
function frame30(){
stop();
}
function frame40(){
stop();
}
function frame50(){
stop();
}
}
}//package
Section 340
//submitScoreMenu (submitScoreMenu)
package {
import flash.display.*;
public dynamic class submitScoreMenu extends MovieClip {
public var nameCon:MovieClip;
public var backCon:MovieClip;
public var scoreCon:MovieClip;
public var sendCon:MovieClip;
public var toWBSite:MovieClip;
}
}//package
Section 341
//TestInterface (TestInterface)
package {
import flash.display.*;
public dynamic class TestInterface extends MovieClip {
public var soundCon:interfaceItemCon;
public var backCon:interfaceItemCon;
public var blocksCon:interfaceItemCon;
public var musicCon:interfaceItemCon;
public var curHeightCon:interfaceItemCon;
public var maxHeightCon:interfaceItemCon;
}
}//package
Section 342
//TextArea_disabledSkin (TextArea_disabledSkin)
package {
import flash.display.*;
public dynamic class TextArea_disabledSkin extends MovieClip {
}
}//package
Section 343
//TextArea_upSkin (TextArea_upSkin)
package {
import flash.display.*;
public dynamic class TextArea_upSkin extends MovieClip {
}
}//package
Section 344
//TextInput_disabledSkin (TextInput_disabledSkin)
package {
import flash.display.*;
public dynamic class TextInput_disabledSkin extends MovieClip {
}
}//package
Section 345
//TextInput_upSkin (TextInput_upSkin)
package {
import flash.display.*;
public dynamic class TextInput_upSkin extends MovieClip {
}
}//package
Section 346
//thumbLoader (thumbLoader)
package {
import flash.display.*;
public dynamic class thumbLoader extends MovieClip {
public var loadBar:MovieClip;
}
}//package
Section 347
//TileList_skin (TileList_skin)
package {
import flash.display.*;
public dynamic class TileList_skin extends MovieClip {
}
}//package
Section 348
//tooltip (tooltip)
package {
import flash.display.*;
import flash.text.*;
public dynamic class tooltip extends MovieClip {
public var bg:MovieClip;
public var textField:TextField;
public function tooltip(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 349
//upArrow (upArrow)
package {
import flash.display.*;
public dynamic class upArrow extends MovieClip {
}
}//package
Section 350
//wbIntro (wbIntro)
package {
import flash.display.*;
public dynamic class wbIntro extends MovieClip {
public var mainMC:load;
}
}//package