Section 1
//AuxFunctions (caurina.transitions.AuxFunctions)
package caurina.transitions {
public class AuxFunctions {
public static function concatObjects(... _args):Object{
var _local3:Object;
var _local5:String;
var _local2:Object = {};
var _local4:int;
while (_local4 < _args.length) {
_local3 = _args[_local4];
for (_local5 in _local3) {
if (_local3[_local5] == null){
delete _local2[_local5];
} else {
_local2[_local5] = _local3[_local5];
};
};
_local4++;
};
return (_local2);
}
public static function numberToG(_arg1:Number):Number{
return (((_arg1 & 0xFF00) >> 8));
}
public static function numberToR(_arg1:Number):Number{
return (((_arg1 & 0xFF0000) >> 16));
}
public static function isInArray(_arg1:String, _arg2:Array):Boolean{
var _local3:uint = _arg2.length;
var _local4:uint;
while (_local4 < _local3) {
if (_arg2[_local4] == _arg1){
return (true);
};
_local4++;
};
return (false);
}
public static function getObjectLength(_arg1:Object):uint{
var _local3:String;
var _local2:uint;
for (_local3 in _arg1) {
_local2++;
};
return (_local2);
}
public static function numberToB(_arg1:Number):Number{
return ((_arg1 & 0xFF));
}
}
}//package caurina.transitions
Section 2
//Equations (caurina.transitions.Equations)
package caurina.transitions {
public class Equations {
public function Equations(){
trace("Equations is a static class and should not be instantiated.");
}
public static function easeOutBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
if (_arg1 < (1 / 2.75)){
return (((_arg3 * ((7.5625 * _arg1) * _arg1)) + _arg2));
};
if (_arg1 < (2 / 2.75)){
_arg1 = (_arg1 - (1.5 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.75)) + _arg2));
};
if (_arg1 < (2.5 / 2.75)){
_arg1 = (_arg1 - (2.25 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.9375)) + _arg2));
};
_arg1 = (_arg1 - (2.625 / 2.75));
return (((_arg3 * (((7.5625 * _arg1) * _arg1) + 0.984375)) + _arg2));
}
public static function easeInOutElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 == 2){
return ((_arg2 + _arg3));
};
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * (0.3 * 1.5)) : _arg5.period;
var _local8:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
if (_arg1 < 1){
--_arg1;
return (((-0.5 * ((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2));
};
--_arg1;
return ((((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) * 0.5) + _arg3) + _arg2));
}
public static function easeInOutQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * _arg1) * _arg1) + _arg2));
};
--_arg1;
return ((((-(_arg3) / 2) * ((_arg1 * (_arg1 - 2)) - 1)) + _arg2));
}
public static function easeInOutBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (((easeInBounce((_arg1 * 2), 0, _arg3, _arg4) * 0.5) + _arg2));
};
return ((((easeOutBounce(((_arg1 * 2) - _arg4), 0, _arg3, _arg4) * 0.5) + (_arg3 * 0.5)) + _arg2));
}
public static function easeInOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
_local6 = (_local6 * 1.525);
return ((((_arg3 / 2) * ((_arg1 * _arg1) * (((_local6 + 1) * _arg1) - _local6))) + _arg2));
};
_arg1 = (_arg1 - 2);
_local6 = (_local6 * 1.525);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 2)) + _arg2));
}
public static function easeOutInCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutCubic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInCubic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 1)) + _arg2));
}
public static function easeInOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((-(_arg3) / 2) * (Math.cos(((Math.PI * _arg1) / _arg4)) - 1)) + _arg2));
}
public static function easeInBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * (((_local6 + 1) * _arg1) - _local6)) + _arg2));
}
public static function easeInQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeOutInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuint((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuint(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutBounce((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInBounce(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function init():void{
Tweener.registerTransition("easenone", easeNone);
Tweener.registerTransition("linear", easeNone);
Tweener.registerTransition("easeinquad", easeInQuad);
Tweener.registerTransition("easeoutquad", easeOutQuad);
Tweener.registerTransition("easeinoutquad", easeInOutQuad);
Tweener.registerTransition("easeoutinquad", easeOutInQuad);
Tweener.registerTransition("easeincubic", easeInCubic);
Tweener.registerTransition("easeoutcubic", easeOutCubic);
Tweener.registerTransition("easeinoutcubic", easeInOutCubic);
Tweener.registerTransition("easeoutincubic", easeOutInCubic);
Tweener.registerTransition("easeinquart", easeInQuart);
Tweener.registerTransition("easeoutquart", easeOutQuart);
Tweener.registerTransition("easeinoutquart", easeInOutQuart);
Tweener.registerTransition("easeoutinquart", easeOutInQuart);
Tweener.registerTransition("easeinquint", easeInQuint);
Tweener.registerTransition("easeoutquint", easeOutQuint);
Tweener.registerTransition("easeinoutquint", easeInOutQuint);
Tweener.registerTransition("easeoutinquint", easeOutInQuint);
Tweener.registerTransition("easeinsine", easeInSine);
Tweener.registerTransition("easeoutsine", easeOutSine);
Tweener.registerTransition("easeinoutsine", easeInOutSine);
Tweener.registerTransition("easeoutinsine", easeOutInSine);
Tweener.registerTransition("easeincirc", easeInCirc);
Tweener.registerTransition("easeoutcirc", easeOutCirc);
Tweener.registerTransition("easeinoutcirc", easeInOutCirc);
Tweener.registerTransition("easeoutincirc", easeOutInCirc);
Tweener.registerTransition("easeinexpo", easeInExpo);
Tweener.registerTransition("easeoutexpo", easeOutExpo);
Tweener.registerTransition("easeinoutexpo", easeInOutExpo);
Tweener.registerTransition("easeoutinexpo", easeOutInExpo);
Tweener.registerTransition("easeinelastic", easeInElastic);
Tweener.registerTransition("easeoutelastic", easeOutElastic);
Tweener.registerTransition("easeinoutelastic", easeInOutElastic);
Tweener.registerTransition("easeoutinelastic", easeOutInElastic);
Tweener.registerTransition("easeinback", easeInBack);
Tweener.registerTransition("easeoutback", easeOutBack);
Tweener.registerTransition("easeinoutback", easeInOutBack);
Tweener.registerTransition("easeoutinback", easeOutInBack);
Tweener.registerTransition("easeinbounce", easeInBounce);
Tweener.registerTransition("easeoutbounce", easeOutBounce);
Tweener.registerTransition("easeinoutbounce", easeInOutBounce);
Tweener.registerTransition("easeoutinbounce", easeOutInBounce);
}
public static function easeOutExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg1)==_arg4) ? (_arg2 + _arg3) : (((_arg3 * 1.001) * (-(Math.pow(2, ((-10 * _arg1) / _arg4))) + 1)) + _arg2));
}
public static function easeOutInBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutBack((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInBack(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg1)==0) ? _arg2 : (((_arg3 * Math.pow(2, (10 * ((_arg1 / _arg4) - 1)))) + _arg2) - (_arg3 * 0.001)));
}
public static function easeInCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((-(_arg3) / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) + 1)) + _arg2));
}
public static function easeInQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((_arg3 * _arg1) * _arg1) + _arg2));
}
public static function easeInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg3 - easeOutBounce((_arg4 - _arg1), 0, _arg3, _arg4)) + _arg2));
}
public static function easeOutInExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutExpo((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInExpo(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((-(_arg3) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 1)) + _arg2));
}
public static function easeInSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((-(_arg3) * Math.cos(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg3) + _arg2));
}
public static function easeInOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((-(_arg3) / 2) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 2)) + _arg2));
}
public static function easeOutQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function easeOutInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutElastic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInElastic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period;
var _local8:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
--_arg1;
return ((-(((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2));
}
public static function easeOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeOutQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeOutInQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuad((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuad(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg3 * Math.sin(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg2));
}
public static function easeInOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * _arg1) + 2)) + _arg2));
}
public static function easeInOutQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 2)) + _arg2));
}
public static function easeInCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((-(_arg3) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
}
public static function easeOutInSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutSine((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInSine(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInOutExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 == 0){
return (_arg2);
};
if (_arg1 == _arg4){
return ((_arg2 + _arg3));
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * Math.pow(2, (10 * (_arg1 - 1)))) + _arg2) - (_arg3 * 0.0005)));
};
--_arg1;
return (((((_arg3 / 2) * 1.0005) * (-(Math.pow(2, (-10 * _arg1))) + 2)) + _arg2));
}
public static function easeOutElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period;
var _local8:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
return (((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) + _arg3) + _arg2));
}
public static function easeOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * Math.sqrt((1 - (_arg1 * _arg1)))) + _arg2));
}
public static function easeOutInQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuart((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuart(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutInCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutCirc((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInCirc(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
}
}//package caurina.transitions
Section 3
//PropertyInfoObj (caurina.transitions.PropertyInfoObj)
package caurina.transitions {
public class PropertyInfoObj {
public var modifierParameters:Array;
public var isSpecialProperty:Boolean;
public var valueComplete:Number;
public var modifierFunction:Function;
public var extra:Object;
public var valueStart:Number;
public var hasModifier:Boolean;
public var arrayIndex:Number;
public var originalValueComplete:Object;
public function PropertyInfoObj(_arg1:Number, _arg2:Number, _arg3:Object, _arg4:Number, _arg5:Object, _arg6:Boolean, _arg7:Function, _arg8:Array){
valueStart = _arg1;
valueComplete = _arg2;
originalValueComplete = _arg3;
arrayIndex = _arg4;
extra = _arg5;
isSpecialProperty = _arg6;
hasModifier = Boolean(_arg7);
modifierFunction = _arg7;
modifierParameters = _arg8;
}
public function toString():String{
var _local1 = "\n[PropertyInfoObj ";
_local1 = (_local1 + ("valueStart:" + String(valueStart)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("valueComplete:" + String(valueComplete)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("originalValueComplete:" + String(originalValueComplete)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("arrayIndex:" + String(arrayIndex)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("extra:" + String(extra)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("isSpecialProperty:" + String(isSpecialProperty)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("hasModifier:" + String(hasModifier)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("modifierFunction:" + String(modifierFunction)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("modifierParameters:" + String(modifierParameters)));
_local1 = (_local1 + "]\n");
return (_local1);
}
public function clone():PropertyInfoObj{
var _local1:PropertyInfoObj = new PropertyInfoObj(valueStart, valueComplete, originalValueComplete, arrayIndex, extra, isSpecialProperty, modifierFunction, modifierParameters);
return (_local1);
}
}
}//package caurina.transitions
Section 4
//SpecialProperty (caurina.transitions.SpecialProperty)
package caurina.transitions {
public class SpecialProperty {
public var parameters:Array;
public var getValue:Function;
public var preProcess:Function;
public var setValue:Function;
public function SpecialProperty(_arg1:Function, _arg2:Function, _arg3:Array=null, _arg4:Function=null){
getValue = _arg1;
setValue = _arg2;
parameters = _arg3;
preProcess = _arg4;
}
public function toString():String{
var _local1 = "";
_local1 = (_local1 + "[SpecialProperty ");
_local1 = (_local1 + ("getValue:" + String(getValue)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("setValue:" + String(setValue)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("parameters:" + String(parameters)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("preProcess:" + String(preProcess)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 5
//SpecialPropertyModifier (caurina.transitions.SpecialPropertyModifier)
package caurina.transitions {
public class SpecialPropertyModifier {
public var getValue:Function;
public var modifyValues:Function;
public function SpecialPropertyModifier(_arg1:Function, _arg2:Function){
modifyValues = _arg1;
getValue = _arg2;
}
public function toString():String{
var _local1 = "";
_local1 = (_local1 + "[SpecialPropertyModifier ");
_local1 = (_local1 + ("modifyValues:" + String(modifyValues)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("getValue:" + String(getValue)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 6
//SpecialPropertySplitter (caurina.transitions.SpecialPropertySplitter)
package caurina.transitions {
public class SpecialPropertySplitter {
public var parameters:Array;
public var splitValues:Function;
public function SpecialPropertySplitter(_arg1:Function, _arg2:Array){
splitValues = _arg1;
parameters = _arg2;
}
public function toString():String{
var _local1 = "";
_local1 = (_local1 + "[SpecialPropertySplitter ");
_local1 = (_local1 + ("splitValues:" + String(splitValues)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("parameters:" + String(parameters)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 7
//Tweener (caurina.transitions.Tweener)
package caurina.transitions {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class Tweener {
private static var _timeScale:Number = 1;
private static var _currentTimeFrame:Number;
private static var _specialPropertySplitterList:Object;
private static var _engineExists:Boolean = false;
private static var _specialPropertyModifierList:Object;
private static var _currentTime:Number;
private static var _tweenList:Array;
private static var _specialPropertyList:Object;
private static var _transitionList:Object;
private static var _inited:Boolean = false;
private static var __tweener_controller__:MovieClip;
public function Tweener(){
trace("Tweener is a static class and should not be instantiated.");
}
public static function registerSpecialPropertyModifier(_arg1:String, _arg2:Function, _arg3:Function):void{
if (!_inited){
init();
};
var _local4:SpecialPropertyModifier = new SpecialPropertyModifier(_arg2, _arg3);
_specialPropertyModifierList[_arg1] = _local4;
}
public static function registerSpecialProperty(_arg1:String, _arg2:Function, _arg3:Function, _arg4:Array=null, _arg5:Function=null):void{
if (!_inited){
init();
};
var _local6:SpecialProperty = new SpecialProperty(_arg2, _arg3, _arg4, _arg5);
_specialPropertyList[_arg1] = _local6;
}
public static function init(... _args):void{
_inited = true;
_transitionList = new Object();
Equations.init();
_specialPropertyList = new Object();
_specialPropertyModifierList = new Object();
_specialPropertySplitterList = new Object();
}
private static function updateTweens():Boolean{
var _local1:int;
if (_tweenList.length == 0){
return (false);
};
_local1 = 0;
while (_local1 < _tweenList.length) {
if ((((_tweenList[_local1] == undefined)) || (!(_tweenList[_local1].isPaused)))){
if (!updateTweenByIndex(_local1)){
removeTweenByIndex(_local1);
};
if (_tweenList[_local1] == null){
removeTweenByIndex(_local1, true);
_local1--;
};
};
_local1++;
};
return (true);
}
public static function addCaller(_arg1:Object=null, _arg2:Object=null):Boolean{
var _local3:Number;
var _local4:Array;
var _local8:Function;
var _local9:TweenListObj;
var _local10:Number;
var _local11:String;
if (!Boolean(_arg1)){
return (false);
};
if ((_arg1 is Array)){
_local4 = _arg1.concat();
} else {
_local4 = [_arg1];
};
var _local5:Object = _arg2;
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
var _local6:Number = (isNaN(_local5.time)) ? 0 : _local5.time;
var _local7:Number = (isNaN(_local5.delay)) ? 0 : _local5.delay;
if (typeof(_local5.transition) == "string"){
_local11 = _local5.transition.toLowerCase();
_local8 = _transitionList[_local11];
} else {
_local8 = _local5.transition;
};
if (!Boolean(_local8)){
_local8 = _transitionList["easeoutexpo"];
};
_local3 = 0;
while (_local3 < _local4.length) {
if (_local5.useFrames == true){
_local9 = new TweenListObj(_local4[_local3], (_currentTimeFrame + (_local7 / _timeScale)), (_currentTimeFrame + ((_local7 + _local6) / _timeScale)), true, _local8, _local5.transitionParams);
} else {
_local9 = new TweenListObj(_local4[_local3], (_currentTime + ((_local7 * 1000) / _timeScale)), (_currentTime + (((_local7 * 1000) + (_local6 * 1000)) / _timeScale)), false, _local8, _local5.transitionParams);
};
_local9.properties = null;
_local9.onStart = _local5.onStart;
_local9.onUpdate = _local5.onUpdate;
_local9.onComplete = _local5.onComplete;
_local9.onOverwrite = _local5.onOverwrite;
_local9.onStartParams = _local5.onStartParams;
_local9.onUpdateParams = _local5.onUpdateParams;
_local9.onCompleteParams = _local5.onCompleteParams;
_local9.onOverwriteParams = _local5.onOverwriteParams;
_local9.onStartScope = _local5.onStartScope;
_local9.onUpdateScope = _local5.onUpdateScope;
_local9.onCompleteScope = _local5.onCompleteScope;
_local9.onOverwriteScope = _local5.onOverwriteScope;
_local9.onErrorScope = _local5.onErrorScope;
_local9.isCaller = true;
_local9.count = _local5.count;
_local9.waitFrames = _local5.waitFrames;
_tweenList.push(_local9);
if ((((_local6 == 0)) && ((_local7 == 0)))){
_local10 = (_tweenList.length - 1);
updateTweenByIndex(_local10);
removeTweenByIndex(_local10);
};
_local3++;
};
return (true);
}
public static function pauseAllTweens():Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
var _local1:Boolean;
_local2 = 0;
while (_local2 < _tweenList.length) {
pauseTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
public static function removeTweens(_arg1:Object, ... _args):Boolean{
var _local4:uint;
var _local3:Array = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && (!(AuxFunctions.isInArray(_args[_local4], _local3))))){
_local3.push(_args[_local4]);
};
_local4++;
};
return (affectTweens(removeTweenByIndex, _arg1, _local3));
}
public static function splitTweens(_arg1:Number, _arg2:Array):uint{
var _local5:uint;
var _local6:String;
var _local7:Boolean;
var _local3:TweenListObj = _tweenList[_arg1];
var _local4:TweenListObj = _local3.clone(false);
_local5 = 0;
while (_local5 < _arg2.length) {
_local6 = _arg2[_local5];
if (Boolean(_local3.properties[_local6])){
_local3.properties[_local6] = undefined;
delete _local3.properties[_local6];
};
_local5++;
};
for (_local6 in _local4.properties) {
_local7 = false;
_local5 = 0;
while (_local5 < _arg2.length) {
if (_arg2[_local5] == _local6){
_local7 = true;
break;
};
_local5++;
};
if (!_local7){
_local4.properties[_local6] = undefined;
delete _local4.properties[_local6];
};
};
_tweenList.push(_local4);
return ((_tweenList.length - 1));
}
public static function updateFrame():void{
_currentTimeFrame++;
}
public static function resumeTweenByIndex(_arg1:Number):Boolean{
var _local2:TweenListObj = _tweenList[_arg1];
if ((((_local2 == null)) || (!(_local2.isPaused)))){
return (false);
};
var _local3:Number = getCurrentTweeningTime(_local2);
_local2.timeStart = (_local2.timeStart + (_local3 - _local2.timePaused));
_local2.timeComplete = (_local2.timeComplete + (_local3 - _local2.timePaused));
_local2.timePaused = undefined;
_local2.isPaused = false;
return (true);
}
public static function getVersion():String{
return ("AS3 1.31.71");
}
public static function onEnterFrame(_arg1:Event):void{
updateTime();
updateFrame();
var _local2:Boolean;
_local2 = updateTweens();
if (!_local2){
stopEngine();
};
}
public static function updateTime():void{
_currentTime = getTimer();
}
private static function updateTweenByIndex(_arg1:Number):Boolean{
var tTweening:TweenListObj;
var mustUpdate:Boolean;
var nv:Number;
var t:Number;
var b:Number;
var c:Number;
var d:Number;
var pName:String;
var eventScope:Object;
var tScope:Object;
var tProperty:Object;
var pv:Number;
var i = _arg1;
tTweening = _tweenList[i];
if ((((tTweening == null)) || (!(Boolean(tTweening.scope))))){
return (false);
};
var isOver:Boolean;
var cTime:Number = getCurrentTweeningTime(tTweening);
if (cTime >= tTweening.timeStart){
tScope = tTweening.scope;
if (tTweening.isCaller){
do {
t = (((tTweening.timeComplete - tTweening.timeStart) / tTweening.count) * (tTweening.timesCalled + 1));
b = tTweening.timeStart;
c = (tTweening.timeComplete - tTweening.timeStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, b, c, d);
} while (!(cTime >= nv));
} else {
mustUpdate = (((((tTweening.skipUpdates < 1)) || (!(tTweening.skipUpdates)))) || ((tTweening.updatesSkipped >= tTweening.skipUpdates)));
if (cTime >= tTweening.timeComplete){
isOver = true;
mustUpdate = true;
};
if (!tTweening.hasStarted){
if (Boolean(tTweening.onStart)){
eventScope = (Boolean(tTweening.onStartScope)) ? tTweening.onStartScope : tScope;
try {
tTweening.onStart.apply(eventScope, tTweening.onStartParams);
} catch(e:Error) {
handleError(tTweening, e, "onStart");
};
};
for (pName in tTweening.properties) {
if (tTweening.properties[pName].isSpecialProperty){
if (Boolean(_specialPropertyList[pName].preProcess)){
tTweening.properties[pName].valueComplete = _specialPropertyList[pName].preProcess(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].originalValueComplete, tTweening.properties[pName].extra);
};
pv = _specialPropertyList[pName].getValue(tScope, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra);
} else {
pv = tScope[pName];
};
tTweening.properties[pName].valueStart = (isNaN(pv)) ? tTweening.properties[pName].valueComplete : pv;
};
mustUpdate = true;
tTweening.hasStarted = true;
};
if (mustUpdate){
for (pName in tTweening.properties) {
tProperty = tTweening.properties[pName];
if (isOver){
nv = tProperty.valueComplete;
} else {
if (tProperty.hasModifier){
t = (cTime - tTweening.timeStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, 0, 1, d, tTweening.transitionParams);
nv = tProperty.modifierFunction(tProperty.valueStart, tProperty.valueComplete, nv, tProperty.modifierParameters);
} else {
t = (cTime - tTweening.timeStart);
b = tProperty.valueStart;
c = (tProperty.valueComplete - tProperty.valueStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, b, c, d, tTweening.transitionParams);
};
};
if (tTweening.rounded){
nv = Math.round(nv);
};
if (tProperty.isSpecialProperty){
_specialPropertyList[pName].setValue(tScope, nv, _specialPropertyList[pName].parameters, tTweening.properties[pName].extra);
} else {
tScope[pName] = nv;
};
};
tTweening.updatesSkipped = 0;
if (Boolean(tTweening.onUpdate)){
eventScope = (Boolean(tTweening.onUpdateScope)) ? tTweening.onUpdateScope : tScope;
try {
tTweening.onUpdate.apply(eventScope, tTweening.onUpdateParams);
} catch(e:Error) {
handleError(tTweening, e, "onUpdate");
};
};
} else {
tTweening.updatesSkipped++;
};
};
if (((isOver) && (Boolean(tTweening.onComplete)))){
eventScope = (Boolean(tTweening.onCompleteScope)) ? tTweening.onCompleteScope : tScope;
try {
tTweening.onComplete.apply(eventScope, tTweening.onCompleteParams);
} catch(e:Error) {
handleError(tTweening, e, "onComplete");
};
};
return (!(isOver));
};
return (true);
}
public static function setTimeScale(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
if (isNaN(_arg1)){
_arg1 = 1;
};
if (_arg1 < 1E-5){
_arg1 = 1E-5;
};
if (_arg1 != _timeScale){
if (_tweenList != null){
_local2 = 0;
while (_local2 < _tweenList.length) {
_local3 = getCurrentTweeningTime(_tweenList[_local2]);
_tweenList[_local2].timeStart = (_local3 - (((_local3 - _tweenList[_local2].timeStart) * _timeScale) / _arg1));
_tweenList[_local2].timeComplete = (_local3 - (((_local3 - _tweenList[_local2].timeComplete) * _timeScale) / _arg1));
if (_tweenList[_local2].timePaused != undefined){
_tweenList[_local2].timePaused = (_local3 - (((_local3 - _tweenList[_local2].timePaused) * _timeScale) / _arg1));
};
_local2++;
};
};
_timeScale = _arg1;
};
}
public static function resumeAllTweens():Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
var _local1:Boolean;
_local2 = 0;
while (_local2 < _tweenList.length) {
resumeTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
private static function handleError(_arg1:TweenListObj, _arg2:Error, _arg3:String):void{
var eventScope:Object;
var pTweening = _arg1;
var pError = _arg2;
var pCallBackName = _arg3;
if (((Boolean(pTweening.onError)) && ((pTweening.onError is Function)))){
eventScope = (Boolean(pTweening.onErrorScope)) ? pTweening.onErrorScope : pTweening.scope;
try {
pTweening.onError.apply(eventScope, [pTweening.scope, pError]);
} catch(metaError:Error) {
printError(((((String(pTweening.scope) + " raised an error while executing the 'onError' handler. Original error:\n ") + pError.getStackTrace()) + "\nonError error: ") + metaError.getStackTrace()));
};
} else {
if (!Boolean(pTweening.onError)){
printError(((((String(pTweening.scope) + " raised an error while executing the '") + pCallBackName) + "'handler. \n") + pError.getStackTrace()));
};
};
}
private static function startEngine():void{
_engineExists = true;
_tweenList = new Array();
__tweener_controller__ = new MovieClip();
__tweener_controller__.addEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame);
_currentTimeFrame = 0;
updateTime();
}
public static function removeAllTweens():Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
var _local1:Boolean;
_local2 = 0;
while (_local2 < _tweenList.length) {
removeTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
public static function addTween(_arg1:Object=null, _arg2:Object=null):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:String;
var _local6:Array;
var _local13:Function;
var _local14:Object;
var _local15:TweenListObj;
var _local16:Number;
var _local17:Array;
var _local18:Array;
var _local19:Array;
var _local20:String;
if (!Boolean(_arg1)){
return (false);
};
if ((_arg1 is Array)){
_local6 = _arg1.concat();
} else {
_local6 = [_arg1];
};
var _local7:Object = TweenListObj.makePropertiesChain(_arg2);
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
var _local8:Number = (isNaN(_local7.time)) ? 0 : _local7.time;
var _local9:Number = (isNaN(_local7.delay)) ? 0 : _local7.delay;
var _local10:Array = new Array();
var _local11:Object = {time:true, delay:true, useFrames:true, skipUpdates:true, transition:true, transitionParams:true, onStart:true, onUpdate:true, onComplete:true, onOverwrite:true, onError:true, rounded:true, onStartParams:true, onUpdateParams:true, onCompleteParams:true, onOverwriteParams:true, onStartScope:true, onUpdateScope:true, onCompleteScope:true, onOverwriteScope:true, onErrorScope:true};
var _local12:Object = new Object();
for (_local5 in _local7) {
if (!_local11[_local5]){
if (_specialPropertySplitterList[_local5]){
_local17 = _specialPropertySplitterList[_local5].splitValues(_local7[_local5], _specialPropertySplitterList[_local5].parameters);
_local3 = 0;
while (_local3 < _local17.length) {
if (_specialPropertySplitterList[_local17[_local3].name]){
_local18 = _specialPropertySplitterList[_local17[_local3].name].splitValues(_local17[_local3].value, _specialPropertySplitterList[_local17[_local3].name].parameters);
_local4 = 0;
while (_local4 < _local18.length) {
_local10[_local18[_local4].name] = {valueStart:undefined, valueComplete:_local18[_local4].value, arrayIndex:_local18[_local4].arrayIndex, isSpecialProperty:false};
_local4++;
};
} else {
_local10[_local17[_local3].name] = {valueStart:undefined, valueComplete:_local17[_local3].value, arrayIndex:_local17[_local3].arrayIndex, isSpecialProperty:false};
};
_local3++;
};
} else {
if (_specialPropertyModifierList[_local5] != undefined){
_local19 = _specialPropertyModifierList[_local5].modifyValues(_local7[_local5]);
_local3 = 0;
while (_local3 < _local19.length) {
_local12[_local19[_local3].name] = {modifierParameters:_local19[_local3].parameters, modifierFunction:_specialPropertyModifierList[_local5].getValue};
_local3++;
};
} else {
_local10[_local5] = {valueStart:undefined, valueComplete:_local7[_local5]};
};
};
};
};
for (_local5 in _local10) {
if (_specialPropertyList[_local5] != undefined){
_local10[_local5].isSpecialProperty = true;
} else {
if (_local6[0][_local5] == undefined){
printError((((("The property '" + _local5) + "' doesn't seem to be a normal object property of ") + String(_local6[0])) + " or a registered special property."));
};
};
};
for (_local5 in _local12) {
if (_local10[_local5] != undefined){
_local10[_local5].modifierParameters = _local12[_local5].modifierParameters;
_local10[_local5].modifierFunction = _local12[_local5].modifierFunction;
};
};
if (typeof(_local7.transition) == "string"){
_local20 = _local7.transition.toLowerCase();
_local13 = _transitionList[_local20];
} else {
_local13 = _local7.transition;
};
if (!Boolean(_local13)){
_local13 = _transitionList["easeoutexpo"];
};
_local3 = 0;
while (_local3 < _local6.length) {
_local14 = new Object();
for (_local5 in _local10) {
_local14[_local5] = new PropertyInfoObj(_local10[_local5].valueStart, _local10[_local5].valueComplete, _local10[_local5].valueComplete, _local10[_local5].arrayIndex, {}, _local10[_local5].isSpecialProperty, _local10[_local5].modifierFunction, _local10[_local5].modifierParameters);
};
if (_local7.useFrames == true){
_local15 = new TweenListObj(_local6[_local3], (_currentTimeFrame + (_local9 / _timeScale)), (_currentTimeFrame + ((_local9 + _local8) / _timeScale)), true, _local13, _local7.transitionParams);
} else {
_local15 = new TweenListObj(_local6[_local3], (_currentTime + ((_local9 * 1000) / _timeScale)), (_currentTime + (((_local9 * 1000) + (_local8 * 1000)) / _timeScale)), false, _local13, _local7.transitionParams);
};
_local15.properties = _local14;
_local15.onStart = _local7.onStart;
_local15.onUpdate = _local7.onUpdate;
_local15.onComplete = _local7.onComplete;
_local15.onOverwrite = _local7.onOverwrite;
_local15.onError = _local7.onError;
_local15.onStartParams = _local7.onStartParams;
_local15.onUpdateParams = _local7.onUpdateParams;
_local15.onCompleteParams = _local7.onCompleteParams;
_local15.onOverwriteParams = _local7.onOverwriteParams;
_local15.onStartScope = _local7.onStartScope;
_local15.onUpdateScope = _local7.onUpdateScope;
_local15.onCompleteScope = _local7.onCompleteScope;
_local15.onOverwriteScope = _local7.onOverwriteScope;
_local15.onErrorScope = _local7.onErrorScope;
_local15.rounded = _local7.rounded;
_local15.skipUpdates = _local7.skipUpdates;
removeTweensByTime(_local15.scope, _local15.properties, _local15.timeStart, _local15.timeComplete);
_tweenList.push(_local15);
if ((((_local8 == 0)) && ((_local9 == 0)))){
_local16 = (_tweenList.length - 1);
updateTweenByIndex(_local16);
removeTweenByIndex(_local16);
};
_local3++;
};
return (true);
}
public static function registerTransition(_arg1:String, _arg2:Function):void{
if (!_inited){
init();
};
_transitionList[_arg1] = _arg2;
}
public static function printError(_arg1:String):void{
trace(("## [Tweener] Error: " + _arg1));
}
private static function affectTweens(_arg1:Function, _arg2:Object, _arg3:Array):Boolean{
var _local5:uint;
var _local6:Array;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local4:Boolean;
if (!Boolean(_tweenList)){
return (false);
};
_local5 = 0;
while (_local5 < _tweenList.length) {
if (((_tweenList[_local5]) && ((_tweenList[_local5].scope == _arg2)))){
if (_arg3.length == 0){
_arg1(_local5);
_local4 = true;
} else {
_local6 = new Array();
_local7 = 0;
while (_local7 < _arg3.length) {
if (Boolean(_tweenList[_local5].properties[_arg3[_local7]])){
_local6.push(_arg3[_local7]);
};
_local7++;
};
if (_local6.length > 0){
_local8 = AuxFunctions.getObjectLength(_tweenList[_local5].properties);
if (_local8 == _local6.length){
_arg1(_local5);
_local4 = true;
} else {
_local9 = splitTweens(_local5, _local6);
_arg1(_local9);
_local4 = true;
};
};
};
};
_local5++;
};
return (_local4);
}
public static function getTweens(_arg1:Object):Array{
var _local2:uint;
var _local3:String;
if (!Boolean(_tweenList)){
return ([]);
};
var _local4:Array = new Array();
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
for (_local3 in _tweenList[_local2].properties) {
_local4.push(_local3);
};
};
_local2++;
};
return (_local4);
}
public static function isTweening(_arg1:Object):Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
return (true);
};
_local2++;
};
return (false);
}
public static function pauseTweenByIndex(_arg1:Number):Boolean{
var _local2:TweenListObj = _tweenList[_arg1];
if ((((_local2 == null)) || (_local2.isPaused))){
return (false);
};
_local2.timePaused = getCurrentTweeningTime(_local2);
_local2.isPaused = true;
return (true);
}
public static function getCurrentTweeningTime(_arg1:Object):Number{
return ((_arg1.useFrames) ? _currentTimeFrame : _currentTime);
}
public static function getTweenCount(_arg1:Object):Number{
var _local2:uint;
if (!Boolean(_tweenList)){
return (0);
};
var _local3:Number = 0;
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
_local3 = (_local3 + AuxFunctions.getObjectLength(_tweenList[_local2].properties));
};
_local2++;
};
return (_local3);
}
private static function stopEngine():void{
_engineExists = false;
_tweenList = null;
_currentTime = 0;
_currentTimeFrame = 0;
__tweener_controller__.removeEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame);
__tweener_controller__ = null;
}
public static function removeTweensByTime(_arg1:Object, _arg2:Object, _arg3:Number, _arg4:Number):Boolean{
var removedLocally:Boolean;
var i:uint;
var pName:String;
var eventScope:Object;
var p_scope = _arg1;
var p_properties = _arg2;
var p_timeStart = _arg3;
var p_timeComplete = _arg4;
var removed:Boolean;
var tl:uint = _tweenList.length;
i = 0;
while (i < tl) {
if (((Boolean(_tweenList[i])) && ((p_scope == _tweenList[i].scope)))){
if ((((p_timeComplete > _tweenList[i].timeStart)) && ((p_timeStart < _tweenList[i].timeComplete)))){
removedLocally = false;
for (pName in _tweenList[i].properties) {
if (Boolean(p_properties[pName])){
if (Boolean(_tweenList[i].onOverwrite)){
eventScope = (Boolean(_tweenList[i].onOverwriteScope)) ? _tweenList[i].onOverwriteScope : _tweenList[i].scope;
try {
_tweenList[i].onOverwrite.apply(eventScope, _tweenList[i].onOverwriteParams);
} catch(e:Error) {
handleError(_tweenList[i], e, "onOverwrite");
};
};
_tweenList[i].properties[pName] = undefined;
delete _tweenList[i].properties[pName];
removedLocally = true;
removed = true;
};
};
if (removedLocally){
if (AuxFunctions.getObjectLength(_tweenList[i].properties) == 0){
removeTweenByIndex(i);
};
};
};
};
i = (i + 1);
};
return (removed);
}
public static function registerSpecialPropertySplitter(_arg1:String, _arg2:Function, _arg3:Array=null):void{
if (!_inited){
init();
};
var _local4:SpecialPropertySplitter = new SpecialPropertySplitter(_arg2, _arg3);
_specialPropertySplitterList[_arg1] = _local4;
}
public static function removeTweenByIndex(_arg1:Number, _arg2:Boolean=false):Boolean{
_tweenList[_arg1] = null;
if (_arg2){
_tweenList.splice(_arg1, 1);
};
return (true);
}
public static function resumeTweens(_arg1:Object, ... _args):Boolean{
var _local4:uint;
var _local3:Array = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && (!(AuxFunctions.isInArray(_args[_local4], _local3))))){
_local3.push(_args[_local4]);
};
_local4++;
};
return (affectTweens(resumeTweenByIndex, _arg1, _local3));
}
public static function pauseTweens(_arg1:Object, ... _args):Boolean{
var _local4:uint;
var _local3:Array = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && (!(AuxFunctions.isInArray(_args[_local4], _local3))))){
_local3.push(_args[_local4]);
};
_local4++;
};
return (affectTweens(pauseTweenByIndex, _arg1, _local3));
}
}
}//package caurina.transitions
Section 8
//TweenListObj (caurina.transitions.TweenListObj)
package caurina.transitions {
public class TweenListObj {
public var hasStarted:Boolean;
public var onUpdate:Function;
public var useFrames:Boolean;
public var count:Number;
public var onOverwriteParams:Array;
public var timeStart:Number;
public var timeComplete:Number;
public var onStartParams:Array;
public var onUpdateScope:Object;
public var rounded:Boolean;
public var onUpdateParams:Array;
public var properties:Object;
public var onComplete:Function;
public var transitionParams:Object;
public var updatesSkipped:Number;
public var onStart:Function;
public var onOverwriteScope:Object;
public var skipUpdates:Number;
public var onStartScope:Object;
public var scope:Object;
public var isCaller:Boolean;
public var timePaused:Number;
public var transition:Function;
public var onCompleteParams:Array;
public var onError:Function;
public var timesCalled:Number;
public var onErrorScope:Object;
public var onOverwrite:Function;
public var isPaused:Boolean;
public var waitFrames:Boolean;
public var onCompleteScope:Object;
public function TweenListObj(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Boolean, _arg5:Function, _arg6:Object){
scope = _arg1;
timeStart = _arg2;
timeComplete = _arg3;
useFrames = _arg4;
transition = _arg5;
transitionParams = _arg6;
properties = new Object();
isPaused = false;
timePaused = undefined;
isCaller = false;
updatesSkipped = 0;
timesCalled = 0;
skipUpdates = 0;
hasStarted = false;
}
public function clone(_arg1:Boolean):TweenListObj{
var _local3:String;
var _local2:TweenListObj = new TweenListObj(scope, timeStart, timeComplete, useFrames, transition, transitionParams);
_local2.properties = new Array();
for (_local3 in properties) {
_local2.properties[_local3] = properties[_local3].clone();
};
_local2.skipUpdates = skipUpdates;
_local2.updatesSkipped = updatesSkipped;
if (!_arg1){
_local2.onStart = onStart;
_local2.onUpdate = onUpdate;
_local2.onComplete = onComplete;
_local2.onOverwrite = onOverwrite;
_local2.onError = onError;
_local2.onStartParams = onStartParams;
_local2.onUpdateParams = onUpdateParams;
_local2.onCompleteParams = onCompleteParams;
_local2.onOverwriteParams = onOverwriteParams;
_local2.onStartScope = onStartScope;
_local2.onUpdateScope = onUpdateScope;
_local2.onCompleteScope = onCompleteScope;
_local2.onOverwriteScope = onOverwriteScope;
_local2.onErrorScope = onErrorScope;
};
_local2.rounded = rounded;
_local2.isPaused = isPaused;
_local2.timePaused = timePaused;
_local2.isCaller = isCaller;
_local2.count = count;
_local2.timesCalled = timesCalled;
_local2.waitFrames = waitFrames;
_local2.hasStarted = hasStarted;
return (_local2);
}
public function toString():String{
var _local3:String;
var _local1 = "\n[TweenListObj ";
_local1 = (_local1 + ("scope:" + String(scope)));
_local1 = (_local1 + ", properties:");
var _local2:Boolean;
for (_local3 in properties) {
if (!_local2){
_local1 = (_local1 + ",");
};
_local1 = (_local1 + ("[name:" + properties[_local3].name));
_local1 = (_local1 + (",valueStart:" + properties[_local3].valueStart));
_local1 = (_local1 + (",valueComplete:" + properties[_local3].valueComplete));
_local1 = (_local1 + "]");
_local2 = false;
};
_local1 = (_local1 + (", timeStart:" + String(timeStart)));
_local1 = (_local1 + (", timeComplete:" + String(timeComplete)));
_local1 = (_local1 + (", useFrames:" + String(useFrames)));
_local1 = (_local1 + (", transition:" + String(transition)));
_local1 = (_local1 + (", transitionParams:" + String(transitionParams)));
if (skipUpdates){
_local1 = (_local1 + (", skipUpdates:" + String(skipUpdates)));
};
if (updatesSkipped){
_local1 = (_local1 + (", updatesSkipped:" + String(updatesSkipped)));
};
if (Boolean(onStart)){
_local1 = (_local1 + (", onStart:" + String(onStart)));
};
if (Boolean(onUpdate)){
_local1 = (_local1 + (", onUpdate:" + String(onUpdate)));
};
if (Boolean(onComplete)){
_local1 = (_local1 + (", onComplete:" + String(onComplete)));
};
if (Boolean(onOverwrite)){
_local1 = (_local1 + (", onOverwrite:" + String(onOverwrite)));
};
if (Boolean(onError)){
_local1 = (_local1 + (", onError:" + String(onError)));
};
if (onStartParams){
_local1 = (_local1 + (", onStartParams:" + String(onStartParams)));
};
if (onUpdateParams){
_local1 = (_local1 + (", onUpdateParams:" + String(onUpdateParams)));
};
if (onCompleteParams){
_local1 = (_local1 + (", onCompleteParams:" + String(onCompleteParams)));
};
if (onOverwriteParams){
_local1 = (_local1 + (", onOverwriteParams:" + String(onOverwriteParams)));
};
if (onStartScope){
_local1 = (_local1 + (", onStartScope:" + String(onStartScope)));
};
if (onUpdateScope){
_local1 = (_local1 + (", onUpdateScope:" + String(onUpdateScope)));
};
if (onCompleteScope){
_local1 = (_local1 + (", onCompleteScope:" + String(onCompleteScope)));
};
if (onOverwriteScope){
_local1 = (_local1 + (", onOverwriteScope:" + String(onOverwriteScope)));
};
if (onErrorScope){
_local1 = (_local1 + (", onErrorScope:" + String(onErrorScope)));
};
if (rounded){
_local1 = (_local1 + (", rounded:" + String(rounded)));
};
if (isPaused){
_local1 = (_local1 + (", isPaused:" + String(isPaused)));
};
if (timePaused){
_local1 = (_local1 + (", timePaused:" + String(timePaused)));
};
if (isCaller){
_local1 = (_local1 + (", isCaller:" + String(isCaller)));
};
if (count){
_local1 = (_local1 + (", count:" + String(count)));
};
if (timesCalled){
_local1 = (_local1 + (", timesCalled:" + String(timesCalled)));
};
if (waitFrames){
_local1 = (_local1 + (", waitFrames:" + String(waitFrames)));
};
if (hasStarted){
_local1 = (_local1 + (", hasStarted:" + String(hasStarted)));
};
_local1 = (_local1 + "]\n");
return (_local1);
}
public static function makePropertiesChain(_arg1:Object):Object{
var _local3:Object;
var _local4:Object;
var _local5:Object;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local2:Object = _arg1.base;
if (_local2){
_local3 = {};
if ((_local2 is Array)){
_local4 = [];
_local8 = 0;
while (_local8 < _local2.length) {
_local4.push(_local2[_local8]);
_local8++;
};
} else {
_local4 = [_local2];
};
_local4.push(_arg1);
_local6 = _local4.length;
_local7 = 0;
while (_local7 < _local6) {
if (_local4[_local7]["base"]){
_local5 = AuxFunctions.concatObjects(makePropertiesChain(_local4[_local7]["base"]), _local4[_local7]);
} else {
_local5 = _local4[_local7];
};
_local3 = AuxFunctions.concatObjects(_local3, _local5);
_local7++;
};
if (_local3["base"]){
delete _local3["base"];
};
return (_local3);
//unresolved jump
};
return (_arg1);
}
}
}//package caurina.transitions
Section 9
//BaseMonster (core.objects.units.BaseMonster)
package core.objects.units {
import core.*;
import flash.display.*;
import flash.geom.*;
import core.weapons.*;
import core.utils.*;
import caurina.transitions.*;
public class BaseMonster extends BaseUnit {
protected var skinRightWing:MovieClip;
private var gravity:Number;
protected var skinLeftWing:MovieClip;
public var radius:Number;
public var skinInner:MovieClip;
protected var weapon:MonsterWeapon;
protected var path:MonsterPath;
private var isHitted:Boolean;
private var speedX:Number;
public var startDistance:Number;
private var speedY:Number;
public function BaseMonster(_arg1:Number):void{
this.startDistance = _arg1;
super(0, 0);
}
protected function updateHandler(_arg1:CoreEvent):void{
updatePos();
updateSkin();
updateWeapon();
}
public function checkBullet(_arg1:CrossbowBullet):Boolean{
if (!skin){
return (false);
};
var _local2:Number = (((x - _arg1.x) * (x - _arg1.x)) + ((y - _arg1.y) * (y - _arg1.y)));
if (_local2 < (radius * radius)){
hitWithBullet(_arg1);
return (true);
};
return (false);
}
protected function deadSound():void{
var _local1:SoundsManager = SoundsManager.getInstance();
_local1.playSound(_local1.getRandomMonsterDead());
}
private function updateWeapon():void{
if (!isHitted){
weapon.update();
};
}
protected function createWeapon():void{
weapon = new MonsterWeapon(this);
}
protected function getStartPos():Point{
return (path.getCurrentPoint());
}
protected function updatePos():void{
if (!isHitted){
updateUnhittedPos();
} else {
updateHittedPos();
};
}
override protected function init():void{
super.init();
radius = 15;
isHitted = false;
gravity = 0.3;
path = new MonsterPath(this);
var _local1:Point = getStartPos();
x = _local1.x;
y = _local1.y;
birth();
}
protected function birthComplete(_arg1:Sprite):void{
_arg1.parent.removeChild(_arg1);
var _local2:Point = getStartPos();
createSkin();
createWeapon();
engine.addEventListener(CoreEvent.UPDATE, updateHandler);
}
protected function updateHittedPos():void{
speedY = (speedY + gravity);
if (speedY > 10){
speedY = 10;
};
x = (x + speedX);
y = (y + speedY);
if (y > (480 + radius)){
destroy();
};
}
override protected function createSkin():void{
var _local1:Class = engine.assets.getAssetClass(getSkinName());
skin = new (_local1);
engine.canvas.objects.addChild(skin);
skinInner = (skin.getChildByName("inner") as MovieClip);
skinInner.gotoAndStop(1);
skinLeftWing = (skinInner.getChildByName("leftWing") as MovieClip);
skinRightWing = (skinInner.getChildByName("rightWing") as MovieClip);
updateSkin();
}
protected function updateUnhittedPos():void{
var _local1:Point = path.update();
x = _local1.x;
y = _local1.y;
}
protected function getSkinName():String{
return ("wtf?");
}
protected function createBlood(_arg1:Vector, _arg2:Number):void{
var _local3:Class = engine.assets.getAssetClass("BloodAsset");
var _local4:Sprite = new (_local3);
skinInner.addChild(_local4);
var _local5:Point = skinInner.globalToLocal(new Point(_arg1.x, _arg1.y));
_local4.x = _local5.x;
_local4.y = _local5.y;
_local4.rotation = _arg2;
}
override public function destroy():void{
super.destroy();
engine.removeEventListener(CoreEvent.UPDATE, updateHandler);
}
public function hitWithBullet(_arg1:CrossbowBullet):void{
if (!skin){
return;
};
isHitted = true;
engine.monsterDead(this);
var _local2:Sprite = _arg1.getStickedSkin();
var _local3:Point = skin.globalToLocal(new Point(_local2.x, _local2.y));
_local2.x = _local3.x;
_local2.y = _local3.y;
skin.addChild(_local2);
var _local4:Vector = _arg1.getVelocity();
speedX = (_local4.x * 0.5);
speedY = (_local4.y * 0.5);
skinLeftWing.stop();
skinRightWing.stop();
var _local5:MonsterWing = new MonsterWing(skinLeftWing, speedX, speedY);
var _local6:MonsterWing = new MonsterWing(skinRightWing, speedX, speedY);
skinInner.gotoAndStop(2);
deadSound();
createBlood(new Vector(_arg1.x, _arg1.y), ((_arg1.angle * 180) / Math.PI));
}
protected function birth():void{
var _local1:Class = engine.assets.getAssetClass(getSkinName());
var _local2:Sprite = new (_local1);
engine.canvas.objects.addChild(_local2);
var _local3:MovieClip = (_local2.getChildByName("inner") as MovieClip);
_local3.gotoAndStop(1);
var _local4:MovieClip = (_local3.getChildByName("leftWing") as MovieClip);
var _local5:MovieClip = (_local3.getChildByName("rightWing") as MovieClip);
_local4.stop();
_local5.stop();
var _local6:Point = getStartPos();
_local2.x = _local6.x;
_local2.y = _local6.y;
_local2.alpha = 0;
Tweener.addTween(_local2, {alpha:1, time:1, transition:"linear", onComplete:birthComplete, onCompleteParams:[_local2]});
}
}
}//package core.objects.units
Section 10
//BaseUnit (core.objects.units.BaseUnit)
package core.objects.units {
import flash.display.*;
import core.objects.*;
public class BaseUnit extends BaseObject {
protected var xtile:int;
protected var ytile:int;
public var x:Number;
public var y:Number;
protected var skin:Sprite;
public function BaseUnit(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
super();
}
protected function createSkin():void{
}
override public function destroy():void{
super.destroy();
if (skin.parent){
skin.parent.removeChild(skin);
};
}
protected function updateSkin():void{
skin.x = x;
skin.y = y;
}
override protected function init():void{
super.init();
}
}
}//package core.objects.units
Section 11
//Monster1 (core.objects.units.Monster1)
package core.objects.units {
import core.*;
public class Monster1 extends BaseMonster {
public function Monster1(_arg1:Number):void{
super(_arg1);
}
override protected function deadSound():void{
var _local1:SoundsManager = SoundsManager.getInstance();
_local1.playSound(_local1.monsterDuckDead);
}
override protected function getSkinName():String{
return ("Monster1Asset");
}
}
}//package core.objects.units
Section 12
//Monster10 (core.objects.units.Monster10)
package core.objects.units {
public class Monster10 extends BaseMonster {
public function Monster10(_arg1:Number):void{
super(_arg1);
}
override protected function getSkinName():String{
return ("Monster10Asset");
}
}
}//package core.objects.units
Section 13
//Monster2 (core.objects.units.Monster2)
package core.objects.units {
public class Monster2 extends BaseMonster {
public function Monster2(_arg1:Number):void{
super(_arg1);
}
override protected function getSkinName():String{
return ("Monster2Asset");
}
}
}//package core.objects.units
Section 14
//Monster3 (core.objects.units.Monster3)
package core.objects.units {
public class Monster3 extends BaseMonster {
public function Monster3(_arg1:Number):void{
super(_arg1);
}
override protected function getSkinName():String{
return ("Monster3Asset");
}
}
}//package core.objects.units
Section 15
//Monster4 (core.objects.units.Monster4)
package core.objects.units {
public class Monster4 extends BaseMonster {
public function Monster4(_arg1:Number):void{
super(_arg1);
}
override protected function getSkinName():String{
return ("Monster4Asset");
}
}
}//package core.objects.units
Section 16
//Monster5 (core.objects.units.Monster5)
package core.objects.units {
public class Monster5 extends BaseMonster {
public function Monster5(_arg1:Number):void{
super(_arg1);
}
override protected function getSkinName():String{
return ("Monster5Asset");
}
}
}//package core.objects.units
Section 17
//Monster6 (core.objects.units.Monster6)
package core.objects.units {
public class Monster6 extends BaseMonster {
public function Monster6(_arg1:Number):void{
super(_arg1);
}
override protected function getSkinName():String{
return ("Monster6Asset");
}
}
}//package core.objects.units
Section 18
//Monster7 (core.objects.units.Monster7)
package core.objects.units {
public class Monster7 extends BaseMonster {
public function Monster7(_arg1:Number):void{
super(_arg1);
}
override protected function getSkinName():String{
return ("Monster7Asset");
}
}
}//package core.objects.units
Section 19
//Monster8 (core.objects.units.Monster8)
package core.objects.units {
public class Monster8 extends BaseMonster {
public function Monster8(_arg1:Number):void{
super(_arg1);
}
override protected function getSkinName():String{
return ("Monster8Asset");
}
}
}//package core.objects.units
Section 20
//Monster9 (core.objects.units.Monster9)
package core.objects.units {
public class Monster9 extends BaseMonster {
public function Monster9(_arg1:Number):void{
super(_arg1);
}
override protected function getSkinName():String{
return ("Monster9Asset");
}
}
}//package core.objects.units
Section 21
//MonsterDef (core.objects.units.MonsterDef)
package core.objects.units {
public class MonsterDef {
public var type:String;
public var startDistance:Number;
public static const TYPE_10:String = "TypeMonster10";
public static const TYPE_1:String = "TypeMonster1";
public static const TYPE_2:String = "TypeMonster2";
public static const TYPE_3:String = "TypeMonster3";
public static const TYPE_4:String = "TypeMonster4";
public static const TYPE_5:String = "TypeMonster5";
public static const TYPE_6:String = "TypeMonster6";
public static const TYPE_7:String = "TypeMonster7";
public static const TYPE_8:String = "TypeMonster8";
public static const TYPE_9:String = "TypeMonster9";
public function MonsterDef(_arg1:String, _arg2:Number=0):void{
this.type = _arg1;
this.startDistance = _arg2;
}
}
}//package core.objects.units
Section 22
//Player (core.objects.units.Player)
package core.objects.units {
import flash.events.*;
import core.*;
import flash.display.*;
import flash.geom.*;
import core.weapons.*;
public class Player extends BaseUnit {
private var jumpstart:Number;
public var skinWeaponHolder:Sprite;
protected var upleft:Boolean;
protected var downleft:Boolean;
private var weapon:CrossbowWeapon;
protected var downright:Boolean;
public var width2:Number;// = 17.5
public var skinCrown:MovieClip;
private var input:KeyboardManager;
private var gravity:Number;
private var skinInner:Sprite;
public var health:Number;
private var skinHit:MovieClip;
private var jumpspeed:Number;
protected var upright:Boolean;
private var isJumping:Boolean;
public var height2:Number;// = 24.5
private var skinInner2:MovieClip;
public function Player(_arg1:Number, _arg2:Number):void{
super(_arg1, _arg2);
}
override protected function init():void{
super.init();
input = KeyboardManager.getInstance();
xtile = Math.floor((x / Map.tileW));
ytile = Math.floor((y / Map.tileH));
health = 60;
corners = [new Point(-(width2), -(height2)), new Point((width2 - 1), -(height2)), new Point((width2 - 1), (height2 - 1)), new Point(-(width2), (height2 - 1))];
createSkin();
createWeapon();
jumpstart = -10;
gravity = 0.5;
checkFall();
engine.addEventListener(CoreEvent.UPDATE, updateHandler);
}
public function shootByWeapon():void{
dispatchEvent(new CoreEvent(CoreEvent.PLAYER_SHOOT));
}
private function hitEfHandler(_arg1:Event):void{
if (skinHit.currentFrame == skinHit.totalFrames){
skinHit.gotoAndStop(1);
skinHit.removeEventListener(Event.ENTER_FRAME, hitEfHandler);
skinHit.visible = false;
skinInner2.visible = true;
};
}
override protected function createSkin():void{
var _local1:Class = engine.assets.getAssetClass("PlayerAsset");
skin = new (_local1);
engine.canvas.objects.addChild(skin);
skinInner = (skin.getChildByName("inner") as Sprite);
skinInner2 = (skinInner.getChildByName("inner2") as MovieClip);
skinWeaponHolder = (skin.getChildByName("weaponHolder") as Sprite);
skinHit = (skinInner.getChildByName("hit") as MovieClip);
skinCrown = (skinInner.getChildByName("crown") as MovieClip);
skinInner2.stop();
skinHit.stop();
skinCrown.stop();
skinHit.visible = false;
}
override protected function checkCorners(_arg1:Number, _arg2:Number):Array{
var _local3:Array = super.checkCorners(_arg1, _arg2);
upleft = _local3[0];
upright = _local3[1];
downright = _local3[2];
downleft = _local3[3];
return (_local3);
}
private function checkFall():void{
if (!isJumping){
checkCorners(x, (y + 1));
if (((downleft) && (downright))){
jumpspeed = 0;
isJumping = true;
};
};
}
private function jump():void{
jumpspeed = (jumpspeed + gravity);
if (jumpspeed > Map.tileH){
jumpspeed = Map.tileH;
};
move(0, jumpspeed);
}
private function createWeapon():void{
weapon = new CrossbowWeapon(this);
}
public function levelStart():void{
skinCrown.visible = false;
}
protected function updateHandler(_arg1:CoreEvent):void{
updateKeys();
if (isJumping){
jump();
};
updateSkin();
weapon.update();
}
public function collideWithBullet(_arg1:MonsterBullet):void{
if (health <= 0){
return;
};
health = (health - _arg1.damage);
if (health <= 0){
health = 0;
engine.playerDead();
} else {
skinHit.removeEventListener(Event.ENTER_FRAME, hitEfHandler);
skinHit.visible = true;
skinHit.gotoAndPlay(1);
skinInner2.visible = false;
skinHit.addEventListener(Event.ENTER_FRAME, hitEfHandler);
engine.playerInPain();
};
}
protected function move(_arg1:Number, _arg2:Number):void{
checkCorners(x, (y + _arg2));
if (_arg2 < 0){
if (((upleft) && (upright))){
y = (y + _arg2);
} else {
y = ((ytile * Map.tileH) + height2);
jumpspeed = 0;
};
};
if (_arg2 > 0){
if (((downleft) && (downright))){
y = (y + _arg2);
} else {
y = (((ytile + 1) * Map.tileH) - height2);
isJumping = false;
};
};
checkCorners((x + _arg1), y);
if (_arg1 < 0){
if (((downleft) && (upleft))){
x = (x + _arg1);
checkFall();
} else {
x = ((xtile * Map.tileW) + width2);
};
};
if (_arg1 > 0){
if (((upright) && (downright))){
x = (x + _arg1);
checkFall();
} else {
x = (((xtile + 1) * Map.tileW) - width2);
};
};
xtile = Math.floor((x / Map.tileW));
ytile = Math.floor((y / Map.tileH));
}
protected function updateKeys():void{
if (((KeyboardManager.KEY_RIGHT) || (KeyboardManager.KEY_D))){
move(5, 0);
if (onFloor()){
skinInner2.nextFrame();
skinCrown.gotoAndStop(skinInner2.currentFrame);
};
} else {
if (((KeyboardManager.KEY_LEFT) || (KeyboardManager.KEY_A))){
move(-5, 0);
if (onFloor()){
skinInner2.nextFrame();
skinCrown.gotoAndStop(skinInner2.currentFrame);
};
};
};
if (((((KeyboardManager.KEY_W) || (KeyboardManager.KEY_UP))) && (!(isJumping)))){
isJumping = true;
jumpspeed = jumpstart;
};
}
override protected function updateSkin():void{
super.updateSkin();
if (engine.canvas.level.mouseX < x){
weapon.skin.scaleY = 1;
skinWeaponHolder.x = -27;
skinInner.scaleX = 1;
} else {
weapon.skin.scaleY = -1;
skinWeaponHolder.x = 27;
skinInner.scaleX = -1;
};
}
public function levelComplete():void{
skinCrown.visible = true;
}
private function onFloor():Boolean{
return (((!(downleft)) || (!(downright))));
}
override public function destroy():void{
super.destroy();
weapon.destroy();
engine.removeEventListener(CoreEvent.UPDATE, updateHandler);
}
}
}//package core.objects.units
Section 23
//BaseObject (core.objects.BaseObject)
package core.objects {
import flash.events.*;
import core.*;
import flash.geom.*;
import core.tiles.*;
public class BaseObject extends EventDispatcher {
protected var engine:CoreEngine;
protected var corners:Array;
public function BaseObject():void{
init();
}
protected function init():void{
engine = CoreEngine.getInstance();
engine.addEventListener(CoreEvent.DESTROY, destroyHandler);
}
protected function checkCorners(_arg1:Number, _arg2:Number):Array{
var _local5:Point;
var _local6:int;
var _local7:int;
var _local8:AbstractTile;
var _local9:Boolean;
if (!corners){
return (null);
};
var _local3:Array = [];
var _local4:uint;
while (_local4 < corners.length) {
_local5 = corners[_local4];
_local6 = Math.floor(((_arg2 + _local5.y) / Map.tileH));
_local7 = Math.floor(((_arg1 + _local5.x) / Map.tileW));
_local8 = engine.map.getTile(_local6, _local7);
_local9 = (_local8) ? _local8.isWalkable(_arg1, _arg2) : false;
_local3.push(_local9);
_local4++;
};
return (_local3);
}
protected function destroyHandler(_arg1:CoreEvent):void{
destroy();
}
public function destroy():void{
engine.removeEventListener(CoreEvent.DESTROY, destroyHandler);
}
}
}//package core.objects
Section 24
//AbstractTile (core.tiles.AbstractTile)
package core.tiles {
import core.*;
import flash.display.*;
public class AbstractTile {
protected var engine:CoreEngine;
public var x:Number;
public var y:Number;
public var skin:Sprite;
public function AbstractTile(_arg1:int, _arg2:int):void{
this.x = _arg1;
this.y = _arg2;
init();
}
protected function init():void{
engine = CoreEngine.getInstance();
}
protected function createSkin():void{
}
public function isWalkable(_arg1:Number, _arg2:Number):Boolean{
return (false);
}
}
}//package core.tiles
Section 25
//EmptyTile (core.tiles.EmptyTile)
package core.tiles {
import core.*;
public class EmptyTile extends AbstractTile {
public function EmptyTile(_arg1:Number, _arg2:Number):void{
super(_arg1, _arg2);
}
override protected function init():void{
super.init();
}
override protected function createSkin():void{
var _local1:Class = engine.assets.getAssetClass("EmptyTileAsset");
skin = new (_local1);
engine.canvas.objects.addChild(skin);
skin.x = (x * Map.tileW);
skin.y = (y * Map.tileH);
}
override public function isWalkable(_arg1:Number, _arg2:Number):Boolean{
return (true);
}
}
}//package core.tiles
Section 26
//GroundTile (core.tiles.GroundTile)
package core.tiles {
import core.*;
public class GroundTile extends AbstractTile {
private var boundary:Number;
public function GroundTile(_arg1:Number, _arg2:Number):void{
super(_arg1, _arg2);
}
override protected function init():void{
super.init();
boundary = 50;
}
override protected function createSkin():void{
var _local1:Class = engine.assets.getAssetClass("WallTileAsset");
skin = new (_local1);
engine.canvas.objects.addChild(skin);
skin.x = (x * Map.tileW);
skin.y = (y * Map.tileH);
}
override public function isWalkable(_arg1:Number, _arg2:Number):Boolean{
var _local3:Number = (this.y * Map.tileH);
return ((_arg2 < (_local3 + boundary)));
}
}
}//package core.tiles
Section 27
//WallTile (core.tiles.WallTile)
package core.tiles {
import core.*;
public class WallTile extends AbstractTile {
public function WallTile(_arg1:Number, _arg2:Number):void{
super(_arg1, _arg2);
}
override protected function createSkin():void{
var _local1:Class = engine.assets.getAssetClass("WallTileAsset");
skin = new (_local1);
engine.canvas.objects.addChild(skin);
skin.x = (x * Map.tileW);
skin.y = (y * Map.tileH);
}
}
}//package core.tiles
Section 28
//BulletTrail (core.utils.BulletTrail)
package core.utils {
import core.*;
import flash.display.*;
import flash.geom.*;
import core.weapons.*;
import caurina.transitions.*;
public class BulletTrail {
private var bullet:CrossbowBullet;
private var points:Array;
private var engine:CoreEngine;
private var isDead:Boolean;
private var skin:Sprite;
public function BulletTrail(_arg1:CrossbowBullet):void{
this.bullet = _arg1;
init();
}
public function destroy():void{
Tweener.addTween(skin, {alpha:0, time:0.4, transition:"linear", onComplete:dissapearComplete});
}
private function init():void{
engine = CoreEngine.getInstance();
skin = new Sprite();
engine.canvas.objects.addChild(skin);
points = [];
}
public function update():void{
var _local3:Point;
var _local1:Point = bullet.skin.localToGlobal(new Point(-41, 0));
if (points.length < 10){
points.push(_local1);
} else {
points.splice(0, 1);
points.push(_local1);
};
skin.graphics.clear();
skin.graphics.moveTo(points[0].x, points[0].y);
var _local2:uint = 1;
while (_local2 < points.length) {
_local3 = points[_local2];
skin.graphics.lineStyle(2, 0xFFFFFF, (_local2 / 20));
skin.graphics.lineTo(_local3.x, _local3.y);
_local2++;
};
}
private function dissapearComplete():void{
skin.parent.removeChild(skin);
}
}
}//package core.utils
Section 29
//Curve (core.utils.Curve)
package core.utils {
import flash.display.*;
import flash.geom.*;
public class Curve {
public var start:Point;
private var __length:Number;
private var beziers:Array;
private var __length_dirty:Boolean;// = true
public var end:Point;
public function Curve(_arg1:Point=null, _arg2:Point=null){
this.start = (((_arg1 as Point)) || (new Point()));
this.end = (((_arg2 as Point)) || (new Point()));
beziers = [];
}
public function removeControl(_arg1:Point):void{
var _local3:int;
var _local4:Bezier;
var _local5:Bezier;
var _local2:Bezier = getBezierByControl(_arg1);
if (_local2){
_local3 = beziers.indexOf(_local2);
_local4 = beziers[(_local3 - 1)];
_local5 = beziers[(_local3 + 1)];
if (((_local4) && (_local5))){
_local4.end = _local5.start;
_local5.start = _local4.end;
} else {
if (beziers.length == 1){
} else {
if (_local3 == 0){
_local5.start = start;
} else {
if (_local3 == (beziers.length - 1)){
_local4.end = end;
};
};
};
};
beziers.splice(_local3, 1);
update();
};
}
public function pushControl(_arg1:Point):void{
var _local2:Bezier;
var _local3:Bezier;
if ((_arg1 as Point)){
if (beziers.length){
_local3 = beziers[(beziers.length - 1)];
_local3.end = new Point();
_local2 = new Bezier(_local3.end, _arg1, end);
} else {
_local2 = new Bezier(start, _arg1, end);
};
beziers[beziers.length] = _local2;
update();
};
}
private function drawBezier(_arg1:Graphics, _arg2:Bezier, _arg3:Boolean=false):void{
if (_arg3){
_arg1.moveTo(_arg2.start.x, _arg2.start.y);
};
_arg1.curveTo(_arg2.control.x, _arg2.control.y, _arg2.end.x, _arg2.end.y);
}
public function update():void{
var _local3:Bezier;
var _local5:Point;
__length_dirty = true;
var _local1:uint = beziers.length;
if (!_local1){
return;
};
var _local2:Bezier = (beziers[0] as Bezier);
var _local4:uint = 1;
while (_local4 < _local1) {
_local3 = beziers[_local4];
_local5 = Point.interpolate(_local2.control, _local3.control, 0.5);
_local3.start.x = _local5.x;
_local3.start.y = _local5.y;
_local2 = _local3;
_local4++;
};
}
public function getControlPoints():Array{
var _local3:Bezier;
var _local1:Array = [];
var _local2:uint;
while (_local2 < beziers.length) {
_local3 = beziers[_local2];
_local1.push(_local3.control);
_local2++;
};
return (_local1);
}
public function draw(_arg1:Graphics):void{
if (!(_arg1 as Graphics)){
return;
};
_arg1.moveTo(start.x, start.y);
var _local2:uint = beziers.length;
if (!_local2){
_arg1.lineTo(end.x, end.y);
return;
};
var _local3:Bezier = (beziers[0] as Bezier);
drawBezier(_arg1, _local3, true);
var _local4:uint = 1;
while (_local4 < _local2) {
_local3 = (beziers[_local4] as Bezier);
drawBezier(_arg1, _local3);
_local4++;
};
}
public function get length():Number{
var _local2:Number;
var _local3:uint;
var _local4:Bezier;
if (!__length_dirty){
return (__length);
};
var _local1:uint = beziers.length;
if (_local1){
_local2 = 0;
_local3 = 0;
while (_local3 < _local1) {
_local4 = beziers[_local3];
_local2 = (_local2 + _local4.length);
_local3++;
};
__length = _local2;
} else {
__length = Point.distance(start, end);
};
__length_dirty = false;
return (__length);
}
private function getBezierByControl(_arg1:Point):Bezier{
var _local3:Bezier;
var _local2:uint;
while (_local2 < beziers.length) {
_local3 = beziers[_local2];
if (_local3.control == _arg1){
return (_local3);
};
_local2++;
};
return (null);
}
public function getPointByDistance(_arg1:Number):Point{
var _local6:Bezier;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Point;
if (_arg1 <= 0){
return (start.clone());
};
var _local2:Number = length;
if (_arg1 >= _local2){
return (end.clone());
};
var _local3:Number = 0;
var _local4:uint = beziers.length;
var _local5:uint;
while (_local5 < _local4) {
_local6 = (beziers[_local5] as Bezier);
_local7 = _local6.length;
if ((_local3 + _local7) > _arg1){
_local8 = (_arg1 - _local3);
_local9 = _local6.getTimeByDistance(_local8);
_local10 = _local6.getPoint(_local9);
return (_local10);
};
_local3 = (_local3 + _local7);
_local5++;
};
throw (new Error((("**ERROR** usage.SmoothCurve.getPointByDistance(" + _arg1) + ")")));
}
}
}//package core.utils
Section 30
//MonsterPath (core.utils.MonsterPath)
package core.utils {
import core.*;
import core.objects.units.*;
import flash.geom.*;
public class MonsterPath {
private var engine:CoreEngine;
private var speed:Number;
private var curve:Curve;
private var owner:BaseMonster;
public var distance:Number;
public static const DEBUG:Boolean = false;
public function MonsterPath(_arg1:BaseMonster):void{
this.owner = _arg1;
init();
}
public function update():Point{
distance = (distance + speed);
distance = (distance % curve.length);
var _local1:Point = curve.getPointByDistance(distance);
if (DEBUG){
curve.draw(engine.canvas.debug.graphics);
};
return (_local1);
}
public function getCurrentPoint():Point{
return (curve.getPointByDistance(distance));
}
private function init():void{
var _local1:uint;
var _local2:String;
var _local3:Point;
var _local10:Array;
var _local11:Point;
engine = CoreEngine.getInstance();
var _local4:Array = [];
if ((owner is Monster1)){
_local2 = "95_61 95_61 565_49|606_104|545_153|234_164|231_304|409_303|419_183|204_150|54_136|43_68";
} else {
if ((owner is Monster2)){
_local2 = "527_48 527_48 305_42|65_58|28_138|100_251|202_133|308_82|400_130|362_228|245_224|226_137|271_88|391_92|416_155|455_235|580_228|591_112|513_61|437_98|442_197|544_225|604_149|575_47";
} else {
if ((owner is Monster3)){
_local2 = "60_79 60_79 158_54|234_154|138_235|45_146|120_60|277_70|388_109|374_220|240_212|245_95|364_54|540_63|568_209|444_223|403_157|447_89|560_95|603_86|593_35|288_23|37_42|27_76";
} else {
if ((owner is Monster4)){
_local2 = "44_111 44_111 42_140|108_172|186_99|246_178|336_100|417_181|479_104|566_184|604_114|551_56|479_35|405_99|328_25|257_97|195_20|128_97|40_44";
} else {
if ((owner is Monster5)){
_local2 = "66_130 66_130 119_41|214_39|192_90|142_156|244_159|299_34|405_43|309_159|431_157|488_31|595_63|478_176|598_247|514_298|436_196|334_218|411_312|294_298|256_218|150_218|202_312|90_294|42_166";
} else {
if ((owner is Monster6)){
_local2 = "132_60 132_60 158_55|179_93|173_199|203_220|240_197|236_70|272_54|308_79|303_202|340_226|363_198|358_77|389_53|429_79|415_200|448_225|484_200|472_84|508_50|542_83|539_272|476_293|427_260|377_297|325_259|267_290|212_264|151_291|113_241|111_138|112_59";
} else {
if ((owner is Monster7)){
_local2 = "66_42 66_42 326_43|582_44|607_71|582_99|323_97|80_91|46_123|77_147|322_147|590_145|603_174|575_201|318_207|66_196|41_226|75_251|322_248|581_245|606_273|581_306|316_304|65_300|20_256|21_106|34_41";
} else {
if ((owner is Monster8)){
_local2 = "66_100 66_101 97_97|121_139|105_289|147_324|190_288|168_119|207_85|239_115|234_227|274_260|304_224|301_118|336_85|366_117|365_288|404_325|441_288|427_118|470_87|505_118|494_228|523_260|556_227|557_97|516_55|285_46|36_63|33_104";
} else {
if ((owner is Monster9)){
_local2 = "136_147 136_147 141_81|299_116|205_167|202_285|299_319|394_288|416_197|341_109|454_60|537_140|466_183|481_253|563_266|611_229|581_155|549_42|284_29|85_52|34_152|28_261|107_287|176_232|127_168";
} else {
if ((owner is Monster10)){
_local2 = "52_90 52_90 80_85|155_114|190_180|247_184|284_159|273_90|197_64|138_114|137_169|187_211|282_218|334_132|376_83|443_83|452_135|414_150|367_143|336_87|374_57|441_57|480_94|486_150|422_187|349_172|315_124|319_66|382_33|481_47|516_140|545_179|598_180|615_136|597_85|535_88|468_218|362_214|323_171|270_55|200_26|134_50|104_140|61_184|16_157|19_107";
} else {
trace("ERROR PATH");
return;
};
};
};
};
};
};
};
};
};
};
var _local5:Array = _local2.split(" ");
var _local6:Array = _local5[0].split("_");
var _local7:Array = _local5[1].split("_");
_local3 = new Point(Number(_local6[0]), Number(_local6[1]));
var _local8:Array = _local5[2].split("|");
_local1 = 0;
while (_local1 < _local8.length) {
_local10 = _local8[_local1].split("_");
_local11 = new Point(Number(_local10[0]), Number(_local10[1]));
_local4.push(_local11);
_local1++;
};
curve = new Curve(_local3, _local3);
_local1 = 0;
while (_local1 < _local4.length) {
curve.pushControl(_local4[_local1]);
_local1++;
};
speed = 3;
var _local9:Number = (owner.startDistance * curve.length);
distance = _local9;
}
}
}//package core.utils
Section 31
//MonsterWing (core.utils.MonsterWing)
package core.utils {
import core.*;
import flash.display.*;
import flash.geom.*;
public class MonsterWing {
private var engine:CoreEngine;
private var gravity:Number;
private var speedX:Number;
private var speedY:Number;
private var startSpeedX:Number;
private var startSpeedY:Number;
private var angle:Number;
private var skin:Sprite;
public function MonsterWing(_arg1:Sprite, _arg2:Number, _arg3:Number):void{
this.skin = _arg1;
this.startSpeedX = _arg2;
this.startSpeedY = _arg3;
init();
}
protected function updateHandler(_arg1:CoreEvent):void{
speedY = (speedY + gravity);
if (speedY > 10){
speedY = 10;
};
skin.x = (skin.x + speedX);
skin.y = (skin.y + speedY);
skin.rotation = (skin.rotation + angle);
limit();
}
private function destroy():void{
skin.parent.removeChild(skin);
engine.removeEventListener(CoreEvent.UPDATE, updateHandler);
}
private function init():void{
engine = CoreEngine.getInstance();
gravity = 0.3;
speedX = ((startSpeedX - 2) + (Math.random() * 4));
speedY = ((startSpeedY - 2) + (Math.random() * 4));
angle = (-3 + Math.round((Math.random() * 6)));
var _local1:Point = skin.parent.localToGlobal(new Point(skin.x, skin.y));
engine.canvas.objects.addChild(skin);
skin.x = _local1.x;
skin.y = _local1.y;
engine.addEventListener(CoreEvent.UPDATE, updateHandler);
}
private function limit():void{
if (skin.y > 490){
destroy();
};
}
}
}//package core.utils
Section 32
//AbstractBullet (core.weapons.AbstractBullet)
package core.weapons {
import core.*;
import flash.display.*;
import flash.geom.*;
import core.objects.*;
import caurina.transitions.*;
public class AbstractBullet extends BaseObject {
public var bulletDef:BulletDef;
protected var height:Number;
protected var lifeTime:uint;
protected var totalLifeTime:uint;
protected var width:Number;
public var x:Number;
public var y:Number;
public var skin:Sprite;
public function AbstractBullet(_arg1:BulletDef):void{
bulletDef = _arg1;
super();
}
protected function createSkin():void{
}
override public function destroy():void{
super.destroy();
if (skin.parent){
skin.parent.removeChild(skin);
};
engine.removeEventListener(CoreEvent.UPDATE, updateHandler);
}
protected function updateHandler(_arg1:CoreEvent=null):void{
updatePos();
updateSkin();
lifeTime++;
if (lifeTime == totalLifeTime){
dieFromTime();
};
}
protected function updatePos():void{
}
private function dieComplete():void{
destroy();
}
override protected function init():void{
super.init();
x = bulletDef.x;
y = bulletDef.y;
totalLifeTime = 200;
lifeTime = 0;
corners = [new Point(0, 0)];
createSkin();
engine.addEventListener(CoreEvent.UPDATE, updateHandler);
}
private function dieFromTime():void{
Tweener.addTween(skin, {alpha:0, time:0.3, transition:"linear", onComplete:dieComplete});
}
protected function updateSkin():void{
skin.x = x;
skin.y = y;
}
}
}//package core.weapons
Section 33
//AbstractWeapon (core.weapons.AbstractWeapon)
package core.weapons {
import flash.events.*;
import core.*;
import flash.display.*;
import flash.geom.*;
public class AbstractWeapon extends EventDispatcher {
protected var engine:CoreEngine;
public var reloadTime:int;
public var totalReloadTime:uint;// = 30
public var bulletsLeft:int;
public var skin:Sprite;
public function AbstractWeapon():void{
init();
}
public function rotateToPoint(_arg1:Point):void{
var _local2:Point = skin.parent.globalToLocal(_arg1);
var _local3:Number = ((Math.atan2(_local2.y, _local2.x) * 180) / Math.PI);
skin.rotation = _local3;
}
protected function weaponReady():void{
reloadTime = -1;
}
protected function doFire():void{
}
public function update():void{
if (reloadTime == -1){
return;
};
if (reloadTime < totalReloadTime){
reloadTime++;
} else {
weaponReady();
};
}
public function getSkin():Sprite{
return (skin);
}
public function reset():void{
reloadTime = -1;
bulletsLeft = 30;
}
public function fire():void{
if ((((((bulletsLeft > 0)) || ((bulletsLeft == -1)))) && ((reloadTime == -1)))){
reloadTime = 0;
doFire();
if (bulletsLeft != -1){
bulletsLeft--;
};
};
}
protected function init():void{
engine = CoreEngine.getInstance();
reset();
}
}
}//package core.weapons
Section 34
//BulletDef (core.weapons.BulletDef)
package core.weapons {
import core.*;
public class BulletDef {
public var x:Number;
public var y:Number;
public var dir:Vector;
public function BulletDef(_arg1:Number, _arg2:Number, _arg3:Vector):void{
this.x = _arg1;
this.y = _arg2;
this.dir = _arg3;
}
}
}//package core.weapons
Section 35
//CrossbowBullet (core.weapons.CrossbowBullet)
package core.weapons {
import core.*;
import flash.display.*;
import core.objects.units.*;
import flash.geom.*;
import core.tiles.*;
import core.utils.*;
import caurina.transitions.*;
public class CrossbowBullet extends PlayerBullet {
private var prevX:Number;
private var trail:BulletTrail;
private var speed:Number;
private var prevY:Number;
public var angle:Number;
private var gravity:Number;
private var xtile:int;
private var ytile:int;
private var velocity:Vector;
private var speedX:Number;
private var speedY:Number;
public function CrossbowBullet(_arg1:BulletDef):void{
super(_arg1);
}
override protected function updateHandler(_arg1:CoreEvent=null):void{
trail.update();
super.updateHandler(_arg1);
checkMonsters();
}
private function checkMonsters():void{
var _local2:BaseMonster;
var _local1:uint;
while (_local1 < engine.monsters.length) {
_local2 = engine.monsters[_local1];
if (_local2.checkBullet(this)){
destroy();
};
_local1++;
};
}
override public function destroy():void{
super.destroy();
trail.destroy();
}
override protected function updatePos():void{
speedY = (speedY + gravity);
move(speedX, speedY);
angle = Math.atan2((y - prevY), (x - prevX));
velocity.x = (x - prevX);
velocity.y = (y - prevY);
prevX = x;
prevY = y;
}
private function stickedComplete(_arg1:Sprite):void{
_arg1.parent.removeChild(_arg1);
}
override protected function init():void{
super.init();
xtile = Math.floor((x / Map.tileW));
ytile = Math.floor((y / Map.tileH));
gravity = 0.3;
speed = 15;
speedX = (bulletDef.dir.x * speed);
speedY = (bulletDef.dir.y * speed);
angle = Math.atan2(bulletDef.dir.y, bulletDef.dir.x);
prevX = bulletDef.x;
prevY = bulletDef.y;
velocity = new Vector(0, 0);
trail = new BulletTrail(this);
}
private function move(_arg1:Number, _arg2:Number):void{
var _local3:Array;
var _local4:Boolean;
_local3 = checkCorners(x, (y + _arg2));
_local4 = _local3[0];
if (!_local4){
if (_arg2 < 0){
y = (ytile * Map.tileH);
} else {
if (_arg2 > 0){
y = ((ytile + 1) * Map.tileH);
};
};
hitTile();
return;
} else {
y = (y + _arg2);
};
_local3 = checkCorners((x + _arg1), y);
_local4 = _local3[0];
if (!_local4){
if (_arg1 < 0){
x = (xtile * Map.tileW);
} else {
if (_arg1 > 0){
x = ((xtile + 1) * Map.tileW);
};
};
hitTile();
return;
} else {
x = (x + _arg1);
};
xtile = Math.floor((x / Map.tileW));
ytile = Math.floor((y / Map.tileH));
}
public function getStickedSkin(_arg1:Boolean=false):Sprite{
var _local2:Class = engine.assets.getAssetClass("CrossbowArrowStickedAsset");
var _local3:MovieClip = new (_local2);
_local3.x = x;
_local3.y = y;
_local3.rotation = ((angle * 180) / Math.PI);
if (_arg1){
_local3.gotoAndStop(1);
} else {
_local3.gotoAndStop(2);
};
return (_local3);
}
override protected function createSkin():void{
var _local1:Class = engine.assets.getAssetClass("CrossbowArrowAsset");
skin = new (_local1);
engine.canvas.objects.addChild(skin);
updateSkin();
}
public function getVelocity():Vector{
return (velocity);
}
private function hitTile():void{
var _local1:Sprite = getStickedSkin();
engine.canvas.objects.addChild(_local1);
Tweener.addTween(_local1, {alpha:0, time:0.5, delay:2, transition:"linear", onComplete:stickedComplete, onCompleteParams:[_local1]});
destroy();
}
override public function collideWithMonster():void{
super.collideWithMonster();
trail.destroy();
}
override protected function updateSkin():void{
skin.x = x;
skin.y = y;
skin.rotation = ((angle * 180) / Math.PI);
}
override protected function checkCorners(_arg1:Number, _arg2:Number):Array{
var _local5:Point;
var _local6:int;
var _local7:int;
var _local8:AbstractTile;
var _local9:Boolean;
if (!corners){
return (null);
};
var _local3:Array = [];
var _local4:uint;
while (_local4 < corners.length) {
_local5 = corners[_local4];
_local6 = Math.floor(((_arg2 + _local5.y) / Map.tileH));
_local7 = Math.floor(((_arg1 + _local5.x) / Map.tileW));
_local8 = engine.map.getTile(_local6, _local7);
_local9 = (_local8) ? _local8.isWalkable(_arg1, _arg2) : true;
_local3.push(_local9);
_local4++;
};
return (_local3);
}
}
}//package core.weapons
Section 36
//CrossbowWeapon (core.weapons.CrossbowWeapon)
package core.weapons {
import core.*;
import flash.display.*;
import core.objects.units.*;
import flash.geom.*;
public class CrossbowWeapon extends PlayerWeapon {
private var skinInner:MovieClip;
public static const NAME:String = "CrossbowWeapon";
public function CrossbowWeapon(_arg1:Player):void{
super(_arg1);
}
override protected function doFire():void{
super.doFire();
var _local1:Point = skin.localToGlobal(new Point(25, 0));
var _local2:Number = skin.rotation;
var _local3:Number = ((_local2 * Math.PI) / 180);
var _local4:Number = Math.cos(_local3);
var _local5:Number = Math.sin(_local3);
var _local6:Number = (engine.canvas.objects.mouseX - _local1.x);
var _local7:Number = (engine.canvas.objects.mouseY - _local1.y);
var _local8:Vector = new Vector(_local6, _local7);
_local8.normalize();
var _local9:BulletDef = new BulletDef(_local1.x, _local1.y, _local8);
var _local10:CrossbowBullet = new CrossbowBullet(_local9);
var _local11:SoundsManager = SoundsManager.getInstance();
SoundsManager.getInstance().playSound(_local11.crossbowArrowStart);
skinInner.gotoAndStop(2);
}
override protected function weaponReady():void{
super.weaponReady();
skinInner.gotoAndStop(1);
}
override public function update():void{
super.update();
var _local1:Point = new Point(engine.canvas.objects.stage.mouseX, engine.canvas.objects.stage.mouseY);
rotateToPoint(_local1);
}
override protected function createSkin():void{
var _local1:Class = engine.assets.getAssetClass("CrossbowAsset");
skin = new (_local1);
player.skinWeaponHolder.addChild(skin);
skinInner = (skin.getChildByName("inner") as MovieClip);
skinInner.stop();
}
override public function reset():void{
reloadTime = -1;
bulletsLeft = 30000000;
}
}
}//package core.weapons
Section 37
//Monster10Bullet (core.weapons.Monster10Bullet)
package core.weapons {
public class Monster10Bullet extends MonsterBullet {
public function Monster10Bullet(_arg1:BulletDef):void{
super(_arg1);
}
override protected function getSkinBoomName():String{
return ("Monster10BulletBoomAsset");
}
override protected function getSkinName():String{
return ("Monster10BulletAsset");
}
}
}//package core.weapons
Section 38
//Monster1Bullet (core.weapons.Monster1Bullet)
package core.weapons {
public class Monster1Bullet extends MonsterBullet {
public function Monster1Bullet(_arg1:BulletDef):void{
super(_arg1);
}
override protected function getSkinBoomName():String{
return ("Monster1BulletBoomAsset");
}
override protected function getSkinName():String{
return ("Monster1BulletAsset");
}
}
}//package core.weapons
Section 39
//Monster2Bullet (core.weapons.Monster2Bullet)
package core.weapons {
import flash.events.*;
public class Monster2Bullet extends MonsterBullet {
private var speedX:Number;
private var speedY:Number;
public function Monster2Bullet(_arg1:BulletDef):void{
super(_arg1);
}
override protected function init():void{
super.init();
var _local1:Number = (engine.player.x - x);
var _local2:Number = (engine.player.y - y);
var _local3:Number = Math.sqrt(((_local1 * _local1) + (_local2 * _local2)));
var _local4:Number = Math.atan2(_local2, _local1);
speedX = (3 * Math.cos(_local4));
speedY = (3 * Math.sin(_local4));
}
private function boomEfHandler(_arg1:Event):void{
if (skinBoom.currentFrame == skinBoom.totalFrames){
skinBoom.stop();
skinBoom.removeEventListener(Event.ENTER_FRAME, boomEfHandler);
skinBoom.parent.removeChild(skinBoom);
};
}
override protected function getSkinBoomName():String{
return ("Monster2BulletBoomAsset");
}
override protected function hitGround():void{
y = 466;
var _local1:Class = engine.assets.getAssetClass(getSkinBoomName());
skinBoom = new (_local1);
skinBoom.x = x;
skinBoom.y = y;
engine.canvas.floor.addChild(skinBoom);
skinBoom.addEventListener(Event.ENTER_FRAME, boomEfHandler);
destroy();
}
override protected function updatePos():void{
x = (x + speedX);
var _local1:Array = checkCorners(x, (y + speedY));
var _local2:Boolean = _local1[0];
if (_local2){
y = (y + speedY);
} else {
hitGround();
};
}
override protected function getSkinName():String{
return ("Monster2BulletAsset");
}
}
}//package core.weapons
Section 40
//Monster3Bullet (core.weapons.Monster3Bullet)
package core.weapons {
public class Monster3Bullet extends MonsterBullet {
private var speedX:Number;
private var speedY:Number;
private var gravity:Number;
public function Monster3Bullet(_arg1:BulletDef):void{
super(_arg1);
}
override protected function init():void{
super.init();
gravity = 0.1;
speedX = (-2 + Math.round((Math.random() * 4)));
speedY = 0;
}
override protected function getSkinName():String{
return ("Monster3BulletAsset");
}
override protected function hitGround():void{
}
override protected function updatePos():void{
x = (x + speedX);
var _local1:Array = checkCorners(x, (y + speedY));
var _local2:Boolean = _local1[0];
if (_local2){
speedY = (speedY + gravity);
if (speedY > 5){
speedY = 5;
};
y = (y + speedY);
} else {
speedY = -5;
};
}
}
}//package core.weapons
Section 41
//Monster4Bullet (core.weapons.Monster4Bullet)
package core.weapons {
public class Monster4Bullet extends MonsterBullet {
public function Monster4Bullet(_arg1:BulletDef):void{
super(_arg1);
}
override protected function getSkinBoomName():String{
return ("Monster4BulletBoomAsset");
}
override protected function getSkinName():String{
return ("Monster4BulletAsset");
}
}
}//package core.weapons
Section 42
//Monster5Bullet (core.weapons.Monster5Bullet)
package core.weapons {
public class Monster5Bullet extends MonsterBullet {
public function Monster5Bullet(_arg1:BulletDef):void{
super(_arg1);
}
override protected function updateSkin():void{
super.updateSkin();
skin.rotation = (skin.rotation + 5);
}
override protected function getSkinName():String{
return ("Monster5BulletAsset");
}
}
}//package core.weapons
Section 43
//Monster6Bullet (core.weapons.Monster6Bullet)
package core.weapons {
public class Monster6Bullet extends MonsterBullet {
public function Monster6Bullet(_arg1:BulletDef):void{
super(_arg1);
}
override protected function getSkinName():String{
return ("Monster6BulletAsset");
}
}
}//package core.weapons
Section 44
//Monster7Bullet (core.weapons.Monster7Bullet)
package core.weapons {
public class Monster7Bullet extends MonsterBullet {
public function Monster7Bullet(_arg1:BulletDef):void{
super(_arg1);
}
override protected function getSkinBoomName():String{
return ("Monster7BulletBoomAsset");
}
override protected function getSkinName():String{
return ("Monster7BulletAsset");
}
}
}//package core.weapons
Section 45
//Monster8Bullet (core.weapons.Monster8Bullet)
package core.weapons {
public class Monster8Bullet extends MonsterBullet {
public function Monster8Bullet(_arg1:BulletDef):void{
super(_arg1);
}
override protected function getSkinBoomName():String{
return ("Monster8BulletBoomAsset");
}
override protected function getSkinName():String{
return ("Monster8BulletAsset");
}
}
}//package core.weapons
Section 46
//Monster9Bullet (core.weapons.Monster9Bullet)
package core.weapons {
public class Monster9Bullet extends MonsterBullet {
public function Monster9Bullet(_arg1:BulletDef):void{
super(_arg1);
}
override protected function getSkinName():String{
return ("Monster9BulletAsset");
}
}
}//package core.weapons
Section 47
//MonsterBullet (core.weapons.MonsterBullet)
package core.weapons {
import core.*;
import flash.display.*;
import flash.geom.*;
import core.tiles.*;
import caurina.transitions.*;
public class MonsterBullet extends AbstractBullet {
protected var skinBoom:MovieClip;
public var damage:Number;
public function MonsterBullet(_arg1:BulletDef):void{
super(_arg1);
}
override protected function updateHandler(_arg1:CoreEvent=null):void{
super.updateHandler(_arg1);
checkPlayer();
}
protected function boomComplete():void{
skinBoom.parent.removeChild(skinBoom);
}
protected function collideWithPlayer():void{
engine.player.collideWithBullet(this);
destroy();
}
override protected function updateSkin():void{
skin.x = x;
skin.y = y;
}
protected function checkPlayer():void{
var _local1:Number = Math.abs((x - engine.player.x));
var _local2:Number = Math.abs((y - engine.player.y));
if ((((_local1 < engine.player.width2)) && ((_local2 < engine.player.height2)))){
collideWithPlayer();
};
}
override protected function updatePos():void{
var _local1:Array = checkCorners(x, (y + 2));
var _local2:Boolean = _local1[0];
if (_local2){
y = (y + 2);
} else {
hitGround();
};
}
override protected function checkCorners(_arg1:Number, _arg2:Number):Array{
if (!corners){
return (null);
};
var _local3:Point = corners[0];
var _local4:int = Math.floor(((_arg2 + _local3.y) / Map.tileH));
var _local5:int = Math.floor(((_arg1 + _local3.x) / Map.tileW));
var _local6:AbstractTile = engine.map.getTile(_local4, _local5);
var _local7:Boolean = (_local6) ? _local6.isWalkable(_arg1, _arg2) : true;
return ([_local7]);
}
override protected function init():void{
super.init();
damage = 10;
totalLifeTime = 400;
}
protected function getSkinBoomName():String{
return ("WASSUP");
}
override protected function createSkin():void{
var _local1:Class = engine.assets.getAssetClass(getSkinName());
skin = new (_local1);
engine.canvas.objects.addChild(skin);
updateSkin();
}
protected function hitGround():void{
y = 466;
var _local1:Class = engine.assets.getAssetClass(getSkinBoomName());
if (_local1){
skinBoom = new (_local1);
skinBoom.x = x;
skinBoom.y = y;
engine.canvas.floor.addChild(skinBoom);
Tweener.addTween(skinBoom, {alpha:0, time:0.5, delay:2, transition:"linear", onComplete:boomComplete});
};
destroy();
}
protected function getSkinName():String{
return ("And here we go");
}
}
}//package core.weapons
Section 48
//MonsterWeapon (core.weapons.MonsterWeapon)
package core.weapons {
import core.*;
import core.objects.units.*;
public class MonsterWeapon extends AbstractWeapon {
protected var monster:BaseMonster;
public function MonsterWeapon(_arg1:BaseMonster):void{
this.monster = _arg1;
super();
reloadTime = 0;
totalReloadTime = (150 + Math.round((Math.random() * 100)));
}
override protected function doFire():void{
var _local5:MonsterBullet;
var _local1:Number = monster.x;
var _local2:Number = (monster.y + 20);
var _local3:Vector = new Vector(0, 1);
var _local4:BulletDef = new BulletDef(_local1, _local2, _local3);
if ((monster is Monster1)){
_local5 = new Monster1Bullet(_local4);
} else {
if ((monster is Monster2)){
_local5 = new Monster2Bullet(_local4);
} else {
if ((monster is Monster3)){
_local5 = new Monster3Bullet(_local4);
} else {
if ((monster is Monster4)){
_local5 = new Monster4Bullet(_local4);
} else {
if ((monster is Monster5)){
_local5 = new Monster5Bullet(_local4);
} else {
if ((monster is Monster6)){
_local5 = new Monster6Bullet(_local4);
} else {
if ((monster is Monster7)){
_local5 = new Monster7Bullet(_local4);
} else {
if ((monster is Monster8)){
_local5 = new Monster8Bullet(_local4);
} else {
if ((monster is Monster9)){
_local5 = new Monster9Bullet(_local4);
} else {
if ((monster is Monster10)){
_local5 = new Monster10Bullet(_local4);
};
};
};
};
};
};
};
};
};
};
monster.skinInner.gotoAndPlay(3);
}
override public function update():void{
super.update();
if (reloadTime == -1){
fire();
};
}
}
}//package core.weapons
Section 49
//PlayerBullet (core.weapons.PlayerBullet)
package core.weapons {
public class PlayerBullet extends AbstractBullet {
public function PlayerBullet(_arg1:BulletDef):void{
super(_arg1);
}
public function collideWithMonster():void{
destroy();
}
}
}//package core.weapons
Section 50
//PlayerWeapon (core.weapons.PlayerWeapon)
package core.weapons {
import flash.events.*;
import core.objects.units.*;
public class PlayerWeapon extends AbstractWeapon {
protected var player:Player;
public function PlayerWeapon(_arg1:Player):void{
this.player = _arg1;
super();
}
override protected function init():void{
super.init();
createSkin();
engine.canvas.level.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
}
override protected function doFire():void{
super.doFire();
player.shootByWeapon();
}
protected function createSkin():void{
}
protected function mouseDownHandler(_arg1:MouseEvent):void{
fire();
}
public function destroy():void{
skin.parent.removeChild(skin);
engine.canvas.level.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
}
}
}//package core.weapons
Section 51
//CoreAssets (core.CoreAssets)
package core {
import flash.events.*;
import flash.display.*;
import flash.system.*;
public class CoreAssets extends EventDispatcher {
private var Assets:Class;
private var appDomain:ApplicationDomain;
public var inited:Boolean;
private static var instance:CoreAssets;
public function CoreAssets():void{
Assets = CoreAssets_Assets;
super();
inited = false;
}
public function init():void{
var _local1:Loader = new Loader();
_local1.contentLoaderInfo.addEventListener(Event.INIT, assetsInitHandler);
_local1.loadBytes(new Assets());
}
private function assetsInitHandler(_arg1:Event):void{
appDomain = _arg1.target.content.loaderInfo.applicationDomain;
inited = true;
dispatchEvent(new Event(Event.INIT));
}
public function getAssetClass(_arg1:String):Class{
if (!appDomain.hasDefinition(_arg1)){
trace((("*Error*: There is no definition of class '" + _arg1) + "'"));
return (null);
};
return ((appDomain.getDefinition(_arg1) as Class));
}
public static function getInstance():CoreAssets{
if (!instance){
instance = new (CoreAssets);
};
return (instance);
}
}
}//package core
Section 52
//CoreAssets_Assets (core.CoreAssets_Assets)
package core {
import mx.core.*;
public class CoreAssets_Assets extends ByteArrayAsset {
}
}//package core
Section 53
//CoreCanvas (core.CoreCanvas)
package core {
import flash.display.*;
public class CoreCanvas {
public var debug:Sprite;
public var level:Sprite;
public var objects:Sprite;
public var floor:Sprite;
public function CoreCanvas(_arg1:Sprite, _arg2:Sprite, _arg3:Sprite, _arg4:Sprite):void{
this.level = _arg1;
this.floor = _arg2;
this.objects = _arg3;
this.debug = _arg4;
}
}
}//package core
Section 54
//CoreEngine (core.CoreEngine)
package core {
import flash.events.*;
import core.objects.units.*;
import caurina.transitions.*;
public class CoreEngine extends EventDispatcher {
public var assets:CoreAssets;
private var currentLevel:Level;
private var currentWaveNum:int;
public var canvas:CoreCanvas;
public var monsters:Array;
public var player:Player;
public var map:Map;
private var elapsedTime:int;
public var isPaused:Boolean;
private static var instance:CoreEngine;
public function CoreEngine():void{
}
public function levelStart(_arg1:Level):void{
currentLevel = _arg1;
currentWaveNum = 0;
loadWave(_arg1.waves[currentWaveNum]);
player.levelStart();
elapsedTime = 0;
}
public function gameStart(_arg1:CoreCanvas):void{
this.canvas = _arg1;
assets = CoreAssets.getInstance();
isPaused = false;
KeyboardManager.getInstance();
map = new Map();
map.buildMap();
player = new Player(320, (400 - (49 / 2)));
_arg1.level.addEventListener(Event.ENTER_FRAME, efHandler);
}
public function gameComplete():void{
}
public function playerInPain():void{
dispatchEvent(new CoreEvent(CoreEvent.PLAYER_IN_PAIN));
}
public function monsterDead(_arg1:BaseMonster):void{
monsters.splice(monsters.indexOf(_arg1), 1);
dispatchEvent(new CoreEvent(CoreEvent.MONSTER_DEAD));
if (monsters.length == 0){
currentWaveNum++;
if (currentWaveNum < currentLevel.waves.length){
loadWave(currentLevel.waves[currentWaveNum]);
} else {
player.levelComplete();
dispatchEvent(new CoreEvent(CoreEvent.LEVEL_COMPLETE));
};
};
}
public function pauseOff():void{
Tweener.resumeAllTweens();
canvas.level.addEventListener(Event.ENTER_FRAME, efHandler);
isPaused = false;
}
public function playerDead():void{
canvas.level.removeEventListener(Event.ENTER_FRAME, efHandler);
dispatchEvent(new CoreEvent(CoreEvent.PLAYER_DEAD));
}
private function efHandler(_arg1:Event):void{
dispatchEvent(new CoreEvent(CoreEvent.UPDATE));
}
public function pauseOn():void{
Tweener.pauseAllTweens();
canvas.level.removeEventListener(Event.ENTER_FRAME, efHandler);
isPaused = true;
}
public function destroy():void{
canvas.level.removeEventListener(Event.ENTER_FRAME, efHandler);
dispatchEvent(new CoreEvent(CoreEvent.DESTROY));
}
private function createMonster(_arg1:MonsterDef):void{
var _local2:BaseMonster;
if (_arg1.type == MonsterDef.TYPE_1){
_local2 = new Monster1(_arg1.startDistance);
} else {
if (_arg1.type == MonsterDef.TYPE_2){
_local2 = new Monster2(_arg1.startDistance);
} else {
if (_arg1.type == MonsterDef.TYPE_3){
_local2 = new Monster3(_arg1.startDistance);
} else {
if (_arg1.type == MonsterDef.TYPE_4){
_local2 = new Monster4(_arg1.startDistance);
} else {
if (_arg1.type == MonsterDef.TYPE_5){
_local2 = new Monster5(_arg1.startDistance);
} else {
if (_arg1.type == MonsterDef.TYPE_6){
_local2 = new Monster6(_arg1.startDistance);
} else {
if (_arg1.type == MonsterDef.TYPE_7){
_local2 = new Monster7(_arg1.startDistance);
} else {
if (_arg1.type == MonsterDef.TYPE_8){
_local2 = new Monster8(_arg1.startDistance);
} else {
if (_arg1.type == MonsterDef.TYPE_9){
_local2 = new Monster9(_arg1.startDistance);
} else {
if (_arg1.type == MonsterDef.TYPE_10){
_local2 = new Monster10(_arg1.startDistance);
} else {
return;
};
};
};
};
};
};
};
};
};
};
monsters.push(_local2);
}
private function loadWave(_arg1:Array):void{
var _local2:uint;
monsters = [];
_local2 = 0;
while (_local2 < _arg1.length) {
createMonster(_arg1[_local2]);
_local2++;
};
}
public static function getInstance():CoreEngine{
if (instance == null){
instance = new (CoreEngine);
};
return (instance);
}
}
}//package core
Section 55
//CoreEvent (core.CoreEvent)
package core {
import flash.events.*;
public class CoreEvent extends Event {
public var data:Object;
public static const PLAYER_SHOOT:String = "PlayerShoot";
public static const PRE_UPDATE:String = "PreUpdate";
public static const POST_UPDATE:String = "PostUpdate";
public static const UPDATE:String = "Update";
public static const PLAYER_DEAD:String = "PlayerDead";
public static const MONSTER_DEAD:String = "MonsterDead";
public static const PLAYER_IN_PAIN:String = "PlayerInPain";
public static const DESTROY:String = "Destroy";
public static const LEVEL_COMPLETE:String = "LevelComplete";
public function CoreEvent(_arg1:String, _arg2:Object=null, _arg3:Boolean=false, _arg4:Boolean=false):void{
super(_arg1, _arg3, _arg4);
this.data = _arg2;
}
}
}//package core
Section 56
//KeyboardManager (core.KeyboardManager)
package core {
import flash.events.*;
import flash.display.*;
import game.view.*;
import flash.ui.*;
public class KeyboardManager {
private var engine:CoreEngine;
private var stage:Stage;
public static var KEY_A:Boolean;
public static var KEY_SPACE:Boolean;
public static var KEY_LEFT:Boolean;
public static var KEY_DOWN:Boolean;
public static var KEY_D:Boolean;
public static var KEY_S:Boolean;
private static var instance:KeyboardManager;
public static var KEY_W:Boolean;
public static var KEY_UP:Boolean;
public static var KEY_RIGHT:Boolean;
public function KeyboardManager():void{
init();
}
protected function init():void{
var _local1:ApplicationFacade = ApplicationFacade.getInstance();
var _local2:AppMediator = (_local1.retrieveMediator(AppMediator.NAME) as AppMediator);
stage = _local2.getViewContainer().stage;
engine = CoreEngine.getInstance();
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
}
private function keyUpHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.RIGHT){
KEY_RIGHT = false;
} else {
if (_arg1.keyCode == Keyboard.LEFT){
KEY_LEFT = false;
} else {
if (_arg1.keyCode == Keyboard.UP){
KEY_UP = false;
} else {
if (_arg1.keyCode == Keyboard.DOWN){
KEY_DOWN = false;
} else {
if (_arg1.keyCode == Keyboard.SPACE){
KEY_SPACE = false;
} else {
if (_arg1.keyCode == 87){
KEY_W = false;
} else {
if (_arg1.keyCode == 65){
KEY_A = false;
} else {
if (_arg1.keyCode == 83){
KEY_S = false;
} else {
if (_arg1.keyCode == 68){
KEY_D = false;
};
};
};
};
};
};
};
};
};
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == Keyboard.RIGHT){
KEY_RIGHT = true;
} else {
if (_arg1.keyCode == Keyboard.LEFT){
KEY_LEFT = true;
} else {
if (_arg1.keyCode == Keyboard.UP){
KEY_UP = true;
} else {
if (_arg1.keyCode == Keyboard.DOWN){
KEY_DOWN = true;
} else {
if (_arg1.keyCode == Keyboard.SPACE){
KEY_SPACE = true;
} else {
if (_arg1.keyCode == 87){
KEY_W = true;
} else {
if (_arg1.keyCode == 65){
KEY_A = true;
} else {
if (_arg1.keyCode == 83){
KEY_S = true;
} else {
if (_arg1.keyCode == 68){
KEY_D = true;
};
};
};
};
};
};
};
};
};
}
public static function getInstance():KeyboardManager{
if (instance == null){
instance = new (KeyboardManager);
};
return (instance);
}
}
}//package core
Section 57
//Level (core.Level)
package core {
public class Level {
public var waves:Array;
public function Level():void{
waves = [];
}
public function addWave(_arg1:Array):void{
waves.push(_arg1);
}
}
}//package core
Section 58
//Map (core.Map)
package core {
import core.tiles.*;
public class Map {
public var tiles:Array;
private var mapDef:Array;
public static const tileW:Number = 80;
public static const tileH:Number = 58.25;
public function Map(){
tiles = [];
super();
init();
}
private function init():void{
mapDef = [[0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0], [1, 1, 1, 1, 1, 1, 1, 1]];
}
public function getTile(_arg1:int, _arg2:int):AbstractTile{
if (!tiles[_arg1]){
return (null);
};
return (tiles[_arg1][_arg2]);
}
public function buildMap():void{
var _local1:AbstractTile;
var _local3:uint;
var _local4:int;
tiles = [];
var _local2:uint;
while (_local2 < mapDef.length) {
tiles[_local2] = [];
_local3 = 0;
while (_local3 < mapDef[_local2].length) {
_local4 = mapDef[_local2][_local3];
switch (_local4){
case 0:
_local1 = new EmptyTile(_local3, _local2);
break;
case 1:
_local1 = new WallTile(_local3, _local2);
break;
case 2:
_local1 = new GroundTile(_local3, _local2);
break;
};
tiles[_local2][_local3] = _local1;
_local3++;
};
_local2++;
};
}
}
}//package core
Section 59
//SoundsManager (core.SoundsManager)
package core {
import flash.media.*;
public class SoundsManager {
private var engine:CoreEngine;
private var sndTransform:SoundTransform;
public var crossbowArrowStart:Sound;
private var monsterDeads:Array;
public var monsterDuckDead:Sound;
private var sndChannel:SoundChannel;
private static var instance:SoundsManager;
public function SoundsManager(){
init();
}
public function getRandomMonsterDead():Sound{
var _local1:int = Math.floor((Math.random() * monsterDeads.length));
return (monsterDeads[_local1]);
}
private function init():void{
var _local4:Class;
var _local5:Sound;
engine = CoreEngine.getInstance();
var _local1:Class = engine.assets.getAssetClass("SndCrossbowArrowStart");
crossbowArrowStart = new (_local1);
monsterDeads = [];
var _local2:uint = 1;
while (_local2 < 8) {
_local4 = engine.assets.getAssetClass(("SndMonsterDead" + _local2));
_local5 = new (_local4);
monsterDeads.push(_local5);
_local2++;
};
var _local3:Class = engine.assets.getAssetClass("SndMonsterDeadDuck");
monsterDuckDead = new (_local3);
sndTransform = new SoundTransform();
}
public function playSound(_arg1:Sound):void{
sndChannel = _arg1.play(0, 0, sndTransform);
}
public static function getInstance():SoundsManager{
if (instance == null){
instance = new (SoundsManager);
};
return (instance);
}
}
}//package core
Section 60
//Vector (core.Vector)
package core {
public class Vector {
public var x:Number;
public var y:Number;
public function Vector(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
public function cross(_arg1:Vector):Number{
return (((x * _arg1.y) - (y * _arg1.x)));
}
public function add(_arg1:Vector):Vector{
return (new Vector((x + _arg1.x), (y + _arg1.y)));
}
public function multiply(_arg1:Number):Vector{
return (new Vector((x * _arg1), (y * _arg1)));
}
public function length():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function dot(_arg1:Vector):Number{
return (((x * _arg1.x) + (y * _arg1.y)));
}
public function toString():String{
return (((x + " ") + 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 subtract(_arg1:Vector):Vector{
return (new Vector((x - _arg1.x), (y - _arg1.y)));
}
public function copy():Vector{
return (new Vector(x, y));
}
}
}//package core
Section 61
//Bezier (flash.geom.Bezier)
package flash.geom {
import flash.math.*;
public class Bezier implements IParametric {
protected var controlPoint:Point;
protected var __isSegment:Boolean;// = true
protected var startPoint:Point;
protected var endPoint:Point;
protected static const PRECISION:Number = 1E-10;
public function Bezier(_arg1:Point=undefined, _arg2:Point=undefined, _arg3:Point=undefined, _arg4:Boolean=true){
initInstance(_arg1, _arg2, _arg3, _arg4);
}
public function getTangentAngle(_arg1:Number=0):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = (startPoint.x + ((controlPoint.x - startPoint.x) * _arg1));
_local3 = (startPoint.y + ((controlPoint.y - startPoint.y) * _arg1));
_local4 = (controlPoint.x + ((endPoint.x - controlPoint.x) * _arg1));
_local5 = (controlPoint.y + ((endPoint.y - controlPoint.y) * _arg1));
var _local6:Number = (_local4 - _local2);
var _local7:Number = (_local5 - _local3);
return (Math.atan2(_local7, _local6));
}
public function get area():Number{
return ((triangleArea * (2 / 3)));
}
public function getTimeByDistance(_arg1:Number):Number{
var _local2:Number;
var _local3: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 _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Number;
if (isNaN(_arg1)){
return (0);
};
var _local4:Number = length;
var _local5:Number = (_arg1 / _local4);
if (__isSegment){
if (_arg1 <= 0){
return (0);
};
if (_arg1 >= _local4){
return (1);
};
};
_local6 = (controlPoint.x - startPoint.x);
_local7 = (controlPoint.y - startPoint.y);
_local8 = (endPoint.x - controlPoint.x);
_local9 = (endPoint.y - controlPoint.y);
_local10 = (_local8 - _local6);
_local11 = (_local9 - _local7);
_local12 = (4 * ((_local6 * _local6) + (_local7 * _local7)));
_local13 = (8 * ((_local6 * _local10) + (_local7 * _local11)));
_local14 = (4 * ((_local10 * _local10) + (_local11 * _local11)));
var _local15:Number = (_local12 - (((0.25 * _local13) * _local13) / _local14));
var _local16:Number = (((0.25 * _local13) * Math.sqrt(_local12)) / _local14);
var _local17:Number = (((0.5 * _local13) / Math.sqrt(_local14)) + Math.sqrt(_local12));
var _local18:Number = Math.sqrt(_local12);
var _local19:Number = Math.sqrt(_local14);
var _local25:Number = 100;
if (_local14 == 0){
if (_local13 == 0){
do {
_local2 = (_local18 * _local5);
_local3 = ((Math.sqrt(Math.abs(((((_local14 * _local5) * _local5) + (_local13 * _local5)) + _local12)))) || (PRECISION));
_local5 = (_local5 - ((_local2 - _arg1) / _local3));
} while ((((Math.abs((_local2 - _arg1)) > PRECISION)) && (_temp1)));
} else {
do {
_local2 = (((((2 / 3) * ((_local13 * _local5) + _local12)) * Math.sqrt(((_local13 * _local5) + _local12))) / _local13) - ((((2 / 3) * _local12) * _local18) / _local13));
_local3 = ((Math.sqrt(Math.abs(((((_local14 * _local5) * _local5) + (_local13 * _local5)) + _local12)))) || (PRECISION));
_local5 = (_local5 - ((_local2 - _arg1) / _local3));
} while ((((Math.abs((_local2 - _arg1)) > PRECISION)) && (_temp2)));
};
} else {
do {
_local20 = Math.sqrt(Math.abs(((((_local14 * _local5) * _local5) + (_local13 * _local5)) + _local12)));
_local21 = ((((0.5 * _local13) + (_local14 * _local5)) / _local19) + _local20);
_local23 = (((0.25 * (((2 * _local14) * _local5) + _local13)) * _local20) / _local14);
if (_local21 < PRECISION){
_local22 = _local23;
} else {
_local22 = (_local23 + (((0.5 * Math.log(((((0.5 * _local13) + (_local14 * _local5)) / _local19) + _local20))) / _local19) * _local15));
};
if (_local17 < PRECISION){
_local24 = _local16;
} else {
_local24 = (_local16 + (((0.5 * Math.log((((0.5 * _local13) / _local19) + _local18))) / _local19) * _local15));
};
_local2 = (_local22 - _local24);
_local3 = ((_local20) || (PRECISION));
_local5 = (_local5 - ((_local2 - _arg1) / _local3));
} while ((((Math.abs((_local2 - _arg1)) > PRECISION)) && (_temp3)));
};
return (_local5);
}
public function offset(_arg1:Number=0, _arg2:Number=0):void{
startPoint.offset(_arg1, _arg2);
controlPoint.offset(_arg1, _arg2);
endPoint.offset(_arg1, _arg2);
}
public function get parabolaFocusPoint():Point{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8: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;
_local1 = startPoint.x;
_local2 = startPoint.y;
_local3 = controlPoint.x;
_local4 = controlPoint.y;
_local5 = endPoint.x;
_local6 = endPoint.y;
_local7 = ((_local1 - (2 * _local3)) + _local5);
_local8 = ((_local2 - (2 * _local4)) + _local6);
var _local9:Number = ((_local7 * _local7) + (_local8 * _local8));
if (_local9 == 0){
return (controlPoint.clone());
};
_local10 = (_local3 - _local1);
_local11 = (_local4 - _local2);
_local12 = (-(((_local7 * _local10) + (_local8 * _local11))) / _local9);
_local13 = (1 - _local12);
_local14 = (_local12 * _local12);
_local15 = (_local13 * _local13);
_local16 = ((2 * _local10) + ((2 * _local12) * _local7));
_local17 = ((2 * _local11) + ((2 * _local12) * _local8));
_local18 = (((_local1 * _local15) + (((2 * _local12) * _local13) * _local3)) + (_local14 * _local5));
_local19 = (((_local2 * _local15) + (((2 * _local12) * _local13) * _local4)) + (_local14 * _local6));
_local20 = (_local18 - (_local17 / (4 * Math.SQRT2)));
_local21 = (_local19 + (_local16 / (4 * Math.SQRT2)));
var _local22:Number = (((_local17 * (_local1 - _local18)) - (_local16 * (_local2 - _local19))) * ((_local17 * (_local20 - _local18)) - (_local16 * (_local21 - _local19))));
if (_local22 < 0){
_local20 = (_local18 + (_local17 / (4 * Math.SQRT2)));
_local21 = (_local19 - (_local16 / (4 * Math.SQRT2)));
};
return (new Point(_local20, _local21));
}
public function get internalCentroid():Point{
var _local1:Number = (((startPoint.x + endPoint.x) * 0.4) + (controlPoint.x * 0.2));
var _local2:Number = (((startPoint.y + endPoint.y) * 0.4) + (controlPoint.y * 0.2));
return (new Point(_local1, _local2));
}
public function getClosest(_arg1:Point):Number{
var _local2:Number;
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:Number;
var _local19:Number;
var _local20:Point;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Boolean;
if (!(_arg1 as Point)){
return (NaN);
};
_local2 = startPoint.x;
_local3 = startPoint.y;
_local4 = controlPoint.x;
_local5 = controlPoint.y;
_local6 = endPoint.x;
_local7 = endPoint.y;
_local8 = (_local2 - _arg1.x);
_local9 = (_local3 - _arg1.y);
_local10 = ((_local2 - (2 * _local4)) + _local6);
_local11 = ((_local3 - (2 * _local5)) + _local7);
_local12 = ((-2 * _local2) + (2 * _local4));
_local13 = ((-2 * _local3) + (2 * _local5));
_local14 = (2 * ((_local10 * _local10) + (_local11 * _local11)));
_local15 = ((3 * ((_local12 * _local10) + (_local13 * _local11))) / _local14);
_local16 = ((((_local12 * _local12) + (_local13 * _local13)) + (2 * ((_local8 * _local10) + (_local9 * _local11)))) / _local14);
_local17 = (((_local12 * _local8) + (_local13 * _local9)) / _local14);
var _local18:Array = Equations.solveCubicEquation(1, _local15, _local16, _local17);
if (__isSegment){
_local18.push(0);
_local18.push(1);
};
var _local25:uint = _local18.length;
var _local26:uint;
while (_local26 < _local25) {
_local19 = _local18[_local26];
_local20 = getPoint(_local19);
_local21 = Point.distance(_arg1, _local20);
_local24 = (((_local19 >= 0)) && ((_local19 <= 1)));
if (isNaN(_local22)){
if (((!(__isSegment)) || (_local24))){
_local22 = _local19;
_local23 = _local21;
};
} else {
if (_local21 < _local23){
if (((!(__isSegment)) || (_local24))){
_local22 = _local19;
_local23 = _local21;
};
};
};
_local26++;
};
return (_local22);
}
public function intersectionLine(_arg1:Line):Intersection{
var _local14:Number;
var _local15:Number;
var _local16:Number;
var _local17:Number;
var _local18:Point;
var _local19:Point;
var _local20:Number;
var _local21:Number;
var _local27:Boolean;
var _local28:Boolean;
var _local29:Boolean;
var _local30:Boolean;
var _local32:Number;
var _local33:Number;
var _local2:Intersection = new Intersection();
var _local3:Number = startPoint.x;
var _local4:Number = startPoint.y;
var _local5:Number = controlPoint.x;
var _local6:Number = controlPoint.y;
var _local7:Number = endPoint.x;
var _local8:Number = endPoint.y;
var _local9:Number = _arg1.start.x;
var _local10:Number = _arg1.start.y;
var _local11:Number = _arg1.angle;
var _local12:Number = Math.cos(_local11);
var _local13:Number = Math.sin(_local11);
_local20 = (_arg1.end.x - _arg1.start.x);
_local21 = (_arg1.end.y - _arg1.start.y);
var _local22 = (Math.abs(_local20) > Math.abs(_local21));
if (Math.abs(_local12) < 1E-6){
_local12 = 0;
};
if (Math.abs(_local13) < 1E-6){
_local13 = 0;
};
var _local23:Number = (((((((-2 * _local13) * _local5) + (_local13 * _local7)) + (_local13 * _local3)) + ((2 * _local12) * _local6)) - (_local12 * _local8)) - (_local12 * _local4));
if (Math.abs(_local23) < 1E-6){
_local23 = 0;
};
if (_local23 == 0){
_local32 = ((((-2 * _local3) + (2 * _local5)) * _local13) - (((-2 * _local4) + (2 * _local6)) * _local12));
if (_local32 == 0){
_local2.currentTimes[0] = 0;
_local2.currentTimes[1] = 1;
_local18 = getPoint(0);
_local19 = getPoint(1);
if (_local22){
_local16 = ((_local18.x - _arg1.start.x) / _local20);
_local17 = ((_local19.x - _arg1.start.x) / _local20);
} else {
_local16 = ((_local18.y - _arg1.start.y) / _local21);
_local17 = ((_local19.y - _arg1.start.y) / _local21);
};
} else {
_local14 = (-((((_local3 - _local9) * _local13) - ((_local4 - _local10) * _local12))) / _local32);
_local2.currentTimes[0] = _local14;
_local18 = getPoint(_local14);
_local33 = ((_local18.x - _arg1.start.x) * (_local18.x - _arg1.end.x));
if (_local33 > 0){
_local2 = null;
};
};
return (_local2);
};
var _local24:Number = ((((_local12 * _local12) * (((((_local4 * _local10) + (_local6 * _local6)) - (_local8 * _local4)) - ((2 * _local6) * _local10)) + (_local8 * _local10))) + ((_local13 * _local12) * (((((((((-(_local4) * _local9) - (_local8 * _local9)) - ((2 * _local6) * _local5)) + (_local7 * _local4)) - (_local3 * _local10)) + ((2 * _local6) * _local9)) + ((2 * _local5) * _local10)) + (_local8 * _local3)) - (_local7 * _local10)))) + ((_local13 * _local13) * (((((_local7 * _local9) + (_local3 * _local9)) - ((2 * _local5) * _local9)) + (_local5 * _local5)) - (_local7 * _local3))));
if (_local24 < 0){
return (null);
};
var _local25:Number = (((((-2 * _local12) * _local4) + ((2 * _local13) * _local3)) + ((2 * _local12) * _local6)) - ((2 * _local13) * _local5));
var _local26:Number = (2 * _local23);
if (_local24 == 0){
_local14 = (_local25 / _local26);
_local27 = (((_local14 < 0)) || ((_local14 > 1)));
if (((isSegment) && (_local27))){
return (null);
};
_local18 = getPoint(_local14);
if (_local22){
_local16 = ((_local18.x - _arg1.start.x) / _local20);
} else {
_local16 = ((_local18.y - _arg1.start.y) / _local20);
};
_local28 = (((_local16 < 0)) || ((_local16 > 1)));
if (((_arg1.isSegment) && (_local28))){
return (null);
};
_local2.currentTimes[0] = _local14;
_local2.targetTimes[0] = _local16;
return (_local2);
};
var _local31:Number = (2 * Math.sqrt(_local24));
_local14 = ((_local25 - _local31) / _local26);
_local15 = ((_local25 + _local31) / _local26);
_local27 = (((_local14 < 0)) || ((_local14 > 1)));
_local29 = (((_local15 < 0)) || ((_local15 > 1)));
if (((((isSegment) && (_local27))) && (_local29))){
return (null);
};
_local18 = getPoint(_local14);
_local19 = getPoint(_local15);
if (_local20){
_local16 = ((_local18.x - _arg1.start.x) / _local20);
_local17 = ((_local19.x - _arg1.start.x) / _local20);
} else {
_local16 = ((_local18.y - _arg1.start.y) / _local21);
_local17 = ((_local19.y - _arg1.start.y) / _local21);
};
_local28 = (((_local16 < 0)) || ((_local16 > 1)));
_local30 = (((_local17 < 0)) || ((_local17 > 1)));
if (((((_arg1.isSegment) && (_local28))) && (_local30))){
return (null);
};
if (isSegment){
if (_arg1.isSegment){
if (((!(_local27)) && (!(_local28)))){
_local2.currentTimes.push(_local14);
_local2.targetTimes.push(_local16);
};
if (((!(_local29)) && (!(_local30)))){
_local2.currentTimes.push(_local15);
_local2.targetTimes.push(_local17);
};
} else {
if (!_local27){
_local2.currentTimes.push(_local14);
_local2.targetTimes.push(_local16);
};
if (!_local29){
_local2.currentTimes.push(_local15);
_local2.targetTimes.push(_local17);
};
};
if (!_local2.currentTimes.length){
return (null);
};
return (_local2);
};
if (_arg1.isSegment){
if (!_local28){
_local2.currentTimes.push(_local14);
_local2.targetTimes.push(_local16);
};
if (!_local30){
_local2.currentTimes.push(_local15);
_local2.targetTimes.push(_local17);
};
if (!_local2.currentTimes.length){
return (null);
};
return (_local2);
};
_local2.currentTimes.push(_local14);
_local2.targetTimes.push(_local16);
_local2.currentTimes.push(_local15);
_local2.targetTimes.push(_local17);
return (_local2);
}
public function get parabolaVertex():Number{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local1 = ((startPoint.x - (2 * controlPoint.x)) + endPoint.x);
_local2 = ((startPoint.y - (2 * controlPoint.y)) + endPoint.y);
_local3 = ((_local1 * _local1) + (_local2 * _local2));
_local4 = (startPoint.x - controlPoint.x);
_local5 = (startPoint.y - controlPoint.y);
var _local6:Number = (((_local1 * _local4) + (_local2 * _local5)) / _local3);
if (isNaN(_local6)){
return ((1 / 2));
};
return (_local6);
}
public function get externalCentroid():Point{
var _local1:Number = (((startPoint.x + endPoint.x) * 0.2) + (controlPoint.x * 0.6));
var _local2:Number = (((startPoint.y + endPoint.y) * 0.2) + (controlPoint.y * 0.6));
return (new Point(_local1, _local2));
}
public function get isSegment():Boolean{
return (__isSegment);
}
public function get bounds():Rectangle{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local8:Number;
var _local9:Number;
_local5 = ((startPoint.x - (2 * controlPoint.x)) + endPoint.x);
_local6 = ((((startPoint.x - controlPoint.x) / _local5)) || (0));
var _local7:Point = getPoint(_local6);
if (((((isNaN(_local7.x)) || ((_local6 <= 0)))) || ((_local6 >= 1)))){
_local1 = Math.min(startPoint.x, endPoint.x);
_local2 = Math.max(startPoint.x, endPoint.x);
} else {
_local1 = Math.min(_local7.x, Math.min(startPoint.x, endPoint.x));
_local2 = Math.max(_local7.x, Math.max(startPoint.x, endPoint.x));
};
_local8 = ((startPoint.y - (2 * controlPoint.y)) + endPoint.y);
_local9 = ((((startPoint.y - controlPoint.y) / _local8)) || (0));
var _local10:Point = getPoint(_local9);
if (((((isNaN(_local10.y)) || ((_local9 <= 0)))) || ((_local9 >= 1)))){
_local3 = Math.min(startPoint.y, endPoint.y);
_local4 = Math.max(startPoint.y, endPoint.y);
} else {
_local3 = Math.min(_local10.y, Math.min(startPoint.y, endPoint.y));
_local4 = Math.max(_local10.y, Math.max(startPoint.y, endPoint.y));
};
var _local11:Number = (_local2 - _local1);
var _local12:Number = (_local4 - _local3);
return (new Rectangle(_local1, _local3, _local11, _local12));
}
public function set end(_arg1:Point):void{
endPoint = _arg1;
}
public function set control(_arg1:Point):void{
controlPoint = _arg1;
}
public function getSegmentLength(_arg1:Number):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
_local2 = (controlPoint.x - startPoint.x);
_local3 = (controlPoint.y - startPoint.y);
_local4 = ((endPoint.x - controlPoint.x) - _local2);
_local5 = ((endPoint.y - controlPoint.y) - _local3);
var _local6:Number = (4 * ((_local2 * _local2) + (_local3 * _local3)));
var _local7:Number = (8 * ((_local2 * _local4) + (_local3 * _local5)));
var _local8:Number = (4 * ((_local4 * _local4) + (_local5 * _local5)));
if (_local8 == 0){
if (_local7 == 0){
_local9 = (Math.sqrt(_local6) * _arg1);
return (_local9);
};
_local9 = ((((2 / 3) * ((_local7 * _arg1) + _local6)) * Math.sqrt(((_local7 * _arg1) + _local6))) / _local7);
_local10 = ((((2 / 3) * _local6) * Math.sqrt(_local6)) / _local7);
return ((_local9 - _local10));
//unresolved jump
};
_local11 = Math.sqrt(((((_local8 * _arg1) * _arg1) + (_local7 * _arg1)) + _local6));
_local12 = Math.sqrt(_local6);
_local13 = Math.sqrt(_local8);
_local14 = ((((0.5 * _local7) + (_local8 * _arg1)) / _local13) + _local11);
if (_local14 < PRECISION){
_local9 = (((0.25 * (((2 * _local8) * _arg1) + _local7)) * _local11) / _local8);
} else {
_local9 = ((((0.25 * (((2 * _local8) * _arg1) + _local7)) * _local11) / _local8) + (((0.5 * Math.log(((((0.5 * _local7) + (_local8 * _arg1)) / _local13) + _local11))) / _local13) * (_local6 - (((0.25 * _local7) * _local7) / _local8))));
};
_local15 = (((0.5 * _local7) / _local13) + _local12);
if (_local15 < PRECISION){
_local10 = (((0.25 * _local7) * _local12) / _local8);
} else {
_local10 = ((((0.25 * _local7) * _local12) / _local8) + (((0.5 * Math.log((((0.5 * _local7) / _local13) + _local12))) / _local13) * (_local6 - (((0.25 * _local7) * _local7) / _local8))));
};
return ((_local9 - _local10));
}
public function set start(_arg1:Point):void{
startPoint = _arg1;
}
protected function initInstance(_arg1:Point=undefined, _arg2:Point=undefined, _arg3:Point=undefined, _arg4:Boolean=true):void{
startPoint = (((_arg1 as Point)) || (new Point()));
controlPoint = (((_arg2 as Point)) || (new Point()));
endPoint = (((_arg3 as Point)) || (new Point()));
__isSegment = Boolean(_arg4);
}
public function angleOffset(_arg1:Number, _arg2:Point=null):void{
_arg2 = ((_arg2) || (new Point()));
var _local3:Line = new Line(_arg2, startPoint);
_local3.angle = (_local3.angle + _arg1);
var _local4:Line = new Line(_arg2, controlPoint);
new Line(_arg2, controlPoint).angle = (_local4.angle + _arg1);
var _local5:Line = new Line(_arg2, endPoint);
new Line(_arg2, endPoint).angle = (_local5.angle + _arg1);
}
public function intersectionBezier(_arg1:Bezier):Intersection{
var _local2:Number;
var _local3:Point;
var _local25:Number;
var _local26:Number;
var _local29:Number;
var _local30:Number;
var _local33:Number;
var _local34:Number;
var _local37:Number;
var _local43:Array;
var _local45:Number;
var _local46:Point;
var _local47:Number;
var _local48:Number;
var _local49:Number;
var _local50:Array;
var _local52:uint;
_local2 = _arg1.parabolaVertex;
_local3 = _arg1.getPoint(_local2);
var _local4:Number = _local3.x;
var _local5:Number = _local3.y;
var _local6:Number = (((2 * _local2) * ((_arg1.startPoint.x - (2 * _arg1.controlPoint.x)) + _arg1.endPoint.x)) + (2 * (_arg1.controlPoint.x - _arg1.startPoint.x)));
var _local7:Number = (((2 * _local2) * ((_arg1.startPoint.y - (2 * _arg1.controlPoint.y)) + _arg1.endPoint.y)) + (2 * (_arg1.controlPoint.y - _arg1.startPoint.y)));
var _local8:Number = (2 * ((_arg1.startPoint.x - (2 * _arg1.controlPoint.x)) + _arg1.endPoint.x));
var _local9:Number = (2 * ((_arg1.startPoint.y - (2 * _arg1.controlPoint.y)) + _arg1.endPoint.y));
var _local10:Number = -(Math.atan2(_local7, _local6));
if ((((_local6 == 0)) && ((_local7 == 0)))){
_local10 = -(Math.atan2(_local9, _local8));
};
var _local11:Number = Math.sin(_local10);
var _local12:Number = Math.cos(_local10);
var _local13:Number = (_local4 - _arg1.endPoint.x);
var _local14:Number = (_local5 - _arg1.endPoint.y);
var _local15:Number = (_local4 - _arg1.startPoint.x);
var _local16:Number = (_local5 - _arg1.startPoint.y);
var _local17:Number = (_local4 - _arg1.controlPoint.x);
var _local18:Number = (_local5 - _arg1.controlPoint.y);
var _local19:Number = ((_local13 * _local12) - (_local14 * _local11));
var _local20:Number = ((_local13 * _local11) + (_local14 * _local12));
var _local21:Number = ((_local15 * _local12) - (_local16 * _local11));
var _local22:Number = ((_local15 * _local11) + (_local16 * _local12));
var _local23:Number = ((_local17 * _local12) - (_local18 * _local11));
var _local24:Number = ((_local17 * _local11) + (_local18 * _local12));
if (Math.abs(_local19) < PRECISION){
_local19 = 0;
};
if (Math.abs(_local20) < PRECISION){
_local20 = 0;
};
if (Math.abs(_local21) < PRECISION){
_local21 = 0;
};
if (Math.abs(_local22) < PRECISION){
_local22 = 0;
};
_local25 = (_local4 - startPoint.x);
_local26 = (_local5 - startPoint.y);
var _local27:Number = ((_local25 * _local12) - (_local26 * _local11));
var _local28:Number = ((_local25 * _local11) + (_local26 * _local12));
_local29 = (_local4 - controlPoint.x);
_local30 = (_local5 - controlPoint.y);
var _local31:Number = ((_local29 * _local12) - (_local30 * _local11));
var _local32:Number = ((_local29 * _local11) + (_local30 * _local12));
_local33 = (_local4 - endPoint.x);
_local34 = (_local5 - endPoint.y);
var _local35:Number = ((_local33 * _local12) - (_local34 * _local11));
var _local36:Number = ((_local33 * _local11) + (_local34 * _local12));
if (_local19 != 0){
_local37 = ((_local20 / _local19) / _local19);
} else {
if (_local21 != 0){
_local37 = ((_local22 / _local21) / _local21);
} else {
_local37 = ((_local24 / _local23) / _local23);
};
};
var _local38:Number = ((_local37 * ((_local27 - (2 * _local31)) + _local35)) * ((_local27 - (2 * _local31)) + _local35));
var _local39:Number = (((_local37 * 4) * ((_local27 - (2 * _local31)) + _local35)) * (_local31 - _local27));
var _local40:Number = ((_local37 * (((4 * (_local31 - _local27)) * (_local31 - _local27)) + ((2 * _local27) * ((_local27 - (2 * _local31)) + _local35)))) - ((_local28 - (2 * _local32)) + _local36));
var _local41:Number = ((((_local37 * 4) * _local27) * (_local31 - _local27)) - (2 * (_local32 - _local28)));
var _local42:Number = (((_local37 * _local27) * _local27) - _local28);
if (Math.abs(_local38) > 1E-12){
_local39 = (_local39 / _local38);
_local40 = (_local40 / _local38);
_local41 = (_local41 / _local38);
_local42 = (_local42 / _local38);
_local38 = 1;
};
_local43 = Equations.solveEquation(_local38, _local39, _local40, _local41, _local42);
var _local44:Intersection = new Intersection();
var _local51:uint = _local43.length;
if (((!(isSegment)) && (!(_arg1.isSegment)))){
_local52 = 0;
while (_local52 < _local51) {
_local44.currentTimes[_local52] = _local43[_local52];
_local46 = getPoint(_local43[_local52]);
_local47 = ((_local21 - (2 * _local23)) + _local19);
_local48 = ((-2 * _local21) + (2 * _local23));
_local49 = _local21;
_local50 = Equations.solveQuadraticEquation(_local47, _local48, _local49);
_local44.targetTimes[_local52] = _local50[0];
_local52++;
};
return (_local44);
};
if (!_arg1.isSegment){
_local52 = 0;
while (_local52 < _local51) {
_local45 = _local43[_local52];
if ((((_local45 >= 0)) && ((_local45 <= 1)))){
_local44.currentTimes.push(_local45);
_local46 = getPoint(_local45);
_local47 = ((_local21 - (2 * _local23)) + _local19);
_local48 = ((-2 * _local21) + (2 * _local23));
_local49 = _local21;
_local50 = Equations.solveQuadraticEquation(_local47, _local48, _local49);
_local44.targetTimes.push(_local50[0]);
};
_local52++;
};
return (_local44);
};
_local52 = 0;
while (_local52 < _local51) {
_local45 = _local43[_local52];
_local44.currentTimes.push(_local45);
_local46 = getPoint(_local45);
_local47 = ((_local21 - (2 * _local23)) + _local19);
_local48 = ((-2 * _local21) + (2 * _local23));
_local49 = _local21;
_local50 = Equations.solveQuadraticEquation(_local47, _local48, _local49);
_local44.targetTimes.push(_local50[0]);
_local52++;
};
return (_local44);
}
public function setPoint(_arg1:Number, _arg2:Number=undefined, _arg3:Number=undefined):void{
var _local4:Number;
if (((isNaN(_arg2)) && (isNaN(_arg3)))){
return;
};
_local4 = (1 - _arg1);
var _local5:Number = (_arg1 * _arg1);
var _local6:Number = (_local4 * _local4);
var _local7:Number = ((2 * _arg1) * _local4);
if (isNaN(_arg2)){
_arg2 = (((startPoint.x * _local6) + ((controlPoint.x * 2) * _local7)) + (endPoint.x * _local5));
};
if (isNaN(_arg3)){
_arg3 = (((startPoint.y * _local6) + ((controlPoint.y * 2) * _local7)) + (endPoint.y * _local5));
};
switch (_arg1){
case 0:
startPoint.x = _arg2;
startPoint.y = _arg3;
break;
case 1:
endPoint.x = _arg2;
endPoint.y = _arg3;
break;
default:
controlPoint.x = (((_arg2 - (endPoint.x * _local5)) - (startPoint.x * _local6)) / _local7);
controlPoint.y = (((_arg3 - (endPoint.y * _local5)) - (startPoint.y * _local6)) / _local7);
};
}
public function get triangleArea():Number{
var _local1:Number;
var _local2:Number;
var _local3:Number;
var _local4:Number;
_local1 = Point.distance(startPoint, controlPoint);
_local2 = Point.distance(endPoint, controlPoint);
_local3 = Point.distance(startPoint, endPoint);
_local4 = (((_local1 + _local2) + _local3) / 2);
var _local5:Number = Math.sqrt((((_local4 * (_local4 - _local1)) * (_local4 - _local2)) * (_local4 - _local3)));
return (_local5);
}
public function set isSegment(_arg1:Boolean):void{
__isSegment = Boolean(_arg1);
}
public function get end():Point{
return (endPoint);
}
public function clone():Bezier{
return (new Bezier(startPoint.clone(), controlPoint.clone(), endPoint.clone(), __isSegment));
}
public function getPoint(_arg1:Number, _arg2:Point=null):Point{
if (isNaN(_arg1)){
return (undefined);
};
_arg2 = (((_arg2 as Point)) || (new Point()));
var _local3:Number = (1 - _arg1);
_arg2.x = ((((startPoint.x * _local3) * _local3) + (((controlPoint.x * 2) * _arg1) * _local3)) + ((endPoint.x * _arg1) * _arg1));
_arg2.y = ((((startPoint.y * _local3) * _local3) + (((controlPoint.y * 2) * _arg1) * _local3)) + ((endPoint.y * _arg1) * _arg1));
return (_arg2);
}
public function get control():Point{
return (controlPoint);
}
public function get triangleCentroid():Point{
var _local1:Number = (((startPoint.x + endPoint.x) + controlPoint.x) / 3);
var _local2:Number = (((startPoint.y + endPoint.y) + controlPoint.y) / 3);
return (new Point(_local1, _local2));
}
public function get start():Point{
return (startPoint);
}
public function toString():String{
return ((((((("(start:" + startPoint) + ", control:") + controlPoint) + ", end:") + endPoint) + ")"));
}
public function get length():Number{
return (getSegmentLength(1));
}
public function getTimesSequence(_arg1:Number, _arg2:Number=0):Array{
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 _local23:Number;
var _local24:Number;
var _local25:Number;
var _local26:Number;
var _local27:Number;
var _local28:Number;
_arg1 = Math.abs(_arg1);
var _local3:Number = _arg2;
var _local4:Array = new Array();
var _local5:Number = length;
if (_local3 > _local5){
return (_local4);
};
if (_local3 < 0){
_local3 = ((_local3 % _arg1) + _arg1);
} else {
_local3 = (_local3 % _arg1);
};
_local6 = (controlPoint.x - startPoint.x);
_local7 = (controlPoint.y - startPoint.y);
_local8 = (endPoint.x - controlPoint.x);
_local9 = (endPoint.y - controlPoint.y);
_local10 = (_local8 - _local6);
_local11 = (_local9 - _local7);
_local12 = (4 * ((_local6 * _local6) + (_local7 * _local7)));
_local13 = (8 * ((_local6 * _local10) + (_local7 * _local11)));
_local14 = (4 * ((_local10 * _local10) + (_local11 * _local11)));
var _local17:Number = (_local3 / _local5);
var _local18:Number = (_local12 - (((0.25 * _local13) * _local13) / _local14));
var _local19:Number = (((0.25 * _local13) * Math.sqrt(_local12)) / _local14);
var _local20:Number = (((0.5 * _local13) / Math.sqrt(_local14)) + Math.sqrt(_local12));
var _local21:Number = Math.sqrt(_local12);
var _local22:Number = Math.sqrt(_local14);
while (_local3 <= _local5) {
_local28 = 20;
if (_local14 == 0){
if (_local13 == 0){
do {
_local15 = (_local21 * _local17);
_local16 = ((Math.sqrt(Math.abs(((((_local14 * _local17) * _local17) + (_local13 * _local17)) + _local12)))) || (PRECISION));
_local17 = (_local17 - ((_local15 - _local3) / _local16));
} while ((((Math.abs((_local15 - _local3)) > PRECISION)) && (_temp1)));
} else {
do {
_local15 = (((2 / 3) * ((((_local13 * _local17) + _local12) * Math.sqrt(Math.abs(((_local13 * _local17) + _local12)))) - (_local12 * _local21))) / _local13);
_local16 = ((Math.sqrt(Math.abs(((((_local14 * _local17) * _local17) + (_local13 * _local17)) + _local12)))) || (PRECISION));
_local17 = (_local17 - ((_local15 - _local3) / _local16));
} while ((((Math.abs((_local15 - _local3)) > PRECISION)) && (_temp2)));
};
} else {
do {
_local23 = Math.sqrt(Math.abs(((((_local14 * _local17) * _local17) + (_local13 * _local17)) + _local12)));
_local24 = ((((0.5 * _local13) + (_local14 * _local17)) / _local22) + _local23);
_local26 = (((0.25 * (((2 * _local14) * _local17) + _local13)) * _local23) / _local14);
if (_local24 < PRECISION){
_local25 = _local26;
} else {
_local25 = (_local26 + (((0.5 * Math.log(((((0.5 * _local13) + (_local14 * _local17)) / _local22) + _local23))) / _local22) * _local18));
};
if (_local20 < PRECISION){
_local27 = _local19;
} else {
_local27 = (_local19 + (((0.5 * Math.log((((0.5 * _local13) / _local22) + _local21))) / _local22) * _local18));
};
_local15 = (_local25 - _local27);
_local16 = ((_local23) || (PRECISION));
_local17 = (_local17 - ((_local15 - _local3) / _local16));
} while ((((Math.abs((_local15 - _local3)) > PRECISION)) && (_temp3)));
};
_local4[_local4.length] = _local17;
_local3 = (_local3 + _arg1);
};
return (_local4);
}
public function getSegment(_arg1:Number=0, _arg2:Number=1):Bezier{
var _local3:Point;
var _local4:Point;
var _local5:Point;
var _local6:Point;
_local3 = getPoint(_arg1);
_local4 = getPoint(_arg2);
_local5 = getPoint(((_arg1 + _arg2) / 2));
_local6 = Point.interpolate(_local3, _local4, (1 / 2));
var _local7:Point = Point.interpolate(_local5, _local6, 2);
return (new Bezier(_local3, _local7, _local4, true));
}
}
}//package flash.geom
Section 62
//Intersection (flash.geom.Intersection)
package flash.geom {
public class Intersection {
public const targetTimes:Array;
public const currentTimes:Array;
public var isCoincidence:Boolean;// = false
public function Intersection(){
currentTimes = new Array();
targetTimes = new Array();
super();
}
public static function isIntersectionPossible(_arg1:Rectangle, _arg2:Rectangle):Boolean{
_arg1 = _arg1.clone();
_arg2 = _arg2.clone();
if (_arg1.width < 0){
_arg1.x = (_arg1.x + _arg1.width);
_arg1.width = -(_arg1.width);
};
if (_arg1.height < 0){
_arg1.y = (_arg1.y + _arg1.height);
_arg1.height = -(_arg1.height);
};
if (_arg2.width < 0){
_arg2.x = (_arg2.x + _arg2.width);
_arg2.width = -(_arg2.width);
};
if (_arg2.height < 0){
_arg2.y = (_arg2.y + _arg2.height);
_arg2.height = -(_arg2.height);
};
_arg1.width = (_arg1.width + 1E-10);
_arg1.height = (_arg1.height + 1E-10);
_arg2.width = (_arg2.width + 1E-10);
_arg2.height = (_arg2.height + 1E-10);
trace(_arg1, _arg2, _arg1.intersects(_arg2));
return (_arg1.intersects(_arg2));
}
}
}//package flash.geom
Section 63
//IParametric (flash.geom.IParametric)
package flash.geom {
public interface IParametric {
function get start():Point;
function getClosest(_arg1:Point):Number;
function set start(_arg1:Point):void;
function get length():Number;
function intersectionBezier(_arg1:Bezier):Intersection;
function get isSegment():Boolean;
function getSegmentLength(_arg1:Number):Number;
function toString():String;
function angleOffset(_arg1:Number, _arg2:Point=null):void;
function setPoint(_arg1:Number, _arg2:Number=undefined, _arg3:Number=undefined):void;
function getTimeByDistance(_arg1:Number):Number;
function getTimesSequence(_arg1:Number, _arg2:Number=0):Array;
function set isSegment(_arg1:Boolean):void;
function offset(_arg1:Number=0, _arg2:Number=0):void;
function get bounds():Rectangle;
function set end(_arg1:Point):void;
function getPoint(_arg1:Number, _arg2:Point=null):Point;
function get end():Point;
function intersectionLine(_arg1:Line):Intersection;
}
}//package flash.geom
Section 64
//Line (flash.geom.Line)
package flash.geom {
public class Line implements IParametric {
protected const PRECISION:Number = 1E-10;
protected var __start:Point;
protected var __isSegment:Boolean;
protected var __end:Point;
public function Line(_arg1:Point=undefined, _arg2:Point=undefined, _arg3:Boolean=true){
initInstance(_arg1, _arg2, _arg3);
}
public function getTimeByDistance(_arg1:Number):Number{
return ((_arg1 / Point.distance(__start, __end)));
}
public function offset(_arg1:Number=0, _arg2:Number=0):void{
__start.offset(_arg1, _arg2);
__end.offset(_arg1, _arg2);
}
public function intersectionLine(_arg1:Line):Intersection{
var _local2:Intersection;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local12: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;
if (((__isSegment) && (_arg1.__isSegment))){
_local14 = Math.max(__start.x, __end.x);
_local15 = Math.max(__start.y, __end.y);
_local16 = Math.min(__start.x, __end.x);
_local17 = Math.min(__start.y, __end.y);
_local18 = Math.max(_arg1.__start.x, _arg1.__end.x);
_local19 = Math.max(_arg1.__start.y, _arg1.__end.y);
_local20 = Math.min(_arg1.__start.x, _arg1.__end.x);
_local21 = Math.min(_arg1.__start.y, _arg1.__end.y);
if ((((((((_local14 < _local20)) || ((_local18 < _local16)))) || ((_local15 < _local21)))) || ((_local19 < _local17)))){
return (null);
};
};
_local3 = (__end.x - __start.x);
_local4 = (__end.y - __start.y);
_local5 = (_arg1.__end.x - _arg1.__start.x);
_local6 = (_arg1.__end.y - _arg1.__start.y);
_local7 = (__start.x - _arg1.__start.x);
_local8 = (__start.y - _arg1.__start.y);
var _local9:Number = ((_local3 * _local6) - (_local4 * _local5));
var _local10:Number = ((_local5 * _local8) - (_local7 * _local6));
if (_local9 == 0){
if (_local10 == 0){
_local2 = new Intersection();
_local2.isCoincidence = true;
return (_local2);
};
return (null);
};
var _local11:Number = (_local10 / _local9);
if (__isSegment){
if ((((_local11 < 0)) || ((_local11 > 1)))){
return (null);
};
};
_local12 = ((_local3 * _local8) - (_local7 * _local4));
var _local13:Number = (_local12 / _local9);
if (_arg1.__isSegment){
if ((((_local13 < 0)) || ((_local13 > 1)))){
return (null);
};
};
_local2 = new Intersection();
_local2.currentTimes[0] = _local11;
_local2.targetTimes[0] = _local13;
return (_local2);
}
public function set angle(_arg1:Number):void{
var _local2:Number;
_local2 = Point.distance(__start, __end);
var _local3:Point = Point.polar(_local2, _arg1);
__end.x = (__start.x + _local3.x);
__end.y = (__start.y + _local3.y);
}
public function getClosest(_arg1:Point):Number{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
_local2 = Point.distance(__start, _arg1);
_local3 = Math.atan2((__start.y - __end.y), (__start.x - __end.x));
_local4 = (_local3 - angle);
_local5 = (_local2 * Math.cos(_local4));
var _local6:Number = (_local5 / length);
if (!__isSegment){
return (_local6);
};
if (_local6 < 0){
return (0);
};
if (_local6 > 1){
return (1);
};
return (_local6);
}
public function get isSegment():Boolean{
return (__isSegment);
}
public function get bounds():Rectangle{
if (__start.x > __end.x){
if (__start.y > __end.y){
return (new Rectangle(__end.x, __end.y, (__start.x - __end.x), (__start.y - __end.y)));
};
return (new Rectangle(__end.x, __start.y, (__start.x - __end.x), (__end.y - __start.y)));
};
if (__start.y > __end.y){
return (new Rectangle(__start.x, __end.y, (__end.x - __start.x), (__start.y - __end.y)));
};
return (new Rectangle(__start.x, __start.y, (__end.x - __start.x), (__end.y - __start.y)));
}
public function set end(_arg1:Point):void{
__end = _arg1;
}
public function getSegmentLength(_arg1:Number):Number{
return (Point.distance(__start, getPoint(_arg1)));
}
protected function initInstance(_arg1:Point=undefined, _arg2:Point=undefined, _arg3:Boolean=true):void{
__start = (((_arg1 as Point)) || (new Point()));
__end = (((_arg2 as Point)) || (new Point()));
__isSegment = Boolean(_arg3);
}
public function angleOffset(_arg1:Number, _arg2:Point=null):void{
_arg2 = ((_arg2) || (new Point()));
var _local3:Line = new Line(_arg2, __start);
_local3.angle = (_local3.angle + _arg1);
var _local4:Line = new Line(_arg2, __end);
new Line(_arg2, __end).angle = (_local4.angle + _arg1);
}
public function intersectionBezier(_arg1:Bezier):Intersection{
var _local2:Intersection = new Intersection();
return (_local2);
}
public function set start(_arg1:Point):void{
__start = _arg1;
}
public function get angle():Number{
return (Math.atan2((__end.y - __start.y), (__end.x - __start.x)));
}
public function setPoint(_arg1:Number, _arg2:Number=undefined, _arg3:Number=undefined):void{
if (((isNaN(_arg2)) && (isNaN(_arg3)))){
return;
};
var _local4:Point = getPoint(_arg1);
if (!isNaN(_arg2)){
_local4.x = _arg2;
};
if (!isNaN(_arg3)){
_local4.y = _arg3;
};
__end.x = (_local4.x + ((_local4.x - __start.x) * ((1 - _arg1) / _arg1)));
__end.y = (_local4.y + ((_local4.y - __start.y) * ((1 - _arg1) / _arg1)));
}
public function set isSegment(_arg1:Boolean):void{
__isSegment = Boolean(_arg1);
}
public function get end():Point{
return (__end);
}
public function clone():Line{
return (new Line(__start.clone(), __end.clone(), __isSegment));
}
public function getPoint(_arg1:Number, _arg2:Point=null):Point{
_arg2 = (((_arg2 as Point)) || (new Point()));
_arg2.x = (__start.x + ((__end.x - __start.x) * _arg1));
_arg2.y = (__start.y + ((__end.y - __start.y) * _arg1));
return (_arg2);
}
public function get start():Point{
return (__start);
}
public function get length():Number{
return (Point.distance(__start, __end));
}
public function toString():String{
return ((((("(start:" + __start) + ", end:") + __end) + ")"));
}
public function getTimesSequence(_arg1:Number, _arg2:Number=0):Array{
_arg1 = Math.abs(_arg1);
var _local3:Number = (((_arg2 % _arg1) + _arg1) % _arg1);
var _local4:Array = new Array();
var _local5:Number = Point.distance(__start, __end);
if (_local3 > _local5){
return (_local4);
};
var _local6:Number = (_arg1 / _local5);
var _local7:Number = getTimeByDistance(_local3);
while (_local7 <= 1) {
_local4[_local4.length] = _local7;
_local7 = (_local7 + _local6);
};
return (_local4);
}
public function getSegment(_arg1:Number=0, _arg2:Number=1):Line{
return (new Line(getPoint(_arg1), getPoint(_arg2)));
}
}
}//package flash.geom
class OrderedPoint {
public var point:Point;
public var time:Number;
public static const TIME:String = "time";
private function OrderedPoint(_arg1:Number, _arg2:Point){
time = _arg1;
point = _arg2.clone();
}
}
Section 65
//Equations (flash.math.Equations)
package flash.math {
public class Equations {
protected static const PRECISION:Number = 1E-10;
public static function solveLinearEquation(_arg1:Number, _arg2:Number):Array{
if (Math.abs(_arg1) < PRECISION){
return ([]);
};
return ([(-(_arg2) / _arg1)]);
}
public static function solveQuadraticEquation(_arg1:Number, _arg2:Number, _arg3:Number):Array{
if (Math.abs(_arg1) < PRECISION){
return (solveLinearEquation(_arg2, _arg3));
};
var _local4:Number = (_arg2 / _arg1);
var _local5:Number = (_arg3 / _arg1);
if (Math.abs(_local4) < PRECISION){
_local4 = 0;
};
if (Math.abs(_local5) < PRECISION){
_local5 = 0;
};
var _local6:Number = ((_local4 * _local4) - (4 * _local5));
if (Math.abs(_local6) < PRECISION){
_local6 = 0;
};
if (_local6 > 0){
_local6 = Math.sqrt(_local6);
return ([((-(_local4) - _local6) / 2), ((-(_local4) + _local6) / 2)]);
};
if (_local6 == 0){
return ([(-(_local4) / 2)]);
};
return ([]);
}
public static function solveQuarticEquation(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):Array{
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local17:Number;
var _local18:Number;
var _local19:Array;
if (Math.abs(_arg1) < PRECISION){
return (solveCubicEquation(_arg2, _arg3, _arg4, _arg5));
};
var _local6:Number = (_arg2 / _arg1);
var _local7:Number = (_arg3 / _arg1);
var _local8:Number = (_arg4 / _arg1);
var _local9:Number = (_arg5 / _arg1);
if (Math.abs(_local6) < PRECISION){
_local6 = 0;
};
if (Math.abs(_local7) < PRECISION){
_local7 = 0;
};
if (Math.abs(_local8) < PRECISION){
_local8 = 0;
};
if (Math.abs(_local9) < PRECISION){
_local9 = 0;
};
_local12 = solveCubicEquation(1, -(_local7), ((_local6 * _local8) - (4 * _local9)), ((((-(_local6) * _local6) * _local9) + ((4 * _local7) * _local9)) - (_local8 * _local8)))[0];
var _local13:Number = (_local12 / 2);
var _local14:Number = ((((_local6 * _local6) / 4) - _local7) + _local12);
var _local15:Number = ((_local6 * _local13) - _local8);
var _local16:Number = ((_local13 * _local13) - _local9);
if (Math.abs(_local14) < PRECISION){
_local14 = 0;
};
if (Math.abs(_local15) < PRECISION){
_local15 = 0;
};
if (Math.abs(_local16) < PRECISION){
_local16 = 0;
};
if ((((_local14 >= 0)) && ((_local16 >= 0)))){
_local17 = Math.sqrt(_local16);
_local18 = Math.sqrt(_local14);
_local10 = ((_local6 / 2) - _local18);
if (_local15 > 0){
_local11 = (_local13 - _local17);
} else {
_local11 = (_local13 + _local17);
};
_local19 = solveQuadraticEquation(1, _local10, _local11);
_local10 = ((_local6 / 2) + _local18);
if (_local15 > 0){
_local11 = (_local13 + _local17);
} else {
_local11 = (_local13 - _local17);
};
return (_local19.concat(solveQuadraticEquation(1, _local10, _local11)));
};
return ([]);
}
public static function solveCubicEquation(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Array{
var _local8:Number;
var _local9:Number;
var _local11:Number;
var _local13:Number;
if (Math.abs(_arg1) < PRECISION){
return (solveQuadraticEquation(_arg2, _arg3, _arg4));
};
var _local5:Number = (_arg2 / _arg1);
var _local6:Number = (_arg3 / _arg1);
var _local7:Number = (_arg4 / _arg1);
if (Math.abs(_local5) < PRECISION){
_local5 = 0;
};
if (Math.abs(_local6) < PRECISION){
_local6 = 0;
};
if (Math.abs(_local7) < PRECISION){
_local7 = 0;
};
_local8 = (((-(_local5) * _local5) / 3) + _local6);
_local9 = ((((((2 * _local5) * _local5) * _local5) / 27) - ((_local5 * _local6) / 3)) + _local7);
var _local10:Number = (((((((((2 * _local5) * _local5) * _local5) / 27) - ((_local5 * _local6) / 3)) + _local7) * _local9) / 4) + (((_local8 * _local8) * _local8) / 27));
if (_local10 >= 0){
_local13 = Math.sqrt(_local10);
_local11 = ((mathPower(((-(_local9) / 2) + _local13), (1 / 3)) + mathPower(((-(_local9) / 2) - _local13), (1 / 3))) - (_local5 / 3));
} else {
_local11 = (((2 * Math.sqrt((-(_local8) / 3))) * Math.cos((mathAtan2((-(_local9) / 2), Math.sqrt(Math.abs(_local10))) / 3))) - (_local5 / 3));
};
var _local12:Array = solveQuadraticEquation(1, (_local11 + _local5), (((_local11 * _local11) + (_local5 * _local11)) + _local6));
if (((!((_local12[0] == _local11))) && (!((_local12[1] == _local11))))){
_local12.push(_local11);
};
return (_local12);
}
private static function mathAtan2(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
if (_arg1 == 0){
_local3 = (Math.PI / 2);
} else {
if (_arg1 > 0){
_local3 = Math.atan(Math.abs((_arg2 / _arg1)));
} else {
_local3 = (Math.PI - Math.atan(Math.abs((_arg2 / _arg1))));
};
};
if (_arg2 >= 0){
return (_local3);
};
return (-(_local3));
}
public static function solveEquation(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):Array{
var _local7:uint = arguments["length"];
switch (_local7){
case 2:
return (solveLinearEquation(_arg1, _arg2));
case 3:
return (solveQuadraticEquation(_arg1, _arg2, _arg3));
case 4:
return (solveCubicEquation(_arg1, _arg2, _arg3, _arg4));
case 5:
return (solveQuarticEquation(_arg1, _arg2, _arg3, _arg4, _arg5));
default:
return ([]);
};
}
private static function mathPower(_arg1:Number, _arg2:Number):Number{
if (_arg1 > 0){
return (Math.exp((Math.log(_arg1) * _arg2)));
};
if (_arg1 < 0){
return (-(Math.exp((Math.log(-(_arg1)) * _arg2))));
};
return (0);
}
}
}//package flash.math
Section 66
//GameAbortCommand (game.controller.GameAbortCommand)
package game.controller {
import org.puremvc.as3.interfaces.*;
import game.model.*;
import game.view.components.*;
import org.puremvc.as3.patterns.command.*;
import game.view.*;
import caurina.transitions.*;
public class GameAbortCommand extends SimpleCommand implements ICommand {
override public function execute(_arg1:INotification):void{
var _local2:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy);
_local2.gameAbort();
Tweener.removeAllTweens();
var _local3:LevelMediator = (facade.retrieveMediator(LevelMediator.NAME) as LevelMediator);
_local3.destroy();
var _local4:GameCompleteMediator = (facade.retrieveMediator(GameCompleteMediator.NAME) as GameCompleteMediator);
if (_local4){
_local4.destroy();
};
var _local5:LevelPauseMediator = (facade.retrieveMediator(LevelPauseMediator.NAME) as LevelPauseMediator);
if (_local5){
_local5.destroy();
};
var _local6:LevelCompleteMediator = (facade.retrieveMediator(LevelCompleteMediator.NAME) as LevelCompleteMediator);
if (_local6){
_local6.destroy();
};
var _local7:GameOverMediator = (facade.retrieveMediator(GameOverMediator.NAME) as GameOverMediator);
if (_local7){
_local7.destroy();
};
var _local8:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator);
var _local9:MainMenuView = new MainMenuView();
_local8.getViewContainer().addChild(_local9);
var _local10:MainMenuMediator = new MainMenuMediator(_local9);
facade.registerMediator(_local10);
}
}
}//package game.controller
Section 67
//GameCompleteCommand (game.controller.GameCompleteCommand)
package game.controller {
import org.puremvc.as3.interfaces.*;
import game.model.*;
import game.view.components.*;
import org.puremvc.as3.patterns.command.*;
import game.view.*;
public class GameCompleteCommand extends SimpleCommand implements ICommand {
override public function execute(_arg1:INotification):void{
var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator);
var _local3:GameCompleteView = new GameCompleteView();
_local2.getViewContainer().addChild(_local3);
var _local4:GameCompleteMediator = new GameCompleteMediator(_local3);
facade.registerMediator(_local4);
var _local5:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy);
_local5.gameComplete();
var _local6:LevelPauseMediator = (facade.retrieveMediator(LevelPauseMediator.NAME) as LevelPauseMediator);
_local6.destroy();
}
}
}//package game.controller
Section 68
//GameOverCommand (game.controller.GameOverCommand)
package game.controller {
import org.puremvc.as3.interfaces.*;
import game.view.components.*;
import org.puremvc.as3.patterns.command.*;
import game.view.*;
public class GameOverCommand extends SimpleCommand implements ICommand {
override public function execute(_arg1:INotification):void{
var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator);
var _local3:GameOverView = new GameOverView();
_local2.getViewContainer().addChild(_local3);
var _local4:GameOverMediator = new GameOverMediator(_local3);
facade.registerMediator(_local4);
var _local5:LevelPauseMediator = (facade.retrieveMediator(LevelPauseMediator.NAME) as LevelPauseMediator);
_local5.destroy();
}
}
}//package game.controller
Section 69
//GameStartCommand (game.controller.GameStartCommand)
package game.controller {
import org.puremvc.as3.interfaces.*;
import game.model.*;
import game.view.components.*;
import org.puremvc.as3.patterns.command.*;
import game.view.*;
public class GameStartCommand extends SimpleCommand implements ICommand {
private var startLevelIndex:int;
private var appMed:AppMediator;
private static var APPEAR:Boolean = true;
override public function execute(_arg1:INotification):void{
var _local3:LevelAppearView;
var _local4:LevelAppearMediator;
var _local2:MainMenuMediator = (facade.retrieveMediator(MainMenuMediator.NAME) as MainMenuMediator);
_local2.destroy();
startLevelIndex = (_arg1.getBody() as int);
appMed = (facade.retrieveMediator(AppMediator.NAME) as AppMediator);
if (APPEAR){
_local3 = new LevelAppearView();
appMed.getViewContainer().addChild(_local3);
_local4 = new LevelAppearMediator(_local3, gameStart);
facade.registerMediator(_local4);
} else {
gameStart();
};
}
private function gameStart():void{
var _local1:GameProxy = new GameProxy();
facade.registerProxy(_local1);
var _local2:LevelView = new LevelView();
appMed.getViewContainer().addChild(_local2);
var _local3:LevelMediator = new LevelMediator(_local2);
facade.registerMediator(_local3);
var _local4:LevelPauseView = new LevelPauseView();
appMed.getPopupContainer().addChild(_local4);
var _local5:LevelPauseMediator = new LevelPauseMediator(_local4);
facade.registerMediator(_local5);
_local1.gameStart(startLevelIndex);
}
}
}//package game.controller
Section 70
//InitializeCommand (game.controller.InitializeCommand)
package game.controller {
import org.puremvc.as3.interfaces.*;
import game.view.components.*;
import org.puremvc.as3.patterns.command.*;
import game.view.*;
public class InitializeCommand extends SimpleCommand implements ICommand {
override public function execute(_arg1:INotification):void{
var _local2:AppView = new AppView();
ApplicationFacade.getInstance().viewContainer.addChild(_local2);
var _local3:AppMediator = new AppMediator(_local2);
facade.registerMediator(_local3);
var _local4:MainMenuView = new MainMenuView();
_local3.getViewContainer().addChild(_local4);
var _local5:MainMenuMediator = new MainMenuMediator(_local4);
facade.registerMediator(_local5);
var _local6:CustomCursorView = new CustomCursorView();
_local3.getCursorContainer().addChild(_local6);
var _local7:CustomCursorMediator = new CustomCursorMediator(_local6);
facade.registerMediator(_local7);
}
}
}//package game.controller
Section 71
//LevelCompleteCommand (game.controller.LevelCompleteCommand)
package game.controller {
import org.puremvc.as3.interfaces.*;
import game.view.components.*;
import org.puremvc.as3.patterns.command.*;
import game.view.*;
public class LevelCompleteCommand extends SimpleCommand implements ICommand {
override public function execute(_arg1:INotification):void{
var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator);
var _local3:LevelCompleteView = new LevelCompleteView();
_local2.getViewContainer().addChild(_local3);
var _local4:LevelCompleteMediator = new LevelCompleteMediator(_local3);
facade.registerMediator(_local4);
}
}
}//package game.controller
Section 72
//LevelStartCommand (game.controller.LevelStartCommand)
package game.controller {
import org.puremvc.as3.interfaces.*;
import game.model.*;
import org.puremvc.as3.patterns.command.*;
public class LevelStartCommand extends SimpleCommand implements ICommand {
override public function execute(_arg1:INotification):void{
var _local2:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy);
_local2.levelStart((_arg1.getBody() as int));
}
}
}//package game.controller
Section 73
//StartupCommand (game.controller.StartupCommand)
package game.controller {
import org.puremvc.as3.interfaces.*;
import game.model.*;
import flash.display.*;
import org.puremvc.as3.patterns.command.*;
public class StartupCommand extends SimpleCommand implements ICommand {
override public function execute(_arg1:INotification):void{
var _local2:Sprite = _arg1.getBody().container;
var _local3:AppProxy = new AppProxy();
facade.registerProxy(_local3);
_local3.startApp();
}
}
}//package game.controller
Section 74
//AppProxy (game.model.AppProxy)
package game.model {
import flash.events.*;
import core.*;
import flash.media.*;
import game.controller.*;
import org.puremvc.as3.patterns.proxy.*;
public class AppProxy extends Proxy {
private var music:Sound;
private var notesProxy:NotesProxy;
public var musicChannel:SoundChannel;
public static const GAME_ABORT:String = "GameAbort";
public static const GAME_COMPLETE:String = "GameComplete";
public static const EDITOR_STARTUP:String = "EditorStartup";
public static const INITIALIZE:String = "Initialize";
public static const NAME:String = "AppProxy";
public static const GAME_START:String = "GameStart";
public function AppProxy():void{
super(NAME);
init();
}
private function init():void{
facade.registerCommand(INITIALIZE, InitializeCommand);
facade.registerCommand(GAME_START, GameStartCommand);
facade.registerCommand(GAME_ABORT, GameAbortCommand);
notesProxy = new NotesProxy();
facade.registerProxy(notesProxy);
}
private function assetsInitHandler(_arg1:Event=null):void{
SaveData.getInstance().initialize();
var _local2:Class = GameAssets.getInstance().getAssetClass("SndMusic");
music = new (_local2);
musicChannel = music.play(0, 100000, SaveData.getInstance().musicTransform);
notesProxy.push(INITIALIZE);
}
private function coreAssetsInitHandler(_arg1:Event):void{
editorAssetsInitHandler(null);
}
private function editorAssetsInitHandler(_arg1:Event):void{
var _local2:GameAssets = GameAssets.getInstance();
_local2.addEventListener(Event.INIT, assetsInitHandler);
_local2.init();
}
public function startApp():void{
var _local1:CoreAssets = CoreAssets.getInstance();
_local1.addEventListener(Event.INIT, coreAssetsInitHandler);
_local1.init();
}
}
}//package game.model
Section 75
//GameAssets (game.model.GameAssets)
package game.model {
import flash.events.*;
import flash.display.*;
import flash.system.*;
public class GameAssets extends EventDispatcher {
private var Assets:Class;
private var appDomain:ApplicationDomain;
private static var instance:GameAssets;
public function GameAssets():void{
Assets = GameAssets_Assets;
super();
}
public function init():void{
var _local1:Loader = new Loader();
_local1.contentLoaderInfo.addEventListener(Event.INIT, assetsInitHandler);
_local1.loadBytes(new Assets());
}
private function assetsInitHandler(_arg1:Event):void{
appDomain = _arg1.target.content.loaderInfo.applicationDomain;
dispatchEvent(new Event(Event.INIT));
}
public function getAssetClass(_arg1:String):Class{
if (!appDomain.hasDefinition(_arg1)){
trace((("*Error*: There is no definition of class '" + _arg1) + "'"));
return (null);
};
return ((appDomain.getDefinition(_arg1) as Class));
}
public static function getInstance():GameAssets{
if (!instance){
instance = new (GameAssets);
};
return (instance);
}
}
}//package game.model
Section 76
//GameAssets_Assets (game.model.GameAssets_Assets)
package game.model {
import mx.core.*;
public class GameAssets_Assets extends ByteArrayAsset {
}
}//package game.model
Section 77
//GameProxy (game.model.GameProxy)
package game.model {
import core.*;
import game.view.components.*;
import core.objects.units.*;
import game.controller.*;
import org.puremvc.as3.patterns.proxy.*;
import game.view.*;
public class GameProxy extends Proxy {
private var engine:CoreEngine;
public var currentLevel:Level;
public var score:int;
private var notesProxy:NotesProxy;
private var levels:Array;
public static const GAME_OVER:String = "GameOver";
public static const LEVEL_UPDATE:String = "LevelUpdate";
public static const GAME_COMPLETE:String = "GameComplete";
public static const LEVEL_START:String = "LevelStart";
public static const NAME:String = "GameProxy";
public static const PAUSE_OFF:String = "PauseOff";
public static const PLAYER_SHOOT:String = "PlayerShoot";
public static const PLAYER_IN_PAIN:String = "PlayerInPain";
public static const LEVEL_COMPLETE:String = "LevelComplete";
public static const PAUSE_ON:String = "PauseOn";
public static const MONSTER_DEAD:String = "MonsterDead";
public function GameProxy():void{
super(NAME);
init();
}
private function updateHandler(_arg1:CoreEvent):void{
notesProxy.push(LEVEL_UPDATE);
}
private function monsterDeadHandler(_arg1:CoreEvent):void{
score = (score + 10);
notesProxy.push(MONSTER_DEAD);
}
private function playerInPainHandler(_arg1:CoreEvent):void{
notesProxy.push(PLAYER_IN_PAIN, engine.player.health);
}
private function init():void{
var _local1:uint;
var _local2:Array;
notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy);
engine = CoreEngine.getInstance();
if (!facade.hasCommand(LEVEL_START)){
facade.registerCommand(LEVEL_START, LevelStartCommand);
};
if (!facade.hasCommand(LEVEL_COMPLETE)){
facade.registerCommand(LEVEL_COMPLETE, LevelCompleteCommand);
};
if (!facade.hasCommand(GAME_COMPLETE)){
facade.registerCommand(GAME_COMPLETE, GameCompleteCommand);
};
if (!facade.hasCommand(GAME_OVER)){
facade.registerCommand(GAME_OVER, GameOverCommand);
};
levels = [];
_local2 = [];
var _local3:Array = [];
var _local4:Array = [];
var _local5:Array = [];
_local1 = 0;
while (_local1 < 6) {
_local3.push(new MonsterDef(MonsterDef.TYPE_1, (_local1 / 6)));
_local1++;
};
_local1 = 0;
while (_local1 < 8) {
_local4.push(new MonsterDef(MonsterDef.TYPE_1, (_local1 / 8)));
_local1++;
};
_local1 = 0;
while (_local1 < 10) {
_local5.push(new MonsterDef(MonsterDef.TYPE_1, (_local1 / 10)));
_local1++;
};
addLevel([_local3, _local4, _local5]);
_local3 = [];
_local4 = [];
_local5 = [];
_local1 = 0;
while (_local1 < 6) {
_local3.push(new MonsterDef(MonsterDef.TYPE_2, (_local1 / 6)));
_local1++;
};
_local1 = 0;
while (_local1 < 8) {
_local4.push(new MonsterDef(MonsterDef.TYPE_2, (_local1 / 8)));
_local1++;
};
_local1 = 0;
while (_local1 < 10) {
_local5.push(new MonsterDef(MonsterDef.TYPE_2, (_local1 / 10)));
_local1++;
};
addLevel([_local3, _local4, _local5]);
_local3 = [];
_local4 = [];
_local5 = [];
_local1 = 0;
while (_local1 < 6) {
_local3.push(new MonsterDef(MonsterDef.TYPE_3, (_local1 / 6)));
_local1++;
};
_local1 = 0;
while (_local1 < 8) {
_local4.push(new MonsterDef(MonsterDef.TYPE_3, (_local1 / 8)));
_local1++;
};
_local1 = 0;
while (_local1 < 10) {
_local5.push(new MonsterDef(MonsterDef.TYPE_3, (_local1 / 10)));
_local1++;
};
addLevel([_local3, _local4, _local5]);
_local3 = [];
_local4 = [];
_local5 = [];
_local1 = 0;
while (_local1 < 6) {
_local3.push(new MonsterDef(MonsterDef.TYPE_4, (_local1 / 6)));
_local1++;
};
_local1 = 0;
while (_local1 < 8) {
_local4.push(new MonsterDef(MonsterDef.TYPE_4, (_local1 / 8)));
_local1++;
};
_local1 = 0;
while (_local1 < 10) {
_local5.push(new MonsterDef(MonsterDef.TYPE_4, (_local1 / 10)));
_local1++;
};
addLevel([_local3, _local4, _local5]);
_local3 = [];
_local4 = [];
_local5 = [];
_local1 = 0;
while (_local1 < 6) {
_local3.push(new MonsterDef(MonsterDef.TYPE_5, (_local1 / 6)));
_local1++;
};
_local1 = 0;
while (_local1 < 8) {
_local4.push(new MonsterDef(MonsterDef.TYPE_5, (_local1 / 8)));
_local1++;
};
_local1 = 0;
while (_local1 < 10) {
_local5.push(new MonsterDef(MonsterDef.TYPE_5, (_local1 / 10)));
_local1++;
};
addLevel([_local3, _local4, _local5]);
_local3 = [];
_local4 = [];
_local5 = [];
_local1 = 0;
while (_local1 < 6) {
_local3.push(new MonsterDef(MonsterDef.TYPE_6, (_local1 / 6)));
_local1++;
};
_local1 = 0;
while (_local1 < 8) {
_local4.push(new MonsterDef(MonsterDef.TYPE_6, (_local1 / 8)));
_local1++;
};
_local1 = 0;
while (_local1 < 10) {
_local5.push(new MonsterDef(MonsterDef.TYPE_6, (_local1 / 10)));
_local1++;
};
addLevel([_local3, _local4, _local5]);
_local3 = [];
_local4 = [];
_local5 = [];
_local1 = 0;
while (_local1 < 6) {
_local3.push(new MonsterDef(MonsterDef.TYPE_7, (_local1 / 6)));
_local1++;
};
_local1 = 0;
while (_local1 < 8) {
_local4.push(new MonsterDef(MonsterDef.TYPE_7, (_local1 / 8)));
_local1++;
};
_local1 = 0;
while (_local1 < 10) {
_local5.push(new MonsterDef(MonsterDef.TYPE_7, (_local1 / 10)));
_local1++;
};
addLevel([_local3, _local4, _local5]);
_local3 = [];
_local4 = [];
_local5 = [];
_local1 = 0;
while (_local1 < 6) {
_local3.push(new MonsterDef(MonsterDef.TYPE_8, (_local1 / 6)));
_local1++;
};
_local1 = 0;
while (_local1 < 8) {
_local4.push(new MonsterDef(MonsterDef.TYPE_8, (_local1 / 8)));
_local1++;
};
_local1 = 0;
while (_local1 < 10) {
_local5.push(new MonsterDef(MonsterDef.TYPE_8, (_local1 / 10)));
_local1++;
};
addLevel([_local3, _local4, _local5]);
_local3 = [];
_local4 = [];
_local5 = [];
_local1 = 0;
while (_local1 < 6) {
_local3.push(new MonsterDef(MonsterDef.TYPE_9, (_local1 / 6)));
_local1++;
};
_local1 = 0;
while (_local1 < 8) {
_local4.push(new MonsterDef(MonsterDef.TYPE_9, (_local1 / 8)));
_local1++;
};
_local1 = 0;
while (_local1 < 10) {
_local5.push(new MonsterDef(MonsterDef.TYPE_9, (_local1 / 10)));
_local1++;
};
addLevel([_local3, _local4, _local5]);
_local3 = [];
_local4 = [];
_local5 = [];
_local1 = 0;
while (_local1 < 6) {
_local3.push(new MonsterDef(MonsterDef.TYPE_10, (_local1 / 6)));
_local1++;
};
_local1 = 0;
while (_local1 < 8) {
_local4.push(new MonsterDef(MonsterDef.TYPE_10, (_local1 / 8)));
_local1++;
};
_local1 = 0;
while (_local1 < 10) {
_local5.push(new MonsterDef(MonsterDef.TYPE_10, (_local1 / 10)));
_local1++;
};
addLevel([_local3, _local4, _local5]);
}
public function levelNext():void{
var _local1:int = levels.indexOf(currentLevel);
notesProxy.push(LEVEL_START, (_local1 + 1));
}
public function pauseOff():void{
engine.pauseOff();
}
public function gameComplete():void{
engine.gameComplete();
}
public function gameStart(_arg1:int):void{
var _local2:LevelMediator = (facade.retrieveMediator(LevelMediator.NAME) as LevelMediator);
var _local3:LevelView = (_local2.getViewComponent() as LevelView);
var _local4:CoreCanvas = new CoreCanvas(_local3.levelContainer, _local3.floor, _local3.objects, _local3.debug);
engine.addEventListener(CoreEvent.UPDATE, updateHandler);
engine.addEventListener(CoreEvent.LEVEL_COMPLETE, levelCompleteHandler);
engine.addEventListener(CoreEvent.PLAYER_IN_PAIN, playerInPainHandler);
engine.addEventListener(CoreEvent.PLAYER_DEAD, playerDeadHandler);
engine.addEventListener(CoreEvent.MONSTER_DEAD, monsterDeadHandler);
engine.gameStart(_local4);
engine.player.addEventListener(CoreEvent.PLAYER_SHOOT, playerShootHandler);
score = 0;
notesProxy.push(LEVEL_START, _arg1);
}
private function addLevel(_arg1:Array):void{
var _local2:Level = new Level();
_local2.waves = _arg1;
levels.push(_local2);
}
private function playerDeadHandler(_arg1:CoreEvent):void{
notesProxy.push(GAME_OVER);
}
private function playerShootHandler(_arg1:CoreEvent):void{
score = (score - 1);
if (score < 0){
score = 0;
};
notesProxy.push(PLAYER_SHOOT);
}
private function levelCompleteHandler(_arg1:CoreEvent):void{
var _local2:int = levels.indexOf(currentLevel);
if (_local2 == (levels.length - 1)){
notesProxy.push(GAME_COMPLETE);
} else {
notesProxy.push(LEVEL_COMPLETE);
};
}
public function pauseOn():void{
engine.pauseOn();
}
public function gameAbort():void{
engine.removeEventListener(CoreEvent.UPDATE, updateHandler);
engine.removeEventListener(CoreEvent.LEVEL_COMPLETE, levelCompleteHandler);
engine.removeEventListener(CoreEvent.PLAYER_IN_PAIN, playerInPainHandler);
engine.removeEventListener(CoreEvent.PLAYER_DEAD, playerDeadHandler);
engine.removeEventListener(CoreEvent.MONSTER_DEAD, monsterDeadHandler);
engine.destroy();
facade.removeProxy(NAME);
}
public function isPaused():Boolean{
return (engine.isPaused);
}
public function getLevels():Array{
return (levels);
}
public function levelStart(_arg1:int):void{
currentLevel = levels[_arg1];
engine.levelStart(currentLevel);
}
}
}//package game.model
Section 78
//NotesProxy (game.model.NotesProxy)
package game.model {
import org.puremvc.as3.interfaces.*;
import org.puremvc.as3.patterns.proxy.*;
public class NotesProxy extends Proxy implements IProxy {
private var notes:Array;
public static const NAME:String = "NotesProxy";
public function NotesProxy():void{
super(NAME);
init();
}
private function init():void{
notes = [];
}
private function sendNote():void{
var _local1:Object = notes[0];
if (_local1.name != GameProxy.LEVEL_UPDATE){
trace("note!", _local1.name);
};
sendNotification(_local1.name, _local1.body);
sendNoteComplete();
}
public function push(_arg1:String, _arg2:Object=null):void{
var _local3:Object = {name:_arg1, body:_arg2};
notes.push(_local3);
if (notes.length == 1){
sendNote();
};
}
private function sendNoteComplete():void{
notes.splice(0, 1);
if (notes.length > 0){
sendNote();
};
}
}
}//package game.model
Section 79
//SaveData (game.model.SaveData)
package game.model {
import flash.display.*;
import flash.media.*;
import flash.net.*;
public class SaveData {
public var sndTransform:SoundTransform;
private var sharedObject:SharedObject;
public var musicTransform:SoundTransform;
public var isNewGame:Boolean;
public var soundEnabled:Boolean;
public var completedLevels:Array;
public var graphicsQuality:uint;
public var musicEnabled:Boolean;
private static var instance:SaveData;
public function SaveData():void{
}
public function toggleSoundEnabled():void{
soundEnabled = !(soundEnabled);
sndTransform.volume = (soundEnabled) ? 1 : 0;
sharedObject.data.soundEnabled = soundEnabled;
sharedObject.flush();
}
public function setGraphicsQuality(_arg1:uint):void{
var _local2:String;
graphicsQuality = _arg1;
switch (_arg1){
case 0:
_local2 = StageQuality.LOW;
break;
case 1:
_local2 = StageQuality.MEDIUM;
break;
case 2:
_local2 = StageQuality.HIGH;
break;
};
ApplicationFacade.getInstance().viewContainer.stage.quality = _local2;
sharedObject.data.graphicsQuality = graphicsQuality;
sharedObject.flush();
}
public function toggleMusicEnabled():void{
musicEnabled = !(musicEnabled);
musicTransform.volume = (musicEnabled) ? 1 : 0;
var _local1:ApplicationFacade = ApplicationFacade.getInstance();
var _local2:AppProxy = (_local1.retrieveProxy(AppProxy.NAME) as AppProxy);
_local2.musicChannel.soundTransform = musicTransform;
sharedObject.data.musicEnabled = musicEnabled;
sharedObject.flush();
}
public function initialize():void{
sharedObject = SharedObject.getLocal("gameData");
if (sharedObject.data.isNewGame == null){
isNewGame = true;
} else {
isNewGame = sharedObject.data.isNewGame;
};
graphicsQuality = 2;
soundEnabled = true;
musicEnabled = true;
sndTransform = new SoundTransform();
musicTransform = new SoundTransform();
if (sharedObject.data.soundEnabled != undefined){
soundEnabled = sharedObject.data.soundEnabled;
};
if (sharedObject.data.musicEnabled != undefined){
musicEnabled = sharedObject.data.musicEnabled;
};
if (sharedObject.data.graphicsQuality != undefined){
graphicsQuality = sharedObject.data.graphicsQuality;
};
sndTransform.volume = (soundEnabled) ? 1 : 0;
musicTransform.volume = (musicEnabled) ? 1 : 0;
setGraphicsQuality(graphicsQuality);
}
public static function getInstance():SaveData{
if (instance == null){
instance = new (SaveData);
};
return (instance);
}
}
}//package game.model
Section 80
//AppView (game.view.components.AppView)
package game.view.components {
import game.model.*;
import flash.display.*;
public class AppView extends Sprite {
private var window:Sprite;
public var container:Sprite;
public var popupContainer:Sprite;
public var cursorContainer:Sprite;
public function AppView(){
init();
}
private function init():void{
var _local1:Class = GameAssets.getInstance().getAssetClass("AppWindow");
window = new (_local1);
addChild(window);
container = (window.getChildByName("container") as Sprite);
popupContainer = (window.getChildByName("popupContainer") as Sprite);
cursorContainer = (window.getChildByName("cursorContainer") as Sprite);
}
}
}//package game.view.components
Section 81
//CreditsView (game.view.components.CreditsView)
package game.view.components {
import game.model.*;
import flash.display.*;
public class CreditsView extends Sprite {
private var window:Sprite;
public var inner:Sprite;
public var close_bt:SimpleButton;
public var egoshin_bt:SimpleButton;
public var karataev_bt:SimpleButton;
public function CreditsView():void{
init();
}
private function init():void{
var _local1:Class = GameAssets.getInstance().getAssetClass("CreditsWindow");
window = new (_local1);
addChild(window);
inner = (window.getChildByName("inner") as Sprite);
close_bt = (inner.getChildByName("close_bt") as SimpleButton);
egoshin_bt = (inner.getChildByName("egoshin_bt") as SimpleButton);
karataev_bt = (inner.getChildByName("karataev_bt") as SimpleButton);
}
}
}//package game.view.components
Section 82
//CustomCursorView (game.view.components.CustomCursorView)
package game.view.components {
import game.model.*;
import flash.display.*;
public class CustomCursorView extends Sprite {
public var window:MovieClip;
public function CustomCursorView():void{
init();
}
private function init():void{
var _local1:Class = GameAssets.getInstance().getAssetClass("CursorAsset");
window = new (_local1);
addChild(window);
}
}
}//package game.view.components
Section 83
//GameCompleteView (game.view.components.GameCompleteView)
package game.view.components {
import game.model.*;
import flash.display.*;
public class GameCompleteView extends Sprite {
private var window:Sprite;
public var inner:Sprite;
public var mainMenu_bt:SimpleButton;
public var replay_bt:SimpleButton;
public var back:Sprite;
public function GameCompleteView():void{
init();
}
private function init():void{
var _local1:Class = GameAssets.getInstance().getAssetClass("GameCompleteWindow");
window = new (_local1);
addChild(window);
inner = (window.getChildByName("inner") as Sprite);
mainMenu_bt = (inner.getChildByName("mainMenu_bt") as SimpleButton);
replay_bt = (inner.getChildByName("replay_bt") as SimpleButton);
back = (inner.getChildByName("back") as Sprite);
}
}
}//package game.view.components
Section 84
//GameOverView (game.view.components.GameOverView)
package game.view.components {
import game.model.*;
import flash.display.*;
public class GameOverView extends Sprite {
private var window:Sprite;
public var inner:Sprite;
public var mainMenu_bt:SimpleButton;
public var replay_bt:SimpleButton;
public function GameOverView():void{
init();
}
private function init():void{
var _local1:Class = GameAssets.getInstance().getAssetClass("GameOverWindow");
window = new (_local1);
addChild(window);
inner = (window.getChildByName("inner") as Sprite);
mainMenu_bt = (inner.getChildByName("mainMenu_bt") as SimpleButton);
replay_bt = (inner.getChildByName("replay_bt") as SimpleButton);
}
}
}//package game.view.components
Section 85
//LevelAppearView (game.view.components.LevelAppearView)
package game.view.components {
import game.model.*;
import flash.display.*;
public class LevelAppearView extends Sprite {
public var treesHolder:Sprite;
public var floor:Sprite;
private var window:Sprite;
public var floorPieces:Array;
public var trees1:Sprite;
public var trees2:Sprite;
public var clouds:Sprite;
public function LevelAppearView():void{
init();
}
private function init():void{
var _local4:Sprite;
var _local1:Class = GameAssets.getInstance().getAssetClass("LevelAppearWindow");
window = new (_local1);
addChild(window);
floor = (window.getChildByName("floor") as Sprite);
floorPieces = [];
var _local2:uint = 30;
var _local3:uint;
while (_local3 < _local2) {
_local4 = (floor.getChildByName(("piece" + _local3)) as Sprite);
floorPieces.push(_local4);
_local3++;
};
treesHolder = (window.getChildByName("treesHolder") as Sprite);
trees1 = (treesHolder.getChildByName("trees1") as Sprite);
trees2 = (treesHolder.getChildByName("trees2") as Sprite);
clouds = (window.getChildByName("clouds") as Sprite);
}
}
}//package game.view.components
Section 86
//LevelCloud (game.view.components.LevelCloud)
package game.view.components {
import game.model.*;
import flash.display.*;
public class LevelCloud extends Sprite {
private var speed:Number;
public function LevelCloud():void{
init();
}
private function init():void{
var _local1:Class = GameAssets.getInstance().getAssetClass("Cloud1Asset");
var _local2:Sprite = new (_local1);
addChild(_local2);
speed = 1;
x = Math.round((Math.random() * 640));
y = Math.round((Math.random() * 300));
}
public function update():void{
x = (x + speed);
if (x > 640){
reset();
};
}
private function reset():void{
x = -(width);
y = Math.round((Math.random() * 300));
}
}
}//package game.view.components
Section 87
//LevelCompleteView (game.view.components.LevelCompleteView)
package game.view.components {
import game.model.*;
import flash.display.*;
public class LevelCompleteView extends Sprite {
private var window:Sprite;
public var title:Sprite;
public function LevelCompleteView():void{
init();
}
private function init():void{
var _local1:Class = GameAssets.getInstance().getAssetClass("LevelCompleteWindow");
window = new (_local1);
addChild(window);
title = (window.getChildByName("title") as Sprite);
}
}
}//package game.view.components
Section 88
//LevelPauseView (game.view.components.LevelPauseView)
package game.view.components {
import game.model.*;
import flash.display.*;
public class LevelPauseView extends Sprite {
private var window:Sprite;
public var resume_bt:SimpleButton;
public var inner:Sprite;
public var mainMenu_bt:SimpleButton;
public function LevelPauseView():void{
init();
}
private function init():void{
var _local1:Class = GameAssets.getInstance().getAssetClass("LevelPauseWindow");
window = new (_local1);
addChild(window);
inner = (window.getChildByName("inner") as Sprite);
resume_bt = (inner.getChildByName("resume_bt") as SimpleButton);
mainMenu_bt = (inner.getChildByName("mainMenu_bt") as SimpleButton);
}
}
}//package game.view.components
Section 89
//LevelView (game.view.components.LevelView)
package game.view.components {
import game.model.*;
import flash.display.*;
import flash.text.*;
public class LevelView extends Sprite {
public var cloudsContainer:Sprite;
public var level_tf:TextField;
public var floor:Sprite;
public var score_tf:TextField;
private var window:Sprite;
public var debug:Sprite;
public var objects:Sprite;
public var pause_bt:SimpleButton;
public var health:MovieClip;
public var levelContainer:Sprite;
public function LevelView():void{
init();
}
private function init():void{
var _local1:Class = GameAssets.getInstance().getAssetClass("LevelWindow");
window = new (_local1);
addChild(window);
levelContainer = (window.getChildByName("levelContainer") as Sprite);
floor = (levelContainer.getChildByName("floor") as Sprite);
objects = (levelContainer.getChildByName("objects") as Sprite);
debug = (levelContainer.getChildByName("debug") as Sprite);
cloudsContainer = (levelContainer.getChildByName("cloudsContainer") as Sprite);
health = (window.getChildByName("health") as MovieClip);
level_tf = (window.getChildByName("level_tf") as TextField);
score_tf = (window.getChildByName("score_tf") as TextField);
pause_bt = (window.getChildByName("pause_bt") as SimpleButton);
}
}
}//package game.view.components
Section 90
//MainMenuView (game.view.components.MainMenuView)
package game.view.components {
import game.model.*;
import flash.display.*;
import flash.text.*;
public class MainMenuView extends Sprite {
public var levelSelector:Sprite;
public var pupil2:Sprite;
public var pupil1:Sprite;
public var level_tf:TextField;
public var moreFreeGames_bt:SimpleButton;
public var options_bt:SimpleButton;
public var credits_bt:SimpleButton;
public var title:Sprite;
public var titleEyes:Sprite;
public var eye2:Sprite;
public var editor_bt:SimpleButton;
public var eye1:Sprite;
private var window:Sprite;
public var addToSite_bt:SimpleButton;
public var gamesNow_bt:SimpleButton;
public var startGame_bt:SimpleButton;
public function MainMenuView():void{
init();
}
private function init():void{
var _local1:Class = GameAssets.getInstance().getAssetClass("MainMenuWindow");
window = new (_local1);
addChild(window);
startGame_bt = (window.getChildByName("startGame_bt") as SimpleButton);
levelSelector = (window.getChildByName("levelSelector") as Sprite);
level_tf = (levelSelector.getChildByName("level_tf") as TextField);
options_bt = (window.getChildByName("options_bt") as SimpleButton);
credits_bt = (window.getChildByName("credits_bt") as SimpleButton);
title = (window.getChildByName("title") as Sprite);
titleEyes = (title.getChildByName("titleEyes") as Sprite);
eye1 = (titleEyes.getChildByName("eye1") as Sprite);
pupil1 = (eye1.getChildByName("pupil") as Sprite);
eye2 = (titleEyes.getChildByName("eye2") as Sprite);
pupil2 = (eye2.getChildByName("pupil") as Sprite);
editor_bt = (window.getChildByName("editor_bt") as SimpleButton);
addToSite_bt = (window.getChildByName("addToSite_bt") as SimpleButton);
moreFreeGames_bt = (window.getChildByName("moreFreeGames_bt") as SimpleButton);
gamesNow_bt = (window.getChildByName("gamesNow_bt") as SimpleButton);
}
}
}//package game.view.components
Section 91
//OptionsView (game.view.components.OptionsView)
package game.view.components {
import game.model.*;
import flash.display.*;
public class OptionsView extends Sprite {
public var qualityHigh:MovieClip;
public var musicOn:MovieClip;
public var soundOff:MovieClip;
public var qualityMed:MovieClip;
public var soundOn:MovieClip;
private var window:Sprite;
public var musicOff:MovieClip;
public var qualityLow:MovieClip;
public var inner:Sprite;
public var close_bt:SimpleButton;
public function OptionsView():void{
init();
}
private function init():void{
var _local1:Class = GameAssets.getInstance().getAssetClass("OptionsWindow");
window = new (_local1);
addChild(window);
inner = (window.getChildByName("inner") as Sprite);
close_bt = (inner.getChildByName("close_bt") as SimpleButton);
qualityLow = (inner.getChildByName("qualityLow") as MovieClip);
qualityMed = (inner.getChildByName("qualityMed") as MovieClip);
qualityHigh = (inner.getChildByName("qualityHigh") as MovieClip);
soundOn = (inner.getChildByName("soundOn") as MovieClip);
soundOff = (inner.getChildByName("soundOff") as MovieClip);
musicOn = (inner.getChildByName("musicOn") as MovieClip);
musicOff = (inner.getChildByName("musicOff") as MovieClip);
}
}
}//package game.view.components
Section 92
//AppMediator (game.view.AppMediator)
package game.view {
import org.puremvc.as3.interfaces.*;
import game.view.components.*;
import flash.display.*;
import flash.media.*;
import org.puremvc.as3.patterns.mediator.*;
public class AppMediator extends Mediator implements IMediator {
private var _view:AppView;
private var sndChannel:SoundChannel;
public static const NAME:String = "AppMediator";
public function AppMediator(_arg1:AppView):void{
super(NAME, _arg1);
init();
}
override public function listNotificationInterests():Array{
return ([]);
}
override public function handleNotification(_arg1:INotification):void{
}
public function getViewContainer():Sprite{
return (_view.container);
}
public function getPopupContainer():Sprite{
return (_view.popupContainer);
}
private function init():void{
_view = (getViewComponent() as AppView);
_view.tabChildren = false;
_view.cursorContainer.mouseEnabled = false;
_view.cursorContainer.mouseChildren = false;
}
public function getCursorContainer():Sprite{
return (_view.cursorContainer);
}
}
}//package game.view
Section 93
//CreditsMediator (game.view.CreditsMediator)
package game.view {
import flash.events.*;
import org.puremvc.as3.interfaces.*;
import game.view.components.*;
import flash.net.*;
import org.puremvc.as3.patterns.mediator.*;
public class CreditsMediator extends Mediator implements IMediator {
private var _view:CreditsView;
public static const NAME:String = "CreditsMediator";
public function CreditsMediator(_arg1:CreditsView):void{
super(NAME, _arg1);
init();
}
override public function listNotificationInterests():Array{
return ([]);
}
private function closeClickHandler(_arg1:MouseEvent):void{
destroy();
}
private function karataevClickHandler(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("mailto:eugene.karataev@gmail.com"), "_blank");
}
private function egoshinClickHandler(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("mailto:muaddib999@rambler.ru"), "_blank");
}
private function init():void{
_view = (getViewComponent() as CreditsView);
_view.close_bt.addEventListener(MouseEvent.CLICK, closeClickHandler);
_view.egoshin_bt.addEventListener(MouseEvent.CLICK, egoshinClickHandler);
_view.karataev_bt.addEventListener(MouseEvent.CLICK, karataevClickHandler);
}
override public function handleNotification(_arg1:INotification):void{
}
private function destroy():void{
_view.close_bt.removeEventListener(MouseEvent.CLICK, closeClickHandler);
_view.egoshin_bt.removeEventListener(MouseEvent.CLICK, egoshinClickHandler);
_view.karataev_bt.removeEventListener(MouseEvent.CLICK, karataevClickHandler);
_view.parent.removeChild(_view);
facade.removeMediator(NAME);
}
private function sponsorClickHandler(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.bubblebox.com/clickreg.php?type=gamestats&id=1290&subid=credits"), "_blank");
}
}
}//package game.view
Section 94
//CustomCursorMediator (game.view.CustomCursorMediator)
package game.view {
import flash.events.*;
import org.puremvc.as3.interfaces.*;
import game.model.*;
import game.view.components.*;
import org.puremvc.as3.patterns.mediator.*;
import flash.ui.*;
public class CustomCursorMediator extends Mediator implements IMediator {
private var _view:CustomCursorView;
public static const NAME:String = "CustomCursorMediator";
public function CustomCursorMediator(_arg1:CustomCursorView):void{
super(NAME, _arg1);
init();
}
private function init():void{
_view = (getViewComponent() as CustomCursorView);
_view.window.stop();
_view.visible = false;
_view.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
}
private function showCursor():void{
Mouse.hide();
_view.visible = true;
}
override public function handleNotification(_arg1:INotification):void{
switch (_arg1.getName()){
case AppProxy.GAME_START:
case GameProxy.PAUSE_OFF:
showCursor();
break;
case GameProxy.GAME_COMPLETE:
case GameProxy.GAME_OVER:
case GameProxy.PAUSE_ON:
hideCursor();
break;
case GameProxy.PLAYER_SHOOT:
playerShoot();
break;
};
}
override public function listNotificationInterests():Array{
return ([AppProxy.GAME_START, GameProxy.GAME_COMPLETE, GameProxy.GAME_OVER, GameProxy.PAUSE_ON, GameProxy.PAUSE_OFF, GameProxy.PLAYER_SHOOT]);
}
private function mouseMoveHandler(_arg1:MouseEvent):void{
_view.x = _view.stage.mouseX;
_view.y = _view.stage.mouseY;
}
private function playerShoot():void{
_view.window.gotoAndPlay(2);
}
private function hideCursor():void{
Mouse.show();
_view.visible = false;
}
}
}//package game.view
Section 95
//GameCompleteMediator (game.view.GameCompleteMediator)
package game.view {
import flash.events.*;
import org.puremvc.as3.interfaces.*;
import game.model.*;
import game.view.components.*;
import flash.display.*;
import org.puremvc.as3.patterns.mediator.*;
import caurina.transitions.*;
public class GameCompleteMediator extends Mediator implements IMediator {
private var _view:GameCompleteView;
private var notesProxy:NotesProxy;
public static const NAME:String = "GameCompleteMediator";
public function GameCompleteMediator(_arg1:GameCompleteView):void{
super(NAME, _arg1);
init();
}
override public function listNotificationInterests():Array{
return ([]);
}
public function destroy():void{
_view.parent.removeChild(_view);
facade.removeMediator(NAME);
}
override public function handleNotification(_arg1:INotification):void{
}
private function replayClickHandler(_arg1:MouseEvent):void{
notesProxy.push(AppProxy.GAME_ABORT);
notesProxy.push(AppProxy.GAME_START);
}
private function init():void{
_view = (getViewComponent() as GameCompleteView);
notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy);
var _local1:LevelMediator = (facade.retrieveMediator(LevelMediator.NAME) as LevelMediator);
var _local2:LevelView = (_local1.getViewComponent() as LevelView);
var _local3:Sprite = _local2.levelContainer;
_view.mainMenu_bt.addEventListener(MouseEvent.CLICK, mainMenuClickHandler);
_view.replay_bt.addEventListener(MouseEvent.CLICK, replayClickHandler);
_view.replay_bt.visible = false;
_view.inner.y = -480;
Tweener.addTween(_view.inner, {y:0, time:2, transition:"easeinoutquad"});
Tweener.addTween(_local3, {y:480, time:2, transition:"easeinoutquad"});
}
private function mainMenuClickHandler(_arg1:MouseEvent):void{
notesProxy.push(AppProxy.GAME_ABORT);
}
}
}//package game.view
Section 96
//GameOverMediator (game.view.GameOverMediator)
package game.view {
import flash.events.*;
import org.puremvc.as3.interfaces.*;
import game.model.*;
import game.view.components.*;
import flash.display.*;
import org.puremvc.as3.patterns.mediator.*;
import caurina.transitions.*;
public class GameOverMediator extends Mediator implements IMediator {
private var _view:GameOverView;
private var notesProxy:NotesProxy;
private var levelContainer:Sprite;
public static const NAME:String = "GameOverMediator";
public function GameOverMediator(_arg1:GameOverView):void{
super(NAME, _arg1);
init();
}
override public function listNotificationInterests():Array{
return ([]);
}
public function destroy():void{
_view.mainMenu_bt.removeEventListener(MouseEvent.CLICK, mainMenuClickHandler);
_view.replay_bt.removeEventListener(MouseEvent.CLICK, replayClickHandler);
_view.parent.removeChild(_view);
facade.removeMediator(NAME);
}
override public function handleNotification(_arg1:INotification):void{
}
private function mainMenuClickHandler(_arg1:MouseEvent):void{
notesProxy.push(AppProxy.GAME_ABORT);
}
private function init():void{
_view = (getViewComponent() as GameOverView);
notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy);
var _local1:LevelMediator = (facade.retrieveMediator(LevelMediator.NAME) as LevelMediator);
var _local2:LevelView = (_local1.getViewComponent() as LevelView);
levelContainer = _local2.levelContainer;
_view.inner.y = -480;
Tweener.addTween(_view.inner, {y:0, time:1, transition:"easeinoutquad", onComplete:showComplete});
Tweener.addTween(levelContainer, {y:480, time:1, transition:"easeinoutquad"});
}
private function showComplete():void{
_view.mainMenu_bt.addEventListener(MouseEvent.CLICK, mainMenuClickHandler);
_view.replay_bt.addEventListener(MouseEvent.CLICK, replayClickHandler);
}
private function replayClickHandler(_arg1:MouseEvent):void{
notesProxy.push(AppProxy.GAME_ABORT);
notesProxy.push(AppProxy.GAME_START);
}
}
}//package game.view
Section 97
//LevelAppearMediator (game.view.LevelAppearMediator)
package game.view {
import org.puremvc.as3.interfaces.*;
import game.view.components.*;
import flash.display.*;
import org.puremvc.as3.patterns.mediator.*;
import caurina.transitions.*;
public class LevelAppearMediator extends Mediator implements IMediator {
private var _view:LevelAppearView;
private var callback:Function;
private var piecesComplete:int;
public static const NAME:String = "LevelAppearMediator";
public function LevelAppearMediator(_arg1:LevelAppearView, _arg2:Function):void{
this.callback = _arg2;
super(NAME, _arg1);
init();
}
override public function listNotificationInterests():Array{
return ([]);
}
override public function handleNotification(_arg1:INotification):void{
}
private function appearComplete():void{
callback();
destroy();
}
private function init():void{
var _local2:Sprite;
var _local3:Number;
var _local4:Number;
_view = (getViewComponent() as LevelAppearView);
piecesComplete = 0;
var _local1:uint;
while (_local1 < _view.floorPieces.length) {
_local2 = _view.floorPieces[_local1];
_local2.y = (_local2.y + 70);
_local3 = (0.4 + (Math.random() * 1));
_local4 = (Math.random() * 0.5);
Tweener.addTween(_local2, {y:(_local2.y - 70), time:_local3, delay:_local4, transition:"easeoutback", onComplete:floorPieceComplete});
_local1++;
};
_view.treesHolder.visible = false;
_view.clouds.visible = false;
}
private function destroy():void{
_view.parent.removeChild(_view);
facade.removeMediator(NAME);
}
private function floorPieceComplete():void{
var _local1:Number;
var _local2:Number;
piecesComplete++;
if (piecesComplete == _view.floorPieces.length){
_view.treesHolder.visible = true;
_local1 = _view.trees1.y;
_view.trees1.y = (_view.trees1.y + 60);
Tweener.addTween(_view.trees1, {y:_local1, time:1, transition:"easeoutquad"});
_local2 = _view.trees2.y;
_view.trees2.y = (_view.trees2.y + 30);
Tweener.addTween(_view.trees2, {y:_local2, time:1, transition:"easeoutquad"});
};
_view.clouds.visible = true;
_view.clouds.alpha = 0;
Tweener.addTween(_view.clouds, {alpha:1, time:1, transition:"linear", onComplete:appearComplete});
}
}
}//package game.view
Section 98
//LevelCompleteMediator (game.view.LevelCompleteMediator)
package game.view {
import org.puremvc.as3.interfaces.*;
import game.model.*;
import game.view.components.*;
import org.puremvc.as3.patterns.mediator.*;
import caurina.transitions.*;
public class LevelCompleteMediator extends Mediator implements IMediator {
private var _view:LevelCompleteView;
public static const NAME:String = "LevelCompleteMediator";
public function LevelCompleteMediator(_arg1:LevelCompleteView):void{
super(NAME, _arg1);
init();
}
private function tweenCompleted():void{
var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy);
_local1.levelNext();
destroy();
}
private function init():void{
_view = (getViewComponent() as LevelCompleteView);
Tweener.addTween(_view.title, {y:300, time:2, transition:"easeinoutcubic"});
Tweener.addTween(_view.title, {alpha:0, time:0.5, delay:2, transition:"linear", onComplete:tweenCompleted});
}
public function destroy():void{
_view.parent.removeChild(_view);
facade.removeMediator(NAME);
}
override public function handleNotification(_arg1:INotification):void{
}
override public function listNotificationInterests():Array{
return ([]);
}
}
}//package game.view
Section 99
//LevelMediator (game.view.LevelMediator)
package game.view {
import org.puremvc.as3.interfaces.*;
import game.model.*;
import game.view.components.*;
import org.puremvc.as3.patterns.mediator.*;
public class LevelMediator extends Mediator implements IMediator {
private var _view:LevelView;
private var clouds:Array;
public static const NAME:String = "LevelMediator";
public function LevelMediator(_arg1:LevelView):void{
super(NAME, _arg1);
init();
}
override public function listNotificationInterests():Array{
return ([GameProxy.LEVEL_UPDATE, GameProxy.PLAYER_IN_PAIN, GameProxy.GAME_OVER, GameProxy.LEVEL_START, GameProxy.MONSTER_DEAD, GameProxy.PLAYER_SHOOT]);
}
override public function handleNotification(_arg1:INotification):void{
switch (_arg1.getName()){
case GameProxy.LEVEL_UPDATE:
levelUpdate();
break;
case GameProxy.PLAYER_IN_PAIN:
playerInPain((_arg1.getBody() as Number));
break;
case GameProxy.GAME_OVER:
gameOver();
break;
case GameProxy.LEVEL_START:
levelStart();
break;
case GameProxy.MONSTER_DEAD:
monsterDead();
break;
case GameProxy.PLAYER_SHOOT:
playerShoot();
break;
};
}
private function levelStart():void{
var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy);
var _local2:int = _local1.getLevels().indexOf(_local1.currentLevel);
_view.level_tf.text = (((_local2 + 1).toString() + "/") + _local1.getLevels().length.toString());
}
private function gameOver():void{
_view.health.gotoAndStop(_view.health.totalFrames);
}
private function monsterDead():void{
var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy);
_view.score_tf.text = _local1.score.toString();
}
private function init():void{
var _local2:LevelCloud;
_view = (getViewComponent() as LevelView);
clouds = [];
var _local1:uint;
while (_local1 < 3) {
_local2 = new LevelCloud();
_view.cloudsContainer.addChild(_local2);
clouds.push(_local2);
_local1++;
};
_view.health.stop();
}
private function levelUpdate():void{
var _local2:LevelCloud;
var _local1:uint;
while (_local1 < clouds.length) {
_local2 = clouds[_local1];
_local2.update();
_local1++;
};
}
public function destroy():void{
_view.parent.removeChild(_view);
facade.removeMediator(NAME);
}
private function playerInPain(_arg1:Number):void{
var _local2:int = (7 - (_arg1 / 10));
_view.health.gotoAndStop(_local2);
}
private function playerShoot():void{
var _local1:GameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy);
_view.score_tf.text = _local1.score.toString();
}
}
}//package game.view
Section 100
//LevelPauseMediator (game.view.LevelPauseMediator)
package game.view {
import flash.events.*;
import org.puremvc.as3.interfaces.*;
import game.model.*;
import game.view.components.*;
import flash.display.*;
import org.puremvc.as3.patterns.mediator.*;
import caurina.transitions.*;
public class LevelPauseMediator extends Mediator implements IMediator {
private var isTweened:Boolean;
private var _view:LevelPauseView;
private var gameProxy:GameProxy;
private var levelContainer:Sprite;
private var notesProxy:NotesProxy;
private var pause_bt:SimpleButton;
public static const NAME:String = "LevelPauseMediator";
public function LevelPauseMediator(_arg1:LevelPauseView):void{
super(NAME, _arg1);
init();
}
private function mainMenuClickHandler(_arg1:MouseEvent):void{
notesProxy.push(AppProxy.GAME_ABORT);
}
private function togglePause():void{
if (isTweened){
return;
};
if (!gameProxy.isPaused()){
pause_bt.visible = false;
gameProxy.pauseOn();
notesProxy.push(GameProxy.PAUSE_ON);
_view.visible = true;
_view.inner.y = -480;
isTweened = true;
Tweener.addTween(_view.inner, {y:0, time:1, transition:"easeinoutquad", onComplete:showComplete});
Tweener.addTween(levelContainer, {y:480, time:1, transition:"easeinoutquad"});
} else {
isTweened = true;
Tweener.addTween(_view.inner, {y:-480, time:1, transition:"easeinoutquad", onComplete:hideComplete});
Tweener.addTween(levelContainer, {y:0, time:1, transition:"easeinoutquad"});
};
}
private function init():void{
_view = (getViewComponent() as LevelPauseView);
gameProxy = (facade.retrieveProxy(GameProxy.NAME) as GameProxy);
notesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy);
var _local1:LevelMediator = (facade.retrieveMediator(LevelMediator.NAME) as LevelMediator);
var _local2:LevelView = (_local1.getViewComponent() as LevelView);
levelContainer = _local2.levelContainer;
_view.stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
_view.resume_bt.addEventListener(MouseEvent.CLICK, resumeClickHandler);
_view.mainMenu_bt.addEventListener(MouseEvent.CLICK, mainMenuClickHandler);
_view.visible = false;
isTweened = false;
pause_bt = _local2.pause_bt;
pause_bt.addEventListener(MouseEvent.CLICK, pauseClickHandler);
}
private function showComplete():void{
isTweened = false;
}
private function keyUpHandler(_arg1:KeyboardEvent):void{
if (_arg1.keyCode == 27){
togglePause();
};
}
private function hideComplete():void{
isTweened = false;
_view.visible = false;
gameProxy.pauseOff();
pause_bt.visible = true;
notesProxy.push(GameProxy.PAUSE_OFF);
}
override public function listNotificationInterests():Array{
return ([]);
}
private function resumeClickHandler(_arg1:MouseEvent):void{
togglePause();
}
override public function handleNotification(_arg1:INotification):void{
}
public function destroy():void{
_view.stage.removeEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
_view.resume_bt.removeEventListener(MouseEvent.CLICK, resumeClickHandler);
_view.mainMenu_bt.removeEventListener(MouseEvent.CLICK, mainMenuClickHandler);
_view.parent.removeChild(_view);
facade.removeMediator(NAME);
}
private function pauseClickHandler(_arg1:MouseEvent):void{
togglePause();
}
}
}//package game.view
Section 101
//MainMenuMediator (game.view.MainMenuMediator)
package game.view {
import flash.events.*;
import org.puremvc.as3.interfaces.*;
import game.model.*;
import core.*;
import game.view.components.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
import org.puremvc.as3.patterns.mediator.*;
public class MainMenuMediator extends Mediator implements IMediator {
private var _view:MainMenuView;
public static const NAME:String = "MainMenuMediator";
public function MainMenuMediator(_arg1:MainMenuView){
super(NAME, _arg1);
init();
}
private function optionsClickHandler(_arg1:MouseEvent):void{
var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator);
var _local3:OptionsView = new OptionsView();
_local2.getViewContainer().addChild(_local3);
var _local4:OptionsMediator = new OptionsMediator(_local3);
facade.registerMediator(_local4);
}
private function moreFreeGamesClickHandler(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.gamesnow.biz"), "_blank");
}
private function addToSiteClickHandler(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.gamesnow.biz/free_website_games.html"), "_blank");
}
override public function listNotificationInterests():Array{
return ([]);
}
override public function handleNotification(_arg1:INotification):void{
}
private function editorClickHandler(_arg1:MouseEvent):void{
var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy);
_local2.push(AppProxy.EDITOR_STARTUP);
}
private function init():void{
_view = (getViewComponent() as MainMenuView);
_view.stage.addEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
mouseMoveHandler(null);
_view.startGame_bt.addEventListener(MouseEvent.CLICK, startGameClickHandler);
_view.options_bt.addEventListener(MouseEvent.CLICK, optionsClickHandler);
_view.credits_bt.addEventListener(MouseEvent.CLICK, creditsClickHandler);
_view.editor_bt.addEventListener(MouseEvent.CLICK, editorClickHandler);
_view.addToSite_bt.addEventListener(MouseEvent.CLICK, addToSiteClickHandler);
_view.moreFreeGames_bt.addEventListener(MouseEvent.CLICK, moreFreeGamesClickHandler);
_view.gamesNow_bt.addEventListener(MouseEvent.CLICK, gamesNowClickHandler);
var _local1:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy);
_view.editor_bt.visible = false;
_view.levelSelector.visible = false;
}
private function mouseMoveHandler(_arg1:Event):void{
rotateEye(_view.eye1, _view.pupil1);
rotateEye(_view.eye2, _view.pupil2);
}
private function startGameClickHandler(_arg1:MouseEvent):void{
var _local2:NotesProxy = (facade.retrieveProxy(NotesProxy.NAME) as NotesProxy);
var _local3:int = (int(_view.level_tf.text) - 1);
_local2.push(AppProxy.GAME_START, _local3);
}
private function gamesNowClickHandler(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.gamesnow.biz"), "_blank");
}
public function destroy():void{
_view.stage.removeEventListener(MouseEvent.MOUSE_MOVE, mouseMoveHandler);
_view.startGame_bt.removeEventListener(MouseEvent.CLICK, startGameClickHandler);
_view.options_bt.removeEventListener(MouseEvent.CLICK, optionsClickHandler);
_view.credits_bt.removeEventListener(MouseEvent.CLICK, creditsClickHandler);
_view.addToSite_bt.removeEventListener(MouseEvent.CLICK, addToSiteClickHandler);
_view.moreFreeGames_bt.removeEventListener(MouseEvent.CLICK, moreFreeGamesClickHandler);
_view.gamesNow_bt.removeEventListener(MouseEvent.CLICK, gamesNowClickHandler);
_view.parent.removeChild(_view);
facade.removeMediator(NAME);
}
private function creditsClickHandler(_arg1:MouseEvent):void{
var _local2:AppMediator = (facade.retrieveMediator(AppMediator.NAME) as AppMediator);
var _local3:CreditsView = new CreditsView();
_local2.getViewContainer().addChild(_local3);
var _local4:CreditsMediator = new CreditsMediator(_local3);
facade.registerMediator(_local4);
}
private function rotateEye(_arg1:Sprite, _arg2:Sprite):void{
var _local4:Point;
var _local5:Point;
var _local6:Vector;
var _local7:Vector;
var _local3:Vector = new Vector(_view.stage.mouseX, _view.stage.mouseY);
var _local8:Number = 3;
_local4 = _arg1.parent.localToGlobal(new Point(_arg1.x, _arg1.y));
_local7 = new Vector(_local4.x, _local4.y);
_local6 = _local3.copy();
_local6 = _local6.subtract(_local7);
if (_local6.length() < _local8){
_local5 = _arg1.globalToLocal(new Point(_local3.x, _local3.y));
} else {
_local6.normalize();
_local6 = _local6.multiply(_local8);
_local7 = _local7.add(_local6);
_local5 = _arg1.globalToLocal(new Point(_local7.x, _local7.y));
};
_arg2.x = _local5.x;
_arg2.y = _local5.y;
var _local9:Number = (1 - ((_local6.length() / _local8) * 0.15));
_arg2.scaleX = (_arg2.scaleY = _local9);
}
}
}//package game.view
Section 102
//OptionsMediator (game.view.OptionsMediator)
package game.view {
import flash.events.*;
import org.puremvc.as3.interfaces.*;
import game.model.*;
import game.view.components.*;
import org.puremvc.as3.patterns.mediator.*;
public class OptionsMediator extends Mediator implements IMediator {
private var _view:OptionsView;
private var saveData:SaveData;
private var appProxy:AppProxy;
public static const NAME:String = "OptionsMediator";
public function OptionsMediator(_arg1:OptionsView):void{
super(NAME, _arg1);
init();
}
private function closeClickHandler(_arg1:MouseEvent):void{
destroy();
}
private function qualityHighClickHandler(_arg1:MouseEvent):void{
setQuality(2);
}
private function updateSound():void{
if (saveData.soundEnabled){
_view.soundOn.gotoAndStop(1);
_view.soundOff.gotoAndStop(2);
} else {
_view.soundOn.gotoAndStop(2);
_view.soundOff.gotoAndStop(1);
};
}
private function musicOffClickHandler(_arg1:MouseEvent):void{
if (saveData.musicEnabled){
saveData.toggleMusicEnabled();
updateMusic();
};
}
private function qualityMedClickHandler(_arg1:MouseEvent):void{
setQuality(1);
}
private function init():void{
_view = (getViewComponent() as OptionsView);
appProxy = (facade.retrieveProxy(AppProxy.NAME) as AppProxy);
saveData = SaveData.getInstance();
_view.close_bt.addEventListener(MouseEvent.CLICK, closeClickHandler);
_view.qualityLow.buttonMode = true;
_view.qualityMed.buttonMode = true;
_view.qualityHigh.buttonMode = true;
_view.soundOn.buttonMode = true;
_view.soundOff.buttonMode = true;
_view.musicOn.buttonMode = true;
_view.musicOff.buttonMode = true;
_view.close_bt.addEventListener(MouseEvent.CLICK, closeClickHandler);
_view.qualityLow.addEventListener(MouseEvent.CLICK, qualityLowClickHandler);
_view.qualityMed.addEventListener(MouseEvent.CLICK, qualityMedClickHandler);
_view.qualityHigh.addEventListener(MouseEvent.CLICK, qualityHighClickHandler);
_view.soundOn.addEventListener(MouseEvent.CLICK, soundOnClickHandler);
_view.soundOff.addEventListener(MouseEvent.CLICK, soundOffClickHandler);
_view.musicOn.addEventListener(MouseEvent.CLICK, musicOnClickHandler);
_view.musicOff.addEventListener(MouseEvent.CLICK, musicOffClickHandler);
updateOptions();
}
private function updateOptions():void{
updateSound();
updateMusic();
updateQuality();
}
private function qualityLowClickHandler(_arg1:MouseEvent):void{
setQuality(0);
}
private function updateMusic():void{
if (saveData.musicEnabled){
_view.musicOn.gotoAndStop(1);
_view.musicOff.gotoAndStop(2);
} else {
_view.musicOn.gotoAndStop(2);
_view.musicOff.gotoAndStop(1);
};
}
private function soundOnClickHandler(_arg1:MouseEvent):void{
if (!saveData.soundEnabled){
saveData.toggleSoundEnabled();
updateSound();
};
}
override public function listNotificationInterests():Array{
return ([]);
}
private function soundOffClickHandler(_arg1:MouseEvent):void{
if (saveData.soundEnabled){
saveData.toggleSoundEnabled();
updateSound();
};
}
private function musicOnClickHandler(_arg1:MouseEvent):void{
if (!saveData.musicEnabled){
saveData.toggleMusicEnabled();
updateMusic();
};
}
override public function handleNotification(_arg1:INotification):void{
}
private function updateQuality():void{
_view.qualityLow.gotoAndStop(2);
_view.qualityMed.gotoAndStop(2);
_view.qualityHigh.gotoAndStop(2);
if (saveData.graphicsQuality == 0){
_view.qualityLow.gotoAndStop(1);
} else {
if (saveData.graphicsQuality == 1){
_view.qualityMed.gotoAndStop(1);
} else {
if (saveData.graphicsQuality == 2){
_view.qualityHigh.gotoAndStop(1);
};
};
};
}
public function destroy():void{
_view.close_bt.removeEventListener(MouseEvent.CLICK, closeClickHandler);
_view.parent.removeChild(_view);
facade.removeMediator(NAME);
}
private function setQuality(_arg1:uint):void{
saveData.setGraphicsQuality(_arg1);
updateQuality();
}
}
}//package game.view
Section 103
//ByteArrayAsset (mx.core.ByteArrayAsset)
package mx.core {
import flash.utils.*;
public class ByteArrayAsset extends ByteArray implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
}
}//package mx.core
Section 104
//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 105
//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 106
//IBorder (mx.core.IBorder)
package mx.core {
public interface IBorder {
function get borderMetrics():EdgeMetrics;
}
}//package mx.core
Section 107
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 108
//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 109
//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 110
//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 111
//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 112
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import mx.core.*;
import flash.display.*;
import flash.utils.*;
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 113
//Controller (org.puremvc.as3.core.controller.Controller)
package org.puremvc.as3.core.controller {
import org.puremvc.as3.interfaces.*;
import org.puremvc.as3.core.view.*;
import org.puremvc.as3.patterns.observer.*;
public class Controller implements IController {
protected const SINGLETON_MSG:String = "Controller Singleton already constructed!";
protected var commandMap:Array;
protected var view:IView;
protected static var instance:IController;
public function Controller(){
if (instance != null){
throw (Error(SINGLETON_MSG));
};
instance = this;
commandMap = new Array();
initializeController();
}
public function removeCommand(_arg1:String):void{
commandMap[_arg1] = null;
}
public function registerCommand(_arg1:String, _arg2:Class):void{
if (commandMap[_arg1] == null){
view.registerObserver(_arg1, new Observer(executeCommand, this));
};
commandMap[_arg1] = _arg2;
}
protected function initializeController():void{
view = View.getInstance();
}
public function hasCommand(_arg1:String):Boolean{
return (!((commandMap[_arg1] == null)));
}
public function executeCommand(_arg1:INotification):void{
var _local2:Class = commandMap[_arg1.getName()];
if (_local2 == null){
return;
};
var _local3:ICommand = new (_local2);
_local3.execute(_arg1);
}
public static function getInstance():IController{
if (instance == null){
instance = new (Controller);
};
return (instance);
}
}
}//package org.puremvc.as3.core.controller
Section 114
//Model (org.puremvc.as3.core.model.Model)
package org.puremvc.as3.core.model {
import org.puremvc.as3.interfaces.*;
public class Model implements IModel {
protected const SINGLETON_MSG:String = "Model Singleton already constructed!";
protected var proxyMap:Array;
protected static var instance:IModel;
public function Model(){
if (instance != null){
throw (Error(SINGLETON_MSG));
};
instance = this;
proxyMap = new Array();
initializeModel();
}
protected function initializeModel():void{
}
public function removeProxy(_arg1:String):IProxy{
var _local2:IProxy = (proxyMap[_arg1] as IProxy);
proxyMap[_arg1] = null;
return (_local2);
}
public function hasProxy(_arg1:String):Boolean{
return (!((proxyMap[_arg1] == null)));
}
public function retrieveProxy(_arg1:String):IProxy{
return (proxyMap[_arg1]);
}
public function registerProxy(_arg1:IProxy):void{
proxyMap[_arg1.getProxyName()] = _arg1;
}
public static function getInstance():IModel{
if (instance == null){
instance = new (Model);
};
return (instance);
}
}
}//package org.puremvc.as3.core.model
Section 115
//View (org.puremvc.as3.core.view.View)
package org.puremvc.as3.core.view {
import org.puremvc.as3.interfaces.*;
import org.puremvc.as3.patterns.observer.*;
public class View implements IView {
protected const SINGLETON_MSG:String = "View Singleton already constructed!";
protected var observerMap:Array;
protected var mediatorMap:Array;
protected static var instance:IView;
public function View(){
if (instance != null){
throw (Error(SINGLETON_MSG));
};
instance = this;
mediatorMap = new Array();
observerMap = new Array();
initializeView();
}
public function retrieveMediator(_arg1:String):IMediator{
return (mediatorMap[_arg1]);
}
public function hasMediator(_arg1:String):Boolean{
return (!((mediatorMap[_arg1] == null)));
}
public function notifyObservers(_arg1:INotification):void{
var _local2:Array;
var _local3:Number;
var _local4:IObserver;
if (observerMap[_arg1.getName()] != null){
_local2 = (observerMap[_arg1.getName()] as Array);
_local3 = 0;
while (_local3 < _local2.length) {
_local4 = (_local2[_local3] as IObserver);
_local4.notifyObserver(_arg1);
_local3++;
};
};
}
protected function initializeView():void{
}
public function registerMediator(_arg1:IMediator):void{
var _local3:Observer;
var _local4:Number;
mediatorMap[_arg1.getMediatorName()] = _arg1;
var _local2:Array = _arg1.listNotificationInterests();
if (_local2.length > 0){
_local3 = new Observer(_arg1.handleNotification, _arg1);
_local4 = 0;
while (_local4 < _local2.length) {
registerObserver(_local2[_local4], _local3);
_local4++;
};
};
_arg1.onRegister();
}
public function removeMediator(_arg1:String):IMediator{
var _local2:String;
var _local3:IMediator;
var _local4:Array;
var _local5:Array;
var _local6:int;
var _local7:int;
for (_local2 in observerMap) {
_local4 = observerMap[_local2];
_local5 = new Array();
_local6 = 0;
while (_local6 < _local4.length) {
if (Observer(_local4[_local6]).compareNotifyContext(retrieveMediator(_arg1)) == true){
_local5.push(_local6);
};
_local6++;
};
while (_local5.length > 0) {
_local7 = _local5.pop();
_local4.splice(_local7, 1);
};
if (_local4.length == 0){
delete observerMap[_local2];
};
};
_local3 = (mediatorMap[_arg1] as IMediator);
delete mediatorMap[_arg1];
if (_local3){
_local3.onRemove();
};
return (_local3);
}
public function registerObserver(_arg1:String, _arg2:IObserver):void{
if (observerMap[_arg1] != null){
observerMap[_arg1].push(_arg2);
} else {
observerMap[_arg1] = [_arg2];
};
}
public static function getInstance():IView{
if (instance == null){
instance = new (View);
};
return (instance);
}
}
}//package org.puremvc.as3.core.view
Section 116
//ICommand (org.puremvc.as3.interfaces.ICommand)
package org.puremvc.as3.interfaces {
public interface ICommand {
function execute(_arg1:INotification):void;
}
}//package org.puremvc.as3.interfaces
Section 117
//IController (org.puremvc.as3.interfaces.IController)
package org.puremvc.as3.interfaces {
public interface IController {
function registerCommand(_arg1:String, _arg2:Class):void;
function hasCommand(_arg1:String):Boolean;
function executeCommand(_arg1:INotification):void;
function removeCommand(_arg1:String):void;
}
}//package org.puremvc.as3.interfaces
Section 118
//IFacade (org.puremvc.as3.interfaces.IFacade)
package org.puremvc.as3.interfaces {
public interface IFacade extends INotifier {
function removeCommand(_arg1:String):void;
function registerCommand(_arg1:String, _arg2:Class):void;
function removeProxy(_arg1:String):IProxy;
function registerProxy(_arg1:IProxy):void;
function hasMediator(_arg1:String):Boolean;
function retrieveMediator(_arg1:String):IMediator;
function hasCommand(_arg1:String):Boolean;
function retrieveProxy(_arg1:String):IProxy;
function hasProxy(_arg1:String):Boolean;
function registerMediator(_arg1:IMediator):void;
function removeMediator(_arg1:String):IMediator;
}
}//package org.puremvc.as3.interfaces
Section 119
//IMediator (org.puremvc.as3.interfaces.IMediator)
package org.puremvc.as3.interfaces {
public interface IMediator {
function listNotificationInterests():Array;
function onRegister():void;
function handleNotification(_arg1:INotification):void;
function getMediatorName():String;
function setViewComponent(_arg1:Object):void;
function getViewComponent():Object;
function onRemove():void;
}
}//package org.puremvc.as3.interfaces
Section 120
//IModel (org.puremvc.as3.interfaces.IModel)
package org.puremvc.as3.interfaces {
public interface IModel {
function removeProxy(_arg1:String):IProxy;
function retrieveProxy(_arg1:String):IProxy;
function registerProxy(_arg1:IProxy):void;
function hasProxy(_arg1:String):Boolean;
}
}//package org.puremvc.as3.interfaces
Section 121
//INotification (org.puremvc.as3.interfaces.INotification)
package org.puremvc.as3.interfaces {
public interface INotification {
function getType():String;
function getName():String;
function toString():String;
function setBody(_arg1:Object):void;
function getBody():Object;
function setType(_arg1:String):void;
}
}//package org.puremvc.as3.interfaces
Section 122
//INotifier (org.puremvc.as3.interfaces.INotifier)
package org.puremvc.as3.interfaces {
public interface INotifier {
function sendNotification(_arg1:String, _arg2:Object=null, _arg3:String=null):void;
}
}//package org.puremvc.as3.interfaces
Section 123
//IObserver (org.puremvc.as3.interfaces.IObserver)
package org.puremvc.as3.interfaces {
public interface IObserver {
function compareNotifyContext(_arg1:Object):Boolean;
function setNotifyContext(_arg1:Object):void;
function setNotifyMethod(_arg1:Function):void;
function notifyObserver(_arg1:INotification):void;
}
}//package org.puremvc.as3.interfaces
Section 124
//IProxy (org.puremvc.as3.interfaces.IProxy)
package org.puremvc.as3.interfaces {
public interface IProxy {
function getData():Object;
function getProxyName():String;
function setData(_arg1:Object):void;
}
}//package org.puremvc.as3.interfaces
Section 125
//IView (org.puremvc.as3.interfaces.IView)
package org.puremvc.as3.interfaces {
public interface IView {
function notifyObservers(_arg1:INotification):void;
function registerMediator(_arg1:IMediator):void;
function removeMediator(_arg1:String):IMediator;
function registerObserver(_arg1:String, _arg2:IObserver):void;
function hasMediator(_arg1:String):Boolean;
function retrieveMediator(_arg1:String):IMediator;
}
}//package org.puremvc.as3.interfaces
Section 126
//SimpleCommand (org.puremvc.as3.patterns.command.SimpleCommand)
package org.puremvc.as3.patterns.command {
import org.puremvc.as3.interfaces.*;
import org.puremvc.as3.patterns.observer.*;
public class SimpleCommand extends Notifier implements ICommand, INotifier {
public function execute(_arg1:INotification):void{
}
}
}//package org.puremvc.as3.patterns.command
Section 127
//Facade (org.puremvc.as3.patterns.facade.Facade)
package org.puremvc.as3.patterns.facade {
import org.puremvc.as3.interfaces.*;
import org.puremvc.as3.core.view.*;
import org.puremvc.as3.core.controller.*;
import org.puremvc.as3.core.model.*;
import org.puremvc.as3.patterns.observer.*;
public class Facade implements IFacade {
protected const SINGLETON_MSG:String = "Facade Singleton already constructed!";
protected var controller:IController;
protected var view:IView;
protected var model:IModel;
protected static var instance:IFacade;
public function Facade(){
if (instance != null){
throw (Error(SINGLETON_MSG));
};
instance = this;
initializeFacade();
}
public function removeProxy(_arg1:String):IProxy{
var _local2:IProxy;
if (model != null){
_local2 = model.removeProxy(_arg1);
};
return (_local2);
}
public function registerProxy(_arg1:IProxy):void{
model.registerProxy(_arg1);
}
protected function initializeController():void{
if (controller != null){
return;
};
controller = Controller.getInstance();
}
protected function initializeFacade():void{
initializeModel();
initializeController();
initializeView();
}
public function retrieveProxy(_arg1:String):IProxy{
return (model.retrieveProxy(_arg1));
}
public function sendNotification(_arg1:String, _arg2:Object=null, _arg3:String=null):void{
notifyObservers(new Notification(_arg1, _arg2, _arg3));
}
public function notifyObservers(_arg1:INotification):void{
if (view != null){
view.notifyObservers(_arg1);
};
}
protected function initializeView():void{
if (view != null){
return;
};
view = View.getInstance();
}
public function retrieveMediator(_arg1:String):IMediator{
return ((view.retrieveMediator(_arg1) as IMediator));
}
public function removeMediator(_arg1:String):IMediator{
var _local2:IMediator;
if (view != null){
_local2 = view.removeMediator(_arg1);
};
return (_local2);
}
public function hasCommand(_arg1:String):Boolean{
return (controller.hasCommand(_arg1));
}
public function removeCommand(_arg1:String):void{
controller.removeCommand(_arg1);
}
public function registerCommand(_arg1:String, _arg2:Class):void{
controller.registerCommand(_arg1, _arg2);
}
public function hasMediator(_arg1:String):Boolean{
return (view.hasMediator(_arg1));
}
public function registerMediator(_arg1:IMediator):void{
if (view != null){
view.registerMediator(_arg1);
};
}
protected function initializeModel():void{
if (model != null){
return;
};
model = Model.getInstance();
}
public function hasProxy(_arg1:String):Boolean{
return (model.hasProxy(_arg1));
}
public static function getInstance():IFacade{
if (instance == null){
instance = new (Facade);
};
return (instance);
}
}
}//package org.puremvc.as3.patterns.facade
Section 128
//Mediator (org.puremvc.as3.patterns.mediator.Mediator)
package org.puremvc.as3.patterns.mediator {
import org.puremvc.as3.interfaces.*;
import org.puremvc.as3.patterns.observer.*;
public class Mediator extends Notifier implements IMediator, INotifier {
protected var viewComponent:Object;
protected var mediatorName:String;
public static const NAME:String = "Mediator";
public function Mediator(_arg1:String=null, _arg2:Object=null){
this.mediatorName = ((_arg1)!=null) ? _arg1 : NAME;
this.viewComponent = _arg2;
}
public function listNotificationInterests():Array{
return ([]);
}
public function onRegister():void{
}
public function onRemove():void{
}
public function getViewComponent():Object{
return (viewComponent);
}
public function handleNotification(_arg1:INotification):void{
}
public function getMediatorName():String{
return (mediatorName);
}
public function setViewComponent(_arg1:Object):void{
this.viewComponent = _arg1;
}
}
}//package org.puremvc.as3.patterns.mediator
Section 129
//Notification (org.puremvc.as3.patterns.observer.Notification)
package org.puremvc.as3.patterns.observer {
import org.puremvc.as3.interfaces.*;
public class Notification implements INotification {
private var body:Object;
private var name:String;
private var type:String;
public function Notification(_arg1:String, _arg2:Object=null, _arg3:String=null){
this.name = _arg1;
this.body = _arg2;
this.type = _arg3;
}
public function setBody(_arg1:Object):void{
this.body = _arg1;
}
public function getName():String{
return (name);
}
public function toString():String{
var _local1:String = ("Notification Name: " + getName());
_local1 = (_local1 + ("\nBody:" + ((body)==null) ? "null" : body.toString()));
_local1 = (_local1 + ("\nType:" + ((type)==null) ? "null" : type));
return (_local1);
}
public function getType():String{
return (type);
}
public function setType(_arg1:String):void{
this.type = _arg1;
}
public function getBody():Object{
return (body);
}
}
}//package org.puremvc.as3.patterns.observer
Section 130
//Notifier (org.puremvc.as3.patterns.observer.Notifier)
package org.puremvc.as3.patterns.observer {
import org.puremvc.as3.interfaces.*;
import org.puremvc.as3.patterns.facade.*;
public class Notifier implements INotifier {
protected var facade:IFacade;
public function Notifier(){
facade = Facade.getInstance();
super();
}
public function sendNotification(_arg1:String, _arg2:Object=null, _arg3:String=null):void{
facade.sendNotification(_arg1, _arg2, _arg3);
}
}
}//package org.puremvc.as3.patterns.observer
Section 131
//Observer (org.puremvc.as3.patterns.observer.Observer)
package org.puremvc.as3.patterns.observer {
import org.puremvc.as3.interfaces.*;
public class Observer implements IObserver {
private var notify:Function;
private var context:Object;
public function Observer(_arg1:Function, _arg2:Object){
setNotifyMethod(_arg1);
setNotifyContext(_arg2);
}
private function getNotifyMethod():Function{
return (notify);
}
public function compareNotifyContext(_arg1:Object):Boolean{
return ((_arg1 === this.context));
}
public function setNotifyContext(_arg1:Object):void{
context = _arg1;
}
private function getNotifyContext():Object{
return (context);
}
public function setNotifyMethod(_arg1:Function):void{
notify = _arg1;
}
public function notifyObserver(_arg1:INotification):void{
this.getNotifyMethod().apply(this.getNotifyContext(), [_arg1]);
}
}
}//package org.puremvc.as3.patterns.observer
Section 132
//Proxy (org.puremvc.as3.patterns.proxy.Proxy)
package org.puremvc.as3.patterns.proxy {
import org.puremvc.as3.interfaces.*;
import org.puremvc.as3.patterns.observer.*;
public class Proxy extends Notifier implements IProxy, INotifier {
protected var proxyName:String;
protected var data:Object;
public static var NAME:String = "Proxy";
public function Proxy(_arg1:String=null, _arg2:Object=null){
this.proxyName = ((_arg1)!=null) ? _arg1 : NAME;
if (_arg2 != null){
setData(_arg2);
};
}
public function getData():Object{
return (data);
}
public function getProxyName():String{
return (proxyName);
}
public function setData(_arg1:Object):void{
this.data = _arg1;
}
}
}//package org.puremvc.as3.patterns.proxy
Section 133
//ApplicationFacade (ApplicationFacade)
package {
import org.puremvc.as3.interfaces.*;
import flash.display.*;
import org.puremvc.as3.patterns.facade.*;
import org.puremvc.as3.patterns.observer.*;
import game.controller.*;
public class ApplicationFacade extends Facade implements IFacade {
public var viewContainer:Sprite;
public static const STARTUP:String = "Startup";
override protected function initializeController():void{
super.initializeController();
registerCommand(STARTUP, StartupCommand);
}
public function startup(_arg1:Object):void{
var _local2:Sprite = _arg1.container;
viewContainer = new Sprite();
_local2.addChild(viewContainer);
notifyObservers(new Notification(STARTUP, _arg1));
}
public static function getInstance():ApplicationFacade{
if (instance == null){
instance = new (ApplicationFacade);
};
return ((instance as ApplicationFacade));
}
}
}//package
Section 134
//Factory (Factory)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.utils.*;
public class Factory extends MovieClip {
private var preloader:Preloader;
public static const DEBUG:Boolean = false;
public static var KONG_VERSION:Boolean;
public static var kongregate;
public function Factory():void{
init();
}
private function init():void{
stop();
preloader = new Preloader(this);
addChild(preloader);
KONG_VERSION = (preloader.domain == "kongregate.com");
if (KONG_VERSION){
initKongAPI();
};
preloader.addEventListener(Event.COMPLETE, preloaderCompleteHandler);
}
private function initApp():void{
var _local2:Object;
var _local1:Class = (getDefinitionByName("MonsterHunter2") as Class);
if (_local1){
_local2 = new (_local1);
addChild((_local2 as DisplayObject));
};
}
private function kongAPILoadComplete(_arg1:Event):void{
kongregate = _arg1.target.content;
kongregate.services.connect();
trace(("\n" + kongregate.services));
trace(("\n" + kongregate.user));
trace(("\n" + kongregate.scores));
trace(("\n" + kongregate.stats));
}
private function preloaderCompleteHandler(_arg1:Event):void{
preloader.removeEventListener(Event.COMPLETE, preloaderCompleteHandler);
nextFrame();
initApp();
}
private function initKongAPI():void{
var _local1:Object = LoaderInfo(root.loaderInfo).parameters;
var _local2:String = ((_local1.api_path) || ("http://www.kongregate.com/flash/API_AS3_Local.swf"));
trace(("API path: " + _local2));
var _local3:URLRequest = new URLRequest(_local2);
var _local4:Loader = new Loader();
_local4.contentLoaderInfo.addEventListener(Event.COMPLETE, kongAPILoadComplete);
_local4.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, kongAPIErrorHandler);
_local4.load(_local3);
this.addChild(_local4);
}
private function kongAPIErrorHandler(_arg1:IOErrorEvent):void{
trace("ZZ", _arg1.text);
}
}
}//package
Section 135
//MonsterHunter2 (MonsterHunter2)
package {
import flash.events.*;
import flash.display.*;
public class MonsterHunter2 extends Sprite {
public function MonsterHunter2():void{
addEventListener(Event.ADDED_TO_STAGE, addedHandler);
}
private function addedHandler(_arg1:Event):void{
ApplicationFacade.getInstance().startup({container:this});
}
}
}//package
Section 136
//Preloader (Preloader)
package {
import flash.events.*;
import caurina.transitions.*;
import flash.display.*;
import flash.net.*;
import flash.ui.*;
import flash.text.*;
public dynamic class Preloader extends MovieClip {
private var preloaderMask:Sprite;
private var WindowClass:Class;
private var factory:Factory;
public var domain:String;
private var mochiComplete:Boolean;
private var holder:Sprite;
private var window:Sprite;
private var top_bt:SimpleButton;
private var loadComplete:Boolean;
public function Preloader(_arg1:Factory):void{
WindowClass = Preloader_WindowClass;
super();
this.factory = _arg1;
init();
}
private function getDomain():String{
var _local1:String = stage.loaderInfo.url;
var _local2:Number = (_local1.indexOf("://") + 3);
var _local3:Number = _local1.indexOf("/", _local2);
var _local4:String = _local1.substring(_local2, _local3);
var _local5:Number = (_local4.lastIndexOf(".") - 1);
var _local6:Number = (_local4.lastIndexOf(".", _local5) + 1);
_local4 = _local4.substring(_local6, _local4.length);
return (_local4);
}
private function init():void{
var _local1:ContextMenu = new ContextMenu();
_local1.hideBuiltInItems();
factory.contextMenu = _local1;
addEventListener(Event.ADDED_TO_STAGE, addedHandler);
}
private function domainNotAvailable():void{
var _local1:TextField = new TextField();
_local1.width = 600;
_local1.wordWrap = true;
_local1.multiline = true;
_local1.text = ("Sorry, this game is not available on domain " + stage.loaderInfo.url);
addChild(_local1);
}
private function sponsorClickHandler(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.bubblebox.com/clickreg.php?type=gamestats&id=1290&subid=preloader"), "_blank");
}
private function topClickHandler(_arg1:MouseEvent):void{
navigateToURL(new URLRequest("http://www.gamesnow.biz"), "_blank");
}
private function shallWeContinue():void{
if (((mochiComplete) && (loadComplete))){
Tweener.addTween(window, {alpha:0, time:0.5, transition:"linear", onComplete:hideComplete});
};
}
private function hideComplete():void{
top_bt.removeEventListener(MouseEvent.CLICK, topClickHandler);
parent.removeChild(this);
dispatchEvent(new Event(Event.COMPLETE));
}
private function efHandler(_arg1:Event):void{
var _local2:Number;
if (factory.framesLoaded == factory.totalFrames){
loadComplete = true;
shallWeContinue();
preloaderMask.scaleX = 1;
removeEventListener(Event.ENTER_FRAME, efHandler);
} else {
_local2 = (root.loaderInfo.bytesLoaded / root.loaderInfo.bytesTotal);
preloaderMask.scaleX = _local2;
};
}
private function addedHandler(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, addedHandler);
domain = getDomain();
window = new WindowClass();
addChild(window);
holder = (window.getChildByName("holder") as Sprite);
preloaderMask = (holder.getChildByName("_mask") as Sprite);
preloaderMask.scaleX = 0;
top_bt = (window.getChildByName("top_bt") as SimpleButton);
mochiComplete = true;
trace("DOMAIN:", domain);
addEventListener(Event.ENTER_FRAME, efHandler);
top_bt.addEventListener(MouseEvent.CLICK, topClickHandler);
}
private function mochiCompleteHandler():void{
mochiComplete = true;
shallWeContinue();
}
private function showAds():void{
mochiComplete = false;
}
}
}//package
Section 137
//Preloader_WindowClass (Preloader_WindowClass)
package {
import mx.core.*;
import flash.display.*;
public class Preloader_WindowClass extends SpriteAsset {
public var top_bt:DisplayObject;
public var _mask:DisplayObject;
public var holder:DisplayObject;
}
}//package