STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
229595
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2595 · P5190

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/68711372?noj=FRM68711372-22DC" width="1" height="1"></div>

splitter.swf

This is the info page for
Flash #226725

(Click the ID number above for more basic data on this flash file.)


Text
CONTINUE

This site does not support this game.
Please visit King.com to play.

ActionScript [AS3]

Section 1
//ArrayUtilities (ascb.util.ArrayUtilities) package ascb.util { public class ArrayUtilities { public static function duplicate(_arg1:Object, _arg2:Boolean=false):Object{ var _local3:Object; var _local4:String; var _local5:Number; if (_arg2){ if ((_arg1 is Array)){ _local3 = new Array(); _local5 = 0; while (_local5 < _arg1.length) { if ((_arg1[_local5] is Object)){ _local3[_local5] = duplicate(_arg1[_local5]); } else { _local3[_local5] = _arg1[_local5]; }; _local5++; }; return (_local3); } else { _local3 = new Object(); for (_local4 in _arg1) { if ((((((((_arg1[_local4] is Object)) && (!((_arg1[_local4] is String))))) && (!((_arg1[_local4] is Boolean))))) && (!((_arg1[_local4] is Number))))){ _local3[_local4] = duplicate(_arg1[_local4], _arg2); } else { _local3[_local4] = _arg1[_local4]; }; }; return (_local3); }; //unresolved jump }; if ((_arg1 is Array)){ return (_arg1.concat()); }; _local3 = new Object(); for (_local4 in _arg1) { _local3[_local4] = _arg1[_local4]; }; return (_local3); } public static function max(_arg1:Array):Number{ var _local2:Array = _arg1.concat(); _local2.sort(Array.NUMERIC); var _local3:Number = Number(_local2.pop()); return (_local3); } public static function findMatchIndex(_arg1:Array, _arg2:Object, ... _args):Number{ var _local4:Number = 0; var _local5:Boolean; if (typeof(_args[0]) == "number"){ _local4 = _args[0]; } else { if (typeof(_args[1]) == "number"){ _local4 = _args[1]; }; }; if (typeof(_args[0]) == "boolean"){ _local5 = _args[0]; }; var _local6:Boolean; var _local7:Number = _local4; while (_local7 < _arg1.length) { if (_local5){ _local6 = !((_arg1[_local7].indexOf(_arg2) == -1)); } else { _local6 = (_arg1[_local7] == _arg2); }; if (_local6){ return (_local7); }; _local7++; }; return (-1); } public static function switchElements(_arg1:Array, _arg2:Number, _arg3:Number):void{ var _local4:Object = _arg1[_arg2]; var _local5:Object = _arg1[_arg3]; _arg1.splice(_arg2, 1, _local5); _arg1.splice(_arg3, 1, _local4); } public static function toString(_arg1:Object, _arg2:uint=0):String{ var _local6:String; var _local3 = ""; var _local4:Number = 0; while (_local4 < _arg2) { _local3 = (_local3 + "\t"); _local4++; }; var _local5 = ""; for (_local6 in _arg1) { if ((_arg1[_local6] is Object)){ _local5 = (((((_local3 + "** ") + _local6) + " **\n") + toString(_arg1[_local6], (_arg2 + 1))) + _local5); } else { _local5 = (_local5 + ((((_local3 + _local6) + ":") + _arg1[_local6]) + "\n")); }; }; return (_local5); } public static function randomize(_arg1:Array):Array{ var _local4:Object; var _local5:Number; var _local2:Array = _arg1.concat(); var _local3:Array = new Array(); var _local6:Number = 0; while (_local6 < _local2.length) { _local5 = NumberUtilities.random(0, (_local2.length - 1)); _local3.push(_local2[_local5]); _local2.splice(_local5, 1); --_local6; _local6++; }; return (_local3); } public static function min(_arg1:Array):Number{ var _local2:Array = _arg1.concat(); _local2.sort(Array.NUMERIC); var _local3:Number = Number(_local2.shift()); return (_local3); } public static function sum(_arg1:Array):Number{ var _local2:Number = 0; var _local3:Number = 0; while (_local3 < _arg1.length) { if (typeof(_arg1[_local3]) == "number"){ _local2 = (_local2 + _arg1[_local3]); }; _local3++; }; return (_local2); } public static function findMatchIndices(_arg1:Array, _arg2:Object, _arg3:Boolean=false):Array{ var _local4:Array = new Array(); var _local5:Number = findMatchIndex(_arg1, _arg2, _arg3); while (_local5 != -1) { _local4.push(_local5); _local5 = findMatchIndex(_arg1, _arg2, _arg3, (_local5 + 1)); }; return (_local4); } public static function findLastMatchIndex(_arg1:Array, _arg2:Object, _arg3:Object):Number{ var _local5:Number = _arg1.length; var _local6:Boolean; if (typeof(arguments[2]) == "number"){ _local5 = arguments[2]; } else { if (typeof(arguments[3]) == "number"){ _local5 = arguments[3]; }; }; if (typeof(arguments[2]) == "boolean"){ _local6 = arguments[2]; }; var _local7:Boolean; var _local8:Number = _local5; while (_local8 >= 0) { if (_local6){ _local7 = !((_arg1[_local8].indexOf(_arg2) == -1)); } else { _local7 = (_arg1[_local8] == _arg2); }; if (_local7){ return (_local8); }; _local8--; }; return (-1); } public static function average(_arg1:Array):Number{ return ((sum(_arg1) / _arg1.length)); } private static function objectEquals(_arg1:Object, _arg2:Object):Boolean{ var _local3:String; for (_local3 in _arg1) { if ((_arg1[_local3] is Object)){ if (!objectEquals(_arg1[_local3], _arg2[_local3])){ return (false); }; } else { if (_arg1[_local3] != _arg2[_local3]){ return (false); }; }; }; return (true); } public static function equals(_arg1:Array, _arg2:Array, _arg3:Boolean, _arg4:Boolean):Boolean{ if (_arg1.length != _arg2.length){ return (false); }; var _local5:Array = _arg1.concat(); var _local6:Array = _arg2.concat(); if (_arg3){ _local5.sort(); _local6.sort(); }; var _local7:Number = 0; while (_local7 < _local5.length) { if ((((_local5[_local7] is Array)) && (_arg4))){ if (!equals(_local5[_local7], _local6[_local7], _arg3, _arg4)){ return (false); }; } else { if ((((_local5[_local7] is Object)) && (_arg4))){ if (!objectEquals(_local5[_local7], _local6[_local7])){ return (false); }; } else { if (_local5[_local7] != _local6[_local7]){ return (false); }; }; }; _local7++; }; return (true); } } }//package ascb.util
Section 2
//NumberUtilities (ascb.util.NumberUtilities) package ascb.util { public class NumberUtilities { private static var _aUniqueIDs:Array; public static function random(_arg1:Number, _arg2:Number=0, _arg3:Number=1):Number{ var _local6:Number; if (_arg1 > _arg2){ _local6 = _arg1; _arg1 = _arg2; _arg2 = _local6; }; var _local4:Number = ((_arg2 - _arg1) + (1 * _arg3)); var _local5:Number = (Math.random() * _local4); _local5 = (_local5 + _arg1); return (floor(_local5, _arg3)); } public static function ceil(_arg1:Number, _arg2:Number=1):Number{ return ((Math.ceil((_arg1 / _arg2)) * _arg2)); } public static function getUnique():Number{ if (_aUniqueIDs == null){ _aUniqueIDs = new Array(); }; var _local1:Date = new Date(); var _local2:Number = _local1.getTime(); while (!(isUnique(_local2))) { _local2 = (_local2 + NumberUtilities.random(_local1.getTime(), (2 * _local1.getTime()))); }; _aUniqueIDs.push(_local2); return (_local2); } private static function isUnique(_arg1:Number):Boolean{ var _local2:Number = 0; while (_local2 < _aUniqueIDs.length) { if (_aUniqueIDs[_local2] == _arg1){ return (false); }; _local2++; }; return (true); } public static function floor(_arg1:Number, _arg2:Number=1):Number{ return ((Math.floor((_arg1 / _arg2)) * _arg2)); } public static function round(_arg1:Number, _arg2:Number=1):Number{ return ((Math.round((_arg1 / _arg2)) * _arg2)); } } }//package ascb.util
Section 3
//b2CircleDef (Box2D.Collision.Shapes.b2CircleDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2CircleDef extends b2ShapeDef { public var radius:Number; public var localPosition:b2Vec2; public function b2CircleDef(){ localPosition = new b2Vec2(0, 0); super(); type = b2Shape.e_circleShape; radius = 1; } } }//package Box2D.Collision.Shapes
Section 4
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; import Box2D.Collision.*; public class b2CircleShape extends b2Shape { public var m_localPosition:b2Vec2; public var m_radius:Number; public function b2CircleShape(_arg1:b2ShapeDef){ m_localPosition = new b2Vec2(); super(_arg1); var _local2:b2CircleDef = (_arg1 as b2CircleDef); m_type = e_circleShape; m_localPosition.SetV(_local2.localPosition); m_radius = _local2.radius; } override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{ var _local10:Number; var _local6:b2Mat22 = _arg1.R; var _local7:Number = (_arg1.position.x + ((_local6.col1.x * m_localPosition.x) + (_local6.col2.x * m_localPosition.y))); var _local8:Number = (_arg1.position.x + ((_local6.col1.y * m_localPosition.x) + (_local6.col2.y * m_localPosition.y))); var _local9:Number = (_arg4.p1.x - _local7); _local10 = (_arg4.p1.y - _local8); var _local11:Number = (((_local9 * _local9) + (_local10 * _local10)) - (m_radius * m_radius)); if (_local11 < 0){ return (false); }; var _local12:Number = (_arg4.p2.x - _arg4.p1.x); var _local13:Number = (_arg4.p2.y - _arg4.p1.y); var _local14:Number = ((_local9 * _local12) + (_local10 * _local13)); var _local15:Number = ((_local12 * _local12) + (_local13 * _local13)); var _local16:Number = ((_local14 * _local14) - (_local15 * _local11)); if ((((_local16 < 0)) || ((_local15 < Number.MIN_VALUE)))){ return (false); }; var _local17:Number = -((_local14 + Math.sqrt(_local16))); if ((((0 <= _local17)) && ((_local17 <= (_arg5 * _local15))))){ _local17 = (_local17 / _local15); _arg2[0] = _local17; _arg3.x = (_local9 + (_local17 * _local12)); _arg3.y = (_local10 + (_local17 * _local13)); _arg3.Normalize(); return (true); }; return (false); } public function GetLocalPosition():b2Vec2{ return (m_localPosition); } public function GetRadius():Number{ return (m_radius); } override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ var _local4:b2Mat22; _local4 = _arg2.R; var _local5:Number = (_arg2.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y))); var _local6:Number = (_arg2.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y))); _local4 = _arg3.R; var _local7:Number = (_arg3.position.x + ((_local4.col1.x * m_localPosition.x) + (_local4.col2.x * m_localPosition.y))); var _local8:Number = (_arg3.position.y + ((_local4.col1.y * m_localPosition.x) + (_local4.col2.y * m_localPosition.y))); _arg1.lowerBound.Set((Math.min(_local5, _local7) - m_radius), (Math.min(_local6, _local8) - m_radius)); _arg1.upperBound.Set((Math.max(_local5, _local7) + m_radius), (Math.max(_local6, _local8) + m_radius)); } override public function ComputeMass(_arg1:b2MassData):void{ _arg1.mass = (((m_density * b2Settings.b2_pi) * m_radius) * m_radius); _arg1.center.SetV(m_localPosition); _arg1.I = (_arg1.mass * (((0.5 * m_radius) * m_radius) + ((m_localPosition.x * m_localPosition.x) + (m_localPosition.y * m_localPosition.y)))); } override public function UpdateSweepRadius(_arg1:b2Vec2):void{ var _local2:Number = (m_localPosition.x - _arg1.x); var _local3:Number = (m_localPosition.y - _arg1.y); _local2 = Math.sqrt(((_local2 * _local2) + (_local3 * _local3))); m_sweepRadius = ((_local2 + m_radius) - b2Settings.b2_toiSlop); } override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ var _local3:b2Mat22 = _arg2.R; var _local4:Number = (_arg2.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y))); var _local5:Number = (_arg2.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y))); _arg1.lowerBound.Set((_local4 - m_radius), (_local5 - m_radius)); _arg1.upperBound.Set((_local4 + m_radius), (_local5 + m_radius)); } override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ var _local3:b2Mat22 = _arg1.R; var _local4:Number = (_arg1.position.x + ((_local3.col1.x * m_localPosition.x) + (_local3.col2.x * m_localPosition.y))); var _local5:Number = (_arg1.position.y + ((_local3.col1.y * m_localPosition.x) + (_local3.col2.y * m_localPosition.y))); _local4 = (_arg2.x - _local4); _local5 = (_arg2.y - _local5); return ((((_local4 * _local4) + (_local5 * _local5)) <= (m_radius * m_radius))); } } }//package Box2D.Collision.Shapes
Section 5
//b2MassData (Box2D.Collision.Shapes.b2MassData) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; public class b2MassData { public var mass:Number;// = 0 public var center:b2Vec2; public var I:Number;// = 0 public function b2MassData(){ center = new b2Vec2(0, 0); super(); } } }//package Box2D.Collision.Shapes
Section 6
//b2PolygonDef (Box2D.Collision.Shapes.b2PolygonDef) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PolygonDef extends b2ShapeDef { public var vertices:Array; public var vertexCount:int; private static var s_mat:b2Mat22 = new b2Mat22(); public function b2PolygonDef(){ vertices = new Array(b2Settings.b2_maxPolygonVertices); super(); type = b2Shape.e_polygonShape; vertexCount = 0; var _local1:int; while (_local1 < b2Settings.b2_maxPolygonVertices) { vertices[_local1] = new b2Vec2(); _local1++; }; } public function SetAsOrientedBox(_arg1:Number, _arg2:Number, _arg3:b2Vec2=null, _arg4:Number=0):void{ var _local5:b2Vec2; var _local6:b2Mat22; var _local7:int; vertexCount = 4; vertices[0].Set(-(_arg1), -(_arg2)); vertices[1].Set(_arg1, -(_arg2)); vertices[2].Set(_arg1, _arg2); vertices[3].Set(-(_arg1), _arg2); if (_arg3){ _local5 = _arg3; _local6 = s_mat; _local6.Set(_arg4); _local7 = 0; while (_local7 < vertexCount) { _arg3 = vertices[_local7]; _arg1 = (_local5.x + ((_local6.col1.x * _arg3.x) + (_local6.col2.x * _arg3.y))); _arg3.y = (_local5.y + ((_local6.col1.y * _arg3.x) + (_local6.col2.y * _arg3.y))); _arg3.x = _arg1; _local7++; }; }; } public function SetAsBox(_arg1:Number, _arg2:Number):void{ vertexCount = 4; vertices[0].Set(-(_arg1), -(_arg2)); vertices[1].Set(_arg1, -(_arg2)); vertices[2].Set(_arg1, _arg2); vertices[3].Set(-(_arg1), _arg2); } } }//package Box2D.Collision.Shapes
Section 7
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; import Box2D.Collision.*; public class b2PolygonShape extends b2Shape { public var m_coreVertices:Array; public var m_vertices:Array; private var s_supportVec:b2Vec2; public var m_centroid:b2Vec2; public var m_normals:Array; public var m_obb:b2OBB; public var m_vertexCount:int; private static var s_computeMat:b2Mat22 = new b2Mat22(); private static var s_sweptAABB1:b2AABB = new b2AABB(); private static var s_sweptAABB2:b2AABB = new b2AABB(); public function b2PolygonShape(_arg1:b2ShapeDef){ var _local3:int; var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; s_supportVec = new b2Vec2(); m_obb = new b2OBB(); m_vertices = new Array(b2Settings.b2_maxPolygonVertices); m_normals = new Array(b2Settings.b2_maxPolygonVertices); m_coreVertices = new Array(b2Settings.b2_maxPolygonVertices); super(_arg1); m_type = e_polygonShape; var _local2:b2PolygonDef = (_arg1 as b2PolygonDef); m_vertexCount = _local2.vertexCount; var _local4:int = _local3; var _local5:int = _local3; _local3 = 0; while (_local3 < m_vertexCount) { m_vertices[_local3] = _local2.vertices[_local3].Copy(); _local3++; }; _local3 = 0; while (_local3 < m_vertexCount) { _local4 = _local3; _local5 = (((_local3 + 1) < m_vertexCount)) ? (_local3 + 1) : 0; _local6 = (m_vertices[_local5].x - m_vertices[_local4].x); _local7 = (m_vertices[_local5].y - m_vertices[_local4].y); _local8 = Math.sqrt(((_local6 * _local6) + (_local7 * _local7))); m_normals[_local3] = new b2Vec2((_local7 / _local8), (-(_local6) / _local8)); _local3++; }; m_centroid = ComputeCentroid(_local2.vertices, _local2.vertexCount); ComputeOBB(m_obb, m_vertices, m_vertexCount); _local3 = 0; while (_local3 < m_vertexCount) { _local4 = (((_local3 - 1) >= 0)) ? (_local3 - 1) : (m_vertexCount - 1); _local5 = _local3; _local9 = m_normals[_local4].x; _local10 = m_normals[_local4].y; _local11 = m_normals[_local5].x; _local12 = m_normals[_local5].y; _local13 = (m_vertices[_local3].x - m_centroid.x); _local14 = (m_vertices[_local3].y - m_centroid.y); _local15 = (((_local9 * _local13) + (_local10 * _local14)) - b2Settings.b2_toiSlop); _local16 = (((_local11 * _local13) + (_local12 * _local14)) - b2Settings.b2_toiSlop); _local17 = (1 / ((_local9 * _local12) - (_local10 * _local11))); m_coreVertices[_local3] = new b2Vec2(((_local17 * ((_local12 * _local15) - (_local10 * _local16))) + m_centroid.x), ((_local17 * ((_local9 * _local16) - (_local11 * _local15))) + m_centroid.y)); _local3++; }; } public function GetCoreVertices():Array{ return (m_coreVertices); } public function GetVertices():Array{ return (m_vertices); } override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{ var _local4:b2AABB = s_sweptAABB1; var _local5:b2AABB = s_sweptAABB2; ComputeAABB(_local4, _arg2); ComputeAABB(_local5, _arg3); _arg1.lowerBound.Set(Math.min(_local4.lowerBound.x, _local5.lowerBound.x), Math.min(_local4.lowerBound.y, _local5.lowerBound.y)); _arg1.upperBound.Set(Math.max(_local4.upperBound.x, _local5.upperBound.x), Math.max(_local4.upperBound.y, _local5.upperBound.y)); } public function GetCentroid():b2Vec2{ return (m_centroid); } public function GetOBB():b2OBB{ return (m_obb); } public function GetFirstVertex(_arg1:b2XForm):b2Vec2{ return (b2Math.b2MulX(_arg1, m_coreVertices[0])); } public function Centroid(_arg1:b2XForm):b2Vec2{ return (b2Math.b2MulX(_arg1, m_centroid)); } override public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{ var _local8:Number; var _local9:Number; var _local10:b2Mat22; var _local11:b2Vec2; var _local20:Number; var _local21:Number; var _local6:Number = 0; var _local7:Number = _arg5; _local8 = (_arg4.p1.x - _arg1.position.x); _local9 = (_arg4.p1.y - _arg1.position.y); _local10 = _arg1.R; var _local12:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y)); var _local13:Number = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y)); _local8 = (_arg4.p2.x - _arg1.position.x); _local9 = (_arg4.p2.y - _arg1.position.y); _local10 = _arg1.R; var _local14:Number = ((_local8 * _local10.col1.x) + (_local9 * _local10.col1.y)); var _local15:Number = ((_local8 * _local10.col2.x) + (_local9 * _local10.col2.y)); var _local16:Number = (_local14 - _local12); var _local17:Number = (_local15 - _local13); var _local18 = -1; var _local19:int; while (_local19 < m_vertexCount) { _local8 = (m_vertices[_local19].x - _local12); _local9 = (m_vertices[_local19].y - _local13); _local11 = m_normals[_local19]; _local20 = ((_local11.x * _local8) + (_local11.y * _local9)); _local21 = ((_local11.x * _local16) + (_local11.y * _local17)); if ((((_local21 < 0)) && ((_local20 > (_local6 * _local21))))){ _local6 = (_local20 / _local21); _local18 = _local19; } else { if ((((_local21 > 0)) && ((_local20 < (_local7 * _local21))))){ _local7 = (_local20 / _local21); }; }; if (_local7 < _local6){ return (false); }; _local19++; }; if (_local18 >= 0){ _arg2[0] = _local6; _local10 = _arg1.R; _local11 = m_normals[_local18]; _arg3.x = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y)); _arg3.y = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y)); return (true); }; return (false); } override public function ComputeMass(_arg1:b2MassData):void{ var _local10:b2Vec2; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local2:Number = 0; var _local3:Number = 0; var _local4:Number = 0; var _local5:Number = 0; var _local6:Number = 0; var _local7:Number = 0; var _local8:Number = (1 / 3); var _local9:int; while (_local9 < m_vertexCount) { _local10 = m_vertices[_local9]; _local11 = (((_local9 + 1) < m_vertexCount)) ? m_vertices[(_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:b2Mat22; var _local11:Number; _local4 = _arg1.R; var _local5:Number = ((_arg2 * _local4.col1.x) + (_arg3 * _local4.col1.y)); var _local6:Number = ((_arg2 * _local4.col2.x) + (_arg3 * _local4.col2.y)); var _local7:int; var _local8:Number = ((m_coreVertices[0].x * _local5) + (m_coreVertices[0].y * _local6)); var _local9 = 1; while (_local9 < m_vertexCount) { _local11 = ((m_coreVertices[_local9].x * _local5) + (m_coreVertices[_local9].y * _local6)); if (_local11 > _local8){ _local7 = _local9; _local8 = _local11; }; _local9++; }; _local4 = _arg1.R; var _local10:b2Vec2 = m_coreVertices[_local7]; s_supportVec.x = (_arg1.position.x + ((_local4.col1.x * _local10.x) + (_local4.col2.x * _local10.y))); s_supportVec.y = (_arg1.position.y + ((_local4.col1.y * _local10.x) + (_local4.col2.y * _local10.y))); return (s_supportVec); } override public function UpdateSweepRadius(_arg1:b2Vec2):void{ var _local3:Number; var _local4:Number; m_sweepRadius = 0; var _local2:int; while (_local2 < m_vertexCount) { _local3 = (m_coreVertices[_local2].x - _arg1.x); _local4 = (m_coreVertices[_local2].y - _arg1.y); _local3 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4))); m_sweepRadius = Math.max(m_sweepRadius, _local3); _local2++; }; } override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ var _local3:b2Mat22; var _local4:b2Vec2; var _local5:b2Mat22 = s_computeMat; _local3 = _arg2.R; _local4 = m_obb.R.col1; _local5.col1.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); _local5.col1.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); _local4 = m_obb.R.col2; _local5.col2.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)); _local5.col2.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)); _local5.Abs(); var _local6:b2Mat22 = _local5; _local4 = m_obb.extents; var _local7:Number = ((_local6.col1.x * _local4.x) + (_local6.col2.x * _local4.y)); var _local8:Number = ((_local6.col1.y * _local4.x) + (_local6.col2.y * _local4.y)); _local3 = _arg2.R; _local4 = m_obb.center; var _local9:Number = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y))); var _local10:Number = (_arg2.position.y + ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y))); _arg1.lowerBound.Set((_local9 - _local7), (_local10 - _local8)); _arg1.upperBound.Set((_local9 + _local7), (_local10 + _local8)); } public function GetVertexCount():int{ return (m_vertexCount); } override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ var _local9:Number; var _local3:b2Mat22 = _arg1.R; var _local4:Number = (_arg2.x - _arg1.position.x); var _local5:Number = (_arg2.y - _arg1.position.y); var _local6:Number = ((_local4 * _local3.col1.x) + (_local5 * _local3.col1.y)); var _local7:Number = ((_local4 * _local3.col2.x) + (_local5 * _local3.col2.y)); var _local8:int; while (_local8 < m_vertexCount) { _local4 = (_local6 - m_vertices[_local8].x); _local5 = (_local7 - m_vertices[_local8].y); _local9 = ((m_normals[_local8].x * _local4) + (m_normals[_local8].y * _local5)); if (_local9 > 0){ return (false); }; _local8++; }; return (true); } public static function ComputeCentroid(_arg1:Array, _arg2:int):b2Vec2{ var _local3:b2Vec2; var _local7:Number; var _local9:b2Vec2; var _local10:b2Vec2; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; _local3 = new b2Vec2(); var _local4:Number = 0; var _local5:Number = 0; var _local6:Number = 0; _local7 = (1 / 3); var _local8:int; while (_local8 < _arg2) { _local9 = _arg1[_local8]; _local10 = (((_local8 + 1) < _arg2)) ? _arg1[(_local8 + 1)] : _arg1[0]; _local11 = (_local9.x - _local5); _local12 = (_local9.y - _local6); _local13 = (_local10.x - _local5); _local14 = (_local10.y - _local6); _local15 = ((_local11 * _local14) - (_local12 * _local13)); _local16 = (0.5 * _local15); _local4 = (_local4 + _local16); _local3.x = (_local3.x + ((_local16 * _local7) * ((_local5 + _local9.x) + _local10.x))); _local3.y = (_local3.y + ((_local16 * _local7) * ((_local6 + _local9.y) + _local10.y))); _local8++; }; _local3.x = (_local3.x * (1 / _local4)); _local3.y = (_local3.y * (1 / _local4)); return (_local3); } public static function ComputeOBB(_arg1:b2OBB, _arg2:Array, _arg3:int):void{ var _local4:int; var _local7:b2Vec2; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:int; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:b2Mat22; var _local5:Array = new Array((b2Settings.b2_maxPolygonVertices + 1)); _local4 = 0; while (_local4 < _arg3) { _local5[_local4] = _arg2[_local4]; _local4++; }; _local5[_arg3] = _local5[0]; var _local6:Number = Number.MAX_VALUE; _local4 = 1; while (_local4 <= _arg3) { _local7 = _local5[(_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)); _local13 = Math.min(_local13, _local21); _local14 = Math.min(_local14, _local22); _local15 = Math.max(_local15, _local21); _local16 = Math.max(_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 8
//b2Shape (Box2D.Collision.Shapes.b2Shape) package Box2D.Collision.Shapes { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Collision.*; public class b2Shape { public var m_next:b2Shape; public var m_type:int; public var m_restitution:Number; public var m_sweepRadius:Number; public var m_userData; public var m_density:Number; public var m_proxyId:uint; public var m_friction:Number; public var m_isSensor:Boolean; public var m_groupIndex:int; public var m_categoryBits:uint; public var m_body:b2Body; public var m_maskBits:uint; 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_categoryBits = _arg1.categoryBits; m_maskBits = _arg1.maskBits; m_groupIndex = _arg1.groupIndex; m_isSensor = _arg1.isSensor; } 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 TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{ return (false); } public function IsSensor():Boolean{ return (m_isSensor); } public function ComputeMass(_arg1:b2MassData):void{ } public function Synchronize(_arg1:b2BroadPhase, _arg2:b2XForm, _arg3:b2XForm):Boolean{ if (m_proxyId == b2Pair.b2_nullProxy){ return (false); }; var _local4:b2AABB = s_syncAABB; ComputeSweptAABB(_local4, _arg2, _arg3); if (_arg1.InRange(_local4)){ _arg1.MoveProxy(m_proxyId, _local4); return (true); }; return (false); } public function CreateProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{ var _local3:b2AABB = s_proxyAABB; ComputeAABB(_local3, _arg2); var _local4:Boolean = _arg1.InRange(_local3); if (_local4){ m_proxyId = _arg1.CreateProxy(_local3, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; } public function DestroyProxy(_arg1:b2BroadPhase):void{ if (m_proxyId != b2Pair.b2_nullProxy){ _arg1.DestroyProxy(m_proxyId); m_proxyId = b2Pair.b2_nullProxy; }; } public function UpdateSweepRadius(_arg1:b2Vec2):void{ } public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{ } public function GetBody():b2Body{ return (m_body); } public function GetUserData(){ return (m_userData); } public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{ return (false); } public function ResetProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{ if (m_proxyId != b2Pair.b2_nullProxy){ _arg1.DestroyProxy(m_proxyId); }; var _local3:b2AABB = s_resetAABB; ComputeAABB(_local3, _arg2); var _local4:Boolean = _arg1.InRange(_local3); if (_local4){ m_proxyId = _arg1.CreateProxy(_local3, this); } else { m_proxyId = b2Pair.b2_nullProxy; }; } public 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 9
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef) package Box2D.Collision.Shapes { public class b2ShapeDef { public var friction:Number; public var groupIndex:int; public var categoryBits:int; public var density:Number; public var restitution:Number; public var maskBits:int; public var userData;// = null public var type:int; public var isSensor:Boolean; public function b2ShapeDef(){ type = b2Shape.e_unknownShape; userData = null; friction = 0.2; restitution = 0; density = 0; categoryBits = 1; maskBits = 0xFFFF; groupIndex = 0; isSensor = false; } } }//package Box2D.Collision.Shapes
Section 10
//b2AABB (Box2D.Collision.b2AABB) package Box2D.Collision { import Box2D.Common.Math.*; public class b2AABB { public var upperBound:b2Vec2; public var lowerBound:b2Vec2; public function b2AABB(){ lowerBound = new b2Vec2(); upperBound = new b2Vec2(); super(); } public function IsValid():Boolean{ var _local1:Number = (upperBound.x - lowerBound.x); var _local2:Number = (upperBound.y - lowerBound.y); var _local3:Boolean = (((_local1 >= 0)) && ((_local2 >= 0))); _local3 = ((((_local3) && (lowerBound.IsValid()))) && (upperBound.IsValid())); return (_local3); } } }//package Box2D.Collision
Section 11
//b2Bound (Box2D.Collision.b2Bound) package Box2D.Collision { public class b2Bound { public var value:uint; public var proxyId:uint; public var stabbingCount:uint; public function Swap(_arg1:b2Bound):void{ var _local2:uint = value; var _local3:uint = proxyId; var _local4:uint = stabbingCount; value = _arg1.value; proxyId = _arg1.proxyId; stabbingCount = _arg1.stabbingCount; _arg1.value = _local2; _arg1.proxyId = _local3; _arg1.stabbingCount = _local4; } public function IsLower():Boolean{ return (((value & 1) == 0)); } public function IsUpper():Boolean{ return (((value & 1) == 1)); } } }//package Box2D.Collision
Section 12
//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 13
//b2BroadPhase (Box2D.Collision.b2BroadPhase) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2BroadPhase { public var m_bounds:Array; public var m_quantizationFactor:b2Vec2; public var m_worldAABB:b2AABB; public var m_freeProxy:uint; public var m_proxyCount:int; public var m_proxyPool:Array; public var m_queryResultCount:int; public var m_pairManager:b2PairManager; public var m_timeStamp:uint; public var m_queryResults:Array; public static const b2_nullEdge:uint = 0xFFFF; public static const b2_invalid:uint = 0xFFFF; public static var s_validate:Boolean = false; public function b2BroadPhase(_arg1:b2AABB, _arg2:b2PairCallback){ var _local3:int; var _local6:b2Proxy; var _local7:int; m_pairManager = new b2PairManager(); m_proxyPool = new Array(b2Settings.b2_maxPairs); m_bounds = new Array((2 * b2Settings.b2_maxProxies)); m_queryResults = new Array(b2Settings.b2_maxProxies); m_quantizationFactor = new b2Vec2(); super(); m_pairManager.Initialize(this, _arg2); m_worldAABB = _arg1; m_proxyCount = 0; _local3 = 0; while (_local3 < b2Settings.b2_maxProxies) { m_queryResults[_local3] = 0; _local3++; }; m_bounds = new Array(2); _local3 = 0; while (_local3 < 2) { m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies)); _local7 = 0; while (_local7 < (2 * b2Settings.b2_maxProxies)) { m_bounds[_local3][_local7] = new b2Bound(); _local7++; }; _local3++; }; var _local4:Number = (_arg1.upperBound.x - _arg1.lowerBound.x); var _local5:Number = (_arg1.upperBound.y - _arg1.lowerBound.y); m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4); m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5); _local3 = 0; while (_local3 < (b2Settings.b2_maxProxies - 1)) { _local6 = new b2Proxy(); m_proxyPool[_local3] = _local6; _local6.SetNext((_local3 + 1)); _local6.timeStamp = 0; _local6.overlapCount = b2_invalid; _local6.userData = null; _local3++; }; _local6 = new b2Proxy(); m_proxyPool[(b2Settings.b2_maxProxies - 1)] = _local6; _local6.SetNext(b2Pair.b2_nullProxy); _local6.timeStamp = 0; _local6.overlapCount = b2_invalid; _local6.userData = null; m_freeProxy = 0; m_timeStamp = 1; m_queryResultCount = 0; } public function QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{ var _local6:uint; var _local7:uint; var _local12:b2Proxy; var _local4:Array = new Array(); var _local5:Array = new Array(); ComputeBounds(_local4, _local5, _arg1); var _local8:Array = [_local6]; var _local9:Array = [_local7]; Query(_local8, _local9, _local4[0], _local5[0], m_bounds[0], (2 * m_proxyCount), 0); Query(_local8, _local9, _local4[1], _local5[1], m_bounds[1], (2 * m_proxyCount), 1); var _local10:int; var _local11:int; while ((((_local11 < m_queryResultCount)) && ((_local10 < _arg3)))) { _local12 = m_proxyPool[m_queryResults[_local11]]; _arg2[_local11] = _local12.userData; _local11++; _local10++; }; m_queryResultCount = 0; IncrementTimeStamp(); return (_local10); } public function Commit():void{ m_pairManager.Commit(); } public function GetProxy(_arg1:int):b2Proxy{ if ((((_arg1 == b2Pair.b2_nullProxy)) || ((m_proxyPool[_arg1].IsValid() == false)))){ return (null); }; return (m_proxyPool[_arg1]); } private function IncrementTimeStamp():void{ var _local1:uint; if (m_timeStamp == b2Settings.USHRT_MAX){ _local1 = 0; while (_local1 < b2Settings.b2_maxProxies) { m_proxyPool[_local1].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 _local11:int; var _local12:int; var _local13:b2Proxy; var _local8:uint = BinarySearch(_arg5, _arg6, _arg3); var _local9:uint = BinarySearch(_arg5, _arg6, _arg4); var _local10:uint = _local8; while (_local10 < _local9) { if (_arg5[_local10].IsLower()){ IncrementOverlapCount(_arg5[_local10].proxyId); }; _local10++; }; if (_local8 > 0){ _local11 = (_local8 - 1); _local12 = _arg5[_local11].stabbingCount; while (_local12) { if (_arg5[_local11].IsLower()){ _local13 = m_proxyPool[_arg5[_local11].proxyId]; if (_local8 <= _local13.upperBounds[_arg7]){ IncrementOverlapCount(_arg5[_local11].proxyId); _local12--; }; }; _local11--; }; }; _arg1[0] = _local8; _arg2[0] = _local9; } private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{ var _local4:Array; var _local3:int; while (_local3 < 2) { _local4 = m_bounds[_local3]; if (_local4[_arg1.lowerBounds[_local3]].value > _local4[_arg2.upperBounds[_local3]].value){ return (false); }; if (_local4[_arg1.upperBounds[_local3]].value < _local4[_arg2.lowerBounds[_local3]].value){ return (false); }; _local3++; }; return (true); } private function ComputeBounds(_arg1:Array, _arg2:Array, _arg3:b2AABB):void{ var _local4:Number = _arg3.lowerBound.x; var _local5:Number = _arg3.lowerBound.y; _local4 = b2Math.b2Min(_local4, m_worldAABB.upperBound.x); _local5 = b2Math.b2Min(_local5, m_worldAABB.upperBound.y); _local4 = b2Math.b2Max(_local4, m_worldAABB.lowerBound.x); _local5 = b2Math.b2Max(_local5, m_worldAABB.lowerBound.y); var _local6:Number = _arg3.upperBound.x; var _local7:Number = _arg3.upperBound.y; _local6 = b2Math.b2Min(_local6, m_worldAABB.upperBound.x); _local7 = b2Math.b2Min(_local7, m_worldAABB.upperBound.y); _local6 = b2Math.b2Max(_local6, m_worldAABB.lowerBound.x); _local7 = b2Math.b2Max(_local7, m_worldAABB.lowerBound.y); _arg1[0] = (uint((m_quantizationFactor.x * (_local4 - m_worldAABB.lowerBound.x))) & (b2Settings.USHRT_MAX - 1)); _arg2[0] = ((uint((m_quantizationFactor.x * (_local6 - m_worldAABB.lowerBound.x))) & 0xFFFF) | 1); _arg1[1] = (uint((m_quantizationFactor.y * (_local5 - m_worldAABB.lowerBound.y))) & (b2Settings.USHRT_MAX - 1)); _arg2[1] = ((uint((m_quantizationFactor.y * (_local7 - m_worldAABB.lowerBound.y))) & 0xFFFF) | 1); } public function CreateProxy(_arg1:b2AABB, _arg2):uint{ var _local3:uint; var _local4:b2Proxy; var _local11:Array; var _local12:uint; var _local13:uint; var _local14:Array; var _local15:Array; var _local16:Array; var _local17:int; var _local18:int; var _local19:b2Bound; var _local20:b2Bound; var _local21:int; var _local22:b2Proxy; var _local5:uint = m_freeProxy; _local4 = m_proxyPool[_local5]; m_freeProxy = _local4.GetNext(); _local4.overlapCount = 0; _local4.userData = _arg2; var _local6:uint = (2 * m_proxyCount); var _local7:Array = new Array(); var _local8:Array = new Array(); ComputeBounds(_local7, _local8, _arg1); var _local9:int; while (_local9 < 2) { _local11 = m_bounds[_local9]; _local14 = [_local12]; _local15 = [_local13]; Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9); _local12 = _local14[0]; _local13 = _local15[0]; _local16 = new Array(); _local18 = (_local6 - _local13); _local17 = 0; while (_local17 < _local18) { _local16[_local17] = new b2Bound(); _local19 = _local16[_local17]; _local20 = _local11[(_local13 + _local17)]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local18 = _local16.length; _local21 = (_local13 + 2); _local17 = 0; while (_local17 < _local18) { _local20 = _local16[_local17]; _local19 = _local11[(_local21 + _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[(_local12 + _local17)]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local18 = _local16.length; _local21 = (_local12 + 1); _local17 = 0; while (_local17 < _local18) { _local20 = _local16[_local17]; _local19 = _local11[(_local21 + _local17)]; _local19.value = _local20.value; _local19.proxyId = _local20.proxyId; _local19.stabbingCount = _local20.stabbingCount; _local17++; }; _local13++; _local11[_local12].value = _local7[_local9]; _local11[_local12].proxyId = _local5; _local11[_local13].value = _local8[_local9]; _local11[_local13].proxyId = _local5; _local11[_local12].stabbingCount = ((_local12 == 0)) ? 0 : _local11[(_local12 - 1)].stabbingCount; _local11[_local13].stabbingCount = _local11[(_local13 - 1)].stabbingCount; _local3 = _local12; while (_local3 < _local13) { _local11[_local3].stabbingCount++; _local3++; }; _local3 = _local12; while (_local3 < (_local6 + 2)) { _local22 = m_proxyPool[_local11[_local3].proxyId]; if (_local11[_local3].IsLower()){ _local22.lowerBounds[_local9] = _local3; } else { _local22.upperBounds[_local9] = _local3; }; _local3++; }; _local9++; }; m_proxyCount++; var _local10:int; while (_local10 < m_queryResultCount) { m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]); _local10++; }; m_pairManager.Commit(); m_queryResultCount = 0; IncrementTimeStamp(); return (_local5); } public function DestroyProxy(_arg1:uint):void{ var _local6:Array; var _local7:uint; var _local8:uint; var _local9:uint; var _local10:uint; var _local11:Array; var _local12:int; var _local13:int; var _local14:b2Bound; var _local15:b2Bound; var _local16:int; var _local17:uint; var _local18:int; var _local19:b2Proxy; var _local2:b2Proxy = m_proxyPool[_arg1]; var _local3:int = (2 * m_proxyCount); var _local4:int; while (_local4 < 2) { _local6 = m_bounds[_local4]; _local7 = _local2.lowerBounds[_local4]; _local8 = _local2.upperBounds[_local4]; _local9 = _local6[_local7].value; _local10 = _local6[_local8].value; _local11 = new Array(); _local13 = ((_local8 - _local7) - 1); _local12 = 0; while (_local12 < _local13) { _local11[_local12] = new b2Bound(); _local14 = _local11[_local12]; _local15 = _local6[((_local7 + 1) + _local12)]; _local14.value = _local15.value; _local14.proxyId = _local15.proxyId; _local14.stabbingCount = _local15.stabbingCount; _local12++; }; _local13 = _local11.length; _local16 = _local7; _local12 = 0; while (_local12 < _local13) { _local15 = _local11[_local12]; _local14 = _local6[(_local16 + _local12)]; _local14.value = _local15.value; _local14.proxyId = _local15.proxyId; _local14.stabbingCount = _local15.stabbingCount; _local12++; }; _local11 = new Array(); _local13 = ((_local3 - _local8) - 1); _local12 = 0; while (_local12 < _local13) { _local11[_local12] = new b2Bound(); _local14 = _local11[_local12]; _local15 = _local6[((_local8 + 1) + _local12)]; _local14.value = _local15.value; _local14.proxyId = _local15.proxyId; _local14.stabbingCount = _local15.stabbingCount; _local12++; }; _local13 = _local11.length; _local16 = (_local8 - 1); _local12 = 0; while (_local12 < _local13) { _local15 = _local11[_local12]; _local14 = _local6[(_local16 + _local12)]; _local14.value = _local15.value; _local14.proxyId = _local15.proxyId; _local14.stabbingCount = _local15.stabbingCount; _local12++; }; _local13 = (_local3 - 2); _local17 = _local7; while (_local17 < _local13) { _local19 = m_proxyPool[_local6[_local17].proxyId]; if (_local6[_local17].IsLower()){ _local19.lowerBounds[_local4] = _local17; } else { _local19.upperBounds[_local4] = _local17; }; _local17++; }; _local13 = (_local8 - 1); _local18 = _local7; while (_local18 < _local13) { _local6[_local18].stabbingCount--; _local18++; }; Query([0], [0], _local9, _local10, _local6, (_local3 - 2), _local4); _local4++; }; var _local5:int; while (_local5 < m_queryResultCount) { m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local5]); _local5++; }; m_pairManager.Commit(); m_queryResultCount = 0; IncrementTimeStamp(); _local2.userData = null; _local2.overlapCount = b2_invalid; _local2.lowerBounds[0] = b2_invalid; _local2.lowerBounds[1] = b2_invalid; _local2.upperBounds[0] = b2_invalid; _local2.upperBounds[1] = b2_invalid; _local2.SetNext(m_freeProxy); m_freeProxy = _arg1; m_proxyCount--; } public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{ var _local4:Array; var _local3:int; while (_local3 < 2) { _local4 = m_bounds[_local3]; if (_arg1.lowerValues[_local3] > _local4[_arg2.upperBounds[_local3]].value){ return (false); }; if (_arg1.upperValues[_local3] < _local4[_arg2.lowerBounds[_local3]].value){ return (false); }; _local3++; }; return (true); } public function Validate():void{ var _local1:b2Pair; var _local2:b2Proxy; var _local3:b2Proxy; var _local4:Boolean; var _local6:b2Bound; var _local7:uint; var _local8:uint; var _local9:uint; var _local10:b2Bound; var _local5:int; while (_local5 < 2) { _local6 = m_bounds[_local5]; _local7 = (2 * m_proxyCount); _local8 = 0; _local9 = 0; while (_local9 < _local7) { _local10 = _local6[_local9]; if (_local10.IsLower() == true){ _local8++; } else { _local8--; }; _local9++; }; _local5++; }; } private function IncrementOverlapCount(_arg1:uint):void{ var _local2:b2Proxy = m_proxyPool[_arg1]; if (_local2.timeStamp < m_timeStamp){ _local2.timeStamp = m_timeStamp; _local2.overlapCount = 1; } else { _local2.overlapCount = 2; m_queryResults[m_queryResultCount] = _arg1; m_queryResultCount++; }; } public function InRange(_arg1:b2AABB):Boolean{ var _local2:Number; var _local3:Number; var _local4:Number; var _local5:Number; _local2 = _arg1.lowerBound.x; _local3 = _arg1.lowerBound.y; _local2 = (_local2 - m_worldAABB.upperBound.x); _local3 = (_local3 - m_worldAABB.upperBound.y); _local4 = m_worldAABB.lowerBound.x; _local5 = m_worldAABB.lowerBound.y; _local4 = (_local4 - _arg1.upperBound.x); _local5 = (_local5 - _arg1.upperBound.y); _local2 = b2Math.b2Max(_local2, _local4); _local3 = b2Math.b2Max(_local3, _local5); return ((b2Math.b2Max(_local2, _local3) < 0)); } public function MoveProxy(_arg1:uint, _arg2:b2AABB):void{ var _local3:uint; var _local4:uint; var _local5:b2Bound; var _local6:b2Bound; var _local7:b2Bound; var _local8:uint; var _local9:b2Proxy; var _local14:Array; var _local15:uint; var _local16:uint; var _local17:uint; var _local18:uint; var _local19:int; var _local20:int; var _local21:uint; var _local22:b2Proxy; if ((((_arg1 == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= _arg1)))){ return; }; if (_arg2.IsValid() == false){ return; }; var _local10:uint = (2 * m_proxyCount); var _local11:b2Proxy = m_proxyPool[_arg1]; var _local12:b2BoundValues = new b2BoundValues(); ComputeBounds(_local12.lowerValues, _local12.upperValues, _arg2); var _local13:b2BoundValues = new b2BoundValues(); _local3 = 0; while (_local3 < 2) { _local13.lowerValues[_local3] = m_bounds[_local3][_local11.lowerBounds[_local3]].value; _local13.upperValues[_local3] = m_bounds[_local3][_local11.upperBounds[_local3]].value; _local3++; }; _local3 = 0; while (_local3 < 2) { _local14 = m_bounds[_local3]; _local15 = _local11.lowerBounds[_local3]; _local16 = _local11.upperBounds[_local3]; _local17 = _local12.lowerValues[_local3]; _local18 = _local12.upperValues[_local3]; _local19 = (_local17 - _local14[_local15].value); _local20 = (_local18 - _local14[_local16].value); _local14[_local15].value = _local17; _local14[_local16].value = _local18; if (_local19 < 0){ _local4 = _local15; while ((((_local4 > 0)) && ((_local17 < _local14[(_local4 - 1)].value)))) { _local5 = _local14[_local4]; _local6 = _local14[(_local4 - 1)]; _local21 = _local6.proxyId; _local22 = m_proxyPool[_local6.proxyId]; _local6.stabbingCount++; if (_local6.IsUpper() == true){ if (TestOverlap(_local12, _local22)){ m_pairManager.AddBufferedPair(_arg1, _local21); }; var _local23 = _local22.upperBounds; var _local24 = _local3; var _local25 = (_local23[_local24] + 1); _local23[_local24] = _local25; _local5.stabbingCount++; } else { _local23 = _local22.lowerBounds; _local24 = _local3; _local25 = (_local23[_local24] + 1); _local23[_local24] = _local25; _local5.stabbingCount--; }; _local23 = _local11.lowerBounds; _local24 = _local3; _local25 = (_local23[_local24] - 1); _local23[_local24] = _local25; _local5.Swap(_local6); _local4--; }; }; if (_local20 > 0){ _local4 = _local16; while ((((_local4 < (_local10 - 1))) && ((_local14[(_local4 + 1)].value <= _local18)))) { _local5 = _local14[_local4]; _local7 = _local14[(_local4 + 1)]; _local8 = _local7.proxyId; _local9 = m_proxyPool[_local8]; _local7.stabbingCount++; if (_local7.IsLower() == true){ if (TestOverlap(_local12, _local9)){ m_pairManager.AddBufferedPair(_arg1, _local8); }; _local23 = _local9.lowerBounds; _local24 = _local3; _local25 = (_local23[_local24] - 1); _local23[_local24] = _local25; _local5.stabbingCount++; } else { _local23 = _local9.upperBounds; _local24 = _local3; _local25 = (_local23[_local24] - 1); _local23[_local24] = _local25; _local5.stabbingCount--; }; _local23 = _local11.upperBounds; _local24 = _local3; _local25 = (_local23[_local24] + 1); _local23[_local24] = _local25; _local5.Swap(_local7); _local4++; }; }; if (_local19 > 0){ _local4 = _local15; while ((((_local4 < (_local10 - 1))) && ((_local14[(_local4 + 1)].value <= _local17)))) { _local5 = _local14[_local4]; _local7 = _local14[(_local4 + 1)]; _local8 = _local7.proxyId; _local9 = m_proxyPool[_local8]; _local7.stabbingCount--; if (_local7.IsUpper()){ if (TestOverlap(_local13, _local9)){ m_pairManager.RemoveBufferedPair(_arg1, _local8); }; _local23 = _local9.upperBounds; _local24 = _local3; _local25 = (_local23[_local24] - 1); _local23[_local24] = _local25; _local5.stabbingCount--; } else { _local23 = _local9.lowerBounds; _local24 = _local3; _local25 = (_local23[_local24] - 1); _local23[_local24] = _local25; _local5.stabbingCount++; }; _local23 = _local11.lowerBounds; _local24 = _local3; _local25 = (_local23[_local24] + 1); _local23[_local24] = _local25; _local5.Swap(_local7); _local4++; }; }; if (_local20 < 0){ _local4 = _local16; while ((((_local4 > 0)) && ((_local18 < _local14[(_local4 - 1)].value)))) { _local5 = _local14[_local4]; _local6 = _local14[(_local4 - 1)]; _local21 = _local6.proxyId; _local22 = m_proxyPool[_local21]; _local6.stabbingCount--; if (_local6.IsLower() == true){ if (TestOverlap(_local13, _local22)){ m_pairManager.RemoveBufferedPair(_arg1, _local21); }; _local23 = _local22.lowerBounds; _local24 = _local3; _local25 = (_local23[_local24] + 1); _local23[_local24] = _local25; _local5.stabbingCount--; } else { _local23 = _local22.upperBounds; _local24 = _local3; _local25 = (_local23[_local24] + 1); _local23[_local24] = _local25; _local5.stabbingCount++; }; _local23 = _local11.upperBounds; _local24 = _local3; _local25 = (_local23[_local24] - 1); _local23[_local24] = _local25; _local5.Swap(_local6); _local4--; }; }; _local3++; }; } public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{ var _local6:int; var _local4:int; var _local5:int = (_arg2 - 1); while (_local4 <= _local5) { _local6 = ((_local4 + _local5) / 2); if (_arg1[_local6].value > _arg3){ _local5 = (_local6 - 1); } else { if (_arg1[_local6].value < _arg3){ _local4 = (_local6 + 1); } else { return (uint(_local6)); }; }; }; return (uint(_local4)); } } }//package Box2D.Collision
Section 14
//b2BufferedPair (Box2D.Collision.b2BufferedPair) package Box2D.Collision { public class b2BufferedPair { public var proxyId1:uint; public var proxyId2:uint; } }//package Box2D.Collision
Section 15
//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; public static const b2_oldPoint:uint = 4; public static const b2_newPoint:uint = 2; private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2(); public static function EdgeSeparation(_arg1:b2PolygonShape, _arg2:b2XForm, _arg3:int, _arg4:b2PolygonShape, _arg5:b2XForm):Number{ var _local6:b2Mat22; var _local7:b2Vec2; var _local20:Number; _local6 = _arg2.R; _local7 = _arg1.m_normals[_arg3]; var _local8:Number = ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)); var _local9:Number = ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)); _local6 = _arg5.R; var _local10:Number = ((_local6.col1.x * _local8) + (_local6.col1.y * _local9)); var _local11:Number = ((_local6.col2.x * _local8) + (_local6.col2.y * _local9)); var _local12:int; var _local13:Number = Number.MAX_VALUE; var _local14:int; while (_local14 < _arg4.m_vertexCount) { _local7 = _arg4.m_vertices[_local14]; _local20 = ((_local7.x * _local10) + (_local7.y * _local11)); if (_local20 < _local13){ _local13 = _local20; _local12 = _local14; }; _local14++; }; _local7 = _arg1.m_vertices[_arg3]; _local6 = _arg2.R; var _local15:Number = (_arg2.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y))); var _local16:Number = (_arg2.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y))); _local7 = _arg4.m_vertices[_local12]; _local6 = _arg5.R; var _local17:Number = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y))); var _local18:Number = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y))); _local17 = (_local17 - _local15); _local18 = (_local18 - _local16); var _local19:Number = ((_local17 * _local8) + (_local18 * _local9)); return (_local19); } public static function b2TestOverlap(_arg1:b2AABB, _arg2:b2AABB):Boolean{ var _local3:b2Vec2 = _arg2.lowerBound; var _local4:b2Vec2 = _arg1.upperBound; var _local5:Number = (_local3.x - _local4.x); var _local6:Number = (_local3.y - _local4.y); _local3 = _arg1.lowerBound; _local4 = _arg2.upperBound; var _local7:Number = (_local3.x - _local4.x); var _local8:Number = (_local3.y - _local4.y); if ((((_local5 > 0)) || ((_local6 > 0)))){ return (false); }; if ((((_local7 > 0)) || ((_local8 > 0)))){ return (false); }; return (true); } public static function FindIncidentEdge(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:int, _arg5:b2PolygonShape, _arg6:b2XForm):void{ var _local7:b2Mat22; var _local8:b2Vec2; var _local15:ClipVertex; var _local18:Number; _local7 = _arg3.R; _local8 = _arg2.m_normals[_arg4]; var _local9:Number = ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)); var _local10:Number = ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)); _local7 = _arg6.R; var _local11:Number = ((_local7.col1.x * _local9) + (_local7.col1.y * _local10)); _local10 = ((_local7.col2.x * _local9) + (_local7.col2.y * _local10)); _local9 = _local11; var _local12:int; var _local13:Number = Number.MAX_VALUE; var _local14:int; while (_local14 < _arg5.m_vertexCount) { _local8 = _arg5.m_normals[_local14]; _local18 = ((_local9 * _local8.x) + (_local10 * _local8.y)); if (_local18 < _local13){ _local13 = _local18; _local12 = _local14; }; _local14++; }; var _local16:int = _local12; var _local17:int = (((_local16 + 1) < _arg5.m_vertexCount)) ? (_local16 + 1) : 0; _local15 = _arg1[0]; _local8 = _arg5.m_vertices[_local16]; _local7 = _arg6.R; _local15.v.x = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y))); _local15.v.y = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y))); _local15.id.features.referenceFace = _arg4; _local15.id.features.incidentEdge = _local16; _local15.id.features.incidentVertex = 0; _local15 = _arg1[1]; _local8 = _arg5.m_vertices[_local17]; _local7 = _arg6.R; _local15.v.x = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y))); _local15.v.y = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y))); _local15.id.features.referenceFace = _arg4; _local15.id.features.incidentEdge = _local17; _local15.id.features.incidentVertex = 1; } public static function b2CollidePolygons(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):void{ var _local12:b2PolygonShape; var _local13:b2PolygonShape; var _local16:int; var _local17:uint; var _local33:int; var _local36:Number; var _local37:b2ManifoldPoint; _arg1.pointCount = 0; var _local6:int; var _local7:Array = [_local6]; var _local8:Number = FindMaxSeparation(_local7, _arg2, _arg3, _arg4, _arg5); _local6 = _local7[0]; if (_local8 > 0){ return; }; var _local9:int; var _local10:Array = [_local9]; var _local11:Number = FindMaxSeparation(_local10, _arg4, _arg5, _arg2, _arg3); _local9 = _local10[0]; if (_local11 > 0){ return; }; var _local14:b2XForm = new b2XForm(); var _local15:b2XForm = new b2XForm(); var _local18:Number = 0.98; var _local19:Number = 0.001; if (_local11 > ((_local18 * _local8) + _local19)){ _local12 = _arg4; _local13 = _arg2; _local14.Set(_arg5); _local15.Set(_arg3); _local16 = _local9; _local17 = 1; } else { _local12 = _arg2; _local13 = _arg4; _local14.Set(_arg3); _local15.Set(_arg5); _local16 = _local6; _local17 = 0; }; var _local20:Array = [new ClipVertex(), new ClipVertex()]; FindIncidentEdge(_local20, _local12, _local14, _local16, _local13, _local15); var _local21:int = _local12.m_vertexCount; var _local22:Array = _local12.m_vertices; var _local23:b2Vec2 = _local22[_local16].Copy(); var _local24:b2Vec2 = (((_local16 + 1) < _local21)) ? _local22[(_local16 + 1)].Copy() : _local22[0].Copy(); var _local25:b2Vec2 = b2Math.SubtractVV(_local24, _local23); var _local26:b2Vec2 = b2Math.b2MulMV(_local14.R, b2Math.SubtractVV(_local24, _local23)); _local26.Normalize(); var _local27:b2Vec2 = b2Math.b2CrossVF(_local26, 1); _local23 = b2Math.b2MulX(_local14, _local23); _local24 = b2Math.b2MulX(_local14, _local24); var _local28:Number = b2Math.b2Dot(_local27, _local23); var _local29:Number = -(b2Math.b2Dot(_local26, _local23)); var _local30:Number = b2Math.b2Dot(_local26, _local24); var _local31:Array = [new ClipVertex(), new ClipVertex()]; var _local32:Array = [new ClipVertex(), new ClipVertex()]; _local33 = ClipSegmentToLine(_local31, _local20, _local26.Negative(), _local29); if (_local33 < 2){ return; }; _local33 = ClipSegmentToLine(_local32, _local31, _local26, _local30); if (_local33 < 2){ return; }; _arg1.normal = (_local17) ? _local27.Negative() : _local27.Copy(); var _local34:int; var _local35:int; while (_local35 < b2Settings.b2_maxManifoldPoints) { _local36 = (b2Math.b2Dot(_local27, _local32[_local35].v) - _local28); if (_local36 <= 0){ _local37 = _arg1.points[_local34]; _local37.separation = _local36; _local37.localPoint1 = b2Math.b2MulXT(_arg3, _local32[_local35].v); _local37.localPoint2 = b2Math.b2MulXT(_arg5, _local32[_local35].v); _local37.id.key = _local32[_local35].id.key; _local37.id.features.flip = _local17; _local34++; }; _local35++; }; _arg1.pointCount = _local34; } public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):Number{ var _local7:b2Vec2; var _local8:b2Mat22; var _local21:int; var _local22:Number; var _local23:int; var _local24:Number; var _local6:int = _arg2.m_vertexCount; _local8 = _arg5.R; _local7 = _arg4.m_centroid; var _local9:Number = (_arg5.position.x + ((_local8.col1.x * _local7.x) + (_local8.col2.x * _local7.y))); var _local10:Number = (_arg5.position.y + ((_local8.col1.y * _local7.x) + (_local8.col2.y * _local7.y))); _local8 = _arg3.R; _local7 = _arg2.m_centroid; _local9 = (_local9 - (_arg3.position.x + ((_local8.col1.x * _local7.x) + (_local8.col2.x * _local7.y)))); _local10 = (_local10 - (_arg3.position.y + ((_local8.col1.y * _local7.x) + (_local8.col2.y * _local7.y)))); var _local11:Number = ((_local9 * _arg3.R.col1.x) + (_local10 * _arg3.R.col1.y)); var _local12:Number = ((_local9 * _arg3.R.col2.x) + (_local10 * _arg3.R.col2.y)); var _local13:int; var _local14:Number = -(Number.MAX_VALUE); var _local15:int; while (_local15 < _local6) { _local24 = ((_arg2.m_normals[_local15].x * _local11) + (_arg2.m_normals[_local15].y * _local12)); if (_local24 > _local14){ _local14 = _local24; _local13 = _local15; }; _local15++; }; var _local16:Number = EdgeSeparation(_arg2, _arg3, _local13, _arg4, _arg5); if (_local16 > 0){ return (_local16); }; var _local17:int = (((_local13 - 1) >= 0)) ? (_local13 - 1) : (_local6 - 1); var _local18:Number = EdgeSeparation(_arg2, _arg3, _local17, _arg4, _arg5); if (_local18 > 0){ return (_local18); }; var _local19:int = (((_local13 + 1) < _local6)) ? (_local13 + 1) : 0; var _local20:Number = EdgeSeparation(_arg2, _arg3, _local19, _arg4, _arg5); if (_local20 > 0){ return (_local20); }; if ((((_local18 > _local16)) && ((_local18 > _local20)))){ _local23 = -1; _local21 = _local17; _local22 = _local18; } else { if (_local20 > _local16){ _local23 = 1; _local21 = _local19; _local22 = _local20; } else { _arg1[0] = _local13; return (_local16); }; }; while (true) { if (_local23 == -1){ _local13 = (((_local21 - 1) >= 0)) ? (_local21 - 1) : (_local6 - 1); } else { _local13 = (((_local21 + 1) < _local6)) ? (_local21 + 1) : 0; }; _local16 = EdgeSeparation(_arg2, _arg3, _local13, _arg4, _arg5); if (_local16 > 0){ return (_local16); }; if (_local16 > _local22){ _local21 = _local13; _local22 = _local16; } else { break; }; }; _arg1[0] = _local21; return (_local22); } public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{ var _local7:b2Vec2; var _local8:Number; var _local10:Number; var _local11:b2Vec2; var _local5:int; var _local6:b2Vec2 = _arg2[0].v; _local7 = _arg2[1].v; _local8 = (b2Math.b2Dot(_arg3, _local6) - _arg4); var _local9:Number = (b2Math.b2Dot(_arg3, _local7) - _arg4); if (_local8 <= 0){ var _temp1 = _local5; _local5 = (_local5 + 1); var _local12 = _temp1; _arg1[_local12] = _arg2[0]; }; if (_local9 <= 0){ var _temp2 = _local5; _local5 = (_local5 + 1); _local12 = _temp2; _arg1[_local12] = _arg2[1]; }; if ((_local8 * _local9) < 0){ _local10 = (_local8 / (_local8 - _local9)); _local11 = _arg1[_local5].v; _local11.x = (_local6.x + (_local10 * (_local7.x - _local6.x))); _local11.y = (_local6.y + (_local10 * (_local7.y - _local6.y))); if (_local8 > 0){ _arg1[_local5].id = _arg2[0].id; } else { _arg1[_local5].id = _arg2[1].id; }; _local5++; }; return (_local5); } public static function b2CollideCircles(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{ var _local6:b2Mat22; var _local7:b2Vec2; var _local16:Number; var _local22:Number; var _local23:Number; _arg1.pointCount = 0; _local6 = _arg3.R; _local7 = _arg2.m_localPosition; var _local8:Number = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y))); var _local9:Number = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y))); _local6 = _arg5.R; _local7 = _arg4.m_localPosition; var _local10:Number = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y))); var _local11:Number = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y))); var _local12:Number = (_local10 - _local8); var _local13:Number = (_local11 - _local9); var _local14:Number = ((_local12 * _local12) + (_local13 * _local13)); var _local15:Number = (_arg2.m_radius + _arg4.m_radius); if (_local14 > (_local15 * _local15)){ return; }; if (_local14 < Number.MIN_VALUE){ _local16 = -(_local15); _arg1.normal.Set(0, 1); } else { _local22 = Math.sqrt(_local14); _local16 = (_local22 - _local15); _local23 = (1 / _local22); _arg1.normal.x = (_local23 * _local12); _arg1.normal.y = (_local23 * _local13); }; _arg1.pointCount = 1; var _local17:b2ManifoldPoint = _arg1.points[0]; _local17.id.key = 0; _local17.separation = _local16; _local8 = (_local8 + (_arg2.m_radius * _arg1.normal.x)); _local9 = (_local9 + (_arg2.m_radius * _arg1.normal.y)); _local10 = (_local10 - (_arg4.m_radius * _arg1.normal.x)); _local11 = (_local11 - (_arg4.m_radius * _arg1.normal.y)); var _local18:Number = (0.5 * (_local8 + _local10)); var _local19:Number = (0.5 * (_local9 + _local11)); var _local20:Number = (_local18 - _arg3.position.x); var _local21:Number = (_local19 - _arg3.position.y); _local17.localPoint1.x = ((_local20 * _arg3.R.col1.x) + (_local21 * _arg3.R.col1.y)); _local17.localPoint1.y = ((_local20 * _arg3.R.col2.x) + (_local21 * _arg3.R.col2.y)); _local20 = (_local18 - _arg5.position.x); _local21 = (_local19 - _arg5.position.y); _local17.localPoint2.x = ((_local20 * _arg5.R.col1.x) + (_local21 * _arg5.R.col1.y)); _local17.localPoint2.y = ((_local20 * _arg5.R.col2.x) + (_local21 * _arg5.R.col2.y)); } public static function b2CollidePolygonAndCircle(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{ var _local6:b2ManifoldPoint; var _local7:Number; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:b2Vec2; var _local12:b2Mat22; var _local17:Number; var _local28:Number; var _local29:Number; var _local30:Number; _arg1.pointCount = 0; _local12 = _arg5.R; _local11 = _arg4.m_localPosition; var _local13:Number = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y))); var _local14:Number = (_arg5.position.y + ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y))); _local7 = (_local13 - _arg3.position.x); _local8 = (_local14 - _arg3.position.y); _local12 = _arg3.R; var _local15:Number = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); var _local16:Number = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); var _local18:int; var _local19:Number = -(Number.MAX_VALUE); var _local20:Number = _arg4.m_radius; var _local21:int; while (_local21 < _arg2.m_vertexCount) { _local7 = (_local15 - _arg2.m_vertices[_local21].x); _local8 = (_local16 - _arg2.m_vertices[_local21].y); _local30 = ((_arg2.m_normals[_local21].x * _local7) + (_arg2.m_normals[_local21].y * _local8)); if (_local30 > _local20){ return; }; if (_local30 > _local19){ _local19 = _local30; _local18 = _local21; }; _local21++; }; if (_local19 < Number.MIN_VALUE){ _arg1.pointCount = 1; _local11 = _arg2.m_normals[_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.referenceFace = b2_nullFeature; _local6.id.features.flip = 0; _local9 = (_local13 - (_local20 * _arg1.normal.x)); _local10 = (_local14 - (_local20 * _arg1.normal.y)); _local7 = (_local9 - _arg3.position.x); _local8 = (_local10 - _arg3.position.y); _local12 = _arg3.R; _local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local7 = (_local9 - _arg5.position.x); _local8 = (_local10 - _arg5.position.y); _local12 = _arg5.R; _local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y)); _local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y)); _local6.separation = (_local19 - _local20); return; }; var _local22:int = _local18; var _local23:int = (((_local22 + 1) < _arg2.m_vertexCount)) ? (_local22 + 1) : 0; var _local24:Number = (_arg2.m_vertices[_local23].x - _arg2.m_vertices[_local22].x); var _local25:Number = (_arg2.m_vertices[_local23].y - _arg2.m_vertices[_local22].y); var _local26:Number = Math.sqrt(((_local24 * _local24) + (_local25 * _local25))); _local24 = (_local24 / _local26); _local25 = (_local25 / _local26); if (_local26 < Number.MIN_VALUE){ _local7 = (_local15 - _arg2.m_vertices[_local22].x); _local8 = (_local16 - _arg2.m_vertices[_local22].y); _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)); _local6 = _arg1.points[0]; _local6.id.features.incidentEdge = b2_nullFeature; _local6.id.features.incidentVertex = _local22; _local6.id.features.referenceFace = b2_nullFeature; _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 = (_local17 - _local20); return; }; _local7 = (_local15 - _arg2.m_vertices[_local22].x); _local8 = (_local16 - _arg2.m_vertices[_local22].y); var _local27:Number = ((_local7 * _local24) + (_local8 * _local25)); _local6 = _arg1.points[0]; _local6.id.features.incidentEdge = b2_nullFeature; _local6.id.features.incidentVertex = b2_nullFeature; _local6.id.features.referenceFace = b2_nullFeature; _local6.id.features.flip = 0; if (_local27 <= 0){ _local28 = _arg2.m_vertices[_local22].x; _local29 = _arg2.m_vertices[_local22].y; _local6.id.features.incidentVertex = _local22; } else { if (_local27 >= _local26){ _local28 = _arg2.m_vertices[_local23].x; _local29 = _arg2.m_vertices[_local23].y; _local6.id.features.incidentVertex = _local23; } else { _local28 = ((_local24 * _local27) + _arg2.m_vertices[_local22].x); _local29 = ((_local25 * _local27) + _arg2.m_vertices[_local22].y); _local6.id.features.incidentEdge = _local22; }; }; _local7 = (_local15 - _local28); _local8 = (_local16 - _local29); _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); } } }//package Box2D.Collision
Section 16
//b2ContactID (Box2D.Collision.b2ContactID) package Box2D.Collision { public class b2ContactID { public var _key:uint; public var features:Features; public function b2ContactID(){ features = new Features(); super(); features._m_id = this; } public function Set(_arg1:b2ContactID):void{ key = _arg1._key; } public function Copy():b2ContactID{ var _local1:b2ContactID = new b2ContactID(); _local1.key = key; return (_local1); } public function set key(_arg1:uint):void{ _key = _arg1; features._referenceFace = (_key & 0xFF); features._incidentEdge = (((_key & 0xFF00) >> 8) & 0xFF); features._incidentVertex = (((_key & 0xFF0000) >> 16) & 0xFF); features._flip = (((_key & 4278190080) >> 24) & 0xFF); } public function get key():uint{ return (_key); } } }//package Box2D.Collision
Section 17
//b2ContactPoint (Box2D.Collision.b2ContactPoint) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; public class b2ContactPoint { public var normalForce:Number; public var separation:Number; public var normal:b2Vec2; public var position:b2Vec2; public var tangentForce:Number; public var shape1:b2Shape; public var shape2:b2Shape; public var id:b2ContactID; public function b2ContactPoint(){ position = new b2Vec2(); normal = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 18
//b2Distance (Box2D.Collision.b2Distance) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; public class b2Distance { private static var s_p2s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var s_p1s:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var s_points:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2()]; private static var gPoint:b2Point = new b2Point(); public static var g_GJK_Iterations:int = 0; public static function InPoints(_arg1:b2Vec2, _arg2:Array, _arg3:int):Boolean{ var _local6:Number; var _local7:Number; var _local8:Number; var _local9:Number; var _local4:Number = (100 * Number.MIN_VALUE); var _local5:int; while (_local5 < _arg3) { _local6 = Math.abs((_arg1.x - _arg2[_local5].x)); _local7 = Math.abs((_arg1.y - _arg2[_local5].y)); _local8 = Math.max(Math.abs(_arg1.x), Math.abs(_arg2[_local5].x)); _local9 = Math.max(Math.abs(_arg1.y), Math.abs(_arg2[_local5].y)); if ((((_local6 < (_local4 * (_local8 + 1)))) && ((_local7 < (_local4 * (_local9 + 1)))))){ return (true); }; _local5++; }; return (false); } public static function DistanceGeneric(_arg1:b2Vec2, _arg2:b2Vec2, _arg3, _arg4:b2XForm, _arg5, _arg6:b2XForm):Number{ var _local14:Number; var _local15:Number; var _local16:b2Vec2; var _local17:b2Vec2; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:int; var _local7:Array = s_p1s; var _local8:Array = s_p2s; var _local9:Array = s_points; var _local10:int; _arg1.SetV(_arg3.GetFirstVertex(_arg4)); _arg2.SetV(_arg5.GetFirstVertex(_arg6)); var _local11:Number = 0; var _local12 = 20; var _local13:int; while (_local13 < _local12) { _local14 = (_arg2.x - _arg1.x); _local15 = (_arg2.y - _arg1.y); _local16 = _arg3.Support(_arg4, _local14, _local15); _local17 = _arg5.Support(_arg6, -(_local14), -(_local15)); _local11 = ((_local14 * _local14) + (_local15 * _local15)); _local18 = (_local17.x - _local16.x); _local19 = (_local17.y - _local16.y); _local20 = ((_local14 * _local18) + (_local15 * _local19)); if ((_local11 - ((_local14 * _local18) + (_local15 * _local19))) <= (0.01 * _local11)){ if (_local10 == 0){ _arg1.SetV(_local16); _arg2.SetV(_local17); }; g_GJK_Iterations = _local13; return (Math.sqrt(_local11)); }; switch (_local10){ case 0: _local7[0].SetV(_local16); _local8[0].SetV(_local17); _local9[0].Set(_local18, _local19); _arg1.SetV(_local7[0]); _arg2.SetV(_local8[0]); _local10++; break; case 1: _local7[1].SetV(_local16); _local8[1].SetV(_local17); _local9[1].x = _local18; _local9[1].y = _local19; _local10 = ProcessTwo(_arg1, _arg2, _local7, _local8, _local9); break; case 2: _local7[2].SetV(_local16); _local8[2].SetV(_local17); _local9[2].x = _local18; _local9[2].y = _local19; _local10 = ProcessThree(_arg1, _arg2, _local7, _local8, _local9); break; }; if (_local10 == 3){ g_GJK_Iterations = _local13; return (0); }; _local21 = -(Number.MAX_VALUE); _local22 = 0; while (_local22 < _local10) { _local21 = b2Math.b2Max(_local21, ((_local9[_local22].x * _local9[_local22].x) + (_local9[_local22].y * _local9[_local22].y))); _local22++; }; if ((((_local10 == 3)) || ((_local11 <= ((100 * Number.MIN_VALUE) * _local21))))){ g_GJK_Iterations = _local13; _local14 = (_arg2.x - _arg1.x); _local15 = (_arg2.y - _arg1.y); _local11 = ((_local14 * _local14) + (_local15 * _local15)); return (Math.sqrt(_local11)); }; _local13++; }; g_GJK_Iterations = _local12; return (Math.sqrt(_local11)); } public static function DistanceCC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2CircleShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{ var _local7:b2Mat22; var _local8:b2Vec2; var _local19:Number; var _local20:Number; _local7 = _arg4.R; _local8 = _arg3.m_localPosition; var _local9:Number = (_arg4.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y))); var _local10:Number = (_arg4.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y))); _local7 = _arg6.R; _local8 = _arg5.m_localPosition; var _local11:Number = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y))); var _local12:Number = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y))); var _local13:Number = (_local11 - _local9); var _local14:Number = (_local12 - _local10); var _local15:Number = ((_local13 * _local13) + (_local14 * _local14)); var _local16:Number = (_arg3.m_radius - b2Settings.b2_toiSlop); var _local17:Number = (_arg5.m_radius - b2Settings.b2_toiSlop); var _local18:Number = (_local16 + _local17); if (_local15 > (_local18 * _local18)){ _local19 = Math.sqrt(((_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 _local26:Number; var _local6:Number = _arg5[0].x; var _local7:Number = _arg5[0].y; var _local8:Number = _arg5[1].x; var _local9:Number = _arg5[1].y; var _local10:Number = _arg5[2].x; var _local11:Number = _arg5[2].y; var _local12:Number = (_local8 - _local6); var _local13:Number = (_local9 - _local7); var _local14:Number = (_local10 - _local6); var _local15:Number = (_local11 - _local7); var _local16:Number = (_local10 - _local8); var _local17:Number = (_local11 - _local9); var _local18:Number = -(((_local6 * _local12) + (_local7 * _local13))); var _local19:Number = ((_local8 * _local12) + (_local9 * _local13)); var _local20:Number = -(((_local6 * _local14) + (_local7 * _local15))); var _local21:Number = ((_local10 * _local14) + (_local11 * _local15)); var _local22:Number = -(((_local8 * _local16) + (_local9 * _local17))); var _local23:Number = ((_local10 * _local16) + (_local11 * _local17)); if ((((_local21 <= 0)) && ((_local23 <= 0)))){ _arg1.SetV(_arg3[2]); _arg2.SetV(_arg4[2]); _arg3[0].SetV(_arg3[2]); _arg4[0].SetV(_arg4[2]); _arg5[0].SetV(_arg5[2]); return (1); }; var _local24:Number = ((_local12 * _local15) - (_local13 * _local14)); var _local25:Number = (_local24 * ((_local6 * _local9) - (_local7 * _local8))); var _local27:Number = (_local24 * ((_local8 * _local11) - (_local9 * _local10))); if ((((((_local27 <= 0)) && ((_local22 >= 0)))) && ((_local23 >= 0)))){ _local26 = (_local22 / (_local22 + _local23)); _arg1.x = (_arg3[1].x + (_local26 * (_arg3[2].x - _arg3[1].x))); _arg1.y = (_arg3[1].y + (_local26 * (_arg3[2].y - _arg3[1].y))); _arg2.x = (_arg4[1].x + (_local26 * (_arg4[2].x - _arg4[1].x))); _arg2.y = (_arg4[1].y + (_local26 * (_arg4[2].y - _arg4[1].y))); _arg3[0].SetV(_arg3[2]); _arg4[0].SetV(_arg4[2]); _arg5[0].SetV(_arg5[2]); return (2); }; var _local28:Number = (_local24 * ((_local10 * _local7) - (_local11 * _local6))); if ((((((_local28 <= 0)) && ((_local20 >= 0)))) && ((_local21 >= 0)))){ _local26 = (_local20 / (_local20 + _local21)); _arg1.x = (_arg3[0].x + (_local26 * (_arg3[2].x - _arg3[0].x))); _arg1.y = (_arg3[0].y + (_local26 * (_arg3[2].y - _arg3[0].y))); _arg2.x = (_arg4[0].x + (_local26 * (_arg4[2].x - _arg4[0].x))); _arg2.y = (_arg4[0].y + (_local26 * (_arg4[2].y - _arg4[0].y))); _arg3[1].SetV(_arg3[2]); _arg4[1].SetV(_arg4[2]); _arg5[1].SetV(_arg5[2]); return (2); }; var _local29:Number = ((_local27 + _local28) + _local25); _local29 = (1 / _local29); var _local30:Number = (_local27 * _local29); var _local31:Number = (_local28 * _local29); var _local32:Number = ((1 - _local30) - _local31); _arg1.x = (((_local30 * _arg3[0].x) + (_local31 * _arg3[1].x)) + (_local32 * _arg3[2].x)); _arg1.y = (((_local30 * _arg3[0].y) + (_local31 * _arg3[1].y)) + (_local32 * _arg3[2].y)); _arg2.x = (((_local30 * _arg4[0].x) + (_local31 * _arg4[1].x)) + (_local32 * _arg4[2].x)); _arg2.y = (((_local30 * _arg4[0].y) + (_local31 * _arg4[1].y)) + (_local32 * _arg4[2].y)); return (3); } public static function DistancePC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2PolygonShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{ var _local7:b2Mat22; var _local8:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local9:b2Point = gPoint; _local8 = _arg5.m_localPosition; _local7 = _arg6.R; _local9.p.x = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y))); _local9.p.y = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y))); var _local10:Number = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _local9, b2Math.b2XForm_identity); var _local11:Number = (_arg5.GetRadius() - b2Settings.b2_toiSlop); if (_local10 > _local11){ _local10 = (_local10 - _local11); _local12 = (_arg2.x - _arg1.x); _local13 = (_arg2.y - _arg1.y); _local14 = Math.sqrt(((_local12 * _local12) + (_local13 * _local13))); _local12 = (_local12 / _local14); _local13 = (_local13 / _local14); _arg2.x = (_arg2.x - (_local11 * _local12)); _arg2.y = (_arg2.y - (_local11 * _local13)); } else { _local10 = 0; _arg2.x = _arg1.x; _arg2.y = _arg1.y; }; return (_local10); } public static function Distance(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Shape, _arg4:b2XForm, _arg5:b2Shape, _arg6:b2XForm):Number{ var _local7:int = _arg3.GetType(); var _local8:int = _arg5.GetType(); 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 _local11:Number; var _local6:Number = -(_arg5[1].x); var _local7:Number = -(_arg5[1].y); var _local8:Number = (_arg5[0].x - _arg5[1].x); var _local9:Number = (_arg5[0].y - _arg5[1].y); var _local10:Number = Math.sqrt(((_local8 * _local8) + (_local9 * _local9))); _local8 = (_local8 / _local10); _local9 = (_local9 / _local10); _local11 = ((_local6 * _local8) + (_local7 * _local9)); if ((((_local11 <= 0)) || ((_local10 < Number.MIN_VALUE)))){ _arg1.SetV(_arg3[1]); _arg2.SetV(_arg4[1]); _arg3[0].SetV(_arg3[1]); _arg4[0].SetV(_arg4[1]); _arg5[0].SetV(_arg5[1]); return (1); }; _local11 = (_local11 / _local10); _arg1.x = (_arg3[1].x + (_local11 * (_arg3[0].x - _arg3[1].x))); _arg1.y = (_arg3[1].y + (_local11 * (_arg3[0].y - _arg3[1].y))); _arg2.x = (_arg4[1].x + (_local11 * (_arg4[0].x - _arg4[1].x))); _arg2.y = (_arg4[1].y + (_local11 * (_arg4[0].y - _arg4[1].y))); return (2); } } }//package Box2D.Collision
Section 19
//b2Manifold (Box2D.Collision.b2Manifold) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2Manifold { public var pointCount:int;// = 0 public var normal:b2Vec2; public var points:Array; public function b2Manifold(){ points = new Array(b2Settings.b2_maxManifoldPoints); var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { points[_local1] = new b2ManifoldPoint(); _local1++; }; normal = new b2Vec2(); } public function Set(_arg1:b2Manifold):void{ pointCount = _arg1.pointCount; var _local2:int; while (_local2 < b2Settings.b2_maxManifoldPoints) { (points[_local2] as b2ManifoldPoint).Set(_arg1.points[_local2]); _local2++; }; normal.SetV(_arg1.normal); } public function Reset():void{ var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { (points[_local1] as b2ManifoldPoint).Reset(); _local1++; }; normal.SetZero(); pointCount = 0; } } }//package Box2D.Collision
Section 20
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint) package Box2D.Collision { import Box2D.Common.Math.*; public class b2ManifoldPoint { public var normalForce:Number; public var tangentForce:Number; public var id:b2ContactID; public var separation:Number; public var localPoint2:b2Vec2; public var localPoint1:b2Vec2; 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; normalForce = _arg1.normalForce; tangentForce = _arg1.tangentForce; id.key = _arg1.id.key; } public function Reset():void{ localPoint1.SetZero(); localPoint2.SetZero(); separation = 0; normalForce = 0; tangentForce = 0; id.key = 0; } } }//package Box2D.Collision
Section 21
//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 22
//b2Pair (Box2D.Collision.b2Pair) package Box2D.Collision { public class b2Pair { public var proxyId1:uint; public var userData;// = null public var proxyId2:uint; public var status:uint; public var next:uint; public static var e_pairFinal:uint = 4; public static var b2_tableMask:int = (b2_tableCapacity - 1); public static var e_pairRemoved:uint = 2; public static var b2_nullPair:uint = 0xFFFF; public static var e_pairBuffered:uint = 1; public static var b2_nullProxy:uint = 0xFFFF; public static var b2_tableCapacity:int = 4096; 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 23
//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 24
//b2PairManager (Box2D.Collision.b2PairManager) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2PairManager { public var m_pairCount:int; public var m_pairBuffer:Array; public var m_hashTable:Array; public var m_callback:b2PairCallback; public var m_pairs:Array; public var m_pairBufferCount:int; public var m_broadPhase:b2BroadPhase; public var m_freePair:uint; public function b2PairManager(){ var _local1:uint; super(); m_hashTable = new Array(b2Pair.b2_tableCapacity); _local1 = 0; while (_local1 < b2Pair.b2_tableCapacity) { m_hashTable[_local1] = b2Pair.b2_nullPair; _local1++; }; m_pairs = new Array(b2Settings.b2_maxPairs); _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairs[_local1] = new b2Pair(); _local1++; }; m_pairBuffer = new Array(b2Settings.b2_maxPairs); _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairBuffer[_local1] = new b2BufferedPair(); _local1++; }; _local1 = 0; while (_local1 < b2Settings.b2_maxPairs) { m_pairs[_local1].proxyId1 = b2Pair.b2_nullProxy; m_pairs[_local1].proxyId2 = b2Pair.b2_nullProxy; m_pairs[_local1].userData = null; m_pairs[_local1].status = 0; m_pairs[_local1].next = (_local1 + 1); _local1++; }; m_pairs[(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:uint = m_hashTable[_arg3]; while (((!((_local4 == b2Pair.b2_nullPair))) && ((Equals(m_pairs[_local4], _arg1, _arg2) == false)))) { _local4 = m_pairs[_local4].next; }; if (_local4 == b2Pair.b2_nullPair){ return (null); }; return (m_pairs[_local4]); } private function Find(_arg1:uint, _arg2:uint):b2Pair{ var _local4:uint; if (_arg1 > _arg2){ _local4 = _arg1; _arg1 = _arg2; _arg2 = _local4; }; var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); return (FindHash(_arg1, _arg2, _local3)); } private function ValidateBuffer():void{ } public function Commit():void{ var _local1:int; var _local4:b2Pair; var _local5:b2Proxy; var _local6:b2Proxy; var _local2:int; var _local3:Array = m_broadPhase.m_proxyPool; _local1 = 0; while (_local1 < m_pairBufferCount) { _local4 = Find(m_pairBuffer[_local1].proxyId1, m_pairBuffer[_local1].proxyId2); _local4.ClearBuffered(); _local5 = _local3[_local4.proxyId1]; _local6 = _local3[_local4.proxyId2]; if (_local4.IsRemoved()){ if (_local4.IsFinal() == true){ m_callback.PairRemoved(_local5.userData, _local6.userData, _local4.userData); }; m_pairBuffer[_local2].proxyId1 = _local4.proxyId1; m_pairBuffer[_local2].proxyId2 = _local4.proxyId2; _local2++; } else { if (_local4.IsFinal() == false){ _local4.userData = m_callback.PairAdded(_local5.userData, _local6.userData); _local4.SetFinal(); }; }; _local1++; }; _local1 = 0; while (_local1 < _local2) { RemovePair(m_pairBuffer[_local1].proxyId1, m_pairBuffer[_local1].proxyId2); _local1++; }; m_pairBufferCount = 0; if (b2BroadPhase.s_validate){ ValidateTable(); }; } public function RemoveBufferedPair(_arg1:int, _arg2:int):void{ var _local3:b2Pair = Find(_arg1, _arg2); if (_local3 == null){ return; }; if (_local3.IsBuffered() == false){ _local3.SetBuffered(); m_pairBuffer[m_pairBufferCount].proxyId1 = _local3.proxyId1; m_pairBuffer[m_pairBufferCount].proxyId2 = _local3.proxyId2; m_pairBufferCount++; }; _local3.SetRemoved(); if (b2BroadPhase.s_validate){ ValidateBuffer(); }; } private function RemovePair(_arg1:uint, _arg2:uint){ var _local6:uint; var _local7:uint; var _local8:b2Pair; var _local9:*; if (_arg1 > _arg2){ _local6 = _arg1; _arg1 = _arg2; _arg2 = _local6; }; var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); var _local4:uint = m_hashTable[_local3]; var _local5:b2Pair; while (_local4 != b2Pair.b2_nullPair) { if (Equals(m_pairs[_local4], _arg1, _arg2)){ _local7 = _local4; if (_local5){ _local5.next = m_pairs[_local4].next; } else { m_hashTable[_local3] = m_pairs[_local4].next; }; _local8 = m_pairs[_local7]; _local9 = _local8.userData; _local8.next = m_freePair; _local8.proxyId1 = b2Pair.b2_nullProxy; _local8.proxyId2 = b2Pair.b2_nullProxy; _local8.userData = null; _local8.status = 0; m_freePair = _local7; m_pairCount--; return (_local9); } else { _local5 = m_pairs[_local4]; _local4 = _local5.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:b2Pair = AddPair(_arg1, _arg2); if (_local3.IsBuffered() == false){ _local3.SetBuffered(); m_pairBuffer[m_pairBufferCount].proxyId1 = _local3.proxyId1; m_pairBuffer[m_pairBufferCount].proxyId2 = _local3.proxyId2; m_pairBufferCount++; }; _local3.ClearRemoved(); if (b2BroadPhase.s_validate){ ValidateBuffer(); }; } private function AddPair(_arg1:uint, _arg2:uint):b2Pair{ var _local6:uint; if (_arg1 > _arg2){ _local6 = _arg1; _arg1 = _arg2; _arg2 = _local6; }; var _local3:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask); var _local4 = FindHash(_arg1, _arg2, _local3); if (_local4 != null){ return (_local4); }; var _local5:uint = m_freePair; _local4 = m_pairs[_local5]; m_freePair = _local4.next; _local4.proxyId1 = _arg1; _local4.proxyId2 = _arg2; _local4.status = 0; _local4.userData = null; _local4.next = m_hashTable[_local3]; m_hashTable[_local3] = _local5; m_pairCount++; return (_local4); } private function ValidateTable():void{ } public static function EqualsPair(_arg1:b2BufferedPair, _arg2:b2BufferedPair):Boolean{ return ((((_arg1.proxyId1 == _arg2.proxyId1)) && ((_arg1.proxyId2 == _arg2.proxyId2)))); } public static function Hash(_arg1:uint, _arg2:uint):uint{ var _local3:uint = (((_arg2 << 16) & 4294901760) | _arg1); _local3 = (~(_local3) + ((_local3 << 15) & 4294934528)); _local3 = (_local3 ^ ((_local3 >> 12) & 1048575)); _local3 = (_local3 + ((_local3 << 2) & 4294967292)); _local3 = (_local3 ^ ((_local3 >> 4) & 268435455)); _local3 = (_local3 * 2057); _local3 = (_local3 ^ ((_local3 >> 16) & 0xFFFF)); return (_local3); } public static function Equals(_arg1:b2Pair, _arg2:uint, _arg3:uint):Boolean{ return ((((_arg1.proxyId1 == _arg2)) && ((_arg1.proxyId2 == _arg3)))); } } }//package Box2D.Collision
Section 25
//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 26
//b2Proxy (Box2D.Collision.b2Proxy) package Box2D.Collision { public class b2Proxy { public var overlapCount:uint; public var userData;// = null public var lowerBounds:Array; public var upperBounds:Array; public var timeStamp:uint; public function b2Proxy(){ lowerBounds = [uint(0), uint(0)]; upperBounds = [uint(0), uint(0)]; super(); } public function GetNext():uint{ return (lowerBounds[0]); } public function IsValid():Boolean{ return (!((overlapCount == b2BroadPhase.b2_invalid))); } public function SetNext(_arg1:uint):void{ lowerBounds[0] = (_arg1 & 0xFFFF); } } }//package Box2D.Collision
Section 27
//b2Segment (Box2D.Collision.b2Segment) package Box2D.Collision { import Box2D.Common.Math.*; import Box2D.Common.*; public class b2Segment { public var p1:b2Vec2; public var p2:b2Vec2; public function b2Segment(){ p1 = new b2Vec2(); p2 = new b2Vec2(); super(); } public function TestSegment(_arg1:Array, _arg2:b2Vec2, _arg3:b2Segment, _arg4:Number):Boolean{ var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local5:b2Vec2 = _arg3.p1; var _local6:Number = (_arg3.p2.x - _local5.x); var _local7:Number = (_arg3.p2.y - _local5.y); var _local8:Number = (p2.x - p1.x); var _local9:Number = (p2.y - p1.y); var _local10:Number = _local9; var _local11:Number = -(_local8); var _local12:Number = (100 * Number.MIN_VALUE); var _local13:Number = -(((_local6 * _local10) + (_local7 * _local11))); if (_local13 > _local12){ _local14 = (_local5.x - p1.x); _local15 = (_local5.y - p1.y); _local16 = ((_local14 * _local10) + (_local15 * _local11)); if ((((0 <= _local16)) && ((_local16 <= (_arg4 * _local13))))){ _local17 = ((-(_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 28
//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 _local23:Number; var _local24:b2XForm; var _local25:b2XForm; var _local26:Number; var _local27:Number; var _local28:Number; var _local29:Number; var _local5:Number = _arg1.GetSweepRadius(); var _local6:Number = _arg3.GetSweepRadius(); var _local7:Number = _arg2.t0; var _local8:Number = (_arg2.c.x - _arg2.c0.x); var _local9:Number = (_arg2.c.y - _arg2.c0.y); var _local10:Number = (_arg4.c.x - _arg4.c0.x); var _local11:Number = (_arg4.c.y - _arg4.c0.y); var _local12:Number = (_arg2.a - _arg2.a0); var _local13:Number = (_arg4.a - _arg4.a0); var _local14:Number = 0; var _local15:b2Vec2 = s_p1; var _local16:b2Vec2 = s_p2; var _local17 = 20; var _local18:int; var _local19:Number = 0; var _local20:Number = 0; var _local21:Number = 0; var _local22:Number = 0; while (true) { _local23 = (((1 - _local14) * _local7) + _local14); _local24 = s_xf1; _local25 = s_xf2; _arg2.GetXForm(_local24, _local23); _arg4.GetXForm(_local25, _local23); _local21 = b2Distance.Distance(_local15, _local16, _arg1, _local24, _arg3, _local25); if (_local18 == 0){ if (_local21 > (2 * b2Settings.b2_toiSlop)){ _local22 = (1.5 * b2Settings.b2_toiSlop); } else { _local22 = Math.max((0.05 * b2Settings.b2_toiSlop), (_local21 - (0.5 * b2Settings.b2_toiSlop))); }; }; if (((((_local21 - _local22) < (0.05 * b2Settings.b2_toiSlop))) || ((_local18 == _local17)))){ break; }; _local19 = (_local16.x - _local15.x); _local20 = (_local16.y - _local15.y); _local26 = Math.sqrt(((_local19 * _local19) + (_local20 * _local20))); _local19 = (_local19 / _local26); _local20 = (_local20 / _local26); _local27 = ((((_local19 * (_local8 - _local10)) + (_local20 * (_local9 - _local11))) + (Math.abs(_local12) * _local5)) + (Math.abs(_local13) * _local6)); if (Math.abs(_local27) < Number.MIN_VALUE){ _local14 = 1; break; }; _local28 = ((_local21 - _local22) / _local27); _local29 = (_local14 + _local28); if ((((_local29 < 0)) || ((1 < _local29)))){ _local14 = 1; break; }; if (_local29 < ((1 + (100 * Number.MIN_VALUE)) * _local14)){ break; }; _local14 = _local29; _local18++; }; return (_local14); } } }//package Box2D.Collision
Section 29
//ClipVertex (Box2D.Collision.ClipVertex) package Box2D.Collision { import Box2D.Common.Math.*; public class ClipVertex { public var id:b2ContactID; public var v:b2Vec2; public function ClipVertex(){ v = new b2Vec2(); id = new b2ContactID(); super(); } } }//package Box2D.Collision
Section 30
//Features (Box2D.Collision.Features) package Box2D.Collision { public class Features { public var _referenceFace:int; public var _incidentEdge:int; public var _flip:int; public var _incidentVertex:int; public var _m_id:b2ContactID; public function get referenceFace():int{ return (_referenceFace); } 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 referenceFace(_arg1:int):void{ _referenceFace = _arg1; _m_id._key = ((_m_id._key & 4294967040) | (_referenceFace & 0xFF)); } public function get incidentVertex():int{ return (_incidentVertex); } public function set flip(_arg1:int):void{ _flip = _arg1; _m_id._key = ((_m_id._key & 0xFFFFFF) | ((_flip << 24) & 4278190080)); } public function set incidentEdge(_arg1:int):void{ _incidentEdge = _arg1; _m_id._key = ((_m_id._key & 4294902015) | ((_incidentEdge << 8) & 0xFF00)); } } }//package Box2D.Collision
Section 31
//b2Mat22 (Box2D.Common.Math.b2Mat22) package Box2D.Common.Math { public class b2Mat22 { public var col1:b2Vec2; public var col2:b2Vec2; public function b2Mat22(_arg1:Number=0, _arg2:b2Vec2=null, _arg3:b2Vec2=null){ var _local4:Number; var _local5:Number; col1 = new b2Vec2(); col2 = new b2Vec2(); super(); if (((!((_arg2 == null))) && (!((_arg3 == null))))){ col1.SetV(_arg2); col2.SetV(_arg3); } else { _local4 = Math.cos(_arg1); _local5 = Math.sin(_arg1); col1.x = _local4; col2.x = -(_local5); col1.y = _local5; col2.y = _local4; }; } public function SetIdentity():void{ col1.x = 1; col2.x = 0; col1.y = 0; col2.y = 1; } public function SetVV(_arg1:b2Vec2, _arg2:b2Vec2):void{ col1.SetV(_arg1); col2.SetV(_arg2); } public function Set(_arg1:Number):void{ var _local2:Number; _local2 = Math.cos(_arg1); var _local3:Number = Math.sin(_arg1); col1.x = _local2; col2.x = -(_local3); col1.y = _local3; col2.y = _local2; } public function SetZero():void{ col1.x = 0; col2.x = 0; col1.y = 0; col2.y = 0; } public function SetM(_arg1:b2Mat22):void{ col1.SetV(_arg1.col1); col2.SetV(_arg1.col2); } public function AddM(_arg1:b2Mat22):void{ col1.x = (col1.x + _arg1.col1.x); col1.y = (col1.y + _arg1.col1.y); col2.x = (col2.x + _arg1.col2.x); col2.y = (col2.y + _arg1.col2.y); } public function Abs():void{ col1.Abs(); col2.Abs(); } public function Copy():b2Mat22{ return (new b2Mat22(0, col1, col2)); } public function Invert(_arg1:b2Mat22):b2Mat22{ var _local2:Number; var _local4:Number; var _local6:Number; _local2 = col1.x; var _local3:Number = col2.x; _local4 = col1.y; var _local5:Number = col2.y; _local6 = ((_local2 * _local5) - (_local3 * _local4)); _local6 = (1 / _local6); _arg1.col1.x = (_local6 * _local5); _arg1.col2.x = (-(_local6) * _local3); _arg1.col1.y = (-(_local6) * _local4); _arg1.col2.y = (_local6 * _local2); return (_arg1); } public function GetAngle():Number{ return (Math.atan2(col1.y, col1.x)); } public function Solve(_arg1:b2Vec2, _arg2:Number, _arg3:Number):b2Vec2{ var _local4:Number = col1.x; var _local5:Number = col2.x; var _local6:Number = col1.y; var _local7:Number = col2.y; var _local8:Number = ((_local4 * _local7) - (_local5 * _local6)); _local8 = (1 / _local8); _arg1.x = (_local8 * ((_local7 * _arg2) - (_local5 * _arg3))); _arg1.y = (_local8 * ((_local4 * _arg3) - (_local6 * _arg2))); return (_arg1); } } }//package Box2D.Common.Math
Section 32
//b2Math (Box2D.Common.Math.b2Math) package Box2D.Common.Math { public class b2Math { public static const b2Mat22_identity:b2Mat22 = new b2Mat22(0, new b2Vec2(1, 0), new b2Vec2(0, 1)); public static const b2XForm_identity:b2XForm = new b2XForm(b2Vec2_zero, b2Mat22_identity); public static const b2Vec2_zero:b2Vec2 = new b2Vec2(0, 0); public static function b2CrossVF(_arg1:b2Vec2, _arg2:Number):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg2 * _arg1.y), (-(_arg2) * _arg1.x)); return (_local3); } public static function AddVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg1.x + _arg2.x), (_arg1.y + _arg2.y)); return (_local3); } public static function b2IsValid(_arg1:Number):Boolean{ return (isFinite(_arg1)); } public static function b2MinV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2(b2Min(_arg1.x, _arg2.x), b2Min(_arg1.y, _arg2.y)); return (_local3); } public static function b2MulX(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; _local3 = b2MulMV(_arg1.R, _arg2); _local3.x = (_local3.x + _arg1.position.x); _local3.y = (_local3.y + _arg1.position.y); return (_local3); } public static function b2DistanceSquared(_arg1:b2Vec2, _arg2:b2Vec2):Number{ var _local3:Number = (_arg1.x - _arg2.x); var _local4:Number = (_arg1.y - _arg2.y); return (((_local3 * _local3) + (_local4 * _local4))); } public static function b2Swap(_arg1:Array, _arg2:Array):void{ var _local3:* = _arg1[0]; _arg1[0] = _arg2[0]; _arg2[0] = _local3; } public static function b2AbsM(_arg1:b2Mat22):b2Mat22{ var _local2:b2Mat22 = new b2Mat22(0, b2AbsV(_arg1.col1), b2AbsV(_arg1.col2)); return (_local2); } public static function SubtractVV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg1.x - _arg2.x), (_arg1.y - _arg2.y)); return (_local3); } public static function b2MulXT(_arg1:b2XForm, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2; var _local4:Number; _local3 = SubtractVV(_arg2, _arg1.position); _local4 = ((_local3.x * _arg1.R.col1.x) + (_local3.y * _arg1.R.col1.y)); _local3.y = ((_local3.x * _arg1.R.col2.x) + (_local3.y * _arg1.R.col2.y)); _local3.x = _local4; return (_local3); } public static function b2Abs(_arg1:Number):Number{ return (((_arg1 > 0)) ? _arg1 : -(_arg1)); } public static function b2Clamp(_arg1:Number, _arg2:Number, _arg3:Number):Number{ return (b2Max(_arg2, b2Min(_arg1, _arg3))); } public static function b2AbsV(_arg1:b2Vec2):b2Vec2{ var _local2:b2Vec2 = new b2Vec2(b2Abs(_arg1.x), b2Abs(_arg1.y)); return (_local2); } public static function MulFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((_arg1 * _arg2.x), (_arg1 * _arg2.y)); return (_local3); } public static function b2CrossVV(_arg1:b2Vec2, _arg2:b2Vec2):Number{ return (((_arg1.x * _arg2.y) - (_arg1.y * _arg2.x))); } public static function b2Dot(_arg1:b2Vec2, _arg2:b2Vec2):Number{ return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y))); } public static function b2CrossFV(_arg1:Number, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2((-(_arg1) * _arg2.y), (_arg1 * _arg2.x)); return (_local3); } public static function AddMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Mat22 = new b2Mat22(0, AddVV(_arg1.col1, _arg2.col1), AddVV(_arg1.col2, _arg2.col2)); return (_local3); } public static function b2Distance(_arg1:b2Vec2, _arg2:b2Vec2):Number{ var _local3:Number = (_arg1.x - _arg2.x); var _local4:Number = (_arg1.y - _arg2.y); return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4)))); } public static function b2MulTMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col1), b2Dot(_arg1.col2, _arg2.col1)); var _local4:b2Vec2 = new b2Vec2(b2Dot(_arg1.col1, _arg2.col2), b2Dot(_arg1.col2, _arg2.col2)); var _local5:b2Mat22 = new b2Mat22(0, _local3, _local4); return (_local5); } public static function b2MaxV(_arg1:b2Vec2, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2(b2Max(_arg1.x, _arg2.x), b2Max(_arg1.y, _arg2.y)); return (_local3); } public static function b2IsPowerOfTwo(_arg1:uint):Boolean{ var _local2:Boolean = (((_arg1 > 0)) && (((_arg1 & (_arg1 - 1)) == 0))); return (_local2); } public static function b2ClampV(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Vec2):b2Vec2{ return (b2MaxV(_arg2, b2MinV(_arg1, _arg3))); } public static function b2RandomRange(_arg1:Number, _arg2:Number):Number{ var _local3:Number = Math.random(); _local3 = (((_arg2 - _arg1) * _local3) + _arg1); return (_local3); } public static function b2MulTMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2(b2Dot(_arg2, _arg1.col1), b2Dot(_arg2, _arg1.col2)); return (_local3); } public static function b2Min(_arg1:Number, _arg2:Number):Number{ return (((_arg1 < _arg2)) ? _arg1 : _arg2); } public static function b2Random():Number{ return (((Math.random() * 2) - 1)); } public static function b2MulMM(_arg1:b2Mat22, _arg2:b2Mat22):b2Mat22{ var _local3:b2Mat22 = new b2Mat22(0, b2MulMV(_arg1, _arg2.col1), b2MulMV(_arg1, _arg2.col2)); return (_local3); } public static function b2NextPowerOfTwo(_arg1:uint):uint{ _arg1 = (_arg1 | ((_arg1 >> 1) & 2147483647)); _arg1 = (_arg1 | ((_arg1 >> 2) & 1073741823)); _arg1 = (_arg1 | ((_arg1 >> 4) & 268435455)); _arg1 = (_arg1 | ((_arg1 >> 8) & 0xFFFFFF)); _arg1 = (_arg1 | ((_arg1 >> 16) & 0xFFFF)); return ((_arg1 + 1)); } public static function b2Max(_arg1:Number, _arg2:Number):Number{ return (((_arg1 > _arg2)) ? _arg1 : _arg2); } public static function b2MulMV(_arg1:b2Mat22, _arg2:b2Vec2):b2Vec2{ var _local3:b2Vec2 = new b2Vec2(((_arg1.col1.x * _arg2.x) + (_arg1.col2.x * _arg2.y)), ((_arg1.col1.y * _arg2.x) + (_arg1.col2.y * _arg2.y))); return (_local3); } } }//package Box2D.Common.Math
Section 33
//b2Sweep (Box2D.Common.Math.b2Sweep) package Box2D.Common.Math { public class b2Sweep { public var localCenter:b2Vec2; public var a:Number; public var c:b2Vec2; public var a0:Number; public var c0:b2Vec2; public var t0:Number; public function b2Sweep(){ localCenter = new b2Vec2(); c0 = new b2Vec2(); c = new b2Vec2(); super(); } public function Advance(_arg1:Number):void{ var _local2:Number; if ((((t0 < _arg1)) && (((1 - t0) > Number.MIN_VALUE)))){ _local2 = ((_arg1 - t0) / (1 - t0)); c0.x = (((1 - _local2) * c0.x) + (_local2 * c.x)); c0.y = (((1 - _local2) * c0.y) + (_local2 * c.y)); a0 = (((1 - _local2) * a0) + (_local2 * a)); t0 = _arg1; }; } public function GetXForm(_arg1:b2XForm, _arg2:Number):void{ var _local4:Number; var _local5:Number; if ((1 - t0) > Number.MIN_VALUE){ _local4 = ((_arg2 - t0) / (1 - t0)); _arg1.position.x = (((1 - _local4) * c0.x) + (_local4 * c.x)); _arg1.position.y = (((1 - _local4) * c0.y) + (_local4 * c.y)); _local5 = (((1 - _local4) * a0) + (_local4 * a)); _arg1.R.Set(_local5); } else { _arg1.position.SetV(c); _arg1.R.Set(a); }; var _local3:b2Mat22 = _arg1.R; _arg1.position.x = (_arg1.position.x - ((_local3.col1.x * localCenter.x) + (_local3.col2.x * localCenter.y))); _arg1.position.y = (_arg1.position.y - ((_local3.col1.y * localCenter.x) + (_local3.col2.y * localCenter.y))); } } }//package Box2D.Common.Math
Section 34
//b2Vec2 (Box2D.Common.Math.b2Vec2) package Box2D.Common.Math { public class b2Vec2 { public var y:Number; public var x:Number; public function b2Vec2(_arg1:Number=0, _arg2:Number=0):void{ x = _arg1; y = _arg2; } public function Add(_arg1:b2Vec2):void{ x = (x + _arg1.x); y = (y + _arg1.y); } public function Set(_arg1:Number=0, _arg2:Number=0):void{ x = _arg1; y = _arg2; } public function Multiply(_arg1:Number):void{ x = (x * _arg1); y = (y * _arg1); } public function Length():Number{ return (Math.sqrt(((x * x) + (y * y)))); } public function LengthSquared():Number{ return (((x * x) + (y * y))); } public function MulM(_arg1:b2Mat22):void{ var _local2:Number = x; x = ((_arg1.col1.x * _local2) + (_arg1.col2.x * y)); y = ((_arg1.col1.y * _local2) + (_arg1.col2.y * y)); } public function SetZero():void{ x = 0; y = 0; } public function MinV(_arg1:b2Vec2):void{ x = ((x < _arg1.x)) ? x : _arg1.x; y = ((y < _arg1.y)) ? y : _arg1.y; } public function Normalize():Number{ var _local1:Number = Math.sqrt(((x * x) + (y * y))); if (_local1 < Number.MIN_VALUE){ return (0); }; var _local2:Number = (1 / _local1); x = (x * _local2); y = (y * _local2); return (_local1); } public function CrossVF(_arg1:Number):void{ var _local2:Number = x; x = (_arg1 * y); y = (-(_arg1) * _local2); } public function MaxV(_arg1:b2Vec2):void{ x = ((x > _arg1.x)) ? x : _arg1.x; y = ((y > _arg1.y)) ? y : _arg1.y; } public function SetV(_arg1:b2Vec2):void{ x = _arg1.x; y = _arg1.y; } public function Negative():b2Vec2{ return (new b2Vec2(-(x), -(y))); } public function CrossFV(_arg1:Number):void{ var _local2:Number = x; x = (-(_arg1) * y); y = (_arg1 * _local2); } public function Abs():void{ x = Math.abs(x); y = Math.abs(y); } public function Subtract(_arg1:b2Vec2):void{ x = (x - _arg1.x); y = (y - _arg1.y); } public function Copy():b2Vec2{ return (new b2Vec2(x, y)); } public function MulTM(_arg1:b2Mat22):void{ var _local2:Number = b2Math.b2Dot(this, _arg1.col1); y = b2Math.b2Dot(this, _arg1.col2); x = _local2; } public function IsValid():Boolean{ return (((b2Math.b2IsValid(x)) && (b2Math.b2IsValid(y)))); } public static function Make(_arg1:Number, _arg2:Number):b2Vec2{ return (new b2Vec2(_arg1, _arg2)); } } }//package Box2D.Common.Math
Section 35
//b2XForm (Box2D.Common.Math.b2XForm) package Box2D.Common.Math { public class b2XForm { public var position:b2Vec2; public var R:b2Mat22; public function b2XForm(_arg1:b2Vec2=null, _arg2:b2Mat22=null):void{ position = new b2Vec2(); R = new b2Mat22(); super(); if (_arg1){ position.SetV(_arg1); R.SetM(_arg2); }; } public function Initialize(_arg1:b2Vec2, _arg2:b2Mat22):void{ position.SetV(_arg1); R.SetM(_arg2); } public function Set(_arg1:b2XForm):void{ position.SetV(_arg1.position); R.SetM(_arg1.R); } public function SetIdentity():void{ position.SetZero(); R.SetIdentity(); } } }//package Box2D.Common.Math
Section 36
//b2Color (Box2D.Common.b2Color) package Box2D.Common { import Box2D.Common.Math.*; public class b2Color { private var _r:uint;// = 0 private var _g:uint;// = 0 private var _b:uint;// = 0 public function b2Color(_arg1:Number, _arg2:Number, _arg3:Number){ _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); _g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1))); _b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1))); } public function Set(_arg1:Number, _arg2:Number, _arg3:Number):void{ _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); _g = uint((0xFF * b2Math.b2Clamp(_arg2, 0, 1))); _b = uint((0xFF * b2Math.b2Clamp(_arg3, 0, 1))); } public function set b(_arg1:Number):void{ _b = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } public function get color():uint{ return (((_r | (_g << 8)) | (_b << 16))); } public function set r(_arg1:Number):void{ _r = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } public function set g(_arg1:Number):void{ _g = uint((0xFF * b2Math.b2Clamp(_arg1, 0, 1))); } } }//package Box2D.Common
Section 37
//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 = 20; 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 38
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.*; import Box2D.Common.*; import Box2D.Collision.*; public class b2CircleContact extends b2Contact { private var m_manifolds:Array; public var m_manifold:b2Manifold; private var m0:b2Manifold; private static var s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){ m_manifolds = [new b2Manifold()]; m0 = new b2Manifold(); super(_arg1, _arg2); m_manifold = m_manifolds[0]; m_manifold.pointCount = 0; m_manifold.points[0].normalForce = 0; m_manifold.points[0].tangentForce = 0; } override public function Evaluate(_arg1:b2ContactListener):void{ var _local4:b2ContactPoint; var _local5:b2Mat22; var _local6:b2Vec2; var _local2:b2Body = m_shape1.m_body; var _local3:b2Body = m_shape2.m_body; m0.Set(m_manifold); b2Collision.b2CollideCircles(m_manifold, (m_shape1 as b2CircleShape), _local2.m_xf, (m_shape2 as b2CircleShape), _local3.m_xf); if (m_manifold.pointCount > 0){ m_manifoldCount = 1; if (m0.pointCount == 0){ m_manifold.points[0].id.features.flip = (m_manifold.points[0].id.features.flip | b2Collision.b2_newPoint); } else { m_manifold.points[0].id.features.flip = (m_manifold.points[0].id.features.flip & ~(b2Collision.b2_newPoint)); }; } else { m_manifoldCount = 0; if ((((m0.pointCount > 0)) && (_arg1))){ _local4 = s_evalCP; _local4.shape1 = m_shape1; _local4.shape2 = m_shape2; _local4.normal.SetV(m0.normal); _local5 = _local2.m_xf.R; _local6 = m0.points[0].localPoint1; _local4.position.x = (_local2.m_xf.position.x + ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y))); _local4.position.y = (_local2.m_xf.position.y + ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y))); _local4.separation = m0.points[0].separation; _local4.normalForce = m0.points[0].normalForce; _local4.tangentForce = m0.points[0].tangentForce; _local4.id.key = m0.points[0].id.key; _arg1.Remove(_local4); }; }; } override public function GetManifolds():Array{ return (m_manifolds); } public static function Destroy(_arg1:b2Contact, _arg2):void{ } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2CircleContact(_arg1, _arg2)); } } }//package Box2D.Dynamics.Contacts
Section 39
//b2Contact (Box2D.Dynamics.Contacts.b2Contact) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.*; import Box2D.Common.*; import Box2D.Collision.*; public class b2Contact { public var m_shape1:b2Shape; public var m_shape2:b2Shape; public var m_prev:b2Contact; public var m_toi:Number; public var m_next:b2Contact; public var m_friction:Number; public var m_manifoldCount:int; public var m_node1:b2ContactEdge; public var m_node2:b2ContactEdge; public var m_restitution:Number; public var m_flags:uint; public static var e_toiFlag:uint = 8; public static var e_nonSolidFlag:uint = 1; public static var e_slowFlag:uint = 2; public static var e_islandFlag:uint = 4; public static var s_registers:Array; public static var s_initialized:Boolean = false; public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){ m_node1 = new b2ContactEdge(); m_node2 = new b2ContactEdge(); super(); m_flags = 0; if (((!(_arg1)) || (!(_arg2)))){ m_shape1 = null; m_shape2 = null; return; }; if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){ m_flags = (m_flags | e_nonSolidFlag); }; m_shape1 = _arg1; m_shape2 = _arg2; m_manifoldCount = 0; m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction)); m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution); m_prev = null; m_next = null; m_node1.contact = null; m_node1.prev = null; m_node1.next = null; m_node1.other = null; m_node2.contact = null; m_node2.prev = null; m_node2.next = null; m_node2.other = null; } public function IsSolid():Boolean{ return (((m_flags & e_nonSolidFlag) == 0)); } public function GetShape1():b2Shape{ return (m_shape1); } public function GetShape2():b2Shape{ return (m_shape2); } public function GetNext():b2Contact{ return (m_next); } public function GetManifoldCount():int{ return (m_manifoldCount); } public function GetManifolds():Array{ return (null); } public function Update(_arg1:b2ContactListener):void{ Evaluate(_arg1); var _local2:b2Body = m_shape1.GetBody(); var _local3:b2Body = m_shape2.GetBody(); if (((((((_local2.IsStatic()) || (_local2.IsBullet()))) || (_local3.IsStatic()))) || (_local3.IsBullet()))){ m_flags = (m_flags & ~(e_slowFlag)); } else { m_flags = (m_flags | e_slowFlag); }; } public function Evaluate(_arg1:b2ContactListener):void{ } public static function InitializeRegisters():void{ var _local2:int; s_registers = new Array(b2Shape.e_shapeTypeCount); var _local1:int; while (_local1 < b2Shape.e_shapeTypeCount) { s_registers[_local1] = new Array(b2Shape.e_shapeTypeCount); _local2 = 0; while (_local2 < b2Shape.e_shapeTypeCount) { s_registers[_local1][_local2] = new b2ContactRegister(); _local2++; }; _local1++; }; AddType(b2CircleContact.Create, b2CircleContact.Destroy, b2Shape.e_circleShape, b2Shape.e_circleShape); AddType(b2PolyAndCircleContact.Create, b2PolyAndCircleContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_circleShape); AddType(b2PolygonContact.Create, b2PolygonContact.Destroy, b2Shape.e_polygonShape, b2Shape.e_polygonShape); } public static function Destroy(_arg1:b2Contact, _arg2):void{ if (_arg1.GetManifoldCount() > 0){ _arg1.GetShape1().GetBody().WakeUp(); _arg1.GetShape2().GetBody().WakeUp(); }; var _local3:int = _arg1.GetShape1().GetType(); var _local4:int = _arg1.GetShape2().GetType(); var _local5:* = s_registers[_local3][_local4].destroyFcn; _local5(_arg1, _arg2); } public static function AddType(_arg1, _arg2, _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 _local7:b2Contact; var _local8:int; var _local9:b2Manifold; if (s_initialized == false){ InitializeRegisters(); s_initialized = true; }; var _local4:int = _arg1.m_type; var _local5:int = _arg2.m_type; var _local6:* = s_registers[_local4][_local5].createFcn; if (_local6){ if (s_registers[_local4][_local5].primary){ return (_local6(_arg1, _arg2, _arg3)); }; _local7 = _local6(_arg2, _arg1, _arg3); _local8 = 0; while (_local8 < _local7.GetManifoldCount()) { _local9 = _local7.GetManifolds()[_local8]; _local7.GetManifolds()[_local8].normal = _local9.normal.Negative(); _local8++; }; return (_local7); //unresolved jump }; return (null); } } }//package Box2D.Dynamics.Contacts
Section 40
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; import Box2D.Collision.*; public class b2ContactConstraint { public var points:Array; public var normal:b2Vec2; public var restitution:Number; public var body1:b2Body; public var manifold:b2Manifold; public var body2:b2Body; public var friction:Number; public var pointCount:int; public function b2ContactConstraint(){ normal = new b2Vec2(); super(); points = new Array(b2Settings.b2_maxManifoldPoints); var _local1:int; while (_local1 < b2Settings.b2_maxManifoldPoints) { points[_local1] = new b2ContactConstraintPoint(); _local1++; }; } } }//package Box2D.Dynamics.Contacts
Section 41
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; public class b2ContactConstraintPoint { public var tangentForce:Number; public var normalForce:Number; public var positionImpulse:Number; public var separation:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var tangentMass:Number; public var normalMass:Number; public var velocityBias:Number; public var equalizedMass:Number; public function b2ContactConstraintPoint(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); } } }//package Box2D.Dynamics.Contacts
Section 42
//b2ContactEdge (Box2D.Dynamics.Contacts.b2ContactEdge) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; public class b2ContactEdge { public var other:b2Body; public var prev:b2ContactEdge; public var contact:b2Contact; public var next:b2ContactEdge; } }//package Box2D.Dynamics.Contacts
Section 43
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister) package Box2D.Dynamics.Contacts { public class b2ContactRegister { public var primary:Boolean; public var createFcn; public var destroyFcn; } }//package Box2D.Dynamics.Contacts
Section 44
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; import Box2D.Collision.*; 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:int; var _local6:b2Vec2; var _local7:b2Mat22; var _local9:b2Contact; 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; _local5 = 0; while (_local5 < _arg3) { m_constraintCount = (m_constraintCount + _arg2[_local5].GetManifoldCount()); _local5++; }; _local5 = 0; while (_local5 < m_constraintCount) { m_constraints[_local5] = new b2ContactConstraint(); _local5++; }; var _local8:int; _local5 = 0; while (_local5 < _arg3) { _local9 = _arg2[_local5]; _local10 = _local9.m_shape1.m_body; _local11 = _local9.m_shape2.m_body; _local12 = _local9.GetManifoldCount(); _local13 = _local9.GetManifolds(); _local14 = _local9.m_friction; _local15 = _local9.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[_local8]; _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.normalForce = _local28.normalForce; _local29.tangentForce = _local28.tangentForce; _local29.separation = _local28.separation; _local29.positionImpulse = 0; _local29.localAnchor1.SetV(_local28.localPoint1); _local29.localAnchor2.SetV(_local28.localPoint2); _local7 = _local10.m_xf.R; _local32 = (_local29.localAnchor1.x - _local10.GetLocalCenter().x); _local33 = (_local29.localAnchor1.y - _local10.GetLocalCenter().y); _local30 = ((_local7.col1.x * _local32) + (_local7.col2.x * _local33)); _local33 = ((_local7.col1.y * _local32) + (_local7.col2.y * _local33)); _local32 = _local30; _local7 = _local11.m_xf.R; _local34 = (_local29.localAnchor2.x - _local11.GetLocalCenter().x); _local35 = (_local29.localAnchor2.y - _local11.GetLocalCenter().y); _local30 = ((_local7.col1.x * _local34) + (_local7.col2.x * _local35)); _local35 = ((_local7.col1.y * _local34) + (_local7.col2.y * _local35)); _local34 = _local30; _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++; }; _local8++; _local22++; }; _local5++; }; } public function InitVelocityConstraints():void{ var _local1:b2Vec2; var _local2:b2Vec2; var _local3:b2Mat22; var _local5:b2ContactConstraint; var _local6:b2Body; var _local7:b2Body; 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:int; var _local19:b2ContactConstraintPoint; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:b2ContactConstraintPoint; var _local4:int; while (_local4 < m_constraintCount) { _local5 = m_constraints[_local4]; _local6 = _local5.body1; _local7 = _local5.body2; _local8 = _local6.m_invMass; _local9 = _local6.m_invI; _local10 = _local7.m_invMass; _local11 = _local7.m_invI; _local12 = _local5.normal.x; _local13 = _local5.normal.y; _local14 = _local13; _local15 = -(_local12); if (b2World.s_enableWarmStarting){ _local18 = _local5.pointCount; _local17 = 0; while (_local17 < _local18) { _local19 = _local5.points[_local17]; _local20 = (m_step.dt * ((_local19.normalForce * _local12) + (_local19.tangentForce * _local14))); _local21 = (m_step.dt * ((_local19.normalForce * _local13) + (_local19.tangentForce * _local15))); _local3 = _local6.m_xf.R; _local1 = _local6.GetLocalCenter(); _local22 = (_local19.localAnchor1.x - _local1.x); _local23 = (_local19.localAnchor1.y - _local1.y); _local16 = ((_local3.col1.x * _local22) + (_local3.col2.x * _local23)); _local23 = ((_local3.col1.y * _local22) + (_local3.col2.y * _local23)); _local22 = _local16; _local3 = _local7.m_xf.R; _local1 = _local7.GetLocalCenter(); _local24 = (_local19.localAnchor2.x - _local1.x); _local25 = (_local19.localAnchor2.y - _local1.y); _local16 = ((_local3.col1.x * _local24) + (_local3.col2.x * _local25)); _local25 = ((_local3.col1.y * _local24) + (_local3.col2.y * _local25)); _local24 = _local16; _local6.m_angularVelocity = (_local6.m_angularVelocity - (_local9 * ((_local22 * _local21) - (_local23 * _local20)))); _local6.m_linearVelocity.x = (_local6.m_linearVelocity.x - (_local8 * _local20)); _local6.m_linearVelocity.y = (_local6.m_linearVelocity.y - (_local8 * _local21)); _local7.m_angularVelocity = (_local7.m_angularVelocity + (_local11 * ((_local24 * _local21) - (_local25 * _local20)))); _local7.m_linearVelocity.x = (_local7.m_linearVelocity.x + (_local10 * _local20)); _local7.m_linearVelocity.y = (_local7.m_linearVelocity.y + (_local10 * _local21)); _local17++; }; } else { _local18 = _local5.pointCount; _local17 = 0; while (_local17 < _local18) { _local26 = _local5.points[_local17]; _local26.normalForce = 0; _local26.tangentForce = 0; _local17++; }; }; _local4++; }; } public function SolvePositionConstraints(_arg1:Number):Boolean{ var _local3:b2Mat22; var _local4:b2Vec2; var _local6:b2ContactConstraint; var _local7:b2Body; var _local8:b2Body; var _local9:b2Vec2; var _local10:Number; var _local11:b2Vec2; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:int; var _local20:int; var _local21:b2ContactConstraintPoint; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:Number; var _local28:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local37:Number; var _local38:Number; var _local2:Number = 0; var _local5:int; while (_local5 < m_constraintCount) { _local6 = m_constraints[_local5]; _local7 = _local6.body1; _local8 = _local6.body2; _local9 = _local7.m_sweep.c; _local10 = _local7.m_sweep.a; _local11 = _local8.m_sweep.c; _local12 = _local8.m_sweep.a; _local13 = (_local7.m_mass * _local7.m_invMass); _local14 = (_local7.m_mass * _local7.m_invI); _local15 = (_local8.m_mass * _local8.m_invMass); _local16 = (_local8.m_mass * _local8.m_invI); _local17 = _local6.normal.x; _local18 = _local6.normal.y; _local19 = _local6.pointCount; _local20 = 0; while (_local20 < _local19) { _local21 = _local6.points[_local20]; _local3 = _local7.m_xf.R; _local4 = _local7.GetLocalCenter(); _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.GetLocalCenter(); _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:b2Mat22; var _local14:b2Vec2; var _local16:b2ContactConstraint; var _local17:b2Body; var _local18:b2Body; var _local19:Number; var _local20:b2Vec2; var _local21:Number; var _local22:b2Vec2; 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:int; var _local33:Number; var _local34:Number; var _local35:Number; var _local36:Number; var _local15:int; while (_local15 < m_constraintCount) { _local16 = m_constraints[_local15]; _local17 = _local16.body1; _local18 = _local16.body2; _local19 = _local17.m_angularVelocity; _local20 = _local17.m_linearVelocity; _local21 = _local18.m_angularVelocity; _local22 = _local18.m_linearVelocity; _local23 = _local17.m_invMass; _local24 = _local17.m_invI; _local25 = _local18.m_invMass; _local26 = _local18.m_invI; _local27 = _local16.normal.x; _local28 = _local16.normal.y; _local29 = _local28; _local30 = -(_local27); _local32 = _local16.pointCount; _local1 = 0; while (_local1 < _local32) { _local2 = _local16.points[_local1]; _local13 = _local17.m_xf.R; _local14 = _local17.GetLocalCenter(); _local3 = (_local2.localAnchor1.x - _local14.x); _local4 = (_local2.localAnchor1.y - _local14.y); _local31 = ((_local13.col1.x * _local3) + (_local13.col2.x * _local4)); _local4 = ((_local13.col1.y * _local3) + (_local13.col2.y * _local4)); _local3 = _local31; _local13 = _local18.m_xf.R; _local14 = _local18.GetLocalCenter(); _local5 = (_local2.localAnchor2.x - _local14.x); _local6 = (_local2.localAnchor2.y - _local14.y); _local31 = ((_local13.col1.x * _local5) + (_local13.col2.x * _local6)); _local6 = ((_local13.col1.y * _local5) + (_local13.col2.y * _local6)); _local5 = _local31; _local7 = (((_local22.x + (-(_local21) * _local6)) - _local20.x) - (-(_local19) * _local4)); _local8 = (((_local22.y + (_local21 * _local5)) - _local20.y) - (_local19 * _local3)); _local33 = ((_local7 * _local27) + (_local8 * _local28)); _local9 = ((-(m_step.inv_dt) * _local2.normalMass) * (_local33 - _local2.velocityBias)); _local34 = b2Math.b2Max((_local2.normalForce + _local9), 0); _local9 = (_local34 - _local2.normalForce); _local11 = ((m_step.dt * _local9) * _local27); _local12 = ((m_step.dt * _local9) * _local28); _local20.x = (_local20.x - (_local23 * _local11)); _local20.y = (_local20.y - (_local23 * _local12)); _local19 = (_local19 - (_local24 * ((_local3 * _local12) - (_local4 * _local11)))); _local22.x = (_local22.x + (_local25 * _local11)); _local22.y = (_local22.y + (_local25 * _local12)); _local21 = (_local21 + (_local26 * ((_local5 * _local12) - (_local6 * _local11)))); _local2.normalForce = _local34; _local7 = (((_local22.x + (-(_local21) * _local6)) - _local20.x) - (-(_local19) * _local4)); _local8 = (((_local22.y + (_local21 * _local5)) - _local20.y) - (_local19 * _local3)); _local35 = ((_local7 * _local29) + (_local8 * _local30)); _local9 = ((m_step.inv_dt * _local2.tangentMass) * -(_local35)); _local36 = (_local16.friction * _local2.normalForce); _local34 = b2Math.b2Clamp((_local2.tangentForce + _local9), -(_local36), _local36); _local9 = (_local34 - _local2.tangentForce); _local11 = ((m_step.dt * _local9) * _local29); _local12 = ((m_step.dt * _local9) * _local30); _local20.x = (_local20.x - (_local23 * _local11)); _local20.y = (_local20.y - (_local23 * _local12)); _local19 = (_local19 - (_local24 * ((_local3 * _local12) - (_local4 * _local11)))); _local22.x = (_local22.x + (_local25 * _local11)); _local22.y = (_local22.y + (_local25 * _local12)); _local21 = (_local21 + (_local26 * ((_local5 * _local12) - (_local6 * _local11)))); _local2.tangentForce = _local34; _local1++; }; _local17.m_angularVelocity = _local19; _local18.m_angularVelocity = _local21; _local15++; }; } public function FinalizeVelocityConstraints():void{ var _local2:b2ContactConstraint; var _local3:b2Manifold; var _local4:int; var _local1:int; while (_local1 < m_constraintCount) { _local2 = m_constraints[_local1]; _local3 = _local2.manifold; _local4 = 0; while (_local4 < _local2.pointCount) { _local3.points[_local4].normalForce = _local2.points[_local4].normalForce; _local3.points[_local4].tangentForce = _local2.points[_local4].tangentForce; _local4++; }; _local1++; }; } } }//package Box2D.Dynamics.Contacts
Section 45
//b2NullContact (Box2D.Dynamics.Contacts.b2NullContact) package Box2D.Dynamics.Contacts { import Box2D.Dynamics.*; public class b2NullContact extends b2Contact { override public function Evaluate(_arg1:b2ContactListener):void{ } override public function GetManifolds():Array{ return (null); } } }//package Box2D.Dynamics.Contacts
Section 46
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.*; import Box2D.Common.*; import Box2D.Collision.*; public class b2PolyAndCircleContact extends b2Contact { private var m_manifolds:Array; public var m_manifold:b2Manifold; private var m0:b2Manifold; private static var s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){ m_manifolds = [new b2Manifold()]; m0 = new b2Manifold(); super(_arg1, _arg2); m_manifold = m_manifolds[0]; b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polygonShape)); b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape)); m_manifold.pointCount = 0; m_manifold.points[0].normalForce = 0; m_manifold.points[0].tangentForce = 0; } override public function Evaluate(_arg1:b2ContactListener):void{ var _local4:b2ContactPoint; var _local5:b2Mat22; var _local6:b2Vec2; var _local2:b2Body = m_shape1.GetBody(); var _local3:b2Body = m_shape2.GetBody(); m0.Set(m_manifold); b2Collision.b2CollidePolygonAndCircle(m_manifold, (m_shape1 as b2PolygonShape), _local2.m_xf, (m_shape2 as b2CircleShape), _local3.m_xf); if (m_manifold.pointCount > 0){ m_manifoldCount = 1; if (m0.pointCount == 0){ m_manifold.points[0].id.features.flip = (m_manifold.points[0].id.features.flip | b2Collision.b2_newPoint); } else { m_manifold.points[0].id.features.flip = (m_manifold.points[0].id.features.flip & ~(b2Collision.b2_newPoint)); }; } else { m_manifoldCount = 0; if ((((m0.pointCount > 0)) && (_arg1))){ _local4 = s_evalCP; _local4.shape1 = m_shape1; _local4.shape2 = m_shape2; _local4.normal.SetV(m0.normal); _local5 = _local2.m_xf.R; _local6 = m0.points[0].localPoint1; _local4.position.x = (_local2.m_xf.position.x + ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y))); _local4.position.y = (_local2.m_xf.position.y + ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y))); _local4.separation = m0.points[0].separation; _local4.normalForce = m0.points[0].normalForce; _local4.tangentForce = m0.points[0].tangentForce; _local4.id = m0.points[0].id; _arg1.Remove(_local4); }; }; } override public function GetManifolds():Array{ return (m_manifolds); } public static function Destroy(_arg1:b2Contact, _arg2):void{ } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2PolyAndCircleContact(_arg1, _arg2)); } } }//package Box2D.Dynamics.Contacts
Section 47
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact) package Box2D.Dynamics.Contacts { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.*; import Box2D.Common.*; import Box2D.Collision.*; public class b2PolygonContact extends b2Contact { private var m_manifolds:Array; private var m0:b2Manifold; public var m_manifold:b2Manifold; private static var s_evalCP:b2ContactPoint = new b2ContactPoint(); public function b2PolygonContact(_arg1:b2Shape, _arg2:b2Shape):void{ m0 = new b2Manifold(); m_manifolds = [new b2Manifold()]; super(_arg1, _arg2); m_manifold = m_manifolds[0]; m_manifold.pointCount = 0; } override public function Evaluate(_arg1:b2ContactListener):void{ var _local4:b2ContactPoint; var _local5:int; var _local7:b2ManifoldPoint; var _local8:Boolean; var _local9:uint; var _local10:int; var _local11:b2ManifoldPoint; var _local12:b2ContactID; var _local13:b2ManifoldPoint; var _local14:b2Mat22; var _local15:b2Vec2; var _local2:b2Body = m_shape1.GetBody(); var _local3:b2Body = m_shape2.GetBody(); m0.Set(m_manifold); b2Collision.b2CollidePolygons(m_manifold, (m_shape1 as b2PolygonShape), _local2.m_xf, (m_shape2 as b2PolygonShape), _local3.m_xf); var _local6:Array = [false, false]; if (m_manifold.pointCount > 0){ _local5 = 0; while (_local5 < m_manifold.pointCount) { _local7 = m_manifold.points[_local5]; _local7.normalForce = 0; _local7.tangentForce = 0; _local8 = false; _local9 = _local7.id.key; _local10 = 0; while (_local10 < m0.pointCount) { if (_local6[_local10] == true){ } else { _local11 = m0.points[_local10]; _local12 = _local11.id; _local12.features.flip = (_local12.features.flip & ~(b2Collision.b2_newPoint)); if (_local12.key == _local9){ _local6[_local10] = true; _local7.normalForce = _local11.normalForce; _local7.tangentForce = _local11.tangentForce; _local8 = true; break; }; }; _local10++; }; if (_local8 == false){ _local7.id.features.flip = (_local7.id.features.flip | b2Collision.b2_newPoint); }; _local5++; }; m_manifoldCount = 1; } else { m_manifoldCount = 0; }; if (((_arg1) && ((m0.pointCount > 0)))){ _local4 = s_evalCP; _local4.shape1 = m_shape1; _local4.shape2 = m_shape2; _local4.normal.SetV(m0.normal); _local5 = 0; while (_local5 < m0.pointCount) { if (_local6[_local5]){ } else { _local13 = m0.points[_local5]; _local14 = _local2.m_xf.R; _local15 = _local13.localPoint1; _local4.position.x = (_local2.m_xf.position.x + ((_local14.col1.x * _local15.x) + (_local14.col2.x * _local15.y))); _local4.position.y = (_local2.m_xf.position.y + ((_local14.col1.y * _local15.x) + (_local14.col2.y * _local15.y))); _local4.separation = _local13.separation; _local4.normalForce = _local13.normalForce; _local4.tangentForce = _local13.tangentForce; _local4.id.key = _local13.id.key; _arg1.Remove(_local4); }; _local5++; }; }; } override public function GetManifolds():Array{ return (m_manifolds); } public static function Destroy(_arg1:b2Contact, _arg2):void{ } public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{ return (new b2PolygonContact(_arg1, _arg2)); } } }//package Box2D.Dynamics.Contacts
Section 48
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2DistanceJoint extends b2Joint { public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_u:b2Vec2; public var m_length:Number; public var m_force:Number; public var m_mass: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_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 GetReactionTorque():Number{ return (0); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = new b2Vec2(); _local1.SetV(m_u); _local1.Multiply(m_force); return (_local1); } override public function SolvePositionConstraints():Boolean{ var _local1:b2Mat22; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local1 = _local2.m_xf.R; var _local4:Number = (m_localAnchor1.x - _local2.GetLocalCenter().x); var _local5:Number = (m_localAnchor1.y - _local2.GetLocalCenter().y); var _local6:Number = ((_local1.col1.x * _local4) + (_local1.col2.x * _local5)); _local5 = ((_local1.col1.y * _local4) + (_local1.col2.y * _local5)); _local4 = _local6; _local1 = _local3.m_xf.R; var _local7:Number = (m_localAnchor2.x - _local3.GetLocalCenter().x); var _local8:Number = (m_localAnchor2.y - _local3.GetLocalCenter().y); _local6 = ((_local1.col1.x * _local7) + (_local1.col2.x * _local8)); _local8 = ((_local1.col1.y * _local7) + (_local1.col2.y * _local8)); _local7 = _local6; var _local9:Number = (((_local3.m_sweep.c.x + _local7) - _local2.m_sweep.c.x) - _local4); var _local10:Number = (((_local3.m_sweep.c.y + _local8) - _local2.m_sweep.c.y) - _local5); var _local11:Number = Math.sqrt(((_local9 * _local9) + (_local10 * _local10))); _local9 = (_local9 / _local11); _local10 = (_local10 / _local11); var _local12:Number = (_local11 - m_length); _local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); var _local13:Number = (-(m_mass) * _local12); m_u.Set(_local9, _local10); var _local14:Number = (_local13 * m_u.x); var _local15:Number = (_local13 * m_u.y); _local2.m_sweep.c.x = (_local2.m_sweep.c.x - (_local2.m_invMass * _local14)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y - (_local2.m_invMass * _local15)); _local2.m_sweep.a = (_local2.m_sweep.a - (_local2.m_invI * ((_local4 * _local15) - (_local5 * _local14)))); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + (_local3.m_invMass * _local14)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + (_local3.m_invMass * _local15)); _local3.m_sweep.a = (_local3.m_sweep.a + (_local3.m_invI * ((_local7 * _local15) - (_local8 * _local14)))); _local2.SynchronizeTransform(); _local3.SynchronizeTransform(); return ((b2Math.b2Abs(_local12) < b2Settings.b2_linearSlop)); } override public function 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 _local13:Number; var _local14:Number; _local4 = m_body1; _local5 = m_body2; _local2 = _local4.m_xf.R; _local6 = (m_localAnchor1.x - _local4.GetLocalCenter().x); _local7 = (m_localAnchor1.y - _local4.GetLocalCenter().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.GetLocalCenter().x); var _local9:Number = (m_localAnchor2.y - _local5.GetLocalCenter().y); _local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9)); _local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9)); _local8 = _local3; m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6); m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7); var _local10:Number = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y))); if (_local10 > b2Settings.b2_linearSlop){ m_u.Multiply((1 / _local10)); } else { m_u.SetZero(); }; var _local11:Number = ((_local6 * m_u.y) - (_local7 * m_u.x)); var _local12:Number = ((_local8 * m_u.y) - (_local9 * m_u.x)); m_mass = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12)); m_mass = (1 / m_mass); if (b2World.s_enableWarmStarting){ _local13 = ((_arg1.dt * m_force) * m_u.x); _local14 = ((_arg1.dt * m_force) * m_u.y); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x - (_local4.m_invMass * _local13)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y - (_local4.m_invMass * _local14)); _local4.m_angularVelocity = (_local4.m_angularVelocity - (_local4.m_invI * ((_local6 * _local14) - (_local7 * _local13)))); _local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + (_local5.m_invMass * _local13)); _local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + (_local5.m_invMass * _local14)); _local5.m_angularVelocity = (_local5.m_angularVelocity + (_local5.m_invI * ((_local8 * _local14) - (_local9 * _local13)))); } else { m_force = 0; }; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Mat22; var _local3:b2Body; _local3 = m_body1; var _local4:b2Body = m_body2; _local2 = _local3.m_xf.R; var _local5:Number = (m_localAnchor1.x - _local3.GetLocalCenter().x); var _local6:Number = (m_localAnchor1.y - _local3.GetLocalCenter().y); var _local7:Number = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6)); _local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6)); _local5 = _local7; _local2 = _local4.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local4.GetLocalCenter().x); var _local9:Number = (m_localAnchor2.y - _local4.GetLocalCenter().y); _local7 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9)); _local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9)); _local8 = _local7; var _local10:Number = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local6)); var _local11:Number = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local5)); var _local12:Number = (_local4.m_linearVelocity.x + (-(_local4.m_angularVelocity) * _local9)); var _local13:Number = (_local4.m_linearVelocity.y + (_local4.m_angularVelocity * _local8)); var _local14:Number = ((m_u.x * (_local12 - _local10)) + (m_u.y * (_local13 - _local11))); var _local15:Number = ((-(_arg1.inv_dt) * m_mass) * _local14); m_force = (m_force + _local15); var _local16:Number = ((_arg1.dt * _local15) * m_u.x); var _local17:Number = ((_arg1.dt * _local15) * m_u.y); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x - (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y - (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity - (_local3.m_invI * ((_local5 * _local17) - (_local6 * _local16)))); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + (_local4.m_invMass * _local16)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + (_local4.m_invMass * _local17)); _local4.m_angularVelocity = (_local4.m_angularVelocity + (_local4.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); } } }//package Box2D.Dynamics.Joints
Section 49
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2DistanceJointDef extends b2JointDef { public var localAnchor1:b2Vec2; public var length:Number; public var localAnchor2:b2Vec2; public function b2DistanceJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_distanceJoint; length = 1; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{ body1 = _arg1; body2 = _arg2; localAnchor1.SetV(body1.GetLocalPoint(_arg3)); localAnchor2.SetV(body2.GetLocalPoint(_arg4)); var _local5:Number = (_arg4.x - _arg3.x); var _local6:Number = (_arg4.y - _arg3.y); length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6))); } } }//package Box2D.Dynamics.Joints
Section 50
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2GearJoint extends b2Joint { public var m_ground2:b2Body; public var m_groundAnchor1:b2Vec2; public var m_groundAnchor2:b2Vec2; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_ratio:Number; public var m_revolute2:b2RevoluteJoint; public var m_force:Number; public var m_mass:Number; public var m_prismatic2:b2PrismaticJoint; public var m_ground1:b2Body; public var m_revolute1:b2RevoluteJoint; public var m_prismatic1:b2PrismaticJoint; public var m_constant:Number; public var m_J:b2Jacobian; public function b2GearJoint(_arg1:b2GearJointDef){ var _local2:Number; var _local3:Number; m_groundAnchor1 = new b2Vec2(); m_groundAnchor2 = new b2Vec2(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_J = new b2Jacobian(); super(_arg1); 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 (_arg1.joint1.m_type == b2Joint.e_revoluteJoint){ m_revolute1 = (_arg1.joint1 as b2RevoluteJoint); m_groundAnchor1.SetV(m_revolute1.m_localAnchor1); m_localAnchor1.SetV(m_revolute1.m_localAnchor2); _local2 = m_revolute1.GetJointAngle(); } else { m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint); m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1); m_localAnchor1.SetV(m_prismatic1.m_localAnchor2); _local2 = m_prismatic1.GetJointTranslation(); }; m_ground2 = _arg1.joint2.m_body1; m_body2 = _arg1.joint2.m_body2; if (_arg1.joint2.m_type == b2Joint.e_revoluteJoint){ m_revolute2 = (_arg1.joint2 as b2RevoluteJoint); m_groundAnchor2.SetV(m_revolute2.m_localAnchor1); m_localAnchor2.SetV(m_revolute2.m_localAnchor2); _local3 = m_revolute2.GetJointAngle(); } else { m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint); m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1); m_localAnchor2.SetV(m_prismatic2.m_localAnchor2); _local3 = m_prismatic2.GetJointTranslation(); }; m_ratio = _arg1.ratio; m_constant = (_local2 + (m_ratio * _local3)); m_force = 0; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _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 _local15:Number; var _local2:b2Body = m_ground1; var _local3:b2Body = m_ground2; _local4 = m_body1; _local5 = m_body2; var _local14:Number = 0; m_J.SetZero(); if (m_revolute1){ m_J.angular1 = -1; _local14 = (_local14 + _local4.m_invI); } else { _local10 = _local2.m_xf.R; _local11 = m_prismatic1.m_localXAxis1; _local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y)); _local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y)); _local10 = _local4.m_xf.R; _local8 = (m_localAnchor1.x - _local4.GetLocalCenter().x); _local9 = (m_localAnchor1.y - _local4.GetLocalCenter().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.GetLocalCenter().x); _local9 = (m_localAnchor2.y - _local5.GetLocalCenter().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 (b2World.s_enableWarmStarting){ _local15 = (_arg1.dt * m_force); _local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * _local15) * m_J.linear1.x)); _local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * _local15) * m_J.linear1.y)); _local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * _local15) * m_J.angular1)); _local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * _local15) * m_J.linear2.x)); _local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * _local15) * m_J.linear2.y)); _local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * _local15) * m_J.angular2)); } else { m_force = 0; }; } override public function GetReactionTorque():Number{ var _local1:b2Mat22 = m_body2.m_xf.R; var _local2:Number = (m_localAnchor1.x - m_body2.GetLocalCenter().x); var _local3:Number = (m_localAnchor1.y - m_body2.GetLocalCenter().y); var _local4:Number = ((_local1.col1.x * _local2) + (_local1.col2.x * _local3)); _local3 = ((_local1.col1.y * _local2) + (_local1.col2.y * _local3)); _local2 = _local4; _local4 = ((m_force * m_J.angular2) - ((_local2 * (m_force * m_J.linear2.y)) - (_local3 * (m_force * m_J.linear2.x)))); return (_local4); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = new b2Vec2((m_force * m_J.linear2.x), (m_force * m_J.linear2.y)); return (_local1); } override public function SolvePositionConstraints():Boolean{ var _local4:Number; var _local5:Number; var _local1:Number = 0; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; if (m_revolute1){ _local4 = m_revolute1.GetJointAngle(); } else { _local4 = m_prismatic1.GetJointTranslation(); }; if (m_revolute2){ _local5 = m_revolute2.GetJointAngle(); } else { _local5 = m_prismatic2.GetJointTranslation(); }; var _local6:Number = (m_constant - (_local4 + (m_ratio * _local5))); var _local7:Number = (-(m_mass) * _local6); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + ((_local2.m_invMass * _local7) * m_J.linear1.x)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + ((_local2.m_invMass * _local7) * m_J.linear1.y)); _local2.m_sweep.a = (_local2.m_sweep.a + ((_local2.m_invI * _local7) * m_J.angular1)); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local3.m_invMass * _local7) * m_J.linear2.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local3.m_invMass * _local7) * m_J.linear2.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local3.m_invI * _local7) * m_J.angular2)); _local2.SynchronizeTransform(); _local3.SynchronizeTransform(); return ((_local1 < b2Settings.b2_linearSlop)); } public function GetRatio():Number{ return (m_ratio); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; var _local4:Number = m_J.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); var _local5:Number = ((-(_arg1.inv_dt) * m_mass) * _local4); m_force = (m_force + _local5); var _local6:Number = (_arg1.dt * _local5); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local2.m_invMass * _local6) * m_J.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local2.m_invMass * _local6) * m_J.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local2.m_invI * _local6) * m_J.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local3.m_invMass * _local6) * m_J.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local3.m_invMass * _local6) * m_J.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _local6) * m_J.angular2)); } } }//package Box2D.Dynamics.Joints
Section 51
//b2GearJointDef (Box2D.Dynamics.Joints.b2GearJointDef) package Box2D.Dynamics.Joints { public class b2GearJointDef extends b2JointDef { public var joint1:b2Joint; public var joint2:b2Joint; public var ratio:Number; public function b2GearJointDef(){ type = b2Joint.e_gearJoint; joint1 = null; joint2 = null; ratio = 1; } } }//package Box2D.Dynamics.Joints
Section 52
//b2Jacobian (Box2D.Dynamics.Joints.b2Jacobian) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2Jacobian { public var linear1:b2Vec2; public var linear2:b2Vec2; public var angular1:Number; public var angular2:Number; public function b2Jacobian(){ linear1 = new b2Vec2(); linear2 = new b2Vec2(); super(); } public function Set(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):void{ linear1.SetV(_arg1); angular1 = _arg2; linear2.SetV(_arg3); angular2 = _arg4; } public function SetZero():void{ linear1.SetZero(); angular1 = 0; linear2.SetZero(); angular2 = 0; } public function Compute(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:Number):Number{ return ((((((linear1.x * _arg1.x) + (linear1.y * _arg1.y)) + (angular1 * _arg2)) + ((linear2.x * _arg3.x) + (linear2.y * _arg3.y))) + (angular2 * _arg4))); } } }//package Box2D.Dynamics.Joints
Section 53
//b2Joint (Box2D.Dynamics.Joints.b2Joint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2Joint { public var m_islandFlag:Boolean; public var m_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_userData; public var m_body1:b2Body; public var m_body2:b2Body; public static const e_unknownJoint:int = 0; public static const e_inactiveLimit:int = 0; public static const e_atUpperLimit:int = 2; public static const e_atLowerLimit:int = 1; public static const e_gearJoint:int = 6; public static const e_revoluteJoint:int = 1; public static const e_equalLimits:int = 3; public static const e_distanceJoint:int = 3; public static const e_pulleyJoint:int = 4; public static const e_prismaticJoint:int = 2; public static const e_mouseJoint:int = 5; public function b2Joint(_arg1:b2JointDef){ m_node1 = new b2JointEdge(); m_node2 = new b2JointEdge(); super(); m_type = _arg1.type; m_prev = null; m_next = null; m_body1 = _arg1.body1; m_body2 = _arg1.body2; m_collideConnected = _arg1.collideConnected; m_islandFlag = false; m_userData = _arg1.userData; } public function GetBody2():b2Body{ return (m_body2); } public function InitPositionConstraints():void{ } public function GetAnchor1():b2Vec2{ return (null); } public function GetAnchor2():b2Vec2{ return (null); } public function GetNext():b2Joint{ return (m_next); } public function GetType():int{ return (m_type); } public function InitVelocityConstraints(_arg1:b2TimeStep):void{ } public function GetReactionTorque():Number{ return (0); } public function GetUserData(){ return (m_userData); } public function GetReactionForce():b2Vec2{ return (null); } public function SolvePositionConstraints():Boolean{ return (false); } public function GetBody1():b2Body{ return (m_body1); } public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ } public static function Destroy(_arg1:b2Joint, _arg2):void{ } public static function Create(_arg1:b2JointDef, _arg2):b2Joint{ var _local3:b2Joint; switch (_arg1.type){ case e_distanceJoint: _local3 = new b2DistanceJoint((_arg1 as b2DistanceJointDef)); break; case e_mouseJoint: _local3 = new b2MouseJoint((_arg1 as b2MouseJointDef)); break; case e_prismaticJoint: _local3 = new b2PrismaticJoint((_arg1 as b2PrismaticJointDef)); break; case e_revoluteJoint: _local3 = new b2RevoluteJoint((_arg1 as b2RevoluteJointDef)); break; case e_pulleyJoint: _local3 = new b2PulleyJoint((_arg1 as b2PulleyJointDef)); break; case e_gearJoint: _local3 = new b2GearJoint((_arg1 as b2GearJointDef)); break; default: break; }; return (_local3); } } }//package Box2D.Dynamics.Joints
Section 54
//b2JointDef (Box2D.Dynamics.Joints.b2JointDef) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; public class b2JointDef { public var body2:b2Body; public var type:int; public var userData; public var collideConnected:Boolean; public var body1:b2Body; public function b2JointDef(){ type = b2Joint.e_unknownJoint; userData = null; body1 = null; body2 = null; collideConnected = false; } } }//package Box2D.Dynamics.Joints
Section 55
//b2JointEdge (Box2D.Dynamics.Joints.b2JointEdge) package Box2D.Dynamics.Joints { import Box2D.Dynamics.*; public class b2JointEdge { public var other:b2Body; public var next:b2JointEdge; public var prev:b2JointEdge; public var joint:b2Joint; } }//package Box2D.Dynamics.Joints
Section 56
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2MouseJoint extends b2Joint { private var K1:b2Mat22; private var K:b2Mat22; public var m_mass:b2Mat22; public var m_beta:Number; public var m_force:b2Vec2; private var K2:b2Mat22; public var m_target:b2Vec2; public var m_gamma:Number; public var m_C:b2Vec2; public var m_localAnchor:b2Vec2; public var m_maxForce:Number; public function b2MouseJoint(_arg1:b2MouseJointDef){ var _local3:Number; K = new b2Mat22(); K1 = new b2Mat22(); K2 = new b2Mat22(); m_localAnchor = new b2Vec2(); m_target = new b2Vec2(); m_force = new b2Vec2(); m_mass = new b2Mat22(); m_C = new b2Vec2(); super(_arg1); m_target.SetV(_arg1.target); var _local2:Number = (m_target.x - m_body2.m_xf.position.x); _local3 = (m_target.y - m_body2.m_xf.position.y); var _local4:b2Mat22 = m_body2.m_xf.R; m_localAnchor.x = ((_local2 * _local4.col1.x) + (_local3 * _local4.col1.y)); m_localAnchor.y = ((_local2 * _local4.col2.x) + (_local3 * _local4.col2.y)); m_maxForce = _arg1.maxForce; m_force.SetZero(); var _local5:Number = m_body2.m_mass; var _local6:Number = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz); var _local7:Number = (((2 * _local5) * _arg1.dampingRatio) * _local6); var _local8:Number = ((_local5 * _local6) * _local6); m_gamma = (1 / (_local7 + (_arg1.timeStep * _local8))); m_beta = ((_arg1.timeStep * _local8) / (_local7 + (_arg1.timeStep * _local8))); } public function SetTarget(_arg1:b2Vec2):void{ if (m_body2.IsSleeping()){ m_body2.WakeUp(); }; m_target = _arg1; } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local7:Number; var _local8:Number; _local2 = m_body2; _local3 = _local2.m_xf.R; _local4 = (m_localAnchor.x - _local2.GetLocalCenter().x); _local5 = (m_localAnchor.y - _local2.GetLocalCenter().y); var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)); _local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)); _local4 = _local6; _local7 = _local2.m_invMass; _local8 = _local2.m_invI; K1.col1.x = _local7; K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = _local7; K2.col1.x = ((_local8 * _local5) * _local5); K2.col2.x = ((-(_local8) * _local4) * _local5); K2.col1.y = ((-(_local8) * _local4) * _local5); K2.col2.y = ((_local8 * _local4) * _local4); K.SetM(K1); K.AddM(K2); K.col1.x = (K.col1.x + m_gamma); K.col2.y = (K.col2.y + m_gamma); K.Invert(m_mass); m_C.x = ((_local2.m_sweep.c.x + _local4) - m_target.x); m_C.y = ((_local2.m_sweep.c.y + _local5) - m_target.y); _local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98); var _local9:Number = (_arg1.dt * m_force.x); var _local10:Number = (_arg1.dt * m_force.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local7 * _local9)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local7 * _local10)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local8 * ((_local4 * _local10) - (_local5 * _local9)))); } override public function GetAnchor1():b2Vec2{ return (m_target); } override public function GetReactionTorque():Number{ return (0); } override public function GetReactionForce():b2Vec2{ return (m_force); } override public function SolvePositionConstraints():Boolean{ return (true); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local3:b2Mat22; var _local4:Number; var _local5:Number; var _local2:b2Body = m_body2; _local3 = _local2.m_xf.R; var _local6:Number = (m_localAnchor.x - _local2.GetLocalCenter().x); var _local7:Number = (m_localAnchor.y - _local2.GetLocalCenter().y); _local4 = ((_local3.col1.x * _local6) + (_local3.col2.x * _local7)); _local7 = ((_local3.col1.y * _local6) + (_local3.col2.y * _local7)); _local6 = _local4; var _local8:Number = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local7)); var _local9:Number = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local6)); _local3 = m_mass; _local4 = ((_local8 + ((m_beta * _arg1.inv_dt) * m_C.x)) + ((m_gamma * _arg1.dt) * m_force.x)); _local5 = ((_local9 + ((m_beta * _arg1.inv_dt) * m_C.y)) + ((m_gamma * _arg1.dt) * m_force.y)); var _local10:Number = (-(_arg1.inv_dt) * ((_local3.col1.x * _local4) + (_local3.col2.x * _local5))); var _local11:Number = (-(_arg1.inv_dt) * ((_local3.col1.y * _local4) + (_local3.col2.y * _local5))); var _local12:Number = m_force.x; var _local13:Number = m_force.y; m_force.x = (m_force.x + _local10); m_force.y = (m_force.y + _local11); var _local14:Number = m_force.Length(); if (_local14 > m_maxForce){ m_force.Multiply((m_maxForce / _local14)); }; _local10 = (m_force.x - _local12); _local11 = (m_force.y - _local13); var _local15:Number = (_arg1.dt * _local10); var _local16:Number = (_arg1.dt * _local11); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local15)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local16)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15)))); } } }//package Box2D.Dynamics.Joints
Section 57
//b2MouseJointDef (Box2D.Dynamics.Joints.b2MouseJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; public class b2MouseJointDef extends b2JointDef { public var timeStep:Number; public var target:b2Vec2; public var maxForce:Number; public var dampingRatio:Number; public var frequencyHz:Number; public function b2MouseJointDef(){ target = new b2Vec2(); super(); type = b2Joint.e_mouseJoint; maxForce = 0; frequencyHz = 5; dampingRatio = 0.7; timeStep = (1 / 60); } } }//package Box2D.Dynamics.Joints
Section 58
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2PrismaticJoint extends b2Joint { public var m_limitForce:Number; public var m_lowerTranslation:Number; public var m_localXAxis1:b2Vec2; public var m_refAngle:Number; public var m_torque:Number; public var m_motorForce:Number; public var m_enableLimit:Boolean; public var m_angularMass:Number; public var m_maxMotorForce:Number; public var m_localYAxis1:b2Vec2; public var m_force:Number; public var m_motorMass:Number; public var m_upperTranslation:Number; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_limitState:int; public var m_linearMass:Number; public var m_motorJacobian:b2Jacobian; public var m_limitPositionImpulse:Number; public var m_motorSpeed:Number; public var m_enableMotor:Boolean; public var m_linearJacobian:b2Jacobian; public function b2PrismaticJoint(_arg1:b2PrismaticJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_localXAxis1 = new b2Vec2(); m_localYAxis1 = new b2Vec2(); m_linearJacobian = new b2Jacobian(); m_motorJacobian = new b2Jacobian(); super(_arg1); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_localXAxis1.SetV(_arg1.localAxis1); m_localYAxis1.x = -(m_localXAxis1.y); m_localYAxis1.y = m_localXAxis1.x; m_refAngle = _arg1.referenceAngle; m_linearJacobian.SetZero(); m_linearMass = 0; m_force = 0; m_angularMass = 0; m_torque = 0; m_motorJacobian.SetZero(); m_motorMass = 0; m_motorForce = 0; m_limitForce = 0; m_limitPositionImpulse = 0; m_lowerTranslation = _arg1.lowerTranslation; m_upperTranslation = _arg1.upperTranslation; m_maxMotorForce = _arg1.maxMotorForce; m_motorSpeed = _arg1.motorSpeed; m_enableLimit = _arg1.enableLimit; m_enableMotor = _arg1.enableMotor; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local8:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; var _local4:Number = _local2.m_invMass; var _local5:Number = _local3.m_invMass; var _local6:Number = _local2.m_invI; var _local7:Number = _local3.m_invI; var _local9:Number = m_linearJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); var _local10:Number = ((-(_arg1.inv_dt) * m_linearMass) * _local9); m_force = (m_force + _local10); var _local11:Number = (_arg1.dt * _local10); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_linearJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_linearJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_linearJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_linearJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_linearJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_linearJacobian.angular2)); var _local12:Number = (_local3.m_angularVelocity - _local2.m_angularVelocity); var _local13:Number = ((-(_arg1.inv_dt) * m_angularMass) * _local12); m_torque = (m_torque + _local13); var _local14:Number = (_arg1.dt * _local13); _local2.m_angularVelocity = (_local2.m_angularVelocity - (_local6 * _local14)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local7 * _local14)); if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){ _local15 = (m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity) - m_motorSpeed); _local16 = ((-(_arg1.inv_dt) * m_motorMass) * _local15); _local17 = m_motorForce; m_motorForce = b2Math.b2Clamp((m_motorForce + _local16), -(m_maxMotorForce), m_maxMotorForce); _local16 = (m_motorForce - _local17); _local11 = (_arg1.dt * _local16); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2)); }; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local18 = m_motorJacobian.Compute(_local2.m_linearVelocity, _local2.m_angularVelocity, _local3.m_linearVelocity, _local3.m_angularVelocity); _local19 = ((-(_arg1.inv_dt) * m_motorMass) * _local18); if (m_limitState == e_equalLimits){ m_limitForce = (m_limitForce + _local19); } else { if (m_limitState == e_atLowerLimit){ _local8 = m_limitForce; m_limitForce = b2Math.b2Max((m_limitForce + _local19), 0); _local19 = (m_limitForce - _local8); } else { if (m_limitState == e_atUpperLimit){ _local8 = m_limitForce; m_limitForce = b2Math.b2Min((m_limitForce + _local19), 0); _local19 = (m_limitForce - _local8); }; }; }; _local11 = (_arg1.dt * _local19); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + ((_local4 * _local11) * m_motorJacobian.linear1.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + ((_local4 * _local11) * m_motorJacobian.linear1.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity + ((_local6 * _local11) * m_motorJacobian.angular1)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_local5 * _local11) * m_motorJacobian.linear2.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_local5 * _local11) * m_motorJacobian.linear2.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local7 * _local11) * m_motorJacobian.angular2)); }; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } public function GetUpperLimit():Number{ return (m_upperTranslation); } public function GetLowerLimit():Number{ return (m_lowerTranslation); } public function EnableMotor(_arg1:Boolean):void{ m_enableMotor = _arg1; } public function GetJointTranslation():Number{ var _local3:b2Mat22; var _local1:b2Body = m_body1; var _local2:b2Body = m_body2; var _local4:b2Vec2 = _local1.GetWorldPoint(m_localAnchor1); var _local5:b2Vec2 = _local2.GetWorldPoint(m_localAnchor2); var _local6:Number = (_local5.x - _local4.x); var _local7:Number = (_local5.y - _local4.y); var _local8:b2Vec2 = _local1.GetWorldVector(m_localXAxis1); var _local9:Number = ((_local8.x * _local6) + (_local8.y * _local7)); return (_local9); } public function GetMotorSpeed():Number{ return (m_motorSpeed); } override public function GetReactionForce():b2Vec2{ var _local1:b2Mat22 = m_body1.m_xf.R; var _local2:Number = (m_limitForce * ((_local1.col1.x * m_localXAxis1.x) + (_local1.col2.x * m_localXAxis1.y))); var _local3:Number = (m_limitForce * ((_local1.col1.y * m_localXAxis1.x) + (_local1.col2.y * m_localXAxis1.y))); var _local4:Number = (m_force * ((_local1.col1.x * m_localYAxis1.x) + (_local1.col2.x * m_localYAxis1.y))); var _local5:Number = (m_force * ((_local1.col1.y * m_localYAxis1.x) + (_local1.col2.y * m_localYAxis1.y))); return (new b2Vec2(((m_limitForce * _local2) + (m_force * _local4)), ((m_limitForce * _local3) + (m_force * _local5)))); } override public function SolvePositionConstraints():Boolean{ var _local1:Number; var _local2:Number; var _local9:b2Mat22; var _local10:Number; var _local29:Number; var _local30:Number; var _local31:Number; var _local32:Number; var _local3:b2Body = m_body1; var _local4:b2Body = m_body2; var _local5:Number = _local3.m_invMass; var _local6:Number = _local4.m_invMass; var _local7:Number = _local3.m_invI; var _local8:Number = _local4.m_invI; _local9 = _local3.m_xf.R; var _local11:Number = (m_localAnchor1.x - _local3.GetLocalCenter().x); var _local12:Number = (m_localAnchor1.y - _local3.GetLocalCenter().y); _local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12)); _local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12)); _local11 = _local10; _local9 = _local4.m_xf.R; var _local13:Number = (m_localAnchor2.x - _local4.GetLocalCenter().x); var _local14:Number = (m_localAnchor2.y - _local4.GetLocalCenter().y); _local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14)); _local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14)); _local13 = _local10; var _local15:Number = (_local3.m_sweep.c.x + _local11); var _local16:Number = (_local3.m_sweep.c.y + _local12); var _local17:Number = (_local4.m_sweep.c.x + _local13); var _local18:Number = (_local4.m_sweep.c.y + _local14); var _local19:Number = (_local17 - _local15); var _local20:Number = (_local18 - _local16); _local9 = _local3.m_xf.R; var _local21:Number = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y)); var _local22:Number = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y)); var _local23:Number = ((_local21 * _local19) + (_local22 * _local20)); _local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); var _local24:Number = (-(m_linearMass) * _local23); _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local24) * m_linearJacobian.linear1.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local24) * m_linearJacobian.linear1.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local24) * m_linearJacobian.angular1)); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local24) * m_linearJacobian.linear2.x)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local24) * m_linearJacobian.linear2.y)); _local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local24) * m_linearJacobian.angular2)); var _local25:Number = b2Math.b2Abs(_local23); var _local26:Number = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_refAngle); _local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); var _local27:Number = (-(m_angularMass) * _local26); _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local27)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local27)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); var _local28:Number = b2Math.b2Abs(_local26); if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local9 = _local3.m_xf.R; _local11 = (m_localAnchor1.x - _local3.GetLocalCenter().x); _local12 = (m_localAnchor1.y - _local3.GetLocalCenter().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.GetLocalCenter().x); _local14 = (m_localAnchor2.y - _local4.GetLocalCenter().y); _local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14)); _local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14)); _local13 = _local10; _local15 = (_local3.m_sweep.c.x + _local11); _local16 = (_local3.m_sweep.c.y + _local12); _local17 = (_local4.m_sweep.c.x + _local13); _local18 = (_local4.m_sweep.c.y + _local14); _local19 = (_local17 - _local15); _local20 = (_local18 - _local16); _local9 = _local3.m_xf.R; _local29 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y)); _local30 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y)); _local31 = ((_local29 * _local19) + (_local30 * _local20)); _local32 = 0; if (m_limitState == e_equalLimits){ _local1 = b2Math.b2Clamp(_local31, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection); _local32 = (-(m_motorMass) * _local1); _local25 = b2Math.b2Max(_local25, b2Math.b2Abs(_local26)); } else { if (m_limitState == e_atLowerLimit){ _local1 = (_local31 - m_lowerTranslation); _local25 = b2Math.b2Max(_local25, -(_local1)); _local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local32 = (-(m_motorMass) * _local1); _local2 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local32), 0); _local32 = (m_limitPositionImpulse - _local2); } else { if (m_limitState == e_atUpperLimit){ _local1 = (_local31 - m_upperTranslation); _local25 = b2Math.b2Max(_local25, _local1); _local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection); _local32 = (-(m_motorMass) * _local1); _local2 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local32), 0); _local32 = (m_limitPositionImpulse - _local2); }; }; }; _local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local32) * m_motorJacobian.linear1.x)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local32) * m_motorJacobian.linear1.y)); _local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local32) * m_motorJacobian.angular1)); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local32) * m_motorJacobian.linear2.x)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local32) * m_motorJacobian.linear2.y)); _local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local32) * m_motorJacobian.angular2)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); }; return ((((_local25 <= b2Settings.b2_linearSlop)) && ((_local28 <= b2Settings.b2_angularSlop)))); } public function SetMotorSpeed(_arg1:Number):void{ m_motorSpeed = _arg1; } public function GetJointSpeed():Number{ var _local3:b2Mat22; var _local1:b2Body = m_body1; var _local2:b2Body = m_body2; _local3 = _local1.m_xf.R; var _local4:Number = (m_localAnchor1.x - _local1.GetLocalCenter().x); var _local5:Number = (m_localAnchor1.y - _local1.GetLocalCenter().y); var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)); _local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)); _local4 = _local6; _local3 = _local2.m_xf.R; var _local7:Number = (m_localAnchor2.x - _local2.GetLocalCenter().x); var _local8:Number = (m_localAnchor2.y - _local2.GetLocalCenter().y); _local6 = ((_local3.col1.x * _local7) + (_local3.col2.x * _local8)); _local8 = ((_local3.col1.y * _local7) + (_local3.col2.y * _local8)); _local7 = _local6; var _local9:Number = (_local1.m_sweep.c.x + _local4); var _local10:Number = (_local1.m_sweep.c.y + _local5); var _local11:Number = (_local2.m_sweep.c.x + _local7); var _local12:Number = (_local2.m_sweep.c.y + _local8); var _local13:Number = (_local11 - _local9); var _local14:Number = (_local12 - _local10); var _local15:b2Vec2 = _local1.GetWorldVector(m_localXAxis1); var _local16:b2Vec2 = _local1.m_linearVelocity; var _local17:b2Vec2 = _local2.m_linearVelocity; var _local18:Number = _local1.m_angularVelocity; var _local19:Number = _local2.m_angularVelocity; var _local20:Number = (((_local13 * (-(_local18) * _local15.y)) + (_local14 * (_local18 * _local15.x))) + ((_local15.x * (((_local17.x + (-(_local19) * _local8)) - _local16.x) - (-(_local18) * _local5))) + (_local15.y * (((_local17.y + (_local19 * _local7)) - _local16.y) - (_local18 * _local4))))); return (_local20); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local5:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local27:Number; var _local28:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local6:Number = (m_localAnchor1.x - _local2.GetLocalCenter().x); var _local7:Number = (m_localAnchor1.y - _local2.GetLocalCenter().y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.GetLocalCenter().x); var _local9:Number = (m_localAnchor2.y - _local3.GetLocalCenter().y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; var _local10:Number = _local2.m_invMass; var _local11:Number = _local3.m_invMass; var _local12:Number = _local2.m_invI; var _local13:Number = _local3.m_invI; _local4 = _local2.m_xf.R; var _local14:Number = ((_local4.col1.x * m_localYAxis1.x) + (_local4.col2.x * m_localYAxis1.y)); var _local15:Number = ((_local4.col1.y * m_localYAxis1.x) + (_local4.col2.y * m_localYAxis1.y)); var _local16:Number = ((_local3.m_sweep.c.x + _local8) - _local2.m_sweep.c.x); var _local17:Number = ((_local3.m_sweep.c.y + _local9) - _local2.m_sweep.c.y); m_linearJacobian.linear1.x = -(_local14); m_linearJacobian.linear1.y = -(_local15); m_linearJacobian.linear2.x = _local14; m_linearJacobian.linear2.y = _local15; m_linearJacobian.angular1 = -(((_local16 * _local15) - (_local17 * _local14))); m_linearJacobian.angular2 = ((_local8 * _local15) - (_local9 * _local14)); m_linearMass = (((_local10 + ((_local12 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local11) + ((_local13 * m_linearJacobian.angular2) * m_linearJacobian.angular2)); m_linearMass = (1 / m_linearMass); m_angularMass = (_local12 + _local13); if (m_angularMass > Number.MIN_VALUE){ m_angularMass = (1 / m_angularMass); }; if (((m_enableLimit) || (m_enableMotor))){ _local4 = _local2.m_xf.R; _local18 = ((_local4.col1.x * m_localXAxis1.x) + (_local4.col2.x * m_localXAxis1.y)); _local19 = ((_local4.col1.y * m_localXAxis1.x) + (_local4.col2.y * m_localXAxis1.y)); m_motorJacobian.linear1.x = -(_local18); m_motorJacobian.linear1.y = -(_local19); m_motorJacobian.linear2.x = _local18; m_motorJacobian.linear2.y = _local19; m_motorJacobian.angular1 = -(((_local16 * _local19) - (_local17 * _local18))); m_motorJacobian.angular2 = ((_local8 * _local19) - (_local9 * _local18)); m_motorMass = (((_local10 + ((_local12 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local11) + ((_local13 * m_motorJacobian.angular2) * m_motorJacobian.angular2)); m_motorMass = (1 / m_motorMass); if (m_enableLimit){ _local20 = (_local16 - _local6); _local21 = (_local17 - _local7); _local22 = ((_local18 * _local20) + (_local19 * _local21)); if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){ m_limitState = e_equalLimits; } else { if (_local22 <= m_lowerTranslation){ if (m_limitState != e_atLowerLimit){ m_limitForce = 0; }; m_limitState = e_atLowerLimit; } else { if (_local22 >= m_upperTranslation){ if (m_limitState != e_atUpperLimit){ m_limitForce = 0; }; m_limitState = e_atUpperLimit; } else { m_limitState = e_inactiveLimit; m_limitForce = 0; }; }; }; }; }; if (m_enableMotor == false){ m_motorForce = 0; }; if (m_enableLimit == false){ m_limitForce = 0; }; if (b2World.s_enableWarmStarting){ _local23 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.x))); _local24 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.y))); _local25 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.x))); _local26 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.y))); _local27 = (_arg1.dt * (((m_force * m_linearJacobian.angular1) - m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular1))); _local28 = (_arg1.dt * (((m_force * m_linearJacobian.angular2) + m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular2))); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local10 * _local23)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local10 * _local24)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local12 * _local27)); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local11 * _local25)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local11 * _local26)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local13 * _local28)); } else { m_force = 0; m_torque = 0; m_limitForce = 0; m_motorForce = 0; }; m_limitPositionImpulse = 0; } public function GetMotorForce():Number{ return (m_motorForce); } public function EnableLimit(_arg1:Boolean):void{ m_enableLimit = _arg1; } public function SetMaxMotorForce(_arg1:Number):void{ m_maxMotorForce = _arg1; } override public function GetReactionTorque():Number{ return (m_torque); } public function IsLimitEnabled():Boolean{ return (m_enableLimit); } public function IsMotorEnabled():Boolean{ return (m_enableMotor); } public function SetLimits(_arg1:Number, _arg2:Number):void{ m_lowerTranslation = _arg1; m_upperTranslation = _arg2; } } }//package Box2D.Dynamics.Joints
Section 59
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2PrismaticJointDef extends b2JointDef { public var motorSpeed:Number; public var localAxis1:b2Vec2; public var referenceAngle:Number; public var upperTranslation:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var enableLimit:Boolean; public var enableMotor:Boolean; public var maxMotorForce:Number; public var lowerTranslation:Number; public function b2PrismaticJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); localAxis1 = new b2Vec2(); super(); type = b2Joint.e_prismaticJoint; localAxis1.Set(1, 0); referenceAngle = 0; enableLimit = false; lowerTranslation = 0; upperTranslation = 0; enableMotor = false; maxMotorForce = 0; motorSpeed = 0; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{ body1 = _arg1; body2 = _arg2; localAnchor1 = body1.GetLocalPoint(_arg3); localAnchor2 = body2.GetLocalPoint(_arg3); localAxis1 = body1.GetLocalVector(_arg4); referenceAngle = (body2.GetAngle() - body1.GetAngle()); } } }//package Box2D.Dynamics.Joints
Section 60
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2PulleyJoint extends b2Joint { public var m_limitState1:int; public var m_limitState2:int; public var m_ground:b2Body; public var m_maxLength2:Number; public var m_maxLength1:Number; public var m_limitPositionImpulse1:Number; public var m_limitPositionImpulse2:Number; public var m_force:Number; public var m_constant:Number; public var m_positionImpulse:Number; public var m_state:int; public var m_ratio:Number; public var m_groundAnchor1:b2Vec2; public var m_groundAnchor2:b2Vec2; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; public var m_limitMass1:Number; public var m_limitMass2:Number; public var m_pulleyMass:Number; public var m_u1:b2Vec2; public var m_limitForce1:Number; public var m_limitForce2:Number; public var m_u2:b2Vec2; public static const b2_minPulleyLength:Number = 2; public function b2PulleyJoint(_arg1:b2PulleyJointDef){ var _local2:b2Mat22; var _local3:Number; var _local4:Number; m_groundAnchor1 = new b2Vec2(); m_groundAnchor2 = new b2Vec2(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_u1 = new b2Vec2(); m_u2 = new b2Vec2(); super(_arg1); m_ground = m_body1.m_world.m_groundBody; m_groundAnchor1.x = (_arg1.groundAnchor1.x - m_ground.m_xf.position.x); m_groundAnchor1.y = (_arg1.groundAnchor1.y - m_ground.m_xf.position.y); m_groundAnchor2.x = (_arg1.groundAnchor2.x - m_ground.m_xf.position.x); m_groundAnchor2.y = (_arg1.groundAnchor2.y - m_ground.m_xf.position.y); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_ratio = _arg1.ratio; m_constant = (_arg1.length1 + (m_ratio * _arg1.length2)); m_maxLength1 = b2Math.b2Min(_arg1.maxLength1, (m_constant - (m_ratio * b2_minPulleyLength))); m_maxLength2 = b2Math.b2Min(_arg1.maxLength2, ((m_constant - b2_minPulleyLength) / m_ratio)); m_force = 0; m_limitForce1 = 0; m_limitForce2 = 0; } public function GetGroundAnchor2():b2Vec2{ var _local1:b2Vec2 = m_ground.m_xf.position.Copy(); _local1.Add(m_groundAnchor2); return (_local1); } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } override public function GetReactionForce():b2Vec2{ var _local1:b2Vec2 = m_u2.Copy(); _local1.Multiply(m_force); return (_local1); } override public function SolvePositionConstraints():Boolean{ var _local3:b2Mat22; var _local8:Number; var _local9:Number; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local22:Number; var _local1:b2Body = m_body1; var _local2:b2Body = m_body2; var _local4:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x); var _local5:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y); var _local6:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x); var _local7:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y); var _local23:Number = 0; if (m_state == e_atUpperLimit){ _local3 = _local1.m_xf.R; _local8 = (m_localAnchor1.x - _local1.GetLocalCenter().x); _local9 = (m_localAnchor1.y - _local1.GetLocalCenter().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.GetLocalCenter().x); _local11 = (m_localAnchor2.y - _local2.GetLocalCenter().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.GetLocalCenter().x); _local9 = (m_localAnchor1.y - _local1.GetLocalCenter().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.GetLocalCenter().x); _local11 = (m_localAnchor2.y - _local2.GetLocalCenter().y); _local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11)); _local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11)); _local10 = _local22; _local14 = (_local2.m_sweep.c.x + _local10); _local15 = (_local2.m_sweep.c.y + _local11); m_u2.Set((_local14 - _local6), (_local15 - _local7)); _local17 = m_u2.Length(); if (_local17 > b2Settings.b2_linearSlop){ m_u2.x = (m_u2.x * (1 / _local17)); m_u2.y = (m_u2.y * (1 / _local17)); } else { m_u2.SetZero(); }; _local18 = (m_maxLength2 - _local17); _local23 = b2Math.b2Max(_local23, -(_local18)); _local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0); _local19 = (-(m_limitMass2) * _local18); _local21 = m_limitPositionImpulse2; m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19)); _local19 = (m_limitPositionImpulse2 - _local21); _local14 = (-(_local19) * m_u2.x); _local15 = (-(_local19) * m_u2.y); _local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14)); _local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15)); _local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14)))); _local2.SynchronizeTransform(); }; return ((_local23 < b2Settings.b2_linearSlop)); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local23:Number; var _local24:Number; var _local25:Number; var _local26:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local5:Number = (m_localAnchor1.x - _local2.GetLocalCenter().x); var _local6:Number = (m_localAnchor1.y - _local2.GetLocalCenter().y); var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6)); _local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6)); _local5 = _local7; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.GetLocalCenter().x); var _local9:Number = (m_localAnchor2.y - _local3.GetLocalCenter().y); _local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local7; var _local10:Number = (_local2.m_sweep.c.x + _local5); var _local11:Number = (_local2.m_sweep.c.y + _local6); var _local12:Number = (_local3.m_sweep.c.x + _local8); var _local13:Number = (_local3.m_sweep.c.y + _local9); var _local14:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x); var _local15:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y); var _local16:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x); var _local17:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y); m_u1.Set((_local10 - _local14), (_local11 - _local15)); m_u2.Set((_local12 - _local16), (_local13 - _local17)); var _local18:Number = m_u1.Length(); var _local19:Number = m_u2.Length(); if (_local18 > b2Settings.b2_linearSlop){ m_u1.Multiply((1 / _local18)); } else { m_u1.SetZero(); }; if (_local19 > b2Settings.b2_linearSlop){ m_u2.Multiply((1 / _local19)); } else { m_u2.SetZero(); }; var _local20:Number = ((m_constant - _local18) - (m_ratio * _local19)); if (_local20 > 0){ m_state = e_inactiveLimit; m_force = 0; } else { m_state = e_atUpperLimit; m_positionImpulse = 0; }; if (_local18 < m_maxLength1){ m_limitState1 = e_inactiveLimit; m_limitForce1 = 0; } else { m_limitState1 = e_atUpperLimit; m_limitPositionImpulse1 = 0; }; if (_local19 < m_maxLength2){ m_limitState2 = e_inactiveLimit; m_limitForce2 = 0; } else { m_limitState2 = e_atUpperLimit; m_limitPositionImpulse2 = 0; }; var _local21:Number = ((_local5 * m_u1.y) - (_local6 * m_u1.x)); var _local22:Number = ((_local8 * m_u2.y) - (_local9 * m_u2.x)); m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21)); m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22)); m_pulleyMass = (m_limitMass1 + ((m_ratio * m_ratio) * m_limitMass2)); m_limitMass1 = (1 / m_limitMass1); m_limitMass2 = (1 / m_limitMass2); m_pulleyMass = (1 / m_pulleyMass); if (b2World.s_enableWarmStarting){ _local23 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.x); _local24 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.y); _local25 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.x); _local26 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local23)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local24)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local24) - (_local6 * _local23)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local25)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local26)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local26) - (_local9 * _local25)))); } else { m_force = 0; m_limitForce1 = 0; m_limitForce2 = 0; }; } override public function GetReactionTorque():Number{ return (0); } public function GetRatio():Number{ return (m_ratio); } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local10:Number; var _local11:Number; var _local12:Number; var _local13:Number; var _local14:Number; var _local15:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local5:Number = (m_localAnchor1.x - _local2.GetLocalCenter().x); var _local6:Number = (m_localAnchor1.y - _local2.GetLocalCenter().y); var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6)); _local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6)); _local5 = _local7; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.GetLocalCenter().x); var _local9:Number = (m_localAnchor2.y - _local3.GetLocalCenter().y); _local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local7; if (m_state == e_atUpperLimit){ _local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6)); _local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5)); _local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)); _local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)); _local18 = (-(((m_u1.x * _local10) + (m_u1.y * _local11))) - (m_ratio * ((m_u2.x * _local12) + (m_u2.y * _local13)))); _local19 = ((-(_arg1.inv_dt) * m_pulleyMass) * _local18); _local20 = m_force; m_force = b2Math.b2Max(0, (m_force + _local19)); _local19 = (m_force - _local20); _local14 = ((-(_arg1.dt) * _local19) * m_u1.x); _local15 = ((-(_arg1.dt) * _local19) * m_u1.y); _local16 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.x); _local17 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); }; if (m_limitState1 == e_atUpperLimit){ _local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6)); _local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5)); _local18 = -(((m_u1.x * _local10) + (m_u1.y * _local11))); _local19 = ((-(_arg1.inv_dt) * m_limitMass1) * _local18); _local20 = m_limitForce1; m_limitForce1 = b2Math.b2Max(0, (m_limitForce1 + _local19)); _local19 = (m_limitForce1 - _local20); _local14 = ((-(_arg1.dt) * _local19) * m_u1.x); _local15 = ((-(_arg1.dt) * _local19) * m_u1.y); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15)); _local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14)))); }; if (m_limitState2 == e_atUpperLimit){ _local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)); _local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)); _local18 = -(((m_u2.x * _local12) + (m_u2.y * _local13))); _local19 = ((-(_arg1.inv_dt) * m_limitMass2) * _local18); _local20 = m_limitForce2; m_limitForce2 = b2Math.b2Max(0, (m_limitForce2 + _local19)); _local19 = (m_limitForce2 - _local20); _local16 = ((-(_arg1.dt) * _local19) * m_u2.x); _local17 = ((-(_arg1.dt) * _local19) * m_u2.y); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16)))); }; } public function GetLength1():Number{ var _local1:b2Vec2 = m_body1.GetWorldPoint(m_localAnchor1); var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x); var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y); var _local4:Number = (_local1.x - _local2); var _local5:Number = (_local1.y - _local3); return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5)))); } public function GetLength2():Number{ var _local1:b2Vec2 = m_body2.GetWorldPoint(m_localAnchor2); var _local2:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x); var _local3:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y); var _local4:Number = (_local1.x - _local2); var _local5:Number = (_local1.y - _local3); return (Math.sqrt(((_local4 * _local4) + (_local5 * _local5)))); } public function GetGroundAnchor1():b2Vec2{ var _local1:b2Vec2 = m_ground.m_xf.position.Copy(); _local1.Add(m_groundAnchor1); return (_local1); } } }//package Box2D.Dynamics.Joints
Section 61
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2PulleyJointDef extends b2JointDef { public var maxLength1:Number; public var maxLength2:Number; public var length1:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var groundAnchor1:b2Vec2; public var groundAnchor2:b2Vec2; public var ratio:Number; public var length2:Number; public function b2PulleyJointDef(){ groundAnchor1 = new b2Vec2(); groundAnchor2 = new b2Vec2(); localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_pulleyJoint; groundAnchor1.Set(-1, 1); groundAnchor2.Set(1, 1); localAnchor1.Set(-1, 0); localAnchor2.Set(1, 0); length1 = 0; maxLength1 = 0; length2 = 0; maxLength2 = 0; ratio = 1; collideConnected = true; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2, _arg5:b2Vec2, _arg6:b2Vec2, _arg7:Number):void{ body1 = _arg1; body2 = _arg2; groundAnchor1.SetV(_arg3); groundAnchor2.SetV(_arg4); localAnchor1 = body1.GetLocalPoint(_arg5); localAnchor2 = body2.GetLocalPoint(_arg6); var _local8:Number = (_arg5.x - _arg3.x); var _local9:Number = (_arg5.y - _arg3.y); length1 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9))); var _local10:Number = (_arg6.x - _arg4.x); var _local11:Number = (_arg6.y - _arg4.y); length2 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11))); ratio = _arg7; var _local12:Number = (length1 + (ratio * length2)); maxLength1 = (_local12 - (ratio * b2PulleyJoint.b2_minPulleyLength)); maxLength2 = ((_local12 - b2PulleyJoint.b2_minPulleyLength) / ratio); } } }//package Box2D.Dynamics.Joints
Section 62
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; import Box2D.Common.*; public class b2RevoluteJoint extends b2Joint { public var m_limitForce:Number; public var m_pivotMass:b2Mat22; public var m_motorForce:Number; public var m_enableLimit:Boolean; public var m_limitState:int; public var m_motorMass:Number; public var m_localAnchor1:b2Vec2; public var m_localAnchor2:b2Vec2; private var K1:b2Mat22; private var K2:b2Mat22; private var K3:b2Mat22; private var K:b2Mat22; public var m_pivotForce:b2Vec2; public var m_enableMotor:Boolean; public var m_referenceAngle:Number; public var m_limitPositionImpulse:Number; public var m_motorSpeed:Number; public var m_upperAngle:Number; public var m_lowerAngle:Number; public var m_maxMotorTorque:Number; public static var tImpulse:b2Vec2 = new b2Vec2(); public function b2RevoluteJoint(_arg1:b2RevoluteJointDef){ K = new b2Mat22(); K1 = new b2Mat22(); K2 = new b2Mat22(); K3 = new b2Mat22(); m_localAnchor1 = new b2Vec2(); m_localAnchor2 = new b2Vec2(); m_pivotForce = new b2Vec2(); m_pivotMass = new b2Mat22(); super(_arg1); m_localAnchor1.SetV(_arg1.localAnchor1); m_localAnchor2.SetV(_arg1.localAnchor2); m_referenceAngle = _arg1.referenceAngle; m_pivotForce.Set(0, 0); m_motorForce = 0; m_limitForce = 0; m_limitPositionImpulse = 0; m_lowerAngle = _arg1.lowerAngle; m_upperAngle = _arg1.upperAngle; m_maxMotorTorque = _arg1.maxMotorTorque; m_motorSpeed = _arg1.motorSpeed; m_enableLimit = _arg1.enableLimit; m_enableMotor = _arg1.enableMotor; } override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{ var _local4:b2Mat22; var _local5:Number; var _local10:Number; var _local16:Number; var _local17:Number; var _local18:Number; var _local19:Number; var _local20:Number; var _local21:Number; var _local2:b2Body = m_body1; var _local3:b2Body = m_body2; _local4 = _local2.m_xf.R; var _local6:Number = (m_localAnchor1.x - _local2.GetLocalCenter().x); var _local7:Number = (m_localAnchor1.y - _local2.GetLocalCenter().y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.GetLocalCenter().x); var _local9:Number = (m_localAnchor2.y - _local3.GetLocalCenter().y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; var _local11:Number = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local7)); var _local12:Number = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local6)); var _local13:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.x * _local11) + (m_pivotMass.col2.x * _local12))); var _local14:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.y * _local11) + (m_pivotMass.col2.y * _local12))); m_pivotForce.x = (m_pivotForce.x + _local13); m_pivotForce.y = (m_pivotForce.y + _local14); var _local15:Number = (_arg1.dt * _local13); _local16 = (_arg1.dt * _local14); _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local15)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local16)); _local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15)))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16)); _local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local16) - (_local9 * _local15)))); if (((m_enableMotor) && (!((m_limitState == e_equalLimits))))){ _local17 = ((_local3.m_angularVelocity - _local2.m_angularVelocity) - m_motorSpeed); _local18 = ((-(_arg1.inv_dt) * m_motorMass) * _local17); _local19 = m_motorForce; m_motorForce = b2Math.b2Clamp((m_motorForce + _local18), -(m_maxMotorTorque), m_maxMotorTorque); _local18 = (m_motorForce - _local19); _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local18)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local18)); }; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local20 = (_local3.m_angularVelocity - _local2.m_angularVelocity); _local21 = ((-(_arg1.inv_dt) * m_motorMass) * _local20); if (m_limitState == e_equalLimits){ m_limitForce = (m_limitForce + _local21); } else { if (m_limitState == e_atLowerLimit){ _local10 = m_limitForce; m_limitForce = b2Math.b2Max((m_limitForce + _local21), 0); _local21 = (m_limitForce - _local10); } else { if (m_limitState == e_atUpperLimit){ _local10 = m_limitForce; m_limitForce = b2Math.b2Min((m_limitForce + _local21), 0); _local21 = (m_limitForce - _local10); }; }; }; _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_local2.m_invI * _arg1.dt) * _local21)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_local3.m_invI * _arg1.dt) * _local21)); }; } override public function GetAnchor1():b2Vec2{ return (m_body1.GetWorldPoint(m_localAnchor1)); } override public function GetAnchor2():b2Vec2{ return (m_body2.GetWorldPoint(m_localAnchor2)); } public function GetUpperLimit():Number{ return (m_upperAngle); } public function GetLowerLimit():Number{ return (m_lowerAngle); } public function EnableMotor(_arg1:Boolean):void{ m_enableMotor = _arg1; } public function GetMotorSpeed():Number{ return (m_motorSpeed); } override public function GetReactionForce():b2Vec2{ return (m_pivotForce); } override public function SolvePositionConstraints():Boolean{ var _local1:Number; var _local2:Number; var _local6:b2Mat22; var _local25:Number; var _local26:Number; var _local3:b2Body = m_body1; var _local4:b2Body = m_body2; var _local5:Number = 0; _local6 = _local3.m_xf.R; var _local7:Number = (m_localAnchor1.x - _local3.GetLocalCenter().x); var _local8:Number = (m_localAnchor1.y - _local3.GetLocalCenter().y); var _local9:Number = ((_local6.col1.x * _local7) + (_local6.col2.x * _local8)); _local8 = ((_local6.col1.y * _local7) + (_local6.col2.y * _local8)); _local7 = _local9; _local6 = _local4.m_xf.R; var _local10:Number = (m_localAnchor2.x - _local4.GetLocalCenter().x); var _local11:Number = (m_localAnchor2.y - _local4.GetLocalCenter().y); _local9 = ((_local6.col1.x * _local10) + (_local6.col2.x * _local11)); _local11 = ((_local6.col1.y * _local10) + (_local6.col2.y * _local11)); _local10 = _local9; var _local12:Number = (_local3.m_sweep.c.x + _local7); var _local13:Number = (_local3.m_sweep.c.y + _local8); var _local14:Number = (_local4.m_sweep.c.x + _local10); var _local15:Number = (_local4.m_sweep.c.y + _local11); var _local16:Number = (_local14 - _local12); var _local17:Number = (_local15 - _local13); _local5 = Math.sqrt(((_local16 * _local16) + (_local17 * _local17))); var _local18:Number = _local3.m_invMass; var _local19:Number = _local4.m_invMass; var _local20:Number = _local3.m_invI; var _local21:Number = _local4.m_invI; K1.col1.x = (_local18 + _local19); K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = (_local18 + _local19); K2.col1.x = ((_local20 * _local8) * _local8); K2.col2.x = ((-(_local20) * _local7) * _local8); K2.col1.y = ((-(_local20) * _local7) * _local8); K2.col2.y = ((_local20 * _local7) * _local7); K3.col1.x = ((_local21 * _local11) * _local11); K3.col2.x = ((-(_local21) * _local10) * _local11); K3.col1.y = ((-(_local21) * _local10) * _local11); K3.col2.y = ((_local21 * _local10) * _local10); K.SetM(K1); K.AddM(K2); K.AddM(K3); K.Solve(tImpulse, -(_local16), -(_local17)); var _local22:Number = tImpulse.x; var _local23:Number = tImpulse.y; _local3.m_sweep.c.x = (_local3.m_sweep.c.x - (_local3.m_invMass * _local22)); _local3.m_sweep.c.y = (_local3.m_sweep.c.y - (_local3.m_invMass * _local23)); _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * ((_local7 * _local23) - (_local8 * _local22)))); _local4.m_sweep.c.x = (_local4.m_sweep.c.x + (_local4.m_invMass * _local22)); _local4.m_sweep.c.y = (_local4.m_sweep.c.y + (_local4.m_invMass * _local23)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * ((_local10 * _local23) - (_local11 * _local22)))); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); var _local24:Number = 0; if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){ _local25 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_referenceAngle); _local26 = 0; if (m_limitState == e_equalLimits){ _local2 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection); _local26 = (-(m_motorMass) * _local2); _local24 = b2Math.b2Abs(_local2); } else { if (m_limitState == e_atLowerLimit){ _local2 = (_local25 - m_lowerAngle); _local24 = b2Math.b2Max(0, -(_local2)); _local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0); _local26 = (-(m_motorMass) * _local2); _local1 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local26), 0); _local26 = (m_limitPositionImpulse - _local1); } else { if (m_limitState == e_atUpperLimit){ _local2 = (_local25 - m_upperAngle); _local24 = b2Math.b2Max(0, _local2); _local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection); _local26 = (-(m_motorMass) * _local2); _local1 = m_limitPositionImpulse; m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local26), 0); _local26 = (m_limitPositionImpulse - _local1); }; }; }; _local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local26)); _local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local26)); _local3.SynchronizeTransform(); _local4.SynchronizeTransform(); }; return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local24 <= b2Settings.b2_angularSlop)))); } public function SetMotorSpeed(_arg1:Number):void{ m_motorSpeed = _arg1; } public function GetJointSpeed():Number{ return ((m_body2.m_angularVelocity - m_body1.m_angularVelocity)); } public function SetMaxMotorTorque(_arg1:Number):void{ m_maxMotorTorque = _arg1; } public function GetJointAngle():Number{ return (((m_body2.m_sweep.a - m_body1.m_sweep.a) - m_referenceAngle)); } public function GetMotorTorque():Number{ return (m_motorForce); } override public function InitVelocityConstraints(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2Mat22; var _local5:Number; var _local7:Number; var _local14:Number; _local2 = m_body1; _local3 = m_body2; _local4 = _local2.m_xf.R; var _local6:Number = (m_localAnchor1.x - _local2.GetLocalCenter().x); _local7 = (m_localAnchor1.y - _local2.GetLocalCenter().y); _local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7)); _local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7)); _local6 = _local5; _local4 = _local3.m_xf.R; var _local8:Number = (m_localAnchor2.x - _local3.GetLocalCenter().x); var _local9:Number = (m_localAnchor2.y - _local3.GetLocalCenter().y); _local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9)); _local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9)); _local8 = _local5; var _local10:Number = _local2.m_invMass; var _local11:Number = _local3.m_invMass; var _local12:Number = _local2.m_invI; var _local13:Number = _local3.m_invI; K1.col1.x = (_local10 + _local11); K1.col2.x = 0; K1.col1.y = 0; K1.col2.y = (_local10 + _local11); K2.col1.x = ((_local12 * _local7) * _local7); K2.col2.x = ((-(_local12) * _local6) * _local7); K2.col1.y = ((-(_local12) * _local6) * _local7); K2.col2.y = ((_local12 * _local6) * _local6); K3.col1.x = ((_local13 * _local9) * _local9); K3.col2.x = ((-(_local13) * _local8) * _local9); K3.col1.y = ((-(_local13) * _local8) * _local9); K3.col2.y = ((_local13 * _local8) * _local8); K.SetM(K1); K.AddM(K2); K.AddM(K3); K.Invert(m_pivotMass); m_motorMass = (1 / (_local12 + _local13)); if (m_enableMotor == false){ m_motorForce = 0; }; if (m_enableLimit){ _local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - m_referenceAngle); if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){ m_limitState = e_equalLimits; } else { if (_local14 <= m_lowerAngle){ if (m_limitState != e_atLowerLimit){ m_limitForce = 0; }; m_limitState = e_atLowerLimit; } else { if (_local14 >= m_upperAngle){ if (m_limitState != e_atUpperLimit){ m_limitForce = 0; }; m_limitState = e_atUpperLimit; } else { m_limitState = e_inactiveLimit; m_limitForce = 0; }; }; }; } else { m_limitForce = 0; }; if (b2World.s_enableWarmStarting){ _local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - ((_arg1.dt * _local10) * m_pivotForce.x)); _local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - ((_arg1.dt * _local10) * m_pivotForce.y)); _local2.m_angularVelocity = (_local2.m_angularVelocity - ((_arg1.dt * _local12) * ((((_local6 * m_pivotForce.y) - (_local7 * m_pivotForce.x)) + m_motorForce) + m_limitForce))); _local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_arg1.dt * _local11) * m_pivotForce.x)); _local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_arg1.dt * _local11) * m_pivotForce.y)); _local3.m_angularVelocity = (_local3.m_angularVelocity + ((_arg1.dt * _local13) * ((((_local8 * m_pivotForce.y) - (_local9 * m_pivotForce.x)) + m_motorForce) + m_limitForce))); } else { m_pivotForce.SetZero(); m_motorForce = 0; m_limitForce = 0; }; m_limitPositionImpulse = 0; } public function EnableLimit(_arg1:Boolean):void{ m_enableLimit = _arg1; } override public function GetReactionTorque():Number{ return (m_limitForce); } public function IsLimitEnabled():Boolean{ return (m_enableLimit); } public function IsMotorEnabled():Boolean{ return (m_enableMotor); } public function SetLimits(_arg1:Number, _arg2:Number):void{ m_lowerAngle = _arg1; m_upperAngle = _arg2; } } }//package Box2D.Dynamics.Joints
Section 63
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef) package Box2D.Dynamics.Joints { import Box2D.Common.Math.*; import Box2D.Dynamics.*; public class b2RevoluteJointDef extends b2JointDef { public var upperAngle:Number; public var enableMotor:Boolean; public var referenceAngle:Number; public var motorSpeed:Number; public var localAnchor1:b2Vec2; public var localAnchor2:b2Vec2; public var enableLimit:Boolean; public var lowerAngle:Number; public var maxMotorTorque:Number; public function b2RevoluteJointDef(){ localAnchor1 = new b2Vec2(); localAnchor2 = new b2Vec2(); super(); type = b2Joint.e_revoluteJoint; localAnchor1.Set(0, 0); localAnchor2.Set(0, 0); referenceAngle = 0; lowerAngle = 0; upperAngle = 0; maxMotorTorque = 0; motorSpeed = 0; enableLimit = false; enableMotor = false; } public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2):void{ body1 = _arg1; body2 = _arg2; localAnchor1 = body1.GetLocalPoint(_arg3); localAnchor2 = body2.GetLocalPoint(_arg3); referenceAngle = (body2.GetAngle() - body1.GetAngle()); } } }//package Box2D.Dynamics.Joints
Section 64
//b2Body (Box2D.Dynamics.b2Body) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.Joints.*; import Box2D.Dynamics.Contacts.*; public class b2Body { public var m_xf:b2XForm; 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_sweep:b2Sweep; public var m_mass:Number; public var m_torque:Number; public var m_userData; public var m_linearVelocity:b2Vec2; public var m_flags:uint; public var m_invI:Number; public var m_world:b2World; public var m_prev:b2Body; public var m_invMass:Number; public var m_type:uint; public var m_linearDamping:Number; public var m_shapeCount:int; public var m_angularDamping:Number; public var m_sleepTime:Number; public var m_jointList:b2JointEdge; public var m_I:Number; public static var e_fixedRotationFlag:uint = 64; public static var e_frozenFlag:uint = 2; public static var e_maxTypes:uint = 3; public static var e_sleepFlag:uint = 8; private static var s_massData:b2MassData = new b2MassData(); public static var e_bulletFlag:uint = 32; public static var e_staticType:uint = 1; public static var e_islandFlag:uint = 4; public static var e_allowSleepFlag:uint = 16; private static var s_xf1:b2XForm = new b2XForm(); public static var e_dynamicType:uint = 2; public function b2Body(_arg1:b2BodyDef, _arg2:uint, _arg3:b2World){ m_xf = new b2XForm(); m_sweep = new b2Sweep(); m_linearVelocity = new b2Vec2(); m_force = new b2Vec2(); super(); m_flags = 0; if (_arg1.isBullet){ m_flags = (m_flags | e_bulletFlag); }; if (_arg1.fixedRotation){ m_flags = (m_flags | e_fixedRotationFlag); }; if (_arg1.allowSleep){ m_flags = (m_flags | e_allowSleepFlag); }; if (_arg1.isSleeping){ m_flags = (m_flags | e_sleepFlag); }; m_type = _arg2; m_world = _arg3; m_xf.position.SetV(_arg1.position); m_xf.R.Set(_arg1.angle); m_sweep.localCenter.SetV(_arg1.massData.center); m_sweep.t0 = 1; m_sweep.a0 = (m_sweep.a = _arg1.angle); var _local4:b2Mat22 = m_xf.R; var _local5:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y)); m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); m_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_mass = 0; m_invMass = 0; m_I = 0; m_invI = 0; if (m_type == e_dynamicType){ m_mass = _arg1.massData.mass; }; if (m_mass > 0){ m_invMass = (1 / m_mass); }; if (((((m_flags & b2Body.e_fixedRotationFlag) == 0)) && ((m_type == e_dynamicType)))){ m_I = _arg1.massData.I; }; if (m_I > 0){ m_invI = (1 / m_I); }; m_userData = _arg1.userData; m_shapeList = null; m_shapeCount = 0; } 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 SynchronizeTransform():void{ m_xf.R.Set(m_sweep.a); var _local1:b2Mat22 = m_xf.R; var _local2:b2Vec2 = m_sweep.localCenter; m_xf.position.x = (m_sweep.c.x - ((_local1.col1.x * _local2.x) + (_local1.col2.x * _local2.y))); m_xf.position.y = (m_sweep.c.y - ((_local1.col1.y * _local2.x) + (_local1.col2.y * _local2.y))); } public function GetInertia():Number{ return (m_I); } public function GetLinearVelocity():b2Vec2{ return (m_linearVelocity); } public function IsSleeping():Boolean{ return (((m_flags & e_sleepFlag) == e_sleepFlag)); } public function SetMassFromShapes():void{ var _local1:b2Shape; if (m_world.m_lock == true){ return; }; if (m_type == e_staticType){ return; }; m_mass = 0; m_invMass = 0; m_I = 0; m_invI = 0; var _local2:Number = 0; var _local3:Number = 0; var _local4:b2MassData = s_massData; _local1 = m_shapeList; while (_local1) { _local1.ComputeMass(_local4); m_mass = (m_mass + _local4.mass); _local2 = (_local2 + (_local4.mass * _local4.center.x)); _local3 = (_local3 + (_local4.mass * _local4.center.y)); m_I = (m_I + _local4.I); _local1 = _local1.m_next; }; if (m_mass > 0){ m_invMass = (1 / m_mass); _local2 = (_local2 * m_invMass); _local3 = (_local3 * m_invMass); } else { m_invMass = 0; m_invI = 0; }; if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){ m_I = (m_I - (m_mass * ((_local2 * _local2) + (_local3 * _local3)))); m_invI = (1 / m_I); } else { m_I = 0; m_invI = 0; }; m_sweep.localCenter.Set(_local2, _local3); var _local5:b2Mat22 = m_xf.R; var _local6:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y)); m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); _local1 = m_shapeList; while (_local1) { _local1.UpdateSweepRadius(m_sweep.localCenter); _local1 = _local1.m_next; }; } public function GetJointList():b2JointEdge{ return (m_jointList); } public function SetXForm(_arg1:b2Vec2, _arg2:Number):Boolean{ var _local3:b2Shape; var _local7:Boolean; if (m_world.m_lock == true){ return (true); }; if (IsFrozen()){ return (false); }; m_xf.R.Set(_arg2); m_xf.position.SetV(_arg1); var _local4:b2Mat22 = m_xf.R; var _local5:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local4.col1.x * _local5.x) + (_local4.col2.x * _local5.y)); m_sweep.c.y = ((_local4.col1.y * _local5.x) + (_local4.col2.y * _local5.y)); m_sweep.c.x = (m_sweep.c.x + m_xf.position.x); m_sweep.c.y = (m_sweep.c.y + m_xf.position.y); m_sweep.c0.SetV(m_sweep.c); m_sweep.a0 = (m_sweep.a = _arg2); var _local6:Boolean; _local3 = m_shapeList; while (_local3) { _local7 = _local3.Synchronize(m_world.m_broadPhase, m_xf, m_xf); if (_local7 == false){ _local6 = true; break; }; _local3 = _local3.m_next; }; if (_local6 == true){ m_flags = (m_flags | e_frozenFlag); m_linearVelocity.SetZero(); m_angularVelocity = 0; _local3 = m_shapeList; while (_local3) { _local3.DestroyProxy(m_world.m_broadPhase); _local3 = _local3.m_next; }; return (false); }; m_world.m_broadPhase.Commit(); return (true); } public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{ if (IsSleeping()){ WakeUp(); }; m_force.x = (m_force.x + _arg1.x); m_force.y = (m_force.y + _arg1.y); m_torque = (m_torque + (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x))); } public function SynchronizeShapes():Boolean{ var _local4:b2Shape; var _local1:b2XForm = s_xf1; _local1.R.Set(m_sweep.a0); var _local2:b2Mat22 = _local1.R; var _local3:b2Vec2 = m_sweep.localCenter; _local1.position.x = (m_sweep.c0.x - ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y))); _local1.position.y = (m_sweep.c0.y - ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y))); var _local5:Boolean; _local4 = m_shapeList; while (_local4) { _local5 = _local4.Synchronize(m_world.m_broadPhase, _local1, m_xf); if (_local5 == false){ break; }; _local4 = _local4.m_next; }; if (_local5 == false){ m_flags = (m_flags | e_frozenFlag); m_linearVelocity.SetZero(); m_angularVelocity = 0; _local4 = m_shapeList; while (_local4) { _local4.DestroyProxy(m_world.m_broadPhase); _local4 = _local4.m_next; }; return (false); }; return (true); } public function GetAngle():Number{ return (m_sweep.a); } public function GetXForm():b2XForm{ return (m_xf); } public function 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 GetContactList():b2ContactEdge{ return (m_contactList); } public function GetAngularVelocity():Number{ return (m_angularVelocity); } public function GetMass():Number{ return (m_mass); } public function GetShapeList():b2Shape{ return (m_shapeList); } public function GetLocalPoint(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulXT(m_xf, _arg1)); } public function SetAngularVelocity(_arg1:Number):void{ m_angularVelocity = _arg1; } public function SetMass(_arg1:b2MassData):void{ var _local2:b2Mat22; if (m_world.m_lock == true){ return; }; if (m_type == e_staticType){ return; }; m_mass = 0; 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); _local2 = m_xf.R; var _local3:b2Vec2 = m_sweep.localCenter; m_sweep.c.x = ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y)); m_sweep.c.y = ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.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); var _local4:b2Shape = m_shapeList; while (_local4) { _local4.UpdateSweepRadius(m_sweep.localCenter); _local4 = _local4.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 GetNext():b2Body{ return (m_next); } 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{ if (m_world.m_lock == true){ return (null); }; var _local2:b2Shape = b2Shape.Create(_arg1, m_world.m_blockAllocator); _local2.m_next = m_shapeList; m_shapeList = _local2; m_shapeCount++; _local2.m_body = this; _local2.CreateProxy(m_world.m_broadPhase, m_xf); _local2.UpdateSweepRadius(m_sweep.localCenter); return (_local2); } public function IsConnected(_arg1:b2Body):Boolean{ var _local2:b2JointEdge = m_jointList; while (_local2) { if (_local2.other == _arg1){ return ((_local2.joint.m_collideConnected == false)); }; _local2 = _local2.next; }; return (false); } public function DestroyShape(_arg1:b2Shape):void{ if (m_world.m_lock == true){ return; }; _arg1.DestroyProxy(m_world.m_broadPhase); var _local2:b2Shape = m_shapeList; var _local3:Boolean; while (_local2 != null) { if (_local2 == _arg1){ _local2 = _arg1.m_next; _local3 = true; break; }; _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 GetLocalVector(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulTMV(m_xf.R, _arg1)); } public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{ return (b2Math.b2MulX(m_xf, _arg1)); } public function GetPosition():b2Vec2{ return (m_xf.position); } } }//package Box2D.Dynamics
Section 65
//b2BodyDef (Box2D.Dynamics.b2BodyDef) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; public class b2BodyDef { public var angularDamping:Number; public var angle:Number; public var isSleeping:Boolean; public var position:b2Vec2; public var isBullet:Boolean; public var allowSleep:Boolean; public var userData; public var fixedRotation:Boolean; public var linearDamping:Number; public var massData:b2MassData; public function b2BodyDef(){ massData = new b2MassData(); position = new b2Vec2(); super(); massData.center.SetZero(); massData.mass = 0; massData.I = 0; userData = null; position.Set(0, 0); angle = 0; linearDamping = 0; angularDamping = 0; allowSleep = true; isSleeping = false; fixedRotation = false; isBullet = false; } } }//package Box2D.Dynamics
Section 66
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener) package Box2D.Dynamics { public class b2BoundaryListener { public function Violation(_arg1:b2Body):void{ } } }//package Box2D.Dynamics
Section 67
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; public class b2ContactFilter { public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter); ; public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{ if ((((_arg1.m_groupIndex == _arg2.m_groupIndex)) && (!((_arg1.m_groupIndex == 0))))){ return ((_arg1.m_groupIndex > 0)); }; var _local3:Boolean = ((!(((_arg1.m_maskBits & _arg2.m_categoryBits) == 0))) && (!(((_arg1.m_categoryBits & _arg2.m_maskBits) == 0)))); return (_local3); } } }//package Box2D.Dynamics
Section 68
//b2ContactListener (Box2D.Dynamics.b2ContactListener) package Box2D.Dynamics { import Box2D.Collision.*; public class b2ContactListener { public function Add(_arg1:b2ContactPoint):void{ } public function Remove(_arg1:b2ContactPoint):void{ } public function Persist(_arg1:b2ContactPoint):void{ } } }//package Box2D.Dynamics
Section 69
//b2ContactManager (Box2D.Dynamics.b2ContactManager) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; public class b2ContactManager extends b2PairCallback { public var m_world:b2World; public var m_destroyImmediate:Boolean; public var m_nullContact:b2NullContact; public function b2ContactManager(){ m_nullContact = new b2NullContact(); super(); m_world = null; m_destroyImmediate = false; } override public function PairRemoved(_arg1, _arg2, _arg3):void{ if (_arg3 == null){ return; }; var _local4:b2Contact = (_arg3 as b2Contact); if (_local4 == m_nullContact){ return; }; Destroy(_local4); } public function Destroy(_arg1:b2Contact):void{ var _local7:b2ContactPoint; var _local8:b2Body; var _local9:Array; var _local10:int; var _local11:b2Manifold; var _local12:int; var _local13:b2ManifoldPoint; var _local14:b2Mat22; var _local15:b2Vec2; var _local16:b2Vec2; var _local2:b2Shape = _arg1.GetShape1(); var _local3:b2Shape = _arg1.GetShape2(); var _local4:int = _arg1.GetManifoldCount(); if ((((_local4 > 0)) && (m_world.m_contactListener))){ _local7 = new b2ContactPoint(); _local7.shape1 = _arg1.GetShape1(); _local7.shape2 = _arg1.GetShape2(); _local8 = _local7.shape1.GetBody(); _local9 = _arg1.GetManifolds(); _local10 = 0; while (_local10 < _local4) { _local11 = _local9[_local10]; _local7.normal.SetV(_local11.normal); _local12 = 0; while (_local12 < _local11.pointCount) { _local13 = _local11.points[_local12]; _local14 = _local8.GetXForm().R; _local15 = _local8.GetXForm().position; _local16 = _local13.localPoint1; _local7.position.x = (_local15.x + ((_local14.col1.x * _local16.x) + (_local14.col2.x * _local16.y))); _local7.position.y = (_local15.y + ((_local14.col1.y * _local16.x) + (_local14.col2.y * _local16.y))); _local7.separation = _local13.separation; _local7.normalForce = _local13.normalForce; _local7.tangentForce = _local13.tangentForce; _local7.id = _local13.id; m_world.m_contactListener.Remove(_local7); _local12++; }; _local10++; }; }; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_world.m_contactList){ m_world.m_contactList = _arg1.m_next; }; var _local5:b2Body = _local2.GetBody(); var _local6:b2Body = _local3.GetBody(); if (_arg1.m_node1.prev){ _arg1.m_node1.prev.next = _arg1.m_node1.next; }; if (_arg1.m_node1.next){ _arg1.m_node1.next.prev = _arg1.m_node1.prev; }; if (_arg1.m_node1 == _local5.m_contactList){ _local5.m_contactList = _arg1.m_node1.next; }; if (_arg1.m_node2.prev){ _arg1.m_node2.prev.next = _arg1.m_node2.next; }; if (_arg1.m_node2.next){ _arg1.m_node2.next.prev = _arg1.m_node2.prev; }; if (_arg1.m_node2 == _local6.m_contactList){ _local6.m_contactList = _arg1.m_node2.next; }; b2Contact.Destroy(_arg1, m_world.m_blockAllocator); m_world.m_contactCount--; } override public function PairAdded(_arg1, _arg2){ var _local3:b2Shape = (_arg1 as b2Shape); var _local4:b2Shape = (_arg2 as b2Shape); var _local5:b2Body = _local3.GetBody(); var _local6:b2Body = _local4.GetBody(); if (((_local5.IsStatic()) && (_local6.IsStatic()))){ return (m_nullContact); }; if (_local3.m_body == _local4.m_body){ return (m_nullContact); }; if (_local6.IsConnected(_local5)){ return (m_nullContact); }; if (((!((m_world.m_contactFilter == null))) && ((m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){ return (m_nullContact); }; var _local7:b2Contact = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator); if (_local7 == null){ return (m_nullContact); }; _local3 = _local7.GetShape1(); _local4 = _local7.GetShape2(); _local5 = _local3.GetBody(); _local6 = _local4.GetBody(); _local7.m_prev = null; _local7.m_next = m_world.m_contactList; if (m_world.m_contactList != null){ m_world.m_contactList.m_prev = _local7; }; m_world.m_contactList = _local7; _local7.m_node1.contact = _local7; _local7.m_node1.other = _local6; _local7.m_node1.prev = null; _local7.m_node1.next = _local5.m_contactList; if (_local5.m_contactList != null){ _local5.m_contactList.prev = _local7.m_node1; }; _local5.m_contactList = _local7.m_node1; _local7.m_node2.contact = _local7; _local7.m_node2.other = _local5; _local7.m_node2.prev = null; _local7.m_node2.next = _local6.m_contactList; if (_local6.m_contactList != null){ _local6.m_contactList.prev = _local7.m_node2; }; _local6.m_contactList = _local7.m_node2; m_world.m_contactCount++; return (_local7); } public function Collide():void{ var _local2:b2Body; var _local3:b2Body; var _local4:b2ContactPoint; var _local5:b2Body; var _local6:int; var _local7:Array; var _local8:int; var _local9:b2Manifold; var _local10:int; var _local11:b2ManifoldPoint; var _local12:b2Mat22; var _local13:b2Vec2; var _local14:b2Vec2; var _local1:b2Contact = m_world.m_contactList; while (_local1) { _local2 = _local1.GetShape1().GetBody(); _local3 = _local1.GetShape2().GetBody(); if (((_local2.IsSleeping()) && (_local3.IsSleeping()))){ } else { _local1.Update(m_world.m_contactListener); if ((((_local1.IsSolid() == false)) && (m_world.m_contactListener))){ _local4 = new b2ContactPoint(); _local4.shape1 = _local1.GetShape1(); _local4.shape2 = _local1.GetShape2(); _local4.normalForce = 0; _local4.tangentForce = 0; _local5 = _local4.shape1.GetBody(); _local6 = _local1.GetManifoldCount(); _local7 = _local1.GetManifolds(); _local8 = 0; while (_local8 < _local6) { _local9 = _local7[_local8]; _local4.normal.SetV(_local9.normal); _local10 = 0; while (_local10 < _local9.pointCount) { _local11 = _local9.points[_local10]; _local12 = _local5.GetXForm().R; _local13 = _local5.GetXForm().position; _local14 = _local11.localPoint1; _local4.position.x = (_local13.x + ((_local12.col1.x * _local14.x) + (_local12.col2.x * _local14.y))); _local4.position.y = (_local13.y + ((_local12.col1.y * _local14.x) + (_local12.col2.y * _local14.y))); _local4.separation = _local11.separation; if ((_local11.id.features.flip & b2Collision.b2_newPoint)){ _local11.id.features.flip = (_local11.id.features.flip & ~(b2Collision.b2_newPoint)); _local4.id = _local11.id; m_world.m_contactListener.Add(_local4); } else { _local4.id = _local11.id; m_world.m_contactListener.Persist(_local4); }; _local10++; }; _local8++; }; }; }; _local1 = _local1.GetNext(); }; } } }//package Box2D.Dynamics
Section 70
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw) package Box2D.Dynamics { import flash.display.*; import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; import Box2D.Collision.*; import Box2D.Dynamics.Contacts.*; public class b2DebugDraw { public var m_xformScale:Number;// = 1 public var m_fillAlpha:Number;// = 1 public var m_alpha:Number;// = 1 public var m_drawFlags:uint; public var m_lineThickness:Number;// = 1 public var m_drawScale:Number;// = 1 public var m_sprite:Sprite; public static var e_coreShapeBit:uint = 4; public static var e_shapeBit:uint = 1; public static var e_centerOfMassBit:uint = 64; public static var e_aabbBit:uint = 8; public static var e_obbBit:uint = 16; public static var e_pairBit:uint = 32; public static var e_jointBit:uint = 2; public function b2DebugDraw(){ m_drawFlags = 0; } public function ClearFlags(_arg1:uint):void{ m_drawFlags = (m_drawFlags & ~(_arg1)); } public function SetFlags(_arg1:uint):void{ m_drawFlags = _arg1; } public function AppendFlags(_arg1:uint):void{ m_drawFlags = (m_drawFlags | _arg1); } public function DrawSegment(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale)); m_sprite.graphics.lineTo((_arg2.x * m_drawScale), (_arg2.y * m_drawScale)); } public function DrawSolidPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); m_sprite.graphics.beginFill(_arg3.color, m_fillAlpha); var _local4 = 1; while (_local4 < _arg2) { m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale)); _local4++; }; m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); m_sprite.graphics.endFill(); } public function DrawCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale)); } public function DrawPolygon(_arg1:Array, _arg2:int, _arg3:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg3.color, m_alpha); m_sprite.graphics.moveTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); var _local4 = 1; while (_local4 < _arg2) { m_sprite.graphics.lineTo((_arg1[_local4].x * m_drawScale), (_arg1[_local4].y * m_drawScale)); _local4++; }; m_sprite.graphics.lineTo((_arg1[0].x * m_drawScale), (_arg1[0].y * m_drawScale)); } public function DrawSolidCircle(_arg1:b2Vec2, _arg2:Number, _arg3:b2Vec2, _arg4:b2Color):void{ m_sprite.graphics.lineStyle(m_lineThickness, _arg4.color, m_alpha); m_sprite.graphics.moveTo(0, 0); m_sprite.graphics.beginFill(_arg4.color, m_fillAlpha); m_sprite.graphics.drawCircle((_arg1.x * m_drawScale), (_arg1.y * m_drawScale), (_arg2 * m_drawScale)); m_sprite.graphics.endFill(); m_sprite.graphics.moveTo((_arg1.x * m_drawScale), (_arg1.y * m_drawScale)); m_sprite.graphics.lineTo(((_arg1.x + (_arg3.x * _arg2)) * m_drawScale), ((_arg1.y + (_arg3.y * _arg2)) * m_drawScale)); } public function GetFlags():uint{ return (m_drawFlags); } public function DrawXForm(_arg1:b2XForm):void{ m_sprite.graphics.lineStyle(m_lineThickness, 0xFF0000, m_alpha); m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale)); m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col1.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col1.y)) * m_drawScale)); m_sprite.graphics.lineStyle(m_lineThickness, 0xFF00, m_alpha); m_sprite.graphics.moveTo((_arg1.position.x * m_drawScale), (_arg1.position.y * m_drawScale)); m_sprite.graphics.lineTo(((_arg1.position.x + (m_xformScale * _arg1.R.col2.x)) * m_drawScale), ((_arg1.position.y + (m_xformScale * _arg1.R.col2.y)) * m_drawScale)); } } }//package Box2D.Dynamics
Section 71
//b2DestructionListener (Box2D.Dynamics.b2DestructionListener) package Box2D.Dynamics { import Box2D.Collision.Shapes.*; import Box2D.Dynamics.Joints.*; public class b2DestructionListener { public function SayGoodbyeShape(_arg1:b2Shape):void{ } public function SayGoodbyeJoint(_arg1:b2Joint):void{ } } }//package Box2D.Dynamics
Section 72
//b2Island (Box2D.Dynamics.b2Island) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Common.*; import Box2D.Collision.*; import Box2D.Dynamics.Joints.*; import Box2D.Dynamics.Contacts.*; public class b2Island { public var m_listener:b2ContactListener; public var m_positionIterationCount:int; public var m_bodyCapacity:int; public var m_bodies:Array; public var m_joints:Array; public var m_jointCapacity:int; public var m_contactCount:int; public var m_contacts:Array; public var m_contactCapacity:int; public var m_jointCount:int; public var m_allocator; public var m_bodyCount:int; private static var s_reportCP:b2ContactPoint = new b2ContactPoint(); public function b2Island(_arg1:int, _arg2:int, _arg3:int, _arg4, _arg5:b2ContactListener){ var _local6:int; super(); m_bodyCapacity = _arg1; m_contactCapacity = _arg2; m_jointCapacity = _arg3; m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; m_allocator = _arg4; m_listener = _arg5; m_bodies = new Array(_arg1); _local6 = 0; while (_local6 < _arg1) { m_bodies[_local6] = null; _local6++; }; m_contacts = new Array(_arg2); _local6 = 0; while (_local6 < _arg2) { m_contacts[_local6] = null; _local6++; }; m_joints = new Array(_arg3); _local6 = 0; while (_local6 < _arg3) { m_joints[_local6] = null; _local6++; }; m_positionIterationCount = 0; } public function AddBody(_arg1:b2Body):void{ var _local2 = m_bodyCount++; m_bodies[_local2] = _arg1; } public function AddJoint(_arg1:b2Joint):void{ var _local2 = m_jointCount++; m_joints[_local2] = _arg1; } public function Report(_arg1:Array):void{ var _local2:b2Mat22; var _local3:b2Vec2; var _local5:b2Contact; var _local6:b2ContactConstraint; var _local7:b2ContactPoint; var _local8:b2Body; var _local9:int; var _local10:Array; var _local11:int; var _local12:b2Manifold; var _local13:int; var _local14:b2ManifoldPoint; var _local15:b2ContactConstraintPoint; if (m_listener == null){ return; }; var _local4:int; while (_local4 < m_contactCount) { _local5 = m_contacts[_local4]; _local6 = _arg1[_local4]; _local7 = s_reportCP; _local7.shape1 = _local5.GetShape1(); _local7.shape2 = _local5.GetShape2(); _local8 = _local7.shape1.GetBody(); _local9 = _local5.GetManifoldCount(); _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]; _local2 = _local8.GetXForm().R; _local3 = _local14.localPoint1; _local7.position.x = (_local8.GetXForm().position.x + ((_local2.col1.x * _local3.x) + (_local2.col2.x * _local3.y))); _local7.position.y = (_local8.GetXForm().position.y + ((_local2.col1.y * _local3.x) + (_local2.col2.y * _local3.y))); _local7.separation = _local14.separation; _local7.normalForce = _local15.normalForce; _local7.tangentForce = _local15.tangentForce; if ((_local14.id.features.flip & b2Collision.b2_newPoint)){ _local14.id.features.flip = (_local14.id.features.flip & ~(b2Collision.b2_newPoint)); _local7.id.key = _local14.id.key; m_listener.Add(_local7); } else { _local7.id.key = _local14.id.key; m_listener.Persist(_local7); }; _local13++; }; _local11++; }; _local4++; }; } public function AddContact(_arg1:b2Contact):void{ var _local2 = m_contactCount++; m_contacts[_local2] = _arg1; } public function Solve(_arg1:b2TimeStep, _arg2:b2Vec2, _arg3:Boolean, _arg4:Boolean):void{ var _local5:int; var _local6:b2Body; var _local8:int; var _local9:Boolean; var _local10:Boolean; var _local11:Boolean; var _local12:Number; var _local13:Number; var _local14:Number; _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; if (_local6.IsStatic()){ } else { _local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x)))); _local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y)))); _local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque)); _local6.m_force.SetZero(); _local6.m_torque = 0; _local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1)); _local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1)); if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){ _local6.m_linearVelocity.Normalize(); _local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity); _local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity); }; if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){ if (_local6.m_angularVelocity < 0){ _local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity); } else { _local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity; }; }; }; _local5++; }; var _local7:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator); _local7.InitVelocityConstraints(); _local5 = 0; while (_local5 < m_jointCount) { m_joints[_local5].InitVelocityConstraints(_arg1); _local5++; }; _local5 = 0; while (_local5 < _arg1.maxIterations) { _local7.SolveVelocityConstraints(); _local8 = 0; while (_local8 < m_jointCount) { m_joints[_local8].SolveVelocityConstraints(_arg1); _local8++; }; _local5++; }; _local7.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) { m_joints[_local5].InitPositionConstraints(); _local5++; }; m_positionIterationCount = 0; while (m_positionIterationCount < _arg1.maxIterations) { _local9 = _local7.SolvePositionConstraints(b2Settings.b2_contactBaumgarte); _local10 = true; _local5 = 0; while (_local5 < m_jointCount) { _local11 = m_joints[_local5].SolvePositionConstraints(); _local10 = ((_local10) && (_local11)); _local5++; }; if (((_local9) && (_local10))){ break; }; m_positionIterationCount++; }; }; Report(_local7.m_constraints); if (_arg4){ _local12 = Number.MAX_VALUE; _local13 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance); _local14 = (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; _local12 = 0; }; if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local14)))) || ((b2Math.b2Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local13)))){ _local6.m_sleepTime = 0; _local12 = 0; } else { _local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt); _local12 = b2Math.b2Min(_local12, _local6.m_sleepTime); }; }; _local5++; }; if (_local12 >= b2Settings.b2_timeToSleep){ _local5 = 0; while (_local5 < m_bodyCount) { _local6 = m_bodies[_local5]; m_bodies[_local5].m_flags = (_local6.m_flags | b2Body.e_sleepFlag); _local6.m_linearVelocity.SetZero(); _local6.m_angularVelocity = 0; _local5++; }; }; }; } public function Clear():void{ m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; } public function SolveTOI(_arg1:b2TimeStep):void{ var _local2:int; var _local5:b2Body; var _local6:Boolean; var _local3:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator); _local2 = 0; while (_local2 < _arg1.maxIterations) { _local3.SolveVelocityConstraints(); _local2++; }; _local2 = 0; while (_local2 < m_bodyCount) { _local5 = m_bodies[_local2]; if (_local5.IsStatic()){ } else { _local5.m_sweep.c0.SetV(_local5.m_sweep.c); _local5.m_sweep.a0 = _local5.m_sweep.a; _local5.m_sweep.c.x = (_local5.m_sweep.c.x + (_arg1.dt * _local5.m_linearVelocity.x)); _local5.m_sweep.c.y = (_local5.m_sweep.c.y + (_arg1.dt * _local5.m_linearVelocity.y)); _local5.m_sweep.a = (_local5.m_sweep.a + (_arg1.dt * _local5.m_angularVelocity)); _local5.SynchronizeTransform(); }; _local2++; }; var _local4:Number = 0.75; _local2 = 0; while (_local2 < _arg1.maxIterations) { _local6 = _local3.SolvePositionConstraints(_local4); if (_local6){ break; }; _local2++; }; Report(_local3.m_constraints); } } }//package Box2D.Dynamics
Section 73
//b2TimeStep (Box2D.Dynamics.b2TimeStep) package Box2D.Dynamics { public class b2TimeStep { public var dt:Number; public var maxIterations:int; public var inv_dt:Number; } }//package Box2D.Dynamics
Section 74
//b2World (Box2D.Dynamics.b2World) package Box2D.Dynamics { import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Common.*; import Box2D.Collision.*; import Box2D.Dynamics.Joints.*; import Box2D.Dynamics.Contacts.*; public class b2World { public var m_contactList:b2Contact; public var m_blockAllocator; public var m_boundaryListener:b2BoundaryListener; public var m_allowSleep:Boolean; public var m_contactListener:b2ContactListener; 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 s_enablePositionCorrection:int = 1; private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6); private static var s_xf:b2XForm = new b2XForm(); public static var s_enableWarmStarting:int = 1; public static var s_enableTOI:int = 1; public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){ m_contactManager = new b2ContactManager(); super(); m_destructionListener = null; m_boundaryListener = null; m_contactFilter = b2ContactFilter.b2_defaultFilter; m_contactListener = null; m_debugDraw = null; m_bodyList = null; m_contactList = null; m_jointList = null; m_bodyCount = 0; m_contactCount = 0; m_jointCount = 0; m_allowSleep = _arg3; m_gravity = _arg2; m_lock = false; m_contactManager.m_world = this; m_broadPhase = new b2BroadPhase(_arg1, m_contactManager); var _local4:b2BodyDef = new b2BodyDef(); m_groundBody = CreateStaticBody(_local4); } public function DrawJoint(_arg1:b2Joint):void{ var _local11:b2PulleyJoint; var _local12:b2Vec2; var _local13:b2Vec2; var _local2:b2Body = _arg1.GetBody1(); var _local3:b2Body = _arg1.GetBody2(); var _local4:b2XForm = _local2.GetXForm(); var _local5:b2XForm = _local3.GetXForm(); var _local6:b2Vec2 = _local4.position; var _local7:b2Vec2 = _local5.position; var _local8:b2Vec2 = _arg1.GetAnchor1(); var _local9:b2Vec2 = _arg1.GetAnchor2(); var _local10:b2Color = s_jointColor; switch (_arg1.GetType()){ 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 SetDebugDraw(_arg1:b2DebugDraw):void{ m_debugDraw = _arg1; } public function SetListener(_arg1:b2ContactListener):void{ m_contactListener = _arg1; } public function DrawDebugData():void{ var _local2:int; var _local3:b2Body; var _local4:b2Shape; var _local5:b2Joint; var _local6:b2BroadPhase; var _local11:b2XForm; var _local15:Boolean; var _local16:uint; var _local17:b2Pair; var _local18:b2Proxy; var _local19:b2Proxy; var _local20:b2Vec2; var _local21:b2Vec2; var _local22:b2Proxy; var _local23:b2PolygonShape; var _local24:b2OBB; var _local25:b2Vec2; var _local26:b2Mat22; var _local27:b2Vec2; var _local28:Number; if (m_debugDraw == null){ return; }; m_debugDraw.m_sprite.graphics.clear(); var _local1:uint = m_debugDraw.GetFlags(); var _local7:b2Vec2 = new b2Vec2(); var _local8:b2Vec2 = new b2Vec2(); var _local9:b2Vec2 = new b2Vec2(); var _local10:b2Color = new b2Color(0, 0, 0); var _local12:b2AABB = new b2AABB(); var _local13:b2AABB = new b2AABB(); var _local14:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()]; if ((_local1 & b2DebugDraw.e_shapeBit)){ _local15 = ((_local1 & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit); _local3 = m_bodyList; while (_local3) { _local11 = _local3.GetXForm(); _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.GetNext(); }; _local3 = _local3.GetNext(); }; }; if ((_local1 & b2DebugDraw.e_jointBit)){ _local5 = m_jointList; while (_local5) { DrawJoint(_local5); _local5 = _local5.GetNext(); }; }; 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.GetXForm(); _local4 = _local3.GetShapeList(); while (_local4) { if (_local4.GetType() != 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.GetNext(); }; _local3 = _local3.GetNext(); }; }; if ((_local1 & b2DebugDraw.e_centerOfMassBit)){ _local3 = m_bodyList; while (_local3) { _local11 = s_xf; _local11.R = _local3.GetXForm().R; _local11.position = _local3.GetWorldCenter(); m_debugDraw.DrawXForm(_local11); _local3 = _local3.GetNext(); }; }; } public function DestroyBody(_arg1:b2Body):void{ var _local4:b2JointEdge; var _local5:b2Shape; if (m_lock == true){ return; }; var _local2:b2JointEdge = _arg1.m_jointList; while (_local2) { _local4 = _local2; _local2 = _local2.next; if (m_destructionListener){ m_destructionListener.SayGoodbyeJoint(_local4.joint); }; DestroyJoint(_local4.joint); }; var _local3:b2Shape = _arg1.m_shapeList; while (_local3) { _local5 = _local3; _local3 = _local3.m_next; if (m_destructionListener){ m_destructionListener.SayGoodbyeShape(_local5); }; _local5.DestroyProxy(m_broadPhase); b2Shape.Destroy(_local5, m_blockAllocator); }; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_bodyList){ m_bodyList = _arg1.m_next; }; m_bodyCount--; } public function DrawShape(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{ var _local6:b2CircleShape; var _local7:b2Vec2; var _local8:Number; var _local9:b2Vec2; var _local10:int; var _local11:b2PolygonShape; var _local12:int; var _local13:Array; var _local14:Array; var _local15:Array; var _local5:b2Color = s_coreColor; switch (_arg1.m_type){ case b2Shape.e_circleShape: _local6 = (_arg1 as b2CircleShape); _local7 = b2Math.b2MulX(_arg2, _local6.GetLocalPosition()); _local8 = _local6.GetRadius(); _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 Solve(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local9:int; var _local10:int; var _local11:b2Body; var _local12:b2ContactEdge; var _local13:b2JointEdge; var _local14:Boolean; m_positionIterationCount = 0; var _local3:b2Island = new b2Island(m_bodyCount, m_contactCount, m_jointCount, m_stackAllocator, m_contactListener); _local2 = m_bodyList; while (_local2) { _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); _local2 = _local2.m_next; }; var _local4:b2Contact = m_contactList; while (_local4) { _local4.m_flags = (_local4.m_flags & ~(b2Contact.e_islandFlag)); _local4 = _local4.m_next; }; var _local5:b2Joint = m_jointList; while (_local5) { _local5.m_islandFlag = false; _local5 = _local5.m_next; }; var _local6:int = m_bodyCount; var _local7:Array = new Array(_local6); var _local8:b2Body = m_bodyList; while (_local8) { if ((_local8.m_flags & ((b2Body.e_islandFlag | b2Body.e_sleepFlag) | b2Body.e_frozenFlag))){ } else { if (_local8.IsStatic()){ } else { _local3.Clear(); _local9 = 0; var _temp1 = _local9; _local9 = (_local9 + 1); var _local15 = _temp1; _local7[_local15] = _local8; _local8.m_flags = (_local8.m_flags | b2Body.e_islandFlag); while (_local9 > 0) { --_local9; _local2 = _local7[_local9]; _local3.AddBody(_local2); _local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag)); if (_local2.IsStatic()){ } else { _local12 = _local2.m_contactList; while (_local12) { if ((_local12.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag))){ } else { if (_local12.contact.GetManifoldCount() == 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, (s_enablePositionCorrection > 0), m_allowSleep); m_positionIterationCount = Math.max(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.GetNext(); }; m_broadPhase.Commit(); } public function GetGroundBody():b2Body{ return (m_groundBody); } public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{ var _local4:Array = new Array(_arg3); var _local5:int = m_broadPhase.QueryAABB(_arg1, _local4, _arg3); var _local6:int; while (_local6 < _local5) { _arg2[_local6] = (_local4[_local6] as b2Shape); _local6++; }; return (_local5); } public function SolveTOI(_arg1:b2TimeStep):void{ var _local2:b2Body; var _local3:b2Shape; var _local4:b2Shape; var _local5:b2Body; var _local6:b2Body; var _local7:b2ContactEdge; var _local11:b2Contact; var _local12:b2Contact; var _local13:Number; var _local14:b2Body; var _local15:int; var _local16:b2TimeStep; var _local17:int; var _local18:Number; var _local19:Number; var _local20:b2Body; var _local21:Boolean; var _local8:b2Island = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener); var _local9:int = m_bodyCount; var _local10:Array = new Array(_local9); _local2 = m_bodyList; while (_local2) { _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); _local2.m_sweep.t0 = 0; _local2 = _local2.m_next; }; _local11 = m_contactList; while (_local11) { _local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag))); _local11 = _local11.m_next; }; while (true) { _local12 = null; _local13 = 1; _local11 = m_contactList; for (;_local11;(_local11 = _local11.m_next)) { if ((_local11.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){ } else { _local18 = 1; if ((_local11.m_flags & b2Contact.e_toiFlag)){ _local18 = _local11.m_toi; } else { _local3 = _local11.GetShape1(); _local4 = _local11.GetShape2(); _local5 = _local3.GetBody(); _local6 = _local4.GetBody(); 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 = Math.min((((1 - _local18) * _local19) + _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.GetShape1(); _local4 = _local12.GetShape2(); _local5 = _local3.GetBody(); _local6 = _local4.GetBody(); _local5.Advance(_local13); _local6.Advance(_local13); _local12.Update(m_contactListener); _local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag)); if (_local12.GetManifoldCount() == 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.GetManifoldCount() == 0){ } else { _local8.AddContact(_local7.contact); _local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag); _local20 = _local7.other; if ((_local20.m_flags & b2Body.e_islandFlag)){ } else { if (_local20.IsStatic() == false){ _local20.Advance(_local13); _local20.WakeUp(); }; var _temp2 = _local15; _local15 = (_local15 + 1); var _local23 = _temp2; _local10[_local23] = _local20; _local20.m_flags = (_local20.m_flags | b2Body.e_islandFlag); }; }; }; }; _local7 = _local7.next; }; }; }; _local16 = new b2TimeStep(); _local16.dt = ((1 - _local13) * _arg1.dt); _local16.inv_dt = (1 / _local16.dt); _local16.maxIterations = _arg1.maxIterations; _local8.SolveTOI(_local16); _local17 = 0; while (_local17 < _local8.m_bodyCount) { _local2 = _local8.m_bodies[_local17]; _local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag)); if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){ } else { if (_local2.IsStatic()){ } else { _local21 = _local2.SynchronizeShapes(); if ((((_local21 == false)) && (!((m_boundaryListener == null))))){ m_boundaryListener.Violation(_local2); }; _local7 = _local2.m_contactList; while (_local7) { _local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag)); _local7 = _local7.next; }; }; }; _local17++; }; _local17 = 0; while (_local17 < _local8.m_contactCount) { _local11 = _local8.m_contacts[_local17]; _local8.m_contacts[_local17].m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag))); _local17++; }; m_broadPhase.Commit(); }; }; } public function GetJointList():b2Joint{ return (m_jointList); } public function GetBodyList():b2Body{ return (m_bodyList); } public function CreateDynamicBody(_arg1:b2BodyDef):b2Body{ if (m_lock == true){ return (null); }; var _local2:b2Body = new b2Body(_arg1, b2Body.e_dynamicType, 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 CreateJoint(_arg1:b2JointDef):b2Joint{ var _local3:b2Body; var _local4:b2Shape; var _local2:b2Joint = b2Joint.Create(_arg1, m_blockAllocator); _local2.m_prev = null; _local2.m_next = m_jointList; if (m_jointList){ m_jointList.m_prev = _local2; }; m_jointList = _local2; m_jointCount++; _local2.m_node1.joint = _local2; _local2.m_node1.other = _local2.m_body2; _local2.m_node1.prev = null; _local2.m_node1.next = _local2.m_body1.m_jointList; if (_local2.m_body1.m_jointList){ _local2.m_body1.m_jointList.prev = _local2.m_node1; }; _local2.m_body1.m_jointList = _local2.m_node1; _local2.m_node2.joint = _local2; _local2.m_node2.other = _local2.m_body1; _local2.m_node2.prev = null; _local2.m_node2.next = _local2.m_body2.m_jointList; if (_local2.m_body2.m_jointList){ _local2.m_body2.m_jointList.prev = _local2.m_node2; }; _local2.m_body2.m_jointList = _local2.m_node2; if (_arg1.collideConnected == false){ _local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2; _local4 = _local3.m_shapeList; while (_local4) { _local4.ResetProxy(m_broadPhase, _local3.m_xf); _local4 = _local4.m_next; }; }; return (_local2); } public function DestroyJoint(_arg1:b2Joint):void{ var _local5:b2Body; var _local6:b2Shape; var _local2:Boolean = _arg1.m_collideConnected; if (_arg1.m_prev){ _arg1.m_prev.m_next = _arg1.m_next; }; if (_arg1.m_next){ _arg1.m_next.m_prev = _arg1.m_prev; }; if (_arg1 == m_jointList){ m_jointList = _arg1.m_next; }; var _local3:b2Body = _arg1.m_body1; var _local4:b2Body = _arg1.m_body2; _local3.WakeUp(); _local4.WakeUp(); if (_arg1.m_node1.prev){ _arg1.m_node1.prev.next = _arg1.m_node1.next; }; if (_arg1.m_node1.next){ _arg1.m_node1.next.prev = _arg1.m_node1.prev; }; if (_arg1.m_node1 == _local3.m_jointList){ _local3.m_jointList = _arg1.m_node1.next; }; _arg1.m_node1.prev = null; _arg1.m_node1.next = null; if (_arg1.m_node2.prev){ _arg1.m_node2.prev.next = _arg1.m_node2.next; }; if (_arg1.m_node2.next){ _arg1.m_node2.next.prev = _arg1.m_node2.prev; }; if (_arg1.m_node2 == _local4.m_jointList){ _local4.m_jointList = _arg1.m_node2.next; }; _arg1.m_node2.prev = null; _arg1.m_node2.next = null; b2Joint.Destroy(_arg1, m_blockAllocator); m_jointCount--; if (_local2 == false){ _local5 = ((_local3.m_shapeCount < _local4.m_shapeCount)) ? _local3 : _local4; _local6 = _local5.m_shapeList; while (_local6) { _local6.ResetProxy(m_broadPhase, _local5.m_xf); _local6 = _local6.m_next; }; }; } public function SetFilter(_arg1:b2ContactFilter):void{ m_contactFilter = _arg1; } public function SetBoundaryListener(_arg1:b2BoundaryListener):void{ m_boundaryListener = _arg1; } public function SetDestructionListener(_arg1:b2DestructionListener):void{ m_destructionListener = _arg1; } public function CreateStaticBody(_arg1:b2BodyDef):b2Body{ if (m_lock == true){ return (null); }; var _local2:b2Body = new b2Body(_arg1, b2Body.e_staticType, 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 Step(_arg1:Number, _arg2:int):void{ m_lock = true; var _local3:b2TimeStep = new b2TimeStep(); _local3.dt = _arg1; _local3.maxIterations = _arg2; if (_arg1 > 0){ _local3.inv_dt = (1 / _arg1); } else { _local3.inv_dt = 0; }; m_contactManager.Collide(); if (_local3.dt > 0){ Solve(_local3); }; if (((s_enableTOI) && ((_local3.dt > 0)))){ SolveTOI(_local3); }; DrawDebugData(); m_lock = false; } } }//package Box2D.Dynamics
Section 75
//ColorShortcuts (caurina.transitions.properties.ColorShortcuts) package caurina.transitions.properties { import flash.geom.*; import caurina.transitions.*; import flash.filters.*; public class ColorShortcuts { private static var LUMINANCE_B:Number = 0.072169; private static var LUMINANCE_G:Number = 0.71516; private static var LUMINANCE_R:Number = 0.212671; public function ColorShortcuts(){ trace("This is an static class and should not be instantiated."); } public static function _color_splitter(_arg1, _arg2:Array):Array{ var _local3:Array = new Array(); if (_arg1 == null){ _local3.push({name:"_color_redMultiplier", value:1}); _local3.push({name:"_color_redOffset", value:0}); _local3.push({name:"_color_greenMultiplier", value:1}); _local3.push({name:"_color_greenOffset", value:0}); _local3.push({name:"_color_blueMultiplier", value:1}); _local3.push({name:"_color_blueOffset", value:0}); } else { _local3.push({name:"_color_redMultiplier", value:0}); _local3.push({name:"_color_redOffset", value:AuxFunctions.numberToR(_arg1)}); _local3.push({name:"_color_greenMultiplier", value:0}); _local3.push({name:"_color_greenOffset", value:AuxFunctions.numberToG(_arg1)}); _local3.push({name:"_color_blueMultiplier", value:0}); _local3.push({name:"_color_blueOffset", value:AuxFunctions.numberToB(_arg1)}); }; return (_local3); } public static function _contrast_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{ var _local5:Number; var _local6:Number; _local5 = (_arg2 + 1); _local6 = Math.round((_arg2 * -128)); var _local7:ColorTransform = new ColorTransform(_local5, _local5, _local5, 1, _local6, _local6, _local6, 0); _arg1.transform.colorTransform = _local7; } public static function _brightness_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{ var _local4:Boolean = _arg2[0]; var _local5:ColorTransform = _arg1.transform.colorTransform; var _local6:Number = (1 - (((_local5.redMultiplier + _local5.greenMultiplier) + _local5.blueMultiplier) / 3)); var _local7:Number = (((_local5.redOffset + _local5.greenOffset) + _local5.blueOffset) / 3); if (_local4){ return (((_local7 > 0)) ? (_local7 / 0xFF) : -(_local6)); //unresolved jump }; return ((_local7 / 100)); } public static function _saturation_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{ var _local4:Array = getObjectMatrix(_arg1); var _local5:Boolean = _arg2[0]; var _local6:Number = (_local5) ? (1 / 3) : LUMINANCE_R; var _local7:Number = (_local5) ? (1 / 3) : LUMINANCE_G; var _local8:Number = (_local5) ? (1 / 3) : LUMINANCE_B; var _local9:Number = (((((_local4[0] - _local6) / (1 - _local6)) + ((_local4[6] - _local7) / (1 - _local7))) + ((_local4[12] - _local8) / (1 - _local8))) / 3); var _local10:Number = (1 - (((((((_local4[1] / _local7) + (_local4[2] / _local8)) + (_local4[5] / _local6)) + (_local4[7] / _local8)) + (_local4[10] / _local6)) + (_local4[11] / _local7)) / 6)); return (((_local9 + _local10) / 2)); } public static function _oldColor_property_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{ return ((_arg1.transform.colorTransform[_arg2[0]] * 100)); } public static function _brightness_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{ var _local6:Number; var _local7:Number; var _local5:Boolean = _arg3[0]; if (_local5){ _local6 = (1 - Math.abs(_arg2)); _local7 = ((_arg2 > 0)) ? Math.round((_arg2 * 0xFF)) : 0; } else { _local6 = 1; _local7 = Math.round((_arg2 * 100)); }; var _local8:ColorTransform = new ColorTransform(_local6, _local6, _local6, 1, _local7, _local7, _local7, 0); _arg1.transform.colorTransform = _local8; } public static function _saturation_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{ var _local5:Boolean = _arg3[0]; var _local6:Number = (_local5) ? (1 / 3) : LUMINANCE_R; var _local7:Number = (_local5) ? (1 / 3) : LUMINANCE_G; var _local8:Number = (_local5) ? (1 / 3) : LUMINANCE_B; var _local9:Number = _arg2; var _local10:Number = (1 - _local9); var _local11:Number = (_local6 * _local10); var _local12:Number = (_local7 * _local10); var _local13:Number = (_local8 * _local10); var _local14:Array = [(_local11 + _local9), _local12, _local13, 0, 0, _local11, (_local12 + _local9), _local13, 0, 0, _local11, _local12, (_local13 + _local9), 0, 0, 0, 0, 0, 1, 0]; setObjectMatrix(_arg1, _local14); } private static function getObjectMatrix(_arg1:Object):Array{ var _local2:Number = 0; while (_local2 < _arg1.filters.length) { if ((_arg1.filters[_local2] is ColorMatrixFilter)){ return (_arg1.filters[_local2].matrix.concat()); }; _local2++; }; return ([1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0]); } public static function getHueDistance(_arg1:Array, _arg2:Array):Number{ return (((Math.abs((_arg1[0] - _arg2[0])) + Math.abs((_arg1[1] - _arg2[1]))) + Math.abs((_arg1[2] - _arg2[2])))); } public static function _hue_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{ setObjectMatrix(_arg1, getHueMatrix(_arg2)); } public static function _hue_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{ var _local6:Number; var _local8:Number; var _local4:Array = getObjectMatrix(_arg1); var _local5:Array = []; _local5[0] = {angle:-179.9, matrix:getHueMatrix(-179.9)}; _local5[1] = {angle:180, matrix:getHueMatrix(180)}; _local6 = 0; while (_local6 < _local5.length) { _local5[_local6].distance = getHueDistance(_local4, _local5[_local6].matrix); _local6++; }; var _local7:Number = 15; _local6 = 0; while (_local6 < _local7) { if (_local5[0].distance < _local5[1].distance){ _local8 = 1; } else { _local8 = 0; }; _local5[_local8].angle = ((_local5[0].angle + _local5[1].angle) / 2); _local5[_local8].matrix = getHueMatrix(_local5[_local8].angle); _local5[_local8].distance = getHueDistance(_local4, _local5[_local8].matrix); _local6++; }; return (_local5[_local8].angle); } public static function getHueMatrix(_arg1:Number):Array{ var _local2:Number = ((_arg1 * Math.PI) / 180); var _local3:Number = LUMINANCE_R; var _local4:Number = LUMINANCE_G; var _local5:Number = LUMINANCE_B; var _local6:Number = Math.cos(_local2); var _local7:Number = Math.sin(_local2); var _local8:Array = [((_local3 + (_local6 * (1 - _local3))) + (_local7 * -(_local3))), ((_local4 + (_local6 * -(_local4))) + (_local7 * -(_local4))), ((_local5 + (_local6 * -(_local5))) + (_local7 * (1 - _local5))), 0, 0, ((_local3 + (_local6 * -(_local3))) + (_local7 * 0.143)), ((_local4 + (_local6 * (1 - _local4))) + (_local7 * 0.14)), ((_local5 + (_local6 * -(_local5))) + (_local7 * -0.283)), 0, 0, ((_local3 + (_local6 * -(_local3))) + (_local7 * -((1 - _local3)))), ((_local4 + (_local6 * -(_local4))) + (_local7 * _local4)), ((_local5 + (_local6 * (1 - _local5))) + (_local7 * _local5)), 0, 0, 0, 0, 0, 1, 0]; return (_local8); } public static function _color_property_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{ return (_arg1.transform.colorTransform[_arg2[0]]); } public static function init():void{ Tweener.registerSpecialProperty("_color_ra", _oldColor_property_get, _oldColor_property_set, ["redMultiplier"]); Tweener.registerSpecialProperty("_color_rb", _color_property_get, _color_property_set, ["redOffset"]); Tweener.registerSpecialProperty("_color_ga", _oldColor_property_get, _oldColor_property_set, ["greenMultiplier"]); Tweener.registerSpecialProperty("_color_gb", _color_property_get, _color_property_set, ["greenOffset"]); Tweener.registerSpecialProperty("_color_ba", _oldColor_property_get, _oldColor_property_set, ["blueMultiplier"]); Tweener.registerSpecialProperty("_color_bb", _color_property_get, _color_property_set, ["blueOffset"]); Tweener.registerSpecialProperty("_color_aa", _oldColor_property_get, _oldColor_property_set, ["alphaMultiplier"]); Tweener.registerSpecialProperty("_color_ab", _color_property_get, _color_property_set, ["alphaOffset"]); Tweener.registerSpecialProperty("_color_redMultiplier", _color_property_get, _color_property_set, ["redMultiplier"]); Tweener.registerSpecialProperty("_color_redOffset", _color_property_get, _color_property_set, ["redOffset"]); Tweener.registerSpecialProperty("_color_greenMultiplier", _color_property_get, _color_property_set, ["greenMultiplier"]); Tweener.registerSpecialProperty("_color_greenOffset", _color_property_get, _color_property_set, ["greenOffset"]); Tweener.registerSpecialProperty("_color_blueMultiplier", _color_property_get, _color_property_set, ["blueMultiplier"]); Tweener.registerSpecialProperty("_color_blueOffset", _color_property_get, _color_property_set, ["blueOffset"]); Tweener.registerSpecialProperty("_color_alphaMultiplier", _color_property_get, _color_property_set, ["alphaMultiplier"]); Tweener.registerSpecialProperty("_color_alphaOffset", _color_property_get, _color_property_set, ["alphaOffset"]); Tweener.registerSpecialPropertySplitter("_color", _color_splitter); Tweener.registerSpecialPropertySplitter("_colorTransform", _colorTransform_splitter); Tweener.registerSpecialProperty("_brightness", _brightness_get, _brightness_set, [false]); Tweener.registerSpecialProperty("_tintBrightness", _brightness_get, _brightness_set, [true]); Tweener.registerSpecialProperty("_contrast", _contrast_get, _contrast_set); Tweener.registerSpecialProperty("_hue", _hue_get, _hue_set); Tweener.registerSpecialProperty("_saturation", _saturation_get, _saturation_set, [false]); Tweener.registerSpecialProperty("_dumbSaturation", _saturation_get, _saturation_set, [true]); } private static function setObjectMatrix(_arg1:Object, _arg2:Array):void{ var _local6:ColorMatrixFilter; var _local3:Array = _arg1.filters.concat(); var _local4:Boolean; var _local5:Number = 0; while (_local5 < _local3.length) { if ((_local3[_local5] is ColorMatrixFilter)){ _local3[_local5].matrix = _arg2.concat(); _local4 = true; }; _local5++; }; if (!_local4){ _local6 = new ColorMatrixFilter(_arg2); _local3[_local3.length] = _local6; }; _arg1.filters = _local3; } public static function _color_property_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{ var _local5:ColorTransform = _arg1.transform.colorTransform; _local5[_arg3[0]] = _arg2; _arg1.transform.colorTransform = _local5; } public static function _oldColor_property_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{ var _local5:ColorTransform = _arg1.transform.colorTransform; _local5[_arg3[0]] = (_arg2 / 100); _arg1.transform.colorTransform = _local5; } public static function _contrast_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{ var _local5:Number; var _local6:Number; var _local4:ColorTransform = _arg1.transform.colorTransform; _local5 = ((((_local4.redMultiplier + _local4.greenMultiplier) + _local4.blueMultiplier) / 3) - 1); _local6 = ((((_local4.redOffset + _local4.greenOffset) + _local4.blueOffset) / 3) / -128); return (((_local5 + _local6) / 2)); } public static function _colorTransform_splitter(_arg1:Object, _arg2:Array):Array{ var _local3:Array = new Array(); if (_arg1 == null){ _local3.push({name:"_color_redMultiplier", value:1}); _local3.push({name:"_color_redOffset", value:0}); _local3.push({name:"_color_greenMultiplier", value:1}); _local3.push({name:"_color_greenOffset", value:0}); _local3.push({name:"_color_blueMultiplier", value:1}); _local3.push({name:"_color_blueOffset", value:0}); } else { if (_arg1.ra != undefined){ _local3.push({name:"_color_ra", value:_arg1.ra}); }; if (_arg1.rb != undefined){ _local3.push({name:"_color_rb", value:_arg1.rb}); }; if (_arg1.ga != undefined){ _local3.push({name:"_color_ba", value:_arg1.ba}); }; if (_arg1.gb != undefined){ _local3.push({name:"_color_bb", value:_arg1.bb}); }; if (_arg1.ba != undefined){ _local3.push({name:"_color_ga", value:_arg1.ga}); }; if (_arg1.bb != undefined){ _local3.push({name:"_color_gb", value:_arg1.gb}); }; if (_arg1.aa != undefined){ _local3.push({name:"_color_aa", value:_arg1.aa}); }; if (_arg1.ab != undefined){ _local3.push({name:"_color_ab", value:_arg1.ab}); }; if (_arg1.redMultiplier != undefined){ _local3.push({name:"_color_redMultiplier", value:_arg1.redMultiplier}); }; if (_arg1.redOffset != undefined){ _local3.push({name:"_color_redOffset", value:_arg1.redOffset}); }; if (_arg1.blueMultiplier != undefined){ _local3.push({name:"_color_blueMultiplier", value:_arg1.blueMultiplier}); }; if (_arg1.blueOffset != undefined){ _local3.push({name:"_color_blueOffset", value:_arg1.blueOffset}); }; if (_arg1.greenMultiplier != undefined){ _local3.push({name:"_color_greenMultiplier", value:_arg1.greenMultiplier}); }; if (_arg1.greenOffset != undefined){ _local3.push({name:"_color_greenOffset", value:_arg1.greenOffset}); }; if (_arg1.alphaMultiplier != undefined){ _local3.push({name:"_color_alphaMultiplier", value:_arg1.alphaMultiplier}); }; if (_arg1.alphaOffset != undefined){ _local3.push({name:"_color_alphaOffset", value:_arg1.alphaOffset}); }; }; return (_local3); } } }//package caurina.transitions.properties
Section 76
//SoundShortcuts (caurina.transitions.properties.SoundShortcuts) package caurina.transitions.properties { import flash.media.*; import caurina.transitions.*; public class SoundShortcuts { public function SoundShortcuts(){ trace("This is an static class and should not be instantiated."); } public static function init():void{ Tweener.registerSpecialProperty("_sound_volume", _sound_volume_get, _sound_volume_set); Tweener.registerSpecialProperty("_sound_pan", _sound_pan_get, _sound_pan_set); } public static function _sound_pan_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{ var _local5:SoundTransform = _arg1.soundTransform; _local5.pan = _arg2; _arg1.soundTransform = _local5; } public static function _sound_volume_set(_arg1:Object, _arg2:Number, _arg3:Array, _arg4:Object=null):void{ var _local5:SoundTransform = _arg1.soundTransform; _local5.volume = _arg2; _arg1.soundTransform = _local5; } public static function _sound_pan_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{ return (_arg1.soundTransform.pan); } public static function _sound_volume_get(_arg1:Object, _arg2:Array, _arg3:Object=null):Number{ return (_arg1.soundTransform.volume); } } }//package caurina.transitions.properties
Section 77
//AuxFunctions (caurina.transitions.AuxFunctions) package caurina.transitions { public class AuxFunctions { public static function concatObjects(... _args):Object{ var _local3:Object; var _local5:String; var _local2:Object = {}; var _local4:int; 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 = _arg2.length; var _local4:uint; while (_local4 < _local3) { if (_arg2[_local4] == _arg1){ return (true); }; _local4++; }; return (false); } public static function getObjectLength(_arg1:Object):uint{ var _local3:String; var _local2:uint; for (_local3 in _arg1) { _local2++; }; return (_local2); } public static function numberToB(_arg1:Number):Number{ return ((_arg1 & 0xFF)); } } }//package caurina.transitions
Section 78
//Equations (caurina.transitions.Equations) package caurina.transitions { public class Equations { public function Equations(){ trace("Equations is a static class and should not be instantiated."); } 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 _local7:Number; if (_arg1 == 0){ return (_arg2); }; _arg1 = (_arg1 / (_arg4 / 2)); if (_arg1 == 2){ return ((_arg2 + _arg3)); }; var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * (0.3 * 1.5)) : _arg5.period; var _local8:Number = (((!(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 = (((!(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 = (((!(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 = (((!(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 _local7:Number; if (_arg1 == 0){ return (_arg2); }; _arg1 = (_arg1 / _arg4); if (_arg1 == 1){ return ((_arg2 + _arg3)); }; var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period; var _local8:Number = (((!(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 _local7:Number; if (_arg1 == 0){ return (_arg2); }; _arg1 = (_arg1 / _arg4); if (_arg1 == 1){ return ((_arg2 + _arg3)); }; var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period; var _local8:Number = (((!(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 79
//PropertyInfoObj (caurina.transitions.PropertyInfoObj) package caurina.transitions { public class PropertyInfoObj { public var modifierParameters:Array; public var isSpecialProperty:Boolean; public var valueComplete:Number; public var modifierFunction:Function; public var extra:Object; public var valueStart:Number; public var hasModifier:Boolean; public var arrayIndex:Number; public var originalValueComplete:Object; 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 = "\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 = new PropertyInfoObj(valueStart, valueComplete, originalValueComplete, arrayIndex, extra, isSpecialProperty, modifierFunction, modifierParameters); return (_local1); } } }//package caurina.transitions
Section 80
//SpecialProperty (caurina.transitions.SpecialProperty) package caurina.transitions { public class SpecialProperty { public var parameters:Array; public var getValue:Function; public var preProcess:Function; public var setValue: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 = ""; _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 81
//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 = ""; _local1 = (_local1 + "[SpecialPropertyModifier "); _local1 = (_local1 + ("modifyValues:" + String(modifyValues))); _local1 = (_local1 + ", "); _local1 = (_local1 + ("getValue:" + String(getValue))); _local1 = (_local1 + "]"); return (_local1); } } }//package caurina.transitions
Section 82
//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 = ""; _local1 = (_local1 + "[SpecialPropertySplitter "); _local1 = (_local1 + ("splitValues:" + String(splitValues))); _local1 = (_local1 + ", "); _local1 = (_local1 + ("parameters:" + String(parameters))); _local1 = (_local1 + "]"); return (_local1); } } }//package caurina.transitions
Section 83
//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 function Tweener(){ trace("Tweener is a static class and should not be instantiated."); } public static function registerSpecialPropertyModifier(_arg1:String, _arg2:Function, _arg3:Function):void{ if (!_inited){ init(); }; var _local4:SpecialPropertyModifier = new SpecialPropertyModifier(_arg2, _arg3); _specialPropertyModifierList[_arg1] = _local4; } public static function registerSpecialProperty(_arg1:String, _arg2:Function, _arg3:Function, _arg4:Array=null, _arg5:Function=null):void{ if (!_inited){ init(); }; var _local6:SpecialProperty = 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 _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]; }; var _local5:Object = _arg2; if (!_inited){ init(); }; if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){ startEngine(); }; var _local6:Number = (isNaN(_local5.time)) ? 0 : _local5.time; var _local7:Number = (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 _local2:uint; if (!Boolean(_tweenList)){ return (false); }; var _local1:Boolean; _local2 = 0; while (_local2 < _tweenList.length) { pauseTweenByIndex(_local2); _local1 = true; _local2++; }; return (_local1); } public static function removeTweens(_arg1:Object, ... _args):Boolean{ var _local4:uint; var _local3:Array = 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 _local5:uint; var _local6:String; var _local7:Boolean; var _local3:TweenListObj = _tweenList[_arg1]; var _local4:TweenListObj = _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 = _tweenList[_arg1]; if ((((_local2 == null)) || (!(_local2.isPaused)))){ return (false); }; var _local3:Number = 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{ updateTime(); updateFrame(); var _local2:Boolean; _local2 = updateTweens(); if (!_local2){ stopEngine(); }; } public static function updateTime():void{ _currentTime = getTimer(); } private static function updateTweenByIndex(_arg1:Number):Boolean{ var tTweening:TweenListObj; 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 tProperty:Object; var pv:Number; var i = _arg1; tTweening = _tweenList[i]; if ((((tTweening == null)) || (!(Boolean(tTweening.scope))))){ return (false); }; var isOver:Boolean; var cTime:Number = 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 _local2:uint; if (!Boolean(_tweenList)){ return (false); }; var _local1:Boolean; _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(); __tweener_controller__.addEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame); _currentTimeFrame = 0; updateTime(); } public static function removeAllTweens():Boolean{ var _local2:uint; if (!Boolean(_tweenList)){ return (false); }; var _local1:Boolean; _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 _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]; }; var _local7:Object = TweenListObj.makePropertiesChain(_arg2); if (!_inited){ init(); }; if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){ startEngine(); }; var _local8:Number = (isNaN(_local7.time)) ? 0 : _local7.time; var _local9:Number = (isNaN(_local7.delay)) ? 0 : _local7.delay; var _local10:Array = new Array(); var _local11:Object = {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}; var _local12:Object = 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{ trace(("## [Tweener] Error: " + _arg1)); } private static function affectTweens(_arg1:Function, _arg2:Object, _arg3:Array):Boolean{ var _local5:uint; var _local6:Array; var _local7:uint; var _local8:uint; var _local9:uint; var _local4:Boolean; 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; if (!Boolean(_tweenList)){ return ([]); }; var _local4:Array = 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 = _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; if (!Boolean(_tweenList)){ return (0); }; var _local3:Number = 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__.removeEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame); __tweener_controller__ = null; } public static function removeTweensByTime(_arg1:Object, _arg2:Object, _arg3:Number, _arg4:Number):Boolean{ var removedLocally:Boolean; var i:uint; var pName:String; var eventScope:Object; var p_scope = _arg1; var p_properties = _arg2; var p_timeStart = _arg3; var p_timeComplete = _arg4; var removed:Boolean; var tl:uint = _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{ if (!_inited){ init(); }; var _local4:SpecialPropertySplitter = 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 _local4:uint; var _local3:Array = 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 _local4:uint; var _local3:Array = 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 84
//TweenListObj (caurina.transitions.TweenListObj) package caurina.transitions { public class TweenListObj { public var hasStarted:Boolean; public var onUpdate:Function; public var useFrames:Boolean; public var count:Number; public var onOverwriteParams:Array; public var timeStart: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 isCaller:Boolean; public var timePaused:Number; public var transition:Function; public var onCompleteParams:Array; public var onError:Function; public var timesCalled:Number; 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 _local3:String; var _local2:TweenListObj = 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 _local3:String; var _local1 = "\n[TweenListObj "; _local1 = (_local1 + ("scope:" + String(scope))); _local1 = (_local1 + ", properties:"); var _local2:Boolean; 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 _local3:Object; var _local4:Object; var _local5:Object; var _local6:Number; var _local7:Number; var _local8:Number; var _local2:Object = _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 85
//IPublisher (com.luminicbox.log.IPublisher) package com.luminicbox.log { public interface IPublisher { function toString():String; function publish(_arg1:LogEvent):void; } }//package com.luminicbox.log
Section 86
//Level (com.luminicbox.log.Level) package com.luminicbox.log { public class Level { private var _value:Number; private var _name:String; public static var ALL:Level = new Level("ALL", 1); ; public static var LOG:Level = new Level("LOG", 1); ; public static var FATAL:Level = new Level("FATAL", 32); ; public static var WARN:Level = new Level("WARN", 8); ; public static var INFO:Level = new Level("INFO", 4); ; public static var ERROR:Level = new Level("ERROR", 16); ; public static var DEBUG:Level = new Level("DEBUG", 2); ; public static var NONE:Level = new Level("NONE", 0x0400); ; public function Level(_arg1:String, _arg2:Number){ this._name = _arg1; this._value = _arg2; } public function getName():String{ return (_name); } public function toString():String{ return (getName()); } public function getValue():Number{ return (_value); } } }//package com.luminicbox.log
Section 87
//LogEvent (com.luminicbox.log.LogEvent) package com.luminicbox.log { public class LogEvent { public var level:Level; public var loggerId:String; public var argument:Object; public var time:Date; public function LogEvent(_arg1:String, _arg2:Object, _arg3:Level){ this.loggerId = _arg1; this.argument = _arg2; this.level = _arg3; time = new Date(); } public static function serialize(_arg1:LogEvent):Object{ var _local2:Object = new Object(); _local2.loggerId = _arg1.loggerId; _local2.time = _arg1.time; _local2.levelName = _arg1.level.getName(); _local2.argument = _arg1.argument; return (_local2); } public static function deserialize(_arg1:Object):LogEvent{ var _local2:Level = Level[("" + _arg1.levelName)]; var _local3:LogEvent = new LogEvent(_arg1.loggerId, _arg1.argument, _local2); _local3.time = _arg1.time; return (_local3); } } }//package com.luminicbox.log
Section 88
//Logger (com.luminicbox.log.Logger) package com.luminicbox.log { public class Logger { private var _level:Level; private var _loggerId:String; private var _publishers:Array; private var _filters:Array; public function Logger(_arg1:String=""){ if (_arg1.length > 0){ this._loggerId = _arg1; }; this._level = Level.LOG; _publishers = new Array(); _filters = new Array(); } public function setLevel(_arg1:Level):void{ _level = _arg1; } public function log(_arg1:Object):void{ publish(_arg1, Level.LOG); } public function warn(_arg1:Object):void{ publish(_arg1, Level.WARN); } public function error(_arg1:Object):void{ publish(_arg1, Level.ERROR); } public function fatal(_arg1:Object):void{ publish(_arg1, Level.FATAL); } public function getPublishers():Array{ return (_publishers); } public function info(_arg1:Object):void{ publish(_arg1, Level.INFO); } private function publish(_arg1:Object, _arg2:Level):void{ var _local3:LogEvent; var _local4:String; if (_arg2.getValue() >= _level.getValue()){ _local3 = new LogEvent(this._loggerId, _arg1, _arg2); for (_local4 in _publishers) { IPublisher(_publishers[_local4]).publish(_local3); }; }; } public function debug(_arg1:Object):void{ publish(_arg1, Level.DEBUG); } public function addPublisher(_arg1:IPublisher):void{ if (!_publishers[_arg1.toString()]){ _publishers[_arg1.toString()] = _arg1; }; } public function removePublisher(_arg1:IPublisher):void{ delete _publishers[_arg1.toString()]; } } }//package com.luminicbox.log
Section 89
//MainParticles (com.midasplayer.particle.MainParticles) package com.midasplayer.particle { import flash.events.*; import flash.display.*; public class MainParticles extends Sprite { private var minAlpha:Number;// = 0.01 private var maxSize:Number;// = 29 private var numParticles:int;// = 20 private var maxXVel:Number;// = 1 private var minYVel:Number;// = -1 private var maxAlpha:Number;// = 0.02 private var maxYVel:Number;// = 1 private var particles:Array; private var emitter; private var minXVel:Number;// = -1 private var minSize:Number;// = 12 private var SparkClass:Class; public function MainParticles(){ particles = new Array(); SparkClass = MainParticles_SparkClass; super(); addEventListener(Event.ENTER_FRAME, enterFrame); } public function kill():void{ removeEventListener(Event.ENTER_FRAME, enterFrame); var _local1:Number = 0; while (_local1 < particles.length) { particles[_local1].destroy(); _local1++; }; } private function randRange(_arg1:Number, _arg2:Number):Number{ var _local3:Number = ((Math.random() * (_arg2 - _arg1)) + _arg1); return (_local3); } public function setEmitterClip(_arg1):void{ emitter = _arg1; } private function createNewParticle():void{ var _local1:* = new Particle(SparkClass, emitter, -10, -7, stage.stageWidth, stage.stageHeight); _local1.setVel(randRange(minXVel, maxXVel), randRange(minYVel, maxYVel)); _local1.setSize(randRange(minSize, maxSize)); particles.push(_local1); while (particles.length > numParticles) { _local1 = particles.shift(); _local1.destroy(); }; var _local2:Number = 0; while (_local2 < particles.length) { particles[_local2].update(); _local2++; }; } private function enterFrame(_arg1:Event){ createNewParticle(); } } }//package com.midasplayer.particle
Section 90
//MainParticles_SparkClass (com.midasplayer.particle.MainParticles_SparkClass) package com.midasplayer.particle { import flash.display.*; import mx.core.*; public class MainParticles_SparkClass extends MovieClipAsset { public var bar:DisplayObject; public var dragonHolder:DisplayObject; public var back:DisplayObject; public var adBox:DisplayObject; public var bg:DisplayObject; public var fireLogoHolder:DisplayObject; public var continue_bt:DisplayObject; public var mcPlayBtn:DisplayObject; public var bannedSign:DisplayObject; public var adsHolder:DisplayObject; public var play_bt:DisplayObject; public var barHolder:DisplayObject; } }//package com.midasplayer.particle
Section 91
//Particle (com.midasplayer.particle.Particle) package com.midasplayer.particle { import flash.display.*; import flash.geom.*; public class Particle { private var _yVel:Number; private var _xVel:Number; private var _stageWidth:Number; private var _stageHeight:Number; private var _alphaDecr:Number;// = 0 private var clip:DisplayObject; public function Particle(_arg1:Class, _arg2:DisplayObjectContainer, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number){ _stageWidth = _arg5; _stageHeight = _arg6; clip = new (_arg1); _arg2.addChild(clip); clip.x = _arg3; clip.y = _arg4; } public function update(){ clip.x = (clip.x + _xVel); clip.y = (clip.y + _yVel); clip.alpha = (clip.alpha - _alphaDecr); } public function setSize(_arg1:Number){ clip.width = _arg1; clip.height = _arg1; } public function setColour(_arg1:Number){ var _local2:ColorTransform = new ColorTransform(); _local2.color = _arg1; clip.transform.colorTransform = _local2; } public function setAlphaDecr(_arg1:Number):void{ _alphaDecr = _arg1; } public function destroy():void{ clip.parent.removeChild(clip); clip = null; } public function setVel(_arg1:Number, _arg2:Number){ _xVel = _arg1; _yVel = _arg2; } } }//package com.midasplayer.particle
Section 92
//DragonLoader (com.midasplayer.DragonLoader) package com.midasplayer { import flash.events.*; import caurina.transitions.*; import flash.display.*; import flash.media.*; import flash.utils.*; public class DragonLoader extends Sprite { private var bannedSignBack:Sprite; private var m_fireLogoClip:MovieClip; private var oldFrameRate:int; private var WindowClass:Class; private var m_bannedSign:Sprite; private var m_dragonClip:MovieClip; private var m_bg:Sprite; private var m_glimmer:Sprite; private var GlimmerClass:Class; private var window:Sprite; private var SndBellClass:Class; private var m_playBtn:MovieClip; private var m_sndBell:Sound; public static var LAUNCH_GAME:String = "launchGame"; public function DragonLoader(){ WindowClass = DragonLoader_WindowClass; SndBellClass = DragonLoader_SndBellClass; GlimmerClass = DragonLoader_GlimmerClass; super(); window = new WindowClass(); addChild(window); } public function destroy():void{ m_playBtn.removeEventListener(MouseEvent.ROLL_OVER, btnOver); m_playBtn.removeEventListener(MouseEvent.ROLL_OUT, btnOut); m_playBtn.removeEventListener(MouseEvent.MOUSE_DOWN, btnDown); m_playBtn.removeEventListener(MouseEvent.MOUSE_UP, launchGame); this.parent.removeChild(this); } public function onMainMovie(_arg1:MouseEvent):void{ KingAPI.openLoaderMovieLink(); } public function showBannedScreen():void{ m_bannedSign.alpha = 1; } public function playLoaderMovie():void{ m_dragonClip.addEventListener(Event.ENTER_FRAME, animationDone); m_dragonClip.play(); } private function btnOut(_arg1:MouseEvent):void{ m_playBtn.gotoAndStop("idle"); } private function fireEfHandler(_arg1:Event):void{ if (m_fireLogoClip.currentFrame == m_fireLogoClip.totalFrames){ m_fireLogoClip.stop(); m_fireLogoClip.removeEventListener(Event.ENTER_FRAME, fireEfHandler); }; } private function logoVisible(_arg1:Event):void{ if (m_fireLogoClip.currentFrame == m_fireLogoClip.totalFrames){ m_fireLogoClip.removeEventListener(Event.ENTER_FRAME, logoVisible); m_playBtn.alpha = 0; Tweener.addTween(m_playBtn, {alpha:1, time:0.5}); m_glimmer = new GlimmerClass(); m_glimmer.x = (m_fireLogoClip.x - m_glimmer.width); m_glimmer.y = (m_fireLogoClip.y + 112); this.addChild(m_glimmer); setTimeout(onGlimmerTmr, 1000, null); }; } public function launchGame(_arg1:Event):void{ root.stage.frameRate = oldFrameRate; trace(LAUNCH_GAME); this.dispatchEvent(new Event(LAUNCH_GAME)); destroy(); } private function btnDown(_arg1:MouseEvent):void{ m_playBtn.gotoAndStop("down"); } private function glimmerDone():void{ this.removeChild(m_glimmer); } public function animationDone(_arg1:Event):void{ if (m_dragonClip.currentFrame == 80){ m_fireLogoClip.visible = true; m_fireLogoClip.play(); m_fireLogoClip.addEventListener(Event.ENTER_FRAME, fireEfHandler); Tweener.addTween(m_fireLogoClip, {x:(((stage.width / 2) - (m_dragonClip.width / 2)) - 51), time:1, onComplete:logoInPlace}); }; if (m_dragonClip.currentFrame == m_dragonClip.totalFrames){ m_dragonClip.removeEventListener(Event.ENTER_FRAME, animationDone); m_dragonClip.stop(); m_playBtn.x = ((stage.width / 2) - (m_playBtn.width / 2)); m_playBtn.y = (m_fireLogoClip.y + 210); m_playBtn.addEventListener(MouseEvent.ROLL_OVER, btnOver); m_playBtn.addEventListener(MouseEvent.ROLL_OUT, btnOut); m_playBtn.addEventListener(MouseEvent.MOUSE_DOWN, btnDown); m_playBtn.addEventListener(MouseEvent.MOUSE_UP, launchGame); }; } public function init(_arg1:String, _arg2:String=""):void{ m_bannedSign = (window.getChildByName("bannedSign") as Sprite); bannedSignBack = (m_bannedSign.getChildByName("bg") as Sprite); bannedSignBack.width = stage.stageWidth; bannedSignBack.height = stage.stageHeight; m_bannedSign.alpha = 0; m_bannedSign.addEventListener(MouseEvent.CLICK, onMainMovie); m_bannedSign.buttonMode = true; m_fireLogoClip = (window.getChildByName("fireLogoHolder") as MovieClip); m_fireLogoClip.x = ((bannedSignBack.width - m_fireLogoClip.width) - 90); m_fireLogoClip.y = (((bannedSignBack.height / 2) - (m_fireLogoClip.height / 2)) - 60); m_fireLogoClip.visible = false; m_fireLogoClip.stop(); m_dragonClip = (window.getChildByName("dragonHolder") as MovieClip); m_dragonClip.x = (bannedSignBack.width - m_dragonClip.width); m_dragonClip.y = ((bannedSignBack.height / 2) - (m_dragonClip.height / 2)); m_dragonClip.stop(); m_playBtn = (window.getChildByName("mcPlayBtn") as MovieClip); m_playBtn.buttonMode = true; m_playBtn.alpha = 0; m_playBtn.stop(); m_sndBell = new SndBellClass(); if (_arg2 != ""){ MochiBot.track(this, _arg2); }; oldFrameRate = root.stage.frameRate; root.stage.frameRate = 30; if (KingAPI.banned){ showBannedScreen(); } else { if (!Factory.VERSION_MYGAME){ playLoaderMovie(); } else { SoundMixer.stopAll(); launchGame(null); }; }; } private function btnOver(_arg1:MouseEvent):void{ m_playBtn.gotoAndStop("over"); } private function logoInPlace():void{ m_fireLogoClip.addEventListener(Event.ENTER_FRAME, logoVisible); } private function onGlimmerTmr(_arg1:Event):void{ var _local2:Number = (m_fireLogoClip.x - m_glimmer.width); var _local3:Number = ((m_fireLogoClip.x + m_fireLogoClip.width) - 80); m_glimmer.x = _local2; Tweener.addTween(m_glimmer, {x:_local3, time:0.5, onComplete:glimmerDone}); m_sndBell.play(); } } }//package com.midasplayer
Section 93
//DragonLoader_GlimmerClass (com.midasplayer.DragonLoader_GlimmerClass) package com.midasplayer { import flash.display.*; import mx.core.*; public class DragonLoader_GlimmerClass extends SpriteAsset { public var mcPlayBtn:DisplayObject; public var bg:DisplayObject; public var bannedSign:DisplayObject; public var fireLogoHolder:DisplayObject; public var dragonHolder:DisplayObject; } }//package com.midasplayer
Section 94
//DragonLoader_SndBellClass (com.midasplayer.DragonLoader_SndBellClass) package com.midasplayer { import flash.display.*; import mx.core.*; public class DragonLoader_SndBellClass extends SoundAsset { public var mcPlayBtn:DisplayObject; public var bg:DisplayObject; public var bannedSign:DisplayObject; public var fireLogoHolder:DisplayObject; public var dragonHolder:DisplayObject; } }//package com.midasplayer
Section 95
//DragonLoader_WindowClass (com.midasplayer.DragonLoader_WindowClass) package com.midasplayer { import flash.display.*; import mx.core.*; public class DragonLoader_WindowClass extends SpriteAsset { public var mcPlayBtn:DisplayObject; public var bg:DisplayObject; public var bannedSign:DisplayObject; public var fireLogoHolder:DisplayObject; public var dragonHolder:DisplayObject; } }//package com.midasplayer
Section 96
//KingAPI (com.midasplayer.KingAPI) package com.midasplayer { import flash.events.*; import flash.net.*; import flash.external.*; public class KingAPI { public static const LINK_TYPE_RIGHT_CLICK:String = "rightclick"; public static const USER_TYPE_SUBSCRIPTION:int = 3; public static const LINK_TYPE_HIGHSCORES:String = "highscores"; public static const LINK_TYPE_SIGN:String = "sign"; public static const INITIALIZED_EVENT:String = "initialized"; public static const LINK_TYPE_OTHER_GAMES:String = "other_games"; public static const USER_TYPE_REGISTERED:int = 1; private static const SAK:String = "ggfd7sday923mdsfd8csfds34"; private static const loadHomeParametersURL:String = "http://www.king.com/servlet/FreeGameServlet?action=load"; public static const LINK_TYPE_LOADER_MOVIE:String = "loader_movie"; private static const bounceURL:String = "http://www.mygame.com/king/bounce.jsp"; public static const LINK_TYPE_PROTECT:String = "protect"; public static const LINK_TYPE_ADD_GAME:String = "add_game"; public static const USER_TYPE_GOLD:int = 2; public static const USER_TYPE_UNREGISTERED:int = 0; public static const HOST_BANNED_EVENT:String = "hostBanned"; private static const SK:String = "vf78hxcsjak77cxzhjkwad87s"; private static const loadCountURL:String = "http://www.mygame.com/king/loadcount.jsp"; public static const LINK_TYPE_LOADER_PROGRESS:String = "loader_progress"; private static var check:String = null; public static var gameName:String; public static var banned:Boolean = false; protected static var dispatcher:EventDispatcher; public static var isHome:Boolean = false; private static var sessionID:String; private static var iscore:int = 123; public static var fromURL:String; private static var SSK:String = "ng43ui54hy35tdsnd6f54rews"; private static function loadUrlErrorHandler(_arg1:Event):void{ trace(("Unable to load url: " + _arg1)); } public static function resetScore():void{ iscore = 123; check = null; } public static function openOfflineProtectionLink():void{ openKingPage(LINK_TYPE_PROTECT); } public static function init(_arg1:String, _arg2:String):void{ var so:SharedObject; var rnd1:Number; var rnd2:Number; var name = _arg1; var from = _arg2; gameName = name; fromURL = from; var loadCounter:URLLoader = new URLLoader(); var reqvars:URLVariables = new URLVariables(); reqvars.game = gameName; reqvars.from = fromURL; try { so = SharedObject.getLocal("sessionId"); if (so.data.sessionID == null){ rnd1 = Math.abs(Math.floor((Math.random() * 4294967295))); rnd2 = Math.abs(Math.floor((Math.random() * 4294967295))); so.data.sessionID = (rnd1.toString(16) + rnd2.toString(16)); so.flush(); }; sessionID = so.data.sessionID; } catch(e:Error) { sessionID = "error"; }; reqvars.session = sessionID; var request:URLRequest = new URLRequest(((loadCountURL + "?") + reqvars.toString())); loadCounter.addEventListener(Event.COMPLETE, loadCountHandler); loadCounter.addEventListener(IOErrorEvent.IO_ERROR, loadUrlErrorHandler); loadCounter.addEventListener(SecurityErrorEvent.SECURITY_ERROR, loadUrlErrorHandler); try { loadCounter.load(request); } catch(error:Error) { trace(("Unable to load loadcount url: " + loadCountURL)); trace(error.message); }; } private static function loadHomeParametersHandler(_arg1:Event):void{ var _local2:URLLoader = URLLoader(_arg1.target); trace(("loadCounter.data" + _local2.data)); } public static function submitInternalScore():void{ checkScore(); var _local1:int = ((iscore - 123) / 2); submitScore(_local1); } public static function openOtherGamesLink():void{ openKingPage(LINK_TYPE_OTHER_GAMES); } public static function openKingPage(_arg1:String, _arg2:String=null):void{ var _local3:URLVariables = new URLVariables(); _local3.game = gameName; _local3.from = fromURL; _local3.type = _arg1; _local3.session = sessionID; if (_arg2 != null){ _local3.redirect = _arg2; }; var _local4 = "_blank"; if (isHome){ _local4 = "_top"; }; navigateToURL(new URLRequest(((bounceURL + "?") + _local3.toString())), _local4); } private static function loadCountHandler(_arg1:Event):void{ var vars:URLVariables; var event = _arg1; var loadCounter:URLLoader = URLLoader(event.target); trace(("loadCounter.data :" + loadCounter.data)); try { vars = new URLVariables(loadCounter.data); if (vars.h == "true"){ isHome = true; }; if (vars.b == "true"){ banned = true; dispatcher.dispatchEvent(new Event(HOST_BANNED_EVENT)); } else { dispatcher.dispatchEvent(new Event(INITIALIZED_EVENT)); }; trace((("::" + vars.h) + "::")); trace((("::" + vars.b) + "::")); } catch(e:Error) { trace(("Error reading data from loadcount url: " + e)); }; } public static function addEventListener(_arg1:String, _arg2:Function):void{ if (dispatcher == null){ dispatcher = new EventDispatcher(); }; dispatcher.addEventListener(_arg1, _arg2); } public static function openLoaderMovieLink():void{ openKingPage(LINK_TYPE_LOADER_MOVIE); } public static function removeEventListener(_arg1:String, _arg2:Function):void{ if (dispatcher == null){ return; }; dispatcher.removeEventListener(_arg1, _arg2); } public static function submitScore(_arg1:int):void{ var score = _arg1; var hash:String = md5.encrypt(((((score + ":") + gameName) + ":") + SSK)); try { if (isHome){ ExternalInterface.call("submitScore", score, hash); } else { openKingPage(LINK_TYPE_HIGHSCORES, ((((("game/" + gameName) + "/submit/") + score) + ":") + hash)); }; } catch(e:Error) { trace(e); }; } public static function submitLevel(_arg1:int):void{ var level = _arg1; var hash:String = md5.encrypt(((((level + ":") + gameName) + ":") + SSK)); trace("h: ", hash); try { if (isHome){ ExternalInterface.call("submitLevel", level, hash); }; } catch(e:Error) { trace(e); }; trace("ok"); } public static function openHighscoresLink():void{ openKingPage(LINK_TYPE_HIGHSCORES, (("game/" + gameName) + "/highscores")); } public static function openSignLink():void{ openKingPage(LINK_TYPE_SIGN); } public static function openRightClickLink():void{ openKingPage(LINK_TYPE_RIGHT_CLICK); } private static function checkScore():void{ if (check != null){ if (check != md5.encrypt(((((iscore + ":") + gameName) + ":") + SK))){ SSK = "ng41ui54hy35tdsnd6f54rews"; }; }; } public static function addScore(_arg1:int):int{ checkScore(); var _local2:int = ((iscore - 123) / 2); _local2 = (_local2 + _arg1); iscore = ((_local2 * 2) + 123); check = md5.encrypt(((((iscore + ":") + gameName) + ":") + SK)); return (_local2); } public static function openLoaderProgressLink():void{ openKingPage(LINK_TYPE_LOADER_PROGRESS); } public static function openAddToWebsiteLink():void{ openKingPage(LINK_TYPE_ADD_GAME, "website_content.jsp"); } public static function submitAchievement(_arg1:String):void{ var achievement = _arg1; var hash:String = md5.encrypt(((((achievement + ":") + gameName) + ":") + SAK)); try { if (isHome){ ExternalInterface.call("submitAchievement", achievement, hash); }; } catch(e:Error) { trace(e); }; } } }//package com.midasplayer
Section 97
//md5 (com.midasplayer.md5) package com.midasplayer { 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 _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; var _local3:Number = 1732584193; var _local4:Number = -271733879; var _local5:Number = -1732584194; var _local6:Number = 271733878; var _local7:Number = 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 = ""; var _local3:Number = 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 = ""; var _local3:Number = 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 _local3:Number; var _local2:Array = 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 _local4:Number; var _local2:String = (hexcase) ? "0123456789ABCDEF" : "0123456789abcdef"; var _local3 = ""; var _local5:Number = 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 _local6:Number; var _local7:Number; var _local2 = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; var _local3 = ""; var _local4:Number = _arg1.length; var _local5:Number = 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 = ((_arg1 & 0xFFFF) + (_arg2 & 0xFFFF)); var _local4:Number = (((_arg1 >> 16) + (_arg2 >> 16)) + (_local3 >> 16)); return (((_local4 << 16) | (_local3 & 0xFFFF))); } public static function str2rstr_utf8(_arg1:String):String{ var _local4:Number; var _local5:Number; var _local2 = ""; var _local3:Number = -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 = rstr2binl(_arg1); if (_local3.length > 16){ _local3 = binl_md5(_local3, (_arg1.length * 8)); }; var _local4:Array = Array(16); var _local5:Array = Array(16); var _local6:Number = 0; while (_local6 < 16) { _local4[_local6] = (_local3[_local6] ^ 909522486); _local5[_local6] = (_local3[_local6] ^ 1549556828); _local6++; }; var _local7:Array = 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 = ""; var _local3:Number = 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 _local5:Number; var _local6:Number; var _local7:Number; var _local8:Array; var _local3:Number = _arg2.length; var _local4:Array = []; var _local9:Array = 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; }; var _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 com.midasplayer
Section 98
//BagsSubControl (com.whirled.game.BagsSubControl) package com.whirled.game { import com.whirled.*; public class BagsSubControl extends AbstractSubControl { public static const SHOW_TO_ALL:int = 0; public function BagsSubControl(_arg1:AbstractControl){ super(_arg1); } protected function getFrom(_arg1:String, _arg2:int, _arg3:String, _arg4:int, _arg5:Boolean, _arg6:Function):void{ callHostCode("getFromCollection_v2", _arg1, _arg2, _arg3, _arg4, _arg5, _arg6); } public function pick(_arg1:String, _arg2:int, _arg3:String, _arg4:int=0):void{ getFrom(_arg1, _arg2, _arg3, _arg4, false, null); } public function addTo(_arg1:String, _arg2:Array):void{ populate(_arg1, _arg2, false); } public function merge(_arg1:String, _arg2:String):void{ callHostCode("mergeCollection_v1", _arg1, _arg2); } protected function populate(_arg1:String, _arg2:Array, _arg3:Boolean):void{ callHostCode("populateCollection_v1", _arg1, _arg2, _arg3); } public function deal(_arg1:String, _arg2:int, _arg3:String, _arg4:Function=null, _arg5:int=0):void{ getFrom(_arg1, _arg2, _arg3, _arg5, true, _arg4); } public function create(_arg1:String, _arg2:Array):void{ populate(_arg1, _arg2, true); } } }//package com.whirled.game
Section 99
//CoinsAwardedEvent (com.whirled.game.CoinsAwardedEvent) package com.whirled.game { import flash.events.*; public class CoinsAwardedEvent extends Event { protected var _amount:int; protected var _percentile:int; public static const COINS_AWARDED:String = "CoinsAwarded"; public function CoinsAwardedEvent(_arg1:int, _arg2:int){ super(COINS_AWARDED, false, true); _amount = _arg1; _percentile = _arg2; } public function get percentile():int{ return (_percentile); } public function get amount():int{ return (_amount); } override public function toString():String{ return ((((((("CoinsAwardedEvent [type=" + type) + ", amount=") + _amount) + ", percentile=") + _percentile) + "]")); } override public function clone():Event{ return (new CoinsAwardedEvent(_amount, _percentile)); } } }//package com.whirled.game
Section 100
//GameContentEvent (com.whirled.game.GameContentEvent) package com.whirled.game { import flash.events.*; public class GameContentEvent extends Event { protected var _playerId:int; protected var _contentType:String; protected var _contentIdent:String; public static const LEVEL_PACK:String = "level_pack"; public static const ITEM_PACK:String = "item_pack"; public static const PLAYER_CONTENT_ADDED:String = "PlayerContentAdded"; public function GameContentEvent(_arg1:String, _arg2:String, _arg3:String, _arg4:int=0){ super(_arg1); _contentType = _arg2; _contentIdent = _arg3; _playerId = _arg4; } public function get contentIdent():String{ return (_contentIdent); } public function get contentType():String{ return (_contentType); } override public function toString():String{ return ((((((((("[GameContentEvent type=" + type) + ", ctype=") + _contentType) + ", cident=") + _contentIdent) + ", pid=") + _playerId) + "]")); } public function get playerId():int{ return (_playerId); } override public function clone():Event{ return (new GameContentEvent(type, _contentType, _contentIdent, _playerId)); } } }//package com.whirled.game
Section 101
//GameControl (com.whirled.game.GameControl) package com.whirled.game { import flash.events.*; import flash.display.*; import com.whirled.*; public class GameControl extends AbstractControl { protected var _servicesCtrl:ServicesSubControl; protected var _netCtrl:NetSubControl; protected var _connected:Boolean; protected var _playerCtrl:PlayerSubControl; protected var _gameCtrl:GameSubControl; protected var _localCtrl:LocalSubControl; public static const LEVEL_PACK_SHOP:String = "level_packs"; public static const FURNITURE_SHOP:String = "furniture"; public static const ITEM_PACK_SHOP:String = "item_packs"; public static const PET_SHOP:String = "pets"; public static const TOY_SHOP:String = "toys"; public static const AVATAR_SHOP:String = "avatars"; public static const BACKDROP_SHOP:String = "backdrops"; public function GameControl(_arg1:DisplayObject, _arg2:Boolean=true){ super(_arg1, {autoReady_v1:_arg2}); _arg1.root.addEventListener(MouseEvent.CLICK, handleRootClick); } public function get player():PlayerSubControl{ return (_playerCtrl); } override protected function setUserProps(_arg1:Object):void{ super.setUserProps(_arg1); _arg1["connectionClosed_v1"] = connectionClosed_v1; } public function get services():ServicesSubControl{ return (_servicesCtrl); } public function get local():LocalSubControl{ return (_localCtrl); } private function connectionClosed_v1():void{ _connected = false; } public function get game():GameSubControl{ return (_gameCtrl); } override protected function createSubControls():Array{ return ([(_localCtrl = new LocalSubControl(this)), (_netCtrl = new NetSubControl(this)), (_playerCtrl = new PlayerSubControl(this)), (_gameCtrl = new GameSubControl(this)), (_servicesCtrl = new ServicesSubControl(this))]); } override protected function gotHostProps(_arg1:Object):void{ super.gotHostProps(_arg1); _connected = !((_arg1.gameData == null)); } public function get net():NetSubControl{ return (_netCtrl); } protected function handleRootClick(_arg1:MouseEvent):void{ var evt = _arg1; if (!isConnected()){ return; }; try { if ((((evt.target.stage == null)) || (!((evt.target.stage.focus == null))))){ return; }; } catch(err:SecurityError) { }; callHostCode("focusContainer_v1"); } override public function isConnected():Boolean{ return (_connected); } } }//package com.whirled.game
Section 102
//GameSubControl (com.whirled.game.GameSubControl) package com.whirled.game { import com.whirled.*; public class GameSubControl extends AbstractSubControl { protected var _gameConfig:Object; protected var _seatingCtrl:SeatingSubControl; public static const SERVER_AGENT_ID:int = -2147483648; public static const WINNERS_TAKE_ALL:int = 1; public static const PROPORTIONAL:int = 3; public static const TO_EACH_THEIR_OWN:int = 2; public static const CASCADING_PAYOUT:int = 0; public function GameSubControl(_arg1:GameControl){ _gameConfig = {}; super(_arg1); } public function loadLevelPackData(_arg1:String, _arg2:Function, _arg3:Function):void{ if (_arg2 == null){ throw (new Error("The onLoaded callback may not be null")); }; callHostCode("loadLevelPackData_v1", _arg1, _arg2, _arg3); } public function playerReady():void{ if (_seatingCtrl == null){ throw (new Error("playerReady() is only applicable to seated games.")); }; callHostCode("playerReady_v1"); } public function isInPlay():Boolean{ return (Boolean(callHostCode("isInPlay_v1"))); } public function getOccupantIds():Array{ return ((callHostCode("getOccupants_v1") as Array)); } public function endGameWithWinners(_arg1:Array, _arg2:Array, _arg3:int):void{ callHostCode("endGameWithWinners_v1", _arg1, _arg2, _arg3); } public function getTurnHolderId():int{ return (int(callHostCode("getTurnHolder_v1"))); } private function occupantChanged_v1(_arg1:int, _arg2:Boolean, _arg3:Boolean):void{ dispatch(new OccupantChangedEvent((_arg3) ? OccupantChangedEvent.OCCUPANT_ENTERED : OccupantChangedEvent.OCCUPANT_LEFT, _arg1, _arg2)); } public function getLevelPacks():Array{ return ((callHostCode("getLevelPacks_v2") as Array)); } public function getControllerId():int{ return (int(callHostCode("getControllerId_v1"))); } private function turnDidChange_v1():void{ dispatch(new StateChangedEvent(StateChangedEvent.TURN_CHANGED)); } public function startNextTurn(_arg1:int=0):void{ callHostCode("startNextTurn_v1", _arg1); } public function isMyTurn():Boolean{ return (Boolean(callHostCode("isMyTurn_v1"))); } public function endGameWithScores(_arg1:Array, _arg2:Array, _arg3:int, _arg4:int=0):void{ callHostCode("endGameWithScores_v1", _arg1, _arg2, _arg3, _arg4); } public function getRound():int{ return (int(callHostCode("getRound_v1"))); } public function loadItemPackData(_arg1:String, _arg2:Function, _arg3:Function):void{ if (_arg2 == null){ throw (new Error("The onLoaded callback may not be null")); }; callHostCode("loadItemPackData_v1", _arg1, _arg2, _arg3); } public function getMyId():int{ return (int(callHostCode("getMyId_v1"))); } public function getOccupantName(_arg1:int):String{ return (String(callHostCode("getOccupantName_v1", _arg1))); } public function systemMessage(_arg1:String):void{ callHostCode("sendChat_v1", _arg1); } override protected function setUserProps(_arg1:Object):void{ super.setUserProps(_arg1); _arg1["controlDidChange_v1"] = controlDidChange_v1; _arg1["turnDidChange_v1"] = turnDidChange_v1; _arg1["gameStateChanged_v1"] = gameStateChanged_v1; _arg1["roundStateChanged_v1"] = roundStateChanged_v1; _arg1["occupantChanged_v1"] = occupantChanged_v1; _arg1["userChat_v1"] = userChat_v1; } public function restartGameIn(_arg1:int):void{ if (_seatingCtrl != null){ throw (new Error("restartGameIn() is only applicable to party games.")); }; callHostCode("restartGameIn_v1", _arg1); } override protected function createSubControls():Array{ return ([(_seatingCtrl = new SeatingSubControl(_parent, this))]); } private function controlDidChange_v1():void{ dispatch(new StateChangedEvent(StateChangedEvent.CONTROL_CHANGED)); } private function roundStateChanged_v1(_arg1:Boolean):void{ dispatch(new StateChangedEvent((_arg1) ? StateChangedEvent.ROUND_STARTED : StateChangedEvent.ROUND_ENDED)); } public function amInControl():Boolean{ return ((getControllerId() == getMyId())); } public function getItemPacks():Array{ return ((callHostCode("getItemPacks_v1") as Array)); } private function gameStateChanged_v1(_arg1:Boolean):void{ dispatch(new StateChangedEvent((_arg1) ? StateChangedEvent.GAME_STARTED : StateChangedEvent.GAME_ENDED)); } public function amServerAgent():Boolean{ return ((getMyId() == SERVER_AGENT_ID)); } private function userChat_v1(_arg1:int, _arg2:String):void{ dispatch(new UserChatEvent(_arg1, _arg2)); } public function getConfig():Object{ return (_gameConfig); } public function endRound(_arg1:int=0):void{ callHostCode("endRound_v1", _arg1); } override protected function gotHostProps(_arg1:Object):void{ var o = _arg1; super.gotHostProps(o); _gameConfig = o.gameConfig; try { if (o["gameInfo"]["type"] == "party"){ _seatingCtrl = null; _subControls = null; }; } catch(er:Error) { }; } public function get seating():SeatingSubControl{ return (_seatingCtrl); } public function endGameWithScore(_arg1:int, _arg2:int=0):void{ endGameWithScores([getMyId()], [_arg1], TO_EACH_THEIR_OWN, _arg2); } } }//package com.whirled.game
Section 103
//LocalSubControl (com.whirled.game.LocalSubControl) package com.whirled.game { import flash.events.*; import flash.display.*; import com.whirled.*; import flash.geom.*; public class LocalSubControl extends AbstractSubControl { public function LocalSubControl(_arg1:GameControl){ super(_arg1); } public function setOccupantsLabel(_arg1:String):void{ callHostCode("setOccupantsLabel_v1", _arg1); } public function setStageQuality(_arg1:String="medium"):void{ callHostCode("setStageQuality_v1", _arg1); } public function setPlayerScores(_arg1:Array, _arg2:Array=null):void{ callHostCode("setPlayerScores_v1", _arg1, _arg2); } public function feedback(_arg1:String):void{ callHostCode("localChat_v1", _arg1); } public function setShowReplay(_arg1:Boolean):void{ callHostCode("setShowReplay_v1", _arg1); } public function showGameLobby(_arg1:Boolean=true):void{ callHostCode("showGameLobby_v1", _arg1); } public function showSharePage(_arg1:String, _arg2:String=""):void{ callHostCode("showSharePage_v1", _arg1, _arg2); } override public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{ super.removeEventListener(_arg1, _arg2, _arg3); switch (_arg1){ case KeyboardEvent.KEY_UP: case KeyboardEvent.KEY_DOWN: if (!hasEventListener(_arg1)){ callHostCode("alterKeyEvents_v1", _arg1, false); }; break; }; } public function setFrameRate(_arg1:Number=30):void{ callHostCode("setFrameRate_v1", _arg1); } public function showGameShop(_arg1:String, _arg2:int=0):void{ callHostCode("showGameShop_v1", _arg1, _arg2); } override public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{ super.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5); switch (_arg1){ case KeyboardEvent.KEY_UP: case KeyboardEvent.KEY_DOWN: if (hasEventListener(_arg1)){ callHostCode("alterKeyEvents_v1", _arg1, true); }; break; }; } public function clearScores(_arg1:Object=null, _arg2:Boolean=false):void{ callHostCode("clearScores_v1", _arg1, _arg2); } public function getHeadShot(_arg1:int):DisplayObject{ return ((callHostCode("getHeadShot_v2", _arg1) as DisplayObject)); } public function showTrophies():void{ callHostCode("showTrophies_v1"); } public function setMappedScores(_arg1:Object):void{ callHostCode("setMappedScores_v1", _arg1); } public function getSize():Point{ return ((callHostCode("getSize_v1") as Point)); } public function filter(_arg1:String):String{ return ((callHostCode("filter_v1", _arg1) as String)); } private function sizeChanged_v1(_arg1:Point):void{ dispatch(new SizeChangedEvent(_arg1)); } override protected function setUserProps(_arg1:Object):void{ super.setUserProps(_arg1); _arg1["dispatchEvent_v1"] = dispatch; _arg1["sizeChanged_v1"] = sizeChanged_v1; } public function getShareMemberId():int{ return (callHostCode("getShareMemberId_v1")); } public function getShareToken():String{ return (callHostCode("getShareToken_v1")); } } }//package com.whirled.game
Section 104
//NetSubControl (com.whirled.game.NetSubControl) package com.whirled.game { import com.whirled.*; import com.whirled.net.*; import flash.utils.*; import com.whirled.net.impl.*; public class NetSubControl extends AbstractSubControl implements PropertySubControl { protected var _playerCtrls:Dictionary; protected var _playersMsgCtrl:MessageSubControl; protected var _gameData:Object; protected var _agentMsgCtrl:MessageSubControl; public static const TO_SERVER_AGENT:int = -2147483648; public static const TO_ALL:int = 0; public function NetSubControl(_arg1:GameControl){ _playerCtrls = new Dictionary(); super(_arg1); } public function getPropertyNames(_arg1:String=""):Array{ var _local3:String; var _local2:Array = []; for (_local3 in _gameData) { if (_local3.lastIndexOf(_arg1, 0) == 0){ _local2.push(_local3); }; }; return (_local2); } public function get agent():MessageSubControl{ return (_agentMsgCtrl); } protected function getPlayerMessager(_arg1:int):MessageSubControl{ var playerId = _arg1; var ctrl:MessageSubControl = _playerCtrls[playerId]; if (ctrl == null){ ctrl = (_playerCtrls[playerId] = new MessageSubControlAdapter(_parent, function (_arg1:String, _arg2:Object):void{ sendMessage(_arg1, _arg2, playerId); })); }; return (ctrl); } public function getTargetId():int{ return (0); } private function messageReceived_v2(_arg1:String, _arg2:Object, _arg3:int):void{ dispatch(new MessageReceivedEvent(_arg1, _arg2, _arg3)); } public function get(_arg1:String):Object{ checkIsConnected(); return (_gameData[_arg1]); } public function getPlayer(_arg1:int):MessageSubControl{ return (getPlayerMessager(_arg1)); } public function sendMessage(_arg1:String, _arg2:Object, _arg3:int=0):void{ callHostCode("sendMessage_v2", _arg1, _arg2, _arg3); } override protected function setUserProps(_arg1:Object):void{ super.setUserProps(_arg1); _arg1["propertyWasSet_v2"] = propertyWasSet_v2; _arg1["messageReceived_v2"] = messageReceived_v2; } public function setIn(_arg1:String, _arg2:int, _arg3:Object, _arg4:Boolean=false):void{ callHostCode("setProperty_v2", _arg1, _arg3, _arg2, false, _arg4); } public function set(_arg1:String, _arg2:Object, _arg3:Boolean=false):void{ callHostCode("setProperty_v2", _arg1, _arg2, null, false, _arg3); } private function propertyWasSet_v2(_arg1:String, _arg2:Object, _arg3:Object, _arg4:Object):void{ if (_arg4 == null){ dispatch(new PropertyChangedEvent(PropertyChangedEvent.PROPERTY_CHANGED, _arg1, _arg2, _arg3)); } else { dispatch(new ElementChangedEvent(ElementChangedEvent.ELEMENT_CHANGED, _arg1, _arg2, _arg3, int(_arg4))); }; } public function get players():MessageSubControl{ return (_playersMsgCtrl); } public function setAt(_arg1:String, _arg2:int, _arg3:Object, _arg4:Boolean=false):void{ callHostCode("setProperty_v2", _arg1, _arg3, _arg2, true, _arg4); } override protected function createSubControls():Array{ _agentMsgCtrl = new MessageSubControlAdapter(_parent, function (_arg1:String, _arg2:Object):void{ sendMessage(_arg1, _arg2, TO_SERVER_AGENT); }); _playersMsgCtrl = new MessageSubControlAdapter(_parent, function (_arg1:String, _arg2:Object):void{ sendMessage(_arg1, _arg2, TO_ALL); }); return ([_agentMsgCtrl, _playersMsgCtrl]); } override protected function gotHostProps(_arg1:Object):void{ super.gotHostProps(_arg1); _gameData = _arg1.gameData; } public function testAndSet(_arg1:String, _arg2:Object, _arg3:Object):void{ callHostCode("testAndSetProperty_v1", _arg1, _arg2, _arg3); } } }//package com.whirled.game
Section 105
//OccupantChangedEvent (com.whirled.game.OccupantChangedEvent) package com.whirled.game { import flash.events.*; public class OccupantChangedEvent extends Event { protected var _player:Boolean; protected var _occupantId:int; public static const OCCUPANT_LEFT:String = "OccupantLeft"; public static const OCCUPANT_ENTERED:String = "OccupantEntered"; public function OccupantChangedEvent(_arg1:String, _arg2:int, _arg3:Boolean){ super(_arg1); _occupantId = _arg2; _player = _arg3; } public function get player():Boolean{ return (_player); } public function get occupantId():int{ return (_occupantId); } override public function toString():String{ return ((((((("[OccupantChangedEvent type=" + type) + ", occupantId=") + _occupantId) + ", player=") + _player) + "]")); } override public function clone():Event{ return (new OccupantChangedEvent(type, _occupantId, _player)); } } }//package com.whirled.game
Section 106
//PlayerSubControl (com.whirled.game.PlayerSubControl) package com.whirled.game { import com.whirled.*; public class PlayerSubControl extends AbstractSubControl { public static const CURRENT_USER:int = 0; public function PlayerSubControl(_arg1:GameControl){ super(_arg1); } public function getPlayerItemPacks(_arg1:int=0):Array{ return ((callHostCode("getPlayerItemPacks_v1", _arg1) as Array)); } override protected function setUserProps(_arg1:Object):void{ super.setUserProps(_arg1); _arg1["flowAwarded_v1"] = flowAwarded_v1; _arg1["notifyGameContentAdded_v1"] = notifyGameContentAdded_v1; } public function holdsTrophy(_arg1:String, _arg2:int=0):Boolean{ return ((callHostCode("holdsTrophy_v1", _arg1, _arg2) as Boolean)); } public function awardPrize(_arg1:String, _arg2:int=0):void{ callHostCode("awardPrize_v1", _arg1, _arg2); } public function setCookie(_arg1:Object, _arg2:int=0):Boolean{ return (Boolean(callHostCode("setCookie_v1", _arg1, _arg2))); } private function notifyGameContentAdded_v1(_arg1:String, _arg2:String, _arg3:int):void{ dispatch(new GameContentEvent(GameContentEvent.PLAYER_CONTENT_ADDED, _arg1, _arg2, _arg3)); } public function getCookie(_arg1:Function, _arg2:int=0):void{ callHostCode("getCookie_v1", _arg1, _arg2); } private function flowAwarded_v1(_arg1:int, _arg2:int):Boolean{ var _local3:CoinsAwardedEvent = new CoinsAwardedEvent(_arg1, _arg2); dispatch(_local3); return (_local3.isDefaultPrevented()); } public function awardTrophy(_arg1:String, _arg2:int=0):Boolean{ return ((callHostCode("awardTrophy_v1", _arg1, _arg2) as Boolean)); } public function getPlayerLevelPacks(_arg1:int=0):Array{ return ((callHostCode("getPlayerLevelPacks_v1", _arg1) as Array)); } } }//package com.whirled.game
Section 107
//SeatingSubControl (com.whirled.game.SeatingSubControl) package com.whirled.game { import com.whirled.*; public class SeatingSubControl extends AbstractSubControl { protected var _game:GameSubControl; public function SeatingSubControl(_arg1:AbstractControl, _arg2:GameSubControl){ super(_arg1); _game = _arg2; } public function getPlayerPosition(_arg1:int):int{ return (int(callHostCode("getPlayerPosition_v1", _arg1))); } public function getPlayerIds():Array{ return ((callHostCode("getPlayers_v1") as Array)); } public function getPlayerNames():Array{ return (getPlayerIds().map(function (_arg1:int, _arg2, _arg3):String{ return (((_arg1)==0) ? null : _game.getOccupantName(_arg1)); })); } public function getMyPosition():int{ return (int(callHostCode("getMyPosition_v1"))); } } }//package com.whirled.game
Section 108
//ServicesSubControl (com.whirled.game.ServicesSubControl) package com.whirled.game { import com.whirled.*; public class ServicesSubControl extends AbstractSubControl { protected var _bagsCtrl:BagsSubControl; public function ServicesSubControl(_arg1:GameControl){ super(_arg1); } public function getDictionaryLetterSet(_arg1:String, _arg2:String, _arg3:int, _arg4:Function):void{ callHostCode("getDictionaryLetterSet_v2", _arg1, _arg2, _arg3, _arg4); } public function stopTicker(_arg1:String):void{ startTicker(_arg1, 0); } public function checkDictionaryWord(_arg1:String, _arg2:String, _arg3:String, _arg4:Function):void{ callHostCode("checkDictionaryWord_v2", _arg1, _arg2, _arg3, _arg4); } override protected function createSubControls():Array{ return ([(_bagsCtrl = new BagsSubControl(_parent))]); } public function get bags():BagsSubControl{ return (_bagsCtrl); } public function startTicker(_arg1:String, _arg2:int):void{ callHostCode("setTicker_v1", _arg1, _arg2); } public function getDictionaryWords(_arg1:String, _arg2:String, _arg3:int, _arg4:Function):void{ callHostCode("getDictionaryWords_v1", _arg1, _arg2, _arg3, _arg4); } } }//package com.whirled.game
Section 109
//SizeChangedEvent (com.whirled.game.SizeChangedEvent) package com.whirled.game { import flash.events.*; import flash.geom.*; public class SizeChangedEvent extends Event { protected var _size:Point; public static const SIZE_CHANGED:String = "SizeChanged"; public function SizeChangedEvent(_arg1:Point){ super(SIZE_CHANGED); _size = _arg1; } public function get size():Point{ return (_size); } override public function toString():String{ return ((("[SizeChangedEvent size=" + _size) + "]")); } override public function clone():Event{ return (new SizeChangedEvent(_size.clone())); } } }//package com.whirled.game
Section 110
//StateChangedEvent (com.whirled.game.StateChangedEvent) package com.whirled.game { import flash.events.*; public class StateChangedEvent extends Event { public static const CONTROL_CHANGED:String = "ControlChanged"; public static const ROUND_ENDED:String = "RoundEnded"; public static const GAME_ENDED:String = "GameEnded"; public static const ROUND_STARTED:String = "RoundStarted"; public static const GAME_STARTED:String = "GameStarted"; public static const TURN_CHANGED:String = "TurnChanged"; public function StateChangedEvent(_arg1:String){ super(_arg1); } override public function toString():String{ return ((("[StateChangedEvent type=" + type) + "]")); } override public function clone():Event{ return (new StateChangedEvent(type)); } } }//package com.whirled.game
Section 111
//UserChatEvent (com.whirled.game.UserChatEvent) package com.whirled.game { import flash.events.*; public class UserChatEvent extends Event { protected var _speaker:int; protected var _message:String; public static const USER_CHAT:String = "UserChat"; public function UserChatEvent(_arg1:int, _arg2:String){ super(USER_CHAT); _speaker = _arg1; _message = _arg2; } public function get message():String{ return (_message); } override public function toString():String{ return ((((("[UserChatEvent speaker=" + _speaker) + ", message=") + _message) + "]")); } override public function clone():Event{ return (new UserChatEvent(_speaker, _message)); } public function get speaker():int{ return (_speaker); } } }//package com.whirled.game
Section 112
//MessageSubControlAdapter (com.whirled.net.impl.MessageSubControlAdapter) package com.whirled.net.impl { import com.whirled.*; import com.whirled.net.*; public class MessageSubControlAdapter extends AbstractSubControl implements MessageSubControl { protected var _sendMessage:Function; public function MessageSubControlAdapter(_arg1:AbstractControl, _arg2:Function){ super(_arg1); _sendMessage = _arg2; } public function sendMessage(_arg1:String, _arg2:Object=null):void{ _sendMessage(_arg1, _arg2); } } }//package com.whirled.net.impl
Section 113
//ElementChangedEvent (com.whirled.net.ElementChangedEvent) package com.whirled.net { import flash.events.*; public class ElementChangedEvent extends PropertyChangedEvent { protected var _key:int; public static const ELEMENT_CHANGED:String = "ElemChanged"; public function ElementChangedEvent(_arg1:String, _arg2:String, _arg3:Object, _arg4:Object, _arg5:int){ super(_arg1, _arg2, _arg3, _arg4); _key = _arg5; } public function get index():int{ return (_key); } override public function toString():String{ return ((((((("[ElementChangedEvent name=" + _name) + ", value=") + _newValue) + ", key=") + _key) + "]")); } override public function clone():Event{ return (new ElementChangedEvent(type, _name, _newValue, _oldValue, _key)); } public function get key():int{ return (_key); } } }//package com.whirled.net
Section 114
//MessageReceivedEvent (com.whirled.net.MessageReceivedEvent) package com.whirled.net { import flash.events.*; public class MessageReceivedEvent extends Event { protected var _name:String; protected var _senderId:int; protected var _value:Object; protected static const SERVER_AGENT_ID:int = -2147483648; protected static const SERVER_ID:int = 0; public static const MESSAGE_RECEIVED:String = "MsgReceived"; public function MessageReceivedEvent(_arg1:String, _arg2:Object, _arg3:int){ super(MESSAGE_RECEIVED); _name = _arg1; _value = _arg2; _senderId = _arg3; } public function get name():String{ return (_name); } override public function toString():String{ return ((((((("[MessageReceivedEvent name=" + _name) + ", value=") + _value) + ", sender=") + _senderId) + "]")); } public function get senderId():int{ return (_senderId); } public function get value():Object{ return (_value); } public function isFromServer():Boolean{ return ((((_senderId == SERVER_ID)) || ((_senderId == SERVER_AGENT_ID)))); } override public function clone():Event{ return (new MessageReceivedEvent(_name, _value, _senderId)); } } }//package com.whirled.net
Section 115
//MessageSubControl (com.whirled.net.MessageSubControl) package com.whirled.net { public interface MessageSubControl { function sendMessage(_arg1:String, _arg2:Object=null):void; } }//package com.whirled.net
Section 116
//PropertyChangedEvent (com.whirled.net.PropertyChangedEvent) package com.whirled.net { import flash.events.*; public class PropertyChangedEvent extends Event { protected var _newValue:Object; protected var _oldValue:Object; protected var _name:String; public static const PROPERTY_CHANGED:String = "PropChanged"; public function PropertyChangedEvent(_arg1:String, _arg2:String, _arg3:Object, _arg4:Object){ super(_arg1); _name = _arg2; _newValue = _arg3; _oldValue = _arg4; } public function get newValue():Object{ return (_newValue); } public function get oldValue():Object{ return (_oldValue); } public function get name():String{ return (_name); } override public function toString():String{ return ((((("[PropertyChangedEvent name=" + _name) + ", value=") + _newValue) + "]")); } override public function clone():Event{ return (new PropertyChangedEvent(type, _name, _newValue, _oldValue)); } } }//package com.whirled.net
Section 117
//PropertyGetSubControl (com.whirled.net.PropertyGetSubControl) package com.whirled.net { import flash.events.*; public interface PropertyGetSubControl extends IEventDispatcher { function getTargetId():int; function getPropertyNames(_arg1:String=""):Array; function get(_arg1:String):Object; } }//package com.whirled.net
Section 118
//PropertySubControl (com.whirled.net.PropertySubControl) package com.whirled.net { public interface PropertySubControl extends PropertyGetSubControl { function set(_arg1:String, _arg2:Object, _arg3:Boolean=false):void; function setAt(_arg1:String, _arg2:int, _arg3:Object, _arg4:Boolean=false):void; function setIn(_arg1:String, _arg2:int, _arg3:Object, _arg4:Boolean=false):void; } }//package com.whirled.net
Section 119
//AbstractControl (com.whirled.AbstractControl) package com.whirled { import flash.events.*; import flash.display.*; import flash.errors.*; public class AbstractControl extends EventDispatcher { protected var _funcs:Object; protected var _subControls:Array; public function AbstractControl(_arg1:DisplayObject, _arg2:Object=null){ _subControls = createSubControls(); if ((this is AbstractSubControl)){ return; }; if (_arg1.root == null){ throw (new Error("Display object used to instantiate a control must be on the stage")); }; _arg1.root.loaderInfo.addEventListener(Event.UNLOAD, handleUnload, false, 0, true); var _local3:Object = ((_arg2)!=null) ? _arg2 : new Object(); setUserProps(_local3); var _local4:ConnectEvent = new ConnectEvent(); _local4.props.userProps = _local3; _arg1.root.loaderInfo.sharedEvents.dispatchEvent(_local4); if (Boolean(_local4.props.alreadyConnected)){ throw (new Error("You've already set up a Control instance. There should only be one.")); }; var _local5:Object = _local4.props.hostProps; if (_local5 != null){ gotHostProps(_local5); }; } override public function dispatchEvent(_arg1:Event):Boolean{ throw (new IllegalOperationError()); } protected function createSubControls():Array{ return (null); } protected function callHostCode(_arg1:String, ... _args){ var func:Function; var name = _arg1; var args = _args; if (_funcs != null){ try { func = (_funcs[name] as Function); if (func == null){ trace((("Host code \"" + name) + "\" not found!")); } else { return (func.apply(null, args)); }; } catch(err:Error) { trace(((((("Error! Your code is broken! Unable to call a host method, perhaps " + "you've been shut down? [msg=") + err.message) + ", trace=") + err.getStackTrace()) + "].")); }; } else { checkIsConnected(); }; return (undefined); } protected function setUserProps(_arg1:Object):void{ var _local2:AbstractSubControl; for each (_local2 in _subControls) { _local2.setUserPropsFriend(_arg1); }; } protected function handleUnload(_arg1:Event):void{ dispatch(_arg1); } function callHostCodeFriend(_arg1:String, _arg2:Array){ _arg2.unshift(_arg1); return (callHostCode.apply(this, _arg2)); } override public function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{ super.removeEventListener(_arg1, _arg2, _arg3); } override public function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{ super.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5); } public function doBatch(_arg1:Function, ... _args):void{ var fn = _arg1; var args = _args; callHostCode("startTransaction"); try { fn.apply(null, args); } finally { callHostCode("commitTransaction"); }; } protected function checkIsConnected():void{ if (!isConnected()){ throw (new IllegalOperationError(("The control is not connected to the host framework, please check isConnected(). " + "If false, your SWF is being viewed standalone and should adjust."))); }; } protected function dispatch(_arg1:Event):void{ var event = _arg1; try { super.dispatchEvent(event); } catch(err:Error) { trace("Error dispatching event to user code."); trace(err.getStackTrace()); }; } protected function gotHostProps(_arg1:Object):void{ var _local2:AbstractSubControl; _funcs = _arg1; for each (_local2 in _subControls) { _local2.gotHostPropsFriend(_arg1); }; } public function isConnected():Boolean{ return (!((_funcs == null))); } } }//package com.whirled import flash.events.*; class ConnectEvent extends Event { public var props:Object; private function ConnectEvent(_arg1:Object=null){ super("controlConnect", true, false); props = ((_arg1) || ({})); } override public function clone():Event{ return (new ConnectEvent(props)); } }
Section 120
//AbstractSubControl (com.whirled.AbstractSubControl) package com.whirled { import flash.events.*; public class AbstractSubControl extends AbstractControl { protected var _parent:AbstractControl; public function AbstractSubControl(_arg1:AbstractControl){ _parent = _arg1; _parent.addEventListener(Event.UNLOAD, handleUnload, false, 0, true); super(null); } function setUserPropsFriend(_arg1:Object):void{ setUserProps(_arg1); } override protected function callHostCode(_arg1:String, ... _args){ return (_parent.callHostCodeFriend(_arg1, _args)); } override public function isConnected():Boolean{ return (_parent.isConnected()); } function gotHostPropsFriend(_arg1:Object):void{ gotHostProps(_arg1); } override public function doBatch(_arg1:Function, ... _args):void{ _args.unshift(_arg1); _parent.doBatch.apply(null, _args); } } }//package com.whirled
Section 121
//CoreEvent (core.events.CoreEvent) package core.events { import flash.events.*; public class CoreEvent extends Event { public var data:Object; public static const PLAYER_COLLIDE:String = "ExitCollide"; public static const CHECK_BODY_INTERSECTIONS:String = "CheckBodyIntersections"; public static const UPDATE:String = "Update"; public static const BONUS_COLLECT:String = "BonusCollect"; public static const LEVEL_COMPLETE:String = "LevelComplete"; public static const LEVEL_RESTART_END:String = "LevelRestartEnd"; public static const LEVEL_RESTART_START:String = "LevelRestartStart"; public static const LEVEL_FAIL:String = "LevelFail"; public static const DESTROY:String = "Destroy"; public static const GET_JOINT_OBJECT:String = "GetJointObject"; public static const SPLIT_SUCCESS:String = "SplitSuccess"; public static const RETURN_JOINT_OBJECT:String = "ReturnJointObject"; public static const GET_BODY_UNDER_POINT:String = "GetBodyUnderPoint"; public static const RETURN_BODY_UNDER_POINT:String = "ReturnBodyUnderPoint"; public static const CHECK_JOINT_INTERSECTIONS:String = "CheckJointIntersections"; public function CoreEvent(_arg1:String, _arg2:Object=null, _arg3:Boolean=false, _arg4:Boolean=false):void{ super(_arg1, _arg3, _arg4); this.data = _arg2; } } }//package core.events
Section 122
//BaseObject (core.objects.BaseObject) package core.objects { import flash.events.*; import flash.display.*; import core.events.*; import core.*; public class BaseObject extends EventDispatcher { protected var engine:GameEngine; protected var def:BaseObjectDef; protected var skin:Sprite; public function BaseObject(_arg1:BaseObjectDef):void{ this.def = _arg1; init(); } public function destroy(_arg1:CoreEvent=null):void{ skin.parent.removeChild(skin); engine.dispatcher.removeEventListener(CoreEvent.DESTROY, destroy); engine.dispatcher.removeEventListener(CoreEvent.LEVEL_RESTART_START, levelRestartStart); } protected function updateSkin():void{ } public function moveTo(_arg1:Number, _arg2:Number):void{ } protected function init():void{ engine = GameEngine.getInstance(); engine.dispatcher.addEventListener(CoreEvent.LEVEL_RESTART_START, levelRestartStart); engine.dispatcher.addEventListener(CoreEvent.DESTROY, destroy); } protected function levelRestartStart(_arg1:CoreEvent):void{ dispatchEvent(new CoreEvent(CoreEvent.LEVEL_RESTART_END)); } protected function createSkin():Sprite{ return (null); } } }//package core.objects
Section 123
//BaseObjectDef (core.objects.BaseObjectDef) package core.objects { public class BaseObjectDef { public var splittable:Boolean; public var x:Number; public var y:Number; public var id:uint; private static var ID:uint = 0; public function BaseObjectDef(_arg1:Number, _arg2:Number, _arg3:Boolean):void{ this.id = ID; this.x = _arg1; this.y = _arg2; this.splittable = _arg3; ID++; } public function getStringDef():String{ return (null); } } }//package core.objects
Section 124
//BodyObject (core.objects.BodyObject) package core.objects { import core.events.*; import flash.geom.*; import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.*; import caurina.transitions.*; public class BodyObject extends BaseObject { protected var body:b2Body; protected var bodyObjDef:BodyObjectDef; public function BodyObject(_arg1:BodyObjectDef):void{ this.bodyObjDef = _arg1; super(_arg1); } protected function createShapeDef():b2ShapeDef{ return (null); } protected function updateHandler(_arg1:CoreEvent):void{ updateSkin(); checkBounds(); } override protected function updateSkin():void{ var _local1:b2Vec2 = body.GetPosition(); skin.x = (_local1.x * engine.m_physScale); skin.y = (_local1.y * engine.m_physScale); skin.rotation = ((body.GetAngle() * 180) / Math.PI); } protected function createBodyDef():b2BodyDef{ return (null); } protected function restartComplete():void{ dispatchEvent(new CoreEvent(CoreEvent.LEVEL_RESTART_END)); } override public function moveTo(_arg1:Number, _arg2:Number):void{ var _local3:b2Vec2 = new b2Vec2((_arg1 / engine.m_physScale), (_arg2 / engine.m_physScale)); body.SetXForm(_local3, body.GetAngle()); updateSkin(); } override protected function init():void{ super.init(); var _local1:b2ShapeDef = createShapeDef(); var _local2:b2BodyDef = createBodyDef(); body = createBody(_local2, _local1); skin = createSkin(); moveTo(def.x, def.y); engine.dispatcher.addEventListener(CoreEvent.GET_BODY_UNDER_POINT, getBodyUnderPointHander); } public function getBody():b2Body{ return (body); } override protected function levelRestartStart(_arg1:CoreEvent):void{ var _local2:Point = new Point(skin.x, skin.y); var _local3:Number = Point.distance(new Point(bodyObjDef.x, bodyObjDef.y), _local2); var _local4:Number = (_local3 / 300); Tweener.addTween(skin, {x:bodyObjDef.x, y:bodyObjDef.y, rotation:0, time:_local4, transition:"easeinoutquad", onComplete:restartComplete}); } override public function destroy(_arg1:CoreEvent=null):void{ super.destroy(_arg1); engine.m_world.DestroyBody(body); if (!bodyObjDef.isStatic){ engine.dispatcher.removeEventListener(CoreEvent.UPDATE, updateHandler); }; engine.dispatcher.removeEventListener(CoreEvent.GET_BODY_UNDER_POINT, getBodyUnderPointHander); } protected function getBodyUnderPointHander(_arg1:CoreEvent):void{ var _local2:Point = (_arg1.data as Point); if (skin.hitTestPoint(_local2.x, _local2.y, true)){ dispatchEvent(new CoreEvent(CoreEvent.RETURN_BODY_UNDER_POINT, this)); }; } protected function checkBounds():void{ var _local1:b2Vec2 = body.GetPosition(); var _local2:Number = (_local1.y * engine.m_physScale); if (_local2 > 1000){ engine.removeBaseObj(this); }; } protected function createBody(_arg1:b2BodyDef, _arg2:b2ShapeDef):b2Body{ var _local3:b2Body; if (bodyObjDef.isStatic){ _local3 = engine.m_world.CreateStaticBody(_arg1); } else { _local3 = engine.m_world.CreateDynamicBody(_arg1); engine.dispatcher.addEventListener(CoreEvent.UPDATE, updateHandler); }; _local3.CreateShape(_arg2); _local3.SetMassFromShapes(); return (_local3); } } }//package core.objects
Section 125
//BodyObjectDef (core.objects.BodyObjectDef) package core.objects { import flash.geom.*; public class BodyObjectDef extends BaseObjectDef { public var startPos:Point; public var startRotation:Number; public var isStatic:Boolean; public function BodyObjectDef(_arg1:Number, _arg2:Number, _arg3:Boolean, _arg4:Boolean):void{ this.isStatic = _arg4; super(_arg1, _arg2, _arg3); } } }//package core.objects
Section 126
//Bonus (core.objects.Bonus) package core.objects { import flash.display.*; import core.events.*; import flash.media.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.*; import Box2D.Dynamics.Contacts.*; import caurina.transitions.*; public class Bonus extends CircleObject { private var sndCollect:Sound; protected var bonusDef:BonusDef; public static const NAME:String = "Bonus"; public function Bonus(_arg1:BonusDef):void{ this.bonusDef = _arg1; super(_arg1); } override protected function createShapeDef():b2ShapeDef{ var _local1:b2ShapeDef = super.createShapeDef(); _local1.isSensor = true; return (_local1); } override protected function createBodyDef():b2BodyDef{ var _local1:b2BodyDef = super.createBodyDef(); _local1.userData = NAME; return (_local1); } override protected function updateHandler(_arg1:CoreEvent):void{ checkCollisions(); } private function checkCollisions():void{ var _local2:b2Body; var _local3:b2Body; var _local1:b2ContactEdge = body.m_contactList; while (_local1) { _local2 = _local1.contact.m_shape1.m_body; _local3 = _local1.contact.m_shape2.m_body; if ((((((_local2.m_userData == Player.NAME)) && ((_local3.m_userData == NAME)))) || ((((_local2.m_userData == NAME)) && ((_local3.m_userData == Player.NAME)))))){ collect(); }; _local1 = _local1.next; }; } private function collect():void{ dispatchEvent(new CoreEvent(CoreEvent.BONUS_COLLECT, this)); engine.sndChannel = sndCollect.play(0, 0, engine.sndTransform); var _local1:Sprite = createSkin(); _local1.x = skin.x; _local1.y = skin.y; Tweener.addTween(_local1, {scaleX:1.5, scaleY:1.5, rotation:60, time:0.3, transition:"easeoutquad"}); Tweener.addTween(_local1, {scaleX:0, scaleY:0, rotation:-180, delay:0.4, time:0.5, transition:"easeoutquad", onComplete:animComplete}); } override protected function init():void{ super.init(); engine.dispatcher.addEventListener(CoreEvent.UPDATE, updateHandler); initSounds(); } private function animComplete():void{ } private function initSounds():void{ var _local1:Class = engine.assets.getAssetClass("SndStarCollect"); sndCollect = new (_local1); } override protected function createSkin():Sprite{ var _local1:Class = engine.assets.getAssetClass("BonusAsset"); var _local2:Sprite = new (_local1); engine.canvas.playerContainer.addChild(_local2); return (_local2); } override public function destroy(_arg1:CoreEvent=null):void{ super.destroy(_arg1); engine.dispatcher.removeEventListener(CoreEvent.UPDATE, updateHandler); } } }//package core.objects
Section 127
//BonusDef (core.objects.BonusDef) package core.objects { public class BonusDef extends CircleObjectDef { public static const NAME:String = "b"; public function BonusDef(_arg1:Number, _arg2:Number, _arg3:Number):void{ super(_arg1, _arg2, false, true, _arg3); } override public function getStringDef():String{ var _local1 = (NAME + "_"); _local1 = (_local1 + (x + "_")); _local1 = (_local1 + (y + "_")); _local1 = (_local1 + r); return (_local1); } public static function parseStringDef(_arg1:String):BonusDef{ var _local2:Array = _arg1.split("_"); var _local3:Number = _local2[1]; var _local4:Number = _local2[2]; var _local5:Number = _local2[3]; var _local6:BonusDef = new BonusDef(_local3, _local4, _local5); return (_local6); } } }//package core.objects
Section 128
//CircleObject (core.objects.CircleObject) package core.objects { import flash.display.*; import core.events.*; import flash.geom.*; import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.*; public class CircleObject extends BodyObject { protected var circleDef:CircleObjectDef; public function CircleObject(_arg1:CircleObjectDef):void{ this.circleDef = _arg1; super(_arg1); } override protected function createShapeDef():b2ShapeDef{ var _local1:b2CircleDef = new b2CircleDef(); _local1.radius = (circleDef.r / engine.m_physScale); _local1.density = 1; _local1.friction = 0.5; _local1.restitution = 0.2; return (_local1); } override protected function createBodyDef():b2BodyDef{ var _local1:b2BodyDef = new b2BodyDef(); _local1.position.Set((circleDef.x / engine.m_physScale), (circleDef.y / engine.m_physScale)); return (_local1); } override protected function createSkin():Sprite{ var _local1:Class; if (circleDef.isStatic){ _local1 = engine.assets.getAssetClass("BrickMaterial"); } else { _local1 = engine.assets.getAssetClass("MetallMaterial"); }; var _local2:BitmapData = (new _local1(0, 0) as BitmapData); var _local3:Sprite = new Sprite(); _local3.graphics.beginBitmapFill(_local2, null, true, true); _local3.graphics.lineStyle(0, 0, 1); _local3.graphics.drawCircle(0, 0, circleDef.r); _local3.graphics.endFill(); engine.canvas.bodiesContainer.addChild(_local3); return (_local3); } override protected function getBodyUnderPointHander(_arg1:CoreEvent):void{ var _local2:Point = (_arg1.data as Point); var _local3:b2Vec2 = body.GetPosition(); var _local4:Number = (_local3.x * engine.m_physScale); var _local5:Number = (_local3.y * engine.m_physScale); var _local6:Number = Math.sqrt((((_local4 - _local2.x) * (_local4 - _local2.x)) + ((_local5 - _local2.y) * (_local5 - _local2.y)))); if (_local6 <= circleDef.r){ dispatchEvent(new CoreEvent(CoreEvent.RETURN_BODY_UNDER_POINT, this)); }; } } }//package core.objects
Section 129
//CircleObjectDef (core.objects.CircleObjectDef) package core.objects { public class CircleObjectDef extends BodyObjectDef { public var r:Number; public static const NAME:String = "c"; public function CircleObjectDef(_arg1:Number, _arg2:Number, _arg3:Boolean, _arg4:Boolean, _arg5:Number):void{ this.r = _arg5; super(_arg1, _arg2, _arg3, _arg4); } override public function getStringDef():String{ var _local2:int; var _local1 = (NAME + "_"); switch (isStatic){ case false: _local2 = 1; break; case true: _local2 = 2; break; }; _local1 = (_local1 + (x + "_")); _local1 = (_local1 + (y + "_")); _local1 = (_local1 + (_local2 + "_")); _local1 = (_local1 + r); return (_local1); } public static function parseStringDef(_arg1:String):CircleObjectDef{ var _local6:Boolean; var _local2:Array = _arg1.split("_"); var _local3:Number = _local2[1]; var _local4:Number = _local2[2]; var _local5:int = _local2[3]; switch (_local5){ case 1: _local6 = false; break; case 2: _local6 = true; break; }; var _local7:Number = _local2[4]; var _local8:CircleObjectDef = new CircleObjectDef(_local3, _local4, false, _local6, _local7); return (_local8); } } }//package core.objects
Section 130
//DistanceJointObject (core.objects.DistanceJointObject) package core.objects { import flash.display.*; import core.events.*; import core.*; import flash.geom.*; import Box2D.Common.Math.*; import Box2D.Dynamics.Joints.*; public class DistanceJointObject extends BaseObject { private var color:uint; protected var joint:b2DistanceJoint; protected var jointDef:DistanceJointObjectDef; public function DistanceJointObject(_arg1:DistanceJointObjectDef):void{ this.jointDef = _arg1; super(_arg1); } protected function updateHandler(_arg1:CoreEvent):void{ updateSkin(); } protected function checkIntersections(_arg1:CoreEvent):void{ var _local6:Object; var _local2:Line = (_arg1.data as Line); var _local3:b2Vec2 = joint.GetAnchor1().Copy(); _local3.Multiply(engine.m_physScale); var _local4:b2Vec2 = joint.GetAnchor2().Copy(); _local4.Multiply(engine.m_physScale); var _local5:Line = new Line(new Point(Math.round(_local3.x), Math.round(_local3.y)), new Point(Math.round(_local4.x), Math.round(_local4.y))); if (Line.checkIntersections(_local2, _local5)){ _local6 = {remove:this}; dispatchEvent(new CoreEvent(CoreEvent.SPLIT_SUCCESS, _local6)); }; } override protected function updateSkin():void{ if (!joint){ return; }; var _local1:b2Vec2 = joint.GetAnchor1().Copy(); _local1.Multiply(engine.m_physScale); var _local2:b2Vec2 = joint.GetAnchor2().Copy(); _local2.Multiply(engine.m_physScale); skin.graphics.clear(); skin.graphics.lineStyle(3, color, 1); skin.graphics.moveTo(_local1.x, _local1.y); skin.graphics.lineTo(_local2.x, _local2.y); skin.graphics.lineStyle(0, 0); drawPoint(_local1.x, _local1.y); drawPoint(_local2.x, _local2.y); } private function drawPoint(_arg1:Number, _arg2:Number):void{ skin.graphics.moveTo((_arg1 - 3), _arg2); skin.graphics.lineTo((_arg1 + 3), _arg2); skin.graphics.moveTo(_arg1, (_arg2 - 3)); skin.graphics.lineTo(_arg1, (_arg2 + 3)); } protected function createJoint():b2DistanceJoint{ var _local2:BodyObject; var _local1:BodyObject = engine.getBodyObjUnderPoint(jointDef.anchor1); _local2 = engine.getBodyObjUnderPoint(jointDef.anchor2); if (((!(_local1)) || (!(_local2)))){ return (null); }; var _local3:b2DistanceJointDef = new b2DistanceJointDef(); _local3.collideConnected = true; var _local4:b2Vec2 = new b2Vec2((jointDef.anchor1.x / engine.m_physScale), (jointDef.anchor1.y / engine.m_physScale)); var _local5:b2Vec2 = new b2Vec2((jointDef.anchor2.x / engine.m_physScale), (jointDef.anchor2.y / engine.m_physScale)); _local3.Initialize(_local1.getBody(), _local2.getBody(), _local4, _local5); var _local6:b2DistanceJoint = (engine.m_world.CreateJoint(_local3) as b2DistanceJoint); return (_local6); } override protected function init():void{ super.init(); joint = createJoint(); skin = createSkin(); updateSkin(); if (joint){ engine.dispatcher.addEventListener(CoreEvent.GET_JOINT_OBJECT, getJointObjectHandler); engine.dispatcher.addEventListener(CoreEvent.CHECK_JOINT_INTERSECTIONS, checkIntersections); engine.dispatcher.addEventListener(CoreEvent.UPDATE, updateHandler); }; } protected function getJointObjectHandler(_arg1:CoreEvent):void{ var _local2:b2Joint = (_arg1.data as b2Joint); if (_local2 == joint){ dispatchEvent(new CoreEvent(CoreEvent.RETURN_JOINT_OBJECT, this)); }; } override protected function createSkin():Sprite{ color = (jointDef.splittable) ? 0xFFFF00 : 0x555555; var _local1:Sprite = new Sprite(); engine.canvas.jointsContainer.addChild(_local1); if (!joint){ _local1.graphics.clear(); _local1.graphics.lineStyle(3, color, 1); _local1.graphics.moveTo(jointDef.anchor1.x, jointDef.anchor1.y); _local1.graphics.lineTo(jointDef.anchor2.x, jointDef.anchor2.y); }; return (_local1); } override public function destroy(_arg1:CoreEvent=null):void{ super.destroy(_arg1); if (joint){ engine.m_world.DestroyJoint(joint); }; engine.dispatcher.removeEventListener(CoreEvent.GET_JOINT_OBJECT, getJointObjectHandler); engine.dispatcher.removeEventListener(CoreEvent.CHECK_JOINT_INTERSECTIONS, checkIntersections); engine.dispatcher.removeEventListener(CoreEvent.UPDATE, updateHandler); } override protected function levelRestartStart(_arg1:CoreEvent):void{ super.levelRestartStart(_arg1); skin.visible = false; } } }//package core.objects
Section 131
//DistanceJointObjectDef (core.objects.DistanceJointObjectDef) package core.objects { import flash.geom.*; public class DistanceJointObjectDef extends BaseObjectDef { public var anchor1:Point; public var anchor2:Point; public static const NAME:String = "j"; public function DistanceJointObjectDef(_arg1:Number, _arg2:Number, _arg3:Boolean, _arg4:Point, _arg5:Point):void{ this.anchor1 = _arg4; this.anchor2 = _arg5; super(_arg1, _arg2, _arg3); } public function updateAnchors(_arg1:Point, _arg2:Point):void{ anchor1.x = _arg1.x; anchor1.y = _arg1.y; anchor2.x = _arg2.x; anchor2.y = _arg2.y; x = Math.round((anchor1.x + ((anchor2.x - anchor1.x) / 2))); y = Math.round((anchor1.y + ((anchor2.y - anchor1.y) / 2))); } override public function getStringDef():String{ var _local1 = (NAME + "_"); _local1 = (_local1 + (x + "_")); _local1 = (_local1 + (y + "_")); _local1 = (_local1 + (anchor1.x + "_")); _local1 = (_local1 + (anchor1.y + "_")); _local1 = (_local1 + (anchor2.x + "_")); _local1 = (_local1 + anchor2.y); return (_local1); } public static function parseStringDef(_arg1:String):DistanceJointObjectDef{ var _local2:Array = _arg1.split("_"); var _local3:Number = _local2[1]; var _local4:Number = _local2[2]; var _local5:Number = _local2[3]; var _local6:Number = _local2[4]; var _local7:Number = _local2[5]; var _local8:Number = _local2[6]; var _local9:Point = new Point(_local5, _local6); var _local10:Point = new Point(_local7, _local8); var _local11:DistanceJointObjectDef = new DistanceJointObjectDef(_local3, _local4, true, _local9, _local10); return (_local11); } } }//package core.objects
Section 132
//Exit (core.objects.Exit) package core.objects { import flash.display.*; import core.events.*; import flash.media.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.*; import Box2D.Dynamics.Contacts.*; public class Exit extends CircleObject { protected var exitDef:ExitDef; private var sndLevelComplete:Sound; public static const NAME:String = "Exit"; public function Exit(_arg1:ExitDef):void{ this.exitDef = _arg1; super(_arg1); } override protected function createShapeDef():b2ShapeDef{ var _local1:b2ShapeDef = super.createShapeDef(); _local1.isSensor = true; return (_local1); } override protected function updateHandler(_arg1:CoreEvent):void{ checkCollisions(); } override protected function createBodyDef():b2BodyDef{ var _local1:b2BodyDef = super.createBodyDef(); _local1.userData = NAME; return (_local1); } private function checkCollisions():void{ var _local2:b2Body; var _local3:b2Body; var _local1:b2ContactEdge = body.m_contactList; while (_local1) { _local2 = _local1.contact.m_shape1.m_body; _local3 = _local1.contact.m_shape2.m_body; if ((((((_local2.m_userData == Player.NAME)) && ((_local3.m_userData == NAME)))) || ((((_local2.m_userData == NAME)) && ((_local3.m_userData == Player.NAME)))))){ levelComplete(); }; _local1 = _local1.next; }; } override protected function init():void{ super.init(); engine.dispatcher.addEventListener(CoreEvent.UPDATE, updateHandler); initSounds(); } override protected function createSkin():Sprite{ var _local1:Class = engine.assets.getAssetClass("ExitAsset"); var _local2:Sprite = new (_local1); engine.canvas.playerContainer.addChild(_local2); return (_local2); } override public function destroy(_arg1:CoreEvent=null):void{ super.destroy(_arg1); engine.dispatcher.removeEventListener(CoreEvent.UPDATE, updateHandler); } private function initSounds():void{ var _local1:Class = engine.assets.getAssetClass("SndLevelComplete"); sndLevelComplete = new (_local1); } private function levelComplete():void{ engine.sndChannel = sndLevelComplete.play(0, 0, engine.sndTransform); dispatchEvent(new CoreEvent(CoreEvent.LEVEL_COMPLETE)); } } }//package core.objects
Section 133
//ExitDef (core.objects.ExitDef) package core.objects { public class ExitDef extends CircleObjectDef { public static const NAME:String = "e"; public function ExitDef(_arg1:Number, _arg2:Number, _arg3:Number):void{ super(_arg1, _arg2, false, true, _arg3); } override public function getStringDef():String{ var _local1 = (NAME + "_"); _local1 = (_local1 + (x + "_")); _local1 = (_local1 + (y + "_")); _local1 = (_local1 + r); return (_local1); } public static function parseStringDef(_arg1:String):ExitDef{ var _local2:Array = _arg1.split("_"); var _local3:Number = _local2[1]; var _local4:Number = _local2[2]; var _local5:Number = _local2[3]; var _local6:ExitDef = new ExitDef(_local3, _local4, _local5); return (_local6); } } }//package core.objects
Section 134
//Player (core.objects.Player) package core.objects { import flash.display.*; import core.events.*; import flash.geom.*; import Box2D.Common.Math.*; import Box2D.Dynamics.*; import caurina.transitions.*; public class Player extends CircleObject { protected var playerDef:PlayerDef; private var eyeRight:Sprite; private var pupilRight:Sprite; private var pupilLeft:Sprite; private var eyeLeft:Sprite; private var skinInner:Sprite; public static const NAME:String = "Player"; public function Player(_arg1:PlayerDef):void{ this.playerDef = _arg1; super(_arg1); } override protected function createSkin():Sprite{ var _local1:Class = engine.assets.getAssetClass("PlayerAsset"); var _local2:Sprite = new (_local1); engine.canvas.playerContainer.addChild(_local2); return (_local2); } override protected function updateHandler(_arg1:CoreEvent):void{ super.updateHandler(_arg1); rotateEye(eyeLeft, pupilLeft); rotateEye(eyeRight, pupilRight); } override protected function createBodyDef():b2BodyDef{ var _local1:b2BodyDef = super.createBodyDef(); _local1.userData = NAME; return (_local1); } public function levelComplete(_arg1:Point):void{ Tweener.addTween(skin, {x:_arg1.x, y:_arg1.y, rotation:(skin.rotation + 180), scaleX:0, scaleY:0, time:0.7, transition:"linear"}); } override protected function init():void{ super.init(); skinInner = (skin.getChildByName("inner") as Sprite); eyeLeft = (skinInner.getChildByName("eyeLeft") as Sprite); eyeRight = (skinInner.getChildByName("eyeRight") as Sprite); pupilLeft = (eyeLeft.getChildByName("pupil") as Sprite); pupilRight = (eyeRight.getChildByName("pupil") as Sprite); } protected function rotateEye(_arg1:Sprite, _arg2:Sprite):void{ var _local4:Point; var _local5:Point; var _local6:b2Vec2; var _local7:b2Vec2; var _local3:b2Vec2 = new b2Vec2(skin.stage.mouseX, skin.stage.mouseY); var _local8:Number = 5; _local4 = _arg1.parent.localToGlobal(new Point(_arg1.x, _arg1.y)); _local7 = new b2Vec2(_local4.x, _local4.y); _local6 = _local3.Copy(); _local6.Subtract(_local7); if (_local6.Length() < _local8){ _local5 = _arg1.globalToLocal(new Point(_local3.x, _local3.y)); } else { _local6.Normalize(); _local6.Multiply(_local8); _local7.Add(_local6); _local5 = _arg1.globalToLocal(new Point(_local7.x, _local7.y)); }; _arg2.x = _local5.x; _arg2.y = _local5.y; } override protected function checkBounds():void{ var _local1:b2Vec2 = body.GetPosition(); var _local2:Number = (_local1.y * engine.m_physScale); if (_local2 > 500){ engine.playerOutOfBounds(); }; } } }//package core.objects
Section 135
//PlayerDef (core.objects.PlayerDef) package core.objects { public class PlayerDef extends CircleObjectDef { public static const NAME:String = "p"; public function PlayerDef(_arg1:Number, _arg2:Number, _arg3:Number):void{ super(_arg1, _arg2, false, false, _arg3); } override public function getStringDef():String{ var _local1 = (NAME + "_"); _local1 = (_local1 + (x + "_")); _local1 = (_local1 + (y + "_")); _local1 = (_local1 + r); return (_local1); } public static function parseStringDef(_arg1:String):PlayerDef{ var _local2:Array = _arg1.split("_"); var _local3:Number = _local2[1]; var _local4:Number = _local2[2]; var _local5:Number = _local2[3]; var _local6:PlayerDef = new PlayerDef(_local3, _local4, _local5); return (_local6); } } }//package core.objects
Section 136
//PolyObject (core.objects.PolyObject) package core.objects { import flash.display.*; import core.events.*; import core.*; import flash.geom.*; import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.*; import geom.*; import caurina.transitions.*; public class PolyObject extends BodyObject { protected var polyDef:PolyObjectDef; public function PolyObject(_arg1:PolyObjectDef):void{ this.polyDef = _arg1; super(_arg1); } override protected function createShapeDef():b2ShapeDef{ var _local4:Point; var _local5:Point; var _local1:b2PolygonDef = new b2PolygonDef(); var _local2:Sprite = new Sprite(); _local2.x = polyDef.x; _local2.y = polyDef.y; _local1.vertexCount = polyDef.vertices.length; var _local3:uint; while (_local3 < polyDef.vertices.length) { _local4 = polyDef.vertices[_local3]; _local5 = _local2.globalToLocal(_local4); polyDef.vertices[_local3] = _local5; _local1.vertices[_local3].Set((_local5.x / engine.m_physScale), (_local5.y / engine.m_physScale)); _local3++; }; _local1.density = 1; return (_local1); } public function isPointInside(_arg1:Point):Boolean{ return (getGeomPoly().isPointInside(_arg1)); } private function getSplittedPieceDef(_arg1:Array, _arg2:b2Vec2, _arg3:Number):Object{ var _local4:Array = _arg1; var _local5:b2Vec2 = body.GetPosition().Copy(); _local5.Multiply(engine.m_physScale); var _local6:Number = (polyDef.skinRotation + ((body.GetAngle() * 180) / Math.PI)); return ({pos:_local5, vertices:_local4, linearVel:_arg2, angularVel:_arg3, startPos:polyDef.startPos, skinRotation:_local6}); } override protected function createBodyDef():b2BodyDef{ var _local1:b2BodyDef = new b2BodyDef(); _local1.position.Set((polyDef.x / engine.m_physScale), (polyDef.y / engine.m_physScale)); return (_local1); } protected function checkIntersections(_arg1:CoreEvent):void{ var _local4:b2Vec2; var _local6:Line; var _local7:Point; var _local13:uint; var _local14:Number; var _local15:Object; var _local16:Object; var _local17:Object; var _local2:Line = (_arg1.data as Line); var _local3:b2PolygonShape = (body.m_shapeList as b2PolygonShape); var _local5:b2Vec2 = getPolyVertex(_local3, 0); var _local8:Array = [new Point(_local5.x, _local5.y)]; var _local9:Array = []; var _local10:Array = _local8; var _local11:Array = []; var _local12:uint = 1; while (_local12 <= _local3.m_vertexCount) { _local13 = _local12; if (_local13 == _local3.m_vertexCount){ _local13 = 0; }; _local4 = getPolyVertex(_local3, _local13); _local6 = new Line(new Point(Math.round(_local5.x), Math.round(_local5.y)), new Point(Math.round(_local4.x), Math.round(_local4.y))); _local7 = Line.checkIntersections(_local2, _local6); if (_local7){ _local8.push(_local7); _local9.push(_local7); if ((_local10 == _local8)){ _local10 = _local9; } else { _local10 = _local8; }; _local11.push(_local7); }; if (_local13 != 0){ _local10.push(new Point(_local4.x, _local4.y)); }; _local5 = _local4; _local12++; }; if (_local11.length == 2){ _local14 = body.m_angularVelocity; _local15 = getSplittedPieceDef(_local8, body.m_linearVelocity.Copy(), _local14); _local16 = getSplittedPieceDef(_local9, body.m_linearVelocity.Copy(), _local14); _local17 = {remove:this, add:[_local15, _local16]}; dispatchEvent(new CoreEvent(CoreEvent.SPLIT_SUCCESS, _local17)); }; } override protected function getBodyUnderPointHander(_arg1:CoreEvent):void{ var _local2:Point = (_arg1.data as Point); if (isPointInside(_local2)){ dispatchEvent(new CoreEvent(CoreEvent.RETURN_BODY_UNDER_POINT, this)); }; } private function getPolyVertex(_arg1:b2PolygonShape, _arg2:uint):b2Vec2{ var _local3:b2Vec2 = _arg1.m_vertices[_arg2]; var _local4:b2Vec2 = _local3.Copy(); var _local5:Number = _arg1.GetBody().GetAngle(); rotateVec(_local4, _local5); var _local6:b2Vec2 = _arg1.GetBody().GetPosition(); var _local7:b2Vec2 = _local6.Copy(); _local7.Add(_local4); _local7.Multiply(engine.m_physScale); return (_local7); } override protected function init():void{ super.init(); if (polyDef.splittable){ engine.dispatcher.addEventListener(CoreEvent.CHECK_BODY_INTERSECTIONS, checkIntersections); }; } private function rotateVec(_arg1:b2Vec2, _arg2:Number):void{ var _local3:Number = Math.cos(_arg2); var _local4:Number = Math.sin(_arg2); var _local5:Number = ((_arg1.x * _local3) - (_arg1.y * _local4)); _arg1.y = ((_arg1.x * _local4) + (_arg1.y * _local3)); _arg1.x = _local5; } override protected function levelRestartStart(_arg1:CoreEvent):void{ var _local2:Point = new Point(skin.x, skin.y); var _local3:Number = Point.distance(new Point(polyDef.startPos.x, polyDef.startPos.y), _local2); var _local4:Number = (_local3 / 300); Tweener.addTween(skin, {x:polyDef.startPos.x, y:polyDef.startPos.y, rotation:-(polyDef.skinRotation), time:_local4, transition:"easeinoutquad", onComplete:restartComplete}); } override protected function createSkin():Sprite{ var _local1:Class; var _local7:Point; if (polyDef.isStatic){ _local1 = engine.assets.getAssetClass("BrickMaterial"); } else { if (polyDef.splittable){ _local1 = engine.assets.getAssetClass("WoodMaterial"); } else { _local1 = engine.assets.getAssetClass("MetallMaterial"); }; }; var _local2:BitmapData = (new _local1(0, 0) as BitmapData); var _local3:Sprite = new Sprite(); var _local4:Matrix = new Matrix(); _local4.rotate(((polyDef.skinRotation * Math.PI) / 180)); _local3.graphics.beginBitmapFill(_local2, _local4, true, true); _local3.graphics.lineStyle(0, 0, 1); var _local5:Point = polyDef.vertices[0]; _local3.graphics.moveTo(_local5.x, _local5.y); var _local6:uint = 1; while (_local6 < polyDef.vertices.length) { _local7 = polyDef.vertices[_local6]; _local3.graphics.lineTo(_local7.x, _local7.y); _local6++; }; _local3.graphics.lineTo(_local5.x, _local5.y); _local3.graphics.endFill(); engine.canvas.bodiesContainer.addChild(_local3); return (_local3); } override public function destroy(_arg1:CoreEvent=null):void{ super.destroy(_arg1); if (polyDef.splittable){ engine.dispatcher.removeEventListener(CoreEvent.CHECK_BODY_INTERSECTIONS, checkIntersections); }; } private function getGeomPoly():GeomPoly{ var _local6:b2Vec2; var _local7:Vector; var _local1:Array = []; var _local2:b2Vec2 = body.GetPosition(); var _local3:Number = (_local2.x * engine.m_physScale); var _local4:Number = (_local2.y * engine.m_physScale); var _local5:uint; while (_local5 < polyDef.vertices.length) { _local6 = body.GetWorldPoint(new b2Vec2((polyDef.vertices[_local5].x / engine.m_physScale), (polyDef.vertices[_local5].y / engine.m_physScale))); _local7 = new Vector((_local6.x * engine.m_physScale), (_local6.y * engine.m_physScale)); _local1.push(_local7); _local5++; }; return (new GeomPoly(_local1)); } } }//package core.objects
Section 137
//PolyObjectDef (core.objects.PolyObjectDef) package core.objects { import flash.geom.*; public class PolyObjectDef extends BodyObjectDef { public var vertices:Array; public var skinRotation:Number; public static const NAME:String = "po"; public function PolyObjectDef(_arg1:Number, _arg2:Number, _arg3:Boolean, _arg4:Boolean, _arg5:Array, _arg6:Number, _arg7:Point=null):void{ this.vertices = _arg5; this.skinRotation = _arg6; this.startPos = ((_arg7 == null)) ? new Point(_arg1, _arg2) : _arg7; super(_arg1, _arg2, _arg3, _arg4); } public static function parseStringDef(_arg1:String):PolyObjectDef{ var _local6:Boolean; var _local7:Boolean; var _local2:Array = _arg1.split("_"); var _local3:Number = _local2[1]; var _local4:Number = _local2[2]; var _local5:int = _local2[3]; switch (_local5){ case 0: _local6 = false; _local7 = true; break; case 1: _local6 = false; _local7 = false; break; case 2: _local6 = true; _local7 = false; break; }; var _local8:String = _local2[4]; var _local9:Array = _local8.split("|"); var _local10:Array = []; var _local11:uint; while (_local11 < _local9.length) { _local10.push(new Point(_local9[_local11], _local9[(_local11 + 1)])); _local11 = (_local11 + 2); }; var _local12:Number = _local2[5]; var _local13:PolyObjectDef = new PolyObjectDef(_local3, _local4, _local7, _local6, _local10, _local12); return (_local13); } } }//package core.objects
Section 138
//RectObject (core.objects.RectObject) package core.objects { import flash.display.*; import flash.geom.*; public class RectObject extends PolyObject { protected var rectDef:RectObjectDef; public function RectObject(_arg1:RectObjectDef):void{ this.rectDef = _arg1; var _local2:Sprite = new Sprite(); _local2.x = _arg1.x; _local2.y = _arg1.y; _local2.rotation = _arg1.rotation; var _local3:Point = _local2.localToGlobal(new Point((-(_arg1.w) / 2), (-(_arg1.h) / 2))); var _local4:Point = _local2.localToGlobal(new Point((_arg1.w / 2), (-(_arg1.h) / 2))); var _local5:Point = _local2.localToGlobal(new Point((_arg1.w / 2), (_arg1.h / 2))); var _local6:Point = _local2.localToGlobal(new Point((-(_arg1.w) / 2), (_arg1.h / 2))); _arg1.vertices = [_local3, _local4, _local5, _local6]; _arg1.skinRotation = 0; super(_arg1); } } }//package core.objects
Section 139
//RectObjectDef (core.objects.RectObjectDef) package core.objects { import flash.geom.*; public class RectObjectDef extends PolyObjectDef { public var w:Number; public var h:Number; public var rotation:Number; public static const NAME:String = "r"; public function RectObjectDef(_arg1:Number, _arg2:Number, _arg3:Boolean, _arg4:Boolean, _arg5:Number, _arg6:Number, _arg7:Number=0):void{ this.w = _arg5; this.h = _arg6; this.rotation = _arg7; var _local8:Array = []; _local8.push(new Point((_arg1 - (_arg5 / 2)), (_arg2 - (_arg6 / 2)))); _local8.push(new Point((_arg1 + (_arg5 / 2)), (_arg2 - (_arg6 / 2)))); _local8.push(new Point((_arg1 + (_arg5 / 2)), (_arg2 + (_arg6 / 2)))); _local8.push(new Point((_arg1 - (_arg5 / 2)), (_arg2 + (_arg6 / 2)))); super(_arg1, _arg2, _arg3, _arg4, _local8, 0); } override public function getStringDef():String{ var _local2:int; var _local1 = (NAME + "_"); _local1 = (_local1 + (x + "_")); _local1 = (_local1 + (y + "_")); switch (isStatic){ case false: _local2 = (splittable) ? 0 : 1; break; case true: _local2 = 2; break; }; _local1 = (_local1 + (_local2 + "_")); _local1 = (_local1 + (w + "_")); _local1 = (_local1 + (h + "_")); _local1 = (_local1 + rotation); return (_local1); } public static function parseStringDef(_arg1:String):RectObjectDef{ var _local6:Boolean; var _local7:Boolean; var _local2:Array = _arg1.split("_"); var _local3:Number = _local2[1]; var _local4:Number = _local2[2]; var _local5:int = _local2[3]; switch (_local5){ case 0: _local6 = false; _local7 = true; break; case 1: _local6 = false; _local7 = false; break; case 2: _local6 = true; _local7 = false; break; }; var _local8:Number = _local2[4]; var _local9:Number = _local2[5]; var _local10:Number = _local2[6]; var _local11:RectObjectDef = new RectObjectDef(_local3, _local4, _local7, _local6, _local8, _local9, _local10); return (_local11); } } }//package core.objects
Section 140
//CoreAssets (core.CoreAssets) package core { import flash.events.*; import flash.display.*; import flash.system.*; public class CoreAssets extends EventDispatcher implements IGameAssets { private var Assets:Class; private var appDomain:ApplicationDomain; public var inited:Boolean; private static var instance:CoreAssets; public function CoreAssets():void{ Assets = CoreAssets_Assets; super(); inited = false; } public function init():void{ var _local1:Loader = new Loader(); _local1.contentLoaderInfo.addEventListener(Event.INIT, assetsInitHandler); _local1.loadBytes(new Assets()); } private function assetsInitHandler(_arg1:Event):void{ appDomain = _arg1.target.content.loaderInfo.applicationDomain; inited = true; dispatchEvent(new Event(Event.INIT)); } public function getAssetClass(_arg1:String):Class{ if (!appDomain.hasDefinition(_arg1)){ trace((("*Error*: There is no definition of class '" + _arg1) + "'")); return (null); }; return ((appDomain.getDefinition(_arg1) as Class)); } public static function getInstance():CoreAssets{ if (!instance){ instance = new (CoreAssets); }; return (instance); } } }//package core
Section 141
//CoreAssets_Assets (core.CoreAssets_Assets) package core { import mx.core.*; public class CoreAssets_Assets extends ByteArrayAsset { } }//package core
Section 142
//GameCanvas (core.GameCanvas) package core { import flash.display.*; public class GameCanvas { public var playerContainer:Sprite; public var bodiesContainer:Sprite; public var jointsContainer:Sprite; public var debugContainer:Sprite; public function GameCanvas(_arg1:Sprite, _arg2:Sprite, _arg3:Sprite, _arg4:Sprite):void{ this.bodiesContainer = _arg1; this.jointsContainer = _arg2; this.playerContainer = _arg3; this.debugContainer = _arg4; } } }//package core
Section 143
//GameEngine (core.GameEngine) package core { import flash.events.*; import core.events.*; import flash.geom.*; import core.objects.*; import flash.media.*; import Box2D.Common.Math.*; import Box2D.Collision.Shapes.*; import Box2D.Dynamics.*; import Box2D.Collision.*; import Box2D.Dynamics.Joints.*; public class GameEngine { public var sndTransform:SoundTransform; private var splitSuccess:Boolean; public var assets:IGameAssets; private var currentLevel:Level; private var jointObj:DistanceJointObject; public var m_physScale:Number;// = 30 private var sndSplitSuccess:Sound; private var objects:Array; private var exit:Exit; public var dispatcher:EventDispatcher; private var currentObjectsNum:int; public var m_world:b2World; private var m_iterations:int;// = 10 private var m_timeStep:Number;// = 0.0333333333333333 private var objectsNum:int; public var canvas:GameCanvas; public var sndChannel:SoundChannel; private var player:Player; private var bodyObj:BodyObject; public static const SPLIT_FAIL:String = "SplitFail"; public static const SPLIT_SUCCESS:String = "SplitSuccess"; private static var instance:GameEngine; public function GameEngine():void{ init(); } private function splitSuccessHandler(_arg1:CoreEvent):void{ var _local2:Object = _arg1.data; if ((_arg1.target is PolyObject)){ splitPoly(_local2); } else { if ((_arg1.target is DistanceJointObject)){ splitDistanceJoint(_local2); }; }; splitSuccess = true; } private function createRect(_arg1:RectObjectDef):void{ var _local2:RectObject = new RectObject(_arg1); createBaseObj(_local2); } private function parseLevel(_arg1:String):void{ var _local4:String; var _local5:Array; var _local6:String; var _local2:Array = _arg1.split(" "); var _local3:uint; while (_local3 < _local2.length) { _local4 = _local2[_local3]; _local5 = _local4.split("_"); _local6 = _local5[0]; switch (_local6){ case PlayerDef.NAME: createPlayer(PlayerDef.parseStringDef(_local4)); break; case CircleObjectDef.NAME: createCircle(CircleObjectDef.parseStringDef(_local4)); break; case ExitDef.NAME: createExit(ExitDef.parseStringDef(_local4)); break; case PolyObjectDef.NAME: createPoly(PolyObjectDef.parseStringDef(_local4)); break; case DistanceJointObjectDef.NAME: createJoint(DistanceJointObjectDef.parseStringDef(_local4)); break; case BonusDef.NAME: createBonus(BonusDef.parseStringDef(_local4)); break; case RectObjectDef.NAME: createRect(RectObjectDef.parseStringDef(_local4)); }; _local3++; }; } public function levelAbort():void{ canvas.bodiesContainer.removeEventListener(Event.ENTER_FRAME, efHandler); dispatcher.dispatchEvent(new CoreEvent(CoreEvent.DESTROY)); } private function init():void{ dispatcher = new EventDispatcher(); } public function initialize(_arg1:IGameAssets, _arg2:GameCanvas, _arg3:SoundTransform):void{ this.assets = _arg1; this.canvas = _arg2; this.sndTransform = _arg3; initSounds(); } private function splitDistanceJoint(_arg1:Object):void{ removeBaseObj((_arg1.remove as DistanceJointObject)); } private function createBonus(_arg1:BonusDef):void{ var _local2:Bonus = new Bonus(_arg1); _local2.addEventListener(CoreEvent.BONUS_COLLECT, bonusCollectHandler); createBaseObj(_local2); } private function returnJointObjHandler(_arg1:CoreEvent):void{ jointObj = (_arg1.data as DistanceJointObject); } public function levelRestartStart():void{ canvas.bodiesContainer.removeEventListener(Event.ENTER_FRAME, efHandler); currentObjectsNum = 0; dispatcher.dispatchEvent(new CoreEvent(CoreEvent.LEVEL_RESTART_START)); } private function initWalls():void{ var _local3:b2Body; var _local1:b2PolygonDef = new b2PolygonDef(); var _local2:b2BodyDef = new b2BodyDef(); _local2.position.Set((-95 / m_physScale), ((480 / m_physScale) / 2)); _local1.SetAsBox((100 / m_physScale), ((480 / m_physScale) / 2)); _local3 = m_world.CreateStaticBody(_local2); _local3.CreateShape(_local1); _local3.SetMassFromShapes(); _local2.position.Set((((640 + 95) - 60) / m_physScale), ((480 / m_physScale) / 2)); _local3 = m_world.CreateStaticBody(_local2); _local3.CreateShape(_local1); _local3.SetMassFromShapes(); _local2.position.Set(((640 / m_physScale) / 2), (-95 / m_physScale)); _local1.SetAsBox(((640 / m_physScale) / 2), (100 / m_physScale)); _local3 = m_world.CreateStaticBody(_local2); _local3.CreateShape(_local1); _local3.SetMassFromShapes(); _local2.position.Set(((640 / m_physScale) / 2), ((480 + 95) / m_physScale)); _local3 = m_world.CreateStaticBody(_local2); _local3.CreateShape(_local1); _local3.SetMassFromShapes(); } private function createExit(_arg1:ExitDef):void{ exit = new Exit(_arg1); exit.addEventListener(CoreEvent.LEVEL_COMPLETE, levelCompleteHandler); createBaseObj(exit); } public function levelStart(_arg1:Level):void{ objectsNum = 0; objects = []; initBox2d(); initWalls(); parseLevel(_arg1.def); currentLevel = _arg1; canvas.bodiesContainer.addEventListener(Event.ENTER_FRAME, efHandler); } private function bonusCollectHandler(_arg1:CoreEvent):void{ var _local2:Bonus = (_arg1.data as Bonus); removeBaseObj(_local2); dispatcher.dispatchEvent(new CoreEvent(CoreEvent.BONUS_COLLECT)); } private function levelCompleteHandler(_arg1:CoreEvent):void{ canvas.bodiesContainer.removeEventListener(Event.ENTER_FRAME, efHandler); var _local2:b2Vec2 = exit.getBody().GetPosition(); var _local3:Point = new Point((_local2.x * m_physScale), (_local2.y * m_physScale)); player.levelComplete(_local3); dispatcher.dispatchEvent(new CoreEvent(CoreEvent.LEVEL_COMPLETE)); } public function getBodyObjUnderPoint(_arg1:Point):BodyObject{ bodyObj = null; dispatcher.dispatchEvent(new CoreEvent(CoreEvent.GET_BODY_UNDER_POINT, _arg1)); return (bodyObj); } private function returnBodyUnderPointHandler(_arg1:CoreEvent):void{ bodyObj = (_arg1.data as BodyObject); } public function removeBaseObj(_arg1:BaseObject):void{ _arg1.removeEventListener(CoreEvent.SPLIT_SUCCESS, splitSuccessHandler); _arg1.removeEventListener(CoreEvent.LEVEL_RESTART_END, levelRestartEnd); objectsNum--; _arg1.destroy(); } private function createBaseObj(_arg1:BaseObject):void{ _arg1.addEventListener(CoreEvent.SPLIT_SUCCESS, splitSuccessHandler); _arg1.addEventListener(CoreEvent.LEVEL_RESTART_END, levelRestartEnd); _arg1.addEventListener(CoreEvent.RETURN_BODY_UNDER_POINT, returnBodyUnderPointHandler); objects.push(_arg1); objectsNum++; } private function splitPoly(_arg1:Object):void{ var _local3:uint; var _local8:b2DistanceJoint; var _local9:b2Vec2; var _local10:b2Vec2; var _local11:b2Vec2; var _local12:Array; var _local13:PolyObjectDef; var _local14:Number; var _local15:Point; var _local16:Point; var _local17:DistanceJointObjectDef; var _local2:PolyObject = (_arg1.remove as PolyObject); var _local4:Array = []; var _local5:Array = []; var _local6:b2JointEdge = _local2.getBody().m_jointList; while (_local6) { _local8 = (_local6.joint as b2DistanceJoint); _local9 = _local8.GetAnchor1().Copy(); _local10 = _local8.GetAnchor2().Copy(); jointObj = null; dispatcher.dispatchEvent(new CoreEvent(CoreEvent.GET_JOINT_OBJECT, _local8)); _local5.push(jointObj); _local4.push({a1:_local9, a2:_local10}); _local6 = _local6.next; }; _local3 = 0; while (_local3 < _local5.length) { removeBaseObj(_local5[_local3]); _local3++; }; removeBaseObj(_local2); var _local7:Array = (_arg1.add as Array); _local3 = 0; while (_local3 < _local7.length) { _local11 = _local7[_local3].pos; _local12 = _local7[_local3].vertices; _local13 = new PolyObjectDef(_local11.x, _local11.y, true, false, _local12, _local7[_local3].skinRotation, _local7[_local3].startPos); _local2 = createPoly(_local13); _local14 = _local7[_local3].angularVel; _local2.getBody().m_linearVelocity = _local7[_local3].linearVel; _local2.getBody().m_angularVelocity = _local14; _local3++; }; _local3 = 0; while (_local3 < _local4.length) { _local15 = new Point((_local4[_local3].a1.x * m_physScale), (_local4[_local3].a1.y * m_physScale)); _local16 = new Point((_local4[_local3].a2.x * m_physScale), (_local4[_local3].a2.y * m_physScale)); _local17 = new DistanceJointObjectDef(100, 100, true, _local15, _local16); createJoint(_local17); _local3++; }; } private function initBox2d():void{ var _local1:b2AABB = new b2AABB(); _local1.lowerBound.Set(-1000, -1000); _local1.upperBound.Set(1000, 1000); var _local2:b2Vec2 = new b2Vec2(0, 10); var _local3:Boolean; m_world = new b2World(_local1, _local2, _local3); var _local4:b2DebugDraw = new b2DebugDraw(); canvas.debugContainer.mouseEnabled = false; canvas.debugContainer.mouseChildren = false; _local4.m_sprite = canvas.debugContainer; _local4.m_drawScale = m_physScale; _local4.m_fillAlpha = 0.7; _local4.m_lineThickness = 1; _local4.m_drawFlags = (b2DebugDraw.e_shapeBit | b2DebugDraw.e_jointBit); } public function levelResume():void{ canvas.bodiesContainer.addEventListener(Event.ENTER_FRAME, efHandler); } public function levelPause():void{ canvas.bodiesContainer.removeEventListener(Event.ENTER_FRAME, efHandler); } public function playerOutOfBounds():void{ levelPause(); dispatcher.dispatchEvent(new CoreEvent(CoreEvent.LEVEL_FAIL)); } public function checkIntersections(_arg1:Line):void{ splitSuccess = false; dispatcher.dispatchEvent(new CoreEvent(CoreEvent.CHECK_JOINT_INTERSECTIONS, _arg1)); dispatcher.dispatchEvent(new CoreEvent(CoreEvent.CHECK_BODY_INTERSECTIONS, _arg1)); if (splitSuccess){ dispatcher.dispatchEvent(new CoreEvent(SPLIT_SUCCESS)); sndChannel = sndSplitSuccess.play(0, 0, sndTransform); } else { dispatcher.dispatchEvent(new CoreEvent(SPLIT_FAIL)); }; } private function createPoly(_arg1:PolyObjectDef):PolyObject{ var _local2:PolyObject = new PolyObject(_arg1); createBaseObj(_local2); return (_local2); } private function efHandler(_arg1:Event):void{ m_world.Step(m_timeStep, m_iterations); dispatcher.dispatchEvent(new CoreEvent(CoreEvent.UPDATE)); } private function createCircle(_arg1:CircleObjectDef):void{ var _local2:CircleObject = new CircleObject(_arg1); createBaseObj(_local2); } private function createJoint(_arg1:DistanceJointObjectDef):void{ var _local2:DistanceJointObject = new DistanceJointObject(_arg1); _local2.addEventListener(CoreEvent.RETURN_JOINT_OBJECT, returnJointObjHandler); _local2.addEventListener(CoreEvent.SPLIT_SUCCESS, splitSuccessHandler); createBaseObj(_local2); } private function levelRestartEnd(_arg1:CoreEvent):void{ currentObjectsNum++; trace(currentObjectsNum, objectsNum); if (currentObjectsNum == objectsNum){ dispatcher.dispatchEvent(new CoreEvent(CoreEvent.DESTROY)); dispatcher.dispatchEvent(new CoreEvent(CoreEvent.LEVEL_RESTART_END)); }; } private function initSounds():void{ var _local1:Class = assets.getAssetClass("SndSplitSuccess"); sndSplitSuccess = new (_local1); } private function createPlayer(_arg1:PlayerDef):void{ player = new Player(_arg1); createBaseObj(player); } public static function getInstance():GameEngine{ if (instance == null){ instance = new (GameEngine); }; return (instance); } } }//package core
Section 144
//IGameAssets (core.IGameAssets) package core { public interface IGameAssets { function getAssetClass(_arg1:String):Class; } }//package core
Section 145
//Level (core.Level) package core { public class Level { public var def:String; public function Level(_arg1:String):void{ this.def = _arg1; } } }//package core
Section 146
//Line (core.Line) package core { import flash.geom.*; public class Line { public var p1:Point; public var p2:Point; public var b:Number; public var k:Number; public function Line(_arg1:Point, _arg2:Point){ this.p1 = _arg1; this.p2 = _arg2; init(); } private function init():void{ var _local1:Number = (p1.x - p2.x); if (Math.abs(_local1) < 1E-7){ k = 1000000; } else { k = ((p1.y - p2.y) / _local1); }; b = (p1.y - (k * p1.x)); } public function toString():String{ return (((("Line k: " + k) + ", b: ") + b)); } public static function checkIntersections(_arg1:Line, _arg2:Line):Point{ var _local3:Number = (_arg1.k - _arg2.k); if (Math.abs(_local3) < 1E-7){ _local3 = 1E-7; }; var _local4:Number = ((_arg2.b - _arg1.b) / _local3); var _local5:Number = ((_arg1.k * _local4) + _arg1.b); var _local6:Point = new Point(_local4, _local5); if (((inSegment(_local6, _arg1)) && (inSegment(_local6, _arg2)))){ return (_local6); }; return (null); } private static function inSegment(_arg1:Point, _arg2:Line):Boolean{ if (_arg2.p1.x == _arg2.p2.x){ if ((((((_arg1.y >= _arg2.p1.y)) && ((_arg1.y <= _arg2.p2.y)))) || ((((_arg1.y <= _arg2.p1.y)) && ((_arg1.y >= _arg2.p2.y)))))){ return (true); }; } else { if ((((((_arg1.x >= _arg2.p1.x)) && ((_arg1.x <= _arg2.p2.x)))) || ((((_arg1.x <= _arg2.p1.x)) && ((_arg1.x >= _arg2.p2.x)))))){ return (true); }; }; return (false); } } }//package core
Section 147
//compareStringCaseInSensitive (de.polygonal.ds.sort.compare.compareStringCaseInSensitive) package de.polygonal.ds.sort.compare { public function compareStringCaseInSensitive(_arg1:String, _arg2:String):int{ var _local3:int; var _local4:int; var _local5:int; _arg1 = _arg1.toLowerCase(); _arg2 = _arg2.toLowerCase(); if ((_arg1.length + _arg2.length) > 2){ _local3 = 0; _local4 = ((_arg1.length > _arg2.length)) ? _arg1.length : _arg2.length; _local5 = 0; while (_local5 < _local4) { _local3 = (_arg1.charCodeAt(_local5) - _arg2.charCodeAt(_local5)); if (_local3 != 0){ break; }; _local5++; }; return (_local3); //unresolved jump }; return ((_arg1.charCodeAt(0) - _arg2.charCodeAt(0))); } }//package de.polygonal.ds.sort.compare
Section 148
//compareStringCaseInSensitiveDesc (de.polygonal.ds.sort.compare.compareStringCaseInSensitiveDesc) package de.polygonal.ds.sort.compare { public function compareStringCaseInSensitiveDesc(_arg1:String, _arg2:String):int{ var _local3:int; var _local4:int; var _local5:int; _arg1 = _arg1.toLowerCase(); _arg2 = _arg2.toLowerCase(); if ((_arg1.length + _arg2.length) > 2){ _local3 = 0; _local4 = ((_arg1.length > _arg2.length)) ? _arg1.length : _arg2.length; _local5 = 0; while (_local5 < _local4) { _local3 = (_arg2.charCodeAt(_local5) - _arg1.charCodeAt(_local5)); if (_local3 != 0){ break; }; _local5++; }; return (_local3); //unresolved jump }; return ((_arg2.charCodeAt(0) - _arg1.charCodeAt(0))); } }//package de.polygonal.ds.sort.compare
Section 149
//compareStringCaseSensitive (de.polygonal.ds.sort.compare.compareStringCaseSensitive) package de.polygonal.ds.sort.compare { public function compareStringCaseSensitive(_arg1:String, _arg2:String):int{ var _local3:int; var _local4:int; var _local5:int; if ((_arg1.length + _arg2.length) > 2){ _local3 = 0; _local4 = ((_arg1.length > _arg2.length)) ? _arg1.length : _arg2.length; _local5 = 0; while (_local5 < _local4) { _local3 = (_arg1.charCodeAt(_local5) - _arg2.charCodeAt(_local5)); if (_local3 != 0){ break; }; _local5++; }; return (_local3); //unresolved jump }; return ((_arg1.charCodeAt(0) - _arg2.charCodeAt(0))); } }//package de.polygonal.ds.sort.compare
Section 150
//compareStringCaseSensitiveDesc (de.polygonal.ds.sort.compare.compareStringCaseSensitiveDesc) package de.polygonal.ds.sort.compare { public function compareStringCaseSensitiveDesc(_arg1:String, _arg2:String):int{ var _local3:int; var _local4:int; var _local5:int; if ((_arg1.length + _arg2.length) > 2){ _local3 = 0; _local4 = ((_arg1.length > _arg2.length)) ? _arg1.length : _arg2.length; _local5 = 0; while (_local5 < _local4) { _local3 = (_arg2.charCodeAt(_local5) - _arg1.charCodeAt(_local5)); if (_local3 != 0){ break; }; _local5++; }; return (_local3); //unresolved jump }; return ((_arg2.charCodeAt(0) - _arg1.charCodeAt(0))); } }//package de.polygonal.ds.sort.compare
Section 151
//dLinkedInsertionSort (de.polygonal.ds.sort.dLinkedInsertionSort) package de.polygonal.ds.sort { import de.polygonal.ds.*; public function dLinkedInsertionSort(_arg1:DListNode, _arg2:Boolean=false):DListNode{ var _local4:DListNode; var _local5:DListNode; var _local6:DListNode; var _local7:DListNode; var _local8:*; if (!_arg1){ return (null); }; var _local3:DListNode = _arg1; if (_arg2){ _local5 = _local3.next; while (_local5) { _local6 = _local5.next; _local4 = _local5.prev; if (_local4.data < _local5.data){ _local7 = _local4; while (_local7.prev) { if (_local7.prev.data < _local5.data){ _local7 = _local7.prev; } else { break; }; }; if (_local6){ _local4.next = _local6; _local6.prev = _local4; } else { _local4.next = null; }; if (_local7 == _local3){ _local5.prev = null; _local5.next = _local7; _local7.prev = _local5; _local3 = _local5; } else { _local5.prev = _local7.prev; _local7.prev.next = _local5; _local5.next = _local7; _local7.prev = _local5; }; }; _local5 = _local6; }; return (_local3); //unresolved jump }; _local5 = _local3.next; while (_local5) { _local6 = _local5.next; _local4 = _local5.prev; if (_local4.data > _local5.data){ _local7 = _local4; while (_local7.prev) { if (_local7.prev.data > _local5.data){ _local7 = _local7.prev; } else { break; }; }; if (_local6){ _local4.next = _local6; _local6.prev = _local4; } else { _local4.next = null; }; if (_local7 == _local3){ _local5.prev = null; _local5.next = _local7; _local7.prev = _local5; _local3 = _local5; } else { _local5.prev = _local7.prev; _local7.prev.next = _local5; _local5.next = _local7; _local7.prev = _local5; }; }; _local5 = _local6; }; return (_local3); } }//package de.polygonal.ds.sort
Section 152
//dLinkedInsertionSortCmp (de.polygonal.ds.sort.dLinkedInsertionSortCmp) package de.polygonal.ds.sort { import de.polygonal.ds.*; public function dLinkedInsertionSortCmp(_arg1:DListNode, _arg2:Function, _arg3:Boolean=false):DListNode{ var _local5:DListNode; var _local6:DListNode; var _local7:DListNode; var _local8:DListNode; var _local9:*; if (((!(_arg1)) || ((_arg2 == null)))){ return (null); }; var _local4:DListNode = _arg1; if (_arg3){ _local6 = _local4.next; while (_local6) { _local7 = _local6.next; _local5 = _local6.prev; if (_arg2(_local5.data, _local6.data) < 0){ _local8 = _local5; while (_local8.prev) { if (_arg2(_local8.prev.data, _local6.data) < 0){ _local8 = _local8.prev; } else { break; }; }; if (_local7){ _local5.next = _local7; _local7.prev = _local5; } else { _local5.next = null; }; if (_local8 == _local4){ _local6.prev = null; _local6.next = _local8; _local8.prev = _local6; _local4 = _local6; } else { _local6.prev = _local8.prev; _local8.prev.next = _local6; _local6.next = _local8; _local8.prev = _local6; }; }; _local6 = _local7; }; } else { _local6 = _local4.next; while (_local6) { _local7 = _local6.next; _local5 = _local6.prev; if (_arg2(_local5.data, _local6.data) > 0){ _local8 = _local5; while (_local8.prev) { if (_arg2(_local8.prev.data, _local6.data) > 0){ _local8 = _local8.prev; } else { break; }; }; if (_local7){ _local5.next = _local7; _local7.prev = _local5; } else { _local5.next = null; }; if (_local8 == _local4){ _local6.prev = null; _local6.next = _local8; _local8.prev = _local6; _local4 = _local6; } else { _local6.prev = _local8.prev; _local8.prev.next = _local6; _local6.next = _local8; _local8.prev = _local6; }; }; _local6 = _local7; }; }; return (_local4); } }//package de.polygonal.ds.sort
Section 153
//dLinkedMergeSort (de.polygonal.ds.sort.dLinkedMergeSort) package de.polygonal.ds.sort { import de.polygonal.ds.*; public function dLinkedMergeSort(_arg1:DListNode, _arg2:Boolean=false):DListNode{ var _local4:DListNode; var _local5:DListNode; var _local6:DListNode; var _local7:DListNode; var _local9:int; var _local10:int; var _local11:int; var _local12:int; if (!_arg1){ return (null); }; var _local3:DListNode = _arg1; var _local8 = 1; if (_arg2){ while (true) { _local4 = _local3; _local7 = null; _local3 = _local7; _local9 = 0; while (_local4) { _local9++; _local12 = 0; _local10 = 0; _local5 = _local4; while (_local12 < _local8) { _local10++; _local5 = _local5.next; if (!_local5){ break; }; _local12++; }; _local11 = _local8; while ((((_local10 > 0)) || ((((_local11 > 0)) && (_local5))))) { if (_local10 == 0){ _local6 = _local5; _local5 = _local5.next; _local11--; } else { if ((((_local11 == 0)) || (!(_local5)))){ _local6 = _local4; _local4 = _local4.next; _local10--; } else { if ((_local4.data - _local5.data) >= 0){ _local6 = _local4; _local4 = _local4.next; _local10--; } else { _local6 = _local5; _local5 = _local5.next; _local11--; }; }; }; if (_local7){ _local7.next = _local6; } else { _local3 = _local6; }; _local6.prev = _local7; _local7 = _local6; }; _local4 = _local5; }; _local7.next = null; if (_local9 <= 1){ return (_local3); }; _local8 = (_local8 << 1); }; } else { while (true) { _local4 = _local3; _local7 = null; _local3 = _local7; _local9 = 0; while (_local4) { _local9++; _local12 = 0; _local10 = 0; _local5 = _local4; while (_local12 < _local8) { _local10++; _local5 = _local5.next; if (!_local5){ break; }; _local12++; }; _local11 = _local8; while ((((_local10 > 0)) || ((((_local11 > 0)) && (_local5))))) { if (_local10 == 0){ _local6 = _local5; _local5 = _local5.next; _local11--; } else { if ((((_local11 == 0)) || (!(_local5)))){ _local6 = _local4; _local4 = _local4.next; _local10--; } else { if ((_local4.data - _local5.data) <= 0){ _local6 = _local4; _local4 = _local4.next; _local10--; } else { _local6 = _local5; _local5 = _local5.next; _local11--; }; }; }; if (_local7){ _local7.next = _local6; } else { _local3 = _local6; }; _local6.prev = _local7; _local7 = _local6; }; _local4 = _local5; }; _local7.next = null; if (_local9 <= 1){ return (_local3); }; _local8 = (_local8 << 1); }; }; return (null); } }//package de.polygonal.ds.sort
Section 154
//dLinkedMergeSortCmp (de.polygonal.ds.sort.dLinkedMergeSortCmp) package de.polygonal.ds.sort { import de.polygonal.ds.*; public function dLinkedMergeSortCmp(_arg1:DListNode, _arg2:Function, _arg3:Boolean=false):DListNode{ var _local5:DListNode; var _local6:DListNode; var _local7:DListNode; var _local8:DListNode; var _local10:int; var _local11:int; var _local12:int; var _local13:int; if (((!(_arg1)) || ((_arg2 == null)))){ return (null); }; var _local4:DListNode = _arg1; var _local9 = 1; if (_arg3){ while (true) { _local5 = _local4; _local8 = null; _local4 = _local8; _local10 = 0; while (_local5) { _local10++; _local13 = 0; _local11 = 0; _local6 = _local5; while (_local13 < _local9) { _local11++; _local6 = _local6.next; if (!_local6){ break; }; _local13++; }; _local12 = _local9; while ((((_local11 > 0)) || ((((_local12 > 0)) && (_local6))))) { if (_local11 == 0){ _local7 = _local6; _local6 = _local6.next; _local12--; } else { if ((((_local12 == 0)) || (!(_local6)))){ _local7 = _local5; _local5 = _local5.next; _local11--; } else { if (_arg2(_local5.data, _local6.data) >= 0){ _local7 = _local5; _local5 = _local5.next; _local11--; } else { _local7 = _local6; _local6 = _local6.next; _local12--; }; }; }; if (_local8){ _local8.next = _local7; } else { _local4 = _local7; }; _local7.prev = _local8; _local8 = _local7; }; _local5 = _local6; }; _arg1.prev = _local8; _local8.next = null; if (_local10 <= 1){ return (_local4); }; _local9 = (_local9 << 1); }; } else { while (true) { _local5 = _local4; _local8 = null; _local4 = _local8; _local10 = 0; while (_local5) { _local10++; _local13 = 0; _local11 = 0; _local6 = _local5; while (_local13 < _local9) { _local11++; _local6 = _local6.next; if (!_local6){ break; }; _local13++; }; _local12 = _local9; while ((((_local11 > 0)) || ((((_local12 > 0)) && (_local6))))) { if (_local11 == 0){ _local7 = _local6; _local6 = _local6.next; _local12--; } else { if ((((_local12 == 0)) || (!(_local6)))){ _local7 = _local5; _local5 = _local5.next; _local11--; } else { if (_arg2(_local5.data, _local6.data) <= 0){ _local7 = _local5; _local5 = _local5.next; _local11--; } else { _local7 = _local6; _local6 = _local6.next; _local12--; }; }; }; if (_local8){ _local8.next = _local7; } else { _local4 = _local7; }; _local7.prev = _local8; _local8 = _local7; }; _local5 = _local6; }; _arg1.prev = _local8; _local8.next = null; if (_local10 <= 1){ return (_local4); }; _local9 = (_local9 << 1); }; }; return (null); } }//package de.polygonal.ds.sort
Section 155
//Collection (de.polygonal.ds.Collection) package de.polygonal.ds { public interface Collection { function get size():int; function isEmpty():Boolean; function getIterator():Iterator; function clear():void; function toArray():Array; function contains(_arg1):Boolean; } }//package de.polygonal.ds
Section 156
//DLinkedList (de.polygonal.ds.DLinkedList) package de.polygonal.ds { import de.polygonal.ds.sort.*; import de.polygonal.ds.sort.compare.*; public class DLinkedList implements Collection { private var _count:int; public var tail:DListNode; public var head:DListNode; public function DLinkedList(... _args){ head = (tail = null); _count = 0; if (_args.length > 0){ append.apply(this, _args); }; } public function get size():int{ return (_count); } public function isEmpty():Boolean{ return ((_count == 0)); } public function remove(_arg1:DListIterator):Boolean{ if (((!((_arg1.list == this))) || (!(_arg1.node)))){ return (false); }; var _local2:DListNode = _arg1.node; if (_local2 == head){ head = head.next; } else { if (_local2 == tail){ tail = tail.prev; }; }; if (_arg1.node){ _arg1.node = _arg1.node.next; }; if (_local2.prev){ _local2.prev.next = _local2.next; }; if (_local2.next){ _local2.next.prev = _local2.prev; }; _local2.next = (_local2.prev = null); if (head == null){ tail = null; }; _count--; return (true); } public function removeHead(){ var _local1:*; if (head){ _local1 = head.data; head = head.next; if (head){ head.prev = null; } else { tail = null; }; _count--; return (_local1); }; return (null); } public function clear():void{ var _local2:DListNode; var _local1:DListNode = head; head = null; while (_local1) { _local2 = _local1.next; _local1.next = (_local1.prev = null); _local1 = _local2; }; _count = 0; } public function prepend(... _args):DListNode{ var _local4:DListNode; var _local5:int; var _local2:int = _args.length; var _local3:DListNode = new DListNode(_args[int((_local2 - 1))]); if (head){ head.insertBefore(_local3); head = head.prev; } else { head = (tail = _local3); }; if (_local2 > 1){ _local4 = _local3; _local5 = (_local2 - 2); while (_local5 >= 0) { _local3 = new DListNode(_args[_local5]); head.insertBefore(_local3); head = head.prev; _local5--; }; _count = (_count + _local2); return (_local4); }; _count++; return (_local3); } public function popDown():void{ var _local1:DListNode = tail; if (tail.prev == head){ tail = head; tail.next = null; head = _local1; head.prev = null; head.next = tail; tail.prev = head; } else { tail = tail.prev; tail.next = null; head.prev = _local1; _local1.prev = null; _local1.next = head; head = _local1; }; } public function concat(... _args):DLinkedList{ var _local3:DLinkedList; var _local4:DListNode; var _local2:DLinkedList = new DLinkedList(); _local4 = head; while (_local4) { _local2.append(_local4.data); _local4 = _local4.next; }; var _local5:int = _args.length; var _local6:int; while (_local6 < _local5) { _local3 = _args[_local6]; _local4 = _local3.head; while (_local4) { _local2.append(_local4.data); _local4 = _local4.next; }; _local6++; }; return (_local2); } public function insertBefore(_arg1:DListIterator, _arg2):DListNode{ var _local3:DListNode; if (_arg1.list != this){ return (null); }; if (_arg1.node){ _local3 = new DListNode(_arg2); _arg1.node.insertBefore(_local3); if (_arg1.node == head){ head = head.prev; }; _count++; return (_local3); //unresolved jump }; return (prepend(_arg2)); } public function append(... _args):DListNode{ var _local4:DListNode; var _local5:int; var _local2:int = _args.length; var _local3:DListNode = new DListNode(_args[0]); if (head){ tail.insertAfter(_local3); tail = tail.next; } else { head = (tail = _local3); }; if (_local2 > 1){ _local4 = _local3; _local5 = 1; while (_local5 < _local2) { _local3 = new DListNode(_args[_local5]); tail.insertAfter(_local3); tail = tail.next; _local5++; }; _count = (_count + _local2); return (_local4); }; _count++; return (_local3); } public function sort(... _args):void{ var _local2:int; var _local3:Function; var _local4:*; if (_count <= 1){ return; }; if (_args.length > 0){ _local2 = 0; _local3 = null; _local4 = _args[0]; if ((_local4 is Function)){ _local3 = _local4; if (_args.length > 1){ _local4 = _args[1]; if ((_local4 is int)){ _local2 = _local4; }; }; } else { if ((_local4 is int)){ _local2 = _local4; }; }; if (Boolean(_local3)){ if ((_local2 & 2)){ head = dLinkedInsertionSortCmp(head, _local3, (_local2 == 18)); } else { head = dLinkedMergeSortCmp(head, _local3, (_local2 == 16)); }; } else { if ((_local2 & 2)){ if ((_local2 & 4)){ if (_local2 == 22){ head = dLinkedInsertionSortCmp(head, compareStringCaseSensitiveDesc); } else { if (_local2 == 14){ head = dLinkedInsertionSortCmp(head, compareStringCaseInSensitive); } else { if (_local2 == 30){ head = dLinkedInsertionSortCmp(head, compareStringCaseInSensitiveDesc); } else { head = dLinkedInsertionSortCmp(head, compareStringCaseSensitive); }; }; }; } else { head = dLinkedInsertionSort(head, (_local2 == 18)); }; } else { if ((_local2 & 4)){ if (_local2 == 20){ head = dLinkedMergeSortCmp(head, compareStringCaseSensitiveDesc); } else { if (_local2 == 12){ head = dLinkedMergeSortCmp(head, compareStringCaseInSensitive); } else { if (_local2 == 28){ head = dLinkedMergeSortCmp(head, compareStringCaseInSensitiveDesc); } else { head = dLinkedMergeSortCmp(head, compareStringCaseSensitive); }; }; }; } else { if ((_local2 & 16)){ head = dLinkedMergeSort(head, true); }; }; }; }; } else { head = dLinkedMergeSort(head); }; } public function contains(_arg1):Boolean{ var _local2:DListNode = head; while (_local2) { if (_local2.data == _arg1){ return (true); }; _local2 = _local2.next; }; return (false); } public function reverse():void{ var _local1:DListNode; var _local3:DListNode; if (_count == 0){ return; }; var _local2:DListNode = tail; while (_local2) { _local1 = _local2.prev; if (!_local2.next){ _local2.next = _local2.prev; _local2.prev = null; head = _local2; } else { if (!_local2.prev){ _local2.prev = _local2.next; _local2.next = null; tail = _local2; } else { _local3 = _local2.next; _local2.next = _local2.prev; _local2.prev = _local3; }; }; _local2 = _local1; }; } public function insertAfter(_arg1:DListIterator, _arg2):DListNode{ var _local3:DListNode; if (_arg1.list != this){ return (null); }; if (_arg1.node){ _local3 = new DListNode(_arg2); _arg1.node.insertAfter(_local3); if (_arg1.node == tail){ tail = _arg1.node.next; }; _count++; return (_local3); //unresolved jump }; return (append(_arg2)); } public function getIterator():Iterator{ return (new DListIterator(this, head)); } public function toArray():Array{ var _local1:Array = []; var _local2:DListNode = head; while (_local2) { _local1.push(_local2.data); _local2 = _local2.next; }; return (_local1); } public function getListIterator():DListIterator{ return (new DListIterator(this, head)); } public function join(_arg1):String{ if (_count == 0){ return (""); }; var _local2 = ""; var _local3:DListNode = head; while (_local3.next) { _local2 = (_local2 + (_local3.data + _arg1)); _local3 = _local3.next; }; _local2 = (_local2 + _local3.data); return (_local2); } public function toString():String{ return ((("[DLinkedList > has " + size) + " nodes]")); } public function removeTail(){ var _local1:*; if (tail){ _local1 = tail.data; tail = tail.prev; if (tail){ tail.next = null; } else { head = null; }; _count--; return (_local1); }; return (null); } public function lastNodeOf(_arg1, _arg2:DListIterator=null):DListIterator{ if (_arg2 != null){ if (_arg2.list != this){ return (null); }; }; var _local3:DListNode = ((_arg2)==null) ? tail : _arg2.node; while (_local3) { if (_local3.data === _arg1){ return (new DListIterator(this, _local3)); }; _local3 = _local3.prev; }; return (null); } public function merge(... _args):void{ var _local2:DLinkedList; _local2 = _args[0]; if (head){ tail.next = _local2.head; _local2.head.prev = tail; tail = _local2.tail; } else { head = _local2.head; tail = _local2.tail; }; _count = (_count + _local2.size); var _local3:int = _args.length; var _local4 = 1; while (_local4 < _local3) { _local2 = _args[_local4]; tail.next = _local2.head; _local2.head.prev = tail; tail = _local2.tail; _count = (_count + _local2.size); _local4++; }; } public function nodeOf(_arg1, _arg2:DListIterator=null):DListIterator{ if (_arg2 != null){ if (_arg2.list != this){ return (null); }; }; var _local3:DListNode = ((_arg2)==null) ? head : _arg2.node; while (_local3) { if (_local3.data === _arg1){ return (new DListIterator(this, _local3)); }; _local3 = _local3.next; }; return (null); } public function dump():String{ if (head == null){ return ("DLinkedList, empty"); }; var _local1 = (((("DLinkedList, has " + _count) + " node") + ((_count == 1)) ? "" : "s") + "\n|< Head\n"); var _local2:DListIterator = getListIterator(); while (_local2.valid()) { _local1 = (_local1 + (("\t" + _local2.data) + "\n")); _local2.forth(); }; _local1 = (_local1 + "Tail >|"); return (_local1); } public function splice(_arg1:DListIterator, _arg2:uint=4294967295, ... _args):DLinkedList{ var _local4:DListNode; var _local5:DListNode; var _local6:DLinkedList; var _local7:int; var _local8:int; var _local9:DListNode; if (_arg1){ if (_arg1.list != this){ return (null); }; }; if (_arg1.node){ _local4 = _arg1.node; _local5 = _arg1.node.prev; _local6 = new DLinkedList(); if (_arg2 == 4294967295){ if (_arg1.node == tail){ return (_local6); }; while (_arg1.node) { _local6.append(_arg1.node.data); _arg1.remove(); }; _arg1.list = _local6; _arg1.node = _local4; return (_local6); } else { _local7 = 0; while (_local7 < _arg2) { if (_arg1.node){ _local6.append(_arg1.node.data); _arg1.remove(); } else { break; }; _local7++; }; }; _local8 = _args.length; if (_local8 > 0){ if (_count == 0){ _local7 = 0; while (_local7 < _local8) { append(_args[_local7]); _local7++; }; } else { if (_local5 == null){ _local9 = prepend(_args[0]); _local7 = 1; while (_local7 < _local8) { _local9.insertAfter(new DListNode(_args[_local7])); if (_local9 == tail){ tail = _local9.next; }; _local9 = _local9.next; _count++; _local7++; }; } else { _local9 = _local5; _local7 = 0; while (_local7 < _local8) { _local9.insertAfter(new DListNode(_args[_local7])); if (_local9 == tail){ tail = _local9.next; }; _local9 = _local9.next; _count++; _local7++; }; }; }; _arg1.node = _local9; } else { _arg1.node = _local4; }; _arg1.list = _local6; return (_local6); }; return (null); } public function shiftUp():void{ var _local1:DListNode = head; if (head.next == tail){ head = tail; head.prev = null; tail = _local1; tail.next = null; head.next = tail; tail.prev = head; } else { head = head.next; head.prev = null; tail.next = _local1; _local1.next = null; _local1.prev = tail; tail = _local1; }; } } }//package de.polygonal.ds
Section 157
//DListIterator (de.polygonal.ds.DListIterator) package de.polygonal.ds { public class DListIterator implements Iterator { public var node:DListNode; public var list:DLinkedList; public function DListIterator(_arg1:DLinkedList, _arg2:DListNode=null){ this.list = _arg1; this.node = _arg2; } public function remove():Boolean{ return (list.remove(this)); } public function back():void{ if (node){ node = node.prev; }; } public function start():void{ node = list.head; } public function get data(){ if (node){ return (node.data); }; return (null); } public function forth():void{ if (node){ node = node.next; }; } public function toString():String{ return ((("{DListIterator, data=" + (node) ? node.data : "null") + "}")); } public function hasNext():Boolean{ return (Boolean(node)); } public function valid():Boolean{ return (Boolean(node)); } public function next(){ var _local1:*; if (hasNext()){ _local1 = node.data; node = node.next; return (_local1); }; return (null); } public function set data(_arg1):void{ node.data = _arg1; } public function end():void{ node = list.tail; } } }//package de.polygonal.ds
Section 158
//DListNode (de.polygonal.ds.DListNode) package de.polygonal.ds { public class DListNode implements LinkedListNode { public var prev:DListNode; public var next:DListNode; public var data; public function DListNode(_arg1){ next = (prev = null); data = _arg1; } public function unlink():void{ if (prev){ prev.next = next; }; if (next){ next.prev = prev; }; next = (prev = null); } public function insertAfter(_arg1:DListNode):void{ _arg1.next = next; _arg1.prev = this; if (next){ next.prev = _arg1; }; next = _arg1; } public function insertBefore(_arg1:DListNode):void{ _arg1.next = this; _arg1.prev = prev; if (prev){ prev.next = _arg1; }; prev = _arg1; } public function toString():String{ return ((("[DListNode, data=" + data) + "]")); } } }//package de.polygonal.ds
Section 159
//Iterator (de.polygonal.ds.Iterator) package de.polygonal.ds { public interface Iterator { function start():void; function set data(_arg1):void; function get data(); function next(); function hasNext():Boolean; } }//package de.polygonal.ds
Section 160
//LinkedListNode (de.polygonal.ds.LinkedListNode) package de.polygonal.ds { public interface LinkedListNode { } }//package de.polygonal.ds
Section 161
//LevelTestEndCommand (editor.controller.LevelTestEndCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import core.*; import org.puremvc.as3.patterns.command.*; import caurina.transitions.*; public class LevelTestEndCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ Tweener.removeAllTweens(); GameEngine.getInstance().levelAbort(); } } }//package editor.controller
Section 162
//LevelTestStartCommand (editor.controller.LevelTestStartCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import editor.model.*; import org.puremvc.as3.patterns.command.*; public class LevelTestStartCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:LevelTestProxy = (facade.retrieveProxy(LevelTestProxy.NAME) as LevelTestProxy); _local2.startTest(); } } }//package editor.controller
Section 163
//ObjectAddCommand (editor.controller.ObjectAddCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import core.objects.*; import editor.model.*; import org.puremvc.as3.patterns.command.*; public class ObjectAddCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:WorkspaceProxy = (facade.retrieveProxy(WorkspaceProxy.NAME) as WorkspaceProxy); _local2.objectAdd((_arg1.getBody() as BaseObjectDef)); } } }//package editor.controller
Section 164
//ObjectsDeleteCommand (editor.controller.ObjectsDeleteCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import editor.model.*; import org.puremvc.as3.patterns.command.*; public class ObjectsDeleteCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:WorkspaceProxy = (facade.retrieveProxy(WorkspaceProxy.NAME) as WorkspaceProxy); _local2.objectsDelete((_arg1.getBody() as Array)); } } }//package editor.controller
Section 165
//ObjectsMoveCommand (editor.controller.ObjectsMoveCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import flash.geom.*; import editor.model.*; import org.puremvc.as3.patterns.command.*; public class ObjectsMoveCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:WorkspaceProxy = (facade.retrieveProxy(WorkspaceProxy.NAME) as WorkspaceProxy); _local2.objectsMove((_arg1.getBody() as Point)); } } }//package editor.controller
Section 166
//ObjectsSelectCommand (editor.controller.ObjectsSelectCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import editor.model.*; import org.puremvc.as3.patterns.command.*; public class ObjectsSelectCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:WorkspaceProxy = (facade.retrieveProxy(WorkspaceProxy.NAME) as WorkspaceProxy); _local2.objectsSelect((_arg1.getBody() as Array)); } } }//package editor.controller
Section 167
//ToolSelectCommand (editor.controller.ToolSelectCommand) package editor.controller { import org.puremvc.as3.interfaces.*; import editor.model.*; import org.puremvc.as3.patterns.command.*; public class ToolSelectCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:WorkspaceProxy = (facade.retrieveProxy(WorkspaceProxy.NAME) as WorkspaceProxy); _local2.toolSelect((_arg1.getBody() as Tool)); } } }//package editor.controller
Section 168
//EditorAssets (editor.model.EditorAssets) package editor.model { import flash.events.*; import flash.display.*; import core.*; import flash.system.*; public class EditorAssets extends EventDispatcher implements IGameAssets { private var Assets:Class; private var appDomain:ApplicationDomain; public var inited:Boolean; private static var instance:EditorAssets; public function EditorAssets():void{ Assets = EditorAssets_Assets; super(); inited = false; } public function init():void{ var _local1:Loader = new Loader(); _local1.contentLoaderInfo.addEventListener(Event.INIT, assetsInitHandler); _local1.loadBytes(new Assets()); } private function assetsInitHandler(_arg1:Event):void{ appDomain = _arg1.target.content.loaderInfo.applicationDomain; inited = true; dispatchEvent(new Event(Event.INIT)); } public function getAssetClass(_arg1:String):Class{ if (!appDomain.hasDefinition(_arg1)){ trace((("*Error*: There is no definition of class '" + _arg1) + "'")); return (null); }; return ((appDomain.getDefinition(_arg1) as Class)); } public static function getInstance():EditorAssets{ if (!instance){ instance = new (EditorAssets); }; return (instance); } } }//package editor.model
Section 169
//EditorAssets_Assets (editor.model.EditorAssets_Assets) package editor.model { import mx.core.*; public class EditorAssets_Assets extends ByteArrayAsset { } }//package editor.model
Section 170
//LevelTestProxy (editor.model.LevelTestProxy) package editor.model { import flash.display.*; import core.events.*; import game.model.*; import core.*; import org.puremvc.as3.patterns.proxy.*; import game.view.*; import editor.controller.*; import editor.view.*; public class LevelTestProxy extends Proxy { public static const LEVEL_TEST_START:String = "LevelTestStart"; public static const LEVEL_TEST_END:String = "LevelTestEnd"; public static const NAME:String = "LevelTestProxy"; public static const LEVEL_RESTART_START:String = "LevelRestartStart"; public static const LEVEL_RESTART_END:String = "LevelRestartEnd"; public function LevelTestProxy():void{ super(NAME); init(); } private function init():void{ if (!facade.hasCommand(LEVEL_TEST_START)){ facade.registerCommand(LEVEL_TEST_START, LevelTestStartCommand); }; if (!facade.hasCommand(LEVEL_TEST_END)){ facade.registerCommand(LEVEL_TEST_END, LevelTestEndCommand); }; } private function splitSuccessHandler(_arg1:CoreEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(GameEngine.SPLIT_SUCCESS); } private function splitFailHandler(_arg1:CoreEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(GameEngine.SPLIT_FAIL); } public function startTest():void{ var _local1:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); var _local2:Sprite = _local1.getPopupContainer(); var _local3:LevelTestMediator = (facade.retrieveMediator(LevelTestMediator.NAME) as LevelTestMediator); var _local4:Sprite = _local3.getBodiesContainer(); var _local5:Sprite = _local3.getJointsContainer(); var _local6:Sprite = _local3.getPlayerContainer(); var _local7:WorkspaceProxy = (facade.retrieveProxy(WorkspaceProxy.NAME) as WorkspaceProxy); var _local8:String = _local7.saveLevel(); var _local9:AppProxy = (facade.retrieveProxy(AppProxy.NAME) as AppProxy); var _local10:GameEngine = GameEngine.getInstance(); var _local11:GameCanvas = new GameCanvas(_local4, _local5, _local6, _local2); _local10.initialize(CoreAssets.getInstance(), _local11, _local9.sndTransform); _local10.dispatcher.addEventListener(GameEngine.SPLIT_SUCCESS, splitSuccessHandler); _local10.dispatcher.addEventListener(GameEngine.SPLIT_FAIL, splitFailHandler); _local10.dispatcher.addEventListener(CoreEvent.LEVEL_RESTART_END, levelRestartEndHandler); _local10.dispatcher.addEventListener(CoreEvent.LEVEL_COMPLETE, levelCompleteHandler); _local10.levelStart(new Level(_local8)); } public function levelRestartStart():void{ GameEngine.getInstance().levelRestartStart(); } public function destroy():void{ facade.removeProxy(NAME); } private function levelRestartEndHandler(_arg1:CoreEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(LevelTestProxy.LEVEL_TEST_START); } private function levelCompleteHandler(_arg1:CoreEvent):void{ trace("yo!"); } } }//package editor.model
Section 171
//Tool (editor.model.Tool) package editor.model { public class Tool { public var type:String; public var id:uint; public static const TYPE_BONUS:String = "TypeBonus"; public static const TYPE_CIRCLE:String = "TypeCircle"; public static const TYPE_SELECTION:String = "TypeSelection"; public static const TYPE_RECT:String = "TypeRect"; public static const TYPE_JOINT:String = "TypeJoint"; public function Tool(_arg1:uint, _arg2:String):void{ this.id = _arg1; this.type = _arg2; init(); } private function init():void{ } } }//package editor.model
Section 172
//WorkspaceProxy (editor.model.WorkspaceProxy) package editor.model { import org.puremvc.as3.interfaces.*; import game.model.*; import flash.geom.*; import core.objects.*; import org.puremvc.as3.patterns.proxy.*; import ascb.util.*; import editor.controller.*; import editor.view.*; public class WorkspaceProxy extends Proxy implements IProxy { private var objects:Array; private var tools:Array; private var notesProxy:NotesProxy; public var currentTool:Tool; private var selectedObjects:Array; public static const OBJECT_ADD:String = "ObjectAdd"; public static const TOOL_SELECT:String = "ToolSelect"; public static const OBJECTS_SELECT:String = "ObjectsSelect"; public static const NAME:String = "WorkspaceProxy"; public static const OBJECT_UPDATE:String = "ObjectUpdate"; public static const OBJECTS_DELETE:String = "ObjectsDelete"; public static const OBJECTS_MOVE:String = "ObjectsMove"; public function WorkspaceProxy():void{ super(NAME); init(); } private function createRect(_arg1:Array):RectObjectDef{ var _local5:Boolean; var _local6:Boolean; var _local2:Number = _arg1[1]; var _local3:Number = _arg1[2]; var _local4:int = _arg1[3]; if (_local4 == 0){ _local5 = true; _local6 = false; } else { if (_local4 == 1){ _local5 = false; _local6 = false; } else { if (_local4 == 2){ _local5 = false; _local6 = true; }; }; }; var _local7:Number = _arg1[4]; var _local8:Number = _arg1[5]; var _local9:Number = _arg1[6]; var _local10:RectObjectDef = new RectObjectDef(_local2, _local3, _local5, _local6, _local7, _local8, _local9); return (_local10); } public function destroy():void{ facade.removeProxy(NAME); } public function getSelectedObjectIndex(_arg1:BaseObjectDef):int{ var _local2:uint; while (_local2 < selectedObjects.length) { if (_arg1 == selectedObjects[_local2]){ return (_local2); }; _local2++; }; return (-1); } public function getSelectedObjects():Array{ return (selectedObjects); } public function objectsMove(_arg1:Point):void{ var _local3:BaseObjectDef; var _local4:DistanceJointObjectDef; var _local2:uint; while (_local2 < selectedObjects.length) { _local3 = selectedObjects[_local2]; _local3.x = (_local3.x + _arg1.x); _local3.y = (_local3.y + _arg1.y); if ((_local3 is DistanceJointObjectDef)){ _local4 = (_local3 as DistanceJointObjectDef); _local4.anchor1.x = (_local4.anchor1.x + _arg1.x); _local4.anchor1.y = (_local4.anchor1.y + _arg1.y); _local4.anchor2.x = (_local4.anchor2.x + _arg1.x); _local4.anchor2.y = (_local4.anchor2.y + _arg1.y); }; _local2++; }; } public function saveLevel():String{ var _local2:uint; var _local3:BaseObjectDef; var _local1 = ""; _local2 = 0; for (;_local2 < objects.length;_local2++) { _local3 = objects[_local2]; if (!(_local3 is DistanceJointObjectDef)){ _local1 = (_local1 + (_local3.getStringDef() + " ")); } else { continue; }; }; _local2 = 0; for (;_local2 < objects.length;_local2++) { _local3 = objects[_local2]; if ((_local3 is DistanceJointObjectDef)){ _local1 = (_local1 + (_local3.getStringDef() + " ")); } else { continue; }; }; return (_local1); } private function createBonus(_arg1:Array):BonusDef{ var _local2:Number = _arg1[1]; var _local3:Number = _arg1[2]; var _local4:Number = _arg1[3]; var _local5:BonusDef = new BonusDef(_local2, _local3, _local4); return (_local5); } private function init():void{ if (!facade.hasCommand(TOOL_SELECT)){ facade.registerCommand(TOOL_SELECT, ToolSelectCommand); }; if (!facade.hasCommand(OBJECT_ADD)){ facade.registerCommand(OBJECT_ADD, ObjectAddCommand); }; if (!facade.hasCommand(OBJECTS_SELECT)){ facade.registerCommand(OBJECTS_SELECT, ObjectsSelectCommand); }; if (!facade.hasCommand(OBJECTS_MOVE)){ facade.registerCommand(OBJECTS_MOVE, ObjectsMoveCommand); }; if (!facade.hasCommand(OBJECTS_DELETE)){ facade.registerCommand(OBJECTS_DELETE, ObjectsDeleteCommand); }; notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); tools = []; tools.push(new Tool(0, Tool.TYPE_SELECTION)); tools.push(new Tool(1, Tool.TYPE_CIRCLE)); tools.push(new Tool(2, Tool.TYPE_RECT)); tools.push(new Tool(3, Tool.TYPE_JOINT)); tools.push(new Tool(4, Tool.TYPE_BONUS)); objects = []; selectedObjects = []; } private function getObjectIndex(_arg1:BaseObjectDef):int{ var _local2:uint; while (_local2 < objects.length) { if (_arg1 == objects[_local2]){ return (_local2); }; _local2++; }; return (-1); } public function getObjects():Array{ return (objects); } public function objectsDelete(_arg1:Array):void{ var _local3:BaseObjectDef; var _local4:int; var _local5:int; var _local6:WorldObjectMediator; var _local2:uint; while (_local2 < _arg1.length) { _local3 = _arg1[_local2]; _local4 = getObjectIndex(_local3); objects.splice(_local4, 1); _local5 = getSelectedObjectIndex(_local3); if (_local5 != -1){ selectedObjects.splice(_local5, 1); }; _local6 = (facade.retrieveMediator((WorldObjectMediator.NAME_BASE + _local3.id)) as WorldObjectMediator); _local6.deleteObject(); _local2++; }; } public function getTools():Array{ return (tools); } public function objectAdd(_arg1:BaseObjectDef):void{ var _local2:WorldObjectMediator; objects.push(_arg1); var _local3:String = (WorldObjectMediator.NAME_BASE + _arg1.id); if ((_arg1 is PlayerDef)){ _local2 = new PlayerObjectMediator(_local3); } else { if ((_arg1 is ExitDef)){ _local2 = new ExitObjectMediator(_local3); } else { if ((_arg1 is BonusDef)){ _local2 = new BonusObjectMediator(_local3); } else { if ((_arg1 is CircleObjectDef)){ _local2 = new CircleObjectMediator(_local3); } else { if ((_arg1 is RectObjectDef)){ _local2 = new RectObjectMediator(_local3); } else { if ((_arg1 is DistanceJointObjectDef)){ _local2 = new JointObjectMediator(_local3); }; }; }; }; }; }; facade.registerMediator(_local2); _local2.loadData(_arg1); notesProxy.push(OBJECTS_SELECT, [_arg1]); } private function createCircle(_arg1:Array):CircleObjectDef{ var _local6:Boolean; var _local2:Number = _arg1[1]; var _local3:Number = _arg1[2]; var _local4:int = _arg1[3]; var _local5:Boolean; if ((_local4 == 1)){ _local6 = false; } else { _local6 = true; }; var _local7:Number = _arg1[4]; var _local8:CircleObjectDef = new CircleObjectDef(_local2, _local3, _local5, _local6, _local7); return (_local8); } private function createJoint(_arg1:Array):DistanceJointObjectDef{ var _local2:Number = _arg1[1]; var _local3:Number = _arg1[2]; var _local4:Boolean; var _local5:Number = _arg1[3]; var _local6:Number = _arg1[4]; var _local7:Number = _arg1[5]; var _local8:Number = _arg1[6]; var _local9:Point = new Point(_local5, _local6); var _local10:Point = new Point(_local7, _local8); var _local11:DistanceJointObjectDef = new DistanceJointObjectDef(_local2, _local3, _local4, _local9, _local10); return (_local11); } public function objectsSelect(_arg1:Array):void{ selectedObjects = _arg1; } public function start():void{ notesProxy.push(TOOL_SELECT, tools[0]); var _local1:ExitDef = new ExitDef(200, 100, 5); notesProxy.push(OBJECT_ADD, _local1); var _local2:PlayerDef = new PlayerDef(100, 100, 20); notesProxy.push(OBJECT_ADD, _local2); } public function toolSelect(_arg1:Tool):void{ currentTool = _arg1; } private function createExit(_arg1:Array):ExitDef{ var _local2:Number = _arg1[1]; var _local3:Number = _arg1[2]; var _local4:Number = _arg1[3]; var _local5:ExitDef = new ExitDef(_local2, _local3, _local4); return (_local5); } private function createPlayer(_arg1:Array):PlayerDef{ var _local2:Number = _arg1[1]; var _local3:Number = _arg1[2]; var _local4:Number = _arg1[3]; var _local5:PlayerDef = new PlayerDef(_local2, _local3, _local4); return (_local5); } public function loadLevel(_arg1:String):void{ var _local4:String; var _local5:Array; var _local6:String; var _local7:BaseObjectDef; notesProxy.push(OBJECTS_DELETE, ArrayUtilities.duplicate(getObjects())); var _local2:Array = _arg1.split(" "); var _local3:uint; for (;_local3 < _local2.length;_local3++) { _local4 = _local2[_local3]; _local5 = _local4.split("_"); _local6 = _local5[0]; switch (_local6){ case PlayerDef.NAME: _local7 = createPlayer(_local5); break; case CircleObjectDef.NAME: _local7 = createCircle(_local5); break; case ExitDef.NAME: _local7 = createExit(_local5); break; case DistanceJointObjectDef.NAME: _local7 = createJoint(_local5); break; case BonusDef.NAME: _local7 = createBonus(_local5); break; case RectObjectDef.NAME: _local7 = createRect(_local5); break; default: continue; }; notesProxy.push(OBJECT_ADD, _local7); }; } } }//package editor.model
Section 173
//JointObjectView (editor.view.components.JointObjectView) package editor.view.components { import flash.display.*; public class JointObjectView extends WorldObjectView { public var point1:Sprite; public var point2:Sprite; public var lineContainer:Sprite; public var pointsContainer:Sprite; public function JointObjectView():void{ } override protected function init():void{ super.init(); lineContainer = new Sprite(); container.addChild(lineContainer); pointsContainer = new Sprite(); container.addChild(pointsContainer); point1 = new Sprite(); container.addChild(point1); point2 = new Sprite(); container.addChild(point2); } } }//package editor.view.components
Section 174
//JointPointView (editor.view.components.JointPointView) package editor.view.components { import flash.display.*; public class JointPointView { public var window:Sprite; public function JointPointView(_arg1:Sprite):void{ this.window = _arg1; init(); } private function init():void{ drawPoint(); } private function drawPoint():void{ window.graphics.clear(); window.graphics.beginFill(0, 0.7); window.graphics.drawCircle(0, 0, 4); window.graphics.endFill(); } } }//package editor.view.components
Section 175
//LevelTestView (editor.view.components.LevelTestView) package editor.view.components { import flash.display.*; import editor.model.*; public class LevelTestView extends Sprite { public var bodiesContainer:Sprite; public var restart_bt:SimpleButton; public var mouseHandler:Sprite; public var playerContainer:Sprite; public var back_bt:SimpleButton; public var objectsContainer:Sprite; private var window:Sprite; public var jointsContainer:Sprite; public var levelContainer:Sprite; public function LevelTestView():void{ init(); } private function init():void{ var _local1:Class = EditorAssets.getInstance().getAssetClass("LevelTestWindow"); window = new (_local1); addChild(window); back_bt = (window.getChildByName("back_bt") as SimpleButton); restart_bt = (window.getChildByName("restart_bt") as SimpleButton); levelContainer = (window.getChildByName("levelContainer") as Sprite); objectsContainer = (levelContainer.getChildByName("objectsContainer") as Sprite); bodiesContainer = (objectsContainer.getChildByName("bodiesContainer") as Sprite); jointsContainer = (objectsContainer.getChildByName("jointsContainer") as Sprite); playerContainer = (objectsContainer.getChildByName("playerContainer") as Sprite); mouseHandler = (levelContainer.getChildByName("mouseHandler") as Sprite); } } }//package editor.view.components
Section 176
//WorkspaceView (editor.view.components.WorkspaceView) package editor.view.components { import flash.display.*; public class WorkspaceView { public var bodiesContainer:Sprite; public var mouseHandler:Sprite; public var objectsContainer:Sprite; public var playerContainer:Sprite; public var window:Sprite; public var toolsCanvas:Sprite; public var jointsContainer:Sprite; public function WorkspaceView(_arg1:Sprite):void{ this.window = _arg1; init(); } private function init():void{ mouseHandler = (window.getChildByName("mouseHandler") as Sprite); objectsContainer = (window.getChildByName("objectsContainer") as Sprite); bodiesContainer = (objectsContainer.getChildByName("bodiesContainer") as Sprite); playerContainer = (objectsContainer.getChildByName("playerContainer") as Sprite); jointsContainer = (objectsContainer.getChildByName("jointsContainer") as Sprite); toolsCanvas = (window.getChildByName("toolsCanvas") as Sprite); } } }//package editor.view.components
Section 177
//WorldObjectView (editor.view.components.WorldObjectView) package editor.view.components { import flash.display.*; public class WorldObjectView extends Sprite { public var container:Sprite; public var origin:Sprite; public var frame:Sprite; public function WorldObjectView():void{ init(); } protected function init():void{ container = new Sprite(); addChild(container); frame = new Sprite(); addChild(frame); origin = new Sprite(); frame.addChild(origin); } } }//package editor.view.components
Section 178
//BodyObjectMediator (editor.view.BodyObjectMediator) package editor.view { import org.puremvc.as3.interfaces.*; import core.objects.*; public class BodyObjectMediator extends WorldObjectMediator implements IMediator { protected var bodyObj:BodyObject; public function BodyObjectMediator(_arg1:String):void{ super(_arg1); } override public function loadData(_arg1:BaseObjectDef):void{ bodyObj = (_arg1 as BodyObject); super.loadData(_arg1); } override protected function processData():void{ super.processData(); draw(); _view.frame.visible = false; } override protected function drawFrame():void{ _view.frame.graphics.clear(); _view.frame.graphics.lineStyle(0, 0); _view.frame.graphics.drawRect((-(_view.container.width) / 2), (-(_view.container.height) / 2), _view.container.width, _view.container.height); } } }//package editor.view
Section 179
//BonusObjectMediator (editor.view.BonusObjectMediator) package editor.view { import org.puremvc.as3.interfaces.*; import flash.display.*; import game.model.*; import editor.view.components.*; public class BonusObjectMediator extends CircleObjectMediator implements IMediator { public function BonusObjectMediator(_arg1:String):void{ super(_arg1); } override protected function init():void{ _view = new WorldObjectView(); var _local1:WorkspaceMediator = (facade.retrieveMediator(WorkspaceMediator.NAME) as WorkspaceMediator); _local1.getPlayerContainer().addChild(_view); } override protected function draw():void{ var _local1:Class = (GameAssets.getInstance().getAssetClass("BonusAsset") as Class); var _local2:Sprite = new (_local1); _view.container.addChild(_local2); drawFrame(); } } }//package editor.view
Section 180
//CircleObjectMediator (editor.view.CircleObjectMediator) package editor.view { import org.puremvc.as3.interfaces.*; import flash.display.*; import flash.geom.*; import core.objects.*; import editor.model.*; public class CircleObjectMediator extends BodyObjectMediator implements IMediator { protected var circleObj:CircleObjectDef; public function CircleObjectMediator(_arg1:String):void{ super(_arg1); } override public function loadData(_arg1:BaseObjectDef):void{ circleObj = (_arg1 as CircleObjectDef); super.loadData(_arg1); } override protected function draw():void{ var _local1:Class; switch (circleObj.isStatic){ case false: _local1 = EditorAssets.getInstance().getAssetClass("MetallMaterial"); break; case true: _local1 = EditorAssets.getInstance().getAssetClass("BrickMaterial"); break; }; var _local2:BitmapData = (new _local1(200, 200) as BitmapData); var _local3:Matrix = new Matrix(); _local3.translate(100, 100); _view.container.graphics.clear(); _view.container.graphics.beginBitmapFill(_local2, _local3); _view.container.graphics.drawCircle(0, 0, circleObj.r); _view.container.graphics.endFill(); super.draw(); } override protected function update():void{ super.update(); draw(); } override protected function processData():void{ super.processData(); } } }//package editor.view
Section 181
//ExitObjectMediator (editor.view.ExitObjectMediator) package editor.view { import org.puremvc.as3.interfaces.*; import flash.display.*; import game.model.*; import editor.view.components.*; public class ExitObjectMediator extends CircleObjectMediator implements IMediator { public function ExitObjectMediator(_arg1:String):void{ super(_arg1); } override protected function init():void{ _view = new WorldObjectView(); var _local1:WorkspaceMediator = (facade.retrieveMediator(WorkspaceMediator.NAME) as WorkspaceMediator); _local1.getPlayerContainer().addChild(_view); } override protected function draw():void{ var _local1:Class = (GameAssets.getInstance().getAssetClass("ExitAsset") as Class); var _local2:Sprite = new (_local1); _view.container.addChild(_local2); drawFrame(); } } }//package editor.view
Section 182
//JointObjectMediator (editor.view.JointObjectMediator) package editor.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import flash.geom.*; import core.objects.*; import editor.view.components.*; public class JointObjectMediator extends WorldObjectMediator implements IMediator { private var point2Med:JointPointMediator; private var point1Med:JointPointMediator; protected var jointObj:DistanceJointObjectDef; private var _jointView:JointObjectView; public function JointObjectMediator(_arg1:String):void{ super(_arg1); } override protected function draw():void{ var _local1:Point = _jointView.lineContainer.globalToLocal(jointObj.anchor1); var _local2:Point = _jointView.lineContainer.globalToLocal(jointObj.anchor2); _jointView.lineContainer.graphics.clear(); _jointView.lineContainer.graphics.lineStyle(3, 0xFF9900); _jointView.lineContainer.graphics.moveTo(_local1.x, _local1.y); _jointView.lineContainer.graphics.lineTo(_local2.x, _local2.y); super.draw(); } override protected function drawFrame():void{ var _local1:Rectangle = _view.container.getBounds(_view.frame); _view.frame.graphics.clear(); _view.frame.graphics.lineStyle(0, 0); _view.frame.graphics.drawRect(_local1.x, _local1.y, _local1.width, _local1.height); } override public function deleteObject():void{ var _local1:String; _local1 = (((JointPointMediator.NAME_BASE + jointObj.id) + "_") + 1); var _local2:JointPointMediator = (facade.retrieveMediator(_local1) as JointPointMediator); _local2.destroy(); _local1 = (((JointPointMediator.NAME_BASE + jointObj.id) + "_") + 2); var _local3:JointPointMediator = (facade.retrieveMediator(_local1) as JointPointMediator); _local3.destroy(); super.deleteObject(); } override public function loadData(_arg1:BaseObjectDef):void{ jointObj = (_arg1 as DistanceJointObjectDef); super.loadData(_arg1); } override protected function update():void{ super.update(); _view.x = jointObj.x; _view.y = jointObj.y; point1Med.update(); point2Med.update(); draw(); } override protected function processData():void{ var _local1:String; drawOrigin(); _view.x = obj.x; _view.y = obj.y; _jointView.lineContainer.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); _local1 = (((JointPointMediator.NAME_BASE + jointObj.id) + "_") + 1); var _local2:JointPointView = new JointPointView(_jointView.point1); point1Med = new JointPointMediator(_local1, _local2); point1Med.loadData(jointObj, 1); facade.registerMediator(point1Med); _local1 = (((JointPointMediator.NAME_BASE + jointObj.id) + "_") + 2); var _local3:JointPointView = new JointPointView(_jointView.point2); point2Med = new JointPointMediator(_local1, _local3); point2Med.loadData(jointObj, 2); facade.registerMediator(point2Med); draw(); _view.frame.visible = false; } override protected function init():void{ _view = new JointObjectView(); var _local1:WorkspaceMediator = (facade.retrieveMediator(WorkspaceMediator.NAME) as WorkspaceMediator); _local1.getJointsContainer().addChild(_view); _jointView = (_view as JointObjectView); } } }//package editor.view
Section 183
//JointPointMediator (editor.view.JointPointMediator) package editor.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import flash.geom.*; import core.objects.*; import editor.model.*; import editor.view.components.*; import org.puremvc.as3.patterns.mediator.*; public class JointPointMediator extends Mediator implements IMediator { private var pointIndex:uint; private var _view:JointPointView; private var jointObj:DistanceJointObjectDef; public var NAME:String; public static const NAME_BASE:String = "JointPointMediator"; public function JointPointMediator(_arg1:String, _arg2:JointPointView):void{ this.NAME = _arg1; super(_arg1, _arg2); init(); } override public function listNotificationInterests():Array{ return ([]); } public function destroy():void{ facade.removeMediator(NAME); } private function mouseDownHandler(_arg1:MouseEvent):void{ _view.window.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); _view.window.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } public function update():void{ var _local1:Point = getJointPoint(pointIndex); var _local2:Point = _view.window.parent.globalToLocal(_local1); _view.window.x = _local2.x; _view.window.y = _local2.y; } private function mouseUpHandler(_arg1:MouseEvent):void{ _view.window.stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); _view.window.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } private function init():void{ _view = (getViewComponent() as JointPointView); } private function mouseMoveHandler(_arg1:MouseEvent):void{ var _local2:Point = getJointPoint(pointIndex); _local2.x = _view.window.stage.mouseX; _local2.y = _view.window.stage.mouseY; jointObj.updateAnchors(jointObj.anchor1, jointObj.anchor2); var _local3:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local3.push(WorkspaceProxy.OBJECT_UPDATE, jointObj); } override public function handleNotification(_arg1:INotification):void{ } public function loadData(_arg1:DistanceJointObjectDef, _arg2:uint):void{ this.jointObj = _arg1; this.pointIndex = _arg2; var _local3:Point = getJointPoint(_arg2); var _local4:Point = _view.window.parent.globalToLocal(_local3); _view.window.x = _local4.x; _view.window.y = _local4.y; _view.window.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } protected function tryUpdate(_arg1:BaseObjectDef):void{ if (_arg1 == jointObj){ update(); }; } private function getJointPoint(_arg1:uint):Point{ if (_arg1 == 1){ return (jointObj.anchor1); }; return (jointObj.anchor2); } } }//package editor.view
Section 184
//LevelTestMediator (editor.view.LevelTestMediator) package editor.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import flash.display.*; import game.model.*; import game.view.components.*; import editor.model.*; import editor.view.components.*; import org.puremvc.as3.patterns.mediator.*; import game.view.*; public class LevelTestMediator extends Mediator implements IMediator { private var _view:LevelTestView; public static const NAME:String = "LevelTestMediator"; public function LevelTestMediator(_arg1:LevelTestView):void{ super(NAME, _arg1); init(); } override public function listNotificationInterests():Array{ return ([]); } public function getJointsContainer():Sprite{ return (_view.jointsContainer); } private function backClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(LevelTestProxy.LEVEL_TEST_END); destroy(); } public function getPlayerContainer():Sprite{ return (_view.playerContainer); } public function getBodiesContainer():Sprite{ return (_view.bodiesContainer); } private function init():void{ _view = (getViewComponent() as LevelTestView); var _local1:MouseHandlerView = new MouseHandlerView(_view.mouseHandler); var _local2:MouseHandlerMediator = new MouseHandlerMediator(_local1); facade.registerMediator(_local2); _view.back_bt.addEventListener(MouseEvent.CLICK, backClickHandler); _view.restart_bt.addEventListener(MouseEvent.CLICK, restartClickHandler); } private function restartClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(GameProxy.LEVEL_RESTART_START); } override public function handleNotification(_arg1:INotification):void{ } public function destroy():void{ facade.removeMediator(MouseHandlerMediator.NAME); _view.parent.removeChild(_view); facade.removeMediator(NAME); } } }//package editor.view
Section 185
//PlayerObjectMediator (editor.view.PlayerObjectMediator) package editor.view { import org.puremvc.as3.interfaces.*; import flash.display.*; import game.model.*; import editor.view.components.*; public class PlayerObjectMediator extends CircleObjectMediator implements IMediator { public function PlayerObjectMediator(_arg1:String):void{ super(_arg1); } override protected function init():void{ _view = new WorldObjectView(); var _local1:WorkspaceMediator = (facade.retrieveMediator(WorkspaceMediator.NAME) as WorkspaceMediator); _local1.getPlayerContainer().addChild(_view); } override protected function draw():void{ var _local1:Class = (GameAssets.getInstance().getAssetClass("PlayerAsset") as Class); var _local2:Sprite = new (_local1); _view.container.addChild(_local2); drawFrame(); } } }//package editor.view
Section 186
//RectObjectMediator (editor.view.RectObjectMediator) package editor.view { import org.puremvc.as3.interfaces.*; import flash.display.*; import flash.geom.*; import core.objects.*; import editor.model.*; public class RectObjectMediator extends BodyObjectMediator implements IMediator { protected var rectObj:RectObjectDef; public function RectObjectMediator(_arg1:String):void{ super(_arg1); } override public function loadData(_arg1:BaseObjectDef):void{ rectObj = (_arg1 as RectObjectDef); super.loadData(_arg1); } override protected function update():void{ super.update(); draw(); } override protected function draw():void{ var _local1:Class; if (rectObj.isStatic){ _local1 = EditorAssets.getInstance().getAssetClass("BrickMaterial"); } else { if (rectObj.splittable){ _local1 = EditorAssets.getInstance().getAssetClass("WoodMaterial"); } else { _local1 = EditorAssets.getInstance().getAssetClass("MetallMaterial"); }; }; var _local2:BitmapData = (new _local1(200, 200) as BitmapData); var _local3:Matrix = new Matrix(); _local3.translate(100, 100); _view.container.graphics.clear(); _view.container.graphics.beginBitmapFill(_local2, _local3); _view.container.graphics.drawRect((-(rectObj.w) / 2), (-(rectObj.h) / 2), rectObj.w, rectObj.h); _view.container.graphics.endFill(); _view.container.rotation = rectObj.rotation; super.draw(); } override protected function drawFrame():void{ var _local1:Rectangle = _view.container.getBounds(_view.frame); _view.frame.graphics.clear(); _view.frame.graphics.lineStyle(0, 0); _view.frame.graphics.drawRect(_local1.x, _local1.y, _local1.width, _local1.height); } override protected function processData():void{ super.processData(); } } }//package editor.view
Section 187
//WorkspaceMediator (editor.view.WorkspaceMediator) package editor.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import flash.display.*; import game.model.*; import editor.view.components.*; import org.puremvc.as3.patterns.mediator.*; public class WorkspaceMediator extends Mediator implements IMediator { private var _view:WorkspaceView; public static const NAME:String = "WorkspaceMediator"; public static const MOUSE_DOWN:String = "WorkspaceMouseDown"; public function WorkspaceMediator(_arg1:WorkspaceView):void{ super(NAME, _arg1); init(); } override public function listNotificationInterests():Array{ return ([]); } public function getJointsContainer():Sprite{ return (_view.jointsContainer); } public function getObjectsContainer():Sprite{ return (_view.objectsContainer); } public function getPlayerContainer():Sprite{ return (_view.playerContainer); } public function getBodiesContainer():Sprite{ return (_view.bodiesContainer); } private function init():void{ _view = (getViewComponent() as WorkspaceView); _view.window.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } private function mouseDownHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(MOUSE_DOWN); } override public function handleNotification(_arg1:INotification):void{ } public function destroy():void{ facade.removeMediator(NAME); } public function getToolsCanvas():Sprite{ return (_view.toolsCanvas); } } }//package editor.view
Section 188
//WorldObjectMediator (editor.view.WorldObjectMediator) package editor.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import flash.geom.*; import core.objects.*; import editor.model.*; import editor.view.components.*; import org.puremvc.as3.patterns.mediator.*; public class WorldObjectMediator extends Mediator implements IMediator { protected var moveOffset:Point; protected var _view:WorldObjectView; protected var obj:BaseObjectDef; public static const NAME_BASE:String = "WorldObjectMediator"; public function WorldObjectMediator(_arg1:String):void{ super(_arg1); init(); } protected function processData():void{ drawOrigin(); _view.x = obj.x; _view.y = obj.y; _view.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); } protected function tryDelete(_arg1:Array):void{ var _local3:BaseObjectDef; var _local2:uint; while (_local2 < _arg1.length) { _local3 = _arg1[_local2]; if (_local3 == obj){ deleteObject(); }; _local2++; }; } protected function update():void{ } public function deleteObject():void{ _view.parent.removeChild(_view); facade.removeMediator((NAME_BASE + obj.id)); } protected function drawFrame():void{ } protected function mouseUpHandler(_arg1:MouseEvent):void{ _view.stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); _view.stage.removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); } protected function draw():void{ drawFrame(); } protected function mouseMoveHandler(_arg1:MouseEvent):void{ var _local2:Point = new Point(_view.x, _view.y); var _local3:Point = new Point((_view.parent.mouseX - moveOffset.x), (_view.parent.mouseY - moveOffset.y)); var _local4:Point = new Point((_local3.x - _local2.x), (_local3.y - _local2.y)); var _local5:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local5.push(WorkspaceProxy.OBJECTS_MOVE, _local4); } protected function init():void{ _view = new WorldObjectView(); var _local1:WorkspaceMediator = (facade.retrieveMediator(WorkspaceMediator.NAME) as WorkspaceMediator); _local1.getBodiesContainer().addChild(_view); } protected function drawOrigin():void{ _view.origin.graphics.clear(); _view.origin.graphics.beginFill(0, 1); _view.origin.graphics.drawCircle(0, 0, 2); _view.origin.graphics.endFill(); } override public function listNotificationInterests():Array{ return ([WorkspaceProxy.OBJECTS_SELECT, WorkspaceProxy.OBJECTS_MOVE, WorkspaceProxy.OBJECT_UPDATE]); } protected function mouseDownHandler(_arg1:MouseEvent):void{ var _local3:Array; var _local4:NotesProxy; var _local2:WorkspaceProxy = (facade.retrieveProxy(WorkspaceProxy.NAME) as WorkspaceProxy); if (_local2.currentTool.type == Tool.TYPE_SELECTION){ _view.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler); _view.stage.addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler); moveOffset = new Point((_view.parent.mouseX - _view.x), (_view.parent.mouseY - _view.y)); if (_local2.getSelectedObjectIndex(obj) == -1){ _local3 = [obj]; _local4 = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local4.push(WorkspaceProxy.OBJECTS_SELECT, _local3); }; }; } protected function checkSelection(_arg1:Array):void{ var _local2:uint; while (_local2 < _arg1.length) { if (_arg1[_local2] == obj){ select(); return; }; _local2++; }; deselect(); } protected function tryUpdate(_arg1:BaseObjectDef):void{ if (_arg1 == obj){ update(); }; } public function loadData(_arg1:BaseObjectDef):void{ this.obj = _arg1; processData(); } protected function checkMove():void{ _view.x = obj.x; _view.y = obj.y; } override public function handleNotification(_arg1:INotification):void{ switch (_arg1.getName()){ case WorkspaceProxy.OBJECTS_SELECT: checkSelection((_arg1.getBody() as Array)); break; case WorkspaceProxy.OBJECTS_MOVE: checkMove(); break; case WorkspaceProxy.OBJECT_UPDATE: tryUpdate((_arg1.getBody() as BaseObjectDef)); break; }; } protected function select():void{ _view.frame.visible = true; } protected function deselect():void{ _view.frame.visible = false; } } }//package editor.view
Section 189
//BaseScrollPane (fl.containers.BaseScrollPane) package fl.containers { import flash.events.*; import flash.display.*; import flash.geom.*; import fl.controls.*; import fl.core.*; 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 190
//DataGridCellEditor (fl.controls.dataGridClasses.DataGridCellEditor) package fl.controls.dataGridClasses { import fl.controls.*; import fl.controls.listClasses.*; 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 191
//DataGridColumn (fl.controls.dataGridClasses.DataGridColumn) package fl.controls.dataGridClasses { import fl.controls.*; import fl.core.*; 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 192
//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 193
//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 194
//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 195
//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 196
//BaseButton (fl.controls.BaseButton) package fl.controls { import flash.events.*; import flash.display.*; import fl.core.*; import fl.events.*; import flash.utils.*; 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 197
//Button (fl.controls.Button) package fl.controls { import flash.display.*; import fl.managers.*; import fl.core.*; 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 198
//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 199
//DataGrid (fl.controls.DataGrid) package fl.controls { import flash.events.*; import flash.display.*; import flash.geom.*; import fl.managers.*; import fl.core.*; import fl.events.*; import fl.data.*; import fl.controls.listClasses.*; import fl.controls.dataGridClasses.*; import flash.utils.*; 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 200
//LabelButton (fl.controls.LabelButton) package fl.controls { import flash.events.*; import flash.display.*; import fl.managers.*; import fl.core.*; import fl.events.*; import flash.text.*; 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 201
//ScrollBar (fl.controls.ScrollBar) package fl.controls { import flash.events.*; import fl.core.*; 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 202
//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 203
//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 204
//SelectableList (fl.controls.SelectableList) package fl.controls { import flash.events.*; import flash.display.*; import fl.managers.*; import fl.core.*; import fl.events.*; import fl.data.*; import fl.controls.listClasses.*; import flash.utils.*; 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 205
//TextInput (fl.controls.TextInput) package fl.controls { import flash.events.*; import flash.display.*; import fl.managers.*; import fl.core.*; import fl.events.*; import flash.text.*; 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 206
//ComponentShim (fl.core.ComponentShim) package fl.core { import flash.display.*; public dynamic class ComponentShim extends MovieClip { } }//package fl.core
Section 207
//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 208
//UIComponent (fl.core.UIComponent) package fl.core { import flash.events.*; import flash.display.*; import fl.managers.*; import fl.events.*; import flash.text.*; import flash.system.*; import flash.utils.*; 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 209
//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 210
//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 211
//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 212
//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 213
//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 214
//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 215
//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 216
//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 217
//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 218
//FocusManager (fl.managers.FocusManager) package fl.managers { import flash.events.*; import flash.display.*; import fl.controls.*; import fl.core.*; import flash.text.*; import flash.utils.*; 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 219
//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 220
//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 221
//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 222
//StyleManager (fl.managers.StyleManager) package fl.managers { import fl.core.*; import flash.text.*; import flash.utils.*; 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 223
//CreditsShowCommand (game.controller.CreditsShowCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.view.components.*; import org.puremvc.as3.patterns.command.*; import game.view.*; public class CreditsShowCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); var _local3:CreditsView = new CreditsView(); _local2.getViewContainer().addChild(_local3); var _local4:CreditsMediator = new CreditsMediator(_local3); facade.registerMediator(_local4); } } }//package game.controller
Section 224
//EndGameCommand (game.controller.EndGameCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import org.puremvc.as3.patterns.command.*; import game.view.*; public class EndGameCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _local2.endGame(); var _local3:GameMediator = (facade.retrieveMediator(GameMediator.NAME) as GameMediator); _local3.destroy(); var _local4:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); var _local5:MainMenuView = new MainMenuView(); _local4.getViewContainer().addChild(_local5); var _local6:MainMenuMediator = new MainMenuMediator(_local5); facade.registerMediator(_local6); } } }//package game.controller
Section 225
//InitializeCommand (game.controller.InitializeCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.view.components.*; import org.puremvc.as3.patterns.command.*; import game.view.*; public class InitializeCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:AppView = new AppView(); ApplicationFacade.getInstance().viewContainer.addChild(_local2); var _local3:AppMediator = new AppMediator(_local2); facade.registerMediator(_local3); var _local4:MainMenuView = new MainMenuView(); _local3.getViewContainer().addChild(_local4); var _local5:MainMenuMediator = new MainMenuMediator(_local4); facade.registerMediator(_local5); } } }//package game.controller
Section 226
//InstructionsShowCommand (game.controller.InstructionsShowCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.view.components.*; import org.puremvc.as3.patterns.command.*; import game.view.*; public class InstructionsShowCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); var _local3:InstructionsView = new InstructionsView(); _local2.getViewContainer().addChild(_local3); var _local4:InstructionsMediator = new InstructionsMediator(_local3); facade.registerMediator(_local4); } } }//package game.controller
Section 227
//LevelCompleteCommand (game.controller.LevelCompleteCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.model.*; import org.puremvc.as3.patterns.command.*; public class LevelCompleteCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _local2.levelComplete(); } } }//package game.controller
Section 228
//LevelEndCommand (game.controller.LevelEndCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.model.*; import org.puremvc.as3.patterns.command.*; import caurina.transitions.*; public class LevelEndCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ Tweener.removeAllTweens(); var _local2:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _local2.levelEnd(); var _local3:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local3.push(GameProxy.LEVEL_SELECT); } } }//package game.controller
Section 229
//LevelNextCommand (game.controller.LevelNextCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.model.*; import org.puremvc.as3.patterns.command.*; public class LevelNextCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _local2.nextLevel(); } } }//package game.controller
Section 230
//LevelSelectCommand (game.controller.LevelSelectCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.view.components.*; import org.puremvc.as3.patterns.command.*; import game.view.*; public class LevelSelectCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:LevelSelectView = new LevelSelectView(); var _local3:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); _local3.getViewContainer().addChild(_local2); var _local4:LevelSelectMediator = new LevelSelectMediator(_local2); facade.registerMediator(_local4); } } }//package game.controller
Section 231
//LevelStartCommand (game.controller.LevelStartCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.model.*; import org.puremvc.as3.patterns.command.*; import game.view.*; public class LevelStartCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:LevelSelectMediator = (facade.retrieveMediator(LevelSelectMediator.NAME) as LevelSelectMediator); if (_local2){ _local2.destroy(); }; var _local3:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _local3.startLevel((_arg1.getBody() as uint)); } } }//package game.controller
Section 232
//MouseDrawEndCommand (game.controller.MouseDrawEndCommand) package game.controller { import org.puremvc.as3.interfaces.*; import core.*; import org.puremvc.as3.patterns.command.*; public class MouseDrawEndCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ GameEngine.getInstance().checkIntersections((_arg1.getBody() as Line)); } } }//package game.controller
Section 233
//MouseDrawStartCommand (game.controller.MouseDrawStartCommand) package game.controller { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.patterns.command.*; public class MouseDrawStartCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ } } }//package game.controller
Section 234
//OptionsShowCommand (game.controller.OptionsShowCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.view.components.*; import org.puremvc.as3.patterns.command.*; import game.view.*; public class OptionsShowCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); var _local3:OptionsView = new OptionsView(); _local2.getViewContainer().addChild(_local3); var _local4:OptionsMediator = new OptionsMediator(_local3); facade.registerMediator(_local4); } } }//package game.controller
Section 235
//StartGameCommand (game.controller.StartGameCommand) package game.controller { import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import org.puremvc.as3.patterns.command.*; import game.view.*; public class StartGameCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:GameProxy = new GameProxy(); GameProxy.OPEN_LEVELS = _arg1.getBody(); facade.registerProxy(_local2); var _local3:GameView = new GameView(); var _local4:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); _local4.getViewContainer().addChild(_local3); var _local5:GameMediator = new GameMediator(_local3); facade.registerMediator(_local5); _local2.startGame(); var _local6:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local6.push(GameProxy.LEVEL_SELECT); _local6.push(AppProxy.INSTRUCTIONS_SHOW); } } }//package game.controller
Section 236
//StartupCommand (game.controller.StartupCommand) package game.controller { import org.puremvc.as3.interfaces.*; import flash.display.*; import game.model.*; import org.puremvc.as3.patterns.command.*; public class StartupCommand extends SimpleCommand implements ICommand { override public function execute(_arg1:INotification):void{ var _local2:Sprite = _arg1.getBody().container; var _local3:AppProxy = new AppProxy(); facade.registerProxy(_local3); _local3.startApp(); } } }//package game.controller
Section 237
//AppProxy (game.model.AppProxy) package game.model { import flash.events.*; import org.puremvc.as3.interfaces.*; import flash.display.*; import com.whirled.game.*; import core.*; import flash.media.*; import game.controller.*; import org.puremvc.as3.patterns.proxy.*; import flash.net.*; import caurina.transitions.properties.*; import game.view.*; public class AppProxy extends Proxy implements IProxy { public var sndTransform:SoundTransform; private var sharedObject:SharedObject; public var whirledControl:GameControl; public var completeLevels:Array; private var loader:Loader; public var musicEnabled:Boolean; public var musicChannel:SoundChannel; private var music:Sound; private var notesProxy:NotesProxy; public var shadowsEnabled:Boolean; public var soundEnabled:Boolean; private var embedAssets:GameAssets; public static const NAME:String = "AppProxy"; public static const START_GAME:String = "StartGame"; public static const INITIALIZE:String = "Initialize"; public static const INSTRUCTIONS_HIDE:String = "InstructionsHide"; public static const OPTIONS_SHOW:String = "OptionsShow"; public static const OPTIONS_HIDE:String = "OptionsHide"; public static const CREDITS_HIDE:String = "CreditsHide"; public static const HOST:String = "http://www.king.com/games/splitter/"; public static const CREDITS_SHOW:String = "CreditsShow"; public static const INSTRUCTIONS_SHOW:String = "InstructionsShow"; public static const DEBUG:Boolean = false; public static const END_GAME:String = "EndGame"; public static const LEVEL_CREATE:String = "LevelCreate"; public static const SAVE_SCORE_SCRIPT:String = "save_score.php"; public function AppProxy():void{ super(NAME); init(); } private function coreAssetsInitHandler(_arg1:Event):void{ var _local2:GameAssets = GameAssets.getInstance(); _local2.addEventListener(Event.INIT, assetsInitHandler); _local2.init(); } private function init():void{ facade.registerCommand(INITIALIZE, InitializeCommand); facade.registerCommand(START_GAME, StartGameCommand); facade.registerCommand(END_GAME, EndGameCommand); facade.registerCommand(INSTRUCTIONS_SHOW, InstructionsShowCommand); facade.registerCommand(CREDITS_SHOW, CreditsShowCommand); facade.registerCommand(OPTIONS_SHOW, OptionsShowCommand); notesProxy = new NotesProxy(); facade.registerProxy(notesProxy); sharedObject = SharedObject.getLocal("gameData"); shadowsEnabled = true; soundEnabled = true; musicEnabled = true; if (sharedObject.data.shadowsEnabled != undefined){ shadowsEnabled = sharedObject.data.shadowsEnabled; }; if (sharedObject.data.soundEnabled != undefined){ soundEnabled = sharedObject.data.soundEnabled; }; if (sharedObject.data.musicEnabled != undefined){ musicEnabled = sharedObject.data.musicEnabled; }; sndTransform = new SoundTransform(); updateSoundOptions(); completeLevels = sharedObject.data.completeLevels; if (completeLevels == null){ completeLevels = []; }; } public function startApp():void{ var _local1:CoreAssets = CoreAssets.getInstance(); _local1.addEventListener(Event.INIT, coreAssetsInitHandler); _local1.init(); } public function clearProgress():void{ completeLevels = []; sharedObject.data.completeLevels = completeLevels; sharedObject.flush(); var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); if (_local1){ _local1.initLevels(); }; } public function flushLevels():void{ var _local4:GameLevel; var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); var _local2:Array = _local1.getLevels(); completeLevels = []; var _local3:uint; while (_local3 < _local2.length) { _local4 = _local2[_local3]; if (_local4.status == GameLevel.STATUS_COMPLETE){ completeLevels.push({id:_local4.id, bonuses:_local4.collectedBonuses, time:_local4.time}); }; _local3++; }; sharedObject.data.completeLevels = completeLevels; sharedObject.flush(); } private function assetsInitHandler(_arg1:Event=null):void{ ColorShortcuts.init(); SoundShortcuts.init(); initMusic(); notesProxy.push(INITIALIZE); var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); if (Factory.VERSION_WHIRLED){ whirledControl = new GameControl(_local2.getViewContainer()); }; } private function updateSoundOptions():void{ sndTransform.volume = (soundEnabled) ? 1 : 0; } private function editorInitHandler(_arg1:Event):void{ var _local2:GameAssets = GameAssets.getInstance(); _local2.addEventListener(Event.INIT, assetsInitHandler); _local2.init(); } private function initMusic():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("island2"); music = new (_local1); var _local2:Number = (musicEnabled) ? 0.5 : 0; var _local3:SoundTransform = new SoundTransform(_local2); musicChannel = music.play(0, 100000, _local3); } public function flushOptions():void{ sharedObject.data.shadowsEnabled = shadowsEnabled; sharedObject.data.soundEnabled = soundEnabled; sharedObject.data.musicEnabled = musicEnabled; updateSoundOptions(); sharedObject.flush(); } } }//package game.model
Section 238
//GameAssets (game.model.GameAssets) package game.model { import flash.events.*; import flash.display.*; import flash.system.*; public class GameAssets extends EventDispatcher { private var Assets:Class; private var appDomain:ApplicationDomain; private static var instance:GameAssets; public function GameAssets():void{ Assets = GameAssets_Assets; super(); } public function init():void{ var _local1:Loader = new Loader(); _local1.contentLoaderInfo.addEventListener(Event.INIT, assetsInitHandler); _local1.loadBytes(new Assets()); } private function assetsInitHandler(_arg1:Event):void{ appDomain = _arg1.target.content.loaderInfo.applicationDomain; dispatchEvent(new Event(Event.INIT)); } public function getAssetClass(_arg1:String):Class{ if (!appDomain.hasDefinition(_arg1)){ trace((("*Error*: There is no definition of class '" + _arg1) + "'")); return (null); }; return ((appDomain.getDefinition(_arg1) as Class)); } public static function getInstance():GameAssets{ if (!instance){ instance = new (GameAssets); }; return (instance); } } }//package game.model
Section 239
//GameAssets_Assets (game.model.GameAssets_Assets) package game.model { import mx.core.*; public class GameAssets_Assets extends ByteArrayAsset { } }//package game.model
Section 240
//GameLevel (game.model.GameLevel) package game.model { import core.*; import core.objects.*; public class GameLevel extends Level { public var collectedBonuses:uint; public var timeScore:int; public var totalBonuses:uint; public var time:uint; public var cuts:uint; public var status:String; public var bonusScore:int; public var score:int; public var name:String; public var id:uint; public static const STATUS_INCOMPLETE:String = "StatusIncomplete"; public static const STATUS_COMPLETE:String = "StatusComplete"; public function GameLevel(_arg1:uint, _arg2:String, _arg3:uint, _arg4:String):void{ this.id = _arg1; this.cuts = _arg3; this.name = _arg4; super(_arg2); init(); } public function complete(_arg1:int, _arg2:int):void{ status = STATUS_COMPLETE; this.time = _arg1; collectedBonuses = _arg2; timeScore = Math.floor((((60 * 40) - _arg1) / 40)); if (timeScore < 0){ timeScore = 0; }; bonusScore = (collectedBonuses * 10); score = (timeScore + bonusScore); } private function init():void{ totalBonuses = 0; collectedBonuses = 0; status = STATUS_INCOMPLETE; time = 0; countBonuses(); } private function countBonuses():void{ var _local3:String; var _local4:Array; var _local1:Array = def.split(" "); var _local2:uint; while (_local2 < _local1.length) { _local3 = _local1[_local2]; _local4 = _local3.split("_"); switch (_local4[0]){ case BonusDef.NAME: totalBonuses++; break; }; _local2++; }; } } }//package game.model
Section 241
//GameProxy (game.model.GameProxy) package game.model { import org.puremvc.as3.interfaces.*; import flash.display.*; import core.events.*; import core.*; import game.view.components.*; import game.controller.*; import org.puremvc.as3.patterns.proxy.*; import game.view.*; import flash.utils.*; import ascb.util.*; import com.midasplayer.*; public class GameProxy extends Proxy implements IProxy { public var currentLevel:GameLevel; private var collectedBonuses:int; private var availableLevels:Array; public var cutsLeft:uint; private var notesProxy:NotesProxy; private var prevTime:int; private var engine:GameEngine; private var recorderProxy:RecorderProxy; private var startScore:uint; public var openLevels:uint; private var levels:Array; private var levelTime:int; public static const SPLIT_FAIL:String = "SplitFail"; public static const LEVEL_UPDATE:String = "LevelUpdate"; public static const BONUS_COLLECT:String = "BonusCollect"; public static const NAME:String = "GameProxy"; public static const LEVEL_RESTART_END:String = "LevelRestartEnd"; public static const LEVEL_RESTART_START:String = "LevelRestartStart"; public static const SPLIT_SUCCESS:String = "SplitSuccess"; public static const LEVEL_END:String = "LevelEnd"; public static const LEVEL_START:String = "LevelStart"; public static const LEVEL_COMPLETE:String = "LevelComplete"; public static const LEVEL_NEXT:String = "LevelNext"; public static const LEVEL_SELECT:String = "LevelSelect"; public static var OPEN_LEVELS:Boolean = false; public function GameProxy():void{ super(NAME); init(); } private function splitSuccessHandler(_arg1:CoreEvent):void{ cutsLeft--; notesProxy.push(GameEngine.SPLIT_SUCCESS); } public function getCutsLeft():uint{ return (cutsLeft); } private function updateAvailableLevels():void{ var _local3:GameLevel; var _local1:uint = openLevels; var _local2:uint; while (_local2 < levels.length) { _local3 = levels[_local2]; if (_local3.status == GameLevel.STATUS_COMPLETE){ _local1++; }; _local2++; }; availableLevels = (ArrayUtilities.duplicate(levels) as Array); availableLevels.splice(_local1, (levels.length - _local1)); } private function init():void{ if (!facade.hasCommand(LEVEL_SELECT)){ facade.registerCommand(LEVEL_SELECT, LevelSelectCommand); }; if (!facade.hasCommand(LEVEL_START)){ facade.registerCommand(LEVEL_START, LevelStartCommand); }; if (!facade.hasCommand(LEVEL_END)){ facade.registerCommand(LEVEL_END, LevelEndCommand); }; if (!facade.hasCommand(LEVEL_COMPLETE)){ facade.registerCommand(LEVEL_COMPLETE, LevelCompleteCommand); }; if (!facade.hasCommand(LEVEL_NEXT)){ facade.registerCommand(LEVEL_NEXT, LevelNextCommand); }; var _local1:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); recorderProxy = new RecorderProxy(); facade.registerProxy(recorderProxy); engine = GameEngine.getInstance(); engine.dispatcher.addEventListener(CoreEvent.LEVEL_COMPLETE, levelCompleteHandler); engine.dispatcher.addEventListener(CoreEvent.LEVEL_RESTART_END, levelRestartEndHandler); engine.dispatcher.addEventListener(GameEngine.SPLIT_SUCCESS, splitSuccessHandler); engine.dispatcher.addEventListener(GameEngine.SPLIT_FAIL, splitFailHandler); engine.dispatcher.addEventListener(CoreEvent.BONUS_COLLECT, bonusCollectHandler); engine.dispatcher.addEventListener(CoreEvent.UPDATE, levelUpdateHandler); } public function mouseDrawEnd():void{ recorderProxy.mouseDrawEnd(); } public function getCurrentLevel():GameLevel{ return (currentLevel); } private function levelUpdateHandler(_arg1:CoreEvent):void{ levelTime++; notesProxy.push(LEVEL_UPDATE); } public function getTotalBonuses():uint{ var _local3:GameLevel; var _local1:uint; var _local2:uint; while (_local2 < levels.length) { _local3 = levels[_local2]; _local1 = (_local1 + _local3.collectedBonuses); _local2++; }; return (_local1); } public function getLevelIndex(_arg1:uint):int{ var _local3:GameLevel; var _local2:uint; while (_local2 < levels.length) { _local3 = levels[_local2]; if (_local3.id == _arg1){ return (_local2); }; _local2++; }; return (-1); } public function initLevels():void{ var _local3:uint; var _local4:GameLevel; var _local5:uint; levels = []; levels.push(new GameLevel(0, "e_340_455_5 p_150_205_20 r_150_325_0_200_200_0 r_150_450_2_200_50_0 b_190_213_5 ", 10, "Hello, world!")); levels.push(new GameLevel(1, "e_500_455_5 p_300_315_20 c_150_60_2_10 c_250_160_2_10 c_100_160_1_20 r_300_405_1_50_140_0 b_420_385_5 j_125_110_150_60_100_160 j_175_160_250_160_100_160 ", 2, "Hello, joints")); levels.push(new GameLevel(2, "e_32_455_5 p_493_127_20 r_174_260_2_15_200_0 r_494_317_2_15_314_0 r_329_155_0_380_13_0 b_329_326_5 ", 2, "Slope")); levels.push(new GameLevel(3, "e_486_455_5 p_33_339_20 r_87_405_2_308_15_30 c_305_325_2_12 r_305_423_1_20_98_0 c_114_218_1_33 b_450_455_5 j_305_358_305_325_305_390 j_23_353_32_345_14_361 ", 1, "Gates")); levels.push(new GameLevel(4, "e_197_176_5 p_117_391_20 r_262_419_0_331_15_0 r_101_450_0_28_50_0 r_424_451_0_30_50_0 c_263_449_1_25 c_356_70_2_13 c_355_154_1_40 b_142_266_5 j_356_110_356_66_356_153 ", 2, "Catapult")); levels.push(new GameLevel(5, "e_100_420_5 p_364_236_20 r_200_192_0_70_153_0 r_272_278_2_214_19_0 r_352_263_2_50_18_30 b_279_418_5 j_295_179_225_123_365_234 ", 2, "Grapple")); levels.push(new GameLevel(6, "e_80_455_5 p_360_385_20 r_350_415_1_300_20_0 r_240_450_0_40_50_0 r_460_450_0_40_50_0 b_130_455_5 ", 3, "Table")); levels.push(new GameLevel(7, "e_110_455_5 p_60_144_20 r_314_174_2_520_20_0 r_125_139_1_10_50_0 r_165_139_1_10_50_0 r_205_139_1_10_50_0 r_245_139_1_10_50_0 r_285_139_1_10_50_0 r_325_139_1_10_50_0 r_365_139_1_10_50_0 r_405_139_1_10_50_0 r_445_139_1_10_50_0 r_485_139_1_10_50_0 r_517_116_1_10_50_-30 r_97_313_2_259_20_34 c_525_207_1_20 b_30_230_5 j_425_194_325_180_525_207 j_539_193_551_178_526_207 ", 2, "Domino")); levels.push(new GameLevel(8, "e_240_455_5 p_450_160_20 r_450_200_0_150_40_0 r_450_340_0_150_40_0 c_350_100_2_5 c_550_100_2_5 c_350_240_2_5 c_550_240_2_5 b_280_455_5 j_373_145_350_100_395_190 j_528_145_550_100_505_190 j_373_285_350_240_395_330 j_528_285_550_240_505_330 ", 4, "Balconies")); levels.push(new GameLevel(9, "e_280_437_5 p_201_215_20 r_315_245_0_300_20_0 r_434_215_0_40_40_0 r_173_305_0_15_100_0 r_458_305_0_15_100_0 r_315_365_0_300_20_0 r_308_425_0_15_100_0 r_323_425_0_15_100_0 b_280_305_5 ", 5, "Stack")); levels.push(new GameLevel(10, "e_60_455_5 p_300_315_20 b_120_455_5 r_300_405_1_50_140_0 c_150_60_2_10 c_250_160_2_10 c_100_160_1_25 j_125_110_150_60_100_160 j_175_160_250_160_100_160 ", 2, "How u doin, joints?")); levels.push(new GameLevel(11, "e_520_455_5 p_290_220_20 r_290_110_2_200_20_0 c_95_110_1_20 c_250_220_1_20 c_330_220_1_20 c_370_220_1_20 b_413_293_5 j_153_110_210_110_95_110 j_250_165_250_110_250_220 j_290_165_290_110_290_220 j_330_165_330_110_330_220 j_370_165_370_110_370_220 ", 3, "Pendulum")); levels.push(new GameLevel(12, "e_430_415_5 p_64_54_20 r_71_149_2_200_20_55 r_209_74_2_200_20_-15 r_285_265_0_560_20_0 r_70_375_2_40_200_0 r_380_375_2_40_200_0 r_480_375_2_40_200_0 c_24_28_1_20 c_74_96_1_20 c_110_38_1_20 c_162_51_1_20 b_430_373_5 ", 4, "Pit")); levels.push(new GameLevel(13, "e_320_455_5 p_60_360_20 r_65_465_0_120_20_0 r_60_388_0_100_15_0 c_20_445_1_10 c_100_445_1_10 c_260_440_2_10 b_260_380_5 j_20_418_20_445_20_390 j_38_418_20_445_55_390 j_83_418_100_445_65_390 j_100_418_100_445_100_390 j_60_375_60_360_60_390 ", 4, "Driving school")); levels.push(new GameLevel(14, "e_25_425_5 p_549_350_20 r_45_460_2_80_30_0 r_150_460_2_70_30_0 r_250_460_2_70_30_0 r_350_460_2_70_30_0 r_465_460_2_100_30_0 r_507_410_2_170_20_-30 c_20_100_1_15 c_60_100_1_15 c_100_100_1_15 c_140_100_1_15 c_240_100_2_10 b_250_430_5 j_190_100_240_100_140_100 j_150_100_240_100_60_100 j_170_100_240_100_100_100 j_130_100_240_100_20_100 j_560_363_549_350_571_375 ", 5, "Road's repair")); levels.push(new GameLevel(15, "e_30_455_5 p_294_255_20 r_293_375_0_100_200_0 b_105_405_5 ", 1, "Only one")); levels.push(new GameLevel(16, "e_550_400_5 p_50_400_20 r_290_110_2_570_20_0 r_65_190_0_80_40_0 r_185_190_0_80_40_0 r_305_190_0_80_40_0 r_415_190_0_80_40_0 r_290_430_2_570_20_0 r_143_423_2_50_10_-5 r_273_423_2_50_10_-5 r_415_423_2_50_10_-5 b_305_395_5 j_65_150_65_110_65_190 j_185_150_185_110_185_190 j_304_150_304_110_304_190 j_416_150_416_110_416_190 ", 4, "Rocks")); levels.push(new GameLevel(17, "e_550_400_5 p_50_100_20 r_250_30_2_20_20_0 r_450_30_2_20_20_0 r_350_220_0_100_320_0 r_350_435_2_100_80_0 c_150_100_2_10 b_500_400_5 j_283_53_250_30_315_75 j_418_53_450_30_385_75 j_100_100_150_100_50_100 ", 3, "Wall")); levels.push(new GameLevel(18, "e_30_455_5 p_155_385_20 c_300_450_2_25 r_300_415_1_350_20_0 r_435_385_0_40_40_0 b_235_385_5 j_435_400_435_385_435_415 ", 2, "Swing")); levels.push(new GameLevel(19, "e_46_182_5 p_553_150_20 r_250_40_2_20_20_0 r_250_180_0_300_20_0 r_150_270_0_70_100_0 r_350_270_0_70_100_0 r_460_190_2_100_20_0 r_533_186_2_100_20_-5 b_42_135_5 b_54_62_5 j_250_112_250_40_250_183 j_150_211_150_181_150_241 j_350_211_350_181_350_241 ", 5, "Elevator")); levels.push(new GameLevel(20, "e_24_453_5 p_267_452_20 r_324_188_2_10_200_0 r_412_155_0_20_300_0 r_141_438_2_197_19_30 b_90_376_5 j_366_100_324_100_408_99 j_366_151_323_129_409_173 j_367_204_325_223_408_184 j_364_273_322_273_406_273 ", 3, "Pusher")); levels.push(new GameLevel(21, "e_550_338_5 p_190_145_20 r_140_232_0_171_130_0 r_140_306_2_169_20_0 c_90_145_1_20 r_360_240_2_200_10_10 r_512_258_2_112_10_0 b_412_321_5 j_140_135_90_135_190_135 j_140_155_90_155_190_155 ", 3, "Connections")); levels.push(new GameLevel(22, "e_545_434_5 p_140_177_20 c_325_254_2_10 c_355_254_2_10 r_343_145_0_200_20_0 r_109_465_2_210_20_0 r_515_465_2_120_20_0 r_64_442_2_130_19_20 r_114_212_2_128_19_-10 b_329_438_5 j_323_199_323_254_323_144 j_354_200_354_255_354_144 ", 2, "Bridge")); levels.push(new GameLevel(23, "e_295_240_5 p_295_110_20 r_295_340_2_250_20_0 r_295_230_0_250_200_0 ", 3, "Core")); levels.push(new GameLevel(24, "e_404_455_5 p_279_454_20 r_238_315_2_200_20_0 r_144_247_0_64_117_0 b_344_456_5 ", 3, "The last one")); var _local1:AppProxy = (facade.retrieveProxy(AppProxy.NAME) as AppProxy); var _local2:Array = _local1.completeLevels; _local3 = 0; while (_local3 < _local2.length) { _local5 = _local2[_local3].id; _local4 = levels[_local5]; _local4.complete(_local2[_local3].time, _local2[_local3].bonuses); _local3++; }; openLevels = (OPEN_LEVELS) ? levels.length : 3; updateAvailableLevels(); } private function processLevelComplete():void{ var _local1:LevelCompleteView = new LevelCompleteView(); var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); _local2.getViewContainer().addChild(_local1); var _local3:LevelCompleteMediator = new LevelCompleteMediator(_local1); facade.registerMediator(_local3); } private function levelCompleteHandler(_arg1:CoreEvent):void{ notesProxy.push(LEVEL_COMPLETE); } private function levelRestartEndHandler(_arg1:CoreEvent):void{ notesProxy.push(LEVEL_RESTART_END); notesProxy.push(LEVEL_START, currentLevel.id); } public function levelRestartStart():void{ GameEngine.getInstance().levelRestartStart(); } private function bonusCollectHandler(_arg1:CoreEvent):void{ collectedBonuses++; } public function levelEnd():void{ GameEngine.getInstance().levelAbort(); } public function startLevel(_arg1:uint):void{ recorderProxy.startRecord(); collectedBonuses = 0; levelTime = 0; var _local2:GameLevel = getLevel(_arg1); cutsLeft = _local2.cuts; currentLevel = _local2; var _local3:GameEngine = GameEngine.getInstance(); _local3.levelStart(_local2); prevTime = getTimer(); } private function getLevel(_arg1:uint):GameLevel{ return (levels[_arg1]); } public function nextLevel():void{ engine.levelAbort(); var _local1:uint = getLevelIndex(currentLevel.id); if (_local1 < (levels.length - 1)){ notesProxy.push(LEVEL_START, (_local1 + 1)); } else { notesProxy.push(LEVEL_END); }; } private function splitFailHandler(_arg1:CoreEvent):void{ notesProxy.push(GameEngine.SPLIT_FAIL); } private function processGameComplete():void{ var _local1:GameCompleteView = new GameCompleteView(); var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator); _local2.getViewContainer().addChild(_local1); var _local3:GameCompleteMediator = new GameCompleteMediator(_local1); facade.registerMediator(_local3); } public function getScore():int{ var _local5:GameLevel; var _local1:int; var _local2:uint; var _local3:uint; var _local4:uint; while (_local4 < levels.length) { _local5 = levels[_local4]; _local1 = (_local1 + _local5.score); _local4++; }; return (_local1); } public function levelComplete():void{ var _local2:uint; var _local4:GameLevel; if (collectedBonuses >= currentLevel.collectedBonuses){ currentLevel.complete(levelTime, collectedBonuses); }; var _local1:AppProxy = (facade.retrieveProxy(AppProxy.NAME) as AppProxy); var _local3:uint; while (_local3 < levels.length) { _local4 = levels[_local3]; if (_local4.status == GameLevel.STATUS_COMPLETE){ _local2++; }; _local3++; }; trace("isHome: ", KingAPI.isHome); if (KingAPI.isHome){ KingAPI.submitLevel(_local2); }; if (Factory.VERSION_KONG){ Factory.kongregate.scores.submit(getScore()); Factory.kongregate.stats.submit("LevelsCompleted", _local2); Factory.kongregate.stats.submit("StarsCollected", getStarsCollected()); }; if (Factory.VERSION_WHIRLED){ if (_local1.whirledControl.isConnected()){ if (_local2 == 5){ _local1.whirledControl.player.awardTrophy("splitter5"); } else { if (_local2 == 10){ _local1.whirledControl.player.awardTrophy("splitter10"); } else { if (_local2 == 15){ _local1.whirledControl.player.awardTrophy("splitter15"); } else { if (_local2 == 20){ _local1.whirledControl.player.awardTrophy("splitter20"); } else { if (_local2 == 25){ _local1.whirledControl.player.awardTrophy("splitter25"); }; }; }; }; }; }; }; updateAvailableLevels(); _local1.flushLevels(); if (_local2 == levels.length){ processGameComplete(); } else { processLevelComplete(); }; } private function getStarsCollected():int{ var _local3:GameLevel; var _local1:uint; var _local2:uint; while (_local2 < levels.length) { _local3 = levels[_local2]; if (_local3.status == GameLevel.STATUS_COMPLETE){ _local1 = (_local1 + _local3.collectedBonuses); }; _local2++; }; return (_local1); } public function mouseDrawStart():void{ recorderProxy.mouseDrawStart(); } public function getAvailableLevels():Array{ return (availableLevels); } public function getLevels():Array{ return (levels); } public function endGame():void{ GameEngine.getInstance().levelAbort(); engine.dispatcher.removeEventListener(CoreEvent.LEVEL_COMPLETE, levelCompleteHandler); engine.dispatcher.removeEventListener(CoreEvent.LEVEL_RESTART_END, levelRestartEndHandler); engine.dispatcher.removeEventListener(GameEngine.SPLIT_SUCCESS, splitSuccessHandler); engine.dispatcher.removeEventListener(GameEngine.SPLIT_FAIL, splitFailHandler); engine.dispatcher.removeEventListener(CoreEvent.BONUS_COLLECT, bonusCollectHandler); engine.dispatcher.removeEventListener(CoreEvent.UPDATE, levelUpdateHandler); facade.removeProxy(RecorderProxy.NAME); facade.removeProxy(NAME); } public function startGame():void{ initLevels(); startScore = 500; var _local1:GameMediator = (facade.retrieveMediator(GameMediator.NAME) as GameMediator); var _local2:Sprite = _local1.getBodiesContainer(); var _local3:Sprite = _local1.getJointsContainer(); var _local4:Sprite = _local1.getPlayerContainer(); var _local5:Sprite = _local3; var _local6:AppProxy = (facade.retrieveProxy(AppProxy.NAME) as AppProxy); var _local7:GameEngine = GameEngine.getInstance(); var _local8:GameCanvas = new GameCanvas(_local2, _local3, _local4, _local5); _local7.initialize(CoreAssets.getInstance(), _local8, _local6.sndTransform); } } }//package game.model
Section 242
//NotesProxy (game.model.NotesProxy) package game.model { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.patterns.proxy.*; public class NotesProxy extends Proxy implements IProxy { private var notes:Array; public static const NAME:String = "NotesProxy"; public function NotesProxy():void{ super(NAME); init(); } private function init():void{ notes = []; } private function sendNote():void{ var _local1:Object = notes[0]; if (_local1.name != GameProxy.LEVEL_UPDATE){ trace("note!", _local1.name); }; sendNotification(_local1.name, _local1.body); sendNoteComplete(); } public function push(_arg1:String, _arg2:Object=null):void{ var _local3:Object = {name:_arg1, body:_arg2}; notes.push(_local3); if (notes.length == 1){ sendNote(); }; } private function sendNoteComplete():void{ notes.splice(0, 1); if (notes.length > 0){ sendNote(); }; } } }//package game.model
Section 243
//RecorderProxy (game.model.RecorderProxy) package game.model { import flash.events.*; import flash.display.*; import core.events.*; import core.*; import org.puremvc.as3.patterns.proxy.*; import flash.net.*; import game.view.*; public class RecorderProxy extends Proxy { private var record:String; private var cursor:Sprite; private var drawEnd:Boolean; private var drawStart:Boolean; private static const SOLUTIONS:Array = ["1helloworld", "2hellojoints", "3slope", "4gates", "5catapult", "6grapple", "7table", "8domino", "9balconies", "10stack", "11howudoinjoints", "12pendulum", "13pit", "14drivingschool", "15roadsrepair", "16onlyone", "17rocks", "18wall", "19swing", "20elevator", "21pusher", "22connections", "23bridge", "24core", "25thelastone"]; public static const RECORD_COMPLETE:String = "RecordComplete"; private static const UPLOAD_SCRIPT:String = "upload.jsp"; public static const NAME:String = "RecorderProxy"; private static const SOLUTION_PREFIX:String = "solution/"; private static const VIEWER:String = "viewer.jsp"; public static const RECORD_ERROR:String = "RecordError"; public function RecorderProxy():void{ super(NAME); init(); } private function updateHandler(_arg1:CoreEvent):void{ record = (record + ((cursor.x + "_") + cursor.y)); if (drawStart){ record = (record + ("_" + "down")); drawStart = false; }; if (drawEnd){ record = (record + ("_" + "up")); drawEnd = false; }; record = (record + " "); } private function loadCompleteHandler(_arg1:Event):void{ var notesProxy:NotesProxy; var response:String; var e = _arg1; notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); try { response = (((AppProxy.HOST + VIEWER) + "?w=") + String(e.target.data)); notesProxy.push(RECORD_COMPLETE, response); } catch(error:TypeError) { response = "An error occured when communicating with server. "; notesProxy.push(RECORD_ERROR, response); }; } public function getRecord():String{ return (record); } private function ioErrorHandler(_arg1:IOErrorEvent):void{ var _local2:String = ("An error occurred when attempting to save walkthrough. " + _arg1.text); var _local3:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local3.push(RECORD_ERROR, _local2); } public function stopRecord():void{ GameEngine.getInstance().dispatcher.removeEventListener(CoreEvent.UPDATE, updateHandler); } public function getSolution(_arg1:uint):String{ return ((((AppProxy.HOST + VIEWER) + "?s=") + SOLUTIONS[_arg1])); } private function init():void{ } public function mouseDrawEnd():void{ drawEnd = true; } public function saveRecord():void{ var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); var _local2:XML = new XML(<data/> ); var _local3:XMLList = new XMLList(new XML((("<level>" + ??esc_xelem ) + "</level>"))); _local3.@name = _local1.currentLevel.name; _local2.appendChild(_local3); var _local4:XMLList = new XMLList(new XML((("<record>" + ??esc_xelem ) + "</record>"))); _local2.appendChild(_local4); var _local5:URLRequest = new URLRequest((AppProxy.HOST + UPLOAD_SCRIPT)); _local5.data = _local2; _local5.contentType = "application/x-www-form-urlencoded"; _local5.method = URLRequestMethod.POST; var _local6:URLLoader = new URLLoader(); _local6.addEventListener(Event.COMPLETE, loadCompleteHandler); _local6.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); navigateToURL(_local5); } public function mouseDrawStart():void{ drawStart = true; } public function startRecord():void{ record = ""; var _local1:MouseHandlerMediator = (facade.retrieveMediator(MouseHandlerMediator.NAME) as MouseHandlerMediator); cursor = _local1.getCursor(); GameEngine.getInstance().dispatcher.addEventListener(CoreEvent.UPDATE, updateHandler); } } }//package game.model
Section 244
//CustomCellRenderer (game.view.components.ui.CustomCellRenderer) package game.view.components.ui { import game.model.*; import fl.controls.listClasses.*; public class CustomCellRenderer extends CellRenderer { private var upSkinIncompleteClass:Class; private var overSkinCompleteClass:Class; private var upSkinCompleteClass:Class; private var overSkinIncompleteClass:Class; public function CustomCellRenderer(){ upSkinIncompleteClass = CustomCellRenderer_upSkinIncompleteClass; upSkinCompleteClass = CustomCellRenderer_upSkinCompleteClass; overSkinIncompleteClass = CustomCellRenderer_overSkinIncompleteClass; overSkinCompleteClass = CustomCellRenderer_overSkinCompleteClass; super(); } override protected function drawBackground():void{ switch (data.levelStatus){ case GameLevel.STATUS_INCOMPLETE: setStyle("upSkin", upSkinIncompleteClass); setStyle("overSkin", overSkinIncompleteClass); setStyle("downSkin", overSkinIncompleteClass); setStyle("selectedUpSkin", overSkinIncompleteClass); setStyle("selectedDownSkin", overSkinIncompleteClass); setStyle("selectedOverSkin", overSkinIncompleteClass); break; case GameLevel.STATUS_COMPLETE: setStyle("upSkin", upSkinCompleteClass); setStyle("overSkin", overSkinCompleteClass); setStyle("downSkin", overSkinCompleteClass); setStyle("selectedUpSkin", overSkinCompleteClass); setStyle("selectedDownSkin", overSkinCompleteClass); setStyle("selectedOverSkin", overSkinCompleteClass); break; }; super.drawBackground(); } public static function getStyleDefinition():Object{ return (CellRenderer.getStyleDefinition()); } } }//package game.view.components.ui
Section 245
//CustomCellRenderer_overSkinCompleteClass (game.view.components.ui.CustomCellRenderer_overSkinCompleteClass) package game.view.components.ui { import flash.display.*; import mx.core.*; public class CustomCellRenderer_overSkinCompleteClass extends SpriteAsset { public var bar:DisplayObject; public var dragonHolder:DisplayObject; public var back:DisplayObject; public var adBox:DisplayObject; public var bg:DisplayObject; public var fireLogoHolder:DisplayObject; public var continue_bt:DisplayObject; public var mcPlayBtn:DisplayObject; public var bannedSign:DisplayObject; public var adsHolder:DisplayObject; public var play_bt:DisplayObject; public var barHolder:DisplayObject; } }//package game.view.components.ui
Section 246
//CustomCellRenderer_overSkinIncompleteClass (game.view.components.ui.CustomCellRenderer_overSkinIncompleteClass) package game.view.components.ui { import flash.display.*; import mx.core.*; public class CustomCellRenderer_overSkinIncompleteClass extends SpriteAsset { public var bar:DisplayObject; public var dragonHolder:DisplayObject; public var back:DisplayObject; public var adBox:DisplayObject; public var bg:DisplayObject; public var fireLogoHolder:DisplayObject; public var continue_bt:DisplayObject; public var mcPlayBtn:DisplayObject; public var bannedSign:DisplayObject; public var adsHolder:DisplayObject; public var play_bt:DisplayObject; public var barHolder:DisplayObject; } }//package game.view.components.ui
Section 247
//CustomCellRenderer_upSkinCompleteClass (game.view.components.ui.CustomCellRenderer_upSkinCompleteClass) package game.view.components.ui { import flash.display.*; import mx.core.*; public class CustomCellRenderer_upSkinCompleteClass extends SpriteAsset { public var bar:DisplayObject; public var dragonHolder:DisplayObject; public var back:DisplayObject; public var adBox:DisplayObject; public var bg:DisplayObject; public var fireLogoHolder:DisplayObject; public var continue_bt:DisplayObject; public var mcPlayBtn:DisplayObject; public var bannedSign:DisplayObject; public var adsHolder:DisplayObject; public var play_bt:DisplayObject; public var barHolder:DisplayObject; } }//package game.view.components.ui
Section 248
//CustomCellRenderer_upSkinIncompleteClass (game.view.components.ui.CustomCellRenderer_upSkinIncompleteClass) package game.view.components.ui { import flash.display.*; import mx.core.*; public class CustomCellRenderer_upSkinIncompleteClass extends SpriteAsset { public var bar:DisplayObject; public var dragonHolder:DisplayObject; public var back:DisplayObject; public var adBox:DisplayObject; public var bg:DisplayObject; public var fireLogoHolder:DisplayObject; public var continue_bt:DisplayObject; public var mcPlayBtn:DisplayObject; public var bannedSign:DisplayObject; public var adsHolder:DisplayObject; public var play_bt:DisplayObject; public var barHolder:DisplayObject; } }//package game.view.components.ui
Section 249
//AppView (game.view.components.AppView) package game.view.components { import flash.display.*; import game.model.*; public class AppView extends Sprite { private var window:Sprite; public var container:Sprite; public var popupContainer:Sprite; public var sponsorLogo_bt:SimpleButton; public function AppView(){ init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("AppWindow"); window = new (_local1); addChild(window); container = (window.getChildByName("container") as Sprite); popupContainer = (window.getChildByName("popupContainer") as Sprite); sponsorLogo_bt = (window.getChildByName("sponsorLogo_bt") as SimpleButton); } } }//package game.view.components
Section 250
//CreditsView (game.view.components.CreditsView) package game.view.components { import flash.display.*; import game.model.*; public class CreditsView extends Sprite { public var fglLogo:MovieClip; public var soundSnap:Sprite; public var karataev1:SimpleButton; public var karataev2:SimpleButton; private var window:Sprite; public var popov:SimpleButton; public var close_bt:SimpleButton; public var johnny_bt:SimpleButton; public var box2d:Sprite; public function CreditsView():void{ init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("CreditsWindow"); window = new (_local1); addChild(window); close_bt = (window.getChildByName("close_bt") as SimpleButton); karataev1 = (window.getChildByName("karataev1") as SimpleButton); karataev2 = (window.getChildByName("karataev2") as SimpleButton); popov = (window.getChildByName("popov") as SimpleButton); box2d = (window.getChildByName("box2d") as Sprite); soundSnap = (window.getChildByName("soundSnap") as Sprite); johnny_bt = (window.getChildByName("johnny_bt") as SimpleButton); fglLogo = (window.getChildByName("fglLogo") as MovieClip); box2d.buttonMode = true; soundSnap.buttonMode = true; fglLogo.buttonMode = true; tabChildren = false; } } }//package game.view.components
Section 251
//FpsMeterView (game.view.components.FpsMeterView) package game.view.components { import flash.display.*; import flash.text.*; public class FpsMeterView { public var window:Sprite; public var fps_tf:TextField; public function FpsMeterView(_arg1:Sprite):void{ this.window = _arg1; init(); } private function init():void{ fps_tf = (window.getChildByName("fps_tf") as TextField); } } }//package game.view.components
Section 252
//GameCompleteView (game.view.components.GameCompleteView) package game.view.components { import flash.events.*; import flash.display.*; import game.model.*; import flash.text.*; public class GameCompleteView extends Sprite { public var status_tf:TextField; public var contentMask:Sprite; public var name_tf:TextField; public var sendScore_bt:SimpleButton; public var selectLevel_bt:SimpleButton; public var clearProgress_bt:SimpleButton; private var window:Sprite; public var save_bt:SimpleButton; public var nameHolder:Sprite; public var score_tf:TextField; public function GameCompleteView():void{ init(); } private function addedHandler(_arg1:Event):void{ stage.focus = name_tf; } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("GameCompleteWindow"); window = (new (_local1) as Sprite); addChild(window); contentMask = (window.getChildByName("_mask") as Sprite); score_tf = (window.getChildByName("score_tf") as TextField); nameHolder = (window.getChildByName("nameHolder") as Sprite); name_tf = (nameHolder.getChildByName("name_tf") as TextField); sendScore_bt = (window.getChildByName("sendScore_bt") as SimpleButton); clearProgress_bt = (window.getChildByName("clearProgress_bt") as SimpleButton); selectLevel_bt = (window.getChildByName("selectLevel_bt") as SimpleButton); save_bt = (window.getChildByName("save_bt") as SimpleButton); status_tf = (window.getChildByName("status_tf") as TextField); name_tf.maxChars = 15; name_tf.border = true; name_tf.background = false; name_tf.borderColor = 0x996600; tabChildren = false; addEventListener(Event.ADDED_TO_STAGE, addedHandler); } } }//package game.view.components
Section 253
//GameMenuView (game.view.components.GameMenuView) package game.view.components { import flash.display.*; import flash.text.*; public class GameMenuView { public var levels_bt:SimpleButton; public var music:MovieClip; public var cuts_tf:TextField; public var restart_bt:SimpleButton; public var sponsorLogo_bt:SimpleButton; public var sound:MovieClip; public var window:Sprite; public var cuts:Sprite; public var menu_bt:SimpleButton; public var solution_bt:SimpleButton; public var score_tf:TextField; public function GameMenuView(_arg1:Sprite):void{ this.window = _arg1; init(); } private function init():void{ restart_bt = (window.getChildByName("restart_bt") as SimpleButton); levels_bt = (window.getChildByName("levels_bt") as SimpleButton); menu_bt = (window.getChildByName("menu_bt") as SimpleButton); music = (window.getChildByName("music") as MovieClip); sound = (window.getChildByName("sound") as MovieClip); score_tf = (window.getChildByName("score_tf") as TextField); cuts = (window.getChildByName("cuts") as Sprite); cuts_tf = (cuts.getChildByName("cuts_tf") as TextField); sponsorLogo_bt = (window.getChildByName("sponsorLogo_bt") as SimpleButton); solution_bt = (window.getChildByName("solution_bt") as SimpleButton); music.buttonMode = true; sound.buttonMode = true; window.tabChildren = false; } } }//package game.view.components
Section 254
//GameView (game.view.components.GameView) package game.view.components { import flash.display.*; import game.model.*; import flash.text.*; public class GameView extends Sprite { public var levelName_tf:TextField; public var infoView:Sprite; public var objectsContainer:Sprite; public var jointsContainer:Sprite; public var backContainer:Sprite; public var levelContainer:Sprite; public var fpsMeter:Sprite; public var bodiesContainer:Sprite; public var mouseHandler:Sprite; public var back:Sprite; public var playerContainer:Sprite; public var gameMenu:Sprite; public function GameView(){ init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("GameView"); var _local2:Sprite = (new (_local1) as Sprite); addChild(_local2); levelContainer = (_local2.getChildByName("levelContainer") as Sprite); infoView = (_local2.getChildByName("infoView") as Sprite); fpsMeter = (_local2.getChildByName("fpsMeter") as Sprite); mouseHandler = (levelContainer.getChildByName("mouseHandler") as Sprite); objectsContainer = (levelContainer.getChildByName("objectsContainer") as Sprite); bodiesContainer = (objectsContainer.getChildByName("bodiesContainer") as Sprite); jointsContainer = (objectsContainer.getChildByName("jointsContainer") as Sprite); playerContainer = (objectsContainer.getChildByName("playerContainer") as Sprite); gameMenu = (_local2.getChildByName("gameMenu") as Sprite); back = (_local2.getChildByName("back") as Sprite); backContainer = (back.getChildByName("container") as Sprite); levelName_tf = (_local2.getChildByName("levelName_tf") as TextField); levelName_tf.mouseEnabled = false; } } }//package game.view.components
Section 255
//InstructionsView (game.view.components.InstructionsView) package game.view.components { import flash.display.*; import game.model.*; public class InstructionsView extends Sprite { private var window:Sprite; public var close_bt:SimpleButton; public function InstructionsView():void{ init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("InstructionsWindow"); window = new (_local1); addChild(window); close_bt = (window.getChildByName("close_bt") as SimpleButton); tabChildren = false; } } }//package game.view.components
Section 256
//LevelCompleteView (game.view.components.LevelCompleteView) package game.view.components { import flash.display.*; import game.model.*; import flash.text.*; public class LevelCompleteView extends Sprite { public var levelScore_tf:TextField; public var contentMask:Sprite; public var timeBonus_tf:TextField; public var selectLevel_bt:SimpleButton; public var next_bt:SimpleButton; private var window:Sprite; public var starsBonus_tf:TextField; public var save_bt:SimpleButton; public var totalScore_tf:TextField; public var replayLevel_bt:SimpleButton; public var status_tf:TextField; public function LevelCompleteView():void{ init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("LevelCompleteViewWindow"); window = (new (_local1) as Sprite); addChild(window); contentMask = (window.getChildByName("_mask") as Sprite); next_bt = (window.getChildByName("next_bt") as SimpleButton); selectLevel_bt = (window.getChildByName("selectLevel_bt") as SimpleButton); replayLevel_bt = (window.getChildByName("replay_bt") as SimpleButton); timeBonus_tf = (window.getChildByName("timeBonus_tf") as TextField); starsBonus_tf = (window.getChildByName("starsBonus_tf") as TextField); levelScore_tf = (window.getChildByName("levelScore_tf") as TextField); totalScore_tf = (window.getChildByName("totalScore_tf") as TextField); save_bt = (window.getChildByName("save_bt") as SimpleButton); status_tf = (window.getChildByName("status_tf") as TextField); status_tf.wordWrap = true; status_tf.autoSize = TextFieldAutoSize.LEFT; tabChildren = false; } } }//package game.view.components
Section 257
//LevelItem (game.view.components.LevelItem) package game.view.components { import flash.events.*; import flash.display.*; import game.model.*; import flash.text.*; public class LevelItem extends Sprite { public var level:GameLevel; private var name_tf:TextField; private var back:MovieClip; private var frame:MovieClip; private var window:Sprite; private var selectedFrame:Sprite; private var stars_tf:TextField; private var isAvailable:Boolean; public static const SELECT:String = "Select"; public function LevelItem(_arg1:GameLevel, _arg2:Boolean):void{ this.level = _arg1; this.isAvailable = _arg2; init(); } private function mouseDownHandler(_arg1:MouseEvent):void{ dispatchEvent(new Event(SELECT)); } private function rollOutHandler(_arg1:MouseEvent):void{ frame.gotoAndStop(1); } public function deselect():void{ selectedFrame.visible = false; } private function rollOverHandler(_arg1:MouseEvent):void{ frame.gotoAndStop(2); } public function select():void{ selectedFrame.visible = true; } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("LevelItemAsset"); window = new (_local1); addChild(window); frame = (window.getChildByName("frame") as MovieClip); selectedFrame = (window.getChildByName("selectedFrame") as Sprite); back = (window.getChildByName("back") as MovieClip); name_tf = (window.getChildByName("name_tf") as TextField); stars_tf = (window.getChildByName("stars_tf") as TextField); frame.stop(); selectedFrame.visible = false; if (level.status == GameLevel.STATUS_INCOMPLETE){ back.gotoAndStop(1); } else { back.gotoAndStop(2); }; var _local2:String = ((uint((level.id + 1)) + ". ") + level.name); name_tf.text = _local2; stars_tf.text = ((level.collectedBonuses + "/") + level.totalBonuses); if (isAvailable){ addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler); addEventListener(MouseEvent.ROLL_OVER, rollOverHandler); addEventListener(MouseEvent.ROLL_OUT, rollOutHandler); } else { alpha = 0.5; }; } } }//package game.view.components
Section 258
//LevelSelectView (game.view.components.LevelSelectView) package game.view.components { import flash.display.*; import game.model.*; import fl.controls.*; import flash.text.*; public class LevelSelectView extends Sprite { public var itemsContainer:Sprite; public var disabledGrid:DataGrid; public var grid:DataGrid; private var window:Sprite; public var menu_bt:SimpleButton; private var headerUpSkinClass:Class; public var totalStars_tf:TextField; public var ok_bt:SimpleButton; public function LevelSelectView(){ headerUpSkinClass = LevelSelectView_headerUpSkinClass; super(); init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("LevelSelectView"); window = (new (_local1) as Sprite); addChild(window); ok_bt = (window.getChildByName("ok_bt") as SimpleButton); menu_bt = (window.getChildByName("menu_bt") as SimpleButton); totalStars_tf = (window.getChildByName("totalStars_tf") as TextField); var _local2:uint = 17; itemsContainer = (window.getChildByName("itemsContainer") as Sprite); tabChildren = false; } } }//package game.view.components
Section 259
//LevelSelectView_headerUpSkinClass (game.view.components.LevelSelectView_headerUpSkinClass) package game.view.components { import flash.display.*; import mx.core.*; public class LevelSelectView_headerUpSkinClass extends SpriteAsset { public var bar:DisplayObject; public var dragonHolder:DisplayObject; public var back:DisplayObject; public var adBox:DisplayObject; public var bg:DisplayObject; public var fireLogoHolder:DisplayObject; public var continue_bt:DisplayObject; public var mcPlayBtn:DisplayObject; public var bannedSign:DisplayObject; public var adsHolder:DisplayObject; public var play_bt:DisplayObject; public var barHolder:DisplayObject; } }//package game.view.components
Section 260
//MainMenuView (game.view.components.MainMenuView) package game.view.components { import flash.display.*; import game.model.*; public class MainMenuView extends Sprite { public var moreGames_bt:SimpleButton; public var iphoneActive:Sprite; public var highscores_bt:SimpleButton; public var options_bt:SimpleButton; public var credits_bt:SimpleButton; public var player:Sprite; public var iphone:Sprite; public var leftPupil:Sprite; public var logo:MovieClip; public var instructions_bt:SimpleButton; private var window:Sprite; public var leftEye:Sprite; public var rightPupil:Sprite; public var create_bt:SimpleButton; public var website_bt:SimpleButton; public var iphoneInner:Sprite; public var rightEye:Sprite; public var startGame_bt:SimpleButton; public function MainMenuView():void{ init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("MainMenuWindow"); window = new (_local1); addChild(window); startGame_bt = (window.getChildByName("startGame_bt") as SimpleButton); instructions_bt = (window.getChildByName("instructions_bt") as SimpleButton); options_bt = (window.getChildByName("options_bt") as SimpleButton); credits_bt = (window.getChildByName("credits_bt") as SimpleButton); highscores_bt = (window.getChildByName("highscores_bt") as SimpleButton); website_bt = (window.getChildByName("website_bt") as SimpleButton); moreGames_bt = (window.getChildByName("moreGames_bt") as SimpleButton); create_bt = (window.getChildByName("create_bt") as SimpleButton); logo = (window.getChildByName("logo") as MovieClip); player = (window.getChildByName("player") as Sprite); leftEye = (player.getChildByName("leftEye") as Sprite); leftPupil = (leftEye.getChildByName("pupil") as Sprite); rightEye = (player.getChildByName("rightEye") as Sprite); rightPupil = (rightEye.getChildByName("pupil") as Sprite); iphone = (window.getChildByName("iphone") as Sprite); iphoneInner = (iphone.getChildByName("inner") as Sprite); iphoneActive = (iphone.getChildByName("active") as Sprite); tabChildren = false; } } }//package game.view.components
Section 261
//MouseHandlerView (game.view.components.MouseHandlerView) package game.view.components { import flash.display.*; import game.model.*; import flash.filters.*; public class MouseHandlerView { public var window:Sprite; public var drawingContainer:Sprite; public var workspace:Sprite; public var cursor:Sprite; public var cursorContainer:Sprite; public function MouseHandlerView(_arg1:Sprite){ this.window = _arg1; init(); } private function init():void{ workspace = (window.getChildByName("workspace") as Sprite); drawingContainer = new Sprite(); window.addChild(drawingContainer); cursorContainer = new Sprite(); window.addChild(cursorContainer); var _local1:Class = GameAssets.getInstance().getAssetClass("KnifeAsset"); cursor = new (_local1); cursorContainer.addChild(cursor); cursor.y = -100; var _local2:DropShadowFilter = new DropShadowFilter(); cursor.filters = [_local2]; } } }//package game.view.components
Section 262
//OptionsView (game.view.components.OptionsView) package game.view.components { import flash.display.*; import game.model.*; public class OptionsView extends Sprite { private var window:Sprite; public var shadows:MovieClip; public var music:MovieClip; public var close_bt:SimpleButton; public var sound:MovieClip; public function OptionsView():void{ init(); } private function init():void{ var _local1:Class = GameAssets.getInstance().getAssetClass("OptionsWindow"); window = new (_local1); addChild(window); close_bt = (window.getChildByName("close_bt") as SimpleButton); shadows = (window.getChildByName("shadows") as MovieClip); sound = (window.getChildByName("sound") as MovieClip); music = (window.getChildByName("music") as MovieClip); shadows.stop(); sound.stop(); music.stop(); shadows.buttonMode = true; sound.buttonMode = true; music.buttonMode = true; tabChildren = false; } } }//package game.view.components
Section 263
//AppMediator (game.view.AppMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import flash.display.*; import game.view.components.*; import org.puremvc.as3.patterns.mediator.*; import com.midasplayer.*; public class AppMediator extends Mediator implements IMediator { private var _view:AppView; public static const NAME:String = "AppMediator"; public function AppMediator(_arg1:AppView):void{ super(NAME, _arg1); init(); } private function init():void{ _view = (getViewComponent() as AppView); _view.sponsorLogo_bt.addEventListener(MouseEvent.CLICK, sponsorClickHandler); } public function getViewContainer():Sprite{ return (_view.container); } override public function listNotificationInterests():Array{ return ([]); } override public function handleNotification(_arg1:INotification):void{ } public function getPopupContainer():Sprite{ return (_view.popupContainer); } private function sponsorClickHandler(_arg1:MouseEvent):void{ KingAPI.openOtherGamesLink(); } } }//package game.view
Section 264
//CreditsMediator (game.view.CreditsMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import flash.net.*; import org.puremvc.as3.patterns.mediator.*; import caurina.transitions.*; public class CreditsMediator extends Mediator implements IMediator { private var _view:CreditsView; public static const NAME:String = "CreditsMediator"; public function CreditsMediator(_arg1:CreditsView):void{ super(NAME, _arg1); init(); } override public function listNotificationInterests():Array{ return ([]); } private function popovClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("mailto:tyomart@mail.ru"), "_blank"); } override public function handleNotification(_arg1:INotification):void{ } private function appearMoveComplete():void{ _view.close_bt.addEventListener(MouseEvent.CLICK, closeClickHandler); _view.karataev1.addEventListener(MouseEvent.CLICK, emailClickHandler); _view.karataev2.addEventListener(MouseEvent.CLICK, emailClickHandler); _view.popov.addEventListener(MouseEvent.CLICK, popovClickHandler); if (!Factory.VERSION_WHIRLED){ _view.box2d.addEventListener(MouseEvent.CLICK, box2dClickHandler); _view.soundSnap.addEventListener(MouseEvent.CLICK, soundSnapClickHandler); _view.fglLogo.addEventListener(MouseEvent.CLICK, fglClickHandler); }; _view.johnny_bt.addEventListener(MouseEvent.CLICK, johnnyClickHandler); _view.fglLogo.play(); } private function destroy():void{ _view.parent.removeChild(_view); facade.removeMediator(NAME); } private function dissapearMoveComplete():void{ var _local1:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local1.push(AppProxy.CREDITS_HIDE); destroy(); } private function fglClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("http://www.flashgamelicense.com/game_referral.php?game_id=1596"), "_blank"); } private function init():void{ _view = (getViewComponent() as CreditsView); _view.fglLogo.stop(); _view.y = -480; Tweener.addTween(_view, {y:0, time:0.7, transition:"easeoutback", onComplete:appearMoveComplete}); } private function johnnyClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("mailto:johnny@johnny-k.ru"), "_blank"); } private function closeClickHandler(_arg1:MouseEvent):void{ Tweener.addTween(_view, {y:480, time:0.7, transition:"easeinback", onComplete:dissapearMoveComplete}); } private function soundSnapClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("http://soundsnap.com"), "_blank"); } private function emailClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("mailto:eugene.karataev@gmail.com"), "_blank"); } private function box2dClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("http://box2d.org"), "_blank"); } } }//package game.view
Section 265
//FpsMeterMediator (game.view.FpsMeterMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.view.components.*; import org.puremvc.as3.patterns.mediator.*; import flash.utils.*; public class FpsMeterMediator extends Mediator implements IMediator { private var _view:FpsMeterView; private var frames:int; private var time:int; public static const NAME:String = "FpsMeterMediator"; public function FpsMeterMediator(_arg1:FpsMeterView):void{ super(NAME, _arg1); init(); } override public function listNotificationInterests():Array{ return ([]); } private function efHandler(_arg1:Event):void{ if ((getTimer() - 1000) >= time){ _view.fps_tf.text = frames.toString(); frames = 0; time = getTimer(); } else { frames++; }; } private function init():void{ _view = (getViewComponent() as FpsMeterView); time = getTimer(); frames = 0; _view.fps_tf.text = "0"; _view.window.addEventListener(Event.ENTER_FRAME, efHandler); _view.window.visible = false; } override public function handleNotification(_arg1:INotification):void{ } } }//package game.view
Section 266
//GameCompleteMediator (game.view.GameCompleteMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import flash.net.*; import org.puremvc.as3.patterns.mediator.*; import caurina.transitions.*; import com.midasplayer.*; public class GameCompleteMediator extends Mediator implements IMediator { private var _view:GameCompleteView; private var score:int; public static const NAME:String = "GameCompleteMediator"; public function GameCompleteMediator(_arg1:GameCompleteView):void{ super(NAME, _arg1); init(); } private function sendApplecartScore():void{ var _local1:URLRequest = new URLRequest("http://www.applecartgames.com/HiScores/HiScorePage.aspx"); var _local2:URLVariables = new URLVariables(); _local2.TheGamesNameValue = "SplitterGame"; _local2.ThePlayersNameValue = _view.name_tf.text; _local2.TheHighScoreValue = score; _local1.method = URLRequestMethod.POST; _local1.data = _local2; navigateToURL(_local1, "_blank"); } private function initRecord():void{ var _local1:RecorderProxy = (facade.retrieveProxy(RecorderProxy.NAME) as RecorderProxy); _local1.saveRecord(); } override public function handleNotification(_arg1:INotification):void{ } override public function listNotificationInterests():Array{ return ([]); } private function sendWhirledScore():void{ var _local1:AppProxy = (facade.retrieveProxy(AppProxy.NAME) as AppProxy); if (_local1.whirledControl.game.isConnected()){ _local1.whirledControl.game.endGameWithScore(score); }; } private function selectLevelClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(GameProxy.LEVEL_END); destroy(); } private function sendScoreClickHandler(_arg1:MouseEvent):void{ if (Factory.VERSION_APPLECART){ sendApplecartScore(); } else { if (Factory.VERSION_WHIRLED){ sendWhirledScore(); } else { sendScore(); }; }; var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(AppProxy.END_GAME); destroy(); } private function init():void{ _view = (getViewComponent() as GameCompleteView); _view.contentMask.scaleY = 0; Tweener.addTween(_view.contentMask, {scaleY:1, time:0.5, transition:"easeoutquad"}); _view.sendScore_bt.addEventListener(MouseEvent.CLICK, sendScoreClickHandler); _view.clearProgress_bt.addEventListener(MouseEvent.CLICK, clearProgressClickHandler); _view.selectLevel_bt.addEventListener(MouseEvent.CLICK, selectLevelClickHandler); _view.save_bt.addEventListener(MouseEvent.CLICK, saveClickHandler); _view.name_tf.text = ""; var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); score = _local1.getScore(); _view.score_tf.text = score.toString(); if (Factory.VERSION_APPLECART){ } else { _view.nameHolder.visible = false; }; } private function sendScore():void{ var _local1 = ""; _local1 = (_local1 + (("name=" + _view.name_tf.text) + "&")); _local1 = (_local1 + ("score=" + score.toString())); var _local2:URLVariables = new URLVariables(_local1); var _local3:URLRequest = new URLRequest((AppProxy.HOST + AppProxy.SAVE_SCORE_SCRIPT)); _local3.method = URLRequestMethod.POST; _local3.data = _local2; var _local4:URLLoader = new URLLoader(); KingAPI.submitScore(score); } private function destroy():void{ _view.sendScore_bt.removeEventListener(MouseEvent.CLICK, sendScoreClickHandler); _view.clearProgress_bt.removeEventListener(MouseEvent.CLICK, clearProgressClickHandler); _view.selectLevel_bt.removeEventListener(MouseEvent.CLICK, selectLevelClickHandler); _view.parent.removeChild(_view); facade.removeMediator(NAME); } private function clearProgressClickHandler(_arg1:MouseEvent):void{ var _local2:AppProxy = (facade.retrieveProxy(AppProxy.NAME) as AppProxy); _local2.clearProgress(); _view.clearProgress_bt.visible = false; } private function saveClickHandler(_arg1:MouseEvent):void{ initRecord(); _view.save_bt.mouseEnabled = false; _view.save_bt.alpha = 0.3; } } }//package game.view
Section 267
//GameMediator (game.view.GameMediator) package game.view { import org.puremvc.as3.interfaces.*; import flash.display.*; import game.model.*; import game.view.components.*; import org.puremvc.as3.patterns.mediator.*; import caurina.transitions.*; import flash.filters.*; public class GameMediator extends Mediator implements IMediator { private var _view:GameView; private var hint:Sprite; private var appProxy:AppProxy; private var updateBack:Boolean; private var circleColors:Array; public static const NAME:String = "GameMediator"; public function GameMediator(_arg1:GameView):void{ super(NAME, _arg1); init(); } private function startLevel():void{ var _local2:DropShadowFilter; var _local3:Class; if (appProxy.shadowsEnabled){ _local2 = new DropShadowFilter(); _view.objectsContainer.filters = [_local2]; }; var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); clearHint(); if (_local1.currentLevel.id < 4){ _local3 = GameAssets.getInstance().getAssetClass((("Level" + _local1.currentLevel.id) + "Hint")); hint = new (_local3); _view.levelContainer.addChild(hint); hint.mouseEnabled = false; if (updateBack){ hint.y = -10; hint.alpha = 0; Tweener.addTween(hint, {y:0, alpha:1, time:0.5, transition:"easeoutquad"}); }; }; if (updateBack){ createBack(); updateBack = false; }; _view.levelName_tf.text = _local1.currentLevel.name; } private function createBack():void{ while (_view.backContainer.numChildren > 0) { _view.backContainer.removeChildAt(0); }; var _local1:uint = (2 + (Math.random() * 6)); var _local2:uint; while (_local2 < _local1) { createCircle(); _local2++; }; } override public function handleNotification(_arg1:INotification):void{ switch (_arg1.getName()){ case GameProxy.LEVEL_START: startLevel(); break; case GameProxy.LEVEL_COMPLETE: levelComplete(); break; case GameProxy.LEVEL_RESTART_START: levelRestartStart(); break; case GameProxy.LEVEL_RESTART_END: clearFilters(); break; case GameProxy.LEVEL_END: levelEnd(); break; case MouseHandlerMediator.MOUSE_DRAW_START: mouseDrawStart(); break; case MouseHandlerMediator.MOUSE_DRAW_END: mouseDrawEnd(); break; }; } private function init():void{ _view = (getViewComponent() as GameView); appProxy = (facade.retrieveProxy(AppProxy.NAME) as AppProxy); var _local1:FpsMeterView = new FpsMeterView(_view.fpsMeter); var _local2:FpsMeterMediator = new FpsMeterMediator(_local1); facade.registerMediator(_local2); var _local3:MouseHandlerView = new MouseHandlerView(_view.mouseHandler); var _local4:GameMouseHandlerMediator = new GameMouseHandlerMediator(_local3); facade.registerMediator(_local4); var _local5:GameMenuView = new GameMenuView(_view.gameMenu); var _local6:GameMenuMediator = new GameMenuMediator(_local5); facade.registerMediator(_local6); updateBack = true; circleColors = [16248271, 15326393, 13877908, 15849093, 13876863, 13352601, 14995083]; } private function mouseDrawEnd():void{ var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _local1.mouseDrawEnd(); } private function mouseDrawStart():void{ var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _local1.mouseDrawStart(); } private function levelComplete():void{ clearFilters(); updateBack = true; } public function getJointsContainer():Sprite{ return (_view.jointsContainer); } public function getPlayerContainer():Sprite{ return (_view.playerContainer); } public function getBodiesContainer():Sprite{ return (_view.bodiesContainer); } private function createCircle():void{ var _local1:Sprite = new Sprite(); var _local2:Number = (Math.random() * 640); var _local3:Number = (Math.random() * 480); var _local4:Number = (40 + (Math.random() * 150)); var _local5:Number = circleColors[Math.floor((Math.random() * circleColors.length))]; _local1.graphics.beginFill(_local5); _local1.graphics.drawCircle(_local2, _local3, _local4); _local1.graphics.endFill(); _view.backContainer.addChild(_local1); } private function clearFilters():void{ if (appProxy.shadowsEnabled){ _view.objectsContainer.filters = []; }; } override public function listNotificationInterests():Array{ return ([GameProxy.LEVEL_START, GameProxy.LEVEL_COMPLETE, GameProxy.LEVEL_RESTART_START, GameProxy.LEVEL_RESTART_END, GameProxy.LEVEL_END, MouseHandlerMediator.MOUSE_DRAW_START, MouseHandlerMediator.MOUSE_DRAW_END]); } private function clearHint():void{ if (hint){ hint.parent.removeChild(hint); hint = null; }; } private function levelEnd():void{ clearFilters(); updateBack = true; clearHint(); while (_view.playerContainer.numChildren > 0) { _view.playerContainer.removeChildAt(0); }; } public function destroy():void{ facade.removeMediator(FpsMeterMediator.NAME); facade.removeMediator(MouseHandlerMediator.NAME); facade.removeMediator(GameMenuMediator.NAME); _view.parent.removeChild(_view); facade.removeMediator(NAME); } private function levelRestartStart():void{ var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _local1.levelRestartStart(); } } }//package game.view
Section 268
//GameMenuMediator (game.view.GameMenuMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import flash.net.*; import org.puremvc.as3.patterns.mediator.*; import caurina.transitions.*; import com.midasplayer.*; public class GameMenuMediator extends Mediator implements IMediator { private var _view:GameMenuView; private var gameProxy:GameProxy; public static const NAME:String = "GameMenuMediator"; public function GameMenuMediator(_arg1:GameMenuView):void{ super(NAME, _arg1); init(); } private function levelStart():void{ var _local1:uint = gameProxy.getLevelIndex(gameProxy.currentLevel.id); if (_local1 < 5){ _view.solution_bt.visible = true; } else { _view.solution_bt.visible = false; }; updateStat(); } private function splitSuccess():void{ updateStat(); } private function bonusCollect():void{ updateStat(); } private function init():void{ var _local2:uint; _view = (getViewComponent() as GameMenuView); var _local1:AppProxy = (facade.retrieveProxy(AppProxy.NAME) as AppProxy); _local2 = (_local1.musicEnabled) ? 1 : 2; _view.music.gotoAndStop(_local2); _local2 = (_local1.soundEnabled) ? 1 : 2; _view.sound.gotoAndStop(_local2); _view.restart_bt.addEventListener(MouseEvent.CLICK, restartClickHandler); _view.levels_bt.addEventListener(MouseEvent.CLICK, levelsClickHandler); _view.menu_bt.addEventListener(MouseEvent.CLICK, menuClickHandler); _view.music.addEventListener(MouseEvent.CLICK, muteClickHandler); _view.sound.addEventListener(MouseEvent.CLICK, soundClickHandler); _view.sponsorLogo_bt.addEventListener(MouseEvent.CLICK, sponsorClickHandler); _view.sponsorLogo_bt.visible = false; _view.solution_bt.addEventListener(MouseEvent.CLICK, solutionClickHandler); gameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); } private function soundClickHandler(_arg1:MouseEvent):void{ var _local2:AppProxy = (facade.retrieveProxy(AppProxy.NAME) as AppProxy); if (_view.sound.currentFrame == 1){ _view.sound.gotoAndStop(2); _local2.soundEnabled = false; } else { _view.sound.gotoAndStop(1); _local2.soundEnabled = true; }; _local2.flushOptions(); } private function restartClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(GameProxy.LEVEL_RESTART_START); } private function muteClickHandler(_arg1:MouseEvent):void{ var _local2:AppProxy = (facade.retrieveProxy(AppProxy.NAME) as AppProxy); if (_view.music.currentFrame == 1){ _view.music.gotoAndStop(2); _local2.musicEnabled = false; Tweener.addTween(_local2.musicChannel, {_sound_volume:0, time:0.5, transition:"linear"}); } else { _view.music.gotoAndStop(1); _local2.musicEnabled = true; Tweener.addTween(_local2.musicChannel, {_sound_volume:0.5, time:0.5, transition:"linear"}); }; _local2.flushOptions(); } override public function listNotificationInterests():Array{ return ([GameProxy.LEVEL_START, GameProxy.LEVEL_RESTART_START, GameProxy.LEVEL_RESTART_END, GameProxy.LEVEL_END, GameProxy.BONUS_COLLECT, GameProxy.SPLIT_SUCCESS, MouseHandlerMediator.SPLIT_NOT_AVAILABLE, GameProxy.LEVEL_UPDATE]); } private function menuClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(AppProxy.END_GAME); } private function sponsorClickHandler(_arg1:MouseEvent):void{ KingAPI.openOtherGamesLink(); } private function levelUpdate():void{ updateStat(); } private function levelRestartEnd():void{ _view.restart_bt.mouseEnabled = true; } private function levelsClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(GameProxy.LEVEL_END); } private function levelEnd():void{ _view.restart_bt.mouseEnabled = true; } override public function handleNotification(_arg1:INotification):void{ switch (_arg1.getName()){ case GameProxy.LEVEL_START: levelStart(); break; case GameProxy.LEVEL_RESTART_START: levelRestartStart(); break; case GameProxy.LEVEL_RESTART_END: levelRestartEnd(); break; case GameProxy.LEVEL_END: levelEnd(); break; case GameProxy.BONUS_COLLECT: bonusCollect(); break; case GameProxy.SPLIT_SUCCESS: splitSuccess(); break; case MouseHandlerMediator.SPLIT_NOT_AVAILABLE: splitNotAvailable(); break; case GameProxy.LEVEL_UPDATE: levelUpdate(); break; }; } private function solutionClickHandler(_arg1:MouseEvent):void{ var _local2:RecorderProxy = (facade.retrieveProxy(RecorderProxy.NAME) as RecorderProxy); var _local3:String = _local2.getSolution(gameProxy.getLevelIndex(gameProxy.currentLevel.id)); navigateToURL(new URLRequest(_local3), "_blank"); } private function updateStat():void{ _view.score_tf.text = gameProxy.getScore().toString(); _view.cuts_tf.text = gameProxy.getCutsLeft().toString(); } private function levelRestartStart():void{ _view.restart_bt.mouseEnabled = false; } private function splitNotAvailable():void{ var _local1:Object = {ra:0.5, rb:100, ga:0, gb:0, ba:0, bb:0, aa:1, ab:0}; var _local2:uint; while (_local2 < 2) { Tweener.addTween(_view.cuts, {scaleX:2, scaleY:2, time:0.25, delay:((0.25 * 2) * _local2), transition:"linear"}); Tweener.addTween(_view.cuts, {scaleX:1, scaleY:1, time:0.25, delay:(0.25 * (1 + (2 * _local2))), transition:"linear"}); _local2++; }; } } }//package game.view
Section 269
//GameMouseHandlerMediator (game.view.GameMouseHandlerMediator) package game.view { import game.model.*; import game.view.components.*; public class GameMouseHandlerMediator extends MouseHandlerMediator { public function GameMouseHandlerMediator(_arg1:MouseHandlerView):void{ super(_arg1); } override protected function doMouseDown():void{ var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); var _local2:uint = _local1.getCutsLeft(); var _local3:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); if (_local2 > 0){ super.doMouseDown(); } else { _local3.push(SPLIT_NOT_AVAILABLE); }; } } }//package game.view
Section 270
//InstructionsMediator (game.view.InstructionsMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import org.puremvc.as3.patterns.mediator.*; import caurina.transitions.*; public class InstructionsMediator extends Mediator implements IMediator { private var _view:InstructionsView; public static const NAME:String = "InstructionsMediator"; public function InstructionsMediator(_arg1:InstructionsView):void{ super(NAME, _arg1); init(); } private function init():void{ _view = (getViewComponent() as InstructionsView); _view.y = -480; Tweener.addTween(_view, {y:0, time:1.5, transition:"easeoutback", onComplete:appearMoveComplete}); } private function destroy():void{ _view.parent.removeChild(_view); facade.removeMediator(NAME); } override public function listNotificationInterests():Array{ return ([]); } private function closeClickHandler(_arg1:MouseEvent):void{ Tweener.addTween(_view, {y:480, time:0.7, transition:"easeinback", onComplete:dissapearMoveComplete}); } override public function handleNotification(_arg1:INotification):void{ } private function dissapearMoveComplete():void{ var _local1:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local1.push(AppProxy.INSTRUCTIONS_HIDE); destroy(); } private function appearMoveComplete():void{ _view.close_bt.addEventListener(MouseEvent.CLICK, closeClickHandler); } } }//package game.view
Section 271
//LevelCompleteMediator (game.view.LevelCompleteMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import org.puremvc.as3.patterns.mediator.*; import caurina.transitions.*; public class LevelCompleteMediator extends Mediator implements IMediator { private var _view:LevelCompleteView; public static const NAME:String = "LevelCompleetMediator"; public function LevelCompleteMediator(_arg1:LevelCompleteView):void{ super(NAME, _arg1); init(); } override public function listNotificationInterests():Array{ return ([RecorderProxy.RECORD_COMPLETE, RecorderProxy.RECORD_ERROR]); } private function initRecord():void{ var _local1:RecorderProxy = (facade.retrieveProxy(RecorderProxy.NAME) as RecorderProxy); _local1.saveRecord(); } override public function handleNotification(_arg1:INotification):void{ switch (_arg1.getName()){ case RecorderProxy.RECORD_COMPLETE: recordComplete((_arg1.getBody() as String)); break; case RecorderProxy.RECORD_ERROR: recordError((_arg1.getBody() as String)); break; }; } private function saveClickHandler(_arg1:MouseEvent):void{ initRecord(); _view.save_bt.mouseEnabled = false; _view.save_bt.alpha = 0.3; } private function recordComplete(_arg1:String):void{ _view.status_tf.htmlText = (((("<u><a target='blank' href='" + _arg1) + "'>") + _arg1) + "</a></u>"); } private function init():void{ _view = (getViewComponent() as LevelCompleteView); _view.save_bt.addEventListener(MouseEvent.CLICK, saveClickHandler); _view.contentMask.scaleY = 0; Tweener.addTween(_view.contentMask, {scaleY:1, time:0.5, transition:"easeoutquad"}); _view.next_bt.addEventListener(MouseEvent.CLICK, nextClickHandler); _view.selectLevel_bt.addEventListener(MouseEvent.CLICK, selectLevelClickHandler); _view.replayLevel_bt.addEventListener(MouseEvent.CLICK, replayLevelClickHandler); var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); var _local2:GameLevel = _local1.currentLevel; _view.timeBonus_tf.text = _local2.timeScore.toString(); _view.starsBonus_tf.text = ((_local2.collectedBonuses.toString() + " * 10 = ") + _local2.bonusScore.toString()); _view.levelScore_tf.text = _local2.score.toString(); _view.totalScore_tf.text = _local1.getScore().toString(); if (Factory.VERSION_WHIRLED){ _view.save_bt.visible = false; }; } private function selectLevelClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(GameProxy.LEVEL_END); destroy(); } private function nextClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(GameProxy.LEVEL_NEXT); destroy(); } private function recordError(_arg1:String):void{ _view.status_tf.text = _arg1; } private function destroy():void{ _view.save_bt.removeEventListener(MouseEvent.CLICK, saveClickHandler); _view.next_bt.removeEventListener(MouseEvent.CLICK, nextClickHandler); _view.selectLevel_bt.removeEventListener(MouseEvent.CLICK, selectLevelClickHandler); _view.replayLevel_bt.removeEventListener(MouseEvent.CLICK, replayLevelClickHandler); _view.parent.removeChild(_view); facade.removeMediator(NAME); } private function replayLevelClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); var _local3:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); _local2.push(GameProxy.LEVEL_END); _local2.push(GameProxy.LEVEL_START, _local3.currentLevel.id); destroy(); } } }//package game.view
Section 272
//LevelSelectMediator (game.view.LevelSelectMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import fl.controls.*; import fl.controls.dataGridClasses.*; import org.puremvc.as3.patterns.mediator.*; import game.view.components.ui.*; public class LevelSelectMediator extends Mediator implements IMediator { private var _view:LevelSelectView; private var items:Array; private var selectedItem:LevelItem; public static const NAME:String = "LevelSelectMediator"; public function LevelSelectMediator(_arg1:LevelSelectView):void{ super(NAME, _arg1); init(); } private function menuClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(AppProxy.END_GAME); destroy(); } private function fillGrid(_arg1:DataGrid, _arg2:Array):void{ var _local5:GameLevel; var _local6:String; var _local7:String; _arg1.removeAll(); _arg1.addColumn("level"); var _local3:DataGridColumn = new DataGridColumn("stars"); _local3.setWidth(40); _arg1.addColumn(_local3); _arg1.setStyle("cellRenderer", CustomCellRenderer); var _local4:uint; while (_local4 < _arg2.length) { _local5 = _arg2[_local4]; _local6 = ((uint((_local4 + 1)) + ". ") + _local5.name); _local7 = ((_local5.collectedBonuses + "/") + _local5.totalBonuses); _arg1.addItem({level:_local6, stars:_local7, levelStatus:_local5.status}); _local4++; }; } private function createItems():void{ var _local7:GameLevel; var _local8:LevelItem; var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); var _local2:Array = _local1.getLevels(); var _local3:Array = _local1.getAvailableLevels(); items = []; var _local4:uint; while (_local4 < _local2.length) { _local7 = _local2[_local4]; _local8 = new LevelItem(_local7, (_local4 < _local3.length)); _local8.y = (_local4 * 17); _view.itemsContainer.addChild(_local8); _local8.addEventListener(LevelItem.SELECT, itemSelectHandler); items.push(_local8); _local4++; }; var _local5:GameLevel = _local1.getCurrentLevel(); var _local6:uint = (_local5) ? _local5.id : 0; selectItem(items[_local6]); } private function selectItem(_arg1:LevelItem):void{ if (selectedItem){ selectedItem.deselect(); }; selectedItem = _arg1; selectedItem.select(); } private function init():void{ _view = (getViewComponent() as LevelSelectView); _view.ok_bt.addEventListener(MouseEvent.CLICK, okClickHandler); _view.menu_bt.addEventListener(MouseEvent.CLICK, menuClickHandler); var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy); var _local2:Array = _local1.getLevels(); var _local3:Array = _local1.getAvailableLevels(); _view.totalStars_tf.text = _local1.getTotalBonuses().toString(); createItems(); } override public function handleNotification(_arg1:INotification):void{ } override public function listNotificationInterests():Array{ return ([]); } public function destroy():void{ _view.parent.removeChild(_view); facade.removeMediator(NAME); } private function itemSelectHandler(_arg1:Event):void{ var _local2:LevelItem = (_arg1.target as LevelItem); selectItem(_local2); } private function okClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(GameProxy.LEVEL_START, selectedItem.level.id); } } }//package game.view
Section 273
//MainMenuMediator (game.view.MainMenuMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import flash.display.*; import game.model.*; import game.view.components.*; import flash.geom.*; import Box2D.Common.Math.*; import flash.net.*; import org.puremvc.as3.patterns.mediator.*; import caurina.transitions.*; import com.midasplayer.*; public class MainMenuMediator extends Mediator implements IMediator { private var _view:MainMenuView; public static const NAME:String = "MainMenuMediator"; public function MainMenuMediator(_arg1:MainMenuView):void{ super(NAME, _arg1); init(); } private function destroy():void{ _view.player.removeEventListener(Event.ENTER_FRAME, playerEfHandler); _view.parent.removeChild(_view); facade.removeMediator(NAME); } override public function handleNotification(_arg1:INotification):void{ switch (_arg1.getName()){ case AppProxy.INSTRUCTIONS_SHOW: case AppProxy.CREDITS_SHOW: case AppProxy.OPTIONS_SHOW: deactivate(); break; case AppProxy.INSTRUCTIONS_HIDE: case AppProxy.CREDITS_HIDE: case AppProxy.OPTIONS_HIDE: activate(); break; }; } private function highscoresClickHandler(_arg1:MouseEvent):void{ if (Factory.VERSION_APPLECART){ applecartHighscores(); } else { KingAPI.openHighscoresLink(); }; } private function createClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(AppProxy.LEVEL_CREATE); } private function playerEfHandler(_arg1:Event):void{ rotateEye(_view.leftEye, _view.leftPupil); rotateEye(_view.rightEye, _view.rightPupil); } private function init():void{ _view = (getViewComponent() as MainMenuView); _view.startGame_bt.addEventListener(MouseEvent.CLICK, startGameClickHandler); _view.instructions_bt.addEventListener(MouseEvent.CLICK, instructionsClickHandler); _view.options_bt.addEventListener(MouseEvent.CLICK, optionsClickHandler); _view.credits_bt.addEventListener(MouseEvent.CLICK, creditsClickHandler); _view.highscores_bt.addEventListener(MouseEvent.CLICK, highscoresClickHandler); _view.website_bt.addEventListener(MouseEvent.CLICK, websiteClickHandler); _view.moreGames_bt.addEventListener(MouseEvent.CLICK, moreGamesClickHandler); _view.create_bt.addEventListener(MouseEvent.CLICK, createClickHandler); _view.logo.stop(); _view.logo.alpha = 0; _view.logo.scaleX = (_view.logo.scaleY = 0.6); Tweener.addTween(_view.logo, {scaleX:1, scaleY:1, alpha:1, time:0.6, transition:"easeoutback"}); _view.startGame_bt.alpha = 0; _view.options_bt.alpha = 0; _view.credits_bt.alpha = 0; _view.highscores_bt.alpha = 0; _view.website_bt.alpha = 0; _view.moreGames_bt.alpha = 0; Tweener.addTween(_view.startGame_bt, {alpha:1, time:0.4, transition:"linear", delay:0.6}); Tweener.addTween(_view.options_bt, {alpha:1, time:0.4, transition:"linear", delay:0.8}); Tweener.addTween(_view.credits_bt, {alpha:1, time:0.4, transition:"linear", delay:1}); Tweener.addTween(_view.highscores_bt, {alpha:1, time:0.4, transition:"linear", delay:1.2}); Tweener.addTween(_view.website_bt, {alpha:1, time:0.4, transition:"linear", delay:1.4}); Tweener.addTween(_view.moreGames_bt, {alpha:1, time:0.4, transition:"linear", delay:1.6, onComplete:logoAppearComplete}); _view.player.addEventListener(Event.ENTER_FRAME, playerEfHandler); if (Factory.VERSION_WHIRLED){ _view.highscores_bt.visible = false; _view.website_bt.visible = false; _view.moreGames_bt.visible = false; }; _view.iphone.buttonMode = true; _view.iphoneActive.addEventListener(MouseEvent.ROLL_OVER, iphoneRollOverHandler); _view.iphoneActive.addEventListener(MouseEvent.ROLL_OUT, iphoneRollOutHandler); _view.iphoneActive.addEventListener(MouseEvent.CLICK, iphoneClickHandler); } private function rotateEye(_arg1:Sprite, _arg2:Sprite):void{ var _local4:Point; var _local5:Point; var _local6:b2Vec2; var _local7:b2Vec2; var _local3:b2Vec2 = new b2Vec2(_view.stage.mouseX, _view.stage.mouseY); var _local8:Number = 15; _local4 = _arg1.parent.localToGlobal(new Point(_arg1.x, _arg1.y)); _local7 = new b2Vec2(_local4.x, _local4.y); _local6 = _local3.Copy(); _local6.Subtract(_local7); if (_local6.Length() < _local8){ _local5 = _arg1.globalToLocal(new Point(_local3.x, _local3.y)); } else { _local6.Normalize(); _local6.Multiply(_local8); _local7.Add(_local6); _local5 = _arg1.globalToLocal(new Point(_local7.x, _local7.y)); }; _arg2.x = _local5.x; _arg2.y = _local5.y; var _local9:Number = (1 - ((_local6.Length() / _local8) * 0.15)); _arg2.scaleX = (_arg2.scaleY = _local9); } private function creditsClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(AppProxy.CREDITS_SHOW); } private function applecartHighscores():void{ var _local1:URLRequest = new URLRequest("http://www.applecartgames.com/HiScores/HiScorePage.aspx"); var _local2:URLVariables = new URLVariables(); _local2.TheGamesNameValue = "SplitterGame"; _local1.method = URLRequestMethod.POST; _local1.data = _local2; navigateToURL(_local1, "_blank"); } private function optionsClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(AppProxy.OPTIONS_SHOW); } private function websiteClickHandler(_arg1:MouseEvent):void{ KingAPI.openAddToWebsiteLink(); } private function logoEfHandler(_arg1:Event):void{ if (_view.logo.currentFrame == _view.logo.totalFrames){ _view.logo.stop(); _view.logo.removeEventListener(Event.ENTER_FRAME, logoEfHandler); }; } private function moreGamesClickHandler(_arg1:MouseEvent):void{ KingAPI.openOtherGamesLink(); } override public function listNotificationInterests():Array{ return ([AppProxy.INSTRUCTIONS_SHOW, AppProxy.INSTRUCTIONS_HIDE, AppProxy.CREDITS_SHOW, AppProxy.CREDITS_HIDE, AppProxy.OPTIONS_SHOW, AppProxy.OPTIONS_HIDE]); } private function activate():void{ _view.mouseChildren = true; } private function iphoneRollOverHandler(_arg1:MouseEvent):void{ Tweener.addTween(_view.iphoneInner, {rotation:-20, time:0.2, transition:"easeoutquad"}); } private function iphoneClickHandler(_arg1:MouseEvent):void{ navigateToURL(new URLRequest("http://itunes.apple.com/us/app/splitter-pals/id406840521"), "_blank"); } private function logoAppearComplete():void{ _view.logo.gotoAndPlay(2); _view.logo.addEventListener(Event.ENTER_FRAME, logoEfHandler); } private function deactivate():void{ _view.mouseChildren = false; } private function startGameClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(AppProxy.START_GAME, _arg1.shiftKey); destroy(); } private function iphoneRollOutHandler(_arg1:MouseEvent):void{ Tweener.addTween(_view.iphoneInner, {rotation:0, time:0.2, transition:"easeoutquad"}); } private function instructionsClickHandler(_arg1:MouseEvent):void{ var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local2.push(AppProxy.INSTRUCTIONS_SHOW); } } }//package game.view
Section 274
//MouseHandlerMediator (game.view.MouseHandlerMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import flash.display.*; import game.model.*; import core.*; import game.view.components.*; import flash.geom.*; import editor.model.*; import game.controller.*; import org.puremvc.as3.patterns.mediator.*; import caurina.transitions.*; import flash.filters.*; import flash.ui.*; public class MouseHandlerMediator extends Mediator implements IMediator { protected var _view:MouseHandlerView; protected var startPoint:Point; protected var mouseUp:Boolean; protected var mouseDown:Boolean; protected var line:Sprite; public static const MOUSE_DRAW_START:String = "MouseDrawStart"; public static const SPLIT_NOT_AVAILABLE:String = "SplitNotAvailable"; public static const MOUSE_DRAW_END:String = "MouseDrawEnd"; public static const NAME:String = "MouseHandlerMediator"; public function MouseHandlerMediator(_arg1:MouseHandlerView):void{ super(NAME, _arg1); init(); } private function stageMouseDownHandler(_arg1:MouseEvent):void{ mouseDown = true; } private function levelEnd():void{ clear(); } private function splitSuccess():void{ Tweener.addTween(line, {alpha:0.3, time:0.3, transition:"linear"}); } private function cursorMouseMoveHandler(_arg1:MouseEvent=null):void{ _view.cursor.x = _view.cursorContainer.mouseX; _view.cursor.y = _view.cursorContainer.mouseY; } public function getCursor():Sprite{ return (_view.cursor); } private function clear():void{ while (_view.drawingContainer.numChildren > 0) { _view.drawingContainer.removeChildAt(0); }; _view.window.removeEventListener(MouseEvent.MOUSE_DOWN, stageMouseDownHandler); mouseDown = false; mouseUp = false; } private function init():void{ _view = (getViewComponent() as MouseHandlerView); facade.registerCommand(MOUSE_DRAW_START, MouseDrawStartCommand); facade.registerCommand(MOUSE_DRAW_END, MouseDrawEndCommand); _view.window.addEventListener(MouseEvent.ROLL_OUT, cursorRollOutHandler); } private function splitFail():void{ Tweener.addTween(line, {alpha:0, time:0.3, transition:"linear"}); } protected function doMouseDown():void{ var _local1:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); line = new Sprite(); var _local2:DropShadowFilter = new DropShadowFilter(); line.filters = [_local2]; _view.drawingContainer.addChild(line); _view.window.stage.addEventListener(MouseEvent.MOUSE_UP, stageMouseUpHandler); _view.window.stage.addEventListener(MouseEvent.MOUSE_MOVE, stageMouseMoveHandler); startPoint = new Point(line.mouseX, line.mouseY); _local1.push(MOUSE_DRAW_START, startPoint); Tweener.addTween(_view.cursor, {rotation:-70, time:0.2, transition:"easeoutquad"}); } private function levelComplete():void{ deactivateCursor(); } private function cursorRollOverHandler(_arg1:MouseEvent):void{ activateCursor(); _view.workspace.removeEventListener(MouseEvent.ROLL_OVER, cursorRollOverHandler); } private function doMouseUp():void{ _view.window.stage.removeEventListener(MouseEvent.MOUSE_UP, stageMouseUpHandler); _view.window.stage.removeEventListener(MouseEvent.MOUSE_MOVE, stageMouseMoveHandler); var _local1:Point = new Point(Math.round(line.mouseX), Math.round(line.mouseY)); var _local2:Line = new Line(startPoint, _local1); var _local3:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local3.push(MOUSE_DRAW_END, _local2); Tweener.addTween(_view.cursor, {rotation:0, time:0.2, transition:"easeoutquad"}); } private function stageMouseUpHandler(_arg1:MouseEvent):void{ mouseUp = true; } private function activateCursor():void{ Mouse.hide(); _view.cursor.visible = true; _view.cursor.root.addEventListener(MouseEvent.MOUSE_MOVE, cursorMouseMoveHandler); cursorMouseMoveHandler(); _view.window.addEventListener(MouseEvent.ROLL_OUT, cursorRollOutHandler); } private function deactivateCursor():void{ _view.cursor.visible = false; _view.cursor.root.removeEventListener(MouseEvent.MOUSE_MOVE, cursorMouseMoveHandler); } private function levelUpdate():void{ if (mouseDown){ doMouseDown(); mouseDown = false; }; if (mouseUp){ doMouseUp(); mouseUp = false; }; } private function levelRestartEnd():void{ } private function stageMouseMoveHandler(_arg1:MouseEvent):void{ line.graphics.clear(); line.graphics.lineStyle(2, 0xFF0000, 1); line.graphics.moveTo(startPoint.x, startPoint.y); line.graphics.lineTo(line.mouseX, line.mouseY); } private function cursorRollOutHandler(_arg1:MouseEvent):void{ Mouse.show(); _view.window.addEventListener(MouseEvent.ROLL_OVER, cursorRollOverHandler); } private function levelRestartStart():void{ clear(); } override public function listNotificationInterests():Array{ return ([GameProxy.LEVEL_RESTART_START, GameProxy.LEVEL_RESTART_END, GameProxy.LEVEL_START, GameProxy.LEVEL_END, GameProxy.LEVEL_COMPLETE, LevelTestProxy.LEVEL_TEST_START, LevelTestProxy.LEVEL_TEST_END, GameProxy.SPLIT_SUCCESS, GameProxy.SPLIT_FAIL, GameProxy.LEVEL_UPDATE]); } override public function handleNotification(_arg1:INotification):void{ switch (_arg1.getName()){ case GameProxy.LEVEL_RESTART_START: levelRestartStart(); break; case GameProxy.LEVEL_RESTART_END: case LevelTestProxy.LEVEL_TEST_END: levelRestartEnd(); break; case GameProxy.LEVEL_START: case LevelTestProxy.LEVEL_TEST_START: levelStart(); break; case GameProxy.LEVEL_END: levelEnd(); break; case GameProxy.LEVEL_COMPLETE: levelComplete(); break; case GameProxy.SPLIT_SUCCESS: splitSuccess(); break; case GameProxy.SPLIT_FAIL: splitFail(); break; case GameProxy.LEVEL_UPDATE: levelUpdate(); break; }; } private function levelStart():void{ clear(); _view.window.addEventListener(MouseEvent.MOUSE_DOWN, stageMouseDownHandler); _view.cursor.rotation = 0; if (_view.workspace.hitTestPoint(_view.window.stage.mouseX, _view.window.stage.mouseY)){ activateCursor(); } else { _view.workspace.addEventListener(MouseEvent.ROLL_OVER, cursorRollOverHandler); }; } } }//package game.view
Section 275
//OptionsMediator (game.view.OptionsMediator) package game.view { import flash.events.*; import org.puremvc.as3.interfaces.*; import game.model.*; import game.view.components.*; import org.puremvc.as3.patterns.mediator.*; import caurina.transitions.*; public class OptionsMediator extends Mediator implements IMediator { private var _view:OptionsView; private var appProxy:AppProxy; public static const NAME:String = "OptionsMediator"; public function OptionsMediator(_arg1:OptionsView):void{ super(NAME, _arg1); init(); } override public function listNotificationInterests():Array{ return ([]); } override public function handleNotification(_arg1:INotification):void{ } private function musicClickHandler(_arg1:MouseEvent):void{ if (_view.music.currentFrame == 1){ _view.music.gotoAndStop(2); appProxy.musicEnabled = true; Tweener.addTween(appProxy.musicChannel, {_sound_volume:0.5, time:0.5, transition:"linear"}); } else { _view.music.gotoAndStop(1); appProxy.musicEnabled = false; Tweener.addTween(appProxy.musicChannel, {_sound_volume:0, time:0.5, transition:"linear"}); }; appProxy.flushOptions(); } private function destroy():void{ _view.parent.removeChild(_view); facade.removeMediator(NAME); } private function dissapearMoveComplete():void{ var _local1:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy); _local1.push(AppProxy.OPTIONS_HIDE); destroy(); } private function init():void{ var _local1:uint; _view = (getViewComponent() as OptionsView); appProxy = (facade.retrieveProxy(AppProxy.NAME) as AppProxy); _local1 = (appProxy.shadowsEnabled) ? 2 : 1; _view.shadows.gotoAndStop(_local1); _local1 = (appProxy.soundEnabled) ? 2 : 1; _view.sound.gotoAndStop(_local1); _local1 = (appProxy.musicEnabled) ? 2 : 1; _view.music.gotoAndStop(_local1); _view.y = -480; Tweener.addTween(_view, {y:0, time:0.7, transition:"easeoutback", onComplete:appearMoveComplete}); } private function soundClickHandler(_arg1:MouseEvent):void{ if (_view.sound.currentFrame == 1){ _view.sound.gotoAndStop(2); appProxy.soundEnabled = true; } else { _view.sound.gotoAndStop(1); appProxy.soundEnabled = false; }; appProxy.flushOptions(); } private function shadowsClickHandler(_arg1:MouseEvent):void{ if (_view.shadows.currentFrame == 1){ _view.shadows.gotoAndStop(2); appProxy.shadowsEnabled = true; } else { _view.shadows.gotoAndStop(1); appProxy.shadowsEnabled = false; }; appProxy.flushOptions(); } private function closeClickHandler(_arg1:MouseEvent):void{ Tweener.addTween(_view, {y:480, time:0.7, transition:"easeinback", onComplete:dissapearMoveComplete}); } private function appearMoveComplete():void{ _view.close_bt.addEventListener(MouseEvent.CLICK, closeClickHandler); _view.shadows.addEventListener(MouseEvent.CLICK, shadowsClickHandler); _view.sound.addEventListener(MouseEvent.CLICK, soundClickHandler); _view.music.addEventListener(MouseEvent.CLICK, musicClickHandler); } } }//package game.view
Section 276
//GeomLine (geom.GeomLine) package geom { import flash.geom.*; public class GeomLine extends GeomObj { public var p1:Vector; public var p2:Vector; public function GeomLine(_arg1:Vector, _arg2:Vector):void{ this.p1 = _arg1; this.p2 = _arg2; } override public function getBoundingBox():Rectangle{ var _local1:Number = (p1.x + ((p2.x - p1.x) / 2)); var _local2:Number = (p1.y + ((p2.y - p1.y) / 2)); return (new Rectangle((_local1 - 10), (_local2 - 10), 20, 20)); } override public function translate(_arg1:Number, _arg2:Number):void{ p1.x = (p1.x + _arg1); p2.x = (p2.x + _arg1); p1.y = (p1.y + _arg2); p2.y = (p2.y + _arg2); } } }//package geom
Section 277
//GeomObj (geom.GeomObj) package geom { import flash.geom.*; public class GeomObj { public function GeomObj():void{ } public function getBoundingBox():Rectangle{ return (null); } public function isPointInside(_arg1:Point):Boolean{ return (false); } public function isRectInside(_arg1:Rectangle):Boolean{ return (false); } public function translate(_arg1:Number, _arg2:Number):void{ } public static function lineLineInts(_arg1:GeomLine, _arg2:GeomLine):Vector{ var _local14:Vector; var _local3:Number = _arg1.p1.x; var _local4:Number = _arg1.p2.x; var _local5:Number = _arg2.p1.x; var _local6:Number = _arg2.p2.x; var _local7:Number = _arg1.p1.y; var _local8:Number = _arg1.p2.y; var _local9:Number = _arg2.p1.y; var _local10:Number = _arg2.p2.y; if ((((Math.max(_local3, _local4) < Math.min(_local5, _local6))) || ((Math.max(_local5, _local6) < Math.min(_local3, _local4))))){ return (null); }; if ((((Math.max(_local7, _local8) < Math.min(_local9, _local10))) || ((Math.max(_local9, _local10) < Math.min(_local7, _local8))))){ return (null); }; var _local11:Number = (((_local6 - _local5) * (_local7 - _local9)) - ((_local10 - _local9) * (_local3 - _local5))); var _local12:Number = (((_local4 - _local3) * (_local7 - _local9)) - ((_local8 - _local7) * (_local3 - _local5))); var _local13:Number = (((_local10 - _local9) * (_local4 - _local3)) - ((_local6 - _local5) * (_local8 - _local7))); if (Math.abs(_local13) < 0.001){ return (null); }; _local11 = (_local11 / _local13); _local12 = (_local12 / _local13); if ((((((((0 < _local11)) && ((_local11 < 1)))) && ((0 < _local12)))) && ((_local12 < 1)))){ _local14 = new Vector((_local3 + (_local11 * (_local4 - _local3))), (_local7 + (_local11 * (_local8 - _local7)))); return (_local14); }; return (null); } public static function checkInts(_arg1:GeomObj, _arg2:GeomObj):Array{ var _local4:Vector; var _local3:Array = []; if ((_arg1 is GeomLine)){ if ((_arg2 is GeomLine)){ _local4 = GeomObj.lineLineInts((_arg1 as GeomLine), (_arg2 as GeomLine)); if (_local4){ _local3.push(_local4); }; } else { if ((_arg2 is GeomPoly)){ _local3 = GeomObj.linePolyInts((_arg1 as GeomLine), (_arg2 as GeomPoly)); }; }; } else { if ((_arg1 is GeomPoly)){ if ((_arg2 is GeomLine)){ _local3 = GeomObj.linePolyInts((_arg2 as GeomLine), (_arg1 as GeomPoly)); }; }; }; return (_local3); } public static function linePolyInts(_arg1:GeomLine, _arg2:GeomPoly):Array{ var _local4:GeomLine; var _local5:Vector; var _local3:Array = []; var _local6:uint = 1; while (_local6 < _arg2.vertices.length) { _local4 = new GeomLine(_arg2.vertices[(_local6 - 1)], _arg2.vertices[_local6]); _local5 = lineLineInts(_arg1, _local4); if (_local5){ _local3.push(_local5); }; _local6++; }; _local4 = new GeomLine(_arg2.vertices[0], _arg2.vertices[(_arg2.vertices.length - 1)]); _local5 = lineLineInts(_arg1, _local4); if (_local5){ _local3.push(_local5); }; return (_local3); } } }//package geom
Section 278
//GeomPoly (geom.GeomPoly) package geom { import flash.geom.*; public class GeomPoly extends GeomObj { public var isReversed:Boolean; public var vertices:Array; public function GeomPoly(_arg1:Array):void{ this.vertices = _arg1; isReversed = false; if (!isCW()){ _arg1.reverse(); isReversed = true; }; } override public function isPointInside(_arg1:Point):Boolean{ var _local6:GeomLine; var _local7:Vector; var _local2:GeomLine = new GeomLine(new Vector(_arg1.x, _arg1.y), new Vector((_arg1.x + 1000), _arg1.y)); var _local3:uint; var _local4:uint; var _local5:uint = 1; while (_local5 <= vertices.length) { _local4 = _local5; if (_local4 == vertices.length){ _local4 = 0; }; _local6 = new GeomLine(vertices[_local4], vertices[(_local5 - 1)]); _local7 = GeomObj.lineLineInts(_local2, _local6); if (_local7){ _local3 = (_local3 + 1); }; _local5++; }; return ((((_local3 > 0)) && (!(((_local3 % 2) == 0))))); } public function getArea():Number{ var _local4:Vector; var _local5:Vector; var _local1:Number = 0; var _local2:Vector = vertices[0]; var _local3:uint = 2; while (_local3 < vertices.length) { _local4 = vertices[(_local3 - 1)].subtract(_local2); _local5 = vertices[_local3].subtract(_local2); _local1 = (_local1 + _local4.cross(_local5)); _local3++; }; return (_local1); } override public function isRectInside(_arg1:Rectangle):Boolean{ var _local4:GeomLine; var _local5:uint; var _local2:Array = [new GeomLine(new Vector(_arg1.x, _arg1.y), new Vector((_arg1.x + _arg1.width), _arg1.y)), new GeomLine(new Vector((_arg1.x + _arg1.width), _arg1.y), new Vector((_arg1.x + _arg1.width), (_arg1.y + _arg1.height))), new GeomLine(new Vector((_arg1.x + _arg1.width), (_arg1.y + _arg1.height)), new Vector(_arg1.x, (_arg1.y + _arg1.height))), new GeomLine(new Vector(_arg1.x, (_arg1.y + _arg1.height)), new Vector(_arg1.x, _arg1.y))]; var _local3:uint = 1; while (_local3 < vertices.length) { _local4 = new GeomLine(vertices[_local3], vertices[(_local3 - 1)]); _local5 = 0; while (_local5 < _local2.length) { if (GeomObj.lineLineInts(_local4, _local2[_local5])){ return (true); }; _local5++; }; _local3++; }; return (false); } override public function translate(_arg1:Number, _arg2:Number):void{ var _local4:Vector; var _local3:uint; while (_local3 < vertices.length) { _local4 = vertices[_local3]; vertices[_local3].x = (_local4.x + _arg1); _local4.y = (_local4.y + _arg2); _local3++; }; } override public function getBoundingBox():Rectangle{ var _local6:Vector; var _local1:Number = 1000; var _local2:Number = 1000; var _local3:Number = -1000; var _local4:Number = -1000; var _local5:uint; while (_local5 < vertices.length) { _local6 = vertices[_local5]; if (_local6.x < _local1){ _local1 = _local6.x; }; if (_local6.x > _local3){ _local3 = _local6.x; }; if (_local6.y < _local2){ _local2 = _local6.y; }; if (_local6.y > _local4){ _local4 = _local6.y; }; _local5++; }; return (new Rectangle(_local1, _local2, (_local3 - _local1), (_local4 - _local2))); } public function split(_arg1:GeomLine):Array{ var _local2:SplittablePoly = new SplittablePoly(vertices); return (_local2.split(_arg1)); } public function isSimple():Boolean{ var _local2:uint; var _local3:GeomLine; var _local4:uint; var _local5:uint; var _local6:GeomLine; var _local7:Vector; var _local1:uint = 1; while (_local1 <= vertices.length) { _local2 = _local1; if (_local2 == vertices.length){ _local2 = 0; }; _local3 = new GeomLine(vertices[_local2], vertices[(_local1 - 1)]); _local4 = (_local1 + 1); while (_local4 <= vertices.length) { _local5 = _local4; if (_local5 == vertices.length){ _local5 = 0; }; _local6 = new GeomLine(vertices[_local5], vertices[(_local4 - 1)]); _local7 = GeomObj.lineLineInts(_local3, _local6); if (_local7){ return (false); }; _local4++; }; _local1++; }; return (true); } public function isCW():Boolean{ return ((getArea() > 0)); } public static function parseStringDef(_arg1:String):GeomPoly{ var _local5:Array; var _local6:Vector; var _local2:Array = []; var _local3:Array = _arg1.split(","); var _local4:uint; while (_local4 < _local3.length) { _local5 = _local3[_local4].split(" "); _local6 = new Vector(Number(_local5[0]), Number(_local5[1])); _local2.push(_local6); _local4++; }; return (new GeomPoly(_local2)); } } }//package geom import de.polygonal.ds.*; class SplittablePoly { private var lineDll:DLinkedList; private var polyDll:DLinkedList; private var vertices:Array; private var inboundDll:DLinkedList; private function SplittablePoly(_arg1:Array):void{ this.vertices = _arg1; } private function createPieces():Array{ var _local4:PolyNode; var _local5:DListIterator; var _local6:PolyNode; var _local7:DListIterator; var _local8:PolyNode; var _local9:PolyNode; var _local10:DListIterator; var _local1:Array = []; trace(lineDll.dump()); trace(polyDll.dump()); trace(inboundDll.dump()); polyDll.tail.next = polyDll.head; var _local2:Array = []; var _local3:DListIterator = inboundDll.getListIterator(); for (;_local3.valid();_local3.forth()) { _local4 = (_local3.data as PolyNode); if (!_local4.isLineVisited){ _local5 = lineDll.nodeOf(_local4); _local5.back(); _local6 = (_local5.data as PolyNode); if (_local6 != lineDll.head.data){ _local2.push(_local4); } else { continue; }; _local7 = polyDll.nodeOf(_local6); while (true) { _local8 = (_local7.data as PolyNode); if (_local8 == _local2[0]){ break; }; _local2.push(_local8); if (_local8.isInbound){ _local8.isLineVisited = true; _local5 = lineDll.nodeOf(_local8); _local5.back(); _local9 = (_local5.data as PolyNode); if (_local9 == _local2[0]){ break; }; if (_local9 == lineDll.head.data){ _local8.isPolyVisited = true; _local7.forth(); } else { _local7 = polyDll.nodeOf(_local9); }; } else { _local7.forth(); }; }; if (_local2.length > 0){ _local1.push(createPiece(_local2)); }; _local2 = []; }; if (!_local4.isPolyVisited){ _local10 = polyDll.nodeOf(_local4); _local2.push(_local4); while (true) { _local10.forth(); _local8 = (_local10.data as PolyNode); if (_local8 == _local2[0]){ break; } else { _local2.push(_local8); if (_local8.isOutbound){ _local5 = lineDll.nodeOf(_local8); _local5.forth(); _local9 = (_local5.data as PolyNode); if (_local9 == _local2[0]){ break; }; if (_local9 == lineDll.tail.data){ _local9.isLineVisited = true; } else { _local10 = polyDll.nodeOf(_local9); _local2.push(_local9); _local9.isPolyVisited = true; }; } else { if (_local8.isInbound){ _local8.isPolyVisited = true; }; }; }; }; _local1.push(createPiece(_local2)); _local2 = []; }; }; return (_local1); } private function createPiece(_arg1:Array):GeomPoly{ var _local5:PolyNode; var _local2:Array = []; var _local3:uint; while (_local3 < _arg1.length) { _local5 = _arg1[_local3]; _local2.push(_local5.vec.copy()); _local3++; }; var _local4:GeomPoly = new GeomPoly(_local2); return (_local4); } public function split(_arg1:GeomLine):Array{ var _local5:DListIterator; var _local6:GeomLine; var _local7:uint; var _local8:uint; var _local10:Vector; var _local11:Array; var _local12:PolyNode; var _local13:Number; var _local14:Vector; var _local15:Number; var _local2:Vector = _arg1.p2.subtract(_arg1.p1); var _local3:Array = []; var _local4:Array = [_arg1.p1, _arg1.p2]; var _local9:Vector = vertices[0]; polyDll = new DLinkedList(); lineDll = new DLinkedList(); inboundDll = new DLinkedList(); lineDll.append(new PolyNode(_arg1.p1)); lineDll.append(new PolyNode(_arg1.p2)); _local7 = 1; while (_local7 <= vertices.length) { _local8 = _local7; if (_local8 == vertices.length){ _local8 = 0; }; _local10 = vertices[_local8]; polyDll.append(new PolyNode(_local9)); _local6 = new GeomLine(_local10, _local9); _local11 = GeomObj.checkInts(_local6, _arg1); if (_local11.length > 0){ _local12 = new PolyNode(_local11[0]); _local12.checkBound(_local2, _local9); polyDll.append(_local12); if (_local12.isInbound){ inboundDll.append(_local12); }; _local13 = (((_local12.vec.x - _arg1.p1.x) * (_local12.vec.x - _arg1.p1.x)) + ((_local12.vec.y - _arg1.p1.y) * (_local12.vec.y - _arg1.p1.y))); _local5 = lineDll.getListIterator(); while (_local5.valid()) { _local14 = (_local5.data.vec as Vector); _local15 = (((_local14.x - _arg1.p1.x) * (_local14.x - _arg1.p1.x)) + ((_local14.y - _arg1.p1.y) * (_local14.y - _arg1.p1.y))); if (_local13 < _local15){ lineDll.insertBefore(_local5, _local12); break; }; _local5.forth(); }; }; _local9 = _local10; _local7++; }; return (createPieces()); } } class PolyNode { public var isInbound:Boolean;// = false public var vec:Vector; public var isLineVisited:Boolean;// = false public var isPolyVisited:Boolean;// = false public var isOutbound:Boolean;// = false public var id:uint; public static var ID:uint; private function PolyNode(_arg1:Vector):void{ id = ID++; this.vec = _arg1; } public function toString():String{ return (("n " + id)); } public function checkBound(_arg1:Vector, _arg2:Vector):void{ var _local3:Vector = vec.subtract(_arg2); if (_arg1.cross(_local3) > 0){ isInbound = true; } else { isOutbound = true; }; } }
Section 279
//Vector (geom.Vector) package geom { public class Vector { public var x:Number; public var y:Number; public function Vector(_arg1:Number, _arg2:Number):void{ this.x = _arg1; this.y = _arg2; } public function dot(_arg1:Vector):Number{ return (((x * _arg1.x) + (y * _arg1.y))); } public function subtract(_arg1:Vector):Vector{ return (new Vector((x - _arg1.x), (y - _arg1.y))); } public function copy():Vector{ return (new Vector(x, y)); } public function toString():String{ return (((x + " ") + y)); } public function cross(_arg1:Vector):Number{ return (((x * _arg1.y) - (y * _arg1.x))); } } }//package geom
Section 280
//ByteArrayAsset (mx.core.ByteArrayAsset) package mx.core { import flash.utils.*; public class ByteArrayAsset extends ByteArray implements IFlexAsset { mx_internal static const VERSION:String = "3.6.0.12937"; } }//package mx.core
Section 281
//EdgeMetrics (mx.core.EdgeMetrics) package mx.core { public class EdgeMetrics { public var top:Number; public var left:Number; public var bottom:Number; public var right:Number; mx_internal static const VERSION:String = "3.6.0.12937"; public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0); ; public function EdgeMetrics(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){ this.left = _arg1; this.top = _arg2; this.right = _arg3; this.bottom = _arg4; } public function clone():EdgeMetrics{ return (new EdgeMetrics(left, top, right, bottom)); } } }//package mx.core
Section 282
//FlexMovieClip (mx.core.FlexMovieClip) package mx.core { import flash.display.*; import mx.utils.*; public class FlexMovieClip extends MovieClip { mx_internal static const VERSION:String = "3.6.0.12937"; public function FlexMovieClip(){ super(); try { name = NameUtil.createUniqueName(this); } catch(e:Error) { }; } override public function toString():String{ return (NameUtil.displayObjectToString(this)); } } }//package mx.core
Section 283
//FlexSprite (mx.core.FlexSprite) package mx.core { import flash.display.*; import mx.utils.*; public class FlexSprite extends Sprite { mx_internal static const VERSION:String = "3.6.0.12937"; public function FlexSprite(){ super(); try { name = NameUtil.createUniqueName(this); } catch(e:Error) { }; } override public function toString():String{ return (NameUtil.displayObjectToString(this)); } } }//package mx.core
Section 284
//IBorder (mx.core.IBorder) package mx.core { public interface IBorder { function get borderMetrics():EdgeMetrics; } }//package mx.core
Section 285
//IFlexAsset (mx.core.IFlexAsset) package mx.core { public interface IFlexAsset { } }//package mx.core
Section 286
//IFlexDisplayObject (mx.core.IFlexDisplayObject) package mx.core { import flash.events.*; import flash.display.*; import flash.geom.*; import flash.accessibility.*; public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher { function get visible():Boolean; function get rotation():Number; function localToGlobal(_arg1:Point):Point; function get name():String; function set width(_arg1:Number):void; function get measuredHeight():Number; function get blendMode():String; function get scale9Grid():Rectangle; function set name(_arg1:String):void; function set scaleX(_arg1:Number):void; function set scaleY(_arg1:Number):void; function get measuredWidth():Number; function get accessibilityProperties():AccessibilityProperties; function set scrollRect(_arg1:Rectangle):void; function get cacheAsBitmap():Boolean; function globalToLocal(_arg1:Point):Point; function get height():Number; function set blendMode(_arg1:String):void; function get parent():DisplayObjectContainer; function getBounds(_arg1:DisplayObject):Rectangle; function get opaqueBackground():Object; function set scale9Grid(_arg1:Rectangle):void; function setActualSize(_arg1:Number, _arg2:Number):void; function set alpha(_arg1:Number):void; function set accessibilityProperties(_arg1:AccessibilityProperties):void; function get width():Number; function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean; function set cacheAsBitmap(_arg1:Boolean):void; function get scaleX():Number; function get scaleY():Number; function get scrollRect():Rectangle; function get mouseX():Number; function get mouseY():Number; function set height(_arg1:Number):void; function set mask(_arg1:DisplayObject):void; function getRect(_arg1:DisplayObject):Rectangle; function get alpha():Number; function set transform(_arg1:Transform):void; function move(_arg1:Number, _arg2:Number):void; function get loaderInfo():LoaderInfo; function get root():DisplayObject; function hitTestObject(_arg1:DisplayObject):Boolean; function set opaqueBackground(_arg1:Object):void; function set visible(_arg1:Boolean):void; function get mask():DisplayObject; function set x(_arg1:Number):void; function set y(_arg1:Number):void; function get transform():Transform; function set filters(_arg1:Array):void; function get x():Number; function get y():Number; function get filters():Array; function set rotation(_arg1:Number):void; function get stage():Stage; } }//package mx.core
Section 287
//IRepeaterClient (mx.core.IRepeaterClient) package mx.core { public interface IRepeaterClient { function get instanceIndices():Array; function set instanceIndices(_arg1:Array):void; function get isDocument():Boolean; function set repeaters(_arg1:Array):void; function initializeRepeaterArrays(_arg1:IRepeaterClient):void; function get repeaters():Array; function set repeaterIndices(_arg1:Array):void; function get repeaterIndices():Array; } }//package mx.core
Section 288
//MovieClipAsset (mx.core.MovieClipAsset) package mx.core { public class MovieClipAsset extends FlexMovieClip implements IFlexAsset, IFlexDisplayObject, IBorder { private var _measuredHeight:Number; private var _measuredWidth:Number; mx_internal static const VERSION:String = "3.6.0.12937"; public function MovieClipAsset(){ _measuredWidth = width; _measuredHeight = height; } public function get measuredWidth():Number{ return (_measuredWidth); } public function get measuredHeight():Number{ return (_measuredHeight); } public function setActualSize(_arg1:Number, _arg2:Number):void{ width = _arg1; height = _arg2; } public function move(_arg1:Number, _arg2:Number):void{ this.x = _arg1; this.y = _arg2; } public function get borderMetrics():EdgeMetrics{ if (scale9Grid == null){ return (EdgeMetrics.EMPTY); }; return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil((measuredWidth - scale9Grid.right)), Math.ceil((measuredHeight - scale9Grid.bottom)))); } } }//package mx.core
Section 289
//mx_internal (mx.core.mx_internal) package mx.core { public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal"; }//package mx.core
Section 290
//SoundAsset (mx.core.SoundAsset) package mx.core { import flash.media.*; public class SoundAsset extends Sound implements IFlexAsset { mx_internal static const VERSION:String = "3.6.0.12937"; } }//package mx.core
Section 291
//SpriteAsset (mx.core.SpriteAsset) package mx.core { public class SpriteAsset extends FlexSprite implements IFlexAsset, IFlexDisplayObject, IBorder { private var _measuredHeight:Number; private var _measuredWidth:Number; mx_internal static const VERSION:String = "3.6.0.12937"; public function SpriteAsset(){ _measuredWidth = width; _measuredHeight = height; } public function get measuredWidth():Number{ return (_measuredWidth); } public function get measuredHeight():Number{ return (_measuredHeight); } public function setActualSize(_arg1:Number, _arg2:Number):void{ width = _arg1; height = _arg2; } public function move(_arg1:Number, _arg2:Number):void{ this.x = _arg1; this.y = _arg2; } public function get borderMetrics():EdgeMetrics{ if (scale9Grid == null){ return (EdgeMetrics.EMPTY); }; return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil((measuredWidth - scale9Grid.right)), Math.ceil((measuredHeight - scale9Grid.bottom)))); } } }//package mx.core
Section 292
//NameUtil (mx.utils.NameUtil) package mx.utils { import flash.display.*; import mx.core.*; import flash.utils.*; public class NameUtil { mx_internal static const VERSION:String = "3.6.0.12937"; private static var counter:int = 0; public static function displayObjectToString(_arg1:DisplayObject):String{ var result:String; var o:DisplayObject; var s:String; var indices:Array; var displayObject = _arg1; try { o = displayObject; while (o != null) { if (((((o.parent) && (o.stage))) && ((o.parent == o.stage)))){ break; }; s = o.name; if ((o is IRepeaterClient)){ indices = IRepeaterClient(o).instanceIndices; if (indices){ s = (s + (("[" + indices.join("][")) + "]")); }; }; result = ((result == null)) ? s : ((s + ".") + result); o = o.parent; }; } catch(e:SecurityError) { }; return (result); } public static function createUniqueName(_arg1:Object):String{ if (!_arg1){ return (null); }; var _local2:String = getQualifiedClassName(_arg1); var _local3:int = _local2.indexOf("::"); if (_local3 != -1){ _local2 = _local2.substr((_local3 + 2)); }; var _local4:int = _local2.charCodeAt((_local2.length - 1)); if ((((_local4 >= 48)) && ((_local4 <= 57)))){ _local2 = (_local2 + "_"); }; return ((_local2 + counter++)); } } }//package mx.utils
Section 293
//Controller (org.puremvc.as3.core.controller.Controller) package org.puremvc.as3.core.controller { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.patterns.observer.*; import org.puremvc.as3.core.view.*; public class Controller implements IController { protected const SINGLETON_MSG:String = "Controller Singleton already constructed!"; protected var commandMap:Array; protected var view:IView; protected static var instance:IController; public function Controller(){ if (instance != null){ throw (Error(SINGLETON_MSG)); }; instance = this; commandMap = new Array(); initializeController(); } public function removeCommand(_arg1:String):void{ commandMap[_arg1] = null; } public function registerCommand(_arg1:String, _arg2:Class):void{ if (commandMap[_arg1] == null){ view.registerObserver(_arg1, new Observer(executeCommand, this)); }; commandMap[_arg1] = _arg2; } protected function initializeController():void{ view = View.getInstance(); } public function hasCommand(_arg1:String):Boolean{ return (!((commandMap[_arg1] == null))); } public function executeCommand(_arg1:INotification):void{ var _local2:Class = commandMap[_arg1.getName()]; if (_local2 == null){ return; }; var _local3:ICommand = new (_local2); _local3.execute(_arg1); } public static function getInstance():IController{ if (instance == null){ instance = new (Controller); }; return (instance); } } }//package org.puremvc.as3.core.controller
Section 294
//Model (org.puremvc.as3.core.model.Model) package org.puremvc.as3.core.model { import org.puremvc.as3.interfaces.*; public class Model implements IModel { protected const SINGLETON_MSG:String = "Model Singleton already constructed!"; protected var proxyMap:Array; protected static var instance:IModel; public function Model(){ if (instance != null){ throw (Error(SINGLETON_MSG)); }; instance = this; proxyMap = new Array(); initializeModel(); } protected function initializeModel():void{ } public function removeProxy(_arg1:String):IProxy{ var _local2:IProxy = (proxyMap[_arg1] as IProxy); proxyMap[_arg1] = null; return (_local2); } public function hasProxy(_arg1:String):Boolean{ return (!((proxyMap[_arg1] == null))); } public function retrieveProxy(_arg1:String):IProxy{ return (proxyMap[_arg1]); } public function registerProxy(_arg1:IProxy):void{ proxyMap[_arg1.getProxyName()] = _arg1; } public static function getInstance():IModel{ if (instance == null){ instance = new (Model); }; return (instance); } } }//package org.puremvc.as3.core.model
Section 295
//View (org.puremvc.as3.core.view.View) package org.puremvc.as3.core.view { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.patterns.observer.*; public class View implements IView { protected const SINGLETON_MSG:String = "View Singleton already constructed!"; protected var observerMap:Array; protected var mediatorMap:Array; protected static var instance:IView; public function View(){ if (instance != null){ throw (Error(SINGLETON_MSG)); }; instance = this; mediatorMap = new Array(); observerMap = new Array(); initializeView(); } public function retrieveMediator(_arg1:String):IMediator{ return (mediatorMap[_arg1]); } public function hasMediator(_arg1:String):Boolean{ return (!((mediatorMap[_arg1] == null))); } public function notifyObservers(_arg1:INotification):void{ var _local2:Array; var _local3:Number; var _local4:IObserver; if (observerMap[_arg1.getName()] != null){ _local2 = (observerMap[_arg1.getName()] as Array); _local3 = 0; while (_local3 < _local2.length) { _local4 = (_local2[_local3] as IObserver); _local4.notifyObserver(_arg1); _local3++; }; }; } protected function initializeView():void{ } public function registerMediator(_arg1:IMediator):void{ var _local3:Observer; var _local4:Number; mediatorMap[_arg1.getMediatorName()] = _arg1; var _local2:Array = _arg1.listNotificationInterests(); if (_local2.length > 0){ _local3 = new Observer(_arg1.handleNotification, _arg1); _local4 = 0; while (_local4 < _local2.length) { registerObserver(_local2[_local4], _local3); _local4++; }; }; _arg1.onRegister(); } public function removeMediator(_arg1:String):IMediator{ var _local2:String; var _local3:IMediator; var _local4:Array; var _local5:Array; var _local6:int; var _local7:int; for (_local2 in observerMap) { _local4 = observerMap[_local2]; _local5 = new Array(); _local6 = 0; while (_local6 < _local4.length) { if (Observer(_local4[_local6]).compareNotifyContext(retrieveMediator(_arg1)) == true){ _local5.push(_local6); }; _local6++; }; while (_local5.length > 0) { _local7 = _local5.pop(); _local4.splice(_local7, 1); }; if (_local4.length == 0){ delete observerMap[_local2]; }; }; _local3 = (mediatorMap[_arg1] as IMediator); delete mediatorMap[_arg1]; if (_local3){ _local3.onRemove(); }; return (_local3); } public function registerObserver(_arg1:String, _arg2:IObserver):void{ if (observerMap[_arg1] != null){ observerMap[_arg1].push(_arg2); } else { observerMap[_arg1] = [_arg2]; }; } public static function getInstance():IView{ if (instance == null){ instance = new (View); }; return (instance); } } }//package org.puremvc.as3.core.view
Section 296
//ICommand (org.puremvc.as3.interfaces.ICommand) package org.puremvc.as3.interfaces { public interface ICommand { function execute(_arg1:INotification):void; } }//package org.puremvc.as3.interfaces
Section 297
//IController (org.puremvc.as3.interfaces.IController) package org.puremvc.as3.interfaces { public interface IController { function registerCommand(_arg1:String, _arg2:Class):void; function hasCommand(_arg1:String):Boolean; function executeCommand(_arg1:INotification):void; function removeCommand(_arg1:String):void; } }//package org.puremvc.as3.interfaces
Section 298
//IFacade (org.puremvc.as3.interfaces.IFacade) package org.puremvc.as3.interfaces { public interface IFacade extends INotifier { function removeCommand(_arg1:String):void; function registerCommand(_arg1:String, _arg2:Class):void; function removeProxy(_arg1:String):IProxy; function registerProxy(_arg1:IProxy):void; function hasMediator(_arg1:String):Boolean; function retrieveMediator(_arg1:String):IMediator; function hasCommand(_arg1:String):Boolean; function retrieveProxy(_arg1:String):IProxy; function hasProxy(_arg1:String):Boolean; function registerMediator(_arg1:IMediator):void; function removeMediator(_arg1:String):IMediator; } }//package org.puremvc.as3.interfaces
Section 299
//IMediator (org.puremvc.as3.interfaces.IMediator) package org.puremvc.as3.interfaces { public interface IMediator { function listNotificationInterests():Array; function onRegister():void; function handleNotification(_arg1:INotification):void; function getMediatorName():String; function setViewComponent(_arg1:Object):void; function getViewComponent():Object; function onRemove():void; } }//package org.puremvc.as3.interfaces
Section 300
//IModel (org.puremvc.as3.interfaces.IModel) package org.puremvc.as3.interfaces { public interface IModel { function removeProxy(_arg1:String):IProxy; function retrieveProxy(_arg1:String):IProxy; function registerProxy(_arg1:IProxy):void; function hasProxy(_arg1:String):Boolean; } }//package org.puremvc.as3.interfaces
Section 301
//INotification (org.puremvc.as3.interfaces.INotification) package org.puremvc.as3.interfaces { public interface INotification { function getType():String; function getName():String; function toString():String; function setBody(_arg1:Object):void; function getBody():Object; function setType(_arg1:String):void; } }//package org.puremvc.as3.interfaces
Section 302
//INotifier (org.puremvc.as3.interfaces.INotifier) package org.puremvc.as3.interfaces { public interface INotifier { function sendNotification(_arg1:String, _arg2:Object=null, _arg3:String=null):void; } }//package org.puremvc.as3.interfaces
Section 303
//IObserver (org.puremvc.as3.interfaces.IObserver) package org.puremvc.as3.interfaces { public interface IObserver { function compareNotifyContext(_arg1:Object):Boolean; function setNotifyContext(_arg1:Object):void; function setNotifyMethod(_arg1:Function):void; function notifyObserver(_arg1:INotification):void; } }//package org.puremvc.as3.interfaces
Section 304
//IProxy (org.puremvc.as3.interfaces.IProxy) package org.puremvc.as3.interfaces { public interface IProxy { function getData():Object; function getProxyName():String; function setData(_arg1:Object):void; } }//package org.puremvc.as3.interfaces
Section 305
//IView (org.puremvc.as3.interfaces.IView) package org.puremvc.as3.interfaces { public interface IView { function notifyObservers(_arg1:INotification):void; function registerMediator(_arg1:IMediator):void; function removeMediator(_arg1:String):IMediator; function registerObserver(_arg1:String, _arg2:IObserver):void; function hasMediator(_arg1:String):Boolean; function retrieveMediator(_arg1:String):IMediator; } }//package org.puremvc.as3.interfaces
Section 306
//SimpleCommand (org.puremvc.as3.patterns.command.SimpleCommand) package org.puremvc.as3.patterns.command { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.patterns.observer.*; public class SimpleCommand extends Notifier implements ICommand, INotifier { public function execute(_arg1:INotification):void{ } } }//package org.puremvc.as3.patterns.command
Section 307
//Facade (org.puremvc.as3.patterns.facade.Facade) package org.puremvc.as3.patterns.facade { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.core.controller.*; import org.puremvc.as3.core.model.*; import org.puremvc.as3.patterns.observer.*; import org.puremvc.as3.core.view.*; public class Facade implements IFacade { protected const SINGLETON_MSG:String = "Facade Singleton already constructed!"; protected var controller:IController; protected var view:IView; protected var model:IModel; protected static var instance:IFacade; public function Facade(){ if (instance != null){ throw (Error(SINGLETON_MSG)); }; instance = this; initializeFacade(); } public function removeProxy(_arg1:String):IProxy{ var _local2:IProxy; if (model != null){ _local2 = model.removeProxy(_arg1); }; return (_local2); } public function registerProxy(_arg1:IProxy):void{ model.registerProxy(_arg1); } protected function initializeController():void{ if (controller != null){ return; }; controller = Controller.getInstance(); } protected function initializeFacade():void{ initializeModel(); initializeController(); initializeView(); } public function retrieveProxy(_arg1:String):IProxy{ return (model.retrieveProxy(_arg1)); } public function sendNotification(_arg1:String, _arg2:Object=null, _arg3:String=null):void{ notifyObservers(new Notification(_arg1, _arg2, _arg3)); } public function notifyObservers(_arg1:INotification):void{ if (view != null){ view.notifyObservers(_arg1); }; } protected function initializeView():void{ if (view != null){ return; }; view = View.getInstance(); } public function retrieveMediator(_arg1:String):IMediator{ return ((view.retrieveMediator(_arg1) as IMediator)); } public function removeMediator(_arg1:String):IMediator{ var _local2:IMediator; if (view != null){ _local2 = view.removeMediator(_arg1); }; return (_local2); } public function hasCommand(_arg1:String):Boolean{ return (controller.hasCommand(_arg1)); } public function removeCommand(_arg1:String):void{ controller.removeCommand(_arg1); } public function registerCommand(_arg1:String, _arg2:Class):void{ controller.registerCommand(_arg1, _arg2); } public function hasMediator(_arg1:String):Boolean{ return (view.hasMediator(_arg1)); } public function registerMediator(_arg1:IMediator):void{ if (view != null){ view.registerMediator(_arg1); }; } protected function initializeModel():void{ if (model != null){ return; }; model = Model.getInstance(); } public function hasProxy(_arg1:String):Boolean{ return (model.hasProxy(_arg1)); } public static function getInstance():IFacade{ if (instance == null){ instance = new (Facade); }; return (instance); } } }//package org.puremvc.as3.patterns.facade
Section 308
//Mediator (org.puremvc.as3.patterns.mediator.Mediator) package org.puremvc.as3.patterns.mediator { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.patterns.observer.*; public class Mediator extends Notifier implements IMediator, INotifier { protected var viewComponent:Object; protected var mediatorName:String; public static const NAME:String = "Mediator"; public function Mediator(_arg1:String=null, _arg2:Object=null){ this.mediatorName = ((_arg1)!=null) ? _arg1 : NAME; this.viewComponent = _arg2; } public function listNotificationInterests():Array{ return ([]); } public function onRegister():void{ } public function onRemove():void{ } public function getViewComponent():Object{ return (viewComponent); } public function handleNotification(_arg1:INotification):void{ } public function getMediatorName():String{ return (mediatorName); } public function setViewComponent(_arg1:Object):void{ this.viewComponent = _arg1; } } }//package org.puremvc.as3.patterns.mediator
Section 309
//Notification (org.puremvc.as3.patterns.observer.Notification) package org.puremvc.as3.patterns.observer { import org.puremvc.as3.interfaces.*; public class Notification implements INotification { private var body:Object; private var name:String; private var type:String; public function Notification(_arg1:String, _arg2:Object=null, _arg3:String=null){ this.name = _arg1; this.body = _arg2; this.type = _arg3; } public function setBody(_arg1:Object):void{ this.body = _arg1; } public function getName():String{ return (name); } public function toString():String{ var _local1:String = ("Notification Name: " + getName()); _local1 = (_local1 + ("\nBody:" + ((body)==null) ? "null" : body.toString())); _local1 = (_local1 + ("\nType:" + ((type)==null) ? "null" : type)); return (_local1); } public function getType():String{ return (type); } public function setType(_arg1:String):void{ this.type = _arg1; } public function getBody():Object{ return (body); } } }//package org.puremvc.as3.patterns.observer
Section 310
//Notifier (org.puremvc.as3.patterns.observer.Notifier) package org.puremvc.as3.patterns.observer { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.patterns.facade.*; public class Notifier implements INotifier { protected var facade:IFacade; public function Notifier(){ facade = Facade.getInstance(); super(); } public function sendNotification(_arg1:String, _arg2:Object=null, _arg3:String=null):void{ facade.sendNotification(_arg1, _arg2, _arg3); } } }//package org.puremvc.as3.patterns.observer
Section 311
//Observer (org.puremvc.as3.patterns.observer.Observer) package org.puremvc.as3.patterns.observer { import org.puremvc.as3.interfaces.*; public class Observer implements IObserver { private var notify:Function; private var context:Object; public function Observer(_arg1:Function, _arg2:Object){ setNotifyMethod(_arg1); setNotifyContext(_arg2); } private function getNotifyMethod():Function{ return (notify); } public function compareNotifyContext(_arg1:Object):Boolean{ return ((_arg1 === this.context)); } public function setNotifyContext(_arg1:Object):void{ context = _arg1; } private function getNotifyContext():Object{ return (context); } public function setNotifyMethod(_arg1:Function):void{ notify = _arg1; } public function notifyObserver(_arg1:INotification):void{ this.getNotifyMethod().apply(this.getNotifyContext(), [_arg1]); } } }//package org.puremvc.as3.patterns.observer
Section 312
//Proxy (org.puremvc.as3.patterns.proxy.Proxy) package org.puremvc.as3.patterns.proxy { import org.puremvc.as3.interfaces.*; import org.puremvc.as3.patterns.observer.*; public class Proxy extends Notifier implements IProxy, INotifier { protected var proxyName:String; protected var data:Object; public static var NAME:String = "Proxy"; public function Proxy(_arg1:String=null, _arg2:Object=null){ this.proxyName = ((_arg1)!=null) ? _arg1 : NAME; if (_arg2 != null){ setData(_arg2); }; } public function getData():Object{ return (data); } public function getProxyName():String{ return (proxyName); } public function setData(_arg1:Object):void{ this.data = _arg1; } } }//package org.puremvc.as3.patterns.proxy
Section 313
//ApplicationFacade (ApplicationFacade) package { import org.puremvc.as3.interfaces.*; import com.luminicbox.log.*; import flash.display.*; import org.puremvc.as3.patterns.facade.*; import org.puremvc.as3.patterns.observer.*; import game.controller.*; public class ApplicationFacade extends Facade implements IFacade { public var viewContainer:Sprite; public var logger:Logger; public static const STARTUP:String = "Startup"; override protected function initializeController():void{ super.initializeController(); registerCommand(STARTUP, StartupCommand); } public function startup(_arg1:Object):void{ var _local2:Sprite = _arg1.container; viewContainer = new Sprite(); _local2.addChild(viewContainer); notifyObservers(new Notification(STARTUP, _arg1)); } public static function getInstance():ApplicationFacade{ if (instance == null){ instance = new (ApplicationFacade); }; return ((instance as ApplicationFacade)); } } }//package
Section 314
//CellRenderer_disabledSkin (CellRenderer_disabledSkin) package { import flash.display.*; public dynamic class CellRenderer_disabledSkin extends MovieClip { } }//package
Section 315
//CellRenderer_downSkin (CellRenderer_downSkin) package { import flash.display.*; public dynamic class CellRenderer_downSkin extends MovieClip { } }//package
Section 316
//CellRenderer_overSkin (CellRenderer_overSkin) package { import flash.display.*; public dynamic class CellRenderer_overSkin extends MovieClip { } }//package
Section 317
//CellRenderer_selectedDisabledSkin (CellRenderer_selectedDisabledSkin) package { import flash.display.*; public dynamic class CellRenderer_selectedDisabledSkin extends MovieClip { } }//package
Section 318
//CellRenderer_selectedDownSkin (CellRenderer_selectedDownSkin) package { import flash.display.*; public dynamic class CellRenderer_selectedDownSkin extends MovieClip { } }//package
Section 319
//CellRenderer_selectedOverSkin (CellRenderer_selectedOverSkin) package { import flash.display.*; public dynamic class CellRenderer_selectedOverSkin extends MovieClip { } }//package
Section 320
//CellRenderer_selectedUpSkin (CellRenderer_selectedUpSkin) package { import flash.display.*; public dynamic class CellRenderer_selectedUpSkin extends MovieClip { } }//package
Section 321
//CellRenderer_upSkin (CellRenderer_upSkin) package { import flash.display.*; public dynamic class CellRenderer_upSkin extends MovieClip { } }//package
Section 322
//ColumnStretch_cursor (ColumnStretch_cursor) package { import flash.display.*; public dynamic class ColumnStretch_cursor extends MovieClip { } }//package
Section 323
//DataGrid_skin (DataGrid_skin) package { import flash.display.*; public dynamic class DataGrid_skin extends MovieClip { } }//package
Section 324
//DataGridCellEditor_skin (DataGridCellEditor_skin) package { import flash.display.*; public dynamic class DataGridCellEditor_skin extends MovieClip { } }//package
Section 325
//Factory (Factory) package { import flash.events.*; import caurina.transitions.*; import flash.display.*; import com.midasplayer.*; import flash.ui.*; import flash.net.*; import flash.utils.*; public class Factory extends MovieClip { private var dragonLoader:DragonLoader; private var preloader:KingPreloader; private var preloader2:Preloader; private var gameName:String; public static var VERSION_KONG:Boolean; public static var VERSION_MYGAME:Boolean; public static var VERSION_ARMORGAMES:Boolean; public static var kongregate; public static var VERSION_WHIRLED:Boolean; public static var VERSION_APPLECART:Boolean; public static var VERSION_UQUDOS:Boolean; public static var VERSION_YAHOO:Boolean; public static var VERSION_ANDKON:Boolean; public static var VERSION_FREEONLINEGAMES:Boolean; public function Factory():void{ init(); } private function preloaderCompleteHandler(_arg1:Event):void{ dragonLoader = new DragonLoader(); addChild(dragonLoader); dragonLoader.addEventListener(DragonLoader.LAUNCH_GAME, launchGameHandler); dragonLoader.init(gameName, "dba8b01a"); } private function kongAPILoadComplete(_arg1:Event):void{ kongregate = _arg1.target.content; kongregate.services.connect(); trace(("\n" + kongregate.services)); trace(("\n" + kongregate.user)); trace(("\n" + kongregate.scores)); trace(("\n" + kongregate.stats)); } private function checkDomain():Boolean{ var _local1:String = stage.loaderInfo.url; var _local2:Number = (_local1.indexOf("://") + 3); var _local3:Number = _local1.indexOf("/", _local2); var _local4:String = _local1.substring(_local2, _local3); var _local5:Number = (_local4.lastIndexOf(".") - 1); var _local6:Number = (_local4.lastIndexOf(".", _local5) + 1); _local4 = _local4.substring(_local6, _local4.length); VERSION_KONG = ((_local4 == "kongregate.com")) ? true : false; VERSION_ARMORGAMES = ((_local4 == "armorgames.com")) ? true : false; VERSION_UQUDOS = ((_local4 == "uqudos.com")) ? true : false; VERSION_ANDKON = ((_local4 == "andkon.com")) ? true : false; VERSION_APPLECART = ((((_local4 == "applecartgames.com")) || ((_local4 == "isfland.com")))) ? true : false; VERSION_WHIRLED = ((_local4 == "whirled.com")) ? true : false; VERSION_FREEONLINEGAMES = ((_local4 == "freeonlinegames.com")) ? true : false; VERSION_YAHOO = ((_local4 == "yimg.com")) ? true : false; trace("DOMAIN: ", _local4); if ((((((_local4 == "flashgamelicense.com")) || ((_local4 == "king.com")))) || ((_local4 == "mygame.com")))){ return (true); }; return (false); } private function launchGameHandler(_arg1:Event):void{ nextFrame(); initApp(); } private function preload(_arg1:Event):void{ VERSION_MYGAME = (checkDomain()) ? true : false; preloader = new KingPreloader(this); addChild(preloader); preloader.addEventListener(Event.COMPLETE, preloaderCompleteHandler); if (VERSION_KONG){ initKongAPI(); }; } private function initKongAPI():void{ var _local1:Object = LoaderInfo(root.loaderInfo).parameters; var _local2:String = ((_local1.api_path) || ("http://www.kongregate.com/flash/API_AS3_Local.swf")); trace(("API path: " + _local2)); var _local3:URLRequest = new URLRequest(_local2); var _local4:Loader = new Loader(); _local4.contentLoaderInfo.addEventListener(Event.COMPLETE, kongAPILoadComplete); _local4.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, kongAPIErrorHandler); _local4.load(_local3); this.addChild(_local4); } private function init():void{ stop(); gameName = "splitter"; Tweener.init(); var _local1:ContextMenu = new ContextMenu(); _local1.hideBuiltInItems(); contextMenu = _local1; checkDomain(); if (VERSION_WHIRLED){ preloader2 = new Preloader(this); addChild(preloader2); preloader2.addEventListener(Preloader.COMPLETE, preloader2CompleteHandler); } else { preload(null); }; } private function initApp():void{ var _local2:Object; var _local1:Class = (getDefinitionByName("Splitter2") as Class); if (_local1){ _local2 = new (_local1); addChild((_local2 as DisplayObject)); }; } private function preloader2CompleteHandler(_arg1:Event):void{ preloader2.removeEventListener(Preloader.COMPLETE, preloader2CompleteHandler); nextFrame(); initApp(); } private function kongAPIErrorHandler(_arg1:IOErrorEvent):void{ trace("ZZ", _arg1.text); } } }//package
Section 326
//focusRectSkin (focusRectSkin) package { import flash.display.*; public dynamic class focusRectSkin extends MovieClip { } }//package
Section 327
//HeaderRenderer_disabledSkin (HeaderRenderer_disabledSkin) package { import flash.display.*; public dynamic class HeaderRenderer_disabledSkin extends MovieClip { } }//package
Section 328
//HeaderRenderer_downSkin (HeaderRenderer_downSkin) package { import flash.display.*; public dynamic class HeaderRenderer_downSkin extends MovieClip { } }//package
Section 329
//HeaderRenderer_overSkin (HeaderRenderer_overSkin) package { import flash.display.*; public dynamic class HeaderRenderer_overSkin extends MovieClip { } }//package
Section 330
//HeaderRenderer_selectedDisabledSkin (HeaderRenderer_selectedDisabledSkin) package { import flash.display.*; public dynamic class HeaderRenderer_selectedDisabledSkin extends MovieClip { } }//package
Section 331
//HeaderRenderer_selectedDownSkin (HeaderRenderer_selectedDownSkin) package { import flash.display.*; public dynamic class HeaderRenderer_selectedDownSkin extends MovieClip { } }//package
Section 332
//HeaderRenderer_selectedOverSkin (HeaderRenderer_selectedOverSkin) package { import flash.display.*; public dynamic class HeaderRenderer_selectedOverSkin extends MovieClip { } }//package
Section 333
//HeaderRenderer_selectedUpSkin (HeaderRenderer_selectedUpSkin) package { import flash.display.*; public dynamic class HeaderRenderer_selectedUpSkin extends MovieClip { } }//package
Section 334
//HeaderRenderer_upSkin (HeaderRenderer_upSkin) package { import flash.display.*; public dynamic class HeaderRenderer_upSkin extends MovieClip { } }//package
Section 335
//HeaderSortArrow_ascIcon (HeaderSortArrow_ascIcon) package { import flash.display.*; public dynamic class HeaderSortArrow_ascIcon extends MovieClip { } }//package
Section 336
//HeaderSortArrow_descIcon (HeaderSortArrow_descIcon) package { import flash.display.*; public dynamic class HeaderSortArrow_descIcon extends MovieClip { } }//package
Section 337
//KingPreloader (KingPreloader) package { import flash.events.*; import flash.display.*; import com.midasplayer.*; import com.midasplayer.particle.*; public class KingPreloader extends Sprite { private var WindowClass:Class; private var factory:Factory; private var bar:Sprite; private var barHolder:Sprite; private var back:Sprite; private var continue_bt:SimpleButton; private var particles:MainParticles; private var window:Sprite; private var particlesHolder:Sprite; private var adsBox:Sprite; private var adsHolder:Sprite; public function KingPreloader(_arg1:Factory):void{ WindowClass = KingPreloader_WindowClass; super(); this.factory = _arg1; init(); } private function backClickHandler(_arg1:MouseEvent):void{ KingAPI.openLoaderProgressLink(); } private function continueClickHandler(_arg1:MouseEvent):void{ continue_bt.removeEventListener(MouseEvent.CLICK, continueClickHandler); parent.removeChild(this); dispatchEvent(new Event(Event.COMPLETE)); } private function init():void{ window = new WindowClass(); addChild(window); back = (window.getChildByName("back") as Sprite); barHolder = (window.getChildByName("barHolder") as Sprite); bar = (barHolder.getChildByName("bar") as Sprite); particlesHolder = new Sprite(); barHolder.addChild(particlesHolder); particlesHolder.y = bar.y; back.buttonMode = true; back.addEventListener(MouseEvent.CLICK, backClickHandler); particles = new MainParticles(); particles.setEmitterClip(particlesHolder); addChild(particles); adsHolder = (window.getChildByName("adsHolder") as Sprite); adsBox = (adsHolder.getChildByName("adBox") as Sprite); continue_bt = (adsHolder.getChildByName("continue_bt") as SimpleButton); continue_bt.visible = false; adsHolder.visible = false; addEventListener(Event.ENTER_FRAME, efHandler); } private function efHandler(_arg1:Event):void{ var _local2:Number; if (factory.framesLoaded == factory.totalFrames){ removeEventListener(Event.ENTER_FRAME, efHandler); back.removeEventListener(MouseEvent.CLICK, backClickHandler); particles.kill(); removeChild(particles); bar.scaleX = 0; parent.removeChild(this); dispatchEvent(new Event(Event.COMPLETE)); } else { _local2 = (stage.loaderInfo.bytesLoaded / stage.loaderInfo.bytesTotal); bar.scaleX = (1 - _local2); particlesHolder.x = ((_local2 * 100) + 5); }; } } }//package
Section 338
//KingPreloader_WindowClass (KingPreloader_WindowClass) package { import flash.display.*; import mx.core.*; public class KingPreloader_WindowClass extends SpriteAsset { public var bar:DisplayObject; public var dragonHolder:DisplayObject; public var back:DisplayObject; public var adBox:DisplayObject; public var bg:DisplayObject; public var fireLogoHolder:DisplayObject; public var continue_bt:DisplayObject; public var mcPlayBtn:DisplayObject; public var bannedSign:DisplayObject; public var adsHolder:DisplayObject; public var play_bt:DisplayObject; public var barHolder:DisplayObject; } }//package
Section 339
//MochiBot (MochiBot) package { import flash.display.*; import flash.net.*; import flash.system.*; public dynamic class MochiBot extends Sprite { public static function track(_arg1:Sprite, _arg2:String):MochiBot{ if (Security.sandboxType == "localWithFile"){ return (null); }; var _local3:MochiBot = new (MochiBot); _arg1.addChild(_local3); Security.allowDomain("*"); Security.allowInsecureDomain("*"); var _local4 = "http://core.mochibot.com/my/core.swf"; var _local5:URLVariables = new URLVariables(); _local5["sb"] = Security.sandboxType; _local5["v"] = Capabilities.version; _local5["swfid"] = _arg2; _local5["mv"] = "8"; _local5["fv"] = "9"; var _local6:String = _local3.root.loaderInfo.loaderURL; if (_local6.indexOf("http") == 0){ _local5["url"] = _local6; } else { _local5["url"] = "local"; }; var _local7:URLRequest = new URLRequest(_local4); _local7.contentType = "application/x-www-form-urlencoded"; _local7.method = URLRequestMethod.POST; _local7.data = _local5; var _local8:Loader = new Loader(); _local3.addChild(_local8); _local8.load(_local7); return (_local3); } } }//package
Section 340
//Preloader (Preloader) package { import flash.events.*; import flash.display.*; import flash.ui.*; public class Preloader extends Sprite { private var myContextMenu:ContextMenu; private var sponsorLogo:Sprite; private var windowClass:Class; private var window:Sprite; private var factory:Factory; private var bar:Sprite; private var play_bt:SimpleButton; private var barHolder:Sprite; public static const COMPLETE:String = "PreloadComplete"; public function Preloader(_arg1:Factory):void{ windowClass = Preloader_windowClass; super(); this.factory = _arg1; window = new windowClass(); window.tabChildren = false; addChild(window); barHolder = (window.getChildByName("barHolder") as Sprite); bar = (barHolder.getChildByName("bar") as Sprite); play_bt = (window.getChildByName("play_bt") as SimpleButton); bar.scaleX = 0; addEventListener(Event.ENTER_FRAME, efHandler); play_bt.visible = false; play_bt.addEventListener(MouseEvent.CLICK, playClickHandler); } private function efHandler(_arg1:Event):void{ var _local2:Number; graphics.clear(); if (factory.framesLoaded == factory.totalFrames){ bar.scaleX = 0; removeEventListener(Event.ENTER_FRAME, efHandler); play_bt.visible = true; } else { _local2 = (root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal); bar.scaleX = (1 - _local2); }; } private function playClickHandler(_arg1:MouseEvent):void{ play_bt.removeEventListener(MouseEvent.CLICK, playClickHandler); dispatchEvent(new Event(COMPLETE)); } } }//package
Section 341
//Preloader_windowClass (Preloader_windowClass) package { import flash.display.*; import mx.core.*; public class Preloader_windowClass extends SpriteAsset { public var bar:DisplayObject; public var bg:DisplayObject; public var dragonHolder:DisplayObject; public var fireLogoHolder:DisplayObject; public var mcPlayBtn:DisplayObject; public var bannedSign:DisplayObject; public var play_bt:DisplayObject; public var barHolder:DisplayObject; } }//package
Section 342
//ScrollArrowDown_disabledSkin (ScrollArrowDown_disabledSkin) package { import flash.display.*; public dynamic class ScrollArrowDown_disabledSkin extends MovieClip { } }//package
Section 343
//ScrollArrowDown_downSkin (ScrollArrowDown_downSkin) package { import flash.display.*; public dynamic class ScrollArrowDown_downSkin extends MovieClip { } }//package
Section 344
//ScrollArrowDown_overSkin (ScrollArrowDown_overSkin) package { import flash.display.*; public dynamic class ScrollArrowDown_overSkin extends MovieClip { } }//package
Section 345
//ScrollArrowDown_upSkin (ScrollArrowDown_upSkin) package { import flash.display.*; public dynamic class ScrollArrowDown_upSkin extends MovieClip { } }//package
Section 346
//ScrollArrowUp_disabledSkin (ScrollArrowUp_disabledSkin) package { import flash.display.*; public dynamic class ScrollArrowUp_disabledSkin extends MovieClip { } }//package
Section 347
//ScrollArrowUp_downSkin (ScrollArrowUp_downSkin) package { import flash.display.*; public dynamic class ScrollArrowUp_downSkin extends MovieClip { } }//package
Section 348
//ScrollArrowUp_overSkin (ScrollArrowUp_overSkin) package { import flash.display.*; public dynamic class ScrollArrowUp_overSkin extends MovieClip { } }//package
Section 349
//ScrollArrowUp_upSkin (ScrollArrowUp_upSkin) package { import flash.display.*; public dynamic class ScrollArrowUp_upSkin extends MovieClip { } }//package
Section 350
//ScrollBar_thumbIcon (ScrollBar_thumbIcon) package { import flash.display.*; public dynamic class ScrollBar_thumbIcon extends MovieClip { } }//package
Section 351
//ScrollThumb_downSkin (ScrollThumb_downSkin) package { import flash.display.*; public dynamic class ScrollThumb_downSkin extends MovieClip { } }//package
Section 352
//ScrollThumb_overSkin (ScrollThumb_overSkin) package { import flash.display.*; public dynamic class ScrollThumb_overSkin extends MovieClip { } }//package
Section 353
//ScrollThumb_upSkin (ScrollThumb_upSkin) package { import flash.display.*; public dynamic class ScrollThumb_upSkin extends MovieClip { } }//package
Section 354
//ScrollTrack_skin (ScrollTrack_skin) package { import flash.display.*; public dynamic class ScrollTrack_skin extends MovieClip { } }//package
Section 355
//Splitter2 (Splitter2) package { import flash.events.*; import flash.display.*; public class Splitter2 extends Sprite { public function Splitter2():void{ addEventListener(Event.ADDED_TO_STAGE, addedHandler); } private function addedHandler(_arg1:Event):void{ ApplicationFacade.getInstance().startup({container:this}); } } }//package
Section 356
//TextInput_disabledSkin (TextInput_disabledSkin) package { import flash.display.*; public dynamic class TextInput_disabledSkin extends MovieClip { } }//package
Section 357
//TextInput_upSkin (TextInput_upSkin) package { import flash.display.*; public dynamic class TextInput_upSkin extends MovieClip { } }//package

Library Items

Symbol 1 BitmapUsed by:2
Symbol 2 GraphicUses:1Used by:5
Symbol 3 GraphicUsed by:4
Symbol 4 MovieClipUses:3Used by:5
Symbol 5 MovieClipUses:2 4Used by:20
Symbol 6 GraphicUsed by:7
Symbol 7 MovieClipUses:6Used by:20
Symbol 8 GraphicUsed by:9
Symbol 9 MovieClipUses:8Used by:19
Symbol 10 GraphicUsed by:11 18
Symbol 11 MovieClipUses:10Used by:17
Symbol 12 GraphicUsed by:17 18
Symbol 13 FontUsed by:14
Symbol 14 TextUses:13Used by:17 18
Symbol 15 GraphicUsed by:16 18
Symbol 16 MovieClipUses:15Used by:17
Symbol 17 MovieClipUses:11 12 14 16Used by:18
Symbol 18 ButtonUses:17 10 12 14 15Used by:19
Symbol 19 MovieClipUses:9 18Used by:20
Symbol 20 MovieClip {KingPreloader_WindowClass} [KingLoaderAsset]Uses:5 7 19
Symbol 21 GraphicUsed by:34
Symbol 22 BitmapUsed by:23 46
Symbol 23 GraphicUses:22Used by:28
Symbol 24 BitmapUsed by:25 47
Symbol 25 GraphicUses:24Used by:28
Symbol 26 BitmapUsed by:27 48
Symbol 27 GraphicUses:26Used by:28
Symbol 28 ButtonUses:23 25 27Used by:34
Symbol 29 BitmapUsed by:30
Symbol 30 GraphicUses:29Used by:33
Symbol 31 GraphicUsed by:32
Symbol 32 MovieClipUses:31Used by:33
Symbol 33 MovieClipUses:30 32Used by:34
Symbol 34 MovieClip {Preloader_windowClass} [PreloaderWindow]Uses:21 28 33
Symbol 35 Sound {com.midasplayer.DragonLoader_SndBellClass} [sfxBell]
Symbol 36 VideoUsed by:38
Symbol 37 SoundUsed by:38
Symbol 38 MovieClipUses:36 37Used by:50
Symbol 39 VideoUsed by:40
Symbol 40 MovieClipUses:39Used by:50
Symbol 41 GraphicUsed by:42
Symbol 42 MovieClipUses:41Used by:45
Symbol 43 FontUsed by:44
Symbol 44 EditableTextUses:43Used by:45
Symbol 45 MovieClipUses:42 44Used by:50
Symbol 46 GraphicUses:22Used by:49
Symbol 47 GraphicUses:24Used by:49
Symbol 48 GraphicUses:26Used by:49
Symbol 49 MovieClipUses:46 47 48Used by:50
Symbol 50 MovieClip {com.midasplayer.DragonLoader_WindowClass} [DragonLoaderWindow]Uses:38 40 45 49
Symbol 51 BitmapUsed by:52
Symbol 52 GraphicUses:51Used by:53
Symbol 53 MovieClip {com.midasplayer.DragonLoader_GlimmerClass} [mcGlimmer]Uses:52
Symbol 54 BitmapUsed by:55
Symbol 55 GraphicUses:54Used by:100
Symbol 56 BitmapUsed by:57
Symbol 57 GraphicUses:56Used by:100
Symbol 58 BitmapUsed by:59
Symbol 59 GraphicUses:58Used by:100
Symbol 60 BitmapUsed by:61
Symbol 61 GraphicUses:60Used by:100
Symbol 62 BitmapUsed by:63
Symbol 63 GraphicUses:62Used by:100
Symbol 64 BitmapUsed by:65
Symbol 65 GraphicUses:64Used by:100
Symbol 66 BitmapUsed by:67
Symbol 67 GraphicUses:66Used by:100
Symbol 68 BitmapUsed by:69
Symbol 69 GraphicUses:68Used by:100
Symbol 70 BitmapUsed by:71
Symbol 71 GraphicUses:70Used by:100
Symbol 72 BitmapUsed by:73
Symbol 73 GraphicUses:72Used by:100
Symbol 74 BitmapUsed by:75
Symbol 75 GraphicUses:74Used by:100
Symbol 76 BitmapUsed by:77
Symbol 77 GraphicUses:76Used by:100
Symbol 78 BitmapUsed by:79
Symbol 79 GraphicUses:78Used by:100
Symbol 80 BitmapUsed by:81
Symbol 81 GraphicUses:80Used by:100
Symbol 82 BitmapUsed by:83
Symbol 83 GraphicUses:82Used by:100
Symbol 84 BitmapUsed by:85
Symbol 85 GraphicUses:84Used by:100
Symbol 86 BitmapUsed by:87
Symbol 87 GraphicUses:86Used by:100
Symbol 88 BitmapUsed by:89
Symbol 89 GraphicUses:88Used by:100
Symbol 90 BitmapUsed by:91
Symbol 91 GraphicUses:90Used by:100
Symbol 92 BitmapUsed by:93
Symbol 93 GraphicUses:92Used by:100
Symbol 94 BitmapUsed by:95
Symbol 95 GraphicUses:94Used by:100
Symbol 96 BitmapUsed by:97
Symbol 97 GraphicUses:96Used by:100
Symbol 98 BitmapUsed by:99
Symbol 99 GraphicUses:98Used by:100
Symbol 100 MovieClip {com.midasplayer.particle.MainParticles_SparkClass} [spark]Uses:55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95 97 99
Symbol 101 GraphicUsed by:102
Symbol 102 MovieClipUses:101Used by:177 189
Symbol 103 MovieClip {fl.core.ComponentShim} [fl.core.ComponentShim]Used by:119 140 174 177 189
Symbol 104 GraphicUsed by:105
Symbol 105 MovieClip {HeaderRenderer_upSkin} [HeaderRenderer_upSkin]Uses:104Used by:119
Symbol 106 GraphicUsed by:107
Symbol 107 MovieClip {HeaderRenderer_disabledSkin} [HeaderRenderer_disabledSkin]Uses:106Used by:119
Symbol 108 GraphicUsed by:109 114
Symbol 109 MovieClip {HeaderRenderer_downSkin} [HeaderRenderer_downSkin]Uses:108Used by:119
Symbol 110 GraphicUsed by:111
Symbol 111 MovieClip {HeaderRenderer_overSkin} [HeaderRenderer_overSkin]Uses:110Used by:119
Symbol 112 GraphicUsed by:113
Symbol 113 MovieClip {HeaderRenderer_selectedDisabledSkin} [HeaderRenderer_selectedDisabledSkin]Uses:112Used by:119
Symbol 114 MovieClip {HeaderRenderer_selectedDownSkin} [HeaderRenderer_selectedDownSkin]Uses:108Used by:119
Symbol 115 GraphicUsed by:116
Symbol 116 MovieClip {HeaderRenderer_selectedOverSkin} [HeaderRenderer_selectedOverSkin]Uses:115Used by:119
Symbol 117 GraphicUsed by:118
Symbol 118 MovieClip {HeaderRenderer_selectedUpSkin} [HeaderRenderer_selectedUpSkin]Uses:117Used by:119
Symbol 119 MovieClip {fl.controls.dataGridClasses.HeaderRenderer} [fl.controls.dataGridClasses.HeaderRenderer]Uses:105 103 107 109 111 113 114 116 118Used by:177
Symbol 120 GraphicUsed by:121 150 153 157 167
Symbol 121 MovieClip {HeaderSortArrow_ascIcon} [HeaderSortArrow_ascIcon]Uses:120Used by:177
Symbol 122 GraphicUsed by:123
Symbol 123 MovieClip {HeaderSortArrow_descIcon} [HeaderSortArrow_descIcon]Uses:122Used by:177
Symbol 124 GraphicUsed by:125
Symbol 125 MovieClip {CellRenderer_upSkin} [CellRenderer_upSkin]Uses:124Used by:140
Symbol 126 GraphicUsed by:127
Symbol 127 MovieClip {CellRenderer_disabledSkin} [CellRenderer_disabledSkin]Uses:126Used by:140
Symbol 128 GraphicUsed by:129
Symbol 129 MovieClip {CellRenderer_downSkin} [CellRenderer_downSkin]Uses:128Used by:140
Symbol 130 GraphicUsed by:131
Symbol 131 MovieClip {CellRenderer_overSkin} [CellRenderer_overSkin]Uses:130Used by:140
Symbol 132 GraphicUsed by:133
Symbol 133 MovieClip {CellRenderer_selectedDisabledSkin} [CellRenderer_selectedDisabledSkin]Uses:132Used by:140
Symbol 134 GraphicUsed by:135
Symbol 135 MovieClip {CellRenderer_selectedDownSkin} [CellRenderer_selectedDownSkin]Uses:134Used by:140
Symbol 136 GraphicUsed by:137
Symbol 137 MovieClip {CellRenderer_selectedOverSkin} [CellRenderer_selectedOverSkin]Uses:136Used by:140
Symbol 138 GraphicUsed by:139
Symbol 139 MovieClip {CellRenderer_selectedUpSkin} [CellRenderer_selectedUpSkin]Uses:138Used by:140
Symbol 140 MovieClip {fl.controls.listClasses.CellRenderer} [fl.controls.listClasses.CellRenderer]Uses:125 103 127 129 131 133 135 137 139Used by:177
Symbol 141 GraphicUsed by:142
Symbol 142 MovieClip {focusRectSkin} [focusRectSkin]Uses:141Used by:174 177 189
Symbol 143 GraphicUsed by:144
Symbol 144 MovieClip {ColumnStretch_cursor} [ColumnStretch_cursor]Uses:143Used by:177
Symbol 145 GraphicUsed by:146
Symbol 146 MovieClip {DataGrid_skin} [DataGrid_skin]Uses:145Used by:177
Symbol 147 GraphicUsed by:148
Symbol 148 MovieClip {ScrollTrack_skin} [ScrollTrack_skin]Uses:147Used by:174
Symbol 149 GraphicUsed by:151
Symbol 150 MovieClipUses:120Used by:151 161 163
Symbol 151 MovieClip {ScrollArrowUp_downSkin} [ScrollArrowUp_downSkin]Uses:149 150Used by:174
Symbol 152 GraphicUsed by:153
Symbol 153 MovieClip {ScrollArrowDown_downSkin} [ScrollArrowDown_downSkin]Uses:152 120Used by:174
Symbol 154 GraphicUsed by:155
Symbol 155 MovieClip {ScrollThumb_downSkin} [ScrollThumb_downSkin]Uses:154Used by:174
Symbol 156 GraphicUsed by:157
Symbol 157 MovieClip {ScrollArrowDown_overSkin} [ScrollArrowDown_overSkin]Uses:156 120Used by:174
Symbol 158 GraphicUsed by:159
Symbol 159 MovieClip {ScrollThumb_overSkin} [ScrollThumb_overSkin]Uses:158Used by:174
Symbol 160 GraphicUsed by:161
Symbol 161 MovieClip {ScrollArrowUp_overSkin} [ScrollArrowUp_overSkin]Uses:160 150Used by:174
Symbol 162 GraphicUsed by:163
Symbol 163 MovieClip {ScrollArrowUp_upSkin} [ScrollArrowUp_upSkin]Uses:162 150Used by:174
Symbol 164 GraphicUsed by:165
Symbol 165 MovieClip {ScrollThumb_upSkin} [ScrollThumb_upSkin]Uses:164Used by:174
Symbol 166 GraphicUsed by:167
Symbol 167 MovieClip {ScrollArrowDown_upSkin} [ScrollArrowDown_upSkin]Uses:166 120Used by:174
Symbol 168 GraphicUsed by:169
Symbol 169 MovieClip {ScrollArrowDown_disabledSkin} [ScrollArrowDown_disabledSkin]Uses:168Used by:174
Symbol 170 GraphicUsed by:171
Symbol 171 MovieClip {ScrollArrowUp_disabledSkin} [ScrollArrowUp_disabledSkin]Uses:170Used by:174
Symbol 172 GraphicUsed by:173
Symbol 173 MovieClip {ScrollBar_thumbIcon} [ScrollBar_thumbIcon]Uses:172Used by:174
Symbol 174 MovieClip {fl.controls.ScrollBar} [fl.controls.ScrollBar]Uses:148 103 142 151 153 155 157 159 161 163 165 167 169 171 173Used by:177
Symbol 175 GraphicUsed by:176 188
Symbol 176 MovieClip {DataGridCellEditor_skin} [DataGridCellEditor_skin]Uses:175Used by:177
Symbol 177 MovieClip {fl.controls.DataGrid} [fl.controls.DataGrid]Uses:102 103 119 121 123 140 142 144 146 174 176
Symbol 178 GraphicUsed by:179
Symbol 179 MovieClip {game.view.components.ui.CustomCellRenderer_overSkinCompleteClass} [CellRenderer_overSkinComplete]Uses:178
Symbol 180 GraphicUsed by:181
Symbol 181 MovieClip {game.view.components.ui.CustomCellRenderer_upSkinIncompleteClass} [CellRenderer_upSkinIncomplete]Uses:180
Symbol 182 GraphicUsed by:183
Symbol 183 MovieClip {game.view.components.ui.CustomCellRenderer_overSkinIncompleteClass} [CellRenderer_overSkinIncomplete]Uses:182
Symbol 184 GraphicUsed by:185
Symbol 185 MovieClip {game.view.components.ui.CustomCellRenderer_upSkinCompleteClass} [CellRenderer_upSkinComplete]Uses:184
Symbol 186 GraphicUsed by:187
Symbol 187 MovieClip {TextInput_disabledSkin} [TextInput_disabledSkin]Uses:186Used by:189
Symbol 188 MovieClip {TextInput_upSkin} [TextInput_upSkin]Uses:175Used by:189
Symbol 189 MovieClip {fl.controls.TextInput} [fl.controls.TextInput]Uses:102 103 187 188 142
Symbol 190 GraphicUsed by:191
Symbol 191 MovieClip {game.view.components.LevelSelectView_headerUpSkinClass}Uses:190
Symbol 192 BinaryData {editor.model.EditorAssets_Assets}
Symbol 193 BinaryData {game.model.GameAssets_Assets}
Symbol 194 BinaryData {core.CoreAssets_Assets}

Instance Names

"bar"Symbol 5 MovieClip Frame 1Symbol 4 MovieClip
"adBox"Symbol 19 MovieClip Frame 1Symbol 9 MovieClip
"continue_bt"Symbol 19 MovieClip Frame 1Symbol 18 Button
"barHolder"Symbol 20 MovieClip {KingPreloader_WindowClass} [KingLoaderAsset] Frame 1Symbol 5 MovieClip
"back"Symbol 20 MovieClip {KingPreloader_WindowClass} [KingLoaderAsset] Frame 1Symbol 7 MovieClip
"adsHolder"Symbol 20 MovieClip {KingPreloader_WindowClass} [KingLoaderAsset] Frame 1Symbol 19 MovieClip
"bar"Symbol 33 MovieClip Frame 1Symbol 32 MovieClip
"play_bt"Symbol 34 MovieClip {Preloader_windowClass} [PreloaderWindow] Frame 1Symbol 28 Button
"barHolder"Symbol 34 MovieClip {Preloader_windowClass} [PreloaderWindow] Frame 1Symbol 33 MovieClip
"bg"Symbol 45 MovieClip Frame 1Symbol 42 MovieClip
"dragonHolder"Symbol 50 MovieClip {com.midasplayer.DragonLoader_WindowClass} [DragonLoaderWindow] Frame 1Symbol 38 MovieClip
"fireLogoHolder"Symbol 50 MovieClip {com.midasplayer.DragonLoader_WindowClass} [DragonLoaderWindow] Frame 1Symbol 40 MovieClip
"bannedSign"Symbol 50 MovieClip {com.midasplayer.DragonLoader_WindowClass} [DragonLoaderWindow] Frame 1Symbol 45 MovieClip
"mcPlayBtn"Symbol 50 MovieClip {com.midasplayer.DragonLoader_WindowClass} [DragonLoaderWindow] Frame 1Symbol 49 MovieClip

Special Tags

FileAttributes (69)Timeline Frame 1Access network only, Metadata present, AS3.
SWFMetaData (77)Timeline Frame 1457 bytes "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'><rdf:Description rdf:about='' xmlns ..."
ScriptLimits (65)Timeline Frame 1MaxRecursionDepth: 1000, ScriptTimeout: 60 seconds
ExportAssets (56)Timeline Frame 1Symbol 20 as "KingLoaderAsset"
ExportAssets (56)Timeline Frame 1Symbol 34 as "PreloaderWindow"
ExportAssets (56)Timeline Frame 1Symbol 35 as "sfxBell"
ExportAssets (56)Timeline Frame 1Symbol 50 as "DragonLoaderWindow"
ExportAssets (56)Timeline Frame 1Symbol 53 as "mcGlimmer"
ExportAssets (56)Timeline Frame 1Symbol 100 as "spark"
ExportAssets (56)Timeline Frame 2Symbol 177 as "fl.controls.DataGrid"
ExportAssets (56)Timeline Frame 2Symbol 140 as "fl.controls.listClasses.CellRenderer"
ExportAssets (56)Timeline Frame 2Symbol 174 as "fl.controls.ScrollBar"
ExportAssets (56)Timeline Frame 2Symbol 142 as "focusRectSkin"
ExportAssets (56)Timeline Frame 2Symbol 176 as "DataGridCellEditor_skin"
ExportAssets (56)Timeline Frame 2Symbol 121 as "HeaderSortArrow_ascIcon"
ExportAssets (56)Timeline Frame 2Symbol 119 as "fl.controls.dataGridClasses.HeaderRenderer"
ExportAssets (56)Timeline Frame 2Symbol 123 as "HeaderSortArrow_descIcon"
ExportAssets (56)Timeline Frame 2Symbol 144 as "ColumnStretch_cursor"
ExportAssets (56)Timeline Frame 2Symbol 103 as "fl.core.ComponentShim"
ExportAssets (56)Timeline Frame 2Symbol 146 as "DataGrid_skin"
ExportAssets (56)Timeline Frame 2Symbol 133 as "CellRenderer_selectedDisabledSkin"
ExportAssets (56)Timeline Frame 2Symbol 137 as "CellRenderer_selectedOverSkin"
ExportAssets (56)Timeline Frame 2Symbol 129 as "CellRenderer_downSkin"
ExportAssets (56)Timeline Frame 2Symbol 139 as "CellRenderer_selectedUpSkin"
ExportAssets (56)Timeline Frame 2Symbol 125 as "CellRenderer_upSkin"
ExportAssets (56)Timeline Frame 2Symbol 135 as "CellRenderer_selectedDownSkin"
ExportAssets (56)Timeline Frame 2Symbol 127 as "CellRenderer_disabledSkin"
ExportAssets (56)Timeline Frame 2Symbol 131 as "CellRenderer_overSkin"
ExportAssets (56)Timeline Frame 2Symbol 179 as "CellRenderer_overSkinComplete"
ExportAssets (56)Timeline Frame 2Symbol 181 as "CellRenderer_upSkinIncomplete"
ExportAssets (56)Timeline Frame 2Symbol 183 as "CellRenderer_overSkinIncomplete"
ExportAssets (56)Timeline Frame 2Symbol 185 as "CellRenderer_upSkinComplete"
ExportAssets (56)Timeline Frame 2Symbol 189 as "fl.controls.TextInput"
ExportAssets (56)Timeline Frame 2Symbol 171 as "ScrollArrowUp_disabledSkin"
ExportAssets (56)Timeline Frame 2Symbol 159 as "ScrollThumb_overSkin"
ExportAssets (56)Timeline Frame 2Symbol 165 as "ScrollThumb_upSkin"
ExportAssets (56)Timeline Frame 2Symbol 155 as "ScrollThumb_downSkin"
ExportAssets (56)Timeline Frame 2Symbol 163 as "ScrollArrowUp_upSkin"
ExportAssets (56)Timeline Frame 2Symbol 153 as "ScrollArrowDown_downSkin"
ExportAssets (56)Timeline Frame 2Symbol 169 as "ScrollArrowDown_disabledSkin"
ExportAssets (56)Timeline Frame 2Symbol 161 as "ScrollArrowUp_overSkin"
ExportAssets (56)Timeline Frame 2Symbol 167 as "ScrollArrowDown_upSkin"
ExportAssets (56)Timeline Frame 2Symbol 173 as "ScrollBar_thumbIcon"
ExportAssets (56)Timeline Frame 2Symbol 157 as "ScrollArrowDown_overSkin"
ExportAssets (56)Timeline Frame 2Symbol 151 as "ScrollArrowUp_downSkin"
ExportAssets (56)Timeline Frame 2Symbol 148 as "ScrollTrack_skin"
ExportAssets (56)Timeline Frame 2Symbol 105 as "HeaderRenderer_upSkin"
ExportAssets (56)Timeline Frame 2Symbol 118 as "HeaderRenderer_selectedUpSkin"
ExportAssets (56)Timeline Frame 2Symbol 109 as "HeaderRenderer_downSkin"
ExportAssets (56)Timeline Frame 2Symbol 107 as "HeaderRenderer_disabledSkin"
ExportAssets (56)Timeline Frame 2Symbol 111 as "HeaderRenderer_overSkin"
ExportAssets (56)Timeline Frame 2Symbol 113 as "HeaderRenderer_selectedDisabledSkin"
ExportAssets (56)Timeline Frame 2Symbol 116 as "HeaderRenderer_selectedOverSkin"
ExportAssets (56)Timeline Frame 2Symbol 114 as "HeaderRenderer_selectedDownSkin"
ExportAssets (56)Timeline Frame 2Symbol 188 as "TextInput_upSkin"
ExportAssets (56)Timeline Frame 2Symbol 187 as "TextInput_disabledSkin"
SerialNumber (41)Timeline Frame 1

Labels

"Factory"Frame 1
"Splitter2"Frame 2
"idle"Symbol 49 MovieClip Frame 1
"over"Symbol 49 MovieClip Frame 2
"down"Symbol 49 MovieClip Frame 3
"loop"Symbol 100 MovieClip {com.midasplayer.particle.MainParticles_SparkClass} [spark] Frame 10




http://swfchan.com/46/226725/info.shtml
Created: 20/10 -2019 08:45:31 Last modified: 20/10 -2019 08:45:31 Server time: 22/12 -2024 10:45:31