Section 1
//AuxFunctions (caurina.transitions.AuxFunctions)
package caurina.transitions {
public class AuxFunctions {
public static function getObjectLength(_arg1:Object):uint{
var _local2:uint;
var _local3:String;
_local2 = 0;
for (_local3 in _arg1) {
_local2++;
};
return (_local2);
}
public static function numberToG(_arg1:Number):Number{
return (((_arg1 & 0xFF00) >> 8));
}
public static function numberToB(_arg1:Number):Number{
return ((_arg1 & 0xFF));
}
public static function numberToR(_arg1:Number):Number{
return (((_arg1 & 0xFF0000) >> 16));
}
public static function concatObjects(... _args):Object{
var _local2:Object;
var _local3:Object;
var _local4:int;
var _local5:String;
_local2 = {};
_local4 = 0;
while (_local4 < _args.length) {
_local3 = _args[_local4];
for (_local5 in _local3) {
if (_local3[_local5] == null){
delete _local2[_local5];
} else {
_local2[_local5] = _local3[_local5];
};
};
_local4++;
};
return (_local2);
}
}
}//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 _local6:Number;
var _local7:Number;
var _local8:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 == 2){
return ((_arg2 + _arg3));
};
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * (0.3 * 1.5)) : _arg5.period;
_local8 = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
if (_arg1 < 1){
--_arg1;
return (((-0.5 * ((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2));
};
--_arg1;
return ((((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) * 0.5) + _arg3) + _arg2));
}
public static function easeInOutQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * _arg1) * _arg1) + _arg2));
};
--_arg1;
return ((((-(_arg3) / 2) * ((_arg1 * (_arg1 - 2)) - 1)) + _arg2));
}
public static function easeInOutBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (((easeInBounce((_arg1 * 2), 0, _arg3, _arg4) * 0.5) + _arg2));
};
return ((((easeOutBounce(((_arg1 * 2) - _arg4), 0, _arg3, _arg4) * 0.5) + (_arg3 * 0.5)) + _arg2));
}
public static function easeInOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number;
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
_local6 = (_local6 * 1.525);
return ((((_arg3 / 2) * ((_arg1 * _arg1) * (((_local6 + 1) * _arg1) - _local6))) + _arg2));
};
_arg1 = (_arg1 - 2);
_local6 = (_local6 * 1.525);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 2)) + _arg2));
}
public static function easeOutInCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutCubic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInCubic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number;
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 1)) + _arg2));
}
public static function easeInOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((-(_arg3) / 2) * (Math.cos(((Math.PI * _arg1) / _arg4)) - 1)) + _arg2));
}
public static function easeInBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number;
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * (((_local6 + 1) * _arg1) - _local6)) + _arg2));
}
public static function easeInQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeOutInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuint((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuint(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutBounce((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInBounce(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function init():void{
Tweener.registerTransition("easenone", easeNone);
Tweener.registerTransition("linear", easeNone);
Tweener.registerTransition("easeinquad", easeInQuad);
Tweener.registerTransition("easeoutquad", easeOutQuad);
Tweener.registerTransition("easeinoutquad", easeInOutQuad);
Tweener.registerTransition("easeoutinquad", easeOutInQuad);
Tweener.registerTransition("easeincubic", easeInCubic);
Tweener.registerTransition("easeoutcubic", easeOutCubic);
Tweener.registerTransition("easeinoutcubic", easeInOutCubic);
Tweener.registerTransition("easeoutincubic", easeOutInCubic);
Tweener.registerTransition("easeinquart", easeInQuart);
Tweener.registerTransition("easeoutquart", easeOutQuart);
Tweener.registerTransition("easeinoutquart", easeInOutQuart);
Tweener.registerTransition("easeoutinquart", easeOutInQuart);
Tweener.registerTransition("easeinquint", easeInQuint);
Tweener.registerTransition("easeoutquint", easeOutQuint);
Tweener.registerTransition("easeinoutquint", easeInOutQuint);
Tweener.registerTransition("easeoutinquint", easeOutInQuint);
Tweener.registerTransition("easeinsine", easeInSine);
Tweener.registerTransition("easeoutsine", easeOutSine);
Tweener.registerTransition("easeinoutsine", easeInOutSine);
Tweener.registerTransition("easeoutinsine", easeOutInSine);
Tweener.registerTransition("easeincirc", easeInCirc);
Tweener.registerTransition("easeoutcirc", easeOutCirc);
Tweener.registerTransition("easeinoutcirc", easeInOutCirc);
Tweener.registerTransition("easeoutincirc", easeOutInCirc);
Tweener.registerTransition("easeinexpo", easeInExpo);
Tweener.registerTransition("easeoutexpo", easeOutExpo);
Tweener.registerTransition("easeinoutexpo", easeInOutExpo);
Tweener.registerTransition("easeoutinexpo", easeOutInExpo);
Tweener.registerTransition("easeinelastic", easeInElastic);
Tweener.registerTransition("easeoutelastic", easeOutElastic);
Tweener.registerTransition("easeinoutelastic", easeInOutElastic);
Tweener.registerTransition("easeoutinelastic", easeOutInElastic);
Tweener.registerTransition("easeinback", easeInBack);
Tweener.registerTransition("easeoutback", easeOutBack);
Tweener.registerTransition("easeinoutback", easeInOutBack);
Tweener.registerTransition("easeoutinback", easeOutInBack);
Tweener.registerTransition("easeinbounce", easeInBounce);
Tweener.registerTransition("easeoutbounce", easeOutBounce);
Tweener.registerTransition("easeinoutbounce", easeInOutBounce);
Tweener.registerTransition("easeoutinbounce", easeOutInBounce);
}
public static function easeOutExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg1)==_arg4) ? (_arg2 + _arg3) : (((_arg3 * 1.001) * (-(Math.pow(2, ((-10 * _arg1) / _arg4))) + 1)) + _arg2));
}
public static function easeOutInBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutBack((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInBack(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg1)==0) ? _arg2 : (((_arg3 * Math.pow(2, (10 * ((_arg1 / _arg4) - 1)))) + _arg2) - (_arg3 * 0.001)));
}
public static function easeInCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((((((_arg3 * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
}
public static function easeInOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((-(_arg3) / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (Math.sqrt((1 - (_arg1 * _arg1))) + 1)) + _arg2));
}
public static function easeInQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((_arg3 * _arg1) * _arg1) + _arg2));
}
public static function easeInBounce(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg3 - easeOutBounce((_arg4 - _arg1), 0, _arg3, _arg4)) + _arg2));
}
public static function easeOutInExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutExpo((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInExpo(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((-(_arg3) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 1)) + _arg2));
}
public static function easeInSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((-(_arg3) * Math.cos(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg3) + _arg2));
}
public static function easeInOutQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((-(_arg3) / 2) * ((((_arg1 * _arg1) * _arg1) * _arg1) - 2)) + _arg2));
}
public static function easeOutQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function easeOutInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutElastic((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInElastic(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number;
var _local7:Number;
var _local8:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period;
_local8 = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
--_arg1;
return ((-(((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2));
}
public static function easeOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeOutQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 1)) + _arg2));
}
public static function easeOutInQuad(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuad((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuad(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return (((_arg3 * Math.sin(((_arg1 / _arg4) * (Math.PI / 2)))) + _arg2));
}
public static function easeInOutCubic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * _arg1) + 2)) + _arg2));
}
public static function easeInOutQuint(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return ((((((((_arg3 / 2) * _arg1) * _arg1) * _arg1) * _arg1) * _arg1) + _arg2));
};
_arg1 = (_arg1 - 2);
return ((((_arg3 / 2) * (((((_arg1 * _arg1) * _arg1) * _arg1) * _arg1) + 2)) + _arg2));
}
public static function easeInCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = (_arg1 / _arg4);
return (((-(_arg3) * (Math.sqrt((1 - (_arg1 * _arg1))) - 1)) + _arg2));
}
public static function easeOutInSine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutSine((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInSine(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeInOutExpo(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 == 0){
return (_arg2);
};
if (_arg1 == _arg4){
return ((_arg2 + _arg3));
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * Math.pow(2, (10 * (_arg1 - 1)))) + _arg2) - (_arg3 * 0.0005)));
};
--_arg1;
return (((((_arg3 / 2) * 1.0005) * (-(Math.pow(2, (-10 * _arg1))) + 2)) + _arg2));
}
public static function easeOutElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number;
var _local7:Number;
var _local8:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
_local6 = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period;
_local8 = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
return (((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) + _arg3) + _arg2));
}
public static function easeOutCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * Math.sqrt((1 - (_arg1 * _arg1)))) + _arg2));
}
public static function easeOutInQuart(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutQuart((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInQuart(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
public static function easeOutInCirc(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
if (_arg1 < (_arg4 / 2)){
return (easeOutCirc((_arg1 * 2), _arg2, (_arg3 / 2), _arg4, _arg5));
};
return (easeInCirc(((_arg1 * 2) - _arg4), (_arg2 + (_arg3 / 2)), (_arg3 / 2), _arg4, _arg5));
}
}
}//package caurina.transitions
Section 3
//PropertyInfoObj (caurina.transitions.PropertyInfoObj)
package caurina.transitions {
public class PropertyInfoObj {
public var originalValueComplete:Object;
public var modifierParameters:Array;
public var isSpecialProperty:Boolean;
public var hasModifier:Boolean;
public var valueComplete:Number;
public var extra:Object;
public var valueStart:Number;
public var modifierFunction:Function;
public var arrayIndex:Number;
public function PropertyInfoObj(_arg1:Number, _arg2:Number, _arg3:Object, _arg4:Number, _arg5:Object, _arg6:Boolean, _arg7:Function, _arg8:Array){
valueStart = _arg1;
valueComplete = _arg2;
originalValueComplete = _arg3;
arrayIndex = _arg4;
extra = _arg5;
isSpecialProperty = _arg6;
hasModifier = Boolean(_arg7);
modifierFunction = _arg7;
modifierParameters = _arg8;
}
public function toString():String{
var _local1:String;
_local1 = "\n[PropertyInfoObj ";
_local1 = (_local1 + ("valueStart:" + String(valueStart)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("valueComplete:" + String(valueComplete)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("originalValueComplete:" + String(originalValueComplete)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("arrayIndex:" + String(arrayIndex)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("extra:" + String(extra)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("isSpecialProperty:" + String(isSpecialProperty)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("hasModifier:" + String(hasModifier)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("modifierFunction:" + String(modifierFunction)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("modifierParameters:" + String(modifierParameters)));
_local1 = (_local1 + "]\n");
return (_local1);
}
public function clone():PropertyInfoObj{
var _local1:PropertyInfoObj;
_local1 = new PropertyInfoObj(valueStart, valueComplete, originalValueComplete, arrayIndex, extra, isSpecialProperty, modifierFunction, modifierParameters);
return (_local1);
}
}
}//package caurina.transitions
Section 4
//SpecialProperty (caurina.transitions.SpecialProperty)
package caurina.transitions {
public class SpecialProperty {
public var parameters:Array;
public var preProcess:Function;
public var setValue:Function;
public var getValue:Function;
public function SpecialProperty(_arg1:Function, _arg2:Function, _arg3:Array=null, _arg4:Function=null){
getValue = _arg1;
setValue = _arg2;
parameters = _arg3;
preProcess = _arg4;
}
public function toString():String{
var _local1:String;
_local1 = "";
_local1 = (_local1 + "[SpecialProperty ");
_local1 = (_local1 + ("getValue:" + String(getValue)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("setValue:" + String(setValue)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("parameters:" + String(parameters)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("preProcess:" + String(preProcess)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 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:String;
_local1 = "";
_local1 = (_local1 + "[SpecialPropertyModifier ");
_local1 = (_local1 + ("modifyValues:" + String(modifyValues)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("getValue:" + String(getValue)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 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:String;
_local1 = "";
_local1 = (_local1 + "[SpecialPropertySplitter ");
_local1 = (_local1 + ("splitValues:" + String(splitValues)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("parameters:" + String(parameters)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 7
//Tweener (caurina.transitions.Tweener)
package caurina.transitions {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
public class Tweener {
private static var _timeScale:Number = 1;
private static var _currentTimeFrame:Number;
private static var _specialPropertySplitterList:Object;
public static var autoOverwrite:Boolean = true;
private static var _engineExists:Boolean = false;
private static var _currentTime:Number;
private static var _tweenList:Array;
private static var _specialPropertyModifierList:Object;
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{
var _local4:SpecialPropertyModifier;
if (!_inited){
init();
};
_local4 = new SpecialPropertyModifier(_arg2, _arg3);
_specialPropertyModifierList[_arg1] = _local4;
}
public static function registerSpecialProperty(_arg1:String, _arg2:Function, _arg3:Function, _arg4:Array=null, _arg5:Function=null):void{
var _local6:SpecialProperty;
if (!_inited){
init();
};
_local6 = new SpecialProperty(_arg2, _arg3, _arg4, _arg5);
_specialPropertyList[_arg1] = _local6;
}
public static function init(... _args):void{
_inited = true;
_transitionList = new Object();
Equations.init();
_specialPropertyList = new Object();
_specialPropertyModifierList = new Object();
_specialPropertySplitterList = new Object();
}
private static function updateTweens():Boolean{
var _local1:int;
if (_tweenList.length == 0){
return (false);
};
_local1 = 0;
while (_local1 < _tweenList.length) {
if ((((_tweenList[_local1] == undefined)) || (!(_tweenList[_local1].isPaused)))){
if (!updateTweenByIndex(_local1)){
removeTweenByIndex(_local1);
};
if (_tweenList[_local1] == null){
removeTweenByIndex(_local1, true);
_local1--;
};
};
_local1++;
};
return (true);
}
public static function addCaller(_arg1:Object=null, _arg2:Object=null):Boolean{
var _local3:Number;
var _local4:Array;
var _local5:Object;
var _local6:Number;
var _local7:Number;
var _local8:Function;
var _local9:TweenListObj;
var _local10:Number;
var _local11:String;
if (!Boolean(_arg1)){
return (false);
};
if ((_arg1 is Array)){
_local4 = _arg1.concat();
} else {
_local4 = [_arg1];
};
_local5 = _arg2;
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
_local6 = (isNaN(_local5.time)) ? 0 : _local5.time;
_local7 = (isNaN(_local5.delay)) ? 0 : _local5.delay;
if (typeof(_local5.transition) == "string"){
_local11 = _local5.transition.toLowerCase();
_local8 = _transitionList[_local11];
} else {
_local8 = _local5.transition;
};
if (!Boolean(_local8)){
_local8 = _transitionList["easeoutexpo"];
};
_local3 = 0;
while (_local3 < _local4.length) {
if (_local5.useFrames == true){
_local9 = new TweenListObj(_local4[_local3], (_currentTimeFrame + (_local7 / _timeScale)), (_currentTimeFrame + ((_local7 + _local6) / _timeScale)), true, _local8, _local5.transitionParams);
} else {
_local9 = new TweenListObj(_local4[_local3], (_currentTime + ((_local7 * 1000) / _timeScale)), (_currentTime + (((_local7 * 1000) + (_local6 * 1000)) / _timeScale)), false, _local8, _local5.transitionParams);
};
_local9.properties = null;
_local9.onStart = _local5.onStart;
_local9.onUpdate = _local5.onUpdate;
_local9.onComplete = _local5.onComplete;
_local9.onOverwrite = _local5.onOverwrite;
_local9.onStartParams = _local5.onStartParams;
_local9.onUpdateParams = _local5.onUpdateParams;
_local9.onCompleteParams = _local5.onCompleteParams;
_local9.onOverwriteParams = _local5.onOverwriteParams;
_local9.onStartScope = _local5.onStartScope;
_local9.onUpdateScope = _local5.onUpdateScope;
_local9.onCompleteScope = _local5.onCompleteScope;
_local9.onOverwriteScope = _local5.onOverwriteScope;
_local9.onErrorScope = _local5.onErrorScope;
_local9.isCaller = true;
_local9.count = _local5.count;
_local9.waitFrames = _local5.waitFrames;
_tweenList.push(_local9);
if ((((_local6 == 0)) && ((_local7 == 0)))){
_local10 = (_tweenList.length - 1);
updateTweenByIndex(_local10);
removeTweenByIndex(_local10);
};
_local3++;
};
return (true);
}
public static function pauseAllTweens():Boolean{
var _local1:Boolean;
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
_local1 = false;
_local2 = 0;
while (_local2 < _tweenList.length) {
pauseTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
public static function removeTweens(_arg1:Object, ... _args):Boolean{
var _local3:Array;
var _local4:uint;
var _local5:SpecialPropertySplitter;
var _local6:Array;
var _local7:uint;
_local3 = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && ((_local3.indexOf(_args[_local4]) == -1)))){
if (_specialPropertySplitterList[_args[_local4]]){
_local5 = _specialPropertySplitterList[_args[_local4]];
_local6 = _local5.splitValues(_arg1, null);
_local7 = 0;
while (_local7 < _local6.length) {
_local3.push(_local6[_local7].name);
_local7++;
};
} else {
_local3.push(_args[_local4]);
};
};
_local4++;
};
return (affectTweens(removeTweenByIndex, _arg1, _local3));
}
public static function updateFrame():void{
_currentTimeFrame++;
}
public static function splitTweens(_arg1:Number, _arg2:Array):uint{
var _local3:TweenListObj;
var _local4:TweenListObj;
var _local5:uint;
var _local6:String;
var _local7:Boolean;
_local3 = _tweenList[_arg1];
_local4 = _local3.clone(false);
_local5 = 0;
while (_local5 < _arg2.length) {
_local6 = _arg2[_local5];
if (Boolean(_local3.properties[_local6])){
_local3.properties[_local6] = undefined;
delete _local3.properties[_local6];
};
_local5++;
};
for (_local6 in _local4.properties) {
_local7 = false;
_local5 = 0;
while (_local5 < _arg2.length) {
if (_arg2[_local5] == _local6){
_local7 = true;
break;
};
_local5++;
};
if (!_local7){
_local4.properties[_local6] = undefined;
delete _local4.properties[_local6];
};
};
_tweenList.push(_local4);
return ((_tweenList.length - 1));
}
public static function resumeTweenByIndex(_arg1:Number):Boolean{
var _local2:TweenListObj;
var _local3:Number;
_local2 = _tweenList[_arg1];
if ((((_local2 == null)) || (!(_local2.isPaused)))){
return (false);
};
_local3 = getCurrentTweeningTime(_local2);
_local2.timeStart = (_local2.timeStart + (_local3 - _local2.timePaused));
_local2.timeComplete = (_local2.timeComplete + (_local3 - _local2.timePaused));
_local2.timePaused = undefined;
_local2.isPaused = false;
return (true);
}
public static function getVersion():String{
return ("AS3 1.33.74");
}
public static function onEnterFrame(_arg1:Event):void{
var _local2:Boolean;
updateTime();
updateFrame();
_local2 = false;
_local2 = updateTweens();
if (!_local2){
stopEngine();
};
}
public static function updateTime():void{
_currentTime = getTimer();
}
private static function updateTweenByIndex(_arg1:Number):Boolean{
var tTweening:TweenListObj;
var isOver:Boolean;
var mustUpdate:Boolean;
var nv:Number;
var t:Number;
var b:Number;
var c:Number;
var d:Number;
var pName:String;
var eventScope:Object;
var tScope:Object;
var cTime:Number;
var tProperty:Object;
var pv:Number;
var i = _arg1;
tTweening = _tweenList[i];
if ((((tTweening == null)) || (!(Boolean(tTweening.scope))))){
return (false);
};
isOver = false;
cTime = getCurrentTweeningTime(tTweening);
if (cTime >= tTweening.timeStart){
tScope = tTweening.scope;
if (tTweening.isCaller){
do {
t = (((tTweening.timeComplete - tTweening.timeStart) / tTweening.count) * (tTweening.timesCalled + 1));
b = tTweening.timeStart;
c = (tTweening.timeComplete - tTweening.timeStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, b, c, d);
} while (!(cTime >= nv));
} else {
mustUpdate = (((((tTweening.skipUpdates < 1)) || (!(tTweening.skipUpdates)))) || ((tTweening.updatesSkipped >= tTweening.skipUpdates)));
if (cTime >= tTweening.timeComplete){
isOver = true;
mustUpdate = true;
};
if (!tTweening.hasStarted){
if (Boolean(tTweening.onStart)){
eventScope = (Boolean(tTweening.onStartScope)) ? tTweening.onStartScope : tScope;
try {
tTweening.onStart.apply(eventScope, tTweening.onStartParams);
} catch(e2:Error) {
handleError(tTweening, e2, "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(e3:Error) {
handleError(tTweening, e3, "onUpdate");
};
};
} else {
tTweening.updatesSkipped++;
};
};
if (((isOver) && (Boolean(tTweening.onComplete)))){
eventScope = (Boolean(tTweening.onCompleteScope)) ? tTweening.onCompleteScope : tScope;
try {
tTweening.onComplete.apply(eventScope, tTweening.onCompleteParams);
} catch(e4:Error) {
handleError(tTweening, e4, "onComplete");
};
};
return (!(isOver));
};
return (true);
}
public static function setTimeScale(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
if (isNaN(_arg1)){
_arg1 = 1;
};
if (_arg1 < 1E-5){
_arg1 = 1E-5;
};
if (_arg1 != _timeScale){
if (_tweenList != null){
_local2 = 0;
while (_local2 < _tweenList.length) {
_local3 = getCurrentTweeningTime(_tweenList[_local2]);
_tweenList[_local2].timeStart = (_local3 - (((_local3 - _tweenList[_local2].timeStart) * _timeScale) / _arg1));
_tweenList[_local2].timeComplete = (_local3 - (((_local3 - _tweenList[_local2].timeComplete) * _timeScale) / _arg1));
if (_tweenList[_local2].timePaused != undefined){
_tweenList[_local2].timePaused = (_local3 - (((_local3 - _tweenList[_local2].timePaused) * _timeScale) / _arg1));
};
_local2++;
};
};
_timeScale = _arg1;
};
}
public static function resumeAllTweens():Boolean{
var _local1:Boolean;
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
_local1 = false;
_local2 = 0;
while (_local2 < _tweenList.length) {
resumeTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
private static function handleError(_arg1:TweenListObj, _arg2:Error, _arg3:String):void{
var eventScope:Object;
var pTweening = _arg1;
var pError = _arg2;
var pCallBackName = _arg3;
if (((Boolean(pTweening.onError)) && ((pTweening.onError is Function)))){
eventScope = (Boolean(pTweening.onErrorScope)) ? pTweening.onErrorScope : pTweening.scope;
try {
pTweening.onError.apply(eventScope, [pTweening.scope, pError]);
} catch(metaError:Error) {
printError(((((String(pTweening.scope) + " raised an error while executing the 'onError' handler. Original error:\n ") + pError.getStackTrace()) + "\nonError error: ") + metaError.getStackTrace()));
};
} else {
if (!Boolean(pTweening.onError)){
printError(((((String(pTweening.scope) + " raised an error while executing the '") + pCallBackName) + "'handler. \n") + pError.getStackTrace()));
};
};
}
private static function startEngine():void{
_engineExists = true;
_tweenList = new Array();
__tweener_controller__ = new MovieClip();
__tweener_controller__.addEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame);
_currentTimeFrame = 0;
updateTime();
}
public static function removeAllTweens():Boolean{
var _local1:Boolean;
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
_local1 = false;
_local2 = 0;
while (_local2 < _tweenList.length) {
removeTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
public static function addTween(_arg1:Object=null, _arg2:Object=null):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:String;
var _local6:Array;
var _local7:Object;
var _local8:Number;
var _local9:Number;
var _local10:Array;
var _local11:Object;
var _local12:Object;
var _local13:Function;
var _local14:Object;
var _local15:TweenListObj;
var _local16:Number;
var _local17:Array;
var _local18:Array;
var _local19:Array;
var _local20:String;
if (!Boolean(_arg1)){
return (false);
};
if ((_arg1 is Array)){
_local6 = _arg1.concat();
} else {
_local6 = [_arg1];
};
_local7 = TweenListObj.makePropertiesChain(_arg2);
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
_local8 = (isNaN(_local7.time)) ? 0 : _local7.time;
_local9 = (isNaN(_local7.delay)) ? 0 : _local7.delay;
_local10 = new Array();
_local11 = {overwrite:true, time:true, delay:true, useFrames:true, skipUpdates:true, transition:true, transitionParams:true, onStart:true, onUpdate:true, onComplete:true, onOverwrite:true, onError:true, rounded:true, onStartParams:true, onUpdateParams:true, onCompleteParams:true, onOverwriteParams:true, onStartScope:true, onUpdateScope:true, onCompleteScope:true, onOverwriteScope:true, onErrorScope:true};
_local12 = new Object();
for (_local5 in _local7) {
if (!_local11[_local5]){
if (_specialPropertySplitterList[_local5]){
_local17 = _specialPropertySplitterList[_local5].splitValues(_local7[_local5], _specialPropertySplitterList[_local5].parameters);
_local3 = 0;
while (_local3 < _local17.length) {
if (_specialPropertySplitterList[_local17[_local3].name]){
_local18 = _specialPropertySplitterList[_local17[_local3].name].splitValues(_local17[_local3].value, _specialPropertySplitterList[_local17[_local3].name].parameters);
_local4 = 0;
while (_local4 < _local18.length) {
_local10[_local18[_local4].name] = {valueStart:undefined, valueComplete:_local18[_local4].value, arrayIndex:_local18[_local4].arrayIndex, isSpecialProperty:false};
_local4++;
};
} else {
_local10[_local17[_local3].name] = {valueStart:undefined, valueComplete:_local17[_local3].value, arrayIndex:_local17[_local3].arrayIndex, isSpecialProperty:false};
};
_local3++;
};
} else {
if (_specialPropertyModifierList[_local5] != undefined){
_local19 = _specialPropertyModifierList[_local5].modifyValues(_local7[_local5]);
_local3 = 0;
while (_local3 < _local19.length) {
_local12[_local19[_local3].name] = {modifierParameters:_local19[_local3].parameters, modifierFunction:_specialPropertyModifierList[_local5].getValue};
_local3++;
};
} else {
_local10[_local5] = {valueStart:undefined, valueComplete:_local7[_local5]};
};
};
};
};
for (_local5 in _local10) {
if (_specialPropertyList[_local5] != undefined){
_local10[_local5].isSpecialProperty = true;
} else {
if (_local6[0][_local5] == undefined){
printError((((("The property '" + _local5) + "' doesn't seem to be a normal object property of ") + String(_local6[0])) + " or a registered special property."));
};
};
};
for (_local5 in _local12) {
if (_local10[_local5] != undefined){
_local10[_local5].modifierParameters = _local12[_local5].modifierParameters;
_local10[_local5].modifierFunction = _local12[_local5].modifierFunction;
};
};
if (typeof(_local7.transition) == "string"){
_local20 = _local7.transition.toLowerCase();
_local13 = _transitionList[_local20];
} else {
_local13 = _local7.transition;
};
if (!Boolean(_local13)){
_local13 = _transitionList["easeoutexpo"];
};
_local3 = 0;
while (_local3 < _local6.length) {
_local14 = new Object();
for (_local5 in _local10) {
_local14[_local5] = new PropertyInfoObj(_local10[_local5].valueStart, _local10[_local5].valueComplete, _local10[_local5].valueComplete, _local10[_local5].arrayIndex, {}, _local10[_local5].isSpecialProperty, _local10[_local5].modifierFunction, _local10[_local5].modifierParameters);
};
if (_local7.useFrames == true){
_local15 = new TweenListObj(_local6[_local3], (_currentTimeFrame + (_local9 / _timeScale)), (_currentTimeFrame + ((_local9 + _local8) / _timeScale)), true, _local13, _local7.transitionParams);
} else {
_local15 = new TweenListObj(_local6[_local3], (_currentTime + ((_local9 * 1000) / _timeScale)), (_currentTime + (((_local9 * 1000) + (_local8 * 1000)) / _timeScale)), false, _local13, _local7.transitionParams);
};
_local15.properties = _local14;
_local15.onStart = _local7.onStart;
_local15.onUpdate = _local7.onUpdate;
_local15.onComplete = _local7.onComplete;
_local15.onOverwrite = _local7.onOverwrite;
_local15.onError = _local7.onError;
_local15.onStartParams = _local7.onStartParams;
_local15.onUpdateParams = _local7.onUpdateParams;
_local15.onCompleteParams = _local7.onCompleteParams;
_local15.onOverwriteParams = _local7.onOverwriteParams;
_local15.onStartScope = _local7.onStartScope;
_local15.onUpdateScope = _local7.onUpdateScope;
_local15.onCompleteScope = _local7.onCompleteScope;
_local15.onOverwriteScope = _local7.onOverwriteScope;
_local15.onErrorScope = _local7.onErrorScope;
_local15.rounded = _local7.rounded;
_local15.skipUpdates = _local7.skipUpdates;
if (((_local7.overwrite == undefined)) ? autoOverwrite : _local7.overwrite){
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 _local4:Boolean;
var _local5:uint;
var _local6:Array;
var _local7:uint;
var _local8:uint;
var _local9:uint;
_local4 = false;
if (!Boolean(_tweenList)){
return (false);
};
_local5 = 0;
while (_local5 < _tweenList.length) {
if (((_tweenList[_local5]) && ((_tweenList[_local5].scope == _arg2)))){
if (_arg3.length == 0){
_arg1(_local5);
_local4 = true;
} else {
_local6 = new Array();
_local7 = 0;
while (_local7 < _arg3.length) {
if (Boolean(_tweenList[_local5].properties[_arg3[_local7]])){
_local6.push(_arg3[_local7]);
};
_local7++;
};
if (_local6.length > 0){
_local8 = AuxFunctions.getObjectLength(_tweenList[_local5].properties);
if (_local8 == _local6.length){
_arg1(_local5);
_local4 = true;
} else {
_local9 = splitTweens(_local5, _local6);
_arg1(_local9);
_local4 = true;
};
};
};
};
_local5++;
};
return (_local4);
}
public static function getTweens(_arg1:Object):Array{
var _local2:uint;
var _local3:String;
var _local4:Array;
if (!Boolean(_tweenList)){
return ([]);
};
_local4 = new Array();
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
for (_local3 in _tweenList[_local2].properties) {
_local4.push(_local3);
};
};
_local2++;
};
return (_local4);
}
public static function isTweening(_arg1:Object):Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
return (true);
};
_local2++;
};
return (false);
}
public static function pauseTweenByIndex(_arg1:Number):Boolean{
var _local2:TweenListObj;
_local2 = _tweenList[_arg1];
if ((((_local2 == null)) || (_local2.isPaused))){
return (false);
};
_local2.timePaused = getCurrentTweeningTime(_local2);
_local2.isPaused = true;
return (true);
}
public static function getCurrentTweeningTime(_arg1:Object):Number{
return ((_arg1.useFrames) ? _currentTimeFrame : _currentTime);
}
public static function getTweenCount(_arg1:Object):Number{
var _local2:uint;
var _local3:Number;
if (!Boolean(_tweenList)){
return (0);
};
_local3 = 0;
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
_local3 = (_local3 + AuxFunctions.getObjectLength(_tweenList[_local2].properties));
};
_local2++;
};
return (_local3);
}
private static function stopEngine():void{
_engineExists = false;
_tweenList = null;
_currentTime = 0;
_currentTimeFrame = 0;
__tweener_controller__.removeEventListener(Event.ENTER_FRAME, Tweener.onEnterFrame);
__tweener_controller__ = null;
}
public static function removeTweensByTime(_arg1:Object, _arg2:Object, _arg3:Number, _arg4:Number):Boolean{
var removed:Boolean;
var removedLocally:Boolean;
var i:uint;
var tl:uint;
var pName:String;
var eventScope:Object;
var p_scope = _arg1;
var p_properties = _arg2;
var p_timeStart = _arg3;
var p_timeComplete = _arg4;
removed = false;
tl = _tweenList.length;
i = 0;
while (i < tl) {
if (((Boolean(_tweenList[i])) && ((p_scope == _tweenList[i].scope)))){
if ((((p_timeComplete > _tweenList[i].timeStart)) && ((p_timeStart < _tweenList[i].timeComplete)))){
removedLocally = false;
for (pName in _tweenList[i].properties) {
if (Boolean(p_properties[pName])){
if (Boolean(_tweenList[i].onOverwrite)){
eventScope = (Boolean(_tweenList[i].onOverwriteScope)) ? _tweenList[i].onOverwriteScope : _tweenList[i].scope;
try {
_tweenList[i].onOverwrite.apply(eventScope, _tweenList[i].onOverwriteParams);
} catch(e:Error) {
handleError(_tweenList[i], e, "onOverwrite");
};
};
_tweenList[i].properties[pName] = undefined;
delete _tweenList[i].properties[pName];
removedLocally = true;
removed = true;
};
};
if (removedLocally){
if (AuxFunctions.getObjectLength(_tweenList[i].properties) == 0){
removeTweenByIndex(i);
};
};
};
};
i = (i + 1);
};
return (removed);
}
public static function registerSpecialPropertySplitter(_arg1:String, _arg2:Function, _arg3:Array=null):void{
var _local4:SpecialPropertySplitter;
if (!_inited){
init();
};
_local4 = new SpecialPropertySplitter(_arg2, _arg3);
_specialPropertySplitterList[_arg1] = _local4;
}
public static function removeTweenByIndex(_arg1:Number, _arg2:Boolean=false):Boolean{
_tweenList[_arg1] = null;
if (_arg2){
_tweenList.splice(_arg1, 1);
};
return (true);
}
public static function resumeTweens(_arg1:Object, ... _args):Boolean{
var _local3:Array;
var _local4:uint;
_local3 = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && ((_local3.indexOf(_args[_local4]) == -1)))){
_local3.push(_args[_local4]);
};
_local4++;
};
return (affectTweens(resumeTweenByIndex, _arg1, _local3));
}
public static function pauseTweens(_arg1:Object, ... _args):Boolean{
var _local3:Array;
var _local4:uint;
_local3 = new Array();
_local4 = 0;
while (_local4 < _args.length) {
if ((((typeof(_args[_local4]) == "string")) && ((_local3.indexOf(_args[_local4]) == -1)))){
_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 onUpdate:Function;
public var useFrames:Boolean;
public var hasStarted:Boolean;
public var onOverwriteParams:Array;
public var timeStart:Number;
public var count:Number;
public var timeComplete:Number;
public var onStartParams:Array;
public var onUpdateScope:Object;
public var rounded:Boolean;
public var onUpdateParams:Array;
public var properties:Object;
public var onComplete:Function;
public var transitionParams:Object;
public var updatesSkipped:Number;
public var onStart:Function;
public var onOverwriteScope:Object;
public var skipUpdates:Number;
public var onStartScope:Object;
public var scope:Object;
public var transition:Function;
public var timePaused:Number;
public var onCompleteParams:Array;
public var timesCalled:Number;
public var isCaller:Boolean;
public var onError:Function;
public var onErrorScope:Object;
public var onOverwrite:Function;
public var isPaused:Boolean;
public var waitFrames:Boolean;
public var onCompleteScope:Object;
public function TweenListObj(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Boolean, _arg5:Function, _arg6:Object){
scope = _arg1;
timeStart = _arg2;
timeComplete = _arg3;
useFrames = _arg4;
transition = _arg5;
transitionParams = _arg6;
properties = new Object();
isPaused = false;
timePaused = undefined;
isCaller = false;
updatesSkipped = 0;
timesCalled = 0;
skipUpdates = 0;
hasStarted = false;
}
public function clone(_arg1:Boolean):TweenListObj{
var _local2:TweenListObj;
var _local3:String;
_local2 = new TweenListObj(scope, timeStart, timeComplete, useFrames, transition, transitionParams);
_local2.properties = new Array();
for (_local3 in properties) {
_local2.properties[_local3] = properties[_local3].clone();
};
_local2.skipUpdates = skipUpdates;
_local2.updatesSkipped = updatesSkipped;
if (!_arg1){
_local2.onStart = onStart;
_local2.onUpdate = onUpdate;
_local2.onComplete = onComplete;
_local2.onOverwrite = onOverwrite;
_local2.onError = onError;
_local2.onStartParams = onStartParams;
_local2.onUpdateParams = onUpdateParams;
_local2.onCompleteParams = onCompleteParams;
_local2.onOverwriteParams = onOverwriteParams;
_local2.onStartScope = onStartScope;
_local2.onUpdateScope = onUpdateScope;
_local2.onCompleteScope = onCompleteScope;
_local2.onOverwriteScope = onOverwriteScope;
_local2.onErrorScope = onErrorScope;
};
_local2.rounded = rounded;
_local2.isPaused = isPaused;
_local2.timePaused = timePaused;
_local2.isCaller = isCaller;
_local2.count = count;
_local2.timesCalled = timesCalled;
_local2.waitFrames = waitFrames;
_local2.hasStarted = hasStarted;
return (_local2);
}
public function toString():String{
var _local1:String;
var _local2:Boolean;
var _local3:String;
_local1 = "\n[TweenListObj ";
_local1 = (_local1 + ("scope:" + String(scope)));
_local1 = (_local1 + ", properties:");
_local2 = true;
for (_local3 in properties) {
if (!_local2){
_local1 = (_local1 + ",");
};
_local1 = (_local1 + ("[name:" + properties[_local3].name));
_local1 = (_local1 + (",valueStart:" + properties[_local3].valueStart));
_local1 = (_local1 + (",valueComplete:" + properties[_local3].valueComplete));
_local1 = (_local1 + "]");
_local2 = false;
};
_local1 = (_local1 + (", timeStart:" + String(timeStart)));
_local1 = (_local1 + (", timeComplete:" + String(timeComplete)));
_local1 = (_local1 + (", useFrames:" + String(useFrames)));
_local1 = (_local1 + (", transition:" + String(transition)));
_local1 = (_local1 + (", transitionParams:" + String(transitionParams)));
if (skipUpdates){
_local1 = (_local1 + (", skipUpdates:" + String(skipUpdates)));
};
if (updatesSkipped){
_local1 = (_local1 + (", updatesSkipped:" + String(updatesSkipped)));
};
if (Boolean(onStart)){
_local1 = (_local1 + (", onStart:" + String(onStart)));
};
if (Boolean(onUpdate)){
_local1 = (_local1 + (", onUpdate:" + String(onUpdate)));
};
if (Boolean(onComplete)){
_local1 = (_local1 + (", onComplete:" + String(onComplete)));
};
if (Boolean(onOverwrite)){
_local1 = (_local1 + (", onOverwrite:" + String(onOverwrite)));
};
if (Boolean(onError)){
_local1 = (_local1 + (", onError:" + String(onError)));
};
if (onStartParams){
_local1 = (_local1 + (", onStartParams:" + String(onStartParams)));
};
if (onUpdateParams){
_local1 = (_local1 + (", onUpdateParams:" + String(onUpdateParams)));
};
if (onCompleteParams){
_local1 = (_local1 + (", onCompleteParams:" + String(onCompleteParams)));
};
if (onOverwriteParams){
_local1 = (_local1 + (", onOverwriteParams:" + String(onOverwriteParams)));
};
if (onStartScope){
_local1 = (_local1 + (", onStartScope:" + String(onStartScope)));
};
if (onUpdateScope){
_local1 = (_local1 + (", onUpdateScope:" + String(onUpdateScope)));
};
if (onCompleteScope){
_local1 = (_local1 + (", onCompleteScope:" + String(onCompleteScope)));
};
if (onOverwriteScope){
_local1 = (_local1 + (", onOverwriteScope:" + String(onOverwriteScope)));
};
if (onErrorScope){
_local1 = (_local1 + (", onErrorScope:" + String(onErrorScope)));
};
if (rounded){
_local1 = (_local1 + (", rounded:" + String(rounded)));
};
if (isPaused){
_local1 = (_local1 + (", isPaused:" + String(isPaused)));
};
if (timePaused){
_local1 = (_local1 + (", timePaused:" + String(timePaused)));
};
if (isCaller){
_local1 = (_local1 + (", isCaller:" + String(isCaller)));
};
if (count){
_local1 = (_local1 + (", count:" + String(count)));
};
if (timesCalled){
_local1 = (_local1 + (", timesCalled:" + String(timesCalled)));
};
if (waitFrames){
_local1 = (_local1 + (", waitFrames:" + String(waitFrames)));
};
if (hasStarted){
_local1 = (_local1 + (", hasStarted:" + String(hasStarted)));
};
_local1 = (_local1 + "]\n");
return (_local1);
}
public static function makePropertiesChain(_arg1:Object):Object{
var _local2:Object;
var _local3:Object;
var _local4:Object;
var _local5:Object;
var _local6:Number;
var _local7:Number;
var _local8:Number;
_local2 = _arg1.base;
if (_local2){
_local3 = {};
if ((_local2 is Array)){
_local4 = [];
_local8 = 0;
while (_local8 < _local2.length) {
_local4.push(_local2[_local8]);
_local8++;
};
} else {
_local4 = [_local2];
};
_local4.push(_arg1);
_local6 = _local4.length;
_local7 = 0;
while (_local7 < _local6) {
if (_local4[_local7]["base"]){
_local5 = AuxFunctions.concatObjects(makePropertiesChain(_local4[_local7]["base"]), _local4[_local7]);
} else {
_local5 = _local4[_local7];
};
_local3 = AuxFunctions.concatObjects(_local3, _local5);
_local7++;
};
if (_local3["base"]){
delete _local3["base"];
};
return (_local3);
//unresolved jump
};
return (_arg1);
}
}
}//package caurina.transitions
Section 9
//MyButton (com.MyButton)
package com {
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class MyButton extends MovieClip {
public var clip:MovieClip;
private var mother:Object;
public function MyButton(_arg1:MovieClip, _arg2:Object):void{
var _local3:uint;
var _local4:*;
var _local5:uint;
var _local6:*;
super();
clip = _arg1;
mother = _arg2;
clip.addEventListener(MouseEvent.CLICK, hClick);
clip.addEventListener(MouseEvent.ROLL_OUT, hRollOut);
clip.addEventListener(MouseEvent.ROLL_OVER, hRoll);
clip.buttonMode = true;
_local3 = 0;
while (_local3 < clip.numChildren) {
_local4 = clip.getChildAt(_local3);
if ((((_local4 is MovieClip)) || ((_local4 is TextField)))){
_local4.mouseEnabled = false;
if ((_local4 is MovieClip)){
_local5 = 0;
while (_local5 < _local4.numChildren) {
_local6 = _local4.getChildAt(_local5);
if ((((_local6 is MovieClip)) || ((_local6 is TextField)))){
_local6.mouseEnabled = false;
};
_local5++;
};
};
};
_local3++;
};
}
private function hClick(_arg1:MouseEvent):void{
mother.hClick(_arg1);
}
public function destroy():void{
clip.removeEventListener(MouseEvent.CLICK, hClick);
clip.removeEventListener(MouseEvent.ROLL_OUT, hRollOut);
clip.removeEventListener(MouseEvent.ROLL_OVER, hRoll);
}
private function hRoll(_arg1:MouseEvent):void{
clip.gotoAndStop(2);
}
private function hRollOut(_arg1:MouseEvent):void{
clip.gotoAndStop(1);
}
}
}//package com
Section 10
//ButtonEvent (controler.events.ButtonEvent)
package controler.events {
import flash.events.*;
public class ButtonEvent extends Event {
public var params:Object;
public static const END_SAVE:String = "endSaveScore";
public static const BACK:String = "buttonBack";
public static const CONTINUE_GAME:String = "continueGame";
public static const NEW_GAME:String = "newGame";
public static const RESET_POINTS:String = "buttonResetPoints";
public static const SAVE:String = "saveScore";
public function ButtonEvent(_arg1:String, _arg2:Object):void{
super(_arg1);
this.params = _arg2;
}
}
}//package controler.events
Section 11
//LanguageEvent (controler.events.LanguageEvent)
package controler.events {
import flash.events.*;
public class LanguageEvent extends Event {
public var language:String;
public static const CHANGE:String = "changeLanguage";
public function LanguageEvent(_arg1):void{
super(CHANGE);
this.language = _arg1;
}
}
}//package controler.events
Section 12
//ObjectEvent (controler.events.ObjectEvent)
package controler.events {
import flash.events.*;
public class ObjectEvent extends Event {
public var params:Object;
public static const CLOSE:String = "objectClose";
public function ObjectEvent(_arg1:String, _arg2:Object):void{
super(_arg1);
this.params = _arg2;
}
}
}//package controler.events
Section 13
//ScoresEvent (controler.events.ScoresEvent)
package controler.events {
import flash.events.*;
public class ScoresEvent extends Event {
public var params:Object;
public static const SUBMIT:String = "submitScores";
public static const UPDATE:String = "updateScores";
public static const SHOW:String = "showScores";
public function ScoresEvent(_arg1:String, _arg2:Object):void{
super(_arg1);
this.params = _arg2;
}
}
}//package controler.events
Section 14
//VehLexus (controler.objects.cars.VehLexus)
package controler.objects.cars {
import controler.objects.*;
public class VehLexus extends Vehicle {
private var BRAKE;// = 0.6
private var FRICTION;// = 0.2
private var ACCELERATE;// = 0.25
private var TURN_ACCELERATE;// = 0.3
private var MAX_SPEED;// = 12
private var MAX_REAR_SPEED;// = 4
private var MAX_TURN;// = 3
public function VehLexus():void{
TURN_ACCELERATE = 0.3;
ACCELERATE = 0.25;
BRAKE = 0.6;
MAX_SPEED = 12;
MAX_REAR_SPEED = 4;
MAX_TURN = 3;
FRICTION = 0.2;
super(TURN_ACCELERATE, ACCELERATE, BRAKE, MAX_SPEED, MAX_REAR_SPEED, MAX_TURN, FRICTION);
}
}
}//package controler.objects.cars
Section 15
//VehMazda (controler.objects.cars.VehMazda)
package controler.objects.cars {
import controler.objects.*;
public class VehMazda extends Vehicle {
private var BRAKE;// = 0.3
private var FRICTION;// = 0.2
private var ACCELERATE;// = 0.1
private var TURN_ACCELERATE;// = 0.3
private var MAX_SPEED;// = 9
private var MAX_REAR_SPEED;// = 5
private var MAX_TURN;// = 3
public function VehMazda():void{
TURN_ACCELERATE = 0.3;
ACCELERATE = 0.1;
BRAKE = 0.3;
MAX_SPEED = 9;
MAX_REAR_SPEED = 5;
MAX_TURN = 3;
FRICTION = 0.2;
super(TURN_ACCELERATE, ACCELERATE, BRAKE, MAX_SPEED, MAX_REAR_SPEED, MAX_TURN, FRICTION);
}
}
}//package controler.objects.cars
Section 16
//VehMerc (controler.objects.cars.VehMerc)
package controler.objects.cars {
import controler.objects.*;
public class VehMerc extends Vehicle {
private var BRAKE;// = 0.4
private var FRICTION;// = 0.2
private var ACCELERATE;// = 0.2
private var TURN_ACCELERATE;// = 0.3
private var MAX_SPEED;// = 10
private var MAX_REAR_SPEED;// = 4
private var MAX_TURN;// = 2.5
public function VehMerc():void{
TURN_ACCELERATE = 0.3;
ACCELERATE = 0.2;
BRAKE = 0.4;
MAX_SPEED = 10;
MAX_REAR_SPEED = 4;
MAX_TURN = 2.5;
FRICTION = 0.2;
super(TURN_ACCELERATE, ACCELERATE, BRAKE, MAX_SPEED, MAX_REAR_SPEED, MAX_TURN, FRICTION);
}
}
}//package controler.objects.cars
Section 17
//VehMini (controler.objects.cars.VehMini)
package controler.objects.cars {
import controler.objects.*;
public class VehMini extends Vehicle {
private var BRAKE;// = 0.6
private var FRICTION;// = 0.2
private var ACCELERATE;// = 0.05
private var TURN_ACCELERATE;// = 0.3
private var MAX_SPEED;// = 8
private var MAX_REAR_SPEED;// = 3
private var MAX_TURN;// = 3
public function VehMini():void{
TURN_ACCELERATE = 0.3;
ACCELERATE = 0.05;
BRAKE = 0.6;
MAX_SPEED = 8;
MAX_REAR_SPEED = 3;
MAX_TURN = 3;
FRICTION = 0.2;
super(TURN_ACCELERATE, ACCELERATE, BRAKE, MAX_SPEED, MAX_REAR_SPEED, MAX_TURN, FRICTION);
}
}
}//package controler.objects.cars
Section 18
//VehSuv (controler.objects.cars.VehSuv)
package controler.objects.cars {
import controler.objects.*;
public class VehSuv extends Vehicle {
private var BRAKE;// = 0.3
private var FRICTION;// = 0.2
private var ACCELERATE;// = 0.1
private var TURN_ACCELERATE;// = 0.3
private var MAX_SPEED;// = 10
private var MAX_REAR_SPEED;// = 4
private var MAX_TURN;// = 2
public function VehSuv():void{
TURN_ACCELERATE = 0.3;
ACCELERATE = 0.1;
BRAKE = 0.3;
MAX_SPEED = 10;
MAX_REAR_SPEED = 4;
MAX_TURN = 2;
FRICTION = 0.2;
super(TURN_ACCELERATE, ACCELERATE, BRAKE, MAX_SPEED, MAX_REAR_SPEED, MAX_TURN, FRICTION);
}
}
}//package controler.objects.cars
Section 19
//CrashObject (controler.objects.CrashObject)
package controler.objects {
import flash.display.*;
public class CrashObject extends MovieClip {
public function CrashObject():void{
alpha = 0;
}
}
}//package controler.objects
Section 20
//Vehicle (controler.objects.Vehicle)
package controler.objects {
public class Vehicle {
private var FRICTION;// = 0.2
private var BRAKE;// = 0.3
public var ySpeed:Number;// = 0
private var speed:Number;// = 0
private var MAX_TURN;// = 3
private var ACCELERATE;// = 0.1
private var TURN_ACCELERATE;// = 1
private var MAX_REAR_SPEED;// = 4
private var MAX_SPEED;// = 10
public var xSpeed:Number;// = 0
public var turn:Number;// = 0
public var rotation:Number;// = 0
public function Vehicle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):void{
speed = 0;
turn = 0;
rotation = 0;
TURN_ACCELERATE = 1;
ACCELERATE = 0.1;
BRAKE = 0.3;
MAX_SPEED = 10;
MAX_REAR_SPEED = 4;
MAX_TURN = 3;
FRICTION = 0.2;
ySpeed = 0;
xSpeed = 0;
super();
TURN_ACCELERATE = _arg1;
ACCELERATE = _arg2;
BRAKE = _arg3;
MAX_SPEED = _arg4;
MAX_REAR_SPEED = _arg5;
MAX_TURN = _arg6;
FRICTION = _arg7;
}
public function getTurn():Number{
return (rotation);
}
public function between(_arg1:Number, _arg2:Number, _arg3:Number):Number{
var _local4:Number;
_local4 = _arg1;
_local4 = ((_local4 < _arg2)) ? _arg2 : _local4;
_local4 = ((_local4 > _arg3)) ? _arg3 : _local4;
return (_local4);
}
public function setSpeed(_arg1:Number):void{
this.speed = _arg1;
}
public function degreesToRadians(_arg1:Number):Number{
var _local2:Number;
_local2 = ((Math.PI * 2) * (_arg1 / 360));
return (_local2);
}
public function move():void{
ySpeed = (ySpeed + (Math.cos(degreesToRadians(rotation)) * speed));
xSpeed = (xSpeed + (Math.sin(degreesToRadians(rotation)) * speed));
xSpeed = (xSpeed * 0.7);
ySpeed = (ySpeed * 0.7);
if ((((((((xSpeed < 0.1)) && ((xSpeed > -0.1)))) && ((ySpeed < 0.1)))) && ((ySpeed > -0.1)))){
xSpeed = 0;
ySpeed = 0;
};
}
public function idle():void{
if (speed > 0){
speed = (speed - 0.1);
speed = ((speed > 0)) ? speed : 0;
} else {
speed = (speed + 0.1);
speed = ((speed < 0)) ? speed : 0;
};
}
public function getSpeed():Number{
return (speed);
}
public function brake():void{
var _local1:Boolean;
_local1 = false;
if (speed <= 0){
_local1 = true;
};
if (_local1 == false){
speed = (speed - BRAKE);
speed = ((speed > 0)) ? speed : 0;
} else {
speed = (speed - (ACCELERATE / 1.5));
if (speed < -(MAX_REAR_SPEED)){
speed = -(MAX_REAR_SPEED);
};
};
}
public function crash():void{
speed = 0;
xSpeed = 0;
ySpeed = 0;
}
public function accelerate():void{
if (speed > 0){
speed = (speed + ACCELERATE);
} else {
speed = (speed + BRAKE);
};
speed = ((speed > MAX_SPEED)) ? MAX_SPEED : speed;
}
public function ster(_arg1:String):void{
if (_arg1 == "left"){
turn = (turn - TURN_ACCELERATE);
turn = ((turn < -(MAX_TURN))) ? -(MAX_TURN) : turn;
};
if (_arg1 == "right"){
turn = (turn + TURN_ACCELERATE);
turn = ((turn > MAX_TURN)) ? MAX_TURN : turn;
};
if (_arg1 == "zero"){
if (turn > 0){
turn = (turn - 0.8);
turn = ((turn < 0)) ? 0 : turn;
};
if (turn < 0){
turn = (turn + 0.8);
turn = ((turn > 0)) ? 0 : turn;
};
};
if (((!((xSpeed == 0))) || (!((ySpeed == 0))))){
rotation = (rotation + ((turn * speed) / (MAX_SPEED / 5)));
if (rotation < 0){
rotation = (360 + rotation);
};
rotation = (rotation % 360);
};
}
}
}//package controler.objects
Section 21
//Adds (controler.Adds)
package controler {
import flash.display.*;
import flash.events.*;
import mochi.as3.*;
import controler.events.*;
import flash.net.*;
import flash.system.*;
public dynamic class Adds extends Sprite {
var PoszkoleAPI:MovieClip;
public var MindJoltAPI:Object;
public var boardID:String;// = "d598614f25a0d3f4"
public var gameID:String;// = "fc1590c1eda2a257"
public var mother:Main;
public function Adds(_arg1:Main):void{
var gameParams:Object;
var urlLoader:Loader;
var loadFinished:Function;
var _mother = _arg1;
gameID = "fc1590c1eda2a257";
boardID = "d598614f25a0d3f4";
super();
mother = _mother;
if (MindJoltAPI == null){
loadFinished = function (_arg1:Event):void{
MindJoltAPI = _arg1.currentTarget.content;
if (MindJoltAPI != null){
MindJoltAPI.service.connect(postMindJoltAPIConnect);
trace("[MindJoltAPI] service successfully loaded");
} else {
trace("[MindJoltAPI] failed to load");
};
};
Security.allowDomain("static.mindjolt.com");
gameParams = LoaderInfo(mother.loaderInfo).parameters;
urlLoader = new Loader();
urlLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadFinished);
urlLoader.load(new URLRequest(((gameParams.mjPath) || ("http://static.mindjolt.com/api/as3/api_as3_local.swf"))));
this.addChild(urlLoader);
};
MochiServices.connect(gameID, mother, onConnectError);
MochiAd.showPreGameAd({clip:mother, id:gameID, res:"640x520"});
addEventListener(Event.ADDED_TO_STAGE, hAdd);
}
private function hAdd(_arg1:Event):void{
var PoszkoleAPI_Loader:Loader;
var parameters:Object;
var PoszkoleAPI_loadComplete:Function;
var e = _arg1;
PoszkoleAPI_loadComplete = function (_arg1:Event):void{
PoszkoleAPI = _arg1.currentTarget.content;
};
Security.allowDomain("poszkole.pl");
PoszkoleAPI_Loader = new Loader();
parameters = LoaderInfo(root.loaderInfo).parameters;
PoszkoleAPI_Loader.contentLoaderInfo.addEventListener(Event.COMPLETE, PoszkoleAPI_loadComplete);
PoszkoleAPI_Loader.load(new URLRequest("http://poszkole.pl/poszkoleAPI_AS3.swf"));
this.addChild(PoszkoleAPI_Loader);
}
public function hNothing():void{
}
public function checkMenu(_arg1):void{
var _local2:String;
_local2 = LoaderInfo(mother.loaderInfo).url;
if (_local2.indexOf("gamebrew.com") > -1){
_arg1.visible = false;
} else {
if (_local2.indexOf("mindjolt.com") > -1){
_arg1.visible = false;
} else {
if (_local2.indexOf("thisarcade.com") > -1){
_arg1.visible = false;
} else {
if (_local2.indexOf("poszkole.pl") > -1){
_arg1.visible = false;
} else {
_arg1.visible = true;
};
};
};
};
}
function postMindJoltAPIConnect(_arg1:Boolean){
trace("[MindJoltAPI] service successfully loaded");
}
public function showScore():void{
MochiScores.showLeaderboard({boardID:boardID, onClose:hNothing});
}
public function hSubmit(_arg1:Number):void{
var _local2:String;
var _local3:Number;
_local2 = LoaderInfo(mother.loaderInfo).url;
_local3 = Math.floor(_arg1);
if (_local2.indexOf("gamebrew.com") > -1){
MindJoltAPI.service.submitScore(_local3);
hMenu();
} else {
if (_local2.indexOf("mindjolt.com") > -1){
MindJoltAPI.service.submitScore(_local3);
hMenu();
} else {
if (_local2.indexOf("thisarcade.com") > -1){
MindJoltAPI.service.submitScore(_local3);
hMenu();
} else {
if (_local2.indexOf("poszkole.pl") > -1){
PoszkoleAPI.submitScore("953df6117bcd28918699ebc0d9f70036", _local3);
hMenu();
} else {
MochiScores.showLeaderboard({boardID:boardID, score:_local3, onClose:hMenu});
};
};
};
};
}
public function onConnectError(_arg1:String):void{
trace("error :(");
}
public function hMenu():void{
dispatchEvent(new ButtonEvent("endSaveScore", new Object()));
}
}
}//package controler
Section 22
//Button1 (controler.Button1)
package controler {
import flash.display.*;
import flash.events.*;
public class Button1 extends MovieClip {
public var clip:MovieClip;
private var mother:Object;
public function Button1(_arg1:MovieClip, _arg2:Object):void{
clip = _arg1;
clip.stop();
mother = _arg2;
clip.addEventListener(MouseEvent.CLICK, hClick);
clip.addEventListener(MouseEvent.ROLL_OUT, hRollOut);
clip.addEventListener(MouseEvent.ROLL_OVER, hRoll);
clip.buttonMode = true;
clip.mouseChildren = false;
}
private function hClick(_arg1:MouseEvent):void{
mother.hClick(_arg1);
}
public function destroy():void{
clip.removeEventListener(MouseEvent.CLICK, hClick);
clip.removeEventListener(MouseEvent.ROLL_OUT, hRollOut);
clip.removeEventListener(MouseEvent.ROLL_OVER, hRoll);
}
private function hRoll(_arg1:MouseEvent):void{
clip.gotoAndStop(2);
}
private function hRollOut(_arg1:MouseEvent):void{
clip.gotoAndStop(1);
}
}
}//package controler
Section 23
//KeyObject (controler.KeyObject)
package controler {
import flash.display.*;
import flash.events.*;
public class KeyObject extends MovieClip {
private var object:Object;
public function KeyObject():void{
object = new Object();
super();
object.left = false;
object.right = false;
object.up = false;
object.down = false;
addEventListener(Event.ADDED_TO_STAGE, hAdd);
}
private function hUp(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case 37:
object.left = false;
break;
case 38:
object.up = false;
break;
case 39:
object.right = false;
break;
case 40:
object.down = false;
break;
};
}
private function hAdd(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, hAdd);
stage.addEventListener(KeyboardEvent.KEY_DOWN, hDown);
stage.addEventListener(KeyboardEvent.KEY_UP, hUp);
}
private function hDown(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case 37:
object.left = true;
break;
case 38:
object.up = true;
break;
case 39:
object.right = true;
break;
case 40:
object.down = true;
break;
};
}
public function getKeys():Object{
return (object);
}
}
}//package controler
Section 24
//Level (controler.Level)
package controler {
import flash.display.*;
import flash.events.*;
import controler.events.*;
import view.*;
import controler.objects.*;
import model.*;
import controler.objects.cars.*;
import view.cars.*;
public class Level extends MovieClip {
private var points:int;
private var gameUI:MovieClip;
private var lives:int;// = 9
private var sites:uint;
private var stages:Array;
private var levelArray:Array;
private var key:Object;
public var map:MovieClip;
private var siteArray:Array;
private var ko:KeyObject;
private var activeSite:uint;
public var language:String;
private var ld:LevelData;
public var level:uint;// = 0
private var veh:Vehicle;
private var frames:uint;// = 0
private var parkArray:Array;
private var mc_car:Car;
private var time:int;// = 0
private var caption:Caption;
private var crashArray:Array;
public function Level(_arg1):void{
key = new Object();
level = 0;
stages = new Array(McStage1, McStage2, McStage3, McStage4, McStage5, McStage6, McStage7, McStage8, McStage9, McStage10);
frames = 0;
time = 0;
lives = 9;
super();
gameUI = new GameInterface();
gameUI.addEventListener(ButtonEvent.BACK, hBackToMenu);
this.language = _arg1;
setLanguage(_arg1);
createStage();
}
public function destroy():void{
var _local1:uint;
var _local2:DisplayObject;
_local1 = 0;
while (_local1 < numChildren) {
_local2 = getChildAt(_local1);
if (_local2){
removeChild(getChildAt(_local1));
_local1--;
};
_local1++;
};
}
private function checkPark():void{
var _local1:uint;
var _local2:uint;
_local1 = 0;
_local2 = 0;
while (_local2 < 4) {
if (siteArray[activeSite].hitTestObject(parkArray[_local2])){
_local1++;
};
_local2++;
};
if (_local1 == 4){
park();
};
}
private function newCar(_arg1:Boolean):void{
if (_arg1 == false){
removeChild(mc_car);
} else {
crashArray.push(mc_car);
};
if (mc_car){
mc_car.destroy();
};
mc_car = null;
mc_car = getCarClass(levelArray[activeSite].type);
mc_car.startEngine();
mc_car.x = ld.getX(activeSite);
mc_car.y = ld.getY(activeSite);
parkArray = new Array(mc_car.mc_park1, mc_car.mc_park2, mc_car.mc_park3, mc_car.mc_park4, mc_car.mc_park5, mc_car.mc_park6, mc_car.mc_park7, mc_car.mc_park8, mc_car.mc_park9, mc_car.mc_park10);
addChild(mc_car);
addChild(gameUI);
veh = null;
veh = getVehClass(levelArray[activeSite].type);
veh.setSpeed(levelArray[activeSite].speed);
veh.rotation = ld.getRotation(activeSite);
}
private function gameOver():void{
var _local1:String;
_local1 = ((language == "en")) ? "GAME OVER" : "KONIEC GRY";
caption = null;
caption = new Caption(_local1, "game_over");
caption.addEventListener(ObjectEvent.CLOSE, hCloseCaption);
addChild(caption);
removeEventListener(Event.ENTER_FRAME, hFrame);
}
public function newStage():void{
clearStage();
if (level < 9){
level++;
createStage();
} else {
completeGame();
};
}
public function createStage():void{
var _local1:uint;
var _local2:String;
gameUI.setCars(lives);
frames = 0;
map = new (stages[level]);
ld = new LevelData(level);
levelArray = ld.getData();
time = ld.time;
addChild(map);
crashArray = new Array();
_local1 = 0;
while (_local1 < map.numChildren) {
if ((((map.getChildAt(_local1) is CrashObject)) || ((map.getChildAt(_local1) is Car)))){
crashArray.push(map.getChildAt(_local1));
};
_local1++;
};
sites = levelArray.length;
activeSite = 0;
siteArray = new Array();
_local1 = 0;
while (_local1 < sites) {
siteArray[_local1] = map[("park" + _local1)];
if (_local1 == 0){
siteArray[_local1].visible = true;
} else {
siteArray[_local1].visible = false;
};
_local1++;
};
if (mc_car){
mc_car.destroy();
};
mc_car = null;
mc_car = getCarClass(levelArray[activeSite].type);
mc_car.startEngine();
mc_car.x = ld.getX(activeSite);
mc_car.y = ld.getY(activeSite);
parkArray = new Array(mc_car.mc_park1, mc_car.mc_park2, mc_car.mc_park3, mc_car.mc_park4, mc_car.mc_park5, mc_car.mc_park6, mc_car.mc_park7, mc_car.mc_park8, mc_car.mc_park9, mc_car.mc_park10);
veh = getVehClass(levelArray[activeSite].type);
veh.setSpeed(levelArray[activeSite].speed);
veh.rotation = ld.getRotation(activeSite);
ko = new KeyObject();
addEventListener(Event.ENTER_FRAME, hFrame);
caption = null;
_local2 = ((language == "en")) ? "LEVEL " : "POZIOM ";
trace(language);
caption = new Caption((_local2 + (level + 1).toString()), "level");
caption.addEventListener(ObjectEvent.CLOSE, hCloseCaption);
addChild(mc_car);
addChild(ko);
addChild(gameUI);
addChild(caption);
}
private function hCloseCaption(_arg1:ObjectEvent):void{
if (getChildByName(caption.name)){
removeChild(caption);
};
switch (_arg1.params.type){
case "crash":
time = (time + 10);
newCar(false);
addEventListener(Event.ENTER_FRAME, hFrame);
break;
case "stage_complete":
newStage();
break;
case "game_over":
clearStage();
gameUI.destroy();
removeChildFrom(gameUI);
gameUI.removeEventListener(ButtonEvent.BACK, hBackToMenu);
removeChild(gameUI);
gameUI = null;
dispatchEvent(new ScoresEvent("submitScores", {scores:points}));
break;
};
}
private function checkColision():void{
var _local1:Boolean;
var _local2:uint;
var _local3:uint;
_local1 = false;
_local2 = 0;
while (_local2 < crashArray.length) {
if ((crashArray[_local2] is Car)){
_local3 = 0;
while (_local3 < parkArray.length) {
if (parkArray[_local3].hitTestObject(crashArray[_local2].mc_crash)){
crashArray[_local2].crash();
veh.crash();
mc_car.crash();
_local1 = true;
break;
};
_local3++;
};
} else {
if (mc_car.mc_crash.hitTestObject(crashArray[_local2])){
_local3 = 0;
while (_local3 < parkArray.length) {
if (parkArray[_local3].hitTestObject(crashArray[_local2])){
veh.crash();
mc_car.crash();
_local1 = true;
break;
};
_local3++;
};
};
};
if (_local1){
break;
};
_local2++;
};
if (_local1){
looseLife(true);
};
}
public function clearStage():void{
var _local1:uint;
var _local2:DisplayObject;
removeChild(mc_car);
if (mc_car){
mc_car.destroy();
};
mc_car = null;
_local1 = 0;
while (_local1 < crashArray.length) {
if (getChildByName(crashArray[_local1].name)){
removeChild(crashArray[_local1]);
crashArray[_local1] = null;
};
_local1++;
};
crashArray = new Array();
_local1 = 0;
while (_local1 < map.numChildren) {
_local2 = map.getChildAt(_local1);
if (_local2){
map.removeChild(map.getChildAt(_local1));
_local1--;
};
_local1++;
};
removeChild(map);
map = null;
}
private function looseLife(_arg1:Boolean):void{
var _local2:String;
lives--;
if (lives < 0){
gameOver();
} else {
gameUI.setCars(lives);
_local2 = "";
if (_arg1 == true){
_local2 = ((language == "en")) ? "CAR CRASHED" : "SAMOCHÓD ZNISZCZONY";
} else {
_local2 = ((language == "en")) ? "END OF TIME" : "KONIEC CZASU";
};
caption = null;
caption = new Caption(_local2, "crash");
caption.addEventListener(ObjectEvent.CLOSE, hCloseCaption);
addChild(caption);
removeEventListener(Event.ENTER_FRAME, hFrame);
};
}
private function removeChildFrom(_arg1:Object):void{
var _local2:uint;
var _local3:DisplayObject;
_local2 = 0;
while (_local2 < _arg1.numChildren) {
_local3 = _arg1.getChildAt(_local2);
if (_local3){
_arg1.removeChild(_arg1.getChildAt(_local2));
_local2--;
};
_local2++;
};
}
public function removeFromArray(_arg1:Array, _arg2:uint):Array{
var _local3:Array;
var _local4:uint;
_local3 = new Array();
_local4 = 0;
while (_local4 < _arg1.length) {
if (_local4 < _arg2){
_local3[_local4] = _arg1[_local4];
};
if (_local4 > _arg2){
_local3[(_local4 - 1)] = _arg1[_local4];
};
_local4++;
};
return (_local3);
}
private function hBackToMenu(_arg1:ButtonEvent):void{
gameOver();
}
private function getCarClass(_arg1:String):Car{
switch (_arg1){
case "mazda":
return (new Mazda());
case "mini":
return (new Mini());
case "suv":
return (new Suv());
case "merc":
return (new Merc());
case "lexus":
return (new Lexus());
};
return (null);
}
private function completeGame():void{
gameUI.destroy();
removeChildFrom(gameUI);
gameUI.removeEventListener(ButtonEvent.BACK, hBackToMenu);
removeChild(gameUI);
gameUI = null;
dispatchEvent(new ScoresEvent("submitScores", {scores:points}));
}
public function setLanguage(_arg1:String):void{
this.language = _arg1;
gameUI.setLanguage(_arg1);
}
private function hFrame(_arg1:Event):void{
key = ko.getKeys();
if (key.up == true){
veh.accelerate();
};
if (key.down == true){
veh.brake();
};
if ((((key.down == false)) && ((key.up == false)))){
veh.idle();
};
if ((((key.left == true)) && ((key.right == false)))){
veh.ster("left");
};
if ((((key.right == true)) && ((key.left == false)))){
veh.ster("right");
};
if ((((key.right == false)) && ((key.left == false)))){
veh.ster("zero");
};
veh.move();
mc_car.move(veh.xSpeed, veh.ySpeed, veh.rotation);
checkColision();
if (veh.getSpeed() == 0){
checkPark();
};
gameUI.setSpeed(Math.abs(Math.floor((veh.getSpeed() * 10))));
frames++;
if ((frames % 25) == 0){
if (time > 60){
time = 60;
};
time--;
gameUI.setTime(time);
if (time <= 0){
time = 0;
looseLife(false);
};
};
}
private function getVehClass(_arg1:String):Vehicle{
switch (_arg1){
case "mazda":
return (new VehMazda());
case "mini":
return (new VehMini());
case "suv":
return (new VehSuv());
case "merc":
return (new VehMerc());
case "lexus":
return (new VehLexus());
};
return (null);
}
public function park():void{
siteArray[activeSite].visible = false;
activeSite++;
points = (points + time);
gameUI.setPoints(points);
if (activeSite < sites){
time = (time + 5);
newCar(true);
siteArray[activeSite].visible = true;
caption = null;
caption = new Caption(((activeSite.toString() + "/") + sites.toString()), "park");
caption.addEventListener(ObjectEvent.CLOSE, hCloseCaption);
addChild(caption);
} else {
caption = null;
caption = new Caption(((activeSite.toString() + "/") + sites.toString()), "stage_complete");
caption.addEventListener(ObjectEvent.CLOSE, hCloseCaption);
addChild(caption);
removeEventListener(Event.ENTER_FRAME, hFrame);
};
}
}
}//package controler
Section 25
//Logo (controler.Logo)
package controler {
import flash.events.*;
import mochi.as3.*;
public class Logo extends McLogo {
private var YOUR_BUTTON_REFERENCE;
public function Logo():void{
YOUR_BUTTON_REFERENCE = this;
super();
buttonMode = true;
addEventListener(Event.ADDED_TO_STAGE, hAdd);
}
private function hAdd(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, hAdd);
MochiServices.addLinkEvent("http://x.mochiads.com/link/ee2da1e7a3f6985c", "www.nobagames.com", YOUR_BUTTON_REFERENCE);
}
}
}//package controler
Section 26
//Logo2 (controler.Logo2)
package controler {
import flash.events.*;
import flash.net.*;
import flash.system.*;
public class Logo2 extends McLogo2 {
public var mochiTrackedURL:String;
public function Logo2(_arg1:String):void{
mochiTrackedURL = _arg1;
buttonMode = true;
bigBtn.addEventListener(MouseEvent.CLICK, gotoLink);
}
public function gotoLink(_arg1:MouseEvent){
var vars:URLVariables;
var req:URLRequest;
var evt = _arg1;
vars = new URLVariables();
vars["mav"] = Capabilities.version;
vars["swfv"] = "9";
vars["swfurl"] = bigBtn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
req = new URLRequest(mochiTrackedURL);
req.data = vars;
try {
navigateToURL(req, "_blank");
} catch(e:Error) {
};
}
}
}//package controler
Section 27
//MyMenu (controler.MyMenu)
package controler {
import flash.display.*;
import flash.events.*;
import controler.events.*;
import view.popups.*;
import com.*;
public class MyMenu extends MovieClip {
public var b4:MyButton;
public var popInstr:PopInstructions;
public var btn_play:MovieClip;
public var clip:MovieClip;
public var language:String;
public var btn_instr:MovieClip;
public var btn_scores:MovieClip;
public var mc_popup:MovieClip;
public var mc_language:MovieClip;
public function MyMenu():void{
clip = new McMenu();
addEventListener(Event.ADDED_TO_STAGE, hAdd);
}
public function hClick(_arg1:MouseEvent):void{
switch (_arg1.target){
case btn_play:
remove();
dispatchEvent(new ButtonEvent("newGame", new Object()));
break;
case btn_scores:
dispatchEvent(new ScoresEvent("showScores", new Object()));
break;
case btn_instr:
popInstr.show();
break;
case mc_language:
language = ((language == "pl")) ? "en" : "pl";
setLanguage(language);
dispatchEvent(new LanguageEvent(language));
break;
default:
break;
};
}
private function hRollOut(_arg1:MouseEvent):void{
if (_arg1.target.n1){
_arg1.target.n2.visible = false;
_arg1.target.n1.visible = true;
} else {
_arg1.target.gotoAndStop(1);
};
}
private function hAdd(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, hAdd);
addChild(clip);
btn_play = clip.btn_play;
btn_instr = clip.btn_instr;
btn_scores = clip.btn_scores;
mc_language = clip.mc_language;
mc_popup = clip.mc_popup;
popInstr = new PopInstructions(mc_popup);
b4 = new MyButton(mc_language, this);
setLanguage(language);
btn(btn_play);
btn(btn_scores);
btn(btn_instr);
}
private function btn(_arg1:MovieClip):void{
_arg1.addEventListener(MouseEvent.CLICK, hClick);
_arg1.addEventListener(MouseEvent.ROLL_OVER, hRollOver);
_arg1.addEventListener(MouseEvent.ROLL_OUT, hRollOut);
_arg1.buttonMode = true;
_arg1.mouseChildren = false;
if (_arg1.n2){
_arg1.n2.visible = false;
};
}
private function remove():void{
b4.destroy();
b4 = null;
btn_scores.removeEventListener(MouseEvent.CLICK, hClick);
btn_instr.removeEventListener(MouseEvent.CLICK, hClick);
btn_play.removeEventListener(MouseEvent.CLICK, hClick);
}
private function hRollOver(_arg1:MouseEvent):void{
if (_arg1.target.n1){
_arg1.target.n1.visible = false;
_arg1.target.n2.visible = true;
} else {
_arg1.target.gotoAndStop(2);
};
}
public function setLanguage(_arg1:String):void{
if (btn_instr){
mc_language.n1.gotoAndStop(_arg1);
btn_play.n1.gotoAndStop(_arg1);
btn_play.n2.gotoAndStop(_arg1);
btn_instr.n1.gotoAndStop(_arg1);
btn_scores.n1.gotoAndStop(_arg1);
btn_instr.n2.gotoAndStop(_arg1);
btn_scores.n2.gotoAndStop(_arg1);
mc_popup.gotoAndStop(_arg1);
};
}
}
}//package controler
Section 28
//MochiAd (mochi.as3.MochiAd)
package mochi.as3 {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showClickAwayAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType == "application"){
return (_local2);
};
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!(clip is DisplayObject)){
trace("Warning: Object passed as container clip not a descendant of the DisplayObject type");
return (null);
};
if (MovieClip(clip).stage == null){
trace("Warning: Container clip for ad is not attached to the stage");
return (null);
};
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
} else {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime()));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:IOErrorEvent):void{
trace("[MochiAds] Blocked URL");
});
if (!options.skip){
loader.load(req);
};
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array;
var _local4:Number;
_local3 = _arg2.split(".");
_local4 = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + _arg3.id));
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_w:Number;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var progress:Number;
var f:Function;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}, progress_override:function (_arg1:Object):Number{
return (NaN);
}, bar_offset:0};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
if (options.skip){
ad_timeout = 0;
};
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = (10 + options.bar_offset);
bar.y = (h - 20);
};
bar_w = ((w - bar.x) - 10);
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo(bar_w, 0);
backing.lineTo(bar_w, 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo(bar_w, 0);
inside.lineTo(bar_w, 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo(bar_w, 0);
outline.lineTo(bar_w, 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
progress = Math.min(1, options.progress_override(clip));
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
if (!isNaN(progress)){
complete = (progress == 1);
} else {
if (clip.loaderInfo.bytesLoaded == clip.loaderInfo.bytesTotal){
complete = true;
} else {
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
return (_arg1);
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Object;
var _local11:Number;
var _local12:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
_local7 = Math.min(1, options.progress_override(_local1));
if (_local7 == 1){
complete = true;
};
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local8 = ((100 * _local6) / _local5);
if (!isNaN(_local7)){
_local8 = (100 * _local7);
};
_local9 = ((100 * _local3) / chk.ad_msec);
_local10 = this._mochiad_bar._inside;
_local11 = Math.min(100, Math.min(((_local8) || (0)), _local9));
_local11 = Math.max(this.last_pcnt, _local11);
this.last_pcnt = _local11;
_local10.scaleX = (_local11 * 0.01);
options.ad_progress(_local11);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local8});
if (_local8 >= 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local12 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local12 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local8 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (unloaded){
MochiAd.unload(_local1);
} else {
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package mochi.as3
Section 29
//MochiCoins (mochi.as3.MochiCoins)
package mochi.as3 {
public class MochiCoins {
public static const STORE_HIDE:String = "StoreHide";
public static const NO_USER:String = "NoUser";
public static const IO_ERROR:String = "IOError";
public static const ITEM_NEW:String = "ItemNew";
public static const ITEM_OWNED:String = "ItemOwned";
public static const STORE_ITEMS:String = "StoreItems";
public static const ERROR:String = "Error";
public static const STORE_SHOW:String = "StoreShow";
public static var _inventory:MochiInventory;
public static function triggerEvent(_arg1:String, _arg2:Object):void{
MochiSocial.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
MochiSocial.removeEventListener(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
MochiSocial.addEventListener(_arg1, _arg2);
}
public static function getStoreItems():void{
MochiServices.send("coins_getStoreItems");
}
public static function get inventory():MochiInventory{
return (_inventory);
}
public static function showStore(_arg1:Object=null):void{
MochiServices.bringToTop();
MochiServices.send("coins_showStore", {options:_arg1}, null, null);
}
public static function showItem(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showItem call must pass an Object with an item key");
return;
};
MochiServices.bringToTop();
MochiServices.send("coins_showItem", {options:_arg1}, null, null);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showVideo(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showVideo call must pass an Object with an item key");
return;
};
MochiServices.bringToTop();
MochiServices.send("coins_showVideo", {options:_arg1}, null, null);
}
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_inventory = new MochiInventory();
});
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_inventory = null;
});
}
}//package mochi.as3
Section 30
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Sibling:MochiDigits;
private var Fragment:Number;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function reencode():void{
var _local1:uint;
_local1 = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function toString():String{
var _local1:String;
_local1 = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
public function get value():Number{
return (Number(this.toString()));
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String;
_local3 = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
Fragment = (_local3.charCodeAt(_temp1) ^ Encoder);
if (_arg2 < _local3.length){
Sibling = new MochiDigits(_arg1, _arg2);
} else {
Sibling = null;
};
reencode();
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
}
}//package mochi.as3
Section 31
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher)
package mochi.as3 {
public class MochiEventDispatcher {
private var eventTable:Object;
public function MochiEventDispatcher():void{
eventTable = {};
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
return;
};
for (_local3 in eventTable[_arg1]) {
var _local6 = eventTable[_arg1];
_local6[_local3](_arg2);
};
}
public function removeEventListener(_arg1:String, _arg2:Function):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
eventTable[_arg1] = [];
return;
};
for (_local3 in eventTable[_arg1]) {
if (eventTable[_arg1][_local3] != _arg2){
} else {
eventTable[_arg1].splice(Number(_local3), 1);
};
};
}
public function addEventListener(_arg1:String, _arg2:Function):void{
removeEventListener(_arg1, _arg2);
eventTable[_arg1].push(_arg2);
}
}
}//package mochi.as3
Section 32
//MochiEvents (mochi.as3.MochiEvents)
package mochi.as3 {
import flash.display.*;
public class MochiEvents {
public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL";
public static const FORMAT_LONG:String = "LongForm";
public static const ALIGN_BOTTOM:String = "ALIGN_B";
public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived";
public static const FORMAT_SHORT:String = "ShortForm";
public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR";
public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR";
public static const ALIGN_TOP:String = "ALIGN_T";
public static const ALIGN_LEFT:String = "ALIGN_L";
public static const ALIGN_RIGHT:String = "ALIGN_R";
public static const ALIGN_TOP_LEFT:String = "ALIGN_TL";
public static const ALIGN_CENTER:String = "ALIGN_C";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
private static var gameStart:Number;
private static var levelStart:Number;
public static function endPlay():void{
MochiServices.send("events_clearRoundID", null, null, null);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function trackEvent(_arg1:String, _arg2=null):void{
MochiServices.send("events_trackEvent", {tag:_arg1, value:_arg2}, null, null);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function startSession(_arg1:String):void{
MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function setNotifications(_arg1:MovieClip, _arg2:Object):void{
var _local3:Object;
var _local4:Object;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
_local3.clip = _arg1;
MochiServices.send("events_setNotifications", _local3, null, null);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function startPlay(_arg1:String="gameplay"):void{
MochiServices.send("events_setRoundID", {tag:String(_arg1)}, null, null);
}
}
}//package mochi.as3
Section 33
//MochiInventory (mochi.as3.MochiInventory)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
public dynamic class MochiInventory extends Proxy {
private var _timer:Timer;
private var _names:Array;
private var _consumableProperties:Object;
private var _syncID:Number;
private var _storeSync:Object;
private var _outstandingID:Number;
private var _syncPending:Boolean;
public static const READY:String = "InvReady";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IoError";
private static const KEY_SALT:String = " syncMaint";
public static const WRITTEN:String = "InvWritten";
public static const NOT_READY:String = "InvNotReady";
public static const VALUE_ERROR:String = "InvValueError";
private static const CONSUMER_KEY:String = "MochiConsumables";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public function MochiInventory():void{
MochiCoins.addEventListener(MochiCoins.ITEM_OWNED, itemOwned);
MochiCoins.addEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, loggedOut);
_storeSync = new Object();
_syncPending = false;
_outstandingID = 0;
_syncID = 0;
_timer = new Timer(1000);
_timer.addEventListener(TimerEvent.TIMER, sync);
_timer.start();
if (MochiSocial.loggedIn){
loggedIn();
} else {
loggedOut();
};
}
private function newItems(_arg1:Object):void{
if (!this[(_arg1.id + KEY_SALT)]){
this[(_arg1.id + KEY_SALT)] = 0;
};
if (!this[_arg1.id]){
this[_arg1.id] = 0;
};
this[(_arg1.id + KEY_SALT)] = (this[(_arg1.id + KEY_SALT)] + _arg1.count);
this[_arg1.id] = (this[_arg1.id] + _arg1.count);
if (_arg1.privateProperties.consumable){
if (!this[_arg1.privateProperties.tag]){
this[_arg1.privateProperties.tag] = 0;
};
this[_arg1.privateProperties.tag] = (this[_arg1.privateProperties.tag] + (_arg1.privateProperties.inc * _arg1.count));
};
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (-1);
};
if (_consumableProperties[_arg1]){
return (MochiDigits(_consumableProperties[_arg1]).value);
};
return (undefined);
}
public function release():void{
MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, loggedOut);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (false);
};
if (_consumableProperties[_arg1] == undefined){
return (false);
};
return (true);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
return (((_arg1)>=_names.length) ? 0 : (_arg1 + 1));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:MochiDigits;
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return;
};
if (!(_arg2 is Number)){
triggerEvent(ERROR, {type:VALUE_ERROR, error:"Invalid type", arg:_arg2});
return;
};
if (_consumableProperties[_arg1]){
_local3 = MochiDigits(_consumableProperties[_arg1]);
if (_local3.value == _arg2){
return;
};
_local3.value = _arg2;
} else {
_names.push(_arg1);
_consumableProperties[_arg1] = new MochiDigits(_arg2);
};
_syncID++;
}
private function sync(_arg1:Event=null):void{
var _local2:Object;
var _local3:String;
if (((_syncPending) || ((_syncID == _outstandingID)))){
return;
};
_outstandingID = _syncID;
_local2 = {};
for (_local3 in _consumableProperties) {
_local2[_local3] = MochiDigits(_consumableProperties[_local3]).value;
};
MochiUserData.put(CONSUMER_KEY, _local2, putConsumableBag);
_syncPending = true;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return (_names[(_arg1 - 1)]);
}
private function loggedIn(_arg1:Object=null):void{
MochiUserData.get(CONSUMER_KEY, getConsumableBag);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{
if (!_consumableProperties[_arg1]){
return (false);
};
_names.splice(_names.indexOf(_arg1), 1);
delete _consumableProperties[_arg1];
return (true);
}
private function itemOwned(_arg1:Object):void{
_storeSync[_arg1.id] = {properties:_arg1.properties, count:_arg1.count};
}
private function putConsumableBag(_arg1:MochiUserData):void{
_syncPending = false;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
_outstandingID = -1;
};
triggerEvent(WRITTEN, {});
}
private function getConsumableBag(_arg1:MochiUserData):void{
var _local2:String;
var _local3:Number;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
return;
};
_consumableProperties = {};
_names = new Array();
if (_arg1.data){
for (_local2 in _arg1.data) {
_names.push(_local2);
_consumableProperties[_local2] = new MochiDigits(_arg1.data[_local2]);
};
};
for (_local2 in _storeSync) {
_local3 = _storeSync[_local2].count;
if (_consumableProperties[(_local2 + KEY_SALT)]){
_local3 = (_local3 - _consumableProperties[_local2]);
};
if (_local3 == 0){
} else {
newItems({id:_local2, count:_local3, properties:_storeSync[_local2].properties});
};
};
triggerEvent(READY, {});
}
private function loggedOut(_arg1:Object=null):void{
_consumableProperties = null;
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
}
}//package mochi.as3
Section 34
//MochiScores (mochi.as3.MochiScores)
package mochi.as3 {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var n:Number;
var options = _arg1;
if (options != null){
delete options.clip;
MochiServices.setContainer();
MochiServices.bringToTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
} else {
if ((options.score is MochiDigits)){
options.score = options.score.value;
};
};
n = Number(options.score);
if (isNaN(n)){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(n) != n){
trace((("WARNING: Submitted score '" + options.score) + "' will be truncated"));
};
options.score = n;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.warnID(options.boardID, true);
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local2:Object;
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
_local2 = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
_arg1 = Number(_arg1);
if (isNaN(_arg1)){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((_arg1 == Number.NEGATIVE_INFINITY)) || ((_arg1 == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(_arg1) != _arg1){
trace((("WARNING: Submitted score '" + String(_arg1)) + "' will be truncated"));
};
_arg1 = Number(_arg1);
};
};
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (((((_arg1) && ((_arg1.error == true)))) && (onErrorHandler))){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiServices.warnID(_arg1, true);
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi.as3
Section 35
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
import flash.geom.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _queue:Array;
private static var _swfVersion:String;
private static var _preserved:Object;
public static var netupAttempted:Boolean = false;
private static var _sendChannel:LocalConnection;
public static var servicesSync:MochiSync = new MochiSync();
private static var _nextCallbackID:Number;
private static var _clip:MovieClip;
private static var _id:String;
private static var _services:String = "services.swf";
private static var _servURL:String = "http://www.mochiads.com/static/lib/services/";
public static var widget:Boolean = false;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _loader:Loader;
private static var _callbacks:Object;
private static var _connecting:Boolean = false;
private static var _mochiLocalConnection:MovieClip;
private static var _listenChannelName:String = "__ms_";
public static var onError:Object;
public static var netup:Boolean = true;
private static var _mochiLC:String = "MochiLC.swf";
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function get connected():Boolean{
return (_connected);
}
private static function onReceive(_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = _callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete _callbacks[cb];
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_nextCallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + _arg1));
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_queue.push({methodName:_arg1, args:_arg2, callbackID:_nextCallbackID});
};
if (_clip != null){
if (_callbacks != null){
_callbacks[_nextCallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_nextCallbackID++;
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local3:Array;
var _local4:int;
var _local5:Array;
var _local6:Array;
var _local7:MovieClip;
var _local8:LocalConnection;
var _local9:String;
var _local10:ByteArray;
var _local11:ByteArray;
var _local12:uint;
var _local13:uint;
var _local14:Loader;
_local3 = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23];
_local5 = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
_local6 = [0, 64, 0, 0, 0];
_local7 = new MovieClip();
_local8 = new LocalConnection();
_local9 = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().time));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
_local10 = new ByteArray();
_local11 = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
_local12 = ((_local3.length + _local11.length) + 4);
_local13 = (_local12 + 35);
_local10.endian = Endian.LITTLE_ENDIAN;
_local10.writeUTFBytes("FWS");
_local10.writeByte(8);
_local10.writeUnsignedInt(_local13);
for each (_local4 in _local5) {
_local10.writeByte(_local4);
};
_local10.writeUnsignedInt(_local12);
_local10.writeByte(136);
_local10.writeShort(_local11.length);
_local10.writeBytes(_local11);
for each (_local4 in _local3) {
_local10.writeByte(_local4);
};
for each (_local4 in _local6) {
_local10.writeByte(_local4);
};
_local14 = new Loader();
_local14.loadBytes(_local10);
_local7.addChild(_local14);
return (_local7);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var vars:Object;
var avm1Click:DisplayObject;
var s:String;
var i:Number;
var x:String;
var req:URLRequest;
var loader:Loader;
var setURL:Function;
var err:Function;
var complete:Function;
var url = _arg1;
var burl = _arg2;
var btn = _arg3;
var onClick = _arg4;
vars = new Object();
vars["mav"] = getVersion();
vars["swfv"] = "9";
vars["swfurl"] = btn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
s = "?";
i = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://x.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
var _local2:Rectangle;
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
_local2 = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = _local2.x;
avm1Click.y = _local2.y;
avm1Click.scaleX = (0.01 * _local2.width);
avm1Click.scaleY = (0.01 * _local2.height);
};
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
setURL(burl);
};
complete = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_mochiLocalConnection.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function getVersion():String{
return ("3.8 as3");
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
}
public static function warnID(_arg1:String, _arg2:Boolean):void{
var _local3:Number;
_arg1 = _arg1.toLowerCase();
if (_arg1.length != 16){
trace((("WARNING: " + (_arg2) ? "board" : "game") + " ID is not the appropriate length"));
return;
} else {
if (_arg1 == "1e113c7239048b3f"){
if (_arg2){
trace("WARNING: Using testing board ID");
} else {
trace("WARNING: Using testing board ID as game ID");
};
return;
} else {
if (_arg1 == "84993a1de4031cd8"){
if (_arg2){
trace("WARNING: Using testing game ID as board ID");
} else {
trace("WARNING: Using testing game ID");
};
return;
};
};
};
_local3 = 0;
while (_local3 < _arg1.length) {
switch (_arg1.charAt(_local3)){
case "0":
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
case "a":
case "b":
case "c":
case "d":
case "e":
case "f":
break;
default:
trace(("WARNING: Board ID contains illegal characters: " + _arg1));
return;
};
_local3++;
};
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (((_clip) && (_queue))){
while (_queue.length > 0) {
_local2 = _queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _callbacks[_local2.callbackID];
};
delete _callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
}
public static function get id():String{
return (_id);
}
private static function onEvent(_arg1:Object):void{
var _local2:String;
var _local3:String;
_local2 = _arg1.target;
_local3 = _arg1.event;
switch (_local2){
case "events":
MochiEvents.triggerEvent(_arg1.event, _arg1.args);
break;
case "coins":
MochiCoins.triggerEvent(_arg1.event, _arg1.args);
break;
case "sync":
servicesSync.triggerEvent(_arg1.event, _arg1.args);
break;
};
}
private static function urlOptions(_arg1:Object):Object{
var _local2:Object;
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
_local2 = {};
if (_arg1.stage){
_local3 = _arg1.stage.loaderInfo.parameters.mochiad_options;
} else {
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
};
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_clip.parent){
_clip.parent.removeChild(_clip);
};
if (_arg1 != null){
if ((_arg1 is DisplayObjectContainer)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is DisplayObjectContainer)){
DisplayObjectContainer(_container).addChild(_clip);
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
private static function loadError(_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
}
private static function initComChannels():void{
if (!_connected){
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"registerGame", preserved:_preserved, id:_id, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_clip.onReceive = onReceive;
_clip.onEvent = onEvent;
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
while (_queue.length > 0) {
_mochiLocalConnection.send(_sendChannelName, "onReceive", _queue.shift());
};
};
}
private static function loadLCBridge(_arg1:Object):void{
var loader:Loader;
var mochiLCURL:String;
var req:URLRequest;
var complete:Function;
var clip = _arg1;
loader = new Loader();
mochiLCURL = (_servURL + _mochiLC);
req = new URLRequest(mochiLCURL);
complete = function (_arg1:Object):void{
_mochiLocalConnection = MovieClip(loader.content);
listen();
};
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
loader.load(req);
clip.addChild(loader);
}
private static function listen():void{
_mochiLocalConnection.connect(_listenChannelName);
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
trace("Waiting for MochiAds services to connect...");
}
public static function get clip():Object{
return (_container);
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var _local3:String;
var _local4:URLRequest;
var _local5:URLVariables;
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(_arg2).servURL){
_servURL = urlOptions(_arg2).servURL;
};
_local3 = (_servURL + _services);
if (urlOptions(_arg2).servicesURL){
_local3 = urlOptions(_arg2).servicesURL;
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().time) + "_") + Math.floor((Math.random() * 99999))));
MochiServices.allowDomains(_local3);
_clip = new MovieClip();
loadLCBridge(_clip);
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
_local4 = new URLRequest(_local3);
_local5 = new URLVariables();
_local5.listenLC = _listenChannelName;
_local5.mochiad_options = _arg2.loaderInfo.parameters.mochiad_options;
_local5.api_version = getVersion();
if (widget){
_local5.widget = true;
};
_local4.data = _local5;
_loader.load(_local4);
_clip.addChild(_loader);
_sendChannel = new LocalConnection();
_queue = [];
_nextCallbackID = 0;
_callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
warnID(id, false);
if ((clip is DisplayObject)){
if (clip.stage == null){
trace("MochiServices connect requires the containing clip be attached to the stage");
};
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function updateCopy(_arg1:Object):void{
MochiServices.send("coins_updateCopy", _arg1, null, null);
}
public static function bringToTop(_arg1:Event=null):void{
var e = _arg1;
if (((!((MochiServices.clip == null))) && (!((MochiServices.childClip == null))))){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
}
public static function connectWait(_arg1:TimerEvent):void{
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
}
}
}//package mochi.as3
Section 36
//MochiSocial (mochi.as3.MochiSocial)
package mochi.as3 {
public class MochiSocial {
public static const LOGGED_IN:String = "LoggedIn";
public static const PROFILE_HIDE:String = "ProfileHide";
public static const NO_USER:String = "NoUser";
public static const PROPERTIES_SIZE:String = "PropertiesSize";
public static const IO_ERROR:String = "IOError";
public static const PROPERTIES_SAVED:String = "PropertySaved";
public static const WIDGET_LOADED:String = "WidgetLoaded";
public static const USER_INFO:String = "UserInfo";
public static const ERROR:String = "Error";
public static const LOGIN_SHOW:String = "LoginShow";
public static const LOGGED_OUT:String = "LoggedOut";
public static const PROFILE_SHOW:String = "ProfileShow";
public static const LOGIN_SHOWN:String = "LoginShown";
public static const LOGIN_HIDE:String = "LoginHide";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static var _user_info:Object = null;
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function saveUserProperties(_arg1:Object):void{
MochiServices.send("coins_saveUserProperties", _arg1);
}
public static function get loggedIn():Boolean{
return (!((_user_info == null)));
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function getUserInfo():void{
MochiServices.send("coins_getUserInfo");
}
public static function showLoginWidget(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showLoginWidget", {options:_arg1});
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function requestLogin():void{
MochiServices.send("coins_requestLogin");
}
public static function getAPIURL():String{
if (!_user_info){
return (null);
};
return (_user_info.api_url);
}
public static function hideLoginWidget():void{
MochiServices.send("coins_hideLoginWidget");
}
public static function getAPIToken():String{
if (!_user_info){
return (null);
};
return (_user_info.api_token);
}
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_user_info = _arg1;
});
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_user_info = null;
});
}
}//package mochi.as3
Section 37
//MochiSync (mochi.as3.MochiSync)
package mochi.as3 {
import flash.utils.*;
public dynamic class MochiSync extends Proxy {
private var _syncContainer:Object;
public static var SYNC_PROPERTY:String = "UpdateProperty";
public static var SYNC_REQUEST:String = "SyncRequest";
public function MochiSync():void{
_syncContainer = {};
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
switch (_arg1){
case SYNC_REQUEST:
MochiServices.send("sync_syncronize", _syncContainer);
break;
case SYNC_PROPERTY:
_syncContainer[_arg2.name] = _arg2.value;
break;
};
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
return (_syncContainer[_arg1]);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:String;
if (_syncContainer[_arg1] == _arg2){
return;
};
_local3 = _arg1.toString();
_syncContainer[_local3] = _arg2;
MochiServices.send("sync_propUpdate", {name:_local3, value:_arg2});
}
}
}//package mochi.as3
Section 38
//MochiUserData (mochi.as3.MochiUserData)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
public class MochiUserData extends EventDispatcher {
public var callback:Function;// = null
public var error:Event;// = null
public var key:String;// = null
public var operation:String;// = null
public var data;// = null
public var _loader:URLLoader;
public function MochiUserData(_arg1:String="", _arg2:Function=null){
key = null;
data = null;
error = null;
operation = null;
callback = null;
super();
this.key = _arg1;
this.callback = _arg2;
}
public function securityErrorHandler(_arg1:SecurityErrorEvent):void{
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.toString())));
}
public function putEvent(_arg1):void{
request("put", serialize(_arg1));
}
public function request(_arg1:String, _arg2:ByteArray):void{
var api_url:String;
var api_token:String;
var args:URLVariables;
var req:URLRequest;
var _operation = _arg1;
var _data = _arg2;
operation = _operation;
api_url = MochiSocial.getAPIURL();
api_token = MochiSocial.getAPIToken();
if ((((api_url == null)) || ((api_token == null)))){
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, "not logged in"));
return;
};
_loader = new URLLoader();
args = new URLVariables();
args.op = _operation;
args.key = key;
req = new URLRequest((((MochiSocial.getAPIURL() + "/") + "MochiUserData?") + args.toString()));
req.method = URLRequestMethod.POST;
req.contentType = "application/x-mochi-userdata";
req.requestHeaders = [new URLRequestHeader("x-mochi-services-version", MochiServices.getVersion()), new URLRequestHeader("x-mochi-api-token", api_token)];
req.data = _data;
_loader.dataFormat = URLLoaderDataFormat.BINARY;
_loader.addEventListener(Event.COMPLETE, completeHandler);
_loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
try {
_loader.load(req);
} catch(e:SecurityError) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + e.toString())));
};
}
public function performCallback():void{
try {
callback(this);
} catch(e:Error) {
trace(("[MochiUserData] exception during callback: " + e));
};
}
public function serialize(_arg1):ByteArray{
var _local2:ByteArray;
_local2 = new ByteArray();
_local2.objectEncoding = ObjectEncoding.AMF3;
_local2.writeObject(_arg1);
_local2.compress();
return (_local2);
}
public function errorHandler(_arg1:IOErrorEvent):void{
data = null;
error = _arg1;
if (callback != null){
performCallback();
} else {
dispatchEvent(_arg1);
};
close();
}
public function completeHandler(_arg1:Event):void{
var event = _arg1;
try {
if (_loader.data.length){
data = deserialize(_loader.data);
} else {
data = null;
};
} catch(e:Error) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("deserialize error: " + e.toString())));
return;
};
if (callback != null){
performCallback();
} else {
dispatchEvent(event);
};
close();
}
public function getEvent():void{
request("get", serialize(null));
}
override public function toString():String{
return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]"));
}
public function close():void{
if (_loader){
_loader.removeEventListener(Event.COMPLETE, completeHandler);
_loader.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
_loader.close();
_loader = null;
};
error = null;
callback = null;
}
public function deserialize(_arg1:ByteArray){
_arg1.objectEncoding = ObjectEncoding.AMF3;
_arg1.uncompress();
return (_arg1.readObject());
}
public static function get(_arg1:String, _arg2:Function):void{
var _local3:MochiUserData;
_local3 = new MochiUserData(_arg1, _arg2);
_local3.getEvent();
}
public static function put(_arg1:String, _arg2, _arg3:Function):void{
var _local4:MochiUserData;
_local4 = new MochiUserData(_arg1, _arg3);
_local4.putEvent(_arg2);
}
}
}//package mochi.as3
Section 39
//LevelData (model.LevelData)
package model {
public class LevelData {
private var level:uint;
public var time:int;
public var array;
public var isLevel:Boolean;
public function LevelData(_arg1:uint):void{
array = new Array();
super();
this.level = _arg1;
}
public function getData():Array{
var _local1:Array;
isLevel = true;
array = new Array();
_local1 = new Array();
time = 60;
switch (level){
case 0:
array.push({type:"mini", speed:2, x:500, y:500, rotation:0});
array.push({type:"mini", speed:2, x:500, y:500, rotation:0});
array.push({type:"mazda", speed:2, x:500, y:500, rotation:0});
array.push({type:"mini", speed:2, x:500, y:500, rotation:0});
time = 60;
break;
case 1:
array.push({type:"mini", speed:2, x:500, y:500, rotation:0});
array.push({type:"mini", speed:2, x:500, y:500, rotation:0});
array.push({type:"mazda", speed:2, x:500, y:500, rotation:0});
array.push({type:"mazda", speed:2, x:500, y:500, rotation:0});
array.push({type:"mazda", speed:2, x:500, y:500, rotation:0});
array.push({type:"mazda", speed:2, x:500, y:500, rotation:0});
array.push({type:"mazda", speed:2, x:500, y:500, rotation:0});
time = 60;
break;
case 2:
array.push({type:"merc", speed:2, x:500, y:500, rotation:0});
array.push({type:"merc", speed:2, x:500, y:500, rotation:0});
array.push({type:"mini", speed:2, x:500, y:500, rotation:0});
array.push({type:"mini", speed:2, x:500, y:500, rotation:0});
array.push({type:"mazda", speed:2, x:500, y:500, rotation:0});
array.push({type:"mazda", speed:2, x:500, y:500, rotation:0});
array.push({type:"mazda", speed:2, x:500, y:500, rotation:0});
array.push({type:"mazda", speed:2, x:500, y:500, rotation:0});
time = 60;
break;
case 3:
array.push({type:"merc", speed:2, x:500, y:500, rotation:0});
array.push({type:"mazda", speed:2, x:500, y:500, rotation:0});
array.push({type:"mini", speed:2, x:500, y:500, rotation:0});
array.push({type:"suv", speed:2, x:500, y:500, rotation:0});
array.push({type:"merc", speed:2, x:500, y:500, rotation:0});
array.push({type:"mazda", speed:2, x:500, y:500, rotation:0});
array.push({type:"merc", speed:2, x:500, y:500, rotation:0});
array.push({type:"mini", speed:2, x:500, y:500, rotation:0});
array.push({type:"mazda", speed:2, x:500, y:500, rotation:0});
array.push({type:"mazda", speed:2, x:500, y:500, rotation:0});
time = 60;
break;
case 4:
array.push({type:"suv", speed:2, x:500, y:500, rotation:0});
array.push({type:"suv", speed:2, x:500, y:500, rotation:0});
array.push({type:"lexus", speed:2, x:500, y:500, rotation:0});
array.push({type:"suv", speed:2, x:500, y:500, rotation:0});
array.push({type:"merc", speed:2, x:500, y:500, rotation:0});
array.push({type:"mazda", speed:2, x:500, y:500, rotation:0});
array.push({type:"merc", speed:2, x:500, y:500, rotation:0});
array.push({type:"mini", speed:2, x:500, y:500, rotation:0});
array.push({type:"mazda", speed:2, x:500, y:500, rotation:0});
array.push({type:"mazda", speed:2, x:500, y:500, rotation:0});
time = 60;
break;
case 5:
array.push({type:"mazda", speed:2, x:650, y:450, rotation:-90});
array.push({type:"mini", speed:2, x:650, y:450, rotation:-90});
array.push({type:"mini", speed:2, x:650, y:450, rotation:-90});
array.push({type:"merc", speed:2, x:650, y:450, rotation:-90});
array.push({type:"merc", speed:2, x:650, y:450, rotation:-90});
time = 50;
break;
case 6:
array.push({type:"mazda", speed:2, x:650, y:450, rotation:-90});
array.push({type:"suv", speed:2, x:650, y:450, rotation:-90});
array.push({type:"mini", speed:2, x:650, y:450, rotation:-90});
array.push({type:"suv", speed:2, x:650, y:450, rotation:-90});
array.push({type:"merc", speed:2, x:650, y:450, rotation:-90});
array.push({type:"mazda", speed:2, x:445, y:9, rotation:180});
array.push({type:"merc", speed:2, x:650, y:450, rotation:-90});
array.push({type:"mini", speed:2, x:650, y:450, rotation:-90});
time = 40;
break;
case 7:
array.push({type:"mazda", speed:2, x:445, y:9, rotation:180});
array.push({type:"mini", speed:2, x:650, y:450, rotation:-90});
array.push({type:"mazda", speed:2, x:445, y:9, rotation:180});
array.push({type:"merc", speed:2, x:445, y:9, rotation:180});
array.push({type:"lexus", speed:2, x:650, y:450, rotation:-90});
array.push({type:"mazda", speed:2, x:445, y:9, rotation:180});
array.push({type:"merc", speed:2, x:650, y:450, rotation:-90});
array.push({type:"suv", speed:2, x:650, y:450, rotation:-90});
time = 40;
break;
case 8:
array.push({type:"suv", speed:2, x:650, y:450, rotation:-90});
array.push({type:"mazda", speed:2, x:445, y:9, rotation:180});
array.push({type:"merc", speed:2, x:445, y:9, rotation:180});
array.push({type:"lexus", speed:2, x:445, y:9, rotation:180});
array.push({type:"merc", speed:2, x:650, y:450, rotation:-90});
array.push({type:"suv", speed:2, x:650, y:450, rotation:-90});
array.push({type:"mazda", speed:2, x:445, y:9, rotation:180});
array.push({type:"mini", speed:2, x:650, y:450, rotation:-90});
array.push({type:"lexus", speed:2, x:650, y:450, rotation:-90});
array.push({type:"mazda", speed:2, x:445, y:9, rotation:180});
time = 30;
break;
case 9:
array.push({type:"lexus", speed:2, x:650, y:450, rotation:-90});
array.push({type:"mazda", speed:2, x:445, y:9, rotation:180});
array.push({type:"merc", speed:2, x:445, y:9, rotation:180});
array.push({type:"lexus", speed:2, x:445, y:9, rotation:180});
array.push({type:"merc", speed:2, x:445, y:9, rotation:180});
array.push({type:"suv", speed:2, x:650, y:450, rotation:-90});
array.push({type:"mazda", speed:2, x:445, y:9, rotation:180});
array.push({type:"mini", speed:2, x:650, y:450, rotation:-90});
array.push({type:"lexus", speed:2, x:650, y:450, rotation:-90});
array.push({type:"suv", speed:2, x:445, y:9, rotation:180});
time = 30;
break;
};
return (array);
}
public function getX(_arg1:uint):Number{
return (array[_arg1].x);
}
public function getY(_arg1:uint):Number{
return (array[_arg1].y);
}
public function getRotation(_arg1:uint):Number{
return (array[_arg1].rotation);
}
public function getLength():uint{
var _local1:uint;
var _local2:uint;
var _local3:uint;
_local1 = level;
_local3 = 0;
while (_local3 < 100) {
level = _local3;
getData();
if (isLevel != true){
_local2 = level;
break;
};
_local3++;
};
level = _local1;
return (_local2);
}
}
}//package model
Section 40
//btm__11 (parking_fla.btm__11)
package parking_fla {
import flash.display.*;
public dynamic class btm__11 extends MovieClip {
public function btm__11(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 41
//btn_no_9 (parking_fla.btn_no_9)
package parking_fla {
import flash.display.*;
public dynamic class btn_no_9 extends MovieClip {
public var n1:MovieClip;
public function btn_no_9(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 42
//btn_yes_7 (parking_fla.btn_yes_7)
package parking_fla {
import flash.display.*;
public dynamic class btn_yes_7 extends MovieClip {
public var n1:MovieClip;
public function btn_yes_7(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 43
//but1_48 (parking_fla.but1_48)
package parking_fla {
import flash.display.*;
public dynamic class but1_48 extends MovieClip {
public var n1:MovieClip;
public var n2:MovieClip;
public function but1_48(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 44
//but1kopia_51 (parking_fla.but1kopia_51)
package parking_fla {
import flash.display.*;
public dynamic class but1kopia_51 extends MovieClip {
public var n1:MovieClip;
public var n2:MovieClip;
public function but1kopia_51(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 45
//but1kopia2_54 (parking_fla.but1kopia2_54)
package parking_fla {
import flash.display.*;
public dynamic class but1kopia2_54 extends MovieClip {
public var n1:MovieClip;
public var n2:MovieClip;
public function but1kopia2_54(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 46
//ins_02_2 (parking_fla.ins_02_2)
package parking_fla {
import flash.display.*;
import flash.text.*;
public dynamic class ins_02_2 extends MovieClip {
public var tf1:TextField;
}
}//package parking_fla
Section 47
//mc_car1_21 (parking_fla.mc_car1_21)
package parking_fla {
import flash.display.*;
public dynamic class mc_car1_21 extends MovieClip {
public function mc_car1_21(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 48
//mc_car2_38 (parking_fla.mc_car2_38)
package parking_fla {
import flash.display.*;
public dynamic class mc_car2_38 extends MovieClip {
public function mc_car2_38(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 49
//mc_car3_34 (parking_fla.mc_car3_34)
package parking_fla {
import flash.display.*;
public dynamic class mc_car3_34 extends MovieClip {
public function mc_car3_34(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 50
//mc_car4_27 (parking_fla.mc_car4_27)
package parking_fla {
import flash.display.*;
public dynamic class mc_car4_27 extends MovieClip {
public function mc_car4_27(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 51
//mc_car5_30 (parking_fla.mc_car5_30)
package parking_fla {
import flash.display.*;
public dynamic class mc_car5_30 extends MovieClip {
public function mc_car5_30(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 52
//mc_close_62 (parking_fla.mc_close_62)
package parking_fla {
import flash.display.*;
public dynamic class mc_close_62 extends MovieClip {
public function mc_close_62(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 53
//mc_instr1_53 (parking_fla.mc_instr1_53)
package parking_fla {
import flash.display.*;
public dynamic class mc_instr1_53 extends MovieClip {
public function mc_instr1_53(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 54
//mc_instr1copy_52 (parking_fla.mc_instr1copy_52)
package parking_fla {
import flash.display.*;
public dynamic class mc_instr1copy_52 extends MovieClip {
public function mc_instr1copy_52(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 55
//mc_leng_59 (parking_fla.mc_leng_59)
package parking_fla {
import flash.display.*;
public dynamic class mc_leng_59 extends MovieClip {
public var n1:MovieClip;
public function mc_leng_59(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package parking_fla
Section 56
//mc_no_10 (parking_fla.mc_no_10)
package parking_fla {
import flash.display.*;
public dynamic class mc_no_10 extends MovieClip {
public function mc_no_10(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 57
//mc_pasek_4 (parking_fla.mc_pasek_4)
package parking_fla {
import flash.display.*;
public dynamic class mc_pasek_4 extends MovieClip {
public function mc_pasek_4(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 58
//mc_play1_49 (parking_fla.mc_play1_49)
package parking_fla {
import flash.display.*;
public dynamic class mc_play1_49 extends MovieClip {
public function mc_play1_49(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 59
//mc_play1copy_50 (parking_fla.mc_play1copy_50)
package parking_fla {
import flash.display.*;
public dynamic class mc_play1copy_50 extends MovieClip {
public function mc_play1copy_50(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 60
//mc_popup_61 (parking_fla.mc_popup_61)
package parking_fla {
import flash.display.*;
public dynamic class mc_popup_61 extends MovieClip {
public var btn_close:MovieClip;
public var n1:MovieClip;
public function mc_popup_61(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 61
//mc_popupGame_6 (parking_fla.mc_popupGame_6)
package parking_fla {
import flash.display.*;
public dynamic class mc_popupGame_6 extends MovieClip {
public var btn_no:MovieClip;
public var btn_yes:MovieClip;
public function mc_popupGame_6(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 62
//mc_scores1_56 (parking_fla.mc_scores1_56)
package parking_fla {
import flash.display.*;
public dynamic class mc_scores1_56 extends MovieClip {
public function mc_scores1_56(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 63
//mc_scores1copy_55 (parking_fla.mc_scores1copy_55)
package parking_fla {
import flash.display.*;
public dynamic class mc_scores1copy_55 extends MovieClip {
public function mc_scores1copy_55(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 64
//n1_60 (parking_fla.n1_60)
package parking_fla {
import flash.display.*;
public dynamic class n1_60 extends MovieClip {
public function n1_60(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package parking_fla
Section 65
//Lexus (view.cars.Lexus)
package view.cars {
import flash.display.*;
import view.*;
public class Lexus extends Car {
public var car:MovieClip;
public function Lexus():void{
car.gotoAndStop((Math.floor((Math.random() * 3)) + 1));
}
}
}//package view.cars
Section 66
//Mazda (view.cars.Mazda)
package view.cars {
import flash.display.*;
import view.*;
public class Mazda extends Car {
public var car:MovieClip;
public function Mazda():void{
car.gotoAndStop((Math.floor((Math.random() * 3)) + 1));
}
}
}//package view.cars
Section 67
//Merc (view.cars.Merc)
package view.cars {
import flash.display.*;
import view.*;
public class Merc extends Car {
public var car:MovieClip;
public function Merc():void{
car.gotoAndStop((Math.floor((Math.random() * 3)) + 1));
}
}
}//package view.cars
Section 68
//Mini (view.cars.Mini)
package view.cars {
import flash.display.*;
import view.*;
public class Mini extends Car {
public var car:MovieClip;
public function Mini():void{
car.gotoAndStop((Math.floor((Math.random() * 3)) + 1));
}
}
}//package view.cars
Section 69
//Suv (view.cars.Suv)
package view.cars {
import flash.display.*;
import view.*;
public class Suv extends Car {
public var car:MovieClip;
public function Suv():void{
car.gotoAndStop((Math.floor((Math.random() * 3)) + 1));
}
}
}//package view.cars
Section 70
//PopInstructions (view.popups.PopInstructions)
package view.popups {
import flash.display.*;
import flash.events.*;
import caurina.transitions.*;
import com.*;
public class PopInstructions {
var clip:MovieClip;
var btn_close:MovieClip;
public function PopInstructions(_arg1:MovieClip):void{
var _local2:*;
super();
clip = _arg1;
clip.visible = false;
clip.alpha = 0;
btn_close = clip.btn_close;
_local2 = new MyButton(clip.btn_close, this);
}
public function hide():void{
Tweener.addTween(clip, {alpha:0, time:0.5, transition:"easeInExpo", onComplete:visibleFalse()});
}
public function hClick(_arg1:MouseEvent):void{
hide();
}
public function visibleFalse():void{
clip.visible = false;
clip.alpha = 0;
}
public function show():void{
clip.alpha = 0;
clip.visible = true;
Tweener.addTween(clip, {alpha:1, time:0.5, transition:"easeOutExpo"});
clip.n1.gotoAndPlay(1);
}
}
}//package view.popups
Section 71
//Caption (view.Caption)
package view {
import flash.display.*;
import flash.events.*;
import controler.events.*;
public class Caption extends MovieClip {
public var mc1:MovieClip;
public var type:String;
public function Caption(_arg1:String, _arg2:String):void{
addFrameScript(32, frame33);
this.type = _arg2;
x = 44;
y = 240;
mc1.tf1.text = _arg1;
visible = false;
addEventListener(Event.ADDED_TO_STAGE, hAdd);
addEventListener(Event.ENTER_FRAME, hFrame);
}
private function hAdd(_arg1:Event):void{
gotoAndPlay(1);
visible = true;
removeEventListener(Event.ADDED_TO_STAGE, hAdd);
}
function frame33(){
stop();
}
private function hFrame(_arg1:Event):void{
if (currentFrame == totalFrames){
removeEventListener(Event.ENTER_FRAME, hFrame);
dispatchEvent(new ObjectEvent("objectClose", {type:type}));
};
}
}
}//package view
Section 72
//Car (view.Car)
package view {
import flash.display.*;
import flash.events.*;
public class Car extends MovieClip {
public var s1:SCarStart;
public var s2:SCrash;
public var ySpeed:Number;// = 0
public var mc_park10:MovieClip;
public var mc_park2:MovieClip;
public var mc_park4:MovieClip;
public var mc_park9:MovieClip;
public var mc_park3:MovieClip;
public var mc_park5:MovieClip;
public var mc_park8:MovieClip;
public var mc_park1:MovieClip;
public var xSpeed:Number;// = 0
public var mc_park6:MovieClip;
public var mc_crash:MovieClip;
public var frameCounter:uint;
public var mc_park7:MovieClip;
public var mc_lights:MovieClip;
public function Car():void{
ySpeed = 0;
xSpeed = 0;
super();
mc_lights.visible = false;
}
public function destroy():void{
removeEventListener(Event.ENTER_FRAME, hFrame);
}
public function startEngine():void{
s1 = new SCarStart();
s1.play(0, 1);
}
public function crash():void{
s2 = new SCrash();
s2.play(0, 1);
mc_lights.visible = true;
addEventListener(Event.ENTER_FRAME, hFrame);
frameCounter = 0;
}
public function move(_arg1:Number, _arg2:Number, _arg3:Number):void{
y = (y - _arg2);
x = (x + _arg1);
rotation = _arg3;
}
private function hFrame(_arg1:Event):void{
frameCounter++;
if (frameCounter >= 30){
mc_lights.visible = false;
removeEventListener(Event.ENTER_FRAME, hFrame);
};
}
}
}//package view
Section 73
//GameInterface (view.GameInterface)
package view {
import flash.display.*;
import flash.events.*;
import controler.events.*;
import controler.*;
import flash.text.*;
public class GameInterface extends MovieClip {
public var b2:Button1;
public var b1:Button1;
public var b3:Button1;
public var tf_points:TextField;
public var mc_timeBar:MovieClip;
public var tf_speed:TextField;
public var mc_popup:MovieClip;
public var tf_cars:TextField;
public var mc_captions:MovieClip;
public var btn_btm:MovieClip;
public function GameInterface():void{
addFrameScript(0, frame1);
mc_popup.visible = false;
b1 = new Button1(btn_btm, this);
b2 = new Button1(mc_popup.btn_yes, this);
b3 = new Button1(mc_popup.btn_no, this);
}
public function hClick(_arg1:MouseEvent):void{
switch (_arg1.target){
case btn_btm:
mc_popup.visible = true;
break;
case mc_popup.btn_yes:
mc_popup.visible = false;
dispatchEvent(new ButtonEvent("buttonBack", new Object()));
break;
case mc_popup.btn_no:
mc_popup.visible = false;
break;
};
}
public function destroy():void{
b1.destroy();
b1 = null;
b2.destroy();
b2 = null;
b3.destroy();
b3 = null;
}
public function setSpeed(_arg1:int):void{
tf_speed.text = _arg1.toString();
}
function frame1(){
stop();
}
public function setTime(_arg1:int):void{
mc_timeBar.gotoAndStop(_arg1);
}
public function setCars(_arg1:int):void{
tf_cars.text = _arg1.toString();
}
public function setLanguage(_arg1:String):void{
mc_popup.btn_yes.n1.gotoAndStop(_arg1);
mc_popup.btn_no.n1.gotoAndStop(_arg1);
mc_popup.gotoAndStop(_arg1);
gotoAndStop(_arg1);
}
public function setPoints(_arg1:int):void{
tf_points.text = _arg1.toString();
}
}
}//package view
Section 74
//MySound (view.MySound)
package view {
import flash.display.*;
import flash.events.*;
import flash.media.*;
public class MySound extends MovieClip {
private static var channel:SoundChannel;
private static var sLoop:Sound;
private static var turnOn:Boolean = true;
private static var firstTime:Boolean = true;
public function MySound():void{
addFrameScript(0, frame1);
buttonMode = true;
mouseChildren = false;
if (firstTime == true){
firstTime = false;
sLoop = new Loop1();
channel = sLoop.play(0, 999);
};
addEventListener(MouseEvent.CLICK, hChangeSound);
addEventListener(MouseEvent.ROLL_OUT, hRollOut);
addEventListener(MouseEvent.ROLL_OVER, hRollOver);
}
public function destroy():void{
removeEventListener(MouseEvent.CLICK, hChangeSound);
removeEventListener(MouseEvent.ROLL_OUT, hRollOut);
removeEventListener(MouseEvent.ROLL_OVER, hRollOver);
}
public function hRollOut(_arg1:MouseEvent):void{
gotoAndStop(1);
}
public function playSound():void{
if (turnOn == true){
channel = sLoop.play(0, 999);
};
}
function frame1(){
stop();
}
public function hRollOver(_arg1:MouseEvent):void{
gotoAndStop(2);
}
public function hChangeSound(_arg1:MouseEvent):void{
if (turnOn == false){
channel = sLoop.play(0, 999);
turnOn = true;
} else {
channel.stop();
turnOn = false;
};
}
}
}//package view
Section 75
//Loop1 (Loop1)
package {
import flash.media.*;
public dynamic class Loop1 extends Sound {
}
}//package
Section 76
//Main (Main)
package {
import flash.display.*;
import mochi.as3.*;
import controler.events.*;
import controler.*;
public dynamic class Main extends MovieClip {
public var menu:MyMenu;
public var language:String;// = "en"
public var level:Level;
public var logo:Logo;
public var logo2:Logo2;
public var adds:Adds;
public function Main():void{
language = "en";
super();
addFrameScript(0, frame1, 8, frame9);
logo = new Logo();
logo.y = 5;
logo.x = 5;
adds = new Adds(this);
adds.addEventListener(ButtonEvent.END_SAVE, hEndSave);
addChild(adds);
logo2 = new Logo2("http://x.mochiads.com/link/ba34f9b681e57936");
logo2.scaleX = 0.8;
logo2.scaleY = 0.8;
logo2.x = 3;
logo2.y = ((stage.stageHeight - logo2.height) + 5);
}
private function hShowScores(_arg1:ScoresEvent):void{
adds.showScore();
}
public function initGame(){
level = new Level(language);
level.addEventListener(ScoresEvent.SUBMIT, hSubmit);
addChild(level);
addChild(logo);
addChild(logo2);
}
private function hNewGame(_arg1:ButtonEvent):void{
menu.removeEventListener(ScoresEvent.SHOW, hShowScores);
menu.removeEventListener(ButtonEvent.NEW_GAME, hNewGame);
menu.removeEventListener(LanguageEvent.CHANGE, hChangeLanguage);
removeChildFrom(menu);
removeChild(menu);
menu = null;
initGame();
MochiEvents.startPlay();
}
function frame1(){
}
private function hEndSave(_arg1:ButtonEvent):void{
level.destroy();
level.removeEventListener(ScoresEvent.SUBMIT, hSubmit);
removeChild(level);
level = null;
initMenu();
}
function frame9(){
stop();
initMenu();
}
public function initMenu():void{
menu = new MyMenu();
menu.language = language;
menu.addEventListener(ScoresEvent.SHOW, hShowScores);
menu.addEventListener(ButtonEvent.NEW_GAME, hNewGame);
menu.addEventListener(LanguageEvent.CHANGE, hChangeLanguage);
adds.checkMenu(menu.clip.btn_scores);
addChild(menu);
addChild(logo);
addChild(logo2);
}
private function hSubmit(_arg1:ScoresEvent):void{
adds.hSubmit(_arg1.params.scores);
}
private function hChangeLanguage(_arg1:LanguageEvent):void{
language = _arg1.language;
}
private function removeChildFrom(_arg1:Object):void{
var _local2:uint;
var _local3:DisplayObject;
_local2 = 0;
while (_local2 < _arg1.numChildren) {
_local3 = _arg1.getChildAt(_local2);
if (_local3){
_arg1.removeChild(_arg1.getChildAt(_local2));
_local2--;
};
_local2++;
};
}
}
}//package
Section 77
//McLogo (McLogo)
package {
import flash.display.*;
public dynamic class McLogo extends MovieClip {
public function McLogo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 78
//McLogo2 (McLogo2)
package {
import flash.display.*;
import flash.events.*;
public dynamic class McLogo2 extends MovieClip {
public var bigBtn:MovieClip;
public var logoBtn:MovieClip;
public function McLogo2(){
addFrameScript(0, frame1, 1, frame2, 20, frame21);
}
public function enterFrameHandler(_arg1:Event):void{
if ((currentFrame > 1)){
prevFrame();
} else {
removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
};
}
public function rollOverHandler(_arg1:MouseEvent):void{
play();
}
function frame1(){
stop();
bigBtn.mouseEnabled = false;
logoBtn.addEventListener(MouseEvent.ROLL_OVER, rollOverHandler, false, 0, true);
}
function frame21(){
stop();
}
function frame2(){
bigBtn.mouseEnabled = true;
bigBtn.addEventListener(MouseEvent.ROLL_OUT, rollOutHandler, false, 0, true);
}
public function rollOutHandler(_arg1:MouseEvent):void{
stop();
addEventListener(Event.ENTER_FRAME, enterFrameHandler, false, 0, true);
}
}
}//package
Section 79
//McMenu (McMenu)
package {
import flash.display.*;
public dynamic class McMenu extends MovieClip {
public var btn_play:MovieClip;
public var btn_instr:MovieClip;
public var btn_scores:MovieClip;
public var mc_popup:MovieClip;
public var mc_language:MovieClip;
public function McMenu(){
addFrameScript(0, frame1, 8, frame9, 39, frame40);
}
function frame9(){
trace(btn_scores.visible);
}
function frame1(){
trace(btn_scores.visible);
}
function frame40(){
stop();
}
}
}//package
Section 80
//McStage1 (McStage1)
package {
import flash.display.*;
public dynamic class McStage1 extends MovieClip {
public var park1:MovieClip;
public var park3:MovieClip;
public var park0:MovieClip;
public var park2:MovieClip;
}
}//package
Section 81
//McStage10 (McStage10)
package {
import flash.display.*;
public dynamic class McStage10 extends MovieClip {
public var park1:MovieClip;
public var park4:MovieClip;
public var park3:MovieClip;
public var park0:MovieClip;
public var park2:MovieClip;
public var park5:MovieClip;
public var park8:MovieClip;
public var park9:MovieClip;
public var park7:MovieClip;
public var park6:MovieClip;
}
}//package
Section 82
//McStage2 (McStage2)
package {
import flash.display.*;
public dynamic class McStage2 extends MovieClip {
public var park1:MovieClip;
public var park4:MovieClip;
public var park3:MovieClip;
public var park0:MovieClip;
public var park2:MovieClip;
public var park5:MovieClip;
public var park6:MovieClip;
}
}//package
Section 83
//McStage3 (McStage3)
package {
import flash.display.*;
public dynamic class McStage3 extends MovieClip {
public var park1:MovieClip;
public var park4:MovieClip;
public var park3:MovieClip;
public var park0:MovieClip;
public var park2:MovieClip;
public var park5:MovieClip;
public var park7:MovieClip;
public var park6:MovieClip;
}
}//package
Section 84
//McStage4 (McStage4)
package {
import flash.display.*;
public dynamic class McStage4 extends MovieClip {
public var park1:MovieClip;
public var park4:MovieClip;
public var park3:MovieClip;
public var park0:MovieClip;
public var park2:MovieClip;
public var park5:MovieClip;
public var park8:MovieClip;
public var park9:MovieClip;
public var park7:MovieClip;
public var park6:MovieClip;
}
}//package
Section 85
//McStage5 (McStage5)
package {
import flash.display.*;
public dynamic class McStage5 extends MovieClip {
public var park1:MovieClip;
public var park4:MovieClip;
public var park3:MovieClip;
public var park0:MovieClip;
public var park2:MovieClip;
public var park5:MovieClip;
public var park8:MovieClip;
public var park9:MovieClip;
public var park7:MovieClip;
public var park6:MovieClip;
}
}//package
Section 86
//McStage6 (McStage6)
package {
import flash.display.*;
public dynamic class McStage6 extends MovieClip {
public var park1:MovieClip;
public var park4:MovieClip;
public var park3:MovieClip;
public var park0:MovieClip;
public var park2:MovieClip;
}
}//package
Section 87
//McStage7 (McStage7)
package {
import flash.display.*;
public dynamic class McStage7 extends MovieClip {
public var park1:MovieClip;
public var park4:MovieClip;
public var park3:MovieClip;
public var park0:MovieClip;
public var park2:MovieClip;
public var park5:MovieClip;
public var park7:MovieClip;
public var park6:MovieClip;
}
}//package
Section 88
//McStage8 (McStage8)
package {
import flash.display.*;
public dynamic class McStage8 extends MovieClip {
public var park1:MovieClip;
public var park4:MovieClip;
public var park3:MovieClip;
public var park0:MovieClip;
public var park2:MovieClip;
public var park5:MovieClip;
public var park7:MovieClip;
public var park6:MovieClip;
}
}//package
Section 89
//McStage9 (McStage9)
package {
import flash.display.*;
public dynamic class McStage9 extends MovieClip {
public var park1:MovieClip;
public var park4:MovieClip;
public var park3:MovieClip;
public var park0:MovieClip;
public var park2:MovieClip;
public var park5:MovieClip;
public var park8:MovieClip;
public var park9:MovieClip;
public var park7:MovieClip;
public var park6:MovieClip;
}
}//package
Section 90
//SCarStart (SCarStart)
package {
import flash.media.*;
public dynamic class SCarStart extends Sound {
}
}//package
Section 91
//SCrash (SCrash)
package {
import flash.media.*;
public dynamic class SCrash extends Sound {
}
}//package