Section 1
//AcidAnimation (assets.AcidAnimation)
package assets {
import com.bigwigmedia.display.*;
public dynamic class AcidAnimation extends AnimationAsset {
}
}//package assets
Section 2
//AcidBalloonExplosionAnimation (assets.AcidBalloonExplosionAnimation)
package assets {
import com.bigwigmedia.display.*;
public dynamic class AcidBalloonExplosionAnimation extends AnimationAsset {
}
}//package assets
Section 3
//AcidBalloonShopButtonSkin (assets.AcidBalloonShopButtonSkin)
package assets {
import flash.display.*;
public dynamic class AcidBalloonShopButtonSkin extends Sprite {
}
}//package assets
Section 4
//AcidBalloonSprite (assets.AcidBalloonSprite)
package assets {
import flash.display.*;
public dynamic class AcidBalloonSprite extends Sprite {
}
}//package assets
Section 5
//AcidBalloonToolIcon (assets.AcidBalloonToolIcon)
package assets {
import flash.display.*;
public dynamic class AcidBalloonToolIcon extends BitmapData {
public function AcidBalloonToolIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 6
//AcidBalloonToolImage (assets.AcidBalloonToolImage)
package assets {
import flash.display.*;
public dynamic class AcidBalloonToolImage extends Sprite {
}
}//package assets
Section 7
//AcidExplosionAnimation (assets.AcidExplosionAnimation)
package assets {
import com.bigwigmedia.display.*;
public dynamic class AcidExplosionAnimation extends AnimationAsset {
}
}//package assets
Section 8
//AirStrikeBallSprite (assets.AirStrikeBallSprite)
package assets {
import flash.display.*;
public dynamic class AirStrikeBallSprite extends Sprite {
}
}//package assets
Section 9
//AirStrikeShopButtonSkin (assets.AirStrikeShopButtonSkin)
package assets {
import flash.display.*;
public dynamic class AirStrikeShopButtonSkin extends Sprite {
}
}//package assets
Section 10
//AirStrikeSprite (assets.AirStrikeSprite)
package assets {
import flash.display.*;
public dynamic class AirStrikeSprite extends Sprite {
}
}//package assets
Section 11
//AirStrikeToolIcon (assets.AirStrikeToolIcon)
package assets {
import flash.display.*;
public dynamic class AirStrikeToolIcon extends BitmapData {
public function AirStrikeToolIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 12
//AirStrikeToolImage (assets.AirStrikeToolImage)
package assets {
import flash.display.*;
public dynamic class AirStrikeToolImage extends Sprite {
}
}//package assets
Section 13
//AnchorIcon (assets.AnchorIcon)
package assets {
import flash.display.*;
public dynamic class AnchorIcon extends BitmapData {
public function AnchorIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 14
//AntimatterAttractorClip (assets.AntimatterAttractorClip)
package assets {
import com.bigwigmedia.display.*;
public dynamic class AntimatterAttractorClip extends AnimationAsset {
}
}//package assets
Section 15
//AntimatterExplosionClip (assets.AntimatterExplosionClip)
package assets {
import com.bigwigmedia.display.*;
public dynamic class AntimatterExplosionClip extends AnimationAsset {
}
}//package assets
Section 16
//AntimatterShopButtonSkin (assets.AntimatterShopButtonSkin)
package assets {
import flash.display.*;
public dynamic class AntimatterShopButtonSkin extends Sprite {
}
}//package assets
Section 17
//AntimatterSprite (assets.AntimatterSprite)
package assets {
import flash.display.*;
public dynamic class AntimatterSprite extends Sprite {
}
}//package assets
Section 18
//AntimatterToolIcon (assets.AntimatterToolIcon)
package assets {
import flash.display.*;
public dynamic class AntimatterToolIcon extends BitmapData {
public function AntimatterToolIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 19
//AntimatterToolImage (assets.AntimatterToolImage)
package assets {
import flash.display.*;
public dynamic class AntimatterToolImage extends Sprite {
}
}//package assets
Section 20
//ArrowLeftIcon (assets.ArrowLeftIcon)
package assets {
import flash.display.*;
public dynamic class ArrowLeftIcon extends BitmapData {
public function ArrowLeftIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 21
//ArrowRightIcon (assets.ArrowRightIcon)
package assets {
import flash.display.*;
public dynamic class ArrowRightIcon extends BitmapData {
public function ArrowRightIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 22
//ArrowsRefresh (assets.ArrowsRefresh)
package assets {
import flash.display.*;
public dynamic class ArrowsRefresh extends BitmapData {
public function ArrowsRefresh(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 23
//BlockConcreteIcon (assets.BlockConcreteIcon)
package assets {
import flash.display.*;
public dynamic class BlockConcreteIcon extends BitmapData {
public function BlockConcreteIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 24
//BlockConcreteTexture (assets.BlockConcreteTexture)
package assets {
import flash.display.*;
public dynamic class BlockConcreteTexture extends BitmapData {
public function BlockConcreteTexture(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 25
//BlockGlassIcon (assets.BlockGlassIcon)
package assets {
import flash.display.*;
public dynamic class BlockGlassIcon extends BitmapData {
public function BlockGlassIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 26
//BlockGlassTexture (assets.BlockGlassTexture)
package assets {
import flash.display.*;
public dynamic class BlockGlassTexture extends BitmapData {
public function BlockGlassTexture(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 27
//BlockStaticIcon (assets.BlockStaticIcon)
package assets {
import flash.display.*;
public dynamic class BlockStaticIcon extends BitmapData {
public function BlockStaticIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 28
//BlockStaticTexture (assets.BlockStaticTexture)
package assets {
import flash.display.*;
public dynamic class BlockStaticTexture extends BitmapData {
public function BlockStaticTexture(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 29
//BlockSteelIcon (assets.BlockSteelIcon)
package assets {
import flash.display.*;
public dynamic class BlockSteelIcon extends BitmapData {
public function BlockSteelIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 30
//BlockSteelTexture (assets.BlockSteelTexture)
package assets {
import flash.display.*;
public dynamic class BlockSteelTexture extends BitmapData {
public function BlockSteelTexture(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 31
//BlockWoodIcon (assets.BlockWoodIcon)
package assets {
import flash.display.*;
public dynamic class BlockWoodIcon extends BitmapData {
public function BlockWoodIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 32
//BlockWoodTexture (assets.BlockWoodTexture)
package assets {
import flash.display.*;
public dynamic class BlockWoodTexture extends BitmapData {
public function BlockWoodTexture(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 33
//BlueButtonOverSkin (assets.BlueButtonOverSkin)
package assets {
import flash.display.*;
public dynamic class BlueButtonOverSkin extends Sprite {
}
}//package assets
Section 34
//BlueButtonSkin (assets.BlueButtonSkin)
package assets {
import flash.display.*;
public dynamic class BlueButtonSkin extends Sprite {
}
}//package assets
Section 35
//BuyToolHintBubble (assets.BuyToolHintBubble)
package assets {
import flash.display.*;
public dynamic class BuyToolHintBubble extends Sprite {
}
}//package assets
Section 36
//C4ShopButtonSkin (assets.C4ShopButtonSkin)
package assets {
import flash.display.*;
public dynamic class C4ShopButtonSkin extends Sprite {
}
}//package assets
Section 37
//C4Sprite (assets.C4Sprite)
package assets {
import flash.display.*;
public dynamic class C4Sprite extends Sprite {
}
}//package assets
Section 38
//C4ToolIcon (assets.C4ToolIcon)
package assets {
import flash.display.*;
public dynamic class C4ToolIcon extends BitmapData {
public function C4ToolIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 39
//C4ToolImage (assets.C4ToolImage)
package assets {
import flash.display.*;
public dynamic class C4ToolImage extends Sprite {
}
}//package assets
Section 40
//ChangeToolHintBubble (assets.ChangeToolHintBubble)
package assets {
import flash.display.*;
public dynamic class ChangeToolHintBubble extends Sprite {
}
}//package assets
Section 41
//CleanZoneGreenTexture (assets.CleanZoneGreenTexture)
package assets {
import flash.display.*;
public dynamic class CleanZoneGreenTexture extends BitmapData {
public function CleanZoneGreenTexture(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 42
//CleanZoneIcon (assets.CleanZoneIcon)
package assets {
import flash.display.*;
public dynamic class CleanZoneIcon extends BitmapData {
public function CleanZoneIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 43
//CleanZoneRedTexture (assets.CleanZoneRedTexture)
package assets {
import flash.display.*;
public dynamic class CleanZoneRedTexture extends BitmapData {
public function CleanZoneRedTexture(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 44
//ContractBackground (assets.ContractBackground)
package assets {
import flash.display.*;
public dynamic class ContractBackground extends Sprite {
}
}//package assets
Section 45
//CracksTexture (assets.CracksTexture)
package assets {
import flash.display.*;
public dynamic class CracksTexture extends BitmapData {
public function CracksTexture(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 46
//EditorHelpPagesClip (assets.EditorHelpPagesClip)
package assets {
import flash.display.*;
public dynamic class EditorHelpPagesClip extends MovieClip {
}
}//package assets
Section 47
//ExitIcon (assets.ExitIcon)
package assets {
import flash.display.*;
public dynamic class ExitIcon extends BitmapData {
public function ExitIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 48
//ExplosionClip (assets.ExplosionClip)
package assets {
import com.bigwigmedia.display.*;
public dynamic class ExplosionClip extends AnimationAsset {
}
}//package assets
Section 49
//ExplosiveControlButtonSkin (assets.ExplosiveControlButtonSkin)
package assets {
import flash.display.*;
public dynamic class ExplosiveControlButtonSkin extends BitmapData {
public function ExplosiveControlButtonSkin(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 50
//ExplosiveDecreaseTimeIcon (assets.ExplosiveDecreaseTimeIcon)
package assets {
import flash.display.*;
public dynamic class ExplosiveDecreaseTimeIcon extends BitmapData {
public function ExplosiveDecreaseTimeIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 51
//ExplosiveDeleteIcon (assets.ExplosiveDeleteIcon)
package assets {
import flash.display.*;
public dynamic class ExplosiveDeleteIcon extends BitmapData {
public function ExplosiveDeleteIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 52
//ExplosiveIncreaseTimeIcon (assets.ExplosiveIncreaseTimeIcon)
package assets {
import flash.display.*;
public dynamic class ExplosiveIncreaseTimeIcon extends BitmapData {
public function ExplosiveIncreaseTimeIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 53
//Font_1 (assets.Font_1)
package assets {
import flash.text.*;
public dynamic class Font_1 extends Font {
}
}//package assets
Section 54
//GameCompleteBackground (assets.GameCompleteBackground)
package assets {
import flash.display.*;
public dynamic class GameCompleteBackground extends Sprite {
}
}//package assets
Section 55
//GreenButtonOverSkin (assets.GreenButtonOverSkin)
package assets {
import flash.display.*;
public dynamic class GreenButtonOverSkin extends Sprite {
}
}//package assets
Section 56
//GreenButtonSkin (assets.GreenButtonSkin)
package assets {
import flash.display.*;
public dynamic class GreenButtonSkin extends Sprite {
}
}//package assets
Section 57
//HelpIcon (assets.HelpIcon)
package assets {
import flash.display.*;
public dynamic class HelpIcon extends BitmapData {
public function HelpIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 58
//HintIcon (assets.HintIcon)
package assets {
import flash.display.*;
public dynamic class HintIcon extends BitmapData {
public function HintIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 59
//HUDBackground (assets.HUDBackground)
package assets {
import flash.display.*;
public dynamic class HUDBackground extends Sprite {
}
}//package assets
Section 60
//InstructionsBackground (assets.InstructionsBackground)
package assets {
import flash.display.*;
public dynamic class InstructionsBackground extends Sprite {
}
}//package assets
Section 61
//LaserAnimation (assets.LaserAnimation)
package assets {
import com.bigwigmedia.display.*;
public dynamic class LaserAnimation extends AnimationAsset {
}
}//package assets
Section 62
//LevelBackground (assets.LevelBackground)
package assets {
import flash.display.*;
public dynamic class LevelBackground extends MovieClip {
}
}//package assets
Section 63
//LevelFailedBackground (assets.LevelFailedBackground)
package assets {
import flash.display.*;
public dynamic class LevelFailedBackground extends Sprite {
}
}//package assets
Section 64
//LevelPassedBackground (assets.LevelPassedBackground)
package assets {
import flash.display.*;
public dynamic class LevelPassedBackground extends Sprite {
}
}//package assets
Section 65
//LevelSelectionBack (assets.LevelSelectionBack)
package assets {
import flash.display.*;
public dynamic class LevelSelectionBack extends BitmapData {
public function LevelSelectionBack(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 66
//MainMenuBackground (assets.MainMenuBackground)
package assets {
import flash.display.*;
public dynamic class MainMenuBackground extends Sprite {
}
}//package assets
Section 67
//ManClip (assets.ManClip)
package assets {
import flash.display.*;
public dynamic class ManClip extends MovieClip {
}
}//package assets
Section 68
//ManEditorIcon (assets.ManEditorIcon)
package assets {
import flash.display.*;
public dynamic class ManEditorIcon extends Sprite {
}
}//package assets
Section 69
//ManIcon (assets.ManIcon)
package assets {
import flash.display.*;
public dynamic class ManIcon extends BitmapData {
public function ManIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 70
//MenuButtonsSkin (assets.MenuButtonsSkin)
package assets {
import flash.display.*;
public dynamic class MenuButtonsSkin extends BitmapData {
public function MenuButtonsSkin(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 71
//NitroglycerinShopButtonSkin (assets.NitroglycerinShopButtonSkin)
package assets {
import flash.display.*;
public dynamic class NitroglycerinShopButtonSkin extends Sprite {
}
}//package assets
Section 72
//NitroglycerinSprite (assets.NitroglycerinSprite)
package assets {
import flash.display.*;
public dynamic class NitroglycerinSprite extends Sprite {
}
}//package assets
Section 73
//NitroglycerinToolIcon (assets.NitroglycerinToolIcon)
package assets {
import flash.display.*;
public dynamic class NitroglycerinToolIcon extends BitmapData {
public function NitroglycerinToolIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 74
//NitroglycerinToolImage (assets.NitroglycerinToolImage)
package assets {
import flash.display.*;
public dynamic class NitroglycerinToolImage extends Sprite {
}
}//package assets
Section 75
//OpponentClip (assets.OpponentClip)
package assets {
import flash.display.*;
public dynamic class OpponentClip extends MovieClip {
}
}//package assets
Section 76
//OpponentEditorIcon (assets.OpponentEditorIcon)
package assets {
import flash.display.*;
public dynamic class OpponentEditorIcon extends Sprite {
}
}//package assets
Section 77
//OpponentIcon (assets.OpponentIcon)
package assets {
import flash.display.*;
public dynamic class OpponentIcon extends BitmapData {
public function OpponentIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 78
//PlayIcon (assets.PlayIcon)
package assets {
import flash.display.*;
public dynamic class PlayIcon extends BitmapData {
public function PlayIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 79
//PreloaderAnimation (assets.PreloaderAnimation)
package assets {
import com.bigwigmedia.display.*;
public dynamic class PreloaderAnimation extends SimpleAutoAsset {
}
}//package assets
Section 80
//PreloaderSprite (assets.PreloaderSprite)
package assets {
import flash.display.*;
public dynamic class PreloaderSprite extends Sprite {
public var _animation:PreloaderAnimation;
public var _logo_button:TwoDPlayLogoAnimation;
public var _ad_holder:MovieClip;
public var _progress_bar:MovieClip;
}
}//package assets
Section 81
//QuestionMarkIcon (assets.QuestionMarkIcon)
package assets {
import flash.display.*;
public dynamic class QuestionMarkIcon extends BitmapData {
public function QuestionMarkIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 82
//RedButtonOverSkin (assets.RedButtonOverSkin)
package assets {
import flash.display.*;
public dynamic class RedButtonOverSkin extends Sprite {
}
}//package assets
Section 83
//RedButtonSkin (assets.RedButtonSkin)
package assets {
import flash.display.*;
public dynamic class RedButtonSkin extends Sprite {
}
}//package assets
Section 84
//SelectLevelButtonSkin (assets.SelectLevelButtonSkin)
package assets {
import flash.display.*;
public dynamic class SelectLevelButtonSkin extends BitmapData {
public function SelectLevelButtonSkin(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 85
//SelectLevelLockedButtonSkin (assets.SelectLevelLockedButtonSkin)
package assets {
import flash.display.*;
public dynamic class SelectLevelLockedButtonSkin extends BitmapData {
public function SelectLevelLockedButtonSkin(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 86
//ShopBackground (assets.ShopBackground)
package assets {
import flash.display.*;
public dynamic class ShopBackground extends Sprite {
}
}//package assets
Section 87
//ShortMenuButtonSkin (assets.ShortMenuButtonSkin)
package assets {
import flash.display.*;
public dynamic class ShortMenuButtonSkin extends BitmapData {
public function ShortMenuButtonSkin(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 88
//TimeoutCounter (assets.TimeoutCounter)
package assets {
import flash.display.*;
public dynamic class TimeoutCounter extends MovieClip {
}
}//package assets
Section 89
//TNTSprite (assets.TNTSprite)
package assets {
import flash.display.*;
public dynamic class TNTSprite extends Sprite {
}
}//package assets
Section 90
//TNTToolIcon (assets.TNTToolIcon)
package assets {
import flash.display.*;
public dynamic class TNTToolIcon extends BitmapData {
public function TNTToolIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 91
//TNTToolImage (assets.TNTToolImage)
package assets {
import flash.display.*;
public dynamic class TNTToolImage extends Sprite {
}
}//package assets
Section 92
//ToolboxAnimation (assets.ToolboxAnimation)
package assets {
import com.bigwigmedia.display.*;
public dynamic class ToolboxAnimation extends AnimationAsset {
}
}//package assets
Section 93
//ToolButtonSelectedSkin (assets.ToolButtonSelectedSkin)
package assets {
import flash.display.*;
public dynamic class ToolButtonSelectedSkin extends BitmapData {
public function ToolButtonSelectedSkin(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 94
//ToolButtonSkin (assets.ToolButtonSkin)
package assets {
import flash.display.*;
public dynamic class ToolButtonSkin extends BitmapData {
public function ToolButtonSkin(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 95
//TransformToolIcon (assets.TransformToolIcon)
package assets {
import flash.display.*;
public dynamic class TransformToolIcon extends BitmapData {
public function TransformToolIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 96
//TwoDPlayIcon (assets.TwoDPlayIcon)
package assets {
import flash.display.*;
public dynamic class TwoDPlayIcon extends Sprite {
}
}//package assets
Section 97
//TwoDPlayLogoAnimation (assets.TwoDPlayLogoAnimation)
package assets {
import com.bigwigmedia.display.*;
public dynamic class TwoDPlayLogoAnimation extends SimpleAutoAsset {
}
}//package assets
Section 98
//UFOShopButtonSkin (assets.UFOShopButtonSkin)
package assets {
import flash.display.*;
public dynamic class UFOShopButtonSkin extends Sprite {
}
}//package assets
Section 99
//UFOSprite (assets.UFOSprite)
package assets {
import flash.display.*;
public dynamic class UFOSprite extends Sprite {
}
}//package assets
Section 100
//UFOToolIcon (assets.UFOToolIcon)
package assets {
import flash.display.*;
public dynamic class UFOToolIcon extends BitmapData {
public function UFOToolIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 101
//UFOToolImage (assets.UFOToolImage)
package assets {
import flash.display.*;
public dynamic class UFOToolImage extends Sprite {
}
}//package assets
Section 102
//UFOViewSprite (assets.UFOViewSprite)
package assets {
import flash.display.*;
public dynamic class UFOViewSprite extends MovieClip {
}
}//package assets
Section 103
//WomanClip (assets.WomanClip)
package assets {
import flash.display.*;
public dynamic class WomanClip extends MovieClip {
}
}//package assets
Section 104
//WomanEditorIcon (assets.WomanEditorIcon)
package assets {
import flash.display.*;
public dynamic class WomanEditorIcon extends Sprite {
}
}//package assets
Section 105
//WomanIcon (assets.WomanIcon)
package assets {
import flash.display.*;
public dynamic class WomanIcon extends BitmapData {
public function WomanIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 106
//WreckingBallCenterSprite (assets.WreckingBallCenterSprite)
package assets {
import flash.display.*;
public dynamic class WreckingBallCenterSprite extends Sprite {
}
}//package assets
Section 107
//WreckingBallChainSprite (assets.WreckingBallChainSprite)
package assets {
import flash.display.*;
public dynamic class WreckingBallChainSprite extends Sprite {
}
}//package assets
Section 108
//WreckingBallShopButtonSkin (assets.WreckingBallShopButtonSkin)
package assets {
import flash.display.*;
public dynamic class WreckingBallShopButtonSkin extends Sprite {
}
}//package assets
Section 109
//WreckingBallSprite (assets.WreckingBallSprite)
package assets {
import flash.display.*;
public dynamic class WreckingBallSprite extends Sprite {
}
}//package assets
Section 110
//WreckingBallToolIcon (assets.WreckingBallToolIcon)
package assets {
import flash.display.*;
public dynamic class WreckingBallToolIcon extends BitmapData {
public function WreckingBallToolIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package assets
Section 111
//WreckingBallToolImage (assets.WreckingBallToolImage)
package assets {
import flash.display.*;
public dynamic class WreckingBallToolImage extends Sprite {
}
}//package assets
Section 112
//AcidDefinition (bb2.common.AcidDefinition)
package bb2.common {
import Box2D.Common.Math.*;
public class AcidDefinition extends TransformableItemDefinition {
private var _velocity:b2Vec2;
public function AcidDefinition(_arg1:Number, _arg2:Number, _arg3:b2Vec2){
super(GameItemKind.ACID, null, _arg1, _arg2, 36, 14, 0);
_velocity = _arg3;
}
public function get velocity():b2Vec2{
return (_velocity);
}
}
}//package bb2.common
Section 113
//AirStrikeBallDefinition (bb2.common.AirStrikeBallDefinition)
package bb2.common {
public class AirStrikeBallDefinition extends TransformableItemDefinition {
private var _radius:Number;
public function AirStrikeBallDefinition(_arg1:Number, _arg2:Number){
super(GameItemKind.AIR_STRIKE_BALL, null, _arg1, _arg2, 0, 0, 0);
_radius = 15;
}
public function get radius():Number{
return (_radius);
}
}
}//package bb2.common
Section 114
//BackgroundType (bb2.common.BackgroundType)
package bb2.common {
import com.bigwigmedia.utils.*;
public class BackgroundType {
public static const BACK_TURKEY:String = "BACK_TURKEY";
public static const BACK_NEW_YORK:String = "BACK_NEW_YORK";
public static const BACK_MOUNTAINS:String = "BACK_MOUNTAINS";
public static const BACK_RANDOM:String = "BACK_RANDOM";
private static const list:Array = [BACK_BEACH, BACK_CHINA, BACK_DESERT, BACK_EUROPE, BACK_MEDITERRANEAN, BACK_MOUNTAINS, BACK_NEW_YORK, BACK_RUSSIA, BACK_SNOW, BACK_TURKEY];
public static const BACK_CHINA:String = "BACK_CHINA";
public static const BACK_SNOW:String = "BACK_SNOW";
public static const BACK_BEACH:String = "BACK_BEACH";
public static const BACK_DESERT:String = "BACK_DESERT";
public static const BACK_RUSSIA:String = "BACK_RUSSIA";
public static const BACK_EUROPE:String = "BACK_EUROPE";
public static const BACK_MEDITERRANEAN:String = "BACK_MEDITERRANEAN";
public static function getRandom():String{
return (ArrayUtil.getRandomElement(list));
}
}
}//package bb2.common
Section 115
//BlockBitmapFactory (bb2.common.BlockBitmapFactory)
package bb2.common {
import flash.display.*;
import flash.geom.*;
import assets.*;
import flash.filters.*;
public class BlockBitmapFactory {
private static const ZERO_POINT:Point = new Point();
private static const TEXTURES_HASH:Object = {block_concrete:new BlockConcreteTexture(0, 0), block_glass:new BlockGlassTexture(0, 0), block_static:new BlockStaticTexture(0, 0), block_steel:new BlockSteelTexture(0, 0), block_wood:new BlockWoodTexture(0, 0)};
private static const CANVAS:Shape = new Shape();
private static const CRACKS_TEXTURE:BitmapData = new CracksTexture(0, 0);
private static const GLOW:GlowFilter = new GlowFilter(0, 1, 6, 6, 2, 1, true);
public static function create(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Boolean):Bitmap{
var _local5:Graphics = CANVAS.graphics;
_local5.clear();
_local5.beginBitmapFill(TEXTURES_HASH[_arg1]);
_local5.drawRect(0, 0, _arg2, _arg3);
_local5.endFill();
var _local6:BitmapData = new BitmapData(_arg2, _arg3, true, 0);
_local6.draw(CANVAS);
if (_arg4){
CANVAS.graphics.beginBitmapFill(CRACKS_TEXTURE);
CANVAS.graphics.drawRect(0, 0, _arg2, _arg3);
CANVAS.graphics.endFill();
_local6.draw(CANVAS);
};
_local6.applyFilter(_local6, _local6.rect, ZERO_POINT, GLOW);
return (new Bitmap(_local6, PixelSnapping.AUTO, true));
}
}
}//package bb2.common
Section 116
//BlockDefinition (bb2.common.BlockDefinition)
package bb2.common {
import bb2.managers.*;
public class BlockDefinition extends TransformableItemDefinition {
private var _strength:Number;
private var _density:Number;
private var _friction:Number;
private var _broken:Boolean;
private static var _kindToFrictionHash:Object = {};
private static var _kindToDensityHash:Object = {};
private static var _kindToStrengthHash:Object = {};
public function BlockDefinition(_arg1:String, _arg2:String, _arg3:Boolean, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number){
var _local9:XML;
super(_arg1, _arg2, _arg4, _arg5, _arg6, _arg7, _arg8);
_broken = _arg3;
if (_kindToFrictionHash[_arg1] === undefined){
_local9 = Managers.configManager.getBlockConfig(_arg1);
_kindToFrictionHash[_arg1] = Number(_local9.friction);
_kindToDensityHash[_arg1] = Number(_local9.density);
_kindToStrengthHash[_arg1] = Number(_local9.strength);
};
_friction = _kindToFrictionHash[_arg1];
_density = _kindToDensityHash[_arg1];
_strength = _kindToStrengthHash[_arg1];
if (_strength <= 0){
_strength = Number.MAX_VALUE;
};
}
public function get strength():Number{
return (_strength);
}
public function get density():Number{
return (_density);
}
public function get broken():Boolean{
return (_broken);
}
public function get isStatic():Boolean{
return ((_density == 0));
}
public function get friction():Number{
return (_friction);
}
}
}//package bb2.common
Section 117
//CharacterDefinition (bb2.common.CharacterDefinition)
package bb2.common {
public class CharacterDefinition extends TransformableItemDefinition {
private var _walkDistance:Number;
public function CharacterDefinition(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number){
var _local5:Number;
var _local6:Number;
switch (_arg1){
case GameItemKind.CHARACTER_OPPONENT:
_local5 = 30;
_local6 = 64;
break;
case GameItemKind.CHARACTER_MAN:
case GameItemKind.CHARACTER_WOMAN:
_local5 = 30;
_local6 = 48;
break;
};
super(_arg1, null, _arg2, _arg3, _local5, _local6, 0);
_walkDistance = _arg4;
}
public function get walkDistance():int{
return (_walkDistance);
}
}
}//package bb2.common
Section 118
//DemolitionToolDefinition (bb2.common.DemolitionToolDefinition)
package bb2.common {
import bb2.managers.*;
public class DemolitionToolDefinition extends GameItemDefinition {
protected var _delay:int;// = 2
protected var _blastPoints:Number;
private static var _kindToBlastPointsHash:Object = {};
public function DemolitionToolDefinition(_arg1:String, _arg2:Number, _arg3:Number){
var _local4:XML;
super(_arg1, null, _arg2, _arg3);
if (_kindToBlastPointsHash[_arg1] === undefined){
_local4 = Managers.configManager.getDemolitionToolConfig(_arg1);
_kindToBlastPointsHash[_arg1] = Number(_local4.blastPoints);
};
_blastPoints = _kindToBlastPointsHash[_arg1];
}
public function set x(_arg1:Number):void{
_x = _arg1;
}
public function set y(_arg1:Number):void{
_y = _arg1;
}
public function set delay(_arg1:int):void{
if (_arg1 < 1){
_arg1 = 1;
} else {
if (_arg1 > 4){
_arg1 = 4;
};
};
_delay = _arg1;
}
public function get delay():int{
return (_delay);
}
public function get blastPoints():Number{
return (_blastPoints);
}
}
}//package bb2.common
Section 119
//ExplosionDefinition (bb2.common.ExplosionDefinition)
package bb2.common {
public class ExplosionDefinition extends GameItemDefinition {
private var _explosiveKind:String;
public function ExplosionDefinition(_arg1:String, _arg2:Number, _arg3:Number){
super(GameItemKind.EXPLOSION_EFFECT, null, _arg2, _arg3);
_explosiveKind = _arg1;
}
public function get explosiveKind():String{
return (_explosiveKind);
}
}
}//package bb2.common
Section 120
//ExplosiveDefinition (bb2.common.ExplosiveDefinition)
package bb2.common {
import bb2.managers.*;
public class ExplosiveDefinition extends DemolitionToolDefinition {
private var _strength:Number;
private var _radius:Number;
private static var _kindToStrengthHash:Object = {};
private static var _kindToRadiusHash:Object = {};
public function ExplosiveDefinition(_arg1:String, _arg2:Number, _arg3:Number){
var _local4:XML;
super(_arg1, _arg2, _arg3);
if (_kindToRadiusHash[_arg1] === undefined){
_local4 = Managers.configManager.getDemolitionToolConfig(_arg1);
_kindToRadiusHash[_arg1] = Number(_local4.radius);
_kindToStrengthHash[_arg1] = Number(_local4.strength);
};
_radius = _kindToRadiusHash[_arg1];
_strength = _kindToStrengthHash[_arg1];
}
public function get strength():Number{
return (_strength);
}
public function get radius():Number{
return (_radius);
}
}
}//package bb2.common
Section 121
//FlippableToolDefinition (bb2.common.FlippableToolDefinition)
package bb2.common {
public class FlippableToolDefinition extends DemolitionToolDefinition {
private var _flipped:Boolean;// = false
public function FlippableToolDefinition(_arg1:String, _arg2:Number, _arg3:Number){
super(_arg1, _arg2, _arg3);
}
public function get flipped():Boolean{
return (_flipped);
}
public function flip():void{
_flipped = !(_flipped);
}
}
}//package bb2.common
Section 122
//GameItemDefinition (bb2.common.GameItemDefinition)
package bb2.common {
public class GameItemDefinition {
protected var _id:String;
protected var _superKind:String;
protected var _kind:String;
protected var _x:Number;
protected var _y:Number;
public function GameItemDefinition(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number){
_superKind = GameItemKind.getSuperKindFromKind(_arg1);
_kind = _arg1;
_id = _arg2;
_x = _arg3;
_y = _arg4;
}
public function get kind():String{
return (_kind);
}
public function get y():Number{
return (_y);
}
public function get id():String{
return (_id);
}
public function get superKind():String{
return (_superKind);
}
public function get x():Number{
return (_x);
}
public static function fromXML(_arg1:XML):GameItemDefinition{
var _local2:String = _arg1.@kind;
var _local3:String = GameItemKind.getSuperKindFromKind(_local2);
var _local4:XMLList = _arg1.params;
switch (_local3){
case GameItemKind.BLOCKS:
return (new BlockDefinition(_local2, _arg1.@id, false, _local4.@x, _local4.@y, _local4.@width, _local4.@height, ((Number(_local4.@rotation) / 180) * Math.PI)));
case GameItemKind.CHARACTERS:
return (new CharacterDefinition(_local2, _local4.@x, _local4.@y, _local4.@walkDistance));
case GameItemKind.HINT:
return (new GameItemDefinition(_local2, _arg1.@id, _local4.@x, _local4.@y));
case GameItemKind.CLEAN_ZONE:
return (new TransformableItemDefinition(_local2, _arg1.@id, _local4.@x, _local4.@y, _local4.@width, _local4.@height, 0));
};
throw (new Error(("Error creating GameItemDefinition for xml:\n" + _arg1.toXMLString())));
}
}
}//package bb2.common
Section 123
//GameItemKind (bb2.common.GameItemKind)
package bb2.common {
public class GameItemKind {
public static const BLOCK_STATIC:String = "block_static";
public static const CLEAN_ZONE:String = "helper_clean_zone";
public static const CHARACTER_MAN:String = "character_man";
public static const BLOCKS:String = "blocks";
public static const BLOCK_GLASS:String = "block_glass";
public static const HINT:String = "helper_hint";
public static const BLOCK_CONCRETE:String = "block_concrete";
public static const EXPL_AIR_STRIKE_BALL:String = "expl_air_strike_ball";
public static const EXPL_C4:String = "c4";
public static const TOOL_WRECKING_BALL:String = "tool_wrecking_ball";
public static const EXPLOSION_EFFECT:String = "explosion_effect";
public static const LASER:String = "laser";
public static const CHARACTER_WOMAN:String = "character_woman";
public static const DESTROYED_BLOCK:String = "destroyed_block";
public static const TOOL_UFO:String = "tool_ufo";
public static const ACID:String = "acid";
public static const BLOCK_WOOD:String = "block_wood";
public static const EXPLOSIVE:String = "explosive";
public static const EXPL_TNT:String = "tnt";
public static const CHARACTER_OPPONENT:String = "character_opponent";
public static const AIR_STRIKE_BALL:String = "air_strike_ball";
public static const BLOCK_STEEL:String = "block_steel";
public static const TOOL_ACID_BALLOON:String = "tool_acid_balloon";
public static const EXPL_NITROGLYCERIN:String = "nitroglycerin";
public static const ANTIMATTER_ATTRACTOR:String = "antimatter_attractor";
public static const CHARACTERS:String = "characters";
public static const EXPL_ANTIMATTER:String = "antimatter";
public static const TOOL_AIR_STRIKE:String = "tool_air_strike";
public static function getSuperKindFromKind(_arg1:String):String{
switch (_arg1){
case BLOCK_STATIC:
case BLOCK_GLASS:
case BLOCK_WOOD:
case BLOCK_CONCRETE:
case BLOCK_STEEL:
return (BLOCKS);
case CHARACTER_OPPONENT:
case CHARACTER_MAN:
case CHARACTER_WOMAN:
return (CHARACTERS);
case EXPL_TNT:
case EXPL_NITROGLYCERIN:
case EXPL_C4:
case EXPL_ANTIMATTER:
case EXPL_AIR_STRIKE_BALL:
return (EXPLOSIVE);
case ANTIMATTER_ATTRACTOR:
case HINT:
case CLEAN_ZONE:
case ACID:
case LASER:
case TOOL_ACID_BALLOON:
case TOOL_UFO:
case TOOL_WRECKING_BALL:
case TOOL_AIR_STRIKE:
case AIR_STRIKE_BALL:
case DESTROYED_BLOCK:
case EXPLOSION_EFFECT:
return (_arg1);
};
throw (new ArgumentError((("Kind \"" + _arg1) + "\" is not supported.")));
}
}
}//package bb2.common
Section 124
//IComponentIDSupplierView (bb2.common.IComponentIDSupplierView)
package bb2.common {
public interface IComponentIDSupplierView {
function get componentID():String;
}
}//package bb2.common
Section 125
//LaserDefinition (bb2.common.LaserDefinition)
package bb2.common {
public class LaserDefinition extends TransformableItemDefinition {
private var _flipped:Boolean;
public function LaserDefinition(_arg1:Number, _arg2:Number, _arg3:Boolean){
super(GameItemKind.LASER, null, _arg1, _arg2, 20, 6, 0);
_flipped = _arg3;
}
public function get flipped():Boolean{
return (_flipped);
}
}
}//package bb2.common
Section 126
//LevelInfo (bb2.common.LevelInfo)
package bb2.common {
import flash.geom.*;
import com.bigwigmedia.geom.*;
import com.bigwigmedia.utils.*;
public class LevelInfo {
public var levelCompleted:Boolean;// = false
private var _levelRect:Rectangle;
private var _adjacentBlocksIDHash:Object;
private var _xml:XML;
private var _itemsDefinitions:Array;
private static const UID_CHARS:Array = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "A", "B", "C", "D", "E", "F"];
public function LevelInfo(_arg1:XML){
if (!_arg1){
throw (new Error("XML config can't be null."));
};
_xml = _arg1;
}
public function get fullTitle():String{
var _local1:String = ((_xml.@title + ((String(_xml.@authorName))!="") ? (" By " + String(_xml.@authorName)) : "") + ((String(_xml.@authorEmail))!="") ? ((" (" + String(_xml.@authorEmail)) + ")") : "");
return (_local1);
}
public function get imported():Boolean{
return (((_xml.hasOwnProperty("@imported")) && ((_xml.@imported == "true"))));
}
public function get num():int{
return (_xml.@num);
}
public function get uid():String{
return (_xml.@uid);
}
public function get levelRect():Rectangle{
return (_levelRect);
}
public function get price():int{
return (_xml.@score);
}
public function get xml():XML{
return (_xml);
}
public function getAdjacentBlocksIDHash():Object{
var _local2:String;
var _local3:Array;
var _local4:Array;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:BlockDefinition;
var _local9:Rectangle;
var _local10:BlockDefinition;
var _local11:String;
var _local12:Rectangle;
var _local13:Point;
var _local14:Number;
var _local15:int;
var _local16:BlockDefinition;
var _local17:String;
var _local18:Rectangle;
var _local19:Point;
var _local20:Number;
var _local21:Array;
var _local22:Array;
if (!_adjacentBlocksIDHash){
_adjacentBlocksIDHash = {};
_local3 = getItemsDefinitions();
_local4 = [];
_local5 = _local3.length;
_local6 = 0;
while (_local6 < _local5) {
_local8 = (_local3[_local6] as BlockDefinition);
if (_local8){
_local4.push(_local8);
_local9 = GeomUtil.getAABB(_local8.rect, _local8.regPoint, _local8.rotation);
if (!_levelRect){
_levelRect = _local9;
} else {
_levelRect = _levelRect.union(_local9);
};
};
_local6++;
};
_local5 = _local4.length;
_local7 = 0;
while (_local7 < (_local5 - 1)) {
_local10 = _local4[_local7];
if (_local10.isStatic){
} else {
_local11 = _local10.id;
_local12 = _local10.rect;
_local13 = _local10.regPoint;
_local14 = _local10.rotation;
_local15 = (_local7 + 1);
while (_local15 < _local5) {
_local16 = _local4[_local15];
if (_local16.isStatic){
} else {
_local17 = _local16.id;
_local18 = _local16.rect;
_local19 = _local16.regPoint;
_local20 = _local16.rotation;
if (RectangleIntersection.intersects(_local12, _local13, _local14, _local18, _local19, _local20)){
_local21 = _adjacentBlocksIDHash[_local11];
if (!_local21){
_local21 = [];
_adjacentBlocksIDHash[_local11] = _local21;
};
if (_local21.indexOf(_local17) == -1){
_local21.push(_local17);
};
_local22 = _adjacentBlocksIDHash[_local17];
if (!_local22){
_local22 = [];
_adjacentBlocksIDHash[_local17] = _local22;
};
if (_local22.indexOf(_local11) == -1){
_local22.push(_local11);
};
};
};
_local15++;
};
};
_local7++;
};
};
var _local1:Object = {};
for (_local2 in _adjacentBlocksIDHash) {
_local1[_local2] = _adjacentBlocksIDHash[_local2].slice();
};
return (_local1);
}
public function get background():String{
var _local1:String = _xml.@background;
if (_local1 == BackgroundType.BACK_RANDOM){
return (BackgroundType.getRandom());
};
return (_local1);
}
public function getItemsDefinitions():Array{
var _local2:XML;
if (_itemsDefinitions){
return (_itemsDefinitions);
};
_itemsDefinitions = [];
var _local1:XMLList = _xml.items.children();
for each (_local2 in _local1) {
_itemsDefinitions.push(GameItemDefinition.fromXML(_local2));
};
return (_itemsDefinitions);
}
public function get title():String{
return (_xml.@title);
}
public function invalidate():void{
_adjacentBlocksIDHash = null;
_itemsDefinitions = null;
levelCompleted = false;
_levelRect = null;
_xml.@score = "0";
}
public static function createNew(_arg1:String, _arg2:String, _arg3:String):LevelInfo{
var _local4:XML = new XML((((((((((("<level uid=\"" + ??esc_xattr
) + "\" background=\"") + ??esc_xattr
) + "\" idCount=\"0\" score=\"1500\" title=\"") + ??esc_xattr
) + "\" authorName=\"") + ??esc_xattr
) + "\" authorEmail=\"") + ??esc_xattr
) + "\"/>"));
return (new LevelInfo(_local4));
}
private static function createUID():String{
var _local1 = "";
var _local2:int;
while (_local2 < 32) {
_local1 = (_local1 + UID_CHARS[int((Math.random() * 16))]);
_local2++;
};
var _local3:Number = new Date().getTime();
_local1 = (_local1 + ("-" + _local3.toString(16).toUpperCase().substr(-8)));
return (_local1);
}
}
}//package bb2.common
Section 127
//TransformableItemDefinition (bb2.common.TransformableItemDefinition)
package bb2.common {
import flash.geom.*;
public class TransformableItemDefinition extends GameItemDefinition {
protected var _width:Number;
protected var _height:Number;
protected var _rotation:Number;
public function TransformableItemDefinition(_arg1:String, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number){
super(_arg1, _arg2, _arg3, _arg4);
_width = _arg5;
_height = _arg6;
_rotation = _arg7;
}
public function get rect():Rectangle{
return (new Rectangle(_x, _y, _width, _height));
}
public function get width():Number{
return (_width);
}
public function get height():Number{
return (_height);
}
public function get regPoint():Point{
return (new Point((_width / 2), (_height / 2)));
}
public function get rotation():Number{
return (_rotation);
}
}
}//package bb2.common
Section 128
//WreckingBallDefinition (bb2.common.WreckingBallDefinition)
package bb2.common {
public class WreckingBallDefinition extends FlippableToolDefinition {
private var _radius:Number;
public function WreckingBallDefinition(_arg1:Number, _arg2:Number){
super(GameItemKind.TOOL_WRECKING_BALL, _arg1, _arg2);
_radius = 35;
}
public function get radius():Number{
return (_radius);
}
}
}//package bb2.common
Section 129
//ChannelID (bb2.constants.ChannelID)
package bb2.constants {
public class ChannelID {
public static const MISC_EFFECTS:String = "misc_effects";
}
}//package bb2.constants
Section 130
//SoundID (bb2.constants.SoundID)
package bb2.constants {
import com.bigwigmedia.utils.*;
public class SoundID {
public static const TAPPING_WAV:String = "tapping_wav";
public static const TRUMPETS_FANFAR_WAV:String = "trumpets_fanfar_wav";
public static const DRM_ROLL_CRASH_02_WAV:String = "drm_roll_crash_02_wav";
public static const BALOON_POP2_WAV:String = "baloon_pop2_wav";
public static const OUCH_4_WAV:String = "ouch_4_wav";
public static const OUCH_6_WAV:String = "ouch_6_wav";
public static const EXPLOSION_02_WAV:String = "explosion_02_wav";
public static const AIRCRAFT_PASS_01_WAV:String = "aircraft_pass_01_wav";
public static const GIRL_HIT_WAV:String = "girl_hit_wav";
public static const WRECKING_BALL_01_WAV:String = "wrecking_ball_01_wav";
public static const WRECKING_BALL_02_WAV:String = "wrecking_ball_02_wav";
public static const EXPLOSION_03_WAV:String = "explosion_03_wav";
public static const EXPLOSION_01_WAV:String = "explosion_01_wav";
public static const BUTTON_CLICK_WAV:String = "button_click_wav";
public static const LASER_01_WAV:String = "laser_01_wav";
public static const ACID_HISS_01_WAV:String = "acid_hiss_01_wav";
public static const UPGRADE_BUY_SFX:String = "upgrade_buy_sfx";
public static const CANCEL_SFX:String = "cancel_sfx";
public static const ROCK_BREAKER_01_WAV:String = "rock_breaker_01_wav";
public static const BEEP_01_WAV:String = "beep_01_wav";
private static var hitSoundSequence:Array;
private static var prevExplosionRand:int = -1;
private static var prevHitIndex:int = 0;
public static function reinitializeHitSounds():void{
if (!hitSoundSequence){
hitSoundSequence = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
};
hitSoundSequence = ArrayUtil.shuffle(hitSoundSequence);
}
public static function get HIT_BLOCKS():String{
var _local1:String = ("hit_" + hitSoundSequence[prevHitIndex++]);
if (prevHitIndex == 10){
prevHitIndex = 0;
};
return (_local1);
}
public static function get EXPLOSION():String{
var _local1:int = (Math.random() * 3);
while (true) {
_local1 = (Math.random() * 3);
if (_local1 != prevExplosionRand){
prevExplosionRand = _local1;
break;
};
};
var _local2 = (("explosion_0" + (_local1 + 1)) + "_wav");
return (_local2);
}
}
}//package bb2.constants
Section 131
//SOValues (bb2.constants.SOValues)
package bb2.constants {
public class SOValues {
public static const BUY_TOOL_HINT:String = "BUY_TOOL_HINT";
public static const USER_LEVELS_SCORE_HASH:String = "USER_LEVELS_SCORE_HASH";
public static const ACQUIRED_TOOLS:String = "ACQUIRED_TOOLS";
public static const LEVELS_SCORE_HASH:String = "LEVELS_SCORE_HASH";
public static const SOUND_ENABLED:String = "SOUND_ENABLED";
public static const USER_LEVEL_UIDS_LIST:String = "USER_LEVEL_UIDS_LIST";
public static const LEVELS_SAVED:String = "LEVELS_SAVED";
public static const TOTAL_SCORE_MINUS_LIST:String = "TOTAL_SCORE_MINUS_LIST";
public static const LEVEL_REACHED:String = "LEVEL_REACHED";
public static const CHANGE_TOOL_HINT:String = "CHANGE_TOOL_HINT";
}
}//package bb2.constants
Section 132
//MainController (bb2.core.MainController)
package bb2.core {
import com.bigwigmedia.stateMachine.*;
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import com.bigwigmedia.ui.*;
import bb2.managers.*;
import flash.events.*;
import com.bigwigmedia.mvc.*;
import bb2.editorLevelSelection.*;
import bb2.game.*;
import bb2.editor.*;
import bb2.mainMenu.*;
import bb2.instructions.*;
import bb2.gameComplete.*;
import bb2.levelSelection.*;
import com.bigwigmedia.core.*;
import com.bigwigmedia.transitions.*;
public class MainController extends EventDispatcher implements IController {
private var _view:Sprite;
private var _subController:IController;
private var _stateMachine:IStateMachine;
private var _subControllerClass:Class;
public function MainController(){
Console.initialize([67, 79, 78, 83, 79, 76, 69]);
_view = new Sprite();
Managers.initialize(onManagersInitCallback);
}
private function showInstructions(_arg1:AbstractEvent):void{
beginTransitionEffect(InstructionsController);
}
private function isPlayingLastLevel():Boolean{
return (Managers.levelProgressService.isPlayedLastLevel());
}
private function beginTransitionEffect(_arg1:Class):void{
_subControllerClass = _arg1;
Globals.application.startTransition(new BlackoutTransition(250, createSubController));
}
private function showEditor(_arg1:AbstractEvent):void{
beginTransitionEffect(EditorController);
}
private function showEditorLevelSelection(_arg1:AbstractEvent):void{
beginTransitionEffect(EditorLevelSelectionController);
}
private function showMainMenu(_arg1:AbstractEvent):void{
beginTransitionEffect(MainMenuController);
}
private function showGame(_arg1:AbstractEvent):void{
beginTransitionEffect(GameController);
}
public function dispose():void{
throw (new Error("Can't dispose MainController"));
}
private function createSubController():void{
if (_subController){
_view.removeChild(_subController.view);
_subController.removeEventListener(ControllerEvent.COMPLETE, onControllerCompleteHandler);
_subController.dispose();
_subController = null;
};
_subController = new _subControllerClass();
_subController.addEventListener(ControllerEvent.COMPLETE, onControllerCompleteHandler);
_view.addChild(_subController.view);
}
public function get view():DisplayObject{
return (_view);
}
private function showGameComplete(_arg1:AbstractEvent):void{
beginTransitionEffect(GameCompleteController);
}
private function levelSelection(_arg1:AbstractEvent):void{
Managers.levelProgressService.selectedUserLevelUID = null;
beginTransitionEffect(LevelSelectionController);
}
private function isPlayingUserLevel():Boolean{
return (Managers.levelProgressService.isPlayingUserLevel());
}
private function onControllerCompleteHandler(_arg1:ControllerEvent):void{
_stateMachine.sendSignal(String(_arg1.data));
}
private function onManagersInitCallback():void{
_stateMachine = new FSM();
var _local1:AbstractState = _stateMachine.addState(new InitialState());
var _local2:AbstractState = _stateMachine.addState(new SimpleState(showMainMenu));
var _local3:AbstractState = _stateMachine.addState(new SimpleState(showInstructions));
var _local4:AbstractState = _stateMachine.addState(new SimpleState(showEditorLevelSelection));
var _local5:AbstractState = _stateMachine.addState(new SimpleState(showEditor));
var _local6:AbstractState = _stateMachine.addState(new SimpleState(levelSelection));
var _local7:AbstractState = _stateMachine.addState(new SimpleState(showGame));
var _local8:AbstractState = _stateMachine.addState(new ChoiceState());
var _local9:AbstractState = _stateMachine.addState(new ChoiceState());
var _local10:AbstractState = _stateMachine.addState(new SimpleState(showGameComplete));
_local1.addTransition(_local2);
_local2.addTransition(_local3, new SignalTrigger(MainSignal.SHOW_INSTRUCTIONS));
_local3.addTransition(_local2, new SignalTrigger(MainSignal.SHOW_MAIN_MENU));
_local2.addTransition(_local4, new SignalTrigger(MainSignal.SHOW_LEVEL_SELECTION));
_local4.addTransition(_local2, new SignalTrigger(MainSignal.SHOW_MAIN_MENU));
_local4.addTransition(_local5, new SignalTrigger(MainSignal.SHOW_EDITOR));
_local4.addTransition(_local7, new SignalTrigger(MainSignal.START));
_local5.addTransition(_local4, new SignalTrigger(MainSignal.SHOW_LEVEL_SELECTION));
_local5.addTransition(_local7, new SignalTrigger(MainSignal.START));
_local7.addTransition(_local9, new SignalTrigger(MainSignal.REPLAY_LEVEL));
_local7.addTransition(_local2, new SignalTrigger(MainSignal.SHOW_MAIN_MENU));
_local7.addTransition(_local8, new SignalTrigger(MainSignal.SHOW_LEVEL_SELECTION));
_local7.addTransition(_local5, new SignalTrigger(MainSignal.SHOW_EDITOR));
_local8.addTransition(_local4, null, null, isPlayingUserLevel);
_local8.addTransition(_local6);
_local2.addTransition(_local6, new SignalTrigger(MainSignal.START));
_local6.addTransition(_local7, new SignalTrigger(MainSignal.START));
_local6.addTransition(_local2, new SignalTrigger(MainSignal.SHOW_MAIN_MENU));
_local6.addTransition(_local6, new SignalTrigger(MainSignal.RESET_GAME));
_local9.addTransition(_local10, null, null, isPlayingLastLevel);
_local9.addTransition(_local7);
_local10.addTransition(_local2, new SignalTrigger(MainSignal.SHOW_MAIN_MENU));
_stateMachine.start();
}
}
}//package bb2.core
Section 133
//MainSignal (bb2.core.MainSignal)
package bb2.core {
public class MainSignal {
public static const START:String = "START";
public static const SHOW_MAIN_MENU:String = "SHOW_MAIN_MENU";
public static const SHOW_INSTRUCTIONS:String = "SHOW_INSTRUCTIONS";
public static const REPLAY_LEVEL:String = "REPLAY_LEVEL";
public static const SHOW_LEVEL_SELECTION:String = "SHOW_LEVEL_SELECTION";
public static const NEXT_DAY:String = "NEXT_DAY";
public static const SHOW_EDITOR:String = "SHOW_EDITOR";
public static const WIN_GAME:String = "WIN_GAME";
public static const QUIT:String = "QUIT";
public static const RESET_GAME:String = "RESET_GAME";
}
}//package bb2.core
Section 134
//BaseEditorEntity (bb2.editor.entities.BaseEditorEntity)
package bb2.editor.entities {
import com.bigwigmedia.mvc.events.*;
import com.bigwigmedia.mvc.*;
public class BaseEditorEntity extends Entity {
protected var _kind:String;
protected var _height:Number;// = 0
protected var _width:Number;// = 0
protected var _id:String;
protected var _rotation:Number;// = 0
protected var _rotatable:Boolean;
protected var _locked:Boolean;// = false
protected var _x:Number;// = 0
protected var _y:Number;// = 0
protected var _scalable:Boolean;
public static const POSITION_STEP:Number = 4;
public static const SIZE_STEP:Number = 8;
public static const MAX_SIZE:Number = 640;
public static const MIN_SIZE:Number = 16;
public function BaseEditorEntity(_arg1:String, _arg2:String, _arg3:Boolean, _arg4:Boolean){
_kind = _arg1;
_id = _arg2;
_scalable = _arg3;
_rotatable = _arg4;
}
public function get y():Number{
return (_y);
}
public function get width():Number{
return (_width);
}
public function get locked():Boolean{
return (_locked);
}
public function set width(_arg1:Number):void{
if (!_scalable){
return;
};
_width = (SIZE_STEP * int((_arg1 / SIZE_STEP)));
if (_width < MIN_SIZE){
_width = MIN_SIZE;
} else {
if (_width > MAX_SIZE){
_width = MAX_SIZE;
};
};
dispatchEvent(new EntityEvent(EntityEvent.UPDATE));
}
public function get kind():String{
return (_kind);
}
public function set height(_arg1:Number):void{
if (!_scalable){
return;
};
_height = (SIZE_STEP * int((_arg1 / SIZE_STEP)));
if (_height < MIN_SIZE){
_height = MIN_SIZE;
} else {
if (_height > MAX_SIZE){
_height = MAX_SIZE;
};
};
dispatchEvent(new EntityEvent(EntityEvent.UPDATE));
}
public function get id():String{
return (_id);
}
public function toXML():XML{
var _local1:XML = new XML((((((("<item kind=\"" + ??esc_xattr
) + "\" id=\"") + ??esc_xattr
) + "\">\r\n\t\t\t\t") + (((("<params x=\"" + ??esc_xattr
) + "\" y=\"") + ??esc_xattr
) + "\"/>")) + "\r\n\t\t\t</item>"));
if (_scalable){
_local1.params.@width = _width;
_local1.params.@height = _height;
};
if (_rotatable){
_local1.params.@rotation = _rotation;
};
return (_local1);
}
public function set y(_arg1:Number):void{
_y = (POSITION_STEP * Math.round((_arg1 / POSITION_STEP)));
dispatchEvent(new EntityEvent(EntityEvent.UPDATE));
}
public function set locked(_arg1:Boolean):void{
_locked = _arg1;
}
public function get scalable():Boolean{
return (_scalable);
}
public function get height():Number{
return (_height);
}
public function get rotatable():Boolean{
return (_rotatable);
}
override public function toString():String{
return (((kind + "_") + _id));
}
public function set x(_arg1:Number):void{
_x = (POSITION_STEP * Math.round((_arg1 / POSITION_STEP)));
dispatchEvent(new EntityEvent(EntityEvent.UPDATE));
}
public function get x():Number{
return (_x);
}
public function set rotation(_arg1:Number):void{
if (!_rotatable){
return;
};
_rotation = int(_arg1);
dispatchEvent(new EntityEvent(EntityEvent.UPDATE));
}
public function get rotation():Number{
return (_rotation);
}
}
}//package bb2.editor.entities
Section 135
//CharacterEntity (bb2.editor.entities.CharacterEntity)
package bb2.editor.entities {
public class CharacterEntity extends BaseEditorEntity {
private var _walkDistance:Number;
public static const MAX_WALK_DISTANCE:Number = 0x0200;
public static const WALK_DISTANCE_STEP:Number = 8;
public function CharacterEntity(_arg1:String, _arg2:String, _arg3:Number){
super(_arg1, _arg2, false, false);
_walkDistance = _arg3;
}
override public function toXML():XML{
var _local1:XML = new XML((((("<item kind=\"" + ??esc_xattr
) + "\">\r\n\t\t\t\t") + (((((("<params x=\"" + ??esc_xattr
) + "\" y=\"") + ??esc_xattr
) + "\" walkDistance=\"") + ??esc_xattr
) + "\"/>")) + "\r\n\t\t\t</item>"));
return (_local1);
}
public function set walkDistance(_arg1:int):void{
var _local2:int = ((_arg1 > 0)) ? 1 : -1;
var _local3:Number = Math.abs(_arg1);
_local3 = (WALK_DISTANCE_STEP * int((_local3 / WALK_DISTANCE_STEP)));
if (_local3 > MAX_WALK_DISTANCE){
_local3 = MAX_WALK_DISTANCE;
};
_walkDistance = ((_local2 == 1)) ? _local3 : -(_local3);
}
public function get walkDistance():int{
return (_walkDistance);
}
}
}//package bb2.editor.entities
Section 136
//EntityGeom (bb2.editor.entities.EntityGeom)
package bb2.editor.entities {
public class EntityGeom {
private var _entity:BaseEditorEntity;
public var width:Number;
public var height:Number;
public var x:Number;
public var y:Number;
public var rotation:Number;
public function EntityGeom(_arg1:BaseEditorEntity){
_entity = _arg1;
update();
}
public function update():void{
x = _entity.x;
y = _entity.y;
width = _entity.width;
height = _entity.height;
rotation = _entity.rotation;
}
public function dispose():void{
_entity = null;
}
}
}//package bb2.editor.entities
Section 137
//HintEntity (bb2.editor.entities.HintEntity)
package bb2.editor.entities {
public class HintEntity extends BaseEditorEntity {
private var _text:String;
public function HintEntity(_arg1:String, _arg2:String, _arg3:String){
super(_arg1, _arg2, false, false);
_text = _arg3;
}
public function set text(_arg1:String):void{
_text = _arg1;
}
override public function toXML():XML{
var _local1:XML = new XML((((("<item kind=\"" + ??esc_xattr
) + "\">\r\n\t\t\t\t") + (((((("<params x=\"" + ??esc_xattr
) + "\" y=\"") + ??esc_xattr
) + "\" text=\"") + ??esc_xattr
) + "\"/>")) + "\r\n\t\t\t</item>"));
return (_local1);
}
public function get text():String{
return (_text);
}
}
}//package bb2.editor.entities
Section 138
//ItemViewEvent (bb2.editor.events.ItemViewEvent)
package bb2.editor.events {
import flash.events.*;
public class ItemViewEvent extends Event {
public static const TOGGLE:String = "ItemViewEvent.toggle";
public static const SELECT:String = "ItemViewEvent.select";
public function ItemViewEvent(_arg1:String, _arg2:Boolean=false){
super(_arg1, _arg2);
}
override public function toString():String{
return (formatToString("ItemViewEvent", "type", "bubbles"));
}
override public function clone():Event{
return (new ItemViewEvent(type, bubbles));
}
}
}//package bb2.editor.events
Section 139
//TransformToolEvent (bb2.editor.events.TransformToolEvent)
package bb2.editor.events {
import flash.events.*;
public class TransformToolEvent extends Event {
private var _data:Object;
public static const MULTI_SELECTION_END:String = "TransformToolEvent.multiSelectionEnd";
public static const DELETE:String = "TransformToolEvent.delete";
public static const TRANSFORM:String = "TransformToolEvent.transform";
public function TransformToolEvent(_arg1:String, _arg2:Object=null){
super(_arg1);
_data = _arg2;
}
public function get data():Object{
return (_data);
}
override public function clone():Event{
return (new TransformToolEvent(type, _data));
}
}
}//package bb2.editor.events
Section 140
//ToolMultiButton (bb2.editor.ui.ToolMultiButton)
package bb2.editor.ui {
import com.bigwigmedia.ui.controls.*;
import flash.events.*;
public class ToolMultiButton extends SkinnedButton {
public var selectionDialog:String;// = null
public static const SHOW_TOOL_SELECTION_EVENT:String = "SHOW_TOOL_SELECTION_EVENT";
public function ToolMultiButton(){
_toggle = true;
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler);
}
override protected function mouseClicked():void{
if (mouseClickHandler != null){
mouseClickHandler(this);
};
if (!_selected){
selected = true;
};
}
private function onMouseDownHandler(_arg1:MouseEvent):void{
if (((_selected) && (selectionDialog))){
dispatchEvent(new Event(SHOW_TOOL_SELECTION_EVENT, true));
};
}
}
}//package bb2.editor.ui
Section 141
//ToolSelectionDialog (bb2.editor.ui.ToolSelectionDialog)
package bb2.editor.ui {
import com.bigwigmedia.ui.controls.*;
import flash.events.*;
import com.bigwigmedia.mvc.*;
import bb2.common.*;
import com.bigwigmedia.core.*;
public class ToolSelectionDialog extends DialogView implements IComponentIDSupplierView {
private var _selectedIcon:Class;
private var _relatedButton:ToolMultiButton;
public function ToolSelectionDialog(_arg1:ToolMultiButton){
_relatedButton = _arg1;
Globals.stage.addEventListener(MouseEvent.MOUSE_UP, onStageMouseUpHandler);
super();
}
public function get componentID():String{
return (relatedButton.selectionDialog);
}
private function onStageMouseUpHandler(_arg1:MouseEvent):void{
var _local2:SkinnedButton = (_arg1.target as SkinnedButton);
if (_local2){
_selectedIcon = _local2.getStyle("icon");
dispatchCloseEvent(_local2.value);
} else {
dispatchCloseEvent(null);
};
}
override public function dispose():void{
Globals.stage.removeEventListener(MouseEvent.MOUSE_UP, onStageMouseUpHandler);
_relatedButton = null;
_selectedIcon = null;
super.dispose();
}
public function get selectedIcon():Class{
return (_selectedIcon);
}
public function get relatedButton():ToolMultiButton{
return (_relatedButton);
}
}
}//package bb2.editor.ui
Section 142
//AbstractItemView (bb2.editor.views.AbstractItemView)
package bb2.editor.views {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import bb2.editor.events.*;
import flash.events.*;
import bb2.editor.entities.*;
import com.bigwigmedia.core.*;
public class AbstractItemView extends Sprite implements IDisposable {
protected var _entity:BaseEditorEntity;
public function AbstractItemView(_arg1:BaseEditorEntity){
_entity = _arg1;
_entity.addEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
this.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler);
}
private function onMouseDownHandler(_arg1:MouseEvent):void{
if (_arg1.shiftKey){
dispatchEvent(new ItemViewEvent(ItemViewEvent.TOGGLE, true));
} else {
dispatchEvent(new ItemViewEvent(ItemViewEvent.SELECT, true));
};
}
public function dispose():void{
this.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler);
_entity.removeEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
_entity = null;
}
public function get entity():BaseEditorEntity{
return (_entity);
}
protected function onEntityUpdate():void{
}
private function onEntityUpdateHandler(_arg1:EntityEvent):void{
onEntityUpdate();
}
}
}//package bb2.editor.views
Section 143
//BlockView (bb2.editor.views.BlockView)
package bb2.editor.views {
import flash.display.*;
import bb2.common.*;
import bb2.editor.entities.*;
public class BlockView extends AbstractItemView {
private var _sprite:Sprite;
public function BlockView(_arg1:BaseEditorEntity){
super(_arg1);
_sprite = new Sprite();
addChild(_sprite);
draw();
}
override protected function onEntityUpdate():void{
draw();
}
private function draw():void{
if (_sprite.numChildren != 0){
_sprite.removeChildAt(0);
};
var _local1:Bitmap = BlockBitmapFactory.create(_entity.kind, _entity.width, _entity.height, false);
_local1.x = (-(_entity.width) / 2);
_local1.y = (-(_entity.height) / 2);
_sprite.addChild(_local1);
this.x = _entity.x;
this.y = _entity.y;
_sprite.rotation = _entity.rotation;
}
}
}//package bb2.editor.views
Section 144
//CharacterView (bb2.editor.views.CharacterView)
package bb2.editor.views {
import flash.display.*;
import com.bigwigmedia.ui.controls.*;
import flash.events.*;
import bb2.common.*;
import flash.geom.*;
import bb2.editor.entities.*;
import assets.*;
public class CharacterView extends AbstractItemView {
private var _sprite:Sprite;
private var _walkDistanceButton:SkinnedButton;
private var _charEntity:CharacterEntity;
public function CharacterView(_arg1:BaseEditorEntity){
super(_arg1);
_charEntity = CharacterEntity(_entity);
switch (_arg1.kind){
case GameItemKind.CHARACTER_OPPONENT:
_sprite = new OpponentEditorIcon();
break;
case GameItemKind.CHARACTER_MAN:
_sprite = new ManEditorIcon();
break;
case GameItemKind.CHARACTER_WOMAN:
_sprite = new WomanEditorIcon();
break;
};
addChild(_sprite);
_walkDistanceButton = new SkinnedButton();
_walkDistanceButton.setInstanceStyle("upSkin", ExplosiveControlButtonSkin);
addChild(_walkDistanceButton);
_walkDistanceButton.x = (_charEntity.walkDistance - 10);
_walkDistanceButton.y = -10;
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler);
draw();
}
private function onMouseDownHandler(_arg1:MouseEvent):void{
if (_arg1.target == _walkDistanceButton){
stage.addEventListener(MouseEvent.MOUSE_MOVE, onStageMouseMoveHandler);
stage.addEventListener(MouseEvent.MOUSE_UP, onStageMouseUpHandler);
};
}
private function onStageMouseUpHandler(_arg1:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, onStageMouseMoveHandler);
stage.removeEventListener(MouseEvent.MOUSE_UP, onStageMouseUpHandler);
}
private function draw():void{
_walkDistanceButton.x = (_charEntity.walkDistance - 10);
if (_charEntity.walkDistance < 0){
_walkDistanceButton.setInstanceStyle("icon", ArrowLeftIcon);
} else {
if (_charEntity.walkDistance > 0){
_walkDistanceButton.setInstanceStyle("icon", ArrowRightIcon);
} else {
_walkDistanceButton.setInstanceStyle("icon", AnchorIcon);
};
};
_sprite.scaleX = ((_charEntity.walkDistance > 0)) ? -1 : 1;
this.x = _entity.x;
this.y = _entity.y;
}
override protected function onEntityUpdate():void{
draw();
}
private function onStageMouseMoveHandler(_arg1:MouseEvent):void{
var _local2:Point = new Point(_arg1.stageX, _arg1.stageY);
_local2 = this.globalToLocal(_local2);
_charEntity.walkDistance = _local2.x;
draw();
}
override public function dispose():void{
super.dispose();
removeChild(_walkDistanceButton);
_walkDistanceButton.dispose();
_walkDistanceButton = null;
}
}
}//package bb2.editor.views
Section 145
//CleanZoneView (bb2.editor.views.CleanZoneView)
package bb2.editor.views {
import flash.display.*;
import bb2.editor.entities.*;
import assets.*;
public class CleanZoneView extends AbstractItemView {
private var _sprite:Sprite;
private static const RED_TEXTURE:BitmapData = new CleanZoneRedTexture(0, 0);
public function CleanZoneView(_arg1:BaseEditorEntity){
super(_arg1);
_sprite = new Sprite();
addChild(_sprite);
draw();
}
override protected function onEntityUpdate():void{
draw();
}
private function draw():void{
var _local1:Graphics = _sprite.graphics;
_local1.clear();
_local1.lineStyle(2, 0);
_local1.beginBitmapFill(RED_TEXTURE);
_local1.drawRoundRect((-(_entity.width) / 2), (-(_entity.height) / 2), _entity.width, _entity.height, 8, 8);
_local1.endFill();
this.x = _entity.x;
this.y = _entity.y;
}
}
}//package bb2.editor.views
Section 146
//HintView (bb2.editor.views.HintView)
package bb2.editor.views {
import bb2.editor.entities.*;
public class HintView extends AbstractItemView {
public function HintView(_arg1:BaseEditorEntity){
super(_arg1);
this.x = _arg1.x;
this.y = _arg1.y;
graphics.clear();
graphics.lineStyle(2, 0);
graphics.beginFill(0xFFFFFF, 1);
graphics.drawRect(-10, -10, 20, 20);
graphics.endFill();
}
override protected function onEntityUpdate():void{
this.x = entity.x;
this.y = entity.y;
}
}
}//package bb2.editor.views
Section 147
//EditorController (bb2.editor.EditorController)
package bb2.editor {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import bb2.managers.*;
import bb2.editor.events.*;
import bb2.editor.views.*;
import flash.events.*;
import com.bigwigmedia.mvc.*;
import flash.geom.*;
import bb2.editor.entities.*;
import bb2.core.*;
public class EditorController extends EventDispatcher implements IController {
private var _prevTargetWidth:Number;// = 16
private var _view:EditorView;
private var _prevTargetHeight:Number;// = 64
private var _prevTargetRotation:Number;// = 0
private var _transformTool:TransformTool;
private var _model:EditorModel;
public function EditorController(){
_model = new EditorModel();
_view = new EditorView(this);
_transformTool = new TransformTool(_view.transformToolSprite, _view.itemsHolder);
_transformTool.addEventListener(TransformToolEvent.MULTI_SELECTION_END, onMultiSelectionEndHandler);
_transformTool.addEventListener(TransformToolEvent.TRANSFORM, onTransformHandler);
_transformTool.addEventListener(TransformToolEvent.DELETE, onDeleteHandler);
_model.addEventListener(EntityEvent.ADDED, onModelChildAddedHandler);
_model.load(Managers.levelProgressService.getLevelInfo());
}
private function onDeleteHandler(_arg1:TransformToolEvent):void{
var _local2:AbstractItemView = AbstractItemView(_arg1.data);
_model.removeChild(_local2.entity);
_view.removeItemView(_local2);
}
public function toggleItem(_arg1:AbstractItemView):void{
if (_transformTool.isTarget(_arg1)){
_transformTool.removeTarget(_arg1);
} else {
_transformTool.addTarget(_arg1);
};
}
public function updateZoom():void{
_transformTool.update();
}
private function onTransformHandler(_arg1:TransformToolEvent):void{
var _local2:Object = _arg1.data;
if (("rotation" in _local2)){
_prevTargetRotation = _local2.rotation;
};
if (((("width" in _local2)) && (("height" in _local2)))){
_prevTargetWidth = _local2.width;
_prevTargetHeight = _local2.height;
};
}
public function beginMultiSelection():void{
_transformTool.beginMultiSelection();
}
public function exit():void{
save();
dispatchEvent(new ControllerEvent(ControllerEvent.COMPLETE, MainSignal.SHOW_LEVEL_SELECTION));
}
public function dispose():void{
_transformTool.dispose();
_transformTool = null;
_model.removeEventListener(EntityEvent.ADDED, onModelChildAddedHandler);
_model.dispose();
_view.dispose();
}
private function onMultiSelectionEndHandler(_arg1:TransformToolEvent):void{
var _local4:AbstractItemView;
var _local2:Rectangle = Rectangle(_arg1.data);
var _local3:Array = _view.getViewsUnderRect(_local2);
for each (_local4 in _local3) {
_transformTool.addTarget(_local4);
};
}
public function get view():DisplayObject{
return (_view);
}
public function selectItem(_arg1:AbstractItemView):void{
if (!_transformTool.isTarget(_arg1)){
_transformTool.removeAll();
_transformTool.addTarget(_arg1);
};
}
public function play():void{
save();
dispatchEvent(new ControllerEvent(ControllerEvent.COMPLETE, MainSignal.START));
}
public function createNewItem(_arg1:Number, _arg2:Number):void{
var _local3:Object = {x:_arg1, y:_arg2, width:_prevTargetWidth, height:_prevTargetHeight, rotation:_prevTargetRotation};
_model.createNewItem(_view.selectedToolKind, _local3);
}
private function onModelChildAddedHandler(_arg1:EntityEvent):void{
_view.addItemView(BaseEditorEntity(_arg1.target));
}
private function save():void{
_model.save(Managers.levelProgressService.getLevelInfo());
Managers.levelProgressService.saveSelectedUserLevel();
}
}
}//package bb2.editor
Section 148
//EditorHelpDialog (bb2.editor.EditorHelpDialog)
package bb2.editor {
import flash.display.*;
import com.bigwigmedia.ui.*;
import com.bigwigmedia.mvc.*;
import assets.*;
public class EditorHelpDialog extends DialogView {
private var _pagesClip:MovieClip;
private var _currentPage:int;// = 0
public function EditorHelpDialog(){
_pagesClip = MovieClip(addChildAt(new EditorHelpPagesClip(), 0));
_pagesClip.stop();
navigatePage(0);
}
private function navigatePage(_arg1:int):void{
_currentPage = (_currentPage + _arg1);
if (_currentPage < 0){
_currentPage = 0;
} else {
if (_currentPage > (_pagesClip.totalFrames - 1)){
_currentPage = (_pagesClip.totalFrames - 1);
};
};
_pagesClip.gotoAndStop((_currentPage + 1));
getComponentByName("backButton").visible = (_currentPage > 0);
getComponentByName("nextButton").visible = (_currentPage < (_pagesClip.totalFrames - 1));
}
override protected function onComponentClick(_arg1:Component):void{
switch (_arg1.name){
case "backButton":
navigatePage(-1);
break;
case "nextButton":
navigatePage(1);
break;
case "closeButton":
dispatchCloseEvent();
break;
};
}
}
}//package bb2.editor
Section 149
//EditorModel (bb2.editor.EditorModel)
package bb2.editor {
import com.bigwigmedia.mvc.*;
import bb2.common.*;
import bb2.editor.entities.*;
public class EditorModel extends EntityContainer {
private var _idCount:int;
public function save(_arg1:LevelInfo):void{
var _local6:BaseEditorEntity;
var _local2:XML = _arg1.xml;
_local2.@idCount = _idCount;
delete _local2.items;
delete _local2.goal;
var _local3:XML = <items/>
;
var _local4:int = numChildren;
var _local5:int;
while (_local5 < _local4) {
_local6 = _children[_local5];
_local3.appendChild(_local6.toXML());
_local5++;
};
_local2.appendChild(_local3);
_arg1.invalidate();
}
public function load(_arg1:LevelInfo):void{
var _local4:XML;
var _local5:BaseEditorEntity;
var _local2:XML = _arg1.xml;
_idCount = _local2.@idCount;
var _local3:XMLList = _local2.items.children();
for each (_local4 in _local3) {
_local5 = EntitiesFactory.fromXML(_local4);
addChild(_local5);
};
}
public function createNewItem(_arg1:String, _arg2:Object):void{
var _local4:String;
var _local3:BaseEditorEntity = EntitiesFactory.create(_arg1, String(_idCount++));
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
addChild(_local3);
}
}
}//package bb2.editor
Section 150
//EditorView (bb2.editor.EditorView)
package bb2.editor {
import flash.display.*;
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import bb2.editor.events.*;
import bb2.editor.views.*;
import com.bigwigmedia.events.*;
import flash.events.*;
import com.bigwigmedia.mvc.*;
import bb2.common.*;
import flash.geom.*;
import bb2.editor.entities.*;
import bb2.editor.ui.*;
import assets.*;
import com.bigwigmedia.ui.controls.scrollClasses.*;
public class EditorView extends DialogOwnerView {
private var _transformToolSprite:Sprite;
private var _itemsHolder:Sprite;
private var _toggleButtons:Array;
private var _background:MovieClip;
private var _sprite:Sprite;
private var _selectedTool:String;// = null
private var _controller:EditorController;
public static const BLOCKS_TOOL:String = "BLOCKS_TOOL";
public static const HELPERS_TOOL:String = "HELPERS_TOOL";
public static const TRANSFORM_TOOL:String = "TRANSFORM_TOOL";
public static const SPECIALS_TOOL:String = "SPECIALS_TOOL";
public function EditorView(_arg1:EditorController){
_toggleButtons = [];
super();
_controller = _arg1;
_sprite = new Sprite();
addChildAt(_sprite, 0);
_background = new LevelBackground();
_background.stop();
addChildAt(_background, 0);
_itemsHolder = new Sprite();
_sprite.addChild(_itemsHolder);
_itemsHolder.graphics.lineStyle(2, 0xFF0000);
_itemsHolder.graphics.beginFill(0xFF0000, 0.5);
_itemsHolder.graphics.drawRect(-1000, 404, 2640, 72);
_itemsHolder.graphics.endFill();
_transformToolSprite = new Sprite();
_sprite.addChild(_transformToolSprite);
_toggleButtons.push(getComponentByName("transformToolButton"), getComponentByName("blocksToolButton"), getComponentByName("specialsToolButton"), getComponentByName("helpersToolButton"));
_sprite.addEventListener(ItemViewEvent.SELECT, onItemViewEventHandler);
_sprite.addEventListener(ItemViewEvent.TOGGLE, onItemViewEventHandler);
_background.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler);
_sprite.addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler);
addEventListener(SliderEvent.CHANGE, onSliderChangeReleaseHandler);
addEventListener(ScrollEvent.SCROLL, onScrollHandler);
addEventListener(ToolMultiButton.SHOW_TOOL_SELECTION_EVENT, onShowToolSelectionHandler);
}
public function getViewsUnderRect(_arg1:Rectangle):Array{
var _local5:DisplayObject;
var _local6:Rectangle;
var _local2:Array = [];
var _local3:int = _itemsHolder.numChildren;
var _local4:int;
while (_local4 < _local3) {
_local5 = _itemsHolder.getChildAt(_local4);
_local6 = _local5.getBounds(_sprite);
if (_local6.intersects(_arg1)){
_local2.push(_local5);
};
_local4++;
};
return (_local2);
}
private function onItemViewEventHandler(_arg1:ItemViewEvent):void{
var _local2:AbstractItemView = AbstractItemView(_arg1.target);
if (_selectedTool == TRANSFORM_TOOL){
if (_arg1.type == ItemViewEvent.SELECT){
_controller.selectItem(_local2);
} else {
if (_arg1.type == ItemViewEvent.TOGGLE){
_controller.toggleItem(_local2);
};
};
};
}
public function get transformToolSprite():Sprite{
return (_transformToolSprite);
}
public function get itemsHolder():Sprite{
return (_itemsHolder);
}
override protected function onComponentClick(_arg1:Component):void{
var _local2:String = _arg1.name;
switch (_local2){
case "transformToolButton":
setTool(TRANSFORM_TOOL, _local2);
break;
case "blocksToolButton":
setTool(BLOCKS_TOOL, _local2);
break;
case "specialsToolButton":
setTool(SPECIALS_TOOL, _local2);
break;
case "helpersToolButton":
setTool(HELPERS_TOOL, _local2);
break;
case "helpButton":
showDialog(new EditorHelpDialog());
break;
case "playButton":
_controller.play();
break;
case "exitButton":
_controller.exit();
break;
};
}
private function onSliderChangeReleaseHandler(_arg1:SliderEvent):void{
var _local2:Number;
var _local3:ScrollBar;
var _local4:ScrollBar;
if (_arg1.target.name == "zoomSlider"){
_local2 = (_arg1.value / 100);
_itemsHolder.scaleX = (_itemsHolder.scaleY = _local2);
_local3 = ScrollBar(getComponentByName("vScrollBar"));
_local4 = ScrollBar(getComponentByName("hScrollBar"));
_local3.minScrollPosition = (_local4.minScrollPosition = (-500 * _local2));
_local3.maxScrollPosition = (_local4.maxScrollPosition = (500 * _local2));
_local3.pageSize = (_local4.pageSize = (100 / _local2));
_itemsHolder.x = (320 - (320 * _local2));
_itemsHolder.y = (240 - (240 * _local2));
_controller.updateZoom();
Label(getComponentByName("zoomValueLabel")).text = (String(_arg1.value) + "%");
};
}
public function get selectedToolKind():String{
var _local1:AbstractButton;
for each (_local1 in _toggleButtons) {
if (_local1.selected){
return (_local1.value);
};
};
return (null);
}
public function addItemView(_arg1:BaseEditorEntity):void{
var _local2:AbstractItemView;
var _local3:String = GameItemKind.getSuperKindFromKind(_arg1.kind);
switch (_local3){
case GameItemKind.BLOCKS:
_local2 = new BlockView(_arg1);
break;
case GameItemKind.CHARACTERS:
_local2 = new CharacterView(_arg1);
break;
case GameItemKind.HINT:
_local2 = new HintView(_arg1);
break;
case GameItemKind.CLEAN_ZONE:
_local2 = new CleanZoneView(_arg1);
break;
};
_itemsHolder.addChild(_local2);
}
private function onScrollHandler(_arg1:ScrollEvent):void{
switch (_arg1.target.name){
case "vScrollBar":
_sprite.y = -(_arg1.position);
break;
case "hScrollBar":
_sprite.x = -(_arg1.position);
break;
};
}
override public function dispose():void{
super.dispose();
_controller = null;
_toggleButtons = [];
}
private function onMouseDownHandler(_arg1:MouseEvent):void{
var _local3:Point;
var _local2:Object = _arg1.target;
if ((_local2 is Component)){
return;
};
switch (_selectedTool){
case BLOCKS_TOOL:
case SPECIALS_TOOL:
case HELPERS_TOOL:
_local3 = new Point(_arg1.stageX, _arg1.stageY);
_local3 = _itemsHolder.globalToLocal(_local3);
_controller.createNewItem(_local3.x, _local3.y);
break;
case TRANSFORM_TOOL:
if (_local2 == _background){
_controller.beginMultiSelection();
};
break;
};
}
private function setTool(_arg1:String, _arg2:String):void{
var _local3:AbstractButton;
if (_selectedTool == _arg1){
return;
};
_selectedTool = _arg1;
_transformToolSprite.visible = (_selectedTool == TRANSFORM_TOOL);
for each (_local3 in _toggleButtons) {
if (_local3.name != _arg2){
_local3.selected = false;
};
};
}
override protected function onDialogClose():void{
var _local1:ToolMultiButton;
if ((((_dialog is ToolSelectionDialog)) && (_dialog.option))){
_local1 = ToolSelectionDialog(_dialog).relatedButton;
_local1.setInstanceStyle("icon", ToolSelectionDialog(_dialog).selectedIcon);
_local1.value = _dialog.option;
};
}
public function get selectedTool():String{
return (_selectedTool);
}
private function onShowToolSelectionHandler(_arg1:Event):void{
var _local2:ToolMultiButton = ToolMultiButton(_arg1.target);
showDialog(new ToolSelectionDialog(_local2));
}
public function removeItemView(_arg1:AbstractItemView):void{
_itemsHolder.removeChild(_arg1);
_arg1.dispose();
}
}
}//package bb2.editor
Section 151
//EntitiesFactory (bb2.editor.EntitiesFactory)
package bb2.editor {
import bb2.common.*;
import bb2.editor.entities.*;
public class EntitiesFactory {
public static function create(_arg1:String, _arg2:String, _arg3:XML=null):BaseEditorEntity{
var _local4:String = GameItemKind.getSuperKindFromKind(_arg1);
switch (_local4){
case GameItemKind.BLOCKS:
return (new BaseEditorEntity(_arg1, _arg2, true, true));
case GameItemKind.CHARACTERS:
return (new CharacterEntity(_arg1, _arg2, (_arg3) ? _arg3.@walkDistance : 0));
case GameItemKind.HINT:
return (new HintEntity(_arg1, _arg2, (_arg3) ? _arg3.@text : ""));
case GameItemKind.CLEAN_ZONE:
return (new BaseEditorEntity(_arg1, _arg2, true, false));
};
throw (new Error((("Error creating entity for kind \"" + _arg1) + "\"")));
}
public static function fromXML(_arg1:XML):BaseEditorEntity{
var _local2:BaseEditorEntity = create(_arg1.@kind, _arg1.@id, _arg1.params[0]);
_local2.x = _arg1.params.@x;
_local2.y = _arg1.params.@y;
if (_local2.scalable){
_local2.width = _arg1.params.@width;
_local2.height = _arg1.params.@height;
};
if (_local2.rotatable){
_local2.rotation = _arg1.params.@rotation;
};
return (_local2);
}
}
}//package bb2.editor
Section 152
//TransformTool (bb2.editor.TransformTool)
package bb2.editor {
import flash.display.*;
import com.bigwigmedia.ui.*;
import bb2.editor.events.*;
import bb2.editor.views.*;
import com.bigwigmedia.events.*;
import flash.events.*;
import flash.geom.*;
import bb2.editor.entities.*;
import flash.utils.*;
import com.bigwigmedia.geom.*;
import com.bigwigmedia.core.*;
import com.bigwigmedia.input.*;
import flash.ui.*;
public class TransformTool extends EventDispatcher {
private var _rotationBLControl:TransformToolControl;
private var _rotationTLControl:TransformToolControl;
private var _sizeRControl:TransformToolControl;
private var _targetsDict:Dictionary;
private var _sizeBControl:TransformToolControl;
private var _interactionMode:String;// = null
private var _startInteractionPoint:Point;
private var _rotationBRControl:TransformToolControl;
private var _numTargets:int;// = 0
private var _transformableTarget:AbstractItemView;
private var _sizeTControl:TransformToolControl;
private var _targetsHolder:Sprite;
private var _sizeLControl:TransformToolControl;
private var _bounds:Rectangle;
private var _rotationTRControl:TransformToolControl;
private var _sprite:Sprite;
private var _keyInputMan:KeyInputManager;
private var _stage:Stage;
public static const MODE_ROTATION:String = "MODE_ROTATION";
public static const MAX_X:Number = 640;
public static const KEY_ACTION_DELETE_2:String = "KEY_ACTION_DELETE_2";
public static const MODE_RESIZE_X:String = "MODE_RESIZE_X";
public static const MODE_RESIZE_Y:String = "MODE_RESIZE_Y";
public static const MIN_X:Number = 0;
public static const MODE_MOVE:String = "MODE_MOVE";
public static const MODE_MULTI_SELECTION:String = "MODE_MULTI_SELECTION";
public static const KEY_ACTION_DELETE:String = "KEY_ACTION_DELETE";
public static const MODE_SNAP_VERTEX:String = "MODE_SNAP_VERTEX";
public function TransformTool(_arg1:Sprite, _arg2:Sprite){
_startInteractionPoint = new Point();
_targetsDict = new Dictionary();
_bounds = new Rectangle();
super();
_sprite = _arg1;
_targetsHolder = _arg2;
_stage = Globals.stage;
_keyInputMan = new KeyInputManager(_stage);
_keyInputMan.mapKey(KEY_ACTION_DELETE, Keyboard.DELETE);
_keyInputMan.mapKey(KEY_ACTION_DELETE_2, Keyboard.BACKSPACE);
_keyInputMan.addEventListener(KeyInputEvent.KEY_DOWN, onKeyDownHandler);
_sizeRControl = new TransformToolControl(TransformToolControl.SIZE);
_sizeLControl = new TransformToolControl(TransformToolControl.SIZE);
_sizeBControl = new TransformToolControl(TransformToolControl.SIZE);
_sizeTControl = new TransformToolControl(TransformToolControl.SIZE);
_rotationBRControl = new TransformToolControl(TransformToolControl.ROTATION);
_rotationBLControl = new TransformToolControl(TransformToolControl.ROTATION);
_rotationTLControl = new TransformToolControl(TransformToolControl.ROTATION);
_rotationTRControl = new TransformToolControl(TransformToolControl.ROTATION);
_sprite.addChild(_sizeRControl);
_sprite.addChild(_sizeLControl);
_sprite.addChild(_sizeBControl);
_sprite.addChild(_sizeTControl);
_sprite.addChild(_rotationBRControl);
_sprite.addChild(_rotationBLControl);
_sprite.addChild(_rotationTRControl);
_sprite.addChild(_rotationTLControl);
setAllControlsVisibility(false);
_sprite.addEventListener(MouseEvent.MOUSE_DOWN, onControlsMouseDownHandler);
}
private function endMultiSelection():void{
_sprite.graphics.clear();
var _local1:Matrix = _targetsHolder.transform.matrix;
var _local2:Point = _local1.transformPoint(_startInteractionPoint);
var _local3:Point = _local1.transformPoint(new Point(_targetsHolder.mouseX, _targetsHolder.mouseY));
var _local4:Rectangle = new Rectangle(((_local2.x < _local3.x)) ? _local2.x : _local3.x, ((_local2.y < _local3.y)) ? _local2.y : _local3.y, Math.abs((_local3.x - _local2.x)), Math.abs((_local3.y - _local2.y)));
dispatchEvent(new TransformToolEvent(TransformToolEvent.MULTI_SELECTION_END, _local4));
}
private function setRotationControlsVisibility(_arg1:Boolean):void{
_rotationBLControl.visible = (_rotationTLControl.visible = (_rotationTRControl.visible = (_rotationBRControl.visible = _arg1)));
}
private function setScaleControlsVisibility(_arg1:Boolean):void{
_sizeRControl.visible = (_sizeLControl.visible = (_sizeBControl.visible = (_sizeTControl.visible = _arg1)));
}
private function updateControls():void{
var _local1:BaseEditorEntity;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Matrix;
var _local7:Matrix;
if (_transformableTarget){
_local1 = _transformableTarget.entity;
_local2 = _local1.x;
_local3 = _local1.y;
_local4 = (_local1.width / 2);
_local5 = (_local1.height / 2);
_local6 = _targetsHolder.transform.matrix;
_local7 = new Matrix();
_local7.translate(-(_local2), -(_local3));
_local7.rotate(((_local1.rotation / 180) * Math.PI));
_local7.translate(_local2, _local3);
if (_local1.scalable){
setScaleControlsVisibility(true);
positionControl(_sizeRControl, (_local2 + _local4), _local3, _local6, _local7);
positionControl(_sizeLControl, (_local2 - _local4), _local3, _local6, _local7);
positionControl(_sizeBControl, _local2, (_local3 + _local5), _local6, _local7);
positionControl(_sizeTControl, _local2, (_local3 - _local5), _local6, _local7);
};
if (_local1.rotatable){
setRotationControlsVisibility(true);
positionControl(_rotationBRControl, (_local2 + _local4), (_local3 + _local5), _local6, _local7);
positionControl(_rotationBLControl, (_local2 - _local4), (_local3 + _local5), _local6, _local7);
positionControl(_rotationTLControl, (_local2 - _local4), (_local3 - _local5), _local6, _local7);
positionControl(_rotationTRControl, (_local2 + _local4), (_local3 - _local5), _local6, _local7);
};
} else {
setAllControlsVisibility(false);
};
}
public function dispose():void{
_keyInputMan.removeEventListener(KeyInputEvent.KEY_DOWN, onKeyDownHandler);
_keyInputMan.dispose();
_keyInputMan = null;
_stage.removeEventListener(MouseEvent.MOUSE_UP, onStageMouseUpHandler);
_stage.removeEventListener(MouseEvent.MOUSE_MOVE, onStageMouseMoveHandler);
_stage = null;
_sprite = null;
_targetsHolder = null;
}
private function setAllControlsVisibility(_arg1:Boolean):void{
setScaleControlsVisibility(_arg1);
setRotationControlsVisibility(_arg1);
}
public function addTarget(_arg1:AbstractItemView):void{
if (_targetsDict[_arg1]){
return;
};
_targetsDict[_arg1] = new EntityGeom(_arg1.entity);
_numTargets++;
_arg1.addEventListener(MouseEvent.MOUSE_DOWN, onViewMouseDownHandler);
update();
}
private function onViewMouseDownHandler(_arg1:MouseEvent):void{
if ((_arg1.target is Component)){
return;
};
_startInteractionPoint.x = _targetsHolder.mouseX;
_startInteractionPoint.y = _targetsHolder.mouseY;
_stage.addEventListener(MouseEvent.MOUSE_UP, onStageMouseUpHandler);
_stage.addEventListener(MouseEvent.MOUSE_MOVE, onStageMouseMoveHandler);
_interactionMode = MODE_MOVE;
}
private function onKeyDownHandler(_arg1:KeyInputEvent):void{
switch (_arg1.keyAction){
case KEY_ACTION_DELETE:
case KEY_ACTION_DELETE_2:
deleteSelectedTargets();
break;
};
}
private function resize():void{
var _local1:Number = (_targetsHolder.mouseX - _startInteractionPoint.x);
var _local2:Number = (_targetsHolder.mouseY - _startInteractionPoint.y);
var _local3:EntityGeom = _targetsDict[_transformableTarget];
var _local4:Vector2D = new Vector2D((_startInteractionPoint.x - _local3.x), (_startInteractionPoint.y - _local3.y));
var _local5:Vector2D = new Vector2D((_targetsHolder.mouseX - _local3.x), (_targetsHolder.mouseY - _local3.y));
var _local6:Number = (_local5.dotProduct(_local4) / _local4.lengthSquared);
switch (_interactionMode){
case MODE_RESIZE_X:
_transformableTarget.entity.width = (_local3.width * _local6);
break;
case MODE_RESIZE_Y:
_transformableTarget.entity.height = (_local3.height * _local6);
break;
};
dispatchTransformEvent(_transformableTarget.entity);
update();
}
public function removeTarget(_arg1:AbstractItemView):void{
if (!_targetsDict[_arg1]){
return;
};
_targetsDict[_arg1].dispose();
delete _targetsDict[_arg1];
_numTargets--;
_arg1.removeEventListener(MouseEvent.MOUSE_DOWN, onViewMouseDownHandler);
update();
}
private function dispatchTransformEvent(_arg1:BaseEditorEntity):void{
var _local2:Object = {};
if (_arg1.scalable){
_local2.width = _arg1.width;
_local2.height = _arg1.height;
};
if (_arg1.rotatable){
_local2.rotation = _arg1.rotation;
};
dispatchEvent(new TransformToolEvent(TransformToolEvent.TRANSFORM, _local2));
}
private function onControlsMouseDownHandler(_arg1:MouseEvent):void{
var _local2:DisplayObject = (_arg1.target as DisplayObject);
if ((_local2 is TransformToolControl) == false){
return;
};
switch (_local2){
case _sizeRControl:
case _sizeLControl:
_interactionMode = MODE_RESIZE_X;
break;
case _sizeBControl:
case _sizeTControl:
_interactionMode = MODE_RESIZE_Y;
break;
case _rotationTRControl:
case _rotationTLControl:
case _rotationBRControl:
case _rotationBLControl:
_interactionMode = MODE_ROTATION;
break;
};
_startInteractionPoint.x = _targetsHolder.mouseX;
_startInteractionPoint.y = _targetsHolder.mouseY;
_stage.addEventListener(MouseEvent.MOUSE_UP, onStageMouseUpHandler);
_stage.addEventListener(MouseEvent.MOUSE_MOVE, onStageMouseMoveHandler);
}
private function deleteSelectedTargets():void{
var _local1:Object;
if (_numTargets == 0){
return;
};
for (_local1 in _targetsDict) {
_targetsDict[_local1].dispose();
delete _targetsDict[_local1];
dispatchEvent(new TransformToolEvent(TransformToolEvent.DELETE, _local1));
};
_transformableTarget = null;
_numTargets = 0;
update();
}
public function draw():void{
var _local2:BaseEditorEntity;
var _local3:Matrix;
var _local4:Matrix;
var _local5:Point;
var _local1:Graphics = _sprite.graphics;
_local1.clear();
if (_transformableTarget){
_local1.lineStyle(0, 1);
_local2 = _transformableTarget.entity;
_local3 = _targetsHolder.transform.matrix;
_local4 = new Matrix();
_local4.translate(-(_local2.x), -(_local2.y));
_local4.rotate(((_local2.rotation / 180) * Math.PI));
_local4.translate(_local2.x, _local2.y);
_local5 = new Point((_local2.x - (_local2.width / 2)), (_local2.y - (_local2.height / 2)));
_local5 = _local3.transformPoint(_local4.transformPoint(_local5));
_local1.moveTo(_local5.x, _local5.y);
_local5.x = (_local2.x + (_local2.width / 2));
_local5.y = (_local2.y - (_local2.height / 2));
_local5 = _local3.transformPoint(_local4.transformPoint(_local5));
_local1.lineTo(_local5.x, _local5.y);
_local5.x = (_local2.x + (_local2.width / 2));
_local5.y = (_local2.y + (_local2.height / 2));
_local5 = _local3.transformPoint(_local4.transformPoint(_local5));
_local1.lineTo(_local5.x, _local5.y);
_local5.x = (_local2.x - (_local2.width / 2));
_local5.y = (_local2.y + (_local2.height / 2));
_local5 = _local3.transformPoint(_local4.transformPoint(_local5));
_local1.lineTo(_local5.x, _local5.y);
_local5.x = (_local2.x - (_local2.width / 2));
_local5.y = (_local2.y - (_local2.height / 2));
_local5 = _local3.transformPoint(_local4.transformPoint(_local5));
_local1.lineTo(_local5.x, _local5.y);
} else {
if (_numTargets > 0){
_local1.lineStyle(0, 1);
_local1.drawRect(_bounds.x, _bounds.y, _bounds.width, _bounds.height);
};
};
}
public function update():void{
updateBounds();
updateControls();
draw();
}
private function onStageMouseMoveHandler(_arg1:MouseEvent):void{
switch (_interactionMode){
case MODE_MOVE:
move(_arg1.shiftKey);
break;
case MODE_ROTATION:
rotate(_arg1.shiftKey);
break;
case MODE_RESIZE_X:
case MODE_RESIZE_Y:
resize();
break;
case MODE_MULTI_SELECTION:
updateMultiSelection();
break;
};
}
private function move(_arg1:Boolean):void{
var _local4:Object;
var _local5:Number;
var _local6:BaseEditorEntity;
var _local7:EntityGeom;
var _local2:Number = (_targetsHolder.mouseX - _startInteractionPoint.x);
var _local3:Number = (_targetsHolder.mouseY - _startInteractionPoint.y);
if (_arg1){
_local5 = ((Math.atan2(_local3, _local2) / Math.PI) * 180);
if (_local5 < 0){
_local5 = (_local5 + 360);
};
if ((((((_local5 < 45)) || ((_local5 > 315)))) || ((((_local5 > 135)) && ((_local5 < 225)))))){
_local3 = 0;
} else {
_local2 = 0;
};
};
for (_local4 in _targetsDict) {
_local6 = _local4.entity;
_local7 = _targetsDict[_local4];
_local6.x = (_local7.x + _local2);
_local6.y = (_local7.y + _local3);
};
update();
}
public function isTarget(_arg1:AbstractItemView):Boolean{
return (!((_targetsDict[_arg1] == null)));
}
public function beginMultiSelection():void{
removeAll();
_interactionMode = MODE_MULTI_SELECTION;
_startInteractionPoint.x = _targetsHolder.mouseX;
_startInteractionPoint.y = _targetsHolder.mouseY;
_stage.addEventListener(MouseEvent.MOUSE_UP, onStageMouseUpHandler);
_stage.addEventListener(MouseEvent.MOUSE_MOVE, onStageMouseMoveHandler);
}
private function updateBounds():void{
var _local1:Object;
var _local2:AbstractItemView;
var _local3:Rectangle;
_bounds.setEmpty();
for (_local1 in _targetsDict) {
_local2 = AbstractItemView(_local1);
_local3 = _local2.getBounds(_sprite);
if (_bounds.isEmpty()){
_bounds = _local3.clone();
} else {
_bounds = _bounds.union(_local3);
};
};
if ((((_numTargets == 1)) && (((_local2.entity.scalable) || (_local2.entity.rotatable))))){
_transformableTarget = _local2;
} else {
_transformableTarget = null;
};
}
private function onStageMouseUpHandler(_arg1:MouseEvent):void{
var _local2:Object;
var _local3:AbstractItemView;
switch (_interactionMode){
case MODE_MULTI_SELECTION:
endMultiSelection();
break;
default:
for (_local2 in _targetsDict) {
_local3 = AbstractItemView(_local2);
_targetsDict[_local2].update();
};
break;
};
_stage.removeEventListener(MouseEvent.MOUSE_UP, onStageMouseUpHandler);
_stage.removeEventListener(MouseEvent.MOUSE_MOVE, onStageMouseMoveHandler);
}
private function rotate(_arg1:Boolean):void{
var _local2:EntityGeom = _targetsDict[_transformableTarget];
var _local3:Number = Math.atan2((_startInteractionPoint.y - _local2.y), (_startInteractionPoint.x - _local2.x));
var _local4:Number = Math.atan2((_targetsHolder.mouseY - _local2.y), (_targetsHolder.mouseX - _local2.x));
var _local5:Number = (_local2.rotation + (((_local4 - _local3) / Math.PI) * 180));
if (_arg1){
_local5 = (15 * int((_local5 / 15)));
};
_transformableTarget.entity.rotation = _local5;
dispatchTransformEvent(_transformableTarget.entity);
update();
}
private function positionControl(_arg1:DisplayObject, _arg2:Number, _arg3:Number, _arg4:Matrix, _arg5:Matrix):void{
var _local6:Point = new Point(_arg2, _arg3);
_local6 = _arg4.transformPoint(_arg5.transformPoint(_local6));
_arg1.x = _local6.x;
_arg1.y = _local6.y;
}
private function updateMultiSelection():void{
var _local1:Graphics = _sprite.graphics;
_local1.clear();
_local1.lineStyle(0, 0xFF);
_local1.beginFill(0xFF, 0.07);
var _local2:Matrix = _targetsHolder.transform.matrix;
var _local3:Point = _local2.transformPoint(_startInteractionPoint);
var _local4:Point = _local2.transformPoint(new Point(_targetsHolder.mouseX, _targetsHolder.mouseY));
_local1.drawRect(_local3.x, _local3.y, (_local4.x - _local3.x), (_local4.y - _local3.y));
_local1.endFill();
}
public function removeAll():void{
var _local1:Object;
var _local2:AbstractItemView;
for (_local1 in _targetsDict) {
_local2 = AbstractItemView(_local1);
_targetsDict[_local2].dispose();
_local2.removeEventListener(MouseEvent.MOUSE_DOWN, onViewMouseDownHandler);
};
_targetsDict = new Dictionary();
_numTargets = 0;
update();
}
}
}//package bb2.editor
import flash.display.*;
class TransformToolControl extends Sprite {
public static const SIZE:String = "size";
private static const DIMENSIONS:Number = 8;
public static const ROTATION:String = "rotation";
private function TransformToolControl(_arg1:String){
switch (_arg1){
case SIZE:
graphics.clear();
graphics.lineStyle(2, 0xFFFFFF);
graphics.beginFill(0);
graphics.drawRect((-(DIMENSIONS) / 2), (-(DIMENSIONS) / 2), DIMENSIONS, DIMENSIONS);
graphics.endFill();
break;
case ROTATION:
graphics.clear();
graphics.lineStyle(2, 0xFFFFFF);
graphics.beginFill(0);
graphics.drawCircle(0, 0, (DIMENSIONS / 2));
graphics.endFill();
break;
};
}
}
Section 153
//ConfirmDeleteLevelDialog (bb2.editorLevelSelection.ConfirmDeleteLevelDialog)
package bb2.editorLevelSelection {
import com.bigwigmedia.ui.*;
import com.bigwigmedia.mvc.*;
public class ConfirmDeleteLevelDialog extends DialogView {
override protected function onComponentClick(_arg1:Component):void{
switch (_arg1.name){
case "okButton":
dispatchCloseEvent(DialogOption.OK);
break;
case "cancelButton":
dispatchCloseEvent(DialogOption.CANCEL);
break;
};
}
}
}//package bb2.editorLevelSelection
Section 154
//EditorLevelSelectionController (bb2.editorLevelSelection.EditorLevelSelectionController)
package bb2.editorLevelSelection {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import bb2.managers.*;
import flash.events.*;
import com.bigwigmedia.mvc.*;
import bb2.core.*;
public class EditorLevelSelectionController extends EventDispatcher implements IController {
private var _view:EditorLevelSelectionView;
public function EditorLevelSelectionController(){
_view = new EditorLevelSelectionView(this);
}
public function createNewLevel(_arg1:String, _arg2:String, _arg3:String):void{
Managers.levelProgressService.addUserLevel(_arg1, _arg2, _arg3);
}
public function get view():DisplayObject{
return (_view);
}
public function getUserLevelInfoList():Array{
return (Managers.levelProgressService.getUserLevelInfoList());
}
public function playLevel():void{
dispatchEvent(new ControllerEvent(ControllerEvent.COMPLETE, MainSignal.START));
}
public function deleteLevel():void{
Managers.levelProgressService.deleteSelectedUserLevel();
}
public function editLevel():void{
dispatchEvent(new ControllerEvent(ControllerEvent.COMPLETE, MainSignal.SHOW_EDITOR));
}
public function gotoMainMenu():void{
dispatchEvent(new ControllerEvent(ControllerEvent.COMPLETE, MainSignal.SHOW_MAIN_MENU));
}
public function selectUserLevel():void{
Managers.levelProgressService.selectedUserLevelUID = _view.selectedLevelUID;
}
public function dispose():void{
_view.dispose();
}
}
}//package bb2.editorLevelSelection
Section 155
//EditorLevelSelectionView (bb2.editorLevelSelection.EditorLevelSelectionView)
package bb2.editorLevelSelection {
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import bb2.managers.*;
import com.bigwigmedia.events.*;
import com.bigwigmedia.mvc.*;
import bb2.common.*;
public class EditorLevelSelectionView extends DialogOwnerView {
private var _levelsList:List;
private var _controller:EditorLevelSelectionController;
public function EditorLevelSelectionView(_arg1:EditorLevelSelectionController){
_controller = _arg1;
_levelsList = (getComponentByName("levelsList") as List);
_levelsList.addEventListener(ListEvent.SELECTION_CHANGE, onSelectionChangeHandler);
updateLevelsList();
}
public function get selectedLevelUID():String{
var _local1:Object = _levelsList.selectedItem;
return ((_local1) ? _local1.uid : null);
}
override protected function onComponentClick(_arg1:Component):void{
var _local2:String;
switch (_arg1.name){
case "mainMenuButton":
_controller.gotoMainMenu();
break;
case "playButton":
if (selectedLevelUID){
_controller.playLevel();
} else {
showLevelNotSelectedDialog();
};
break;
case "editButton":
if (!selectedLevelUID){
showLevelNotSelectedDialog();
} else {
if (Managers.levelProgressService.getLevelInfo().imported){
showErrorDialog("You can't edit level created by someone else");
} else {
_controller.editLevel();
};
};
break;
case "deleteButton":
if (selectedLevelUID){
showDialog(new ConfirmDeleteLevelDialog());
} else {
showLevelNotSelectedDialog();
};
break;
case "loadButton":
showDialog(new LoadLevelDialog());
break;
case "sendToFriendsButton":
if (!selectedLevelUID){
showLevelNotSelectedDialog();
} else {
if (Managers.levelProgressService.getLevelInfo().imported){
showErrorDialog("You can't send level created by someone else");
} else {
_local2 = Managers.levelProgressService.getLevelExportString();
showDialog(new SendToFriendsDialog(_local2));
};
};
break;
case "createNewLevelButton":
showDialog(new NewLevelDialog());
break;
};
}
private function onSelectionChangeHandler(_arg1:ListEvent):void{
_controller.selectUserLevel();
var _local2:Label = Label(getComponentByName("bestScoreLabel"));
if (this.selectedLevelUID){
_local2.text = String(Managers.levelProgressService.getLevelScore(this.selectedLevelUID));
} else {
_local2.text = "...";
};
}
public function showLevelNotSelectedDialog():void{
showErrorDialog("Select level from the list");
}
override protected function onDialogClose():void{
var _local1:NewLevelDialog;
switch (_dialog.option){
case DialogOption.OK:
if ((_dialog is NewLevelDialog)){
_local1 = NewLevelDialog(_dialog);
_controller.createNewLevel(_local1.levelTitle, _local1.authorName, _local1.authorEmail);
updateLevelsList();
_levelsList.clearSelection();
} else {
if ((_dialog is LoadLevelDialog)){
updateLevelsList();
} else {
if ((_dialog is ConfirmDeleteLevelDialog)){
_controller.deleteLevel();
updateLevelsList();
_levelsList.clearSelection();
};
};
};
break;
};
}
private function showErrorDialog(_arg1:String):void{
showDialog(new ErrorDialog(_arg1));
}
private function updateLevelsList():void{
var _local4:LevelInfo;
_levelsList.removeAllItems();
var _local1:Array = _controller.getUserLevelInfoList();
var _local2:int = _local1.length;
var _local3:int;
while (_local3 < _local2) {
_local4 = _local1[_local3];
_levelsList.addItem({label:_local4.fullTitle, uid:_local4.uid});
_local3++;
};
}
}
}//package bb2.editorLevelSelection
Section 156
//ErrorDialog (bb2.editorLevelSelection.ErrorDialog)
package bb2.editorLevelSelection {
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import com.bigwigmedia.mvc.*;
public class ErrorDialog extends DialogView {
public function ErrorDialog(_arg1:String){
Label(getComponentByName("messageLabel")).text = _arg1;
}
override protected function onComponentClick(_arg1:Component):void{
switch (_arg1.name){
case "okButton":
dispatchCloseEvent(DialogOption.OK);
break;
};
}
}
}//package bb2.editorLevelSelection
Section 157
//LoadLevelDialog (bb2.editorLevelSelection.LoadLevelDialog)
package bb2.editorLevelSelection {
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import bb2.managers.*;
import bb2.services.*;
import com.bigwigmedia.mvc.*;
public class LoadLevelDialog extends DialogView {
override protected function onComponentClick(_arg1:Component):void{
switch (_arg1.name){
case "okButton":
validateLevelCode();
break;
case "cancelButton":
dispatchCloseEvent(DialogOption.CANCEL);
break;
};
}
private function validateLevelCode():void{
var _local1:String = TextArea(getComponentByName("textArea")).text;
var _local2:String = Managers.levelProgressService.loadLevel(_local1);
switch (_local2){
case LevelProgressService.LOAD_RESULT_SUCCESS:
dispatchCloseEvent(DialogOption.OK);
break;
case LevelProgressService.LOAD_RESULT_INVALID:
TextArea(getComponentByName("textArea")).text = "Code is invalid";
break;
case LevelProgressService.LOAD_RESULT_DUPLICATE:
TextArea(getComponentByName("textArea")).text = "Level exists already";
break;
};
}
}
}//package bb2.editorLevelSelection
Section 158
//NewLevelDialog (bb2.editorLevelSelection.NewLevelDialog)
package bb2.editorLevelSelection {
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import com.bigwigmedia.mvc.*;
public class NewLevelDialog extends DialogView {
public function get authorEmail():String{
return (TextInput(getComponentByName("authorEmailInput")).text);
}
override protected function onComponentClick(_arg1:Component):void{
switch (_arg1.name){
case "okButton":
dispatchCloseEvent(DialogOption.OK);
break;
case "cancelButton":
dispatchCloseEvent(DialogOption.CANCEL);
break;
};
}
public function get levelTitle():String{
return (TextInput(getComponentByName("levelTitleInput")).text);
}
public function get authorName():String{
return (TextInput(getComponentByName("authorNameInput")).text);
}
}
}//package bb2.editorLevelSelection
Section 159
//SendToFriendsDialog (bb2.editorLevelSelection.SendToFriendsDialog)
package bb2.editorLevelSelection {
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import com.bigwigmedia.mvc.*;
public class SendToFriendsDialog extends DialogView {
public function SendToFriendsDialog(_arg1:String){
TextArea(getComponentByName("textArea")).text = _arg1;
}
override protected function onComponentClick(_arg1:Component):void{
switch (_arg1.name){
case "okButton":
dispatchCloseEvent(DialogOption.OK);
break;
};
}
}
}//package bb2.editorLevelSelection
Section 160
//AbstractGameEntity (bb2.game.entities.AbstractGameEntity)
package bb2.game.entities {
import com.bigwigmedia.mvc.*;
import bb2.common.*;
public class AbstractGameEntity extends Entity {
protected var _x:Number;
protected var _id:String;
protected var _kind:String;
protected var _y:Number;
public static const REMOVE_EVENT:String = "AbstractGameEntity.REMOVE_EVENT";
public function AbstractGameEntity(_arg1:GameItemDefinition){
_kind = _arg1.kind;
_id = _arg1.id;
_x = _arg1.x;
_y = _arg1.y;
}
public function get kind():String{
return (_kind);
}
public function get id():String{
return (_id);
}
public function get x():Number{
return (_x);
}
public function get y():Number{
return (_y);
}
}
}//package bb2.game.entities
Section 161
//Acid (bb2.game.entities.Acid)
package bb2.game.entities {
import com.bigwigmedia.mvc.events.*;
import bb2.common.*;
import bb2.game.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import com.bigwigmedia.utils.*;
public class Acid extends PhysicGameEntity {
private var _active:Boolean;// = true
private var _velocity:b2Vec2;
public function Acid(_arg1:AcidDefinition){
super(_arg1);
_velocity = _arg1.velocity;
}
public function deactivate():void{
if (_active){
_active = false;
};
}
public function get active():Boolean{
return (_active);
}
override public function update(_arg1:Number):void{
var _local2:b2Vec2 = _body.GetPosition();
var _local3:Number = (_local2.x * GameModel.WORLD_SCALE);
var _local4:Number = (_local2.y * GameModel.WORLD_SCALE);
if (((!(MathUtil.nearEquals(_local3, _x, MIN_MOVE_TOLERANCE))) || (!(MathUtil.nearEquals(_local4, _y, MIN_MOVE_TOLERANCE))))){
_x = _local3;
_y = _local4;
dispatchEvent(new EntityEvent(EntityEvent.UPDATE));
};
}
override public function createBody(_arg1:b2World):void{
var _local2:Number;
var _local3:b2BodyDef;
var _local4:b2PolygonDef;
if (!_body){
_local2 = GameModel.WORLD_SCALE;
_local3 = new b2BodyDef();
_local3.allowSleep = true;
_local4 = new b2PolygonDef();
_local4.density = 0.01;
_local4.isSensor = true;
_local4.SetAsBox(((_width / 2) / _local2), ((_height / 2) / _local2));
_body = _arg1.CreateBody(_local3);
_body.bodyKindID = GameModel.BODY_ID_ACID;
_body.CreateShape(_local4);
_body.SetMassFromShapes();
_body.SetXForm(new b2Vec2((_x / _local2), (_y / _local2)), 0);
_body.SetLinearVelocity(_velocity);
};
}
}
}//package bb2.game.entities
Section 162
//AcidBalloon (bb2.game.entities.AcidBalloon)
package bb2.game.entities {
import bb2.common.*;
import Box2D.Common.Math.*;
public class AcidBalloon extends DemolitionToolEntity {
public function AcidBalloon(_arg1:DemolitionToolDefinition){
super(_arg1);
}
public function createAcidDefs():Array{
var _local3:b2Vec2;
var _local1:Array = [];
var _local2 = -2;
while (_local2 <= 2) {
_local3 = new b2Vec2((_local2 * 0.2), (-1 * Math.abs(_local2)));
_local1.push(new AcidDefinition(((_x + (_local2 * 36)) - 18), _y, _local3));
_local2++;
};
return (_local1);
}
}
}//package bb2.game.entities
Section 163
//AirStrike (bb2.game.entities.AirStrike)
package bb2.game.entities {
import bb2.common.*;
public class AirStrike extends DemolitionToolEntity {
public function AirStrike(_arg1:DemolitionToolDefinition){
super(_arg1);
}
public function createBallDefs(_arg1:Number):Array{
var _local2:Array = [];
var _local3:Number = (_arg1 - 50);
if (_local3 > 0){
_local3 = 0;
};
var _local4 = -2;
while (_local4 <= 2) {
_local2.push(new AirStrikeBallDefinition((_x + (_local4 * 65)), _local3));
_local4++;
};
return (_local2);
}
}
}//package bb2.game.entities
Section 164
//AirStrikeBall (bb2.game.entities.AirStrikeBall)
package bb2.game.entities {
import com.bigwigmedia.mvc.events.*;
import bb2.common.*;
import bb2.game.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import com.bigwigmedia.utils.*;
public class AirStrikeBall extends PhysicGameEntity {
private var _definition:AirStrikeBallDefinition;
private var _active:Boolean;// = true
public function AirStrikeBall(_arg1:AirStrikeBallDefinition){
super(_arg1);
_definition = _arg1;
}
public function get active():Boolean{
return (_active);
}
override public function update(_arg1:Number):void{
var _local5:Number;
var _local2:b2Vec2 = _body.GetPosition();
var _local3:Number = (_local2.x * GameModel.WORLD_SCALE);
var _local4:Number = (_local2.y * GameModel.WORLD_SCALE);
_local5 = _body.GetAngle();
if (((((!(MathUtil.nearEquals(_local3, _x, MIN_MOVE_TOLERANCE))) || (!(MathUtil.nearEquals(_local4, _y, MIN_MOVE_TOLERANCE))))) || (!(MathUtil.nearEquals(_local5, _rotation, MIN_ROTATION_TOLERANCE))))){
_x = _local3;
_y = _local4;
_rotation = _local5;
dispatchEvent(new EntityEvent(EntityEvent.UPDATE));
};
}
public function deactivate():void{
if (_active){
_active = false;
};
}
override public function createBody(_arg1:b2World):void{
var _local2:Number;
var _local3:b2BodyDef;
var _local4:b2CircleDef;
if (!_body){
_local2 = GameModel.WORLD_SCALE;
_local3 = new b2BodyDef();
_local3.allowSleep = true;
_local4 = new b2CircleDef();
_local4.density = 10;
_local4.isSensor = true;
_local4.radius = (_definition.radius / _local2);
_body = _arg1.CreateBody(_local3);
_body.bodyKindID = GameModel.BODY_ID_AIR_STRIKE_BALL;
_body.CreateShape(_local4);
_body.SetMassFromShapes();
_body.SetLinearVelocity(new b2Vec2(0, 2));
_body.SetXForm(new b2Vec2((_x / _local2), (_y / _local2)), 0);
};
}
}
}//package bb2.game.entities
Section 165
//AntimatterAttractor (bb2.game.entities.AntimatterAttractor)
package bb2.game.entities {
import bb2.common.*;
import bb2.game.*;
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
public class AntimatterAttractor extends Explosive {
private var _bodyPosition:b2Vec2;
public function AntimatterAttractor(_arg1:ExplosiveDefinition){
super(_arg1);
_bodyPosition = new b2Vec2((_x / GameModel.WORLD_SCALE), (_y / GameModel.WORLD_SCALE));
}
public function attract(_arg1:b2Body):void{
var _local2:b2Vec2 = _arg1.GetPosition();
var _local3:b2Vec2 = _bodyPosition.Copy();
_local3.Subtract(_local2);
_local3.Multiply(_strength);
_arg1.ApplyImpulse(_local3, _local2);
}
override public function createBody(_arg1:b2World):b2Body{
var _local2:b2Body = super.createBody(_arg1);
_local2.bodyKindID = GameModel.BODY_ID_ATTRACTOR;
return (_local2);
}
}
}//package bb2.game.entities
Section 166
//Block (bb2.game.entities.Block)
package bb2.game.entities {
import com.bigwigmedia.mvc.events.*;
import bb2.common.*;
import bb2.game.*;
import Box2D.Dynamics.*;
import com.bigwigmedia.geom.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import com.bigwigmedia.utils.*;
public class Block extends PhysicGameEntity {
private var _static:Boolean;
private var _destroyed:Boolean;
private var _strength:Number;
private var _density:Number;
private var _lastSquaredVelocity:Number;// = 0
private var _friction:Number;
private var _broken:Boolean;
public static const SQUARED_VELOCITY_THRESHOLD:Number = 0.2;
public static const PI_3_2:Number = 4.71238898038469;
public static const MIN_DEBRIS_SIZE:Number = 16;
public static const PI:Number = 3.14159265358979;
public static const PI_1_2:Number = 1.5707963267949;
public function Block(_arg1:BlockDefinition){
super(_arg1);
_friction = _arg1.friction;
_density = _arg1.density;
_strength = _arg1.strength;
_broken = _arg1.broken;
_static = _arg1.isStatic;
}
public function get strength():Number{
return (_strength);
}
public function createDebrisDefs():Object{
var _local1:Number;
var _local2:Number;
var _local9:Number;
var _local10:Number;
if (((_broken) || ((((_width < MIN_DEBRIS_SIZE)) && ((_height < MIN_DEBRIS_SIZE)))))){
return (null);
};
var _local3:Number = _x;
var _local4:Number = _y;
var _local5:Number = _x;
var _local6:Number = _y;
if (_width >= _height){
_local1 = (_width * 0.5);
_local2 = _height;
_local9 = (_width * 0.25);
_local3 = (_local3 + (Math.cos(_rotation) * _local9));
_local4 = (_local4 + (Math.sin(_rotation) * _local9));
_local5 = (_local5 + (Math.cos((_rotation + PI)) * _local9));
_local6 = (_local6 + (Math.sin((_rotation + PI)) * _local9));
} else {
_local1 = _width;
_local2 = (_height * 0.5);
_local10 = (_height * 0.25);
_local3 = (_local3 + (Math.cos((_rotation + PI_1_2)) * _local10));
_local4 = (_local4 + (Math.sin((_rotation + PI_1_2)) * _local10));
_local5 = (_local5 + (Math.cos((_rotation + PI_3_2)) * _local10));
_local6 = (_local6 + (Math.sin((_rotation + PI_3_2)) * _local10));
};
var _local7:BlockDefinition = new BlockDefinition(_kind, null, true, _local3, _local4, _local1, _local2, _rotation);
var _local8:BlockDefinition = new BlockDefinition(_kind, null, true, _local5, _local6, _local1, _local2, _rotation);
return ({defs:[_local7, _local8], linearVelocity:_body.GetLinearVelocity().Copy(), angularVelocity:_body.GetAngularVelocity()});
}
override public function update(_arg1:Number):void{
if (_static){
return;
};
_lastSquaredVelocity = _body.GetLinearVelocity().LengthSquared();
var _local2:b2Vec2 = _body.GetPosition();
var _local3:Number = (_local2.x * GameModel.WORLD_SCALE);
var _local4:Number = (_local2.y * GameModel.WORLD_SCALE);
var _local5:Number = _body.GetAngle();
if (((((!(MathUtil.nearEquals(_local3, _x, MIN_MOVE_TOLERANCE))) || (!(MathUtil.nearEquals(_local4, _y, MIN_MOVE_TOLERANCE))))) || (!(MathUtil.nearEquals(_local5, _rotation, MIN_ROTATION_TOLERANCE))))){
_x = _local3;
_y = _local4;
_rotation = _local5;
dispatchEvent(new EntityEvent(EntityEvent.UPDATE));
};
}
public function get dangerous():Boolean{
if (((_body.IsSleeping()) || (_static))){
return (false);
};
var _local1:Number = ((_body.GetLinearVelocity().LengthSquared() + _lastSquaredVelocity) / 2);
return ((_local1 > SQUARED_VELOCITY_THRESHOLD));
}
public function createDestroyedBlockEntity():DestroyedBlock{
var _local1:Vector2D = Vector2D.fromObject(_body.GetLinearVelocity());
return (new DestroyedBlock(kind, x, y, width, height, rotation, _local1));
}
public function markAsBroken():void{
_broken = true;
}
public function get broken():Boolean{
return (_broken);
}
public function get destroyed():Boolean{
return (_destroyed);
}
public function get isStatic():Boolean{
return (_static);
}
public function markAsDestroyed():void{
_destroyed = true;
}
override public function createBody(_arg1:b2World):void{
var _local2:Number;
var _local3:b2BodyDef;
var _local4:b2PolygonDef;
if (!_body){
_local2 = GameModel.WORLD_SCALE;
_local3 = new b2BodyDef();
_local3.allowSleep = true;
_local3.isSleeping = !((_id == null));
_local4 = new b2PolygonDef();
_local4.friction = _friction;
_local4.density = _density;
_local4.SetAsBox(((_width / 2) / _local2), ((_height / 2) / _local2));
_body = _arg1.CreateBody(_local3);
_body.bodyKindID = GameModel.BODY_ID_BLOCK;
_body.CreateShape(_local4);
_body.SetMassFromShapes();
_body.SetXForm(new b2Vec2((_x / _local2), (_y / _local2)), _rotation);
};
}
}
}//package bb2.game.entities
Section 167
//Character (bb2.game.entities.Character)
package bb2.game.entities {
import com.bigwigmedia.mvc.events.*;
import bb2.managers.*;
import bb2.common.*;
import bb2.game.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import bb2.constants.*;
public class Character extends PhysicGameEntity {
private var _minX:Number;
private var _direction:Number;
private var _speed:Number;
private var _state:String;// = "STATE_STAYING"
private var _maxX:Number;
private var _startX:Number;
public static const STATE_BUMPED:String = "STATE_BUMPED";
public static const STATE_WALKING:String = "STATE_WALKING";
public static const STATE_STAYING:String = "STATE_STAYING";
public function Character(_arg1:CharacterDefinition){
super(_arg1);
_startX = _x;
var _local2:Number = _arg1.walkDistance;
if (_local2 == 0){
_direction = 0;
_speed = 0;
} else {
_direction = ((_local2 < 0)) ? -1 : 1;
_speed = ((_kind == GameItemKind.CHARACTER_WOMAN)) ? 1 : 2;
_minX = Math.min(_x, (_x + _local2));
_maxX = Math.max(_x, (_x + _local2));
};
}
override public function update(_arg1:Number):void{
var _local2:b2Vec2;
if (((!((_speed == 0))) && (!(bumped)))){
if (_state == STATE_STAYING){
_state = STATE_WALKING;
dispatchEvent(new EntityEvent("STATE_CHANGED"));
};
_x = (_x + (_speed * _direction));
if (_x < _minX){
_x = _minX;
_direction = -(_direction);
};
if (_x > _maxX){
_x = _maxX;
_direction = -(_direction);
} else {
_local2 = _body.GetPosition().Copy();
_local2.x = (_x / GameModel.WORLD_SCALE);
_body.SetXForm(_local2, 0);
};
};
dispatchEvent(new EntityEvent(EntityEvent.UPDATE));
}
public function markAsBumped():void{
_state = STATE_BUMPED;
}
public function bump():void{
var _local1:String;
switch (_kind){
case GameItemKind.CHARACTER_MAN:
_local1 = SoundID.OUCH_4_WAV;
break;
case GameItemKind.CHARACTER_WOMAN:
_local1 = SoundID.GIRL_HIT_WAV;
break;
case GameItemKind.CHARACTER_OPPONENT:
_local1 = SoundID.OUCH_6_WAV;
break;
};
Managers.soundManager.play(_local1);
dispatchEvent(new EntityEvent("STATE_CHANGED"));
}
public function get state():String{
return (_state);
}
public function get bumped():Boolean{
return ((_state == STATE_BUMPED));
}
override public function createBody(_arg1:b2World):void{
var _local2:Number;
var _local3:b2BodyDef;
var _local4:b2PolygonDef;
if (!_body){
_local2 = GameModel.WORLD_SCALE;
_local3 = new b2BodyDef();
_local4 = new b2PolygonDef();
_local4.SetAsBox(((_width / 2) / _local2), ((_height / 2) / _local2));
_local4.isSensor = true;
_body = _arg1.CreateBody(_local3);
_body.bodyKindID = GameModel.BODY_ID_CHARACTER;
_body.CreateShape(_local4);
_body.SetMass(new b2MassData());
_body.SetXForm(new b2Vec2((_x / _local2), (_y / _local2)), _rotation);
};
}
public function get direction():int{
return (_direction);
}
}
}//package bb2.game.entities
Section 168
//CleanZone (bb2.game.entities.CleanZone)
package bb2.game.entities {
import flash.events.*;
import bb2.common.*;
import bb2.game.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
public class CleanZone extends PhysicGameEntity {
private var _clean:Boolean;
public function CleanZone(_arg1:TransformableItemDefinition){
super(_arg1);
}
public function set clean(_arg1:Boolean):void{
if (_clean != _arg1){
_clean = _arg1;
dispatchEvent(new Event(Event.CHANGE));
};
}
public function get clean():Boolean{
return (_clean);
}
override public function createBody(_arg1:b2World):void{
var _local2:Number;
var _local3:b2BodyDef;
var _local4:b2PolygonDef;
if (!_body){
_local2 = GameModel.WORLD_SCALE;
_local3 = new b2BodyDef();
_local4 = new b2PolygonDef();
_local4.SetAsBox((((_width - 4) / 2) / _local2), (((_height - 4) / 2) / _local2));
_local4.isSensor = true;
_body = _arg1.CreateBody(_local3);
_body.bodyKindID = GameModel.BODY_ID_CLEAN_ZONE;
_body.CreateShape(_local4);
_body.SetMass(new b2MassData());
_body.SetXForm(new b2Vec2((_x / _local2), (_y / _local2)), _rotation);
};
}
}
}//package bb2.game.entities
Section 169
//DemolitionToolEntity (bb2.game.entities.DemolitionToolEntity)
package bb2.game.entities {
import com.bigwigmedia.mvc.events.*;
import bb2.common.*;
import Box2D.Dynamics.*;
public class DemolitionToolEntity extends AbstractGameEntity {
protected var _started:Boolean;// = false
protected var _definition:DemolitionToolDefinition;
private var _delayCounter:int;
public static const EXPLODE_EVENT:String = "EXPLODE_EVENT";
public static const DELAY_MULTIPLAYER:int = 30;
public function DemolitionToolEntity(_arg1:DemolitionToolDefinition){
super(_arg1);
_definition = _arg1;
}
public function explode():void{
if (_delayCounter != (DELAY_MULTIPLAYER - 1)){
_delayCounter = (DELAY_MULTIPLAYER - 1);
dispatchEvent(new EntityEvent(DemolitionToolEntity.EXPLODE_EVENT, null, true));
};
}
public function start():void{
_delayCounter = (_definition.delay * DELAY_MULTIPLAYER);
_started = true;
}
public function get delay():int{
return (_definition.delay);
}
override public function dispose():void{
_definition = null;
}
public function get started():Boolean{
return (_started);
}
public function get currentDelay():int{
return ((_started) ? (_delayCounter / DELAY_MULTIPLAYER) : _definition.delay);
}
public function set delay(_arg1:int):void{
_definition.delay = _arg1;
dispatchEvent(new EntityEvent(EntityEvent.UPDATE));
}
public function set x(_arg1:Number):void{
_definition.x = (_x = _arg1);
}
override public function update(_arg1:Number):void{
if (_delayCounter != (DELAY_MULTIPLAYER - 1)){
if (--_delayCounter == (DELAY_MULTIPLAYER - 1)){
dispatchEvent(new EntityEvent(DemolitionToolEntity.EXPLODE_EVENT, null, true));
};
};
dispatchEvent(new EntityEvent(EntityEvent.UPDATE));
}
public function set y(_arg1:Number):void{
_definition.y = (_y = _arg1);
}
public function get definition():DemolitionToolDefinition{
return (_definition);
}
public function createBody(_arg1:b2World):b2Body{
throw (new Error("Override required."));
}
}
}//package bb2.game.entities
Section 170
//DestroyedBlock (bb2.game.entities.DestroyedBlock)
package bb2.game.entities {
import com.bigwigmedia.mvc.events.*;
import bb2.common.*;
import com.bigwigmedia.geom.*;
public class DestroyedBlock extends AbstractGameEntity {
private var _blockKind:String;
private var _height:Number;
private var _width:Number;
private var _lifeTimeCount:Number;// = 0
private var _velocity:Vector2D;
private var _rotation:Number;
public static const LIFE_TIME:Number = 15;
public function DestroyedBlock(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Vector2D){
super(new GameItemDefinition(GameItemKind.DESTROYED_BLOCK, null, _arg2, _arg3));
_blockKind = _arg1;
_width = _arg4;
_height = _arg5;
_rotation = _arg6;
_velocity = _arg7;
}
public function get blockKind():String{
return (_blockKind);
}
public function get lifeTimeCount():Number{
return (_lifeTimeCount);
}
override public function update(_arg1:Number):void{
if (_lifeTimeCount != LIFE_TIME){
dispatchEvent(new EntityEvent(EntityEvent.UPDATE));
if (++_lifeTimeCount == LIFE_TIME){
dispatchEvent(new EntityEvent(REMOVE_EVENT, null, true));
};
};
}
public function get width():Number{
return (_width);
}
public function get rotation():Number{
return (_rotation);
}
public function get height():Number{
return (_height);
}
}
}//package bb2.game.entities
Section 171
//Explosion (bb2.game.entities.Explosion)
package bb2.game.entities {
import com.bigwigmedia.mvc.events.*;
import bb2.common.*;
public class Explosion extends AbstractGameEntity {
private var _explosiveKind:String;
public function Explosion(_arg1:ExplosionDefinition){
super(_arg1);
_explosiveKind = _arg1.explosiveKind;
}
override public function update(_arg1:Number):void{
dispatchEvent(new EntityEvent(EntityEvent.UPDATE));
}
public function get explosiveKind():String{
return (_explosiveKind);
}
}
}//package bb2.game.entities
Section 172
//Explosive (bb2.game.entities.Explosive)
package bb2.game.entities {
import bb2.common.*;
import bb2.game.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
public class Explosive extends DemolitionToolEntity {
protected var _strength:Number;
protected var _radius:Number;
public function Explosive(_arg1:ExplosiveDefinition){
super(_arg1);
_radius = _arg1.radius;
_strength = _arg1.strength;
}
public function get strength():Number{
return (_strength);
}
override public function createBody(_arg1:b2World):b2Body{
var _local2:Number;
var _local3:b2BodyDef;
_local2 = GameModel.WORLD_SCALE;
_local3 = new b2BodyDef();
_local3.position.x = (_x / _local2);
_local3.position.y = (_y / _local2);
var _local4:b2CircleDef = new b2CircleDef();
_local4.radius = (_radius / _local2);
_local4.density = 0;
_local4.isSensor = true;
var _local5:b2Body = _arg1.CreateBody(_local3);
_local5.bodyKindID = GameModel.BODY_ID_EXPLOSIVE;
var _local6:b2Shape = _local5.CreateShape(_local4);
_local5.SetMassFromShapes();
return (_local5);
}
}
}//package bb2.game.entities
Section 173
//Laser (bb2.game.entities.Laser)
package bb2.game.entities {
import com.bigwigmedia.mvc.events.*;
import bb2.common.*;
import bb2.game.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
public class Laser extends PhysicGameEntity {
private var _flipped:Boolean;
public function Laser(_arg1:LaserDefinition){
super(_arg1);
_flipped = _arg1.flipped;
}
override public function update(_arg1:Number):void{
var _local2:Number = GameModel.WORLD_SCALE;
_x = (_x + (_flipped) ? 12 : -12);
_body.SetXForm(new b2Vec2((_x / _local2), (_y / _local2)), 0);
dispatchEvent(new EntityEvent(EntityEvent.UPDATE));
}
override public function createBody(_arg1:b2World):void{
var _local2:Number;
var _local3:b2BodyDef;
var _local4:b2PolygonDef;
if (!_body){
_local2 = GameModel.WORLD_SCALE;
_local3 = new b2BodyDef();
_local3.allowSleep = true;
_local4 = new b2PolygonDef();
_local4.isSensor = true;
_local4.SetAsBox(((_width / 2) / _local2), ((_height / 2) / _local2));
_body = _arg1.CreateBody(_local3);
_body.bodyKindID = GameModel.BODY_ID_LASER;
_body.CreateShape(_local4);
_body.SetMassFromShapes();
_body.SetXForm(new b2Vec2((_x / _local2), (_y / _local2)), 0);
};
}
}
}//package bb2.game.entities
Section 174
//PhysicGameEntity (bb2.game.entities.PhysicGameEntity)
package bb2.game.entities {
import bb2.common.*;
import Box2D.Dynamics.*;
public class PhysicGameEntity extends AbstractGameEntity {
protected var _body:b2Body;
protected var _height:Number;
protected var _width:Number;
protected var _rotation:Number;
public static const MIN_ROTATION_TOLERANCE:Number = 0.0174532925199433;
public static const MIN_MOVE_TOLERANCE:Number = 0.2;
public function PhysicGameEntity(_arg1:TransformableItemDefinition){
super(_arg1);
_width = _arg1.width;
_height = _arg1.height;
_rotation = _arg1.rotation;
}
public function get rotation():Number{
return (_rotation);
}
public function get body():b2Body{
return (_body);
}
public function get width():Number{
return (_width);
}
public function get height():Number{
return (_height);
}
public function createBody(_arg1:b2World):void{
throw (new Error("Override required."));
}
}
}//package bb2.game.entities
Section 175
//UFO (bb2.game.entities.UFO)
package bb2.game.entities {
import bb2.common.*;
public class UFO extends DemolitionToolEntity {
public function UFO(_arg1:FlippableToolDefinition){
super(_arg1);
}
public function get flipped():Boolean{
return (FlippableToolDefinition(_definition).flipped);
}
public function flip():void{
FlippableToolDefinition(_definition).flip();
}
public function createLaserDefs():LaserDefinition{
var _local1:Boolean = flipped;
return (new LaserDefinition((_x + (_local1) ? 35 : -35), _y, _local1));
}
}
}//package bb2.game.entities
Section 176
//WreckingBall (bb2.game.entities.WreckingBall)
package bb2.game.entities {
import bb2.common.*;
import bb2.game.*;
import Box2D.Dynamics.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
public class WreckingBall extends DemolitionToolEntity {
private var _body:b2Body;
private var _bodyX:Number;
private var _bodyY:Number;
private var _rotation:Number;
private var _bodyRotation:Number;
public function WreckingBall(_arg1:WreckingBallDefinition){
super(_arg1);
_bodyX = _x;
_bodyY = _y;
_bodyRotation = 0;
}
public function get bodyRotation():Number{
return (_bodyRotation);
}
public function get bodyX():Number{
return (_bodyX);
}
override public function createBody(_arg1:b2World):b2Body{
var _local2:Number;
var _local3:b2BodyDef;
_local2 = GameModel.WORLD_SCALE;
_local3 = new b2BodyDef();
_local3.position.x = (_x / _local2);
_local3.position.y = (_y / _local2);
var _local4:b2CircleDef = new b2CircleDef();
_local4.radius = (WreckingBallDefinition(_definition).radius / _local2);
_local4.density = 10;
_body = _arg1.CreateBody(_local3);
_body.bodyKindID = GameModel.BODY_ID_HEAVY_BALL;
var _local5:b2Shape = _body.CreateShape(_local4);
_body.SetMassFromShapes();
_local3 = new b2BodyDef();
_local3.position.x = ((_x + (100 * (FlippableToolDefinition(_definition).flipped) ? 1 : -1)) / _local2);
_local3.position.y = (_y / _local2);
_local4 = new b2CircleDef();
_local4.radius = (WreckingBallDefinition(_definition).radius / _local2);
_local4.isSensor = true;
var _local6:b2Body = _arg1.CreateBody(_local3);
_local6.CreateShape(_local4);
_local6.SetMassFromShapes();
var _local7:b2DistanceJointDef = new b2DistanceJointDef();
_local7.Initialize(_body, _local6, _body.GetPosition(), _local6.GetPosition());
var _local8:b2Joint = _arg1.CreateJoint(_local7);
_local8.InitPositionConstraints();
return (_body);
}
override public function dispose():void{
super.dispose();
_body = null;
}
override public function set x(_arg1:Number):void{
if (!_started){
var _local2 = _arg1;
super.x = _local2;
_bodyX = _local2;
};
}
override public function update(_arg1:Number):void{
var _local2:b2Vec2;
if (_body){
_local2 = _body.GetPosition();
_bodyX = (_local2.x * GameModel.WORLD_SCALE);
_bodyY = (_local2.y * GameModel.WORLD_SCALE);
_bodyRotation = _body.GetAngle();
};
super.update(_arg1);
}
public function flip():void{
FlippableToolDefinition(_definition).flip();
}
public function get bodyY():Number{
return (_bodyY);
}
public function get flipped():Boolean{
return (FlippableToolDefinition(_definition).flipped);
}
override public function set y(_arg1:Number):void{
if (!_started){
var _local2 = _arg1;
super.y = _local2;
_bodyY = _local2;
};
}
public function get rotation():Number{
return (_rotation);
}
}
}//package bb2.game.entities
Section 177
//DemolitionToolEvent (bb2.game.events.DemolitionToolEvent)
package bb2.game.events {
import flash.events.*;
public class DemolitionToolEvent extends Event {
public static const INCREASE_TIME:String = "DemolitionToolEvent.INCREASE_TIME";
public static const DELETE:String = "DemolitionToolEvent.DELETE";
public static const FLIP:String = "DemolitionToolEvent.FLIP";
public static const DECREASE_TIME:String = "DemolitionToolEvent.DECREASE_TIME";
public static const START_DRAG:String = "DemolitionToolEvent.START_DRAG";
public static const HIDE_CONTROLS:String = "DemolitionToolEvent.HIDE_CONTROLS";
public static const SHOW_CONTROLS:String = "DemolitionToolEvent.SHOW_CONTROLS";
public function DemolitionToolEvent(_arg1:String, _arg2:Boolean=false){
super(_arg1, _arg2);
}
override public function clone():Event{
return (new DemolitionToolEvent(type, bubbles));
}
}
}//package bb2.game.events
Section 178
//HUDEvent (bb2.game.events.HUDEvent)
package bb2.game.events {
import flash.events.*;
public class HUDEvent extends Event {
private var _data:Object;
public static const DETONATE:String = "HUDEvent.detonate";
public static const SELECT_LEVEL:String = "HUDEvent.selectLevel";
public static const MAIN_MENU:String = "HUDEvent.mainMenu";
public static const RESET:String = "HUDEvent.reset";
public static const EDIT_LEVEL:String = "HUDEvent.editLevel";
public static const REPLAY_LEVEL:String = "HUDEvent.replayLevel";
public static const TOOL_ACQUIRED:String = "HUDEvent.toolAcquired";
public static const PAUSE:String = "HUDEvent.pause";
public static const TOOL_CHANGE:String = "HUDEvent.toolChange";
public static const SHOW_SHOP:String = "HUDEvent.showShop";
public static const UNPAUSE:String = "HUDEvent.unpause";
public static const NEXT_LEVEL:String = "HUDEvent.nextLevel";
public function HUDEvent(_arg1:String, _arg2:Boolean=false, _arg3:Object=null){
super(_arg1, _arg2);
_data = _arg3;
}
public function get data():Object{
return (_data);
}
override public function clone():Event{
return (new HUDEvent(type, bubbles, _data));
}
}
}//package bb2.game.events
Section 179
//ContractDialog (bb2.game.ui.ContractDialog)
package bb2.game.ui {
import flash.display.*;
import com.bigwigmedia.ui.controls.*;
import bb2.managers.*;
import flash.events.*;
import com.bigwigmedia.mvc.*;
import bb2.common.*;
import flash.geom.*;
import com.bigwigmedia.tweens.*;
import com.bigwigmedia.utils.*;
import flash.filters.*;
public class ContractDialog extends DialogView {
private var _messageTween:ITween;
private var _messageLabel:Label;
public static const THUMBNAIL_HEIGHT:int = 130;
public static const THUMBNAIL_WIDTH:int = 192;
public function ContractDialog(){
var _local1:LevelInfo = Managers.levelProgressService.getLevelInfo();
Label(getComponentByName("levelNumLabel")).text = ("Mission " + (_local1.num + 1));
Label(getComponentByName("levelNameLabel")).text = (("«" + _local1.title) + "»");
Label(getComponentByName("levelScoreLabel")).text = ("Reward: $" + _local1.price);
_messageLabel = Label(getComponentByName("clickMessageLabel"));
_messageTween = new SequenceTween([new Action(this, setMessageLabelVisible, [true]), new Delay(500), new Action(this, setMessageLabelVisible, [false]), new Delay(300)], true);
_messageTween.playAuto();
drawLevelThumbnail(_local1);
addEventListener(MouseEvent.CLICK, onMouseClickHandler);
}
private function setMessageLabelVisible(_arg1:Boolean):void{
_messageLabel.visible = _arg1;
}
private function drawBlock(_arg1:BlockDefinition, _arg2:Graphics):void{
var _local6:uint;
var _local3:Rectangle = new Rectangle(_arg1.x, _arg1.y, _arg1.width, _arg1.height);
var _local4:Point = new Point((_local3.width / 2), (_local3.height / 2));
var _local5:Number = _arg1.rotation;
var _local7:String = _arg1.kind;
switch (_local7){
case GameItemKind.BLOCK_STATIC:
_local6 = 7626498;
break;
case GameItemKind.BLOCK_CONCRETE:
_local6 = 11782324;
break;
case GameItemKind.BLOCK_WOOD:
_local6 = 12680746;
break;
case GameItemKind.BLOCK_STEEL:
_local6 = 6647157;
break;
case GameItemKind.BLOCK_GLASS:
_local6 = 12573936;
break;
};
_arg2.beginFill(_local6, 1);
GraphicsUtil.drawRectExt(_arg2, _local3, _local4, _local5);
_arg2.endFill();
}
private function drawLevelThumbnail(_arg1:LevelInfo):void{
var _local8:GameItemDefinition;
var _local2:Shape = new Shape();
addChild(_local2);
var _local3:Array = _arg1.getItemsDefinitions();
var _local4:int = _local3.length;
var _local5:int;
while (_local5 < _local4) {
_local8 = _local3[_local5];
if (_local8.superKind == GameItemKind.BLOCKS){
drawBlock(BlockDefinition(_local8), _local2.graphics);
};
_local5++;
};
var _local6:Number = Math.min(Math.min((THUMBNAIL_WIDTH / _local2.width), 1), Math.min((THUMBNAIL_HEIGHT / _local2.height), 1));
_local2.scaleX = (_local2.scaleY = _local6);
_local2.rotation = -5;
var _local7:Rectangle = _local2.getBounds(this);
_local2.x = (_local2.x - ((_local7.x + (_local7.width / 2)) - 291));
_local2.y = (_local2.y - ((_local7.y + (_local7.height / 2)) - 192));
_local2.filters = [new GlowFilter(0, 1, 2, 2, 4)];
}
override public function dispose():void{
_messageTween.dispose();
super.dispose();
}
private function onMouseClickHandler(_arg1:MouseEvent):void{
dispatchCloseEvent();
}
}
}//package bb2.game.ui
Section 180
//HintDialog (bb2.game.ui.HintDialog)
package bb2.game.ui {
import com.bigwigmedia.ui.*;
import com.bigwigmedia.mvc.*;
import bb2.common.*;
public class HintDialog extends DialogView implements IComponentIDSupplierView {
private var _componentID:String;
public function HintDialog(_arg1:String){
_componentID = _arg1;
super();
}
public function get componentID():String{
return (_componentID);
}
override protected function onComponentClick(_arg1:Component):void{
if (_arg1.name == "closeButton"){
dispatchCloseEvent();
};
}
}
}//package bb2.game.ui
Section 181
//HUD (bb2.game.ui.HUD)
package bb2.game.ui {
import flash.display.*;
import com.bigwigmedia.ui.*;
import bb2.managers.*;
import flash.events.*;
import bb2.game.events.*;
import com.bigwigmedia.mvc.*;
import bb2.game.*;
import assets.*;
import bb2.constants.*;
public class HUD extends DialogOwnerView {
private var _timeoutCounter:MovieClip;
private var _toolsMenu:ToolsMenu;
private var _shopDialog:ShopDialog;
public function HUD(){
_component.y = 404;
_toolsMenu = new ToolsMenu();
addChild(_toolsMenu);
_timeoutCounter = new TimeoutCounter();
_timeoutCounter.visible = false;
_timeoutCounter.stop();
_timeoutCounter.x = 320;
_timeoutCounter.y = 150;
addChild(_timeoutCounter);
addEventListener(HUDEvent.SHOW_SHOP, onShowShopHandler);
if (!Managers.levelProgressService.isPlayingUserLevel()){
showDialog(new ContractDialog());
};
}
override protected function onDialogClose():void{
switch (_dialog.option){
case PauseMenu.OPTION_RESUME:
dispatchEvent(new HUDEvent(HUDEvent.UNPAUSE, true));
break;
case PauseMenu.OPTION_EDIT:
dispatchEvent(new HUDEvent(HUDEvent.EDIT_LEVEL, true));
break;
};
}
public function showAcquiredTool(_arg1:String):void{
_toolsMenu.showAcquiredTool(_arg1);
}
public function updateTimeoutCounter(_arg1:Number):void{
var _local2:int = (_arg1 * _timeoutCounter.totalFrames);
if (_local2 < 1){
_local2 = 1;
};
_timeoutCounter.gotoAndStop(_local2);
}
public function set blastPoints(_arg1:int):void{
_toolsMenu.blastPoints = _arg1;
}
override public function dispose():void{
super.dispose();
removeChild(_toolsMenu);
_toolsMenu.dispose();
_toolsMenu = null;
}
private function onShopCloseHandler(_arg1:Event):void{
removeChild(_shopDialog);
_shopDialog.removeEventListener(Event.CLOSE, onShopCloseHandler);
_shopDialog.dispose();
_shopDialog = null;
}
public function get toolsMenu():ToolsMenu{
return (_toolsMenu);
}
override protected function onComponentClick(_arg1:Component):void{
switch (_arg1.name){
case "resetButton":
dispatchEvent(new HUDEvent(HUDEvent.RESET, true));
break;
case "detonateButton":
dispatchEvent(new HUDEvent(HUDEvent.DETONATE, true));
break;
case "pauseButton":
showDialog(new PauseMenu());
dispatchEvent(new HUDEvent(HUDEvent.PAUSE, true));
break;
case "twoDPlayButton":
Managers.urlCaller.mainLink();
break;
};
}
public function showHintDialog(_arg1:String):void{
showDialog(new HintDialog(_arg1));
}
override protected function removeDialog():void{
var _local1:Boolean = (((_dialog is ContractDialog)) && (Managers.levelProgressService.showInstructionsHint()));
var _local2:Boolean = (((((_dialog is ContractDialog)) || ((_dialog is HintDialog)))) && (Managers.levelProgressService.showChangeToolHint()));
super.removeDialog();
if (_local1){
showHintDialog("Hint_instructions");
} else {
if (_local2){
showHintDialog("Hint_changeTool");
Managers.soManager.setValue(SOValues.CHANGE_TOOL_HINT, true);
};
};
}
public function resetTimeoutCounter():void{
_timeoutCounter.gotoAndStop(1);
_timeoutCounter.visible = false;
}
private function onShowShopHandler(_arg1:HUDEvent):void{
_shopDialog = new ShopDialog();
_shopDialog.addEventListener(Event.CLOSE, onShopCloseHandler);
addChild(_shopDialog);
}
public function showLevelEndDialog(_arg1:LevelResult):void{
var _local2:DialogView;
if (_arg1.levelPassed){
showDialog(new LevelPassedDialog(_arg1));
} else {
showDialog(new LevelFailedDialog());
};
}
public function showTimeoutCounter():void{
_timeoutCounter.gotoAndStop(1);
_timeoutCounter.visible = true;
}
}
}//package bb2.game.ui
Section 182
//LevelFailedDialog (bb2.game.ui.LevelFailedDialog)
package bb2.game.ui {
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import bb2.managers.*;
import bb2.game.events.*;
import com.bigwigmedia.mvc.*;
import bb2.common.*;
public class LevelFailedDialog extends DialogView implements IComponentIDSupplierView {
public function LevelFailedDialog(){
var _local1:Boolean;
var _local2:Component;
super();
if (!Managers.levelProgressService.isPlayingUserLevel()){
_local1 = Managers.levelProgressService.isCurrentLevelCompleted();
getComponentByName("nextLevelButton").visible = _local1;
AbstractButton(getComponentByName("replayButton")).useBeacon = !(_local1);
if (Managers.levelProgressService.currentLevel == 49){
Button(getComponentByName("nextLevelButton")).label = "Continue";
};
};
if (((Managers.levelProgressService.isPlayingUserLevel()) && (Managers.levelProgressService.getLevelInfo().imported))){
_local2 = _component.getComponentByName("editLevelButton");
_local2.parent.removeChild(_local2);
_local2.dispose();
};
}
public function get componentID():String{
if (Managers.levelProgressService.isPlayingUserLevel()){
return ("bb2.game.ui::UserLevelFailedDialog");
};
return ("bb2.game.ui::LevelFailedDialog");
}
override protected function onComponentClick(_arg1:Component):void{
switch (_arg1.name){
case "nextLevelButton":
Managers.levelProgressService.updateForNextLevel();
dispatchEvent(new HUDEvent(HUDEvent.NEXT_LEVEL, true));
break;
case "editLevelButton":
dispatchEvent(new HUDEvent(HUDEvent.EDIT_LEVEL, true));
break;
case "replayButton":
dispatchEvent(new HUDEvent(HUDEvent.RESET, true));
dispatchCloseEvent();
break;
case "selectLevelButton":
dispatchEvent(new HUDEvent(HUDEvent.SELECT_LEVEL, true));
break;
case "mainMenuButton":
dispatchEvent(new HUDEvent(HUDEvent.MAIN_MENU, true));
break;
case "nextLevelButton":
break;
case "shopButton":
dispatchEvent(new HUDEvent(HUDEvent.SHOW_SHOP, true));
break;
case "submitScoreButton":
Managers.urlCaller.submitScore(Managers.levelProgressService.totalScore);
break;
case "twoDPlayButton":
Managers.urlCaller.mainLink();
break;
};
}
}
}//package bb2.game.ui
Section 183
//LevelPassedDialog (bb2.game.ui.LevelPassedDialog)
package bb2.game.ui {
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import bb2.managers.*;
import bb2.game.events.*;
import com.bigwigmedia.mvc.*;
import bb2.common.*;
import bb2.game.*;
import bb2.constants.*;
public class LevelPassedDialog extends DialogView implements IComponentIDSupplierView {
private var _levelResult:LevelResult;
private var _shopHintDialog:HintDialog;
public function LevelPassedDialog(_arg1:LevelResult){
var _local2:Component;
_levelResult = _arg1;
super();
if (Managers.levelProgressService.isPlayingUserLevel()){
if (Managers.levelProgressService.getLevelInfo().imported){
_local2 = _component.getComponentByName("editLevelButton");
_local2.parent.removeChild(_local2);
_local2.dispose();
};
} else {
if (Managers.levelProgressService.currentLevel == 49){
Button(getComponentByName("nextLevelButton")).label = "Continue";
};
if ((((Managers.levelProgressService.totalScoreMinus >= 5000)) && (!(Managers.soManager.getValue(SOValues.BUY_TOOL_HINT))))){
Managers.soManager.setValue(SOValues.BUY_TOOL_HINT, true);
Button(getComponentByName("shopButton")).useBeacon = true;
_shopHintDialog = new HintDialog("Hint_buyTool");
addChild(_shopHintDialog);
};
};
}
override protected function createComponent():void{
super.createComponent();
Label(getComponentByName("blastPointsBonusLabel")).text = ("Blast Points Bonus: " + _levelResult.blastPointsBonus);
Label(getComponentByName("bumpedOpponentsBonusLabel")).text = ("Opponent Bonus: " + _levelResult.bumpedOpponentsBonus);
Label(getComponentByName("bumpedCharsPenaltyLabel")).text = ("Civilian Penalty: " + _levelResult.bumpedCharsPenalty);
Label(getComponentByName("levelScoreLabel")).text = ("Level Score: " + _levelResult.levelScore);
Label(getComponentByName("bestScoreLabel")).text = ("Best Score: " + Managers.levelProgressService.getLevelScore(_levelResult.levelUID));
var _local1:Label = Label(getComponentByName("totalScoreLabel"));
if (_local1){
_local1.text = ("Total Score: " + Managers.levelProgressService.totalScore);
};
}
override public function dispose():void{
_levelResult = null;
removeShopHintDialog();
super.dispose();
}
private function removeShopHintDialog():void{
if (_shopHintDialog){
Button(getComponentByName("shopButton")).useBeacon = false;
removeChild(_shopHintDialog);
_shopHintDialog.dispose();
_shopHintDialog = null;
};
}
override protected function onComponentClick(_arg1:Component):void{
switch (_arg1.name){
case "editLevelButton":
dispatchEvent(new HUDEvent(HUDEvent.EDIT_LEVEL, true));
break;
case "replayButton":
dispatchEvent(new HUDEvent(HUDEvent.RESET, true));
dispatchCloseEvent();
break;
case "selectLevelButton":
dispatchEvent(new HUDEvent(HUDEvent.SELECT_LEVEL, true));
break;
case "mainMenuButton":
dispatchEvent(new HUDEvent(HUDEvent.MAIN_MENU, true));
break;
case "nextLevelButton":
Managers.levelProgressService.updateForNextLevel();
dispatchEvent(new HUDEvent(HUDEvent.NEXT_LEVEL, true));
break;
case "shopButton":
removeShopHintDialog();
dispatchEvent(new HUDEvent(HUDEvent.SHOW_SHOP, true));
break;
case "submitScoreButton":
Managers.urlCaller.submitScore(Managers.levelProgressService.totalScore);
break;
case "twoDPlayButton":
Managers.urlCaller.mainLink();
break;
};
}
public function get componentID():String{
if (Managers.levelProgressService.isPlayingUserLevel()){
return ("bb2.game.ui::UserLevelPassedDialog");
};
return ("bb2.game.ui::LevelPassedDialog");
}
}
}//package bb2.game.ui
Section 184
//PauseMenu (bb2.game.ui.PauseMenu)
package bb2.game.ui {
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import bb2.managers.*;
import bb2.game.events.*;
import com.bigwigmedia.mvc.*;
public class PauseMenu extends DialogView {
public static const OPTION_EDIT:String = "OPTION_EDIT";
public static const OPTION_RESUME:String = "OPTION_RESUME";
public function PauseMenu(){
var _local1:Component;
super();
showSoundButtonLabel();
if (((!(Managers.levelProgressService.isPlayingUserLevel())) || (Managers.levelProgressService.getLevelInfo().imported))){
_local1 = _component.getComponentByName("editLevelButton");
_local1.parent.removeChild(_local1);
_local1.dispose();
};
}
private function showSoundButtonLabel():void{
var _local1:String = (Managers.configManager.soundEnabled) ? "Switch Sound OFF" : "Switch Sound ON";
Button(getComponentByName("soundButton")).label = _local1;
}
override protected function onComponentClick(_arg1:Component):void{
switch (_arg1.name){
case "resumeButton":
dispatchCloseEvent(OPTION_RESUME);
break;
case "editLevelButton":
dispatchCloseEvent(OPTION_EDIT);
break;
case "selectLevelButton":
dispatchEvent(new HUDEvent(HUDEvent.SELECT_LEVEL, true));
break;
case "soundButton":
Managers.configManager.soundEnabled = !(Managers.configManager.soundEnabled);
showSoundButtonLabel();
break;
case "viewScoresButton":
Managers.urlCaller.viewScores();
break;
case "mainMenuButton":
dispatchEvent(new HUDEvent(HUDEvent.MAIN_MENU, true));
break;
case "twoDPlayButton":
Managers.urlCaller.mainLink();
break;
};
}
}
}//package bb2.game.ui
Section 185
//ShopDialog (bb2.game.ui.ShopDialog)
package bb2.game.ui {
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import bb2.managers.*;
import com.bigwigmedia.events.*;
import bb2.game.events.*;
import com.bigwigmedia.mvc.*;
import bb2.common.*;
import com.bigwigmedia.tweens.*;
import bb2.constants.*;
public class ShopDialog extends DialogView {
private var _messageTween:ITween;
private var _selectedToolKind:String;// = null
private var _messageLabel:Label;
public function ShopDialog(){
showSelectedToolInfo();
_messageLabel = Label(getComponentByName("cantBuyMessageLabel"));
_messageLabel.visible = false;
showToolAcquiredLabel(GameItemKind.EXPL_NITROGLYCERIN);
showToolAcquiredLabel(GameItemKind.EXPL_C4);
showToolAcquiredLabel(GameItemKind.EXPL_ANTIMATTER);
showToolAcquiredLabel(GameItemKind.TOOL_ACID_BALLOON);
showToolAcquiredLabel(GameItemKind.TOOL_AIR_STRIKE);
showToolAcquiredLabel(GameItemKind.TOOL_UFO);
showToolAcquiredLabel(GameItemKind.TOOL_WRECKING_BALL);
}
private function setMessageLabelVisible(_arg1:Boolean):void{
_messageLabel.visible = _arg1;
}
private function removeMessageTween():void{
if (_messageTween){
_messageTween.removeEventListener(TweenEvent.COMPLETE, onMessageTweenCompleteHandler);
_messageTween.dispose();
_messageTween = null;
};
}
private function onMessageTweenCompleteHandler(_arg1:TweenEvent):void{
removeMessageTween();
}
private function showToolAcquiredLabel(_arg1:String):void{
var _local2:Text;
if (Managers.levelProgressService.isToolAcquired(_arg1)){
_local2 = Text(getComponentByName(("text_" + _arg1)));
_local2.htmlText = "<p align='center'><font size='22' color='#009900'>Acquired</font></p>";
};
}
override protected function onComponentClick(_arg1:Component):void{
var _local2:Boolean;
switch (_arg1.name){
case "closeButton":
dispatchCloseEvent();
break;
case "toolButton":
_selectedToolKind = SkinnedButton(_arg1).value;
showSelectedToolInfo();
break;
case "buyButton":
_local2 = Managers.levelProgressService.acquireTool(_selectedToolKind);
if (_local2){
showToolAcquiredLabel(_selectedToolKind);
showSelectedToolInfo();
Managers.soundManager.play(SoundID.UPGRADE_BUY_SFX);
dispatchEvent(new HUDEvent(HUDEvent.TOOL_ACQUIRED, true, _selectedToolKind));
} else {
Managers.soundManager.play(SoundID.CANCEL_SFX);
if (!_messageTween){
_messageTween = new SequenceTween([new Action(this, setMessageLabelVisible, [true]), new Delay(500), new Action(this, setMessageLabelVisible, [false]), new Delay(300), new Action(this, setMessageLabelVisible, [true]), new Delay(500), new Action(this, setMessageLabelVisible, [false]), new Delay(300), new Action(this, setMessageLabelVisible, [true]), new Delay(500), new Action(this, setMessageLabelVisible, [false])]);
_messageTween.addEventListener(TweenEvent.COMPLETE, onMessageTweenCompleteHandler);
_messageTween.playAuto();
};
};
break;
};
}
private function showSelectedToolInfo():void{
var _local5:XML;
var _local1 = "";
var _local2 = "";
var _local3:Boolean;
var _local4:Boolean;
if (_selectedToolKind){
_local5 = Managers.configManager.getDemolitionToolConfig(_selectedToolKind);
_local1 = _local5.description;
_local2 = (("<font size=\"24\" color=\"#009900\">$" + _local5.price) + "</font>");
_local3 = !(Managers.levelProgressService.isToolAcquired(_selectedToolKind));
_local4 = !(_local3);
};
getComponentByName("clickIconHint").visible = (_selectedToolKind == null);
Text(getComponentByName("toolDescriptionText")).htmlText = _local1;
Label(getComponentByName("toolPriceLabel")).htmlText = _local2;
getComponentByName("buyButton").visible = _local3;
getComponentByName("acquiredLabel").visible = _local4;
Label(getComponentByName("totalScoreLabel")).text = ("Your Bank: $" + Managers.levelProgressService.totalScoreMinus);
}
override public function dispose():void{
removeMessageTween();
super.dispose();
}
}
}//package bb2.game.ui
Section 186
//ToolsMenu (bb2.game.ui.ToolsMenu)
package bb2.game.ui {
import flash.display.*;
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import bb2.managers.*;
import com.bigwigmedia.events.*;
import flash.events.*;
import bb2.game.events.*;
import com.bigwigmedia.mvc.*;
import bb2.common.*;
import flash.geom.*;
import com.bigwigmedia.ui.containers.*;
import assets.*;
import com.bigwigmedia.display.*;
import com.bigwigmedia.tweens.*;
import com.bigwigmedia.tweens.easing.*;
public class ToolsMenu extends DialogView {
private var _selectedToolBlastPointsLabel:Label;
private var _toolboxAnimationClient:AnimationClient;
private var _blastPointsLabel:Label;
private var _selectedToolKind:String;
private var _selectedToolBlastPoints:int;// = 0
private var _tween:ITween;
private var _numBlastPoints:int;
private var _labelTween:ITween;
private var _canvas:Canvas;
private var _mouseBlocker:Sprite;
public function ToolsMenu(){
_mouseBlocker = new Sprite();
_mouseBlocker.graphics.beginFill(0, 0);
_mouseBlocker.graphics.drawRect(0, 0, 640, 480);
_mouseBlocker.graphics.endFill();
addChildAt(_mouseBlocker, 0);
_mouseBlocker.visible = false;
_component.visible = false;
_component.y = 480;
var _local1:XML = <cntn:Canvas xmlns:cntn="com.bigwigmedia.ui.containers" xmlns:ctrl="com.bigwigmedia.ui.controls" width="150" height="76" x="0" y="404" mouseEnabled="false" mouseChildren="true">
<ctrl:Label name="blastPointsLabel" right="10" middle="0" textFormat="font=FontID(assets.Font_1),size=28,color=0xFFFFFF" toolTip="Blast points remaining"/>
<ctrl:SkinnedButton name="selectedToolIndicator" left="10" middle="0"/>
<ctrl:Label name="selectedToolBlastPointsLabel" text="12" left="4" bottom="4" textFormat="font=FontID(assets.Font_1),size=18,color=0xFFFFFF"/>
</cntn:Canvas>
;
_canvas = Canvas(ComponentFactory.create(_local1));
_blastPointsLabel = Label(_canvas.getComponentByName("blastPointsLabel"));
_selectedToolBlastPointsLabel = Label(_canvas.getComponentByName("selectedToolBlastPointsLabel"));
addChildAt(_canvas, 0);
_toolboxAnimationClient = new AnimationClient();
_toolboxAnimationClient.mouseChildren = (_toolboxAnimationClient.mouseEnabled = false);
_toolboxAnimationClient.y = 410;
_toolboxAnimationClient.scaleX = (_toolboxAnimationClient.scaleY = 0.9);
_toolboxAnimationClient.addChild(new ToolboxAnimation());
addChildAt(_toolboxAnimationClient, 0);
graphics.beginFill(0xFFFFFF, 0);
graphics.drawRect(0, 404, 150, 76);
graphics.endFill();
addEventListener(MouseEvent.MOUSE_UP, onMouseClickHandler);
addEventListener(MouseEvent.MOUSE_UP, onMouseClickHandler);
selectedToolKind = GameItemKind.EXPL_TNT;
setToolButtonEnabledState(GameItemKind.EXPL_NITROGLYCERIN);
setToolButtonEnabledState(GameItemKind.EXPL_C4);
setToolButtonEnabledState(GameItemKind.EXPL_ANTIMATTER);
setToolButtonEnabledState(GameItemKind.TOOL_ACID_BALLOON);
setToolButtonEnabledState(GameItemKind.TOOL_UFO);
setToolButtonEnabledState(GameItemKind.TOOL_AIR_STRIKE);
setToolButtonEnabledState(GameItemKind.TOOL_WRECKING_BALL);
}
override public function dispose():void{
removeChild(_canvas);
stopLabelTween();
_canvas.dispose();
_canvas = null;
_toolboxAnimationClient.dispose();
super.dispose();
}
public function set enabled(_arg1:Boolean):void{
this.mouseChildren = (this.mouseEnabled = _arg1);
}
public function set blastPoints(_arg1:int):void{
_numBlastPoints = _arg1;
_blastPointsLabel.text = String(_arg1);
updateLabelState();
}
public function get selectedToolKind():String{
return (_selectedToolKind);
}
private function onMouseClickHandler(_arg1:MouseEvent):void{
if (((((!(_tween)) && (!(_mouseBlocker.visible)))) && ((((_arg1.target == this)) || ((_arg1.target.parent == _canvas)))))){
_component.visible = true;
_mouseBlocker.visible = true;
_tween = new ParallelTween([new PropertyTween(_component, "y", 480, 350, "5", Easing.BACK_OUT), new Update(_toolboxAnimationClient, "5")]);
_tween.addEventListener(TweenEvent.COMPLETE, onAppearTweenCompleteHandler);
_tween.playAuto();
_canvas.visible = false;
};
}
override protected function onComponentClick(_arg1:Component):void{
var _local2:AbstractButton = (_arg1 as AbstractButton);
if (((_tween) || (!(_local2)))){
return;
};
if (_local2.name == "shopButton"){
dispatchEvent(new HUDEvent(HUDEvent.SHOW_SHOP, true));
hideComponent();
} else {
if (_local2.value){
this.selectedToolKind = _local2.value;
hideComponent();
};
};
}
public function set selectedToolKind(_arg1:String):void{
var _local2:Class;
var _local3:XML;
if (_selectedToolKind != _arg1){
_selectedToolKind = _arg1;
switch (_arg1){
case GameItemKind.EXPL_TNT:
_local2 = TNTToolImage;
break;
case GameItemKind.EXPL_C4:
_local2 = C4ToolImage;
break;
case GameItemKind.EXPL_NITROGLYCERIN:
_local2 = NitroglycerinToolImage;
break;
case GameItemKind.EXPL_ANTIMATTER:
_local2 = AntimatterToolImage;
break;
case GameItemKind.TOOL_ACID_BALLOON:
_local2 = AcidBalloonToolImage;
break;
case GameItemKind.TOOL_UFO:
_local2 = UFOToolImage;
break;
case GameItemKind.TOOL_WRECKING_BALL:
_local2 = WreckingBallToolImage;
break;
case GameItemKind.TOOL_AIR_STRIKE:
_local2 = AirStrikeToolImage;
break;
};
_local3 = Managers.configManager.getDemolitionToolConfig(_selectedToolKind);
_selectedToolBlastPoints = int(_local3.blastPoints);
_selectedToolBlastPointsLabel.text = String(_selectedToolBlastPoints);
updateLabelState();
SkinnedButton(_canvas.getComponentByName("selectedToolIndicator")).setInstanceStyle("upSkin", _local2);
dispatchEvent(new HUDEvent(HUDEvent.TOOL_CHANGE, true));
};
}
private function onDisappearTweenCompleteHandler(_arg1:TweenEvent):void{
_canvas.visible = true;
_component.visible = false;
_mouseBlocker.visible = false;
_tween.removeEventListener(TweenEvent.COMPLETE, onDisappearTweenCompleteHandler);
_tween.dispose();
_tween = null;
}
private function onStageMouseMoveHandler(_arg1:MouseEvent):void{
if (((!(_tween)) && ((((_arg1.stageY < 350)) || ((_arg1.stageX > 180)))))){
hideComponent();
};
}
private function startLabelTween():void{
if (_labelTween){
return;
};
_labelTween = new SequenceTween([new ColorTween(_blastPointsLabel, 0xFF0000, 0, 0xFF0000, 1, 500), new ColorTween(_blastPointsLabel, 0xFF0000, 1, 0xFF0000, 0, 500)], true);
_labelTween.playAuto();
}
private function onAppearTweenCompleteHandler(_arg1:TweenEvent):void{
_tween.removeEventListener(TweenEvent.COMPLETE, onAppearTweenCompleteHandler);
_tween.dispose();
_tween = null;
if (stage){
stage.addEventListener(MouseEvent.MOUSE_MOVE, onStageMouseMoveHandler, false, 0, true);
};
}
private function setToolButtonEnabledState(_arg1:String):void{
var _local4:Class;
var _local2:Component = getComponentByName((_arg1 + "_toolButton"));
var _local3:Boolean = Managers.levelProgressService.isToolAcquired(_arg1);
_local2.enabled = _local3;
if (_local3){
switch (_arg1){
case GameItemKind.EXPL_NITROGLYCERIN:
_local4 = NitroglycerinToolIcon;
break;
case GameItemKind.EXPL_C4:
_local4 = C4ToolIcon;
break;
case GameItemKind.EXPL_ANTIMATTER:
_local4 = AntimatterToolIcon;
break;
case GameItemKind.TOOL_ACID_BALLOON:
_local4 = AcidBalloonToolIcon;
break;
case GameItemKind.TOOL_UFO:
_local4 = UFOToolIcon;
break;
case GameItemKind.TOOL_AIR_STRIKE:
_local4 = AirStrikeToolIcon;
break;
case GameItemKind.TOOL_WRECKING_BALL:
_local4 = WreckingBallToolIcon;
break;
};
} else {
_local4 = QuestionMarkIcon;
};
_local2.setInstanceStyle("icon", _local4);
}
private function hideComponent():void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, onStageMouseMoveHandler);
_tween = new ParallelTween([new PropertyTween(_component, "y", 350, 480, "7", Easing.BACK_IN), new Update(_toolboxAnimationClient, "7")]);
_tween.addEventListener(TweenEvent.COMPLETE, onDisappearTweenCompleteHandler);
_tween.playAuto();
}
public function showAcquiredTool(_arg1:String):void{
setToolButtonEnabledState(_arg1);
}
public function get isSelecting():Boolean{
return (_mouseBlocker.visible);
}
private function updateLabelState():void{
if ((((_numBlastPoints == 0)) || ((_numBlastPoints < _selectedToolBlastPoints)))){
startLabelTween();
} else {
stopLabelTween();
};
}
private function stopLabelTween():void{
if (!_labelTween){
return;
};
_labelTween.dispose();
_labelTween = null;
_blastPointsLabel.transform.colorTransform = new ColorTransform();
}
}
}//package bb2.game.ui
Section 187
//AbstractDemolitionToolView (bb2.game.views.AbstractDemolitionToolView)
package bb2.game.views {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import com.bigwigmedia.font.*;
import flash.events.*;
import bb2.game.events.*;
import bb2.game.entities.*;
import com.bigwigmedia.mvc.*;
import flash.geom.*;
import flash.text.*;
import com.bigwigmedia.core.*;
import flash.filters.*;
public class AbstractDemolitionToolView extends Sprite implements IDisposable {
protected var _entity:DemolitionToolEntity;
private var _controls:ComponentView;
private var _delayField:TextField;
private var _isDragging:Boolean;// = false
public function AbstractDemolitionToolView(_arg1:DemolitionToolEntity, _arg2:ComponentView){
_entity = _arg1;
_entity.addEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
_entity.addEventListener(DemolitionToolEntity.EXPLODE_EVENT, onEntityExplodeHandler);
_controls = _arg2;
_controls.visible = false;
addChild(_controls);
_delayField = new TextField();
_delayField.mouseEnabled = false;
_delayField.embedFonts = true;
_delayField.defaultTextFormat = new TextFormat(IFontManager(Singleton.getInstanceByInterface(IFontManager)).getFontName("assets.Font_1"), 24, 0xFFFFFF);
_delayField.autoSize = TextFieldAutoSize.LEFT;
_delayField.filters = [new GlowFilter(0, 1, 4, 4, 3)];
addChild(_delayField);
updateDelay();
addEventListener(DemolitionToolEvent.INCREASE_TIME, onIncreaseTimeHandler);
addEventListener(DemolitionToolEvent.DECREASE_TIME, onDecreaseTimeHandler);
addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHandler);
addEventListener(MouseEvent.MOUSE_OUT, onMouseOutHandler);
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler);
}
private function onEntityUpdateHandler(_arg1:EntityEvent):void{
updateDelay();
}
private function onMouseOutHandler(_arg1:MouseEvent):void{
controlsVisibility = false;
}
private function set controlsVisibility(_arg1:Boolean):void{
if (((_isDragging) || (_entity.started))){
return;
};
if (_controls.visible != _arg1){
_controls.visible = _arg1;
dispatchEvent(new DemolitionToolEvent((_arg1) ? DemolitionToolEvent.SHOW_CONTROLS : DemolitionToolEvent.HIDE_CONTROLS, true));
};
}
override public function stopDrag():void{
_isDragging = false;
super.stopDrag();
}
public function dispose():void{
_entity.removeEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
_entity.removeEventListener(DemolitionToolEntity.EXPLODE_EVENT, onEntityExplodeHandler);
_entity = null;
removeChild(_controls);
_controls.dispose();
_controls = null;
}
protected function get hideOnExplode():Boolean{
return (true);
}
private function onMouseDownHandler(_arg1:MouseEvent):void{
if (_arg1.target.name == "spacer"){
_isDragging = true;
dispatchEvent(new DemolitionToolEvent(DemolitionToolEvent.START_DRAG, true));
};
}
public function get entity():DemolitionToolEntity{
return (_entity);
}
private function onDecreaseTimeHandler(_arg1:DemolitionToolEvent):void{
_entity.delay--;
}
private function onEntityExplodeHandler(_arg1:Event):void{
if (hideOnExplode){
this.visible = false;
};
}
override public function set y(_arg1:Number):void{
var _local2 = _arg1;
super.y = _local2;
_entity.y = _local2;
if (!_entity.started){
constrainCoords();
};
}
public function constrainCoords():void{
if (!parent){
return;
};
var _local1:Point = new Point(this.x, this.y);
_local1 = parent.localToGlobal(_local1);
var _local2:Number = _controls.component.width;
var _local3:Number = _controls.component.height;
var _local4:Rectangle = new Rectangle((_local1.x - (_local2 / 2)), (_local1.y - (_local3 / 2)), _local2, _local3);
var _local5:Number = 0;
var _local6:Number = 0;
if (_local4.x < 0){
_local5 = -(_local4.x);
} else {
if (_local4.right > 640){
_local5 = (640 - _local4.right);
};
};
if (_local4.y < 0){
_local6 = -(_local4.y);
} else {
if (_local4.bottom > 404){
_local6 = (404 - _local4.bottom);
};
};
_entity.x = (_entity.x + _local5);
super.x = _entity.x;
_entity.y = (_entity.y + _local6);
super.y = _entity.y;
}
override public function set x(_arg1:Number):void{
var _local2 = _arg1;
super.x = _local2;
_entity.x = _local2;
if (!_entity.started){
constrainCoords();
};
}
private function updateDelay():void{
_delayField.text = _entity.currentDelay.toString();
_delayField.x = (-(_delayField.width) / 2);
_delayField.y = (-(_delayField.height) / 2);
}
private function onIncreaseTimeHandler(_arg1:DemolitionToolEvent):void{
_entity.delay++;
}
private function onMouseOverHandler(_arg1:MouseEvent):void{
controlsVisibility = true;
}
}
}//package bb2.game.views
Section 188
//AcidBalloonView (bb2.game.views.AcidBalloonView)
package bb2.game.views {
import flash.display.*;
import bb2.game.entities.*;
import assets.*;
public class AcidBalloonView extends AbstractDemolitionToolView {
private var _sprite:Sprite;
public function AcidBalloonView(_arg1:AbstractGameEntity){
super(AcidBalloon(_arg1), new ExplosiveControls());
_sprite = new AcidBalloonSprite();
_sprite.mouseChildren = false;
addChildAt(_sprite, 0);
this.x = _entity.x;
this.y = _entity.y;
}
}
}//package bb2.game.views
Section 189
//AcidView (bb2.game.views.AcidView)
package bb2.game.views {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import bb2.game.entities.*;
import com.bigwigmedia.core.*;
import assets.*;
import com.bigwigmedia.display.*;
public class AcidView extends Sprite implements IDisposable {
private var _animationClient:AnimationClient;
private var _entity:Acid;
public function AcidView(_arg1:AbstractGameEntity){
_entity = Acid(_arg1);
_entity.addEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
this.x = _entity.x;
this.y = _entity.y;
_animationClient = new AnimationClient();
var _local2:MovieClip = new AcidAnimation();
_local2.scaleX = (_local2.scaleY = 0.5);
_animationClient.addChild(_local2);
addChild(_animationClient);
}
public function dispose():void{
_entity.removeEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
_entity = null;
removeChild(_animationClient);
_animationClient.dispose();
}
private function onEntityUpdateHandler(_arg1:EntityEvent):void{
this.x = _entity.x;
this.y = _entity.y;
_animationClient.update(0);
}
}
}//package bb2.game.views
Section 190
//AirStrikeBallView (bb2.game.views.AirStrikeBallView)
package bb2.game.views {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import bb2.game.entities.*;
import com.bigwigmedia.core.*;
import assets.*;
public class AirStrikeBallView extends Sprite implements IDisposable {
private var _entity:AirStrikeBall;
public function AirStrikeBallView(_arg1:AbstractGameEntity){
_entity = AirStrikeBall(_arg1);
_entity.addEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
this.x = _entity.x;
this.y = _entity.y;
var _local2:Sprite = new AirStrikeBallSprite();
addChild(_local2);
}
public function dispose():void{
_entity.removeEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
_entity = null;
}
private function onEntityUpdateHandler(_arg1:EntityEvent):void{
this.x = _entity.x;
this.y = _entity.y;
this.rotation = ((_entity.rotation / Math.PI) * 180);
}
}
}//package bb2.game.views
Section 191
//AirStrikeView (bb2.game.views.AirStrikeView)
package bb2.game.views {
import flash.display.*;
import bb2.game.entities.*;
import assets.*;
public class AirStrikeView extends AbstractDemolitionToolView {
private var _sprite:Sprite;
public function AirStrikeView(_arg1:AbstractGameEntity){
super(AirStrike(_arg1), new ExplosiveControls());
_sprite = new AirStrikeSprite();
_sprite.mouseChildren = false;
addChildAt(_sprite, 0);
this.x = _entity.x;
this.y = _entity.y;
}
}
}//package bb2.game.views
Section 192
//AntimatterAttractorView (bb2.game.views.AntimatterAttractorView)
package bb2.game.views {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import bb2.game.entities.*;
import com.bigwigmedia.core.*;
import assets.*;
import com.bigwigmedia.display.*;
public class AntimatterAttractorView extends Sprite implements IDisposable {
private var _animationClient:AnimationClient;
private var _entity:AntimatterAttractor;
public function AntimatterAttractorView(_arg1:AbstractGameEntity){
_entity = AntimatterAttractor(_arg1);
_entity.addEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
this.x = _entity.x;
this.y = _entity.y;
_animationClient = new AnimationClient();
_animationClient.addChild(new AntimatterAttractorClip());
addChild(_animationClient);
}
public function dispose():void{
_entity.removeEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
_entity = null;
removeChild(_animationClient);
_animationClient.dispose();
}
private function onEntityUpdateHandler(_arg1:EntityEvent):void{
_animationClient.update(0);
}
}
}//package bb2.game.views
Section 193
//BlockView (bb2.game.views.BlockView)
package bb2.game.views {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import bb2.game.entities.*;
import bb2.common.*;
import com.bigwigmedia.core.*;
public class BlockView extends Sprite implements IDisposable {
private var _entity:Block;
public function BlockView(_arg1:AbstractGameEntity){
mouseEnabled = false;
mouseChildren = false;
_entity = Block(_arg1);
_entity.addEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
var _local2:Bitmap = BlockBitmapFactory.create(_entity.kind, _entity.width, _entity.height, _entity.broken);
_local2.x = (-(_entity.width) / 2);
_local2.y = (-(_entity.height) / 2);
addChild(_local2);
onEntityUpdateHandler(null);
}
public function dispose():void{
_entity.removeEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
_entity = null;
}
private function onEntityUpdateHandler(_arg1:EntityEvent):void{
this.x = _entity.x;
this.y = _entity.y;
this.rotation = ((_entity.rotation / Math.PI) * 180);
}
}
}//package bb2.game.views
Section 194
//CharacterView (bb2.game.views.CharacterView)
package bb2.game.views {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import flash.events.*;
import bb2.game.entities.*;
import bb2.common.*;
import com.bigwigmedia.core.*;
import assets.*;
import flash.filters.*;
public class CharacterView extends Sprite implements IDisposable {
private var _direction:int;// = 1
private var _entity:Character;
private var _animation:MovieClip;
private var _started:Boolean;// = false
private var _clip:MovieClip;
private static const GLOW:GlowFilter = new GlowFilter(0, 1, 2, 2, 3, 1);
public function CharacterView(_arg1:AbstractGameEntity){
_entity = Character(_arg1);
_entity.addEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
_entity.addEventListener("STATE_CHANGED", onStateChangedHandler);
mouseEnabled = false;
mouseChildren = false;
this.filters = [GLOW];
switch (_entity.kind){
case GameItemKind.CHARACTER_OPPONENT:
_clip = new OpponentClip();
break;
case GameItemKind.CHARACTER_MAN:
_clip = new ManClip();
break;
case GameItemKind.CHARACTER_WOMAN:
_clip = new WomanClip();
break;
};
_clip.addEventListener(Event.ADDED, onAddedHandler);
_clip.gotoAndStop(Character.STATE_STAYING);
addChild(_clip);
onEntityUpdateHandler(null);
}
public function dispose():void{
_entity.removeEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
_entity = null;
}
private function onStateChangedHandler(_arg1:Event):void{
_clip.gotoAndStop(_entity.state);
}
private function onAddedHandler(_arg1:Event):void{
var _local2:MovieClip = (_arg1.target as MovieClip);
if (((_local2) && ((_local2.parent == _clip)))){
_animation = _local2;
_animation.stop();
};
}
private function onEntityUpdateHandler(_arg1:EntityEvent):void{
if (_animation){
if (_animation.currentFrame == _animation.totalFrames){
_animation.gotoAndStop(1);
} else {
_animation.nextFrame();
};
};
_clip.scaleX = ((_entity.direction < 0)) ? -1 : 1;
this.x = _entity.x;
this.y = _entity.y;
}
}
}//package bb2.game.views
Section 195
//CleanZoneView (bb2.game.views.CleanZoneView)
package bb2.game.views {
import flash.display.*;
import flash.events.*;
import bb2.game.entities.*;
import flash.geom.*;
import com.bigwigmedia.core.*;
import assets.*;
public class CleanZoneView extends Sprite implements IDisposable {
private var _entity:CleanZone;
private static const RED_TEXTURE:BitmapData = new CleanZoneRedTexture(0, 0);
private static const GREEN_TEXTURE:BitmapData = new CleanZoneGreenTexture(0, 0);
public function CleanZoneView(_arg1:AbstractGameEntity){
mouseEnabled = false;
mouseChildren = false;
_entity = CleanZone(_arg1);
_entity.addEventListener(Event.CHANGE, onEntityChangeHandler);
this.x = _entity.x;
this.y = _entity.y;
addEventListener(Event.ADDED_TO_STAGE, onAddedToStageHandler);
onEntityChangeHandler(null);
}
private function onEntityChangeHandler(_arg1:Event):void{
graphics.clear();
graphics.lineStyle(2, 0, 1, false, LineScaleMode.NONE);
var _local2:Matrix = this.transform.concatenatedMatrix;
_local2.invert();
graphics.beginBitmapFill((_entity.clean) ? GREEN_TEXTURE : RED_TEXTURE, _local2);
graphics.drawRoundRect((-(_entity.width) / 2), (-(_entity.height) / 2), _entity.width, _entity.height, 8, 8);
graphics.endFill();
}
private function onAddedToStageHandler(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStageHandler);
onEntityChangeHandler(null);
}
public function dispose():void{
_entity.removeEventListener(Event.CHANGE, onEntityChangeHandler);
_entity = null;
}
}
}//package bb2.game.views
Section 196
//DestroyedBlockView (bb2.game.views.DestroyedBlockView)
package bb2.game.views {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import bb2.game.entities.*;
import bb2.common.*;
import com.bigwigmedia.core.*;
public class DestroyedBlockView extends Sprite implements IDisposable {
private var _entity:DestroyedBlock;
public function DestroyedBlockView(_arg1:AbstractGameEntity){
_entity = DestroyedBlock(_arg1);
_entity.addEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
var _local2:Bitmap = BlockBitmapFactory.create(_entity.blockKind, _entity.width, _entity.height, true);
_local2.x = (-(_entity.width) / 2);
_local2.y = (-(_entity.height) / 2);
addChild(_local2);
this.x = _entity.x;
this.y = _entity.y;
this.rotation = ((_entity.rotation / Math.PI) * 180);
}
public function dispose():void{
_entity = null;
}
private function onEntityUpdateHandler(_arg1:EntityEvent):void{
this.alpha = (1 - (_entity.lifeTimeCount / DestroyedBlock.LIFE_TIME));
}
}
}//package bb2.game.views
Section 197
//ExplosionView (bb2.game.views.ExplosionView)
package bb2.game.views {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import bb2.game.entities.*;
import bb2.common.*;
import com.bigwigmedia.core.*;
import assets.*;
import com.bigwigmedia.display.*;
public class ExplosionView extends Sprite implements IDisposable {
private var _animationClient:AnimationClient;
private var _entity:Explosion;
public function ExplosionView(_arg1:AbstractGameEntity){
var _local2:DisplayObject;
super();
_entity = Explosion(_arg1);
_entity.addEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
this.x = _entity.x;
this.y = _entity.y;
switch (_entity.explosiveKind){
case GameItemKind.EXPL_TNT:
case GameItemKind.EXPL_AIR_STRIKE_BALL:
_local2 = new ExplosionClip();
break;
case GameItemKind.EXPL_NITROGLYCERIN:
_local2 = new ExplosionClip();
_local2.scaleX = (_local2.scaleY = 1.5);
break;
case GameItemKind.EXPL_C4:
_local2 = new ExplosionClip();
_local2.scaleX = (_local2.scaleY = 2);
break;
case GameItemKind.EXPL_ANTIMATTER:
_local2 = new AntimatterExplosionClip();
break;
case GameItemKind.ACID:
_local2 = new AcidExplosionAnimation();
_local2.scaleX = (_local2.scaleY = 0.5);
break;
case GameItemKind.TOOL_ACID_BALLOON:
_local2 = new AcidBalloonExplosionAnimation();
break;
};
_animationClient = new AnimationClient();
_animationClient.addChild(_local2);
addChild(_animationClient);
}
public function dispose():void{
_entity.removeEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
_entity = null;
removeChild(_animationClient);
_animationClient.dispose();
}
private function onEntityUpdateHandler(_arg1:EntityEvent):void{
_animationClient.update(0);
}
}
}//package bb2.game.views
Section 198
//ExplosiveControls (bb2.game.views.ExplosiveControls)
package bb2.game.views {
import com.bigwigmedia.ui.*;
import flash.events.*;
import bb2.game.events.*;
import com.bigwigmedia.mvc.*;
public class ExplosiveControls extends ComponentView {
public function ExplosiveControls(){
_component.x = (_component.y = -30);
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler);
}
override protected function onComponentClick(_arg1:Component):void{
switch (_arg1.name){
case "deleteButton":
parent.dispatchEvent(new DemolitionToolEvent(DemolitionToolEvent.DELETE, true));
break;
case "increaseTimeButton":
dispatchEvent(new DemolitionToolEvent(DemolitionToolEvent.INCREASE_TIME, true));
break;
case "decreaseTimeButton":
dispatchEvent(new DemolitionToolEvent(DemolitionToolEvent.DECREASE_TIME, true));
break;
};
}
private function onMouseDownHandler(_arg1:MouseEvent):void{
if (_arg1.target.name == "spacer"){
parent.dispatchEvent(new DemolitionToolEvent(DemolitionToolEvent.START_DRAG, true));
};
}
}
}//package bb2.game.views
Section 199
//ExplosiveView (bb2.game.views.ExplosiveView)
package bb2.game.views {
import flash.display.*;
import bb2.game.entities.*;
import bb2.common.*;
import assets.*;
public class ExplosiveView extends AbstractDemolitionToolView {
private var _sprite:Sprite;
public function ExplosiveView(_arg1:AbstractGameEntity){
super(Explosive(_arg1), new ExplosiveControls());
switch (_entity.kind){
case GameItemKind.EXPL_TNT:
_sprite = new TNTSprite();
break;
case GameItemKind.EXPL_NITROGLYCERIN:
_sprite = new NitroglycerinSprite();
break;
case GameItemKind.EXPL_C4:
_sprite = new C4Sprite();
break;
case GameItemKind.EXPL_ANTIMATTER:
_sprite = new AntimatterSprite();
break;
};
_sprite.mouseChildren = false;
addChildAt(_sprite, 0);
this.x = _entity.x;
this.y = _entity.y;
}
}
}//package bb2.game.views
Section 200
//LaserView (bb2.game.views.LaserView)
package bb2.game.views {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import bb2.game.entities.*;
import com.bigwigmedia.core.*;
import assets.*;
import com.bigwigmedia.display.*;
public class LaserView extends Sprite implements IDisposable {
private var _animationClient:AnimationClient;
private var _entity:Laser;
public function LaserView(_arg1:AbstractGameEntity){
_entity = Laser(_arg1);
_entity.addEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
this.x = _entity.x;
this.y = _entity.y;
_animationClient = new AnimationClient();
_animationClient.addChild(new LaserAnimation());
addChild(_animationClient);
}
public function dispose():void{
_entity.removeEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
_entity = null;
removeChild(_animationClient);
_animationClient.dispose();
}
private function onEntityUpdateHandler(_arg1:EntityEvent):void{
this.x = _entity.x;
this.y = _entity.y;
_animationClient.update(0);
}
}
}//package bb2.game.views
Section 201
//UFOControls (bb2.game.views.UFOControls)
package bb2.game.views {
import com.bigwigmedia.ui.*;
import flash.events.*;
import bb2.game.events.*;
import com.bigwigmedia.mvc.*;
public class UFOControls extends ComponentView {
public function UFOControls(){
_component.x = (_component.y = -30);
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler);
}
override protected function onComponentClick(_arg1:Component):void{
switch (_arg1.name){
case "deleteButton":
parent.dispatchEvent(new DemolitionToolEvent(DemolitionToolEvent.DELETE, true));
break;
case "increaseTimeButton":
dispatchEvent(new DemolitionToolEvent(DemolitionToolEvent.INCREASE_TIME, true));
break;
case "decreaseTimeButton":
dispatchEvent(new DemolitionToolEvent(DemolitionToolEvent.DECREASE_TIME, true));
break;
case "flipButton":
dispatchEvent(new DemolitionToolEvent(DemolitionToolEvent.FLIP, true));
break;
};
}
private function onMouseDownHandler(_arg1:MouseEvent):void{
if (_arg1.target.name == "spacer"){
parent.dispatchEvent(new DemolitionToolEvent(DemolitionToolEvent.START_DRAG, true));
};
}
}
}//package bb2.game.views
Section 202
//UFOView (bb2.game.views.UFOView)
package bb2.game.views {
import flash.display.*;
import bb2.game.events.*;
import bb2.game.entities.*;
import assets.*;
public class UFOView extends AbstractDemolitionToolView {
private var _clip:MovieClip;
public function UFOView(_arg1:AbstractGameEntity){
super(UFO(_arg1), new UFOControls());
this.x = _entity.x;
this.y = _entity.y;
_clip = new UFOViewSprite();
_clip.mouseChildren = false;
updateClip();
addChildAt(_clip, 0);
addEventListener(DemolitionToolEvent.FLIP, onFlipHandler);
}
override protected function get hideOnExplode():Boolean{
return (false);
}
private function updateClip():void{
_clip.gotoAndStop((UFO(_entity).flipped) ? 2 : 1);
}
private function onFlipHandler(_arg1:DemolitionToolEvent):void{
UFO(_entity).flip();
updateClip();
}
}
}//package bb2.game.views
Section 203
//WreckingBallView (bb2.game.views.WreckingBallView)
package bb2.game.views {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import bb2.game.events.*;
import bb2.game.entities.*;
import flash.geom.*;
import assets.*;
public class WreckingBallView extends AbstractDemolitionToolView {
private var _chainSprite:Sprite;
private var _wreckingBall:WreckingBall;
private var _centerSprite:Sprite;
public function WreckingBallView(_arg1:AbstractGameEntity){
super(WreckingBall(_arg1), new UFOControls());
_wreckingBall = WreckingBall(_arg1);
_entity.addEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
this.x = _entity.x;
this.y = _entity.y;
var _local2:Sprite = new WreckingBallSprite();
_local2.mouseEnabled = false;
addChildAt(_local2, 0);
_centerSprite = new WreckingBallCenterSprite();
_centerSprite.mouseEnabled = false;
addChildAt(_centerSprite, 0);
_chainSprite = new WreckingBallChainSprite();
_chainSprite.mouseEnabled = false;
addChildAt(_chainSprite, 0);
updateSprite();
addEventListener(DemolitionToolEvent.FLIP, onFlipHandler);
}
override protected function get hideOnExplode():Boolean{
return (false);
}
private function onEntityUpdateHandler(_arg1:EntityEvent):void{
this.x = _wreckingBall.bodyX;
this.y = _wreckingBall.bodyY;
var _local2:Point = new Point((_wreckingBall.x + (100 * (_wreckingBall.flipped) ? 1 : -1)), _wreckingBall.y);
_local2 = parent.localToGlobal(_local2);
_local2 = this.globalToLocal(_local2);
var _local3:Number = Math.atan2(-(_local2.y), -(_local2.x));
_chainSprite.x = (_centerSprite.x = _local2.x);
_chainSprite.y = (_centerSprite.y = _local2.y);
_chainSprite.rotation = ((_local3 / Math.PI) * 180);
}
private function updateSprite():void{
_centerSprite.x = (100 * (_wreckingBall.flipped) ? 1 : -1);
_chainSprite.x = (100 * (_wreckingBall.flipped) ? 1 : -1);
_chainSprite.rotation = (_wreckingBall.flipped) ? 180 : 0;
}
private function onFlipHandler(_arg1:DemolitionToolEvent):void{
_wreckingBall.flip();
updateSprite();
}
override public function dispose():void{
_wreckingBall = null;
_entity.removeEventListener(EntityEvent.UPDATE, onEntityUpdateHandler);
super.dispose();
}
}
}//package bb2.game.views
Section 204
//CustomContactListener (bb2.game.CustomContactListener)
package bb2.game {
import Box2D.Dynamics.*;
import Box2D.Collision.*;
public class CustomContactListener extends b2ContactListener {
private var _persistsCallback:Function;
private var _addCallback:Function;
private var _removeCallback:Function;
public function CustomContactListener(_arg1:Function, _arg2:Function, _arg3:Function){
_addCallback = _arg1;
_removeCallback = _arg2;
_persistsCallback = _arg3;
}
override public function Add(_arg1:b2ContactPoint):void{
if (_addCallback != null){
_addCallback(_arg1);
};
}
override public function Remove(_arg1:b2ContactPoint):void{
if (_removeCallback != null){
_removeCallback(_arg1);
};
}
override public function Persist(_arg1:b2ContactPoint):void{
if (_persistsCallback != null){
_persistsCallback(_arg1);
};
}
public function dispose():void{
_addCallback = null;
_removeCallback = null;
_persistsCallback = null;
}
}
}//package bb2.game
Section 205
//GameController (bb2.game.GameController)
package bb2.game {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import bb2.managers.*;
import flash.events.*;
import bb2.game.events.*;
import bb2.game.entities.*;
import com.bigwigmedia.mvc.*;
import bb2.core.*;
import bb2.constants.*;
public class GameController extends EventDispatcher implements IController {
private var _view:GameView;
private var _model:GameModel;
public function GameController(){
_model = new GameModel(Managers.levelProgressService.getLevelInfo());
_view = new GameView(this, _model);
_view.showBackground(_model.background);
_view.hud.blastPoints = _model.blastPoints;
_model.addEventListener(EntityEvent.ADDED, onModelChildAddedHandler);
_model.addEventListener(EntityEvent.REMOVED, onModelChildRemovedHandler);
_model.addEventListener(GameModel.BLAST_POINTS_CHANGE_EVENT, onBlastPointsChangedHandler);
_model.addEventListener(GameModel.BEGIN_DETONATION_EVENT, onBeginDetonationHandler);
_model.addEventListener(GameModel.RESET_EVENT, onResetHandler);
_model.addEventListener(GameModel.LEVEL_END_EVENT, onLevelEndHandler);
_model.addEventListener(GameModel.START_TIMEOUT_EVENT, onStartTimeoutEventHandler);
_model.addEventListener(GameModel.UPDATE_TIMEOUT_EVENT, onUpdateTimeoutEventHandler);
_model.addEventListener(GameModel.NOT_ENOUGH_BLAST_POINTS_EVENT, notEnoughBlastPointsEventHandler);
_view.addEventListener(HUDEvent.RESET, onHUDEventHandler);
_view.addEventListener(HUDEvent.REPLAY_LEVEL, onHUDEventHandler);
_view.addEventListener(HUDEvent.DETONATE, onHUDEventHandler);
_view.addEventListener(HUDEvent.PAUSE, onHUDEventHandler);
_view.addEventListener(HUDEvent.UNPAUSE, onHUDEventHandler);
_view.addEventListener(HUDEvent.MAIN_MENU, onHUDEventHandler);
_view.addEventListener(HUDEvent.SELECT_LEVEL, onHUDEventHandler);
_view.addEventListener(HUDEvent.EDIT_LEVEL, onHUDEventHandler);
_view.addEventListener(HUDEvent.NEXT_LEVEL, onHUDEventHandler);
_view.addEventListener(HUDEvent.TOOL_ACQUIRED, onHUDEventHandler);
_view.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
_model.start();
_view.correctScale();
}
public function viewMouseClick(_arg1:String, _arg2:Number, _arg3:Number):void{
_model.requestPlaceTool(_arg1, _arg2, _arg3);
}
private function onModelChildRemovedHandler(_arg1:EntityEvent):void{
_view.removeEntityView(AbstractGameEntity(_arg1.target));
}
public function get view():DisplayObject{
return (_view);
}
private function onUpdateTimeoutEventHandler(_arg1:EntityEvent):void{
_view.hud.updateTimeoutCounter(Number(_arg1.data));
}
private function onStartTimeoutEventHandler(_arg1:Event):void{
_view.hud.showTimeoutCounter();
}
private function notEnoughBlastPointsEventHandler(_arg1:EntityEvent):void{
Managers.soundManager.play(SoundID.CANCEL_SFX);
}
private function onBlastPointsChangedHandler(_arg1:Event):void{
_view.hud.blastPoints = _model.blastPoints;
}
private function onEnterFrameHandler(_arg1:Event):void{
_model.update(0);
}
private function onHUDEventHandler(_arg1:HUDEvent):void{
switch (_arg1.type){
case HUDEvent.REPLAY_LEVEL:
break;
case HUDEvent.TOOL_ACQUIRED:
_view.hud.showAcquiredTool(String(_arg1.data));
break;
case HUDEvent.EDIT_LEVEL:
dispatchEvent(new ControllerEvent(ControllerEvent.COMPLETE, MainSignal.SHOW_EDITOR));
break;
case HUDEvent.RESET:
_model.requestReset();
break;
case HUDEvent.DETONATE:
_model.requestDetonate();
break;
case HUDEvent.PAUSE:
_model.pause();
break;
case HUDEvent.UNPAUSE:
_model.unpause();
break;
case HUDEvent.MAIN_MENU:
dispatchEvent(new ControllerEvent(ControllerEvent.COMPLETE, MainSignal.SHOW_MAIN_MENU));
break;
case HUDEvent.SELECT_LEVEL:
dispatchEvent(new ControllerEvent(ControllerEvent.COMPLETE, MainSignal.SHOW_LEVEL_SELECTION));
break;
case HUDEvent.NEXT_LEVEL:
dispatchEvent(new ControllerEvent(ControllerEvent.COMPLETE, MainSignal.REPLAY_LEVEL));
break;
};
}
private function onResetHandler(_arg1:Event):void{
_view.reset();
}
private function onLevelEndHandler(_arg1:EntityEvent):void{
_view.hud.showLevelEndDialog(LevelResult(_arg1.data));
}
private function onModelChildAddedHandler(_arg1:EntityEvent):void{
_view.createEntityView(AbstractGameEntity(_arg1.target));
}
private function onBeginDetonationHandler(_arg1:Event):void{
_view.beginDetonation();
}
public function deleteDemolitionTool(_arg1:DemolitionToolEntity):void{
_model.deleteDemolitionTool(_arg1);
}
public function dispose():void{
_model.dispose();
_view.dispose();
}
}
}//package bb2.game
Section 206
//GameModel (bb2.game.GameModel)
package bb2.game {
import com.bigwigmedia.stateMachine.*;
import com.bigwigmedia.mvc.events.*;
import bb2.managers.*;
import bb2.game.entities.*;
import com.bigwigmedia.mvc.*;
import bb2.common.*;
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import flash.utils.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import com.bigwigmedia.utils.messages.*;
import bb2.constants.*;
public class GameModel extends EntityContainer {
private var _currentExplosives:Explosive;
private var _afterDetonationTimeoutCount:int;
private var _world:b2World;
private var _checkVelocityCounter:int;
private var _adjacentBlocksIDHash:Object;
private var _timeStep:Number;
private var _numCleanZones:int;
private var _messageQueue:MessageQueue;
private var _bodyToEntityDict:Dictionary;
private var _demolitionToolDefinitionsList:Array;
private var _blastPoints:int;// = 20
private var _inGameContactListener:CustomContactListener;
private var _paused:Boolean;// = false
private var _levelInfo:LevelInfo;
private var _stateMachine:HSM;
private var _idToBlockHash:Object;
private var _idToCleanZoneHash:Object;
private var _demolitionToolsLeft:int;
private var _explodeContactListener:CustomContactListener;
private var _cleanZonesDict:Dictionary;
private var _detonationStarted:Boolean;
public static const BODY_ID_LASER:int = 64;
public static const UPDATE_TIMEOUT_EVENT:String = "UPDATE_TIMEOUT_EVENT";
public static const CONTACT_ID_BLOCK_TO_AIR_STRIKE_BALL:int = (BODY_ID_BLOCK | BODY_ID_AIR_STRIKE_BALL);
public static const CONTACT_ID_BLOCK_TO_HEAVY_BALL:int = (BODY_ID_BLOCK | BODY_ID_HEAVY_BALL);
public static const SOUND_IMPULSE_THRESHOLD:Number = 3;
public static const SIGNAL_ALL_DETONATED:String = "SIGNAL_ALL_DETONATED";
public static const MESSAGE_BUMP_CHARACTER:String = "MESSAGE_BUMP_CHARACTER";
public static const WORLD_SCALE:Number = 30;
public static const BODY_ID_EXPLOSIVE:int = 16;
public static const BLAST_POINTS_CHANGE_EVENT:String = "BLAST_POINTS_CHANGE_EVENT";
public static const WORLD_ITERATIONS:int = 10;
public static const CONTACT_ID_BLOCK_TO_LASER:int = (BODY_ID_BLOCK | BODY_ID_LASER);
public static const MESSAGE_REMOVE_ENTITY:String = "MESSAGE_REMOVE_ENTITY";
public static const MESSAGE_ADD_EXPLOSIVE:String = "MESSAGE_ADD_EXPLOSIVE";
public static const BEGIN_DETONATION_EVENT:String = "BEGIN_DETONATION_EVENT";
public static const MIN_VELOCITY_TOLERANCE:Number = 1;
public static const SOUND_IMPULSE_MULTIPLIER:Number = 0.1;
public static const START_TIMEOUT_EVENT:String = "START_TIMEOUT_EVENT";
public static const BODY_ID_BLOCK:int = 1;
public static const NOT_ENOUGH_BLAST_POINTS_EVENT:String = "NOT_ENOUGH_BLAST_POINTS_EVENT";
public static const BODY_ID_CLEAN_ZONE:int = 8;
public static const MAX_TIME_STEP:Number = 0.05;
public static const BODY_ID_ACID:int = 32;
public static const SIGNAL_RESET:String = "SIGNAL_RESET";
public static const BODY_ID_ATTRACTOR:int = 4;
public static const BODY_ID_CHARACTER:int = 2;
public static const BODY_ID_HEAVY_BALL:int = 0x0100;
public static const CONTACT_ID_BLOCK_TO_ACID:int = (BODY_ID_BLOCK | BODY_ID_ACID);
public static const CHECK_VELOCITY_RATE:int = 25;
public static const SIGNAL_START_TIMEOUT:String = "SIGNAL_START_TIMEOUT";
public static const CONTACT_ID_BLOCK_TO_BLOCK:int = (BODY_ID_BLOCK | BODY_ID_BLOCK);
public static const MESSAGE_DESTROY_BLOCK:String = "MESSAGE_DESTROY_BLOCK";
public static const RESET_EVENT:String = "RESET_EVENT";
public static const LEVEL_END_EVENT:String = "LEVEL_END_EVENT";
public static const CONTACT_ID_BLOCK_EXPLOSIVE:int = (BODY_ID_BLOCK | BODY_ID_EXPLOSIVE);
public static const CONTACT_ID_BLOCK_TO_ATTRACTOR:int = (BODY_ID_BLOCK | BODY_ID_ATTRACTOR);
public static const CONTACT_ID_BLOCK_CLEAN_ZONE:int = (BODY_ID_BLOCK | BODY_ID_CLEAN_ZONE);
public static const SIGNAL_DETONATION:String = "SIGNAL_DETONATION";
public static const CONTACT_ID_BLOCK_TO_CHARACTER:int = (BODY_ID_BLOCK | BODY_ID_CHARACTER);
public static const BODY_ID_AIR_STRIKE_BALL:int = 128;
public function GameModel(_arg1:LevelInfo){
_demolitionToolDefinitionsList = [];
super();
_levelInfo = _arg1;
_inGameContactListener = new CustomContactListener(onContactAddInGame, null, onContactPersistInGame);
_explodeContactListener = new CustomContactListener(onContactAddExplosion, null, null);
_stateMachine = new HSM();
var _local2:AbstractState = _stateMachine.addState(new InitialState());
var _local3:AbstractState = _stateMachine.addState(new SimpleState(enterBuildLevel));
var _local4:AbstractState = _stateMachine.addState(new SimpleState(enterPlacingExplosives));
var _local5:CompositeState = CompositeState(_stateMachine.addState(new CompositeState()));
var _local6:AbstractState = _local5.addState(new InitialState());
var _local7:AbstractState = _local5.addState(new SimpleState(enterDetonation, updateDetonation));
var _local8:AbstractState = _local5.addState(new SimpleState(null, updateDetonation));
var _local9:AbstractState = _local5.addState(new SimpleState(null, updateAfterDetonation));
var _local10:AbstractState = _local5.addState(new SimpleState(enterTimeout, updateAfterDetonationTimeout));
var _local11:AbstractState = _local5.addState(new SimpleState(enterLevelEnd));
_local2.addTransition(_local3);
_local3.addTransition(_local4);
_local4.addTransition(_local6, new SignalTrigger(SIGNAL_DETONATION), null, demolitionToolsPlaced);
_local6.addTransition(_local7);
_local7.addTransition(_local8, new SignalTrigger(SIGNAL_ALL_DETONATED));
_local8.addTransition(_local9, new DelayTrigger("75"));
_local9.addTransition(_local10, new SignalTrigger(SIGNAL_START_TIMEOUT));
_local9.addTransition(_local10, new DelayTrigger("300"));
_local10.addTransition(_local11, new DelayTrigger("60"));
_local5.addTransition(_local3, new SignalTrigger(SIGNAL_RESET), resetEffect);
_messageQueue = new MessageQueue();
_messageQueue.registerMessage(MESSAGE_BUMP_CHARACTER, 5);
_messageQueue.registerMessage(MESSAGE_DESTROY_BLOCK, 5);
_messageQueue.registerMessage(MESSAGE_REMOVE_ENTITY, 5);
_messageQueue.registerMessage(MESSAGE_ADD_EXPLOSIVE, 4);
addEventListener(AbstractGameEntity.REMOVE_EVENT, onGameEntityRemoveHandler);
addEventListener(DemolitionToolEntity.EXPLODE_EVENT, onExplodeHandler);
}
public function requestReset():void{
_stateMachine.sendSignal(SIGNAL_RESET);
}
public function get blastPoints():int{
return (_blastPoints);
}
public function unpause():void{
_paused = false;
}
private function onContactAddInGame(_arg1:b2ContactPoint):void{
var _local2:b2Body = _arg1.shape1.m_body;
var _local3:b2Body = _arg1.shape2.m_body;
var _local4 = (_local2.bodyKindID | _local3.bodyKindID);
switch (_local4){
case CONTACT_ID_BLOCK_TO_CHARACTER:
collideBlockToCharacter(_local2, _local3);
break;
case CONTACT_ID_BLOCK_TO_ATTRACTOR:
collideBlockToAttractor(_local2, _local3);
break;
case CONTACT_ID_BLOCK_TO_ACID:
collideBlockToAcid(_local2, _local3);
break;
case CONTACT_ID_BLOCK_TO_LASER:
collideBlockToLaser(_local2, _local3);
break;
case CONTACT_ID_BLOCK_TO_BLOCK:
case CONTACT_ID_BLOCK_TO_HEAVY_BALL:
collideBlockToBlock(_local2, _local3, _arg1);
break;
case CONTACT_ID_BLOCK_TO_AIR_STRIKE_BALL:
collideBlockToAirStrikeBall(_local2, _local3);
break;
};
}
private function wakeupAdjacentBlocks(_arg1:Block):void{
var _local3:Block;
var _local2:Array = _adjacentBlocksIDHash[_arg1.id];
if (_local2){
while (_local2.length > 0) {
_local3 = _idToBlockHash[_local2.pop()];
if (((_local3) && (_local3.body))){
_local3.body.WakeUp();
};
};
};
}
private function updateAfterDetonationTimeout(_arg1:Number):void{
updateDetonation(_arg1);
var _local2:Number = Math.min(1, (++_afterDetonationTimeoutCount / 60));
dispatchEvent(new EntityEvent(UPDATE_TIMEOUT_EVENT, _local2));
}
public function deleteDemolitionTool(_arg1:DemolitionToolEntity):void{
var _local2:DemolitionToolDefinition = _arg1.definition;
var _local3:int = _demolitionToolDefinitionsList.indexOf(_local2);
_demolitionToolDefinitionsList.splice(_local3, 1);
_blastPoints = (_blastPoints + _local2.blastPoints);
removeChild(_arg1);
dispatchEvent(new EntityEvent(BLAST_POINTS_CHANGE_EVENT));
}
private function collideBlockToAirStrikeBall(_arg1:b2Body, _arg2:b2Body):void{
var _local4:Block;
var _local3:AirStrikeBall = (((_bodyToEntityDict[_arg1] as AirStrikeBall)) || ((_bodyToEntityDict[_arg2] as AirStrikeBall)));
if (_local3.active){
_local3.deactivate();
_messageQueue.append(MESSAGE_REMOVE_ENTITY, _local3);
_messageQueue.append(MESSAGE_ADD_EXPLOSIVE, new ExplosiveDefinition(GameItemKind.EXPL_AIR_STRIKE_BALL, _local3.x, _local3.y));
_local4 = (((_bodyToEntityDict[_arg1] as Block)) || ((_bodyToEntityDict[_arg2] as Block)));
if (((_local4) && (!(_local4.isStatic)))){
_local4.markAsBroken();
if (!_local4.destroyed){
_local4.markAsDestroyed();
_messageQueue.append(MESSAGE_DESTROY_BLOCK, _local4);
};
};
Managers.soundManager.play(SoundID.EXPLOSION);
};
}
private function explodeWreckingBall(_arg1:WreckingBall):void{
var _local2:b2Body = _arg1.createBody(_world);
_bodyToEntityDict[_local2] = _arg1;
}
override public function dispose():void{
clearLevel();
_stateMachine.dispose();
_stateMachine = null;
_messageQueue.dispose();
_messageQueue = null;
_levelInfo = null;
super.dispose();
}
private function collideBlockToCharacter(_arg1:b2Body, _arg2:b2Body):void{
var _local3:Character = (((_bodyToEntityDict[_arg1] as Character)) || ((_bodyToEntityDict[_arg2] as Character)));
var _local4:Block = (((_bodyToEntityDict[_arg1] as Block)) || ((_bodyToEntityDict[_arg2] as Block)));
if (((!(_local3.bumped)) && (_local4.dangerous))){
_local3.markAsBumped();
_messageQueue.append(MESSAGE_BUMP_CHARACTER, _local3);
};
}
private function demolitionToolsPlaced():Boolean{
return ((_demolitionToolDefinitionsList.length > 0));
}
private function collideBlockToAcid(_arg1:b2Body, _arg2:b2Body):void{
var _local4:Block;
var _local3:Acid = (((_bodyToEntityDict[_arg1] as Acid)) || ((_bodyToEntityDict[_arg2] as Acid)));
if (_local3.active){
_local3.deactivate();
_messageQueue.append(MESSAGE_REMOVE_ENTITY, _local3);
_local4 = (((_bodyToEntityDict[_arg1] as Block)) || ((_bodyToEntityDict[_arg2] as Block)));
if (((_local4) && (!(_local4.isStatic)))){
_local4.markAsBroken();
if (!_local4.destroyed){
_local4.markAsDestroyed();
_messageQueue.append(MESSAGE_DESTROY_BLOCK, _local4);
};
};
Managers.soundManager.play(SoundID.ACID_HISS_01_WAV);
createGameEntity(new ExplosionDefinition(_local3.kind, _local3.x, _local3.y));
};
}
private function collideBlockToLaser(_arg1:b2Body, _arg2:b2Body):void{
var _local3:Laser = (((_bodyToEntityDict[_arg1] as Laser)) || ((_bodyToEntityDict[_arg2] as Laser)));
var _local4:Block = (((_bodyToEntityDict[_arg1] as Block)) || ((_bodyToEntityDict[_arg2] as Block)));
_local4.markAsBroken();
if (!_local4.destroyed){
_local4.markAsDestroyed();
_messageQueue.append(MESSAGE_DESTROY_BLOCK, _local4);
};
}
private function enterBuildLevel(_arg1:AbstractEvent):void{
_timeStep = MAX_TIME_STEP;
_idToBlockHash = {};
_idToCleanZoneHash = {};
_bodyToEntityDict = new Dictionary();
var _local2:b2AABB = new b2AABB();
_local2.lowerBound.Set((-600 / WORLD_SCALE), (-600 / WORLD_SCALE));
_local2.upperBound.Set(((600 + 640) / WORLD_SCALE), (520 / WORLD_SCALE));
var _local3:b2Vec2 = new b2Vec2(0, 5);
_world = new b2World(_local2, _local3, true);
_world.SetContactListener(_inGameContactListener);
_world.onBodyWakeUpCallback = onBodyWakeUpCallback;
var _local4:b2BodyDef = new b2BodyDef();
_local4.position.x = (320 / WORLD_SCALE);
_local4.position.y = (442 / WORLD_SCALE);
var _local5:b2PolygonDef = new b2PolygonDef();
_local5.SetAsBox((1000 / WORLD_SCALE), (38 / WORLD_SCALE));
_local5.density = 0;
var _local6:b2Body = _world.CreateBody(_local4);
_local6.bodyKindID = GameModel.BODY_ID_BLOCK;
_local6.CreateShape(_local5);
_local6.SetMass(new b2MassData());
var _local7:Array = _levelInfo.getItemsDefinitions();
var _local8:int = _local7.length;
var _local9:int;
while (_local9 < _local8) {
createGameEntity(_local7[_local9]);
_local9++;
};
_local8 = _demolitionToolDefinitionsList.length;
_local9 = 0;
while (_local9 < _local8) {
createGameEntity(_demolitionToolDefinitionsList[_local9]);
_local9++;
};
_adjacentBlocksIDHash = _levelInfo.getAdjacentBlocksIDHash();
SoundID.reinitializeHitSounds();
}
private function enterLevelEnd(_arg1:AbstractEvent):void{
var _local3:CleanZone;
var _local4:LevelResult;
var _local5:int;
var _local6:int;
var _local7:Entity;
var _local8:Character;
_paused = true;
var _local2:int;
for each (_local3 in _idToCleanZoneHash) {
_local2++;
};
if (_local2 == _numCleanZones){
_local5 = 0;
_local6 = 0;
for each (_local7 in _children) {
_local8 = (_local7 as Character);
if (((_local8) && (_local8.bumped))){
if (_local8.kind == GameItemKind.CHARACTER_OPPONENT){
_local5++;
} else {
_local6++;
};
};
};
_local4 = new LevelResult(_levelInfo.uid, true, _levelInfo.price, _blastPoints, _local5, _local6);
Managers.levelProgressService.completeLevel(_local4);
Managers.soundManager.play(SoundID.TRUMPETS_FANFAR_WAV);
} else {
_local4 = new LevelResult(_levelInfo.uid, false);
Managers.soundManager.play(SoundID.DRM_ROLL_CRASH_02_WAV);
};
dispatchEvent(new EntityEvent(LEVEL_END_EVENT, _local4));
}
private function explodeExplosive(_arg1:Explosive):void{
var _local3:ExplosiveDefinition;
var _local4:AntimatterAttractor;
var _local5:b2Body;
_currentExplosives = _arg1;
_world.SetContactListener(_explodeContactListener);
var _local2:b2Body = _currentExplosives.createBody(_world);
_world.Step(_timeStep, WORLD_ITERATIONS);
_world.DestroyBody(_local2);
_world.SetContactListener(_inGameContactListener);
if (_currentExplosives.kind == GameItemKind.EXPL_ANTIMATTER){
_local3 = new ExplosiveDefinition(GameItemKind.ANTIMATTER_ATTRACTOR, _currentExplosives.x, _currentExplosives.y);
_local4 = new AntimatterAttractor(_local3);
_local5 = _local4.createBody(_world);
_bodyToEntityDict[_local5] = _local4;
addChild(_local4);
};
createGameEntity(new ExplosionDefinition(_arg1.kind, _arg1.x, _arg1.y));
_currentExplosives = null;
Managers.soundManager.play(SoundID.EXPLOSION);
}
private function clearLevel():void{
var _local1:Entity;
var _local2:PhysicGameEntity;
while (numChildren > 0) {
_local1 = removeLastChild();
_local2 = (_local1 as PhysicGameEntity);
if (_local2){
delete _bodyToEntityDict[_local2.body];
_world.DestroyBody(_local2.body);
};
_local1.dispose();
};
if (_world){
_world.onBodyWakeUpCallback = null;
};
_idToBlockHash = null;
_idToCleanZoneHash = null;
_cleanZonesDict = null;
_messageQueue.clear();
}
private function updateDetonation(_arg1:Number):void{
var _local2:Entity;
var _local3:CleanZone;
var _local4:Message;
var _local5:Explosive;
_cleanZonesDict = new Dictionary();
_numCleanZones = 0;
_world.Step(_timeStep, WORLD_ITERATIONS);
for each (_local2 in _children) {
_local2.update(_arg1);
};
for each (_local3 in _idToCleanZoneHash) {
_local3.clean = (_cleanZonesDict[_local3] == null);
if (_local3.clean){
_numCleanZones++;
};
};
_messageQueue.lock();
while (_messageQueue.hasNext()) {
_local4 = _messageQueue.getNext();
switch (_local4.type){
case MESSAGE_BUMP_CHARACTER:
Character(_local4.data).bump();
break;
case MESSAGE_DESTROY_BLOCK:
destroyBlock(Block(_local4.data));
break;
case MESSAGE_REMOVE_ENTITY:
removeChild(AbstractGameEntity(_local4.data));
break;
case MESSAGE_ADD_EXPLOSIVE:
_local5 = Explosive(addChild(new Explosive(ExplosiveDefinition(_local4.data))));
_local5.explode();
break;
};
};
_messageQueue.unlock();
}
public function get background():String{
return (_levelInfo.background);
}
private function resetEffect(_arg1:AbstractEvent):void{
clearLevel();
dispatchEvent(new EntityEvent(RESET_EVENT));
}
private function destroyBlock(_arg1:Block):void{
var _local4:Array;
var _local5:b2Vec2;
var _local6:Number;
var _local7:GameItemDefinition;
var _local8:Block;
var _local2:Object = _arg1.createDebrisDefs();
wakeupAdjacentBlocks(_arg1);
removeChild(_arg1);
var _local3:DestroyedBlock = _arg1.createDestroyedBlockEntity();
delete _bodyToEntityDict[_arg1.body];
_world.DestroyBody(_arg1.body);
if (_arg1.id){
delete _idToBlockHash[_arg1.id];
};
_arg1.dispose();
if (_local2){
_local4 = _local2.defs;
_local5 = _local2.linearVelocity;
_local6 = _local2.angularVelocity;
_local5.Multiply(0.3);
for each (_local7 in _local4) {
_local8 = Block(createGameEntity(_local7));
_local8.body.SetAngularVelocity(_local6);
_local8.body.SetLinearVelocity(_local5);
};
} else {
addChild(_local3);
};
}
private function onBodyWakeUpCallback(_arg1:b2Body):void{
var _local2:Block = (_bodyToEntityDict[_arg1] as Block);
if (_local2){
wakeupAdjacentBlocks(_local2);
};
}
override public function update(_arg1:Number):void{
if (_paused){
return;
};
_stateMachine.update(_arg1);
}
public function requestDetonate():void{
_stateMachine.sendSignal(SIGNAL_DETONATION);
}
private function createGameEntity(_arg1:GameItemDefinition):AbstractGameEntity{
var _local2:AbstractGameEntity;
var _local3:Block;
var _local4:Character;
var _local5:CleanZone;
var _local6:Acid;
var _local7:Laser;
var _local8:AirStrikeBall;
switch (_arg1.superKind){
case GameItemKind.BLOCKS:
_local2 = new Block(BlockDefinition(_arg1));
_local3 = Block(_local2);
_local3.createBody(_world);
_bodyToEntityDict[_local3.body] = _local3;
if (_local3.id){
_idToBlockHash[_local3.id] = _local3;
};
break;
case GameItemKind.EXPLOSIVE:
_local2 = new Explosive(ExplosiveDefinition(_arg1));
break;
case GameItemKind.CHARACTERS:
_local2 = new Character(CharacterDefinition(_arg1));
_local4 = Character(_local2);
_local4.createBody(_world);
_bodyToEntityDict[_local4.body] = _local4;
break;
case GameItemKind.CLEAN_ZONE:
_local2 = new CleanZone(TransformableItemDefinition(_arg1));
_local5 = CleanZone(_local2);
_local5.createBody(_world);
_bodyToEntityDict[_local5.body] = _local5;
_idToCleanZoneHash[_local5.id] = _local5;
break;
case GameItemKind.HINT:
_local2 = new AbstractGameEntity(_arg1);
break;
case GameItemKind.TOOL_ACID_BALLOON:
_local2 = new AcidBalloon(DemolitionToolDefinition(_arg1));
break;
case GameItemKind.TOOL_UFO:
_local2 = new UFO(FlippableToolDefinition(_arg1));
break;
case GameItemKind.TOOL_AIR_STRIKE:
_local2 = new AirStrike(DemolitionToolDefinition(_arg1));
break;
case GameItemKind.TOOL_WRECKING_BALL:
_local2 = new WreckingBall(WreckingBallDefinition(_arg1));
break;
case GameItemKind.ACID:
_local2 = new Acid(AcidDefinition(_arg1));
_local6 = Acid(_local2);
_local6.createBody(_world);
_bodyToEntityDict[_local6.body] = _local6;
break;
case GameItemKind.LASER:
_local2 = new Laser(LaserDefinition(_arg1));
_local7 = Laser(_local2);
_local7.createBody(_world);
_bodyToEntityDict[_local7.body] = _local7;
break;
case GameItemKind.AIR_STRIKE_BALL:
_local2 = new AirStrikeBall(AirStrikeBallDefinition(_arg1));
_local8 = AirStrikeBall(_local2);
_local8.createBody(_world);
_bodyToEntityDict[_local8.body] = _local8;
break;
case GameItemKind.EXPLOSION_EFFECT:
_local2 = new Explosion(ExplosionDefinition(_arg1));
break;
default:
throw (new Error((("Item kind \"" + _arg1.kind) + "\" is not supported.")));
};
addChild(_local2);
return (_local2);
}
private function onGameEntityRemoveHandler(_arg1:EntityEvent):void{
_messageQueue.append(MESSAGE_REMOVE_ENTITY, _arg1.target);
}
private function enterPlacingExplosives(_arg1:AbstractEvent):void{
_detonationStarted = false;
}
private function explodeAirStrike(_arg1:AirStrike):void{
var _local3:GameItemDefinition;
var _local2:Array = _arg1.createBallDefs(_levelInfo.levelRect.top);
for each (_local3 in _local2) {
createGameEntity(_local3);
};
Managers.soundManager.play(SoundID.AIRCRAFT_PASS_01_WAV);
}
public function get levelInfo():LevelInfo{
return (_levelInfo);
}
public function start():void{
_stateMachine.start();
}
private function collideBlockToBlock(_arg1:b2Body, _arg2:b2Body, _arg3:b2ContactPoint):void{
var _local7:Number;
var _local8:String;
var _local4:Number = _arg3.velocity.Length();
var _local5:Block = (_bodyToEntityDict[_arg1] as Block);
var _local6:Block = (_bodyToEntityDict[_arg2] as Block);
if (((((((_local5) && (!(_local5.destroyed)))) && ((_local4 > _local5.strength)))) && (((!(_local6)) || ((_local5.strength <= _local6.strength)))))){
_local5.markAsDestroyed();
_messageQueue.append(MESSAGE_DESTROY_BLOCK, _local5);
};
if (((((((_local6) && (!(_local6.destroyed)))) && ((_local4 > _local6.strength)))) && (((!(_local5)) || ((_local6.strength <= _local5.strength)))))){
_local6.markAsDestroyed();
_messageQueue.append(MESSAGE_DESTROY_BLOCK, _local6);
};
if ((((_local4 > SOUND_IMPULSE_THRESHOLD)) && ((Math.random() < 0.2)))){
_local7 = (_local4 * SOUND_IMPULSE_MULTIPLIER);
if (_local7 > 1){
_local7 = 1;
};
_local8 = SoundID.HIT_BLOCKS;
Managers.soundManager.setVolume(_local8, _local7);
Managers.soundManager.play(_local8);
};
}
private function explodeAcidBalloon(_arg1:AcidBalloon):void{
var _local3:GameItemDefinition;
var _local2:Array = _arg1.createAcidDefs();
for each (_local3 in _local2) {
createGameEntity(_local3);
};
createGameEntity(new ExplosionDefinition(_arg1.kind, _arg1.x, _arg1.y));
Managers.soundManager.play(SoundID.BALOON_POP2_WAV);
}
private function onExplodeHandler(_arg1:EntityEvent):void{
var _local2:String = GameItemKind.getSuperKindFromKind(_arg1.target.kind);
switch (_local2){
case GameItemKind.EXPLOSIVE:
explodeExplosive(Explosive(_arg1.target));
break;
case GameItemKind.TOOL_ACID_BALLOON:
explodeAcidBalloon(AcidBalloon(_arg1.target));
break;
case GameItemKind.TOOL_UFO:
explodeUFO(UFO(_arg1.target));
break;
case GameItemKind.TOOL_AIR_STRIKE:
explodeAirStrike(AirStrike(_arg1.target));
break;
case GameItemKind.TOOL_WRECKING_BALL:
explodeWreckingBall(WreckingBall(_arg1.target));
break;
default:
throw (new Error((("Superkind \"" + _local2) + "\" is not supported.")));
};
if (--_demolitionToolsLeft == 0){
_stateMachine.sendSignal(SIGNAL_ALL_DETONATED);
};
}
private function enterTimeout(_arg1:AbstractEvent):void{
dispatchEvent(new EntityEvent(START_TIMEOUT_EVENT));
}
private function explodeUFO(_arg1:UFO):void{
var _local2:LaserDefinition = _arg1.createLaserDefs();
createGameEntity(_local2);
Managers.soundManager.play(SoundID.LASER_01_WAV);
}
public function requestPlaceTool(_arg1:String, _arg2:Number, _arg3:Number):void{
var _local4:DemolitionToolDefinition;
if (_detonationStarted){
return;
};
var _local5:String = GameItemKind.getSuperKindFromKind(_arg1);
switch (_local5){
case GameItemKind.EXPLOSIVE:
_local4 = new ExplosiveDefinition(_arg1, _arg2, _arg3);
break;
case GameItemKind.TOOL_ACID_BALLOON:
_local4 = new DemolitionToolDefinition(_arg1, _arg2, _arg3);
break;
case GameItemKind.TOOL_UFO:
_local4 = new FlippableToolDefinition(GameItemKind.TOOL_UFO, _arg2, _arg3);
break;
case GameItemKind.TOOL_AIR_STRIKE:
_local4 = new DemolitionToolDefinition(_arg1, _arg2, _arg3);
break;
case GameItemKind.TOOL_WRECKING_BALL:
_local4 = new WreckingBallDefinition(_arg2, _arg3);
break;
};
if (_local4.blastPoints > _blastPoints){
dispatchEvent(new EntityEvent(NOT_ENOUGH_BLAST_POINTS_EVENT));
return;
};
_demolitionToolDefinitionsList.push(_local4);
createGameEntity(_local4);
_blastPoints = (_blastPoints - _local4.blastPoints);
dispatchEvent(new EntityEvent(BLAST_POINTS_CHANGE_EVENT));
}
private function onContactPersistInGame(_arg1:b2ContactPoint):void{
var _local5:CleanZone;
var _local6:CleanZone;
var _local2:b2Body = _arg1.shape1.m_body;
var _local3:b2Body = _arg1.shape2.m_body;
var _local4 = (_local2.bodyKindID | _local3.bodyKindID);
if (_local4 == CONTACT_ID_BLOCK_CLEAN_ZONE){
_local5 = (_bodyToEntityDict[_local2] as CleanZone);
_local6 = (_bodyToEntityDict[_local3] as CleanZone);
if (((_local5) && (!((_local3.m_mass == 0))))){
_cleanZonesDict[_local5] = _local5;
} else {
if (_local2.m_mass != 0){
_cleanZonesDict[_local6] = _local6;
};
};
};
}
private function updateAfterDetonation(_arg1:Number):void{
var _local2:Number;
var _local3:b2Body;
updateDetonation(_arg1);
if (++_checkVelocityCounter >= CHECK_VELOCITY_RATE){
_checkVelocityCounter = 0;
_local2 = 0;
_local3 = _world.GetBodyList();
while (_local3) {
if (_local3.bodyKindID == BODY_ID_BLOCK){
_local2 = (_local2 + _local3.GetLinearVelocity().Length());
};
_local3 = _local3.GetNext();
};
if (_local2 < MIN_VELOCITY_TOLERANCE){
_stateMachine.sendSignal(SIGNAL_START_TIMEOUT);
};
};
}
private function onContactAddExplosion(_arg1:b2ContactPoint):void{
var _local5:Block;
var _local6:b2Body;
var _local7:b2Vec2;
var _local8:Number;
var _local2:b2Body = _arg1.shape1.m_body;
var _local3:b2Body = _arg1.shape2.m_body;
var _local4 = (_local2.bodyKindID | _local3.bodyKindID);
if (_local4 == CONTACT_ID_BLOCK_EXPLOSIVE){
_local5 = (((_bodyToEntityDict[_local2] as Block)) || ((_bodyToEntityDict[_local3] as Block)));
_local6 = _local5.body;
_local6.WakeUp();
_local7 = _arg1.normal.Negative();
_local8 = (_currentExplosives.strength / _local7.Length());
_local7.Multiply(_local8);
_local6.ApplyImpulse(_local7, _arg1.position);
};
}
private function collideBlockToAttractor(_arg1:b2Body, _arg2:b2Body):void{
var _local3:AntimatterAttractor = (((_bodyToEntityDict[_arg1] as AntimatterAttractor)) || ((_bodyToEntityDict[_arg2] as AntimatterAttractor)));
var _local4:Block = (((_bodyToEntityDict[_arg1] as Block)) || ((_bodyToEntityDict[_arg2] as Block)));
_local3.attract(_local4.body);
}
private function enterDetonation(_arg1:AbstractEvent):void{
var _local2:Entity;
var _local3:DemolitionToolEntity;
_detonationStarted = true;
_paused = false;
_afterDetonationTimeoutCount = 0;
for each (_local2 in _children) {
_local3 = (_local2 as DemolitionToolEntity);
if (_local3){
_local3.start();
};
};
_demolitionToolsLeft = _demolitionToolDefinitionsList.length;
_checkVelocityCounter = 0;
dispatchEvent(new EntityEvent(BEGIN_DETONATION_EVENT));
}
public function pause():void{
_paused = true;
}
}
}//package bb2.game
Section 207
//GameView (bb2.game.GameView)
package bb2.game {
import flash.display.*;
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import bb2.managers.*;
import flash.events.*;
import bb2.game.events.*;
import bb2.game.entities.*;
import bb2.common.*;
import flash.geom.*;
import bb2.game.ui.*;
import flash.utils.*;
import com.bigwigmedia.ui.containers.*;
import com.bigwigmedia.core.*;
import assets.*;
import bb2.game.views.*;
public class GameView extends Sprite implements IDisposable {
private var _startDragX:Number;
private var _startDragY:Number;
private var _dragToolView:AbstractDemolitionToolView;// = null
private var _charactersHolder:Sprite;
private var _toolsHolder:Sprite;
private var _cleanZonesHolder:Sprite;
private var _model:GameModel;
private var _levelNameCanvas:Canvas;
private var _blocksHolder:Sprite;
private var _hud:HUD;
private var _controller:GameController;
private var _entityToViewDict:Dictionary;
private var _holder:Sprite;
private var _background:MovieClip;
private var _hintsHolder:Sprite;
private var _dragToolIcon:Sprite;
public function GameView(_arg1:GameController, _arg2:GameModel){
var _local4:Label;
_entityToViewDict = new Dictionary();
super();
_controller = _arg1;
_model = _arg2;
_background = new LevelBackground();
_background.stop();
addChild(_background);
_levelNameCanvas = new Canvas();
_levelNameCanvas.mouseEnabled = false;
_levelNameCanvas.mouseChildren = false;
_levelNameCanvas.width = 640;
_levelNameCanvas.height = 20;
var _local3:Label = Label(_levelNameCanvas.addChild(new Label()));
_local3.top = 0;
_local3.text = (("«" + _model.levelInfo.title) + "»");
if (Managers.levelProgressService.isPlayingUserLevel()){
_local3.center = 0;
} else {
_local3.right = 2;
_local4 = Label(_levelNameCanvas.addChild(new Label()));
_local4.top = 0;
_local4.left = 2;
_local4.text = ("Mission " + String((_model.levelInfo.num + 1)));
};
addChild(_levelNameCanvas);
_holder = new Sprite();
addChild(_holder);
_cleanZonesHolder = new Sprite();
_holder.addChild(_cleanZonesHolder);
_blocksHolder = new Sprite();
_holder.addChild(_blocksHolder);
_charactersHolder = new Sprite();
_holder.addChild(_charactersHolder);
_hintsHolder = new Sprite();
_holder.addChild(_hintsHolder);
_toolsHolder = new Sprite();
_holder.addChild(_toolsHolder);
_hud = new HUD();
addChild(_hud);
_dragToolIcon = new TNTSprite();
_toolsHolder.addChildAt(_dragToolIcon, 0);
positionDragSprites();
addEventListener(MouseEvent.CLICK, onMouseClickHandler);
addEventListener(MouseEvent.MOUSE_MOVE, onMouseMoveHandler);
addEventListener(DemolitionToolEvent.DELETE, onDeleteControlsHandler);
addEventListener(DemolitionToolEvent.SHOW_CONTROLS, onShowControlsHandler);
addEventListener(DemolitionToolEvent.HIDE_CONTROLS, onHideControlsHandler);
addEventListener(DemolitionToolEvent.START_DRAG, onStartDragHandler);
addEventListener(HUDEvent.TOOL_CHANGE, onToolChangeHandler);
}
public function correctScale():void{
var _local1:Rectangle = _holder.getRect(this);
var _local2:Number = 640;
if ((((_local1.x < 0)) && ((_local1.right > 640)))){
_local2 = (_local2 + ((-(_local1.x) * 2) + ((_local1.right - 640) * 2)));
} else {
if (_local1.x < 0){
_local2 = (_local2 + (-(_local1.x) * 2));
} else {
if (_local1.right > 640){
_local2 = (_local2 + ((_local1.right - 640) * 2));
};
};
};
var _local3:Number = (640 / _local2);
if (_local1.y < 0){
_local3 = Math.min(_local3, (404 / (404 - _local1.y)));
};
if (!isNaN(_local3)){
_holder.scaleX = (_holder.scaleY = _local3);
_holder.x = (320 - (320 * _local3));
_holder.y = (404 - (404 * _local3));
};
}
private function getSpaceMouseCoordinates(_arg1:DisplayObject):Point{
var _local2:Stage = Globals.stage;
var _local3:Point = new Point(_local2.mouseX, _local2.mouseY);
if (_local3.x < 0){
_local3.x = 0;
} else {
if (_local3.x > 640){
_local3.x = 640;
};
};
if (_local3.y < 0){
_local3.y = 0;
} else {
if (_local3.y > 404){
_local3.y = 404;
};
};
_local3 = _arg1.globalToLocal(_local3);
return (_local3);
}
public function showBackground(_arg1:String):void{
_background.gotoAndStop(_arg1);
}
public function beginDetonation():void{
_hud.toolsMenu.enabled = false;
_dragToolIcon.visible = false;
}
private function positionDragSprites():void{
var _local1:Point = getSpaceMouseCoordinates(_toolsHolder);
if (_dragToolView){
_dragToolView.x = (_local1.x - _startDragX);
_dragToolView.y = (_local1.y - _startDragY);
} else {
if (_dragToolIcon){
_dragToolIcon.x = _local1.x;
_dragToolIcon.y = _local1.y;
};
};
}
private function onShowControlsHandler(_arg1:DemolitionToolEvent):void{
var _local2:AbstractDemolitionToolView;
if (!_dragToolView){
_local2 = AbstractDemolitionToolView(_arg1.target);
_toolsHolder.setChildIndex(_local2, (_toolsHolder.numChildren - 1));
_dragToolIcon.visible = false;
};
}
public function dispose():void{
removeChild(_levelNameCanvas);
_levelNameCanvas.dispose();
_controller = null;
_model = null;
removeChild(_hud);
_hud.dispose();
_hud = null;
}
private function onToolChangeHandler(_arg1:HUDEvent):void{
var _local2:Sprite;
switch (_hud.toolsMenu.selectedToolKind){
case GameItemKind.EXPL_TNT:
_local2 = new TNTSprite();
break;
case GameItemKind.EXPL_NITROGLYCERIN:
_local2 = new NitroglycerinSprite();
break;
case GameItemKind.EXPL_C4:
_local2 = new C4Sprite();
break;
case GameItemKind.EXPL_ANTIMATTER:
_local2 = new AntimatterSprite();
break;
case GameItemKind.TOOL_ACID_BALLOON:
_local2 = new AcidBalloonSprite();
break;
case GameItemKind.TOOL_UFO:
_local2 = new UFOSprite();
break;
case GameItemKind.TOOL_AIR_STRIKE:
_local2 = new AirStrikeSprite();
break;
case GameItemKind.TOOL_WRECKING_BALL:
_local2 = new WreckingBallSprite();
break;
};
_toolsHolder.removeChild(_dragToolIcon);
_dragToolIcon = _local2;
_toolsHolder.addChildAt(_dragToolIcon, 0);
positionDragSprites();
}
private function onHideControlsHandler(_arg1:DemolitionToolEvent):void{
if (!_dragToolView){
_dragToolIcon.visible = true;
};
}
private function onStartDragHandler(_arg1:DemolitionToolEvent):void{
_dragToolView = AbstractDemolitionToolView(_arg1.target);
_startDragX = _dragToolView.mouseX;
_startDragY = _dragToolView.mouseY;
stage.addEventListener(MouseEvent.MOUSE_UP, onStageMouseUpHandler);
}
public function createEntityView(_arg1:AbstractGameEntity):void{
var _local2:DisplayObject;
var _local3:DisplayObjectContainer;
var _local4:String = GameItemKind.getSuperKindFromKind(_arg1.kind);
switch (_local4){
case GameItemKind.BLOCKS:
_local2 = new BlockView(_arg1);
_local3 = _blocksHolder;
break;
case GameItemKind.CHARACTERS:
_local2 = new CharacterView(_arg1);
_local3 = _charactersHolder;
break;
case GameItemKind.EXPLOSIVE:
if (_arg1.kind != GameItemKind.EXPL_AIR_STRIKE_BALL){
_local2 = new ExplosiveView(_arg1);
_local3 = _toolsHolder;
};
break;
case GameItemKind.CLEAN_ZONE:
_local2 = new CleanZoneView(_arg1);
_local3 = _cleanZonesHolder;
break;
case GameItemKind.TOOL_ACID_BALLOON:
_local2 = new AcidBalloonView(_arg1);
_local3 = _toolsHolder;
break;
case GameItemKind.TOOL_UFO:
_local2 = new UFOView(_arg1);
_local3 = _toolsHolder;
break;
case GameItemKind.TOOL_AIR_STRIKE:
_local2 = new AirStrikeView(_arg1);
_local3 = _toolsHolder;
break;
case GameItemKind.TOOL_WRECKING_BALL:
_local2 = new WreckingBallView(_arg1);
_local3 = _toolsHolder;
break;
case GameItemKind.ACID:
_local2 = new AcidView(_arg1);
_local3 = _toolsHolder;
break;
case GameItemKind.LASER:
_local2 = new LaserView(_arg1);
_local3 = _toolsHolder;
break;
case GameItemKind.AIR_STRIKE_BALL:
_local2 = new AirStrikeBallView(_arg1);
_local3 = _toolsHolder;
break;
case GameItemKind.DESTROYED_BLOCK:
_local2 = new DestroyedBlockView(_arg1);
_local3 = _blocksHolder;
break;
case GameItemKind.EXPLOSION_EFFECT:
_local2 = new ExplosionView(_arg1);
_local3 = _toolsHolder;
break;
case GameItemKind.ANTIMATTER_ATTRACTOR:
_local2 = new AntimatterAttractorView(_arg1);
_local3 = _toolsHolder;
break;
};
if (_local2){
_entityToViewDict[_arg1] = _local2;
_local3.addChild(_local2);
};
}
private function onStageMouseUpHandler(_arg1:MouseEvent):void{
if (_dragToolView){
_dragToolView.stopDrag();
};
_dragToolView = null;
stage.removeEventListener(MouseEvent.MOUSE_UP, onStageMouseUpHandler);
}
public function removeEntityView(_arg1:AbstractGameEntity):void{
var _local2:Sprite = _entityToViewDict[_arg1];
if (_local2){
delete _entityToViewDict[_arg1];
_local2.parent.removeChild(_local2);
IDisposable(_local2).dispose();
};
}
public function reset():void{
_hud.toolsMenu.enabled = true;
_hud.resetTimeoutCounter();
_dragToolIcon.visible = true;
}
private function onMouseMoveHandler(_arg1:MouseEvent):void{
positionDragSprites();
}
private function onMouseClickHandler(_arg1:MouseEvent):void{
if ((((((this.mouseY > 404)) || ((_arg1.target is Component)))) || (_hud.toolsMenu.isSelecting))){
return;
};
var _local2:Point = getSpaceMouseCoordinates(_holder);
_controller.viewMouseClick(_hud.toolsMenu.selectedToolKind, _local2.x, _local2.y);
}
private function onDeleteControlsHandler(_arg1:DemolitionToolEvent):void{
var _local2:AbstractDemolitionToolView = AbstractDemolitionToolView(_arg1.target);
_controller.deleteDemolitionTool(_local2.entity);
_dragToolIcon.visible = true;
}
public function get hud():HUD{
return (_hud);
}
}
}//package bb2.game
Section 208
//LevelResult (bb2.game.LevelResult)
package bb2.game {
import bb2.managers.*;
public class LevelResult {
private var _bumpedCharsPenalty:int;
private var _blastPointsBonus:int;
private var _levelPrice:int;
private var _levelUID:String;
private var _levelScore:int;
private var _levelPassed:Boolean;
private var _bumpedOpponentsBonus:int;
public function LevelResult(_arg1:String, _arg2:Boolean, _arg3:int=0, _arg4:int=0, _arg5:int=0, _arg6:int=0){
_levelUID = _arg1;
_levelPassed = _arg2;
_levelPrice = _arg3;
_blastPointsBonus = (_arg4 * Managers.configManager.getScoringConfig("blastPointBonus"));
_bumpedOpponentsBonus = (_arg5 * Managers.configManager.getScoringConfig("bumpedOpponentsBonus"));
_bumpedCharsPenalty = (_arg6 * Managers.configManager.getScoringConfig("bumpedCharsPenalty"));
_levelScore = (((_levelPrice + _blastPointsBonus) + _bumpedOpponentsBonus) - _bumpedCharsPenalty);
if (_levelScore < 0){
_levelScore = 0;
};
}
public function get levelPrice():int{
return (_levelPrice);
}
public function get levelUID():String{
return (_levelUID);
}
public function get levelScore():int{
return (_levelScore);
}
public function get bumpedCharsPenalty():int{
return (_bumpedCharsPenalty);
}
public function get levelPassed():Boolean{
return (_levelPassed);
}
public function get blastPointsBonus():int{
return (_blastPointsBonus);
}
public function get bumpedOpponentsBonus():int{
return (_bumpedOpponentsBonus);
}
}
}//package bb2.game
Section 209
//GameCompleteController (bb2.gameComplete.GameCompleteController)
package bb2.gameComplete {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import flash.events.*;
import com.bigwigmedia.mvc.*;
import bb2.core.*;
public class GameCompleteController extends EventDispatcher implements IController {
private var _view:GameCompleteView;
public function GameCompleteController(){
_view = new GameCompleteView(this);
}
public function get view():DisplayObject{
return (_view);
}
public function gotoMainMenu():void{
dispatchEvent(new ControllerEvent(ControllerEvent.COMPLETE, MainSignal.SHOW_MAIN_MENU));
}
public function dispose():void{
_view.dispose();
}
}
}//package bb2.gameComplete
Section 210
//GameCompleteView (bb2.gameComplete.GameCompleteView)
package bb2.gameComplete {
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import bb2.managers.*;
import com.bigwigmedia.mvc.*;
public class GameCompleteView extends ComponentView {
private var _controller:GameCompleteController;
public function GameCompleteView(_arg1:GameCompleteController){
_controller = _arg1;
Label(getComponentByName("finalScoreLabel")).text = ("Final Score: $" + Managers.levelProgressService.totalScore);
}
override protected function onComponentClick(_arg1:Component):void{
switch (_arg1.name){
case "mainMenuButton":
_controller.gotoMainMenu();
break;
case "submitScoreButton":
Managers.urlCaller.submitScore(Managers.levelProgressService.totalScore);
break;
case "viewScoresButton":
Managers.urlCaller.viewScores();
break;
case "twoDPlayButton":
Managers.urlCaller.mainLink();
break;
};
}
}
}//package bb2.gameComplete
Section 211
//InstructionsController (bb2.instructions.InstructionsController)
package bb2.instructions {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import flash.events.*;
import com.bigwigmedia.mvc.*;
import bb2.core.*;
public class InstructionsController extends EventDispatcher implements IController {
private var _view:InstructionsView;
public function InstructionsController(){
_view = new InstructionsView(this);
}
public function get view():DisplayObject{
return (_view);
}
public function gotoMainMenu():void{
dispatchEvent(new ControllerEvent(ControllerEvent.COMPLETE, MainSignal.SHOW_MAIN_MENU));
}
public function dispose():void{
_view.dispose();
}
}
}//package bb2.instructions
Section 212
//InstructionsView (bb2.instructions.InstructionsView)
package bb2.instructions {
import com.bigwigmedia.ui.*;
import com.bigwigmedia.mvc.*;
public class InstructionsView extends ComponentView {
private var _controller:InstructionsController;
public function InstructionsView(_arg1:InstructionsController){
_controller = _arg1;
}
override protected function onComponentClick(_arg1:Component):void{
switch (_arg1.name){
case "mainMenuButton":
_controller.gotoMainMenu();
break;
};
}
}
}//package bb2.instructions
Section 213
//LevelSelectionController (bb2.levelSelection.LevelSelectionController)
package bb2.levelSelection {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import bb2.managers.*;
import flash.events.*;
import com.bigwigmedia.mvc.*;
import bb2.core.*;
public class LevelSelectionController extends EventDispatcher implements IController {
private var _view:LevelSelectionView;
public function LevelSelectionController(){
_view = new LevelSelectionView(this);
}
public function resetGame():void{
Managers.levelProgressService.resetGameProgress();
dispatchEvent(new ControllerEvent(ControllerEvent.COMPLETE, MainSignal.RESET_GAME));
}
public function get view():DisplayObject{
return (_view);
}
public function gotoMainMenu():void{
dispatchEvent(new ControllerEvent(ControllerEvent.COMPLETE, MainSignal.SHOW_MAIN_MENU));
}
public function startGame():void{
dispatchEvent(new ControllerEvent(ControllerEvent.COMPLETE, MainSignal.START));
}
public function dispose():void{
_view.dispose();
}
}
}//package bb2.levelSelection
Section 214
//LevelSelectionView (bb2.levelSelection.LevelSelectionView)
package bb2.levelSelection {
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import bb2.managers.*;
import flash.events.*;
import com.bigwigmedia.mvc.*;
import bb2.common.*;
import com.bigwigmedia.ui.containers.*;
import com.bigwigmedia.tweens.*;
public class LevelSelectionView extends DialogOwnerView {
private var _nameLabelTween:ITween;
private var _levelNameLabel:Label;
private var _controller:LevelSelectionController;
public function LevelSelectionView(_arg1:LevelSelectionController){
var _local7:Boolean;
var _local8:Button;
super();
_controller = _arg1;
Label(_component.getComponentByName("totalScoreLabel")).text = ("Total Score: $" + Managers.levelProgressService.totalScore);
var _local2:Tile = Tile(_component.getComponentByName("tile"));
var _local3:Array = Managers.levelProgressService.getLevelInfoList();
var _local4:int = _local3.length;
var _local5:int = Managers.levelProgressService.levelReached;
var _local6:int;
while (_local6 < _local4) {
_local7 = (_local6 > _local5);
_local8 = new Button();
_local8.styleName = (_local7) ? "selectLevelLockedButton" : "selectLevelButton";
_local8.label = (_local7) ? "" : String((_local6 + 1));
_local8.value = _local6;
_local8.enabled = !(_local7);
_local2.addChild(_local8);
_local6++;
};
_levelNameLabel = new Label();
_levelNameLabel.alpha = 0;
_levelNameLabel.mouseEnabled = false;
addChild(_levelNameLabel);
addEventListener(MouseEvent.MOUSE_OVER, onMouseOverHandler);
addEventListener(MouseEvent.MOUSE_MOVE, onMouseMoveHandler);
addEventListener(MouseEvent.MOUSE_OVER, onRollOverHandler);
addEventListener(MouseEvent.MOUSE_OUT, onRollOutHandler);
}
private function onRollOverHandler(_arg1:MouseEvent):void{
var _local3:LevelInfo;
var _local2:Button = (_arg1.target as Button);
if (((_local2) && ((_local2.value is Number)))){
_local3 = Managers.levelProgressService.getLevelInfoList()[_local2.value];
_levelNameLabel.text = (("«" + _local3.title) + "»");
_levelNameLabel.validate();
startNameLabelTween(true);
};
}
override protected function onComponentClick(_arg1:Component):void{
var _local2:Button = (_arg1 as Button);
if (!_local2){
return;
};
switch (_local2.name){
case "resetGameButton":
showDialog(new ResetGameDialog());
break;
case "mainMenuButton":
_controller.gotoMainMenu();
break;
default:
if ((_local2.value is Number)){
Managers.levelProgressService.currentLevel = _local2.value;
Managers.levelProgressService.selectedUserLevelUID = null;
_controller.startGame();
};
break;
};
}
private function startNameLabelTween(_arg1:Boolean):void{
if (_nameLabelTween){
_nameLabelTween.dispose();
};
positionLevelNameLabel();
_nameLabelTween = new PropertyTween(_levelNameLabel, "alpha", _levelNameLabel.alpha, (_arg1) ? 1 : 0, 250);
_nameLabelTween.playAuto();
}
private function positionLevelNameLabel():void{
var _local1:Number = (640 - _levelNameLabel.width);
_levelNameLabel.x = Math.max(0, Math.min(_local1, (this.mouseX - (_levelNameLabel.width / 2))));
_levelNameLabel.y = (this.mouseY - _levelNameLabel.height);
}
private function onMouseOverHandler(_arg1:MouseEvent):void{
var _local2:Button = (_arg1.target as Button);
if (((_local2) && ((_local2.value is Number)))){
Label(_component.getComponentByName("levelBestScoreLabel")).text = ("Level Best Score: $" + Managers.levelProgressService.getLevelBestScore(_local2.value));
};
}
override protected function onDialogClose():void{
if (_dialog.option == DialogOption.OK){
_controller.resetGame();
};
}
private function onRollOutHandler(_arg1:MouseEvent):void{
var _local2:Button = (_arg1.target as Button);
if (((_local2) && ((_local2.value is Number)))){
startNameLabelTween(false);
};
}
private function onMouseMoveHandler(_arg1:MouseEvent):void{
if (_levelNameLabel.alpha != 0){
positionLevelNameLabel();
};
}
override public function dispose():void{
_controller = null;
if (_nameLabelTween){
_nameLabelTween.dispose();
};
super.dispose();
}
}
}//package bb2.levelSelection
Section 215
//ResetGameDialog (bb2.levelSelection.ResetGameDialog)
package bb2.levelSelection {
import com.bigwigmedia.ui.*;
import com.bigwigmedia.mvc.*;
public class ResetGameDialog extends DialogView {
override protected function onComponentClick(_arg1:Component):void{
switch (_arg1.name){
case "okButton":
dispatchCloseEvent(DialogOption.OK);
break;
case "cancelButton":
dispatchCloseEvent(DialogOption.CANCEL);
break;
};
}
}
}//package bb2.levelSelection
Section 216
//MainMenuController (bb2.mainMenu.MainMenuController)
package bb2.mainMenu {
import com.bigwigmedia.mvc.events.*;
import flash.display.*;
import flash.events.*;
import com.bigwigmedia.mvc.*;
import bb2.core.*;
public class MainMenuController extends EventDispatcher implements IController {
private var _view:MainMenuView;
public function MainMenuController(){
_view = new MainMenuView(this);
}
public function get view():DisplayObject{
return (_view);
}
public function playGame():void{
dispatchEvent(new ControllerEvent(ControllerEvent.COMPLETE, MainSignal.START));
}
public function editLevels():void{
dispatchEvent(new ControllerEvent(ControllerEvent.COMPLETE, MainSignal.SHOW_LEVEL_SELECTION));
}
public function viewInstructions():void{
dispatchEvent(new ControllerEvent(ControllerEvent.COMPLETE, MainSignal.SHOW_INSTRUCTIONS));
}
public function dispose():void{
_view.dispose();
}
}
}//package bb2.mainMenu
Section 217
//MainMenuView (bb2.mainMenu.MainMenuView)
package bb2.mainMenu {
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import bb2.managers.*;
import com.bigwigmedia.mvc.*;
public class MainMenuView extends ComponentView {
private var _textArea:TextArea;
private var _controller:MainMenuController;
public function MainMenuView(_arg1:MainMenuController){
_controller = _arg1;
}
override protected function onComponentClick(_arg1:Component):void{
switch (_arg1.name){
case "playButton":
_controller.playGame();
break;
case "levelEditorButton":
_controller.editLevels();
break;
case "viewScoresButton":
Managers.urlCaller.viewScores();
break;
case "instructionsButton":
_controller.viewInstructions();
break;
case "twoDPlayButton":
Managers.urlCaller.mainLink();
break;
};
}
override public function dispose():void{
super.dispose();
if (_textArea){
removeChild(_textArea);
_textArea.dispose();
_textArea = null;
};
}
}
}//package bb2.mainMenu
Section 218
//ConfigManager (bb2.managers.ConfigManager)
package bb2.managers {
import com.bigwigmedia.core.*;
import bb2.constants.*;
public class ConfigManager {
private var configXMLClass:Class;
private var _soundEnabled:Boolean;// = true
private var _onInitCallback:Function;
private var interfacesXMLClass:Class;
private var interfacesXML:XML;
private var styles:String;
private var _scoringParamsHash:Object;
private var levelsXML:XML;
private var levelsXMLClass:Class;
private var configXML:XML;
private var stylesClass:Class;
public function ConfigManager(){
levelsXMLClass = ConfigManager_levelsXMLClass;
configXMLClass = ConfigManager_configXMLClass;
interfacesXMLClass = ConfigManager_interfacesXMLClass;
stylesClass = ConfigManager_stylesClass;
_scoringParamsHash = {};
super();
Singleton.checkInstance(this);
}
public function getLevelsConfig():XMLList{
return (levelsXML.level);
}
public function getDemolitionToolConfig(_arg1:String):XML{
var kind = _arg1;
return (configXML.demolitionTools.tool.(@kind == kind)[0]);
}
public function initialize(_arg1:Function):void{
_onInitCallback = _arg1;
if (!false){
setConfigs(new levelsXMLClass(), new configXMLClass(), new interfacesXMLClass(), new stylesClass());
};
if (Managers.soManager.getValue(SOValues.SOUND_ENABLED) === false){
soundEnabled = false;
};
}
public function getStyles():String{
return (styles);
}
public function set soundEnabled(_arg1:Boolean):void{
_soundEnabled = _arg1;
Managers.soundManager.masterVolume = (_soundEnabled) ? 1 : 0;
Managers.soManager.setValue(SOValues.SOUND_ENABLED, _soundEnabled);
}
private function setConfigs(_arg1:Object, _arg2:Object, _arg3:Object, _arg4:Object):void{
levelsXML = XML(_arg1);
configXML = XML(_arg2);
interfacesXML = XML(_arg3);
styles = String(_arg4);
_onInitCallback();
}
public function get soundEnabled():Boolean{
return (_soundEnabled);
}
public function getComponentConfig(_arg1:String):XML{
var infos:XMLList;
var factoryID = _arg1;
infos = interfacesXML.children().(@factoryID == factoryID);
if (infos.length() != 1){
throw (new Error((("Can't retrieve component configuration with factoryID=\"" + factoryID) + "\"")));
};
return (infos[0]);
}
public function getBlockConfig(_arg1:String):XML{
var kind = _arg1;
return (configXML.blocks.block.(@kind == kind)[0]);
}
public function getScoringConfig(_arg1:String):Number{
var _local2:Number;
if (_scoringParamsHash[_arg1] === undefined){
_local2 = configXML.scoring[_arg1];
_scoringParamsHash[_arg1] = _local2;
};
return (_scoringParamsHash[_arg1]);
}
}
}//package bb2.managers
Section 219
//ConfigManager_configXMLClass (bb2.managers.ConfigManager_configXMLClass)
package bb2.managers {
import mx.core.*;
public class ConfigManager_configXMLClass extends ByteArrayAsset {
}
}//package bb2.managers
Section 220
//ConfigManager_interfacesXMLClass (bb2.managers.ConfigManager_interfacesXMLClass)
package bb2.managers {
import mx.core.*;
public class ConfigManager_interfacesXMLClass extends ByteArrayAsset {
}
}//package bb2.managers
Section 221
//ConfigManager_levelsXMLClass (bb2.managers.ConfigManager_levelsXMLClass)
package bb2.managers {
import mx.core.*;
public class ConfigManager_levelsXMLClass extends ByteArrayAsset {
}
}//package bb2.managers
Section 222
//ConfigManager_stylesClass (bb2.managers.ConfigManager_stylesClass)
package bb2.managers {
import mx.core.*;
public class ConfigManager_stylesClass extends ByteArrayAsset {
}
}//package bb2.managers
Section 223
//Managers (bb2.managers.Managers)
package bb2.managers {
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.font.*;
import com.bigwigmedia.ui.*;
import com.bigwigmedia.sound.*;
import com.bigwigmedia.net.*;
import bb2.services.*;
import com.bigwigmedia.mvc.*;
import com.bigwigmedia.core.*;
import bb2.constants.*;
public class Managers {
private static var _levelProgressService:LevelProgressService;
private static var _soundManager:ISoundManager;
private static var _configManager:ConfigManager;
private static var initialized:Boolean = false;
private static var _urlCaller:IURLCaller;
private static var _fontManager:IFontManager;
private static var _styleManager:IStyleManager;
private static var _soManager:ISOManager;
private static var onInitCallback:Function;
private static var _cursorManager:ICursorManager;
public static function onButtonRollOver(_arg1:AbstractButton):void{
_soundManager.play(SoundID.BEEP_01_WAV);
}
public static function get configManager():ConfigManager{
return (_configManager);
}
public static function initialize(_arg1:Function):void{
if (initialized){
throw (new Error("Managers initialized already"));
};
initialized = true;
Managers.onInitCallback = _arg1;
Singleton.registerClassByInterface(IFontManager, FontManager);
_fontManager = IFontManager(Singleton.getInstanceByInterface(IFontManager));
Singleton.registerClassByInterface(ICursorManager, CursorManager);
_cursorManager = ICursorManager(Singleton.getInstanceByInterface(ICursorManager));
Singleton.registerClassByInterface(ISoundManager, SoundManager);
_soundManager = ISoundManager(Singleton.getInstanceByInterface(ISoundManager));
Singleton.registerClassByInterface(IStyleManager, StyleManager);
_styleManager = IStyleManager(Singleton.getInstanceByInterface(IStyleManager));
Singleton.registerClassByInterface(ISOManager, SOManager);
_soManager = ISOManager(Singleton.getInstanceByInterface(ISOManager));
Singleton.registerClassByInterface(IURLCaller, URLCaller_2DPlay);
_urlCaller = IURLCaller(Singleton.getInstanceByInterface(IURLCaller));
Singleton.registerClassByInterface(IToolTipManager, ToolTipManager);
var _local2:IToolTipManager = IToolTipManager(Singleton.getInstanceByInterface(IToolTipManager));
_local2.showDelay = 250;
ComponentView.componentFactory = new ViewComponentFactory();
_configManager = new ConfigManager();
_configManager.initialize(onConfigManagerInit);
}
public static function onButtonClick(_arg1:AbstractButton):void{
_soundManager.play(SoundID.BUTTON_CLICK_WAV);
}
public static function get urlCaller():IURLCaller{
return (_urlCaller);
}
private static function onConfigManagerInit():void{
_styleManager.parseCSS(_configManager.getStyles());
_soundManager.registerRecord("acid_hiss_01_wav", acid_hiss_01_wav, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("aircraft_pass_01_wav", aircraft_pass_01_wav, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("baloon_pop2_wav", baloon_pop2_wav, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("explosion_01_wav", explosion_01_wav, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("explosion_02_wav", explosion_02_wav, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("explosion_03_wav", explosion_03_wav, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("laser_01_wav", laser_01_wav, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("rock_breaker_01_wav", rock_breaker_01_wav, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("trumpets_fanfar_wav", trumpets_fanfar_wav, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("wrecking_ball_01_wav", wrecking_ball_01_wav, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("wrecking_ball_02_wav", wrecking_ball_02_wav, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("hit_0", hit_0, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("hit_1", hit_1, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("hit_2", hit_2, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("hit_3", hit_3, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("hit_4", hit_4, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("hit_5", hit_5, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("hit_6", hit_6, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("hit_7", hit_7, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("hit_8", hit_8, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("hit_9", hit_9, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("girl_hit_wav", girl_hit_wav, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("ouch_4_wav", ouch_4_wav, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("ouch_6_wav", ouch_6_wav, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("button_click_wav", button_click_wav, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("beep_01_wav", beep_01_wav, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("drm_roll_crash_02_wav", drm_roll_crash_02_wav, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("cancel_sfx", cancel_sfx, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("upgrade_buy_sfx", upgrade_buy_sfx, ChannelID.MISC_EFFECTS);
_soundManager.registerRecord("tapping_wav", tapping_wav, ChannelID.MISC_EFFECTS);
if (!_configManager.soundEnabled){
_soundManager.masterVolume = 0;
};
_levelProgressService = new LevelProgressService();
Managers.onInitCallback();
Managers.onInitCallback = null;
}
public static function get fontManager():IFontManager{
return (_fontManager);
}
public static function get soundManager():ISoundManager{
return (_soundManager);
}
public static function get levelProgressService():LevelProgressService{
return (_levelProgressService);
}
public static function get soManager():ISOManager{
return (_soManager);
}
public static function get cursorManager():ICursorManager{
return (_cursorManager);
}
public static function get styleManager():IStyleManager{
return (_styleManager);
}
}
}//package bb2.managers
Section 224
//ViewComponentFactory (bb2.managers.ViewComponentFactory)
package bb2.managers {
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import com.bigwigmedia.mvc.*;
import bb2.common.*;
import flash.utils.*;
import com.bigwigmedia.ui.decorations.*;
import bb2.editor.ui.*;
import com.bigwigmedia.ui.containers.*;
public class ViewComponentFactory implements IComponentFactory {
private var linkClasses:Array;
public function ViewComponentFactory(){
linkClasses = [Canvas, VBox, HBox, Label, LabelButton, Button, SkinnedButton, Spacer, TextInput, List, Image, Text, HSlider, VScrollBar, HScrollBar, ToolMultiButton, FilterDecoration, TintDecoration, ColorBeacon];
super();
}
public function create(_arg1:ComponentView):Component{
var _local2:String;
var _local3:IComponentIDSupplierView = (_arg1 as IComponentIDSupplierView);
if (_local3){
_local2 = _local3.componentID;
} else {
_local2 = getQualifiedClassName(_arg1);
};
var _local4:XML = Managers.configManager.getComponentConfig(_local2);
return (ComponentFactory.create(_local4));
}
}
}//package bb2.managers
Section 225
//Preloader_BB2 (bb2.preloaders.Preloader_BB2)
package bb2.preloaders {
import flash.display.*;
import flash.system.*;
import flash.events.*;
import com.bigwigmedia.preloaders.*;
import com.bigwigmedia.events.*;
import com.bigwigmedia.core.*;
import com.bigwigmedia.tweens.*;
import assets.*;
import flash.filters.*;
import flash.net.*;
public class Preloader_BB2 extends AbstractPreloader {
private var _animation:MovieClip;
private var _adHolder:Sprite;
private var _hideBarTween:ITween;
private var _logoButton:MovieClip;
private var _sprite:PreloaderSprite;
private var _progressBar:MovieClip;
private var _tween:ITween;
private var _adLoader:Loader;
private var _progressBarMask:MovieClip;
private var _appID:String;
public static const AD_LOADER_URL:String = "http://adserver.bigwigmedia.com/ingamead4.swf";
public function Preloader_BB2(){
_appID = Globals.application.info.id;
_sprite = new PreloaderSprite();
_animation = _sprite._animation;
_progressBar = _sprite._progress_bar;
_adHolder = _sprite._ad_holder;
_logoButton = _sprite._logo_button;
_progressBarMask = _progressBar._mask;
_progressBar.alpha = 0;
_logoButton.alpha = 0;
_adHolder.alpha = 0;
this.addEventListener(MouseEvent.CLICK, onClickHandler);
this.addEventListener("animationEnd", onAnimationEndHandler);
this.addEventListener("logoButtonAnimationEnd", onAnimationEndHandler);
addChild(_sprite);
loadAd();
}
private function playGame():void{
this.removeEventListener(MouseEvent.CLICK, onClickHandler);
this.removeEventListener("animationEnd", onAnimationEndHandler);
this.removeEventListener("logoButtonAnimationEnd", onAnimationEndHandler);
_tween.dispose();
if (_hideBarTween){
_hideBarTween.dispose();
_hideBarTween = null;
};
_adLoader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onAdLoadErrorHandler);
try {
_adLoader.close();
_adLoader.unload();
} catch(error:Error) {
};
dispatchEvent(new PreloaderEvent(PreloaderEvent.COMPLETE, 1));
}
private function navigateTwoDPlay():void{
try {
navigateToURL(new URLRequest(("http://www.2DPlay.com/index.php?gameid=" + _appID)), "_blank");
} catch(error:Error) {
trace("Can't navigate to http://www.2DPlay.com.");
};
}
private function onClickHandler(_arg1:MouseEvent):void{
switch (_arg1.target.name){
case "_two_d_play_logo":
navigateTwoDPlay();
break;
case "_play_game_button":
playGame();
break;
};
}
private function onTweenCompleteHandler(_arg1:TweenEvent):void{
_tween.removeEventListener(TweenEvent.COMPLETE, onTweenCompleteHandler);
_tween.dispose();
this.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
}
private function loadAd():void{
if (Security.sandboxType == Security.LOCAL_WITH_FILE){
trace("Movie sandbox type is LOCAL WITH FILE. It can't participate in BigWig Media ads network.");
} else {
Security.allowDomain("pagead2.googlesyndication.com", "server.cpmstar.com", "adserver.bigwigmedia.com");
_adLoader = new Loader();
_adLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onAdLoadErrorHandler);
_adHolder.addChild(_adLoader);
try {
_adLoader.load(new URLRequest(AD_LOADER_URL));
} catch(error:Error) {
trace((("Resource " + AD_LOADER_URL) + " is unavailable."));
};
};
}
private function onAdLoadErrorHandler(_arg1:IOErrorEvent):void{
trace((("Resource " + AD_LOADER_URL) + " is unavailable."));
}
private function onAnimationEndHandler(_arg1:Event):void{
var _local2:uint;
var _local3:Number;
switch (_arg1.type){
case "logoButtonAnimationEnd":
_local2 = 14955570;
_local3 = 16;
_tween = new SequenceTween([new FilterTween(_logoButton, GlowFilter, {color:_local2, blurX:0, blurY:0}, {color:_local2, blurX:_local3, blurY:_local3}, 700), new FilterTween(_logoButton, GlowFilter, {color:_local2, blurX:_local3, blurY:_local3}, {color:_local2, blurX:0, blurY:0}, 700)], true);
_tween.playAuto();
break;
case "animationEnd":
_progressBarMask.scaleX = percentLoaded;
_tween = new ParallelTween([new PropertyTween(_progressBar, "alpha", 0, 1, 1000), new PropertyTween(_logoButton, "alpha", 0, 1, 1000), new PropertyTween(_adHolder, "alpha", 0, 1, 1000)]);
_tween.addEventListener(TweenEvent.COMPLETE, onTweenCompleteHandler);
_tween.playAuto();
break;
};
}
private function onEnterFrameHandler(_arg1:Event):void{
var _local2:Number = percentLoaded;
_progressBarMask.scaleX = _local2;
if (_local2 == 1){
this.removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
_logoButton.play();
_hideBarTween = new PropertyTween(_progressBar, "alpha", 1, 0, 700);
_hideBarTween.playAuto();
};
}
}
}//package bb2.preloaders
Section 226
//LevelProgressService (bb2.services.LevelProgressService)
package bb2.services {
import bb2.managers.*;
import bb2.common.*;
import bb2.game.*;
import flash.utils.*;
import com.bigwigmedia.core.*;
import bb2.constants.*;
import com.dynamicflash.util.*;
public class LevelProgressService {
private var _levelInfoList:Array;
private var _uidToUserLevelInfoHash:Object;
private var _currentLevel:int;
private var _selectedUserLevelUID:String;
private var _userLevelUIDList:Array;
public static const LOAD_RESULT_DUPLICATE:String = "LOAD_RESULT_DUPLICATE";
public static const LOAD_RESULT_SUCCESS:String = "LOAD_RESULT_SUCCESS";
public static const LOAD_RESULT_INVALID:String = "LOAD_RESULT_INVALID";
public function LevelProgressService(){
var _local3:String;
var _local4:XML;
_uidToUserLevelInfoHash = {};
super();
Singleton.checkInstance(this);
if (!Managers.soManager.getValue(SOValues.LEVELS_SAVED)){
Managers.soManager.setValue(SOValues.LEVELS_SAVED, true);
Managers.soManager.setValue(SOValues.LEVEL_REACHED, 0);
Managers.soManager.setValue(SOValues.USER_LEVEL_UIDS_LIST, new Array());
Managers.soManager.setValue(SOValues.USER_LEVELS_SCORE_HASH, new Object());
};
if (!Managers.soManager.getValue(SOValues.LEVELS_SCORE_HASH)){
Managers.soManager.setValue(SOValues.LEVELS_SCORE_HASH, new Object());
};
if (!Managers.soManager.getValue(SOValues.TOTAL_SCORE_MINUS_LIST)){
Managers.soManager.setValue(SOValues.TOTAL_SCORE_MINUS_LIST, new Array());
};
_userLevelUIDList = Managers.soManager.getValue(SOValues.USER_LEVEL_UIDS_LIST);
var _local1:int = _userLevelUIDList.length;
var _local2:int;
while (_local2 < _local1) {
_local3 = _userLevelUIDList[_local2];
_local4 = new XML(Managers.soManager.getValue(_local3));
_uidToUserLevelInfoHash[_local3] = new LevelInfo(_local4);
_local2++;
};
}
public function isPlayedLastLevel():Boolean{
if (isPlayingUserLevel()){
return (false);
};
return ((_currentLevel >= _levelInfoList.length));
}
public function getLevelInfo():LevelInfo{
if (_selectedUserLevelUID != null){
return (getUserLevelInfo(_selectedUserLevelUID));
};
return (getLevelInfoList()[_currentLevel]);
}
public function get currentLevel():int{
return (_currentLevel);
}
public function isPlayingUserLevel():Boolean{
return (!((_selectedUserLevelUID == null)));
}
public function deleteUserLevel(_arg1:String):void{
if (!_uidToUserLevelInfoHash[_arg1]){
throw (new Error((("Level with uid=\"" + _arg1) + "\" doesn't exist")));
};
var _local2:int = _userLevelUIDList.indexOf(_arg1);
_userLevelUIDList.splice(_local2, 1);
delete _uidToUserLevelInfoHash[_arg1];
Managers.soManager.setValue(_arg1, undefined);
}
public function getUserLevelInfoList():Array{
var _local1:Array = [];
var _local2:int = _userLevelUIDList.length;
var _local3:int;
while (_local3 < _local2) {
_local1.push(getUserLevelInfo(_userLevelUIDList[_local3]));
_local3++;
};
return (_local1);
}
public function isToolAcquired(_arg1:String):Boolean{
if (_arg1 == GameItemKind.EXPL_TNT){
return (true);
};
var _local2:Object = Managers.soManager.getValue(SOValues.ACQUIRED_TOOLS);
if (!_local2){
Managers.soManager.setValue(SOValues.ACQUIRED_TOOLS, new Object());
return (false);
};
return (Boolean(_local2[_arg1]));
}
public function get selectedUserLevelUID():String{
return (_selectedUserLevelUID);
}
public function getLevelExportString():String{
var _local1:XML = new XML(Managers.soManager.getValue(_selectedUserLevelUID));
var _local2:ByteArray = new ByteArray();
_local2.writeUTFBytes(_local1.toXMLString());
_local2.compress();
return (Base64.encodeByteArray(_local2));
}
public function acquireTool(_arg1:String):Boolean{
var _local2:XML = Managers.configManager.getDemolitionToolConfig(_arg1);
var _local3:int = _local2.price;
if (_local3 > totalScoreMinus){
return (false);
};
var _local4:Object = Managers.soManager.getValue(SOValues.ACQUIRED_TOOLS);
if (!_local4){
_local4 = {};
};
_local4[_arg1] = true;
Managers.soManager.setValue(SOValues.ACQUIRED_TOOLS, _local4);
var _local5:Array = Managers.soManager.getValue(SOValues.TOTAL_SCORE_MINUS_LIST);
_local5.push(_local3);
Managers.soManager.setValue(SOValues.TOTAL_SCORE_MINUS_LIST, _local5);
if (Managers.soManager.getValue(SOValues.CHANGE_TOOL_HINT) === undefined){
Managers.soManager.setValue(SOValues.CHANGE_TOOL_HINT, false);
};
return (true);
}
public function set currentLevel(_arg1:int):void{
_currentLevel = _arg1;
}
public function addUserLevel(_arg1:String, _arg2:String, _arg3:String):void{
var _local4:LevelInfo = LevelInfo.createNew(_arg1, _arg2, _arg3);
_uidToUserLevelInfoHash[_local4.uid] = _local4;
_userLevelUIDList.push(_local4.uid);
saveUserLevel(_local4.uid);
}
public function getLevelInfoList():Array{
var _local1:XMLList;
var _local2:XML;
if (!_levelInfoList){
_levelInfoList = [];
_local1 = Managers.configManager.getLevelsConfig();
for each (_local2 in _local1) {
_levelInfoList[int(_local2.@num)] = new LevelInfo(_local2);
};
};
return (_levelInfoList);
}
public function get totalScoreMinus():int{
var _local3:int;
var _local1:int = this.totalScore;
var _local2:Array = Managers.soManager.getValue(SOValues.TOTAL_SCORE_MINUS_LIST);
for each (_local3 in _local2) {
_local1 = (_local1 - _local3);
};
return (_local1);
}
public function set levelReached(_arg1:int):void{
Managers.soManager.setValue(SOValues.LEVEL_REACHED, _arg1);
}
public function getUserLevelInfo(_arg1:String):LevelInfo{
if (!_uidToUserLevelInfoHash[_arg1]){
throw (new Error((("Level with uid=\"" + _arg1) + "\" doesn't exist")));
};
return (_uidToUserLevelInfoHash[_arg1]);
}
public function saveSelectedUserLevel():void{
saveUserLevel(_selectedUserLevelUID);
}
public function completeLevel(_arg1:LevelResult):void{
var _local4:Object;
var _local5:int;
var _local6:Object;
var _local2:String = _arg1.levelUID;
var _local3:int = getLevelScore(_local2);
if (isPlayingUserLevel()){
if (_arg1.levelScore > _local3){
_local4 = Managers.soManager.getValue(SOValues.USER_LEVELS_SCORE_HASH);
_local4[_local2] = _arg1.levelScore;
Managers.soManager.setValue(SOValues.USER_LEVELS_SCORE_HASH, _local4);
};
} else {
if (_arg1.levelScore > _local3){
_local6 = Managers.soManager.getValue(SOValues.LEVELS_SCORE_HASH);
_local6[_local2] = _arg1.levelScore;
Managers.soManager.setValue(SOValues.LEVELS_SCORE_HASH, _local6);
};
_local5 = 0;
while (_local5 < _levelInfoList.length) {
if (LevelInfo(_levelInfoList[_local5]).uid == _local2){
if (_local5 == this.levelReached){
this.levelReached = (_local5 + 1);
};
break;
};
_local5++;
};
};
}
public function set selectedUserLevelUID(_arg1:String):void{
_selectedUserLevelUID = _arg1;
}
public function getLevelBestScore(_arg1:int):int{
var _local2:LevelInfo = getLevelInfoList()[_arg1];
return (getLevelScore(_local2.uid));
}
public function getLevelScore(_arg1:String):int{
var _local2:Object;
var _local3:Object;
if (isPlayingUserLevel()){
_local2 = Managers.soManager.getValue(SOValues.USER_LEVELS_SCORE_HASH);
if (_local2[_arg1] !== undefined){
return (_local2[_arg1]);
};
} else {
_local3 = Managers.soManager.getValue(SOValues.LEVELS_SCORE_HASH);
if (_local3[_arg1] !== undefined){
return (_local3[_arg1]);
};
};
return (0);
}
public function showChangeToolHint():Boolean{
return (((!(this.isPlayingUserLevel())) && ((Managers.soManager.getValue(SOValues.CHANGE_TOOL_HINT) === false))));
}
public function get levelReached():int{
return (Managers.soManager.getValue(SOValues.LEVEL_REACHED));
}
public function showInstructionsHint():Boolean{
return (((!(this.isPlayingUserLevel())) && ((this.currentLevel == 0))));
}
public function getAllUserLevelsXML():XML{
var _local4:String;
var _local5:XML;
var _local1:XML = <levels/>
;
var _local2:int = _userLevelUIDList.length;
var _local3:int;
while (_local3 < _local2) {
_local4 = _userLevelUIDList[_local3];
_local5 = new XML(Managers.soManager.getValue(_local4));
_local1.appendChild(_local5);
_local3++;
};
return (_local1);
}
public function deleteSelectedUserLevel():void{
deleteUserLevel(_selectedUserLevelUID);
}
public function get totalScore():int{
var _local3:int;
var _local1:int;
var _local2:Object = Managers.soManager.getValue(SOValues.LEVELS_SCORE_HASH);
for each (_local3 in _local2) {
_local1 = (_local1 + _local3);
};
return (_local1);
}
public function isCurrentLevelCompleted():Boolean{
return ((_currentLevel < levelReached));
}
public function updateForNextLevel():void{
if (!isPlayingUserLevel()){
this.currentLevel++;
};
}
public function saveUserLevel(_arg1:String):void{
Managers.soManager.setValue(_arg1, getUserLevelInfo(_arg1).xml.toXMLString());
}
public function resetGameProgress():void{
Managers.soManager.setValue(SOValues.TOTAL_SCORE_MINUS_LIST, new Array());
Managers.soManager.setValue(SOValues.LEVELS_SCORE_HASH, new Object());
Managers.soManager.setValue(SOValues.ACQUIRED_TOOLS, new Object());
levelReached = 0;
}
public function loadLevel(_arg1:String):String{
var bytes:ByteArray;
var str:String;
var xml:XML;
var info:LevelInfo;
var levelString = _arg1;
try {
bytes = Base64.decodeToByteArray(levelString);
bytes.uncompress();
str = bytes.readUTFBytes(bytes.length);
xml = new XML(str);
if (!xml.hasOwnProperty("@uid")){
return (LOAD_RESULT_INVALID);
};
xml.@imported = "true";
info = new LevelInfo(xml);
if (_uidToUserLevelInfoHash[info.uid]){
return (LOAD_RESULT_DUPLICATE);
};
_uidToUserLevelInfoHash[info.uid] = info;
_userLevelUIDList.push(info.uid);
saveUserLevel(info.uid);
return (LOAD_RESULT_SUCCESS);
} catch(e:Error) {
trace(e.message);
};
return (LOAD_RESULT_INVALID);
}
}
}//package bb2.services
Section 227
//Main (bb2.Main)
package bb2 {
import com.bigwigmedia.application.*;
import com.bigwigmedia.core.*;
import bb2.preloaders.*;
import com.bigwigmedia.mvc.*;
import com.bigwigmedia.ui.*;
public class Main extends AbstractApplication {
public static const VERSION:String = "1.0.0.3708";
public function Main(){
super("Building Blaster 2", "1748", VERSION, "com.bigwigmedia.building_blaster_2");
}
final public function getBigWigWrappedGameData():Object{
var _local1:Object = {url:loaderInfo.url, gameid:info.id, affid:loaderInfo.parameters.affid};
return (_local1);
}
override protected function onLoadingComplete():void{
removePreloader();
var _local1:Class = Globals.getClass("bb2.core.MainController");
var _local2:IController = new (_local1);
addMainView(_local2.view);
}
override protected function onInitialize():void{
super.onInitialize();
this.contextMenu = new ContextMenuFactory_2DPlay().menu;
fillBackground();
fillMask(0);
startPreloading(new Preloader_BB2());
}
}
}//package bb2
Section 228
//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 229
//b2CircleShape (Box2D.Collision.Shapes.b2CircleShape)
package Box2D.Collision.Shapes {
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2CircleShape extends b2Shape {
public var m_localPosition:b2Vec2;
public var m_radius:Number;
public function b2CircleShape(_arg1:b2ShapeDef){
m_localPosition = new b2Vec2();
super(_arg1);
var _local2:b2CircleDef = (_arg1 as b2CircleDef);
m_type = e_circleShape;
m_localPosition.SetV(_local2.localPosition);
m_radius = _local2.radius;
}
override public function 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.y + ((_local6.col1.y * m_localPosition.x) + (_local6.col2.y * m_localPosition.y)));
var _local9:Number = (_arg4.p1.x - _local7);
_local10 = (_arg4.p1.y - _local8);
var _local11:Number = (((_local9 * _local9) + (_local10 * _local10)) - (m_radius * m_radius));
if (_local11 < 0){
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((((_local5 < _local7)) ? _local5 : _local7 - m_radius), (((_local6 < _local8)) ? _local6 : _local8 - m_radius));
_arg1.upperBound.Set((((_local5 > _local7)) ? _local5 : _local7 + m_radius), (((_local6 > _local8)) ? _local6 : _local8 + m_radius));
}
override public function ComputeMass(_arg1:b2MassData):void{
_arg1.mass = (((m_density * b2Settings.b2_pi) * m_radius) * m_radius);
_arg1.center.SetV(m_localPosition);
_arg1.I = (_arg1.mass * (((0.5 * m_radius) * m_radius) + ((m_localPosition.x * m_localPosition.x) + (m_localPosition.y * m_localPosition.y))));
}
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 230
//b2FilterData (Box2D.Collision.Shapes.b2FilterData)
package Box2D.Collision.Shapes {
public class b2FilterData {
public var maskBits:uint;// = 0xFFFF
public var groupIndex:int;// = 0
public var categoryBits:uint;// = 1
public function Copy():b2FilterData{
var _local1:b2FilterData = new b2FilterData();
_local1.categoryBits = categoryBits;
_local1.maskBits = maskBits;
_local1.groupIndex = groupIndex;
return (_local1);
}
}
}//package Box2D.Collision.Shapes
Section 231
//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 232
//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 233
//b2PolygonShape (Box2D.Collision.Shapes.b2PolygonShape)
package Box2D.Collision.Shapes {
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
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++;
};
}
override public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
var _local4:b2AABB = s_sweptAABB1;
var _local5:b2AABB = s_sweptAABB2;
ComputeAABB(_local4, _arg2);
ComputeAABB(_local5, _arg3);
_arg1.lowerBound.Set(((_local4.lowerBound.x < _local5.lowerBound.x)) ? _local4.lowerBound.x : _local5.lowerBound.x, ((_local4.lowerBound.y < _local5.lowerBound.y)) ? _local4.lowerBound.y : _local5.lowerBound.y);
_arg1.upperBound.Set(((_local4.upperBound.x > _local5.upperBound.x)) ? _local4.upperBound.x : _local5.upperBound.x, ((_local4.upperBound.y > _local5.upperBound.y)) ? _local4.upperBound.y : _local5.upperBound.y);
}
public function GetVertices():Array{
return (m_vertices);
}
public function GetCoreVertices():Array{
return (m_coreVertices);
}
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) {
_local11 = m_vertices[_local19];
_local8 = (_local11.x - _local12);
_local9 = (_local11.y - _local13);
_local11 = m_normals[_local19];
_local20 = ((_local11.x * _local8) + (_local11.y * _local9));
_local21 = ((_local11.x * _local16) + (_local11.y * _local17));
if ((((_local21 < 0)) && ((_local20 < (_local6 * _local21))))){
_local6 = (_local20 / _local21);
_local18 = _local19;
} else {
if ((((_local21 > 0)) && ((_local20 < (_local7 * _local21))))){
_local7 = (_local20 / _local21);
};
};
if (_local7 < _local6){
return (false);
};
_local19++;
};
if (_local18 >= 0){
_arg2[0] = _local6;
_local10 = _arg1.R;
_local11 = m_normals[_local18];
_arg3.x = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_arg3.y = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
return (true);
};
return (false);
}
override public function ComputeMass(_arg1:b2MassData):void{
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local2:Number = 0;
var _local3:Number = 0;
var _local4:Number = 0;
var _local5:Number = 0;
var _local6:Number = 0;
var _local7:Number = 0;
var _local8:Number = (1 / 3);
var _local9:int;
while (_local9 < m_vertexCount) {
_local10 = m_vertices[_local9];
_local11 = (((_local9 + 1) < m_vertexCount)) ? m_vertices[int((_local9 + 1))] : m_vertices[0];
_local12 = (_local10.x - _local6);
_local13 = (_local10.y - _local7);
_local14 = (_local11.x - _local6);
_local15 = (_local11.y - _local7);
_local16 = ((_local12 * _local15) - (_local13 * _local14));
_local17 = (0.5 * _local16);
_local4 = (_local4 + _local17);
_local2 = (_local2 + ((_local17 * _local8) * ((_local6 + _local10.x) + _local11.x)));
_local3 = (_local3 + ((_local17 * _local8) * ((_local7 + _local10.y) + _local11.y)));
_local18 = _local6;
_local19 = _local7;
_local20 = _local12;
_local21 = _local13;
_local22 = _local14;
_local23 = _local15;
_local24 = ((_local8 * ((0.25 * (((_local20 * _local20) + (_local22 * _local20)) + (_local22 * _local22))) + ((_local18 * _local20) + (_local18 * _local22)))) + ((0.5 * _local18) * _local18));
_local25 = ((_local8 * ((0.25 * (((_local21 * _local21) + (_local23 * _local21)) + (_local23 * _local23))) + ((_local19 * _local21) + (_local19 * _local23)))) + ((0.5 * _local19) * _local19));
_local5 = (_local5 + (_local16 * (_local24 + _local25)));
_local9++;
};
_arg1.mass = (m_density * _local4);
_local2 = (_local2 * (1 / _local4));
_local3 = (_local3 * (1 / _local4));
_arg1.center.Set(_local2, _local3);
_arg1.I = (m_density * _local5);
}
public function GetNormals():Array{
return (m_normals);
}
public function Support(_arg1:b2XForm, _arg2:Number, _arg3:Number):b2Vec2{
var _local4:b2Vec2;
var _local5:b2Mat22;
var _local11:Number;
_local5 = _arg1.R;
var _local6:Number = ((_arg2 * _local5.col1.x) + (_arg3 * _local5.col1.y));
var _local7:Number = ((_arg2 * _local5.col2.x) + (_arg3 * _local5.col2.y));
var _local8:int;
_local4 = m_coreVertices[0];
var _local9:Number = ((_local4.x * _local6) + (_local4.y * _local7));
var _local10 = 1;
while (_local10 < m_vertexCount) {
_local4 = m_coreVertices[_local10];
_local11 = ((_local4.x * _local6) + (_local4.y * _local7));
if (_local11 > _local9){
_local8 = _local10;
_local9 = _local11;
};
_local10++;
};
_local5 = _arg1.R;
_local4 = m_coreVertices[_local8];
s_supportVec.x = (_arg1.position.x + ((_local5.col1.x * _local4.x) + (_local5.col2.x * _local4.y)));
s_supportVec.y = (_arg1.position.y + ((_local5.col1.y * _local4.x) + (_local5.col2.y * _local4.y)));
return (s_supportVec);
}
public function GetVertexCount():int{
return (m_vertexCount);
}
override public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local5:b2Mat22 = s_computeMat;
_local3 = _arg2.R;
_local4 = m_obb.R.col1;
_local5.col1.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col1.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local4 = m_obb.R.col2;
_local5.col2.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
_local5.col2.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
_local5.Abs();
var _local6:b2Mat22 = _local5;
_local4 = m_obb.extents;
var _local7:Number = ((_local6.col1.x * _local4.x) + (_local6.col2.x * _local4.y));
var _local8:Number = ((_local6.col1.y * _local4.x) + (_local6.col2.y * _local4.y));
_local3 = _arg2.R;
_local4 = m_obb.center;
var _local9:Number = (_arg2.position.x + ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y)));
var _local10:Number = (_arg2.position.y + ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y)));
_arg1.lowerBound.Set((_local9 - _local7), (_local10 - _local8));
_arg1.upperBound.Set((_local9 + _local7), (_local10 + _local8));
}
override public function UpdateSweepRadius(_arg1:b2Vec2):void{
var _local2:b2Vec2;
var _local4:Number;
var _local5:Number;
m_sweepRadius = 0;
var _local3:int;
while (_local3 < m_vertexCount) {
_local2 = m_coreVertices[_local3];
_local4 = (_local2.x - _arg1.x);
_local5 = (_local2.y - _arg1.y);
_local4 = Math.sqrt(((_local4 * _local4) + (_local5 * _local5)));
if (_local4 > m_sweepRadius){
m_sweepRadius = _local4;
};
_local3++;
};
}
override public function TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
var _local3:b2Vec2;
var _local10:Number;
var _local4:b2Mat22 = _arg1.R;
var _local5:Number = (_arg2.x - _arg1.position.x);
var _local6:Number = (_arg2.y - _arg1.position.y);
var _local7:Number = ((_local5 * _local4.col1.x) + (_local6 * _local4.col1.y));
var _local8:Number = ((_local5 * _local4.col2.x) + (_local6 * _local4.col2.y));
var _local9:int;
while (_local9 < m_vertexCount) {
_local3 = m_vertices[_local9];
_local5 = (_local7 - _local3.x);
_local6 = (_local8 - _local3.y);
_local3 = m_normals[_local9];
_local10 = ((_local3.x * _local5) + (_local3.y * _local6));
if (_local10 > 0){
return (false);
};
_local9++;
};
return (true);
}
public static function ComputeCentroid(_arg1:Array, _arg2:int):b2Vec2{
var _local3:b2Vec2;
var _local7:Number;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
_local3 = new b2Vec2();
var _local4:Number = 0;
var _local5:Number = 0;
var _local6:Number = 0;
_local7 = (1 / 3);
var _local8:int;
while (_local8 < _arg2) {
_local9 = _arg1[_local8];
_local10 = (((_local8 + 1) < _arg2)) ? _arg1[int((_local8 + 1))] : _arg1[0];
_local11 = (_local9.x - _local5);
_local12 = (_local9.y - _local6);
_local13 = (_local10.x - _local5);
_local14 = (_local10.y - _local6);
_local15 = ((_local11 * _local14) - (_local12 * _local13));
_local16 = (0.5 * _local15);
_local4 = (_local4 + _local16);
_local3.x = (_local3.x + ((_local16 * _local7) * ((_local5 + _local9.x) + _local10.x)));
_local3.y = (_local3.y + ((_local16 * _local7) * ((_local6 + _local9.y) + _local10.y)));
_local8++;
};
_local3.x = (_local3.x * (1 / _local4));
_local3.y = (_local3.y * (1 / _local4));
return (_local3);
}
public static function ComputeOBB(_arg1:b2OBB, _arg2:Array, _arg3:int):void{
var _local4:int;
var _local7:b2Vec2;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:b2Mat22;
var _local5:Array = new Array((b2Settings.b2_maxPolygonVertices + 1));
_local4 = 0;
while (_local4 < _arg3) {
_local5[_local4] = _arg2[_local4];
_local4++;
};
_local5[_arg3] = _local5[0];
var _local6:Number = Number.MAX_VALUE;
_local4 = 1;
while (_local4 <= _arg3) {
_local7 = _local5[int((_local4 - 1))];
_local8 = (_local5[_local4].x - _local7.x);
_local9 = (_local5[_local4].y - _local7.y);
_local10 = Math.sqrt(((_local8 * _local8) + (_local9 * _local9)));
_local8 = (_local8 / _local10);
_local9 = (_local9 / _local10);
_local11 = -(_local9);
_local12 = _local8;
_local13 = Number.MAX_VALUE;
_local14 = Number.MAX_VALUE;
_local15 = -(Number.MAX_VALUE);
_local16 = -(Number.MAX_VALUE);
_local17 = 0;
while (_local17 < _arg3) {
_local19 = (_local5[_local17].x - _local7.x);
_local20 = (_local5[_local17].y - _local7.y);
_local21 = ((_local8 * _local19) + (_local9 * _local20));
_local22 = ((_local11 * _local19) + (_local12 * _local20));
if (_local21 < _local13){
_local13 = _local21;
};
if (_local22 < _local14){
_local14 = _local22;
};
if (_local21 > _local15){
_local15 = _local21;
};
if (_local22 > _local16){
_local16 = _local22;
};
_local17++;
};
_local18 = ((_local15 - _local13) * (_local16 - _local14));
if (_local18 < (0.95 * _local6)){
_local6 = _local18;
_arg1.R.col1.x = _local8;
_arg1.R.col1.y = _local9;
_arg1.R.col2.x = _local11;
_arg1.R.col2.y = _local12;
_local23 = (0.5 * (_local13 + _local15));
_local24 = (0.5 * (_local14 + _local16));
_local25 = _arg1.R;
_arg1.center.x = (_local7.x + ((_local25.col1.x * _local23) + (_local25.col2.x * _local24)));
_arg1.center.y = (_local7.y + ((_local25.col1.y * _local23) + (_local25.col2.y * _local24)));
_arg1.extents.x = (0.5 * (_local15 - _local13));
_arg1.extents.y = (0.5 * (_local16 - _local14));
};
_local4++;
};
}
}
}//package Box2D.Collision.Shapes
Section 234
//b2Shape (Box2D.Collision.Shapes.b2Shape)
package Box2D.Collision.Shapes {
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
public class b2Shape {
public var m_next:b2Shape;
public var m_type:int;
public var m_sweepRadius:Number;
public var m_density:Number;
public var m_filter:b2FilterData;
public var m_friction:Number;
public var m_isSensor:Boolean;
public var m_restitution:Number;
public var m_userData;
public var m_proxyId:uint;
public var m_body:b2Body;
public static const e_polygonShape:int = 1;
public static const e_unknownShape:int = -1;
public static const e_circleShape:int = 0;
public static const e_shapeTypeCount:int = 2;
private static var s_resetAABB:b2AABB = new b2AABB();
private static var s_syncAABB:b2AABB = new b2AABB();
private static var s_proxyAABB:b2AABB = new b2AABB();
public function b2Shape(_arg1:b2ShapeDef){
m_userData = _arg1.userData;
m_friction = _arg1.friction;
m_restitution = _arg1.restitution;
m_density = _arg1.density;
m_body = null;
m_sweepRadius = 0;
m_next = null;
m_proxyId = b2Pair.b2_nullProxy;
m_filter = _arg1.filter.Copy();
m_isSensor = _arg1.isSensor;
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetSweepRadius():Number{
return (m_sweepRadius);
}
public function GetNext():b2Shape{
return (m_next);
}
public function ComputeSweptAABB(_arg1:b2AABB, _arg2:b2XForm, _arg3:b2XForm):void{
}
public function GetType():int{
return (m_type);
}
public function GetRestitution():Number{
return (m_restitution);
}
public function GetFriction():Number{
return (m_friction);
}
public function GetFilterData():b2FilterData{
return (m_filter.Copy());
}
public function TestSegment(_arg1:b2XForm, _arg2:Array, _arg3:b2Vec2, _arg4:b2Segment, _arg5:Number):Boolean{
return (false);
}
public function RefilterProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
if (m_proxyId == b2Pair.b2_nullProxy){
return;
};
_arg1.DestroyProxy(m_proxyId);
var _local3:b2AABB = s_resetAABB;
ComputeAABB(_local3, _arg2);
var _local4:Boolean = _arg1.InRange(_local3);
if (_local4){
m_proxyId = _arg1.CreateProxy(_local3, this);
} else {
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function SetFilterData(_arg1:b2FilterData):void{
m_filter = _arg1.Copy();
}
public function GetUserData(){
return (m_userData);
}
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 ComputeMass(_arg1:b2MassData):void{
}
public function IsSensor():Boolean{
return (m_isSensor);
}
public function DestroyProxy(_arg1:b2BroadPhase):void{
if (m_proxyId != b2Pair.b2_nullProxy){
_arg1.DestroyProxy(m_proxyId);
m_proxyId = b2Pair.b2_nullProxy;
};
}
public function UpdateSweepRadius(_arg1:b2Vec2):void{
}
public function ComputeAABB(_arg1:b2AABB, _arg2:b2XForm):void{
}
public function GetBody():b2Body{
return (m_body);
}
public function CreateProxy(_arg1:b2BroadPhase, _arg2:b2XForm):void{
var _local3:b2AABB = 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 TestPoint(_arg1:b2XForm, _arg2:b2Vec2):Boolean{
return (false);
}
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 235
//b2ShapeDef (Box2D.Collision.Shapes.b2ShapeDef)
package Box2D.Collision.Shapes {
public class b2ShapeDef {
public var friction:Number;// = 0.2
public var isSensor:Boolean;// = false
public var density:Number;// = 0
public var restitution:Number;// = 0
public var userData;// = null
public var filter:b2FilterData;
public var type:int;
public function b2ShapeDef(){
type = b2Shape.e_unknownShape;
filter = new b2FilterData();
super();
}
}
}//package Box2D.Collision.Shapes
Section 236
//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 237
//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 238
//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 239
//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 _local5:Number;
var _local6:b2Proxy;
var _local7:int;
m_pairManager = new b2PairManager();
m_proxyPool = new Array(b2Settings.b2_maxPairs);
m_bounds = new Array((2 * b2Settings.b2_maxProxies));
m_queryResults = new Array(b2Settings.b2_maxProxies);
m_quantizationFactor = new b2Vec2();
super();
m_pairManager.Initialize(this, _arg2);
m_worldAABB = _arg1;
m_proxyCount = 0;
_local3 = 0;
while (_local3 < b2Settings.b2_maxProxies) {
m_queryResults[_local3] = 0;
_local3++;
};
m_bounds = new Array(2);
_local3 = 0;
while (_local3 < 2) {
m_bounds[_local3] = new Array((2 * b2Settings.b2_maxProxies));
_local7 = 0;
while (_local7 < (2 * b2Settings.b2_maxProxies)) {
m_bounds[_local3][_local7] = new b2Bound();
_local7++;
};
_local3++;
};
var _local4:Number = (_arg1.upperBound.x - _arg1.lowerBound.x);
_local5 = (_arg1.upperBound.y - _arg1.lowerBound.y);
m_quantizationFactor.x = (b2Settings.USHRT_MAX / _local4);
m_quantizationFactor.y = (b2Settings.USHRT_MAX / _local5);
_local3 = 0;
while (_local3 < (b2Settings.b2_maxProxies - 1)) {
_local6 = new b2Proxy();
m_proxyPool[_local3] = _local6;
_local6.SetNext((_local3 + 1));
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
_local3++;
};
_local6 = new b2Proxy();
m_proxyPool[int((b2Settings.b2_maxProxies - 1))] = _local6;
_local6.SetNext(b2Pair.b2_nullProxy);
_local6.timeStamp = 0;
_local6.overlapCount = b2_invalid;
_local6.userData = null;
m_freeProxy = 0;
m_timeStamp = 1;
m_queryResultCount = 0;
}
public function QueryAABB(_arg1:b2AABB, _arg2, _arg3:int):int{
var _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{
var _local2:b2Proxy = m_proxyPool[_arg1];
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((_local2.IsValid() == false)))){
return (null);
};
return (_local2);
}
private function IncrementTimeStamp():void{
var _local1:uint;
if (m_timeStamp == b2Settings.USHRT_MAX){
_local1 = 0;
while (_local1 < b2Settings.b2_maxProxies) {
(m_proxyPool[_local1] as b2Proxy).timeStamp = 0;
_local1++;
};
m_timeStamp = 1;
} else {
m_timeStamp++;
};
}
private function Query(_arg1:Array, _arg2:Array, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:uint, _arg7:int):void{
var _local10:b2Bound;
var _local12:int;
var _local13:int;
var _local14:b2Proxy;
var _local8:uint = BinarySearch(_arg5, _arg6, _arg3);
var _local9:uint = BinarySearch(_arg5, _arg6, _arg4);
var _local11:uint = _local8;
while (_local11 < _local9) {
_local10 = _arg5[_local11];
if (_local10.IsLower()){
IncrementOverlapCount(_local10.proxyId);
};
_local11++;
};
if (_local8 > 0){
_local12 = (_local8 - 1);
_local10 = _arg5[_local12];
_local13 = _local10.stabbingCount;
while (_local13) {
_local10 = _arg5[_local12];
if (_local10.IsLower()){
_local14 = m_proxyPool[_local10.proxyId];
if (_local8 <= _local14.upperBounds[_arg7]){
IncrementOverlapCount(_local10.proxyId);
_local13--;
};
};
_local12--;
};
};
_arg1[0] = _local8;
_arg2[0] = _local9;
}
private function TestOverlapValidate(_arg1:b2Proxy, _arg2:b2Proxy):Boolean{
var _local4:Array;
var _local5:b2Bound;
var _local6:b2Bound;
var _local3:int;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg1.lowerBounds[_local3]];
_local6 = _local4[_arg2.upperBounds[_local3]];
if (_local5.value > _local6.value){
return (false);
};
_local5 = _local4[_arg1.upperBounds[_local3]];
_local6 = _local4[_arg2.lowerBounds[_local3]];
if (_local5.value < _local6.value){
return (false);
};
_local3++;
};
return (true);
}
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:b2Bound;
var _local22:int;
var _local23:b2Proxy;
var _local5:uint = m_freeProxy;
_local4 = m_proxyPool[_local5];
m_freeProxy = _local4.GetNext();
_local4.overlapCount = 0;
_local4.userData = _arg2;
var _local6:uint = (2 * m_proxyCount);
var _local7:Array = new Array();
var _local8:Array = new Array();
ComputeBounds(_local7, _local8, _arg1);
var _local9:int;
while (_local9 < 2) {
_local11 = m_bounds[_local9];
_local14 = [_local12];
_local15 = [_local13];
Query(_local14, _local15, _local7[_local9], _local8[_local9], _local11, _local6, _local9);
_local12 = _local14[0];
_local13 = _local15[0];
_local16 = new Array();
_local18 = (_local6 - _local13);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local13 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local13 + 2);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local16 = new Array();
_local18 = (_local13 - _local12);
_local17 = 0;
while (_local17 < _local18) {
_local16[_local17] = new b2Bound();
_local19 = _local16[_local17];
_local20 = _local11[int((_local12 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local18 = _local16.length;
_local22 = (_local12 + 1);
_local17 = 0;
while (_local17 < _local18) {
_local20 = _local16[_local17];
_local19 = _local11[int((_local22 + _local17))];
_local19.value = _local20.value;
_local19.proxyId = _local20.proxyId;
_local19.stabbingCount = _local20.stabbingCount;
_local17++;
};
_local13++;
_local19 = _local11[_local12];
_local20 = _local11[_local13];
_local19.value = _local7[_local9];
_local19.proxyId = _local5;
_local20.value = _local8[_local9];
_local20.proxyId = _local5;
_local21 = _local11[int((_local12 - 1))];
_local19.stabbingCount = ((_local12 == 0)) ? 0 : _local21.stabbingCount;
_local21 = _local11[int((_local13 - 1))];
_local20.stabbingCount = _local21.stabbingCount;
_local3 = _local12;
while (_local3 < _local13) {
_local21 = _local11[_local3];
_local21.stabbingCount++;
_local3++;
};
_local3 = _local12;
while (_local3 < (_local6 + 2)) {
_local19 = _local11[_local3];
_local23 = m_proxyPool[_local19.proxyId];
if (_local19.IsLower()){
_local23.lowerBounds[_local9] = _local3;
} else {
_local23.upperBounds[_local9] = _local3;
};
_local3++;
};
_local9++;
};
m_proxyCount++;
var _local10:int;
while (_local10 < m_queryResultCount) {
m_pairManager.AddBufferedPair(_local5, m_queryResults[_local10]);
_local10++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
return (_local5);
}
public function DestroyProxy(_arg1:uint):void{
var _local2:b2Bound;
var _local3:b2Bound;
var _local8:Array;
var _local9:uint;
var _local10:uint;
var _local11:uint;
var _local12:uint;
var _local13:Array;
var _local14:int;
var _local15:int;
var _local16:int;
var _local17:uint;
var _local18:int;
var _local19:b2Proxy;
var _local4:b2Proxy = m_proxyPool[_arg1];
var _local5:int = (2 * m_proxyCount);
var _local6:int;
while (_local6 < 2) {
_local8 = m_bounds[_local6];
_local9 = _local4.lowerBounds[_local6];
_local10 = _local4.upperBounds[_local6];
_local2 = _local8[_local9];
_local11 = _local2.value;
_local3 = _local8[_local10];
_local12 = _local3.value;
_local13 = new Array();
_local15 = ((_local10 - _local9) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local9 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = _local9;
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local13 = new Array();
_local15 = ((_local5 - _local10) - 1);
_local14 = 0;
while (_local14 < _local15) {
_local13[_local14] = new b2Bound();
_local2 = _local13[_local14];
_local3 = _local8[int(((_local10 + 1) + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = _local13.length;
_local16 = (_local10 - 1);
_local14 = 0;
while (_local14 < _local15) {
_local3 = _local13[_local14];
_local2 = _local8[int((_local16 + _local14))];
_local2.value = _local3.value;
_local2.proxyId = _local3.proxyId;
_local2.stabbingCount = _local3.stabbingCount;
_local14++;
};
_local15 = (_local5 - 2);
_local17 = _local9;
while (_local17 < _local15) {
_local2 = _local8[_local17];
_local19 = m_proxyPool[_local2.proxyId];
if (_local2.IsLower()){
_local19.lowerBounds[_local6] = _local17;
} else {
_local19.upperBounds[_local6] = _local17;
};
_local17++;
};
_local15 = (_local10 - 1);
_local18 = _local9;
while (_local18 < _local15) {
_local2 = _local8[_local18];
_local2.stabbingCount--;
_local18++;
};
Query([0], [0], _local11, _local12, _local8, (_local5 - 2), _local6);
_local6++;
};
var _local7:int;
while (_local7 < m_queryResultCount) {
m_pairManager.RemoveBufferedPair(_arg1, m_queryResults[_local7]);
_local7++;
};
m_pairManager.Commit();
m_queryResultCount = 0;
IncrementTimeStamp();
_local4.userData = null;
_local4.overlapCount = b2_invalid;
_local4.lowerBounds[0] = b2_invalid;
_local4.lowerBounds[1] = b2_invalid;
_local4.upperBounds[0] = b2_invalid;
_local4.upperBounds[1] = b2_invalid;
_local4.SetNext(m_freeProxy);
m_freeProxy = _arg1;
m_proxyCount--;
}
public function TestOverlap(_arg1:b2BoundValues, _arg2:b2Proxy):Boolean{
var _local4:Array;
var _local5:b2Bound;
var _local3:int;
while (_local3 < 2) {
_local4 = m_bounds[_local3];
_local5 = _local4[_arg2.upperBounds[_local3]];
if (_arg1.lowerValues[_local3] > _local5.value){
return (false);
};
_local5 = _local4[_arg2.lowerBounds[_local3]];
if (_arg1.upperValues[_local3] < _local5.value){
return (false);
};
_local3++;
};
return (true);
}
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:Array;
var _local4:int;
var _local5:uint;
var _local6:uint;
var _local7:b2Bound;
var _local8:b2Bound;
var _local9:b2Bound;
var _local10:uint;
var _local11:b2Proxy;
var _local16:Array;
var _local17:uint;
var _local18:uint;
var _local19:uint;
var _local20:uint;
var _local21:int;
var _local22:int;
var _local23:uint;
var _local24:b2Proxy;
if ((((_arg1 == b2Pair.b2_nullProxy)) || ((b2Settings.b2_maxProxies <= _arg1)))){
return;
};
if (_arg2.IsValid() == false){
return;
};
var _local12:uint = (2 * m_proxyCount);
var _local13:b2Proxy = m_proxyPool[_arg1];
var _local14:b2BoundValues = new b2BoundValues();
ComputeBounds(_local14.lowerValues, _local14.upperValues, _arg2);
var _local15:b2BoundValues = new b2BoundValues();
_local5 = 0;
while (_local5 < 2) {
_local7 = m_bounds[_local5][_local13.lowerBounds[_local5]];
_local15.lowerValues[_local5] = _local7.value;
_local7 = m_bounds[_local5][_local13.upperBounds[_local5]];
_local15.upperValues[_local5] = _local7.value;
_local5++;
};
_local5 = 0;
while (_local5 < 2) {
_local16 = m_bounds[_local5];
_local17 = _local13.lowerBounds[_local5];
_local18 = _local13.upperBounds[_local5];
_local19 = _local14.lowerValues[_local5];
_local20 = _local14.upperValues[_local5];
_local7 = _local16[_local17];
_local21 = (_local19 - _local7.value);
_local7.value = _local19;
_local7 = _local16[_local18];
_local22 = (_local20 - _local7.value);
_local7.value = _local20;
if (_local21 < 0){
_local6 = _local17;
while ((((_local6 > 0)) && ((_local19 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local8.proxyId];
_local8.stabbingCount++;
if (_local8.IsUpper() == true){
if (TestOverlap(_local14, _local24)){
m_pairManager.AddBufferedPair(_arg1, _local23);
};
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
if (_local22 > 0){
_local6 = _local18;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local20)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount++;
if (_local9.IsLower() == true){
if (TestOverlap(_local14, _local11)){
m_pairManager.AddBufferedPair(_arg1, _local10);
};
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
} else {
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local21 > 0){
_local6 = _local17;
while ((((_local6 < (_local12 - 1))) && (((_local16[int((_local6 + 1))] as b2Bound).value <= _local19)))) {
_local7 = _local16[_local6];
_local9 = _local16[int((_local6 + 1))];
_local10 = _local9.proxyId;
_local11 = m_proxyPool[_local10];
_local9.stabbingCount--;
if (_local9.IsUpper()){
if (TestOverlap(_local15, _local11)){
m_pairManager.RemoveBufferedPair(_arg1, _local10);
};
_local3 = _local11.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local11.lowerBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.Swap(_local9);
_local6++;
};
};
if (_local22 < 0){
_local6 = _local18;
while ((((_local6 > 0)) && ((_local20 < (_local16[int((_local6 - 1))] as b2Bound).value)))) {
_local7 = _local16[_local6];
_local8 = _local16[int((_local6 - 1))];
_local23 = _local8.proxyId;
_local24 = m_proxyPool[_local23];
_local8.stabbingCount--;
if (_local8.IsLower() == true){
if (TestOverlap(_local15, _local24)){
m_pairManager.RemoveBufferedPair(_arg1, _local23);
};
_local3 = _local24.lowerBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount--;
} else {
_local3 = _local24.upperBounds;
_local4 = _local3[_local5];
_local4++;
_local3[_local5] = _local4;
_local7.stabbingCount++;
};
_local3 = _local13.upperBounds;
_local4 = _local3[_local5];
_local4--;
_local3[_local5] = _local4;
_local7.Swap(_local8);
_local6--;
};
};
_local5++;
};
}
public static function BinarySearch(_arg1:Array, _arg2:int, _arg3:uint):uint{
var _local6:int;
var _local7:b2Bound;
var _local4:int;
var _local5:int = (_arg2 - 1);
while (_local4 <= _local5) {
_local6 = ((_local4 + _local5) / 2);
_local7 = _arg1[_local6];
if (_local7.value > _arg3){
_local5 = (_local6 - 1);
} else {
if (_local7.value < _arg3){
_local4 = (_local6 + 1);
} else {
return (uint(_local6));
};
};
};
return (uint(_local4));
}
}
}//package Box2D.Collision
Section 240
//b2BufferedPair (Box2D.Collision.b2BufferedPair)
package Box2D.Collision {
public class b2BufferedPair {
public var proxyId1:uint;
public var proxyId2:uint;
}
}//package Box2D.Collision
Section 241
//b2Collision (Box2D.Collision.b2Collision)
package Box2D.Collision {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Collision {
public static const b2_nullFeature:uint = 0xFF;
private static var b2CollidePolyTempVec:b2Vec2 = new b2Vec2();
public static function EdgeSeparation(_arg1:b2PolygonShape, _arg2:b2XForm, _arg3:int, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local11:b2Mat22;
var _local12:b2Vec2;
var _local25:Number;
var _local6:int = _arg1.m_vertexCount;
var _local7:Array = _arg1.m_vertices;
var _local8:Array = _arg1.m_normals;
var _local9:int = _arg4.m_vertexCount;
var _local10:Array = _arg4.m_vertices;
_local11 = _arg2.R;
_local12 = _local8[_arg3];
var _local13:Number = ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y));
var _local14:Number = ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y));
_local11 = _arg5.R;
var _local15:Number = ((_local11.col1.x * _local13) + (_local11.col1.y * _local14));
var _local16:Number = ((_local11.col2.x * _local13) + (_local11.col2.y * _local14));
var _local17:int;
var _local18:Number = Number.MAX_VALUE;
var _local19:int;
while (_local19 < _local9) {
_local12 = _local10[_local19];
_local25 = ((_local12.x * _local15) + (_local12.y * _local16));
if (_local25 < _local18){
_local18 = _local25;
_local17 = _local19;
};
_local19++;
};
_local12 = _local7[_arg3];
_local11 = _arg2.R;
var _local20:Number = (_arg2.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
var _local21:Number = (_arg2.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local12 = _local10[_local17];
_local11 = _arg5.R;
var _local22:Number = (_arg5.position.x + ((_local11.col1.x * _local12.x) + (_local11.col2.x * _local12.y)));
var _local23:Number = (_arg5.position.y + ((_local11.col1.y * _local12.x) + (_local11.col2.y * _local12.y)));
_local22 = (_local22 - _local20);
_local23 = (_local23 - _local21);
var _local24:Number = ((_local22 * _local13) + (_local23 * _local14));
return (_local24);
}
public static function 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 _local12:b2Mat22;
var _local13:b2Vec2;
var _local20:ClipVertex;
var _local23:Number;
var _local7:int = _arg2.m_vertexCount;
var _local8:Array = _arg2.m_normals;
var _local9:int = _arg5.m_vertexCount;
var _local10:Array = _arg5.m_vertices;
var _local11:Array = _arg5.m_normals;
_local12 = _arg3.R;
_local13 = _local8[_arg4];
var _local14:Number = ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y));
var _local15:Number = ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y));
_local12 = _arg6.R;
var _local16:Number = ((_local12.col1.x * _local14) + (_local12.col1.y * _local15));
_local15 = ((_local12.col2.x * _local14) + (_local12.col2.y * _local15));
_local14 = _local16;
var _local17:int;
var _local18:Number = Number.MAX_VALUE;
var _local19:int;
while (_local19 < _local9) {
_local13 = _local11[_local19];
_local23 = ((_local14 * _local13.x) + (_local15 * _local13.y));
if (_local23 < _local18){
_local18 = _local23;
_local17 = _local19;
};
_local19++;
};
var _local21:int = _local17;
var _local22:int = (((_local21 + 1) < _local9)) ? (_local21 + 1) : 0;
_local20 = _arg1[0];
_local13 = _local10[_local21];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local21;
_local20.id.features.incidentVertex = 0;
_local20 = _arg1[1];
_local13 = _local10[_local22];
_local12 = _arg6.R;
_local20.v.x = (_arg6.position.x + ((_local12.col1.x * _local13.x) + (_local12.col2.x * _local13.y)));
_local20.v.y = (_arg6.position.y + ((_local12.col1.y * _local13.x) + (_local12.col2.y * _local13.y)));
_local20.id.features.referenceEdge = _arg4;
_local20.id.features.incidentEdge = _local22;
_local20.id.features.incidentVertex = 1;
}
public static function b2CollidePolygons(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):void{
var _local6:ClipVertex;
var _local13:b2PolygonShape;
var _local14:b2PolygonShape;
var _local17:int;
var _local18:uint;
var _local34:int;
var _local37:b2Vec2;
var _local38:Number;
var _local39:b2ManifoldPoint;
_arg1.pointCount = 0;
var _local7:int;
var _local8:Array = [_local7];
var _local9:Number = FindMaxSeparation(_local8, _arg2, _arg3, _arg4, _arg5);
_local7 = _local8[0];
if (_local9 > 0){
return;
};
var _local10:int;
var _local11:Array = [_local10];
var _local12:Number = FindMaxSeparation(_local11, _arg4, _arg5, _arg2, _arg3);
_local10 = _local11[0];
if (_local12 > 0){
return;
};
var _local15:b2XForm = new b2XForm();
var _local16:b2XForm = new b2XForm();
var _local19:Number = 0.98;
var _local20:Number = 0.001;
if (_local12 > ((_local19 * _local9) + _local20)){
_local13 = _arg4;
_local14 = _arg2;
_local15.Set(_arg5);
_local16.Set(_arg3);
_local17 = _local10;
_local18 = 1;
} else {
_local13 = _arg2;
_local14 = _arg4;
_local15.Set(_arg3);
_local16.Set(_arg5);
_local17 = _local7;
_local18 = 0;
};
var _local21:Array = [new ClipVertex(), new ClipVertex()];
FindIncidentEdge(_local21, _local13, _local15, _local17, _local14, _local16);
var _local22:int = _local13.m_vertexCount;
var _local23:Array = _local13.m_vertices;
var _local24:b2Vec2 = _local23[_local17];
var _local25:b2Vec2 = _local24.Copy();
if ((_local17 + 1) < _local22){
_local24 = _local23[int((_local17 + 1))];
_local37 = _local24.Copy();
} else {
_local24 = _local23[0];
_local37 = _local24.Copy();
};
var _local26:b2Vec2 = b2Math.SubtractVV(_local37, _local25);
var _local27:b2Vec2 = b2Math.b2MulMV(_local15.R, b2Math.SubtractVV(_local37, _local25));
_local27.Normalize();
var _local28:b2Vec2 = b2Math.b2CrossVF(_local27, 1);
_local25 = b2Math.b2MulX(_local15, _local25);
_local37 = b2Math.b2MulX(_local15, _local37);
var _local29:Number = b2Math.b2Dot(_local28, _local25);
var _local30:Number = -(b2Math.b2Dot(_local27, _local25));
var _local31:Number = b2Math.b2Dot(_local27, _local37);
var _local32:Array = [new ClipVertex(), new ClipVertex()];
var _local33:Array = [new ClipVertex(), new ClipVertex()];
_local34 = ClipSegmentToLine(_local32, _local21, _local27.Negative(), _local30);
if (_local34 < 2){
return;
};
_local34 = ClipSegmentToLine(_local33, _local32, _local27, _local31);
if (_local34 < 2){
return;
};
_arg1.normal = (_local18) ? _local28.Negative() : _local28.Copy();
var _local35:int;
var _local36:int;
while (_local36 < b2Settings.b2_maxManifoldPoints) {
_local6 = _local33[_local36];
_local38 = (b2Math.b2Dot(_local28, _local6.v) - _local29);
if (_local38 <= 0){
_local39 = _arg1.points[_local35];
_local39.separation = _local38;
_local39.localPoint1 = b2Math.b2MulXT(_arg3, _local6.v);
_local39.localPoint2 = b2Math.b2MulXT(_arg5, _local6.v);
_local39.id.key = _local6.id._key;
_local39.id.features.flip = _local18;
_local35++;
};
_local36++;
};
_arg1.pointCount = _local35;
}
public static function FindMaxSeparation(_arg1:Array, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2PolygonShape, _arg5:b2XForm):Number{
var _local8:b2Vec2;
var _local9:b2Mat22;
var _local22:int;
var _local23:Number;
var _local24:int;
var _local25:Number;
var _local6:int = _arg2.m_vertexCount;
var _local7:Array = _arg2.m_normals;
_local9 = _arg5.R;
_local8 = _arg4.m_centroid;
var _local10:Number = (_arg5.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y)));
var _local11:Number = (_arg5.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y)));
_local9 = _arg3.R;
_local8 = _arg2.m_centroid;
_local10 = (_local10 - (_arg3.position.x + ((_local9.col1.x * _local8.x) + (_local9.col2.x * _local8.y))));
_local11 = (_local11 - (_arg3.position.y + ((_local9.col1.y * _local8.x) + (_local9.col2.y * _local8.y))));
var _local12:Number = ((_local10 * _arg3.R.col1.x) + (_local11 * _arg3.R.col1.y));
var _local13:Number = ((_local10 * _arg3.R.col2.x) + (_local11 * _arg3.R.col2.y));
var _local14:int;
var _local15:Number = -(Number.MAX_VALUE);
var _local16:int;
while (_local16 < _local6) {
_local8 = _local7[_local16];
_local25 = ((_local8.x * _local12) + (_local8.y * _local13));
if (_local25 > _local15){
_local15 = _local25;
_local14 = _local16;
};
_local16++;
};
var _local17:Number = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
var _local18:int = (((_local14 - 1) >= 0)) ? (_local14 - 1) : (_local6 - 1);
var _local19:Number = EdgeSeparation(_arg2, _arg3, _local18, _arg4, _arg5);
if (_local19 > 0){
return (_local19);
};
var _local20:int = (((_local14 + 1) < _local6)) ? (_local14 + 1) : 0;
var _local21:Number = EdgeSeparation(_arg2, _arg3, _local20, _arg4, _arg5);
if (_local21 > 0){
return (_local21);
};
if ((((_local19 > _local17)) && ((_local19 > _local21)))){
_local24 = -1;
_local22 = _local18;
_local23 = _local19;
} else {
if (_local21 > _local17){
_local24 = 1;
_local22 = _local20;
_local23 = _local21;
} else {
_arg1[0] = _local14;
return (_local17);
};
};
while (true) {
if (_local24 == -1){
_local14 = (((_local22 - 1) >= 0)) ? (_local22 - 1) : (_local6 - 1);
} else {
_local14 = (((_local22 + 1) < _local6)) ? (_local22 + 1) : 0;
};
_local17 = EdgeSeparation(_arg2, _arg3, _local14, _arg4, _arg5);
if (_local17 > 0){
return (_local17);
};
if (_local17 > _local23){
_local22 = _local14;
_local23 = _local17;
} else {
break;
};
};
_arg1[0] = _local22;
return (_local23);
}
public static function ClipSegmentToLine(_arg1:Array, _arg2:Array, _arg3:b2Vec2, _arg4:Number):int{
var _local5:ClipVertex;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:Number;
var _local11:Number;
var _local12:b2Vec2;
var _local13:ClipVertex;
_local6 = 0;
_local5 = _arg2[0];
_local7 = _local5.v;
_local5 = _arg2[1];
_local8 = _local5.v;
_local9 = (b2Math.b2Dot(_arg3, _local7) - _arg4);
var _local10:Number = (b2Math.b2Dot(_arg3, _local8) - _arg4);
if (_local9 <= 0){
var _temp1 = _local6;
_local6 = (_local6 + 1);
var _local14 = _temp1;
_arg1[_local14] = _arg2[0];
};
if (_local10 <= 0){
var _temp2 = _local6;
_local6 = (_local6 + 1);
_local14 = _temp2;
_arg1[_local14] = _arg2[1];
};
if ((_local9 * _local10) < 0){
_local11 = (_local9 / (_local9 - _local10));
_local5 = _arg1[_local6];
_local12 = _local5.v;
_local12.x = (_local7.x + (_local11 * (_local8.x - _local7.x)));
_local12.y = (_local7.y + (_local11 * (_local8.y - _local7.y)));
_local5 = _arg1[_local6];
if (_local9 > 0){
_local13 = _arg2[0];
_local5.id = _local13.id;
} else {
_local13 = _arg2[1];
_local5.id = _local13.id;
};
_local6++;
};
return (_local6);
}
public static function b2CollideCircles(_arg1:b2Manifold, _arg2:b2CircleShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2Mat22;
var _local7:b2Vec2;
var _local18:Number;
var _local24:Number;
var _local25:Number;
_arg1.pointCount = 0;
_local6 = _arg3.R;
_local7 = _arg2.m_localPosition;
var _local8:Number = (_arg3.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
var _local9:Number = (_arg3.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
_local6 = _arg5.R;
_local7 = _arg4.m_localPosition;
var _local10:Number = (_arg5.position.x + ((_local6.col1.x * _local7.x) + (_local6.col2.x * _local7.y)));
var _local11:Number = (_arg5.position.y + ((_local6.col1.y * _local7.x) + (_local6.col2.y * _local7.y)));
var _local12:Number = (_local10 - _local8);
var _local13:Number = (_local11 - _local9);
var _local14:Number = ((_local12 * _local12) + (_local13 * _local13));
var _local15:Number = _arg2.m_radius;
var _local16:Number = _arg4.m_radius;
var _local17:Number = (_local15 + _local16);
if (_local14 > (_local17 * _local17)){
return;
};
if (_local14 < Number.MIN_VALUE){
_local18 = -(_local17);
_arg1.normal.Set(0, 1);
} else {
_local24 = Math.sqrt(_local14);
_local18 = (_local24 - _local17);
_local25 = (1 / _local24);
_arg1.normal.x = (_local25 * _local12);
_arg1.normal.y = (_local25 * _local13);
};
_arg1.pointCount = 1;
var _local19:b2ManifoldPoint = _arg1.points[0];
_local19.id.key = 0;
_local19.separation = _local18;
_local8 = (_local8 + (_local15 * _arg1.normal.x));
_local9 = (_local9 + (_local15 * _arg1.normal.y));
_local10 = (_local10 - (_local16 * _arg1.normal.x));
_local11 = (_local11 - (_local16 * _arg1.normal.y));
var _local20:Number = (0.5 * (_local8 + _local10));
var _local21:Number = (0.5 * (_local9 + _local11));
var _local22:Number = (_local20 - _arg3.position.x);
var _local23:Number = (_local21 - _arg3.position.y);
_local19.localPoint1.x = ((_local22 * _arg3.R.col1.x) + (_local23 * _arg3.R.col1.y));
_local19.localPoint1.y = ((_local22 * _arg3.R.col2.x) + (_local23 * _arg3.R.col2.y));
_local22 = (_local20 - _arg5.position.x);
_local23 = (_local21 - _arg5.position.y);
_local19.localPoint2.x = ((_local22 * _arg5.R.col1.x) + (_local23 * _arg5.R.col1.y));
_local19.localPoint2.y = ((_local22 * _arg5.R.col2.x) + (_local23 * _arg5.R.col2.y));
}
public static function b2CollidePolygonAndCircle(_arg1:b2Manifold, _arg2:b2PolygonShape, _arg3:b2XForm, _arg4:b2CircleShape, _arg5:b2XForm):void{
var _local6:b2ManifoldPoint;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:b2Vec2;
var _local12:b2Mat22;
var _local17:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
_arg1.pointCount = 0;
_local12 = _arg5.R;
_local11 = _arg4.m_localPosition;
var _local13:Number = (_arg5.position.x + ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y)));
var _local14:Number = (_arg5.position.y + ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y)));
_local7 = (_local13 - _arg3.position.x);
_local8 = (_local14 - _arg3.position.y);
_local12 = _arg3.R;
var _local15:Number = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
var _local16:Number = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
var _local18:int;
var _local19:Number = -(Number.MAX_VALUE);
var _local20:Number = _arg4.m_radius;
var _local21:int = _arg2.m_vertexCount;
var _local22:Array = _arg2.m_vertices;
var _local23:Array = _arg2.m_normals;
var _local24:int;
while (_local24 < _local21) {
_local11 = _local22[_local24];
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
_local11 = _local23[_local24];
_local34 = ((_local11.x * _local7) + (_local11.y * _local8));
if (_local34 > _local20){
return;
};
if (_local34 > _local19){
_local19 = _local34;
_local18 = _local24;
};
_local24++;
};
if (_local19 < Number.MIN_VALUE){
_arg1.pointCount = 1;
_local11 = _local23[_local18];
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local11.x) + (_local12.col2.x * _local11.y));
_arg1.normal.y = ((_local12.col1.y * _local11.x) + (_local12.col2.y * _local11.y));
_local6 = _arg1.points[0];
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = b2_nullFeature;
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local19 - _local20);
return;
};
var _local25:int = _local18;
var _local26:int = (((_local25 + 1) < _local21)) ? (_local25 + 1) : 0;
_local11 = _local22[_local25];
var _local27:b2Vec2 = _local22[_local26];
var _local28:Number = (_local27.x - _local11.x);
var _local29:Number = (_local27.y - _local11.y);
var _local30:Number = Math.sqrt(((_local28 * _local28) + (_local29 * _local29)));
_local28 = (_local28 / _local30);
_local29 = (_local29 / _local30);
_local7 = (_local15 - _local11.x);
_local8 = (_local16 - _local11.y);
var _local31:Number = ((_local7 * _local28) + (_local8 * _local29));
_local6 = _arg1.points[0];
if (_local31 <= 0){
_local32 = _local11.x;
_local33 = _local11.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local25;
} else {
if (_local31 >= _local30){
_local32 = _local27.x;
_local33 = _local27.y;
_local6.id.features.incidentEdge = b2_nullFeature;
_local6.id.features.incidentVertex = _local26;
} else {
_local32 = ((_local28 * _local31) + _local11.x);
_local33 = ((_local29 * _local31) + _local11.y);
_local6.id.features.incidentEdge = _local18;
_local6.id.features.incidentVertex = b2_nullFeature;
};
};
_local7 = (_local15 - _local32);
_local8 = (_local16 - _local33);
_local17 = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
_local7 = (_local7 / _local17);
_local8 = (_local8 / _local17);
if (_local17 > _local20){
return;
};
_arg1.pointCount = 1;
_local12 = _arg3.R;
_arg1.normal.x = ((_local12.col1.x * _local7) + (_local12.col2.x * _local8));
_arg1.normal.y = ((_local12.col1.y * _local7) + (_local12.col2.y * _local8));
_local9 = (_local13 - (_local20 * _arg1.normal.x));
_local10 = (_local14 - (_local20 * _arg1.normal.y));
_local7 = (_local9 - _arg3.position.x);
_local8 = (_local10 - _arg3.position.y);
_local12 = _arg3.R;
_local6.localPoint1.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint1.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local7 = (_local9 - _arg5.position.x);
_local8 = (_local10 - _arg5.position.y);
_local12 = _arg5.R;
_local6.localPoint2.x = ((_local7 * _local12.col1.x) + (_local8 * _local12.col1.y));
_local6.localPoint2.y = ((_local7 * _local12.col2.x) + (_local8 * _local12.col2.y));
_local6.separation = (_local17 - _local20);
_local6.id.features.referenceEdge = 0;
_local6.id.features.flip = 0;
}
}
}//package Box2D.Collision
Section 242
//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._referenceEdge = (_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 243
//b2ContactPoint (Box2D.Collision.b2ContactPoint)
package Box2D.Collision {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
public class b2ContactPoint {
public var friction:Number;
public var separation:Number;
public var normal:b2Vec2;
public var position:b2Vec2;
public var restitution:Number;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var id:b2ContactID;
public var velocity:b2Vec2;
public function b2ContactPoint(){
position = new b2Vec2();
velocity = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Collision
Section 244
//b2Distance (Box2D.Collision.b2Distance)
package Box2D.Collision {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Distance {
private static var s_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:b2Vec2;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local4:Number = (100 * Number.MIN_VALUE);
var _local5:int;
while (_local5 < _arg3) {
_local6 = _arg2[_local5];
_local7 = Math.abs((_arg1.x - _local6.x));
_local8 = Math.abs((_arg1.y - _local6.y));
_local9 = Math.max(Math.abs(_arg1.x), Math.abs(_local6.x));
_local10 = Math.max(Math.abs(_arg1.y), Math.abs(_local6.y));
if ((((_local7 < (_local4 * (_local9 + 1)))) && ((_local8 < (_local4 * (_local10 + 1)))))){
return (true);
};
_local5++;
};
return (false);
}
public static function DistanceGeneric(_arg1:b2Vec2, _arg2:b2Vec2, _arg3, _arg4:b2XForm, _arg5, _arg6:b2XForm):Number{
var _local7:b2Vec2;
var _local15:Number;
var _local16:Number;
var _local17:b2Vec2;
var _local18:b2Vec2;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:int;
var _local8:Array = s_p1s;
var _local9:Array = s_p2s;
var _local10:Array = s_points;
var _local11:int;
_arg1.SetV(_arg3.GetFirstVertex(_arg4));
_arg2.SetV(_arg5.GetFirstVertex(_arg6));
var _local12:Number = 0;
var _local13 = 20;
var _local14:int;
while (_local14 < _local13) {
_local15 = (_arg2.x - _arg1.x);
_local16 = (_arg2.y - _arg1.y);
_local17 = _arg3.Support(_arg4, _local15, _local16);
_local18 = _arg5.Support(_arg6, -(_local15), -(_local16));
_local12 = ((_local15 * _local15) + (_local16 * _local16));
_local19 = (_local18.x - _local17.x);
_local20 = (_local18.y - _local17.y);
_local21 = ((_local15 * _local19) + (_local16 * _local20));
if ((_local12 - _local21) <= (0.01 * _local12)){
if (_local11 == 0){
_arg1.SetV(_local17);
_arg2.SetV(_local18);
};
g_GJK_Iterations = _local14;
return (Math.sqrt(_local12));
};
switch (_local11){
case 0:
_local7 = _local8[0];
_local7.SetV(_local17);
_local7 = _local9[0];
_local7.SetV(_local18);
_local7 = _local10[0];
_local7.x = _local19;
_local7.y = _local20;
_arg1.SetV(_local8[0]);
_arg2.SetV(_local9[0]);
_local11++;
break;
case 1:
_local7 = _local8[1];
_local7.SetV(_local17);
_local7 = _local9[1];
_local7.SetV(_local18);
_local7 = _local10[1];
_local7.x = _local19;
_local7.y = _local20;
_local11 = ProcessTwo(_arg1, _arg2, _local8, _local9, _local10);
break;
case 2:
_local7 = _local8[2];
_local7.SetV(_local17);
_local7 = _local9[2];
_local7.SetV(_local18);
_local7 = _local10[2];
_local7.x = _local19;
_local7.y = _local20;
_local11 = ProcessThree(_arg1, _arg2, _local8, _local9, _local10);
break;
};
if (_local11 == 3){
g_GJK_Iterations = _local14;
return (0);
};
_local22 = -(Number.MAX_VALUE);
_local23 = 0;
while (_local23 < _local11) {
_local7 = _local10[_local23];
_local22 = b2Math.b2Max(_local22, ((_local7.x * _local7.x) + (_local7.y * _local7.y)));
_local23++;
};
if ((((_local11 == 3)) || ((_local12 <= ((100 * Number.MIN_VALUE) * _local22))))){
g_GJK_Iterations = _local14;
_local15 = (_arg2.x - _arg1.x);
_local16 = (_arg2.y - _arg1.y);
_local12 = ((_local15 * _local15) + (_local16 * _local16));
return (Math.sqrt(_local12));
};
_local14++;
};
g_GJK_Iterations = _local13;
return (Math.sqrt(_local12));
}
public static function DistanceCC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2CircleShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local19:Number;
var _local20:Number;
_local7 = _arg4.R;
_local8 = _arg3.m_localPosition;
var _local9:Number = (_arg4.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
var _local10:Number = (_arg4.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
_local7 = _arg6.R;
_local8 = _arg5.m_localPosition;
var _local11:Number = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
var _local12:Number = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
var _local13:Number = (_local11 - _local9);
var _local14:Number = (_local12 - _local10);
var _local15:Number = ((_local13 * _local13) + (_local14 * _local14));
var _local16:Number = (_arg3.m_radius - b2Settings.b2_toiSlop);
var _local17:Number = (_arg5.m_radius - b2Settings.b2_toiSlop);
var _local18:Number = (_local16 + _local17);
if (_local15 > (_local18 * _local18)){
_local19 = Math.sqrt(_local15);
_local13 = (_local13 / _local19);
_local14 = (_local14 / _local19);
_local20 = (_local19 - _local18);
_arg1.x = (_local9 + (_local16 * _local13));
_arg1.y = (_local10 + (_local16 * _local14));
_arg2.x = (_local11 - (_local17 * _local13));
_arg2.y = (_local12 - (_local17 * _local14));
return (_local20);
};
if (_local15 > (Number.MIN_VALUE * Number.MIN_VALUE)){
_local19 = Math.sqrt(_local15);
_local13 = (_local13 / _local19);
_local14 = (_local14 / _local19);
_arg1.x = (_local9 + (_local16 * _local13));
_arg1.y = (_local10 + (_local16 * _local14));
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
};
_arg1.x = _local9;
_arg1.y = _local10;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
return (0);
}
public static function ProcessThree(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local6:b2Vec2;
var _local7:b2Vec2;
var _local8:b2Vec2;
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local12:b2Vec2;
var _local13:b2Vec2;
var _local35:Number;
_local6 = _arg5[0];
_local7 = _arg5[1];
_local8 = _arg5[2];
_local9 = _arg3[0];
_local10 = _arg3[1];
_local11 = _arg3[2];
_local12 = _arg4[0];
_local13 = _arg4[1];
var _local14:b2Vec2 = _arg4[2];
var _local15:Number = _local6.x;
var _local16:Number = _local6.y;
var _local17:Number = _local7.x;
var _local18:Number = _local7.y;
var _local19:Number = _local8.x;
var _local20:Number = _local8.y;
var _local21:Number = (_local17 - _local15);
var _local22:Number = (_local18 - _local16);
var _local23:Number = (_local19 - _local15);
var _local24:Number = (_local20 - _local16);
var _local25:Number = (_local19 - _local17);
var _local26:Number = (_local20 - _local18);
var _local27:Number = -(((_local15 * _local21) + (_local16 * _local22)));
var _local28:Number = ((_local17 * _local21) + (_local18 * _local22));
var _local29:Number = -(((_local15 * _local23) + (_local16 * _local24)));
var _local30:Number = ((_local19 * _local23) + (_local20 * _local24));
var _local31:Number = -(((_local17 * _local25) + (_local18 * _local26)));
var _local32:Number = ((_local19 * _local25) + (_local20 * _local26));
if ((((_local30 <= 0)) && ((_local32 <= 0)))){
_arg1.SetV(_local11);
_arg2.SetV(_local14);
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (1);
};
var _local33:Number = ((_local21 * _local24) - (_local22 * _local23));
var _local34:Number = (_local33 * ((_local15 * _local18) - (_local16 * _local17)));
var _local36:Number = (_local33 * ((_local17 * _local20) - (_local18 * _local19)));
if ((((((((_local36 <= 0)) && ((_local31 >= 0)))) && ((_local32 >= 0)))) && (((_local31 + _local32) > 0)))){
_local35 = (_local31 / (_local31 + _local32));
_arg1.x = (_local10.x + (_local35 * (_local11.x - _local10.x)));
_arg1.y = (_local10.y + (_local35 * (_local11.y - _local10.y)));
_arg2.x = (_local13.x + (_local35 * (_local14.x - _local13.x)));
_arg2.y = (_local13.y + (_local35 * (_local14.y - _local13.y)));
_local9.SetV(_local11);
_local12.SetV(_local14);
_local6.SetV(_local8);
return (2);
};
var _local37:Number = (_local33 * ((_local19 * _local16) - (_local20 * _local15)));
if ((((((((_local37 <= 0)) && ((_local29 >= 0)))) && ((_local30 >= 0)))) && (((_local29 + _local30) > 0)))){
_local35 = (_local29 / (_local29 + _local30));
_arg1.x = (_local9.x + (_local35 * (_local11.x - _local9.x)));
_arg1.y = (_local9.y + (_local35 * (_local11.y - _local9.y)));
_arg2.x = (_local12.x + (_local35 * (_local14.x - _local12.x)));
_arg2.y = (_local12.y + (_local35 * (_local14.y - _local12.y)));
_local10.SetV(_local11);
_local13.SetV(_local14);
_local7.SetV(_local8);
return (2);
};
var _local38:Number = ((_local36 + _local37) + _local34);
_local38 = (1 / _local38);
var _local39:Number = (_local36 * _local38);
var _local40:Number = (_local37 * _local38);
var _local41:Number = ((1 - _local39) - _local40);
_arg1.x = (((_local39 * _local9.x) + (_local40 * _local10.x)) + (_local41 * _local11.x));
_arg1.y = (((_local39 * _local9.y) + (_local40 * _local10.y)) + (_local41 * _local11.y));
_arg2.x = (((_local39 * _local12.x) + (_local40 * _local13.x)) + (_local41 * _local14.x));
_arg2.y = (((_local39 * _local12.y) + (_local40 * _local13.y)) + (_local41 * _local14.y));
return (3);
}
public static function DistancePC(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2PolygonShape, _arg4:b2XForm, _arg5:b2CircleShape, _arg6:b2XForm):Number{
var _local7:b2Mat22;
var _local8:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local9:b2Point = gPoint;
_local8 = _arg5.m_localPosition;
_local7 = _arg6.R;
_local9.p.x = (_arg6.position.x + ((_local7.col1.x * _local8.x) + (_local7.col2.x * _local8.y)));
_local9.p.y = (_arg6.position.y + ((_local7.col1.y * _local8.x) + (_local7.col2.y * _local8.y)));
var _local10:Number = DistanceGeneric(_arg1, _arg2, _arg3, _arg4, _local9, b2Math.b2XForm_identity);
var _local11:Number = (_arg5.m_radius - b2Settings.b2_toiSlop);
if (_local10 > _local11){
_local10 = (_local10 - _local11);
_local12 = (_arg2.x - _arg1.x);
_local13 = (_arg2.y - _arg1.y);
_local14 = Math.sqrt(((_local12 * _local12) + (_local13 * _local13)));
_local12 = (_local12 / _local14);
_local13 = (_local13 / _local14);
_arg2.x = (_arg2.x - (_local11 * _local12));
_arg2.y = (_arg2.y - (_local11 * _local13));
} else {
_local10 = 0;
_arg2.x = _arg1.x;
_arg2.y = _arg1.y;
};
return (_local10);
}
public static function Distance(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:b2Shape, _arg4:b2XForm, _arg5:b2Shape, _arg6:b2XForm):Number{
var _local7:int = _arg3.m_type;
var _local8:int = _arg5.m_type;
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistanceCC(_arg1, _arg2, (_arg3 as b2CircleShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_circleShape)))){
return (DistancePC(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2CircleShape), _arg6));
};
if ((((_local7 == b2Shape.e_circleShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistancePC(_arg2, _arg1, (_arg5 as b2PolygonShape), _arg6, (_arg3 as b2CircleShape), _arg4));
};
if ((((_local7 == b2Shape.e_polygonShape)) && ((_local8 == b2Shape.e_polygonShape)))){
return (DistanceGeneric(_arg1, _arg2, (_arg3 as b2PolygonShape), _arg4, (_arg5 as b2PolygonShape), _arg6));
};
return (0);
}
public static function ProcessTwo(_arg1:b2Vec2, _arg2:b2Vec2, _arg3:Array, _arg4:Array, _arg5:Array):int{
var _local9:b2Vec2;
var _local10:b2Vec2;
var _local11:b2Vec2;
var _local17:Number;
var _local6:b2Vec2 = _arg5[0];
var _local7:b2Vec2 = _arg5[1];
var _local8:b2Vec2 = _arg3[0];
_local9 = _arg3[1];
_local10 = _arg4[0];
_local11 = _arg4[1];
var _local12:Number = -(_local7.x);
var _local13:Number = -(_local7.y);
var _local14:Number = (_local6.x - _local7.x);
var _local15:Number = (_local6.y - _local7.y);
var _local16:Number = Math.sqrt(((_local14 * _local14) + (_local15 * _local15)));
_local14 = (_local14 / _local16);
_local15 = (_local15 / _local16);
_local17 = ((_local12 * _local14) + (_local13 * _local15));
if ((((_local17 <= 0)) || ((_local16 < Number.MIN_VALUE)))){
_arg1.SetV(_local9);
_arg2.SetV(_local11);
_local8.SetV(_local9);
_local10.SetV(_local11);
_local6.SetV(_local7);
return (1);
};
_local17 = (_local17 / _local16);
_arg1.x = (_local9.x + (_local17 * (_local8.x - _local9.x)));
_arg1.y = (_local9.y + (_local17 * (_local8.y - _local9.y)));
_arg2.x = (_local11.x + (_local17 * (_local10.x - _local11.x)));
_arg2.y = (_local11.y + (_local17 * (_local10.y - _local11.y)));
return (2);
}
}
}//package Box2D.Collision
Section 245
//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 246
//b2ManifoldPoint (Box2D.Collision.b2ManifoldPoint)
package Box2D.Collision {
import Box2D.Common.Math.*;
public class b2ManifoldPoint {
public var separation:Number;
public var localPoint2:b2Vec2;
public var normalImpulse:Number;
public var tangentImpulse:Number;
public var localPoint1:b2Vec2;
public var id:b2ContactID;
public function b2ManifoldPoint(){
localPoint1 = new b2Vec2();
localPoint2 = new b2Vec2();
id = new b2ContactID();
super();
}
public function Set(_arg1:b2ManifoldPoint):void{
localPoint1.SetV(_arg1.localPoint1);
localPoint2.SetV(_arg1.localPoint2);
separation = _arg1.separation;
normalImpulse = _arg1.normalImpulse;
tangentImpulse = _arg1.tangentImpulse;
id.key = _arg1.id.key;
}
public function Reset():void{
localPoint1.SetZero();
localPoint2.SetZero();
separation = 0;
normalImpulse = 0;
tangentImpulse = 0;
id.key = 0;
}
}
}//package Box2D.Collision
Section 247
//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 248
//b2Pair (Box2D.Collision.b2Pair)
package Box2D.Collision {
import Box2D.Common.*;
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 = b2Settings.USHRT_MAX;
public static var e_pairBuffered:uint = 1;
public static var b2_nullProxy:uint = b2Settings.USHRT_MAX;
public static var b2_tableCapacity:int = b2Settings.b2_maxPairs;
public function 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 249
//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 250
//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[int((b2Settings.b2_maxPairs - 1))].next = b2Pair.b2_nullPair;
m_pairCount = 0;
m_pairBufferCount = 0;
}
private function FindHash(_arg1:uint, _arg2:uint, _arg3:uint):b2Pair{
var _local4:b2Pair;
var _local5:uint = m_hashTable[_arg3];
_local4 = m_pairs[_local5];
while (((!((_local5 == b2Pair.b2_nullPair))) && ((Equals(_local4, _arg1, _arg2) == false)))) {
_local5 = _local4.next;
_local4 = m_pairs[_local5];
};
if (_local5 == b2Pair.b2_nullPair){
return (null);
};
return (_local4);
}
private function Find(_arg1:uint, _arg2:uint):b2Pair{
var _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:b2BufferedPair;
var _local2:int;
var _local5:b2Pair;
var _local6:b2Proxy;
var _local7:b2Proxy;
var _local3:int;
var _local4:Array = m_broadPhase.m_proxyPool;
_local2 = 0;
while (_local2 < m_pairBufferCount) {
_local1 = m_pairBuffer[_local2];
_local5 = Find(_local1.proxyId1, _local1.proxyId2);
_local5.ClearBuffered();
_local6 = _local4[_local5.proxyId1];
_local7 = _local4[_local5.proxyId2];
if (_local5.IsRemoved()){
if (_local5.IsFinal() == true){
m_callback.PairRemoved(_local6.userData, _local7.userData, _local5.userData);
};
_local1 = m_pairBuffer[_local3];
_local1.proxyId1 = _local5.proxyId1;
_local1.proxyId2 = _local5.proxyId2;
_local3++;
} else {
if (_local5.IsFinal() == false){
_local5.userData = m_callback.PairAdded(_local6.userData, _local7.userData);
_local5.SetFinal();
};
};
_local2++;
};
_local2 = 0;
while (_local2 < _local3) {
_local1 = m_pairBuffer[_local2];
RemovePair(_local1.proxyId1, _local1.proxyId2);
_local2++;
};
m_pairBufferCount = 0;
if (b2BroadPhase.s_validate){
ValidateTable();
};
}
public function RemoveBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair = Find(_arg1, _arg2);
if (_local4 == null){
return;
};
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.SetRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
private function RemovePair(_arg1:uint, _arg2:uint){
var _local3:b2Pair;
var _local7:uint;
var _local8:uint;
var _local9:*;
if (_arg1 > _arg2){
_local7 = _arg1;
_arg1 = _arg2;
_arg2 = _local7;
};
var _local4:uint = (Hash(_arg1, _arg2) & b2Pair.b2_tableMask);
var _local5:uint = m_hashTable[_local4];
var _local6:b2Pair;
while (_local5 != b2Pair.b2_nullPair) {
if (Equals(m_pairs[_local5], _arg1, _arg2)){
_local8 = _local5;
_local3 = m_pairs[_local5];
if (_local6){
_local6.next = _local3.next;
} else {
m_hashTable[_local4] = _local3.next;
};
_local3 = m_pairs[_local8];
_local9 = _local3.userData;
_local3.next = m_freePair;
_local3.proxyId1 = b2Pair.b2_nullProxy;
_local3.proxyId2 = b2Pair.b2_nullProxy;
_local3.userData = null;
_local3.status = 0;
m_freePair = _local8;
m_pairCount--;
return (_local9);
} else {
_local6 = m_pairs[_local5];
_local5 = _local6.next;
};
};
return (null);
}
public function Initialize(_arg1:b2BroadPhase, _arg2:b2PairCallback):void{
m_broadPhase = _arg1;
m_callback = _arg2;
}
public function AddBufferedPair(_arg1:int, _arg2:int):void{
var _local3:b2BufferedPair;
var _local4:b2Pair = AddPair(_arg1, _arg2);
if (_local4.IsBuffered() == false){
_local4.SetBuffered();
_local3 = m_pairBuffer[m_pairBufferCount];
_local3.proxyId1 = _local4.proxyId1;
_local3.proxyId2 = _local4.proxyId2;
m_pairBufferCount++;
};
_local4.ClearRemoved();
if (b2BroadPhase.s_validate){
ValidateBuffer();
};
}
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 251
//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 252
//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 253
//b2Segment (Box2D.Collision.b2Segment)
package Box2D.Collision {
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Segment {
public var p1:b2Vec2;
public var p2:b2Vec2;
public function b2Segment(){
p1 = new b2Vec2();
p2 = new b2Vec2();
super();
}
public function TestSegment(_arg1:Array, _arg2:b2Vec2, _arg3:b2Segment, _arg4:Number):Boolean{
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local5:b2Vec2 = _arg3.p1;
var _local6:Number = (_arg3.p2.x - _local5.x);
var _local7:Number = (_arg3.p2.y - _local5.y);
var _local8:Number = (p2.x - p1.x);
var _local9:Number = (p2.y - p1.y);
var _local10:Number = _local9;
var _local11:Number = -(_local8);
var _local12:Number = (100 * Number.MIN_VALUE);
var _local13:Number = -(((_local6 * _local10) + (_local7 * _local11)));
if (_local13 > _local12){
_local14 = (_local5.x - p1.x);
_local15 = (_local5.y - p1.y);
_local16 = ((_local14 * _local10) + (_local15 * _local11));
if ((((0 <= _local16)) && ((_local16 <= (_arg4 * _local13))))){
_local17 = ((-(_local6) * _local15) + (_local7 * _local14));
if (((((-(_local12) * _local13) <= _local17)) && ((_local17 <= (_local13 * (1 + _local12)))))){
_local16 = (_local16 / _local13);
_local18 = Math.sqrt(((_local10 * _local10) + (_local11 * _local11)));
_local10 = (_local10 / _local18);
_local11 = (_local11 / _local18);
_arg1[0] = _local16;
_arg2.Set(_local10, _local11);
return (true);
};
};
};
return (false);
}
}
}//package Box2D.Collision
Section 254
//b2TimeOfImpact (Box2D.Collision.b2TimeOfImpact)
package Box2D.Collision {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2TimeOfImpact {
public static var s_xf1:b2XForm = new b2XForm();
public static var s_xf2:b2XForm = new b2XForm();
public static var s_p1:b2Vec2 = new b2Vec2();
public static var s_p2:b2Vec2 = new b2Vec2();
public static function TimeOfImpact(_arg1:b2Shape, _arg2:b2Sweep, _arg3:b2Shape, _arg4:b2Sweep):Number{
var _local5:Number;
var _local6:Number;
var _local25:Number;
var _local26:b2XForm;
var _local27:b2XForm;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local7:Number = _arg1.m_sweepRadius;
var _local8:Number = _arg3.m_sweepRadius;
var _local9:Number = _arg2.t0;
var _local10:Number = (_arg2.c.x - _arg2.c0.x);
var _local11:Number = (_arg2.c.y - _arg2.c0.y);
var _local12:Number = (_arg4.c.x - _arg4.c0.x);
var _local13:Number = (_arg4.c.y - _arg4.c0.y);
var _local14:Number = (_arg2.a - _arg2.a0);
var _local15:Number = (_arg4.a - _arg4.a0);
var _local16:Number = 0;
var _local17:b2Vec2 = s_p1;
var _local18:b2Vec2 = s_p2;
var _local19 = 20;
var _local20:int;
var _local21:Number = 0;
var _local22:Number = 0;
var _local23:Number = 0;
var _local24:Number = 0;
while (true) {
_local25 = (((1 - _local16) * _local9) + _local16);
_local26 = s_xf1;
_local27 = s_xf2;
_arg2.GetXForm(_local26, _local25);
_arg4.GetXForm(_local27, _local25);
_local23 = b2Distance.Distance(_local17, _local18, _arg1, _local26, _arg3, _local27);
if (_local20 == 0){
if (_local23 > (2 * b2Settings.b2_toiSlop)){
_local24 = (1.5 * b2Settings.b2_toiSlop);
} else {
_local5 = (0.05 * b2Settings.b2_toiSlop);
_local6 = (_local23 - (0.5 * b2Settings.b2_toiSlop));
_local24 = ((_local5 > _local6)) ? _local5 : _local6;
};
};
if (((((_local23 - _local24) < (0.05 * b2Settings.b2_toiSlop))) || ((_local20 == _local19)))){
break;
};
_local21 = (_local18.x - _local17.x);
_local22 = (_local18.y - _local17.y);
_local28 = Math.sqrt(((_local21 * _local21) + (_local22 * _local22)));
_local21 = (_local21 / _local28);
_local22 = (_local22 / _local28);
_local29 = ((((_local21 * (_local10 - _local12)) + (_local22 * (_local11 - _local13))) + (((_local14 < 0)) ? -(_local14) : _local14 * _local7)) + (((_local15 < 0)) ? -(_local15) : _local15 * _local8));
if (_local29 == 0){
_local16 = 1;
break;
};
_local30 = ((_local23 - _local24) / _local29);
_local31 = (_local16 + _local30);
if ((((_local31 < 0)) || ((1 < _local31)))){
_local16 = 1;
break;
};
if (_local31 < ((1 + (100 * Number.MIN_VALUE)) * _local16)){
break;
};
_local16 = _local31;
_local20++;
};
return (_local16);
}
}
}//package Box2D.Collision
Section 255
//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 256
//Features (Box2D.Collision.Features)
package Box2D.Collision {
public class Features {
public var _referenceEdge:int;
public var _incidentEdge:int;
public var _flip:int;
public var _incidentVertex:int;
public var _m_id:b2ContactID;
public function get referenceEdge():int{
return (_referenceEdge);
}
public function set incidentVertex(_arg1:int):void{
_incidentVertex = _arg1;
_m_id._key = ((_m_id._key & 4278255615) | ((_incidentVertex << 16) & 0xFF0000));
}
public function get flip():int{
return (_flip);
}
public function get incidentEdge():int{
return (_incidentEdge);
}
public function set referenceEdge(_arg1:int):void{
_referenceEdge = _arg1;
_m_id._key = ((_m_id._key & 4294967040) | (_referenceEdge & 0xFF));
}
public function 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 257
//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 258
//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 259
//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 260
//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 toString():String{
return ((((("[b2Vec2 x=\"" + x) + "\" y=\"") + y) + "\"]"));
}
public function Normalize():Number{
var _local1:Number = Math.sqrt(((x * x) + (y * y)));
if (_local1 < Number.MIN_VALUE){
return (0);
};
var _local2:Number = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
return (_local1);
}
public function 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{
if (x < 0){
x = -(x);
};
if (y < 0){
y = -(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 261
//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 262
//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 263
//b2Settings (Box2D.Common.b2Settings)
package Box2D.Common {
import Box2D.Common.Math.*;
public class b2Settings {
public static const b2_angularSleepTolerance:Number = 0.0111111111111111;
public static const b2_linearSleepTolerance:Number = 0.01;
public static const b2_angularSlop:Number = 0.0349065850398866;
public static const b2_linearSlop:Number = 0.005;
public static const b2_pi:Number = 3.14159265358979;
public static const b2_maxProxies:int = 0x0200;
public static const b2_maxAngularVelocitySquared:Number = 62500;
public static const b2_maxPolygonVertices:int = 8;
public static const b2_velocityThreshold:Number = 1;
public static const b2_contactBaumgarte:Number = 0.2;
public static const b2_maxPairs:int = 4096;
public static const b2_maxTOIContactsPerIsland:int = 32;
public static const b2_timeToSleep:Number = 0.5;
public static const b2_maxManifoldPoints:int = 2;
public static const b2_maxAngularVelocity:Number = 250;
public static const b2_maxAngularCorrection:Number = 0.139626340159546;
public static const USHRT_MAX:int = 0xFFFF;
public static const b2_maxLinearVelocity:Number = 200;
public static const b2_maxLinearCorrection:Number = 0.2;
public static const b2_toiSlop:Number = 0.04;
public static const b2_maxLinearVelocitySquared:Number = 40000;
public static function b2Assert(_arg1:Boolean):void{
var _local2:b2Vec2;
if (!_arg1){
_local2.x++;
};
}
}
}//package Box2D.Common
Section 264
//b2CircleContact (Box2D.Dynamics.Contacts.b2CircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2CircleContact extends b2Contact {
private var m_manifolds:Array;
public var m_manifold:b2Manifold;
private var m0:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2CircleContact(_arg1:b2Shape, _arg2:b2Shape){
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
var _local3:b2ManifoldPoint = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local8:b2ManifoldPoint;
var _local5:b2Body = m_shape1.m_body;
var _local6:b2Body = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollideCircles(m_manifold, (m_shape1 as b2CircleShape), _local5.m_xf, (m_shape2 as b2CircleShape), _local6.m_xf);
var _local7:b2ContactPoint = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
m_manifoldCount = 1;
_local8 = m_manifold.points[0];
if (m0.pointCount == 0){
_local8.normalImpulse = 0;
_local8.tangentImpulse = 0;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Add(_local7);
};
} else {
_local4 = m0.points[0];
_local8.normalImpulse = _local4.normalImpulse;
_local8.tangentImpulse = _local4.tangentImpulse;
if (_arg1){
_local7.position = _local5.GetWorldPoint(_local8.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local8.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local8.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local8.separation;
_local7.id.key = _local8.id._key;
_arg1.Persist(_local7);
};
};
} else {
m_manifoldCount = 0;
if ((((m0.pointCount > 0)) && (_arg1))){
_local4 = m0.points[0];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
};
}
override public function GetManifolds():Array{
return (m_manifolds);
}
public static function 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 265
//b2Contact (Box2D.Dynamics.Contacts.b2Contact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2Contact {
public var m_shape1:b2Shape;
public var m_shape2:b2Shape;
public var m_prev:b2Contact;
public var m_toi:Number;
public var m_next:b2Contact;
public var m_friction:Number;
public var m_manifoldCount:int;
public var m_node1:b2ContactEdge;
public var m_node2:b2ContactEdge;
public var m_restitution:Number;
public var m_flags:uint;
public static var e_toiFlag:uint = 8;
public static var e_nonSolidFlag:uint = 1;
public static var e_slowFlag:uint = 2;
public static var e_islandFlag:uint = 4;
public static var s_registers:Array;
public static var s_initialized:Boolean = false;
public function b2Contact(_arg1:b2Shape=null, _arg2:b2Shape=null){
m_node1 = new b2ContactEdge();
m_node2 = new b2ContactEdge();
super();
m_flags = 0;
if (((!(_arg1)) || (!(_arg2)))){
m_shape1 = null;
m_shape2 = null;
return;
};
if (((_arg1.IsSensor()) || (_arg2.IsSensor()))){
m_flags = (m_flags | e_nonSolidFlag);
};
m_shape1 = _arg1;
m_shape2 = _arg2;
m_manifoldCount = 0;
m_friction = Math.sqrt((m_shape1.m_friction * m_shape2.m_friction));
m_restitution = b2Math.b2Max(m_shape1.m_restitution, m_shape2.m_restitution);
m_prev = null;
m_next = null;
m_node1.contact = null;
m_node1.prev = null;
m_node1.next = null;
m_node1.other = null;
m_node2.contact = null;
m_node2.prev = null;
m_node2.next = null;
m_node2.other = null;
}
public function 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{
var _local2:int = m_manifoldCount;
Evaluate(_arg1);
var _local3:int = m_manifoldCount;
var _local4:b2Body = m_shape1.m_body;
var _local5:b2Body = m_shape2.m_body;
if ((((((((_local3 == 0)) && ((_local2 > 0)))) && (!(_local4.IsStatic())))) && (!(_local5.IsStatic())))){
_local4.WakeUp();
_local5.WakeUp();
};
if (((((((_local4.IsStatic()) || (_local4.IsBullet()))) || (_local5.IsStatic()))) || (_local5.IsBullet()))){
m_flags = (m_flags & ~(e_slowFlag));
} else {
m_flags = (m_flags | e_slowFlag);
};
}
public function Evaluate(_arg1:b2ContactListener):void{
}
public static function InitializeRegisters():void{
var _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.m_manifoldCount > 0)) && (!(_arg1.m_shape1.m_isSensor)))) && (!(_arg1.m_shape2.m_isSensor)))){
_arg1.m_shape1.m_body.WakeUp();
_arg1.m_shape2.m_body.WakeUp();
};
var _local3:int = _arg1.m_shape1.m_type;
var _local4:int = _arg1.m_shape2.m_type;
var _local5:b2ContactRegister = s_registers[_local3][_local4];
var _local6:Function = _local5.destroyFcn;
_local6(_arg1, _arg2);
}
public static function AddType(_arg1:Function, _arg2:Function, _arg3:int, _arg4:int):void{
s_registers[_arg3][_arg4].createFcn = _arg1;
s_registers[_arg3][_arg4].destroyFcn = _arg2;
s_registers[_arg3][_arg4].primary = true;
if (_arg3 != _arg4){
s_registers[_arg4][_arg3].createFcn = _arg1;
s_registers[_arg4][_arg3].destroyFcn = _arg2;
s_registers[_arg4][_arg3].primary = false;
};
}
public static function Create(_arg1:b2Shape, _arg2:b2Shape, _arg3):b2Contact{
var _local8:b2Contact;
var _local9:int;
var _local10:b2Manifold;
if (s_initialized == false){
InitializeRegisters();
s_initialized = true;
};
var _local4:int = _arg1.m_type;
var _local5:int = _arg2.m_type;
var _local6:b2ContactRegister = s_registers[_local4][_local5];
var _local7:Function = _local6.createFcn;
if (_local7 != null){
if (_local6.primary){
return (_local7(_arg1, _arg2, _arg3));
};
_local8 = _local7(_arg2, _arg1, _arg3);
_local9 = 0;
while (_local9 < _local8.m_manifoldCount) {
_local10 = _local8.GetManifolds()[_local9];
_local8.GetManifolds()[_local9].normal = _local10.normal.Negative();
_local9++;
};
return (_local8);
//unresolved jump
};
return (null);
}
}
}//package Box2D.Dynamics.Contacts
Section 266
//b2ContactConstraint (Box2D.Dynamics.Contacts.b2ContactConstraint)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
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 267
//b2ContactConstraintPoint (Box2D.Dynamics.Contacts.b2ContactConstraintPoint)
package Box2D.Dynamics.Contacts {
import Box2D.Common.Math.*;
public class b2ContactConstraintPoint {
public var r2:b2Vec2;
public var separation:Number;
public var positionImpulse:Number;
public var normalImpulse:Number;
public var tangentMass:Number;
public var equalizedMass:Number;
public var tangentImpulse:Number;
public var localAnchor1:b2Vec2;
public var localAnchor2:b2Vec2;
public var normalMass:Number;
public var velocityBias:Number;
public var r1:b2Vec2;
public function b2ContactConstraintPoint(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
r1 = new b2Vec2();
r2 = new b2Vec2();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 268
//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 269
//b2ContactRegister (Box2D.Dynamics.Contacts.b2ContactRegister)
package Box2D.Dynamics.Contacts {
public class b2ContactRegister {
public var primary:Boolean;
public var createFcn:Function;
public var destroyFcn:Function;
}
}//package Box2D.Dynamics.Contacts
Section 270
//b2ContactResult (Box2D.Dynamics.Contacts.b2ContactResult)
package Box2D.Dynamics.Contacts {
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
public class b2ContactResult {
public var position:b2Vec2;
public var shape1:b2Shape;
public var shape2:b2Shape;
public var normalImpulse:Number;
public var normal:b2Vec2;
public var tangentImpulse:Number;
public var id:b2ContactID;
public function b2ContactResult(){
position = new b2Vec2();
normal = new b2Vec2();
id = new b2ContactID();
super();
}
}
}//package Box2D.Dynamics.Contacts
Section 271
//b2ContactSolver (Box2D.Dynamics.Contacts.b2ContactSolver)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2ContactSolver {
public var m_constraintCount:int;
public var m_constraints:Array;
public var m_allocator;
public var m_step:b2TimeStep;
public function b2ContactSolver(_arg1:b2TimeStep, _arg2:Array, _arg3:int, _arg4){
var _local5:b2Contact;
var _local6:int;
var _local7:b2Vec2;
var _local8:b2Mat22;
var _local10:b2Body;
var _local11:b2Body;
var _local12:int;
var _local13:Array;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:int;
var _local23:b2Manifold;
var _local24:Number;
var _local25:Number;
var _local26:b2ContactConstraint;
var _local27:uint;
var _local28:b2ManifoldPoint;
var _local29:b2ContactConstraintPoint;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local39:Number;
var _local40:Number;
var _local41:Number;
var _local42:Number;
var _local43:Number;
var _local44:Number;
var _local45:Number;
var _local46:Number;
var _local47:Number;
m_step = new b2TimeStep();
m_constraints = new Array();
super();
m_step.dt = _arg1.dt;
m_step.inv_dt = _arg1.inv_dt;
m_step.maxIterations = _arg1.maxIterations;
m_allocator = _arg4;
m_constraintCount = 0;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
m_constraintCount = (m_constraintCount + _local5.m_manifoldCount);
_local6++;
};
_local6 = 0;
while (_local6 < m_constraintCount) {
m_constraints[_local6] = new b2ContactConstraint();
_local6++;
};
var _local9:int;
_local6 = 0;
while (_local6 < _arg3) {
_local5 = _arg2[_local6];
_local10 = _local5.m_shape1.m_body;
_local11 = _local5.m_shape2.m_body;
_local12 = _local5.m_manifoldCount;
_local13 = _local5.GetManifolds();
_local14 = _local5.m_friction;
_local15 = _local5.m_restitution;
_local16 = _local10.m_linearVelocity.x;
_local17 = _local10.m_linearVelocity.y;
_local18 = _local11.m_linearVelocity.x;
_local19 = _local11.m_linearVelocity.y;
_local20 = _local10.m_angularVelocity;
_local21 = _local11.m_angularVelocity;
_local22 = 0;
while (_local22 < _local12) {
_local23 = _local13[_local22];
_local24 = _local23.normal.x;
_local25 = _local23.normal.y;
_local26 = m_constraints[_local9];
_local26.body1 = _local10;
_local26.body2 = _local11;
_local26.manifold = _local23;
_local26.normal.x = _local24;
_local26.normal.y = _local25;
_local26.pointCount = _local23.pointCount;
_local26.friction = _local14;
_local26.restitution = _local15;
_local27 = 0;
while (_local27 < _local26.pointCount) {
_local28 = _local23.points[_local27];
_local29 = _local26.points[_local27];
_local29.normalImpulse = _local28.normalImpulse;
_local29.tangentImpulse = _local28.tangentImpulse;
_local29.separation = _local28.separation;
_local29.positionImpulse = 0;
_local29.localAnchor1.SetV(_local28.localPoint1);
_local29.localAnchor2.SetV(_local28.localPoint2);
_local8 = _local10.m_xf.R;
_local32 = (_local28.localPoint1.x - _local10.m_sweep.localCenter.x);
_local33 = (_local28.localPoint1.y - _local10.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local32) + (_local8.col2.x * _local33));
_local33 = ((_local8.col1.y * _local32) + (_local8.col2.y * _local33));
_local32 = _local30;
_local29.r1.Set(_local32, _local33);
_local8 = _local11.m_xf.R;
_local34 = (_local28.localPoint2.x - _local11.m_sweep.localCenter.x);
_local35 = (_local28.localPoint2.y - _local11.m_sweep.localCenter.y);
_local30 = ((_local8.col1.x * _local34) + (_local8.col2.x * _local35));
_local35 = ((_local8.col1.y * _local34) + (_local8.col2.y * _local35));
_local34 = _local30;
_local29.r2.Set(_local34, _local35);
_local36 = ((_local32 * _local32) + (_local33 * _local33));
_local37 = ((_local34 * _local34) + (_local35 * _local35));
_local38 = ((_local32 * _local24) + (_local33 * _local25));
_local39 = ((_local34 * _local24) + (_local35 * _local25));
_local40 = (_local10.m_invMass + _local11.m_invMass);
_local40 = (_local40 + ((_local10.m_invI * (_local36 - (_local38 * _local38))) + (_local11.m_invI * (_local37 - (_local39 * _local39)))));
_local29.normalMass = (1 / _local40);
_local41 = ((_local10.m_mass * _local10.m_invMass) + (_local11.m_mass * _local11.m_invMass));
_local41 = (_local41 + (((_local10.m_mass * _local10.m_invI) * (_local36 - (_local38 * _local38))) + ((_local11.m_mass * _local11.m_invI) * (_local37 - (_local39 * _local39)))));
_local29.equalizedMass = (1 / _local41);
_local42 = _local25;
_local43 = -(_local24);
_local44 = ((_local32 * _local42) + (_local33 * _local43));
_local45 = ((_local34 * _local42) + (_local35 * _local43));
_local46 = (_local10.m_invMass + _local11.m_invMass);
_local46 = (_local46 + ((_local10.m_invI * (_local36 - (_local44 * _local44))) + (_local11.m_invI * (_local37 - (_local45 * _local45)))));
_local29.tangentMass = (1 / _local46);
_local29.velocityBias = 0;
if (_local29.separation > 0){
_local29.velocityBias = (-60 * _local29.separation);
};
_local30 = (((_local18 + (-(_local21) * _local35)) - _local16) - (-(_local20) * _local33));
_local31 = (((_local19 + (_local21 * _local34)) - _local17) - (_local20 * _local32));
_local47 = ((_local26.normal.x * _local30) + (_local26.normal.y * _local31));
if (_local47 < -(b2Settings.b2_velocityThreshold)){
_local29.velocityBias = (_local29.velocityBias + (-(_local26.restitution) * _local47));
};
_local27++;
};
_local9++;
_local22++;
};
_local6++;
};
}
public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2Mat22;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:int;
var _local19:int;
var _local20:b2ContactConstraintPoint;
var _local21:Number;
var _local22:Number;
var _local23:b2ContactConstraintPoint;
var _local5:int;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_invMass;
_local10 = _local7.m_invI;
_local11 = _local8.m_invMass;
_local12 = _local8.m_invI;
_local13 = _local6.normal.x;
_local14 = _local6.normal.y;
_local15 = _local14;
_local16 = -(_local13);
if (_arg1.warmStarting){
_local19 = _local6.pointCount;
_local18 = 0;
while (_local18 < _local19) {
_local20 = _local6.points[_local18];
_local6.points[_local18].normalImpulse = (_local20.normalImpulse * _arg1.dtRatio);
_local20.tangentImpulse = (_local20.tangentImpulse * _arg1.dtRatio);
_local21 = ((_local20.normalImpulse * _local13) + (_local20.tangentImpulse * _local15));
_local22 = ((_local20.normalImpulse * _local14) + (_local20.tangentImpulse * _local16));
_local7.m_angularVelocity = (_local7.m_angularVelocity - (_local10 * ((_local20.r1.x * _local22) - (_local20.r1.y * _local21))));
_local7.m_linearVelocity.x = (_local7.m_linearVelocity.x - (_local9 * _local21));
_local7.m_linearVelocity.y = (_local7.m_linearVelocity.y - (_local9 * _local22));
_local8.m_angularVelocity = (_local8.m_angularVelocity + (_local12 * ((_local20.r2.x * _local22) - (_local20.r2.y * _local21))));
_local8.m_linearVelocity.x = (_local8.m_linearVelocity.x + (_local11 * _local21));
_local8.m_linearVelocity.y = (_local8.m_linearVelocity.y + (_local11 * _local22));
_local18++;
};
} else {
_local19 = _local6.pointCount;
_local18 = 0;
while (_local18 < _local19) {
_local23 = _local6.points[_local18];
_local23.normalImpulse = 0;
_local23.tangentImpulse = 0;
_local18++;
};
};
_local5++;
};
}
public function SolvePositionConstraints(_arg1:Number):Boolean{
var _local3:b2Mat22;
var _local4:b2Vec2;
var _local6:b2ContactConstraint;
var _local7:b2Body;
var _local8:b2Body;
var _local9:b2Vec2;
var _local10:Number;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:int;
var _local20:int;
var _local21:b2ContactConstraintPoint;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:Number;
var _local38:Number;
var _local2:Number = 0;
var _local5:int;
while (_local5 < m_constraintCount) {
_local6 = m_constraints[_local5];
_local7 = _local6.body1;
_local8 = _local6.body2;
_local9 = _local7.m_sweep.c;
_local10 = _local7.m_sweep.a;
_local11 = _local8.m_sweep.c;
_local12 = _local8.m_sweep.a;
_local13 = (_local7.m_mass * _local7.m_invMass);
_local14 = (_local7.m_mass * _local7.m_invI);
_local15 = (_local8.m_mass * _local8.m_invMass);
_local16 = (_local8.m_mass * _local8.m_invI);
_local17 = _local6.normal.x;
_local18 = _local6.normal.y;
_local19 = _local6.pointCount;
_local20 = 0;
while (_local20 < _local19) {
_local21 = _local6.points[_local20];
_local3 = _local7.m_xf.R;
_local4 = _local7.m_sweep.localCenter;
_local22 = (_local21.localAnchor1.x - _local4.x);
_local23 = (_local21.localAnchor1.y - _local4.y);
_local26 = ((_local3.col1.x * _local22) + (_local3.col2.x * _local23));
_local23 = ((_local3.col1.y * _local22) + (_local3.col2.y * _local23));
_local22 = _local26;
_local3 = _local8.m_xf.R;
_local4 = _local8.m_sweep.localCenter;
_local24 = (_local21.localAnchor2.x - _local4.x);
_local25 = (_local21.localAnchor2.y - _local4.y);
_local26 = ((_local3.col1.x * _local24) + (_local3.col2.x * _local25));
_local25 = ((_local3.col1.y * _local24) + (_local3.col2.y * _local25));
_local24 = _local26;
_local27 = (_local9.x + _local22);
_local28 = (_local9.y + _local23);
_local29 = (_local11.x + _local24);
_local30 = (_local11.y + _local25);
_local31 = (_local29 - _local27);
_local32 = (_local30 - _local28);
_local33 = (((_local31 * _local17) + (_local32 * _local18)) + _local21.separation);
_local2 = b2Math.b2Min(_local2, _local33);
_local34 = (_arg1 * b2Math.b2Clamp((_local33 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0));
_local35 = (-(_local21.equalizedMass) * _local34);
_local36 = _local21.positionImpulse;
_local21.positionImpulse = b2Math.b2Max((_local36 + _local35), 0);
_local35 = (_local21.positionImpulse - _local36);
_local37 = (_local35 * _local17);
_local38 = (_local35 * _local18);
_local9.x = (_local9.x - (_local13 * _local37));
_local9.y = (_local9.y - (_local13 * _local38));
_local10 = (_local10 - (_local14 * ((_local22 * _local38) - (_local23 * _local37))));
_local7.m_sweep.a = _local10;
_local7.SynchronizeTransform();
_local11.x = (_local11.x + (_local15 * _local37));
_local11.y = (_local11.y + (_local15 * _local38));
_local12 = (_local12 + (_local16 * ((_local24 * _local38) - (_local25 * _local37))));
_local8.m_sweep.a = _local12;
_local8.SynchronizeTransform();
_local20++;
};
_local5++;
};
return ((_local2 >= (-1.5 * b2Settings.b2_linearSlop)));
}
public function SolveVelocityConstraints():void{
var _local1:int;
var _local2:b2ContactConstraintPoint;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:b2Mat22;
var _local18:b2Vec2;
var _local20:b2ContactConstraint;
var _local21:b2Body;
var _local22:b2Body;
var _local23:Number;
var _local24:Number;
var _local25:b2Vec2;
var _local26:b2Vec2;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:Number;
var _local31:Number;
var _local32:Number;
var _local33:Number;
var _local34:Number;
var _local35:Number;
var _local36:Number;
var _local37:int;
var _local38:Number;
var _local19:int;
while (_local19 < m_constraintCount) {
_local20 = m_constraints[_local19];
_local21 = _local20.body1;
_local22 = _local20.body2;
_local23 = _local21.m_angularVelocity;
_local24 = _local22.m_angularVelocity;
_local25 = _local21.m_linearVelocity;
_local26 = _local22.m_linearVelocity;
_local27 = _local21.m_invMass;
_local28 = _local21.m_invI;
_local29 = _local22.m_invMass;
_local30 = _local22.m_invI;
_local31 = _local20.normal.x;
_local32 = _local20.normal.y;
_local33 = _local32;
_local34 = -(_local31);
_local35 = _local20.friction;
_local37 = _local20.pointCount;
_local1 = 0;
while (_local1 < _local37) {
_local2 = _local20.points[_local1];
_local7 = (((_local26.x + (-(_local24) * _local2.r2.y)) - _local25.x) - (-(_local23) * _local2.r1.y));
_local8 = (((_local26.y + (_local24 * _local2.r2.x)) - _local25.y) - (_local23 * _local2.r1.x));
_local9 = ((_local7 * _local31) + (_local8 * _local32));
_local11 = (-(_local2.normalMass) * (_local9 - _local2.velocityBias));
_local10 = ((_local7 * _local33) + (_local8 * _local34));
_local12 = (_local2.tangentMass * -(_local10));
_local13 = b2Math.b2Max((_local2.normalImpulse + _local11), 0);
_local11 = (_local13 - _local2.normalImpulse);
_local38 = (_local35 * _local2.normalImpulse);
_local14 = b2Math.b2Clamp((_local2.tangentImpulse + _local12), -(_local38), _local38);
_local12 = (_local14 - _local2.tangentImpulse);
_local15 = ((_local11 * _local31) + (_local12 * _local33));
_local16 = ((_local11 * _local32) + (_local12 * _local34));
_local25.x = (_local25.x - (_local27 * _local15));
_local25.y = (_local25.y - (_local27 * _local16));
_local23 = (_local23 - (_local28 * ((_local2.r1.x * _local16) - (_local2.r1.y * _local15))));
_local26.x = (_local26.x + (_local29 * _local15));
_local26.y = (_local26.y + (_local29 * _local16));
_local24 = (_local24 + (_local30 * ((_local2.r2.x * _local16) - (_local2.r2.y * _local15))));
_local2.normalImpulse = _local13;
_local2.tangentImpulse = _local14;
_local1++;
};
_local21.m_angularVelocity = _local23;
_local22.m_angularVelocity = _local24;
_local19++;
};
}
public function FinalizeVelocityConstraints():void{
var _local2:b2ContactConstraint;
var _local3:b2Manifold;
var _local4:int;
var _local5:b2ManifoldPoint;
var _local6:b2ContactConstraintPoint;
var _local1:int;
while (_local1 < m_constraintCount) {
_local2 = m_constraints[_local1];
_local3 = _local2.manifold;
_local4 = 0;
while (_local4 < _local2.pointCount) {
_local5 = _local3.points[_local4];
_local6 = _local2.points[_local4];
_local5.normalImpulse = _local6.normalImpulse;
_local5.tangentImpulse = _local6.tangentImpulse;
_local4++;
};
_local1++;
};
}
}
}//package Box2D.Dynamics.Contacts
Section 272
//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 273
//b2PolyAndCircleContact (Box2D.Dynamics.Contacts.b2PolyAndCircleContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PolyAndCircleContact extends b2Contact {
private var m_manifolds:Array;
public var m_manifold:b2Manifold;
private var m0:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolyAndCircleContact(_arg1:b2Shape, _arg2:b2Shape){
m_manifolds = [new b2Manifold()];
m0 = new b2Manifold();
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
b2Settings.b2Assert((m_shape1.m_type == b2Shape.e_polygonShape));
b2Settings.b2Assert((m_shape2.m_type == b2Shape.e_circleShape));
m_manifold.pointCount = 0;
var _local3:b2ManifoldPoint = m_manifold.points[0];
_local3.normalImpulse = 0;
_local3.tangentImpulse = 0;
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:int;
var _local3:b2Vec2;
var _local4:b2Vec2;
var _local5:b2ManifoldPoint;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
var _local6:b2Body = m_shape1.m_body;
var _local7:b2Body = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygonAndCircle(m_manifold, (m_shape1 as b2PolygonShape), _local6.m_xf, (m_shape2 as b2CircleShape), _local7.m_xf);
var _local8:Array = [false, false];
var _local9:b2ContactPoint = s_evalCP;
_local9.shape1 = m_shape1;
_local9.shape2 = m_shape2;
_local9.friction = m_friction;
_local9.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local2 = 0;
while (_local2 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local2];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local8[_local13] == true){
} else {
_local5 = m0.points[_local13];
if (_local5.id._key == _local12){
_local8[_local13] = true;
_local10.normalImpulse = _local5.normalImpulse;
_local10.tangentImpulse = _local5.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Persist(_local9);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local9.position = _local6.GetWorldPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m_manifold.normal);
_local9.separation = _local10.separation;
_local9.id.key = _local12;
_arg1.Add(_local9);
};
_local2++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local2 = 0;
while (_local2 < m0.pointCount) {
if (_local8[_local2]){
} else {
_local5 = m0.points[_local2];
_local9.position = _local6.GetWorldPoint(_local5.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local5.localPoint1);
_local4 = _local7.GetLinearVelocityFromLocalPoint(_local5.localPoint2);
_local9.velocity.Set((_local4.x - _local3.x), (_local4.y - _local3.y));
_local9.normal.SetV(m0.normal);
_local9.separation = _local5.separation;
_local9.id.key = _local5.id._key;
_arg1.Remove(_local9);
};
_local2++;
};
}
override public function GetManifolds():Array{
return (m_manifolds);
}
public static function 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 274
//b2PolygonContact (Box2D.Dynamics.Contacts.b2PolygonContact)
package Box2D.Dynamics.Contacts {
import Box2D.Dynamics.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2PolygonContact extends b2Contact {
private var m_manifolds:Array;
private var m0:b2Manifold;
public var m_manifold:b2Manifold;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2PolygonContact(_arg1:b2Shape, _arg2:b2Shape):void{
m0 = new b2Manifold();
m_manifolds = [new b2Manifold()];
super(_arg1, _arg2);
m_manifold = m_manifolds[0];
m_manifold.pointCount = 0;
}
override public function Evaluate(_arg1:b2ContactListener):void{
var _local2:b2Vec2;
var _local3:b2Vec2;
var _local4:b2ManifoldPoint;
var _local7:b2ContactPoint;
var _local8:int;
var _local10:b2ManifoldPoint;
var _local11:Boolean;
var _local12:uint;
var _local13:int;
var _local5:b2Body = m_shape1.m_body;
var _local6:b2Body = m_shape2.m_body;
m0.Set(m_manifold);
b2Collision.b2CollidePolygons(m_manifold, (m_shape1 as b2PolygonShape), _local5.m_xf, (m_shape2 as b2PolygonShape), _local6.m_xf);
var _local9:Array = [false, false];
_local7 = s_evalCP;
_local7.shape1 = m_shape1;
_local7.shape2 = m_shape2;
_local7.friction = m_friction;
_local7.restitution = m_restitution;
if (m_manifold.pointCount > 0){
_local8 = 0;
while (_local8 < m_manifold.pointCount) {
_local10 = m_manifold.points[_local8];
_local10.normalImpulse = 0;
_local10.tangentImpulse = 0;
_local11 = false;
_local12 = _local10.id._key;
_local13 = 0;
while (_local13 < m0.pointCount) {
if (_local9[_local13] == true){
} else {
_local4 = m0.points[_local13];
if (_local4.id._key == _local12){
_local9[_local13] = true;
_local10.normalImpulse = _local4.normalImpulse;
_local10.tangentImpulse = _local4.tangentImpulse;
_local11 = true;
if (_arg1 != null){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Persist(_local7);
};
break;
};
};
_local13++;
};
if ((((_local11 == false)) && (!((_arg1 == null))))){
_local7.position = _local5.GetWorldPoint(_local10.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local10.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local10.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m_manifold.normal);
_local7.separation = _local10.separation;
_local7.id.key = _local12;
_arg1.Add(_local7);
};
_local8++;
};
m_manifoldCount = 1;
} else {
m_manifoldCount = 0;
};
if (_arg1 == null){
return;
};
_local8 = 0;
while (_local8 < m0.pointCount) {
if (_local9[_local8]){
} else {
_local4 = m0.points[_local8];
_local7.position = _local5.GetWorldPoint(_local4.localPoint1);
_local2 = _local5.GetLinearVelocityFromLocalPoint(_local4.localPoint1);
_local3 = _local6.GetLinearVelocityFromLocalPoint(_local4.localPoint2);
_local7.velocity.Set((_local3.x - _local2.x), (_local3.y - _local2.y));
_local7.normal.SetV(m0.normal);
_local7.separation = _local4.separation;
_local7.id.key = _local4.id._key;
_arg1.Remove(_local7);
};
_local8++;
};
}
override public function GetManifolds():Array{
return (m_manifolds);
}
public static function 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 275
//b2DistanceJoint (Box2D.Dynamics.Joints.b2DistanceJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2DistanceJoint extends b2Joint {
public var m_localAnchor1:b2Vec2;
public var m_localAnchor2:b2Vec2;
public var m_bias:Number;
public var m_gamma:Number;
public var m_u:b2Vec2;
public var m_mass:Number;
public var m_impulse:Number;
public var m_dampingRatio:Number;
public var m_frequencyHz:Number;
public var m_length:Number;
public function b2DistanceJoint(_arg1:b2DistanceJointDef){
var _local2:b2Mat22;
var _local3:Number;
var _local4:Number;
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_u = new b2Vec2();
super(_arg1);
m_localAnchor1.SetV(_arg1.localAnchor1);
m_localAnchor2.SetV(_arg1.localAnchor2);
m_length = _arg1.length;
m_frequencyHz = _arg1.frequencyHz;
m_dampingRatio = _arg1.dampingRatio;
m_impulse = 0;
m_gamma = 0;
m_bias = 0;
m_inv_dt = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:Number;
var _local4:b2Body;
var _local5:b2Body;
var _local6:Number;
var _local8:Number;
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
m_inv_dt = _arg1.inv_dt;
_local4 = m_body1;
_local5 = m_body2;
_local2 = _local4.m_xf.R;
_local6 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local6) + (_local2.col2.x * _local7));
_local7 = ((_local2.col1.y * _local6) + (_local2.col2.y * _local7));
_local6 = _local3;
_local2 = _local5.m_xf.R;
_local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local3 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local3;
m_u.x = (((_local5.m_sweep.c.x + _local8) - _local4.m_sweep.c.x) - _local6);
m_u.y = (((_local5.m_sweep.c.y + _local9) - _local4.m_sweep.c.y) - _local7);
var _local10:Number = Math.sqrt(((m_u.x * m_u.x) + (m_u.y * m_u.y)));
if (_local10 > b2Settings.b2_linearSlop){
m_u.Multiply((1 / _local10));
} else {
m_u.SetZero();
};
var _local11:Number = ((_local6 * m_u.y) - (_local7 * m_u.x));
var _local12:Number = ((_local8 * m_u.y) - (_local9 * m_u.x));
var _local13:Number = (((_local4.m_invMass + ((_local4.m_invI * _local11) * _local11)) + _local5.m_invMass) + ((_local5.m_invI * _local12) * _local12));
m_mass = (1 / _local13);
if (m_frequencyHz > 0){
_local14 = (_local10 - m_length);
_local15 = ((2 * Math.PI) * m_frequencyHz);
_local16 = (((2 * m_mass) * m_dampingRatio) * _local15);
_local17 = ((m_mass * _local15) * _local15);
m_gamma = (1 / (_arg1.dt * (_local16 + (_arg1.dt * _local17))));
m_bias = (((_local14 * _arg1.dt) * _local17) * m_gamma);
m_mass = (1 / (_local13 + m_gamma));
};
if (_arg1.warmStarting){
m_impulse = (m_impulse * _arg1.dtRatio);
_local18 = (m_impulse * m_u.x);
_local19 = (m_impulse * m_u.y);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x - (_local4.m_invMass * _local18));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y - (_local4.m_invMass * _local19));
_local4.m_angularVelocity = (_local4.m_angularVelocity - (_local4.m_invI * ((_local6 * _local19) - (_local7 * _local18))));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + (_local5.m_invMass * _local18));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + (_local5.m_invMass * _local19));
_local5.m_angularVelocity = (_local5.m_angularVelocity + (_local5.m_invI * ((_local8 * _local19) - (_local9 * _local18))));
} else {
m_impulse = 0;
};
}
override public function GetReactionTorque():Number{
return (0);
}
override public function GetReactionForce():b2Vec2{
var _local1:b2Vec2 = new b2Vec2();
_local1.SetV(m_u);
_local1.Multiply((m_inv_dt * m_impulse));
return (_local1);
}
override public function SolvePositionConstraints():Boolean{
var _local1:b2Mat22;
if (m_frequencyHz > 0){
return (true);
};
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local1 = _local2.m_xf.R;
var _local4:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local5:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
var _local6:Number = ((_local1.col1.x * _local4) + (_local1.col2.x * _local5));
_local5 = ((_local1.col1.y * _local4) + (_local1.col2.y * _local5));
_local4 = _local6;
_local1 = _local3.m_xf.R;
var _local7:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local8:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local6 = ((_local1.col1.x * _local7) + (_local1.col2.x * _local8));
_local8 = ((_local1.col1.y * _local7) + (_local1.col2.y * _local8));
_local7 = _local6;
var _local9:Number = (((_local3.m_sweep.c.x + _local7) - _local2.m_sweep.c.x) - _local4);
var _local10:Number = (((_local3.m_sweep.c.y + _local8) - _local2.m_sweep.c.y) - _local5);
var _local11:Number = Math.sqrt(((_local9 * _local9) + (_local10 * _local10)));
_local9 = (_local9 / _local11);
_local10 = (_local10 / _local11);
var _local12:Number = (_local11 - m_length);
_local12 = b2Math.b2Clamp(_local12, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
var _local13:Number = (-(m_mass) * _local12);
m_u.Set(_local9, _local10);
var _local14:Number = (_local13 * m_u.x);
var _local15:Number = (_local13 * m_u.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x - (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y - (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a - (_local2.m_invI * ((_local4 * _local15) - (_local5 * _local14))));
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + (_local3.m_invMass * _local14));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + (_local3.m_invMass * _local15));
_local3.m_sweep.a = (_local3.m_sweep.a + (_local3.m_invI * ((_local7 * _local15) - (_local8 * _local14))));
_local2.SynchronizeTransform();
_local3.SynchronizeTransform();
return ((b2Math.b2Abs(_local12) < b2Settings.b2_linearSlop));
}
override public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
var _local2:b2Mat22;
var _local3:b2Body = m_body1;
var _local4:b2Body = m_body2;
_local2 = _local3.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
var _local7:Number = ((_local2.col1.x * _local5) + (_local2.col2.x * _local6));
_local6 = ((_local2.col1.y * _local5) + (_local2.col2.y * _local6));
_local5 = _local7;
_local2 = _local4.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local7 = ((_local2.col1.x * _local8) + (_local2.col2.x * _local9));
_local9 = ((_local2.col1.y * _local8) + (_local2.col2.y * _local9));
_local8 = _local7;
var _local10:Number = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local6));
var _local11:Number = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local5));
var _local12:Number = (_local4.m_linearVelocity.x + (-(_local4.m_angularVelocity) * _local9));
var _local13:Number = (_local4.m_linearVelocity.y + (_local4.m_angularVelocity * _local8));
var _local14:Number = ((m_u.x * (_local12 - _local10)) + (m_u.y * (_local13 - _local11)));
var _local15:Number = (-(m_mass) * ((_local14 + m_bias) + (m_gamma * m_impulse)));
m_impulse = (m_impulse + _local15);
var _local16:Number = (_local15 * m_u.x);
var _local17:Number = (_local15 * m_u.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x - (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y - (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity - (_local3.m_invI * ((_local5 * _local17) - (_local6 * _local16))));
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + (_local4.m_invMass * _local16));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + (_local4.m_invMass * _local17));
_local4.m_angularVelocity = (_local4.m_angularVelocity + (_local4.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
}
}
}//package Box2D.Dynamics.Joints
Section 276
//b2DistanceJointDef (Box2D.Dynamics.Joints.b2DistanceJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
public class b2DistanceJointDef extends b2JointDef {
public var localAnchor1:b2Vec2;
public var length:Number;
public var dampingRatio:Number;
public var localAnchor2:b2Vec2;
public var frequencyHz:Number;
public function b2DistanceJointDef(){
localAnchor1 = new b2Vec2();
localAnchor2 = new b2Vec2();
super();
type = b2Joint.e_distanceJoint;
length = 1;
frequencyHz = 0;
dampingRatio = 0;
}
public function Initialize(_arg1:b2Body, _arg2:b2Body, _arg3:b2Vec2, _arg4:b2Vec2):void{
body1 = _arg1;
body2 = _arg2;
localAnchor1.SetV(body1.GetLocalPoint(_arg3));
localAnchor2.SetV(body2.GetLocalPoint(_arg4));
var _local5:Number = (_arg4.x - _arg3.x);
var _local6:Number = (_arg4.y - _arg3.y);
length = Math.sqrt(((_local5 * _local5) + (_local6 * _local6)));
frequencyHz = 0;
dampingRatio = 0;
}
}
}//package Box2D.Dynamics.Joints
Section 277
//b2GearJoint (Box2D.Dynamics.Joints.b2GearJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
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 _local4:Number;
var _local5:Number;
m_groundAnchor1 = new b2Vec2();
m_groundAnchor2 = new b2Vec2();
m_localAnchor1 = new b2Vec2();
m_localAnchor2 = new b2Vec2();
m_J = new b2Jacobian();
super(_arg1);
var _local2:int = _arg1.joint1.m_type;
var _local3:int = _arg1.joint2.m_type;
m_revolute1 = null;
m_prismatic1 = null;
m_revolute2 = null;
m_prismatic2 = null;
m_ground1 = _arg1.joint1.m_body1;
m_body1 = _arg1.joint1.m_body2;
if (_local2 == b2Joint.e_revoluteJoint){
m_revolute1 = (_arg1.joint1 as b2RevoluteJoint);
m_groundAnchor1.SetV(m_revolute1.m_localAnchor1);
m_localAnchor1.SetV(m_revolute1.m_localAnchor2);
_local4 = m_revolute1.GetJointAngle();
} else {
m_prismatic1 = (_arg1.joint1 as b2PrismaticJoint);
m_groundAnchor1.SetV(m_prismatic1.m_localAnchor1);
m_localAnchor1.SetV(m_prismatic1.m_localAnchor2);
_local4 = m_prismatic1.GetJointTranslation();
};
m_ground2 = _arg1.joint2.m_body1;
m_body2 = _arg1.joint2.m_body2;
if (_local3 == b2Joint.e_revoluteJoint){
m_revolute2 = (_arg1.joint2 as b2RevoluteJoint);
m_groundAnchor2.SetV(m_revolute2.m_localAnchor1);
m_localAnchor2.SetV(m_revolute2.m_localAnchor2);
_local5 = m_revolute2.GetJointAngle();
} else {
m_prismatic2 = (_arg1.joint2 as b2PrismaticJoint);
m_groundAnchor2.SetV(m_prismatic2.m_localAnchor1);
m_localAnchor2.SetV(m_prismatic2.m_localAnchor2);
_local5 = m_prismatic2.GetJointTranslation();
};
m_ratio = _arg1.ratio;
m_constant = (_local4 + (m_ratio * _local5));
m_force = 0;
}
override public function GetAnchor1():b2Vec2{
return (m_body1.GetWorldPoint(m_localAnchor1));
}
override public function GetAnchor2():b2Vec2{
return (m_body2.GetWorldPoint(m_localAnchor2));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:b2Mat22;
var _local11:b2Vec2;
var _local12:Number;
var _local13:Number;
var _local15:Number;
var _local2:b2Body = m_ground1;
var _local3:b2Body = m_ground2;
var _local4:b2Body = m_body1;
var _local5:b2Body = m_body2;
var _local14:Number = 0;
m_J.SetZero();
if (m_revolute1){
m_J.angular1 = -1;
_local14 = (_local14 + _local4.m_invI);
} else {
_local10 = _local2.m_xf.R;
_local11 = m_prismatic1.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local4.m_xf.R;
_local8 = (m_localAnchor1.x - _local4.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local4.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linear1.Set(-(_local6), -(_local7));
m_J.angular1 = -(_local12);
_local14 = (_local14 + (_local4.m_invMass + ((_local4.m_invI * _local12) * _local12)));
};
if (m_revolute2){
m_J.angular2 = -(m_ratio);
_local14 = (_local14 + ((m_ratio * m_ratio) * _local5.m_invI));
} else {
_local10 = _local3.m_xf.R;
_local11 = m_prismatic2.m_localXAxis1;
_local6 = ((_local10.col1.x * _local11.x) + (_local10.col2.x * _local11.y));
_local7 = ((_local10.col1.y * _local11.x) + (_local10.col2.y * _local11.y));
_local10 = _local5.m_xf.R;
_local8 = (m_localAnchor2.x - _local5.m_sweep.localCenter.x);
_local9 = (m_localAnchor2.y - _local5.m_sweep.localCenter.y);
_local13 = ((_local10.col1.x * _local8) + (_local10.col2.x * _local9));
_local9 = ((_local10.col1.y * _local8) + (_local10.col2.y * _local9));
_local8 = _local13;
_local12 = ((_local8 * _local7) - (_local9 * _local6));
m_J.linear2.Set((-(m_ratio) * _local6), (-(m_ratio) * _local7));
m_J.angular2 = (-(m_ratio) * _local12);
_local14 = (_local14 + ((m_ratio * m_ratio) * (_local5.m_invMass + ((_local5.m_invI * _local12) * _local12))));
};
m_mass = (1 / _local14);
if (_arg1.warmStarting){
_local15 = (_arg1.dt * m_force);
_local4.m_linearVelocity.x = (_local4.m_linearVelocity.x + ((_local4.m_invMass * _local15) * m_J.linear1.x));
_local4.m_linearVelocity.y = (_local4.m_linearVelocity.y + ((_local4.m_invMass * _local15) * m_J.linear1.y));
_local4.m_angularVelocity = (_local4.m_angularVelocity + ((_local4.m_invI * _local15) * m_J.angular1));
_local5.m_linearVelocity.x = (_local5.m_linearVelocity.x + ((_local5.m_invMass * _local15) * m_J.linear2.x));
_local5.m_linearVelocity.y = (_local5.m_linearVelocity.y + ((_local5.m_invMass * _local15) * m_J.linear2.y));
_local5.m_angularVelocity = (_local5.m_angularVelocity + ((_local5.m_invI * _local15) * m_J.angular2));
} else {
m_force = 0;
};
}
override public function GetReactionTorque():Number{
var _local1:b2Mat22 = m_body2.m_xf.R;
var _local2:Number = (m_localAnchor1.x - m_body2.m_sweep.localCenter.x);
var _local3:Number = (m_localAnchor1.y - m_body2.m_sweep.localCenter.y);
var _local4:Number = ((_local1.col1.x * _local2) + (_local1.col2.x * _local3));
_local3 = ((_local1.col1.y * _local2) + (_local1.col2.y * _local3));
_local2 = _local4;
_local4 = ((m_force * m_J.angular2) - ((_local2 * (m_force * m_J.linear2.y)) - (_local3 * (m_force * m_J.linear2.x))));
return (_local4);
}
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 278
//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 279
//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 280
//b2Joint (Box2D.Dynamics.Joints.b2Joint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
public class b2Joint {
public var m_islandFlag:Boolean;
public var m_body1:b2Body;
public var m_prev:b2Joint;
public var m_next:b2Joint;
public var m_type:int;
public var m_collideConnected:Boolean;
public var m_node1:b2JointEdge;
public var m_node2:b2JointEdge;
public var m_inv_dt:Number;
public var m_userData;
public var m_body2:b2Body;
public static const e_unknownJoint:int = 0;
public static const e_inactiveLimit:int = 0;
public static const e_atUpperLimit:int = 2;
public static const e_atLowerLimit:int = 1;
public static const e_gearJoint:int = 6;
public static const e_revoluteJoint:int = 1;
public static const e_equalLimits:int = 3;
public static const e_distanceJoint:int = 3;
public static const e_pulleyJoint:int = 4;
public static const e_prismaticJoint:int = 2;
public static const e_mouseJoint:int = 5;
public function b2Joint(_arg1:b2JointDef){
m_node1 = new b2JointEdge();
m_node2 = new b2JointEdge();
super();
m_type = _arg1.type;
m_prev = null;
m_next = null;
m_body1 = _arg1.body1;
m_body2 = _arg1.body2;
m_collideConnected = _arg1.collideConnected;
m_islandFlag = false;
m_userData = _arg1.userData;
}
public function GetBody2():b2Body{
return (m_body2);
}
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 SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetBody1():b2Body{
return (m_body1);
}
public function SolveVelocityConstraints(_arg1:b2TimeStep):void{
}
public function InitPositionConstraints():void{
}
public static function Destroy(_arg1:b2Joint, _arg2):void{
}
public static function Create(_arg1:b2JointDef, _arg2):b2Joint{
var _local3:b2Joint;
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 281
//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 282
//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 283
//b2MouseJoint (Box2D.Dynamics.Joints.b2MouseJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
public class b2MouseJoint extends b2Joint {
private var K1:b2Mat22;
private var K:b2Mat22;
public var m_beta:Number;
public var m_mass:b2Mat22;
private var K2:b2Mat22;
public var m_target:b2Vec2;
public var m_gamma:Number;
public var m_impulse:b2Vec2;
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_impulse = new b2Vec2();
m_mass = new b2Mat22();
m_C = new b2Vec2();
super(_arg1);
m_target.SetV(_arg1.target);
var _local2:Number = (m_target.x - m_body2.m_xf.position.x);
_local3 = (m_target.y - m_body2.m_xf.position.y);
var _local4:b2Mat22 = m_body2.m_xf.R;
m_localAnchor.x = ((_local2 * _local4.col1.x) + (_local3 * _local4.col1.y));
m_localAnchor.y = ((_local2 * _local4.col2.x) + (_local3 * _local4.col2.y));
m_maxForce = _arg1.maxForce;
m_impulse.SetZero();
var _local5:Number = m_body2.m_mass;
var _local6:Number = ((2 * b2Settings.b2_pi) * _arg1.frequencyHz);
var _local7:Number = (((2 * _local5) * _arg1.dampingRatio) * _local6);
var _local8:Number = ((_arg1.timeStep * _local5) * (_local6 * _local6));
m_gamma = (1 / (_local7 + _local8));
m_beta = (_local8 / (_local7 + _local8));
}
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.m_sweep.localCenter.x);
_local5 = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local7 = _local2.m_invMass;
_local8 = _local2.m_invI;
K1.col1.x = _local7;
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = _local7;
K2.col1.x = ((_local8 * _local5) * _local5);
K2.col2.x = ((-(_local8) * _local4) * _local5);
K2.col1.y = ((-(_local8) * _local4) * _local5);
K2.col2.y = ((_local8 * _local4) * _local4);
K.SetM(K1);
K.AddM(K2);
K.col1.x = (K.col1.x + m_gamma);
K.col2.y = (K.col2.y + m_gamma);
K.Invert(m_mass);
m_C.x = ((_local2.m_sweep.c.x + _local4) - m_target.x);
m_C.y = ((_local2.m_sweep.c.y + _local5) - m_target.y);
_local2.m_angularVelocity = (_local2.m_angularVelocity * 0.98);
var _local9:Number = (_arg1.dt * m_impulse.x);
var _local10:Number = (_arg1.dt * m_impulse.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local7 * _local9));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local7 * _local10));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local8 * ((_local4 * _local10) - (_local5 * _local9))));
}
override public function GetAnchor1():b2Vec2{
return (m_target);
}
override public function GetReactionTorque():Number{
return (0);
}
override public function GetReactionForce():b2Vec2{
return (m_impulse);
}
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.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor.y - _local2.m_sweep.localCenter.y);
_local4 = ((_local3.col1.x * _local6) + (_local3.col2.x * _local7));
_local7 = ((_local3.col1.y * _local6) + (_local3.col2.y * _local7));
_local6 = _local4;
var _local8:Number = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local7));
var _local9:Number = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local6));
_local3 = m_mass;
_local4 = ((_local8 + ((m_beta * _arg1.inv_dt) * m_C.x)) + ((m_gamma * _arg1.dt) * m_impulse.x));
_local5 = ((_local9 + ((m_beta * _arg1.inv_dt) * m_C.y)) + ((m_gamma * _arg1.dt) * m_impulse.y));
var _local10:Number = (-(_arg1.inv_dt) * ((_local3.col1.x * _local4) + (_local3.col2.x * _local5)));
var _local11:Number = (-(_arg1.inv_dt) * ((_local3.col1.y * _local4) + (_local3.col2.y * _local5)));
var _local12:Number = m_impulse.x;
var _local13:Number = m_impulse.y;
m_impulse.x = (m_impulse.x + _local10);
m_impulse.y = (m_impulse.y + _local11);
var _local14:Number = m_impulse.Length();
if (_local14 > m_maxForce){
m_impulse.Multiply((m_maxForce / _local14));
};
_local10 = (m_impulse.x - _local12);
_local11 = (m_impulse.y - _local13);
var _local15:Number = (_arg1.dt * _local10);
var _local16:Number = (_arg1.dt * _local11);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
}
}
}//package Box2D.Dynamics.Joints
Section 284
//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 285
//b2PrismaticJoint (Box2D.Dynamics.Joints.b2PrismaticJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
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.m_sweep.localCenter.x);
var _local12:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
var _local13:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local14:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
var _local15:Number = (_local3.m_sweep.c.x + _local11);
var _local16:Number = (_local3.m_sweep.c.y + _local12);
var _local17:Number = (_local4.m_sweep.c.x + _local13);
var _local18:Number = (_local4.m_sweep.c.y + _local14);
var _local19:Number = (_local17 - _local15);
var _local20:Number = (_local18 - _local16);
_local9 = _local3.m_xf.R;
var _local21:Number = ((_local9.col1.x * m_localYAxis1.x) + (_local9.col2.x * m_localYAxis1.y));
var _local22:Number = ((_local9.col1.y * m_localYAxis1.x) + (_local9.col2.y * m_localYAxis1.y));
var _local23:Number = ((_local21 * _local19) + (_local22 * _local20));
_local23 = b2Math.b2Clamp(_local23, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
var _local24:Number = (-(m_linearMass) * _local23);
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local24) * m_linearJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local24) * m_linearJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local24) * m_linearJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local24) * m_linearJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local24) * m_linearJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local24) * m_linearJacobian.angular2));
var _local25:Number = b2Math.b2Abs(_local23);
var _local26:Number = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_refAngle);
_local26 = b2Math.b2Clamp(_local26, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
var _local27:Number = (-(m_angularMass) * _local26);
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local27));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local27));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
var _local28:Number = b2Math.b2Abs(_local26);
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local9 = _local3.m_xf.R;
_local11 = (m_localAnchor1.x - _local3.m_sweep.localCenter.x);
_local12 = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local11) + (_local9.col2.x * _local12));
_local12 = ((_local9.col1.y * _local11) + (_local9.col2.y * _local12));
_local11 = _local10;
_local9 = _local4.m_xf.R;
_local13 = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
_local14 = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local10 = ((_local9.col1.x * _local13) + (_local9.col2.x * _local14));
_local14 = ((_local9.col1.y * _local13) + (_local9.col2.y * _local14));
_local13 = _local10;
_local15 = (_local3.m_sweep.c.x + _local11);
_local16 = (_local3.m_sweep.c.y + _local12);
_local17 = (_local4.m_sweep.c.x + _local13);
_local18 = (_local4.m_sweep.c.y + _local14);
_local19 = (_local17 - _local15);
_local20 = (_local18 - _local16);
_local9 = _local3.m_xf.R;
_local29 = ((_local9.col1.x * m_localXAxis1.x) + (_local9.col2.x * m_localXAxis1.y));
_local30 = ((_local9.col1.y * m_localXAxis1.x) + (_local9.col2.y * m_localXAxis1.y));
_local31 = ((_local29 * _local19) + (_local30 * _local20));
_local32 = 0;
if (m_limitState == e_equalLimits){
_local1 = b2Math.b2Clamp(_local31, -(b2Settings.b2_maxLinearCorrection), b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local25 = b2Math.b2Max(_local25, b2Math.b2Abs(_local26));
} else {
if (m_limitState == e_atLowerLimit){
_local1 = (_local31 - m_lowerTranslation);
_local25 = b2Math.b2Max(_local25, -(_local1));
_local1 = b2Math.b2Clamp((_local1 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
} else {
if (m_limitState == e_atUpperLimit){
_local1 = (_local31 - m_upperTranslation);
_local25 = b2Math.b2Max(_local25, _local1);
_local1 = b2Math.b2Clamp((_local1 - b2Settings.b2_linearSlop), 0, b2Settings.b2_maxLinearCorrection);
_local32 = (-(m_motorMass) * _local1);
_local2 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local32), 0);
_local32 = (m_limitPositionImpulse - _local2);
};
};
};
_local3.m_sweep.c.x = (_local3.m_sweep.c.x + ((_local5 * _local32) * m_motorJacobian.linear1.x));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y + ((_local5 * _local32) * m_motorJacobian.linear1.y));
_local3.m_sweep.a = (_local3.m_sweep.a + ((_local7 * _local32) * m_motorJacobian.angular1));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + ((_local6 * _local32) * m_motorJacobian.linear2.x));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + ((_local6 * _local32) * m_motorJacobian.linear2.y));
_local4.m_sweep.a = (_local4.m_sweep.a + ((_local8 * _local32) * m_motorJacobian.angular2));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local25 <= b2Settings.b2_linearSlop)) && ((_local28 <= b2Settings.b2_angularSlop))));
}
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.m_sweep.localCenter.x);
var _local5:Number = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
var _local6:Number = ((_local3.col1.x * _local4) + (_local3.col2.x * _local5));
_local5 = ((_local3.col1.y * _local4) + (_local3.col2.y * _local5));
_local4 = _local6;
_local3 = _local2.m_xf.R;
var _local7:Number = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
var _local8:Number = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local6 = ((_local3.col1.x * _local7) + (_local3.col2.x * _local8));
_local8 = ((_local3.col1.y * _local7) + (_local3.col2.y * _local8));
_local7 = _local6;
var _local9:Number = (_local1.m_sweep.c.x + _local4);
var _local10:Number = (_local1.m_sweep.c.y + _local5);
var _local11:Number = (_local2.m_sweep.c.x + _local7);
var _local12:Number = (_local2.m_sweep.c.y + _local8);
var _local13:Number = (_local11 - _local9);
var _local14:Number = (_local12 - _local10);
var _local15:b2Vec2 = _local1.GetWorldVector(m_localXAxis1);
var _local16:b2Vec2 = _local1.m_linearVelocity;
var _local17:b2Vec2 = _local2.m_linearVelocity;
var _local18:Number = _local1.m_angularVelocity;
var _local19:Number = _local2.m_angularVelocity;
var _local20:Number = (((_local13 * (-(_local18) * _local15.y)) + (_local14 * (_local18 * _local15.x))) + ((_local15.x * (((_local17.x + (-(_local19) * _local8)) - _local16.x) - (-(_local18) * _local5))) + (_local15.y * (((_local17.y + (_local19 * _local7)) - _local16.y) - (_local18 * _local4)))));
return (_local20);
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local5:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
var _local10:Number = _local2.m_invMass;
var _local11:Number = _local3.m_invMass;
var _local12:Number = _local2.m_invI;
var _local13:Number = _local3.m_invI;
_local4 = _local2.m_xf.R;
var _local14:Number = ((_local4.col1.x * m_localYAxis1.x) + (_local4.col2.x * m_localYAxis1.y));
var _local15:Number = ((_local4.col1.y * m_localYAxis1.x) + (_local4.col2.y * m_localYAxis1.y));
var _local16:Number = ((_local3.m_sweep.c.x + _local8) - _local2.m_sweep.c.x);
var _local17:Number = ((_local3.m_sweep.c.y + _local9) - _local2.m_sweep.c.y);
m_linearJacobian.linear1.x = -(_local14);
m_linearJacobian.linear1.y = -(_local15);
m_linearJacobian.linear2.x = _local14;
m_linearJacobian.linear2.y = _local15;
m_linearJacobian.angular1 = -(((_local16 * _local15) - (_local17 * _local14)));
m_linearJacobian.angular2 = ((_local8 * _local15) - (_local9 * _local14));
m_linearMass = (((_local10 + ((_local12 * m_linearJacobian.angular1) * m_linearJacobian.angular1)) + _local11) + ((_local13 * m_linearJacobian.angular2) * m_linearJacobian.angular2));
m_linearMass = (1 / m_linearMass);
m_angularMass = (_local12 + _local13);
if (m_angularMass > Number.MIN_VALUE){
m_angularMass = (1 / m_angularMass);
};
if (((m_enableLimit) || (m_enableMotor))){
_local4 = _local2.m_xf.R;
_local18 = ((_local4.col1.x * m_localXAxis1.x) + (_local4.col2.x * m_localXAxis1.y));
_local19 = ((_local4.col1.y * m_localXAxis1.x) + (_local4.col2.y * m_localXAxis1.y));
m_motorJacobian.linear1.x = -(_local18);
m_motorJacobian.linear1.y = -(_local19);
m_motorJacobian.linear2.x = _local18;
m_motorJacobian.linear2.y = _local19;
m_motorJacobian.angular1 = -(((_local16 * _local19) - (_local17 * _local18)));
m_motorJacobian.angular2 = ((_local8 * _local19) - (_local9 * _local18));
m_motorMass = (((_local10 + ((_local12 * m_motorJacobian.angular1) * m_motorJacobian.angular1)) + _local11) + ((_local13 * m_motorJacobian.angular2) * m_motorJacobian.angular2));
m_motorMass = (1 / m_motorMass);
if (m_enableLimit){
_local20 = (_local16 - _local6);
_local21 = (_local17 - _local7);
_local22 = ((_local18 * _local20) + (_local19 * _local21));
if (b2Math.b2Abs((m_upperTranslation - m_lowerTranslation)) < (2 * b2Settings.b2_linearSlop)){
m_limitState = e_equalLimits;
} else {
if (_local22 <= m_lowerTranslation){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local22 >= m_upperTranslation){
if (m_limitState != e_atUpperLimit){
m_limitForce = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitForce = 0;
};
};
};
};
};
if (m_enableMotor == false){
m_motorForce = 0;
};
if (m_enableLimit == false){
m_limitForce = 0;
};
if (_arg1.warmStarting){
_local23 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.x)));
_local24 = (_arg1.dt * ((m_force * m_linearJacobian.linear1.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear1.y)));
_local25 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.x) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.x)));
_local26 = (_arg1.dt * ((m_force * m_linearJacobian.linear2.y) + ((m_motorForce + m_limitForce) * m_motorJacobian.linear2.y)));
_local27 = (_arg1.dt * (((m_force * m_linearJacobian.angular1) - m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular1)));
_local28 = (_arg1.dt * (((m_force * m_linearJacobian.angular2) + m_torque) + ((m_motorForce + m_limitForce) * m_motorJacobian.angular2)));
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local10 * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local10 * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local12 * _local27));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local11 * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local11 * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local13 * _local28));
} else {
m_force = 0;
m_torque = 0;
m_limitForce = 0;
m_motorForce = 0;
};
m_limitPositionImpulse = 0;
}
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 286
//b2PrismaticJointDef (Box2D.Dynamics.Joints.b2PrismaticJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
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 287
//b2PulleyJoint (Box2D.Dynamics.Joints.b2PulleyJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
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.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local16 = m_u1.Length();
_local17 = m_u2.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local16));
} else {
m_u1.SetZero();
};
if (_local17 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = ((m_constant - _local16) - (m_ratio * _local17));
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_pulleyMass) * _local18);
_local20 = m_positionImpulse;
m_positionImpulse = b2Math.b2Max(0, (m_positionImpulse + _local19));
_local19 = (m_positionImpulse - _local20);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local14 = ((-(m_ratio) * _local19) * m_u2.x);
_local15 = ((-(m_ratio) * _local19) * m_u2.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local1.SynchronizeTransform();
_local2.SynchronizeTransform();
};
if (m_limitState1 == e_atUpperLimit){
_local3 = _local1.m_xf.R;
_local8 = (m_localAnchor1.x - _local1.m_sweep.localCenter.x);
_local9 = (m_localAnchor1.y - _local1.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local8) + (_local3.col2.x * _local9));
_local9 = ((_local3.col1.y * _local8) + (_local3.col2.y * _local9));
_local8 = _local22;
_local12 = (_local1.m_sweep.c.x + _local8);
_local13 = (_local1.m_sweep.c.y + _local9);
m_u1.Set((_local12 - _local4), (_local13 - _local5));
_local16 = m_u1.Length();
if (_local16 > b2Settings.b2_linearSlop){
m_u1.x = (m_u1.x * (1 / _local16));
m_u1.y = (m_u1.y * (1 / _local16));
} else {
m_u1.SetZero();
};
_local18 = (m_maxLength1 - _local16);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass1) * _local18);
_local21 = m_limitPositionImpulse1;
m_limitPositionImpulse1 = b2Math.b2Max(0, (m_limitPositionImpulse1 + _local19));
_local19 = (m_limitPositionImpulse1 - _local21);
_local12 = (-(_local19) * m_u1.x);
_local13 = (-(_local19) * m_u1.y);
_local1.m_sweep.c.x = (_local1.m_sweep.c.x + (_local1.m_invMass * _local12));
_local1.m_sweep.c.y = (_local1.m_sweep.c.y + (_local1.m_invMass * _local13));
_local1.m_sweep.a = (_local1.m_sweep.a + (_local1.m_invI * ((_local8 * _local13) - (_local9 * _local12))));
_local1.SynchronizeTransform();
};
if (m_limitState2 == e_atUpperLimit){
_local3 = _local2.m_xf.R;
_local10 = (m_localAnchor2.x - _local2.m_sweep.localCenter.x);
_local11 = (m_localAnchor2.y - _local2.m_sweep.localCenter.y);
_local22 = ((_local3.col1.x * _local10) + (_local3.col2.x * _local11));
_local11 = ((_local3.col1.y * _local10) + (_local3.col2.y * _local11));
_local10 = _local22;
_local14 = (_local2.m_sweep.c.x + _local10);
_local15 = (_local2.m_sweep.c.y + _local11);
m_u2.Set((_local14 - _local6), (_local15 - _local7));
_local17 = m_u2.Length();
if (_local17 > b2Settings.b2_linearSlop){
m_u2.x = (m_u2.x * (1 / _local17));
m_u2.y = (m_u2.y * (1 / _local17));
} else {
m_u2.SetZero();
};
_local18 = (m_maxLength2 - _local17);
_local23 = b2Math.b2Max(_local23, -(_local18));
_local18 = b2Math.b2Clamp((_local18 + b2Settings.b2_linearSlop), -(b2Settings.b2_maxLinearCorrection), 0);
_local19 = (-(m_limitMass2) * _local18);
_local21 = m_limitPositionImpulse2;
m_limitPositionImpulse2 = b2Math.b2Max(0, (m_limitPositionImpulse2 + _local19));
_local19 = (m_limitPositionImpulse2 - _local21);
_local14 = (-(_local19) * m_u2.x);
_local15 = (-(_local19) * m_u2.y);
_local2.m_sweep.c.x = (_local2.m_sweep.c.x + (_local2.m_invMass * _local14));
_local2.m_sweep.c.y = (_local2.m_sweep.c.y + (_local2.m_invMass * _local15));
_local2.m_sweep.a = (_local2.m_sweep.a + (_local2.m_invI * ((_local10 * _local15) - (_local11 * _local14))));
_local2.SynchronizeTransform();
};
return ((_local23 < b2Settings.b2_linearSlop));
}
override public function InitVelocityConstraints(_arg1:b2TimeStep):void{
var _local4:b2Mat22;
var _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local5:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
var _local10:Number = (_local2.m_sweep.c.x + _local5);
var _local11:Number = (_local2.m_sweep.c.y + _local6);
var _local12:Number = (_local3.m_sweep.c.x + _local8);
var _local13:Number = (_local3.m_sweep.c.y + _local9);
var _local14:Number = (m_ground.m_xf.position.x + m_groundAnchor1.x);
var _local15:Number = (m_ground.m_xf.position.y + m_groundAnchor1.y);
var _local16:Number = (m_ground.m_xf.position.x + m_groundAnchor2.x);
var _local17:Number = (m_ground.m_xf.position.y + m_groundAnchor2.y);
m_u1.Set((_local10 - _local14), (_local11 - _local15));
m_u2.Set((_local12 - _local16), (_local13 - _local17));
var _local18:Number = m_u1.Length();
var _local19:Number = m_u2.Length();
if (_local18 > b2Settings.b2_linearSlop){
m_u1.Multiply((1 / _local18));
} else {
m_u1.SetZero();
};
if (_local19 > b2Settings.b2_linearSlop){
m_u2.Multiply((1 / _local19));
} else {
m_u2.SetZero();
};
var _local20:Number = ((m_constant - _local18) - (m_ratio * _local19));
if (_local20 > 0){
m_state = e_inactiveLimit;
m_force = 0;
} else {
m_state = e_atUpperLimit;
m_positionImpulse = 0;
};
if (_local18 < m_maxLength1){
m_limitState1 = e_inactiveLimit;
m_limitForce1 = 0;
} else {
m_limitState1 = e_atUpperLimit;
m_limitPositionImpulse1 = 0;
};
if (_local19 < m_maxLength2){
m_limitState2 = e_inactiveLimit;
m_limitForce2 = 0;
} else {
m_limitState2 = e_atUpperLimit;
m_limitPositionImpulse2 = 0;
};
var _local21:Number = ((_local5 * m_u1.y) - (_local6 * m_u1.x));
var _local22:Number = ((_local8 * m_u2.y) - (_local9 * m_u2.x));
m_limitMass1 = (_local2.m_invMass + ((_local2.m_invI * _local21) * _local21));
m_limitMass2 = (_local3.m_invMass + ((_local3.m_invI * _local22) * _local22));
m_pulleyMass = (m_limitMass1 + ((m_ratio * m_ratio) * m_limitMass2));
m_limitMass1 = (1 / m_limitMass1);
m_limitMass2 = (1 / m_limitMass2);
m_pulleyMass = (1 / m_pulleyMass);
if (_arg1.warmStarting){
_local23 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.x);
_local24 = ((_arg1.dt * (-(m_force) - m_limitForce1)) * m_u1.y);
_local25 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.x);
_local26 = ((_arg1.dt * ((-(m_ratio) * m_force) - m_limitForce2)) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local23));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local24));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local24) - (_local6 * _local23))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local25));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local26));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local26) - (_local9 * _local25))));
} else {
m_force = 0;
m_limitForce1 = 0;
m_limitForce2 = 0;
};
}
override public function 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.m_sweep.localCenter.x);
var _local6:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
var _local7:Number = ((_local4.col1.x * _local5) + (_local4.col2.x * _local6));
_local6 = ((_local4.col1.y * _local5) + (_local4.col2.y * _local6));
_local5 = _local7;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local7 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local7;
if (m_state == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = (-(((m_u1.x * _local10) + (m_u1.y * _local11))) - (m_ratio * ((m_u2.x * _local12) + (m_u2.y * _local13))));
_local19 = ((-(_arg1.inv_dt) * m_pulleyMass) * _local18);
_local20 = m_force;
m_force = b2Math.b2Max(0, (m_force + _local19));
_local19 = (m_force - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * m_u1.y);
_local16 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.x);
_local17 = (((-(_arg1.dt) * m_ratio) * _local19) * m_u2.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
if (m_limitState1 == e_atUpperLimit){
_local10 = (_local2.m_linearVelocity.x + (-(_local2.m_angularVelocity) * _local6));
_local11 = (_local2.m_linearVelocity.y + (_local2.m_angularVelocity * _local5));
_local18 = -(((m_u1.x * _local10) + (m_u1.y * _local11)));
_local19 = ((-(_arg1.inv_dt) * m_limitMass1) * _local18);
_local20 = m_limitForce1;
m_limitForce1 = b2Math.b2Max(0, (m_limitForce1 + _local19));
_local19 = (m_limitForce1 - _local20);
_local14 = ((-(_arg1.dt) * _local19) * m_u1.x);
_local15 = ((-(_arg1.dt) * _local19) * m_u1.y);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x + (_local2.m_invMass * _local14));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y + (_local2.m_invMass * _local15));
_local2.m_angularVelocity = (_local2.m_angularVelocity + (_local2.m_invI * ((_local5 * _local15) - (_local6 * _local14))));
};
if (m_limitState2 == e_atUpperLimit){
_local12 = (_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9));
_local13 = (_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8));
_local18 = -(((m_u2.x * _local12) + (m_u2.y * _local13)));
_local19 = ((-(_arg1.inv_dt) * m_limitMass2) * _local18);
_local20 = m_limitForce2;
m_limitForce2 = b2Math.b2Max(0, (m_limitForce2 + _local19));
_local19 = (m_limitForce2 - _local20);
_local16 = ((-(_arg1.dt) * _local19) * m_u2.x);
_local17 = ((-(_arg1.dt) * _local19) * m_u2.y);
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local16));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local17));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local17) - (_local9 * _local16))));
};
}
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 288
//b2PulleyJointDef (Box2D.Dynamics.Joints.b2PulleyJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
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 289
//b2RevoluteJoint (Box2D.Dynamics.Joints.b2RevoluteJoint)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
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 _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local2:b2Body = m_body1;
var _local3:b2Body = m_body2;
_local4 = _local2.m_xf.R;
var _local6:Number = (m_localAnchor1.x - _local2.m_sweep.localCenter.x);
var _local7:Number = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
var _local11:Number = (((_local3.m_linearVelocity.x + (-(_local3.m_angularVelocity) * _local9)) - _local2.m_linearVelocity.x) - (-(_local2.m_angularVelocity) * _local7));
var _local12:Number = (((_local3.m_linearVelocity.y + (_local3.m_angularVelocity * _local8)) - _local2.m_linearVelocity.y) - (_local2.m_angularVelocity * _local6));
var _local13:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.x * _local11) + (m_pivotMass.col2.x * _local12)));
var _local14:Number = (-(_arg1.inv_dt) * ((m_pivotMass.col1.y * _local11) + (m_pivotMass.col2.y * _local12)));
m_pivotForce.x = (m_pivotForce.x + _local13);
m_pivotForce.y = (m_pivotForce.y + _local14);
var _local15:Number = (_arg1.dt * _local13);
var _local16:Number = (_arg1.dt * _local14);
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - (_local2.m_invMass * _local15));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - (_local2.m_invMass * _local16));
_local2.m_angularVelocity = (_local2.m_angularVelocity - (_local2.m_invI * ((_local6 * _local16) - (_local7 * _local15))));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + (_local3.m_invMass * _local15));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + (_local3.m_invMass * _local16));
_local3.m_angularVelocity = (_local3.m_angularVelocity + (_local3.m_invI * ((_local8 * _local16) - (_local9 * _local15))));
if (((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.m_sweep.localCenter.x);
var _local8:Number = (m_localAnchor1.y - _local3.m_sweep.localCenter.y);
var _local9:Number = ((_local6.col1.x * _local7) + (_local6.col2.x * _local8));
_local8 = ((_local6.col1.y * _local7) + (_local6.col2.y * _local8));
_local7 = _local9;
_local6 = _local4.m_xf.R;
var _local10:Number = (m_localAnchor2.x - _local4.m_sweep.localCenter.x);
var _local11:Number = (m_localAnchor2.y - _local4.m_sweep.localCenter.y);
_local9 = ((_local6.col1.x * _local10) + (_local6.col2.x * _local11));
_local11 = ((_local6.col1.y * _local10) + (_local6.col2.y * _local11));
_local10 = _local9;
var _local12:Number = (_local3.m_sweep.c.x + _local7);
var _local13:Number = (_local3.m_sweep.c.y + _local8);
var _local14:Number = (_local4.m_sweep.c.x + _local10);
var _local15:Number = (_local4.m_sweep.c.y + _local11);
var _local16:Number = (_local14 - _local12);
var _local17:Number = (_local15 - _local13);
_local5 = Math.sqrt(((_local16 * _local16) + (_local17 * _local17)));
var _local18:Number = _local3.m_invMass;
var _local19:Number = _local4.m_invMass;
var _local20:Number = _local3.m_invI;
var _local21:Number = _local4.m_invI;
K1.col1.x = (_local18 + _local19);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local18 + _local19);
K2.col1.x = ((_local20 * _local8) * _local8);
K2.col2.x = ((-(_local20) * _local7) * _local8);
K2.col1.y = ((-(_local20) * _local7) * _local8);
K2.col2.y = ((_local20 * _local7) * _local7);
K3.col1.x = ((_local21 * _local11) * _local11);
K3.col2.x = ((-(_local21) * _local10) * _local11);
K3.col1.y = ((-(_local21) * _local10) * _local11);
K3.col2.y = ((_local21 * _local10) * _local10);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Solve(tImpulse, -(_local16), -(_local17));
var _local22:Number = tImpulse.x;
var _local23:Number = tImpulse.y;
_local3.m_sweep.c.x = (_local3.m_sweep.c.x - (_local3.m_invMass * _local22));
_local3.m_sweep.c.y = (_local3.m_sweep.c.y - (_local3.m_invMass * _local23));
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * ((_local7 * _local23) - (_local8 * _local22))));
_local4.m_sweep.c.x = (_local4.m_sweep.c.x + (_local4.m_invMass * _local22));
_local4.m_sweep.c.y = (_local4.m_sweep.c.y + (_local4.m_invMass * _local23));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * ((_local10 * _local23) - (_local11 * _local22))));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
var _local24:Number = 0;
if (((m_enableLimit) && (!((m_limitState == e_inactiveLimit))))){
_local25 = ((_local4.m_sweep.a - _local3.m_sweep.a) - m_referenceAngle);
_local26 = 0;
if (m_limitState == e_equalLimits){
_local2 = b2Math.b2Clamp(_local25, -(b2Settings.b2_maxAngularCorrection), b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local24 = b2Math.b2Abs(_local2);
} else {
if (m_limitState == e_atLowerLimit){
_local2 = (_local25 - m_lowerAngle);
_local24 = b2Math.b2Max(0, -(_local2));
_local2 = b2Math.b2Clamp((_local2 + b2Settings.b2_angularSlop), -(b2Settings.b2_maxAngularCorrection), 0);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Max((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
} else {
if (m_limitState == e_atUpperLimit){
_local2 = (_local25 - m_upperAngle);
_local24 = b2Math.b2Max(0, _local2);
_local2 = b2Math.b2Clamp((_local2 - b2Settings.b2_angularSlop), 0, b2Settings.b2_maxAngularCorrection);
_local26 = (-(m_motorMass) * _local2);
_local1 = m_limitPositionImpulse;
m_limitPositionImpulse = b2Math.b2Min((m_limitPositionImpulse + _local26), 0);
_local26 = (m_limitPositionImpulse - _local1);
};
};
};
_local3.m_sweep.a = (_local3.m_sweep.a - (_local3.m_invI * _local26));
_local4.m_sweep.a = (_local4.m_sweep.a + (_local4.m_invI * _local26));
_local3.SynchronizeTransform();
_local4.SynchronizeTransform();
};
return ((((_local5 <= b2Settings.b2_linearSlop)) && ((_local24 <= b2Settings.b2_angularSlop))));
}
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.m_sweep.localCenter.x);
_local7 = (m_localAnchor1.y - _local2.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local6) + (_local4.col2.x * _local7));
_local7 = ((_local4.col1.y * _local6) + (_local4.col2.y * _local7));
_local6 = _local5;
_local4 = _local3.m_xf.R;
var _local8:Number = (m_localAnchor2.x - _local3.m_sweep.localCenter.x);
var _local9:Number = (m_localAnchor2.y - _local3.m_sweep.localCenter.y);
_local5 = ((_local4.col1.x * _local8) + (_local4.col2.x * _local9));
_local9 = ((_local4.col1.y * _local8) + (_local4.col2.y * _local9));
_local8 = _local5;
var _local10:Number = _local2.m_invMass;
var _local11:Number = _local3.m_invMass;
var _local12:Number = _local2.m_invI;
var _local13:Number = _local3.m_invI;
K1.col1.x = (_local10 + _local11);
K1.col2.x = 0;
K1.col1.y = 0;
K1.col2.y = (_local10 + _local11);
K2.col1.x = ((_local12 * _local7) * _local7);
K2.col2.x = ((-(_local12) * _local6) * _local7);
K2.col1.y = ((-(_local12) * _local6) * _local7);
K2.col2.y = ((_local12 * _local6) * _local6);
K3.col1.x = ((_local13 * _local9) * _local9);
K3.col2.x = ((-(_local13) * _local8) * _local9);
K3.col1.y = ((-(_local13) * _local8) * _local9);
K3.col2.y = ((_local13 * _local8) * _local8);
K.SetM(K1);
K.AddM(K2);
K.AddM(K3);
K.Invert(m_pivotMass);
m_motorMass = (1 / (_local12 + _local13));
if (m_enableMotor == false){
m_motorForce = 0;
};
if (m_enableLimit){
_local14 = ((_local3.m_sweep.a - _local2.m_sweep.a) - m_referenceAngle);
if (b2Math.b2Abs((m_upperAngle - m_lowerAngle)) < (2 * b2Settings.b2_angularSlop)){
m_limitState = e_equalLimits;
} else {
if (_local14 <= m_lowerAngle){
if (m_limitState != e_atLowerLimit){
m_limitForce = 0;
};
m_limitState = e_atLowerLimit;
} else {
if (_local14 >= m_upperAngle){
if (m_limitState != e_atUpperLimit){
m_limitForce = 0;
};
m_limitState = e_atUpperLimit;
} else {
m_limitState = e_inactiveLimit;
m_limitForce = 0;
};
};
};
} else {
m_limitForce = 0;
};
if (_arg1.warmStarting){
_local2.m_linearVelocity.x = (_local2.m_linearVelocity.x - ((_arg1.dt * _local10) * m_pivotForce.x));
_local2.m_linearVelocity.y = (_local2.m_linearVelocity.y - ((_arg1.dt * _local10) * m_pivotForce.y));
_local2.m_angularVelocity = (_local2.m_angularVelocity - ((_arg1.dt * _local12) * ((((_local6 * m_pivotForce.y) - (_local7 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
_local3.m_linearVelocity.x = (_local3.m_linearVelocity.x + ((_arg1.dt * _local11) * m_pivotForce.x));
_local3.m_linearVelocity.y = (_local3.m_linearVelocity.y + ((_arg1.dt * _local11) * m_pivotForce.y));
_local3.m_angularVelocity = (_local3.m_angularVelocity + ((_arg1.dt * _local13) * ((((_local8 * m_pivotForce.y) - (_local9 * m_pivotForce.x)) + m_motorForce) + m_limitForce)));
} else {
m_pivotForce.SetZero();
m_motorForce = 0;
m_limitForce = 0;
};
m_limitPositionImpulse = 0;
}
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 290
//b2RevoluteJointDef (Box2D.Dynamics.Joints.b2RevoluteJointDef)
package Box2D.Dynamics.Joints {
import Box2D.Dynamics.*;
import Box2D.Common.Math.*;
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 291
//b2Body (Box2D.Dynamics.b2Body)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Dynamics.Contacts.*;
public class b2Body {
public var m_next:b2Body;
public var m_xf:b2XForm;
public var bodyKindID:int;// = -1
public var m_contactList:b2ContactEdge;
public var m_angularVelocity:Number;
public var m_shapeList:b2Shape;
public var m_force:b2Vec2;
public var m_mass:Number;
public var m_sweep:b2Sweep;
public var m_torque:Number;
public var m_userData;
public var m_flags:uint;
public var m_world:b2World;
public var m_prev:b2Body;
public var m_invMass:Number;
public var m_type:int;
public var m_linearDamping:Number;
public var m_shapeCount:int;
public var m_angularDamping:Number;
public var m_invI:Number;
public var m_linearVelocity:b2Vec2;
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:b2World){
m_xf = new b2XForm();
m_sweep = new b2Sweep();
m_linearVelocity = new b2Vec2();
m_force = new b2Vec2();
super();
m_flags = 0;
if (_arg1.isBullet){
m_flags = (m_flags | e_bulletFlag);
};
if (_arg1.fixedRotation){
m_flags = (m_flags | e_fixedRotationFlag);
};
if (_arg1.allowSleep){
m_flags = (m_flags | e_allowSleepFlag);
};
if (_arg1.isSleeping){
m_flags = (m_flags | e_sleepFlag);
};
m_world = _arg2;
m_xf.position.SetV(_arg1.position);
m_xf.R.Set(_arg1.angle);
m_sweep.localCenter.SetV(_arg1.massData.center);
m_sweep.t0 = 1;
m_sweep.a0 = (m_sweep.a = _arg1.angle);
var _local3:b2Mat22 = m_xf.R;
var _local4:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
m_jointList = null;
m_contactList = null;
m_prev = null;
m_next = null;
m_linearDamping = _arg1.linearDamping;
m_angularDamping = _arg1.angularDamping;
m_force.Set(0, 0);
m_torque = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_sleepTime = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.massData.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.massData.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
m_userData = _arg1.userData;
m_shapeList = null;
m_shapeCount = 0;
}
public function GetLinearVelocityFromWorldPoint(_arg1:b2Vec2):b2Vec2{
return (new b2Vec2((m_linearVelocity.x - (m_angularVelocity * (_arg1.y - m_sweep.c.y))), (m_linearVelocity.y + (m_angularVelocity * (_arg1.x - m_sweep.c.x)))));
}
public function SetLinearVelocity(_arg1:b2Vec2):void{
m_linearVelocity.SetV(_arg1);
}
public function WakeUp():void{
m_world.onBodyWakeUp(this);
m_flags = (m_flags & ~(e_sleepFlag));
m_sleepTime = 0;
}
public function GetLocalCenter():b2Vec2{
return (m_sweep.localCenter);
}
public function ApplyTorque(_arg1:Number):void{
if (IsSleeping()){
WakeUp();
};
m_torque = (m_torque + _arg1);
}
public function IsFrozen():Boolean{
return (((m_flags & e_frozenFlag) == e_frozenFlag));
}
public function IsDynamic():Boolean{
return ((m_type == e_dynamicType));
}
public function GetLinearVelocity():b2Vec2{
return (m_linearVelocity);
}
public function SynchronizeTransform():void{
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 IsSleeping():Boolean{
return (((m_flags & e_sleepFlag) == e_sleepFlag));
}
public function SetMassFromShapes():void{
var _local1:b2Shape;
if (m_world.m_lock == true){
return;
};
m_mass = 0;
m_invMass = 0;
m_I = 0;
m_invI = 0;
var _local2:Number = 0;
var _local3:Number = 0;
var _local4:b2MassData = s_massData;
_local1 = m_shapeList;
while (_local1) {
_local1.ComputeMass(_local4);
m_mass = (m_mass + _local4.mass);
_local2 = (_local2 + (_local4.mass * _local4.center.x));
_local3 = (_local3 + (_local4.mass * _local4.center.y));
m_I = (m_I + _local4.I);
_local1 = _local1.m_next;
};
if (m_mass > 0){
m_invMass = (1 / m_mass);
_local2 = (_local2 * m_invMass);
_local3 = (_local3 * m_invMass);
};
if ((((m_I > 0)) && (((m_flags & e_fixedRotationFlag) == 0)))){
m_I = (m_I - (m_mass * ((_local2 * _local2) + (_local3 * _local3))));
m_invI = (1 / m_I);
} else {
m_I = 0;
m_invI = 0;
};
m_sweep.localCenter.Set(_local2, _local3);
var _local5:b2Mat22 = m_xf.R;
var _local6:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local5.col1.x * _local6.x) + (_local5.col2.x * _local6.y));
m_sweep.c.y = ((_local5.col1.y * _local6.x) + (_local5.col2.y * _local6.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
_local1 = m_shapeList;
while (_local1) {
_local1.UpdateSweepRadius(m_sweep.localCenter);
_local1 = _local1.m_next;
};
var _local7:int = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local7 != m_type){
_local1 = m_shapeList;
while (_local1) {
_local1.RefilterProxy(m_world.m_broadPhase, m_xf);
_local1 = _local1.m_next;
};
};
}
public function PutToSleep():void{
m_flags = (m_flags | e_sleepFlag);
m_sleepTime = 0;
m_linearVelocity.SetZero();
m_angularVelocity = 0;
m_force.SetZero();
m_torque = 0;
}
public function GetJointList():b2JointEdge{
return (m_jointList);
}
public function SetXForm(_arg1:b2Vec2, _arg2:Number):Boolean{
var _local3:b2Shape;
var _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 GetLocalPoint(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulXT(m_xf, _arg1));
}
public function ApplyForce(_arg1:b2Vec2, _arg2:b2Vec2):void{
if (IsSleeping()){
WakeUp();
};
m_force.x = (m_force.x + _arg1.x);
m_force.y = (m_force.y + _arg1.y);
m_torque = (m_torque + (((_arg2.x - m_sweep.c.x) * _arg1.y) - ((_arg2.y - m_sweep.c.y) * _arg1.x)));
}
public function SynchronizeShapes():Boolean{
var _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 GetLinearVelocityFromLocalPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22 = m_xf.R;
var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (new b2Vec2((m_linearVelocity.x + (m_angularVelocity * (_local3.y - m_sweep.c.y))), (m_linearVelocity.x - (m_angularVelocity * (_local3.x - m_sweep.c.x)))));
}
public function GetNext():b2Body{
return (m_next);
}
public function GetMass():Number{
return (m_mass);
}
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 GetAngularVelocity():Number{
return (m_angularVelocity);
}
public function SetAngularVelocity(_arg1:Number):void{
m_angularVelocity = _arg1;
}
public function SetMass(_arg1:b2MassData):void{
var _local2:b2Shape;
if (m_world.m_lock == true){
return;
};
m_invMass = 0;
m_I = 0;
m_invI = 0;
m_mass = _arg1.mass;
if (m_mass > 0){
m_invMass = (1 / m_mass);
};
if ((m_flags & b2Body.e_fixedRotationFlag) == 0){
m_I = _arg1.I;
};
if (m_I > 0){
m_invI = (1 / m_I);
};
m_sweep.localCenter.SetV(_arg1.center);
var _local3:b2Mat22 = m_xf.R;
var _local4:b2Vec2 = m_sweep.localCenter;
m_sweep.c.x = ((_local3.col1.x * _local4.x) + (_local3.col2.x * _local4.y));
m_sweep.c.y = ((_local3.col1.y * _local4.x) + (_local3.col2.y * _local4.y));
m_sweep.c.x = (m_sweep.c.x + m_xf.position.x);
m_sweep.c.y = (m_sweep.c.y + m_xf.position.y);
m_sweep.c0.SetV(m_sweep.c);
_local2 = m_shapeList;
while (_local2) {
_local2.UpdateSweepRadius(m_sweep.localCenter);
_local2 = _local2.m_next;
};
var _local5:int = m_type;
if ((((m_invMass == 0)) && ((m_invI == 0)))){
m_type = e_staticType;
} else {
m_type = e_dynamicType;
};
if (_local5 != m_type){
_local2 = m_shapeList;
while (_local2) {
_local2.RefilterProxy(m_world.m_broadPhase, m_xf);
_local2 = _local2.m_next;
};
};
}
public function IsStatic():Boolean{
return ((m_type == e_staticType));
}
public function GetWorldVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulMV(m_xf.R, _arg1));
}
public function GetShapeList():b2Shape{
return (m_shapeList);
}
public function Advance(_arg1:Number):void{
m_sweep.Advance(_arg1);
m_sweep.c.SetV(m_sweep.c0);
m_sweep.a = m_sweep.a0;
SynchronizeTransform();
}
public function SetBullet(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_bulletFlag);
} else {
m_flags = (m_flags & ~(e_bulletFlag));
};
}
public function CreateShape(_arg1:b2ShapeDef):b2Shape{
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:b2Shape;
var _local4:Boolean;
while (_local2 != null) {
if (_local2 == _arg1){
if (_local3){
_local3.m_next = _arg1.m_next;
} else {
m_shapeList = _arg1.m_next;
};
_local4 = true;
break;
};
_local3 = _local2;
_local2 = _local2.m_next;
};
_arg1.m_body = null;
_arg1.m_next = null;
m_shapeCount--;
b2Shape.Destroy(_arg1, m_world.m_blockAllocator);
}
public function GetUserData(){
return (m_userData);
}
public function IsBullet():Boolean{
return (((m_flags & e_bulletFlag) == e_bulletFlag));
}
public function GetWorldCenter():b2Vec2{
return (m_sweep.c);
}
public function AllowSleeping(_arg1:Boolean):void{
if (_arg1){
m_flags = (m_flags | e_allowSleepFlag);
} else {
m_flags = (m_flags & ~(e_allowSleepFlag));
WakeUp();
};
}
public function SetUserData(_arg1):void{
m_userData = _arg1;
}
public function GetLocalVector(_arg1:b2Vec2):b2Vec2{
return (b2Math.b2MulTMV(m_xf.R, _arg1));
}
public function GetWorldPoint(_arg1:b2Vec2):b2Vec2{
var _local2:b2Mat22 = m_xf.R;
var _local3:b2Vec2 = new b2Vec2(((_local2.col1.x * _arg1.x) + (_local2.col2.x * _arg1.y)), ((_local2.col1.y * _arg1.x) + (_local2.col2.y * _arg1.y)));
_local3.x = (_local3.x + m_xf.position.x);
_local3.y = (_local3.y + m_xf.position.y);
return (_local3);
}
public function GetWorld():b2World{
return (m_world);
}
public function GetPosition():b2Vec2{
return (m_xf.position);
}
}
}//package Box2D.Dynamics
Section 292
//b2BodyDef (Box2D.Dynamics.b2BodyDef)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
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 293
//b2BoundaryListener (Box2D.Dynamics.b2BoundaryListener)
package Box2D.Dynamics {
public class b2BoundaryListener {
public function Violation(_arg1:b2Body):void{
}
}
}//package Box2D.Dynamics
Section 294
//b2ContactFilter (Box2D.Dynamics.b2ContactFilter)
package Box2D.Dynamics {
import Box2D.Collision.Shapes.*;
public class b2ContactFilter {
public static var b2_defaultFilter:b2ContactFilter = new (b2ContactFilter);
;
public function ShouldCollide(_arg1:b2Shape, _arg2:b2Shape):Boolean{
var _local3:b2FilterData = _arg1.GetFilterData();
var _local4:b2FilterData = _arg2.GetFilterData();
if ((((_local3.groupIndex == _local4.groupIndex)) && (!((_local3.groupIndex == 0))))){
return ((_local3.groupIndex > 0));
};
var _local5:Boolean = ((!(((_local3.maskBits & _local4.categoryBits) == 0))) && (!(((_local3.categoryBits & _local4.maskBits) == 0))));
return (_local5);
}
}
}//package Box2D.Dynamics
Section 295
//b2ContactListener (Box2D.Dynamics.b2ContactListener)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactListener {
public function Add(_arg1:b2ContactPoint):void{
}
public function Remove(_arg1:b2ContactPoint):void{
}
public function Persist(_arg1:b2ContactPoint):void{
}
public function Result(_arg1:b2ContactResult):void{
}
}
}//package Box2D.Dynamics
Section 296
//b2ContactManager (Box2D.Dynamics.b2ContactManager)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2ContactManager extends b2PairCallback {
public var m_world:b2World;
public var m_destroyImmediate:Boolean;
public var m_nullContact:b2NullContact;
private static const s_evalCP:b2ContactPoint = new b2ContactPoint();
public function b2ContactManager(){
m_nullContact = new b2NullContact();
super();
m_world = null;
m_destroyImmediate = false;
}
override public function PairRemoved(_arg1, _arg2, _arg3):void{
if (_arg3 == null){
return;
};
var _local4:b2Contact = (_arg3 as b2Contact);
if (_local4 == m_nullContact){
return;
};
Destroy(_local4);
}
public function Destroy(_arg1:b2Contact):void{
var _local7:b2Body;
var _local8:b2Body;
var _local9:Array;
var _local10:b2ContactPoint;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2Vec2;
var _local16:b2Vec2;
var _local2:b2Shape = _arg1.m_shape1;
var _local3:b2Shape = _arg1.m_shape2;
var _local4:int = _arg1.m_manifoldCount;
if ((((_local4 > 0)) && (m_world.m_contactListener))){
_local7 = _local2.m_body;
_local8 = _local3.m_body;
_local9 = _arg1.GetManifolds();
_local10 = s_evalCP;
_local10.shape1 = _arg1.m_shape1;
_local10.shape2 = _arg1.m_shape2;
_local10.friction = _arg1.m_friction;
_local10.restitution = _arg1.m_restitution;
_local11 = 0;
while (_local11 < _local4) {
_local12 = _local9[_local11];
_local10.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local10.position = _local7.GetWorldPoint(_local14.localPoint1);
_local15 = _local7.GetLinearVelocityFromLocalPoint(_local14.localPoint1);
_local16 = _local8.GetLinearVelocityFromLocalPoint(_local14.localPoint2);
_local10.velocity.Set((_local16.x - _local15.x), (_local16.y - _local15.y));
_local10.separation = _local14.separation;
_local10.id.key = _local14.id._key;
m_world.m_contactListener.Remove(_local10);
_local13++;
};
_local11++;
};
};
if (_arg1.m_prev){
_arg1.m_prev.m_next = _arg1.m_next;
};
if (_arg1.m_next){
_arg1.m_next.m_prev = _arg1.m_prev;
};
if (_arg1 == m_world.m_contactList){
m_world.m_contactList = _arg1.m_next;
};
var _local5:b2Body = _local2.m_body;
var _local6:b2Body = _local3.m_body;
if (_arg1.m_node1.prev){
_arg1.m_node1.prev.next = _arg1.m_node1.next;
};
if (_arg1.m_node1.next){
_arg1.m_node1.next.prev = _arg1.m_node1.prev;
};
if (_arg1.m_node1 == _local5.m_contactList){
_local5.m_contactList = _arg1.m_node1.next;
};
if (_arg1.m_node2.prev){
_arg1.m_node2.prev.next = _arg1.m_node2.next;
};
if (_arg1.m_node2.next){
_arg1.m_node2.next.prev = _arg1.m_node2.prev;
};
if (_arg1.m_node2 == _local6.m_contactList){
_local6.m_contactList = _arg1.m_node2.next;
};
b2Contact.Destroy(_arg1, m_world.m_blockAllocator);
m_world.m_contactCount--;
}
override public function PairAdded(_arg1, _arg2){
var _local3:b2Shape = (_arg1 as b2Shape);
var _local4:b2Shape = (_arg2 as b2Shape);
var _local5:b2Body = _local3.m_body;
var _local6:b2Body = _local4.m_body;
if (((_local5.IsStatic()) && (_local6.IsStatic()))){
return (m_nullContact);
};
if (_local3.m_body == _local4.m_body){
return (m_nullContact);
};
if (_local6.IsConnected(_local5)){
return (m_nullContact);
};
if (((!((m_world.m_contactFilter == null))) && ((m_world.m_contactFilter.ShouldCollide(_local3, _local4) == false)))){
return (m_nullContact);
};
var _local7:b2Contact = b2Contact.Create(_local3, _local4, m_world.m_blockAllocator);
if (_local7 == null){
return (m_nullContact);
};
_local3 = _local7.m_shape1;
_local4 = _local7.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local7.m_prev = null;
_local7.m_next = m_world.m_contactList;
if (m_world.m_contactList != null){
m_world.m_contactList.m_prev = _local7;
};
m_world.m_contactList = _local7;
_local7.m_node1.contact = _local7;
_local7.m_node1.other = _local6;
_local7.m_node1.prev = null;
_local7.m_node1.next = _local5.m_contactList;
if (_local5.m_contactList != null){
_local5.m_contactList.prev = _local7.m_node1;
};
_local5.m_contactList = _local7.m_node1;
_local7.m_node2.contact = _local7;
_local7.m_node2.other = _local5;
_local7.m_node2.prev = null;
_local7.m_node2.next = _local6.m_contactList;
if (_local6.m_contactList != null){
_local6.m_contactList.prev = _local7.m_node2;
};
_local6.m_contactList = _local7.m_node2;
m_world.m_contactCount++;
return (_local7);
}
public function Collide():void{
var _local2:b2Body;
var _local3:b2Body;
var _local1:b2Contact = m_world.m_contactList;
while (_local1) {
_local2 = _local1.m_shape1.m_body;
_local3 = _local1.m_shape2.m_body;
if (((_local2.IsSleeping()) && (_local3.IsSleeping()))){
} else {
_local1.Update(m_world.m_contactListener);
};
_local1 = _local1.m_next;
};
}
}
}//package Box2D.Dynamics
Section 297
//b2DebugDraw (Box2D.Dynamics.b2DebugDraw)
package Box2D.Dynamics {
import flash.display.*;
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2DebugDraw {
public var m_xformScale:Number;// = 1
public var m_fillAlpha:Number;// = 1
public var m_alpha:Number;// = 1
public var m_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 298
//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 299
//b2Island (Box2D.Dynamics.b2Island)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2Island {
public var m_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_reportCR:b2ContactResult = new b2ContactResult();
public function b2Island(_arg1:int, _arg2:int, _arg3:int, _arg4, _arg5:b2ContactListener){
var _local6:int;
super();
m_bodyCapacity = _arg1;
m_contactCapacity = _arg2;
m_jointCapacity = _arg3;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_allocator = _arg4;
m_listener = _arg5;
m_bodies = new Array(_arg1);
_local6 = 0;
while (_local6 < _arg1) {
m_bodies[_local6] = null;
_local6++;
};
m_contacts = new Array(_arg2);
_local6 = 0;
while (_local6 < _arg2) {
m_contacts[_local6] = null;
_local6++;
};
m_joints = new Array(_arg3);
_local6 = 0;
while (_local6 < _arg3) {
m_joints[_local6] = null;
_local6++;
};
m_positionIterationCount = 0;
}
public function AddBody(_arg1:b2Body):void{
var _local2 = m_bodyCount++;
m_bodies[_local2] = _arg1;
}
public function AddJoint(_arg1:b2Joint):void{
var _local2 = m_jointCount++;
m_joints[_local2] = _arg1;
}
public function Report(_arg1:Array):void{
var _local2:b2Mat22;
var _local3:b2Vec2;
var _local5:b2Contact;
var _local6:b2ContactConstraint;
var _local7:b2ContactResult;
var _local8:b2Body;
var _local9:int;
var _local10:Array;
var _local11:int;
var _local12:b2Manifold;
var _local13:int;
var _local14:b2ManifoldPoint;
var _local15:b2ContactConstraintPoint;
if (m_listener == null){
return;
};
var _local4:int;
while (_local4 < m_contactCount) {
_local5 = m_contacts[_local4];
_local6 = _arg1[_local4];
_local7 = s_reportCR;
_local7.shape1 = _local5.m_shape1;
_local7.shape2 = _local5.m_shape2;
_local8 = _local7.shape1.m_body;
_local9 = _local5.m_manifoldCount;
_local10 = _local5.GetManifolds();
_local11 = 0;
while (_local11 < _local9) {
_local12 = _local10[_local11];
_local7.normal.SetV(_local12.normal);
_local13 = 0;
while (_local13 < _local12.pointCount) {
_local14 = _local12.points[_local13];
_local15 = _local6.points[_local13];
_local7.position = _local8.GetWorldPoint(_local14.localPoint1);
_local7.normalImpulse = _local15.normalImpulse;
_local7.tangentImpulse = _local15.tangentImpulse;
_local7.id.key = _local14.id.key;
m_listener.Result(_local7);
_local13++;
};
_local11++;
};
_local4++;
};
}
public function 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 _local7:b2Joint;
var _local9:int;
var _local10:Boolean;
var _local11:Boolean;
var _local12:Boolean;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x + (_arg1.dt * (_arg2.x + (_local6.m_invMass * _local6.m_force.x))));
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y + (_arg1.dt * (_arg2.y + (_local6.m_invMass * _local6.m_force.y))));
_local6.m_angularVelocity = (_local6.m_angularVelocity + ((_arg1.dt * _local6.m_invI) * _local6.m_torque));
_local6.m_force.SetZero();
_local6.m_torque = 0;
_local6.m_linearVelocity.Multiply(b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_linearDamping)), 0, 1));
_local6.m_angularVelocity = (_local6.m_angularVelocity * b2Math.b2Clamp((1 - (_arg1.dt * _local6.m_angularDamping)), 0, 1));
if (_local6.m_linearVelocity.LengthSquared() > b2Settings.b2_maxLinearVelocitySquared){
_local6.m_linearVelocity.Normalize();
_local6.m_linearVelocity.x = (_local6.m_linearVelocity.x * b2Settings.b2_maxLinearVelocity);
_local6.m_linearVelocity.y = (_local6.m_linearVelocity.y * b2Settings.b2_maxLinearVelocity);
};
if ((_local6.m_angularVelocity * _local6.m_angularVelocity) > b2Settings.b2_maxAngularVelocitySquared){
if (_local6.m_angularVelocity < 0){
_local6.m_angularVelocity = -(b2Settings.b2_maxAngularVelocity);
} else {
_local6.m_angularVelocity = b2Settings.b2_maxAngularVelocity;
};
};
};
_local5++;
};
var _local8:b2ContactSolver = new b2ContactSolver(_arg1, m_contacts, m_contactCount, m_allocator);
_local8.InitVelocityConstraints(_arg1);
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitVelocityConstraints(_arg1);
_local5++;
};
_local5 = 0;
while (_local5 < _arg1.maxIterations) {
_local8.SolveVelocityConstraints();
_local9 = 0;
while (_local9 < m_jointCount) {
_local7 = m_joints[_local9];
_local7.SolveVelocityConstraints(_arg1);
_local9++;
};
_local5++;
};
_local8.FinalizeVelocityConstraints();
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.IsStatic()){
} else {
_local6.m_sweep.c0.SetV(_local6.m_sweep.c);
_local6.m_sweep.a0 = _local6.m_sweep.a;
_local6.m_sweep.c.x = (_local6.m_sweep.c.x + (_arg1.dt * _local6.m_linearVelocity.x));
_local6.m_sweep.c.y = (_local6.m_sweep.c.y + (_arg1.dt * _local6.m_linearVelocity.y));
_local6.m_sweep.a = (_local6.m_sweep.a + (_arg1.dt * _local6.m_angularVelocity));
_local6.SynchronizeTransform();
};
_local5++;
};
if (_arg3){
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local7.InitPositionConstraints();
_local5++;
};
m_positionIterationCount = 0;
while (m_positionIterationCount < _arg1.maxIterations) {
_local10 = _local8.SolvePositionConstraints(b2Settings.b2_contactBaumgarte);
_local11 = true;
_local5 = 0;
while (_local5 < m_jointCount) {
_local7 = m_joints[_local5];
_local12 = _local7.SolvePositionConstraints();
_local11 = ((_local11) && (_local12));
_local5++;
};
if (((_local10) && (_local11))){
break;
};
m_positionIterationCount++;
};
};
Report(_local8.m_constraints);
if (_arg4){
_local13 = Number.MAX_VALUE;
_local14 = (b2Settings.b2_linearSleepTolerance * b2Settings.b2_linearSleepTolerance);
_local15 = (b2Settings.b2_angularSleepTolerance * b2Settings.b2_angularSleepTolerance);
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
if (_local6.m_invMass == 0){
} else {
if ((_local6.m_flags & b2Body.e_allowSleepFlag) == 0){
_local6.m_sleepTime = 0;
_local13 = 0;
};
if (((((((_local6.m_flags & b2Body.e_allowSleepFlag) == 0)) || (((_local6.m_angularVelocity * _local6.m_angularVelocity) > _local15)))) || ((b2Math.b2Dot(_local6.m_linearVelocity, _local6.m_linearVelocity) > _local14)))){
_local6.m_sleepTime = 0;
_local13 = 0;
} else {
_local6.m_sleepTime = (_local6.m_sleepTime + _arg1.dt);
_local13 = b2Math.b2Min(_local13, _local6.m_sleepTime);
};
};
_local5++;
};
if (_local13 >= b2Settings.b2_timeToSleep){
_local5 = 0;
while (_local5 < m_bodyCount) {
_local6 = m_bodies[_local5];
m_bodies[_local5].m_flags = (_local6.m_flags | b2Body.e_sleepFlag);
_local6.m_linearVelocity.SetZero();
_local6.m_angularVelocity = 0;
_local5++;
};
};
};
}
public function 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 300
//b2TimeStep (Box2D.Dynamics.b2TimeStep)
package Box2D.Dynamics {
public class b2TimeStep {
public var warmStarting:Boolean;
public var positionCorrection:Boolean;
public var dt:Number;
public var maxIterations:int;
public var dtRatio:Number;
public var inv_dt:Number;
}
}//package Box2D.Dynamics
Section 301
//b2World (Box2D.Dynamics.b2World)
package Box2D.Dynamics {
import Box2D.Collision.*;
import Box2D.Collision.Shapes.*;
import Box2D.Common.Math.*;
import Box2D.Dynamics.Joints.*;
import Box2D.Common.*;
import Box2D.Dynamics.Contacts.*;
public class b2World {
public var m_inv_dt0:Number;
public var m_boundaryListener:b2BoundaryListener;
public var m_contactList:b2Contact;
public var m_blockAllocator;
public var m_contactListener:b2ContactListener;
public var m_allowSleep:Boolean;
public var m_broadPhase:b2BroadPhase;
public var m_destructionListener:b2DestructionListener;
public var m_jointCount:int;
public var m_bodyCount:int;
public var m_lock:Boolean;
public var onBodyWakeUpCallback:Function;
public var m_positionIterationCount:int;
public var m_groundBody:b2Body;
public var m_contactCount:int;
public var m_debugDraw:b2DebugDraw;
public var m_contactFilter:b2ContactFilter;
public var m_bodyList:b2Body;
public var m_stackAllocator;
public var m_jointList:b2Joint;
public var m_gravity:b2Vec2;
public var m_contactManager:b2ContactManager;
private static var s_jointColor:b2Color = new b2Color(0.5, 0.8, 0.8);
public static var m_continuousPhysics:Boolean;
public static var m_warmStarting:Boolean;
private static var s_coreColor:b2Color = new b2Color(0.9, 0.6, 0.6);
public static var m_positionCorrection:Boolean;
private static var s_xf:b2XForm = new b2XForm();
public function b2World(_arg1:b2AABB, _arg2:b2Vec2, _arg3:Boolean){
m_contactManager = new b2ContactManager();
super();
m_destructionListener = null;
m_boundaryListener = null;
m_contactFilter = b2ContactFilter.b2_defaultFilter;
m_contactListener = null;
m_debugDraw = null;
m_bodyList = null;
m_contactList = null;
m_jointList = null;
m_bodyCount = 0;
m_contactCount = 0;
m_jointCount = 0;
m_positionCorrection = true;
m_warmStarting = true;
m_continuousPhysics = true;
m_allowSleep = _arg3;
m_gravity = _arg2;
m_lock = false;
m_inv_dt0 = 0;
m_contactManager.m_world = this;
m_broadPhase = new b2BroadPhase(_arg1, m_contactManager);
var _local4:b2BodyDef = new b2BodyDef();
m_groundBody = CreateBody(_local4);
}
public function DrawJoint(_arg1:b2Joint):void{
var _local11:b2PulleyJoint;
var _local12:b2Vec2;
var _local13:b2Vec2;
var _local2:b2Body = _arg1.m_body1;
var _local3:b2Body = _arg1.m_body2;
var _local4:b2XForm = _local2.m_xf;
var _local5:b2XForm = _local3.m_xf;
var _local6:b2Vec2 = _local4.position;
var _local7:b2Vec2 = _local5.position;
var _local8:b2Vec2 = _arg1.GetAnchor1();
var _local9:b2Vec2 = _arg1.GetAnchor2();
var _local10:b2Color = s_jointColor;
switch (_arg1.m_type){
case b2Joint.e_distanceJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
case b2Joint.e_pulleyJoint:
_local11 = (_arg1 as b2PulleyJoint);
_local12 = _local11.GetGroundAnchor1();
_local13 = _local11.GetGroundAnchor2();
m_debugDraw.DrawSegment(_local12, _local8, _local10);
m_debugDraw.DrawSegment(_local13, _local9, _local10);
m_debugDraw.DrawSegment(_local12, _local13, _local10);
break;
case b2Joint.e_mouseJoint:
m_debugDraw.DrawSegment(_local8, _local9, _local10);
break;
default:
if (_local2 != m_groundBody){
m_debugDraw.DrawSegment(_local6, _local8, _local10);
};
m_debugDraw.DrawSegment(_local8, _local9, _local10);
if (_local3 != m_groundBody){
m_debugDraw.DrawSegment(_local7, _local9, _local10);
};
};
}
public function Refilter(_arg1:b2Shape):void{
_arg1.RefilterProxy(m_broadPhase, _arg1.m_body.m_xf);
}
public function SetDebugDraw(_arg1:b2DebugDraw):void{
m_debugDraw = _arg1;
}
public function SetContinuousPhysics(_arg1:Boolean):void{
m_continuousPhysics = _arg1;
}
public function GetProxyCount():int{
return (m_broadPhase.m_proxyCount);
}
public function DrawDebugData():void{
var _local2:int;
var _local3:b2Body;
var _local4:b2Shape;
var _local5:b2Joint;
var _local6:b2BroadPhase;
var _local11:b2XForm;
var _local15:Boolean;
var _local16:uint;
var _local17:b2Pair;
var _local18:b2Proxy;
var _local19:b2Proxy;
var _local20:b2Vec2;
var _local21:b2Vec2;
var _local22:b2Proxy;
var _local23:b2PolygonShape;
var _local24:b2OBB;
var _local25:b2Vec2;
var _local26:b2Mat22;
var _local27:b2Vec2;
var _local28:Number;
if (m_debugDraw == null){
return;
};
m_debugDraw.m_sprite.graphics.clear();
var _local1:uint = m_debugDraw.GetFlags();
var _local7:b2Vec2 = new b2Vec2();
var _local8:b2Vec2 = new b2Vec2();
var _local9:b2Vec2 = new b2Vec2();
var _local10:b2Color = new b2Color(0, 0, 0);
var _local12:b2AABB = new b2AABB();
var _local13:b2AABB = new b2AABB();
var _local14:Array = [new b2Vec2(), new b2Vec2(), new b2Vec2(), new b2Vec2()];
if ((_local1 & b2DebugDraw.e_shapeBit)){
_local15 = ((_local1 & b2DebugDraw.e_coreShapeBit) == b2DebugDraw.e_coreShapeBit);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local3.IsStatic()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.9, 0.5), _local15);
} else {
if (_local3.IsSleeping()){
DrawShape(_local4, _local11, new b2Color(0.5, 0.5, 0.9), _local15);
} else {
DrawShape(_local4, _local11, new b2Color(0.9, 0.9, 0.9), _local15);
};
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_jointBit)){
_local5 = m_jointList;
while (_local5) {
DrawJoint(_local5);
_local5 = _local5.m_next;
};
};
if ((_local1 & b2DebugDraw.e_pairBit)){
_local6 = m_broadPhase;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.9, 0.3);
_local2 = 0;
while (_local2 < b2Pair.b2_tableCapacity) {
_local16 = _local6.m_pairManager.m_hashTable[_local2];
while (_local16 != b2Pair.b2_nullPair) {
_local17 = _local6.m_pairManager.m_pairs[_local16];
_local18 = _local6.m_proxyPool[_local17.proxyId1];
_local19 = _local6.m_proxyPool[_local17.proxyId2];
_local12.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.lowerBounds[0]].value));
_local12.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.lowerBounds[1]].value));
_local12.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local18.upperBounds[0]].value));
_local12.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local18.upperBounds[1]].value));
_local13.lowerBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.lowerBounds[0]].value));
_local13.lowerBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.lowerBounds[1]].value));
_local13.upperBound.x = (_local6.m_worldAABB.lowerBound.x + (_local7.x * _local6.m_bounds[0][_local19.upperBounds[0]].value));
_local13.upperBound.y = (_local6.m_worldAABB.lowerBound.y + (_local7.y * _local6.m_bounds[1][_local19.upperBounds[1]].value));
_local8.x = (0.5 * (_local12.lowerBound.x + _local12.upperBound.x));
_local8.y = (0.5 * (_local12.lowerBound.y + _local12.upperBound.y));
_local9.x = (0.5 * (_local13.lowerBound.x + _local13.upperBound.x));
_local9.y = (0.5 * (_local13.lowerBound.y + _local13.upperBound.y));
m_debugDraw.DrawSegment(_local8, _local9, _local10);
_local16 = _local17.next;
};
_local2++;
};
};
if ((_local1 & b2DebugDraw.e_aabbBit)){
_local6 = m_broadPhase;
_local20 = _local6.m_worldAABB.lowerBound;
_local21 = _local6.m_worldAABB.upperBound;
_local7.Set((1 / _local6.m_quantizationFactor.x), (1 / _local6.m_quantizationFactor.y));
_local10.Set(0.9, 0.3, 0.9);
_local2 = 0;
while (_local2 < b2Settings.b2_maxProxies) {
_local22 = _local6.m_proxyPool[_local2];
if (_local22.IsValid() == false){
} else {
_local12.lowerBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.lowerBounds[0]].value));
_local12.lowerBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.lowerBounds[1]].value));
_local12.upperBound.x = (_local20.x + (_local7.x * _local6.m_bounds[0][_local22.upperBounds[0]].value));
_local12.upperBound.y = (_local20.y + (_local7.y * _local6.m_bounds[1][_local22.upperBounds[1]].value));
_local14[0].Set(_local12.lowerBound.x, _local12.lowerBound.y);
_local14[1].Set(_local12.upperBound.x, _local12.lowerBound.y);
_local14[2].Set(_local12.upperBound.x, _local12.upperBound.y);
_local14[3].Set(_local12.lowerBound.x, _local12.upperBound.y);
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local2++;
};
_local14[0].Set(_local20.x, _local20.y);
_local14[1].Set(_local21.x, _local20.y);
_local14[2].Set(_local21.x, _local21.y);
_local14[3].Set(_local20.x, _local21.y);
m_debugDraw.DrawPolygon(_local14, 4, new b2Color(0.3, 0.9, 0.9));
};
if ((_local1 & b2DebugDraw.e_obbBit)){
_local10.Set(0.5, 0.3, 0.5);
_local3 = m_bodyList;
while (_local3) {
_local11 = _local3.m_xf;
_local4 = _local3.GetShapeList();
while (_local4) {
if (_local4.m_type != b2Shape.e_polygonShape){
} else {
_local23 = (_local4 as b2PolygonShape);
_local24 = _local23.GetOBB();
_local25 = _local24.extents;
_local14[0].Set(-(_local25.x), -(_local25.y));
_local14[1].Set(_local25.x, -(_local25.y));
_local14[2].Set(_local25.x, _local25.y);
_local14[3].Set(-(_local25.x), _local25.y);
_local2 = 0;
while (_local2 < 4) {
_local26 = _local24.R;
_local27 = _local14[_local2];
_local28 = (_local24.center.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local24.center.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local26 = _local11.R;
_local28 = (_local11.position.x + ((_local26.col1.x * _local27.x) + (_local26.col2.x * _local27.y)));
_local14[_local2].y = (_local11.position.y + ((_local26.col1.y * _local27.x) + (_local26.col2.y * _local27.y)));
_local14[_local2].x = _local28;
_local2++;
};
m_debugDraw.DrawPolygon(_local14, 4, _local10);
};
_local4 = _local4.m_next;
};
_local3 = _local3.m_next;
};
};
if ((_local1 & b2DebugDraw.e_centerOfMassBit)){
_local3 = m_bodyList;
while (_local3) {
_local11 = s_xf;
_local11.R = _local3.m_xf.R;
_local11.position = _local3.GetWorldCenter();
m_debugDraw.DrawXForm(_local11);
_local3 = _local3.m_next;
};
};
}
public function 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 SetContactFilter(_arg1:b2ContactFilter):void{
m_contactFilter = _arg1;
}
public function GetGroundBody():b2Body{
return (m_groundBody);
}
public function DrawShape(_arg1:b2Shape, _arg2:b2XForm, _arg3:b2Color, _arg4:Boolean):void{
var _local6:b2CircleShape;
var _local7:b2Vec2;
var _local8:Number;
var _local9:b2Vec2;
var _local10:int;
var _local11:b2PolygonShape;
var _local12:int;
var _local13:Array;
var _local14:Array;
var _local15:Array;
var _local5:b2Color = s_coreColor;
switch (_arg1.m_type){
case b2Shape.e_circleShape:
_local6 = (_arg1 as b2CircleShape);
_local7 = b2Math.b2MulX(_arg2, _local6.m_localPosition);
_local8 = _local6.m_radius;
_local9 = _arg2.R.col1;
m_debugDraw.DrawSolidCircle(_local7, _local8, _local9, _arg3);
if (_arg4){
m_debugDraw.DrawCircle(_local7, (_local8 - b2Settings.b2_toiSlop), _local5);
};
break;
case b2Shape.e_polygonShape:
_local11 = (_arg1 as b2PolygonShape);
_local12 = _local11.GetVertexCount();
_local13 = _local11.GetVertices();
_local14 = new Array(b2Settings.b2_maxPolygonVertices);
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local13[_local10]);
_local10++;
};
m_debugDraw.DrawSolidPolygon(_local14, _local12, _arg3);
if (_arg4){
_local15 = _local11.GetCoreVertices();
_local10 = 0;
while (_local10 < _local12) {
_local14[_local10] = b2Math.b2MulX(_arg2, _local15[_local10]);
_local10++;
};
m_debugDraw.DrawPolygon(_local14, _local12, _local5);
};
break;
};
}
public function GetContactCount():int{
return (m_contactCount);
}
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));
onBodyWakeUp(_local2);
if (_local2.IsStatic()){
} else {
_local12 = _local2.m_contactList;
while (_local12) {
if ((_local12.contact.m_flags & (b2Contact.e_islandFlag | b2Contact.e_nonSolidFlag))){
} else {
if (_local12.contact.m_manifoldCount == 0){
} else {
_local3.AddContact(_local12.contact);
_local12.contact.m_flags = (_local12.contact.m_flags | b2Contact.e_islandFlag);
_local11 = _local12.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp2 = _local9;
_local9 = (_local9 + 1);
var _local16 = _temp2;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
};
_local12 = _local12.next;
};
_local13 = _local2.m_jointList;
while (_local13) {
if (_local13.joint.m_islandFlag == true){
} else {
_local3.AddJoint(_local13.joint);
_local13.joint.m_islandFlag = true;
_local11 = _local13.other;
if ((_local11.m_flags & b2Body.e_islandFlag)){
} else {
var _temp3 = _local9;
_local9 = (_local9 + 1);
_local16 = _temp3;
_local7[_local16] = _local11;
_local11.m_flags = (_local11.m_flags | b2Body.e_islandFlag);
};
};
_local13 = _local13.next;
};
};
};
_local3.Solve(_arg1, m_gravity, m_positionCorrection, m_allowSleep);
if (_local3.m_positionIterationCount > m_positionIterationCount){
m_positionIterationCount = _local3.m_positionIterationCount;
};
_local10 = 0;
while (_local10 < _local3.m_bodyCount) {
_local2 = _local3.m_bodies[_local10];
if (_local2.IsStatic()){
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
};
_local10++;
};
};
};
_local8 = _local8.m_next;
};
_local2 = m_bodyList;
while (_local2) {
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local14 = _local2.SynchronizeShapes();
if ((((_local14 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
};
};
_local2 = _local2.m_next;
};
m_broadPhase.Commit();
}
public function Query(_arg1:b2AABB, _arg2:Array, _arg3:int):int{
var _local4:Array = new Array(_arg3);
var _local5:int = m_broadPhase.QueryAABB(_arg1, _local4, _arg3);
var _local6:int;
while (_local6 < _local5) {
_arg2[_local6] = _local4[_local6];
_local6++;
};
return (_local5);
}
public function SetGravity(_arg1:b2Vec2):void{
m_gravity = _arg1;
}
public function SolveTOI(_arg1:b2TimeStep):void{
var _local2:b2Body;
var _local3:b2Shape;
var _local4:b2Shape;
var _local5:b2Body;
var _local6:b2Body;
var _local7:b2ContactEdge;
var _local11:b2Contact;
var _local12:b2Contact;
var _local13:Number;
var _local14:b2Body;
var _local15:int;
var _local16:b2TimeStep;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:b2Body;
var _local21:Boolean;
var _local8:b2Island = new b2Island(m_bodyCount, b2Settings.b2_maxTOIContactsPerIsland, 0, m_stackAllocator, m_contactListener);
var _local9:int = m_bodyCount;
var _local10:Array = new Array(_local9);
_local2 = m_bodyList;
while (_local2) {
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
_local2.m_sweep.t0 = 0;
_local2 = _local2.m_next;
};
_local11 = m_contactList;
while (_local11) {
_local11.m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local11 = _local11.m_next;
};
while (true) {
_local12 = null;
_local13 = 1;
_local11 = m_contactList;
for (;_local11;(_local11 = _local11.m_next)) {
if ((_local11.m_flags & (b2Contact.e_slowFlag | b2Contact.e_nonSolidFlag))){
} else {
_local18 = 1;
if ((_local11.m_flags & b2Contact.e_toiFlag)){
_local18 = _local11.m_toi;
} else {
_local3 = _local11.m_shape1;
_local4 = _local11.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
if (((((_local5.IsStatic()) || (_local5.IsSleeping()))) && (((_local6.IsStatic()) || (_local6.IsSleeping()))))){
continue;
};
_local19 = _local5.m_sweep.t0;
if (_local5.m_sweep.t0 < _local6.m_sweep.t0){
_local19 = _local6.m_sweep.t0;
_local5.m_sweep.Advance(_local19);
} else {
if (_local6.m_sweep.t0 < _local5.m_sweep.t0){
_local19 = _local5.m_sweep.t0;
_local6.m_sweep.Advance(_local19);
};
};
_local18 = b2TimeOfImpact.TimeOfImpact(_local11.m_shape1, _local5.m_sweep, _local11.m_shape2, _local6.m_sweep);
if ((((_local18 > 0)) && ((_local18 < 1)))){
_local18 = (((1 - _local18) * _local19) + _local18);
if (_local18 > 1){
_local18 = 1;
};
};
_local11.m_toi = _local18;
_local11.m_flags = (_local11.m_flags | b2Contact.e_toiFlag);
};
if ((((Number.MIN_VALUE < _local18)) && ((_local18 < _local13)))){
_local12 = _local11;
_local13 = _local18;
};
};
};
if ((((_local12 == null)) || (((1 - (100 * Number.MIN_VALUE)) < _local13)))){
break;
};
_local3 = _local12.m_shape1;
_local4 = _local12.m_shape2;
_local5 = _local3.m_body;
_local6 = _local4.m_body;
_local5.Advance(_local13);
_local6.Advance(_local13);
_local12.Update(m_contactListener);
_local12.m_flags = (_local12.m_flags & ~(b2Contact.e_toiFlag));
if (_local12.m_manifoldCount == 0){
} else {
_local14 = _local5;
if (_local14.IsStatic()){
_local14 = _local6;
};
_local8.Clear();
_local15 = 0;
var _temp1 = _local15;
_local15 = (_local15 + 1);
var _local22 = _temp1;
_local10[_local22] = _local14;
_local14.m_flags = (_local14.m_flags | b2Body.e_islandFlag);
while (_local15 > 0) {
--_local15;
_local2 = _local10[_local15];
_local8.AddBody(_local2);
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_sleepFlag));
onBodyWakeUp(_local2);
if (_local2.IsStatic()){
} else {
_local7 = _local2.m_contactList;
while (_local7) {
if (_local8.m_contactCount == _local8.m_contactCapacity){
} else {
if ((_local7.contact.m_flags & ((b2Contact.e_islandFlag | b2Contact.e_slowFlag) | b2Contact.e_nonSolidFlag))){
} else {
if (_local7.contact.m_manifoldCount == 0){
} else {
_local8.AddContact(_local7.contact);
_local7.contact.m_flags = (_local7.contact.m_flags | b2Contact.e_islandFlag);
_local20 = _local7.other;
if ((_local20.m_flags & b2Body.e_islandFlag)){
} else {
if (_local20.IsStatic() == false){
_local20.Advance(_local13);
_local20.WakeUp();
};
var _temp2 = _local15;
_local15 = (_local15 + 1);
var _local23 = _temp2;
_local10[_local23] = _local20;
_local20.m_flags = (_local20.m_flags | b2Body.e_islandFlag);
};
};
};
};
_local7 = _local7.next;
};
};
};
_local16 = new b2TimeStep();
_local16.dt = ((1 - _local13) * _arg1.dt);
_local16.inv_dt = (1 / _local16.dt);
_local16.maxIterations = _arg1.maxIterations;
_local8.SolveTOI(_local16);
_local17 = 0;
while (_local17 < _local8.m_bodyCount) {
_local2 = _local8.m_bodies[_local17];
_local2.m_flags = (_local2.m_flags & ~(b2Body.e_islandFlag));
if ((_local2.m_flags & (b2Body.e_sleepFlag | b2Body.e_frozenFlag))){
} else {
if (_local2.IsStatic()){
} else {
_local21 = _local2.SynchronizeShapes();
if ((((_local21 == false)) && (!((m_boundaryListener == null))))){
m_boundaryListener.Violation(_local2);
};
_local7 = _local2.m_contactList;
while (_local7) {
_local7.contact.m_flags = (_local7.contact.m_flags & ~(b2Contact.e_toiFlag));
_local7 = _local7.next;
};
};
};
_local17++;
};
_local17 = 0;
while (_local17 < _local8.m_contactCount) {
_local11 = _local8.m_contacts[_local17];
_local8.m_contacts[_local17].m_flags = (_local11.m_flags & ~((b2Contact.e_toiFlag | b2Contact.e_islandFlag)));
_local17++;
};
m_broadPhase.Commit();
};
};
}
public function GetJointList():b2Joint{
return (m_jointList);
}
public function Validate():void{
m_broadPhase.Validate();
}
public function GetPairCount():int{
return (m_broadPhase.m_pairManager.m_pairCount);
}
public function SetWarmStarting(_arg1:Boolean):void{
m_warmStarting = _arg1;
}
public function SetPositionCorrection(_arg1:Boolean):void{
m_positionCorrection = _arg1;
}
public function CreateJoint(_arg1:b2JointDef):b2Joint{
var _local3:b2Body;
var _local4:b2Shape;
var _local2:b2Joint = b2Joint.Create(_arg1, m_blockAllocator);
_local2.m_prev = null;
_local2.m_next = m_jointList;
if (m_jointList){
m_jointList.m_prev = _local2;
};
m_jointList = _local2;
m_jointCount++;
_local2.m_node1.joint = _local2;
_local2.m_node1.other = _local2.m_body2;
_local2.m_node1.prev = null;
_local2.m_node1.next = _local2.m_body1.m_jointList;
if (_local2.m_body1.m_jointList){
_local2.m_body1.m_jointList.prev = _local2.m_node1;
};
_local2.m_body1.m_jointList = _local2.m_node1;
_local2.m_node2.joint = _local2;
_local2.m_node2.other = _local2.m_body1;
_local2.m_node2.prev = null;
_local2.m_node2.next = _local2.m_body2.m_jointList;
if (_local2.m_body2.m_jointList){
_local2.m_body2.m_jointList.prev = _local2.m_node2;
};
_local2.m_body2.m_jointList = _local2.m_node2;
if (_arg1.collideConnected == false){
_local3 = ((_arg1.body1.m_shapeCount < _arg1.body2.m_shapeCount)) ? _arg1.body1 : _arg1.body2;
_local4 = _local3.m_shapeList;
while (_local4) {
_local4.RefilterProxy(m_broadPhase, _local3.m_xf);
_local4 = _local4.m_next;
};
};
return (_local2);
}
public function DestroyJoint(_arg1:b2Joint):void{
var _local5:b2Body;
var _local6:b2Shape;
var _local2: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.RefilterProxy(m_broadPhase, _local5.m_xf);
_local6 = _local6.m_next;
};
};
}
public function SetContactListener(_arg1:b2ContactListener):void{
m_contactListener = _arg1;
}
public function GetBodyList():b2Body{
return (m_bodyList);
}
public function CreateBody(_arg1:b2BodyDef):b2Body{
if (m_lock == true){
return (null);
};
var _local2:b2Body = new b2Body(_arg1, this);
_local2.m_prev = null;
_local2.m_next = m_bodyList;
if (m_bodyList){
m_bodyList.m_prev = _local2;
};
m_bodyList = _local2;
m_bodyCount++;
return (_local2);
}
function onBodyWakeUp(_arg1:b2Body):void{
onBodyWakeUpCallback(_arg1);
}
public function SetBoundaryListener(_arg1:b2BoundaryListener):void{
m_boundaryListener = _arg1;
}
public function SetDestructionListener(_arg1:b2DestructionListener):void{
m_destructionListener = _arg1;
}
public function Step(_arg1:Number, _arg2:int):void{
m_lock = true;
var _local3:b2TimeStep = new b2TimeStep();
_local3.dt = _arg1;
_local3.maxIterations = _arg2;
if (_arg1 > 0){
_local3.inv_dt = (1 / _arg1);
} else {
_local3.inv_dt = 0;
};
_local3.dtRatio = (m_inv_dt0 * _arg1);
_local3.positionCorrection = m_positionCorrection;
_local3.warmStarting = m_warmStarting;
m_contactManager.Collide();
if (_local3.dt > 0){
Solve(_local3);
};
if (((m_continuousPhysics) && ((_local3.dt > 0)))){
SolveTOI(_local3);
};
DrawDebugData();
m_inv_dt0 = _local3.inv_dt;
m_lock = false;
}
public function GetBodyCount():int{
return (m_bodyCount);
}
public function GetJointCount():int{
return (m_jointCount);
}
}
}//package Box2D.Dynamics
Section 302
//MD5 (com.adobe.crypto.MD5)
package com.adobe.crypto {
import flash.utils.*;
import com.adobe.utils.*;
public class MD5 {
public static var digest:ByteArray;
private static function ff(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(f, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function f(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 & _arg2) | (~(_arg1) & _arg3)));
}
private static function g(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 & _arg3) | (_arg2 & ~(_arg3))));
}
private static function h(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 ^ _arg2) ^ _arg3));
}
private static function i(_arg1:int, _arg2:int, _arg3:int):int{
return ((_arg2 ^ (_arg1 | ~(_arg3))));
}
private static function transform(_arg1:Function, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int, _arg8:int):int{
var _local9:int = (((_arg2 + int(_arg1(_arg3, _arg4, _arg5))) + _arg6) + _arg8);
return ((IntUtil.rol(_local9, _arg7) + _arg3));
}
private static function hh(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(h, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
public static function hash(_arg1:String):String{
var _local2:ByteArray = new ByteArray();
_local2.writeUTFBytes(_arg1);
return (hashBinary(_local2));
}
private static function createBlocks(_arg1:ByteArray):Array{
var _local2:Array = new Array();
var _local3:int = (_arg1.length * 8);
var _local4 = 0xFF;
var _local5:int;
while (_local5 < _local3) {
_local2[int((_local5 >> 5))] = (_local2[int((_local5 >> 5))] | ((_arg1[(_local5 / 8)] & _local4) << (_local5 % 32)));
_local5 = (_local5 + 8);
};
_local2[int((_local3 >> 5))] = (_local2[int((_local3 >> 5))] | (128 << (_local3 % 32)));
_local2[int(((((_local3 + 64) >>> 9) << 4) + 14))] = _local3;
return (_local2);
}
public static function hashBinary(_arg1:ByteArray):String{
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local2 = 1732584193;
var _local3 = -271733879;
var _local4 = -1732584194;
var _local5 = 271733878;
var _local10:Array = createBlocks(_arg1);
var _local11:int = _local10.length;
var _local12:int;
while (_local12 < _local11) {
_local6 = _local2;
_local7 = _local3;
_local8 = _local4;
_local9 = _local5;
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 0))], 7, -680876936);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 1))], 12, -389564586);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 2))], 17, 606105819);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 3))], 22, -1044525330);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 4))], 7, -176418897);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 5))], 12, 1200080426);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 6))], 17, -1473231341);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 7))], 22, -45705983);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 8))], 7, 1770035416);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 9))], 12, -1958414417);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 10))], 17, -42063);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 11))], 22, -1990404162);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 12))], 7, 1804603682);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 13))], 12, -40341101);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 14))], 17, -1502002290);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 15))], 22, 1236535329);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 1))], 5, -165796510);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 6))], 9, -1069501632);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 11))], 14, 643717713);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 0))], 20, -373897302);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 5))], 5, -701558691);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 10))], 9, 38016083);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 15))], 14, -660478335);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 4))], 20, -405537848);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 9))], 5, 568446438);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 14))], 9, -1019803690);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 3))], 14, -187363961);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 8))], 20, 1163531501);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 13))], 5, -1444681467);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 2))], 9, -51403784);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 7))], 14, 1735328473);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 12))], 20, -1926607734);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 5))], 4, -378558);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 8))], 11, -2022574463);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 11))], 16, 1839030562);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 14))], 23, -35309556);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 1))], 4, -1530992060);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 4))], 11, 1272893353);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 7))], 16, -155497632);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 10))], 23, -1094730640);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 13))], 4, 681279174);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 0))], 11, -358537222);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 3))], 16, -722521979);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 6))], 23, 76029189);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 9))], 4, -640364487);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 12))], 11, -421815835);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 15))], 16, 530742520);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 2))], 23, -995338651);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 0))], 6, -198630844);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 7))], 10, 1126891415);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 14))], 15, -1416354905);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 5))], 21, -57434055);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 12))], 6, 1700485571);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 3))], 10, -1894986606);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 10))], 15, -1051523);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 1))], 21, -2054922799);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 8))], 6, 1873313359);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 15))], 10, -30611744);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 6))], 15, -1560198380);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 13))], 21, 1309151649);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 4))], 6, -145523070);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 11))], 10, -1120210379);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 2))], 15, 718787259);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 9))], 21, -343485551);
_local2 = (_local2 + _local6);
_local3 = (_local3 + _local7);
_local4 = (_local4 + _local8);
_local5 = (_local5 + _local9);
_local12 = (_local12 + 16);
};
digest = new ByteArray();
digest.writeInt(_local2);
digest.writeInt(_local3);
digest.writeInt(_local4);
digest.writeInt(_local5);
digest.position = 0;
return ((((IntUtil.toHex(_local2) + IntUtil.toHex(_local3)) + IntUtil.toHex(_local4)) + IntUtil.toHex(_local5)));
}
private static function gg(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(g, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function ii(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(i, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
public static function hashBytes(_arg1:ByteArray):String{
return (hashBinary(_arg1));
}
}
}//package com.adobe.crypto
Section 303
//IntUtil (com.adobe.utils.IntUtil)
package com.adobe.utils {
public class IntUtil {
private static var hexChars:String = "0123456789abcdef";
public static function toHex(_arg1:int, _arg2:Boolean=false):String{
var _local4:int;
var _local5:int;
var _local3 = "";
if (_arg2){
_local4 = 0;
while (_local4 < 4) {
_local3 = (_local3 + (hexChars.charAt(((_arg1 >> (((3 - _local4) * 8) + 4)) & 15)) + hexChars.charAt(((_arg1 >> ((3 - _local4) * 8)) & 15))));
_local4++;
};
} else {
_local5 = 0;
while (_local5 < 4) {
_local3 = (_local3 + (hexChars.charAt(((_arg1 >> ((_local5 * 8) + 4)) & 15)) + hexChars.charAt(((_arg1 >> (_local5 * 8)) & 15))));
_local5++;
};
};
return (_local3);
}
public static function ror(_arg1:int, _arg2:int):uint{
var _local3:int = (32 - _arg2);
return (((_arg1 << _local3) | (_arg1 >>> (32 - _local3))));
}
public static function rol(_arg1:int, _arg2:int):int{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
}
}//package com.adobe.utils
Section 304
//AbstractApplication (com.bigwigmedia.application.AbstractApplication)
package com.bigwigmedia.application {
import flash.display.*;
import com.bigwigmedia.transitions.*;
import flash.system.*;
import flash.events.*;
import com.bigwigmedia.preloaders.*;
import com.bigwigmedia.events.*;
import com.bigwigmedia.core.*;
public class AbstractApplication extends MovieClip implements IApplication {
protected var _cursorHolder:Sprite;
protected var _preloaderHolder:Sprite;
protected var _info:ApplicationInfo;
protected var _transitionHolder:Sprite;
protected var _mask:Sprite;
protected var _mainView:DisplayObject;
protected var _toolTipHolder:Sprite;
protected var _transition:AbstractTransition;
protected var _preloader:AbstractPreloader;
public function AbstractApplication(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:String=null){
Globals.bigwigmedia_ns::application = this;
_info = new ApplicationInfo(_arg1, _arg2, _arg3, _arg4, _arg5);
stop();
createChildren();
if (((root) && (root.loaderInfo))){
root.loaderInfo.addEventListener(Event.INIT, onRootInitHandler);
};
}
public function get mainView():DisplayObject{
return (_mainView);
}
public function removeTransition():void{
if (_transition){
_transition.removeEventListener(Event.COMPLETE, onTransitionCompleteHandler);
_transitionHolder.removeChild(_transition);
_transition.dispose();
_transition = null;
};
}
protected function fillMask(_arg1:uint=0):void{
var _local2:Graphics = _mask.graphics;
_local2.clear();
_local2.lineStyle();
_local2.beginFill(_arg1, 1);
var _local3:int = nominalWidth;
var _local4:int = nominalHeight;
_local2.moveTo(0, 0);
_local2.lineTo(_local3, 0);
_local2.lineTo(_local3, _local4);
_local2.lineTo(0, _local4);
_local2.lineTo(0, 0);
var _local5:int = ((maxScreenWidth - _local3) / 2);
var _local6:int = ((maxScreenHeight - _local4) / 2);
_local2.moveTo(-(_local5), -(_local6));
_local2.lineTo((_local3 + _local5), -(_local6));
_local2.lineTo((_local3 + _local5), (_local4 + _local6));
_local2.lineTo(-(_local5), (_local4 + _local6));
_local2.lineTo(-(_local5), -(_local6));
_local2.endFill();
addChild(_mask);
}
protected function fillBackground(_arg1:uint=0, _arg2:Number=1):void{
graphics.clear();
graphics.lineStyle();
graphics.beginFill(_arg1, _arg2);
graphics.drawRect(0, 0, nominalWidth, nominalHeight);
graphics.endFill();
}
protected function createChildren():void{
_preloaderHolder = new Sprite();
addChild(_preloaderHolder);
_toolTipHolder = new Sprite();
_toolTipHolder.mouseEnabled = false;
_toolTipHolder.mouseChildren = false;
addChild(_toolTipHolder);
_transitionHolder = new Sprite();
addChild(_transitionHolder);
_mask = new Sprite();
addChild(_mask);
_cursorHolder = new Sprite();
_cursorHolder.mouseEnabled = false;
_cursorHolder.mouseChildren = false;
addChild(_cursorHolder);
}
private function onTransitionCompleteHandler(_arg1:Event):void{
removeTransition();
}
public function get cursorHolder():Sprite{
return (_cursorHolder);
}
public function get nominalHeight():int{
return (loaderInfo.height);
}
private function onRootInitHandler(_arg1:Event):void{
root.loaderInfo.removeEventListener(Event.INIT, onRootInitHandler);
if (stage){
Globals.bigwigmedia_ns::stage = stage;
_initialize();
} else {
addEventListener(Event.ADDED_TO_STAGE, onAddedToStageHandler);
};
}
public function get info():ApplicationInfo{
return (_info);
}
protected function _initialize():void{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = "";
onInitialize();
}
public function get applicationDomain():ApplicationDomain{
return (loaderInfo.applicationDomain);
}
protected function onLoadingComplete():void{
}
protected function get maxScreenHeight():int{
return (Capabilities.screenResolutionY);
}
protected function get maxScreenWidth():int{
return (Capabilities.screenResolutionX);
}
protected function addMainView(_arg1:DisplayObject):void{
if (_mainView){
return;
};
_mainView = _arg1;
addChildAt(_mainView, 0);
}
protected function startPreloading(_arg1:AbstractPreloader):void{
if (_preloader){
return;
};
_preloader = _arg1;
_preloaderHolder.addChild(_preloader);
_preloader.addEventListener(PreloaderEvent.COMPLETE, preloadingCompleteHandler);
}
private function onAddedToStageHandler(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStageHandler);
Globals.bigwigmedia_ns::stage = stage;
_initialize();
}
public function get nominalWidth():int{
return (loaderInfo.width);
}
protected function onInitialize():void{
}
protected function removePreloader():void{
_preloader.removeEventListener(PreloaderEvent.COMPLETE, preloadingCompleteHandler);
_preloader.dispose();
_preloaderHolder.removeChild(_preloader);
_preloader = null;
}
public function getURLVariable(_arg1:String, _arg2:Boolean=false):String{
var _local4:String;
var _local5:String;
var _local3:Object = loaderInfo.parameters;
if (_arg2){
return (_local3[_arg1]);
};
_local4 = _arg1.toLowerCase();
for (_local5 in _local3) {
if (_local5.toLowerCase() == _local4){
return (_local3[_local5]);
};
};
return (null);
}
public function startTransition(_arg1:AbstractTransition):void{
if (_transition){
return;
};
_transition = _arg1;
_transition.addEventListener(Event.COMPLETE, onTransitionCompleteHandler);
_transitionHolder.addChild(_transition);
_transition.start();
}
private function preloadingCompleteHandler(_arg1:PreloaderEvent):void{
while (this.currentFrame != this.totalFrames) {
nextFrame();
};
onLoadingComplete();
}
protected function clearMask():void{
_mask.graphics.clear();
}
protected function clearBackground():void{
this.graphics.clear();
}
public function get nominalFrameRate():Number{
return (loaderInfo.frameRate);
}
public function get toolTipHolder():Sprite{
return (_toolTipHolder);
}
}
}//package com.bigwigmedia.application
Section 305
//ApplicationInfo (com.bigwigmedia.application.ApplicationInfo)
package com.bigwigmedia.application {
public class ApplicationInfo {
private var _sharedObjectPath:String;
private var _name:String;
private var _sharedObjectName:String;
private var _version:String;
private var _id:String;
public function ApplicationInfo(_arg1:String, _arg2:String, _arg3:String, _arg4:String, _arg5:String){
_name = _arg1;
_id = _arg2;
_version = _arg3;
_sharedObjectName = _arg4;
_sharedObjectPath = _arg5;
}
public function get id():String{
return (_id);
}
public function get sharedObjectPath():String{
return (_sharedObjectPath);
}
public function get name():String{
return (_name);
}
public function get sharedObjectName():String{
return (_sharedObjectName);
}
public function get version():String{
return (_version);
}
}
}//package com.bigwigmedia.application
Section 306
//IApplication (com.bigwigmedia.application.IApplication)
package com.bigwigmedia.application {
import flash.display.*;
import com.bigwigmedia.transitions.*;
import flash.system.*;
import flash.events.*;
public interface IApplication extends IEventDispatcher {
function get cursorHolder():Sprite;
function get nominalHeight():int;
function get nominalWidth():int;
function get info():ApplicationInfo;
function get toolTipHolder():Sprite;
function get nominalFrameRate():Number;
function get applicationDomain():ApplicationDomain;
function getURLVariable(_arg1:String, _arg2:Boolean=false):String;
function startTransition(_arg1:AbstractTransition):void;
function removeTransition():void;
function get mainView():DisplayObject;
}
}//package com.bigwigmedia.application
Section 307
//bigwigmedia_ns (com.bigwigmedia.core.bigwigmedia_ns)
package com.bigwigmedia.core {
public namespace bigwigmedia_ns = "http://www.bigwigmedia.com/flash/as3/namespace";
}//package com.bigwigmedia.core
Section 308
//Globals (com.bigwigmedia.core.Globals)
package com.bigwigmedia.core {
import flash.display.*;
import com.bigwigmedia.application.*;
public class Globals {
private static var _application:IApplication;
private static var _nameToClassHash:Object = {};
private static var _stage:Stage;
public static function get application():IApplication{
return (_application);
}
public static function getClass(_arg1:String):Class{
var _local2:Class = _nameToClassHash[_arg1];
if (!_local2){
_local2 = (_nameToClassHash[_arg1] = Class(_application.applicationDomain.getDefinition(_arg1)));
};
return (_local2);
}
public static function get stage():Stage{
return (_stage);
}
bigwigmedia_ns static function set application(_arg1:IApplication):void{
if (!_application){
_application = _arg1;
};
}
bigwigmedia_ns static function set stage(_arg1:Stage):void{
if (!_stage){
_stage = _arg1;
};
}
}
}//package com.bigwigmedia.core
Section 309
//IDisposable (com.bigwigmedia.core.IDisposable)
package com.bigwigmedia.core {
public interface IDisposable {
function dispose():void;
}
}//package com.bigwigmedia.core
Section 310
//IUpdatable (com.bigwigmedia.core.IUpdatable)
package com.bigwigmedia.core {
public interface IUpdatable {
function update(_arg1:Number):void;
}
}//package com.bigwigmedia.core
Section 311
//Singleton (com.bigwigmedia.core.Singleton)
package com.bigwigmedia.core {
import flash.utils.*;
public class Singleton {
private static var instantiatedClassesDict:Dictionary = new Dictionary();
private static var interfaceToClassHash:Object = {};
private static var interfaceToInstanceHash:Object = {};
public static function registerClass(_arg1:String, _arg2:Class):void{
var _local3:Class = interfaceToClassHash[_arg1];
if (!_local3){
interfaceToClassHash[_arg1] = _arg2;
};
}
public static function getInstanceByInterface(_arg1:Class):Object{
return (getInstance(getQualifiedClassName(_arg1)));
}
public static function getInstance(_arg1:String):Object{
var _local2:Object = interfaceToInstanceHash[_arg1];
if (_local2){
return (_local2);
};
var _local3:Class = interfaceToClassHash[_arg1];
if (!_local3){
throw (new Error((("No class registered for interface \"" + _arg1) + "\".")));
};
_local2 = new (_local3);
interfaceToInstanceHash[_arg1] = _local2;
return (_local2);
}
public static function checkInstance(_arg1:Object):void{
var _local2:Object = Object(_arg1).constructor;
if (instantiatedClassesDict[_local2]){
throw ((new Error(("Class " + _local2.toString())) + " has been instantiated already."));
};
instantiatedClassesDict[_local2] = true;
}
public static function registerClassByInterface(_arg1:Class, _arg2:Class):void{
registerClass(getQualifiedClassName(_arg1), _arg2);
}
}
}//package com.bigwigmedia.core
Section 312
//AnimationAsset (com.bigwigmedia.display.AnimationAsset)
package com.bigwigmedia.display {
import flash.display.*;
public class AnimationAsset extends MovieClip {
var prevLabel:String;// = null
var nextFrameNum:int;// = 1
var playing:Boolean;// = true
public function AnimationAsset(){
super.stop();
}
override public function play():void{
playing = true;
}
override public function gotoAndStop(_arg1:Object, _arg2:String=null):void{
playing = false;
nextFrameNum = int(_arg1);
}
override public function stop():void{
playing = false;
nextFrameNum = currentFrame;
}
function $gotoAndStop(_arg1:int):void{
super.gotoAndStop(_arg1);
}
override public function gotoAndPlay(_arg1:Object, _arg2:String=null):void{
playing = true;
nextFrameNum = int(_arg1);
}
}
}//package com.bigwigmedia.display
Section 313
//AnimationClient (com.bigwigmedia.display.AnimationClient)
package com.bigwigmedia.display {
import flash.display.*;
import flash.events.*;
import com.bigwigmedia.core.*;
public class AnimationClient extends Sprite implements IUpdatable, IDisposable {
protected var _assetsList:Array;
public var action:FrameAction;
public function AnimationClient(){
action = FrameAction.defaultAction;
_assetsList = [];
super();
addEventListener(Event.ADDED, onChildAddedHandler);
addEventListener(Event.REMOVED, onChildRemovedHandler);
}
protected function childRemoved(_arg1:DisplayObject):void{
}
private function onChildRemovedHandler(_arg1:Event):void{
var _local2:DisplayObject = DisplayObject(_arg1.target);
var _local3:int = ((_local2 is AnimationAsset)) ? _assetsList.indexOf(_local2) : -1;
if (_local3 != -1){
_assetsList.splice(_local3, 1);
};
childRemoved(_local2);
}
protected function childAdded(_arg1:DisplayObject):void{
}
private function onChildAddedHandler(_arg1:Event):void{
var _local2:DisplayObject = DisplayObject(_arg1.target);
var _local3:AnimationAsset = (_local2 as AnimationAsset);
if (_local3){
_assetsList.push(_local3);
};
childAdded(_local2);
}
public function update(_arg1:Number):void{
var _local2:AnimationAsset;
var _local3:String;
for each (_local2 in _assetsList) {
if (_local2.playing){
if (_local2.currentFrame == _local2.totalFrames){
_local2.nextFrameNum = 1;
} else {
_local2.nextFrameNum++;
};
_local3 = _local2.currentLabel;
if (_local2.prevLabel != _local3){
_local2.prevLabel = _local3;
if (_local3){
action.execute(_local2, _local3);
};
};
_local2.$gotoAndStop(_local2.nextFrameNum);
};
};
}
public function dispose():void{
removeEventListener(Event.ADDED, onChildAddedHandler);
removeEventListener(Event.REMOVED, onChildRemovedHandler);
action = null;
_assetsList = null;
}
}
}//package com.bigwigmedia.display
Section 314
//FrameAction (com.bigwigmedia.display.FrameAction)
package com.bigwigmedia.display {
import flash.events.*;
import com.bigwigmedia.sound.*;
import com.bigwigmedia.core.*;
public class FrameAction {
public static const STOP:String = "stop";
public static const GOTO_AND_STOP:String = "gotoAndStop";
public static const PLAY_SOUND:String = "playSound";
public static const DISPATCH_EVENT:String = "dispatchEvent";
public static const GOTO_AND_PLAY:String = "gotoAndPlay";
private static var _defaultAction:FrameAction = new (FrameAction);
;
private static var _soundManager:ISoundManager;
protected function executeAction(_arg1:AnimationAsset, _arg2:String, _arg3:String):void{
var _local4:Array;
var _local5:String;
var _local6:String;
var _local7:Array;
var _local8:String;
var _local9:String;
var _local10:int;
switch (_arg2){
case STOP:
_arg1.stop();
break;
case GOTO_AND_PLAY:
_arg1.gotoAndPlay(_arg3);
break;
case GOTO_AND_STOP:
_arg1.gotoAndStop(_arg3);
break;
case DISPATCH_EVENT:
_local4 = _arg3.split(",");
_local5 = _local4[0];
_local6 = _local4[1];
_arg1.dispatchEvent(new TextEvent(_local5, true, false, ((_local6) || (""))));
break;
case PLAY_SOUND:
_local7 = _arg3.split(",");
_local8 = _local7[0];
_local9 = _local7[1];
_local10 = (_local9) ? int(_local9) : 1;
FrameAction.soundManager.play(_local8, _local10);
break;
};
}
public function execute(_arg1:AnimationAsset, _arg2:String):void{
var _local3:Array;
var _local4:Array;
var _local5:int;
var _local6:int;
if (_arg2.indexOf("&") == -1){
_local3 = _arg2.split("?");
executeAction(_arg1, _local3[0], _local3[1]);
} else {
_local4 = _arg2.split("&");
_local5 = _local4.length;
_local6 = 0;
while (_local6 < _local5) {
_local3 = String(_local4[_local6]).split("?");
executeAction(_arg1, _local3[0], _local3[1]);
_local6++;
};
};
}
public static function get soundManager():ISoundManager{
if (!_soundManager){
_soundManager = ISoundManager(Singleton.getInstanceByInterface(ISoundManager));
};
return (_soundManager);
}
public static function get defaultAction():FrameAction{
return (_defaultAction);
}
}
}//package com.bigwigmedia.display
Section 315
//SimpleAutoAsset (com.bigwigmedia.display.SimpleAutoAsset)
package com.bigwigmedia.display {
import flash.events.*;
public class SimpleAutoAsset extends AnimationAsset {
private var _action:FrameAction;
public function SimpleAutoAsset(){
addEventListener(Event.ADDED_TO_STAGE, onAddedToStageHandler);
}
private function onAddedToStageHandler(_arg1:Event):void{
_action = FrameAction.defaultAction;
addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStageHandler);
}
private function onEnterFrameHandler(_arg1:Event):void{
if (playing){
if (currentFrame == totalFrames){
nextFrameNum = 1;
} else {
nextFrameNum++;
};
if (prevLabel != currentLabel){
prevLabel = currentLabel;
if (currentLabel){
_action.execute(this, currentLabel);
};
};
$gotoAndStop(nextFrameNum);
};
}
private function onRemovedFromStageHandler(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
removeEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStageHandler);
_action = null;
}
}
}//package com.bigwigmedia.display
Section 316
//ComponentEvent (com.bigwigmedia.events.ComponentEvent)
package com.bigwigmedia.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const CHANGE:String = "ComponentEvent.change";
public static const MOVE:String = "ComponentEvent.move";
public static const RESIZE:String = "ComponentEvent.resize";
public static const STYLE_NAME_CHANGE:String = "ComponentEvent.styleNameChange";
public static const BUTTON_DOWN:String = "ComponentEvent.buttonDown";
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 com.bigwigmedia.events
Section 317
//EventPriority (com.bigwigmedia.events.EventPriority)
package com.bigwigmedia.events {
public class EventPriority {
public static const DEFAULT:int = 0;
public static const HIGH:int = 2000;
public static const LOW:int = -2000;
public static const LOWEST:int = -5000;
public static const HIGHEST:int = 5000;
}
}//package com.bigwigmedia.events
Section 318
//KeyInputEvent (com.bigwigmedia.events.KeyInputEvent)
package com.bigwigmedia.events {
import flash.events.*;
public class KeyInputEvent extends KeyboardEvent {
private var _keyAction:String;
public static const SEQUENCE:String = "KeyInputEvent.sequence";
public static const KEY_DOWN:String = "KeyInputEvent.keyDown";
public static const KEY_UP:String = "KeyInputEvent.keyUp";
public static const KEY_HOLD:String = "KeyInputEvent.keyHold";
public function KeyInputEvent(_arg1:String, _arg2:String, _arg3:uint, _arg4:uint, _arg5:uint, _arg6:Boolean, _arg7:Boolean, _arg8:Boolean){
super(_arg1, false, false, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
_keyAction = _arg2;
}
override public function toString():String{
return (formatToString("KeyInputEvent", "type", "keyAction", "keyCode", "ctrlKey", "altKey", "shiftKey"));
}
public function get keyAction():String{
return (_keyAction);
}
override public function clone():Event{
return (new KeyInputEvent(type, keyAction, charCode, keyCode, keyLocation, ctrlKey, altKey, shiftKey));
}
}
}//package com.bigwigmedia.events
Section 319
//ListEvent (com.bigwigmedia.events.ListEvent)
package com.bigwigmedia.events {
import flash.events.*;
public class ListEvent extends Event {
private var _item:Object;
private var _index:int;
public static const SELECTION_CHANGE:String = "ListEvent.selectionChange";
public static const ITEM_CLICK:String = "ListEvent.itemClick";
public function ListEvent(_arg1:String, _arg2:int, _arg3:Object, _arg4:Boolean=false, _arg5:Boolean=false){
super(_arg1, _arg4, _arg5);
_index = _arg2;
_item = _arg3;
}
public function get index():int{
return (_index);
}
public function get item():Object{
return (_item);
}
override public function toString():String{
return (formatToString("ListEvent", "type", "index", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ListEvent(type, _index, _item, bubbles, cancelable));
}
}
}//package com.bigwigmedia.events
Section 320
//LoaderErrorEvent (com.bigwigmedia.events.LoaderErrorEvent)
package com.bigwigmedia.events {
import flash.events.*;
import com.bigwigmedia.loaders.*;
public class LoaderErrorEvent extends IOErrorEvent {
private var _loader:ILoader;
public static const ERROR:String = "LoaderErrorEvent.error";
public function LoaderErrorEvent(_arg1:String, _arg2:ILoader, _arg3:String=""){
super(_arg1, false, false, _arg3);
_loader = _arg2;
}
public function get loader():ILoader{
return (_loader);
}
override public function toString():String{
return (formatToString("LoaderErrorEvent", "type", "loader", "text"));
}
override public function clone():Event{
return (new LoaderErrorEvent(type, _loader, text));
}
}
}//package com.bigwigmedia.events
Section 321
//LoaderEvent (com.bigwigmedia.events.LoaderEvent)
package com.bigwigmedia.events {
import flash.events.*;
import com.bigwigmedia.loaders.*;
public class LoaderEvent extends Event {
private var _loader:ILoader;
public static const BUNDLE_LOAD:String = "LoaderEvent.bundleLoad";
public static const READY:String = "LoaderEvent.ready";
public static const LOAD:String = "LoaderEvent.load";
public static const BUNDLE_READY:String = "LoaderEvent.bundleReady";
public function LoaderEvent(_arg1:String, _arg2:ILoader){
super(_arg1);
_loader = _arg2;
}
public function get loader():ILoader{
return (_loader);
}
override public function toString():String{
return (formatToString("LoaderEvent", "type", "loader"));
}
override public function clone():Event{
return (new LoaderEvent(type, _loader));
}
}
}//package com.bigwigmedia.events
Section 322
//PreloaderEvent (com.bigwigmedia.events.PreloaderEvent)
package com.bigwigmedia.events {
import flash.events.*;
public class PreloaderEvent extends Event {
private var _percentLoaded:Number;
public static const COMPLETE:String = "PreloaderEvent.complete";
public static const PROGRESS:String = "PreloaderEvent.progress";
public function PreloaderEvent(_arg1:String, _arg2:Number){
super(_arg1, false, false);
_percentLoaded = _arg2;
}
public function get percentLoaded():Number{
return (_percentLoaded);
}
override public function toString():String{
return (formatToString("PreloaderEvent", "type", "percentLoaded"));
}
override public function clone():Event{
return (new PreloaderEvent(type, _percentLoaded));
}
}
}//package com.bigwigmedia.events
Section 323
//ScrollEvent (com.bigwigmedia.events.ScrollEvent)
package com.bigwigmedia.events {
import flash.events.*;
public class ScrollEvent extends Event {
private var _position:Number;
public static const THUMB_PRESS:String = "ScrollEvent.thumbPress";
public static const SCROLL:String = "ScrollEvent.change";
public static const THUMB_RELEASE:String = "ScrollEvent.thumbRelease";
public function ScrollEvent(_arg1:String, _arg2:Number, _arg3:Boolean=false, _arg4:Boolean=false){
super(_arg1, _arg3, _arg4);
_position = _arg2;
}
public function get position():Number{
return (_position);
}
override public function toString():String{
return (formatToString("ScrollEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ScrollEvent(type, _position, bubbles, cancelable));
}
}
}//package com.bigwigmedia.events
Section 324
//SliderEvent (com.bigwigmedia.events.SliderEvent)
package com.bigwigmedia.events {
import flash.events.*;
public class SliderEvent extends Event {
private var _value:Number;
public static const CHANGE:String = "SliderEvent.change";
public static const KNOB_PRESS:String = "SliderEvent.knobPress";
public static const KNOB_RELEASE:String = "SliderEvent.knobRelease";
public function SliderEvent(_arg1:String, _arg2:Number, _arg3:Boolean=true, _arg4:Boolean=false){
super(_arg1, _arg3, _arg4);
_value = _arg2;
}
public function get value():Number{
return (_value);
}
override public function toString():String{
return (formatToString("SliderEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new SliderEvent(type, _value, bubbles, cancelable));
}
}
}//package com.bigwigmedia.events
Section 325
//TweenEvent (com.bigwigmedia.events.TweenEvent)
package com.bigwigmedia.events {
import flash.events.*;
public class TweenEvent extends Event {
public static const COMPLETE:String = "TweenEvent.complete";
public function TweenEvent(_arg1:String){
super(_arg1);
}
override public function toString():String{
return (formatToString("TweenEvent", "type"));
}
override public function clone():Event{
return (new TweenEvent(type));
}
}
}//package com.bigwigmedia.events
Section 326
//FontManager (com.bigwigmedia.font.FontManager)
package com.bigwigmedia.font {
import flash.utils.*;
import flash.text.*;
import com.bigwigmedia.core.*;
public class FontManager implements IFontManager {
private var _idToFontNameHash:Object;
public function FontManager(){
_idToFontNameHash = {};
super();
Singleton.checkInstance(this);
}
public function getFontName(_arg1:String):String{
var _local2:Class;
var _local3:Font;
if (!_idToFontNameHash[_arg1]){
_local2 = Class(getDefinitionByName(_arg1));
Font.registerFont(_local2);
_local3 = new (_local2);
_idToFontNameHash[_arg1] = _local3.fontName;
};
return (_idToFontNameHash[_arg1]);
}
}
}//package com.bigwigmedia.font
Section 327
//IFontManager (com.bigwigmedia.font.IFontManager)
package com.bigwigmedia.font {
public interface IFontManager {
function getFontName(_arg1:String):String;
}
}//package com.bigwigmedia.font
Section 328
//RectangleIntersection (com.bigwigmedia.geom.RectangleIntersection)
package com.bigwigmedia.geom {
import flash.geom.*;
public class RectangleIntersection {
private static var _tempMatrix:Matrix = new Matrix();
private static var _tempPoint:Point = new Point();
private static var _tolerance:Number;
private static function getTransformedPoint(_arg1:Number, _arg2:Number):Point{
_tempPoint.x = _arg1;
_tempPoint.y = _arg2;
var _local3:Point = _tempMatrix.transformPoint(_tempPoint);
_local3.x = (Math.round((_local3.x / _tolerance)) * _tolerance);
_local3.y = (Math.round((_local3.y / _tolerance)) * _tolerance);
return (_local3);
}
private static function getTriangles(_arg1:Rectangle, _arg2:Point, _arg3:Number):Array{
_tempMatrix.a = 1;
_tempMatrix.b = 0;
_tempMatrix.c = 0;
_tempMatrix.d = 1;
_tempMatrix.tx = -(_arg2.x);
_tempMatrix.ty = -(_arg2.y);
_tempMatrix.rotate(_arg3);
_tempMatrix.tx = (_tempMatrix.tx + _arg1.x);
_tempMatrix.ty = (_tempMatrix.ty + _arg1.y);
var _local4:Array = [];
_local4.push(getTransformedPoint(0, 0));
_local4.push(getTransformedPoint(_arg1.width, 0));
_local4.push(getTransformedPoint(_arg1.width, _arg1.height));
var _local5:Array = [];
_local5.push(getTransformedPoint(0, 0));
_local5.push(getTransformedPoint(_arg1.width, _arg1.height));
_local5.push(getTransformedPoint(0, _arg1.height));
return (new Array(_local4, _local5));
}
public static function intersects(_arg1:Rectangle, _arg2:Point, _arg3:Number, _arg4:Rectangle, _arg5:Point, _arg6:Number, _arg7:Number=0.0001):Boolean{
_tolerance = _arg7;
var _local8:Array = getTriangles(_arg1, _arg2, _arg3);
var _local9:Array = getTriangles(_arg4, _arg5, _arg6);
if (((((((TriangleIntersection.intersects(_local8[0], _local9[0])) || (TriangleIntersection.intersects(_local8[0], _local9[1])))) || (TriangleIntersection.intersects(_local8[1], _local9[0])))) || (TriangleIntersection.intersects(_local8[1], _local9[1])))){
return (true);
};
return (false);
}
}
}//package com.bigwigmedia.geom
Section 329
//TriangleIntersection (com.bigwigmedia.geom.TriangleIntersection)
package com.bigwigmedia.geom {
import flash.geom.*;
public class TriangleIntersection {
private static var tempA:Point = new Point();
private static var tempB:Point = new Point();
public static function intersects(_arg1:Array, _arg2:Array):Boolean{
var _local3:int;
var _local4:int;
_local3 = 0;
_local4 = 2;
while (_local3 < 3) {
tempA.x = (_arg1[_local3].y - _arg1[_local4].y);
tempA.y = (_arg1[_local4].x - _arg1[_local3].x);
if (sideTest(_arg2, _arg1[_local4], tempA) > 0){
return (false);
};
_local4 = _local3;
_local3++;
};
_local3 = 0;
_local4 = 2;
while (_local3 < 3) {
tempA.x = (_arg2[_local3].y - _arg2[_local4].y);
tempA.y = (_arg2[_local4].x - _arg2[_local3].x);
if (sideTest(_arg1, _arg2[_local4], tempA) > 0){
return (false);
};
_local4 = _local3;
_local3++;
};
return (true);
}
private static function sideTest(_arg1:Array, _arg2:Point, _arg3:Point):int{
var _local8:Number;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
while (_local7 < 3) {
tempB.x = (_arg1[_local7].x - _arg2.x);
tempB.y = (_arg1[_local7].y - _arg2.y);
_local8 = ((_arg3.x * tempB.x) + (_arg3.y * tempB.y));
if (_local8 > 0){
_local4++;
} else {
if (_local8 < 0){
_local5++;
} else {
_local6++;
};
};
if ((((_local4 > 0)) && ((_local5 > 0)))){
return (0);
};
_local7++;
};
return (((_local6 == 0)) ? ((_local4 > 0)) ? 1 : -1 : 0);
}
}
}//package com.bigwigmedia.geom
Section 330
//Vector2D (com.bigwigmedia.geom.Vector2D)
package com.bigwigmedia.geom {
public class Vector2D {
public var x:Number;
public var y:Number;
public function Vector2D(_arg1:Number=0, _arg2:Number=0){
this.x = _arg1;
this.y = _arg2;
}
public function divide(_arg1:Number):void{
x = (x / _arg1);
y = (y / _arg1);
}
public function negate():void{
x = -(x);
y = -(y);
}
public function getProjection(_arg1:Vector2D):Vector2D{
var _local2:Number = _arg1.dotProduct(_arg1);
if (_local2 == 0){
return (this.clone());
};
var _local3:Vector2D = _arg1.getMultiply((this.dotProduct(_arg1) / _local2));
return (_local3);
}
public function equals(_arg1:Vector2D):Boolean{
return ((((x == _arg1.x)) && ((y == _arg1.y))));
}
public function getReflect(_arg1:Vector2D):Vector2D{
var _local2:Number = (2 * dotProduct(_arg1));
return (new Vector2D((x - (_arg1.x * _local2)), (y - (_arg1.y * _local2))));
}
public function getRotateBy(_arg1:Number):Vector2D{
var _local2:Number = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
var _local4:Number = ((x * _local2) - (y * _local3));
return (new Vector2D(_local4, ((x * _local3) + (y * _local2))));
}
public function getSubtract(_arg1:Vector2D):Vector2D{
return (new Vector2D((x - _arg1.x), (y - _arg1.y)));
}
public function set length(_arg1:Number):void{
var _local2:Number = (_arg1 / this.length);
x = (x * _local2);
y = (y * _local2);
}
public function getOrth():Vector2D{
return (new Vector2D(-(y), x));
}
public function nearEquals(_arg1:Vector2D, _arg2:Number=1E-5):Boolean{
if (_arg2 < 0){
_arg2 = -(_arg2);
};
var _local3:Number = (x - _arg1.x);
if (_local3 < 0){
_local3 = -(_local3);
};
var _local4:Number = (y - _arg1.y);
if (_local4 < 0){
_local4 = -(_local4);
};
return ((((_local3 < _arg2)) && ((_local4 < _arg2))));
}
public function crossProduct(_arg1:Vector2D):Number{
return (((x * _arg1.y) - (y * _arg1.x)));
}
public function rotateBy(_arg1:Number):void{
var _local2:Number = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
var _local4:Number = ((x * _local2) - (y * _local3));
y = ((x * _local3) + (y * _local2));
x = _local4;
}
public function get angle():Number{
return (Math.atan2(y, x));
}
public function normalize():void{
var _local1:Number = this.length;
x = (x / _local1);
y = (y / _local1);
}
public function clone():Vector2D{
return (new Vector2D(x, y));
}
public function orth():void{
var _local1:Number = -(y);
y = x;
x = _local1;
}
public function getMultiply(_arg1:Number):Vector2D{
return (new Vector2D((x * _arg1), (y * _arg1)));
}
public function subtract(_arg1:Vector2D):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function getNormal():Vector2D{
var _local1:Number = this.length;
return (new Vector2D((-(y) / _local1), (x / _local1)));
}
public function getNormalize():Vector2D{
var _local1:Number = this.length;
return (new Vector2D((x / _local1), (y / _local1)));
}
public function get lengthSquared():Number{
return (((x * x) + (y * y)));
}
public function multiply(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function get length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function normal():void{
var _local1:Number = this.length;
var _local2:Number = (-(y) / _local1);
y = (x / _local1);
x = _local2;
}
public function add(_arg1:Vector2D):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function getAdd(_arg1:Vector2D):Vector2D{
return (new Vector2D((x + _arg1.x), (y + _arg1.y)));
}
public function getRotateTo(_arg1:Number):Vector2D{
var _local2:Number = this.length;
return (new Vector2D((Math.cos(_arg1) * _local2), (Math.sin(_arg1) * _local2)));
}
public function dotProduct(_arg1:Vector2D):Number{
return (((x * _arg1.x) + (y * _arg1.y)));
}
public function getDivide(_arg1:Number):Vector2D{
return (new Vector2D((x / _arg1), (y / _arg1)));
}
public function angleBetween(_arg1:Vector2D):Number{
var _local2:Number = Math.acos((dotProduct(_arg1) / (this.length * _arg1.length)));
return (_local2);
}
public function rotateTo(_arg1:Number):void{
var _local2:Number = this.length;
x = (Math.cos(_arg1) * _local2);
y = (Math.sin(_arg1) * _local2);
}
public function getNewLength(_arg1:Number):Vector2D{
var _local2:Number = (this.length / _arg1);
return (new Vector2D((x / _local2), (y / _local2)));
}
public function toString():String{
return ((((("[Vector2D x=" + x) + " y=") + y) + "]"));
}
public function distance(_arg1:Vector2D):Number{
var _local2:Vector2D = this.getSubtract(_arg1);
return (_local2.length);
}
public function reflect(_arg1:Vector2D):void{
var _local2:Number = (2 * dotProduct(_arg1));
x = (x - (_arg1.x * _local2));
y = (y - (_arg1.y * _local2));
}
public function getNegate():Vector2D{
return (new Vector2D(-(x), -(y)));
}
public static function fromObject(_arg1:Object):Vector2D{
return (new Vector2D(_arg1.x, _arg1.y));
}
public static function get Y_UNIT():Vector2D{
return (new Vector2D(0, 1));
}
public static function get X_UNIT():Vector2D{
return (new Vector2D(1, 0));
}
}
}//package com.bigwigmedia.geom
Section 331
//KeyInputManager (com.bigwigmedia.input.KeyInputManager)
package com.bigwigmedia.input {
import flash.display.*;
import com.bigwigmedia.events.*;
import flash.events.*;
import com.bigwigmedia.core.*;
public class KeyInputManager extends EventDispatcher implements IDisposable {
private var actionToMapperHash:Object;
private var target:InteractiveObject;
private var keySequences:Object;
private var keycodeToMapperHash:Object;
public function KeyInputManager(_arg1:InteractiveObject){
actionToMapperHash = {};
keycodeToMapperHash = {};
keySequences = {};
super();
this.target = _arg1;
this.target.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandler);
this.target.addEventListener(KeyboardEvent.KEY_UP, onKeyUpHandler);
}
public function mapKey(_arg1:String, _arg2:uint):void{
var _local3:KeyMapper;
_local3 = keycodeToMapperHash[_arg2];
if (_local3){
unmapKey(_local3.keyAction);
};
_local3 = actionToMapperHash[_arg1];
if (_local3){
unmapKey(_arg1);
};
_local3 = new KeyMapper(_arg1, _arg2);
actionToMapperHash[_arg1] = _local3;
keycodeToMapperHash[_arg2] = _local3;
}
public function unmapSequence(_arg1:String):void{
delete keySequences[_arg1];
}
private function onKeyDownHandler(_arg1:KeyboardEvent):void{
var _local4:KeySequence;
var _local2:uint = _arg1.keyCode;
var _local3:KeyMapper = keycodeToMapperHash[_local2];
if (_local3){
dispatchEvent(new KeyInputEvent((_local3.isDown) ? KeyInputEvent.KEY_HOLD : KeyInputEvent.KEY_DOWN, _local3.keyAction, _arg1.charCode, _local2, _arg1.keyLocation, _arg1.ctrlKey, _arg1.altKey, _arg1.shiftKey));
_local3.isDown = true;
};
for each (_local4 in keySequences) {
if (_local4.checkNext(_local2)){
dispatchEvent(new KeyInputEvent(KeyInputEvent.SEQUENCE, _local4.keyAction, _arg1.charCode, _local2, _arg1.keyLocation, _arg1.ctrlKey, _arg1.altKey, _arg1.shiftKey));
};
};
}
public function dispose():void{
unmapAll();
target.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandler);
target.removeEventListener(KeyboardEvent.KEY_UP, onKeyUpHandler);
target = null;
}
private function onKeyUpHandler(_arg1:KeyboardEvent):void{
var _local2:KeyMapper = keycodeToMapperHash[_arg1.keyCode];
if (_local2){
if (_local2.isDown){
dispatchEvent(new KeyInputEvent(KeyInputEvent.KEY_UP, _local2.keyAction, _arg1.charCode, _arg1.keyCode, _arg1.keyLocation, _arg1.ctrlKey, _arg1.altKey, _arg1.shiftKey));
};
_local2.isDown = false;
};
}
public function isKeyMapped(_arg1:uint):Boolean{
return (keycodeToMapperHash[_arg1]);
}
public function isKeyDown(_arg1:String):Boolean{
var _local2:KeyMapper = actionToMapperHash[_arg1];
return (((_local2) && (_local2.isDown)));
}
public function unmapKey(_arg1:String):void{
var _local2:KeyMapper = actionToMapperHash[_arg1];
if (_local2){
delete actionToMapperHash[_arg1];
delete keycodeToMapperHash[_local2.keyCode];
};
}
public function mapSequence(_arg1:String, _arg2:Array):void{
keySequences[_arg1] = new KeySequence(_arg1, _arg2.slice());
}
public function unmapAll():void{
actionToMapperHash = {};
keycodeToMapperHash = {};
keySequences = {};
}
public function depressAll():void{
var _local1:KeyMapper;
for each (_local1 in actionToMapperHash) {
_local1.isDown = false;
};
}
}
}//package com.bigwigmedia.input
Section 332
//KeyMapper (com.bigwigmedia.input.KeyMapper)
package com.bigwigmedia.input {
class KeyMapper {
public var keyCode:uint;
public var keyAction:String;
public var isDown:Boolean;// = false
function KeyMapper(_arg1:String, _arg2:uint){
this.keyAction = _arg1;
this.keyCode = _arg2;
}
}
}//package com.bigwigmedia.input
Section 333
//KeySequence (com.bigwigmedia.input.KeySequence)
package com.bigwigmedia.input {
import com.bigwigmedia.input.*;
class KeySequence {
private var sequence:Array;
public var keyAction:String;
private var nextKeyIndex:int;// = 0
function KeySequence(_arg1:String, _arg2:Array){
this.keyAction = _arg1;
this.sequence = _arg2;
}
public function checkNext(_arg1:uint):Boolean{
if (sequence[nextKeyIndex] != _arg1){
nextKeyIndex = 0;
};
if (sequence[nextKeyIndex] == _arg1){
if (++nextKeyIndex == sequence.length){
nextKeyIndex = 0;
return (true);
};
};
return (false);
}
}
}//package com.bigwigmedia.input
Section 334
//AbstractLoader (com.bigwigmedia.loaders.AbstractLoader)
package com.bigwigmedia.loaders {
import com.bigwigmedia.events.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import com.bigwigmedia.utils.*;
import flash.errors.*;
public class AbstractLoader extends EventDispatcher implements ILoader {
protected var _encrypted:Boolean;
protected var _status:String;// = "pending"
protected var _urlLoader:URLLoader;
protected var rc4:RC4;
protected var _url:String;
private static var _asyncDecryptionThreshold:uint = 4194304;
public function AbstractLoader(_arg1:String, _arg2:Boolean){
_url = _arg1;
_encrypted = _arg2;
}
public function get content(){
throw (new IllegalOperationError("Method is not supported in abstract class."));
}
private function onSecurityErrorHandler(_arg1:SecurityErrorEvent):void{
onErrorEvent(_arg1.text);
}
public function get encrypted():Boolean{
return (_encrypted);
}
private function onIOErrorHandler(_arg1:IOErrorEvent):void{
onErrorEvent(_arg1.text);
}
public function get bytesDecrypted():uint{
if (_status == LoaderStatus.READY){
return (_urlLoader.bytesTotal);
};
if (_status == LoaderStatus.DECRYPTING){
return (rc4.bytesDecrypted);
};
return (0);
}
public function get bytesLoaded():uint{
if (((!((_status == LoaderStatus.LOADING))) && (!((_status == LoaderStatus.READY))))){
return (0);
};
return (contentBytesLoaded);
}
public function decrypt(_arg1:String):void{
if (((_encrypted) && ((_status == LoaderStatus.LOADED)))){
_status = LoaderStatus.DECRYPTING;
rc4 = new RC4(_arg1);
rc4.addEventListener(Event.COMPLETE, onDecryptionCompleteHandler);
if (contentBytesTotal < AbstractLoader.asyncDecryptionThreshold){
rc4.decrypt((_urlLoader.data as ByteArray));
} else {
rc4.decryptAsync((_urlLoader.data as ByteArray));
};
};
}
protected function makeReady():void{
_status = LoaderStatus.READY;
destroyRC4();
dispatchEvent(new LoaderEvent(LoaderEvent.READY, this));
}
protected function get contentBytesLoaded():uint{
return (_urlLoader.bytesLoaded);
}
public function get bytesTotal():uint{
if ((((((_status == LoaderStatus.PENDING)) || ((_status == LoaderStatus.ERROR)))) || ((_status == LoaderStatus.DISPOSED)))){
return (0);
};
var _local1:uint = contentBytesLoaded;
var _local2:uint = contentBytesTotal;
if ((((_local2 == 0)) && ((_local1 > 0)))){
_local2 = _local1;
};
return (_local2);
}
protected function get contentDataFormat():String{
throw (new IllegalOperationError("Method is not supported in abstract class."));
}
private function onURLLoadCompleteHandler(_arg1:Event):void{
_status = LoaderStatus.LOADED;
dispatchEvent(new LoaderEvent(LoaderEvent.LOAD, this));
if (!_encrypted){
populateContent();
};
}
private function onDecryptionCompleteHandler(_arg1:Event):void{
populateContent();
}
public function load():void{
if (_status != LoaderStatus.PENDING){
return;
};
_status = LoaderStatus.LOADING;
_urlLoader = new URLLoader();
_urlLoader.dataFormat = contentDataFormat;
_urlLoader.addEventListener(Event.COMPLETE, onURLLoadCompleteHandler);
_urlLoader.addEventListener(IOErrorEvent.IO_ERROR, onIOErrorHandler);
_urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityErrorHandler);
try {
_urlLoader.load(new URLRequest(_url));
} catch(error:Error) {
onErrorEvent(error.message);
};
}
public function get percentDecrypted():Number{
if (_status == LoaderStatus.READY){
return (1);
};
if (_status == LoaderStatus.DECRYPTING){
return ((rc4.bytesDecrypted / bytesTotal));
};
return (0);
}
protected function destroyRC4():void{
if (rc4){
rc4.removeEventListener(Event.COMPLETE, onDecryptionCompleteHandler);
rc4.dispose();
rc4 = null;
};
}
public function get status():String{
return (_status);
}
protected function populateContent():void{
throw (new IllegalOperationError("Method is not supported in abstract class."));
}
protected function onErrorEvent(_arg1:String):void{
_status = LoaderStatus.ERROR;
dispatchEvent(new LoaderErrorEvent(LoaderErrorEvent.ERROR, this, ((_arg1 + " in loader: ") + _url)));
}
protected function get contentBytesTotal():uint{
return (_urlLoader.bytesTotal);
}
public function dispose():void{
if (_status == LoaderStatus.DISPOSED){
return;
};
_status = LoaderStatus.DISPOSED;
destroyRC4();
if (_urlLoader){
_urlLoader.removeEventListener(Event.COMPLETE, onURLLoadCompleteHandler);
_urlLoader.removeEventListener(IOErrorEvent.IO_ERROR, onIOErrorHandler);
_urlLoader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityErrorHandler);
try {
_urlLoader.close();
} catch(error:Error) {
};
_urlLoader = null;
};
}
public function get percentLoaded():Number{
if ((((((_status == LoaderStatus.PENDING)) || ((_status == LoaderStatus.ERROR)))) || ((_status == LoaderStatus.DISPOSED)))){
return (0);
};
var _local1:uint = contentBytesLoaded;
var _local2:uint = contentBytesTotal;
if (_local2 == 0){
return (((_local1 > 0)) ? 1 : 0);
};
return ((_local1 / _local2));
}
public function get url():String{
return (_url);
}
public static function set asyncDecryptionThreshold(_arg1:uint):void{
_asyncDecryptionThreshold = _arg1;
}
public static function get asyncDecryptionThreshold():uint{
return (_asyncDecryptionThreshold);
}
}
}//package com.bigwigmedia.loaders
Section 335
//ILoader (com.bigwigmedia.loaders.ILoader)
package com.bigwigmedia.loaders {
import flash.events.*;
import com.bigwigmedia.core.*;
public interface ILoader extends IEventDispatcher, IDisposable {
function get bytesTotal():uint;
function get bytesDecrypted():uint;
function get encrypted():Boolean;
function load():void;
function get percentDecrypted():Number;
function get percentLoaded():Number;
function decrypt(_arg1:String):void;
function get url():String;
function get bytesLoaded():uint;
function get status():String;
function get content();
}
}//package com.bigwigmedia.loaders
Section 336
//ISWFLoader (com.bigwigmedia.loaders.ISWFLoader)
package com.bigwigmedia.loaders {
import flash.system.*;
public interface ISWFLoader extends ILoader {
function getClass(_arg1:String):Class;
function get applicationDomain():ApplicationDomain;
}
}//package com.bigwigmedia.loaders
Section 337
//LoaderStatus (com.bigwigmedia.loaders.LoaderStatus)
package com.bigwigmedia.loaders {
public class LoaderStatus {
public static const READY:String = "ready";
public static const LOADED:String = "loaded";
public static const ERROR:String = "error";
public static const DISPOSED:String = "disposed";
public static const DECRYPTING:String = "decrypting";
public static const PENDING:String = "pending";
public static const LOADING:String = "loading";
}
}//package com.bigwigmedia.loaders
Section 338
//SWFLoader (com.bigwigmedia.loaders.SWFLoader)
package com.bigwigmedia.loaders {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.system.*;
import flash.net.*;
public class SWFLoader extends AbstractLoader implements ISWFLoader {
private var _nameToClassHash:Object;
protected var _loader:Loader;
protected var _applicationDomain:ApplicationDomain;
public function SWFLoader(_arg1:String, _arg2:ApplicationDomain=null, _arg3:Boolean=false){
_nameToClassHash = {};
super(_arg1, _arg3);
_applicationDomain = ((_arg2) || (new ApplicationDomain(ApplicationDomain.currentDomain)));
}
override public function dispose():void{
super.dispose();
if (_loader){
_loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, onLoaderCompleteHandler);
_loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, onLoaderIOErrorHandler);
try {
_loader.close();
} catch(error:Error) {
};
try {
_loader.unload();
} catch(error:Error) {
};
_loader = null;
};
_nameToClassHash = null;
_applicationDomain = null;
}
override protected function get contentDataFormat():String{
return (URLLoaderDataFormat.BINARY);
}
override protected function populateContent():void{
_loader = new Loader();
var context:LoaderContext = new LoaderContext(false, _applicationDomain, null);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaderCompleteHandler);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onLoaderIOErrorHandler);
try {
_loader.loadBytes((_urlLoader.data as ByteArray), context);
} catch(error:Error) {
onErrorEvent(error.message);
};
}
public function getClass(_arg1:String):Class{
var _local2:Class = _nameToClassHash[_arg1];
if (!_local2){
_local2 = (_nameToClassHash[_arg1] = Class(_applicationDomain.getDefinition(_arg1)));
};
return (_local2);
}
public function get applicationDomain():ApplicationDomain{
return (_applicationDomain);
}
override public function get content(){
return (((_status == LoaderStatus.READY)) ? _loader.content : null);
}
private function onLoaderIOErrorHandler(_arg1:IOErrorEvent):void{
onErrorEvent(_arg1.text);
}
private function onLoaderCompleteHandler(_arg1:Event):void{
makeReady();
}
}
}//package com.bigwigmedia.loaders
Section 339
//ILocale (com.bigwigmedia.locale.ILocale)
package com.bigwigmedia.locale {
public interface ILocale {
function getStringEx(_arg1:String, _arg2:String):String;
function get systemLanguageCode():String;
function get languageCode():String;
function getString(_arg1:String):String;
function set languageCode(_arg1:String):void;
function get languages():Array;
function addLanguageXML(_arg1:XML):void;
}
}//package com.bigwigmedia.locale
Section 340
//ControllerEvent (com.bigwigmedia.mvc.events.ControllerEvent)
package com.bigwigmedia.mvc.events {
import flash.events.*;
public class ControllerEvent extends Event {
private var _data:Object;
public static const COMPLETE:String = "ControllerEvent.complete";
public static const MESSAGE:String = "ControllerEvent.message";
public function ControllerEvent(_arg1:String, _arg2:Object=null){
super(_arg1);
_data = _arg2;
}
public function get data():Object{
return (_data);
}
override public function clone():Event{
return (new ControllerEvent(type, _data));
}
}
}//package com.bigwigmedia.mvc.events
Section 341
//EntityEvent (com.bigwigmedia.mvc.events.EntityEvent)
package com.bigwigmedia.mvc.events {
import flash.events.*;
import com.bigwigmedia.mvc.*;
public class EntityEvent extends EntityNativeEvent {
private var _data:Object;
public static const ADDED:String = "EntityEvent.added";
public static const UPDATE:String = "EntityEvent.update";
public static const REMOVED:String = "EntityEvent.removed";
public function EntityEvent(_arg1:String, _arg2:Object=null, _arg3:Boolean=false, _arg4:Boolean=false){
super(_arg1, _arg3, _arg4);
_data = _arg2;
}
public function get data():Object{
return (_data);
}
override public function clone():Event{
return (new EntityEvent(type, _data, bubbles, cancelable));
}
}
}//package com.bigwigmedia.mvc.events
Section 342
//ComponentView (com.bigwigmedia.mvc.ComponentView)
package com.bigwigmedia.mvc {
import flash.display.*;
import com.bigwigmedia.ui.*;
import flash.events.*;
import com.bigwigmedia.core.*;
public class ComponentView extends Sprite implements IDisposable {
protected var _component:Component;
public static var componentFactory:IComponentFactory;
public function ComponentView(){
createComponent();
}
protected function createComponent():void{
_component = componentFactory.create(this);
addChild(_component);
addEventListener(MouseEvent.CLICK, onMouseClickHandler);
}
protected function onMouseClick(_arg1:DisplayObject):void{
}
public function dispose():void{
removeEventListener(MouseEvent.CLICK, onMouseClickHandler);
removeChild(_component);
_component.dispose();
_component = null;
}
private function onMouseClickHandler(_arg1:MouseEvent):void{
targetClicked(_arg1.target);
}
public function getComponentByName(_arg1:String):Component{
return (_component.getComponentByName(_arg1));
}
protected function onComponentClick(_arg1:Component):void{
}
protected function targetClicked(_arg1:Object):void{
var _local2:Component = (_arg1 as Component);
if (((_local2) && (!((_local2 == _component))))){
onComponentClick(_local2);
} else {
onMouseClick(DisplayObject(_arg1));
};
}
public function get component():Component{
return (_component);
}
}
}//package com.bigwigmedia.mvc
Section 343
//DialogOption (com.bigwigmedia.mvc.DialogOption)
package com.bigwigmedia.mvc {
public class DialogOption {
public static const NO:String = "no";
public static const RETRY:String = "retry";
public static const YES:String = "yes";
public static const IGNORE:String = "ignore";
public static const ABORT:String = "abort";
public static const NONE:String = "none";
public static const CANCEL:String = "cancel";
public static const OK:String = "ok";
}
}//package com.bigwigmedia.mvc
Section 344
//DialogOwnerView (com.bigwigmedia.mvc.DialogOwnerView)
package com.bigwigmedia.mvc {
import flash.events.*;
public class DialogOwnerView extends ComponentView {
protected var _dialog:DialogView;
protected function onDialogClose():void{
}
protected function showDialog(_arg1:DialogView):void{
_dialog = _arg1;
_dialog.addEventListener(Event.CLOSE, onDialogCloseHandler);
addChild(_dialog);
}
override protected function targetClicked(_arg1:Object):void{
if (!_dialog){
super.targetClicked(_arg1);
};
}
private function onDialogCloseHandler(_arg1:Event):void{
if (_arg1.target == _dialog){
onDialogClose();
removeDialog();
};
}
protected function removeDialog():void{
removeChild(_dialog);
_dialog.dispose();
_dialog.removeEventListener(Event.CLOSE, onDialogCloseHandler);
_dialog = null;
}
override public function dispose():void{
if (_dialog){
removeDialog();
};
super.dispose();
}
}
}//package com.bigwigmedia.mvc
Section 345
//DialogView (com.bigwigmedia.mvc.DialogView)
package com.bigwigmedia.mvc {
import flash.events.*;
public class DialogView extends ComponentView {
protected var _option:String;
public function get option():String{
return (_option);
}
protected function dispatchCloseEvent(_arg1:String=null):void{
_option = _arg1;
dispatchEvent(new Event(Event.CLOSE));
}
}
}//package com.bigwigmedia.mvc
Section 346
//Entity (com.bigwigmedia.mvc.Entity)
package com.bigwigmedia.mvc {
import com.bigwigmedia.mvc.events.*;
import flash.events.*;
import com.bigwigmedia.core.*;
import com.bigwigmedia.utils.*;
public class Entity extends EventDispatcher implements IUpdatable, IDisposable {
protected var _parent:EntityContainer;
public var name:String;
private var _bubbleParent:EntityContainer;
private static var idCount:int = 0;
public function Entity(){
name = ((ClassUtil.getClassName(this) + "_") + idCount++);
}
override public function dispatchEvent(_arg1:Event):Boolean{
if (((_arg1.bubbles) && ((_arg1 is EntityNativeEvent)))){
return (dispatchEntityEvent(EntityNativeEvent(_arg1)));
};
return (super.dispatchEvent(_arg1));
}
public function get parent():EntityContainer{
return (_parent);
}
function setParent(_arg1:EntityContainer):void{
_parent = _arg1;
if (_arg1){
_bubbleParent = _arg1;
dispatchEntityEvent(new EntityEvent(EntityEvent.ADDED, null, true));
} else {
dispatchEntityEvent(new EntityEvent(EntityEvent.REMOVED, null, true));
_bubbleParent = _arg1;
};
}
public function update(_arg1:Number):void{
}
override public function toString():String{
return (name);
}
private function $dispatchEvent(_arg1:Event):Boolean{
return (super.dispatchEvent(_arg1));
}
private function dispatchEntityEvent(_arg1:EntityNativeEvent):Boolean{
var _local3:EntityContainer;
var _local4:EntityNativeEvent;
var _local2:Boolean;
if (hasEventListener(_arg1.type)){
_local2 = super.dispatchEvent(_arg1);
};
if (_arg1.bubbles){
_local3 = _bubbleParent;
while (((_local3) && (!(_arg1._stopped)))) {
if (_local3.hasEventListener(_arg1.type)){
_local4 = (_arg1.clone() as EntityNativeEvent);
_local4._target = this;
_local4._canceled = _local2;
_local4._eventPhase = EventPhase.BUBBLING_PHASE;
_local3.$dispatchEvent(new EventContainer(_local4));
_local2 = _local4._canceled;
};
_local3 = _local3._bubbleParent;
};
};
return (_local2);
}
public function dispose():void{
}
}
}//package com.bigwigmedia.mvc
import flash.events.*;
class EventContainer extends Event {
private var _event:Event;
private static const TARGET:Object = new Object();
private function EventContainer(_arg1:EntityNativeEvent){
super(_arg1.type, _arg1.bubbles, _arg1.cancelable);
_event = _arg1;
}
override public function get target():Object{
return (TARGET);
}
override public function clone():Event{
return (_event);
}
}
Section 347
//EntityContainer (com.bigwigmedia.mvc.EntityContainer)
package com.bigwigmedia.mvc {
public class EntityContainer extends Entity {
protected var _children:Array;
public function EntityContainer(){
_children = [];
super();
}
public function removeChildAt(_arg1:int):Entity{
if ((((_arg1 < 0)) || ((_arg1 >= _children.length)))){
throw (new RangeError("The supplied index is out of bounds."));
};
var _local2:Entity = _children.splice(_arg1, 1)[0];
_local2.setParent(null);
return (_local2);
}
public function getChildIndex(_arg1:Entity):int{
if (_arg1.parent != this){
throw (new ArgumentError((("Supplied entity " + _arg1.toString()) + " is not a child.")));
};
return (_children.indexOf(_arg1));
}
public function get numChildren():int{
return (_children.length);
}
override public function dispose():void{
var _local1:Entity;
while (_children.length > 0) {
_local1 = _children.pop();
_local1.setParent(null);
_local1.dispose();
};
}
public function removeChild(_arg1:Entity):Entity{
return (removeChildAt(getChildIndex(_arg1)));
}
public function removeLastChild():Entity{
if (_children.length == 0){
throw (RangeError("No child to remove."));
};
var _local1:Entity = _children.pop();
_local1.setParent(null);
return (_local1);
}
public function addChild(_arg1:Entity):Entity{
if (_arg1.parent == this){
return (_arg1);
};
if (_arg1 == this){
throw (new ArgumentError((("Entity " + _arg1.toString()) + " can't be added as a child of itself.")));
};
if (_arg1.parent){
throw (new ArgumentError((("Entity " + _arg1.toString()) + " can't be added as a child twice.")));
};
_children.push(_arg1);
_arg1.setParent(this);
return (_arg1);
}
public function getChildByName(_arg1:String):Entity{
var _local2:Entity;
for each (_local2 in _children) {
if (_local2.name == _arg1){
return (_local2);
};
};
return (null);
}
}
}//package com.bigwigmedia.mvc
Section 348
//EntityNativeEvent (com.bigwigmedia.mvc.EntityNativeEvent)
package com.bigwigmedia.mvc {
import flash.events.*;
public class EntityNativeEvent extends Event {
var _eventPhase:uint;
var _stopped:Boolean;// = false
var _target:Object;
var _canceled:Boolean;// = false
public function EntityNativeEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function get eventPhase():uint{
return (((_eventPhase) || (super.eventPhase)));
}
override public function isDefaultPrevented():Boolean{
return (_canceled);
}
override public function clone():Event{
return (new EntityNativeEvent(type, bubbles, cancelable));
}
override public function preventDefault():void{
if (cancelable){
_canceled = true;
};
}
override public function stopPropagation():void{
_stopped = true;
}
override public function get target():Object{
return (((_target) || (super.target)));
}
override public function stopImmediatePropagation():void{
super.stopImmediatePropagation();
_stopped = true;
}
}
}//package com.bigwigmedia.mvc
Section 349
//IComponentFactory (com.bigwigmedia.mvc.IComponentFactory)
package com.bigwigmedia.mvc {
import com.bigwigmedia.ui.*;
public interface IComponentFactory {
function create(_arg1:ComponentView):Component;
}
}//package com.bigwigmedia.mvc
Section 350
//IController (com.bigwigmedia.mvc.IController)
package com.bigwigmedia.mvc {
import flash.display.*;
import flash.events.*;
import com.bigwigmedia.core.*;
public interface IController extends IEventDispatcher, IDisposable {
function get view():DisplayObject;
}
}//package com.bigwigmedia.mvc
Section 351
//ISOManager (com.bigwigmedia.net.ISOManager)
package com.bigwigmedia.net {
import flash.events.*;
public interface ISOManager extends IEventDispatcher {
function flush(_arg1:int=0):String;
function get dataEmpty():Boolean;
function getValue(_arg1:String);
function clear():void;
function setValue(_arg1:String, _arg2):void;
}
}//package com.bigwigmedia.net
Section 352
//IURLCaller (com.bigwigmedia.net.IURLCaller)
package com.bigwigmedia.net {
public interface IURLCaller {
function submitScore(_arg1:Object):void;
function mainLink():void;
function viewScores():void;
function playMoreGames():void;
function getURL(_arg1:String, _arg2:String="_blank"):void;
function downloadGame():void;
function getGame():void;
}
}//package com.bigwigmedia.net
Section 353
//SOManager (com.bigwigmedia.net.SOManager)
package com.bigwigmedia.net {
import flash.events.*;
import com.bigwigmedia.core.*;
import flash.net.*;
import com.bigwigmedia.utils.*;
public class SOManager extends EventDispatcher implements ISOManager {
private var dataObject:Object;
private var so:SharedObject;
public function SOManager(){
super();
Singleton.checkInstance(this);
try {
so = SharedObject.getLocal(Globals.application.info.sharedObjectName, Globals.application.info.sharedObjectPath);
so.addEventListener(NetStatusEvent.NET_STATUS, onNetStatusEventHandler);
dataObject = so.data;
} catch(e:Error) {
dataObject = {};
};
}
private function onNetStatusEventHandler(_arg1:NetStatusEvent):void{
dispatchEvent(_arg1.clone());
}
public function getValue(_arg1:String){
return (dataObject[_arg1]);
}
public function get dataEmpty():Boolean{
var _local1:Boolean = ObjectUtil.hasProperties(dataObject);
return (!(_local1));
}
public function flush(_arg1:int=0):String{
if (so){
return (so.flush(_arg1));
};
return (SharedObjectFlushStatus.FLUSHED);
}
public function clear():void{
var _local1:String;
if (so){
for (_local1 in dataObject) {
delete dataObject[_local1];
};
so.clear();
} else {
dataObject = {};
};
}
public function setValue(_arg1:String, _arg2):void{
if (_arg2 === undefined){
delete dataObject[_arg1];
} else {
dataObject[_arg1] = _arg2;
};
}
}
}//package com.bigwigmedia.net
Section 354
//URLCaller_2DPlay (com.bigwigmedia.net.URLCaller_2DPlay)
package com.bigwigmedia.net {
import com.bigwigmedia.core.*;
import com.adobe.crypto.*;
import flash.net.*;
public class URLCaller_2DPlay implements IURLCaller {
private var applicationID:String;
public function URLCaller_2DPlay(){
Singleton.checkInstance(this);
applicationID = Globals.application.info.id;
}
public function submitScore(_arg1:Object):void{
var _local2:String = MD5.hash((((("gameid=" + applicationID) + "&hiscore=") + _arg1.toString()) + "2DPlay.com/"));
var _local3:String = ((((("http://www.2DPlay.com/highscores.php?gameid=" + applicationID) + "&hiscore=") + _arg1.toString()) + "&hash=") + _local2);
getURL(_local3);
}
public function viewScores():void{
getURL(("http://www.2Dplay.com/showscores.php?gameid=" + applicationID));
}
public function getGame():void{
getURL("http://www.2DPlay.com/freecontent.htm");
}
public function mainLink():void{
getURL(("http://www.2DPlay.com/index.php?gameid=" + applicationID));
}
public function playMoreGames():void{
getURL(("http://www.2DPlay.com/index.php?gameid=" + applicationID));
}
public function getURL(_arg1:String, _arg2:String="_blank"):void{
navigateToURL(new URLRequest(_arg1), _arg2);
}
public function downloadGame():void{
getURL(("http://www.2DPlay.com/downloadgame.php?gameid=" + applicationID));
}
}
}//package com.bigwigmedia.net
Section 355
//AbstractPreloader (com.bigwigmedia.preloaders.AbstractPreloader)
package com.bigwigmedia.preloaders {
import flash.display.*;
import com.bigwigmedia.core.*;
public class AbstractPreloader extends Sprite implements IDisposable {
public function get percentLoaded():Number{
if (!root){
return (0);
};
var _local1:uint = root.loaderInfo.bytesLoaded;
var _local2:uint = root.loaderInfo.bytesTotal;
if (_local2 == 0){
return (((_local1 > 0)) ? 1 : 0);
};
return ((_local1 / _local2));
}
public function dispose():void{
}
}
}//package com.bigwigmedia.preloaders
Section 356
//Channel (com.bigwigmedia.sound.Channel)
package com.bigwigmedia.sound {
import com.bigwigmedia.events.*;
import com.bigwigmedia.tweens.*;
public class Channel implements IChannel {
private var _pan:Number;// = 0
private var _tween:ITween;
private var _transitionVolume:Number;// = 1
private var _recordsHash:Object;
private var _volume:Number;// = 1
public function Channel(){
_recordsHash = new Object();
super();
}
public function playNextSound(_arg1:String, _arg2:int, _arg3:Number, _arg4:Number):void{
stopTween();
if (playing){
_tween = new SequenceTween([new SetterTween(this, setTransitionVolume, _transitionVolume, 0, _arg3), new Action(this, _playNextSound, [_arg1, _arg2]), new SetterTween(this, setTransitionVolume, 0, 1, _arg4)]);
} else {
setTransitionVolume(0);
_tween = new SequenceTween([new Action(this, _playNextSound, [_arg1, _arg2]), new SetterTween(this, setTransitionVolume, 0, 1, _arg4)]);
};
_tween.addEventListener(TweenEvent.COMPLETE, onTweenCompleteHandler);
_tween.playAuto();
}
private function stopTween():void{
if (_tween){
_tween.removeEventListener(TweenEvent.COMPLETE, onTweenCompleteHandler);
_tween.dispose();
_tween = null;
};
}
private function _playNextSound(_arg1:String, _arg2:int):void{
var _local3:Record;
for each (_local3 in _recordsHash) {
_local3.stop();
};
if (_arg1){
_recordsHash[_arg1].play(_arg2);
};
}
public function stop():void{
var _local1:Record;
stopTween();
for each (_local1 in _recordsHash) {
_local1.stop();
};
}
function registerRecord(_arg1:String, _arg2:Record):void{
if (!_recordsHash[_arg1]){
_arg2.channelVolume = _volume;
_arg2.channelPan = _pan;
_recordsHash[_arg1] = _arg2;
};
}
private function setTransitionVolume(_arg1:Number):void{
var _local2:Record;
_transitionVolume = _arg1;
for each (_local2 in _recordsHash) {
_local2.volume = _arg1;
};
}
private function onTweenCompleteHandler(_arg1:TweenEvent):void{
stopTween();
}
function unregisterRecord(_arg1:String):void{
var _local2:Record = _recordsHash[_arg1];
if (_local2){
stopTween();
_local2.dispose();
delete _recordsHash[_arg1];
};
}
public function get playing():Boolean{
var _local1:Record;
for each (_local1 in _recordsHash) {
if (_local1.playing){
return (true);
};
};
return (false);
}
public function set pan(_arg1:Number):void{
var _local2:Record;
_pan = _arg1;
for each (_local2 in _recordsHash) {
_local2.channelPan = _pan;
};
}
public function set volume(_arg1:Number):void{
var _local2:Record;
_volume = _arg1;
for each (_local2 in _recordsHash) {
_local2.channelVolume = _volume;
};
}
}
}//package com.bigwigmedia.sound
Section 357
//IChannel (com.bigwigmedia.sound.IChannel)
package com.bigwigmedia.sound {
public interface IChannel {
function stop():void;
function set volume(_arg1:Number):void;
function playNextSound(_arg1:String, _arg2:int, _arg3:Number, _arg4:Number):void;
function set pan(_arg1:Number):void;
function get playing():Boolean;
}
}//package com.bigwigmedia.sound
Section 358
//IRecord (com.bigwigmedia.sound.IRecord)
package com.bigwigmedia.sound {
import com.bigwigmedia.core.*;
public interface IRecord extends IDisposable {
function set pan(_arg1:Number):void;
function stop():void;
function play(_arg1:int):void;
function get volume():Number;
function set volume(_arg1:Number):void;
function playSingle(_arg1:int):Boolean;
function get pan():Number;
function get playing():Boolean;
}
}//package com.bigwigmedia.sound
Section 359
//ISoundManager (com.bigwigmedia.sound.ISoundManager)
package com.bigwigmedia.sound {
public interface ISoundManager {
function stopChannel(_arg1:String):void;
function stop(_arg1:String):void;
function registerRecord(_arg1:String, _arg2:Class, _arg3:String="defaultChannel"):void;
function getChannel(_arg1:String):IChannel;
function playNext(_arg1:String, _arg2:String=null, _arg3:int=1, _arg4:Number=60, _arg5:Number=60):void;
function setAllChannelsVolume(_arg1:Number):void;
function setPan(_arg1:String, _arg2:Number):void;
function playSingle(_arg1:String, _arg2:int=1):Boolean;
function unregisterRecord(_arg1:String):void;
function getRecord(_arg1:String):IRecord;
function play(_arg1:String, _arg2:int=1):void;
function setVolume(_arg1:String, _arg2:Number):void;
function set masterVolume(_arg1:Number):void;
function setChannelVolume(_arg1:String, _arg2:Number):void;
function setChannelPan(_arg1:String, _arg2:Number):void;
function get masterVolume():Number;
function stopAll():void;
}
}//package com.bigwigmedia.sound
Section 360
//Record (com.bigwigmedia.sound.Record)
package com.bigwigmedia.sound {
import flash.events.*;
import flash.utils.*;
import flash.media.*;
public class Record implements IRecord {
private var _volume:Number;// = 1
private var _masterVolume:Number;// = 1
private var _soundTransform:SoundTransform;
private var _sound:Sound;
private var _pan:Number;// = 0
private var _playing:Boolean;// = false
private var _channels:Dictionary;
private var _numChannelsPlaying:int;// = 0
private var _channelPan:Number;// = 0
private var _channelVolume:Number;// = 1
public function Record(_arg1:Sound){
_soundTransform = new SoundTransform();
_channels = new Dictionary();
super();
_sound = _arg1;
}
function set channelPan(_arg1:Number):void{
_channelPan = _arg1;
setResultTransform();
}
public function stop():void{
var _local1:SoundChannel;
if (_playing){
for each (_local1 in _channels) {
_local1.stop();
_local1.removeEventListener(Event.SOUND_COMPLETE, onCompleteHandler);
delete _channels[_local1];
};
_numChannelsPlaying = 0;
_playing = false;
};
}
private function onCompleteHandler(_arg1:Event):void{
var _local2:SoundChannel = SoundChannel(_arg1.target);
_local2.removeEventListener(Event.SOUND_COMPLETE, onCompleteHandler);
delete _channels[_local2];
if (--_numChannelsPlaying == 0){
_playing = false;
};
}
public function set volume(_arg1:Number):void{
_volume = _arg1;
setResultTransform();
}
private function setResultTransform():void{
var _local3:SoundChannel;
var _local1:Number = (_pan + _channelPan);
if (_local1 < -1){
_local1 = -1;
} else {
if (_local1 > 1){
_local1 = 1;
};
};
_soundTransform.pan = _local1;
var _local2:Number = (_volume * _channelVolume);
_soundTransform.volume = ((_local2 > _masterVolume)) ? _masterVolume : _local2;
if (_playing){
for each (_local3 in _channels) {
_local3.soundTransform = _soundTransform;
};
};
}
public function set pan(_arg1:Number):void{
_pan = _arg1;
setResultTransform();
}
public function get volume():Number{
return (_volume);
}
public function playSingle(_arg1:int):Boolean{
if (_playing){
return (false);
};
play(_arg1);
return (true);
}
public function get pan():Number{
return (_pan);
}
public function dispose():void{
stop();
_sound = null;
_soundTransform = null;
}
public function play(_arg1:int):void{
var _local2:SoundChannel = _sound.play(0, _arg1, _soundTransform);
if (_local2){
_local2.addEventListener(Event.SOUND_COMPLETE, onCompleteHandler);
_channels[_local2] = _local2;
_numChannelsPlaying++;
_playing = true;
};
}
public function get playing():Boolean{
return (_playing);
}
function set channelVolume(_arg1:Number):void{
_channelVolume = _arg1;
setResultTransform();
}
function set masterVolume(_arg1:Number):void{
_masterVolume = _arg1;
if (_masterVolume < 0){
_masterVolume = 0;
} else {
if (_masterVolume > 1){
_masterVolume = 1;
};
};
setResultTransform();
}
}
}//package com.bigwigmedia.sound
Section 361
//SoundManager (com.bigwigmedia.sound.SoundManager)
package com.bigwigmedia.sound {
import com.bigwigmedia.core.*;
public class SoundManager implements ISoundManager {
private var channelsHash:Object;
private var _maxVolume:Number;// = 1
private var recordsHash:Object;
public function SoundManager(){
channelsHash = {};
recordsHash = {};
super();
Singleton.checkInstance(this);
}
public function stop(_arg1:String):void{
var _local2:Record = recordsHash[_arg1];
_local2.stop();
}
public function play(_arg1:String, _arg2:int=1):void{
var _local3:Record = recordsHash[_arg1];
_local3.play(_arg2);
}
public function playNext(_arg1:String, _arg2:String=null, _arg3:int=1, _arg4:Number=60, _arg5:Number=60):void{
var _local6:Channel = channelsHash[_arg1];
_local6.playNextSound(_arg2, _arg3, _arg4, _arg5);
}
public function getChannel(_arg1:String):IChannel{
return (channelsHash[_arg1]);
}
public function setAllChannelsVolume(_arg1:Number):void{
var _local2:Channel;
for each (_local2 in channelsHash) {
_local2.volume = _arg1;
};
}
public function getRecord(_arg1:String):IRecord{
return (recordsHash[_arg1]);
}
public function registerRecord(_arg1:String, _arg2:Class, _arg3:String="default_channel"):void{
if (recordsHash[_arg1]){
throw (new Error((("Record with \"" + _arg1) + "\" identifier already exists.")));
};
var _local4:Channel = channelsHash[_arg3];
if (!_local4){
_local4 = new Channel();
channelsHash[_arg3] = _local4;
};
var _local5:Record = new Record(new (_arg2));
recordsHash[_arg1] = _local5;
_local4.registerRecord(_arg1, _local5);
}
public function stopChannel(_arg1:String):void{
var _local2:Channel = channelsHash[_arg1];
_local2.stop();
}
public function setVolume(_arg1:String, _arg2:Number):void{
var _local3:Record = recordsHash[_arg1];
_local3.volume = _arg2;
}
public function playSingle(_arg1:String, _arg2:int=1):Boolean{
var _local3:Record = recordsHash[_arg1];
return (_local3.playSingle(_arg2));
}
public function setPan(_arg1:String, _arg2:Number):void{
var _local3:Record = recordsHash[_arg1];
_local3.pan = _arg2;
}
public function setChannelPan(_arg1:String, _arg2:Number):void{
var _local3:Channel = channelsHash[_arg1];
_local3.pan = _arg2;
}
public function unregisterRecord(_arg1:String):void{
var _local2:Channel;
if (!recordsHash[_arg1]){
throw (new Error((("Record with \"" + _arg1) + "\" identifier doesn't exist.")));
};
for each (_local2 in channelsHash) {
_local2.unregisterRecord(_arg1);
};
delete recordsHash[_arg1];
}
public function get masterVolume():Number{
return (_maxVolume);
}
public function set masterVolume(_arg1:Number):void{
var _local2:Record;
_maxVolume = _arg1;
for each (_local2 in recordsHash) {
_local2.masterVolume = _arg1;
};
}
public function setChannelVolume(_arg1:String, _arg2:Number):void{
var _local3:Channel = channelsHash[_arg1];
_local3.volume = _arg2;
}
public function stopAll():void{
var _local1:Record;
for each (_local1 in recordsHash) {
_local1.stop();
};
}
}
}//package com.bigwigmedia.sound
Section 362
//HSMError (com.bigwigmedia.stateMachine.errors.HSMError)
package com.bigwigmedia.stateMachine.errors {
public class HSMError extends Error {
public function HSMError(_arg1:String=""){
super(_arg1);
}
}
}//package com.bigwigmedia.stateMachine.errors
Section 363
//HSMEvent (com.bigwigmedia.stateMachine.events.HSMEvent)
package com.bigwigmedia.stateMachine.events {
import com.bigwigmedia.stateMachine.*;
import flash.events.*;
public class HSMEvent extends Event {
private var _state:AbstractState;
private var _event:AbstractEvent;
public static const COMPLETE:String = "HSMEvent.complete";
public static const START:String = "HSMEvent.start";
public static const EVENT_RECIEVE:String = "HSMEvent.eventRecieve";
public static const STATE_CHANGE:String = "HSMEvent.stateChange";
public function HSMEvent(_arg1:String, _arg2:AbstractState=null, _arg3:AbstractEvent=null){
super(_arg1);
_state = _arg2;
_event = _arg3;
}
public function get state():AbstractState{
return (_state);
}
public function get event():AbstractEvent{
return (_event);
}
override public function toString():String{
return (formatToString("HSMEvent", "type", "state", "event"));
}
override public function clone():Event{
return (new HSMEvent(type, _state, _event));
}
}
}//package com.bigwigmedia.stateMachine.events
Section 364
//StateEvent (com.bigwigmedia.stateMachine.events.StateEvent)
package com.bigwigmedia.stateMachine.events {
import flash.events.*;
public class StateEvent extends Event {
private var _data:Object;
public static const ADDED_TRIGGER:String = "StateEvent.addedTrigger";
public static const DEACTIVATE:String = "StateEvent.deactivate";
public function StateEvent(_arg1:String, _arg2:Object=null){
super(_arg1);
_data = _arg2;
}
public function get data():Object{
return (_data);
}
override public function clone():Event{
return (new StateEvent(type, _data));
}
}
}//package com.bigwigmedia.stateMachine.events
Section 365
//TriggerEvent (com.bigwigmedia.stateMachine.events.TriggerEvent)
package com.bigwigmedia.stateMachine.events {
import com.bigwigmedia.stateMachine.*;
import flash.events.*;
public class TriggerEvent extends Event {
private var _raisedEvent:AbstractEvent;
public static const TRIGGER:String = "TriggerEvent.trigger";
public function TriggerEvent(_arg1:String, _arg2:AbstractEvent){
super(_arg1);
_raisedEvent = _arg2;
}
public function get raisedEvent():AbstractEvent{
return (_raisedEvent);
}
override public function clone():Event{
return (new TriggerEvent(type, _raisedEvent));
}
}
}//package com.bigwigmedia.stateMachine.events
Section 366
//AbstractEvent (com.bigwigmedia.stateMachine.AbstractEvent)
package com.bigwigmedia.stateMachine {
public class AbstractEvent {
var _triggerID:int;
public function toString():String{
return ("[AbstractEvent]");
}
}
}//package com.bigwigmedia.stateMachine
Section 367
//AbstractState (com.bigwigmedia.stateMachine.AbstractState)
package com.bigwigmedia.stateMachine {
import com.bigwigmedia.stateMachine.events.*;
import flash.events.*;
import com.bigwigmedia.core.*;
import com.bigwigmedia.stateMachine.errors.*;
import com.bigwigmedia.utils.*;
public class AbstractState extends EventDispatcher implements IUpdatable, IDisposable {
private var _id:int;
public var name:String;
private var _parent:CompositeState;
private var updatableTriggers:Array;
private var _active:Boolean;// = false
private var _owned:Boolean;// = false
protected var transitionsList:Array;
private static var idCount:int = 0;
public function AbstractState(){
transitionsList = [];
updatableTriggers = [];
super();
_id = idCount++;
name = ("State_" + _id);
}
function setParent(_arg1:CompositeState):void{
_parent = _arg1;
}
public function update(_arg1:Number):void{
var _local2:IUpdatable;
for each (_local2 in updatableTriggers) {
_local2.update(_arg1);
};
}
public function get id():int{
return (_id);
}
public function isAncestor(_arg1:AbstractState):Boolean{
var _local2:AbstractState = _parent;
while (_local2) {
if (_local2 == _arg1){
return (true);
};
_local2 = _local2.parent;
};
return (false);
}
function setOwned(_arg1:Boolean):void{
_owned = _arg1;
}
public function get parent():CompositeState{
return (_parent);
}
override public function toString():String{
return (formatToString(this, "name"));
}
public function addTransition(_arg1:AbstractState, _arg2:AbstractTrigger=null, _arg3:Function=null, _arg4:Function=null):void{
var _local6:Transition;
_arg2 = ((_arg2) || (new EmptyTrigger()));
var _local5:Transition = new Transition(this, _arg1, _arg2, _arg3, _arg4);
for each (_local6 in transitionsList) {
if (_local6.conflicts(_local5)){
throw (new HSMError((("State " + this.toString()) + " have conflicting outgoing transitions.")));
};
};
transitionsList.push(_local5);
if ((_arg2 is IUpdatable)){
updatableTriggers.push(_arg2);
};
dispatchEvent(new StateEvent(StateEvent.ADDED_TRIGGER, _arg2));
}
public function getActiveTransition(_arg1:AbstractEvent):Transition{
var _local4:Transition;
var _local2:int = transitionsList.length;
var _local3:int;
while (_local3 < _local2) {
_local4 = transitionsList[_local3];
if (_local4.willFire(_arg1)){
return (_local4);
};
_local3++;
};
return (null);
}
public function dispose():void{
var _local1:Transition;
deactivate(null);
for each (_local1 in transitionsList) {
_local1.dispose();
};
transitionsList = [];
updatableTriggers = [];
_parent = null;
}
public function getTransitionLevel(_arg1:AbstractState):String{
if (this == _arg1){
return (TransitionLevel.TO_SELF);
};
if (this.parent == _arg1.parent){
return (TransitionLevel.TO_SIBLING);
};
if (this.isAncestor(_arg1)){
return (TransitionLevel.TO_ANCESTOR);
};
if (_arg1.isAncestor(this)){
return (TransitionLevel.TO_DESCENDANT);
};
return (TransitionLevel.TO_IRRELATIVE);
}
public function activate(_arg1:AbstractEvent):void{
var _local2:Transition;
_active = true;
for each (_local2 in transitionsList) {
_local2.trigger.activate();
};
}
public function deactivate(_arg1:AbstractEvent):void{
var _local2:Transition;
_active = false;
for each (_local2 in transitionsList) {
_local2.trigger.deactivate();
};
dispatchEvent(new StateEvent(StateEvent.DEACTIVATE));
}
public function get owned():Boolean{
return (_owned);
}
}
}//package com.bigwigmedia.stateMachine
Section 368
//AbstractTrigger (com.bigwigmedia.stateMachine.AbstractTrigger)
package com.bigwigmedia.stateMachine {
import flash.events.*;
import com.bigwigmedia.core.*;
public class AbstractTrigger extends EventDispatcher implements IDisposable {
protected var _id:int;
private static var idCount:int = 0;
public function AbstractTrigger(){
_id = idCount++;
}
function activate():void{
}
public function dispose():void{
}
public function willFire(_arg1:AbstractEvent):Boolean{
throw (new Error("Method must be overriden in subclass."));
}
function deactivate():void{
}
public function equals(_arg1:AbstractTrigger):Boolean{
throw (new Error("Method must be overriden in subclass."));
}
}
}//package com.bigwigmedia.stateMachine
Section 369
//ChoiceState (com.bigwigmedia.stateMachine.ChoiceState)
package com.bigwigmedia.stateMachine {
import com.bigwigmedia.stateMachine.errors.*;
public class ChoiceState extends AbstractState {
override public function addTransition(_arg1:AbstractState, _arg2:AbstractTrigger=null, _arg3:Function=null, _arg4:Function=null):void{
if (((_arg2) && (!((_arg2 is EmptyTrigger))))){
throw (new HSMError("Transition from ChoiceState may not have a trigger."));
};
super.addTransition(_arg1, _arg2, _arg3, _arg4);
}
}
}//package com.bigwigmedia.stateMachine
Section 370
//CompositeState (com.bigwigmedia.stateMachine.CompositeState)
package com.bigwigmedia.stateMachine {
import com.bigwigmedia.stateMachine.events.*;
import com.bigwigmedia.stateMachine.errors.*;
public class CompositeState extends SimpleState {
private var substatesList:Array;
private var _initialState:InitialState;
private var _lastActiveState:AbstractState;
private var hasHistoryState:Boolean;// = false
public function CompositeState(_arg1:Function=null, _arg2:Function=null, _arg3:Function=null){
substatesList = [];
super(_arg1, _arg2, _arg3);
}
private function onStateDeactivateHandler(_arg1:StateEvent):void{
if (hasHistoryState){
_lastActiveState = (_arg1.target as AbstractState);
};
}
public function get initial():InitialState{
return (_initialState);
}
public function addState(_arg1:AbstractState):AbstractState{
if (_arg1.owned){
throw (new HSMError("State can't be added twice."));
};
if ((_arg1 is InitialState)){
if (_initialState){
throw (new HSMError("CompositeState can have at most one InitialState."));
};
_initialState = (_arg1 as InitialState);
} else {
if ((_arg1 is HistoryState)){
if (hasHistoryState){
throw (new HSMError("CompositeState can have at most one HistoryState."));
};
hasHistoryState = true;
};
};
_arg1.addEventListener(StateEvent.ADDED_TRIGGER, onAddedTriggerHandler);
_arg1.addEventListener(StateEvent.DEACTIVATE, onStateDeactivateHandler);
substatesList.push(_arg1);
_arg1.setParent(this);
_arg1.setOwned(true);
return (_arg1);
}
private function onAddedTriggerHandler(_arg1:StateEvent):void{
dispatchEvent(_arg1.clone());
}
public function get history():AbstractState{
return (((_lastActiveState) || (_initialState)));
}
override public function dispose():void{
var _local1:AbstractState;
for each (_local1 in substatesList) {
_local1.removeEventListener(StateEvent.DEACTIVATE, onStateDeactivateHandler);
_local1.removeEventListener(StateEvent.ADDED_TRIGGER, onAddedTriggerHandler);
_local1.dispose();
};
substatesList = [];
_initialState = null;
_lastActiveState = null;
super.dispose();
}
}
}//package com.bigwigmedia.stateMachine
Section 371
//DelayEvent (com.bigwigmedia.stateMachine.DelayEvent)
package com.bigwigmedia.stateMachine {
import com.bigwigmedia.utils.*;
public class DelayEvent extends AbstractEvent {
private var _delay:Object;
public function DelayEvent(_arg1:Object){
_delay = _arg1;
}
public function get delay():Object{
return (_delay);
}
override public function toString():String{
return (formatToString(this, "delay"));
}
}
}//package com.bigwigmedia.stateMachine
Section 372
//DelayTrigger (com.bigwigmedia.stateMachine.DelayTrigger)
package com.bigwigmedia.stateMachine {
import com.bigwigmedia.stateMachine.events.*;
import com.bigwigmedia.core.*;
public class DelayTrigger extends AbstractTrigger implements IUpdatable {
private var _delay:Object;
private var _time:Number;
private var _delayValue:Number;
public function DelayTrigger(_arg1:Object){
if (((((_arg1 is Number) == false)) && (((_arg1 is String) == false)))){
throw (new ArgumentError("Supplied delay value must be Number or String"));
};
_delay = _arg1;
_delayValue = Number(_arg1);
}
override function activate():void{
_time = 0;
}
override public function equals(_arg1:AbstractTrigger):Boolean{
var _local2:DelayTrigger = (_arg1 as DelayTrigger);
return (((_local2) && ((_local2._delay === _delay))));
}
override public function willFire(_arg1:AbstractEvent):Boolean{
return ((_arg1._triggerID == _id));
}
public function update(_arg1:Number):void{
var _local3:DelayEvent;
var _local2:Boolean;
if (_time < _delayValue){
if ((_delay is String)){
_time++;
} else {
_time = (_time + _arg1);
if (_time > _delayValue){
_time = _delayValue;
};
};
} else {
_local3 = new DelayEvent(_delay);
_local3._triggerID = _id;
dispatchEvent(new TriggerEvent(TriggerEvent.TRIGGER, _local3));
};
}
}
}//package com.bigwigmedia.stateMachine
Section 373
//EmptyEvent (com.bigwigmedia.stateMachine.EmptyEvent)
package com.bigwigmedia.stateMachine {
public class EmptyEvent extends AbstractEvent {
}
}//package com.bigwigmedia.stateMachine
Section 374
//EmptyTrigger (com.bigwigmedia.stateMachine.EmptyTrigger)
package com.bigwigmedia.stateMachine {
public class EmptyTrigger extends AbstractTrigger {
override public function willFire(_arg1:AbstractEvent):Boolean{
return ((_arg1 is EmptyEvent));
}
override public function equals(_arg1:AbstractTrigger):Boolean{
return ((_arg1 is EmptyTrigger));
}
}
}//package com.bigwigmedia.stateMachine
Section 375
//FinalState (com.bigwigmedia.stateMachine.FinalState)
package com.bigwigmedia.stateMachine {
import com.bigwigmedia.stateMachine.errors.*;
public class FinalState extends SimpleState {
override public function addTransition(_arg1:AbstractState, _arg2:AbstractTrigger=null, _arg3:Function=null, _arg4:Function=null):void{
throw (new HSMError("FinalState can't have any outgoing transitions."));
}
}
}//package com.bigwigmedia.stateMachine
Section 376
//FSM (com.bigwigmedia.stateMachine.FSM)
package com.bigwigmedia.stateMachine {
import com.bigwigmedia.stateMachine.events.*;
import flash.events.*;
import com.bigwigmedia.stateMachine.errors.*;
public class FSM extends EventDispatcher implements IStateMachine {
protected var statesList:Array;
protected var started:Boolean;// = false
protected var completed:Boolean;// = false
protected var currentState:AbstractState;
protected var inTransition:Boolean;// = false
protected var eventsQueue:Array;
public function FSM(){
statesList = [];
eventsQueue = [];
super();
}
public function update(_arg1:Number):void{
currentState.update(_arg1);
}
protected function doTransition():void{
var _local1:AbstractEvent;
var _local2:Transition;
if (((inTransition) || ((eventsQueue.length == 0)))){
return;
};
inTransition = true;
while (eventsQueue.length > 0) {
_local1 = eventsQueue.shift();
_local2 = currentState.getActiveTransition(_local1);
if (_local2){
currentState = _local2.target;
_local2.source.deactivate(_local1);
_local2.invokeEffect(_local1);
_local2.target.activate(_local1);
dispatchEvent(new HSMEvent(HSMEvent.STATE_CHANGE, currentState, _local1));
if ((((currentState is FinalState)) && (!(currentState.parent)))){
completed = true;
dispatchEvent(new HSMEvent(HSMEvent.COMPLETE, currentState, _local1));
break;
};
sendEvent(new EmptyEvent());
};
};
inTransition = false;
}
public function sendSignal(_arg1:String, _arg2:Object=null):void{
sendEvent(new SignalEvent(_arg1, _arg2));
}
public function dispose():void{
var _local1:AbstractState;
for each (_local1 in statesList) {
_local1.removeEventListener(StateEvent.ADDED_TRIGGER, onAddedTriggerHandler);
_local1.dispose();
};
statesList = [];
currentState = null;
started = false;
}
public function start():void{
if (started){
return;
};
if (!currentState){
throw (new HSMError("InitialState doesn't exist or is not immediate state of state machine."));
};
started = true;
dispatchEvent(new HSMEvent(HSMEvent.START));
sendEvent(new EmptyEvent());
}
protected function stateAdded(_arg1:AbstractState):void{
_arg1.addEventListener(StateEvent.ADDED_TRIGGER, onAddedTriggerHandler);
statesList.push(_arg1);
_arg1.setOwned(true);
}
public function addState(_arg1:AbstractState):AbstractState{
if (_arg1.owned){
throw (new HSMError("State can't be added twice."));
};
if ((_arg1 is CompositeState)){
throw (new HSMError("FSM cannot have composite states."));
};
if ((_arg1 is HistoryState)){
throw (new HSMError("State machine can't have any HistoryState."));
};
if ((_arg1 is InitialState)){
if (currentState){
throw (new HSMError("State machine can have at most one InitialState."));
};
currentState = (_arg1 as InitialState);
};
stateAdded(_arg1);
return (_arg1);
}
private function onTriggerHandler(_arg1:TriggerEvent):void{
sendEvent(_arg1.raisedEvent);
}
protected function sendEvent(_arg1:AbstractEvent):void{
if (!started){
throw (new HSMError("State machine is not started."));
};
dispatchEvent(new HSMEvent(HSMEvent.EVENT_RECIEVE, currentState, _arg1));
if (!completed){
eventsQueue.push(_arg1);
doTransition();
};
}
private function onAddedTriggerHandler(_arg1:StateEvent):void{
var _local2:AbstractTrigger = (_arg1.data as AbstractTrigger);
_local2.addEventListener(TriggerEvent.TRIGGER, onTriggerHandler);
}
}
}//package com.bigwigmedia.stateMachine
Section 377
//HistoryState (com.bigwigmedia.stateMachine.HistoryState)
package com.bigwigmedia.stateMachine {
import com.bigwigmedia.stateMachine.errors.*;
public class HistoryState extends AbstractState {
override public function addTransition(_arg1:AbstractState, _arg2:AbstractTrigger=null, _arg3:Function=null, _arg4:Function=null):void{
if (transitionsList.length == 1){
throw (new HSMError("HistoryState can have at most one outgoing transition."));
};
if (((_arg2) && (!((_arg2 is EmptyTrigger))))){
throw (new HSMError("Transition from HistoryState may not have a trigger."));
};
super.addTransition(_arg1, _arg2, _arg3, _arg4);
}
}
}//package com.bigwigmedia.stateMachine
Section 378
//HSM (com.bigwigmedia.stateMachine.HSM)
package com.bigwigmedia.stateMachine {
import com.bigwigmedia.stateMachine.events.*;
import com.bigwigmedia.stateMachine.errors.*;
public class HSM extends FSM {
private var stateChanged:Boolean;// = false
private var routesHash:Object;
private var activeStates:Array;
public function HSM(){
activeStates = [];
routesHash = {};
super();
}
override protected function doTransition():void{
var _local1:AbstractEvent;
var _local2:Transition;
var _local3:int;
var _local4:int;
var _local5:AbstractState;
var _local6:Array;
var _local7:Array;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:int;
if (((inTransition) || ((eventsQueue.length == 0)))){
return;
};
inTransition = true;
while (eventsQueue.length > 0) {
_local1 = eventsQueue.shift();
_local3 = activeStates.length;
_local4 = 0;
while (_local4 < _local3) {
_local2 = activeStates[_local4].getActiveTransition(_local1);
if (_local2){
break;
};
_local4++;
};
if (_local2){
_local5 = _local2.target;
if ((_local5 is CompositeState)){
_local5 = ((CompositeState(_local5).initial) || (_local5));
} else {
if ((_local5 is HistoryState)){
_local5 = _local5.parent.history;
};
};
_local6 = getExitRoute(currentState, _local5);
_local7 = getEntryRoute(currentState, _local5);
activeStates = getStack(_local7[(_local7.length - 1)]);
currentState = activeStates[0];
_local8 = _local6.length;
_local9 = 0;
while (_local9 < _local8) {
_local6[_local9].deactivate(_local1);
_local9++;
};
_local2.invokeEffect(_local1);
_local10 = _local7.length;
_local11 = 0;
while (_local11 < _local10) {
_local7[_local11].activate(_local1);
_local11++;
};
stateChanged = true;
dispatchEvent(new HSMEvent(HSMEvent.STATE_CHANGE, currentState, _local1));
if ((((currentState is FinalState)) && (!(currentState.parent)))){
completed = true;
dispatchEvent(new HSMEvent(HSMEvent.COMPLETE, currentState, _local1));
break;
};
sendEvent(new EmptyEvent());
};
};
inTransition = false;
}
override public function update(_arg1:Number):void{
var _local2:int = activeStates.length;
var _local3:int;
while (_local3 < _local2) {
AbstractState(activeStates[_local3]).update(_arg1);
if (stateChanged){
stateChanged = false;
return;
};
_local3++;
};
}
private function getEntryRoute(_arg1:AbstractState, _arg2:AbstractState):Array{
var _local5:AbstractState;
var _local3:String = ((_arg1.id + "->") + _arg2.id);
var _local4:Array = routesHash[_local3];
if (_local4){
return (_local4);
};
_local4 = [];
var _local6:String = _arg1.getTransitionLevel(_arg2);
switch (_local6){
case TransitionLevel.TO_SELF:
case TransitionLevel.TO_SIBLING:
_local4.push(_arg2);
break;
case TransitionLevel.TO_ANCESTOR:
_local5 = _arg1.parent;
while (true) {
_local4.push(_local5);
if (_local5 == _arg2){
break;
};
_local5 = _local5.parent;
};
break;
case TransitionLevel.TO_IRRELATIVE:
_local5 = _arg2;
while (true) {
_local4.push(_local5);
if (((!(_local5.parent)) || ((_local5.parent == _arg1.parent)))){
break;
};
_local5 = _local5.parent;
};
_local4.reverse();
break;
case TransitionLevel.TO_DESCENDANT:
_local4 = getStack(_arg2).slice();
_local4 = _local4.splice(0, _local4.indexOf(_arg1));
_local4.reverse();
break;
};
routesHash[_local3] = _local4;
return (_local4);
}
override public function dispose():void{
routesHash = {};
activeStates = [];
super.dispose();
}
private function getExitRoute(_arg1:AbstractState, _arg2:AbstractState):Array{
var _local5:AbstractState;
var _local3:String = ((_arg1.id + "<-") + _arg2.id);
var _local4:Array = routesHash[_local3];
if (_local4){
return (_local4);
};
_local4 = [];
var _local6:String = _arg1.getTransitionLevel(_arg2);
switch (_local6){
case TransitionLevel.TO_SELF:
case TransitionLevel.TO_SIBLING:
_local4.push(_arg1);
break;
case TransitionLevel.TO_ANCESTOR:
_local5 = _arg1;
while (_local5 != _arg2) {
_local4.push(_local5);
_local5 = _local5.parent;
};
break;
case TransitionLevel.TO_DESCENDANT:
break;
case TransitionLevel.TO_IRRELATIVE:
_local5 = _arg1;
while (true) {
_local4.push(_local5);
if (((!(_local5.parent)) || ((_local5.parent == _arg2.parent)))){
break;
};
_local5 = _local5.parent;
};
break;
};
routesHash[_local3] = _local4;
return (_local4);
}
override public function addState(_arg1:AbstractState):AbstractState{
if (_arg1.owned){
throw (new HSMError("State can't be added twice."));
};
if ((_arg1 is InitialState)){
if (currentState){
throw (new HSMError("State machine can have at most one InitialState."));
};
activeStates = [_arg1];
currentState = _arg1;
} else {
if ((_arg1 is HistoryState)){
throw (new HSMError("State machine can't have any HistoryState."));
};
};
stateAdded(_arg1);
return (_arg1);
}
private function getStack(_arg1:AbstractState):Array{
var _local2:String = String(_arg1.id);
var _local3:Array = routesHash[_local2];
if (_local3){
return (_local3);
};
var _local4:AbstractState = _arg1;
_local3 = [_local4];
while (_local4.parent) {
_local3.push(_local4.parent);
_local4 = _local4.parent;
};
routesHash[_local2] = _local3;
return (_local3);
}
}
}//package com.bigwigmedia.stateMachine
Section 379
//InitialState (com.bigwigmedia.stateMachine.InitialState)
package com.bigwigmedia.stateMachine {
import com.bigwigmedia.stateMachine.errors.*;
public class InitialState extends SimpleState {
override public function addTransition(_arg1:AbstractState, _arg2:AbstractTrigger=null, _arg3:Function=null, _arg4:Function=null):void{
if (transitionsList.length == 1){
throw (new HSMError("InitialState can have at most one outgoing transition."));
};
if (((_arg2) && (!((_arg2 is EmptyTrigger))))){
throw (new HSMError("Transition from InitialState may not have a trigger."));
};
super.addTransition(_arg1, _arg2, _arg3, _arg4);
}
}
}//package com.bigwigmedia.stateMachine
Section 380
//IStateMachine (com.bigwigmedia.stateMachine.IStateMachine)
package com.bigwigmedia.stateMachine {
import flash.events.*;
import com.bigwigmedia.core.*;
public interface IStateMachine extends IEventDispatcher, IUpdatable, IDisposable {
function addState(_arg1:AbstractState):AbstractState;
function start():void;
function sendSignal(_arg1:String, _arg2:Object=null):void;
}
}//package com.bigwigmedia.stateMachine
Section 381
//SignalEvent (com.bigwigmedia.stateMachine.SignalEvent)
package com.bigwigmedia.stateMachine {
import com.bigwigmedia.utils.*;
public class SignalEvent extends AbstractEvent {
protected var _type:String;
protected var _data:Object;
public function SignalEvent(_arg1:String, _arg2:Object=null){
_type = _arg1;
_data = _arg2;
}
public function get data():Object{
return (_data);
}
public function get type():String{
return (_type);
}
override public function toString():String{
return (formatToString(this, "type", "data"));
}
}
}//package com.bigwigmedia.stateMachine
Section 382
//SignalTrigger (com.bigwigmedia.stateMachine.SignalTrigger)
package com.bigwigmedia.stateMachine {
public class SignalTrigger extends AbstractTrigger {
private var _type:String;
public function SignalTrigger(_arg1:String){
_type = _arg1;
}
override public function willFire(_arg1:AbstractEvent):Boolean{
var _local2:SignalEvent = (_arg1 as SignalEvent);
return (((_local2) && ((_local2.type == _type))));
}
override public function equals(_arg1:AbstractTrigger):Boolean{
var _local2:SignalTrigger = (_arg1 as SignalTrigger);
return (((_local2) && ((_local2._type == _type))));
}
}
}//package com.bigwigmedia.stateMachine
Section 383
//SimpleState (com.bigwigmedia.stateMachine.SimpleState)
package com.bigwigmedia.stateMachine {
public class SimpleState extends AbstractState {
protected var _entry:Function;// = null
protected var _doActivity:Function;// = null
protected var _exit:Function;// = null
public function SimpleState(_arg1:Function=null, _arg2:Function=null, _arg3:Function=null){
_entry = _arg1;
_doActivity = _arg2;
_exit = _arg3;
}
override public function update(_arg1:Number):void{
super.update(_arg1);
if (_doActivity != null){
_doActivity(_arg1);
};
}
override public function deactivate(_arg1:AbstractEvent):void{
if (_exit != null){
_exit(_arg1);
};
super.deactivate(_arg1);
}
override public function activate(_arg1:AbstractEvent):void{
super.activate(_arg1);
if (_entry != null){
_entry(_arg1);
};
}
override public function dispose():void{
_entry = null;
_doActivity = null;
_exit = null;
super.dispose();
}
}
}//package com.bigwigmedia.stateMachine
Section 384
//Transition (com.bigwigmedia.stateMachine.Transition)
package com.bigwigmedia.stateMachine {
import com.bigwigmedia.core.*;
import com.bigwigmedia.utils.*;
public class Transition implements IDisposable {
private var _guard:Function;
private var _target:AbstractState;
private var _effect:Function;
private var _trigger:AbstractTrigger;
private var _source:AbstractState;
public function Transition(_arg1:AbstractState, _arg2:AbstractState, _arg3:AbstractTrigger, _arg4:Function, _arg5:Function){
_source = _arg1;
_target = _arg2;
_trigger = _arg3;
_effect = _arg4;
_guard = _arg5;
}
public function conflicts(_arg1:Transition):Boolean{
return ((((((_source == _arg1.source)) && (_trigger.equals(_arg1.trigger)))) && ((_guard == _arg1.guard))));
}
public function get source():AbstractState{
return (_source);
}
public function get guard():Function{
return (_guard);
}
public function willFire(_arg1:AbstractEvent):Boolean{
if (_trigger.willFire(_arg1)){
return ((((guard == null)) || (_guard())));
};
return (false);
}
public function invokeEffect(_arg1:AbstractEvent):void{
if (_effect != null){
_effect(_arg1);
};
}
public function get target():AbstractState{
return (_target);
}
public function get trigger():AbstractTrigger{
return (_trigger);
}
public function toString():String{
return (formatToString(this, "source", "target", "trigger"));
}
public function dispose():void{
_source = null;
_target = null;
_trigger.dispose();
_trigger = null;
_effect = null;
_guard = null;
}
}
}//package com.bigwigmedia.stateMachine
Section 385
//TransitionLevel (com.bigwigmedia.stateMachine.TransitionLevel)
package com.bigwigmedia.stateMachine {
public class TransitionLevel {
public static const TO_SELF:String = "toSelf";
public static const TO_DESCENDANT:String = "toDescendant";
public static const TO_ANCESTOR:String = "toAncestor";
public static const TO_IRRELATIVE:String = "toIrrelative";
public static const TO_SIBLING:String = "toSibling";
}
}//package com.bigwigmedia.stateMachine
Section 386
//AbstractTransition (com.bigwigmedia.transitions.AbstractTransition)
package com.bigwigmedia.transitions {
import flash.display.*;
import com.bigwigmedia.core.*;
public class AbstractTransition extends Sprite implements IDisposable {
public function start():void{
}
public function dispose():void{
}
}
}//package com.bigwigmedia.transitions
Section 387
//BlackoutTransition (com.bigwigmedia.transitions.BlackoutTransition)
package com.bigwigmedia.transitions {
import flash.events.*;
import com.bigwigmedia.core.*;
import com.bigwigmedia.tweens.*;
public class BlackoutTransition extends AbstractTransition {
private var _peakCallback:Function;
private var _color:int;
private var _halfDuration:Object;
private var _tween:ITween;
private var _completeCallback:Function;
public function BlackoutTransition(_arg1:Object, _arg2:Function, _arg3:Function=null, _arg4:uint=0){
_halfDuration = _arg1;
_peakCallback = _arg2;
_completeCallback = _arg3;
_color = _arg4;
}
override public function start():void{
alpha = 0;
graphics.beginFill(_color, 1);
graphics.drawRect(0, 0, Globals.application.nominalWidth, Globals.application.nominalHeight);
graphics.endFill();
_tween = new SequenceTween([new PropertyTween(this, "alpha", 0, 1, _halfDuration), new Action(this, onPeak), new PropertyTween(this, "alpha", 1, 0, _halfDuration), new Action(this, onComplete)]);
_tween.playAuto();
}
override public function dispose():void{
graphics.clear();
_peakCallback = null;
_completeCallback = null;
_tween.dispose();
}
private function onPeak():void{
_peakCallback();
}
private function onComplete():void{
graphics.clear();
if (_completeCallback != null){
_completeCallback();
};
dispatchEvent(new Event(Event.COMPLETE));
}
}
}//package com.bigwigmedia.transitions
Section 388
//Back (com.bigwigmedia.tweens.easing.Back)
package com.bigwigmedia.tweens.easing {
public class Back {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=1.70158):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) + _arg5)) + 1)) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=1.70158):Number{
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * (((_arg5 + 1) * _arg1) - _arg5)) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=1.70158):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
_arg5 = (_arg5 * 1.525);
return ((((_arg3 / 2) * ((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) - _arg5))) + _arg2));
};
_arg1 = (_arg1 - 2);
_arg5 = (_arg5 * 1.525);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_arg5 + 1) * _arg1) + _arg5)) + 2)) + _arg2));
}
}
}//package com.bigwigmedia.tweens.easing
Section 389
//Bounce (com.bigwigmedia.tweens.easing.Bounce)
package com.bigwigmedia.tweens.easing {
public class Bounce {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):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 easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (((_arg3 - easeOut((_arg4 - _arg1), 0, _arg3, _arg4)) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
if (_arg1 < (_arg4 / 2)){
return (((easeIn((_arg1 * 2), 0, _arg3, _arg4) * 0.5) + _arg2));
};
return ((((easeOut(((_arg1 * 2) - _arg4), 0, _arg3, _arg4) * 0.5) + (_arg3 * 0.5)) + _arg2));
}
}
}//package com.bigwigmedia.tweens.easing
Section 390
//Circular (com.bigwigmedia.tweens.easing.Circular)
package com.bigwigmedia.tweens.easing {
public class Circular {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * Math.sqrt((1 - (_arg1 * _arg1)))) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return (((-(_arg3) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((-(_arg3) / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) + 1)) + _arg2));
}
}
}//package com.bigwigmedia.tweens.easing
Section 391
//Cubic (com.bigwigmedia.tweens.easing.Cubic)
package com.bigwigmedia.tweens.easing {
public class Cubic {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * _arg1) + 2)) + _arg2));
}
}
}//package com.bigwigmedia.tweens.easing
Section 392
//Easing (com.bigwigmedia.tweens.easing.Easing)
package com.bigwigmedia.tweens.easing {
public class Easing {
public static const QUADRATIC_IN_OUT:String = "quadraticInOut";
public static const CIRCULAR_IN:String = "circularIn";
public static const SINE_IN_OUT:String = "sineInOut";
public static const CUBIC_IN_OUT:String = "cubicInOut";
public static const SINE_OUT:String = "sineOut";
public static const QUADRATIC_IN:String = "quadraticIn";
public static const CIRCULAR_OUT:String = "circularOut";
public static const SINE_IN:String = "sineIn";
public static const CUBIC_OUT:String = "cubicOut";
public static const CUBIC_IN:String = "cubicIn";
public static const BACK_OUT:String = "backOut";
public static const ELASTIC_OUT:String = "elasticOut";
public static const LINEAR:String = "linear";
public static const QUADRATIC_OUT:String = "quadraticOut";
public static const BOUNCE_IN_OUT:String = "bounceInOut";
public static const BACK_IN_OUT:String = "backInOut";
public static const ELASTIC_IN_OUT:String = "elasticInOut";
public static const ELASTIC_IN:String = "elasticIn";
public static const BOUNCE_OUT:String = "bounceOut";
public static const CIRCULAR_IN_OUT:String = "circularInOut";
public static const BOUNCE_IN:String = "bounceIn";
public static const BACK_IN:String = "backIn";
public static function getEasingFunc(_arg1:String):Function{
switch (_arg1){
case null:
case LINEAR:
return (Linear.easeNone);
case BACK_IN:
return (Back.easeIn);
case BACK_OUT:
return (Back.easeOut);
case BACK_IN_OUT:
return (Back.easeInOut);
case BOUNCE_IN:
return (Bounce.easeIn);
case BOUNCE_OUT:
return (Bounce.easeOut);
case BOUNCE_IN_OUT:
return (Bounce.easeInOut);
case CIRCULAR_IN:
return (Circular.easeIn);
case CIRCULAR_OUT:
return (Circular.easeOut);
case CIRCULAR_IN_OUT:
return (Circular.easeInOut);
case CUBIC_IN:
return (Cubic.easeIn);
case CUBIC_OUT:
return (Cubic.easeOut);
case CUBIC_IN_OUT:
return (Cubic.easeInOut);
case ELASTIC_IN:
return (Elastic.easeIn);
case ELASTIC_OUT:
return (Elastic.easeOut);
case ELASTIC_IN_OUT:
return (Elastic.easeInOut);
case QUADRATIC_IN:
return (Quadratic.easeIn);
case QUADRATIC_OUT:
return (Quadratic.easeOut);
case QUADRATIC_IN_OUT:
return (Quadratic.easeInOut);
case SINE_IN:
return (Sine.easeIn);
case SINE_OUT:
return (Sine.easeOut);
case SINE_IN_OUT:
return (Sine.easeInOut);
};
throw (new ArgumentError((("Easing \"" + _arg1) + "\" is not supported.")));
}
}
}//package com.bigwigmedia.tweens.easing
Section 393
//Elastic (com.bigwigmedia.tweens.easing.Elastic)
package com.bigwigmedia.tweens.easing {
public class Elastic {
private static const _2PI:Number = 6.28318530717959;
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / _2PI) * Math.asin((_arg3 / _arg5)));
};
--_arg1;
return ((-(((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * _2PI) / _arg6)))) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 == 2){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * (0.3 * 1.5));
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / _2PI) * Math.asin((_arg3 / _arg5)));
};
if (_arg1 < 1){
--_arg1;
return (((-0.5 * ((_arg5 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * _2PI) / _arg6)))) + _arg2));
};
--_arg1;
return ((((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * _2PI) / _arg6))) * 0.5) + _arg3) + _arg2));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number=0, _arg6:Number=0):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
if (!_arg6){
_arg6 = (_arg4 * 0.3);
};
if (((!(_arg5)) || ((_arg5 < Math.abs(_arg3))))){
_arg5 = _arg3;
_local7 = (_arg6 / 4);
} else {
_local7 = ((_arg6 / _2PI) * Math.asin((_arg3 / _arg5)));
};
return (((((_arg5 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * _2PI) / _arg6))) + _arg3) + _arg2));
}
}
}//package com.bigwigmedia.tweens.easing
Section 394
//Linear (com.bigwigmedia.tweens.easing.Linear)
package com.bigwigmedia.tweens.easing {
public class Linear {
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
}
}//package com.bigwigmedia.tweens.easing
Section 395
//Quadratic (com.bigwigmedia.tweens.easing.Quadratic)
package com.bigwigmedia.tweens.easing {
public class Quadratic {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((_arg3 * _arg1) * _arg1) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * _arg1) * _arg1) + _arg2));
};
--_arg1;
return ((((-(_arg3) / 2) * ((_arg1 * (_arg1 - 2)) - 1)) + _arg2));
}
}
}//package com.bigwigmedia.tweens.easing
Section 396
//Sine (com.bigwigmedia.tweens.easing.Sine)
package com.bigwigmedia.tweens.easing {
public class Sine {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (((_arg3 * Math.sin(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((-(_arg3) * Math.cos(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg3) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((-(_arg3) / 2) * (Math.cos(((Math.PI * _arg1) / _arg4)) - 1)) + _arg2));
}
}
}//package com.bigwigmedia.tweens.easing
Section 397
//AbstractNumberTween (com.bigwigmedia.tweens.AbstractNumberTween)
package com.bigwigmedia.tweens {
public class AbstractNumberTween extends AbstractTargetTween {
protected var _changeValue:Number;
protected var _startValue:Number;
public function AbstractNumberTween(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Object, _arg5:String, _arg6:Boolean){
super(_arg1, _arg4, _arg5, _arg6);
_startValue = _arg2;
_changeValue = (_arg3 - _arg2);
}
protected function getNumber():Number{
return (_easingFunc(_time, _startValue, _changeValue, _duration));
}
}
}//package com.bigwigmedia.tweens
Section 398
//AbstractTargetTween (com.bigwigmedia.tweens.AbstractTargetTween)
package com.bigwigmedia.tweens {
import com.bigwigmedia.events.*;
import com.bigwigmedia.tweens.easing.*;
public class AbstractTargetTween extends AbstractTween implements ITargetTween {
protected var _time:Number;// = 0
protected var _easingFunc:Function;
protected var _target:Object;
protected var _duration:Number;
protected var _useFrames:Boolean;
public function AbstractTargetTween(_arg1:Object, _arg2:Object, _arg3:String, _arg4:Boolean){
super(_arg4);
if (((((_arg2 is Number) == false)) && (((_arg2 is String) == false)))){
throw (new ArgumentError("Supplied duration value must be Number or String"));
};
_target = _arg1;
_duration = Number(_arg2);
_easingFunc = Easing.getEasingFunc(_arg3);
_useFrames = (_arg2 is String);
}
override public function update(_arg1:Number):void{
if (_completed){
return;
};
updateTarget();
if (_time < _duration){
if (_useFrames){
_time++;
} else {
_time = (_time + _arg1);
if (_time > _duration){
_time = _duration;
};
};
} else {
if (_repeat){
reset();
} else {
_completed = true;
dispatchEvent(new TweenEvent(TweenEvent.COMPLETE));
};
};
}
override public function reset():void{
_time = 0;
_completed = false;
}
public function get target():Object{
return (_target);
}
protected function updateTarget():void{
}
override public function dispose():void{
stopAuto();
_target = null;
_easingFunc = null;
}
}
}//package com.bigwigmedia.tweens
Section 399
//AbstractTween (com.bigwigmedia.tweens.AbstractTween)
package com.bigwigmedia.tweens {
import flash.display.*;
import flash.events.*;
public class AbstractTween extends EventDispatcher implements ITween {
private var _autoPlaying:Boolean;// = false
protected var _completed:Boolean;// = false
protected var _repeat:Boolean;
public static var autoFrameDuration:Number = 30;
private static var _autoTweens:Array = [];
private static var _autoTicker:Shape = new Shape();
public function AbstractTween(_arg1:Boolean){
_repeat = _arg1;
}
public function playAuto():void{
if (_autoPlaying){
return;
};
if (!_autoTicker.hasEventListener(Event.ENTER_FRAME)){
_autoTicker.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
};
_autoTweens.push(this);
_autoPlaying = true;
}
public function update(_arg1:Number):void{
}
public function stopAuto():void{
if (!_autoPlaying){
return;
};
_autoTweens.splice(_autoTweens.indexOf(this), 1);
if (_autoTweens.length == 0){
_autoTicker.removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
};
_autoPlaying = false;
}
public function reset():void{
_completed = false;
}
public function dispose():void{
stopAuto();
}
private static function onEnterFrameHandler(_arg1:Event):void{
var _local2:ITween;
for each (_local2 in _autoTweens) {
_local2.update(autoFrameDuration);
};
}
}
}//package com.bigwigmedia.tweens
Section 400
//Action (com.bigwigmedia.tweens.Action)
package com.bigwigmedia.tweens {
import com.bigwigmedia.events.*;
public class Action extends AbstractTween {
private var _func:Function;
private var _scope:Object;
private var _args:Array;
public function Action(_arg1:Object, _arg2:Function, _arg3:Array=null, _arg4:Boolean=false){
super(_arg4);
_scope = _arg1;
_func = _arg2;
_args = _arg3;
}
override public function update(_arg1:Number):void{
if (_completed){
return;
};
_func.apply(_scope, _args);
if (_repeat){
reset();
} else {
_completed = true;
dispatchEvent(new TweenEvent(TweenEvent.COMPLETE));
};
}
override public function dispose():void{
super.dispose();
_scope = null;
_func = null;
_args = null;
}
}
}//package com.bigwigmedia.tweens
Section 401
//ColorTween (com.bigwigmedia.tweens.ColorTween)
package com.bigwigmedia.tweens {
import flash.geom.*;
import fl.motion.*;
public class ColorTween extends AbstractTargetTween {
private var _endColor:Color;
private var _targetTransform:Transform;
private var _startColor:Color;
public function ColorTween(_arg1:Object, _arg2:uint, _arg3:Number, _arg4:uint, _arg5:Number, _arg6:Object, _arg7:String="linear", _arg8:Boolean=false){
super(_arg1, _arg6, _arg7, _arg8);
if (((!(("transform" in _arg1))) || (!((_arg1.transform is Transform))))){
throw (new ArgumentError("Supplied target must implement target property."));
};
_startColor = new Color();
_startColor.setTint(_arg2, _arg3);
_endColor = new Color();
_endColor.setTint(_arg4, _arg5);
_targetTransform = _arg1.transform;
}
override public function dispose():void{
super.dispose();
_targetTransform = null;
_startColor = null;
_endColor = null;
}
override protected function updateTarget():void{
var _local1:Number = _easingFunc(_time, 0, 1, _duration);
_targetTransform.colorTransform = Color.interpolateTransform(_startColor, _endColor, _local1);
}
}
}//package com.bigwigmedia.tweens
Section 402
//Delay (com.bigwigmedia.tweens.Delay)
package com.bigwigmedia.tweens {
import com.bigwigmedia.events.*;
public class Delay extends AbstractTween {
protected var _duration:Number;
protected var _time:Number;// = 0
protected var _useFrames:Boolean;
public function Delay(_arg1:Object){
super(false);
if (((((_arg1 is Number) == false)) && (((_arg1 is String) == false)))){
throw (new ArgumentError("Supplied duration value must be Number or String"));
};
_duration = Number(_arg1);
_useFrames = (_arg1 is String);
}
override public function update(_arg1:Number):void{
if (_completed){
return;
};
if (_time < _duration){
if (_useFrames){
_time++;
} else {
_time = (_time + _arg1);
if (_time > _duration){
_time = _duration;
};
};
} else {
if (_repeat){
reset();
} else {
_completed = true;
dispatchEvent(new TweenEvent(TweenEvent.COMPLETE));
};
};
}
override public function reset():void{
_completed = false;
_time = 0;
}
}
}//package com.bigwigmedia.tweens
Section 403
//FilterTween (com.bigwigmedia.tweens.FilterTween)
package com.bigwigmedia.tweens {
import flash.filters.*;
public class FilterTween extends AbstractTargetTween {
private var _filterClass:Class;
private var _startValues:Object;
private var _endValues:Object;
public function FilterTween(_arg1:Object, _arg2:Class, _arg3:Object, _arg4:Object, _arg5:Object, _arg6:String="linear", _arg7:Boolean=false){
super(_arg1, _arg5, _arg6, _arg7);
_filterClass = _arg2;
_startValues = _arg3;
_endValues = _arg4;
}
override protected function updateTarget():void{
var _local1:BitmapFilter;
var _local5:String;
var _local6:Number;
var _local7:Number;
var _local2:Array = target.filters;
var _local3:int = _local2.length;
var _local4:int;
while (_local4 < _local3) {
_local1 = _local2[_local4];
if ((_local1 is _filterClass)){
break;
};
_local4++;
};
if (!_local1){
_local1 = new _filterClass();
_local2.push(_local1);
};
for (_local5 in _startValues) {
_local6 = _startValues[_local5];
_local7 = (_endValues[_local5] - _local6);
_local1[_local5] = _easingFunc(_time, _local6, _local7, _duration);
};
target.filters = _local2;
}
override public function dispose():void{
super.dispose();
_filterClass = null;
_startValues = null;
_endValues = null;
}
}
}//package com.bigwigmedia.tweens
Section 404
//ITargetTween (com.bigwigmedia.tweens.ITargetTween)
package com.bigwigmedia.tweens {
public interface ITargetTween extends ITween {
function get target():Object;
}
}//package com.bigwigmedia.tweens
Section 405
//ITween (com.bigwigmedia.tweens.ITween)
package com.bigwigmedia.tweens {
import flash.events.*;
import com.bigwigmedia.core.*;
public interface ITween extends IEventDispatcher, IUpdatable, IDisposable {
function stopAuto():void;
function playAuto():void;
function reset():void;
}
}//package com.bigwigmedia.tweens
Section 406
//ParallelTween (com.bigwigmedia.tweens.ParallelTween)
package com.bigwigmedia.tweens {
import com.bigwigmedia.events.*;
public class ParallelTween extends AbstractTween {
private var _tweens:Array;
private var _numActiveTweens:int;// = 0
public function ParallelTween(_arg1:Array, _arg2:Boolean=false){
var _local5:ITween;
_tweens = [];
super(_arg2);
var _local3:int = _arg1.length;
var _local4:int;
while (_local4 < _local3) {
_local5 = _arg1[_local4];
_local5.addEventListener(TweenEvent.COMPLETE, onTweenCompleteHandler);
_tweens.push(_local5);
_local4++;
};
_numActiveTweens = _local3;
}
override public function dispose():void{
var _local1:ITween;
for each (_local1 in _tweens) {
_local1.removeEventListener(TweenEvent.COMPLETE, onTweenCompleteHandler);
_local1.dispose();
};
_tweens = [];
super.dispose();
}
private function onTweenCompleteHandler(_arg1:TweenEvent):void{
if (--_numActiveTweens == 0){
_completed = true;
};
}
override public function update(_arg1:Number):void{
var _local2:ITween;
if (_completed){
return;
};
for each (_local2 in _tweens) {
_local2.update(_arg1);
};
if (_completed){
if (_repeat){
reset();
} else {
dispatchEvent(new TweenEvent(TweenEvent.COMPLETE));
};
};
}
override public function reset():void{
var _local1:ITween;
_completed = false;
for each (_local1 in _tweens) {
_local1.reset();
};
_numActiveTweens = _tweens.length;
}
}
}//package com.bigwigmedia.tweens
Section 407
//PropertyTween (com.bigwigmedia.tweens.PropertyTween)
package com.bigwigmedia.tweens {
public class PropertyTween extends AbstractNumberTween {
private var _property:String;
public function PropertyTween(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number, _arg5:Object, _arg6:String="linear", _arg7:Boolean=false){
super(_arg1, _arg3, _arg4, _arg5, _arg6, _arg7);
_property = _arg2;
if (((!((_arg2 in _arg1))) || ((_arg1[_arg2] is Function)))){
throw (new ArgumentError((("Supplied property \"" + _arg2) + "\" is not found in target object.")));
};
}
override protected function updateTarget():void{
_target[_property] = getNumber();
}
}
}//package com.bigwigmedia.tweens
Section 408
//SequenceTween (com.bigwigmedia.tweens.SequenceTween)
package com.bigwigmedia.tweens {
import com.bigwigmedia.events.*;
public class SequenceTween extends AbstractTween {
private var _currentTweenIndex:int;// = 0
private var _tweens:Array;
private var _currentTween:ITween;
public function SequenceTween(_arg1:Array, _arg2:Boolean=false){
var _local5:ITween;
_tweens = [];
super(_arg2);
var _local3:int = _arg1.length;
var _local4:int;
while (_local4 < _local3) {
_local5 = _arg1[_local4];
_local5.addEventListener(TweenEvent.COMPLETE, onTweenCompleteHandler);
_tweens.push(_local5);
_local4++;
};
_currentTween = _tweens[0];
}
private function onTweenCompleteHandler(_arg1:TweenEvent):void{
if (++_currentTweenIndex == _tweens.length){
if (_repeat){
reset();
} else {
if (!_completed){
_completed = true;
dispatchEvent(new TweenEvent(TweenEvent.COMPLETE));
};
};
} else {
_currentTween = _tweens[_currentTweenIndex];
};
}
override public function update(_arg1:Number):void{
if (!_completed){
_currentTween.update(_arg1);
};
}
override public function reset():void{
var _local1:ITween;
_completed = false;
for each (_local1 in _tweens) {
_local1.reset();
};
_currentTweenIndex = 0;
_currentTween = _tweens[0];
}
override public function dispose():void{
var _local1:ITween;
_currentTween = null;
for each (_local1 in _tweens) {
_local1.removeEventListener(TweenEvent.COMPLETE, onTweenCompleteHandler);
_local1.dispose();
};
_tweens = [];
super.dispose();
}
}
}//package com.bigwigmedia.tweens
Section 409
//SetterTween (com.bigwigmedia.tweens.SetterTween)
package com.bigwigmedia.tweens {
public class SetterTween extends AbstractNumberTween {
private var _setterFunc:Function;
public function SetterTween(_arg1:Object, _arg2:Function, _arg3:Number, _arg4:Number, _arg5:Object, _arg6:String="linear", _arg7:Boolean=false){
super(_arg1, _arg3, _arg4, _arg5, _arg6, _arg7);
_setterFunc = _arg2;
}
override protected function updateTarget():void{
_setterFunc.call(_target, getNumber());
}
override public function dispose():void{
_setterFunc = null;
super.dispose();
}
}
}//package com.bigwigmedia.tweens
Section 410
//Update (com.bigwigmedia.tweens.Update)
package com.bigwigmedia.tweens {
import com.bigwigmedia.events.*;
import com.bigwigmedia.core.*;
import com.bigwigmedia.tweens.easing.*;
public class Update extends AbstractTargetTween {
public function Update(_arg1:IUpdatable, _arg2:Object, _arg3:Boolean=false){
super(_arg1, _arg2, Easing.LINEAR, _arg3);
if ((_arg1 is IUpdatable) == false){
throw (new ArgumentError("Supplied target object must implement IUpdatable interface."));
};
}
override public function update(_arg1:Number):void{
if (_completed){
return;
};
_target.update(_arg1);
if (_time < _duration){
if (_useFrames){
_time++;
} else {
_time = (_time + _arg1);
if (_time > _duration){
_time = _duration;
};
};
} else {
if (_repeat){
reset();
} else {
_completed = true;
dispatchEvent(new TweenEvent(TweenEvent.COMPLETE));
};
};
}
}
}//package com.bigwigmedia.tweens
Section 411
//CanvasLayout (com.bigwigmedia.ui.containers.layouts.CanvasLayout)
package com.bigwigmedia.ui.containers.layouts {
import com.bigwigmedia.ui.*;
import flash.geom.*;
import com.bigwigmedia.ui.containers.*;
public class CanvasLayout implements ILayout {
protected var _container:LayoutContainer;
public function CanvasLayout(_arg1:LayoutContainer){
_container = _arg1;
}
protected function scaleChildHorizontally(_arg1:Component):void{
if (!_arg1.inSizeLayout){
return;
};
if (!isNaN(_arg1.percentWidth)){
_arg1.width = ((_container.width * _arg1.percentWidth) / 100);
} else {
if (((!(isNaN(_arg1.left))) && (!(isNaN(_arg1.right))))){
_arg1.width = ((_container.width - _arg1.left) - _arg1.right);
};
};
}
public function apply():void{
var _local4:Component;
var _local1:Array = _container.layoutChildren;
var _local2:int = _local1.length;
var _local3:int;
while (_local3 < _local2) {
_local4 = _local1[_local3];
scaleChildHorizontally(_local4);
scaleChildVertically(_local4);
positionChildHorizontally(_local4);
positionChildVertically(_local4);
_local3++;
};
}
protected function positionChildVertically(_arg1:Component):void{
if (!_arg1.inPositionLayout){
return;
};
var _local2:Rectangle = _arg1.getAABB();
if (!isNaN(_arg1.middle)){
_arg1.y = (_arg1.y + (((_container.height / 2) - (_local2.top + (_local2.height / 2))) + _arg1.middle));
} else {
if (!isNaN(_arg1.top)){
_arg1.y = (_arg1.y + (_arg1.top - _local2.top));
} else {
if (!isNaN(_arg1.bottom)){
_arg1.y = (_arg1.y + ((_container.height - _local2.bottom) - _arg1.bottom));
};
};
};
}
protected function positionChildHorizontally(_arg1:Component):void{
if (!_arg1.inPositionLayout){
return;
};
var _local2:Rectangle = _arg1.getAABB();
if (!isNaN(_arg1.center)){
_arg1.x = (_arg1.x + (((_container.width / 2) - (_local2.left + (_local2.width / 2))) + _arg1.center));
} else {
if (!isNaN(_arg1.left)){
_arg1.x = (_arg1.x + (_arg1.left - _local2.left));
} else {
if (!isNaN(_arg1.right)){
_arg1.x = (_arg1.x + ((_container.width - _local2.right) - _arg1.right));
};
};
};
}
protected function scaleChildVertically(_arg1:Component):void{
if (!_arg1.inSizeLayout){
return;
};
if (!isNaN(_arg1.percentHeight)){
_arg1.height = ((_container.height * _arg1.percentHeight) / 100);
} else {
if (((!(isNaN(_arg1.top))) && (!(isNaN(_arg1.bottom))))){
_arg1.height = ((_container.height - _arg1.top) - _arg1.bottom);
};
};
}
public function dispose():void{
_container = null;
}
}
}//package com.bigwigmedia.ui.containers.layouts
Section 412
//HBoxLayout (com.bigwigmedia.ui.containers.layouts.HBoxLayout)
package com.bigwigmedia.ui.containers.layouts {
import com.bigwigmedia.ui.*;
import flash.geom.*;
import com.bigwigmedia.ui.containers.*;
public class HBoxLayout extends CanvasLayout {
private var _currentX:Number;
public function HBoxLayout(_arg1:LayoutContainer){
super(_arg1);
}
override protected function scaleChildHorizontally(_arg1:Component):void{
var _local6:int;
if (isNaN(_container.explicitWidth)){
return;
};
var _local2:Array = _container.layoutChildren;
var _local3:int = _local2.length;
var _local4:Number = 0;
var _local5:Number = 0;
_local6 = 0;
while (_local6 < _local3) {
_arg1 = _local2[_local6];
if (isNaN(_arg1.percentWidth)){
_local5 = (_local5 + _arg1.width);
} else {
_local5 = (_local5 + _arg1.minWidth);
_local4 = (_local4 + _arg1.percentWidth);
};
_local6++;
};
var _local7:Number = ((_container.explicitWidth)>=_local5) ? ((_container.explicitWidth - _local5) - ((_local3 - 1) * _container.getStyle("horizontalGap"))) : 0;
var _local8:Number = ((_local4 < 100)) ? 1 : (100 / _local4);
_local6 = 0;
while (_local6 < _local3) {
_arg1 = _local2[_local6];
if (!isNaN(_arg1.percentWidth)){
_arg1.width = (((_arg1.percentWidth / 100) * _local8) * _local7);
};
_local6++;
};
}
override protected function positionChildHorizontally(_arg1:Component):void{
_arg1.x = _currentX;
var _local2:Rectangle = _arg1.getAABB();
_currentX = (_currentX + (_local2.width + _container.getStyle("horizontalGap")));
}
override public function apply():void{
_currentX = 0;
super.apply();
if (isNaN(_container.explicitWidth)){
_container.setNotExplicitWidth(((_currentX == 0)) ? 0 : (_currentX - _container.getStyle("horizontalGap")));
};
}
}
}//package com.bigwigmedia.ui.containers.layouts
Section 413
//ILayout (com.bigwigmedia.ui.containers.layouts.ILayout)
package com.bigwigmedia.ui.containers.layouts {
import com.bigwigmedia.core.*;
public interface ILayout extends IDisposable {
function apply():void;
}
}//package com.bigwigmedia.ui.containers.layouts
Section 414
//TileLayout (com.bigwigmedia.ui.containers.layouts.TileLayout)
package com.bigwigmedia.ui.containers.layouts {
import com.bigwigmedia.ui.*;
import com.bigwigmedia.ui.containers.*;
public class TileLayout extends CanvasLayout {
private var _maxChildHeight:Number;
private var _currentCol:int;
private var _currentRow:int;
private var _maxChildWidth:Number;
private var _currentX:Number;
private var _maxCol:int;
private var _currentY:Number;
public function TileLayout(_arg1:LayoutContainer){
super(_arg1);
}
override protected function positionChildHorizontally(_arg1:Component):void{
_arg1.x = _currentX;
_arg1.y = _currentY;
_currentX = (_currentX + (_maxChildWidth + _container.getStyle("horizontalGap")));
_currentCol++;
if (isNaN(_container.explicitWidth)){
if (_currentCol == _maxCol){
_currentX = 0;
_currentCol = 0;
_currentRow++;
_currentY = (_currentY + (_maxChildHeight + _container.getStyle("verticalGap")));
};
} else {
if (_currentX > _container.explicitWidth){
_currentX = 0;
_currentCol = 0;
_currentRow++;
_currentY = (_currentY + (_maxChildHeight + _container.getStyle("verticalGap")));
};
};
}
override protected function scaleChildHorizontally(_arg1:Component):void{
}
override public function apply():void{
_maxChildWidth = _container.maxChildWidth;
_maxChildHeight = _container.maxChildHeight;
_currentX = (_currentY = 0);
_currentCol = (_currentRow = 0);
_maxCol = Math.ceil(Math.sqrt(_container.layoutChildren.length));
var _local1:int = Math.ceil((_container.layoutChildren.length / _maxCol));
super.apply();
if (isNaN(_container.explicitWidth)){
_container.setNotExplicitWidth(((_maxCol * _maxChildWidth) + ((_maxCol - 1) * _container.getStyle("horizontalGap"))));
};
if (isNaN(_container.explicitHeight)){
_container.setNotExplicitHeight(((_local1 * _maxChildHeight) + ((_local1 - 1) * _container.getStyle("verticalGap"))));
};
}
override protected function scaleChildVertically(_arg1:Component):void{
}
override protected function positionChildVertically(_arg1:Component):void{
}
}
}//package com.bigwigmedia.ui.containers.layouts
Section 415
//VBoxLayout (com.bigwigmedia.ui.containers.layouts.VBoxLayout)
package com.bigwigmedia.ui.containers.layouts {
import com.bigwigmedia.ui.*;
import flash.geom.*;
import com.bigwigmedia.ui.containers.*;
public class VBoxLayout extends CanvasLayout {
private var _currentY:Number;
public function VBoxLayout(_arg1:LayoutContainer){
super(_arg1);
}
override protected function scaleChildVertically(_arg1:Component):void{
var _local6:int;
if (isNaN(_container.explicitHeight)){
return;
};
var _local2:Array = _container.layoutChildren;
var _local3:int = _local2.length;
var _local4:Number = 0;
var _local5:Number = 0;
_local6 = 0;
while (_local6 < _local3) {
_arg1 = _local2[_local6];
if (isNaN(_arg1.percentHeight)){
_local5 = (_local5 + _arg1.height);
} else {
_local5 = (_local5 + _arg1.minHeight);
_local4 = (_local4 + _arg1.percentHeight);
};
_local6++;
};
var _local7:Number = ((_container.explicitHeight)>=_local5) ? ((_container.explicitHeight - _local5) - ((_local3 - 1) * _container.getStyle("verticalGap"))) : 0;
var _local8:Number = ((_local4 < 100)) ? 1 : (100 / _local4);
_local6 = 0;
while (_local6 < _local3) {
_arg1 = _local2[_local6];
if (!isNaN(_arg1.percentHeight)){
_arg1.height = (((_arg1.percentHeight / 100) * _local8) * _local7);
};
_local6++;
};
}
override protected function positionChildVertically(_arg1:Component):void{
_arg1.y = _currentY;
var _local2:Rectangle = _arg1.getAABB();
_currentY = (_currentY + (_local2.height + _container.getStyle("verticalGap")));
}
override public function apply():void{
_currentY = 0;
super.apply();
if (isNaN(_container.explicitHeight)){
_container.setNotExplicitHeight(((_currentY == 0)) ? 0 : (_currentY - _container.getStyle("verticalGap")));
};
}
}
}//package com.bigwigmedia.ui.containers.layouts
Section 416
//Box (com.bigwigmedia.ui.containers.Box)
package com.bigwigmedia.ui.containers {
import com.bigwigmedia.ui.containers.layouts.*;
public class Box extends LayoutContainer {
public function Box(_arg1:ILayout){
super(_arg1);
}
public static function get defaultStyles():Object{
var _local1:Object = {horizontalGap:8, verticalGap:8};
return (_local1);
}
}
}//package com.bigwigmedia.ui.containers
Section 417
//Canvas (com.bigwigmedia.ui.containers.Canvas)
package com.bigwigmedia.ui.containers {
import com.bigwigmedia.ui.containers.layouts.*;
public class Canvas extends LayoutContainer {
public function Canvas(){
super(new CanvasLayout(this));
}
}
}//package com.bigwigmedia.ui.containers
Section 418
//HBox (com.bigwigmedia.ui.containers.HBox)
package com.bigwigmedia.ui.containers {
import com.bigwigmedia.ui.containers.layouts.*;
public class HBox extends Box {
public function HBox(){
super(new HBoxLayout(this));
}
}
}//package com.bigwigmedia.ui.containers
Section 419
//LayoutContainer (com.bigwigmedia.ui.containers.LayoutContainer)
package com.bigwigmedia.ui.containers {
import flash.display.*;
import com.bigwigmedia.ui.*;
import com.bigwigmedia.events.*;
import com.bigwigmedia.ui.containers.layouts.*;
public class LayoutContainer extends Container {
protected var _layoutChildren:Array;
protected var _layout:ILayout;
protected var validatingChildren:Boolean;// = false
public function LayoutContainer(_arg1:ILayout){
_layoutChildren = [];
_layout = _arg1;
super();
}
override protected function componentAdded(_arg1:Component):void{
_arg1.addEventListener(ComponentEvent.RESIZE, onComponentEventHandler);
_arg1.addEventListener(ComponentEvent.MOVE, onComponentEventHandler);
_layoutChildren.push(_arg1);
invalidateSize();
invalidateChildren();
}
override public function dispose():void{
var _local1:DisplayObject;
for each (_local1 in _layoutChildren) {
_local1.removeEventListener(ComponentEvent.RESIZE, onComponentEventHandler);
_local1.removeEventListener(ComponentEvent.MOVE, onComponentEventHandler);
};
_layoutChildren = [];
_layout.dispose();
_layout = null;
super.dispose();
}
override protected function componentRemoved(_arg1:Component):void{
var _local2:int = _layoutChildren.indexOf(_arg1);
_layoutChildren.splice(_local2, 1);
_arg1.removeEventListener(ComponentEvent.RESIZE, onComponentEventHandler);
_arg1.removeEventListener(ComponentEvent.MOVE, onComponentEventHandler);
invalidateSize();
invalidateChildren();
}
private function onComponentEventHandler(_arg1:ComponentEvent):void{
if (validatingChildren){
return;
};
invalidateSize();
invalidateChildren();
}
override protected function validateChildren():void{
validatingChildren = true;
_layout.apply();
validatingChildren = false;
}
override protected function validateSize():void{
if (isNaN(_explicitWidth)){
setNotExplicitWidth(maxChildWidth);
};
if (isNaN(_explicitHeight)){
setNotExplicitHeight(maxChildHeight);
};
invalidateChildren();
}
public function get layoutChildren():Array{
return (_layoutChildren);
}
public function get maxChildWidth():Number{
var _local2:DisplayObject;
var _local1:Number = 0;
for each (_local2 in _layoutChildren) {
if (_local2.width > _local1){
_local1 = _local2.width;
};
};
return (_local1);
}
public function get maxChildHeight():Number{
var _local2:DisplayObject;
var _local1:Number = 0;
for each (_local2 in _layoutChildren) {
if (_local2.height > _local1){
_local1 = _local2.height;
};
};
return (_local1);
}
}
}//package com.bigwigmedia.ui.containers
Section 420
//Tile (com.bigwigmedia.ui.containers.Tile)
package com.bigwigmedia.ui.containers {
import com.bigwigmedia.ui.containers.layouts.*;
public class Tile extends Box {
private var _requestedNumRows:int;// = 0
private var _requestedNumColumns:int;// = 0
public function Tile(){
super(new TileLayout(this));
}
public function get requestedNumRows():int{
return (_requestedNumRows);
}
public function set requestedNumRows(_arg1:int):void{
_requestedNumRows = _arg1;
}
public function get requestedNumColumns():int{
return (_requestedNumColumns);
}
public function set requestedNumColumns(_arg1:int):void{
_requestedNumColumns = _arg1;
}
}
}//package com.bigwigmedia.ui.containers
Section 421
//VBox (com.bigwigmedia.ui.containers.VBox)
package com.bigwigmedia.ui.containers {
import com.bigwigmedia.ui.containers.layouts.*;
public class VBox extends Box {
public function VBox(){
super(new VBoxLayout(this));
}
}
}//package com.bigwigmedia.ui.containers
Section 422
//ListItemRenderer (com.bigwigmedia.ui.controls.listClasses.ListItemRenderer)
package com.bigwigmedia.ui.controls.listClasses {
import com.bigwigmedia.ui.controls.*;
public class ListItemRenderer extends LabelButton {
private var _index:int;
public function ListItemRenderer(_arg1:int){
_index = _arg1;
_toggle = true;
}
public function get index():int{
return (_index);
}
override protected function drawBackground():void{
graphics.clear();
graphics.lineStyle();
if (_selected){
graphics.beginFill(getStyle("selectedFillColor"), getStyle("selectedFillAlpha"));
} else {
graphics.beginFill(getStyle("fillColor"), getStyle("fillAlpha"));
};
graphics.drawRect(0, 0, (isNaN(width)) ? 0 : width, (isNaN(height)) ? 0 : height);
graphics.endFill();
}
override public function set toggle(_arg1:Boolean):void{
}
override protected function mouseClicked():void{
if (mouseClickHandler != null){
mouseClickHandler(this);
};
if (!_selected){
super.selected = true;
drawBackground();
};
}
public static function get defaultStyles():Object{
var _local1:Object = {selectedFillColor:0xFFFFFF, selectedFillAlpha:0.3, labelPlacement:"left", padding:0, icon:null, upIcon:null, overIcon:null, downIcon:null, selectedIcon:null, decoration:null, upDecoration:null, overDecoration:null, downDecoration:null, selectedDecoration:null};
return (_local1);
}
}
}//package com.bigwigmedia.ui.controls.listClasses
Section 423
//ScrollBar (com.bigwigmedia.ui.controls.scrollClasses.ScrollBar)
package com.bigwigmedia.ui.controls.scrollClasses {
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import com.bigwigmedia.events.*;
import flash.events.*;
public class ScrollBar extends Container {
private var _minScrollPosition:Number;// = 0
protected var _downArrow:SkinnedButton;
private var _drag:Boolean;// = false
private var _pageSize:Number;// = 10
private var _maxScrollPosition:Number;// = 100
private var _lineScrollSize:Number;// = 1
private var _scrollPosition:Number;// = 0
private var _thumbClickDisp:Number;// = 0
protected var _track:SkinnedButton;
protected var _thumb:SkinnedButton;
protected var _upArrow:SkinnedButton;
private var _pageScrollSize:Number;// = 0
public static const MIN_SIZE:Number = 14;
public function ScrollBar(){
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStageHandler);
this.addEventListener(Event.REMOVED_FROM_STAGE, onRemovedToStageHandler);
}
public function get lineScrollSize():Number{
return (((_lineScrollSize == 0)) ? _pageSize : _lineScrollSize);
}
public function set lineScrollSize(_arg1:Number):void{
if (_arg1 > 0){
_lineScrollSize = _arg1;
};
}
public function get minScrollPosition():Number{
return (_minScrollPosition);
}
private function mouseMoved():void{
positionThumb();
var _local1:Number = ((((thumbPosition - _upArrow.height) / (((convertedHeight - _upArrow.height) - _downArrow.height) - _thumb.height)) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition);
scrollPosition = _local1;
}
public function set minScrollPosition(_arg1:Number):void{
if (_minScrollPosition != _arg1){
_minScrollPosition = _arg1;
invalidateProperties();
};
}
public function get maxScrollPosition():Number{
return (_maxScrollPosition);
}
public function get scrollPosition():Number{
return (_scrollPosition);
}
protected function get thumbPosition():Number{
throw (new Error("Override required."));
}
override protected function createChildren():void{
var _local1:Class = getStyle("track");
_track = new (_local1);
_track.autoRepeat = true;
addChild(_track);
var _local2:Class = getStyle("upButton");
_upArrow = new (_local2);
_upArrow.autoRepeat = true;
addChild(_upArrow);
var _local3:Class = getStyle("downButton");
_downArrow = new (_local3);
_downArrow.autoRepeat = true;
addChild(_downArrow);
var _local4:Class = getStyle("thumb");
_thumb = new (_local4);
addChild(_thumb);
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler);
addEventListener(ComponentEvent.BUTTON_DOWN, onButtonDownHandler);
}
override public function getComponentByName(_arg1:String):Component{
return (((_arg1 == this.name)) ? this : null);
}
public function set scrollPosition(_arg1:Number):void{
var _local2:Number = _scrollPosition;
_scrollPosition = _arg1;
if (_scrollPosition < _minScrollPosition){
_scrollPosition = _minScrollPosition;
} else {
if (_scrollPosition > _maxScrollPosition){
_scrollPosition = _maxScrollPosition;
};
};
if (_local2 != _scrollPosition){
positionThumb();
dispatchEvent(new ScrollEvent(ScrollEvent.SCROLL, _scrollPosition, true));
};
}
protected function positionThumb():void{
var _local3:Number;
var _local1:Number = ((_maxScrollPosition - _minScrollPosition) + _pageSize);
var _local2:Number = Math.round(((((convertedHeight - _upArrow.height) - _downArrow.height) * _pageSize) / _local1));
if (_local2 < MIN_SIZE){
_local2 = MIN_SIZE;
};
if ((((_maxScrollPosition <= _minScrollPosition)) || ((_local1 == 0)))){
_thumb.visible = false;
this.enabled = false;
} else {
_thumb.width = convertedWidth;
_thumb.height = _local2;
_thumb.visible = true;
this.enabled = true;
};
if (_drag){
_local3 = (this.mouseY - _thumbClickDisp);
} else {
_local3 = (_upArrow.height + ((((convertedHeight - _upArrow.height) - _downArrow.height) - _thumb.height) * ((_scrollPosition - _minScrollPosition) / (_maxScrollPosition - _minScrollPosition))));
};
if ((((_local3 < _upArrow.height)) || (isNaN(_local3)))){
_local3 = _upArrow.height;
} else {
if (_local3 > ((convertedHeight - _downArrow.height) - _thumb.height)){
_local3 = ((convertedHeight - _downArrow.height) - _thumb.height);
};
};
thumbPosition = _local3;
}
private function onButtonDownHandler(_arg1:ComponentEvent):void{
var _local2:Number;
switch (_arg1.target){
case _upArrow:
scrollPosition = (scrollPosition - lineScrollSize);
break;
case _downArrow:
scrollPosition = (scrollPosition + lineScrollSize);
break;
case _track:
_local2 = ((((_track.mouseY - _upArrow.height) / ((convertedHeight - _upArrow.height) - _downArrow.height)) * (_maxScrollPosition - _minScrollPosition)) + _minScrollPosition);
if (_scrollPosition < _local2){
scrollPosition = Math.min(_local2, (_scrollPosition + _pageSize));
} else {
if (_scrollPosition > _local2){
scrollPosition = Math.max(_local2, (_scrollPosition - _pageSize));
};
};
break;
};
}
public function get pageSize():Number{
return (_pageSize);
}
public function set maxScrollPosition(_arg1:Number):void{
if (_maxScrollPosition != _arg1){
_maxScrollPosition = _arg1;
invalidateProperties();
};
}
public function set pageScrollSize(_arg1:Number):void{
if (_arg1 > 0){
_pageScrollSize = _arg1;
};
}
protected function set thumbPosition(_arg1:Number):void{
throw (new Error("Override required."));
}
private function onAddedToStageHandler(_arg1:Event):void{
stage.addEventListener(MouseEvent.MOUSE_UP, onMouseEventHandler);
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseEventHandler);
}
protected function get convertedWidth():Number{
throw (new Error("Override required."));
}
protected function get convertedHeight():Number{
throw (new Error("Override required."));
}
public function get pageScrollSize():Number{
return (((_pageScrollSize == 0)) ? _pageSize : _pageScrollSize);
}
public function set pageSize(_arg1:Number):void{
if (_pageSize != _arg1){
_pageSize = _arg1;
invalidateProperties();
};
}
private function onMouseDownHandler(_arg1:MouseEvent):void{
if ((((_arg1.target == _thumb)) && (!(_drag)))){
_thumbClickDisp = _thumb.mouseY;
_drag = true;
};
}
private function onRemovedToStageHandler(_arg1:Event):void{
stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseEventHandler);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseEventHandler);
}
override protected function validateProperties():void{
positionThumb();
}
private function onMouseEventHandler(_arg1:MouseEvent):void{
switch (_arg1.type){
case MouseEvent.MOUSE_MOVE:
if (_drag){
mouseMoved();
};
break;
case MouseEvent.MOUSE_UP:
if (_drag){
_drag = false;
};
break;
};
}
public static function get defaultStyles():Object{
var _local1:Object = {track:ScrollBarTrack, thumb:ScrollBarThumb, upButton:ScrollBarUpButton, downButton:ScrollBarDownButton};
return (_local1);
}
}
}//package com.bigwigmedia.ui.controls.scrollClasses
Section 424
//ScrollBarDownButton (com.bigwigmedia.ui.controls.scrollClasses.ScrollBarDownButton)
package com.bigwigmedia.ui.controls.scrollClasses {
import com.bigwigmedia.ui.controls.*;
public class ScrollBarDownButton extends SkinnedButton {
public function ScrollBarDownButton(){
this.height = 14;
}
public static function get defaultStyles():Object{
var _local1:Object = {upSkin:DefaultSkin, overSkin:DefaultSkin, downSkin:DefaultSkin, icon:ArrowDownIcon, upIcon:null, overIcon:null, downIcon:null, decoration:null};
return (_local1);
}
}
}//package com.bigwigmedia.ui.controls.scrollClasses
import flash.display.*;
import flash.geom.*;
class ArrowDownIcon extends Shape {
private function ArrowDownIcon(){
graphics.beginFill(0x333333, 1);
graphics.moveTo(4, 4);
graphics.lineTo(0, 0);
graphics.lineTo(8, 0);
graphics.lineTo(4, 4);
graphics.endFill();
}
}
class DefaultSkin extends Shape {
private var WIDTH:Number;// = 14
private var HEIGHT:Number;// = 14
private function DefaultSkin(){
graphics.beginFill(0x333333, 1);
graphics.drawRect(0, 0, WIDTH, HEIGHT);
graphics.endFill();
var _local1:Matrix = new Matrix();
_local1.createGradientBox((WIDTH - 2), (HEIGHT - 2), 0, 0, 0);
graphics.beginGradientFill(GradientType.LINEAR, [0xFFFFFF, 0xCCCCCC], [1, 1], [0, 0xFF], _local1);
graphics.drawRect(1, 1, (WIDTH - 2), (HEIGHT - 2));
graphics.endFill();
this.scale9Grid = new Rectangle(1, 1, (WIDTH - 2), (HEIGHT - 2));
}
}
Section 425
//ScrollBarThumb (com.bigwigmedia.ui.controls.scrollClasses.ScrollBarThumb)
package com.bigwigmedia.ui.controls.scrollClasses {
import com.bigwigmedia.ui.controls.*;
public class ScrollBarThumb extends SkinnedButton {
public static function get defaultStyles():Object{
var _local1:Object = {upSkin:DefaultSkin, overSkin:DefaultSkin, downSkin:DefaultSkin, icon:DefaultIcon, upIcon:null, overIcon:null, downIcon:null, decoration:null};
return (_local1);
}
}
}//package com.bigwigmedia.ui.controls.scrollClasses
import flash.display.*;
import flash.geom.*;
class DefaultIcon extends Shape {
private function DefaultIcon(){
graphics.beginFill(0x333333, 1);
graphics.drawRect(0, 0, 6, 1);
graphics.drawRect(0, 3, 6, 1);
graphics.drawRect(0, 6, 6, 1);
graphics.endFill();
}
}
class DefaultSkin extends Shape {
private var WIDTH:Number;// = 14
private var HEIGHT:Number;// = 100
private function DefaultSkin(){
graphics.beginFill(0x333333, 1);
graphics.drawRect(0, 0, WIDTH, HEIGHT);
graphics.endFill();
var _local1:Matrix = new Matrix();
_local1.createGradientBox((WIDTH - 2), (HEIGHT - 2), 0, 0, 0);
graphics.beginGradientFill(GradientType.LINEAR, [0xFFFFFF, 0xCCCCCC], [1, 1], [0, 0xFF], _local1);
graphics.drawRect(1, 1, (WIDTH - 2), (HEIGHT - 2));
graphics.endFill();
this.scale9Grid = new Rectangle(1, 1, (WIDTH - 2), (HEIGHT - 2));
}
}
Section 426
//ScrollBarTrack (com.bigwigmedia.ui.controls.scrollClasses.ScrollBarTrack)
package com.bigwigmedia.ui.controls.scrollClasses {
import com.bigwigmedia.ui.controls.*;
public class ScrollBarTrack extends SkinnedButton {
public static function get defaultStyles():Object{
var _local1:Object = {upSkin:DefaultSkin, overSkin:DefaultSkin, downSkin:DefaultSkin, icon:null, upIcon:null, overIcon:null, downIcon:null, decoration:null};
return (_local1);
}
}
}//package com.bigwigmedia.ui.controls.scrollClasses
import flash.display.*;
import flash.geom.*;
class DefaultSkin extends Shape {
private var WIDTH:Number;// = 14
private var HEIGHT:Number;// = 100
private function DefaultSkin(){
graphics.beginFill(0xCCCCCC, 1);
graphics.drawRect(0, 0, WIDTH, HEIGHT);
graphics.endFill();
graphics.beginFill(0xFFFFFF, 1);
graphics.drawRect(1, 1, (WIDTH - 2), (HEIGHT - 2));
graphics.endFill();
this.scale9Grid = new Rectangle(1, 1, (WIDTH - 2), (HEIGHT - 2));
}
}
Section 427
//ScrollBarUpButton (com.bigwigmedia.ui.controls.scrollClasses.ScrollBarUpButton)
package com.bigwigmedia.ui.controls.scrollClasses {
import com.bigwigmedia.ui.controls.*;
public class ScrollBarUpButton extends SkinnedButton {
public function ScrollBarUpButton(){
this.height = 14;
}
public static function get defaultStyles():Object{
var _local1:Object = {upSkin:DefaultSkin, overSkin:DefaultSkin, downSkin:DefaultSkin, icon:ArrowUpIcon, upIcon:null, overIcon:null, downIcon:null, decoration:null};
return (_local1);
}
}
}//package com.bigwigmedia.ui.controls.scrollClasses
import flash.display.*;
import flash.geom.*;
class ArrowUpIcon extends Shape {
private function ArrowUpIcon(){
graphics.beginFill(0x333333, 1);
graphics.moveTo(4, 0);
graphics.lineTo(8, 4);
graphics.lineTo(0, 4);
graphics.lineTo(4, 0);
graphics.endFill();
}
}
class DefaultSkin extends Shape {
private var WIDTH:Number;// = 14
private var HEIGHT:Number;// = 14
private function DefaultSkin(){
graphics.beginFill(0x333333, 1);
graphics.drawRect(0, 0, WIDTH, HEIGHT);
graphics.endFill();
var _local1:Matrix = new Matrix();
_local1.createGradientBox((WIDTH - 2), (HEIGHT - 2), 0, 0, 0);
graphics.beginGradientFill(GradientType.LINEAR, [0xFFFFFF, 0xCCCCCC], [1, 1], [0, 0xFF], _local1);
graphics.drawRect(1, 1, (WIDTH - 2), (HEIGHT - 2));
graphics.endFill();
this.scale9Grid = new Rectangle(1, 1, (WIDTH - 2), (HEIGHT - 2));
}
}
Section 428
//Slider (com.bigwigmedia.ui.controls.sliderClasses.Slider)
package com.bigwigmedia.ui.controls.sliderClasses {
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.ui.*;
import com.bigwigmedia.events.*;
import flash.events.*;
public class Slider extends Container {
protected var _track:SkinnedButton;
protected var _snapInterval:Number;// = 0
protected var _minimum:Number;// = 0
private var _drag:Boolean;// = false
protected var _thumb:AbstractButton;
protected var _maximum:Number;// = 100
protected var _value:Number;// = 0
protected var _thumbClickDisp:Number;// = 0
public function Slider(){
this.addEventListener(Event.ADDED_TO_STAGE, onAddedToStageHandler);
this.addEventListener(Event.REMOVED_FROM_STAGE, onRemovedToStageHandler);
}
public function set maximum(_arg1:Number):void{
if (_maximum == _arg1){
return;
};
_maximum = _arg1;
if (_value > _maximum){
_value = _maximum;
};
invalidateProperties();
}
public function set value(_arg1:Number):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local2:Number = _value;
if (((!((_snapInterval == 0))) && (!((_snapInterval == 1))))){
_local3 = Math.pow(10, getPrecision(_snapInterval));
_local4 = (_snapInterval * _local3);
_local5 = Math.round((_arg1 * _local3));
_local6 = (Math.round((_local5 / _local4)) * _local4);
_local7 = (_local6 / _local3);
_value = _local7;
} else {
_value = Math.round(_arg1);
};
if (_value < _minimum){
_value = _minimum;
} else {
if (_value > _maximum){
_value = _maximum;
};
};
if (_local2 != _value){
positionThumb();
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, _value, true));
};
}
private function onAddedToStageHandler(_arg1:Event):void{
stage.addEventListener(MouseEvent.MOUSE_UP, onMouseEventHandler);
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseEventHandler);
}
protected function get convertedWidth():Number{
throw (new Error("Override required."));
}
protected function mouseMoved():void{
var _local1:Number = (((this.mouseY - _thumbClickDisp) / convertedHeight) * (_maximum - _minimum));
value = correctedValue(_local1);
}
protected function get convertedHeight():Number{
throw (new Error("Override required."));
}
override protected function createChildren():void{
var _local1:Class = getStyle("track");
_track = new (_local1);
addChild(_track);
var _local2:Class = getStyle("thumb");
_thumb = new (_local2);
addChild(_thumb);
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDownHandler);
}
public function get minimum():Number{
return (_minimum);
}
private function getPrecision(_arg1:Number):Number{
var _local2:String = _arg1.toString();
if (_local2.indexOf(".") == -1){
return (0);
};
return (_local2.split(".").pop().length);
}
private function onMouseDownHandler(_arg1:MouseEvent):void{
var _local2:Number;
switch (_arg1.target){
case _thumb:
_thumbClickDisp = _thumb.mouseY;
_drag = true;
dispatchEvent(new SliderEvent(SliderEvent.KNOB_PRESS, _value, true));
break;
case _track:
_local2 = ((this.mouseY / convertedHeight) * (_maximum - _minimum));
value = correctedValue(_local2);
break;
};
}
public function set minimum(_arg1:Number):void{
if (_minimum == _arg1){
return;
};
_minimum = _arg1;
if (_value < _minimum){
_value = _minimum;
};
invalidateProperties();
}
public function set snapInterval(_arg1:Number):void{
_snapInterval = _arg1;
invalidateProperties();
}
public function get maximum():Number{
return (_maximum);
}
private function onRemovedToStageHandler(_arg1:Event):void{
stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseEventHandler);
stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseEventHandler);
}
override protected function validateProperties():void{
positionThumb();
}
protected function correctedValue(_arg1:Number):Number{
throw (new Error("Override required."));
}
override public function getComponentByName(_arg1:String):Component{
return (((_arg1 == this.name)) ? this : null);
}
public function get value():Number{
return (_value);
}
protected function positionThumb():void{
if (("label" in _thumb)){
_thumb["label"] = String(_value);
};
}
private function onMouseEventHandler(_arg1:MouseEvent):void{
switch (_arg1.type){
case MouseEvent.MOUSE_UP:
if (_drag){
_drag = false;
dispatchEvent(new SliderEvent(SliderEvent.KNOB_RELEASE, _value, true));
};
break;
case MouseEvent.MOUSE_MOVE:
if (_drag){
mouseMoved();
};
break;
};
}
public function get snapInterval():Number{
return (_snapInterval);
}
public static function get defaultStyles():Object{
var _local1:Object = {track:SliderTrack, thumb:SliderThumb};
return (_local1);
}
}
}//package com.bigwigmedia.ui.controls.sliderClasses
Section 429
//SliderThumb (com.bigwigmedia.ui.controls.sliderClasses.SliderThumb)
package com.bigwigmedia.ui.controls.sliderClasses {
import com.bigwigmedia.ui.controls.*;
public class SliderThumb extends SkinnedButton {
override protected function drawBackground():void{
graphics.clear();
graphics.lineStyle();
graphics.beginFill(0, 0);
graphics.drawRect(0, (-(this.height) / 2), this.width, this.height);
graphics.endFill();
}
public static function get defaultStyles():Object{
var _local1:Object = {upSkin:DefaultSkin, overSkin:DefaultSkin, downSkin:DefaultSkin, icon:null, upIcon:null, overIcon:null, downIcon:null};
return (_local1);
}
}
}//package com.bigwigmedia.ui.controls.sliderClasses
import flash.display.*;
import flash.geom.*;
class DefaultSkin extends Shape {
private function DefaultSkin(){
graphics.lineStyle(1, 0x333333);
var _local1:Matrix = new Matrix();
_local1.createGradientBox(16, 12, 0, 0, 0);
graphics.beginGradientFill(GradientType.LINEAR, [0xFFFFFF, 0xCCCCCC], [1, 1], [0, 0xFF], _local1);
graphics.moveTo(0, 0);
graphics.lineTo(6, -6);
graphics.lineTo(16, -6);
graphics.lineTo(16, 6);
graphics.lineTo(6, 6);
graphics.lineTo(0, 0);
graphics.endFill();
}
}
Section 430
//SliderTrack (com.bigwigmedia.ui.controls.sliderClasses.SliderTrack)
package com.bigwigmedia.ui.controls.sliderClasses {
import com.bigwigmedia.ui.controls.*;
public class SliderTrack extends SkinnedButton {
public static function get defaultStyles():Object{
var _local1:Object = {upSkin:DefaultSkin, overSkin:DefaultSkin, downSkin:DefaultSkin, icon:null, upIcon:null, overIcon:null, downIcon:null, decoration:null};
return (_local1);
}
}
}//package com.bigwigmedia.ui.controls.sliderClasses
import flash.display.*;
import flash.geom.*;
class DefaultSkin extends Shape {
private var WIDTH:Number;// = 4
private var HEIGHT:Number;// = 100
private function DefaultSkin(){
graphics.beginFill(0x333333, 1);
graphics.drawRect(0, 0, WIDTH, HEIGHT);
graphics.endFill();
var _local1:Matrix = new Matrix();
_local1.createGradientBox((WIDTH - 2), (HEIGHT - 2), 0, 0, 0);
graphics.beginGradientFill(GradientType.LINEAR, [0xFFFFFF, 0xCCCCCC], [1, 1], [0, 0xFF], _local1);
graphics.drawRect(1, 1, (WIDTH - 2), (HEIGHT - 2));
graphics.endFill();
this.scale9Grid = new Rectangle(1, 1, (WIDTH - 2), (HEIGHT - 2));
}
}
Section 431
//AbstractButton (com.bigwigmedia.ui.controls.AbstractButton)
package com.bigwigmedia.ui.controls {
import flash.display.*;
import com.bigwigmedia.ui.*;
import com.bigwigmedia.events.*;
import flash.events.*;
import flash.utils.*;
import com.bigwigmedia.ui.decorations.*;
public class AbstractButton extends Component {
private var pressTimer:Timer;
protected var _autoRepeat:Boolean;// = false
protected var rollOverHandler:Function;// = null
protected var _selected:Boolean;// = false
protected var mouseDownHandler:Function;// = null
protected var mouseClickHandler:Function;// = null
private var _beacon:IBeacon;// = null
public var value;
protected var rollOutHandler:Function;// = null
protected var _toggle:Boolean;// = false
protected var _phase:String;// = "phaseUp"
public static const PHASE_DOWN:String = "phaseDown";
public static const PHASE_OVER:String = "phaseOver";
public static const PHASE_UP:String = "phaseUp";
public function AbstractButton(){
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, onPressTimerHandler);
buttonMode = true;
mouseChildren = false;
addEventListener(MouseEvent.MOUSE_UP, onMouseEventHandler, false, EventPriority.HIGH);
addEventListener(MouseEvent.MOUSE_DOWN, onMouseEventHandler, false, EventPriority.HIGH);
addEventListener(MouseEvent.ROLL_OVER, onMouseEventHandler, false, EventPriority.HIGH);
addEventListener(MouseEvent.ROLL_OUT, onMouseEventHandler, false, EventPriority.HIGH);
addEventListener(MouseEvent.CLICK, onMouseClickHandler, false, EventPriority.HIGH);
}
private function onMouseClickHandler(_arg1:MouseEvent):void{
mouseClicked();
}
protected function updatePhase():void{
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
private function onPressTimerHandler(_arg1:TimerEvent):void{
if (!_autoRepeat){
pressTimer.reset();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = getStyle("repeatInterval");
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function mouseClicked():void{
if (mouseClickHandler != null){
mouseClickHandler(this);
};
if (_toggle){
selected = !(selected);
};
}
public function get toggle():Boolean{
return (_toggle);
}
public function set useBeacon(_arg1:Boolean):void{
var _local2:IBeacon;
if (_arg1){
_local2 = getStyle("beacon");
if (_local2){
_beacon = _local2.clone();
_beacon.apply(this.beaconTarget);
};
} else {
if (_beacon){
_beacon.dispose();
_beacon = null;
};
};
}
override protected function validateStyles():void{
super.validateStyles();
rollOverHandler = getStyle("rollOverHandler");
rollOutHandler = getStyle("rollOutHandler");
mouseDownHandler = getStyle("mouseDownHandler");
mouseClickHandler = getStyle("mouseClickHandler");
}
override public function set enabled(_arg1:Boolean):void{
if (_enabled != _arg1){
_phase = PHASE_UP;
invalidateProperties();
invalidateSize();
super.enabled = _arg1;
};
}
public function get selected():Boolean{
return (_selected);
}
override public function dispose():void{
removeEventListener(MouseEvent.MOUSE_UP, onMouseEventHandler);
removeEventListener(MouseEvent.MOUSE_DOWN, onMouseEventHandler);
removeEventListener(MouseEvent.ROLL_OVER, onMouseEventHandler);
removeEventListener(MouseEvent.ROLL_OUT, onMouseEventHandler);
removeEventListener(MouseEvent.CLICK, onMouseClickHandler);
pressTimer.reset();
pressTimer.removeEventListener(TimerEvent.TIMER, onPressTimerHandler);
if (_beacon){
_beacon.dispose();
_beacon = null;
};
rollOverHandler = null;
rollOutHandler = null;
mouseDownHandler = null;
mouseClickHandler = null;
super.dispose();
}
public function set toggle(_arg1:Boolean):void{
if (_toggle != _arg1){
_toggle = _arg1;
invalidateProperties();
invalidateSize();
};
}
override protected function validateProperties():void{
super.validateProperties();
updatePhase();
}
public function get useBeacon():Boolean{
return (!((_beacon == null)));
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
protected function get beaconTarget():DisplayObject{
throw (new Error("Method must be overriden in subclass."));
}
private function onMouseEventHandler(_arg1:MouseEvent):void{
switch (_arg1.type){
case MouseEvent.ROLL_OVER:
if (rollOverHandler != null){
rollOverHandler(this);
};
_phase = PHASE_OVER;
break;
case MouseEvent.ROLL_OUT:
if (rollOutHandler != null){
rollOutHandler(this);
};
_phase = PHASE_UP;
break;
case MouseEvent.MOUSE_DOWN:
if (mouseDownHandler != null){
mouseDownHandler(this);
};
_phase = PHASE_DOWN;
break;
case MouseEvent.MOUSE_UP:
_phase = PHASE_OVER;
break;
};
if (_phase == PHASE_DOWN){
if (_autoRepeat){
pressTimer.delay = getStyle("repeatDelay");
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
} else {
pressTimer.reset();
};
invalidateProperties();
invalidateSize();
}
public function set selected(_arg1:Boolean):void{
if (_selected != _arg1){
_selected = _arg1;
if (_toggle){
dispatchEvent(new ComponentEvent(ComponentEvent.CHANGE, true));
invalidateProperties();
invalidateSize();
};
};
}
public static function get defaultStyles():Object{
var _local1:Object = {repeatDelay:500, repeatInterval:50, rollOverHandler:null, rollOutHandler:null, mouseDownHandler:null, mouseClickHandler:null, beacon:null};
return (_local1);
}
}
}//package com.bigwigmedia.ui.controls
Section 432
//AbstractTextComponent (com.bigwigmedia.ui.controls.AbstractTextComponent)
package com.bigwigmedia.ui.controls {
import com.bigwigmedia.ui.*;
import flash.text.*;
public class AbstractTextComponent extends Component {
protected var _editable:Boolean;// = false
protected var _text:String;// = ""
protected var _textField:TextField;
protected var _htmlText:String;// = null
protected var _selectable:Boolean;// = false
public function get scrollV():int{
return (_textField.scrollV);
}
public function set editable(_arg1:Boolean):void{
_editable = _arg1;
updateTextFieldType();
}
public function set scrollV(_arg1:int):void{
_textField.scrollV = _arg1;
}
public function get selectable():Boolean{
return (_selectable);
}
public function set text(_arg1:String):void{
if (!_arg1){
_arg1 = "";
};
if (_text != _arg1){
_text = _arg1;
invalidateProperties();
invalidateSize();
};
}
public function get scrollH():int{
return (_textField.scrollH);
}
protected function updateTextFieldType():void{
_textField.type = (((_editable) && (_selectable))) ? TextFieldType.INPUT : TextFieldType.DYNAMIC;
_textField.selectable = _selectable;
this.mouseChildren = _selectable;
}
override protected function validateStyles():void{
var _local2:TextFormat;
super.validateStyles();
_textField.embedFonts = getStyle("embedFonts");
var _local1:StyleSheet = getStyle("styleSheet");
if (_local1){
_textField.styleSheet = _local1;
} else {
_textField.styleSheet = null;
_local2 = getStyle("textFormat");
_textField.setTextFormat(_local2);
_textField.defaultTextFormat = _local2;
};
}
public function get editable():Boolean{
return (_editable);
}
public function set wordWrap(_arg1:Boolean):void{
_textField.wordWrap = _arg1;
}
override protected function validateProperties():void{
if (_htmlText){
_textField.htmlText = _htmlText;
} else {
_textField.text = _text;
};
}
public function set selectable(_arg1:Boolean):void{
_selectable = _arg1;
updateTextFieldType();
}
public function get text():String{
return (_textField.text);
}
public function set htmlText(_arg1:String):void{
if (_htmlText != _arg1){
_htmlText = _arg1;
invalidateProperties();
invalidateSize();
};
}
public function get wordWrap():Boolean{
return (_textField.wordWrap);
}
public function set scrollH(_arg1:int):void{
_textField.scrollH = _arg1;
}
override protected function validateSize():void{
if (isNaN(_explicitWidth)){
setNotExplicitWidth(_textField.width);
} else {
_textField.width = this.width;
};
if (isNaN(_explicitHeight)){
setNotExplicitHeight(_textField.height);
} else {
_textField.height = this.height;
};
}
public function get htmlText():String{
return (_textField.htmlText);
}
}
}//package com.bigwigmedia.ui.controls
Section 433
//Button (com.bigwigmedia.ui.controls.Button)
package com.bigwigmedia.ui.controls {
import flash.display.*;
import flash.text.*;
public class Button extends SkinnedButton {
protected var _labelColors:Object;
protected var _labelField:TextField;
protected var _label:String;// = ""
public function Button(){
_labelColors = {};
super();
}
public function set label(_arg1:String):void{
if (_label != _arg1){
_labelField.text = (_label = _arg1);
invalidateSize();
};
}
override protected function updatePhase():void{
super.updatePhase();
switch (_phase){
case PHASE_UP:
_labelField.textColor = _labelColors[(_selected) ? "selectedLabelColor" : "upLabelColor"];
break;
case PHASE_OVER:
_labelField.textColor = _labelColors["overLabelColor"];
break;
default:
_labelField.textColor = _labelColors["downLabelColor"];
break;
};
}
public function get label():String{
return (_label);
}
override protected function validateSize():void{
var _local4:Number;
var _local5:Number;
var _local1:Number = getStyle("padding");
var _local2:Number = getStyle("iconGap");
var _local3:String = getStyle("labelPlacement");
if (isNaN(_explicitWidth)){
if (_currentSkin){
_local4 = _currentSkin.width;
} else {
if (_currentIcon){
if ((((_local3 == "left")) || ((_local3 == "right")))){
_local4 = (((_labelField.width + (_local1 * 2)) + _currentIcon.width) + _local2);
} else {
_local4 = (Math.max(_labelField.width, _currentIcon.width) + (_local1 * 2));
};
} else {
_local4 = (_labelField.width + (_local1 * 2));
};
};
setNotExplicitWidth(_local4);
} else {
_local4 = _explicitWidth;
};
if (_currentIcon){
if ((((_local3 == "left")) || ((_local3 == "right")))){
_labelField.x = ((_local3 == "left")) ? _local1 : ((_local4 - _labelField.width) - _local1);
_currentIcon.x = ((_local3 == "right")) ? _local1 : ((_local4 - _currentIcon.width) - _local1);
} else {
_labelField.x = ((_local4 - _labelField.width) / 2);
_currentIcon.x = ((_local4 - _currentIcon.width) / 2);
};
} else {
_labelField.x = ((_local4 - _labelField.width) / 2);
};
if (_currentSkin){
_currentSkin.width = _local4;
};
if (isNaN(_explicitHeight)){
if (_currentSkin){
_local5 = _currentSkin.height;
} else {
if (_currentIcon){
if ((((_local3 == "top")) || ((_local3 == "bottom")))){
_local5 = (((_labelField.height + (_local1 * 2)) + _currentIcon.height) + _local2);
} else {
_local5 = (Math.max(_labelField.height, _currentIcon.height) + (_local1 * 2));
};
} else {
_local5 = (_labelField.height + (_local1 * 2));
};
};
setNotExplicitHeight(_local5);
} else {
_local5 = _explicitHeight;
};
if (_currentIcon){
if ((((_local3 == "top")) || ((_local3 == "bottom")))){
_labelField.y = ((_local3 == "top")) ? _local1 : ((_local5 - _labelField.height) - _local1);
_currentIcon.y = ((_local3 == "bottom")) ? _local1 : ((_local5 - _currentIcon.height) - _local1);
} else {
_labelField.y = ((_local5 - _labelField.height) / 2);
_currentIcon.y = ((_local5 - _currentIcon.height) / 2);
};
} else {
_labelField.y = ((_local5 - _labelField.height) / 2);
};
if (_currentSkin){
_currentSkin.height = _local5;
};
drawBackground();
}
override protected function validateStyles():void{
super.validateStyles();
_labelField.embedFonts = getStyle("embedFonts");
var _local1:TextFormat = getStyle("textFormat");
_labelField.setTextFormat(_local1);
_labelField.defaultTextFormat = _local1;
_labelColors["upLabelColor"] = getStyle("upLabelColor");
_labelColors["overLabelColor"] = getStyle("overLabelColor");
_labelColors["downLabelColor"] = getStyle("downLabelColor");
_labelColors["selectedLabelColor"] = getStyle("selectedLabelColor");
}
override protected function createChildren():void{
_labelField = new TextField();
_labelField.type = TextFieldType.DYNAMIC;
_labelField.selectable = false;
_labelField.autoSize = TextFieldAutoSize.LEFT;
addChild(_labelField);
super.createChildren();
}
override protected function get beaconTarget():DisplayObject{
return (_labelField);
}
public static function get defaultStyles():Object{
var _local1:Object = {upLabelColor:0, overLabelColor:0x808080, downLabelColor:0xFFFFFF, selectedLabelColor:0xFFFFFF, labelPlacement:"right", padding:2, iconGap:6};
return (_local1);
}
}
}//package com.bigwigmedia.ui.controls
Section 434
//HScrollBar (com.bigwigmedia.ui.controls.HScrollBar)
package com.bigwigmedia.ui.controls {
import com.bigwigmedia.ui.controls.scrollClasses.*;
public class HScrollBar extends ScrollBar {
public function HScrollBar(){
this.width = 100;
this.height = 14;
}
override protected function get convertedWidth():Number{
return (height);
}
override protected function validateSize():void{
_upArrow.width = (_downArrow.width = height);
_downArrow.x = (width - _downArrow.width);
_track.width = height;
_track.height = width;
minWidth = ((MIN_SIZE + _upArrow.width) + _downArrow.width);
positionThumb();
}
override protected function get convertedHeight():Number{
return (width);
}
override protected function createChildren():void{
super.createChildren();
_track.rotation = (_upArrow.rotation = (_downArrow.rotation = (_thumb.rotation = -90)));
_track.scaleX = (_upArrow.scaleX = (_downArrow.scaleX = (_thumb.scaleX = -1)));
}
override public function get mouseY():Number{
return (super.mouseX);
}
override protected function set thumbPosition(_arg1:Number):void{
_thumb.x = _arg1;
}
override protected function get thumbPosition():Number{
return (_thumb.x);
}
}
}//package com.bigwigmedia.ui.controls
Section 435
//HSlider (com.bigwigmedia.ui.controls.HSlider)
package com.bigwigmedia.ui.controls {
import com.bigwigmedia.ui.controls.sliderClasses.*;
public class HSlider extends Slider {
public function HSlider(){
this.width = 100;
this.height = 14;
}
override protected function get convertedWidth():Number{
return (height);
}
override protected function validateSize():void{
_track.height = convertedHeight;
_track.y = ((height - _track.width) / 2);
_thumb.y = ((height - _thumb.width) / 2);
positionThumb();
}
override protected function correctedValue(_arg1:Number):Number{
return ((_minimum + _arg1));
}
override protected function get convertedHeight():Number{
return (width);
}
override protected function createChildren():void{
super.createChildren();
_track.rotation = (_thumb.rotation = -90);
_track.scaleX = (_thumb.scaleX = -1);
}
override public function get mouseY():Number{
return (super.mouseX);
}
override protected function positionThumb():void{
super.positionThumb();
var _local1:Number = (_value - _minimum);
_thumb.x = ((_local1 / (_maximum - _minimum)) * convertedHeight);
}
}
}//package com.bigwigmedia.ui.controls
Section 436
//Image (com.bigwigmedia.ui.controls.Image)
package com.bigwigmedia.ui.controls {
import flash.display.*;
import com.bigwigmedia.ui.*;
import com.bigwigmedia.events.*;
import flash.utils.*;
import com.bigwigmedia.loaders.*;
public class Image extends Component {
private var _displayObject:DisplayObject;// = null
private var _loader:ISWFLoader;// = null
private var _source:Object;// = null
public function Image(){
this.mouseChildren = false;
}
override protected function validateProperties():void{
clear();
if (_source == null){
return;
};
if ((_source is DisplayObject)){
_displayObject = DisplayObject(_source);
} else {
if ((_source is BitmapData)){
_displayObject = new Bitmap(BitmapData(_source), getPixelSnapping(), getStyle("bitmapSmoothing"));
} else {
if ((_source is Class)){
if (getQualifiedSuperclassName(_source) == "flash.display::BitmapData"){
_displayObject = new Bitmap(new _source(0, 0), getPixelSnapping(), getStyle("bitmapSmoothing"));
} else {
_displayObject = new _source();
};
} else {
if ((_source is String)){
_loader = new SWFLoader(String(_source));
_loader.addEventListener(LoaderEvent.READY, onLoaderReadyHandler);
_loader.load();
};
};
};
};
if (_displayObject){
addChild(_displayObject);
};
}
private function getPixelSnapping():String{
var _local1:String = getStyle("bitmapPixelSnapping");
switch (_local1){
case "always":
return (PixelSnapping.ALWAYS);
case "never":
return (PixelSnapping.NEVER);
};
return (PixelSnapping.AUTO);
}
private function clear():void{
if (_loader){
_loader.removeEventListener(LoaderEvent.READY, onLoaderReadyHandler);
_loader.dispose();
_loader = null;
};
if (_displayObject){
removeChild(_displayObject);
_displayObject = null;
};
}
public function set source(_arg1:Object):void{
if (_source == _arg1){
return;
};
_source = _arg1;
invalidateProperties();
invalidateSize();
}
override protected function validateSize():void{
if (isNaN(_explicitWidth)){
setNotExplicitWidth((_displayObject) ? _displayObject.width : 0);
} else {
if (_displayObject){
_displayObject.width = this.width;
};
};
if (isNaN(_explicitHeight)){
setNotExplicitHeight((_displayObject) ? _displayObject.height : 0);
} else {
if (_displayObject){
_displayObject.height = this.height;
};
};
}
private function onLoaderReadyHandler(_arg1:LoaderEvent):void{
_displayObject = _loader.content;
if ((_displayObject is Bitmap)){
Bitmap(_displayObject).pixelSnapping = getPixelSnapping();
Bitmap(_displayObject).smoothing = getStyle("bitmapSmoothing");
};
addChild(_displayObject);
invalidateSize();
}
override public function dispose():void{
clear();
_source = null;
super.dispose();
}
public static function get defaultStyles():Object{
var _local1:Object = {bitmapPixelSnapping:"auto", bitmapSmoothing:false};
return (_local1);
}
}
}//package com.bigwigmedia.ui.controls
Section 437
//Label (com.bigwigmedia.ui.controls.Label)
package com.bigwigmedia.ui.controls {
import flash.text.*;
public class Label extends AbstractTextComponent {
public function Label(){
this.selectable = false;
this.editable = false;
}
override protected function createChildren():void{
_textField = new TextField();
_textField.wordWrap = false;
_textField.multiline = false;
_textField.autoSize = TextFieldAutoSize.LEFT;
addChild(_textField);
}
}
}//package com.bigwigmedia.ui.controls
Section 438
//LabelButton (com.bigwigmedia.ui.controls.LabelButton)
package com.bigwigmedia.ui.controls {
import flash.display.*;
public class LabelButton extends Button {
override protected function get decorationTarget():DisplayObject{
return (_labelField);
}
override protected function getSkin():DisplayObject{
return (null);
}
}
}//package com.bigwigmedia.ui.controls
Section 439
//List (com.bigwigmedia.ui.controls.List)
package com.bigwigmedia.ui.controls {
import com.bigwigmedia.ui.*;
import com.bigwigmedia.events.*;
import flash.events.*;
import flash.geom.*;
import com.bigwigmedia.ui.controls.listClasses.*;
public class List extends ScrollPane {
private var _allowMultipleSelection:Boolean;// = false
private var _data:Array;
private var _cellRendereres:Array;
private var _redrawCellRenderers:Boolean;// = false
private var _selectedItemsIndices:Array;
private var _rowHeight:Number;// = 32
private var _minVisibleIndex:int;// = -1
private var _numItems:int;// = 0
private var _selectable:Boolean;// = true
public function List(){
_data = [];
_cellRendereres = [];
_selectedItemsIndices = [];
super();
addEventListener(MouseEvent.CLICK, onMouseClickHandler);
}
private function dispatchListEvent(_arg1:String, _arg2:int=-1):void{
dispatchEvent(new ListEvent(_arg1, _arg2, ((_arg2 < 0)) ? null : getItemAt(_arg2), true));
}
public function removeAllItems():void{
removeCellRenderers();
_data = [];
_numItems = 0;
_redrawCellRenderers = true;
invalidateProperties();
invalidateChildren();
}
public function set selectedIndices(_arg1:Array):void{
if (!_allowMultipleSelection){
return;
};
_selectedItemsIndices = _arg1;
invalidateProperties();
}
private function onMouseClickHandler(_arg1:MouseEvent):void{
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local2:ListItemRenderer = (_arg1.target as ListItemRenderer);
if (!_local2){
return;
};
var _local3:int = _local2.index;
var _local4:Boolean;
if (_arg1.ctrlKey){
_local5 = _selectedItemsIndices.indexOf(_local3);
if (_local5 == -1){
_selectedItemsIndices.push(_local3);
} else {
_selectedItemsIndices.splice(_local5, 1);
};
_local4 = true;
} else {
if (_allowMultipleSelection){
if (((_arg1.shiftKey) && ((_selectedItemsIndices.length > 0)))){
_local6 = _selectedItemsIndices.length;
_local7 = int.MAX_VALUE;
_local8 = int.MIN_VALUE;
_local9 = 0;
while (_local9 < _local6) {
_local10 = _selectedItemsIndices[_local9];
if (_local10 < _local7){
_local7 = _local10;
};
if (_local10 > _local8){
_local8 = _local10;
};
_local9++;
};
if (_local3 <= _local7){
_local8 = _local7;
_local7 = _local3;
} else {
if (_local3 >= _local8){
_local7 = _local8;
_local8 = _local3;
};
};
_selectedItemsIndices = [];
_local9 = _local7;
while (_local9 <= _local8) {
_selectedItemsIndices.push(_local9);
_local9++;
};
_local4 = true;
} else {
_selectedItemsIndices = [_local3];
_local4 = true;
};
} else {
if (_selectedItemsIndices[0] != _local3){
_selectedItemsIndices = [_local3];
_local4 = true;
};
};
};
dispatchListEvent(ListEvent.ITEM_CLICK, _local3);
if (_local4){
invalidateProperties();
dispatchListEvent(ListEvent.SELECTION_CHANGE, _local3);
};
}
public function removeItemAt(_arg1:int):Object{
if ((((_arg1 < 0)) || ((_arg1 >= _numItems)))){
throw (new RangeError((((("Index (" + String(_arg1)) + ") is not in acceptable range (0 - ") + String((_numItems - 1))) + ")")));
};
_numItems = (_data.length - 1);
_redrawCellRenderers = true;
invalidateProperties();
invalidateChildren();
return (_data.splice(_arg1, 1)[0]);
}
public function get selectedIndices():Array{
if (!_allowMultipleSelection){
return ([]);
};
return (_selectedItemsIndices);
}
public function get selectedItem():Object{
if (((_allowMultipleSelection) || ((_selectedItemsIndices[0] === undefined)))){
return (null);
};
return (getItemAt(_selectedItemsIndices[0]));
}
public function getItemIndex(_arg1:Object):int{
return (_data.indexOf(_arg1));
}
public function get allowMultipleSelection():Boolean{
return (_allowMultipleSelection);
}
public function set data(_arg1:Array):void{
_data = _arg1;
_numItems = _data.length;
_redrawCellRenderers = true;
invalidateProperties();
invalidateChildren();
}
public function get selectable():Boolean{
return (_selectable);
}
public function addItem(_arg1:Object):void{
addItemAt(_arg1, _numItems);
}
public function getItemAt(_arg1:int):Object{
return (_data[_arg1]);
}
override public function dispose():void{
removeCellRenderers();
super.dispose();
}
public function addItemAt(_arg1:Object, _arg2:int):void{
if ((((_arg2 < 0)) || ((_arg2 > _numItems)))){
throw (new RangeError((((("Index (" + String(_arg2)) + ") is not in acceptable range (0 - ") + String((_numItems - 1))) + ")")));
};
_data.splice(_arg2, 0, _arg1);
_numItems = _data.length;
_redrawCellRenderers = true;
invalidateProperties();
invalidateChildren();
}
override protected function validateProperties():void{
var _local1:ListItemRenderer;
for each (_local1 in _cellRendereres) {
_local1.selected = !((_selectedItemsIndices.indexOf(_local1.index) == -1));
};
_contentHeight = (_numItems * _rowHeight);
calculateAvailableSize();
updateScrollBarsProperties();
}
public function set selectable(_arg1:Boolean):void{
if (_selectable != _arg1){
_selectable = _arg1;
if (!_selectable){
clearSelection();
};
_redrawCellRenderers = true;
invalidateChildren();
};
}
public function set allowMultipleSelection(_arg1:Boolean):void{
if (_allowMultipleSelection != _arg1){
_allowMultipleSelection = _arg1;
if (!_allowMultipleSelection){
clearSelection();
};
_redrawCellRenderers = true;
invalidateChildren();
};
}
private function removeCellRenderers():void{
var _local1:ListItemRenderer;
while (_cellRendereres.length > 0) {
_local1 = _cellRendereres.pop();
_contentHolder.removeChild(_local1);
_local1.dispose();
};
}
override protected function validateChildren():void{
var _local2:int;
var _local3:int;
var _local4:ListItemRenderer;
_contentHolder.scrollRect = new Rectangle(0, _verticalScrollBar.scrollPosition, _availableWidth, _availableHeight);
var _local1:int = (_verticalScrollBar.scrollPosition / _rowHeight);
if (((_redrawCellRenderers) || (!((_local1 == _minVisibleIndex))))){
removeCellRenderers();
_minVisibleIndex = _local1;
_local2 = Math.min((_numItems - 1), ((_minVisibleIndex + (_availableHeight / _rowHeight)) + 1));
_local3 = _minVisibleIndex;
while (_local3 <= _local2) {
_local4 = new ListItemRenderer(_local3);
_local4.label = _data[_local3].label;
_local4.y = (_local3 * _rowHeight);
_local4.height = _rowHeight;
_local4.width = _availableWidth;
_local4.selected = !((_selectedItemsIndices.indexOf(_local3) == -1));
_local4.enabled = _selectable;
_cellRendereres.push(_local4);
_contentHolder.addChild(_local4);
_local3++;
};
};
_redrawCellRenderers = false;
}
public function removeItem(_arg1:Object):Object{
return (removeItemAt(getItemIndex(_arg1)));
}
public function set selectedIndex(_arg1:int):void{
if (((_allowMultipleSelection) || ((_selectedItemsIndices[0] === _arg1)))){
return;
};
if ((((_arg1 < 0)) || ((_arg1 >= _numItems)))){
throw (new RangeError((((("Index (" + String(_arg1)) + ") is not in acceptable range (0 - ") + String((_numItems - 1))) + ")")));
};
_selectedItemsIndices[0] = _arg1;
invalidateProperties();
dispatchListEvent(ListEvent.SELECTION_CHANGE, _arg1);
}
public function get selectedIndex():int{
if (((_allowMultipleSelection) || ((_selectedItemsIndices[0] === undefined)))){
return (-1);
};
return (_selectedItemsIndices[0]);
}
public function clearSelection():void{
if (_selectedItemsIndices.length > 0){
_selectedItemsIndices = [];
invalidateProperties();
dispatchListEvent(ListEvent.SELECTION_CHANGE, -1);
};
}
}
}//package com.bigwigmedia.ui.controls
Section 440
//SkinnedButton (com.bigwigmedia.ui.controls.SkinnedButton)
package com.bigwigmedia.ui.controls {
import flash.display.*;
import flash.utils.*;
import com.bigwigmedia.ui.decorations.*;
public class SkinnedButton extends AbstractButton {
protected var _decorations:Object;
protected var _currentDecoration:IDecoration;// = null
protected var _currentIcon:DisplayObject;// = null
protected var _currentSkin:DisplayObject;// = null
protected var _icons:Object;
protected var _skins:Object;
public function SkinnedButton(){
_skins = {};
_icons = {};
_decorations = {};
super();
}
override protected function createChildren():void{
updatePhase();
}
protected function getIcon():DisplayObject{
var _local1:DisplayObject;
switch (_phase){
case PHASE_UP:
_local1 = _icons[(_selected) ? "selectedIcon" : "upIcon"];
break;
case PHASE_OVER:
_local1 = _icons["overIcon"];
break;
default:
_local1 = _icons["downIcon"];
break;
};
return (((_local1) || (_icons["icon"])));
}
protected function getSkin():DisplayObject{
var _local1:DisplayObject;
switch (_phase){
case PHASE_UP:
_local1 = _skins[(_selected) ? "selectedSkin" : "upSkin"];
break;
case PHASE_OVER:
_local1 = _skins["overSkin"];
break;
default:
_local1 = _skins["downSkin"];
break;
};
return (((_local1) || (_skins["upSkin"])));
}
override protected function validateSize():void{
if (isNaN(_explicitWidth)){
setNotExplicitWidth(_currentSkin.width);
} else {
_currentSkin.width = this.width;
};
if (isNaN(_explicitHeight)){
setNotExplicitHeight(_currentSkin.height);
} else {
_currentSkin.height = this.height;
};
if (_currentIcon){
_currentIcon.x = ((this.width - _currentIcon.width) / 2);
_currentIcon.y = ((this.height - _currentIcon.height) / 2);
};
drawBackground();
}
protected function get decorationTarget():DisplayObject{
return (_currentSkin);
}
override protected function updatePhase():void{
var _local3:IDecoration;
var _local1:DisplayObject = getSkin();
var _local2:DisplayObject = getIcon();
switch (_phase){
case PHASE_UP:
_local3 = _decorations[(_selected) ? "selectedDecoration" : "upDecoration"];
break;
case PHASE_OVER:
_local3 = _decorations["overDecoration"];
break;
case PHASE_DOWN:
_local3 = _decorations["downDecoration"];
break;
};
if (((((!((_currentDecoration == _local3))) && (_currentDecoration))) && (decorationTarget))){
_currentDecoration.remove(decorationTarget);
};
if (_currentSkin != _local1){
if (_currentSkin){
removeChild(_currentSkin);
};
_currentSkin = _local1;
if (_currentSkin){
addChildAt(_currentSkin, 0);
};
};
if (_currentIcon != _local2){
if (_currentIcon){
removeChild(_currentIcon);
};
_currentIcon = _local2;
if (_currentIcon){
addChildAt(_currentIcon, (_currentSkin) ? (getChildIndex(_currentSkin) + 1) : 0);
};
};
if (((!((_currentDecoration == _local3))) && (decorationTarget))){
if (_local3){
_local3.apply(decorationTarget);
};
_currentDecoration = _local3;
};
}
override protected function validateStyles():void{
super.validateStyles();
_skins["upSkin"] = getElementDisplayObject(getStyle("upSkin"));
_skins["overSkin"] = getElementDisplayObject(getStyle("overSkin"));
_skins["downSkin"] = getElementDisplayObject(getStyle("downSkin"));
_skins["selectedSkin"] = getElementDisplayObject(getStyle("selectedSkin"));
_icons["icon"] = getElementDisplayObject(getStyle("icon"));
_icons["upIcon"] = getElementDisplayObject(getStyle("upIcon"));
_icons["overIcon"] = getElementDisplayObject(getStyle("overIcon"));
_icons["downIcon"] = getElementDisplayObject(getStyle("downIcon"));
_icons["selectedIcon"] = getElementDisplayObject(getStyle("selectedIcon"));
_decorations["upDecoration"] = getStyle("upDecoration");
_decorations["overDecoration"] = getStyle("overDecoration");
_decorations["downDecoration"] = getStyle("downDecoration");
_decorations["selectedDecoration"] = getStyle("selectedDecoration");
}
override protected function get beaconTarget():DisplayObject{
return (_currentSkin);
}
protected function getElementDisplayObject(_arg1:Object):DisplayObject{
if ((_arg1 is Class) == false){
return (DisplayObject(_arg1));
};
if (getQualifiedSuperclassName(_arg1) == "flash.display::BitmapData"){
return (new Bitmap(new _arg1(0, 0), PixelSnapping.AUTO, true));
};
return (new (_arg1));
}
override public function dispose():void{
super.dispose();
if (_currentSkin){
removeChild(_currentSkin);
_currentSkin = null;
};
if (_currentIcon){
removeChild(_currentIcon);
_currentIcon = null;
};
_skins = {};
_icons = {};
_decorations = {};
}
public static function get defaultStyles():Object{
var _local1:Object = {upSkin:DefaultSkin, overSkin:null, downSkin:null, selectedSkin:null, icon:null, upIcon:null, overIcon:null, downIcon:null, selectedIcon:null, upDecoration:null, overDecoration:null, downDecoration:null, selectedDecoration:null};
return (_local1);
}
}
}//package com.bigwigmedia.ui.controls
import flash.display.*;
import flash.geom.*;
class DefaultSkin extends Shape {
public static const WIDTH:Number = 48;
public static const HEIGHT:Number = 24;
private function DefaultSkin(){
graphics.beginFill(0x333333, 1);
graphics.drawRect(0, 0, WIDTH, HEIGHT);
graphics.endFill();
var _local1:Matrix = new Matrix();
_local1.createGradientBox((WIDTH - 2), (HEIGHT - 2), (Math.PI / 2), 0, 0);
graphics.beginGradientFill(GradientType.LINEAR, [0xFFFFFF, 0xCCCCCC], [1, 1], [0, 0xFF], _local1);
graphics.drawRect(1, 1, (WIDTH - 2), (HEIGHT - 2));
graphics.endFill();
this.scale9Grid = new Rectangle(1, 1, (WIDTH - 2), (HEIGHT - 2));
}
}
Section 441
//Spacer (com.bigwigmedia.ui.controls.Spacer)
package com.bigwigmedia.ui.controls {
import com.bigwigmedia.ui.*;
public class Spacer extends Component {
override protected function validateSize():void{
graphics.clear();
graphics.beginFill(getStyle("fillColor"), getStyle("fillAlpha"));
graphics.drawRect(0, 0, width, height);
graphics.endFill();
}
public static function get defaultStyles():Object{
var _local1:Object = {fillColor:0xFFFFFF, fillAlpha:0};
return (_local1);
}
}
}//package com.bigwigmedia.ui.controls
Section 442
//Text (com.bigwigmedia.ui.controls.Text)
package com.bigwigmedia.ui.controls {
public class Text extends Label {
override protected function createChildren():void{
super.createChildren();
_textField.wordWrap = true;
_textField.multiline = true;
}
}
}//package com.bigwigmedia.ui.controls
Section 443
//TextArea (com.bigwigmedia.ui.controls.TextArea)
package com.bigwigmedia.ui.controls {
import com.bigwigmedia.ui.*;
import com.bigwigmedia.events.*;
import flash.events.*;
public class TextArea extends TextInput {
protected var _horizontalScrollPolicy:String;// = "auto"
protected var _horizontalScrollBar:HScrollBar;
protected var _verticalScrollPolicy:String;// = "auto"
protected var _showVScrollBar:Boolean;
protected var _verticalScrollBar:VScrollBar;
protected var _showHScrollBar:Boolean;
public function TextArea(){
this.width = 100;
this.height = 100;
updateScrollBarsProperties();
}
public function set horizontalScrollPolicy(_arg1:String):void{
_horizontalScrollPolicy = _arg1;
calculateAvailableSize();
updateScrollBarsProperties();
}
private function onMouseWheelHandler(_arg1:MouseEvent):void{
if (((_enabled) && (_verticalScrollBar.visible))){
_verticalScrollBar.scrollPosition = (_verticalScrollBar.scrollPosition - (_arg1.delta * _verticalScrollBar.lineScrollSize));
};
}
override protected function createChildren():void{
super.createChildren();
_textField.multiline = true;
_textField.addEventListener(Event.CHANGE, onTextChangeHandler);
_textField.addEventListener(Event.SCROLL, onTextChangeHandler);
_horizontalScrollBar = new HScrollBar();
_horizontalScrollBar.visible = false;
addChild(_horizontalScrollBar);
_verticalScrollBar = new VScrollBar();
_verticalScrollBar.visible = false;
addChild(_verticalScrollBar);
addEventListener(ScrollEvent.SCROLL, onScrollHandler);
addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheelHandler);
}
private function onScrollHandler(_arg1:ScrollEvent):void{
_arg1.stopPropagation();
if (_showHScrollBar){
_textField.scrollH = _horizontalScrollBar.scrollPosition;
};
if (_showVScrollBar){
_textField.scrollV = _verticalScrollBar.scrollPosition;
};
}
public function get horizontalScrollPolicy():String{
return (_horizontalScrollPolicy);
}
protected function calculateAvailableSize():void{
var _local1:Number = height;
_showVScrollBar = (((_verticalScrollPolicy == ScrollPolicy.ON)) || ((((_verticalScrollPolicy == ScrollPolicy.AUTO)) && ((_textField.maxScrollV > 1)))));
var _local2:Number = (width - (_showVScrollBar) ? _verticalScrollBar.width : 0);
_showHScrollBar = (((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_verticalScrollPolicy == ScrollPolicy.AUTO)) && ((_textField.maxScrollH > 1)))));
if (_showHScrollBar){
_local1 = (_local1 - _horizontalScrollBar.height);
_textField.height = _local1;
if (((((!(_showVScrollBar)) && ((_verticalScrollPolicy == ScrollPolicy.AUTO)))) && ((_textField.maxScrollV > 1)))){
_showVScrollBar = true;
_local2 = (_local2 - _verticalScrollBar.width);
};
} else {
_textField.height = _local1;
};
_textField.width = _local2;
}
protected function updateScrollBarsProperties():void{
_horizontalScrollBar.visible = _showHScrollBar;
if (_showHScrollBar){
_horizontalScrollBar.pageSize = _textField.width;
_horizontalScrollBar.minScrollPosition = 0;
_horizontalScrollBar.maxScrollPosition = _textField.maxScrollH;
_horizontalScrollBar.scrollPosition = _textField.scrollH;
};
_verticalScrollBar.visible = _showVScrollBar;
if (_showVScrollBar){
_verticalScrollBar.pageSize = ((_textField.bottomScrollV - _textField.scrollV) + 1);
_verticalScrollBar.minScrollPosition = 1;
_verticalScrollBar.maxScrollPosition = _textField.maxScrollV;
_verticalScrollBar.scrollPosition = _textField.scrollV;
};
}
public function set verticalScrollPolicy(_arg1:String):void{
_verticalScrollPolicy = _arg1;
calculateAvailableSize();
updateScrollBarsProperties();
}
private function onTextChangeHandler(_arg1:Event):void{
calculateAvailableSize();
updateScrollBarsProperties();
}
override protected function validateProperties():void{
super.validateProperties();
calculateAvailableSize();
updateScrollBarsProperties();
}
public function get verticalScrollPolicy():String{
return (_verticalScrollPolicy);
}
override protected function validateSize():void{
super.validateSize();
calculateAvailableSize();
_horizontalScrollBar.x = 0;
_horizontalScrollBar.y = (height - _horizontalScrollBar.height);
_horizontalScrollBar.width = (width - (_showVScrollBar) ? _verticalScrollBar.width : 0);
_verticalScrollBar.x = (width - _verticalScrollBar.width);
_verticalScrollBar.y = 0;
_verticalScrollBar.height = (height - (_showHScrollBar) ? _horizontalScrollBar.height : 0);
drawBackground();
}
}
}//package com.bigwigmedia.ui.controls
Section 444
//TextInput (com.bigwigmedia.ui.controls.TextInput)
package com.bigwigmedia.ui.controls {
import flash.display.*;
import flash.text.*;
public class TextInput extends AbstractTextComponent {
protected var _skin:DisplayObject;
public function TextInput(){
this.editable = true;
this.selectable = true;
}
override protected function validateStyles():void{
super.validateStyles();
if (_skin){
removeChild(_skin);
_skin = null;
};
var _local1:Class = getStyle("skin");
if (_local1){
_skin = new (_local1);
addChildAt(_skin, 0);
};
_textField.background = getStyle("background");
_textField.backgroundColor = getStyle("backgroundColor");
_textField.border = getStyle("border");
_textField.borderColor = getStyle("borderColor");
_textField.embedFonts = getStyle("embedFonts");
var _local2:TextFormat = getStyle("textFormat");
_textField.setTextFormat(_local2);
_textField.defaultTextFormat = _local2;
}
public function get displayAsPassword():Boolean{
return (_textField.displayAsPassword);
}
public function set maxChars(_arg1:int):void{
_textField.maxChars = _arg1;
}
override protected function validateSize():void{
var _local1:Number = getStyle("textPadding");
if (isNaN(_explicitWidth)){
setNotExplicitWidth((_skin) ? _skin.width : (_textField.width + (_local1 * 2)));
_textField.width = (_skin) ? _skin.width : 100;
} else {
if (_skin){
_skin.width = this.width;
};
_textField.width = (this.width - (_local1 * 2));
};
_textField.x = _local1;
if (isNaN(_explicitHeight)){
setNotExplicitHeight((_skin) ? _skin.height : (_textField.height + (_local1 * 2)));
_textField.height = (_skin) ? _skin.height : 24;
} else {
if (_skin){
_skin.height = this.height;
};
_textField.height = (this.height - (_local1 * 2));
};
_textField.y = _local1;
}
public function set restrict(_arg1:String):void{
_textField.restrict = _arg1;
}
public function get maxChars():int{
return (_textField.maxChars);
}
override protected function createChildren():void{
_textField = new TextField();
_textField.wordWrap = false;
_textField.multiline = false;
addChild(_textField);
}
public function get restrict():String{
return (_textField.restrict);
}
public function set displayAsPassword(_arg1:Boolean):void{
_textField.displayAsPassword = _arg1;
}
public static function get defaultStyles():Object{
var _local1:Object = {skin:DefaultSkin, textPadding:2, background:false, backgroundColor:0xFFFFFF, border:false, borderColor:0};
return (_local1);
}
}
}//package com.bigwigmedia.ui.controls
import flash.display.*;
import flash.geom.*;
class DefaultSkin extends Shape {
public static const WIDTH:Number = 100;
public static const HEIGHT:Number = 24;
private function DefaultSkin(){
graphics.beginFill(0x333333, 1);
graphics.drawRect(0, 0, WIDTH, HEIGHT);
graphics.endFill();
var _local1:Matrix = new Matrix();
_local1.createGradientBox((WIDTH - 2), (HEIGHT - 2), (Math.PI / 2), 0, 0);
graphics.beginGradientFill(GradientType.LINEAR, [0xFFFFFF, 0xDDDDDD], [1, 1], [0, 0xFF], _local1);
graphics.drawRect(1, 1, (WIDTH - 2), (HEIGHT - 2));
graphics.endFill();
this.scale9Grid = new Rectangle(1, 1, (WIDTH - 2), (HEIGHT - 2));
}
}
Section 445
//ToolTip (com.bigwigmedia.ui.controls.ToolTip)
package com.bigwigmedia.ui.controls {
import flash.display.*;
import com.bigwigmedia.ui.*;
import flash.text.*;
public class ToolTip extends Component {
protected var _text:String;// = ""
protected var _textField:TextField;
protected var _skin:DisplayObject;
public static const MAX_WIDTH:Number = 300;
public function ToolTip(){
this.mouseEnabled = false;
this.mouseChildren = false;
}
override protected function validateProperties():void{
var _local1:Number = getStyle("textPadding");
_textField.wordWrap = false;
_textField.text = _text;
if (_textField.textWidth > (MAX_WIDTH - (_local1 * 2))){
_textField.width = (MAX_WIDTH - (_local1 * 2));
_textField.wordWrap = true;
};
}
public function get text():String{
return (_text);
}
override protected function validateSize():void{
var _local1:Number = getStyle("textPadding");
_textField.x = (_textField.y = _local1);
width = (_skin.width = (_textField.width + (_local1 * 2)));
height = (_skin.height = (_textField.height + (_local1 * 2)));
}
override protected function validateStyles():void{
_textField.embedFonts = getStyle("embedFonts");
var _local1:TextFormat = getStyle("textFormat");
_textField.setTextFormat(_local1);
_textField.defaultTextFormat = _local1;
super.validateStyles();
}
public function set text(_arg1:String):void{
if (_text != _arg1){
_text = _arg1;
invalidateProperties();
invalidateSize();
};
}
override protected function createChildren():void{
var _local1:Class = getStyle("skin");
_skin = new (_local1);
addChild(_skin);
_textField = new TextField();
_textField.autoSize = TextFieldAutoSize.LEFT;
_textField.selectable = false;
_textField.background = false;
_textField.wordWrap = false;
_textField.width = MAX_WIDTH;
_textField.multiline = true;
addChild(_textField);
}
public static function get defaultStyles():Object{
var _local1:Object = {skin:DefaultSkin, textPadding:4};
return (_local1);
}
}
}//package com.bigwigmedia.ui.controls
import flash.display.*;
import flash.geom.*;
class DefaultSkin extends Shape {
public static const WIDTH:Number = 48;
public static const HEIGHT:Number = 24;
public static const CORNER_RADIUS:Number = 8;
private function DefaultSkin(){
graphics.beginFill(16777184);
graphics.drawRoundRect(0, 0, WIDTH, HEIGHT, CORNER_RADIUS, CORNER_RADIUS);
graphics.endFill();
this.scale9Grid = new Rectangle(CORNER_RADIUS, CORNER_RADIUS, (WIDTH - (CORNER_RADIUS * 2)), (HEIGHT - (CORNER_RADIUS * 2)));
}
}
Section 446
//VScrollBar (com.bigwigmedia.ui.controls.VScrollBar)
package com.bigwigmedia.ui.controls {
import com.bigwigmedia.ui.controls.scrollClasses.*;
public class VScrollBar extends ScrollBar {
public function VScrollBar(){
this.width = 14;
this.height = 100;
}
override protected function get convertedWidth():Number{
return (width);
}
override protected function validateSize():void{
_upArrow.width = (_downArrow.width = width);
_downArrow.y = (height - _downArrow.height);
_track.width = width;
_track.height = height;
minHeight = ((MIN_SIZE + _upArrow.height) + _downArrow.height);
positionThumb();
}
override protected function get convertedHeight():Number{
return (height);
}
override protected function set thumbPosition(_arg1:Number):void{
_thumb.y = _arg1;
}
override protected function get thumbPosition():Number{
return (_thumb.y);
}
}
}//package com.bigwigmedia.ui.controls
Section 447
//ColorBeacon (com.bigwigmedia.ui.decorations.ColorBeacon)
package com.bigwigmedia.ui.decorations {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import fl.motion.*;
public class ColorBeacon implements IBeacon {
private var _dFrameCounter:Number;
private var _color:uint;
private var _multiplier:Number;
private var _frameCounter:Number;// = 0
private var _colorTransform:Color;
private var _target:DisplayObject;
private var _period:int;
public function ColorBeacon(_arg1:uint=0xFFFFFF, _arg2:Number=1, _arg3:int=30){
_colorTransform = new Color();
super();
_color = _arg1;
_multiplier = _arg2;
_period = _arg3;
_colorTransform.tintColor = _arg1;
_dFrameCounter = ((2 * Math.PI) / _arg3);
}
public function set color(_arg1:uint):void{
_color = _arg1;
}
public function remove(_arg1:DisplayObject):void{
dispose();
}
public function get color():uint{
return (_color);
}
public function dispose():void{
_target.removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
_target.transform.colorTransform = new ColorTransform();
_target = null;
}
public function clone():IBeacon{
return (new ColorBeacon(_color, _multiplier, _period));
}
public function apply(_arg1:DisplayObject):void{
_target = _arg1;
_target.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
}
private function onEnterFrameHandler(_arg1:Event):void{
_colorTransform.tintMultiplier = ((_multiplier / 2) * (1 + Math.sin(_frameCounter)));
_target.transform.colorTransform = _colorTransform;
_frameCounter = (_frameCounter + _dFrameCounter);
if (_frameCounter >= (2 * Math.PI)){
_frameCounter = 0;
};
}
}
}//package com.bigwigmedia.ui.decorations
Section 448
//ColorDecoration (com.bigwigmedia.ui.decorations.ColorDecoration)
package com.bigwigmedia.ui.decorations {
import flash.display.*;
import flash.geom.*;
public class ColorDecoration implements IDecoration {
private var _colorTransform:ColorTransform;
public function ColorDecoration(_arg1:ColorTransform=null){
_colorTransform = ((_arg1) || (new ColorTransform()));
}
public function set colorTransform(_arg1:ColorTransform):void{
_colorTransform = _arg1;
}
public function remove(_arg1:DisplayObject):void{
_arg1.transform.colorTransform = new ColorTransform();
}
public function apply(_arg1:DisplayObject):void{
_arg1.transform.colorTransform = _colorTransform;
}
public function get colorTransform():ColorTransform{
return (_colorTransform);
}
}
}//package com.bigwigmedia.ui.decorations
Section 449
//FilterDecoration (com.bigwigmedia.ui.decorations.FilterDecoration)
package com.bigwigmedia.ui.decorations {
import flash.display.*;
import flash.filters.*;
public class FilterDecoration implements IDecoration {
private var _filters:Array;
public function FilterDecoration(_arg1:Array=null){
_filters = [];
super();
this.filters = ((_arg1) || ([]));
}
public function get filters():Array{
return (_filters);
}
public function remove(_arg1:DisplayObject):void{
_arg1.filters = [];
}
public function apply(_arg1:DisplayObject):void{
_arg1.filters = _filters;
}
public function set filters(_arg1:Array):void{
var _local4:BitmapFilter;
var _local2:int = _arg1.length;
var _local3:int;
while (_local3 < _local2) {
_local4 = _arg1[_local3];
_filters.push(_local4.clone());
_local3++;
};
}
}
}//package com.bigwigmedia.ui.decorations
Section 450
//IBeacon (com.bigwigmedia.ui.decorations.IBeacon)
package com.bigwigmedia.ui.decorations {
import com.bigwigmedia.core.*;
public interface IBeacon extends IDecoration, IDisposable {
function clone():IBeacon;
}
}//package com.bigwigmedia.ui.decorations
Section 451
//IDecoration (com.bigwigmedia.ui.decorations.IDecoration)
package com.bigwigmedia.ui.decorations {
import flash.display.*;
public interface IDecoration {
function remove(_arg1:DisplayObject):void;
function apply(_arg1:DisplayObject):void;
}
}//package com.bigwigmedia.ui.decorations
Section 452
//TintDecoration (com.bigwigmedia.ui.decorations.TintDecoration)
package com.bigwigmedia.ui.decorations {
import fl.motion.*;
public class TintDecoration extends ColorDecoration implements IDecoration {
private var _tintColor:uint;
private var _tintMultiplier:Number;
public function TintDecoration(_arg1:uint=0, _arg2:Number=1){
_tintColor = _arg1;
_tintMultiplier = _arg2;
updateColorTransform();
}
public function set tintColor(_arg1:uint):void{
_tintColor = _arg1;
updateColorTransform();
}
private function updateColorTransform():void{
var _local1:Color = new Color();
_local1.setTint(_tintColor, _tintMultiplier);
colorTransform = _local1;
}
public function get tintColor():uint{
return (_tintColor);
}
public function get tintMultiplier():Number{
return (_tintMultiplier);
}
public function set tintMultiplier(_arg1:Number):void{
_tintMultiplier = _arg1;
updateColorTransform();
}
}
}//package com.bigwigmedia.ui.decorations
Section 453
//ComponentCreationError (com.bigwigmedia.ui.errors.ComponentCreationError)
package com.bigwigmedia.ui.errors {
public class ComponentCreationError extends Error {
public function ComponentCreationError(_arg1:String=""){
super(_arg1);
}
public function toString():String{
return (("ComponentCreationError: " + message));
}
}
}//package com.bigwigmedia.ui.errors
Section 454
//ParseUtil (com.bigwigmedia.ui.utils.ParseUtil)
package com.bigwigmedia.ui.utils {
import com.bigwigmedia.font.*;
import flash.utils.*;
import com.bigwigmedia.locale.*;
import flash.text.*;
import com.bigwigmedia.utils.reflection.*;
import com.bigwigmedia.core.*;
public class ParseUtil {
private static var _locale:ILocale;
public static function parseRef(_arg1:String):Object{
if (_arg1 == "null"){
return (null);
};
var _local2:String = _arg1.substr(0, _arg1.indexOf("("));
switch (_local2){
case "Class":
return (parseClassRef(_arg1));
case "Static":
return (parseStaticRef(_arg1));
case "Singleton":
return (parseSingletonRef(_arg1));
default:
return (parseValue(_arg1));
};
}
private static function parseStaticRef(_arg1:String):Object{
var _local2:Object = parsePropsPairs(_arg1.substring((_arg1.indexOf("(") + 1), _arg1.lastIndexOf(")")));
var _local3:Class = Class(getDefinitionByName(_local2.className));
var _local4:QName = new QName(((_local2.ns === undefined)) ? "" : _local2.ns, _local2.name);
return (_local3[_local4]);
}
public static function parseString(_arg1:String):String{
return (((_arg1 == "null")) ? null : _arg1);
}
private static function parseArray(_arg1:String):Array{
var _local3:int;
var _local4:RegExp;
var _local5:int;
var _local6:Object;
var _local7:String;
var _local8:String;
var _local9:RegExp;
var _local10:Object;
var _local11:int;
var _local12:String;
var _local2:Array = [];
if (_arg1 == ""){
return (_local2);
};
while (true) {
_local3 = 0;
_local4 = /^[\w\.]+(?=\()/gi;
if (_local4.exec(_arg1)){
_local6 = getBracedExpression(_arg1, _local4.lastIndex, "(");
_local7 = _local6.string;
_local8 = _arg1.substring(0, _local4.lastIndex);
_local2.push(parseType(_local8, _local7));
_local3 = _local6.lastIndex;
} else {
_local9 = /^\[(?=.)/ig;
if (_local9.exec(_arg1)){
_local10 = getBracedExpression(_arg1, (_local9.lastIndex - 1), "[");
_local2.push(parseArray(_local10.string));
_local3 = _local10.lastIndex;
} else {
_local11 = _arg1.indexOf(",");
_local12 = ((_local11 == -1)) ? _arg1 : _arg1.substring(0, _local11);
_local2.push(_local12);
};
};
_local5 = _arg1.indexOf(",", _local3);
if (_local5 == -1){
break;
};
_arg1 = _arg1.substring((_local5 + 1));
};
return (_local2);
}
private static function parseType(_arg1:String, _arg2:String):Object{
var _local7:String;
var _local8:PropertyInfo;
var _local9:String;
var _local10:String;
var _local3:Class = Class(getDefinitionByName(_arg1));
var _local4:Object = new (_local3);
var _local5:ClassInfo = Reflection.getClassInfo(_local3);
var _local6:Object = parseProps(_arg2);
for (_local7 in _local6) {
_local8 = _local5.getPropertyInfo(_local7, false);
if (!_local8){
throw (new ReferenceError(((("Cannot create property \"" + _local7) + "\" on ") + _local4)));
};
_local9 = _local8.type;
_local10 = _local6[_local7];
switch (_local9){
case "String":
_local4[_local7] = _local10;
break;
case "Number":
case "uint":
case "int":
if (_local10.indexOf("0x") == 0){
_local4[_local7] = parseInt(_local10);
} else {
_local4[_local7] = parseFloat(_local10);
};
break;
case "Boolean":
_local4[_local7] = (_local10 == "true");
break;
default:
_local4[_local7] = _local6[_local7];
break;
};
};
return (_local4);
}
private static function parseClassRef(_arg1:String):Class{
var _local2:String = _arg1.substring((_arg1.indexOf("(") + 1), _arg1.lastIndexOf(")"));
var _local3:Class = Class(getDefinitionByName(_local2));
return (_local3);
}
public static function parseTextFormat(_arg1:String):TextFormat{
var _local6:IFontManager;
var _local2:Object = parsePropsPairs(_arg1);
var _local3:String;
if (((!((_local2.font === undefined))) && ((_local2.font.indexOf("FontID(") == 0)))){
_local6 = IFontManager(Singleton.getInstanceByInterface(IFontManager));
_local3 = _local6.getFontName(_local2.font.substr(7, (_local2.font.length - 8)));
} else {
_local3 = _local2.font;
};
var _local4:String;
switch (_local2.align){
case "center":
_local4 = TextFormatAlign.CENTER;
break;
case "justify":
_local4 = TextFormatAlign.JUSTIFY;
break;
case "left":
_local4 = TextFormatAlign.LEFT;
break;
case "right":
_local4 = TextFormatAlign.RIGHT;
break;
};
var _local5:TextFormat = new TextFormat(_local3, _local2.size, _local2.color, (_local2.bold == "true"), (_local2.italic == "true"), (_local2.underline == "true"), _local2.url, _local2.target, _local4, _local2.leftMargin, _local2.rightMargin, _local2.indent, _local2.leading);
return (_local5);
}
private static function get locale():ILocale{
if (!_locale){
_locale = ILocale(Singleton.getInstanceByInterface(ILocale));
};
return (_locale);
}
private static function parseSingletonRef(_arg1:String):Object{
var _local2:Object = parsePropsPairs(_arg1.substring((_arg1.indexOf("(") + 1), _arg1.lastIndexOf(")")));
var _local3:Object = Singleton.getInstance(_local2.interfaceName);
var _local4:QName = new QName(((_local2.ns === undefined)) ? "" : _local2.ns, _local2.name);
return (_local3[_local4]);
}
private static function parsePropsPairs(_arg1:String):Object{
var _local6:Array;
var _local2:Array = _arg1.split(",");
var _local3:Object = {};
var _local4:int = _local2.length;
var _local5:int;
while (_local5 < _local4) {
_local6 = _local2[_local5].split("=");
_local3[_local6[0]] = _local6[1];
_local5++;
};
return (_local3);
}
private static function parseProps(_arg1:String):Object{
var _local4:String;
var _local5:String;
var _local6:RegExp;
var _local7:Object;
var _local8:String;
var _local9:String;
var _local10:RegExp;
var _local11:Object;
var _local12:int;
var _local13:String;
var _local2:Object = {};
var _local3:RegExp = /^[\w]+(?==)/gi;
while (_local3.exec(_arg1)) {
_local4 = _arg1.substring(0, _local3.lastIndex);
_local5 = _arg1.substring((_local3.lastIndex + 1));
_local6 = /^[\w\.]+(?=\()/gi;
if (_local6.exec(_local5)){
_local7 = getBracedExpression(_local5, _local6.lastIndex, "(");
_local8 = _local7.string;
_local9 = _local5.substring(0, _local6.lastIndex);
_local2[_local4] = parseType(_local9, _local8);
_arg1 = _local5.substring((_local7.lastIndex + 1));
} else {
_local10 = /^\[(?=.)/ig;
if (_local10.exec(_local5)){
_local11 = getBracedExpression(_local5, (_local10.lastIndex - 1), "[");
_local2[_local4] = parseArray(_local11.string);
_arg1 = _local5.substring((_local11.lastIndex + 1));
} else {
_local12 = _local5.indexOf(",");
_local13 = ((_local12 == -1)) ? _local5 : _local5.substring(0, _local12);
_local2[_local4] = _local13;
_arg1 = _local5.substring((_local12 + 1));
};
};
_local3.lastIndex = 0;
};
return (_local2);
}
public static function parseValue(_arg1:String):Object{
var _local3:String;
var _local4:String;
var _local5:RegExp;
var _local6:String;
var _local2:RegExp = /^[\w\.]+(?=\()/gi;
if (_local2.exec(_arg1)){
_local3 = getBracedExpression(_arg1, _local2.lastIndex, "(").string;
_local4 = _arg1.substring(0, _local2.lastIndex);
return (parseType(_local4, _local3));
};
_local5 = /^\[(?=.)/ig;
if (_local5.exec(_arg1)){
_local6 = getBracedExpression(_arg1, _local5.lastIndex, "[").string;
return (parseArray(_local6));
};
return (_arg1);
}
private static function getBracedExpression(_arg1:String, _arg2:int, _arg3:String):Object{
var _local4:String;
var _local8:String;
switch (_arg3){
case "(":
_local4 = ")";
break;
case "[":
_local4 = "]";
break;
default:
throw (ArgumentError("Wrong brace type."));
};
var _local5:int;
var _local6:int = _arg2;
var _local7:int = _arg1.length;
while (_local6 < _local7) {
_local8 = _arg1.charAt(_local6);
if (_local8 == _arg3){
_local5++;
} else {
if (_local8 == _local4){
_local5--;
};
};
if (_local5 <= 0){
break;
};
_local6++;
};
return ({string:_arg1.substring((_arg2 + 1), _local6), lastIndex:_local6});
}
}
}//package com.bigwigmedia.ui.utils
Section 455
//StyleUtil (com.bigwigmedia.ui.utils.StyleUtil)
package com.bigwigmedia.ui.utils {
public class StyleUtil {
private static const _styleTypes:Object = {fillColor:"Color", fillAlpha:"Number", textFormat:"TextFormat", styleSheet:"ObjectRef", embedFonts:"Boolean", decoration:"ObjectRef", disabledDecoration:"ObjectRef", repeatDelay:"Number", repeatDelay:"Number", repeatInterval:"Number", rollOverHandler:"MethodRef", rollOutHandler:"MethodRef", mouseDownHandler:"MethodRef", mouseClickHandler:"MethodRef", beacon:"ObjectRef", upLabelColor:"Color", overLabelColor:"Color", downLabelColor:"Color", selectedLabelColor:"Color", labelPlacement:"String", padding:"Number", iconGap:"Number", upSelectedIcon:"ObjectRef", overSelectedIcon:"ObjectRef", downSelectedIcon:"ObjectRef", bitmapPixelSnapping:"String", bitmapSmoothing:"Boolean", upSkin:"ObjectRef", overSkin:"ObjectRef", downSkin:"ObjectRef", selectedSkin:"ObjectRef", icon:"ObjectRef", upIcon:"ObjectRef", overIcon:"ObjectRef", downIcon:"ObjectRef", selectedIcon:"ObjectRef", upDecoration:"ObjectRef", overDecoration:"ObjectRef", downDecoration:"ObjectRef", selectedDecoration:"ObjectRef", skin:"ObjectRef", textPadding:"Number", background:"Boolean", backgroundColor:"Color", border:"Boolean", borderColor:"Color", track:"ObjectRef", thumb:"ObjectRef", upButton:"ObjectRef", downButton:"ObjectRef", horizontalGap:"Number", verticalGap:"Number", selectedFillColor:"Color", selectedFillAlpha:"Number"};
public static function isValidStyleName(_arg1:String):Boolean{
return (Boolean(_styleTypes[_arg1]));
}
public static function parseStyle(_arg1:String, _arg2:String):Object{
var _local3:String = _styleTypes[_arg1];
switch (_local3){
case "String":
return (ParseUtil.parseString(_arg2));
case "Number":
return (parseFloat(_arg2));
case "Boolean":
return ((_arg2 == "true"));
case "Color":
return (parseInt(_arg2));
case "TextFormat":
return (ParseUtil.parseTextFormat(_arg2));
case "MethodRef":
case "ObjectRef":
return (ParseUtil.parseRef(_arg2));
};
throw (new ArgumentError((("Style \"" + _arg1) + "\" is not supported.")));
}
}
}//package com.bigwigmedia.ui.utils
Section 456
//Component (com.bigwigmedia.ui.Component)
package com.bigwigmedia.ui {
import flash.display.*;
import com.bigwigmedia.events.*;
import flash.geom.*;
import com.bigwigmedia.ui.decorations.*;
import flash.text.*;
import com.bigwigmedia.core.*;
import com.bigwigmedia.utils.*;
public class Component extends Sprite implements IDisposable {
protected var _enabled:Boolean;// = true
private var invalidateStylesFlag:Boolean;// = false
protected var _explicitWidth:Number;// = NAN
protected var _minWidth:Number;// = 0
private var _right:Number;// = NAN
protected var _maxWidth:Number;// = 10000
private var _inheritingStyles:Object;
protected var _visible:Boolean;// = true
protected var _maxHeight:Number;// = 10000
protected var _height:Number;// = 0
private var _bottom:Number;// = NAN
protected var _decoration:IDecoration;// = null
private var invalidatePropertiesFlag:Boolean;// = false
protected var _styleName:String;// = null
private var _percentWidth:Number;// = NAN
private var _inSizeLayout:Boolean;// = false
private var _center:Number;// = NAN
private var invalidateSizeFlag:Boolean;// = false
private var _nestLevel:int;// = 0
private var _top:Number;// = NAN
private var _inPositionLayout:Boolean;// = false
protected var _minHeight:Number;// = 0
protected var _explicitHeight:Number;// = NAN
private var _toolTip:String;// = null
private var _middle:Number;// = NAN
private var _namedStyles:Object;
protected var _width:Number;// = 0
private var _id:String;
private var _percentHeight:Number;// = NAN
protected var _rotation:Number;// = 0
private var invalidateChildrenFlag:Boolean;// = false
private var _instanceStyles:Object;
private var _left:Number;// = NAN
private static var idCount:int = 0;
private static var _renderManager:RenderManager;
private static var _styleManager:IStyleManager;
public function Component(){
_namedStyles = {};
_instanceStyles = {};
_inheritingStyles = {};
super();
_id = ((ClassUtil.getClassName(this) + "_") + idCount++);
name = _id;
super.visible = false;
tabEnabled = false;
styleManager.registerComponent(this);
createChildren();
invalidateAll();
}
public function get left():Number{
return (_left);
}
public function get nestLevel():int{
return (_nestLevel);
}
public function set left(_arg1:Number):void{
if (_left != _arg1){
_left = _arg1;
validateLayoutType();
};
}
public function set percentWidth(_arg1:Number):void{
if (_arg1 < 0){
_arg1 = 0;
};
if (_percentWidth != _arg1){
_percentWidth = _arg1;
validateLayoutType();
};
}
public function validate():void{
if (invalidateStylesFlag){
validateStyles();
};
if (invalidatePropertiesFlag){
validateProperties();
};
if (invalidateSizeFlag){
validateSize();
};
if (invalidateChildrenFlag){
validateChildren();
};
invalidateStylesFlag = false;
invalidatePropertiesFlag = false;
invalidateSizeFlag = false;
invalidateChildrenFlag = false;
if (((_visible) && (!(super.visible)))){
visible = true;
};
}
public function set nestLevel(_arg1:int):void{
if (_nestLevel == _arg1){
return;
};
_nestLevel = _arg1;
renderManager.remove(this);
renderManager.add(this);
var _local2:DisplayObjectContainer = this.parent;
while ((_local2 is Component)) {
renderManager.remove(Component(_local2));
renderManager.add(Component(_local2));
_local2 = _local2.parent;
};
}
public function get minHeight():Number{
return (_minHeight);
}
protected function createChildren():void{
}
public function get right():Number{
return (_right);
}
public function dispose():void{
renderManager.remove(this);
styleManager.unregisterComponent(this);
toolTip = null;
if (_decoration){
_decoration.remove(this);
_decoration = null;
};
_namedStyles = {};
_instanceStyles = {};
_inheritingStyles = {};
}
public function get id():String{
return (_id);
}
override public function get height():Number{
return ((isNaN(_explicitHeight)) ? _height : _explicitHeight);
}
public function set middle(_arg1:Number):void{
if (_middle != _arg1){
_middle = _arg1;
validateLayoutType();
};
}
public function get bottom():Number{
return (_bottom);
}
public function setInheritingStyle(_arg1:String, _arg2:Object):void{
if (_inheritingStyles[_arg1] === _arg2){
return;
};
_inheritingStyles[_arg1] = _arg2;
invalidateAll();
}
public function set minHeight(_arg1:Number):void{
if (_minHeight == _arg1){
return;
};
_minHeight = _arg1;
if (this.height < _minHeight){
this.height = _minHeight;
};
}
protected function validateChildren():void{
}
protected function validateSize():void{
}
public function set right(_arg1:Number):void{
if (_right != _arg1){
_right = _arg1;
validateLayoutType();
};
}
public function get inPositionLayout():Boolean{
return (_inPositionLayout);
}
public function set minWidth(_arg1:Number):void{
if (_minWidth == _arg1){
return;
};
_minWidth = _arg1;
if (this.width < _minWidth){
this.width = _minWidth;
};
}
public function get enabled():Boolean{
return (_enabled);
}
private function validateLayoutType():void{
if (((((((((((isNaN(_left)) && (isNaN(_right)))) && (isNaN(_top)))) && (isNaN(_bottom)))) && (isNaN(_center)))) && (isNaN(_middle)))){
_inPositionLayout = false;
} else {
_inPositionLayout = true;
if (((((!(isNaN(_left))) && (!(isNaN(_right))))) || (((!(isNaN(_top))) && (!(isNaN(_bottom))))))){
_inSizeLayout = true;
return;
};
};
if (((isNaN(_percentWidth)) && (isNaN(_percentWidth)))){
_inSizeLayout = false;
} else {
_inSizeLayout = true;
};
}
override public function set height(_arg1:Number):void{
var _local2:Number = Math.round(_arg1);
if (_local2 < _minHeight){
_local2 = _minHeight;
} else {
if (_local2 > _maxHeight){
_local2 = _maxHeight;
};
};
if (this.height != _local2){
_height = (_explicitHeight = _local2);
invalidateSize();
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE));
};
}
public function set maxHeight(_arg1:Number):void{
if (_maxHeight == _arg1){
return;
};
_maxHeight = _arg1;
if (this.height > _maxHeight){
this.height = _maxHeight;
};
}
public function get top():Number{
return (_top);
}
public function setNotExplicitWidth(_arg1:Number):void{
var _local2:Number = Math.round(_arg1);
if (_local2 < _minWidth){
_local2 = _minWidth;
} else {
if (_local2 > _maxWidth){
_local2 = _maxWidth;
};
};
if (this.width != _local2){
_width = _local2;
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE));
};
}
public function get center():Number{
return (_center);
}
public function set bottom(_arg1:Number):void{
if (_bottom != _arg1){
_bottom = _arg1;
validateLayoutType();
};
}
protected function invalidateAll():void{
invalidateStylesFlag = true;
invalidatePropertiesFlag = true;
invalidateSizeFlag = true;
invalidateChildrenFlag = true;
renderManager.add(this);
}
protected function invalidateChildren():void{
invalidateChildrenFlag = true;
renderManager.add(this);
}
override public function toString():String{
return (name);
}
override public function get visible():Boolean{
return (_visible);
}
override public function get rotation():Number{
return (_rotation);
}
public function get percentWidth():Number{
return (_percentWidth);
}
public function set enabled(_arg1:Boolean):void{
if (_enabled != _arg1){
_enabled = _arg1;
mouseEnabled = _arg1;
invalidateAll();
};
}
public function set maxWidth(_arg1:Number):void{
if (_maxWidth == _arg1){
return;
};
_maxWidth = _arg1;
if (this.width > _maxWidth){
this.width = _maxWidth;
};
}
public function get explicitHeight():Number{
return (_explicitHeight);
}
public function get inSizeLayout():Boolean{
return (_inSizeLayout);
}
protected function drawBackground():void{
graphics.clear();
graphics.lineStyle();
graphics.beginFill(getStyle("fillColor"), getStyle("fillAlpha"));
graphics.drawRect(0, 0, (isNaN(width)) ? 0 : width, (isNaN(height)) ? 0 : height);
graphics.endFill();
}
override public function set width(_arg1:Number):void{
var _local2:Number = Math.round(_arg1);
if (_local2 < _minWidth){
_local2 = _minWidth;
} else {
if (_local2 > _maxWidth){
_local2 = _maxWidth;
};
};
if (this.width != _local2){
_width = (_explicitWidth = _local2);
invalidateSize();
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE));
};
}
public function get middle():Number{
return (_middle);
}
protected function validateStyles():void{
var _local1:IDecoration = getStyle((_enabled) ? "decoration" : "disabledDecoration");
if (_decoration != _local1){
if (_decoration){
_decoration.remove(this);
};
if (_local1){
_local1.apply(this);
};
_decoration = _local1;
};
}
public function get minWidth():Number{
return (_minWidth);
}
override public function set scaleX(_arg1:Number):void{
if (super.scaleX != _arg1){
super.scaleX = _arg1;
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE));
};
}
public function set percentHeight(_arg1:Number):void{
if (_arg1 < 0){
_arg1 = 0;
};
if (_percentHeight != _arg1){
_percentHeight = _arg1;
validateLayoutType();
};
}
override public function set scaleY(_arg1:Number):void{
if (super.scaleY != _arg1){
super.scaleY = _arg1;
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE));
};
}
public function getComponentByName(_arg1:String):Component{
return (((_arg1 == this.name)) ? this : null);
}
public function set top(_arg1:Number):void{
if (_top != _arg1){
_top = _arg1;
validateLayoutType();
};
}
public function get maxHeight():Number{
return (_maxHeight);
}
public function set center(_arg1:Number):void{
if (_center != _arg1){
_center = _arg1;
validateLayoutType();
};
}
public function getAABB():Rectangle{
var _local1:Rectangle = new Rectangle(this.x, this.y, (this.width * scaleX), (this.height * scaleY));
if (_rotation == 0){
return (_local1);
};
return (GeomUtil.getAABB(_local1, new Point(), ((_rotation / 180) * Math.PI)));
}
public function set styleName(_arg1:String):void{
if (_styleName != _arg1){
_styleName = _arg1;
dispatchEvent(new ComponentEvent(ComponentEvent.STYLE_NAME_CHANGE));
};
}
public function get maxWidth():Number{
return (_maxWidth);
}
override public function get width():Number{
return ((isNaN(_explicitWidth)) ? _width : _explicitWidth);
}
protected function invalidateProperties():void{
invalidatePropertiesFlag = true;
renderManager.add(this);
}
public function set toolTip(_arg1:String):void{
if (_toolTip != _arg1){
_toolTip = _arg1;
if (_toolTip){
IToolTipManager(Singleton.getInstanceByInterface(IToolTipManager)).registerComponent(this);
} else {
IToolTipManager(Singleton.getInstanceByInterface(IToolTipManager)).unregisterComponent(this);
};
};
}
public function setInstanceStyle(_arg1:String, _arg2:Object):void{
if (_instanceStyles[_arg1] === _arg2){
return;
};
_instanceStyles[_arg1] = _arg2;
invalidateAll();
}
public function get percentHeight():Number{
return (_percentHeight);
}
protected function invalidateSize():void{
invalidateSizeFlag = true;
renderManager.add(this);
}
public function get styleName():String{
return (_styleName);
}
override public function set visible(_arg1:Boolean):void{
_visible = _arg1;
super.visible = _arg1;
}
protected function validateProperties():void{
}
public function get toolTip():String{
return (_toolTip);
}
public function setNotExplicitHeight(_arg1:Number):void{
var _local2:Number = Math.round(_arg1);
if (_local2 < _minHeight){
_local2 = _minHeight;
} else {
if (_local2 > _maxHeight){
_local2 = _maxHeight;
};
};
if (this.height != _local2){
_height = _local2;
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE));
};
}
override public function set x(_arg1:Number):void{
var _local2:Number = Math.round(_arg1);
if (super.x != _local2){
super.x = _local2;
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
};
}
override public function set y(_arg1:Number):void{
var _local2:Number = Math.round(_arg1);
if (super.y != _local2){
super.y = _local2;
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
};
}
public function get explicitWidth():Number{
return (_explicitWidth);
}
public function setNamedStyle(_arg1:String, _arg2:Object):void{
if (_namedStyles[_arg1] === _arg2){
return;
};
_namedStyles[_arg1] = _arg2;
invalidateAll();
}
public function getStyle(_arg1:String){
if (_instanceStyles[_arg1] !== undefined){
return (_instanceStyles[_arg1]);
};
if (((_styleName) && (!((_namedStyles[_arg1] === undefined))))){
return (_namedStyles[_arg1]);
};
return (_inheritingStyles[_arg1]);
}
override public function set rotation(_arg1:Number):void{
var _local2:Number = Math.round(_arg1);
if (_rotation != _local2){
var _local3 = _local2;
super.rotation = _local3;
_rotation = _local3;
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE));
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
};
}
protected function invalidateStyles():void{
invalidateStylesFlag = true;
renderManager.add(this);
}
public static function get defaultStyles():Object{
var _local1:Object = {fillColor:0xFFFFFF, fillAlpha:0, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), styleSheet:null, embedFonts:false, decoration:null, disabledDecoration:null};
return (_local1);
}
protected static function get renderManager():RenderManager{
if (!_renderManager){
Singleton.registerClassByInterface(RenderManager, RenderManager);
_renderManager = RenderManager(Singleton.getInstanceByInterface(RenderManager));
};
return (_renderManager);
}
protected static function get styleManager():IStyleManager{
if (!_styleManager){
_styleManager = IStyleManager(Singleton.getInstanceByInterface(IStyleManager));
};
return (_styleManager);
}
}
}//package com.bigwigmedia.ui
Section 457
//ComponentFactory (com.bigwigmedia.ui.ComponentFactory)
package com.bigwigmedia.ui {
import flash.utils.*;
import com.bigwigmedia.utils.reflection.*;
import com.bigwigmedia.ui.utils.*;
import com.bigwigmedia.ui.errors.*;
public class ComponentFactory {
public static function create(_arg1:XML):Component{
var prop:XML;
var compClass:Class;
var propName:String;
var propValue:String;
var propInfo:PropertyInfo;
var propType:String;
var xml = _arg1;
try {
compClass = Class(getDefinitionByName(xml.name()));
} catch(e:ReferenceError) {
throw (new ComponentCreationError((("Component \"" + xml.name()) + "\" can't be created.")));
};
var component:Component = new (compClass);
var compClassInfo:ClassInfo = Reflection.getClassInfo(compClass);
var isContainer = (component is Container);
var props:XMLList = (xml.attributes() + xml.children());
for each (prop in props) {
propName = prop.name();
propValue = prop.toString();
propInfo = compClassInfo.getPropertyInfo(propName, false);
if (propInfo){
propType = propInfo.type;
switch (propType){
case "String":
case "*":
component[propName] = propValue;
break;
case "Number":
case "uint":
case "int":
if (propValue.indexOf("0x") == 0){
component[propName] = parseInt(propValue);
} else {
component[propName] = parseFloat(propValue);
};
break;
case "Boolean":
component[propName] = (propValue == "true");
break;
case "Object":
if (propValue.indexOf("(") != -1){
component[propName] = ParseUtil.parseRef(propValue);
} else {
component[propName] = propValue;
};
break;
};
} else {
if (StyleUtil.isValidStyleName(propName)){
component.setInstanceStyle(propName, StyleUtil.parseStyle(propName, propValue));
} else {
if (isContainer){
try {
component.addChild(create(prop));
} catch(e:ComponentCreationError) {
};
};
};
};
};
return (component);
}
}
}//package com.bigwigmedia.ui
Section 458
//Console (com.bigwigmedia.ui.Console)
package com.bigwigmedia.ui {
import flash.display.*;
import com.bigwigmedia.events.*;
import flash.events.*;
import com.bigwigmedia.core.*;
import com.bigwigmedia.input.*;
public class Console {
private static var _view:ConsoleView;
private static var _active:Boolean = false;
private static var keyInputMan:KeyInputManager;
private static var toggleKeyCode:uint;
private static var _stage:Stage;
private static function onKeyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == toggleKeyCode){
toggle();
};
}
private static function onKeySequenceHandler(_arg1:KeyInputEvent):void{
if (_arg1.keyAction == "toggle_console"){
toggle();
};
}
private static function toggle():void{
_active = !(_active);
if (_active){
_stage.addChild(_view);
_stage.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
} else {
_stage.removeChild(_view);
_stage.removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
};
}
private static function onEnterFrameHandler(_arg1:Event):void{
_view.update();
}
public static function initialize(_arg1:Array=null):void{
if (_view){
return;
};
_view = new ConsoleView();
_stage = Globals.stage;
if (!_arg1){
toggleKeyCode = 67;
_stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDownHandler);
} else {
keyInputMan = new KeyInputManager(_stage);
keyInputMan.mapSequence("toggle_console", _arg1);
keyInputMan.addEventListener(KeyInputEvent.SEQUENCE, onKeySequenceHandler);
};
}
}
}//package com.bigwigmedia.ui
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.text.*;
import flash.system.*;
import com.bigwigmedia.core.*;
import com.bigwigmedia.application.*;
class ConsoleView extends Sprite {
private var maxMemory:int;
private var infoField:TextField;
private var viewMode:int;// = 0
private var tfDelay:int;// = 0
private var minMemory:int;
private var firstDraw:Boolean;// = true
private var tfTimer:int;
public static const PROFILER:int = 0;
public static const UPDATE_DELAY:int = 10;
public static const INFO:int = 1;
private function ConsoleView(){
infoField = new TextField();
infoField.defaultTextFormat = new TextFormat("_sans", 10);
infoField.selectable = false;
infoField.x = 1;
infoField.y = 0;
infoField.multiline = true;
addChild(infoField);
this.mouseChildren = false;
addEventListener(MouseEvent.CLICK, onMouseClickHandler);
minMemory = (maxMemory = System.totalMemory);
tfTimer = getTimer();
draw();
}
private function draw():void{
var _local1:ApplicationInfo;
graphics.clear();
graphics.lineStyle(0, 0, 1, true);
graphics.beginFill(0x666666, 1);
switch (viewMode){
case ConsoleView.PROFILER:
infoField.autoSize = TextFieldAutoSize.LEFT;
infoField.htmlText = "";
graphics.drawRect(0, 0, 80, 56);
break;
case ConsoleView.INFO:
infoField.autoSize = TextFieldAutoSize.LEFT;
_local1 = Globals.application.info;
infoField.htmlText = (((((((((((((("<font color='#FFFFFF'>" + "APP: ") + _local1.name) + "\nID: ") + _local1.id) + "\nVER: ") + _local1.version) + "\nFP: ") + Capabilities.version) + " ") + Capabilities.playerType) + (Capabilities.isDebugger) ? " DEBUG" : " RELEASE") + "\nSANDBOX: ") + Security.sandboxType) + "</font>");
graphics.drawRect(0, 0, (infoField.width + 4), 68);
break;
};
graphics.endFill();
}
public function update():void{
var _local1:int;
var _local2:Number;
if (++tfDelay >= UPDATE_DELAY){
tfDelay = 0;
_local1 = System.totalMemory;
if (_local1 > maxMemory){
maxMemory = _local1;
};
if (_local1 < minMemory){
minMemory = _local1;
};
_local2 = ((1000 * UPDATE_DELAY) / (getTimer() - tfTimer));
tfTimer = getTimer();
switch (viewMode){
case ConsoleView.PROFILER:
infoField.htmlText = ((((((((((("<font color='#FFFFFF'>FPS: " + _local2.toFixed(2)) + "</font>\n") + "<font color='#9FCFFF'>MEM: ") + bytesToString(_local1)) + "</font>\n") + "<font color='#FFCC00'>MAX: ") + bytesToString(maxMemory)) + "</font>\n") + "<font color='#00FF00'>MIN: ") + bytesToString(minMemory)) + "</font>");
break;
};
};
}
private function onMouseClickHandler(_arg1:MouseEvent):void{
viewMode++;
if (viewMode > ConsoleView.INFO){
viewMode = ConsoleView.PROFILER;
};
draw();
}
private function bytesToString(_arg1:uint):String{
var _local2:String;
if (_arg1 < 0x0400){
_local2 = (String(_arg1) + "b");
} else {
if (_arg1 < 0x2800){
_local2 = (Number((_arg1 / 0x0400)).toFixed(2) + "kb");
} else {
if (_arg1 < 102400){
_local2 = (Number((_arg1 / 0x0400)).toFixed(1) + "kb");
} else {
if (_arg1 < 0x100000){
_local2 = ((_arg1 >> 10) + "kb");
} else {
if (_arg1 < 0xA00000){
_local2 = (Number((_arg1 / 0x100000)).toFixed(2) + "mb");
} else {
if (_arg1 < 104857600){
_local2 = (Number((_arg1 / 0x100000)).toFixed(1) + "mb");
} else {
_local2 = ((_arg1 >> 20) + "mb");
};
};
};
};
};
};
return (_local2);
}
}
Section 459
//Container (com.bigwigmedia.ui.Container)
package com.bigwigmedia.ui {
import flash.display.*;
public class Container extends Component {
private var _idToComponentHash:Object;
public function Container(){
_idToComponentHash = {};
super();
}
override public function set enabled(_arg1:Boolean):void{
var _local2:Component;
for each (_local2 in _idToComponentHash) {
_local2.enabled = _arg1;
};
super.enabled = _arg1;
}
protected function componentRemoved(_arg1:Component):void{
}
override public function dispose():void{
var _local1:Component;
for each (_local1 in _idToComponentHash) {
_local1.dispose();
};
_idToComponentHash = {};
super.dispose();
}
override public function getComponentByName(_arg1:String):Component{
var _local2:Component;
var _local3:Component;
if (_arg1 == this.name){
return (this);
};
for each (_local2 in _idToComponentHash) {
_local3 = _local2.getComponentByName(_arg1);
if (_local3){
return (_local3);
};
};
return (null);
}
protected function componentAdded(_arg1:Component):void{
}
override public function removeChildAt(_arg1:int):DisplayObject{
var _local2:Component = (getChildAt(_arg1) as Component);
if (((_local2) && (_idToComponentHash[_local2.id]))){
delete _idToComponentHash[_local2.id];
componentRemoved(_local2);
};
return (super.removeChildAt(_arg1));
}
override public function addChildAt(_arg1:DisplayObject, _arg2:int):DisplayObject{
var _local3:Component = (_arg1 as Component);
if (((_local3) && (!(_idToComponentHash[_local3.id])))){
_idToComponentHash[_local3.id] = _local3;
if (_local3.nestLevel <= this.nestLevel){
_local3.nestLevel = (this.nestLevel + 1);
};
componentAdded(_local3);
};
return (super.addChildAt(_arg1, _arg2));
}
override public function set nestLevel(_arg1:int):void{
var _local2:Component;
super.nestLevel = _arg1;
for each (_local2 in _idToComponentHash) {
if (_local2.nestLevel <= this.nestLevel){
_local2.nestLevel = (this.nestLevel + 1);
};
};
}
override public function addChild(_arg1:DisplayObject):DisplayObject{
return (addChildAt(_arg1, numChildren));
}
override public function removeChild(_arg1:DisplayObject):DisplayObject{
var _local2:int = this.getChildIndex(_arg1);
return (removeChildAt(_local2));
}
public static function get defaultStyles():Object{
var _local1:Object = {decoration:null, disabledDecoration:null};
return (_local1);
}
}
}//package com.bigwigmedia.ui
Section 460
//ContextMenuFactory (com.bigwigmedia.ui.ContextMenuFactory)
package com.bigwigmedia.ui {
import flash.events.*;
import flash.ui.*;
public class ContextMenuFactory {
protected var _menu:ContextMenu;
public function ContextMenuFactory(){
_menu = new ContextMenu();
super();
}
public function addItem(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=true, _arg4:Boolean=true):void{
var _local5:ContextMenuItem = new ContextMenuItem(_arg1, _arg2, _arg3, _arg4);
_local5.addEventListener(ContextMenuEvent.MENU_ITEM_SELECT, onItemSelectHandler);
_menu.customItems.push(_local5);
}
protected function getItemAt(_arg1:int):ContextMenuItem{
return (_menu.customItems[_arg1]);
}
private function onItemSelectHandler(_arg1:ContextMenuEvent):void{
var _local2:int = _menu.customItems.indexOf(_arg1.target);
onItemSelect(_local2);
}
protected function onItemSelect(_arg1:int):void{
}
public function get menu():ContextMenu{
return (_menu);
}
}
}//package com.bigwigmedia.ui
Section 461
//ContextMenuFactory_2DPlay (com.bigwigmedia.ui.ContextMenuFactory_2DPlay)
package com.bigwigmedia.ui {
import com.bigwigmedia.core.*;
import com.bigwigmedia.net.*;
public class ContextMenuFactory_2DPlay extends ContextMenuFactory {
public function ContextMenuFactory_2DPlay(){
Singleton.registerClass("com.bigwigmedia.net::IURLCaller", URLCaller_2DPlay);
_menu.hideBuiltInItems();
this.addItem("High scores");
this.addItem("Play more games");
this.addItem("Get game for your site");
this.addItem("Download this game");
}
override protected function onItemSelect(_arg1:int):void{
var _local2:IURLCaller = IURLCaller(Singleton.getInstanceByInterface(IURLCaller));
switch (_arg1){
case 0:
_local2.viewScores();
break;
case 1:
_local2.playMoreGames();
break;
case 2:
_local2.getGame();
break;
case 3:
_local2.downloadGame();
break;
};
}
}
}//package com.bigwigmedia.ui
Section 462
//CursorManager (com.bigwigmedia.ui.CursorManager)
package com.bigwigmedia.ui {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import com.bigwigmedia.core.*;
import flash.ui.*;
public class CursorManager implements ICursorManager {
private var cursorLeftStage:Boolean;
private var nextCursorID:int;// = 1
private var _currentCursorID:int;// = 0
private var cursorQueue:Array;
private var cursorHolder:Sprite;
private var _currentCursor:DisplayObject;
private var stage:Stage;
public function CursorManager(){
cursorQueue = [];
super();
Singleton.checkInstance(this);
stage = Globals.stage;
cursorHolder = Globals.application.cursorHolder;
}
public function get currentCursor():DisplayObject{
return (_currentCursor);
}
public function removeCursor(_arg1:int):void{
var _local2:int = cursorQueue.length;
var _local3:int;
while (_local3 < _local2) {
if (cursorQueue[_local3].id == _arg1){
cursorQueue.splice(_local3, 1);
showCurrentCursor();
break;
};
_local3++;
};
}
public function get currentCursorID():int{
return (_currentCursorID);
}
private function removeCustomEventHandlers():void{
stage.removeEventListener(MouseEvent.MOUSE_MOVE, onMouseMoveHandler, true);
stage.removeEventListener(MouseEvent.MOUSE_OUT, onMouseOutHandler, true);
var _local1:ContextMenu = InteractiveObject(Globals.application).contextMenu;
if (_local1){
_local1.removeEventListener(ContextMenuEvent.MENU_SELECT, onContextMenuSelectHandler);
};
}
private function addCustomEventHandlers():void{
stage.addEventListener(MouseEvent.MOUSE_MOVE, onMouseMoveHandler, true);
stage.addEventListener(MouseEvent.MOUSE_OUT, onMouseOutHandler, true);
var _local1:ContextMenu = InteractiveObject(Globals.application).contextMenu;
if (_local1){
_local1.addEventListener(ContextMenuEvent.MENU_SELECT, onContextMenuSelectHandler);
};
}
private function onMouseMoveHandler(_arg1:MouseEvent):void{
_currentCursor.x = stage.mouseX;
_currentCursor.y = stage.mouseY;
var _local2:Object = _arg1.target;
if ((((_local2 is TextField)) && ((_local2.type == TextFieldType.INPUT)))){
cursorVisible = false;
Mouse.show();
} else {
cursorVisible = true;
};
if (cursorLeftStage){
cursorLeftStage = false;
cursorVisible = true;
};
if (cursorQueue.length > 0){
Mouse.hide();
};
}
public function setCursor(_arg1:Class, _arg2:int=2):int{
var _local3:int = nextCursorID++;
cursorQueue.push(new CursorInfo(_arg1, _local3, _arg2));
cursorQueue.sortOn("priority", (Array.NUMERIC | Array.DESCENDING));
showCurrentCursor();
return (_local3);
}
private function onMouseOutHandler(_arg1:MouseEvent):void{
if ((((_arg1.relatedObject == null)) && ((cursorQueue.length > 0)))){
stage.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
};
}
private function onContextMenuSelectHandler(_arg1:ContextMenuEvent):void{
stage.addEventListener(MouseEvent.MOUSE_OVER, contextMenuMouseOverHandler, true);
}
public function removeAllCursors():void{
cursorQueue = [];
showCurrentCursor();
}
private function showCurrentCursor():void{
var _local1:CursorInfo;
if (cursorQueue.length > 0){
_local1 = cursorQueue[0];
if (_local1.id != _currentCursorID){
if (_currentCursor){
cursorHolder.removeChild(_currentCursor);
};
_currentCursor = new _local1.cursorClass();
if (_currentCursor){
if ((_currentCursor is InteractiveObject)){
InteractiveObject(_currentCursor).mouseEnabled = false;
};
_currentCursor.x = stage.mouseX;
_currentCursor.y = stage.mouseY;
cursorHolder.addChild(_currentCursor);
_currentCursorID = _local1.id;
addCustomEventHandlers();
};
};
Mouse.hide();
} else {
if (_currentCursorID != 0){
_currentCursorID = 0;
cursorHolder.removeChild(_currentCursor);
_currentCursor = null;
removeCustomEventHandlers();
};
Mouse.show();
};
}
public function set cursorVisible(_arg1:Boolean):void{
if (_currentCursor){
_currentCursor.visible = _arg1;
};
}
private function onEnterFrameHandler(_arg1:Event):void{
stage.removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
cursorLeftStage = true;
cursorVisible = false;
Mouse.show();
}
private function contextMenuMouseOverHandler(_arg1:MouseEvent):void{
stage.removeEventListener(MouseEvent.MOUSE_OVER, contextMenuMouseOverHandler, true);
onMouseMoveHandler(_arg1);
}
}
}//package com.bigwigmedia.ui
class CursorInfo {
public var cursorClass:Class;
public var priority:int;
public var id:int;
private function CursorInfo(_arg1:Class, _arg2:int, _arg3:int){
this.cursorClass = _arg1;
this.id = _arg2;
this.priority = _arg3;
}
}
Section 463
//ICursorManager (com.bigwigmedia.ui.ICursorManager)
package com.bigwigmedia.ui {
import flash.display.*;
public interface ICursorManager {
function removeAllCursors():void;
function removeCursor(_arg1:int):void;
function get currentCursor():DisplayObject;
function setCursor(_arg1:Class, _arg2:int=2):int;
function get currentCursorID():int;
function set cursorVisible(_arg1:Boolean):void;
}
}//package com.bigwigmedia.ui
Section 464
//IStyleManager (com.bigwigmedia.ui.IStyleManager)
package com.bigwigmedia.ui {
public interface IStyleManager {
function parseCSS(_arg1:String):void;
function unregisterComponent(_arg1:Component):void;
function registerComponent(_arg1:Component):void;
}
}//package com.bigwigmedia.ui
Section 465
//IToolTipManager (com.bigwigmedia.ui.IToolTipManager)
package com.bigwigmedia.ui {
public interface IToolTipManager {
function unregisterComponent(_arg1:Component):void;
function registerComponent(_arg1:Component):void;
function set showDelay(_arg1:Number):void;
function get showDelay():Number;
}
}//package com.bigwigmedia.ui
Section 466
//RenderManager (com.bigwigmedia.ui.RenderManager)
package com.bigwigmedia.ui {
import flash.display.*;
import com.bigwigmedia.events.*;
import flash.events.*;
import flash.utils.*;
import com.bigwigmedia.core.*;
public class RenderManager {
private var _invalidComponentsQueue:Array;
private var _invalidComponentsDict:Dictionary;
private var _waitingForRender:Boolean;// = false
private var _enterFrameBeacon:Shape;
private var _stage:Stage;
public function RenderManager(){
_invalidComponentsDict = new Dictionary();
_invalidComponentsQueue = [];
_enterFrameBeacon = new Shape();
super();
Singleton.checkInstance(this);
_stage = Globals.stage;
}
public function add(_arg1:Component):void{
var _local2:int;
if (!_invalidComponentsDict[_arg1]){
_local2 = indexOfLastEqualNestLevel(_arg1);
if (_local2 > -1){
_local2++;
} else {
_local2 = (-(_local2) - 1);
};
_invalidComponentsQueue.splice(_local2, 0, _arg1);
_invalidComponentsDict[_arg1] = true;
};
if (!_waitingForRender){
_waitingForRender = true;
_stage.addEventListener(Event.RENDER, onStageRenderHandler, false, EventPriority.HIGH);
_stage.invalidate();
_enterFrameBeacon.addEventListener(Event.ENTER_FRAME, onEnterFrameHandler, false, EventPriority.HIGH);
};
}
public function remove(_arg1:Component):void{
var _local2:int;
if (_invalidComponentsDict[_arg1]){
delete _invalidComponentsDict[_arg1];
_local2 = _invalidComponentsQueue.indexOf(_arg1);
_invalidComponentsQueue.splice(_local2, 1);
};
}
private function onStageRenderHandler(_arg1:Event):void{
validate();
}
private function validate():void{
var _local1:Component;
if (!_waitingForRender){
return;
};
_stage.removeEventListener(Event.RENDER, onStageRenderHandler);
_enterFrameBeacon.removeEventListener(Event.ENTER_FRAME, onEnterFrameHandler);
while (_invalidComponentsQueue.length > 0) {
_local1 = _invalidComponentsQueue.pop();
delete _invalidComponentsDict[_local1];
_local1.validate();
};
_waitingForRender = false;
}
private function indexOfLastEqualNestLevel(_arg1:Component):int{
var _local4:uint;
var _local6:int;
var _local2:uint;
var _local3:int = (_invalidComponentsQueue.length - 1);
var _local5:Boolean;
while (_local2 <= _local3) {
_local4 = ((_local3 + _local2) / 2);
_local6 = _invalidComponentsQueue[_local4].nestLevel;
if (_arg1.nestLevel < _local6){
if (_local4 == _local2){
if (_local5){
return ((_local4 - 1));
};
return ((-1 - _local4));
};
_local3 = (_local4 - 1);
} else {
if (_arg1.nestLevel > _local6){
if (_local4 == _local3){
return ((-1 - (_local4 + 1)));
};
_local2 = (_local4 + 1);
} else {
if (_local4 == _local3){
return (_local4);
};
_local5 = true;
_local2 = (_local4 + 1);
};
};
};
return (-1);
}
private function onEnterFrameHandler(_arg1:Event):void{
validate();
}
}
}//package com.bigwigmedia.ui
Section 467
//ScrollPane (com.bigwigmedia.ui.ScrollPane)
package com.bigwigmedia.ui {
import flash.display.*;
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.events.*;
import flash.events.*;
import flash.geom.*;
public class ScrollPane extends Container {
protected var _contentHeight:Number;// = 0
protected var _horizontalScrollPolicy:String;// = "auto"
protected var _horizontalScrollBar:HScrollBar;
protected var _contentHolder:Sprite;
protected var _availableHeight:Number;// = 0
protected var _verticalScrollPolicy:String;// = "auto"
protected var _availableWidth:Number;// = 0
protected var _contentScrollRect:Rectangle;
protected var _showVScrollBar:Boolean;
protected var _verticalScrollBar:VScrollBar;
protected var _contentWidth:Number;// = 0
protected var _showHScrollBar:Boolean;
public function ScrollPane(){
this.width = 100;
this.height = 100;
updateScrollBarsProperties();
}
private function onMouseWheelHandler(_arg1:MouseEvent):void{
if (((_enabled) && (_verticalScrollBar.visible))){
_verticalScrollBar.scrollPosition = (_verticalScrollBar.scrollPosition - (_arg1.delta * _verticalScrollBar.lineScrollSize));
};
}
override protected function createChildren():void{
_contentScrollRect = new Rectangle(0, 0, 100, 100);
_contentHolder = new Sprite();
addChild(_contentHolder);
_horizontalScrollBar = new HScrollBar();
_horizontalScrollBar.visible = false;
addChild(_horizontalScrollBar);
_verticalScrollBar = new VScrollBar();
_verticalScrollBar.visible = false;
addChild(_verticalScrollBar);
addEventListener(ScrollEvent.SCROLL, onScrollHandler);
addEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheelHandler);
}
private function onScrollHandler(_arg1:ScrollEvent):void{
_arg1.stopPropagation();
invalidateChildren();
}
public function get horizontalScrollPolicy():String{
return (_horizontalScrollPolicy);
}
protected function calculateAvailableSize():void{
var _local1:Number = height;
_showVScrollBar = (((_verticalScrollPolicy == ScrollPolicy.ON)) || ((((_verticalScrollPolicy == ScrollPolicy.AUTO)) && ((_contentHeight > _local1)))));
var _local2:Number = (width - (_showVScrollBar) ? _verticalScrollBar.width : 0);
_showHScrollBar = (((_horizontalScrollPolicy == ScrollPolicy.ON)) || ((((_verticalScrollPolicy == ScrollPolicy.AUTO)) && ((_contentWidth > _local2)))));
if (_showHScrollBar){
_local1 = (_local1 - _horizontalScrollBar.height);
if (((((!(_showVScrollBar)) && ((_verticalScrollPolicy == ScrollPolicy.AUTO)))) && ((_contentHeight > _local1)))){
_showVScrollBar = true;
_local2 = (_local2 - _verticalScrollBar.width);
};
};
_availableWidth = _local2;
_availableHeight = _local1;
}
public function set verticalScrollPolicy(_arg1:String):void{
_verticalScrollPolicy = _arg1;
calculateAvailableSize();
updateScrollBarsProperties();
}
protected function updateScrollBarsProperties():void{
if (_showHScrollBar){
_horizontalScrollBar.pageSize = _availableWidth;
_horizontalScrollBar.minScrollPosition = 0;
_horizontalScrollBar.maxScrollPosition = ((_contentWidth < _availableWidth)) ? 0 : (_contentWidth - _availableWidth);
_horizontalScrollBar.pageScrollSize = _availableWidth;
};
if (_showVScrollBar){
_verticalScrollBar.pageSize = _availableHeight;
_verticalScrollBar.minScrollPosition = 0;
_verticalScrollBar.maxScrollPosition = ((_contentHeight < _availableHeight)) ? 0 : (_contentHeight - _availableHeight);
_verticalScrollBar.pageScrollSize = _availableHeight;
};
}
override public function getComponentByName(_arg1:String):Component{
return (((_arg1 == this.name)) ? this : null);
}
public function get verticalScrollPolicy():String{
return (_verticalScrollPolicy);
}
override protected function validateSize():void{
calculateAvailableSize();
_horizontalScrollBar.x = 0;
_horizontalScrollBar.y = (height - _horizontalScrollBar.height);
_horizontalScrollBar.width = (width - (_showVScrollBar) ? _verticalScrollBar.width : 0);
_horizontalScrollBar.visible = _showHScrollBar;
_verticalScrollBar.x = (width - _verticalScrollBar.width);
_verticalScrollBar.y = 0;
_verticalScrollBar.height = (height - (_showHScrollBar) ? _horizontalScrollBar.height : 0);
_verticalScrollBar.visible = _showVScrollBar;
drawBackground();
}
public function set horizontalScrollPolicy(_arg1:String):void{
_horizontalScrollPolicy = _arg1;
calculateAvailableSize();
updateScrollBarsProperties();
}
}
}//package com.bigwigmedia.ui
Section 468
//ScrollPolicy (com.bigwigmedia.ui.ScrollPolicy)
package com.bigwigmedia.ui {
public class ScrollPolicy {
public static const AUTO:String = "auto";
public static const ON:String = "on";
public static const OFF:String = "off";
}
}//package com.bigwigmedia.ui
Section 469
//StyleManager (com.bigwigmedia.ui.StyleManager)
package com.bigwigmedia.ui {
import com.bigwigmedia.events.*;
import flash.utils.*;
import flash.text.*;
import com.bigwigmedia.core.*;
import com.bigwigmedia.utils.*;
import com.bigwigmedia.ui.utils.*;
public class StyleManager implements IStyleManager {
private var _classNameToMergedInheritingStylesHash:Object;
private var _styleNameToStylesHash:Object;
private var _styleSheet:StyleSheet;
private var _components:Dictionary;
private var _classNameToInheritingStylesHash:Object;
public function StyleManager(){
_styleSheet = new StyleSheet();
_classNameToInheritingStylesHash = {};
_classNameToMergedInheritingStylesHash = {};
_styleNameToStylesHash = {};
_components = new Dictionary();
super();
Singleton.checkInstance(this);
}
private function getNamedStyles(_arg1:String):Object{
var _local4:String;
if (_arg1 == null){
return ({});
};
if (_styleNameToStylesHash[_arg1] !== undefined){
return (_styleNameToStylesHash[_arg1]);
};
var _local2:Object = {};
var _local3:Object = _styleSheet.getStyle(("." + _arg1.toLowerCase()));
for (_local4 in _local3) {
_local2[_local4] = StyleUtil.parseStyle(_local4, _local3[_local4]);
};
_styleNameToStylesHash[_arg1] = _local2;
return (_local2);
}
private function onCompStyleNameChangedHandler(_arg1:ComponentEvent):void{
var _local4:String;
var _local2:Component = Component(_arg1.target);
var _local3:Object = getNamedStyles(_local2.styleName);
for (_local4 in _local3) {
_local2.setNamedStyle(_local4, _local3[_local4]);
};
}
private function getMergedInheritingStyles(_arg1:Component):Object{
var _local6:Object;
var _local7:String;
var _local2:Class = (Object(_arg1).constructor as Class);
var _local3:String = getQualifiedClassName(_local2);
if (_classNameToMergedInheritingStylesHash[_local3] !== undefined){
return (_classNameToMergedInheritingStylesHash[_local3]);
};
var _local4:Object = {};
var _local5:Class = _local2;
while (true) {
_local6 = getInheritingStyle(_local5);
for (_local7 in _local6) {
if (_local4[_local7] === undefined){
_local4[_local7] = _local6[_local7];
};
};
if (getQualifiedClassName(_local5) == "com.bigwigmedia.ui::Component"){
break;
} else {
_local5 = (getDefinitionByName(getQualifiedSuperclassName(_local5)) as Class);
};
};
_classNameToMergedInheritingStylesHash[_local3] = _local4;
return (_local4);
}
private function getInheritingStyle(_arg1:Class):Object{
var _local6:String;
var _local2:String = getQualifiedClassName(_arg1);
if (_classNameToInheritingStylesHash[_local2] !== undefined){
return (_classNameToInheritingStylesHash[_local2]);
};
var _local3:Object = ((_arg1["defaultStyles"]) || ({}));
var _local4:String = ClassUtil.getClassName(_arg1).toLowerCase();
var _local5:Object = _styleSheet.getStyle(_local4);
for (_local6 in _local5) {
_local3[_local6] = StyleUtil.parseStyle(_local6, _local5[_local6]);
};
_classNameToInheritingStylesHash[_local2] = _local3;
return (_local3);
}
public function parseCSS(_arg1:String):void{
var _local2:Object;
var _local3:Component;
var _local4:Object;
var _local5:String;
var _local6:Object;
var _local7:String;
_styleSheet.parseCSS(_arg1);
_styleNameToStylesHash = {};
_classNameToMergedInheritingStylesHash = {};
_classNameToInheritingStylesHash = {};
for (_local2 in _components) {
_local3 = Component(_local2);
_local4 = getMergedInheritingStyles(_local3);
for (_local5 in _local4) {
_local3.setInheritingStyle(_local5, _local4[_local5]);
};
_local6 = getNamedStyles(_local3.styleName);
for (_local7 in _local6) {
_local3.setNamedStyle(_local7, _local6[_local7]);
};
};
}
public function unregisterComponent(_arg1:Component):void{
if (_components[_arg1]){
_arg1.removeEventListener(ComponentEvent.STYLE_NAME_CHANGE, onCompStyleNameChangedHandler);
delete _components[_arg1];
};
}
public function registerComponent(_arg1:Component):void{
var _local2:Object;
var _local3:String;
if (!_components[_arg1]){
_components[_arg1] = true;
_arg1.addEventListener(ComponentEvent.STYLE_NAME_CHANGE, onCompStyleNameChangedHandler);
_local2 = getMergedInheritingStyles(_arg1);
for (_local3 in _local2) {
_arg1.setInheritingStyle(_local3, _local2[_local3]);
};
};
}
}
}//package com.bigwigmedia.ui
Section 470
//ToolTipManager (com.bigwigmedia.ui.ToolTipManager)
package com.bigwigmedia.ui {
import flash.display.*;
import com.bigwigmedia.ui.controls.*;
import com.bigwigmedia.events.*;
import flash.events.*;
import flash.utils.*;
import com.bigwigmedia.core.*;
import com.bigwigmedia.application.*;
public class ToolTipManager implements IToolTipManager {
private var _showDelay:Number;// = 500
private var _showTimer:Timer;
private var _toolTipTarget:Component;
private var _toolTip:ToolTip;
private var _toolTipHolder:Sprite;
private var _components:Dictionary;
private var _toolTipText:String;
public static const DISP_X:Number = 20;
public static const DISP_Y:Number = 20;
public function ToolTipManager(){
_components = new Dictionary();
super();
Singleton.checkInstance(this);
_toolTipHolder = Globals.application.toolTipHolder;
}
public function get showDelay():Number{
return (_showDelay);
}
public function set showDelay(_arg1:Number):void{
_showDelay = _arg1;
}
private function onToolTipResizeHandler(_arg1:ComponentEvent):void{
var _local2:IApplication = Globals.application;
if ((_toolTip.x + _toolTip.width) > _local2.nominalWidth){
_toolTip.x = (_local2.nominalWidth - _toolTip.width);
};
if ((_toolTip.y + _toolTip.height) > _local2.nominalHeight){
_toolTip.y = (_local2.nominalHeight - _toolTip.height);
};
}
public function registerComponent(_arg1:Component):void{
if (!_components[_arg1]){
_components[_arg1] = true;
_arg1.addEventListener(MouseEvent.MOUSE_OVER, onComponentMouseOverHandler);
_arg1.addEventListener(MouseEvent.MOUSE_OUT, onComponentMouseOutHandler);
};
}
private function onShowTimerHandler(_arg1:TimerEvent):void{
_toolTip = new ToolTip();
_toolTip.addEventListener(ComponentEvent.RESIZE, onToolTipResizeHandler);
_toolTip.text = _toolTipText;
var _local2:Stage = Globals.stage;
_toolTip.x = (_local2.mouseX + DISP_X);
_toolTip.y = (_local2.mouseY + DISP_Y);
_toolTipHolder.addChild(_toolTip);
}
private function onComponentMouseOutHandler(_arg1:MouseEvent):void{
if (_toolTipTarget == findTarget(DisplayObject(_arg1.target))){
removeToolTip();
};
}
private function showToolTip():void{
removeToolTip();
_showTimer = new Timer(_showDelay, 1);
_showTimer.addEventListener(TimerEvent.TIMER, onShowTimerHandler);
_showTimer.start();
}
public function unregisterComponent(_arg1:Component):void{
if (_components[_arg1]){
if (_toolTipTarget == _arg1){
removeToolTip();
};
_arg1.removeEventListener(MouseEvent.MOUSE_OVER, onComponentMouseOverHandler);
_arg1.removeEventListener(MouseEvent.MOUSE_OUT, onComponentMouseOutHandler);
delete _components[_arg1];
};
}
private function onComponentMouseOverHandler(_arg1:MouseEvent):void{
var _local2:Component = findTarget(DisplayObject(_arg1.target));
if (!_local2){
return;
};
var _local3:String = _local2.toolTip;
if (_local3){
_toolTipText = _local3;
_toolTipTarget = _local2;
showToolTip();
};
}
private function findTarget(_arg1:DisplayObject):Component{
while (_arg1) {
if ((_arg1 is Component)){
return (Component(_arg1));
};
_arg1 = _arg1.parent;
};
return (null);
}
private function removeToolTip():void{
if (_showTimer){
_showTimer.stop();
_showTimer.removeEventListener(TimerEvent.TIMER, onShowTimerHandler);
_showTimer = null;
};
if (_toolTip){
_toolTip.removeEventListener(ComponentEvent.RESIZE, onToolTipResizeHandler);
_toolTip.dispose();
_toolTipHolder.removeChild(_toolTip);
_toolTip = null;
_toolTipTarget = null;
};
}
}
}//package com.bigwigmedia.ui
Section 471
//Message (com.bigwigmedia.utils.messages.Message)
package com.bigwigmedia.utils.messages {
import com.bigwigmedia.utils.*;
public class Message {
private var _priority:int;
private var _data:Object;
private var _removeDuplicates:Boolean;
private var _cancelQueue:Boolean;
private var _type:String;
public function Message(_arg1:String, _arg2:int, _arg3:Boolean, _arg4:Boolean, _arg5:Object){
_type = _arg1;
_priority = _arg2;
_cancelQueue = _arg3;
_removeDuplicates = _arg4;
_data = _arg5;
}
public function get priority():int{
return (_priority);
}
public function get data():Object{
return (_data);
}
public function toString():String{
return (formatToString(this, "type", "priority", "data"));
}
function cloneWithData(_arg1:Object):Message{
return (new Message(_type, _priority, _cancelQueue, _removeDuplicates, _arg1));
}
public function get cancelQueue():Boolean{
return (_cancelQueue);
}
public function get type():String{
return (_type);
}
public function get removeDuplicates():Boolean{
return (_removeDuplicates);
}
}
}//package com.bigwigmedia.utils.messages
Section 472
//MessageQueue (com.bigwigmedia.utils.messages.MessageQueue)
package com.bigwigmedia.utils.messages {
import com.bigwigmedia.core.*;
import flash.errors.*;
public class MessageQueue implements IDisposable {
private var pendingMessages:Array;
private var locked:Boolean;// = false
private var pendingMessagesWhileLocked:Array;
private var messagePrototypes:Object;
public function MessageQueue(){
pendingMessages = [];
pendingMessagesWhileLocked = [];
messagePrototypes = {};
super();
}
private function indexOfLastEqualPriority(_arg1:int):int{
var _local4:uint;
var _local6:int;
var _local2:uint;
var _local3:int = (pendingMessages.length - 1);
var _local5:Boolean;
while (_local2 <= _local3) {
_local4 = ((_local3 + _local2) / 2);
_local6 = pendingMessages[_local4].priority;
if (_arg1 < _local6){
if (_local4 == _local2){
if (_local5){
return ((_local4 - 1));
};
return ((-1 - _local4));
};
_local3 = (_local4 - 1);
} else {
if (_arg1 > _local6){
if (_local4 == _local3){
return ((-1 - (_local4 + 1)));
};
_local2 = (_local4 + 1);
} else {
if (_local4 == _local3){
return (_local4);
};
_local5 = true;
_local2 = (_local4 + 1);
};
};
};
return (-1);
}
public function registerMessage(_arg1:String, _arg2:int, _arg3:Boolean=false, _arg4:Boolean=false):void{
if (messagePrototypes[_arg1] != undefined){
throw (new ArgumentError((("Message of type \"" + _arg1) + "\" is registered already.")));
};
messagePrototypes[_arg1] = new Message(_arg1, _arg2, _arg4, _arg3, null);
}
public function getNext():Message{
var _local1:Message = pendingMessages.pop();
if (_local1.cancelQueue){
pendingMessages = [];
};
return (_local1);
}
public function lock():void{
if (locked){
throw (new IllegalOperationError("Message queue is already locked"));
};
locked = true;
}
public function clear():void{
pendingMessages = [];
pendingMessagesWhileLocked = [];
}
public function dispose():void{
pendingMessages = [];
pendingMessagesWhileLocked = [];
messagePrototypes = {};
}
public function unlock():void{
if (!locked){
throw (new IllegalOperationError("Message queue is already unlocked"));
};
while (pendingMessagesWhileLocked.length > 0) {
_append(pendingMessagesWhileLocked.pop());
};
locked = false;
}
private function _append(_arg1:Message):void{
var _local3:Message;
var _local4:int;
if (_arg1.removeDuplicates){
for each (_local3 in pendingMessages) {
if (_arg1.type == _local3.type){
_local4 = pendingMessages.indexOf(_local3);
pendingMessages.splice(_local4, 1);
};
};
};
var _local2:int = indexOfLastEqualPriority(_arg1.priority);
if (_local2 > -1){
_local2++;
} else {
_local2 = (-(_local2) - 1);
};
pendingMessages.splice(_local2, 0, _arg1);
}
public function append(_arg1:String, _arg2:Object=null):void{
var _local3:Message = messagePrototypes[_arg1];
if (_local3 == null){
throw (new ArgumentError((("Message with type \"" + _arg1) + "\" is not registered.")));
};
var _local4:Message = _local3.cloneWithData(_arg2);
if (locked){
pendingMessagesWhileLocked.push(_local4);
} else {
_append(_local4);
};
}
public function hasNext():Boolean{
return ((pendingMessages.length > 0));
}
}
}//package com.bigwigmedia.utils.messages
Section 473
//ClassInfo (com.bigwigmedia.utils.reflection.ClassInfo)
package com.bigwigmedia.utils.reflection {
import flash.utils.*;
public class ClassInfo {
private var _propertiesHash:Object;
private var _methodsHash:Object;
private var _classMetadataHash:Object;
private var _xml:XML;
public function ClassInfo(_arg1:Class){
_propertiesHash = {};
_methodsHash = {};
super();
_xml = describeType(_arg1);
}
public function getMethodInfo(_arg1:String, _arg2:Boolean=false):MethodInfo{
var xmlList:XMLList;
var name = _arg1;
var isStatic = _arg2;
var id:String = ((name + ",static=") + isStatic);
if (_methodsHash[id] === undefined){
if (isStatic){
xmlList = _xml.method.(@name == name);
} else {
xmlList = _xml.factory.method.(@name == name);
};
if (xmlList.length() == 0){
_methodsHash[id] = null;
} else {
_methodsHash[id] = new MethodInfo(xmlList[0], isStatic);
};
};
return (_methodsHash[id]);
}
public function getClassMetadata(_arg1:String):Array{
if (!_classMetadataHash){
_classMetadataHash = collectClassMetadata();
};
return (((_classMetadataHash[_arg1]) || ([])));
}
public function getPropertyInfo(_arg1:String, _arg2:Boolean=false):PropertyInfo{
var xmlList:XMLList;
var name = _arg1;
var isStatic = _arg2;
var id:String = ((name + ",static=") + isStatic);
if (_propertiesHash[id] === undefined){
if (isStatic){
xmlList = (_xml.accessor.(@name == name) + _xml.variable.(@name == name));
} else {
xmlList = (_xml.factory.accessor.(@name == name) + _xml.factory.variable.(@name == name));
};
if (xmlList.length() == 0){
_propertiesHash[id] = null;
} else {
_propertiesHash[id] = new PropertyInfo(xmlList[0], isStatic);
};
};
return (_propertiesHash[id]);
}
private function collectClassMetadata():Object{
var _local3:XML;
var _local4:Metadata;
var _local5:Array;
var _local1:Object = {};
var _local2:XMLList = _xml.factory.metadata;
for each (_local3 in _local2) {
_local4 = new Metadata(_local3);
_local5 = _local1[_local4.name];
if (!_local5){
_local5 = (_local1[_local4.name] = []);
};
_local5.push(_local4);
};
return (_local1);
}
}
}//package com.bigwigmedia.utils.reflection
Section 474
//Metadata (com.bigwigmedia.utils.reflection.Metadata)
package com.bigwigmedia.utils.reflection {
public class Metadata {
private var _arguments:Object;
private var _name:String;
public function Metadata(_arg1:XML){
var xml = _arg1;
_arguments = {};
super();
_name = xml.@name;
xml.arg.(_arguments[@key] = @value); //not popped
}
public function getArgument(_arg1:String):String{
return (_arguments[_arg1]);
}
public function get name():String{
return (_name);
}
public function toString():String{
return ((("[Metadata name=\"" + _name) + "\"]"));
}
}
}//package com.bigwigmedia.utils.reflection
Section 475
//MethodInfo (com.bigwigmedia.utils.reflection.MethodInfo)
package com.bigwigmedia.utils.reflection {
import com.bigwigmedia.utils.*;
public class MethodInfo {
private var _returnType:String;
private var _name:String;
private var _parameters:Array;
private var _isStatic:Boolean;
public function MethodInfo(_arg1:XML, _arg2:Boolean){
var xml = _arg1;
var isStatic = _arg2;
_parameters = [];
super();
_name = xml.@name;
_returnType = xml.@returnType;
_isStatic = isStatic;
var parametersList:XMLList = xml.parameter;
parametersList.(_parameters.push(new ParameterInfo(valueOf()))); //not popped
}
public function get parameters():Array{
return (_parameters);
}
public function get name():String{
return (_name);
}
public function toString():String{
return (formatToString(this, "name", "returnType", "isStatic"));
}
public function get returnType():String{
return (_returnType);
}
public function get isStatic():Boolean{
return (_isStatic);
}
}
}//package com.bigwigmedia.utils.reflection
Section 476
//ParameterInfo (com.bigwigmedia.utils.reflection.ParameterInfo)
package com.bigwigmedia.utils.reflection {
import com.bigwigmedia.utils.*;
public class ParameterInfo {
private var _index:int;
private var _type:String;
private var _optional:Boolean;
public function ParameterInfo(_arg1:XML){
_index = _arg1.@index;
_type = _arg1.@type;
_optional = (_arg1.@optional.toString() == "true");
}
public function get optional():Boolean{
return (_optional);
}
public function get index():int{
return (_index);
}
public function get type():String{
return (_type);
}
public function toString():String{
return (formatToString(this, "index", "type", "optional"));
}
}
}//package com.bigwigmedia.utils.reflection
Section 477
//PropertyInfo (com.bigwigmedia.utils.reflection.PropertyInfo)
package com.bigwigmedia.utils.reflection {
import com.bigwigmedia.utils.*;
public class PropertyInfo {
private var _access:String;
private var _name:String;
private var _isStatic:Boolean;
private var _type:String;
public static const READ_ONLY:String = "readonly";
public static const READ_WRITE:String = "readwrite";
public static const WRITE_ONLY:String = "writeonly";
public function PropertyInfo(_arg1:XML, _arg2:Boolean){
_name = _arg1.@name;
_access = (_arg1.hasOwnProperty("@access")) ? _arg1.@access : PropertyInfo.READ_WRITE;
_type = _arg1.@type;
_isStatic = _arg2;
}
public function get access():String{
return (_access);
}
public function get name():String{
return (_name);
}
public function toString():String{
return (formatToString(this, "name", "access", "type", "isStatic"));
}
public function get isStatic():Boolean{
return (_isStatic);
}
public function get type():String{
return (_type);
}
}
}//package com.bigwigmedia.utils.reflection
Section 478
//Reflection (com.bigwigmedia.utils.reflection.Reflection)
package com.bigwigmedia.utils.reflection {
import flash.utils.*;
public class Reflection {
private static var _classNameToInfoHash:Object = {};
public static function getClassInfo(_arg1:Object):ClassInfo{
var _local2:Class = ((_arg1 is Class)) ? Class(_arg1) : Object(_arg1).constructor;
var _local3:String = getQualifiedClassName(_local2);
var _local4:ClassInfo = _classNameToInfoHash[_local3];
if (!_local4){
_local4 = (_classNameToInfoHash[_local3] = new ClassInfo(_local2));
};
return (_local4);
}
}
}//package com.bigwigmedia.utils.reflection
Section 479
//ArrayUtil (com.bigwigmedia.utils.ArrayUtil)
package com.bigwigmedia.utils {
public class ArrayUtil {
public static function shuffle(_arg1:Array):Array{
var _local5:int;
var _local6:*;
var _local2:Array = _arg1.slice();
var _local3:int = _local2.length;
if (_local3 <= 1){
return (_local2);
};
var _local4:int;
while (_local4 < _local3) {
_local5 = int((Math.random() * _local3));
_local6 = _local2[_local4];
_local2[_local4] = _local2[_local5];
_local2[_local5] = _local6;
_local4++;
};
return (_local2);
}
public static function shuffleTrim(_arg1:Array, _arg2:int):Array{
var _local3:int = _arg1.length;
if (_arg2 > _local3){
throw (new ArgumentError("Supplied length is bigger than length of supplied array"));
};
if (_local3 <= 1){
return (_arg1.slice());
};
var _local4:Array = ArrayUtil.shuffle(_arg1);
var _local5:Array = [];
var _local6:int;
while (_local6 < _arg2) {
_local5.push(_local4.pop());
_local6++;
};
return (_local5);
}
public static function getRandomElement(_arg1:Array){
var _local3:int;
var _local2:int = _arg1.length;
if (_local2 > 0){
_local3 = (Math.random() * _local2);
return (_arg1[_local3]);
};
return (undefined);
}
}
}//package com.bigwigmedia.utils
Section 480
//ClassUtil (com.bigwigmedia.utils.ClassUtil)
package com.bigwigmedia.utils {
import flash.utils.*;
public class ClassUtil {
public static function getClassName(_arg1):String{
var _local2:String = getQualifiedClassName(_arg1);
var _local3:int = _local2.indexOf("::");
return (((_local3 == -1)) ? _local2 : _local2.substr((_local3 + 2)));
}
}
}//package com.bigwigmedia.utils
Section 481
//formatToString (com.bigwigmedia.utils.formatToString)
package com.bigwigmedia.utils {
public function formatToString(_arg1, ... _args):String{
var _local6:String;
var _local7:Object;
var _local3:String = ("[" + ClassUtil.getClassName(_arg1));
var _local4:int = _args.length;
var _local5:int;
while (_local5 < _local4) {
_local6 = _args[_local5].toString();
_local7 = _arg1[_local6];
if ((_local7 is String)){
_local3 = (_local3 + ((((" " + _local6) + "=\"") + _local7) + "\""));
} else {
_local3 = (_local3 + (((" " + _local6) + "=") + _local7));
};
_local5++;
};
return ((_local3 + "]"));
}
}//package com.bigwigmedia.utils
Section 482
//GeomUtil (com.bigwigmedia.utils.GeomUtil)
package com.bigwigmedia.utils {
import flash.geom.*;
public class GeomUtil {
private static var _tempMatrix:Matrix = new Matrix();
private static var _tempPoint:Point = new Point();
public static function getAABB(_arg1:Rectangle, _arg2:Point, _arg3:Number=0):Rectangle{
var _local4:Number = (_arg1.x + _arg2.x);
var _local5:Number = (_arg1.y + _arg2.y);
var _local6:Number = _arg1.width;
var _local7:Number = _arg1.height;
_tempMatrix.a = 1;
_tempMatrix.b = 0;
_tempMatrix.c = 0;
_tempMatrix.d = 1;
_tempMatrix.tx = -(_local4);
_tempMatrix.ty = -(_local5);
_tempMatrix.rotate(_arg3);
_tempMatrix.tx = (_tempMatrix.tx + _local4);
_tempMatrix.ty = (_tempMatrix.ty + _local5);
_tempPoint.x = (_arg1.x + (_local6 / 2));
_tempPoint.y = (_arg1.y + (_local7 / 2));
_tempPoint = _tempMatrix.transformPoint(_tempPoint);
var _local8:Number = Math.sin(_arg3);
if (_local8 < 0){
_local8 = -(_local8);
};
var _local9:Number = Math.cos(_arg3);
if (_local9 < 0){
_local9 = -(_local9);
};
var _local10:Number = ((_local6 * _local9) + (_local7 * _local8));
var _local11:Number = ((_local6 * _local8) + (_local7 * _local9));
return (new Rectangle(((_tempPoint.x - _arg2.x) - (_local10 / 2)), ((_tempPoint.y - _arg2.y) - (_local11 / 2)), _local10, _local11));
}
}
}//package com.bigwigmedia.utils
Section 483
//GraphicsUtil (com.bigwigmedia.utils.GraphicsUtil)
package com.bigwigmedia.utils {
import flash.display.*;
import flash.geom.*;
public class GraphicsUtil {
public static function drawRectExt(_arg1:Graphics, _arg2:Rectangle, _arg3:Point, _arg4:Number):void{
var _local5:Matrix = new Matrix(1, 0, 0, 1, -(_arg3.x), -(_arg3.y));
_local5.rotate(_arg4);
_local5.tx = (_local5.tx + _arg2.x);
_local5.ty = (_local5.ty + _arg2.y);
var _local6:Point = new Point(0, 0);
_local6 = _local5.transformPoint(_local6);
_arg1.moveTo(_local6.x, _local6.y);
_local6.x = _arg2.width;
_local6.y = 0;
_local6 = _local5.transformPoint(_local6);
_arg1.lineTo(_local6.x, _local6.y);
_local6.x = _arg2.width;
_local6.y = _arg2.height;
_local6 = _local5.transformPoint(_local6);
_arg1.lineTo(_local6.x, _local6.y);
_local6.x = 0;
_local6.y = _arg2.height;
_local6 = _local5.transformPoint(_local6);
_arg1.lineTo(_local6.x, _local6.y);
_local6.x = 0;
_local6.y = 0;
_local6 = _local5.transformPoint(_local6);
_arg1.lineTo(_local6.x, _local6.y);
}
public static function drawTransparencyGrid(_arg1:Graphics, _arg2:Rectangle, _arg3:Number=8, _arg4:uint=0xFFFFFF, _arg5:uint=0xCBCBCB):void{
var _local10:int;
var _local11:int;
_arg1.lineStyle();
_arg1.beginFill(_arg4, 1);
_arg1.drawRect(_arg2.x, _arg2.y, _arg2.width, _arg2.height);
_arg1.endFill();
var _local6:int = (_arg2.height / _arg3);
var _local7:int = (_arg2.width / _arg3);
var _local8:int = (_local6 * _local7);
var _local9:int;
while (_local9 < _local8) {
_local10 = (_local9 / _local7);
_local11 = (_local9 % _local7);
if ((_local10 % 2) == (_local11 % 2)){
_arg1.beginFill(_arg5, 1);
_arg1.drawRect((_arg2.x + (_local11 * _arg3)), (_arg2.y + (_local10 * _arg3)), _arg3, _arg3);
_arg1.endFill();
};
_local9++;
};
}
}
}//package com.bigwigmedia.utils
Section 484
//MathUtil (com.bigwigmedia.utils.MathUtil)
package com.bigwigmedia.utils {
public class MathUtil {
public static function angleDif(_arg1:Number, _arg2:Number):Number{
return (Math.atan2(Math.sin((_arg2 - _arg1)), Math.cos((_arg2 - _arg1))));
}
public static function nearEquals(_arg1:Number, _arg2:Number, _arg3:Number=0.0001):Boolean{
var _local4:Number = (_arg1 - _arg2);
return ((((_local4 < _arg3)) && ((_local4 > -(_arg3)))));
}
}
}//package com.bigwigmedia.utils
Section 485
//ObjectUtil (com.bigwigmedia.utils.ObjectUtil)
package com.bigwigmedia.utils {
public class ObjectUtil {
public static function getRandomValue(_arg1:Object){
var _local3:Object;
var _local4:int;
var _local2:Array = [];
for each (_local3 in _arg1) {
_local2.push(_local3);
};
_local4 = (Math.random() * _local2.length);
return (_local2[_local4]);
}
public static function hasProperties(_arg1:Object):Boolean{
var _local2:String;
for (_local2 in _arg1) {
return (true);
};
return (false);
}
}
}//package com.bigwigmedia.utils
Section 486
//RC4 (com.bigwigmedia.utils.RC4)
package com.bigwigmedia.utils {
import flash.events.*;
import flash.utils.*;
import com.bigwigmedia.core.*;
public class RC4 extends EventDispatcher implements IDisposable {
private var asyncPosition:uint;// = 0
private var keyBytes:ByteArray;
private var asyncBytes:ByteArray;
private var S:ByteArray;
private var asyncBytesLength:uint;
private var i:int;// = 0
private var asyncTimer:Timer;
private var j:int;// = 0
public static const ASYNC_BLOCK_SIZE_KB:uint = 204800;
public function RC4(_arg1:String){
S = new ByteArray();
keyBytes = new ByteArray();
super();
keyBytes.writeUTFBytes(_arg1);
}
public function get bytesDecrypted():uint{
return (asyncPosition);
}
private function onTimerHandler(_arg1:TimerEvent):void{
var _local2:int = ASYNC_BLOCK_SIZE_KB;
while ((((asyncPosition < asyncBytesLength)) && ((_local2 > 0)))) {
var _local3 = asyncPosition++;
asyncBytes[_local3] = (asyncBytes[_local3] ^ next());
};
if (asyncPosition >= asyncBytesLength){
asyncTimer.removeEventListener(TimerEvent.TIMER, onTimerHandler);
dispatchEvent(new Event(Event.COMPLETE));
};
}
public function decrypt(_arg1:ByteArray):void{
encrypt(_arg1);
dispatchEvent(new Event(Event.COMPLETE));
}
private function initialize():void{
var _local1:int;
var _local4:int;
_local1 = 0;
while (_local1 < 0x0100) {
S[_local1] = _local1;
_local1++;
};
var _local2:int;
var _local3:int = keyBytes.length;
_local1 = 0;
while (_local1 < 0x0100) {
_local4 = S[_local1];
_local2 = (((_local2 + _local4) + keyBytes[(_local1 % _local3)]) & 0xFF);
S[_local1] = S[_local2];
S[_local2] = _local4;
_local1++;
};
i = 0;
j = 0;
}
public function dispose():void{
if (asyncTimer){
asyncTimer.stop();
asyncTimer.removeEventListener(TimerEvent.TIMER, onTimerHandler);
asyncTimer = null;
};
S = null;
keyBytes = null;
asyncBytes = null;
}
public function encrypt(_arg1:ByteArray):void{
initialize();
var _local2:uint;
while (_local2 < _arg1.length) {
var _temp1 = _local2;
_local2 = (_local2 + 1);
var _local3 = _temp1;
_arg1[_local3] = (_arg1[_local3] ^ next());
};
}
public function decryptAsync(_arg1:ByteArray):void{
asyncBytes = _arg1;
asyncBytesLength = asyncBytes.length;
initialize();
asyncTimer = new Timer(1, 0);
asyncTimer.addEventListener(TimerEvent.TIMER, onTimerHandler);
asyncTimer.start();
}
private function next():uint{
var _local1:int = S[i];
i = ((i + 1) & 0xFF);
j = ((j + _local1) & 0xFF);
var _local2:int = (S[i] = S[j]);
S[j] = _local1;
return (S[((_local1 + _local2) & 0xFF)]);
}
}
}//package com.bigwigmedia.utils
Section 487
//Base64 (com.dynamicflash.util.Base64)
package com.dynamicflash.util {
import flash.utils.*;
public class Base64 {
public static const version:String = "1.0.0";
private static const BASE64_CHARS:String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
public function Base64(){
throw (new Error("Base64 class is static container only"));
}
public static function encode(_arg1:String):String{
var _local2:ByteArray = new ByteArray();
_local2.writeUTFBytes(_arg1);
return (encodeByteArray(_local2));
}
public static function encodeByteArray(_arg1:ByteArray):String{
var _local3:Array;
var _local5:uint;
var _local6:uint;
var _local7:uint;
var _local2 = "";
var _local4:Array = new Array(4);
_arg1.position = 0;
while (_arg1.bytesAvailable > 0) {
_local3 = new Array();
_local5 = 0;
while ((((_local5 < 3)) && ((_arg1.bytesAvailable > 0)))) {
_local3[_local5] = _arg1.readUnsignedByte();
_local5++;
};
_local4[0] = ((_local3[0] & 252) >> 2);
_local4[1] = (((_local3[0] & 3) << 4) | (_local3[1] >> 4));
_local4[2] = (((_local3[1] & 15) << 2) | (_local3[2] >> 6));
_local4[3] = (_local3[2] & 63);
_local6 = _local3.length;
while (_local6 < 3) {
_local4[(_local6 + 1)] = 64;
_local6++;
};
_local7 = 0;
while (_local7 < _local4.length) {
_local2 = (_local2 + BASE64_CHARS.charAt(_local4[_local7]));
_local7++;
};
};
return (_local2);
}
public static function decode(_arg1:String):String{
var _local2:ByteArray = decodeToByteArray(_arg1);
return (_local2.readUTFBytes(_local2.length));
}
public static function decodeToByteArray(_arg1:String):ByteArray{
var _local6:uint;
var _local7:uint;
var _local2:ByteArray = new ByteArray();
var _local3:Array = new Array(4);
var _local4:Array = new Array(3);
var _local5:uint;
while (_local5 < _arg1.length) {
_local6 = 0;
while ((((_local6 < 4)) && (((_local5 + _local6) < _arg1.length)))) {
_local3[_local6] = BASE64_CHARS.indexOf(_arg1.charAt((_local5 + _local6)));
_local6++;
};
_local4[0] = ((_local3[0] << 2) + ((_local3[1] & 48) >> 4));
_local4[1] = (((_local3[1] & 15) << 4) + ((_local3[2] & 60) >> 2));
_local4[2] = (((_local3[2] & 3) << 6) + _local3[3]);
_local7 = 0;
while (_local7 < _local4.length) {
if (_local3[(_local7 + 1)] == 64){
break;
};
_local2.writeByte(_local4[_local7]);
_local7++;
};
_local5 = (_local5 + 4);
};
_local2.position = 0;
return (_local2);
}
}
}//package com.dynamicflash.util
Section 488
//Color (fl.motion.Color)
package fl.motion {
import flash.display.*;
import flash.geom.*;
public class Color extends ColorTransform {
private var _tintColor:Number;// = 0
private var _tintMultiplier:Number;// = 0
public function Color(_arg1:Number=1, _arg2:Number=1, _arg3:Number=1, _arg4:Number=1, _arg5:Number=0, _arg6:Number=0, _arg7:Number=0, _arg8:Number=0){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
}
private function deriveTintColor():uint{
var _local1:Number = (1 / this.tintMultiplier);
var _local2:uint = Math.round((this.redOffset * _local1));
var _local3:uint = Math.round((this.greenOffset * _local1));
var _local4:uint = Math.round((this.blueOffset * _local1));
var _local5:uint = (((_local2 << 16) | (_local3 << 8)) | _local4);
return (_local5);
}
public function set brightness(_arg1:Number):void{
if (_arg1 > 1){
_arg1 = 1;
} else {
if (_arg1 < -1){
_arg1 = -1;
};
};
var _local2:Number = (1 - Math.abs(_arg1));
var _local3:Number = 0;
if (_arg1 > 0){
_local3 = (_arg1 * 0xFF);
};
this.redMultiplier = (this.greenMultiplier = (this.blueMultiplier = _local2));
this.redOffset = (this.greenOffset = (this.blueOffset = _local3));
}
private function parseXML(_arg1:XML=null):Color{
var _local3:XML;
var _local4:String;
var _local5:uint;
if (!_arg1){
return (this);
};
var _local2:XML = _arg1.elements()[0];
if (!_local2){
return (this);
};
for each (_local3 in _local2.attributes()) {
_local4 = _local3.localName();
if (_local4 == "tintColor"){
_local5 = (Number(_local3.toString()) as uint);
this.tintColor = _local5;
} else {
this[_local4] = Number(_local3.toString());
};
};
return (this);
}
public function get tintColor():uint{
return (this._tintColor);
}
public function set tintColor(_arg1:uint):void{
this.setTint(_arg1, this.tintMultiplier);
}
public function get brightness():Number{
return ((this.redOffset) ? (1 - this.redMultiplier) : (this.redMultiplier - 1));
}
public function set tintMultiplier(_arg1:Number):void{
this.setTint(this.tintColor, _arg1);
}
public function get tintMultiplier():Number{
return (this._tintMultiplier);
}
public function setTint(_arg1:uint, _arg2:Number):void{
this._tintColor = _arg1;
this._tintMultiplier = _arg2;
this.redMultiplier = (this.greenMultiplier = (this.blueMultiplier = (1 - _arg2)));
var _local3:uint = ((_arg1 >> 16) & 0xFF);
var _local4:uint = ((_arg1 >> 8) & 0xFF);
var _local5:uint = (_arg1 & 0xFF);
this.redOffset = Math.round((_local3 * _arg2));
this.greenOffset = Math.round((_local4 * _arg2));
this.blueOffset = Math.round((_local5 * _arg2));
}
public static function interpolateColor(_arg1:uint, _arg2:uint, _arg3:Number):uint{
var _local4:Number = (1 - _arg3);
var _local5:uint = ((_arg1 >> 24) & 0xFF);
var _local6:uint = ((_arg1 >> 16) & 0xFF);
var _local7:uint = ((_arg1 >> 8) & 0xFF);
var _local8:uint = (_arg1 & 0xFF);
var _local9:uint = ((_arg2 >> 24) & 0xFF);
var _local10:uint = ((_arg2 >> 16) & 0xFF);
var _local11:uint = ((_arg2 >> 8) & 0xFF);
var _local12:uint = (_arg2 & 0xFF);
var _local13:uint = ((_local5 * _local4) + (_local9 * _arg3));
var _local14:uint = ((_local6 * _local4) + (_local10 * _arg3));
var _local15:uint = ((_local7 * _local4) + (_local11 * _arg3));
var _local16:uint = ((_local8 * _local4) + (_local12 * _arg3));
var _local17:uint = ((((_local13 << 24) | (_local14 << 16)) | (_local15 << 8)) | _local16);
return (_local17);
}
public static function interpolateTransform(_arg1:ColorTransform, _arg2:ColorTransform, _arg3:Number):ColorTransform{
var _local4:Number = (1 - _arg3);
var _local5:ColorTransform = new ColorTransform(((_arg1.redMultiplier * _local4) + (_arg2.redMultiplier * _arg3)), ((_arg1.greenMultiplier * _local4) + (_arg2.greenMultiplier * _arg3)), ((_arg1.blueMultiplier * _local4) + (_arg2.blueMultiplier * _arg3)), ((_arg1.alphaMultiplier * _local4) + (_arg2.alphaMultiplier * _arg3)), ((_arg1.redOffset * _local4) + (_arg2.redOffset * _arg3)), ((_arg1.greenOffset * _local4) + (_arg2.greenOffset * _arg3)), ((_arg1.blueOffset * _local4) + (_arg2.blueOffset * _arg3)), ((_arg1.alphaOffset * _local4) + (_arg2.alphaOffset * _arg3)));
return (_local5);
}
public static function fromXML(_arg1:XML):Color{
return (Color(new (Color).parseXML(_arg1)));
}
}
}//package fl.motion
Section 489
//ByteArrayAsset (mx.core.ByteArrayAsset)
package mx.core {
import flash.utils.*;
public class ByteArrayAsset extends ByteArray implements IFlexAsset {
mx_internal static const VERSION:String = "3.5.0.12683";
}
}//package mx.core
Section 490
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 491
//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 492
//preloader_progress_bar_21 (preloader_fla.preloader_progress_bar_21)
package preloader_fla {
import flash.display.*;
public dynamic class preloader_progress_bar_21 extends MovieClip {
public var _mask:MovieClip;
}
}//package preloader_fla
Section 493
//acid_hiss_01_wav (acid_hiss_01_wav)
package {
import flash.media.*;
public dynamic class acid_hiss_01_wav extends Sound {
}
}//package
Section 494
//aircraft_pass_01_wav (aircraft_pass_01_wav)
package {
import flash.media.*;
public dynamic class aircraft_pass_01_wav extends Sound {
}
}//package
Section 495
//baloon_pop2_wav (baloon_pop2_wav)
package {
import flash.media.*;
public dynamic class baloon_pop2_wav extends Sound {
}
}//package
Section 496
//beep_01_wav (beep_01_wav)
package {
import flash.media.*;
public dynamic class beep_01_wav extends Sound {
}
}//package
Section 497
//button_click_wav (button_click_wav)
package {
import flash.media.*;
public dynamic class button_click_wav extends Sound {
}
}//package
Section 498
//cancel_sfx (cancel_sfx)
package {
import flash.media.*;
public dynamic class cancel_sfx extends Sound {
}
}//package
Section 499
//drm_roll_crash_02_wav (drm_roll_crash_02_wav)
package {
import flash.media.*;
public dynamic class drm_roll_crash_02_wav extends Sound {
}
}//package
Section 500
//explosion_01_wav (explosion_01_wav)
package {
import flash.media.*;
public dynamic class explosion_01_wav extends Sound {
}
}//package
Section 501
//explosion_02_wav (explosion_02_wav)
package {
import flash.media.*;
public dynamic class explosion_02_wav extends Sound {
}
}//package
Section 502
//explosion_03_wav (explosion_03_wav)
package {
import flash.media.*;
public dynamic class explosion_03_wav extends Sound {
}
}//package
Section 503
//foot (foot)
package {
import com.bigwigmedia.display.*;
public dynamic class foot extends SimpleAutoAsset {
}
}//package
Section 504
//girl_hit_wav (girl_hit_wav)
package {
import flash.media.*;
public dynamic class girl_hit_wav extends Sound {
}
}//package
Section 505
//hit_0 (hit_0)
package {
import flash.media.*;
public dynamic class hit_0 extends Sound {
}
}//package
Section 506
//hit_1 (hit_1)
package {
import flash.media.*;
public dynamic class hit_1 extends Sound {
}
}//package
Section 507
//hit_2 (hit_2)
package {
import flash.media.*;
public dynamic class hit_2 extends Sound {
}
}//package
Section 508
//hit_3 (hit_3)
package {
import flash.media.*;
public dynamic class hit_3 extends Sound {
}
}//package
Section 509
//hit_4 (hit_4)
package {
import flash.media.*;
public dynamic class hit_4 extends Sound {
}
}//package
Section 510
//hit_5 (hit_5)
package {
import flash.media.*;
public dynamic class hit_5 extends Sound {
}
}//package
Section 511
//hit_6 (hit_6)
package {
import flash.media.*;
public dynamic class hit_6 extends Sound {
}
}//package
Section 512
//hit_7 (hit_7)
package {
import flash.media.*;
public dynamic class hit_7 extends Sound {
}
}//package
Section 513
//hit_8 (hit_8)
package {
import flash.media.*;
public dynamic class hit_8 extends Sound {
}
}//package
Section 514
//hit_9 (hit_9)
package {
import flash.media.*;
public dynamic class hit_9 extends Sound {
}
}//package
Section 515
//laser_01_wav (laser_01_wav)
package {
import flash.media.*;
public dynamic class laser_01_wav extends Sound {
}
}//package
Section 516
//ouch_4_wav (ouch_4_wav)
package {
import flash.media.*;
public dynamic class ouch_4_wav extends Sound {
}
}//package
Section 517
//ouch_6_wav (ouch_6_wav)
package {
import flash.media.*;
public dynamic class ouch_6_wav extends Sound {
}
}//package
Section 518
//rock_breaker_01_wav (rock_breaker_01_wav)
package {
import flash.media.*;
public dynamic class rock_breaker_01_wav extends Sound {
}
}//package
Section 519
//tapping_wav (tapping_wav)
package {
import flash.media.*;
public dynamic class tapping_wav extends Sound {
}
}//package
Section 520
//trumpets_fanfar_wav (trumpets_fanfar_wav)
package {
import flash.media.*;
public dynamic class trumpets_fanfar_wav extends Sound {
}
}//package
Section 521
//upgrade_buy_sfx (upgrade_buy_sfx)
package {
import flash.media.*;
public dynamic class upgrade_buy_sfx extends Sound {
}
}//package
Section 522
//wrecking_ball_01_wav (wrecking_ball_01_wav)
package {
import flash.media.*;
public dynamic class wrecking_ball_01_wav extends Sound {
}
}//package
Section 523
//wrecking_ball_02_wav (wrecking_ball_02_wav)
package {
import flash.media.*;
public dynamic class wrecking_ball_02_wav extends Sound {
}
}//package