Section 1
//Debug (alcon.Debug)
package alcon {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public final class Debug {
public static const LEVEL_WARN:int = 2;
public static const LEVEL_DEBUG:int = 0;
public static const LEVEL_INFO:int = 1;
public static const LEVEL_FATAL:int = 4;
public static const LEVEL_ERROR:int = 3;
private static var _stage:Stage;
private static var _filterLevel:int = 0;
private static var _isEnabled:Boolean = true;
private static var _isConnected:Boolean = false;
private static var _isPollingFPS:Boolean = false;
private static var _stopWatch:StopWatch;
private static var _connection:LocalConnection;
private static var _fpsMeter:FPSMeter;
public static function forceGC():void{
try {
} catch(e1:Error) {
try {
new LocalConnection().connect("forceGC");
new LocalConnection().connect("forceGC");
} catch(e2:Error) {
};
};
}
private static function send(_arg1:String, _arg2, _arg3:int=1, _arg4:int=0):void{
var _local5:Number;
var _local6:ByteArray;
if (_isEnabled){
if (!_isConnected){
_isConnected = true;
_connection = new LocalConnection();
_connection.addEventListener(StatusEvent.STATUS, onStatus);
};
_local5 = 0;
if (typeof(_arg2) == "string"){
_local5 = String(_arg2).length;
} else {
if (typeof(_arg2) == "object"){
_local6 = new ByteArray();
_local6.writeObject(_arg2);
_local5 = _local6.length;
_local6 = null;
};
};
if (_local5 > 39000){
storeDataLSO(_arg1, _arg2);
_arg1 = "onLargeData";
_arg2 = null;
};
_connection.send("_alcon_lc", _arg1, _arg2, _arg3, _arg4, "");
};
}
public static function stop():void{
if (_fpsMeter){
_isPollingFPS = false;
_fpsMeter.stop();
_fpsMeter.removeEventListener(FPSMeter.FPS_UPDATE, onFPSUpdate);
_fpsMeter = null;
_stage = null;
};
}
public static function timerReset():void{
if (_stopWatch){
_stopWatch.reset();
};
}
private static function onFPSUpdate(_arg1:Event):void{
send("onFPS", ((((((_fpsMeter.fps + ",") + _stage.frameRate) + ",") + _fpsMeter.frt) + ",") + System.totalMemory));
}
public static function delimiter():void{
Debug.trace("[%DLT%]", 5);
}
public static function set enabled(_arg1:Boolean):void{
_isEnabled = _arg1;
}
public static function inspect(_arg1:Object):void{
send("onInspect", _arg1, 1, -1);
}
public static function timerStart(_arg1:String=""):void{
if (_isEnabled){
if (!_stopWatch){
_stopWatch = new StopWatch();
};
_stopWatch.start(_arg1);
};
}
public static function createCategory(_arg1:int, _arg2:String="", _arg3:uint=0, _arg4:uint=0xFFFF00):void{
send("onCategory", [_arg1, _arg2, _arg3, _arg4], 0, 0);
}
private static function storeDataLSO(_arg1:String, _arg2):void{
var flushResult:String;
var m = _arg1;
var d = _arg2;
var sharedObject:SharedObject = SharedObject.getLocal("alcon", "/");
sharedObject.data["alconMethod"] = m;
sharedObject.data["alconData"] = d;
try {
flushResult = sharedObject.flush();
if (flushResult == SharedObjectFlushStatus.FLUSHED){
return;
};
} catch(e:Error) {
Security.showSettings(SecurityPanel.LOCAL_STORAGE);
};
}
public static function hexDump(_arg1:Object):void{
send("onHexDump", _arg1, 0, 0);
}
private static function onStatus(_arg1:StatusEvent):void{
}
public static function get enabled():Boolean{
return (_isEnabled);
}
public static function trace(... _args):void{
var _local2:int = ((_args[1] is int)) ? _args[1] : 1;
if ((((_local2 >= _filterLevel)) && ((_local2 < 7)))){
send("onData", _args[0], _local2, 0);
};
}
public static function timerToString():void{
if (_stopWatch){
Debug.trace(_stopWatch.toString());
};
}
public static function mark(_arg1:uint=0xFF00FF):void{
send("onMarker", _arg1, 1, -1);
}
public static function timerInSeconds():void{
if (_stopWatch){
Debug.trace((_stopWatch.timeInSeconds + "s"));
};
}
public static function set filterLevel(_arg1:int):void{
if ((((_arg1 >= 0)) && ((_arg1 < 5)))){
_filterLevel = _arg1;
};
}
public static function monitor(_arg1:Stage, _arg2:int=500):void{
if (_isPollingFPS){
Debug.stop();
};
if (((_isEnabled) && (!(_fpsMeter)))){
_isPollingFPS = true;
_stage = _arg1;
sendCapabilities();
_fpsMeter = new FPSMeter(_stage, _arg2);
_fpsMeter.addEventListener(FPSMeter.FPS_UPDATE, onFPSUpdate);
_fpsMeter.start();
};
}
public static function time():void{
Debug.trace("[%TME%]", 5);
}
private static function sendCapabilities():void{
var _local3:XML;
var _local4:String;
var _local1:XML = describeType(Capabilities);
var _local2:Array = [];
for each (_local3 in _local1.*) {
_local4 = _local3.@name.toString();
if ((((((_local4.length > 0)) && (!((_local4 == "_internal"))))) && (!((_local4 == "prototype"))))){
_local2.push({p:_local4, v:Capabilities[_local4].toString()});
};
};
_local2.sortOn(["p"], Array.CASEINSENSITIVE);
send("onCap", _local2);
}
public static function clear():void{
Debug.trace("[%CLR%]", 5);
}
public static function timerStop():void{
if (_stopWatch){
_stopWatch.stop();
};
}
public static function timerInMilliSeconds():void{
if (_stopWatch){
Debug.trace((_stopWatch.timeInMilliSeconds + "ms"));
};
}
public static function get filterLevel():int{
return (_filterLevel);
}
public static function traceObj(_arg1:Object, _arg2:int=64, _arg3:int=1):void{
if ((((_arg3 >= _filterLevel)) && ((_arg3 < 7)))){
send("onData", _arg1, _arg3, _arg2);
};
}
public static function timerStopToString(_arg1:Boolean=false):void{
if (_stopWatch){
_stopWatch.stop();
Debug.trace(_stopWatch.toString());
if (_arg1){
_stopWatch.reset();
};
};
}
public static function pause():void{
Debug.trace("[%PSE%]", 5);
}
}
}//package alcon
Section 2
//FPSMeter (alcon.FPSMeter)
package alcon {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class FPSMeter extends EventDispatcher {
private var _delayMax:int;// = 10
private var _pollInterval:int;
private var _delay:int;
private var _ms:int;
private var _timer:Timer;
private var _prev:int;
private var _frt:int;
private var _fps:int;
private var _isRunning:Boolean;
private var _stage:Stage;
public static const FPS_UPDATE:String = "fpsUpdate";
public function FPSMeter(_arg1:Stage, _arg2:int=500){
_stage = _arg1;
_pollInterval = _arg2;
reset();
}
public function stop():void{
if (_isRunning){
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, onTimer);
_stage.removeEventListener(Event.ENTER_FRAME, onEnterFrame);
_timer = null;
reset();
};
}
public function reset():void{
_fps = 0;
_frt = 0;
_ms = 0;
_delay = 0;
_prev = 0;
_isRunning = false;
}
public function start():void{
if (!_isRunning){
_isRunning = true;
_timer = new Timer(_pollInterval, 0);
_timer.addEventListener(TimerEvent.TIMER, onTimer);
_stage.addEventListener(Event.ENTER_FRAME, onEnterFrame);
_timer.start();
};
}
private function onTimer(_arg1:TimerEvent):void{
dispatchEvent(new Event(FPSMeter.FPS_UPDATE));
}
public function get frt():int{
return (_frt);
}
public function get fps():int{
return (_fps);
}
private function onEnterFrame(_arg1:Event):void{
var _local2:Number = getTimer();
_delay++;
if (_delay >= _delayMax){
_delay = 0;
_fps = int(((1000 * _delayMax) / (_local2 - _prev)));
_prev = _local2;
};
_frt = (_local2 - _ms);
_ms = _local2;
}
}
}//package alcon
Section 3
//StopWatch (alcon.StopWatch)
package alcon {
import flash.utils.*;
public class StopWatch {
private var _stopTimeKeys:Array;
private var _startTimeKeys:Array;
private var _started:Boolean;// = false
private var _title:String;
public function StopWatch(){
reset();
}
public function get started():Boolean{
return (_started);
}
public function get timeInMilliSeconds():int{
if (_started){
_stopTimeKeys[(_startTimeKeys.length - 1)] = getTimer();
};
var _local1:int;
var _local2:int;
while (_local2 < _startTimeKeys.length) {
_local1 = (_local1 + (_stopTimeKeys[_local2] - _startTimeKeys[_local2]));
_local2++;
};
return (_local1);
}
public function stop():void{
var _local1:int;
if (_started){
_local1 = getTimer();
_stopTimeKeys[(_startTimeKeys.length - 1)] = _local1;
_started = false;
};
}
public function toString():String{
var _local3:int;
var _local4:int;
var _local1 = "\n ********************* [STOPWATCH] *********************";
if (_title != ""){
_local1 = (_local1 + ("\n * " + _title));
};
var _local2:int;
while (_local2 < _startTimeKeys.length) {
_local3 = _startTimeKeys[_local2];
_local4 = _stopTimeKeys[_local2];
_local1 = (_local1 + (((((("\n * started [" + format(_local3)) + "ms] stopped [") + format(_local4)) + "ms] time [") + format((_local4 - _local3))) + "ms]"));
_local2++;
};
if (_local2 == 0){
_local1 = (_local1 + "\n * never started.");
} else {
_local1 = (_local1 + (("\n * total runnning time: " + timeInSeconds) + "s"));
};
_local1 = (_local1 + "\n *******************************************************");
return (_local1);
}
public function get timeInSeconds():Number{
return ((timeInMilliSeconds / 1000));
}
public function reset():void{
_startTimeKeys = [];
_stopTimeKeys = [];
_started = false;
}
private function format(_arg1:int):String{
var _local2 = "";
var _local3:int = _arg1.toString().length;
var _local4:int;
while (_local4 < (5 - _local3)) {
_local2 = (_local2 + "0");
_local4++;
};
return ((_local2 + _arg1));
}
public function start(_arg1:String=""):void{
if (!_started){
_title = _arg1;
_started = true;
_startTimeKeys.push(getTimer());
};
}
}
}//package alcon
Section 4
//DelayedFunction (flesh.DelayedFunction)
package flesh {
public class DelayedFunction {
public var time:Number;
public var f:Function;
public function DelayedFunction(_arg1:Function, _arg2:Number){
this.f = _arg1;
this.time = _arg2;
}
public function update(_arg1:Number):Boolean{
time = (time - _arg1);
if (time <= 0){
f.call();
return (true);
};
return (false);
}
}
}//package flesh
Section 5
//DraggableSprite (flesh.DraggableSprite)
package flesh {
import flash.events.*;
import flash.display.*;
public class DraggableSprite {
public var mouseOffsetX:Number;
public var mouseOffsetY:Number;
public var sprite:Sprite;
public var beingDragged:Boolean;
public var startX:Number;
public var startY:Number;
public var dropFunction:Function;
public function DraggableSprite(_arg1:Sprite, _arg2:Function=null){
this.sprite = _arg1;
this.dropFunction = _arg2;
this.startX = _arg1.x;
this.startY = _arg1.y;
reset();
}
public function mouseDown(_arg1:MouseEvent):void{
mouseOffsetX = (sprite.x - sprite.root.mouseX);
mouseOffsetY = (sprite.y - sprite.root.mouseY);
this.sprite.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
this.sprite.addEventListener(MouseEvent.MOUSE_UP, mouseUp);
beingDragged = true;
}
public function mouseUp(_arg1:MouseEvent):void{
var _local2:Boolean;
this.sprite.removeEventListener(MouseEvent.MOUSE_UP, mouseUp);
if (dropFunction != null){
_local2 = dropFunction(sprite);
};
reset();
}
public function update(_arg1:Number):void{
if (beingDragged){
sprite.x = (sprite.root.mouseX + mouseOffsetX);
sprite.y = (sprite.root.mouseY + mouseOffsetY);
};
}
public function reset():void{
beingDragged = false;
sprite.x = startX;
sprite.y = startY;
this.sprite.addEventListener(MouseEvent.MOUSE_DOWN, mouseDown);
}
}
}//package flesh
Section 6
//FleshSound (flesh.FleshSound)
package flesh {
import flash.events.*;
import flash.media.*;
public class FleshSound {
private var fadeInVolume:Number;
private var stopOnFadeOut:Boolean;
private var defaultVolume:Number;
public var name:String;
private var sound:Sound;
private var channels:Array;
private var state:uint;
private var fadeVolumePerSecond:Number;
private var loopNextSound:Boolean;
private var urlString:String;
public var id:String;
private var transform:SoundTransform;
private var soundToPlayOnFadeOut:FleshSound;
private var type:uint;
public var filters:String;
private var multiMode:uint;
public static const MUSIC:uint = 0;
public static const SINGLETON:uint = 0;
public static const STATE_PLAYING:uint = 0;
public static const MULTIPLE:uint = 1;
public static const FX:uint = 1;
public static const STATE_FADING_IN:uint = 3;
public static const STATE_FADING_OUT:uint = 2;
public static const STATE_STOPPED:uint = 1;
public function FleshSound(_arg1:String, _arg2:Sound, _arg3:uint, _arg4:uint){
this.id = _arg1;
this.channels = new Array();
this.type = _arg3;
this.multiMode = _arg4;
this.urlString = urlString;
this.sound = _arg2;
transform = new SoundTransform(1, 0);
state = STATE_STOPPED;
}
public function fadeIn(_arg1:Boolean=false, _arg2:Number=0, _arg3:Number=0, _arg4:Number=-1):SoundChannel{
return (play(_arg1, _arg2, _arg3, _arg4));
}
public function loadFailed(_arg1:Event):void{
sound.removeEventListener(IOErrorEvent.IO_ERROR, loadFailed);
trace((" ** ERROR: Couldn't load sound " + getUrl()));
}
public function setDefaultVolume(_arg1:Number):void{
defaultVolume = _arg1;
}
public function play(_arg1:Boolean=false, _arg2:Number=0, _arg3:Number=0, _arg4:Number=-1, _arg5:Number=0):SoundChannel{
var _local6:Number = ((_arg4 == -1)) ? defaultVolume : _arg4;
if ((((((state == STATE_PLAYING)) && ((_arg3 > 0)))) && ((transform.volume == 0)))){
state = STATE_FADING_IN;
fadeInVolume = _local6;
return (null);
};
if ((((multiMode == SINGLETON)) && ((channels.length > 0)))){
stop();
};
transform.pan = _arg2;
if (_arg3 > 0){
fadeInVolume = _local6;
fadeVolumePerSecond = (fadeInVolume / _arg3);
state = STATE_FADING_IN;
trace(((("fading in sound " + id) + " fadeVolumePerSecond = ") + fadeVolumePerSecond));
} else {
state = STATE_PLAYING;
};
transform.volume = ((_arg3 > 0)) ? 0 : _local6;
var _local7:SoundChannel = sound.play((_arg5 * 1000), (_arg1) ? 100000 : 1, transform);
if (_local7 != null){
channels.push(_local7);
_local7.addEventListener(Event.SOUND_COMPLETE, soundFinished);
};
return (_local7);
}
public function getSound():Sound{
return (sound);
}
public function stop():void{
var _local1:uint;
while (_local1 < channels.length) {
channels[_local1].stop();
_local1++;
};
channels.splice(0);
state = STATE_STOPPED;
}
public function applyTransformToAllChannels():void{
var _local1:SoundChannel;
for each (_local1 in channels) {
_local1.soundTransform = transform;
};
}
public function stopChannel(_arg1:SoundChannel):void{
_arg1.stop();
var _local2:int = channels.indexOf(_arg1);
if (_local2 != -1){
channels.splice(_local2, 1);
_arg1.removeEventListener(Event.SOUND_COMPLETE, soundFinished);
};
}
public function soundFinished(_arg1:Event):void{
var _local2:SoundChannel = SoundChannel(_arg1.target);
_local2.removeEventListener(Event.SOUND_COMPLETE, soundFinished);
channels.splice(channels.indexOf(_local2), 1);
}
public function update(_arg1:Number):void{
var _local2:SoundChannel;
switch (state){
case STATE_FADING_OUT:
transform.volume = (transform.volume - (fadeVolumePerSecond * _arg1));
_local2 = (channels[0] as SoundChannel);
if (_local2 == null){
stop();
trace("strange sound problem");
return;
};
_local2.soundTransform = transform;
if (transform.volume <= 0){
transform.volume = 0;
_local2.soundTransform = transform;
if (stopOnFadeOut){
stop();
} else {
state = STATE_PLAYING;
};
if (soundToPlayOnFadeOut != null){
soundToPlayOnFadeOut.play(loopNextSound);
};
};
break;
case STATE_FADING_IN:
transform.volume = (transform.volume + (fadeVolumePerSecond * _arg1));
if (transform.volume >= fadeInVolume){
transform.volume = fadeInVolume;
state = STATE_PLAYING;
};
_local2 = (channels[0] as SoundChannel);
if (_local2 != null){
_local2.soundTransform = transform;
};
break;
};
}
public function fadeOut(_arg1:Boolean=true, _arg2:FleshSound=null, _arg3:Boolean=true, _arg4:Number=1):void{
if (channels.length == 0){
return;
};
this.soundToPlayOnFadeOut = _arg2;
this.loopNextSound = _arg3;
this.stopOnFadeOut = _arg1;
fadeVolumePerSecond = (transform.volume / _arg4);
state = STATE_FADING_OUT;
}
public function getType():uint{
return (type);
}
public function getUrl():String{
return (urlString);
}
public function loadComplete(_arg1:Event):void{
sound.removeEventListener(Event.COMPLETE, loadComplete);
SoundManager.notifySoundLoaded(this);
}
}
}//package flesh
Section 7
//FloatingText (flesh.FloatingText)
package flesh {
import flash.display.*;
public class FloatingText {
public var scaleAmount:Number;
public var sprite:Sprite;
public var parent:DisplayObjectContainer;
public var fadeSpeed:Number;
public var preFadeTime:Number;
public var dy:Number;
public function FloatingText(_arg1:DisplayObjectContainer, _arg2:Class, _arg3:String, _arg4:Number, _arg5:Number, _arg6:Number=-50, _arg7:Number=0.5, _arg8:Number=3, _arg9:Number=0, _arg10:int=0xFFFFFF){
this.parent = _arg1;
this.sprite = new (_arg2);
this.sprite["text"].text = _arg3;
this.sprite.x = _arg4;
this.sprite.y = _arg5;
this.sprite.cacheAsBitmap = true;
this.dy = _arg6;
this.scaleAmount = _arg9;
this.fadeSpeed = (1 / _arg8);
this.preFadeTime = _arg7;
if (_arg10 != 0xFFFFFF){
sprite["text"].textColor = _arg10;
};
_arg1.addChild(sprite);
}
public function update(_arg1:Number):void{
sprite.y = (sprite.y + (dy * _arg1));
sprite.scaleX = (sprite.scaleX + (scaleAmount * _arg1));
sprite.scaleY = sprite.scaleX;
if (preFadeTime > 0){
preFadeTime = (preFadeTime - _arg1);
} else {
sprite.alpha = (sprite.alpha - (fadeSpeed * _arg1));
if (sprite.alpha <= 0){
remove();
};
};
}
public function remove():void{
Utils.removeChild(sprite, parent);
Utils.removeFloatingText(this);
}
}
}//package flesh
Section 8
//ManagedPool (flesh.ManagedPool)
package flesh {
public class ManagedPool {
public var activePool:Array;
public var max:uint;
public var maxActiveObjectCount:uint;
public var inactivePool:Array;
private var id:String;
public function ManagedPool(_arg1:String, _arg2:PoolObject, _arg3:Number){
this.id = _arg1;
this.max = _arg3;
activePool = new Array(0);
inactivePool = new Array(_arg3);
var _local4:uint = _arg3;
while (--_local4 >= 0) {
inactivePool[_local4] = _arg2.createInstance(_local4);
inactivePool[_local4].active = false;
};
maxActiveObjectCount = 0;
}
public function paintAll(_arg1:Object):void{
var _local2:uint = activePool.length;
while (--_local2 >= 0) {
activePool[_local2].paint(_arg1);
};
}
public function getActiveObject(_arg1:uint):PoolObject{
return (activePool[_arg1]);
}
public function deactivateAll():void{
var _local2:PoolObject;
while (activePool.length > 0) {
_local2 = activePool.shift();
_local2.deactivate();
inactivePool.push(_local2);
};
var _local1:uint;
while (_local1 < inactivePool.length) {
_local2 = inactivePool[_local1];
_local2.index = _local1;
_local2.active = false;
_local1++;
};
}
private function getObjectAt(_arg1:uint):PoolObject{
var _local2:uint = activePool.length;
while (--_local2 >= 0) {
if (activePool[_local2].index == _arg1){
return (activePool[_local2]);
};
};
_local2 = inactivePool.length;
while (--_local2 >= 0) {
if (inactivePool[_local2].index == _arg1){
return (inactivePool[_local2]);
};
};
return (null);
}
public function setAllInactive():void{
deactivateAll();
}
public function getActiveObjectCount():uint{
return (activePool.length);
}
public function requestObject():PoolObject{
var _local1:uint;
var _local2:PoolObject;
if (inactivePool.length > 0){
_local1 = 0;
while (_local1 < inactivePool.length) {
_local2 = inactivePool[_local1];
if (!_local2.active){
inactivePool.splice(_local1, 1);
activePool.push(_local2);
if (activePool.length > maxActiveObjectCount){
maxActiveObjectCount = activePool.length;
};
_local2.active = true;
_local2.index = (activePool.length - 1);
return (_local2);
};
_local1++;
};
};
trace((("ManagedPool " + id) + " doesn't have enough objects"));
return (null);
}
public function updateAll(_arg1:Number):void{
var _local2:uint = activePool.length;
while (--_local2 >= 0) {
activePool[_local2].update(_arg1);
};
}
public function getMaxActiveObjectCount():int{
return (maxActiveObjectCount);
}
public function getRandomActiveObject():PoolObject{
var _local1:uint;
while (true) {
_local1 = Math.floor((Math.random() * activePool.length));
if (activePool[_local1].active){
return (activePool[_local1]);
};
};
return (null);
}
public function notifyDeactivated(_arg1:PoolObject):void{
_arg1.active = false;
var _local2:int = activePool.indexOf(_arg1);
if (_local2 != -1){
activePool.splice(_local2, 1);
};
var _local3:int = inactivePool.indexOf(_arg1);
if (_local3 == -1){
inactivePool.push(_arg1);
};
}
}
}//package flesh
Section 9
//PoolObject (flesh.PoolObject)
package flesh {
public class PoolObject {
public var index:uint;
public var active:Boolean;
public function PoolObject(_arg1:uint){
this.index = _arg1;
active = false;
}
public function createInstance(_arg1:uint):PoolObject{
return (undefined);
}
public function getIndex():uint{
return (index);
}
public function update(_arg1:Number):void{
}
public function deactivate():void{
active = false;
}
public function paint(_arg1:Object):void{
}
}
}//package flesh
Section 10
//SeededRandom (flesh.SeededRandom)
package flesh {
public class SeededRandom {
protected var _currentSeed:uint;// = 0
protected var _seed:uint;// = 0
protected static var _instance:SeededRandom;
public function SeededRandom(_arg1:uint=1){
_seed = (_currentSeed = _arg1);
}
public function set seed(_arg1:uint):void{
_seed = (_currentSeed = _arg1);
}
public function random():Number{
return ((((_currentSeed = ((_currentSeed * 16807) % 2147483647)) / 2147483647) + 2.33E-10));
}
public function boolean(_arg1:Number=0.5):Boolean{
return ((random() < _arg1));
}
public function get currentSeed():uint{
return (_currentSeed);
}
public function bit(_arg1:Number=0.5):int{
return (((random())<_arg1) ? 1 : 0);
}
public function reset():void{
_seed = _currentSeed;
}
public function get seed():uint{
return (_seed);
}
public function float(_arg1:Number, _arg2:Number=NaN):Number{
if (isNaN(_arg2)){
_arg2 = _arg1;
_arg1 = 0;
};
return (((random() * (_arg2 - _arg1)) + _arg1));
}
public function sign(_arg1:Number=0.5):int{
return (((random())<_arg1) ? 1 : -1);
}
public function integer(_arg1:Number, _arg2:Number=NaN):int{
if (isNaN(_arg2)){
_arg2 = _arg1;
_arg1 = 0;
};
return (Math.floor(float(_arg1, _arg2)));
}
public static function random():Number{
return (instance.random());
}
public static function set seed(_arg1:uint):void{
instance.seed = _arg1;
}
public static function get currentSeed():uint{
return (instance.currentSeed);
}
public static function bit(_arg1:Number=0.5):int{
return (instance.bit(_arg1));
}
public static function boolean(_arg1:Number=0.5):Boolean{
return (instance.boolean(_arg1));
}
public static function get seed():uint{
return (instance.seed);
}
public static function get instance():SeededRandom{
if (_instance == null){
_instance = new (SeededRandom);
};
return (_instance);
}
public static function reset():void{
instance.reset();
}
public static function float(_arg1:Number, _arg2:Number=NaN):Number{
return (instance.float(_arg1, _arg2));
}
public static function sign(_arg1:Number=0.5):int{
return (instance.sign(_arg1));
}
public static function integer(_arg1:Number, _arg2:Number=NaN):int{
return (instance.integer(_arg1, _arg2));
}
}
}//package flesh
Section 11
//SoundManager (flesh.SoundManager)
package flesh {
import flash.utils.*;
import flash.media.*;
public class SoundManager {
public static const CROSS_FADE_MUSIC_TIME:Number = 0.5;
public static const SOUND_DATA_PROPERTY_COUNT:uint = 4;
private static var soundCount:uint;
private static var sounds:Dictionary;
private static var instance:SoundManager;
private static var currentMusic:FleshSound;
private static var soundsArray:Array;
public static function getSoundsAsDictionary():Dictionary{
return (sounds);
}
public static function update(_arg1:Number):void{
var _local2:FleshSound;
for each (_local2 in sounds) {
_local2.update(_arg1);
};
}
public static function fadeInSound(_arg1:String):void{
var _local2:FleshSound = sounds[_arg1];
_local2.fadeIn();
}
public static function setNameAndFilters(_arg1:String, _arg2:String, _arg3:String):void{
var _local4:FleshSound = sounds[_arg1];
if (_local4 != null){
_local4.name = _arg2;
_local4.filters = _arg3;
} else {
trace(("couldn't find sound " + _arg1));
};
}
public static function getSound(_arg1:String):FleshSound{
if (sounds == null){
return (null);
};
return (sounds[_arg1]);
}
public static function stopAllSounds():void{
var _local1:FleshSound;
for each (_local1 in sounds) {
_local1.stop();
};
currentMusic = null;
}
public static function notifySoundLoaded(_arg1:FleshSound):void{
trace(("loaded " + _arg1.getUrl()));
}
public static function stopSound(_arg1:String):void{
var _local2:FleshSound = sounds[_arg1];
if (_local2 == currentMusic){
currentMusic = null;
};
_local2.stop();
}
public static function initStart(_arg1:Array):void{
sounds = new Dictionary();
soundsArray = new Array();
soundCount = 0;
currentMusic = null;
}
public static function getSoundsAsArray():Array{
return (soundsArray);
}
public static function embedSound(_arg1:Array, _arg2:Sound):void{
var _local3:uint = soundCount;
var _local4:uint = (_local3 * SOUND_DATA_PROPERTY_COUNT);
var _local5:String = _arg1[_local4];
var _local6:uint = _arg1[(_local4 + 1)];
var _local7:uint = _arg1[(_local4 + 2)];
var _local8:Number = _arg1[(_local4 + 3)];
var _local9:FleshSound = new FleshSound(_local5, _arg2, _local6, _local7);
_local9.setDefaultVolume(_local8);
sounds[_local5] = _local9;
soundsArray.push(_local9);
soundCount++;
}
public static function playSound(_arg1:String, _arg2:Boolean=false, _arg3:Number=0, _arg4:Number=-1):SoundChannel{
var _local5:FleshSound = sounds[_arg1];
if (_local5 == null){
trace(("sound not found " + _arg1));
return (null);
};
if (_local5.getType() == FleshSound.MUSIC){
if (currentMusic == null){
trace("currentMusic is null");
} else {
if (currentMusic.id == _local5.id){
return (null);
};
};
};
if ((((_local5.getType() == FleshSound.MUSIC)) && (!((currentMusic == null))))){
currentMusic.fadeOut(false, null, false, CROSS_FADE_MUSIC_TIME);
currentMusic = _local5;
return (_local5.play(_arg2, _arg3, CROSS_FADE_MUSIC_TIME, _arg4));
};
if (_local5.getType() == FleshSound.MUSIC){
currentMusic = _local5;
};
return (_local5.play(_arg2, _arg3, 0, _arg4));
}
public static function fadeOutSound(_arg1:String):void{
var _local2:FleshSound = sounds[_arg1];
if (_local2 == currentMusic){
currentMusic = null;
};
_local2.fadeOut();
}
}
}//package flesh
Section 12
//Utils (flesh.Utils)
package flesh {
import flash.display.*;
import flash.utils.*;
import flash.media.*;
import flash.geom.*;
import alcon.*;
public class Utils {
public static const OPPOSITE_DIR:Array = new Array(DOWN, UP, RIGHT, LEFT);
public static const MOVE:Array = new Array(0, -1, 0, 1, -1, 0, 1, 0);
public static var RAD30:Number = (Math.PI / 6);
public static var LEFT:uint = 2;
public static var RAD360:Number = (Math.PI * 2);
public static var RAD120:Number = ((Math.PI / 2) + (Math.PI / 6));
private static var mixerByteArray:ByteArray = null;
public static var RAD45:Number = (Math.PI / 4);
public static var RAD135:Number = (RAD45 + RAD90);
private static var delayedFunctions:Array = null;
public static var ANTICLOCKWISE:uint = 0;
public static var RAD270:Number = (RAD180 + RAD90);
public static var RAD315:Number = (RAD270 + RAD45);
public static var CLOCKWISE:uint = 1;
public static var allFloatingText:Array = null;
public static var RAD280:Number = (RAD270 + RAD10);
public static var UP:uint = 0;
public static var DOWN:uint = 1;
public static var RAD80:Number = (RAD90 - RAD10);
public static var RAD90:Number = (Math.PI / 2);
public static var RAD10:Number = (Math.PI / 18);
public static var RAD15:Number = (Math.PI / 12);
public static var RAD180:Number = Math.PI;
public static var RAD5:Number = (Math.PI / 36);
public static var RAD225:Number = (RAD180 + RAD45);
public static var RIGHT:uint = 3;
private static var draggingSprites:Array = null;
public static function getIndexOfString(_arg1:String, _arg2:Array, _arg3:int):int{
if (_arg1 == null){
return (_arg3);
};
var _local4:int = _arg2.indexOf(_arg1);
if (_local4 == -1){
return (_arg3);
};
return (_local4);
}
public static function paintRectOnSprite(_arg1:Sprite, _arg2:Number=0, _arg3:Number=0, _arg4:Number=1000, _arg5:Number=1000, _arg6:int=0xFF0000, _arg7:Number=1, _arg8:Boolean=false, _arg9:Number=1):void{
var _local10:Graphics = _arg1.graphics;
if (_arg8){
_local10.lineStyle(_arg9, _arg6, _arg7);
} else {
_local10.beginFill(_arg6, _arg7);
};
_local10.drawRect(_arg2, _arg3, _arg4, _arg5);
if (!_arg8){
_local10.endFill();
};
}
public static function getAngleBetweenAngles(_arg1:Number, _arg2:Number):Number{
if ((((_arg1 > RAD270)) && ((_arg2 < RAD90)))){
return (((RAD360 - _arg1) + _arg2));
};
if ((((_arg2 > RAD270)) && ((_arg1 < RAD90)))){
return (((RAD360 - _arg2) + _arg1));
};
return (Math.abs((_arg1 - _arg2)));
}
public static function removeChild(_arg1:DisplayObject, _arg2:DisplayObjectContainer=null):void{
if (_arg1 == null){
return;
};
if (_arg2 == null){
_arg2 = _arg1.parent;
};
if (((((!((_arg1 == null))) && (!((_arg2 == null))))) && (_arg2.contains(_arg1)))){
_arg2.removeChild(_arg1);
};
}
public static function ccw(_arg1:Vector2D, _arg2:Vector2D, _arg3:Vector2D):int{
var _local4:Number = (_arg2.x - _arg1.x);
var _local5:Number = (_arg2.y - _arg1.y);
var _local6:Number = (_arg3.x - _arg1.x);
var _local7:Number = (_arg3.y - _arg1.y);
if ((_local4 * _local7) > (_local5 * _local6)){
return (1);
};
if ((_local4 * _local7) < (_local5 * _local6)){
return (-1);
};
if (((((_local4 * _local6) < 0)) || (((_local5 * _local7) < 0)))){
return (-1);
};
if (((_local4 * _local4) + (_local5 * _local5)) < ((_local6 * _local6) + (_local7 * _local7))){
return (1);
};
return (0);
}
public static function getAngle(_arg1:Number, _arg2:Number):Number{
var _local3:Number = (Math.atan2(_arg2, _arg1) + (Math.PI / 2));
if (_local3 < 0){
_local3 = (_local3 + (Math.PI * 2));
};
return (_local3);
}
public static function trim(_arg1:String):String{
if (_arg1 == null){
return (_arg1);
};
var _local2:int;
while (_arg1.charCodeAt(_local2) < 33) {
_local2++;
};
var _local3:int = (_arg1.length - 1);
while (_arg1.charCodeAt(_local3) < 33) {
_local3--;
};
return (_arg1.substring(_local2, (_local3 + 1)));
}
public static function getInterpolatedColour(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (getInterpolatedColourUtil((0xFF & (_arg1 >> 24)), (0xFF & (_arg1 >> 16)), (0xFF & (_arg1 >> 8)), (0xFF & (_arg1 >> 0)), (0xFF & (_arg2 >> 24)), (0xFF & (_arg2 >> 16)), (0xFF & (_arg2 >> 8)), (0xFF & (_arg2 >> 0)), _arg3, _arg4));
}
public static function toDegrees(_arg1:Number):Number{
return (((_arg1 * 180) / Math.PI));
}
public static function encryptText(_arg1:String):String{
var _local5:int;
var _local2:SeededRandom = new SeededRandom(4435543);
var _local3 = "";
var _local4:uint;
while (_local4 < _arg1.length) {
_local5 = _arg1.charCodeAt(_local4);
if (_local5 > 34){
_local5 = (_local5 + _local2.integer(1, 4));
};
_local3 = (_local3 + String.fromCharCode(_local5));
_local4++;
};
return (_local3);
}
public static function getVectorBetweenLineAndPoint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Vector{
var _local7:Number = (_arg3 - _arg1);
var _local8:Number = (_arg4 - _arg2);
var _local9:Number = ((((_arg5 - _arg1) * _local7) + ((_arg6 - _arg2) * _local8)) / ((_local7 * _local7) + (_local8 * _local8)));
var _local10:Number = 0;
var _local11:Number = 0;
if ((((_local9 >= 0)) && ((_local9 <= 1)))){
_local10 = (_arg1 + int((_local9 * _local7)));
_local11 = (_arg2 + int((_local9 * _local8)));
} else {
if (_local9 < 0){
_local10 = _arg1;
_local11 = _arg2;
} else {
if (_local9 > 0){
_local10 = _arg3;
_local11 = _arg4;
};
};
};
_local7 = (_local10 - _arg5);
_local8 = (_local11 - _arg6);
return (new Vector(_local7, _local8));
}
public static function getMixerEQ(_arg1:uint=0, _arg2:uint=0x0200):Number{
var _local5:Number;
if (mixerByteArray == null){
mixerByteArray = new ByteArray();
};
SoundMixer.computeSpectrum(mixerByteArray, true);
var _local3:Number = 0;
var _local4:uint;
while (_local4 < 0x0200) {
_local5 = mixerByteArray.readFloat();
if ((((_local4 >= _arg1)) && ((_local4 < _arg2)))){
_local3 = (_local3 + _local5);
};
_local4++;
};
return ((_local3 / (_arg2 - _arg1)));
}
public static function clearFloatingText():void{
if (allFloatingText == null){
return;
};
while (allFloatingText.length > 0) {
allFloatingText[0].remove();
};
}
public static function updateDelayedFunctions(_arg1:Number):void{
if (delayedFunctions == null){
return;
};
var _local2:uint = delayedFunctions.length;
while (--_local2 >= 0) {
if (delayedFunctions[_local2].update(_arg1)){
delayedFunctions.splice(_local2, 1);
};
};
}
public static function getRandomElementFromChanceArray(_arg1:Array):int{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:uint;
var _local2:Number = 0;
for each (_local3 in _arg1) {
_local2 = (_local2 + _local3);
};
_local4 = (Math.random() * _local2);
_local5 = 0;
_local6 = 0;
while (_local6 < _arg1.length) {
_local5 = (_local5 + _arg1[_local6]);
if (_local4 < _local5){
return (_local6);
};
_local6++;
};
return (0);
}
public static function getRandomNumberInRange(_arg1:Number=0, _arg2:Number=1):Number{
return (((Math.random() * (_arg2 - _arg1)) + _arg1));
}
public static function decryptText(_arg1:String):String{
var _local5:int;
var _local2:SeededRandom = new SeededRandom(4435543);
var _local3 = "";
var _local4:uint;
while (_local4 < _arg1.length) {
_local5 = _arg1.charCodeAt(_local4);
if (_local5 > 34){
_local5 = (_local5 - _local2.integer(1, 4));
};
_local3 = (_local3 + String.fromCharCode(_local5));
_local4++;
};
return (_local3);
}
public static function duplicateDisplayObject(_arg1:DisplayObject, _arg2:Boolean=false):DisplayObject{
var _local5:Rectangle;
var _local3:Class = Object(_arg1).constructor;
var _local4:DisplayObject = new (_local3);
_local4.transform = _arg1.transform;
_local4.filters = _arg1.filters;
_local4.cacheAsBitmap = _arg1.cacheAsBitmap;
_local4.opaqueBackground = _arg1.opaqueBackground;
if (_arg1.scale9Grid){
_local5 = _arg1.scale9Grid;
_local4.scale9Grid = _local5;
};
if (((_arg2) && (_arg1.parent))){
_arg1.parent.addChild(_local4);
};
return (_local4);
}
public static function getDistanceBetweenPoints(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number = (_arg3 - _arg1);
var _local6:Number = (_arg4 - _arg2);
return (Math.sqrt(((_local5 * _local5) + (_local6 * _local6))));
}
public static function getPeakMixerEQ(_arg1:uint=0, _arg2:uint=0x0200):int{
var _local6:Number;
if (mixerByteArray == null){
mixerByteArray = new ByteArray();
};
SoundMixer.computeSpectrum(mixerByteArray, true);
var _local3:Number = 0;
var _local4 = -1;
var _local5:uint;
while (_local5 < 0x0200) {
_local6 = mixerByteArray.readFloat();
if ((((((_local5 >= _arg1)) && ((_local5 < _arg2)))) && ((_local6 > _local3)))){
_local3 = _local6;
_local4 = _local5;
};
_local5++;
};
return (_local4);
}
public static function formatDecimals(_arg1:Number, _arg2:uint):String{
var _local5:int;
var _local10:int;
var _local3:Number = Math.pow(10, _arg2);
var _local4:String = String((Math.round((_arg1 * _local3)) / _local3));
var _local6:int;
while (_local6 < _local4.length) {
if (_local4.charAt(_local6) == "."){
_local5 = _local6;
};
_local6++;
};
var _local7:String = _local4;
var _local8:String = _local4.substr((_local5 + 1), _local4.length);
var _local9:Number = (_arg2 - _local8.length);
if ((((_local8.length < _arg2)) && ((_local5 > 0)))){
_local10 = 0;
while (_local10 < _local9) {
_local7 = (_local7 + "0");
_local10++;
};
};
return (_local7);
}
public static function createFloatingText(_arg1:DisplayObjectContainer, _arg2:Class, _arg3:String, _arg4:Number, _arg5:Number, _arg6:Number=-50, _arg7:Number=0.5, _arg8:Number=3, _arg9:Number=0.1, _arg10:int=0xFFFFFF):void{
if (allFloatingText == null){
allFloatingText = new Array();
};
var _local11:FloatingText = new FloatingText(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10);
allFloatingText.push(_local11);
}
public static function paintCircleOnSprite(_arg1:Sprite, _arg2:int=3, _arg3:int=0xFF0000, _arg4:Number=1, _arg5:Boolean=false, _arg6:Number=1):void{
var _local7:Graphics = _arg1.graphics;
if (_arg5){
_local7.lineStyle(_arg6, _arg3, _arg4);
} else {
_local7.beginFill(_arg3, _arg4);
};
_local7.drawCircle(0, 0, _arg2);
if (!_arg5){
_local7.endFill();
};
}
public static function setSpriteColour(_arg1:Sprite, _arg2:int):void{
var _local3:ColorTransform = _arg1.transform.colorTransform;
_local3.color = _arg2;
_arg1.transform.colorTransform = _local3;
}
public static function toRadians(_arg1:Number):Number{
return (((_arg1 * Math.PI) / 180));
}
public static function delayFunction(_arg1:Function, _arg2:Number):void{
if (delayedFunctions == null){
delayedFunctions = new Array();
};
delayedFunctions.push(new DelayedFunction(_arg1, _arg2));
}
public static function paintMixerEQToSprite(_arg1:Sprite, _arg2:int=0xFF0000, _arg3:int=0):void{
var _local4:int;
var _local7:Number;
var _local8:Number;
if (mixerByteArray == null){
mixerByteArray = new ByteArray();
};
SoundMixer.computeSpectrum(mixerByteArray, true);
_arg1.graphics.clear();
var _local5 = !((_arg3 == 0));
if (!_local5){
_arg1.graphics.beginFill(_arg2);
};
_arg1.graphics.moveTo(0, 0);
var _local6:uint = 2;
_local4 = 0;
while (_local4 < 0x0100) {
if (_local5){
_arg1.graphics.beginFill(Utils.getInterpolatedColour(_arg2, _arg3, _local4, 0x0100));
};
_local7 = mixerByteArray.readFloat();
_local8 = (_local7 * 100);
_arg1.graphics.drawRect(_local4, 0, _local6, -(_local8));
if (_local5){
_arg1.graphics.endFill();
};
_local4 = (_local4 + _local6);
};
if (!_local5){
_arg1.graphics.endFill();
};
}
public static function stopDraggingSprite(_arg1:Sprite):void{
if (draggingSprites == null){
return;
};
var _local2:int = draggingSprites.indexOf(_arg1);
if (_local2 != -1){
draggingSprites.splice(_local2, 1);
};
}
public static function paintBigRedRectOnSprite(_arg1:Sprite, _arg2:Number=0, _arg3:Number=0, _arg4:Number=1000, _arg5:Number=1000):void{
var _local6:Graphics = _arg1.graphics;
_local6.beginFill(0xFF0000);
_local6.drawRect(_arg2, _arg3, _arg4, _arg5);
_local6.endFill();
}
public static function getFloatAttributeFromXML(_arg1:XML, _arg2:String, _arg3:Number=0):Number{
if (_arg1.attribute(_arg2).length() > 0){
return (parseFloat(_arg1.attribute(_arg2)));
};
return (_arg3);
}
public static function clearDraggingSprite():void{
if (draggingSprites != null){
draggingSprites.splice(0);
};
}
public static function getIntAttributeFromXML(_arg1:XML, _arg2:String, _arg3:int=0):int{
if (_arg1.attribute(_arg2).length() > 0){
return (parseInt(_arg1.attribute(_arg2)));
};
return (_arg3);
}
public static function updateFloatingText(_arg1:Number):void{
if (allFloatingText == null){
return;
};
var _local2:uint = allFloatingText.length;
while (--_local2 >= 0) {
allFloatingText[_local2].update(_arg1);
};
}
public static function getProjectedPoint2D(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Vector2D):void{
var _local5:Number = Math.sin(_arg3);
var _local6:Number = Math.cos(_arg3);
var _local7:Number = (_local6 * _arg1);
var _local8:Number = (_local5 * _arg1);
var _local9:Number = (_local6 * _arg2);
var _local10:Number = -((_local5 * _arg2));
_arg4.set((_local7 + _local10), (_local8 + _local9));
}
public static function getRandomIntInRange(_arg1:Number=0, _arg2:Number=1):int{
return (int(((Math.random() * (_arg2 - _arg1)) + _arg1)));
}
public static function clearDelayedFunctions():void{
if (delayedFunctions != null){
delayedFunctions.splice(0);
};
}
public static function getInterpolatedColourUtil(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number, _arg9:Number, _arg10:Number):Number{
var _local11:Number = (_arg10 - _arg9);
_arg1 = (((_arg5 * _arg9) + (_arg1 * _local11)) / _arg10);
_arg2 = (((_arg6 * _arg9) + (_arg2 * _local11)) / _arg10);
_arg3 = (((_arg7 * _arg9) + (_arg3 * _local11)) / _arg10);
_arg4 = (((_arg8 * _arg9) + (_arg4 * _local11)) / _arg10);
_arg1 = ((_arg1)>0xFF) ? 0xFF : ((_arg1)<0) ? 0 : _arg1;
_arg2 = ((_arg2)>0xFF) ? 0xFF : ((_arg2)<0) ? 0 : _arg2;
_arg3 = ((_arg3)>0xFF) ? 0xFF : ((_arg3)<0) ? 0 : _arg3;
_arg4 = ((_arg4)>0xFF) ? 0xFF : ((_arg4)<0) ? 0 : _arg4;
var _local12:Number = Math.round(_arg1);
var _local13:Number = Math.round(_arg2);
var _local14:Number = Math.round(_arg3);
var _local15:Number = Math.round(_arg4);
return (((((_local12 << 24) | (_local13 << 16)) | (_local14 << 8)) | _local15));
}
public static function getDistanceBetweenLineAndPoint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Number{
var _local7:Number = (_arg3 - _arg1);
var _local8:Number = (_arg4 - _arg2);
var _local9:Number = ((((_arg5 - _arg1) * _local7) + ((_arg6 - _arg2) * _local8)) / ((_local7 * _local7) + (_local8 * _local8)));
var _local10:Number = 0;
var _local11:Number = 0;
if ((((_local9 >= 0)) && ((_local9 <= 1)))){
_local10 = (_arg1 + int((_local9 * _local7)));
_local11 = (_arg2 + int((_local9 * _local8)));
} else {
if (_local9 < 0){
_local10 = _arg1;
_local11 = _arg2;
} else {
if (_local9 > 0){
_local10 = _arg3;
_local11 = _arg4;
};
};
};
_local7 = (_local10 - _arg5);
_local8 = (_local11 - _arg6);
var _local12:Number = Math.sqrt(((_local7 * _local7) + (_local8 * _local8)));
return (_local12);
}
public static function getTurnDirection(_arg1:Number, _arg2:Number):int{
var _local3:Number;
var _local4:Number;
if (_arg2 >= _arg1){
_local3 = (_arg2 - _arg1);
_local4 = ((RAD360 - _arg2) + _arg1);
if (_local3 <= _local4){
return (1);
};
return (-1);
//unresolved jump
};
_local3 = (_arg1 - _arg2);
_local4 = ((RAD360 - _arg1) + _arg2);
if (_local3 <= _local4){
return (-1);
};
return (1);
}
public static function replaceCharactersInText(_arg1:String, _arg2:int, _arg3:int):String{
var _local6:int;
if (_arg1.indexOf(String.fromCharCode(_arg3)) != -1){
Debug.trace(("Utils.replaceCharactersInText already has character " + _arg3));
trace(("Utils.replaceCharactersInText already has character " + _arg3));
};
var _local4 = "";
var _local5:uint;
while (_local5 < _arg1.length) {
_local6 = _arg1.charCodeAt(_local5);
if (_local6 == _arg2){
_local6 = _arg3;
};
_local4 = (_local4 + String.fromCharCode(_local6));
_local5++;
};
return (_local4);
}
public static function getBooleanAttributeFromXML(_arg1:XML, _arg2:String, _arg3:Boolean=false):Boolean{
if (_arg1.attribute(_arg2).length() > 0){
return ((_arg1.attribute(_arg2) == "true"));
};
return (_arg3);
}
public static function getSquaredDistanceBetweenPoints(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
var _local5:Number = (_arg3 - _arg1);
var _local6:Number = (_arg4 - _arg2);
return (((_local5 * _local5) + (_local6 * _local6)));
}
public static function getVector2DBetweenLineAndPoint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Vector2D{
var _local7:Number = (_arg3 - _arg1);
var _local8:Number = (_arg4 - _arg2);
var _local9:Number = ((((_arg5 - _arg1) * _local7) + ((_arg6 - _arg2) * _local8)) / ((_local7 * _local7) + (_local8 * _local8)));
var _local10:Number = 0;
var _local11:Number = 0;
if ((((_local9 >= 0)) && ((_local9 <= 1)))){
_local10 = (_arg1 + int((_local9 * _local7)));
_local11 = (_arg2 + int((_local9 * _local8)));
} else {
if (_local9 < 0){
_local10 = _arg1;
_local11 = _arg2;
} else {
if (_local9 > 0){
_local10 = _arg3;
_local11 = _arg4;
};
};
};
_local7 = (_local10 - _arg5);
_local8 = (_local11 - _arg6);
return (new Vector2D(_local7, _local8));
}
public static function getProjectedPoint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Vector):void{
var _local5:Number = Math.sin(_arg3);
var _local6:Number = Math.cos(_arg3);
var _local7:Number = (_local6 * _arg1);
var _local8:Number = (_local5 * _arg1);
var _local9:Number = (_local6 * _arg2);
var _local10:Number = -((_local5 * _arg2));
_arg4.set((_local7 + _local10), (_local8 + _local9));
}
public static function linesIntersect(_arg1:Vector2D, _arg2:Vector2D, _arg3:Vector2D, _arg4:Vector2D):Boolean{
return (((((ccw(_arg1, _arg2, _arg3) * ccw(_arg1, _arg2, _arg4)) <= 0)) && (((ccw(_arg3, _arg4, _arg1) * ccw(_arg3, _arg4, _arg2)) <= 0))));
}
public static function startDraggingSprite(_arg1:Sprite, _arg2:Function=null):void{
if (draggingSprites == null){
draggingSprites = new Array();
};
draggingSprites.push(new DraggableSprite(_arg1, _arg2));
}
public static function removeFloatingText(_arg1:FloatingText):void{
var _local2:int = allFloatingText.indexOf(_arg1);
if (_local2 != -1){
allFloatingText.splice(_local2, 1);
};
}
public static function getStringAttributeFromXML(_arg1:XML, _arg2:String, _arg3:String=null):String{
if (_arg1.attribute(_arg2).length() > 0){
return (_arg1.attribute(_arg2));
};
return (_arg3);
}
public static function addChild(_arg1:DisplayObject, _arg2:DisplayObjectContainer):void{
if (((((!((_arg1 == null))) && (!((_arg2 == null))))) && (!(_arg2.contains(_arg1))))){
_arg2.addChild(_arg1);
};
}
public static function updateDraggingSprites(_arg1:Number):void{
if (draggingSprites == null){
return;
};
var _local2:uint = draggingSprites.length;
while (--_local2 >= 0) {
draggingSprites[_local2].update(_arg1);
};
}
}
}//package flesh
Section 13
//Vector (flesh.Vector)
package flesh {
public class Vector {
public var y:Number;
public var x:Number;
public function Vector(_arg1:Number, _arg2:Number){
x = _arg1;
y = _arg2;
}
public function getUnitNormal():Vector{
var _local1:Vector = new Vector(y, -(x));
_local1.unit();
return (_local1);
}
public function addVector(_arg1:Vector):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function setVector(_arg1:Vector):void{
x = _arg1.x;
y = _arg1.y;
}
public function addNew(_arg1:Vector):Vector{
return (new Vector((x - _arg1.x), (y - _arg1.y)));
}
public function unit():Number{
var _local1:Number = Math.sqrt(((x * x) + (y * y)));
if (_local1 > 0){
x = (x / _local1);
y = (y / _local1);
return (_local1);
};
return (0);
}
public function subtract(_arg1:Number, _arg2:Number):void{
x = (x - _arg1);
y = (y - _arg2);
}
public function invert():void{
x = -(x);
y = -(y);
}
public function multiplyNew(_arg1:Number):Vector{
return (new Vector((x * _arg1), (y * _arg1)));
}
public function square():void{
x = (x * x);
y = (y * y);
}
public function add(_arg1:Number, _arg2:Number):void{
x = (x + _arg1);
y = (y + _arg2);
}
public function set(_arg1:Number, _arg2:Number):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 subtractNew(_arg1:Vector):Vector{
return (new Vector((x - _arg1.x), (y - _arg1.y)));
}
public function dotProduct(_arg1:Vector):Number{
return (((this.x * _arg1.x) + (this.y * _arg1.y)));
}
public function makeNormal():void{
var _local1:Number = x;
x = y;
y = -(_local1);
}
public function subtractVector(_arg1:Vector):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function divide(_arg1:Number):void{
x = (x / _arg1);
y = (y / _arg1);
}
public function toString():String{
return (((x + ",") + y));
}
public function getSquaredLength():Number{
return (((x * x) + (y * y)));
}
public function clone():Vector{
return (new Vector(x, y));
}
public static function getRandomVectorBetween(_arg1:Vector, _arg2:Vector):Vector{
var _local3:Vector = _arg2.clone();
_local3.subtractVector(_arg1);
_local3.multiply(Math.random());
_local3.addVector(_arg1);
return (_local3);
}
}
}//package flesh
Section 14
//Vector2D (flesh.Vector2D)
package flesh {
public class Vector2D {
public var y:Number;
public var x:Number;
public function Vector2D(_arg1:Number, _arg2:Number){
x = _arg1;
y = _arg2;
}
public function getUnitNormal():Vector2D{
var _local1:Vector2D = new Vector2D(y, -(x));
_local1.unit();
return (_local1);
}
public function addVector(_arg1:Vector2D):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function setVector(_arg1:Vector2D):void{
x = _arg1.x;
y = _arg1.y;
}
public function addNew(_arg1:Vector2D):Vector2D{
return (new Vector2D((x - _arg1.x), (y - _arg1.y)));
}
public function unit():Number{
var _local1:Number = Math.sqrt(((x * x) + (y * y)));
if (_local1 > 0){
x = (x / _local1);
y = (y / _local1);
return (_local1);
};
return (0);
}
public function subtract(_arg1:Number, _arg2:Number):void{
x = (x - _arg1);
y = (y - _arg2);
}
public function invert():void{
x = -(x);
y = -(y);
}
public function multiplyNew(_arg1:Number):Vector2D{
return (new Vector2D((x * _arg1), (y * _arg1)));
}
public function square():void{
x = (x * x);
y = (y * y);
}
public function add(_arg1:Number, _arg2:Number):void{
x = (x + _arg1);
y = (y + _arg2);
}
public function set(_arg1:Number, _arg2:Number):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 subtractNew(_arg1:Vector2D):Vector2D{
return (new Vector2D((x - _arg1.x), (y - _arg1.y)));
}
public function dotProduct(_arg1:Vector2D):Number{
return (((this.x * _arg1.x) + (this.y * _arg1.y)));
}
public function makeNormal():void{
var _local1:Number = x;
x = y;
y = -(_local1);
}
public function subtractVector(_arg1:Vector2D):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function divide(_arg1:Number):void{
x = (x / _arg1);
y = (y / _arg1);
}
public function toString():String{
return (((x + ",") + y));
}
public function getSquaredLength():Number{
return (((x * x) + (y * y)));
}
public function clone():Vector2D{
return (new Vector2D(x, y));
}
public static function getRandomVectorBetween(_arg1:Vector2D, _arg2:Vector2D):Vector2D{
var _local3:Vector2D = _arg2.clone();
_local3.subtractVector(_arg1);
_local3.multiply(Math.random());
_local3.addVector(_arg1);
return (_local3);
}
}
}//package flesh
Section 15
//EdgeMetrics (mx.core.EdgeMetrics)
package mx.core {
public class EdgeMetrics {
public var top:Number;
public var left:Number;
public var bottom:Number;
public var right:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0);
;
public function EdgeMetrics(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){
this.left = _arg1;
this.top = _arg2;
this.right = _arg3;
this.bottom = _arg4;
}
public function clone():EdgeMetrics{
return (new EdgeMetrics(left, top, right, bottom));
}
}
}//package mx.core
Section 16
//FlexSprite (mx.core.FlexSprite)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexSprite extends Sprite {
mx_internal static const VERSION:String = "3.0.0.0";
public function FlexSprite(){
super();
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 17
//IBorder (mx.core.IBorder)
package mx.core {
public interface IBorder {
function get borderMetrics():EdgeMetrics;
}
}//package mx.core
Section 18
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 19
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.accessibility.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get visible():Boolean;
function get rotation():Number;
function localToGlobal(_arg1:Point):Point;
function get name():String;
function set width(_arg1:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(_arg1:String):void;
function set scaleX(_arg1:Number):void;
function set scaleY(_arg1:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(_arg1:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(_arg1:Point):Point;
function get height():Number;
function set blendMode(_arg1:String):void;
function get parent():DisplayObjectContainer;
function getBounds(_arg1:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(_arg1:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(_arg1:Number):void;
function set accessibilityProperties(_arg1:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(_arg1:Boolean):void;
function get scaleX():Number;
function get scaleY():Number;
function get scrollRect():Rectangle;
function get mouseX():Number;
function get mouseY():Number;
function set height(_arg1:Number):void;
function set mask(_arg1:DisplayObject):void;
function getRect(_arg1:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(_arg1:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(_arg1:DisplayObject):Boolean;
function set opaqueBackground(_arg1:Object):void;
function set visible(_arg1:Boolean):void;
function get mask():DisplayObject;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function get transform():Transform;
function set filters(_arg1:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(_arg1:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 20
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(_arg1:Array):void;
function get isDocument():Boolean;
function set repeaters(_arg1:Array):void;
function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(_arg1:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 21
//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 22
//SoundAsset (mx.core.SoundAsset)
package mx.core {
import flash.media.*;
public class SoundAsset extends Sound implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
}
}//package mx.core
Section 23
//SpriteAsset (mx.core.SpriteAsset)
package mx.core {
public class SpriteAsset extends FlexSprite implements IFlexAsset, IFlexDisplayObject, IBorder {
private var _measuredHeight:Number;
private var _measuredWidth:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public function SpriteAsset(){
_measuredWidth = width;
_measuredHeight = height;
}
public function get measuredWidth():Number{
return (_measuredWidth);
}
public function get measuredHeight():Number{
return (_measuredHeight);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
public function get borderMetrics():EdgeMetrics{
if (scale9Grid == null){
return (EdgeMetrics.EMPTY);
};
return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil((measuredWidth - scale9Grid.right)), Math.ceil((measuredHeight - scale9Grid.bottom))));
}
}
}//package mx.core
Section 24
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import flash.utils.*;
import mx.core.*;
public class NameUtil {
mx_internal static const VERSION:String = "3.0.0.0";
private static var counter:int = 0;
public static function displayObjectToString(_arg1:DisplayObject):String{
var _local2:String;
var _local4:String;
var _local5:Array;
var _local3:DisplayObject = _arg1;
while (_local3 != null) {
if (((((_local3.parent) && (_local3.stage))) && ((_local3.parent == _local3.stage)))){
break;
};
_local4 = _local3.name;
if ((_local3 is IRepeaterClient)){
_local5 = IRepeaterClient(_local3).instanceIndices;
if (_local5){
_local4 = (_local4 + (("[" + _local5.join("][")) + "]"));
};
};
_local2 = ((_local2 == null)) ? _local4 : ((_local4 + ".") + _local2);
_local3 = _local3.parent;
};
return (_local2);
}
public static function createUniqueName(_arg1:Object):String{
if (!_arg1){
return (null);
};
var _local2:String = getQualifiedClassName(_arg1);
var _local3:int = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
var _local4:int = _local2.charCodeAt((_local2.length - 1));
if ((((_local4 >= 48)) && ((_local4 <= 57)))){
_local2 = (_local2 + "_");
};
return ((_local2 + counter++));
}
}
}//package mx.utils
Section 25
//Eyja (Eyja)
package {
import flash.events.*;
import flash.display.*;
public class Eyja extends Sprite {
public var gameScreen:GameScreen;
public function Eyja(){
gameScreen = new GameScreen();
this.addChild(gameScreen);
addEventListener(Event.ENTER_FRAME, gameScreen.update, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, gameScreen.mouseDown, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, gameScreen.mouseUp, false, 0, true);
addEventListener(MouseEvent.MOUSE_MOVE, gameScreen.mouseMove, false, 0, true);
}
}
}//package
Section 26
//GameScreen (GameScreen)
package {
import flash.events.*;
import flesh.*;
import flash.display.*;
import flash.utils.*;
import flash.system.*;
import flash.text.*;
public dynamic class GameScreen extends Sprite {
public var ejaSoundTime:Number;
public var chainLostFadeTime:Number;
public var state:int;
public var coneX:Number;
public var timeSinceLastPlaneDowned:Number;
public var maxPlanes:int;
public var coneY:Number;
public var displayDeathToll:int;
public var chainClip:Sprite;
public var planesDownedCount:int;
public var panicOn:Boolean;
public var chain:int;
public var planeTime:Number;
public var chainFadeTime:Number;
public var bestDeathToll:int;
public var deathToll:int;
public var gameSprite:Sprite;
public var smokeTime:Number;
public var increaseMaxPlanesTime:Number;
public var panicClip:MovieClip;
private var lastUpdateTime:Number;
private var mouseIsDown:Boolean;
public var timeLeft:Number;
public var chainLostClip:Sprite;
public static const STATE_GAME:int = 0;
public static const STATE_TITLE:int = 2;
public static const CHAIN_TIME:int = 4;
public static const LEVEL_TIME:int = 90;
public static const STATE_GAMEOVER:int = 1;
public static var instance:GameScreen;
public function GameScreen(){
instance = this;
SoundManager.initStart(SoundData.SOUND_DATA);
SoundData.initStart();
gameSprite = new Sprite();
this.addChildAt(gameSprite, 2);
Smoke.initStart();
Plane.initStart();
lastUpdateTime = getTimer();
var _local1:Sprite = this["cone"];
panicClip = this["panic"];
chainClip = this["chainClip"];
chainLostClip = this["chainLostClip"];
coneX = _local1.x;
coneY = _local1.y;
ejaSoundTime = 0;
deathToll = 0;
bestDeathToll = 0;
state = STATE_TITLE;
}
public function chainLost():void{
if (chain > 1){
chainLostFadeTime = 2;
};
chain = 0;
}
public function setPlanesDownedText():void{
if (planesDownedCount == 1){
this["planesDownedText"].text = "Downed 1 plane";
} else {
this["planesDownedText"].text = (("Downed " + planesDownedCount) + " planes");
};
this["deathTollText"].text = ("Death Toll: " + displayDeathToll);
}
public function mouseUp(_arg1:MouseEvent):void{
mouseIsDown = false;
}
public function chainIncreased():void{
chain++;
if (chain > 1){
chainClip["chainCountText"].text = ("" + chain);
chainFadeTime = 2;
};
}
public function mouseMove(_arg1:MouseEvent):void{
}
public function notifyPlaneDowned():void{
planesDownedCount++;
deathToll = (deathToll + (100 * (chain + 1)));
if (timeSinceLastPlaneDowned < CHAIN_TIME){
chainIncreased();
} else {
chainLost();
};
timeSinceLastPlaneDowned = 0;
setPlanesDownedText();
}
public function setTimeLeftText():void{
this["timeText"].text = (("Time Left: " + Math.floor(timeLeft)) + " secs");
}
public function update(_arg1:Event):void{
var _local5:int;
var _local6:int;
var _local7:Number;
var _local2:Number = getTimer();
var _local3:Number = ((_local2 - lastUpdateTime) / 1000);
lastUpdateTime = _local2;
SoundManager.update(_local3);
var _local4:int = (deathToll - displayDeathToll);
if (_local4 > 0){
if (_local4 >= 100){
displayDeathToll = (displayDeathToll + 100);
} else {
if (_local4 >= 10){
displayDeathToll = (displayDeathToll + 10);
} else {
displayDeathToll++;
};
};
this["deathTollText"].text = ("Death Toll: " + displayDeathToll);
};
switch (state){
case STATE_TITLE:
ejaSoundTime = (ejaSoundTime - _local3);
if (ejaSoundTime < 0){
ejaSoundTime = (0.5 + (Math.random() * 0.5));
playSoundPanned(("EJA" + Math.floor((Math.random() * 4))), (Math.random() * 640));
};
break;
case STATE_GAME:
timeSinceLastPlaneDowned = (timeSinceLastPlaneDowned + _local3);
if (chainFadeTime > 0){
chainFadeTime = (chainFadeTime - _local3);
};
if ((((chainFadeTime > 0)) && ((chainClip.alpha < 1)))){
chainClip.alpha = (chainClip.alpha + (_local3 * 4));
};
if ((((chainFadeTime <= 0)) && ((chainClip.alpha > 0)))){
chainClip.alpha = (chainClip.alpha - (_local3 * 4));
};
if (chainLostFadeTime > 0){
chainLostFadeTime = (chainLostFadeTime - _local3);
};
if ((((chainLostFadeTime > 0)) && ((chainLostClip.alpha < 1)))){
chainLostClip.alpha = (chainLostClip.alpha + (_local3 * 4));
};
if ((((chainLostFadeTime <= 0)) && ((chainLostClip.alpha > 0)))){
chainLostClip.alpha = (chainLostClip.alpha - (_local3 * 4));
};
panicOn = false;
_local5 = Math.floor(timeLeft);
timeLeft = (timeLeft - _local3);
_local6 = Math.floor(timeLeft);
if (_local6 != _local5){
setTimeLeftText();
};
if (_local6 == 0){
state = STATE_GAMEOVER;
this["gameOver"].visible = true;
};
smokeTime = (smokeTime + _local3);
if (smokeTime > 0.1){
smokeTime = 0;
Smoke.create(coneX, coneY, ((Math.random() * Utils.RAD45) - Utils.RAD30));
};
increaseMaxPlanesTime = (increaseMaxPlanesTime + _local3);
if (increaseMaxPlanesTime > 7){
increaseMaxPlanesTime = 0;
maxPlanes++;
};
if (Plane.pool.getActiveObjectCount() < maxPlanes){
planeTime = (planeTime + _local3);
if (planeTime > 0.5){
planeTime = 0;
if (Math.random() < 0.5){
Plane.create((120 + (Math.random() * 400)), 700, ((Math.random() * Utils.RAD30) - Utils.RAD15));
} else {
Plane.create(700, (120 + (Math.random() * 400)), ((Utils.RAD270 + (Math.random() * Utils.RAD30)) - Utils.RAD15));
};
};
};
Smoke.pool.updateAll(_local3);
Plane.pool.updateAll(_local3);
Plane.checkSmokeAll();
Smoke.blowAllToward(mouseX, mouseY);
Plane.blowAllCrashingToward(mouseX, mouseY);
if (panicOn){
_local7 = (494 - panicClip.x);
} else {
_local7 = (640 - panicClip.x);
};
panicClip.x = (panicClip.x + (_local7 * 0.25));
break;
};
}
public function playMusic(_arg1:String):void{
SoundManager.playSound(_arg1, true);
}
public function resetGame():void{
if (deathToll > bestDeathToll){
bestDeathToll = deathToll;
};
this["bestDeathTollText"].text = ("Best Death Toll: " + bestDeathToll);
chainFadeTime = 0;
chainLostFadeTime = 0;
smokeTime = 0;
planeTime = 0;
maxPlanes = 1;
timeLeft = LEVEL_TIME;
timeSinceLastPlaneDowned = 0;
chain = 0;
chainClip.alpha = 0;
planesDownedCount = 0;
increaseMaxPlanesTime = 0;
deathToll = (displayDeathToll = 0);
setTimeLeftText();
Smoke.pool.deactivateAll();
Plane.pool.deactivateAll();
chainLostClip.alpha = 0;
chainClip.alpha = 0;
setPlanesDownedText();
panicClip.x = 640;
state = STATE_GAME;
playMusic("MUSIC");
this["title"].visible = false;
this["gameOver"].visible = false;
}
public function playSoundPanned(_arg1:String, _arg2:Number, _arg3:Number=-1):void{
SoundManager.playSound(_arg1, false, (((_arg2 / 640) * 2) - 1), _arg3);
}
public function mouseDown(_arg1:MouseEvent):void{
mouseIsDown = true;
if ((((state == STATE_GAMEOVER)) || ((state == STATE_TITLE)))){
resetGame();
};
}
}
}//package
Section 27
//Plane (Plane)
package {
import flash.events.*;
import flesh.*;
import flash.display.*;
import flash.media.*;
public class Plane extends PoolObject {
public var sprite:Sprite;
public var lifetime:Number;
public var planeClip:MovieClip;
public var dir:Vector2D;
public var state:int;
public var crashTime:Number;
public var pos:Vector2D;
public var explosionClip:MovieClip;
public var rippleClip:MovieClip;
private var PlaneSprite:Class;
public var crashingChannel:SoundChannel;
public var turnAmount:Number;
public var shakeAmount:Number;
public static const MAX:uint = 100;
public static const CRASH_TIME:Number = 4;
public static const INITIAL_SPEED:Number = 3;
public static const PLANE_COLLIDE_DIST:Number = 36;
public static const SMOKE_DIST:Number = 48;
public static const BLOW_POWER:Number = 0.7;
public static const STATE_ENGINES_FAIL:int = 1;
public static const EXPLODE_CHAIN_REACTION_DIST:Number = 70;
public static const TURN_AMOUNT:Number = 0.5;
public static const STATE_EXPLODE:int = 3;
public static const STATE_NORMAL:int = 0;
public static const STATE_CRASH:int = 2;
public static var pool:ManagedPool;
public function Plane(_arg1:uint){
PlaneSprite = Plane_PlaneSprite;
super(_arg1);
sprite = new PlaneSprite();
pos = new Vector2D(0, 0);
dir = new Vector2D(0, 0);
rippleClip = sprite["ripple"];
planeClip = sprite["thePlane"];
explosionClip = sprite["explosionClip"];
}
public function checkSmoke():void{
var _local1:Smoke;
var _local2:Vector2D;
for each (_local1 in Smoke.pool.activePool) {
if (_local1.state == Smoke.STATE_SUCKED){
} else {
_local2 = new Vector2D((_local1.pos.x - pos.x), (_local1.pos.y - pos.y));
if (_local2.length() < SMOKE_DIST){
GameScreen.instance.playSoundPanned(("ENGINEDIE" + Math.floor((Math.random() * 2))), pos.x);
_local1.suckIntoPlane(this);
hitSmoke();
};
};
};
}
public function blowToward(_arg1:Number, _arg2:Number):void{
var _local3:Vector2D = new Vector2D((_arg1 - pos.x), (_arg2 - pos.y));
var _local4:Number = _local3.unit();
if (_local4 > Smoke.BLOW_RADIUS){
return;
};
var _local5:Number = 1;
_local3.multiply((_local5 * BLOW_POWER));
dir.add(_local3.x, _local3.y);
}
public function init(_arg1:Number, _arg2:Number, _arg3:Number):void{
state = STATE_NORMAL;
pos.set(_arg1, _arg2);
planeClip.visible = true;
rippleClip.visible = false;
explosionClip.visible = false;
planeClip.alpha = 1;
crashingChannel = null;
planeClip.gotoAndStop(1);
dir.set((Math.sin(_arg3) * INITIAL_SPEED), (-(Math.cos(_arg3)) * INITIAL_SPEED));
sprite.x = _arg1;
sprite.y = _arg2;
lifetime = 0;
crashTime = 0;
sprite.scaleX = (sprite.scaleY = 1);
shakeAmount = 0;
turnAmount = (((Math.random() * TURN_AMOUNT) * 2) - TURN_AMOUNT);
Utils.addChild(sprite, GameScreen.instance.gameSprite);
}
public function hitSmoke():void{
state = STATE_ENGINES_FAIL;
shakeAmount = (shakeAmount + 1);
if (((!((state == STATE_CRASH))) && ((shakeAmount > 8)))){
planeClip.gotoAndStop(2);
state = STATE_CRASH;
crashingChannel = SoundManager.playSound("PLANECRASH", false, (((pos.x / 640) * 2) - 1));
};
}
public function explosionUpdated(_arg1:Event):void{
if (explosionClip.currentFrame == explosionClip.totalFrames){
explosionClip.removeEventListener(Event.ENTER_FRAME, explosionUpdated);
deactivate();
};
}
public function rippleUpdated(_arg1:Event):void{
if (rippleClip.currentFrame == rippleClip.totalFrames){
rippleClip.removeEventListener(Event.ENTER_FRAME, rippleUpdated);
deactivate();
};
}
public function explode():void{
var _local1:Plane;
var _local2:Number;
if (state == STATE_EXPLODE){
return;
};
if (rippleClip.visible){
return;
};
state = STATE_EXPLODE;
GameScreen.instance.notifyPlaneDowned();
explosionClip.gotoAndPlay(1);
explosionClip.visible = true;
explosionClip.addEventListener(Event.ENTER_FRAME, explosionUpdated);
if (crashingChannel != null){
crashingChannel.stop();
crashingChannel = null;
};
GameScreen.instance.playSoundPanned("BOOM", pos.x);
for each (_local1 in pool.activePool) {
if (_local1 == this){
} else {
if (_local1.state == STATE_EXPLODE){
} else {
_local2 = Utils.getDistanceBetweenPoints(pos.x, pos.y, _local1.pos.x, _local1.pos.y);
if (_local2 < EXPLODE_CHAIN_REACTION_DIST){
_local1.explode();
};
};
};
};
}
override public function createInstance(_arg1:uint):PoolObject{
return (new Plane(_arg1));
}
override public function deactivate():void{
active = false;
pool.notifyDeactivated(this);
Utils.removeChild(sprite);
}
override public function update(_arg1:Number):void{
if (state == STATE_EXPLODE){
planeClip.alpha = (planeClip.alpha - (_arg1 * 3));
};
if (state == STATE_CRASH){
GameScreen.instance.panicOn = true;
if (rippleClip.visible == false){
crashTime = (crashTime + _arg1);
if (crashTime > CRASH_TIME){
sprite.scaleX = (sprite.scaleX - (_arg1 * 2));
if (sprite.scaleX <= 0.1){
sprite.scaleX = (sprite.scaleY = 0.4);
if (crashingChannel != null){
crashingChannel.stop();
crashingChannel = null;
};
GameScreen.instance.playSoundPanned("BOOM", pos.x);
planeClip.visible = false;
rippleClip.visible = true;
rippleClip.gotoAndPlay(1);
rippleClip.addEventListener(Event.ENTER_FRAME, rippleUpdated);
GameScreen.instance.notifyPlaneDowned();
};
sprite.scaleY = sprite.scaleX;
} else {
checkCollisionsWithOtherPlanes();
};
};
};
if (((planeClip.visible) && ((planeClip.alpha == 1)))){
pos.addVector(dir);
};
var _local2:int;
var _local3:int;
if (((((!((state == STATE_NORMAL))) && (!((state == STATE_EXPLODE))))) && ((rippleClip.visible == false)))){
_local2 = (_local2 + (((Math.random() * shakeAmount) * 0.5) - (shakeAmount * 0.25)));
_local3 = (_local3 + (((Math.random() * shakeAmount) * 0.5) - (shakeAmount * 0.25)));
};
sprite.x = (pos.x + _local2);
sprite.y = (pos.y + _local3);
var _local4:Vector2D = dir.getUnitNormal();
_local4.multiply((turnAmount * _arg1));
dir.addVector(_local4);
sprite.rotation = ((Utils.getAngle(dir.x, dir.y) * 360) / Utils.RAD360);
lifetime = (lifetime + _arg1);
if (lifetime > 30){
deactivate();
};
}
public function checkCollisionsWithOtherPlanes():void{
var _local1:Plane;
var _local2:Number;
for each (_local1 in pool.activePool) {
if (_local1 == this){
} else {
if (_local1.state == STATE_EXPLODE){
} else {
if (_local1.rippleClip.visible){
} else {
_local2 = Utils.getDistanceBetweenPoints(pos.x, pos.y, _local1.pos.x, _local1.pos.y);
if (_local2 < PLANE_COLLIDE_DIST){
explode();
};
};
};
};
};
}
public static function initStart():void{
pool = new ManagedPool("PlanePool", new Plane(0), MAX);
}
public static function blowAllCrashingToward(_arg1:Number, _arg2:Number):void{
var _local3:Plane;
for each (_local3 in pool.activePool) {
if (_local3.state == Plane.STATE_CRASH){
_local3.blowToward(_arg1, _arg2);
};
};
}
public static function checkSmokeAll():void{
var _local1:Plane;
for each (_local1 in pool.activePool) {
if (((!((_local1.state == Plane.STATE_CRASH))) && (!((_local1.state == Plane.STATE_EXPLODE))))){
_local1.checkSmoke();
};
};
}
public static function create(_arg1:int, _arg2:int, _arg3:Number):Plane{
var _local4:Plane = (pool.requestObject() as Plane);
_local4.init(_arg1, _arg2, _arg3);
return (_local4);
}
}
}//package
Section 28
//Plane_PlaneSprite (Plane_PlaneSprite)
package {
import flash.display.*;
import mx.core.*;
public class Plane_PlaneSprite extends SpriteAsset {
public var explosionClip:DisplayObject;
public var planesDownedText:DisplayObject;
public var title:DisplayObject;
public var timeText:DisplayObject;
public var chainCountText:DisplayObject;
public var deathTollText:DisplayObject;
public var bestDeathTollText:DisplayObject;
public var cone:DisplayObject;
public var gameOver:DisplayObject;
public var thePlane:DisplayObject;
public var ripple:DisplayObject;
public var chainClip:DisplayObject;
public var chainLostClip:DisplayObject;
public var panic:DisplayObject;
}
}//package
Section 29
//Smoke (Smoke)
package {
import flesh.*;
import flash.display.*;
public class Smoke extends PoolObject {
public var plane:Plane;
public var sprite:Sprite;
public var pos:Vector2D;
public var dir:Vector2D;
public var state:int;
public var scale:Number;
private var SmokeSprite:Class;
public var life:Number;
public static const MAX:uint = 250;
public static const STATE_SUCKED:int = 1;
public static const LIFETIME:Number = 5;
public static const MINALPHA:Number = 0.4;
public static const INITIAL_SPEED:Number = 0.75;
public static const BLOW_POWER:Number = 0.25;
public static const MAX_SCALE:Number = 2;
public static const STATE_NORMAL:int = 0;
public static const SCALE_INCREASE:Number = 0.25;
public static const BASE_SCALE:Number = 0.3;
public static const BLOW_RADIUS:Number = 800;
public static var pool:ManagedPool;
public function Smoke(_arg1:uint){
SmokeSprite = Smoke_SmokeSprite;
super(_arg1);
sprite = new SmokeSprite();
pos = new Vector2D(0, 0);
dir = new Vector2D(0, 0);
}
override public function createInstance(_arg1:uint):PoolObject{
return (new Smoke(_arg1));
}
public function blowToward(_arg1:Number, _arg2:Number):void{
var _local3:Vector2D = new Vector2D((_arg1 - pos.x), (_arg2 - pos.y));
var _local4:Number = _local3.unit();
if (_local4 > BLOW_RADIUS){
return;
};
var _local5:Number = (1 - (_local4 / BLOW_RADIUS));
_local3.multiply((_local5 * BLOW_POWER));
dir.add(_local3.x, _local3.y);
}
override public function update(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
switch (state){
case STATE_SUCKED:
_local2 = (plane.pos.x - pos.x);
_local3 = (plane.pos.y - pos.y);
pos.x = (pos.x + (_local2 * 0.1));
pos.y = (pos.y + (_local3 * 0.1));
sprite.scaleX = (sprite.scaleX - (_arg1 * 2));
sprite.alpha = (1 - sprite.scaleX);
sprite.scaleY = sprite.scaleX;
if (sprite.scaleX <= 0){
deactivate();
};
break;
case STATE_NORMAL:
life = (life - _arg1);
if (life <= 0){
deactivate();
return;
};
pos.addVector(dir);
sprite.x = pos.x;
sprite.y = pos.y;
scale = (scale + (SCALE_INCREASE * _arg1));
if (scale > MAX_SCALE){
scale = MAX_SCALE;
};
sprite.scaleX = (sprite.scaleY = scale);
if (life > 0.5){
sprite.alpha = (MINALPHA + ((1 - MINALPHA) * (life / LIFETIME)));
} else {
sprite.alpha = (((MINALPHA * life) / 0.5) + ((1 - MINALPHA) * (life / LIFETIME)));
};
sprite.rotation = (sprite.rotation + (100 * _arg1));
break;
};
}
public function init(_arg1:Number, _arg2:Number, _arg3:Number):void{
pos.set(_arg1, _arg2);
dir.set((Math.sin(_arg3) * INITIAL_SPEED), (-(Math.cos(_arg3)) * INITIAL_SPEED));
sprite.alpha = 1;
scale = BASE_SCALE;
sprite.x = _arg1;
sprite.y = _arg2;
sprite.rotation = (Math.random() * 360);
life = LIFETIME;
state = STATE_NORMAL;
Utils.addChild(sprite, GameScreen.instance.gameSprite);
}
public function suckIntoPlane(_arg1:Plane):void{
this.plane = _arg1;
state = STATE_SUCKED;
}
override public function deactivate():void{
active = false;
pool.notifyDeactivated(this);
Utils.removeChild(sprite);
}
public static function create(_arg1:int, _arg2:int, _arg3:Number):Smoke{
var _local4:Smoke = (pool.requestObject() as Smoke);
_local4.init(_arg1, _arg2, _arg3);
return (_local4);
}
public static function blowAllToward(_arg1:Number, _arg2:Number):void{
var _local3:Smoke;
for each (_local3 in pool.activePool) {
_local3.blowToward(_arg1, _arg2);
};
}
public static function initStart():void{
pool = new ManagedPool("SmokePool", new Smoke(0), MAX);
}
}
}//package
Section 30
//Smoke_SmokeSprite (Smoke_SmokeSprite)
package {
import flash.display.*;
import mx.core.*;
public class Smoke_SmokeSprite extends SpriteAsset {
public var cone:DisplayObject;
public var planesDownedText:DisplayObject;
public var gameOver:DisplayObject;
public var bestDeathTollText:DisplayObject;
public var chainClip:DisplayObject;
public var chainLostClip:DisplayObject;
public var panic:DisplayObject;
public var title:DisplayObject;
public var timeText:DisplayObject;
public var chainCountText:DisplayObject;
public var deathTollText:DisplayObject;
}
}//package
Section 31
//SoundData (SoundData)
package {
import flesh.*;
public class SoundData {
private static var Sound0:Class = SoundData_Sound0;
private static var Sound2:Class = SoundData_Sound2;
private static var Sound4:Class = SoundData_Sound4;
private static var Sound6:Class = SoundData_Sound6;
private static var Sound3:Class = SoundData_Sound3;
private static var Sound5:Class = SoundData_Sound5;
private static var Sound7:Class = SoundData_Sound7;
private static var Sound1:Class = SoundData_Sound1;
private static var Sound8:Class = SoundData_Sound8;
private static var Sound9:Class = SoundData_Sound9;
public static var SOUND_DATA:Array;
public static function initStart():void{
var _local2:XML;
var _local3:String;
var _local4:int;
var _local5:int;
var _local6:Number;
var _local1:XML = SoundDataXML.XML_DATA;
SOUND_DATA = new Array();
for each (_local2 in _local1.children()) {
_local3 = Utils.getStringAttributeFromXML(_local2, "id");
_local4 = ((Utils.getStringAttributeFromXML(_local2, "type") == "sfx")) ? FleshSound.FX : FleshSound.MUSIC;
_local5 = (Utils.getBooleanAttributeFromXML(_local2, "multiple")) ? FleshSound.MULTIPLE : FleshSound.SINGLETON;
_local6 = Utils.getFloatAttributeFromXML(_local2, "volume");
SOUND_DATA.push(_local3);
SOUND_DATA.push(_local4);
SOUND_DATA.push(_local5);
SOUND_DATA.push(_local6);
};
SoundManager.embedSound(SOUND_DATA, new Sound0());
SoundManager.embedSound(SOUND_DATA, new Sound1());
SoundManager.embedSound(SOUND_DATA, new Sound2());
SoundManager.embedSound(SOUND_DATA, new Sound3());
SoundManager.embedSound(SOUND_DATA, new Sound4());
SoundManager.embedSound(SOUND_DATA, new Sound5());
SoundManager.embedSound(SOUND_DATA, new Sound6());
SoundManager.embedSound(SOUND_DATA, new Sound7());
SoundManager.embedSound(SOUND_DATA, new Sound8());
SoundManager.embedSound(SOUND_DATA, new Sound9());
}
}
}//package
Section 32
//SoundData_Sound0 (SoundData_Sound0)
package {
import flash.display.*;
import mx.core.*;
public class SoundData_Sound0 extends SoundAsset {
public var cone:DisplayObject;
public var planesDownedText:DisplayObject;
public var gameOver:DisplayObject;
public var bestDeathTollText:DisplayObject;
public var chainClip:DisplayObject;
public var chainLostClip:DisplayObject;
public var panic:DisplayObject;
public var title:DisplayObject;
public var timeText:DisplayObject;
public var chainCountText:DisplayObject;
public var deathTollText:DisplayObject;
}
}//package
Section 33
//SoundData_Sound1 (SoundData_Sound1)
package {
import flash.display.*;
import mx.core.*;
public class SoundData_Sound1 extends SoundAsset {
public var cone:DisplayObject;
public var planesDownedText:DisplayObject;
public var gameOver:DisplayObject;
public var bestDeathTollText:DisplayObject;
public var chainClip:DisplayObject;
public var chainLostClip:DisplayObject;
public var panic:DisplayObject;
public var title:DisplayObject;
public var timeText:DisplayObject;
public var chainCountText:DisplayObject;
public var deathTollText:DisplayObject;
}
}//package
Section 34
//SoundData_Sound2 (SoundData_Sound2)
package {
import flash.display.*;
import mx.core.*;
public class SoundData_Sound2 extends SoundAsset {
public var cone:DisplayObject;
public var planesDownedText:DisplayObject;
public var gameOver:DisplayObject;
public var bestDeathTollText:DisplayObject;
public var chainClip:DisplayObject;
public var chainLostClip:DisplayObject;
public var panic:DisplayObject;
public var title:DisplayObject;
public var timeText:DisplayObject;
public var chainCountText:DisplayObject;
public var deathTollText:DisplayObject;
}
}//package
Section 35
//SoundData_Sound3 (SoundData_Sound3)
package {
import flash.display.*;
import mx.core.*;
public class SoundData_Sound3 extends SoundAsset {
public var cone:DisplayObject;
public var planesDownedText:DisplayObject;
public var gameOver:DisplayObject;
public var bestDeathTollText:DisplayObject;
public var chainClip:DisplayObject;
public var chainLostClip:DisplayObject;
public var panic:DisplayObject;
public var title:DisplayObject;
public var timeText:DisplayObject;
public var chainCountText:DisplayObject;
public var deathTollText:DisplayObject;
}
}//package
Section 36
//SoundData_Sound4 (SoundData_Sound4)
package {
import flash.display.*;
import mx.core.*;
public class SoundData_Sound4 extends SoundAsset {
public var cone:DisplayObject;
public var planesDownedText:DisplayObject;
public var gameOver:DisplayObject;
public var bestDeathTollText:DisplayObject;
public var chainClip:DisplayObject;
public var chainLostClip:DisplayObject;
public var panic:DisplayObject;
public var title:DisplayObject;
public var timeText:DisplayObject;
public var chainCountText:DisplayObject;
public var deathTollText:DisplayObject;
}
}//package
Section 37
//SoundData_Sound5 (SoundData_Sound5)
package {
import flash.display.*;
import mx.core.*;
public class SoundData_Sound5 extends SoundAsset {
public var cone:DisplayObject;
public var planesDownedText:DisplayObject;
public var gameOver:DisplayObject;
public var bestDeathTollText:DisplayObject;
public var chainClip:DisplayObject;
public var chainLostClip:DisplayObject;
public var panic:DisplayObject;
public var title:DisplayObject;
public var timeText:DisplayObject;
public var chainCountText:DisplayObject;
public var deathTollText:DisplayObject;
}
}//package
Section 38
//SoundData_Sound6 (SoundData_Sound6)
package {
import flash.display.*;
import mx.core.*;
public class SoundData_Sound6 extends SoundAsset {
public var cone:DisplayObject;
public var planesDownedText:DisplayObject;
public var gameOver:DisplayObject;
public var bestDeathTollText:DisplayObject;
public var chainClip:DisplayObject;
public var chainLostClip:DisplayObject;
public var panic:DisplayObject;
public var title:DisplayObject;
public var timeText:DisplayObject;
public var chainCountText:DisplayObject;
public var deathTollText:DisplayObject;
}
}//package
Section 39
//SoundData_Sound7 (SoundData_Sound7)
package {
import flash.display.*;
import mx.core.*;
public class SoundData_Sound7 extends SoundAsset {
public var cone:DisplayObject;
public var planesDownedText:DisplayObject;
public var gameOver:DisplayObject;
public var bestDeathTollText:DisplayObject;
public var chainClip:DisplayObject;
public var chainLostClip:DisplayObject;
public var panic:DisplayObject;
public var title:DisplayObject;
public var timeText:DisplayObject;
public var chainCountText:DisplayObject;
public var deathTollText:DisplayObject;
}
}//package
Section 40
//SoundData_Sound8 (SoundData_Sound8)
package {
import flash.display.*;
import mx.core.*;
public class SoundData_Sound8 extends SoundAsset {
public var cone:DisplayObject;
public var planesDownedText:DisplayObject;
public var gameOver:DisplayObject;
public var bestDeathTollText:DisplayObject;
public var chainClip:DisplayObject;
public var chainLostClip:DisplayObject;
public var panic:DisplayObject;
public var title:DisplayObject;
public var timeText:DisplayObject;
public var chainCountText:DisplayObject;
public var deathTollText:DisplayObject;
}
}//package
Section 41
//SoundData_Sound9 (SoundData_Sound9)
package {
import flash.display.*;
import mx.core.*;
public class SoundData_Sound9 extends SoundAsset {
public var cone:DisplayObject;
public var planesDownedText:DisplayObject;
public var gameOver:DisplayObject;
public var bestDeathTollText:DisplayObject;
public var chainClip:DisplayObject;
public var chainLostClip:DisplayObject;
public var panic:DisplayObject;
public var title:DisplayObject;
public var timeText:DisplayObject;
public var chainCountText:DisplayObject;
public var deathTollText:DisplayObject;
}
}//package
Section 42
//SoundDataXML (SoundDataXML)
package {
public class SoundDataXML {
public static const XML_DATA:XML = <SOUNDS>
<SOUND id="BOOM" type="sfx" multiple="true" volume="0.3"/>
<SOUND id="EJA0" type="sfx" multiple="true" volume="0.3"/>
<SOUND id="EJA1" type="sfx" multiple="true" volume="0.7"/>
<SOUND id="EJA2" type="sfx" multiple="true" volume="0.7"/>
<SOUND id="EJA3" type="sfx" multiple="true" volume="0.7"/>
<SOUND id="MUSIC" type="music" multiple="false" volume="0.1"/>
<SOUND id="ENGINEDIE0" type="sfx" multiple="true" volume="0.2"/>
<SOUND id="ENGINEDIE1" type="sfx" multiple="true" volume="0.2"/>
<SOUND id="PLANELOOP" type="sfx" multiple="true" volume="0.7"/>
<SOUND id="PLANECRASH" type="sfx" multiple="true" volume="0.2"/>
</SOUNDS>
;
}
}//package