Section 1
//SoundFX (app_sound.SoundFX)
package app_sound {
import flash.events.*;
import flash.media.*;
public class SoundFX {
private var controller:EventDispatcher;
private var sound:Sound;
private var playFlag:Boolean;// = true
public function SoundFX(_arg1, _arg2:String, _arg3:EventDispatcher){
sound = _arg1;
_arg3.addEventListener(_arg2, playSound);
_arg3.addEventListener(MainGame.FX_SWITCH, mute);
}
private function mute(_arg1:Event):void{
playFlag = !(playFlag);
}
private function playSound(_arg1):void{
if (playFlag){
sound.play();
};
}
}
}//package app_sound
Section 2
//AuxFunctions (caurina.transitions.AuxFunctions)
package caurina.transitions {
public class AuxFunctions {
public static function numberToR(_arg1:Number):Number{
return (((_arg1 & 0xFF0000) >> 16));
}
public static function numberToG(_arg1:Number):Number{
return (((_arg1 & 0xFF00) >> 8));
}
public static function numberToB(_arg1:Number):Number{
return ((_arg1 & 0xFF));
}
public static function getObjectLength(_arg1:Object):uint{
var _local3:String;
var _local2:uint;
for (_local3 in _arg1) {
_local2++;
};
return (_local2);
}
public static function concatObjects(... _args):Object{
var _local3:Object;
var _local5:String;
var _local2:Object = {};
var _local4:int;
while (_local4 < _args.length) {
_local3 = _args[_local4];
for (_local5 in _local3) {
if (_local3[_local5] == null){
delete _local2[_local5];
} else {
_local2[_local5] = _local3[_local5];
};
};
_local4++;
};
return (_local2);
}
}
}//package caurina.transitions
Section 3
//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 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 easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
return ((((_arg3 * _arg1) / _arg4) + _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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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 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));
}
public static function easeInElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period;
var _local8:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
--_arg1;
return ((-(((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2));
}
public static function easeOutElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / _arg4);
if (_arg1 == 1){
return ((_arg2 + _arg3));
};
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * 0.3) : _arg5.period;
var _local8:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
return (((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) + _arg3) + _arg2));
}
public static function easeInOutElastic(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local7:Number;
if (_arg1 == 0){
return (_arg2);
};
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 == 2){
return ((_arg2 + _arg3));
};
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.period)))) ? (_arg4 * (0.3 * 1.5)) : _arg5.period;
var _local8:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.amplitude)))) ? 0 : _arg5.amplitude;
if (((!(Boolean(_local8))) || ((_local8 < Math.abs(_arg3))))){
_local8 = _arg3;
_local7 = (_local6 / 4);
} else {
_local7 = ((_local6 / (2 * Math.PI)) * Math.asin((_arg3 / _local8)));
};
if (_arg1 < 1){
--_arg1;
return (((-0.5 * ((_local8 * Math.pow(2, (10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6)))) + _arg2));
};
--_arg1;
return ((((((_local8 * Math.pow(2, (-10 * _arg1))) * Math.sin(((((_arg1 * _arg4) - _local7) * (2 * Math.PI)) / _local6))) * 0.5) + _arg3) + _arg2));
}
public static function 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 easeInBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = (_arg1 / _arg4);
return (((((_arg3 * _arg1) * _arg1) * (((_local6 + 1) * _arg1) - _local6)) + _arg2));
}
public static function easeOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = ((_arg1 / _arg4) - 1);
return (((_arg3 * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 1)) + _arg2));
}
public static function easeInOutBack(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Object=null):Number{
var _local6:Number = (((!(Boolean(_arg5))) || (isNaN(_arg5.overshoot)))) ? 1.70158 : _arg5.overshoot;
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
_local6 = (_local6 * 1.525);
return ((((_arg3 / 2) * ((_arg1 * _arg1) * (((_local6 + 1) * _arg1) - _local6))) + _arg2));
};
_arg1 = (_arg1 - 2);
_local6 = (_local6 * 1.525);
return ((((_arg3 / 2) * (((_arg1 * _arg1) * (((_local6 + 1) * _arg1) + _local6)) + 2)) + _arg2));
}
public static function 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 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 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 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 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));
}
}
}//package caurina.transitions
Section 4
//PropertyInfoObj (caurina.transitions.PropertyInfoObj)
package caurina.transitions {
public class PropertyInfoObj {
public var valueStart:Number;
public var valueComplete:Number;
public var originalValueComplete:Object;
public var arrayIndex:Number;
public var extra:Object;
public var isSpecialProperty:Boolean;
public var hasModifier:Boolean;
public var modifierFunction:Function;
public var modifierParameters:Array;
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 clone():PropertyInfoObj{
var _local1:PropertyInfoObj = new PropertyInfoObj(valueStart, valueComplete, originalValueComplete, arrayIndex, extra, isSpecialProperty, modifierFunction, modifierParameters);
return (_local1);
}
public function toString():String{
var _local1 = "\n[PropertyInfoObj ";
_local1 = (_local1 + ("valueStart:" + String(valueStart)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("valueComplete:" + String(valueComplete)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("originalValueComplete:" + String(originalValueComplete)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("arrayIndex:" + String(arrayIndex)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("extra:" + String(extra)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("isSpecialProperty:" + String(isSpecialProperty)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("hasModifier:" + String(hasModifier)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("modifierFunction:" + String(modifierFunction)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("modifierParameters:" + String(modifierParameters)));
_local1 = (_local1 + "]\n");
return (_local1);
}
}
}//package caurina.transitions
Section 5
//SpecialProperty (caurina.transitions.SpecialProperty)
package caurina.transitions {
public class SpecialProperty {
public var getValue:Function;
public var setValue:Function;
public var parameters:Array;
public var preProcess:Function;
public function SpecialProperty(_arg1:Function, _arg2:Function, _arg3:Array=null, _arg4:Function=null){
getValue = _arg1;
setValue = _arg2;
parameters = _arg3;
preProcess = _arg4;
}
public function toString():String{
var _local1 = "";
_local1 = (_local1 + "[SpecialProperty ");
_local1 = (_local1 + ("getValue:" + String(getValue)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("setValue:" + String(setValue)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("parameters:" + String(parameters)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("preProcess:" + String(preProcess)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 6
//SpecialPropertyModifier (caurina.transitions.SpecialPropertyModifier)
package caurina.transitions {
public class SpecialPropertyModifier {
public var modifyValues:Function;
public var getValue:Function;
public function SpecialPropertyModifier(_arg1:Function, _arg2:Function){
modifyValues = _arg1;
getValue = _arg2;
}
public function toString():String{
var _local1 = "";
_local1 = (_local1 + "[SpecialPropertyModifier ");
_local1 = (_local1 + ("modifyValues:" + String(modifyValues)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("getValue:" + String(getValue)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 7
//SpecialPropertySplitter (caurina.transitions.SpecialPropertySplitter)
package caurina.transitions {
public class SpecialPropertySplitter {
public var parameters:Array;
public var splitValues:Function;
public function SpecialPropertySplitter(_arg1:Function, _arg2:Array){
splitValues = _arg1;
parameters = _arg2;
}
public function toString():String{
var _local1 = "";
_local1 = (_local1 + "[SpecialPropertySplitter ");
_local1 = (_local1 + ("splitValues:" + String(splitValues)));
_local1 = (_local1 + ", ");
_local1 = (_local1 + ("parameters:" + String(parameters)));
_local1 = (_local1 + "]");
return (_local1);
}
}
}//package caurina.transitions
Section 8
//Tweener (caurina.transitions.Tweener)
package caurina.transitions {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class Tweener {
private static var __tweener_controller__:MovieClip;
private static var _engineExists:Boolean = false;
private static var _inited:Boolean = false;
private static var _currentTime:Number;
private static var _currentTimeFrame:Number;
private static var _tweenList:Array;
private static var _timeScale:Number = 1;
private static var _transitionList:Object;
private static var _specialPropertyList:Object;
private static var _specialPropertyModifierList:Object;
private static var _specialPropertySplitterList:Object;
public static var autoOverwrite:Boolean = true;
public function Tweener(){
trace("Tweener is a static class and should not be instantiated.");
}
public static function addTween(_arg1:Object=null, _arg2:Object=null):Boolean{
var _local3:Number;
var _local4:Number;
var _local5:String;
var _local6:Array;
var _local13:Function;
var _local14:Object;
var _local15:TweenListObj;
var _local16:Number;
var _local17:Array;
var _local18:Array;
var _local19:Array;
var _local20:String;
if (!Boolean(_arg1)){
return (false);
};
if ((_arg1 is Array)){
_local6 = _arg1.concat();
} else {
_local6 = [_arg1];
};
var _local7:Object = TweenListObj.makePropertiesChain(_arg2);
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
var _local8:Number = (isNaN(_local7.time)) ? 0 : _local7.time;
var _local9:Number = (isNaN(_local7.delay)) ? 0 : _local7.delay;
var _local10:Array = new Array();
var _local11:Object = {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};
var _local12:Object = new Object();
for (_local5 in _local7) {
if (!_local11[_local5]){
if (_specialPropertySplitterList[_local5]){
_local17 = _specialPropertySplitterList[_local5].splitValues(_local7[_local5], _specialPropertySplitterList[_local5].parameters);
_local3 = 0;
while (_local3 < _local17.length) {
if (_specialPropertySplitterList[_local17[_local3].name]){
_local18 = _specialPropertySplitterList[_local17[_local3].name].splitValues(_local17[_local3].value, _specialPropertySplitterList[_local17[_local3].name].parameters);
_local4 = 0;
while (_local4 < _local18.length) {
_local10[_local18[_local4].name] = {valueStart:undefined, valueComplete:_local18[_local4].value, arrayIndex:_local18[_local4].arrayIndex, isSpecialProperty:false};
_local4++;
};
} else {
_local10[_local17[_local3].name] = {valueStart:undefined, valueComplete:_local17[_local3].value, arrayIndex:_local17[_local3].arrayIndex, isSpecialProperty:false};
};
_local3++;
};
} else {
if (_specialPropertyModifierList[_local5] != undefined){
_local19 = _specialPropertyModifierList[_local5].modifyValues(_local7[_local5]);
_local3 = 0;
while (_local3 < _local19.length) {
_local12[_local19[_local3].name] = {modifierParameters:_local19[_local3].parameters, modifierFunction:_specialPropertyModifierList[_local5].getValue};
_local3++;
};
} else {
_local10[_local5] = {valueStart:undefined, valueComplete:_local7[_local5]};
};
};
};
};
for (_local5 in _local10) {
if (_specialPropertyList[_local5] != undefined){
_local10[_local5].isSpecialProperty = true;
} else {
if (_local6[0][_local5] == undefined){
printError((((("The property '" + _local5) + "' doesn't seem to be a normal object property of ") + String(_local6[0])) + " or a registered special property."));
};
};
};
for (_local5 in _local12) {
if (_local10[_local5] != undefined){
_local10[_local5].modifierParameters = _local12[_local5].modifierParameters;
_local10[_local5].modifierFunction = _local12[_local5].modifierFunction;
};
};
if (typeof(_local7.transition) == "string"){
_local20 = _local7.transition.toLowerCase();
_local13 = _transitionList[_local20];
} else {
_local13 = _local7.transition;
};
if (!Boolean(_local13)){
_local13 = _transitionList["easeoutexpo"];
};
_local3 = 0;
while (_local3 < _local6.length) {
_local14 = new Object();
for (_local5 in _local10) {
_local14[_local5] = new PropertyInfoObj(_local10[_local5].valueStart, _local10[_local5].valueComplete, _local10[_local5].valueComplete, _local10[_local5].arrayIndex, {}, _local10[_local5].isSpecialProperty, _local10[_local5].modifierFunction, _local10[_local5].modifierParameters);
};
if (_local7.useFrames == true){
_local15 = new TweenListObj(_local6[_local3], (_currentTimeFrame + (_local9 / _timeScale)), (_currentTimeFrame + ((_local9 + _local8) / _timeScale)), true, _local13, _local7.transitionParams);
} else {
_local15 = new TweenListObj(_local6[_local3], (_currentTime + ((_local9 * 1000) / _timeScale)), (_currentTime + (((_local9 * 1000) + (_local8 * 1000)) / _timeScale)), false, _local13, _local7.transitionParams);
};
_local15.properties = _local14;
_local15.onStart = _local7.onStart;
_local15.onUpdate = _local7.onUpdate;
_local15.onComplete = _local7.onComplete;
_local15.onOverwrite = _local7.onOverwrite;
_local15.onError = _local7.onError;
_local15.onStartParams = _local7.onStartParams;
_local15.onUpdateParams = _local7.onUpdateParams;
_local15.onCompleteParams = _local7.onCompleteParams;
_local15.onOverwriteParams = _local7.onOverwriteParams;
_local15.onStartScope = _local7.onStartScope;
_local15.onUpdateScope = _local7.onUpdateScope;
_local15.onCompleteScope = _local7.onCompleteScope;
_local15.onOverwriteScope = _local7.onOverwriteScope;
_local15.onErrorScope = _local7.onErrorScope;
_local15.rounded = _local7.rounded;
_local15.skipUpdates = _local7.skipUpdates;
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 addCaller(_arg1:Object=null, _arg2:Object=null):Boolean{
var _local3:Number;
var _local4:Array;
var _local8:Function;
var _local9:TweenListObj;
var _local10:Number;
var _local11:String;
if (!Boolean(_arg1)){
return (false);
};
if ((_arg1 is Array)){
_local4 = _arg1.concat();
} else {
_local4 = [_arg1];
};
var _local5:Object = _arg2;
if (!_inited){
init();
};
if (((!(_engineExists)) || (!(Boolean(__tweener_controller__))))){
startEngine();
};
var _local6:Number = (isNaN(_local5.time)) ? 0 : _local5.time;
var _local7:Number = (isNaN(_local5.delay)) ? 0 : _local5.delay;
if (typeof(_local5.transition) == "string"){
_local11 = _local5.transition.toLowerCase();
_local8 = _transitionList[_local11];
} else {
_local8 = _local5.transition;
};
if (!Boolean(_local8)){
_local8 = _transitionList["easeoutexpo"];
};
_local3 = 0;
while (_local3 < _local4.length) {
if (_local5.useFrames == true){
_local9 = new TweenListObj(_local4[_local3], (_currentTimeFrame + (_local7 / _timeScale)), (_currentTimeFrame + ((_local7 + _local6) / _timeScale)), true, _local8, _local5.transitionParams);
} else {
_local9 = new TweenListObj(_local4[_local3], (_currentTime + ((_local7 * 1000) / _timeScale)), (_currentTime + (((_local7 * 1000) + (_local6 * 1000)) / _timeScale)), false, _local8, _local5.transitionParams);
};
_local9.properties = null;
_local9.onStart = _local5.onStart;
_local9.onUpdate = _local5.onUpdate;
_local9.onComplete = _local5.onComplete;
_local9.onOverwrite = _local5.onOverwrite;
_local9.onStartParams = _local5.onStartParams;
_local9.onUpdateParams = _local5.onUpdateParams;
_local9.onCompleteParams = _local5.onCompleteParams;
_local9.onOverwriteParams = _local5.onOverwriteParams;
_local9.onStartScope = _local5.onStartScope;
_local9.onUpdateScope = _local5.onUpdateScope;
_local9.onCompleteScope = _local5.onCompleteScope;
_local9.onOverwriteScope = _local5.onOverwriteScope;
_local9.onErrorScope = _local5.onErrorScope;
_local9.isCaller = true;
_local9.count = _local5.count;
_local9.waitFrames = _local5.waitFrames;
_tweenList.push(_local9);
if ((((_local6 == 0)) && ((_local7 == 0)))){
_local10 = (_tweenList.length - 1);
updateTweenByIndex(_local10);
removeTweenByIndex(_local10);
};
_local3++;
};
return (true);
}
public static function removeTweensByTime(_arg1:Object, _arg2:Object, _arg3:Number, _arg4:Number):Boolean{
var removedLocally:Boolean;
var i:uint;
var pName:String;
var eventScope:Object;
var p_scope = _arg1;
var p_properties = _arg2;
var p_timeStart = _arg3;
var p_timeComplete = _arg4;
var removed:Boolean;
var tl:uint = _tweenList.length;
i = 0;
while (i < tl) {
if (((Boolean(_tweenList[i])) && ((p_scope == _tweenList[i].scope)))){
if ((((p_timeComplete > _tweenList[i].timeStart)) && ((p_timeStart < _tweenList[i].timeComplete)))){
removedLocally = false;
for (pName in _tweenList[i].properties) {
if (Boolean(p_properties[pName])){
if (Boolean(_tweenList[i].onOverwrite)){
eventScope = (Boolean(_tweenList[i].onOverwriteScope)) ? _tweenList[i].onOverwriteScope : _tweenList[i].scope;
try {
_tweenList[i].onOverwrite.apply(eventScope, _tweenList[i].onOverwriteParams);
} catch(e:Error) {
handleError(_tweenList[i], e, "onOverwrite");
};
};
_tweenList[i].properties[pName] = undefined;
delete _tweenList[i].properties[pName];
removedLocally = true;
removed = true;
};
};
if (removedLocally){
if (AuxFunctions.getObjectLength(_tweenList[i].properties) == 0){
removeTweenByIndex(i);
};
};
};
};
i = (i + 1);
};
return (removed);
}
public static function removeTweens(_arg1:Object, ... _args):Boolean{
var _local4:uint;
var _local5:SpecialPropertySplitter;
var _local6:Array;
var _local7:uint;
var _local3:Array = 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 removeAllTweens():Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
var _local1:Boolean;
_local2 = 0;
while (_local2 < _tweenList.length) {
removeTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
public static function pauseTweens(_arg1:Object, ... _args):Boolean{
var _local4:uint;
var _local3:Array = 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));
}
public static function pauseAllTweens():Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
var _local1:Boolean;
_local2 = 0;
while (_local2 < _tweenList.length) {
pauseTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
public static function resumeTweens(_arg1:Object, ... _args):Boolean{
var _local4:uint;
var _local3:Array = 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 resumeAllTweens():Boolean{
var _local2:uint;
if (!Boolean(_tweenList)){
return (false);
};
var _local1:Boolean;
_local2 = 0;
while (_local2 < _tweenList.length) {
resumeTweenByIndex(_local2);
_local1 = true;
_local2++;
};
return (_local1);
}
private static function affectTweens(_arg1:Function, _arg2:Object, _arg3:Array):Boolean{
var _local5:uint;
var _local6:Array;
var _local7:uint;
var _local8:uint;
var _local9:uint;
var _local4:Boolean;
if (!Boolean(_tweenList)){
return (false);
};
_local5 = 0;
while (_local5 < _tweenList.length) {
if (((_tweenList[_local5]) && ((_tweenList[_local5].scope == _arg2)))){
if (_arg3.length == 0){
_arg1(_local5);
_local4 = true;
} else {
_local6 = new Array();
_local7 = 0;
while (_local7 < _arg3.length) {
if (Boolean(_tweenList[_local5].properties[_arg3[_local7]])){
_local6.push(_arg3[_local7]);
};
_local7++;
};
if (_local6.length > 0){
_local8 = AuxFunctions.getObjectLength(_tweenList[_local5].properties);
if (_local8 == _local6.length){
_arg1(_local5);
_local4 = true;
} else {
_local9 = splitTweens(_local5, _local6);
_arg1(_local9);
_local4 = true;
};
};
};
};
_local5++;
};
return (_local4);
}
public static function splitTweens(_arg1:Number, _arg2:Array):uint{
var _local5:uint;
var _local6:String;
var _local7:Boolean;
var _local3:TweenListObj = _tweenList[_arg1];
var _local4:TweenListObj = _local3.clone(false);
_local5 = 0;
while (_local5 < _arg2.length) {
_local6 = _arg2[_local5];
if (Boolean(_local3.properties[_local6])){
_local3.properties[_local6] = undefined;
delete _local3.properties[_local6];
};
_local5++;
};
for (_local6 in _local4.properties) {
_local7 = false;
_local5 = 0;
while (_local5 < _arg2.length) {
if (_arg2[_local5] == _local6){
_local7 = true;
break;
};
_local5++;
};
if (!_local7){
_local4.properties[_local6] = undefined;
delete _local4.properties[_local6];
};
};
_tweenList.push(_local4);
return ((_tweenList.length - 1));
}
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 removeTweenByIndex(_arg1:Number, _arg2:Boolean=false):Boolean{
_tweenList[_arg1] = null;
if (_arg2){
_tweenList.splice(_arg1, 1);
};
return (true);
}
public static function pauseTweenByIndex(_arg1:Number):Boolean{
var _local2:TweenListObj = _tweenList[_arg1];
if ((((_local2 == null)) || (_local2.isPaused))){
return (false);
};
_local2.timePaused = getCurrentTweeningTime(_local2);
_local2.isPaused = true;
return (true);
}
public static function resumeTweenByIndex(_arg1:Number):Boolean{
var _local2:TweenListObj = _tweenList[_arg1];
if ((((_local2 == null)) || (!(_local2.isPaused)))){
return (false);
};
var _local3:Number = getCurrentTweeningTime(_local2);
_local2.timeStart = (_local2.timeStart + (_local3 - _local2.timePaused));
_local2.timeComplete = (_local2.timeComplete + (_local3 - _local2.timePaused));
_local2.timePaused = undefined;
_local2.isPaused = false;
return (true);
}
private static function updateTweenByIndex(_arg1:Number):Boolean{
var tTweening:TweenListObj;
var mustUpdate:Boolean;
var nv:Number;
var t:Number;
var b:Number;
var c:Number;
var d:Number;
var pName:String;
var eventScope:Object;
var tScope:Object;
var tProperty:Object;
var pv:Number;
var i = _arg1;
tTweening = _tweenList[i];
if ((((tTweening == null)) || (!(Boolean(tTweening.scope))))){
return (false);
};
var isOver:Boolean;
var cTime:Number = getCurrentTweeningTime(tTweening);
if (cTime >= tTweening.timeStart){
tScope = tTweening.scope;
if (tTweening.isCaller){
do {
t = (((tTweening.timeComplete - tTweening.timeStart) / tTweening.count) * (tTweening.timesCalled + 1));
b = tTweening.timeStart;
c = (tTweening.timeComplete - tTweening.timeStart);
d = (tTweening.timeComplete - tTweening.timeStart);
nv = tTweening.transition(t, b, c, d);
} while (!(cTime >= nv));
} else {
mustUpdate = (((((tTweening.skipUpdates < 1)) || (!(tTweening.skipUpdates)))) || ((tTweening.updatesSkipped >= tTweening.skipUpdates)));
if (cTime >= tTweening.timeComplete){
isOver = true;
mustUpdate = true;
};
if (!tTweening.hasStarted){
if (Boolean(tTweening.onStart)){
eventScope = (Boolean(tTweening.onStartScope)) ? tTweening.onStartScope : tScope;
try {
tTweening.onStart.apply(eventScope, tTweening.onStartParams);
} catch(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 init(... _args):void{
_inited = true;
_transitionList = new Object();
Equations.init();
_specialPropertyList = new Object();
_specialPropertyModifierList = new Object();
_specialPropertySplitterList = new Object();
}
public static function registerTransition(_arg1:String, _arg2:Function):void{
if (!_inited){
init();
};
_transitionList[_arg1] = _arg2;
}
public static function registerSpecialProperty(_arg1:String, _arg2:Function, _arg3:Function, _arg4:Array=null, _arg5:Function=null):void{
if (!_inited){
init();
};
var _local6:SpecialProperty = new SpecialProperty(_arg2, _arg3, _arg4, _arg5);
_specialPropertyList[_arg1] = _local6;
}
public static function registerSpecialPropertyModifier(_arg1:String, _arg2:Function, _arg3:Function):void{
if (!_inited){
init();
};
var _local4:SpecialPropertyModifier = new SpecialPropertyModifier(_arg2, _arg3);
_specialPropertyModifierList[_arg1] = _local4;
}
public static function registerSpecialPropertySplitter(_arg1:String, _arg2:Function, _arg3:Array=null):void{
if (!_inited){
init();
};
var _local4:SpecialPropertySplitter = new SpecialPropertySplitter(_arg2, _arg3);
_specialPropertySplitterList[_arg1] = _local4;
}
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();
}
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 updateTime():void{
_currentTime = getTimer();
}
public static function updateFrame():void{
_currentTimeFrame++;
}
public static function onEnterFrame(_arg1:Event):void{
updateTime();
updateFrame();
var _local2:Boolean;
_local2 = updateTweens();
if (!_local2){
stopEngine();
};
}
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 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 getTweens(_arg1:Object):Array{
var _local2:uint;
var _local3:String;
if (!Boolean(_tweenList)){
return ([]);
};
var _local4:Array = new Array();
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
for (_local3 in _tweenList[_local2].properties) {
_local4.push(_local3);
};
};
_local2++;
};
return (_local4);
}
public static function getTweenCount(_arg1:Object):Number{
var _local2:uint;
if (!Boolean(_tweenList)){
return (0);
};
var _local3:Number = 0;
_local2 = 0;
while (_local2 < _tweenList.length) {
if (((Boolean(_tweenList[_local2])) && ((_tweenList[_local2].scope == _arg1)))){
_local3 = (_local3 + AuxFunctions.getObjectLength(_tweenList[_local2].properties));
};
_local2++;
};
return (_local3);
}
private static function 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()));
};
};
}
public static function getCurrentTweeningTime(_arg1:Object):Number{
return ((_arg1.useFrames) ? _currentTimeFrame : _currentTime);
}
public static function getVersion():String{
return ("AS3 1.33.74");
}
public static function printError(_arg1:String):void{
trace(("## [Tweener] Error: " + _arg1));
}
}
}//package caurina.transitions
Section 9
//TweenListObj (caurina.transitions.TweenListObj)
package caurina.transitions {
public class TweenListObj {
public var scope:Object;
public var properties:Object;
public var timeStart:Number;
public var timeComplete:Number;
public var useFrames:Boolean;
public var transition:Function;
public var transitionParams:Object;
public var onStart:Function;
public var onUpdate:Function;
public var onComplete:Function;
public var onOverwrite:Function;
public var onError:Function;
public var onStartParams:Array;
public var onUpdateParams:Array;
public var onCompleteParams:Array;
public var onOverwriteParams:Array;
public var onStartScope:Object;
public var onUpdateScope:Object;
public var onCompleteScope:Object;
public var onOverwriteScope:Object;
public var onErrorScope:Object;
public var rounded:Boolean;
public var isPaused:Boolean;
public var timePaused:Number;
public var isCaller:Boolean;
public var count:Number;
public var timesCalled:Number;
public var waitFrames:Boolean;
public var skipUpdates:Number;
public var updatesSkipped:Number;
public var hasStarted:Boolean;
public function TweenListObj(_arg1:Object, _arg2:Number, _arg3:Number, _arg4:Boolean, _arg5:Function, _arg6:Object){
scope = _arg1;
timeStart = _arg2;
timeComplete = _arg3;
useFrames = _arg4;
transition = _arg5;
transitionParams = _arg6;
properties = new Object();
isPaused = false;
timePaused = undefined;
isCaller = false;
updatesSkipped = 0;
timesCalled = 0;
skipUpdates = 0;
hasStarted = false;
}
public function clone(_arg1:Boolean):TweenListObj{
var _local3:String;
var _local2:TweenListObj = new TweenListObj(scope, timeStart, timeComplete, useFrames, transition, transitionParams);
_local2.properties = new Array();
for (_local3 in properties) {
_local2.properties[_local3] = properties[_local3].clone();
};
_local2.skipUpdates = skipUpdates;
_local2.updatesSkipped = updatesSkipped;
if (!_arg1){
_local2.onStart = onStart;
_local2.onUpdate = onUpdate;
_local2.onComplete = onComplete;
_local2.onOverwrite = onOverwrite;
_local2.onError = onError;
_local2.onStartParams = onStartParams;
_local2.onUpdateParams = onUpdateParams;
_local2.onCompleteParams = onCompleteParams;
_local2.onOverwriteParams = onOverwriteParams;
_local2.onStartScope = onStartScope;
_local2.onUpdateScope = onUpdateScope;
_local2.onCompleteScope = onCompleteScope;
_local2.onOverwriteScope = onOverwriteScope;
_local2.onErrorScope = onErrorScope;
};
_local2.rounded = rounded;
_local2.isPaused = isPaused;
_local2.timePaused = timePaused;
_local2.isCaller = isCaller;
_local2.count = count;
_local2.timesCalled = timesCalled;
_local2.waitFrames = waitFrames;
_local2.hasStarted = hasStarted;
return (_local2);
}
public function toString():String{
var _local3:String;
var _local1 = "\n[TweenListObj ";
_local1 = (_local1 + ("scope:" + String(scope)));
_local1 = (_local1 + ", properties:");
var _local2:Boolean;
for (_local3 in properties) {
if (!_local2){
_local1 = (_local1 + ",");
};
_local1 = (_local1 + ("[name:" + properties[_local3].name));
_local1 = (_local1 + (",valueStart:" + properties[_local3].valueStart));
_local1 = (_local1 + (",valueComplete:" + properties[_local3].valueComplete));
_local1 = (_local1 + "]");
_local2 = false;
};
_local1 = (_local1 + (", timeStart:" + String(timeStart)));
_local1 = (_local1 + (", timeComplete:" + String(timeComplete)));
_local1 = (_local1 + (", useFrames:" + String(useFrames)));
_local1 = (_local1 + (", transition:" + String(transition)));
_local1 = (_local1 + (", transitionParams:" + String(transitionParams)));
if (skipUpdates){
_local1 = (_local1 + (", skipUpdates:" + String(skipUpdates)));
};
if (updatesSkipped){
_local1 = (_local1 + (", updatesSkipped:" + String(updatesSkipped)));
};
if (Boolean(onStart)){
_local1 = (_local1 + (", onStart:" + String(onStart)));
};
if (Boolean(onUpdate)){
_local1 = (_local1 + (", onUpdate:" + String(onUpdate)));
};
if (Boolean(onComplete)){
_local1 = (_local1 + (", onComplete:" + String(onComplete)));
};
if (Boolean(onOverwrite)){
_local1 = (_local1 + (", onOverwrite:" + String(onOverwrite)));
};
if (Boolean(onError)){
_local1 = (_local1 + (", onError:" + String(onError)));
};
if (onStartParams){
_local1 = (_local1 + (", onStartParams:" + String(onStartParams)));
};
if (onUpdateParams){
_local1 = (_local1 + (", onUpdateParams:" + String(onUpdateParams)));
};
if (onCompleteParams){
_local1 = (_local1 + (", onCompleteParams:" + String(onCompleteParams)));
};
if (onOverwriteParams){
_local1 = (_local1 + (", onOverwriteParams:" + String(onOverwriteParams)));
};
if (onStartScope){
_local1 = (_local1 + (", onStartScope:" + String(onStartScope)));
};
if (onUpdateScope){
_local1 = (_local1 + (", onUpdateScope:" + String(onUpdateScope)));
};
if (onCompleteScope){
_local1 = (_local1 + (", onCompleteScope:" + String(onCompleteScope)));
};
if (onOverwriteScope){
_local1 = (_local1 + (", onOverwriteScope:" + String(onOverwriteScope)));
};
if (onErrorScope){
_local1 = (_local1 + (", onErrorScope:" + String(onErrorScope)));
};
if (rounded){
_local1 = (_local1 + (", rounded:" + String(rounded)));
};
if (isPaused){
_local1 = (_local1 + (", isPaused:" + String(isPaused)));
};
if (timePaused){
_local1 = (_local1 + (", timePaused:" + String(timePaused)));
};
if (isCaller){
_local1 = (_local1 + (", isCaller:" + String(isCaller)));
};
if (count){
_local1 = (_local1 + (", count:" + String(count)));
};
if (timesCalled){
_local1 = (_local1 + (", timesCalled:" + String(timesCalled)));
};
if (waitFrames){
_local1 = (_local1 + (", waitFrames:" + String(waitFrames)));
};
if (hasStarted){
_local1 = (_local1 + (", hasStarted:" + String(hasStarted)));
};
_local1 = (_local1 + "]\n");
return (_local1);
}
public static function makePropertiesChain(_arg1:Object):Object{
var _local3:Object;
var _local4:Object;
var _local5:Object;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local2:Object = _arg1.base;
if (_local2){
_local3 = {};
if ((_local2 is Array)){
_local4 = [];
_local8 = 0;
while (_local8 < _local2.length) {
_local4.push(_local2[_local8]);
_local8++;
};
} else {
_local4 = [_local2];
};
_local4.push(_arg1);
_local6 = _local4.length;
_local7 = 0;
while (_local7 < _local6) {
if (_local4[_local7]["base"]){
_local5 = AuxFunctions.concatObjects(makePropertiesChain(_local4[_local7]["base"]), _local4[_local7]);
} else {
_local5 = _local4[_local7];
};
_local3 = AuxFunctions.concatObjects(_local3, _local5);
_local7++;
};
if (_local3["base"]){
delete _local3["base"];
};
return (_local3);
//unresolved jump
};
return (_arg1);
}
}
}//package caurina.transitions
Section 10
//darts (game_code.darts)
package game_code {
import flash.events.*;
import flash.display.*;
import caurina.transitions.*;
import flash.utils.*;
import flash.media.*;
import flash.geom.*;
import flash.errors.*;
public class darts extends MovieClip {
private var controller:EventDispatcher;
var Parent:game;
var dartboard:mcDartboard;
var BombArray:Array;
var SectionArray:Array;
public var crosshair:mcCrosshair;
var DartArray:Array;
var BlueDartArray:Array;
var YellowDartArray:Array;
var ScaledX;// = 0
var ScaledY;// = 0
var HitX;// = 0
var HitY;// = 0
var CurrentAngle;// = 90
var DartType;// = 0
var CurrentDirection;// = 1
public var CurrentDart;// = 0
var CurrentDistance;// = 180
var CurrentDartScore;// = 0
public var GoodForFinish;
var CurrentScale;// = 1
var TargetMouseX;
var TargetMouseY;
var MouseMoved;
private var affineTransform:Matrix;
public var HitArray:Array;
var MouseReached;// = false
var VelX;
var VelY;
public function darts(){
dartboard = new mcDartboard();
BombArray = new Array();
SectionArray = new Array();
crosshair = new mcCrosshair();
DartArray = new Array();
BlueDartArray = new Array();
YellowDartArray = new Array();
HitArray = new Array();
super();
}
function FillBombArray(){
BombArray.push(dartboard.bomb1);
BombArray.push(dartboard.bomb2);
BombArray.push(dartboard.bomb3);
BombArray.push(dartboard.bomb4);
BombArray.push(dartboard.bomb5);
BombArray.push(dartboard.bomb6);
BombArray.push(dartboard.bomb7);
BombArray.push(dartboard.bomb8);
BombArray.push(dartboard.bomb9);
BombArray.push(dartboard.bomb10);
BombArray.push(dartboard.bomb11);
BombArray.push(dartboard.bomb12);
BombArray.push(dartboard.bomb13);
BombArray.push(dartboard.bomb14);
BombArray.push(dartboard.bomb15);
BombArray.push(dartboard.bomb16);
BombArray.push(dartboard.bomb17);
BombArray.push(dartboard.bomb18);
BombArray.push(dartboard.bomb19);
BombArray.push(dartboard.bomb20);
SectionArray.push(dartboard.section1);
SectionArray.push(dartboard.section2);
SectionArray.push(dartboard.section3);
SectionArray.push(dartboard.section4);
SectionArray.push(dartboard.section5);
SectionArray.push(dartboard.section6);
SectionArray.push(dartboard.section7);
SectionArray.push(dartboard.section8);
SectionArray.push(dartboard.section9);
SectionArray.push(dartboard.section10);
SectionArray.push(dartboard.section11);
SectionArray.push(dartboard.section12);
SectionArray.push(dartboard.section13);
SectionArray.push(dartboard.section14);
SectionArray.push(dartboard.section15);
SectionArray.push(dartboard.section16);
SectionArray.push(dartboard.section17);
SectionArray.push(dartboard.section18);
SectionArray.push(dartboard.section19);
SectionArray.push(dartboard.section20);
}
public function HideBombArray(){
var _local1:* = 0;
while (_local1 < 20) {
BombArray[_local1].visible = false;
SectionArray[_local1].visible = false;
_local1++;
};
}
public function ShowSection(_arg1){
if (_arg1 < 20){
SectionArray[(_arg1 - 1)].visible = true;
};
}
public function SetBombArray(){
var _local1:* = 0;
while (_local1 < 20) {
BombArray[_local1].visible = true;
HitArray[_local1] = 3;
BombArray[_local1].gotoAndStop(HitArray[_local1]);
BombArray[_local1].faceMC.gotoAndStop(Parent.PLAYER);
_local1++;
};
_local1 = 0;
while (_local1 < 10) {
BombArray[(vars.WhiteArray[_local1] - 1)].faceMC.gotoAndStop(Parent.OPPONENT);
_local1++;
};
}
public function init(_arg1:EventDispatcher, _arg2:game){
var _local4:mcDart;
var _local5:mcYellowDart;
Parent = _arg2;
controller = _arg1;
addChild(dartboard);
dartboard.x = vars.CENTER_X;
dartboard.y = vars.CENTER_Y;
var _local3:int;
while (_local3 < 3) {
_local4 = new mcDart();
BlueDartArray.push(_local4);
_local4.visible = false;
_local4.mouseEnabled = false;
addChild(_local4);
_local5 = new mcYellowDart();
YellowDartArray.push(_local5);
_local5.visible = false;
_local5.mouseEnabled = false;
addChild(_local5);
_local3++;
};
addChild(crosshair);
crosshair.mouseEnabled = false;
FillBombArray();
dartboard.addEventListener(MouseEvent.CLICK, CheckThrow);
dartboard.addEventListener(MouseEvent.MOUSE_MOVE, PositionCrosshair);
dartboard.addEventListener(Event.ENTER_FRAME, DropCrosshair);
dartboard.quitB.addEventListener(MouseEvent.CLICK, QuitGame);
}
function QuitGame(_arg1:Event){
controller.dispatchEvent(new Event(MainGame.LEAVE_GAME));
}
public function scaleAt(_arg1:Number, _arg2:Number, _arg3:Number):void{
affineTransform = transform.matrix;
affineTransform.translate(-(_arg2), -(_arg3));
affineTransform.scale(_arg1, _arg1);
affineTransform.translate(_arg2, _arg3);
transform.matrix = affineTransform;
}
public function Reset(){
dartboard.waitMC.visible = false;
crosshair.visible = false;
HideDarts();
HideBombArray();
}
public function Control(){
switch (Parent.GameState){
case vars.AIMINGBOARD:
AddWobble();
break;
};
}
function AddWobble(){
crosshair.dartarea.scaleX = (crosshair.dartarea.scaleX - 0.05);
crosshair.dartarea.scaleY = (crosshair.dartarea.scaleY - 0.05);
if (crosshair.dartarea.scaleX <= 0){
crosshair.dartarea.scaleX = 1;
crosshair.dartarea.scaleY = 1;
};
}
function PositionCrosshair(_arg1:Event){
TargetMouseX = mouseX;
TargetMouseY = mouseY;
MouseReached = false;
MouseMoved = 0;
VelX = ((TargetMouseX - crosshair.x) / 4);
VelY = ((TargetMouseY - crosshair.y) / 4);
}
function DropCrosshair(_arg1:Event){
if (!MouseReached){
crosshair.x = (crosshair.x + VelX);
crosshair.y = (crosshair.y + VelY);
if (VelX > 0){
if (crosshair.x > TargetMouseX){
MouseReached = true;
VelX = ((Math.random() * 3) - 1.5);
VelY = ((Math.random() * 3) - 1.5);
MouseMoved = 0;
};
} else {
if (crosshair.x < TargetMouseX){
MouseReached = true;
VelX = ((Math.random() * 2) - 1);
VelY = ((Math.random() * 2) - 1);
MouseMoved = 0;
};
};
} else {
MouseMoved++;
if (MouseMoved > 2){
crosshair.x = (crosshair.x + VelX);
crosshair.y = (crosshair.y + VelY);
};
};
}
function CheckThrow(_arg1:Event){
if (Parent.Hud.CurrInfo != Parent.Hud.OppInfo){
switch (Parent.GameState){
case vars.AIMINGBOARD:
StartThrow();
break;
case vars.THROWN:
break;
};
};
}
function AddTimingOffset(){
var _local1:* = (int(((Math.random() * 100) * crosshair.dartarea.scaleX)) - (50 * crosshair.dartarea.scaleX));
var _local2:* = (int(((Math.random() * 100) * crosshair.dartarea.scaleY)) - (50 * crosshair.dartarea.scaleX));
crosshair.x = (crosshair.x + _local1);
crosshair.y = (crosshair.y + _local2);
}
function StartThrow(){
crosshair.visible = false;
Parent.GameState = vars.THROWING;
if (Parent.Hud.CurrInfo == Parent.Hud.PlayerInfo){
AddTimingOffset();
HitX = crosshair.x;
HitY = crosshair.y;
DartArray = BlueDartArray;
} else {
DartArray = YellowDartArray;
};
DartArray[CurrentDart].visible = true;
DartArray[CurrentDart].x = HitX;
DartArray[CurrentDart].y = HitY;
ScaledX = HitX;
ScaledY = HitY;
DartArray[CurrentDart].gotoAndPlay(1);
controller.dispatchEvent(new Event(MainGame.FX_SWOOSH));
DartArray[CurrentDart].addEventListener(Event.ENTER_FRAME, CheckDartThrown);
Parent.Hud.HideScoreBoard();
}
function ResetCrossHair(){
if (Parent.Hud.CurrInfo == Parent.Hud.PlayerInfo){
crosshair.visible = true;
};
crosshair.x = 300;
crosshair.y = 200;
CurrentAngle = 90;
CurrentDirection = vars.DARTIN;
CurrentDistance = vars.DARTPOSITION;
Parent.GameState = vars.AIMINGBOARD;
scaleAt((1 / CurrentScale), ScaledX, ScaledY);
CurrentScale = 1;
Parent.Hud.ShowScoreBoard();
if (CurrentDart == 0){
Parent.Darts.HideDarts();
};
}
public function HideDarts(){
CurrentDart = 0;
BlueDartArray[0].visible = false;
BlueDartArray[1].visible = false;
BlueDartArray[2].visible = false;
YellowDartArray[0].visible = false;
YellowDartArray[1].visible = false;
YellowDartArray[2].visible = false;
}
function CheckDartThrown(_arg1:Event){
if (_arg1.currentTarget.currentLabel == "SCALE"){
CurrentScale = (CurrentScale * 1.1);
scaleAt(1.1, ScaledX, ScaledY);
};
if (_arg1.currentTarget.currentLabel == "FINISH"){
controller.dispatchEvent(new Event(MainGame.FX_IMPACT));
DartArray[CurrentDart].removeEventListener(Event.ENTER_FRAME, CheckDartThrown);
WorkOutScore();
CurrentDart++;
trace("Dart thrown", CurrentDart);
if (CurrentDart == 3){
CurrentDart = 0;
};
Parent.GameState = vars.THROWN;
};
}
function WorkOutScore(){
var _local1:*;
var _local2:*;
var _local3:*;
var _local6:*;
var _local4:* = 0;
var _local5:* = 0;
_local1 = (HitX - vars.CENTER_X);
_local2 = (HitY - vars.CENTER_Y);
if ((((_local1 >= 0)) && ((_local2 < 0)))){
_local4 = 1;
} else {
if ((((_local1 < 0)) && ((_local2 < 0)))){
_local4 = 2;
} else {
if ((((_local1 < 0)) && ((_local2 >= 0)))){
_local4 = 3;
} else {
if ((((_local1 >= 0)) && ((_local2 >= 0)))){
_local4 = 4;
};
};
};
};
if ((((_local1 == 0)) && ((_local2 == 0)))){
_local1 = 1;
_local2 = 1;
};
_local5 = ((_local1 * _local1) + (_local2 * _local2));
_local3 = Math.round(Math.sqrt(_local5));
_local6 = (Math.abs(_local2) / Math.abs(_local3));
switch (_local4){
case 1:
if (_local6 >= vars.COS9){
CurrentDartScore = 20;
} else {
if (_local6 >= vars.COS27){
CurrentDartScore = 1;
} else {
if (_local6 >= vars.COS45){
CurrentDartScore = 18;
} else {
if (_local6 >= vars.COS63){
CurrentDartScore = 4;
} else {
if (_local6 >= vars.COS81){
CurrentDartScore = 13;
} else {
CurrentDartScore = 6;
};
};
};
};
};
break;
case 2:
if (_local6 >= vars.COS9){
CurrentDartScore = 20;
} else {
if (_local6 >= vars.COS27){
CurrentDartScore = 5;
} else {
if (_local6 >= vars.COS45){
CurrentDartScore = 12;
} else {
if (_local6 >= vars.COS63){
CurrentDartScore = 9;
} else {
if (_local6 >= vars.COS81){
CurrentDartScore = 14;
} else {
CurrentDartScore = 11;
};
};
};
};
};
break;
case 3:
if (_local6 >= vars.COS9){
CurrentDartScore = 3;
} else {
if (_local6 >= vars.COS27){
CurrentDartScore = 19;
} else {
if (_local6 >= vars.COS45){
CurrentDartScore = 7;
} else {
if (_local6 >= vars.COS63){
CurrentDartScore = 16;
} else {
if (_local6 >= vars.COS81){
CurrentDartScore = 8;
} else {
CurrentDartScore = 11;
};
};
};
};
};
break;
case 4:
if (_local6 >= vars.COS9){
CurrentDartScore = 3;
} else {
if (_local6 >= vars.COS27){
CurrentDartScore = 17;
} else {
if (_local6 >= vars.COS45){
CurrentDartScore = 2;
} else {
if (_local6 >= vars.COS63){
CurrentDartScore = 15;
} else {
if (_local6 >= vars.COS81){
CurrentDartScore = 10;
} else {
CurrentDartScore = 6;
};
};
};
};
};
break;
};
GoodForFinish = false;
DartType = vars.FIRSTSINGLE;
if (_local3 <= vars.BULL){
CurrentDartScore = 50;
GoodForFinish = true;
DartType = vars.BULL;
} else {
if (_local3 <= vars.TWENTYFIVE){
CurrentDartScore = 25;
} else {
if (_local3 <= vars.FIRSTSINGLE){
CurrentDartScore = CurrentDartScore;
} else {
if (_local3 <= vars.TREBLE){
DartType = vars.TREBLE;
CurrentDartScore = (CurrentDartScore * 3);
} else {
if (_local3 <= vars.SECONDSINGLE){
CurrentDartScore = CurrentDartScore;
} else {
if (_local3 <= vars.DOUBLE){
CurrentDartScore = (CurrentDartScore * 2);
GoodForFinish = true;
DartType = vars.DOUBLE;
} else {
CurrentDartScore = 0;
DartType = vars.MISS;
};
};
};
};
};
};
GameTypeWorkOutScore();
}
function GameTypeWorkOutScore(){
switch (Parent.GAME_TYPE){
case vars.QUICK_GAME:
case vars.TOURNAMENT_GAME:
Parent.Hud.SetScore(CurrentDartScore, DartType, (CurrentDart + 1));
break;
case vars.DARTATTACK_GAME:
Parent.Hud.SetScoreDartAttack(CurrentDartScore, DartType, (CurrentDart + 1));
break;
case vars.ROUNDTHECLOCK_GAME:
Parent.Hud.SetScoreRoundTheClock(CurrentDartScore, DartType, (CurrentDart + 1));
break;
};
}
public function StartPlayersGo(){
dartboard.waitMC.visible = false;
ResetCrossHair();
}
public function StartComputersGo(){
dartboard.waitMC.visible = true;
CurrentDart = 0;
ResetCrossHair();
Parent.GameState = vars.THROWN;
crosshair.visible = false;
DART_WorkOutComputerAimingFor();
}
function DART_WorkOutComputerThrow(_arg1, _arg2){
var _local3:* = (vars.SECONDSINGLE - ((vars.SECONDSINGLE - vars.TREBLE) / 2));
switch (_arg2){
case vars.AIMFORTREBLE:
_local3 = (vars.TREBLE - ((vars.TREBLE - vars.FIRSTSINGLE) / 2));
break;
case vars.AIMFORDOUBLE:
_local3 = (vars.DOUBLE - ((vars.DOUBLE - vars.SECONDSINGLE) / 2));
break;
case vars.AIMFORSINGLE:
_local3 = (vars.SECONDSINGLE - ((vars.SECONDSINGLE - vars.TREBLE) / 2));
break;
case vars.AIMFORBULL:
_local3 = (vars.BULL - (vars.BULL / 2));
break;
case vars.AIMFOR25:
_local3 = (vars.TWENTYFIVE - ((vars.TWENTYFIVE - vars.BULL) / 2));
break;
};
var _local4:* = (vars.AngleForNumber[_arg1] / (180 / Math.PI));
HitX = (vars.CENTER_X + (_local3 * Math.cos(_local4)));
HitY = (vars.CENTER_Y + (_local3 * Math.sin(_local4)));
switch (Parent.DIFFICULTY){
case vars.AMATEUR:
HitX = ((HitX + vars.EASY_RAND) - (Math.random() * vars.EASY_MOVEMENT));
HitY = ((HitY + vars.EASY_RAND) - (Math.random() * vars.EASY_MOVEMENT));
break;
case vars.PRO:
HitX = ((HitX + vars.HARD_RAND) - (Math.random() * vars.HARD_MOVEMENT));
HitY = ((HitY + vars.HARD_RAND) - (Math.random() * vars.HARD_MOVEMENT));
break;
};
}
function DART_WorkOutAimingForNormalGame(){
var _local1:*;
var _local2:*;
var _local3:*;
if (Parent.Hud.CurrInfo.CurrentScore > vars.LOWEST_FINISH_VAL){
DART_WorkOutComputerThrow(19, vars.AIMFORTREBLE);
} else {
_local1 = vars.CheckOutArray.length;
_local2 = false;
_local3 = 0;
while (_local3 < _local1) {
if (vars.CheckOutArray[_local3][vars.CURRENT_SCORE] == Parent.Hud.CurrInfo.CurrentScore){
DART_WorkOutComputerThrow((vars.CheckOutArray[_local3][vars.NUM_REQUIRED] - 1), vars.CheckOutArray[_local3][vars.AIMING_FOR]);
_local2 = true;
};
_local3++;
};
if (!_local2){
DART_WorkOutComputerThrow(19, vars.AIMFORTREBLE);
};
};
Tweener.addTween(crosshair, {time:2, onComplete:StartThrow});
}
function DART_WorkOutAimingForRoundTheClock(){
if (Parent.Hud.CurrInfo.CurrentScore <= 18){
DART_WorkOutComputerThrow((Parent.Hud.CurrInfo.CurrentScore - 1), vars.AIMFORTREBLE);
} else {
if (Parent.Hud.CurrInfo.CurrentScore == 19){
DART_WorkOutComputerThrow((Parent.Hud.CurrInfo.CurrentScore - 1), vars.AIMFORDOUBLE);
} else {
if (Parent.Hud.CurrInfo.CurrentScore == 20){
DART_WorkOutComputerThrow((Parent.Hud.CurrInfo.CurrentScore - 1), vars.AIMFORSINGLE);
} else {
if (Parent.Hud.CurrInfo.CurrentScore == 21){
DART_WorkOutComputerThrow(19, vars.AIMFORBULL);
};
};
};
};
Tweener.addTween(crosshair, {time:2, onComplete:StartThrow});
}
function DART_WorkOutAimingForDartAttack(){
var _local1:* = 0;
while (_local1 < 10) {
if (HitArray[(vars.BlackArray[_local1] - 1)] > 0){
trace("Aiming for", vars.BlackArray[_local1]);
DART_WorkOutComputerThrow((vars.BlackArray[_local1] - 1), vars.AIMFORTREBLE);
break;
};
_local1++;
};
Tweener.addTween(crosshair, {time:2, onComplete:StartThrow});
}
function DART_WorkOutComputerAimingFor(){
if (Parent.Hud.GamePlaying){
switch (Parent.GAME_TYPE){
case vars.QUICK_GAME:
case vars.TOURNAMENT_GAME:
DART_WorkOutAimingForNormalGame();
break;
case vars.ROUNDTHECLOCK_GAME:
DART_WorkOutAimingForRoundTheClock();
break;
case vars.DARTATTACK_GAME:
DART_WorkOutAimingForDartAttack();
break;
};
};
}
}
}//package game_code
Section 11
//game (game_code.game)
package game_code {
import flash.events.*;
import flash.display.*;
public class game extends MovieClip {
private var controller:EventDispatcher;
var Hud:hud;
public var Darts:darts;
public var GameState;// = 4
public var PlayState;// = 0
public var GAME_TYPE;
public var PLAYER;
public var GAME_LENGTH;
public var OPPONENT;
public var DIFFICULTY;// = 1
public function game(){
Hud = new hud();
Darts = new darts();
super();
this.addEventListener(Event.ENTER_FRAME, GameLoop);
}
public function init(_arg1:EventDispatcher){
controller = _arg1;
Darts.init(_arg1, this);
addChild(Darts);
Hud.cacheAsBitmap = true;
Hud.init(_arg1, this);
addChild(Hud);
}
public function Reset(){
Hud.ResetLegs();
Darts.Reset();
Hud.Reset();
}
function GameLoop(_arg1:Event){
Darts.Control();
}
}
}//package game_code
Section 12
//hud (game_code.hud)
package game_code {
import flash.events.*;
import flash.display.*;
import caurina.transitions.*;
import flash.utils.*;
import flash.media.*;
import flash.geom.*;
import flash.errors.*;
public class hud extends MovieClip {
private var controller:EventDispatcher;
var Parent:game;
var ScoreAtStart;// = 0
var CurrentTally;// = 0
var dart_score:score;
var Miss:mcMiss;
var Hit:mcHit;
var Treble:mcTreble;
var Double:mcDouble;
var Bust:mcBust;
var Bullseye:mcBullseye;
var PlayerInfo:playerinfo;
var OppInfo:playerinfo;
public var CurrInfo:playerinfo;
var Starting:mcStart;
var Winner:mcWinner;
var win:mcWin;
var lose:mcLose;
public var GamePlaying;// = true
var GameWins;// = true
public function hud(){
dart_score = new score();
Miss = new mcMiss();
Hit = new mcHit();
Treble = new mcTreble();
Double = new mcDouble();
Bust = new mcBust();
Bullseye = new mcBullseye();
PlayerInfo = new playerinfo();
OppInfo = new playerinfo();
Starting = new mcStart();
Winner = new mcWinner();
win = new mcWin();
lose = new mcLose();
super();
}
function StartGameType(){
switch (Parent.GAME_TYPE){
case vars.QUICK_GAME:
case vars.TOURNAMENT_GAME:
PlayerInfo.ResetInfo(30, 50, Parent.PLAYER, Parent.GAME_LENGTH, true);
OppInfo.ResetInfo(620, 50, Parent.OPPONENT, Parent.GAME_LENGTH, false);
break;
case vars.DARTATTACK_GAME:
PlayerInfo.ResetInfo(30, 50, Parent.PLAYER, 30, true);
OppInfo.ResetInfo(620, 50, Parent.OPPONENT, 30, false);
Parent.Darts.SetBombArray();
break;
case vars.ROUNDTHECLOCK_GAME:
PlayerInfo.ResetInfo(30, 50, Parent.PLAYER, 1, true);
OppInfo.ResetInfo(620, 50, Parent.OPPONENT, 1, false);
Parent.Darts.ShowSection(1);
break;
};
}
public function init(_arg1:EventDispatcher, _arg2:game){
Parent = _arg2;
controller = _arg1;
dart_score.scaleX = 2;
dart_score.scaleY = 2;
dart_score.CreateScores(150, 150, 30, 3);
addChild(dart_score);
dart_score.visible = false;
addChild(Miss);
Miss.visible = false;
addChild(Hit);
Hit.visible = false;
addChild(Treble);
Treble.visible = false;
addChild(Double);
Double.visible = false;
addChild(Bullseye);
Bullseye.visible = false;
addChild(Bust);
Bust.visible = false;
addChild(PlayerInfo);
addChild(OppInfo);
addChild(Winner);
addChild(win);
addChild(lose);
StartGameType();
addChild(Starting);
Starting.x = vars.CENTER_X;
Starting.y = vars.CENTER_Y;
Winner.x = 350;
Winner.y = 200;
win.x = 300;
win.y = 200;
lose.y = 300;
lose.y = 200;
Winner.visible = false;
lose.visible = false;
win.visible = false;
PlayerInfo.mouseChildren = false;
PlayerInfo.mouseEnabled = false;
OppInfo.mouseChildren = false;
OppInfo.mouseEnabled = false;
Winner.backB.addEventListener(MouseEvent.CLICK, ReturnToMenu);
}
function WriteOnBoard(_arg1){
switch (Parent.GAME_TYPE){
case vars.QUICK_GAME:
case vars.TOURNAMENT_GAME:
if (CurrInfo.ChangeScore(_arg1, CurrentTally)){
ChangePlayer();
};
break;
case vars.DARTATTACK_GAME:
PlayerInfo.SetScore(PlayerInfo.CurrentScore);
OppInfo.SetScore(OppInfo.CurrentScore);
if (CurrInfo.ChangeScore(CurrInfo.CurrentScore, CurrentTally)){
ChangePlayer();
};
break;
case vars.ROUNDTHECLOCK_GAME:
if (CurrInfo.CurrentScore == 21){
if (CurrInfo.ChangeScore("BULL", CurrentTally)){
ChangePlayer();
};
} else {
if (CurrInfo.ChangeScore(_arg1, CurrentTally)){
ChangePlayer();
};
};
break;
};
}
public function SetScore(_arg1, _arg2, _arg3){
if (_arg3 == 1){
CurrentTally = _arg1;
ScoreAtStart = CurrInfo.CurrentScore;
} else {
CurrentTally = (CurrentTally + _arg1);
};
CheckFinalScore(_arg1);
dart_score.alpha = 1;
dart_score.x = 100;
dart_score.y = 0;
dart_score.GAME_SetScore3Digits(_arg1);
dart_score.visible = true;
switch (_arg2){
case vars.BULL:
StartBullAnim();
break;
case vars.TREBLE:
StartTrebleAnim();
break;
case vars.DOUBLE:
StartDoubleAnim();
break;
case vars.MISS:
StartMissAnim();
break;
default:
break;
};
}
function CheckFinalScore(_arg1){
CurrInfo.CurrentScore = (CurrInfo.CurrentScore - _arg1);
if (CurrInfo.CurrentScore == 0){
if (Parent.Darts.GoodForFinish){
GamePlaying = false;
if (CurrInfo == PlayerInfo){
win.visible = true;
PlayerInfo.AddLeg();
Tweener.addTween(dart_score, {x:150, time:2, onComplete:GameWon});
} else {
lose.visible = true;
OppInfo.AddLeg();
Tweener.addTween(dart_score, {x:150, time:2, onComplete:GameWon});
};
} else {
CurrInfo.CurrentScore = ScoreAtStart;
CurrInfo.SetScoreAfterBust();
StartBustAnim();
Tweener.addTween(dart_score, {x:150, time:1, onComplete:GameBust});
};
} else {
if (CurrInfo.CurrentScore < 2){
CurrInfo.CurrentScore = ScoreAtStart;
CurrInfo.SetScoreAfterBust();
StartBustAnim();
Tweener.addTween(dart_score, {x:150, time:1, onComplete:GameBust});
} else {
Tweener.addTween(dart_score, {x:150, time:1, onComplete:ResetBoard});
};
};
}
function ResetBoard(){
WriteOnBoard(CurrInfo.CurrentScore);
Tweener.addTween(dart_score, {alpha:0, time:0.5});
Miss.visible = false;
Hit.visible = false;
Treble.visible = false;
Double.visible = false;
Bust.visible = false;
Bullseye.visible = false;
Parent.Darts.ResetCrossHair();
if (CurrInfo == OppInfo){
Parent.Darts.DART_WorkOutComputerAimingFor();
};
if (Parent.GAME_TYPE == vars.ROUNDTHECLOCK_GAME){
Parent.Darts.HideBombArray();
Parent.Darts.ShowSection(CurrInfo.CurrentScore);
};
}
function GameWon(){
Tweener.addTween(dart_score, {alpha:0, time:0.5});
Miss.visible = false;
Hit.visible = false;
Treble.visible = false;
Double.visible = false;
Bust.visible = false;
Bullseye.visible = false;
win.visible = false;
lose.visible = false;
if (PlayerInfo.NumLegs == 2){
Winner.visible = true;
controller.dispatchEvent(new Event(MainGame.FX_CLAPS));
GameWins = true;
Winner.faceMC.gotoAndStop(PlayerInfo.Character);
trace("Game Over, you win");
} else {
if (OppInfo.NumLegs == 2){
controller.dispatchEvent(new Event(MainGame.FX_AAH));
Winner.visible = true;
GameWins = false;
Winner.faceMC.gotoAndStop(OppInfo.Character);
trace("Game Over, you lose");
} else {
Reset();
Parent.Darts.HideDarts();
Tweener.addTween(dart_score, {alpha:0, time:0.5});
Miss.visible = false;
Hit.visible = false;
Treble.visible = false;
Double.visible = false;
Bust.visible = false;
Bullseye.visible = false;
};
};
Parent.Darts.ResetCrossHair();
Parent.Darts.crosshair.visible = false;
}
function GameBust(){
Tweener.addTween(dart_score, {alpha:0, time:0.5});
Parent.Darts.HideDarts();
ChangePlayer();
CurrInfo.ActivateGo();
Miss.visible = false;
Hit.visible = false;
Treble.visible = false;
Double.visible = false;
Bust.visible = false;
Bullseye.visible = false;
Parent.Darts.ResetCrossHair();
if (CurrInfo == OppInfo){
trace("Reset board next player");
Parent.Darts.DART_WorkOutComputerAimingFor();
};
}
public function Reset(){
StartGameType();
if ((PlayerInfo.NumLegs + OppInfo.NumLegs) == 1){
CurrInfo = OppInfo;
Tweener.addTween(Starting, {time:2, onComplete:StartComputerGo});
PlayerInfo.HideDarts();
} else {
CurrInfo = PlayerInfo;
Tweener.addTween(Starting, {time:2, onComplete:StartPlayerGo});
OppInfo.HideDarts();
};
trace("2");
Winner.visible = false;
win.visible = false;
lose.visible = false;
CurrInfo.ActivateGo();
Parent.PlayState = vars.STARTING;
Starting.visible = true;
controller.dispatchEvent(new Event(MainGame.FX_START));
GamePlaying = true;
}
public function StartPlayerGo(){
Parent.PlayState = vars.PLAYING;
Parent.Darts.StartPlayersGo();
Starting.visible = false;
}
function StartComputerGo(){
Parent.PlayState = vars.PLAYING;
Parent.Darts.StartComputersGo();
Starting.visible = false;
}
function StartBullAnim(){
Bullseye.x = 300;
Bullseye.y = 300;
Bullseye.visible = true;
Tweener.addTween(Bullseye, {y:150, time:0.9});
}
function StartTrebleAnim(){
Treble.x = 300;
Treble.y = 300;
Treble.visible = true;
Tweener.addTween(Treble, {y:150, time:0.9});
}
function StartDoubleAnim(){
Double.x = 300;
Double.y = 300;
Double.visible = true;
Tweener.addTween(Double, {y:150, time:0.9});
}
function StartMissAnim(){
Miss.x = 300;
Miss.y = 200;
Miss.visible = true;
Tweener.addTween(Miss, {y:300, time:0.9});
}
function StartHitAnim(){
Hit.x = 300;
Hit.y = 200;
Hit.visible = true;
Tweener.addTween(Hit, {y:300, time:0.9});
}
function StartBustAnim(){
Bust.x = 300;
Bust.y = 200;
Bust.visible = true;
Tweener.addTween(Bust, {y:300, time:0.9});
}
public function HideScoreBoard(){
Tweener.addTween(PlayerInfo, {alpha:0, time:0.9});
Tweener.addTween(OppInfo, {alpha:0, time:0.9});
}
public function ShowScoreBoard(){
Tweener.addTween(PlayerInfo, {alpha:1, time:0.9});
Tweener.addTween(OppInfo, {alpha:1, time:0.9});
}
function ChangePlayer(){
CurrInfo.HideDarts();
if (CurrInfo == PlayerInfo){
CurrInfo = OppInfo;
Parent.PlayState = vars.COMPUTER;
Parent.Darts.StartComputersGo();
} else {
CurrInfo = PlayerInfo;
Parent.Darts.StartPlayersGo();
Parent.PlayState = vars.PLAYING;
};
CurrInfo.ActivateGo();
}
function ReturnToMenu(_arg1:Event){
if (Parent.GAME_TYPE == vars.TOURNAMENT_GAME){
if (GameWins){
controller.dispatchEvent(new Event(MainGame.SHOW_NEXT_ROUND));
} else {
controller.dispatchEvent(new Event(MainGame.LEAVE_GAME));
};
} else {
controller.dispatchEvent(new Event(MainGame.LEAVE_GAME));
};
}
public function ResetLegs(){
PlayerInfo.NumLegs = 0;
OppInfo.NumLegs = 0;
}
public function SetScoreRoundTheClock(_arg1, _arg2, _arg3){
var _local4:* = 0;
trace("CurrInfo.Curren", CurrInfo.CurrentScore, _arg1);
dart_score.alpha = 1;
dart_score.x = 100;
dart_score.y = 0;
dart_score.GAME_SetScore3Digits(_arg1);
dart_score.visible = true;
switch (_arg2){
case vars.BULL:
if (CurrInfo.CurrentScore == 21){
_local4 = 1;
};
break;
case vars.TREBLE:
if (CurrInfo.CurrentScore == (_arg1 / 3)){
_local4 = 3;
};
break;
case vars.DOUBLE:
if (CurrInfo.CurrentScore == (_arg1 / 2)){
_local4 = 2;
};
break;
case vars.MISS:
break;
default:
if (CurrInfo.CurrentScore == _arg1){
_local4 = 1;
};
break;
};
if (_local4 == 0){
StartMissAnim();
} else {
StartHitAnim();
};
if (CurrInfo.CurrentScore == 19){
if (_local4 >= 2){
CurrInfo.CurrentScore = 21;
} else {
CurrInfo.CurrentScore = 20;
};
Tweener.addTween(dart_score, {x:150, time:1, onComplete:ResetBoard});
} else {
if (CurrInfo.CurrentScore == 20){
CurrInfo.CurrentScore = 21;
Tweener.addTween(dart_score, {x:150, time:1, onComplete:ResetBoard});
} else {
if (CurrInfo.CurrentScore == 21){
if (_local4 != 0){
GamePlaying = false;
if (CurrInfo == PlayerInfo){
win.visible = true;
PlayerInfo.AddLeg();
Tweener.addTween(dart_score, {x:150, time:2, onComplete:GameWon});
} else {
lose.visible = true;
OppInfo.AddLeg();
Tweener.addTween(dart_score, {x:150, time:2, onComplete:GameWon});
};
} else {
Tweener.addTween(dart_score, {x:150, time:1, onComplete:ResetBoard});
};
} else {
CurrInfo.CurrentScore = (CurrInfo.CurrentScore + _local4);
Tweener.addTween(dart_score, {x:150, time:1, onComplete:ResetBoard});
};
};
};
}
public function SetScoreDartAttack(_arg1, _arg2, _arg3){
var _local7:*;
var _local4:* = 0;
var _local5:* = false;
switch (_arg2){
case vars.TREBLE:
_local7 = ((_arg1 / 3) - 1);
_local4 = 3;
break;
case vars.DOUBLE:
_local7 = ((_arg1 / 2) - 1);
_local4 = 2;
break;
case vars.BULL:
case vars.MISS:
break;
default:
_local7 = (_arg1 - 1);
_local4 = 1;
break;
};
var _local6:* = 0;
while (_local6 < 10) {
if (vars.BlackArray[_local6] == (_local7 + 1)){
_local5 = true;
};
_local6++;
};
trace("num", _local7, Parent.Darts.HitArray[_local7]);
if (Parent.Darts.HitArray[_local7] > 0){
if (Parent.Darts.HitArray[_local7] >= _local4){
Parent.Darts.HitArray[_local7] = (Parent.Darts.HitArray[_local7] - _local4);
if (_local5){
PlayerInfo.CurrentScore = (PlayerInfo.CurrentScore - _local4);
} else {
OppInfo.CurrentScore = (OppInfo.CurrentScore - _local4);
};
} else {
if (_local5){
PlayerInfo.CurrentScore = (PlayerInfo.CurrentScore - Parent.Darts.HitArray[_local7]);
} else {
OppInfo.CurrentScore = (OppInfo.CurrentScore - Parent.Darts.HitArray[_local7]);
};
Parent.Darts.HitArray[_local7] = 0;
};
if (Parent.Darts.HitArray[_local7] == 0){
Parent.Darts.BombArray[_local7].visible = false;
} else {
Parent.Darts.BombArray[_local7].gotoAndStop(Parent.Darts.HitArray[_local7]);
};
if (CurrInfo == PlayerInfo){
if (_local5){
StartMissAnim();
} else {
StartHitAnim();
};
} else {
if (!_local5){
StartMissAnim();
} else {
StartHitAnim();
};
};
} else {
StartMissAnim();
};
if (_local4 == 0){
StartMissAnim();
};
if (OppInfo.CurrentScore == 0){
GamePlaying = false;
win.visible = true;
PlayerInfo.AddLeg();
Tweener.addTween(dart_score, {x:150, time:2, onComplete:GameWon});
} else {
if (PlayerInfo.CurrentScore == 0){
GamePlaying = false;
lose.visible = true;
OppInfo.AddLeg();
Tweener.addTween(dart_score, {x:150, time:2, onComplete:GameWon});
} else {
Tweener.addTween(dart_score, {x:150, time:1, onComplete:ResetBoard});
};
};
}
}
}//package game_code
Section 13
//playerinfo (game_code.playerinfo)
package game_code {
import flash.display.*;
import flash.text.*;
public class playerinfo extends MovieClip {
public var tallyText:TextField;
public var legsText:TextField;
public var faceMC:mcPlayerFace;
public var dart1:MovieClip;
public var dart2:MovieClip;
public var dart3:MovieClip;
public var scoreText:TextField;
public var scoreMC:MovieClip;
public var hiderMC:MovieClip;
public var box1MC:MovieClip;
public var box2MC:MovieClip;
public var CurrentScore;
public var NumDarts;// = 3
public var NumLegs;// = 0
public var Character;
public function HideDarts(){
dart1.visible = false;
dart2.visible = false;
dart3.visible = false;
hiderMC.visible = true;
}
public function ResetInfo(_arg1, _arg2, _arg3, _arg4, _arg5){
visible = true;
CurrentScore = _arg4;
Character = _arg3;
faceMC.gotoAndStop(_arg3);
scoreMC.gotoAndStop(_arg3);
scoreText.text = _arg4;
tallyText.text = "0";
legsText.text = NumLegs;
box1MC.gotoAndStop(_arg3);
box2MC.gotoAndStop(_arg3);
x = _arg1;
y = _arg2;
hiderMC.visible = true;
if (_arg5){
dart1.gotoAndStop(1);
dart2.gotoAndStop(1);
dart3.gotoAndStop(1);
} else {
dart1.gotoAndStop(2);
dart2.gotoAndStop(2);
dart3.gotoAndStop(2);
};
}
public function HideInfo(){
visible = false;
}
public function ActivateGo(){
NumDarts = 3;
dart1.visible = true;
dart2.visible = true;
dart3.visible = true;
hiderMC.visible = false;
}
function SetDarts(){
dart1.visible = false;
dart2.visible = false;
dart3.visible = false;
if (NumDarts == 1){
dart1.visible = true;
} else {
if (NumDarts == 2){
dart1.visible = true;
dart2.visible = true;
} else {
if (NumDarts == 3){
dart1.visible = true;
dart2.visible = true;
dart3.visible = true;
};
};
};
}
public function SetScore(_arg1){
scoreText.text = _arg1;
}
public function ChangeScore(_arg1, _arg2):Boolean{
trace("Changing score");
scoreText.text = _arg1;
tallyText.text = _arg2;
NumDarts--;
SetDarts();
if (NumDarts == 0){
hiderMC.visible = true;
return (true);
};
return (false);
}
public function AddLeg(){
NumLegs++;
legsText.text = NumLegs;
}
public function SetScoreAfterBust(){
scoreText.text = CurrentScore;
}
}
}//package game_code
Section 14
//score (game_code.score)
package game_code {
import flash.display.*;
public class score extends MovieClip {
var Digits;
var scorearray:Array;
public static const NUM_FRAMES = 1;
public function score(){
scorearray = new Array();
super();
}
public function CreateScores(_arg1, _arg2, _arg3, _arg4):void{
var _local6:*;
Digits = _arg4;
var _local5:* = -1;
while (++_local5 < Digits) {
_local6 = new mcNumber();
addChild(_local6);
scorearray.push(_local6);
_local6.x = (_arg1 + (_local5 * _arg3));
_local6.y = _arg2;
};
}
public function HideScore(){
var _local1:* = 0;
while (_local1 < Digits) {
scorearray[_local1].visible = false;
_local1++;
};
}
public function ShowScore(){
var _local1:* = 0;
while (_local1 < Digits) {
scorearray[_local1].visible = true;
_local1++;
};
}
public function GAME_SetScore7Digits(_arg1){
var _local2:int = (_arg1 % 10);
if (_arg1 > 999999){
scorearray[6].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 10);
_local2 = (_local2 % 10);
scorearray[5].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 100);
_local2 = (_local2 % 10);
scorearray[4].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 1000);
_local2 = (_local2 % 10);
scorearray[3].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 10000);
_local2 = (_local2 % 10);
scorearray[2].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 100000);
_local2 = (_local2 % 10);
scorearray[1].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 1000000);
_local2 = (_local2 % 10);
scorearray[0].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
} else {
if (_arg1 > 99999){
scorearray[6].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 10);
_local2 = (_local2 % 10);
scorearray[5].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 100);
_local2 = (_local2 % 10);
scorearray[4].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 1000);
_local2 = (_local2 % 10);
scorearray[3].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 10000);
_local2 = (_local2 % 10);
scorearray[2].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 100000);
_local2 = (_local2 % 10);
scorearray[1].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
scorearray[0].gotoAndStop("HIDE_NUMBER");
} else {
if (_arg1 > 9999){
scorearray[6].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 10);
_local2 = (_local2 % 10);
scorearray[5].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 100);
_local2 = (_local2 % 10);
scorearray[4].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 1000);
_local2 = (_local2 % 10);
scorearray[3].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 10000);
_local2 = (_local2 % 10);
scorearray[2].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
scorearray[1].gotoAndStop("HIDE_NUMBER");
scorearray[0].gotoAndStop("HIDE_NUMBER");
} else {
if (_arg1 > 999){
scorearray[6].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 10);
_local2 = (_local2 % 10);
scorearray[5].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 100);
_local2 = (_local2 % 10);
scorearray[4].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 1000);
_local2 = (_local2 % 10);
scorearray[3].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
scorearray[2].gotoAndStop("HIDE_NUMBER");
scorearray[1].gotoAndStop("HIDE_NUMBER");
scorearray[0].gotoAndStop("HIDE_NUMBER");
} else {
if (_arg1 > 99){
scorearray[6].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 10);
_local2 = (_local2 % 10);
scorearray[5].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 100);
_local2 = (_local2 % 10);
scorearray[4].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
scorearray[3].gotoAndStop("HIDE_NUMBER");
scorearray[2].gotoAndStop("HIDE_NUMBER");
scorearray[1].gotoAndStop("HIDE_NUMBER");
scorearray[0].gotoAndStop("HIDE_NUMBER");
} else {
if (_arg1 > 9){
scorearray[6].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
_local2 = (_arg1 / 10);
_local2 = (_local2 % 10);
scorearray[5].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
scorearray[4].gotoAndStop("HIDE_NUMBER");
scorearray[3].gotoAndStop("HIDE_NUMBER");
scorearray[2].gotoAndStop("HIDE_NUMBER");
scorearray[1].gotoAndStop("HIDE_NUMBER");
scorearray[0].gotoAndStop("HIDE_NUMBER");
} else {
scorearray[6].gotoAndStop(Math.floor(((_local2 * NUM_FRAMES) + 1)));
scorearray[5].gotoAndStop("HIDE_NUMBER");
scorearray[4].gotoAndStop("HIDE_NUMBER");
scorearray[3].gotoAndStop("HIDE_NUMBER");
scorearray[2].gotoAndStop("HIDE_NUMBER");
scorearray[1].gotoAndStop("HIDE_NUMBER");
scorearray[0].gotoAndStop("HIDE_NUMBER");
};
};
};
};
};
};
}
public function GAME_SetScore3Digits(_arg1){
var _local2:int = (_arg1 % 10);
if (_arg1 > 99){
scorearray[2].gotoAndStop(Math.floor((_local2 + 1)));
_local2 = (_arg1 / 10);
_local2 = (_local2 % 10);
scorearray[1].gotoAndStop(Math.floor((_local2 + 1)));
_local2 = (_arg1 / 100);
_local2 = (_local2 % 10);
scorearray[0].gotoAndStop(Math.floor((_local2 + 1)));
} else {
if (_arg1 > 9){
scorearray[0].gotoAndStop("HIDE_NUMBER");
scorearray[2].gotoAndStop(Math.floor((_local2 + 1)));
_local2 = (_arg1 / 10);
_local2 = (_local2 % 10);
scorearray[1].gotoAndStop(Math.floor((_local2 + 1)));
} else {
scorearray[1].gotoAndStop("HIDE_NUMBER");
scorearray[2].gotoAndStop(Math.floor((_local2 + 1)));
scorearray[0].gotoAndStop("HIDE_NUMBER");
};
};
}
public function GAME_SetScore2Digits(_arg1, _arg2){
trace("Scroe is", _arg1);
var _local3:int = (_arg1 % 10);
if (_arg1 > 9){
scorearray[1].gotoAndStop(Math.floor(((_local3 * NUM_FRAMES) + 1)));
_local3 = (_arg1 / 10);
_local3 = (_local3 % 10);
scorearray[0].gotoAndStop(Math.floor(((_local3 * NUM_FRAMES) + 1)));
} else {
scorearray[1].gotoAndStop(Math.floor(((_local3 * NUM_FRAMES) + 1)));
if (_arg2){
scorearray[0].gotoAndStop(1);
} else {
scorearray[0].gotoAndStop("HIDE_NUMBER");
};
};
}
}
}//package game_code
Section 15
//vars (game_code.vars)
package game_code {
public class vars {
public static const STARTING = 0;
public static const PLAYING = 1;
public static const COMPUTER = 2;
public static const PARTYINFO = 3;
public static const QUARTERS = 0;
public static const SEMI_FINAL = 1;
public static const FINAL = 2;
public static const WINNER = 3;
public static const CENTER_X = 368;
public static const CENTER_Y = 263;
public static const AIMINGBOARD = 4;
public static const THROWING = 2;
public static const THROWN = 3;
public static const SPIN_SPEED = 0.1;
public static const FAST_SPIN_SPEED = 0.12;
public static const DARTPOSITION = 180;
public static const DARTOUT = 0;
public static const DARTIN = 1;
public static const INOUT_SPEED = 10;
public static const FAST_INOUT_SPEED = 15;
public static const MAX_DISTANCE = 200;
public static const COS0 = 1;
public static const COS9 = 0.988;
public static const COS27 = 0.891;
public static const COS45 = 0.707;
public static const COS63 = 0.454;
public static const COS81 = 0.156;
public static const COS90 = 0;
public static const BULL = 7.5;
public static const TWENTYFIVE = 16;
public static const FIRSTSINGLE = 84;
public static const TREBLE = 93;
public static const SECONDSINGLE = 137;
public static const DOUBLE = 148;
public static const MISS = 1000;
public static const BOARD_X = 700;
public static const BOARD_Y = 300;
public static const QUICK_GAME = 0;
public static const TOURNAMENT_GAME = 1;
public static const ROUNDTHECLOCK_GAME = 2;
public static const DARTATTACK_GAME = 3;
public static const PLAYER1 = 1;
public static const PLAYER2 = 2;
public static const PLAYER3 = 3;
public static const PLAYER4 = 4;
public static const PLAYER5 = 5;
public static const PLAYER6 = 6;
public static const PLAYER7 = 7;
public static const PLAYER8 = 8;
public static const THREE01 = 301;
public static const FIVE01 = 501;
public static const AMATEUR = 1;
public static const PRO = 2;
public static const AIMFORSINGLE = 0;
public static const AIMFORDOUBLE = 1;
public static const AIMFORBULL = 2;
public static const AIMFORTREBLE = 3;
public static const AIMFOR25 = 4;
public static const AngleForNumber:Array = new Array(288, 54, 90, 324, 252, 0, 126, 162, 216, 18, 180, 234, 342, 198, 36, 144, 72, 306, 108, 270);
public static const LOWEST_FINISH_VAL = 137;
public static const CURRENT_SCORE = 0;
public static const NUM_REQUIRED = 1;
public static const AIMING_FOR = 2;
public static const CheckOut1:Array = new Array(2, 1, AIMFORDOUBLE);
public static const CheckOut2:Array = new Array(3, 1, AIMFORSINGLE);
public static const CheckOut3:Array = new Array(4, 2, AIMFORDOUBLE);
public static const CheckOut4:Array = new Array(5, 1, AIMFORSINGLE);
public static const CheckOut5:Array = new Array(6, 3, AIMFORDOUBLE);
public static const CheckOut6:Array = new Array(7, 1, AIMFORSINGLE);
public static const CheckOut7:Array = new Array(8, 4, AIMFORDOUBLE);
public static const CheckOut8:Array = new Array(9, 1, AIMFORSINGLE);
public static const CheckOut9:Array = new Array(10, 5, AIMFORDOUBLE);
public static const CheckOut10:Array = new Array(11, 3, AIMFORSINGLE);
public static const CheckOut11:Array = new Array(12, 6, AIMFORDOUBLE);
public static const CheckOut12:Array = new Array(13, 5, AIMFORSINGLE);
public static const CheckOut13:Array = new Array(14, 7, AIMFORDOUBLE);
public static const CheckOut14:Array = new Array(15, 7, AIMFORSINGLE);
public static const CheckOut15:Array = new Array(16, 8, AIMFORDOUBLE);
public static const CheckOut16:Array = new Array(17, 9, AIMFORSINGLE);
public static const CheckOut17:Array = new Array(18, 9, AIMFORDOUBLE);
public static const CheckOut18:Array = new Array(19, 1, AIMFORSINGLE);
public static const CheckOut19:Array = new Array(20, 10, AIMFORDOUBLE);
public static const CheckOut20:Array = new Array(21, 5, AIMFORSINGLE);
public static const CheckOut21:Array = new Array(22, 11, AIMFORDOUBLE);
public static const CheckOut22:Array = new Array(23, 7, AIMFORSINGLE);
public static const CheckOut23:Array = new Array(24, 12, AIMFORDOUBLE);
public static const CheckOut24:Array = new Array(25, 9, AIMFORSINGLE);
public static const CheckOut25:Array = new Array(26, 13, AIMFORDOUBLE);
public static const CheckOut26:Array = new Array(27, 1, AIMFORSINGLE);
public static const CheckOut27:Array = new Array(28, 14, AIMFORDOUBLE);
public static const CheckOut28:Array = new Array(29, 3, AIMFORSINGLE);
public static const CheckOut29:Array = new Array(30, 15, AIMFORDOUBLE);
public static const CheckOut30:Array = new Array(31, 15, AIMFORSINGLE);
public static const CheckOut31:Array = new Array(32, 16, AIMFORDOUBLE);
public static const CheckOut32:Array = new Array(33, 1, AIMFORSINGLE);
public static const CheckOut33:Array = new Array(34, 17, AIMFORDOUBLE);
public static const CheckOut34:Array = new Array(35, 3, AIMFORSINGLE);
public static const CheckOut35:Array = new Array(36, 18, AIMFORDOUBLE);
public static const CheckOut36:Array = new Array(37, 5, AIMFORSINGLE);
public static const CheckOut37:Array = new Array(38, 19, AIMFORDOUBLE);
public static const CheckOut38:Array = new Array(39, 7, AIMFORSINGLE);
public static const CheckOut39:Array = new Array(40, 20, AIMFORDOUBLE);
public static const CheckOut40:Array = new Array(41, 9, AIMFORSINGLE);
public static const CheckOut41:Array = new Array(42, 10, AIMFORSINGLE);
public static const CheckOut42:Array = new Array(43, 11, AIMFORSINGLE);
public static const CheckOut43:Array = new Array(44, 12, AIMFORSINGLE);
public static const CheckOut44:Array = new Array(45, 13, AIMFORSINGLE);
public static const CheckOut45:Array = new Array(46, 14, AIMFORSINGLE);
public static const CheckOut46:Array = new Array(47, 15, AIMFORSINGLE);
public static const CheckOut47:Array = new Array(48, 16, AIMFORSINGLE);
public static const CheckOut48:Array = new Array(49, 17, AIMFORSINGLE);
public static const CheckOut49:Array = new Array(50, 10, AIMFORBULL);
public static const CheckOut50:Array = new Array(51, 19, AIMFORSINGLE);
public static const CheckOut51:Array = new Array(52, 20, AIMFORSINGLE);
public static const CheckOut52:Array = new Array(53, 13, AIMFORSINGLE);
public static const CheckOut53:Array = new Array(54, 14, AIMFORSINGLE);
public static const CheckOut54:Array = new Array(55, 15, AIMFORSINGLE);
public static const CheckOut55:Array = new Array(56, 16, AIMFORSINGLE);
public static const CheckOut56:Array = new Array(57, 17, AIMFORSINGLE);
public static const CheckOut57:Array = new Array(58, 18, AIMFORSINGLE);
public static const CheckOut58:Array = new Array(59, 19, AIMFORSINGLE);
public static const CheckOut59:Array = new Array(60, 20, AIMFORSINGLE);
public static const CheckOut60:Array = new Array(61, 15, AIMFORTREBLE);
public static const CheckOut61:Array = new Array(62, 10, AIMFORTREBLE);
public static const CheckOut62:Array = new Array(63, 13, AIMFORTREBLE);
public static const CheckOut63:Array = new Array(64, 16, AIMFORDOUBLE);
public static const CheckOut64:Array = new Array(65, 15, AIMFORTREBLE);
public static const CheckOut65:Array = new Array(66, 10, AIMFORTREBLE);
public static const CheckOut66:Array = new Array(67, 17, AIMFORTREBLE);
public static const CheckOut67:Array = new Array(68, 16, AIMFORTREBLE);
public static const CheckOut68:Array = new Array(69, 19, AIMFORTREBLE);
public static const CheckOut69:Array = new Array(71, 13, AIMFORTREBLE);
public static const CheckOut70:Array = new Array(73, 19, AIMFORTREBLE);
public static const CheckOut71:Array = new Array(74, 14, AIMFORTREBLE);
public static const CheckOut72:Array = new Array(75, 15, AIMFORTREBLE);
public static const CheckOut73:Array = new Array(77, 15, AIMFORTREBLE);
public static const CheckOut74:Array = new Array(78, 14, AIMFORTREBLE);
public static const CheckOut75:Array = new Array(79, 13, AIMFORTREBLE);
public static const CheckOut76:Array = new Array(80, 16, AIMFORTREBLE);
public static const CheckOut77:Array = new Array(81, 15, AIMFORTREBLE);
public static const CheckOut78:Array = new Array(82, 14, AIMFORTREBLE);
public static const CheckOut79:Array = new Array(83, 17, AIMFORTREBLE);
public static const CheckOut80:Array = new Array(85, 15, AIMFORTREBLE);
public static const CheckOut81:Array = new Array(86, 18, AIMFORTREBLE);
public static const CheckOut82:Array = new Array(87, 17, AIMFORTREBLE);
public static const CheckOut83:Array = new Array(88, 16, AIMFORTREBLE);
public static const CheckOut84:Array = new Array(89, 19, AIMFORTREBLE);
public static const CheckOut85:Array = new Array(90, 18, AIMFORTREBLE);
public static const CheckOut86:Array = new Array(91, 17, AIMFORTREBLE);
public static const CheckOut87:Array = new Array(93, 19, AIMFORTREBLE);
public static const CheckOut88:Array = new Array(94, 18, AIMFORTREBLE);
public static const CheckOut89:Array = new Array(95, 18, AIMFORTREBLE);
public static const CheckOut90:Array = new Array(97, 19, AIMFORTREBLE);
public static const CheckOut91:Array = new Array(99, 19, AIMFORTREBLE);
public static const CheckOut92:Array = new Array(101, 17, AIMFORTREBLE);
public static const CheckOut93:Array = new Array(104, 18, AIMFORTREBLE);
public static const CheckOut94:Array = new Array(107, 19, AIMFORTREBLE);
public static const CheckOut95:Array = new Array(119, 19, AIMFORTREBLE);
public static const CheckOut96:Array = new Array(122, 18, AIMFORTREBLE);
public static const CheckOut97:Array = new Array(123, 19, AIMFORTREBLE);
public static const CheckOut98:Array = new Array(125, 1, AIMFORBULL);
public static const CheckOut99:Array = new Array(127, 19, AIMFORTREBLE);
public static const CheckOut100:Array = new Array(128, 18, AIMFORTREBLE);
public static const CheckOut101:Array = new Array(129, 19, AIMFORTREBLE);
public static const CheckOut102:Array = new Array(137, 17, AIMFORTREBLE);
public static const CheckOutArray:Array = new Array(CheckOut1, CheckOut2, CheckOut3, CheckOut4, CheckOut5, CheckOut6, CheckOut7, CheckOut8, CheckOut9, CheckOut10, CheckOut11, CheckOut12, CheckOut13, CheckOut14, CheckOut15, CheckOut16, CheckOut17, CheckOut18, CheckOut19, CheckOut20, CheckOut21, CheckOut22, CheckOut23, CheckOut24, CheckOut25, CheckOut26, CheckOut27, CheckOut28, CheckOut29, CheckOut30, CheckOut31, CheckOut32, CheckOut33, CheckOut34, CheckOut35, CheckOut36, CheckOut37, CheckOut38, CheckOut39, CheckOut40, CheckOut41, CheckOut42, CheckOut43, CheckOut44, CheckOut45, CheckOut46, CheckOut47, CheckOut48, CheckOut49, CheckOut50, CheckOut51, CheckOut52, CheckOut53, CheckOut54, CheckOut55, CheckOut56, CheckOut57, CheckOut58, CheckOut59, CheckOut60, CheckOut61, CheckOut62, CheckOut63, CheckOut64, CheckOut65, CheckOut66, CheckOut67, CheckOut68, CheckOut69, CheckOut70, CheckOut71, CheckOut72, CheckOut73, CheckOut74, CheckOut75, CheckOut76, CheckOut77, CheckOut78, CheckOut79, CheckOut80, CheckOut81, CheckOut82, CheckOut83, CheckOut84, CheckOut85, CheckOut86, CheckOut87, CheckOut88, CheckOut89, CheckOut90, CheckOut91, CheckOut92, CheckOut93, CheckOut94, CheckOut95, CheckOut96, CheckOut97, CheckOut98, CheckOut99, CheckOut100, CheckOut101, CheckOut102);
public static const EASY_RAND = 20;
public static const EASY_MOVEMENT = 40;
public static const HARD_RAND = 10;
public static const HARD_MOVEMENT = 20;
public static const BlackArray:Array = new Array(20, 18, 13, 10, 2, 3, 7, 8, 14, 12);
public static const WhiteArray:Array = new Array(1, 4, 6, 15, 17, 19, 16, 11, 9, 5);
}
}//package game_code
Section 16
//MochiAd (mochi.as3.MochiAd)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var mc = _arg1;
trace("oooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo");
var f:Function = 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);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function showPreGameAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var w:Number;
var h:Number;
var chk:MovieClip;
var complete:Boolean;
var unloaded:Boolean;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:5500, 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;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
if (options.skip){
ad_timeout = 0;
};
delete options.ad_timeout;
var fadeout_time:Number = 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);
var fn:Function = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
var wh:Array = 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);
var bar:MovieClip = 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);
};
var bar_w:Number = ((w - bar.x) - 10);
var bar_color:Number = options.color;
delete options.color;
var bar_background:Number = options.background;
delete options.background;
var bar_outline:Number = options.outline;
delete options.outline;
var backing_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 1);
var backing:Object = 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();
var inside_mc:MovieClip = createEmptyMovieClip(bar, "_inside", 2);
var inside:Object = 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;
var outline_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 3);
var outline:Object = 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 = (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;
var progress:Number = Math.min(1, options.progress_override(clip));
var f:Function = 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);
MainGame.instance.mochiDone();
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object = 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 _local12:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
var _local1:Object = this.parent.parent.root;
var _local2:Object = this.parent._mochiad_ctr;
var _local3:Number = (getTimer() - this.started);
var _local4:Boolean;
var _local5:Number = _local1.loaderInfo.bytesTotal;
var _local6:Number = _local1.loaderInfo.bytesLoaded;
var _local7:Number = Math.min(1, options.progress_override(_local1));
if (_local7 == 1){
complete = true;
};
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
var _local8:Number = ((100 * _local6) / _local5);
if (!isNaN(_local7)){
_local8 = (100 * _local7);
};
var _local9:Number = ((100 * _local3) / chk.ad_msec);
var _local10:Object = this._mochiad_bar._inside;
var _local11:Number = 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 showClickAwayAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:5500, 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;
var ad_timeout:Number = 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();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = 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 _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
var _local1:Object = this.parent._mochiad_ctr;
var _local2:Number = (getTimer() - this.started);
var _local3:Boolean;
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 showInterLevelAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:5500, 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)){
trace("RTHTRHRTHRTHRTHRTHRTHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHE");
MainGame.instance.mochiDone();
} 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;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = 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();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = 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{
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var _local1:Number = (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 = 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 _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var _local1:Object = this.parent._mochiad_ctr;
var _local2:Number = (getTimer() - this.started);
var _local3:Boolean;
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 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 _allowDomains(_arg1:String):String{
var _local2:String = _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 load(_arg1:Object):MovieClip{
var clip:Object;
var mc:MovieClip;
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;
var DEFAULTS:Object = {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."));
};
var depth:Number = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
var wh:Array = 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");
};
var lv:URLVariables = 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 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 _cleanup(_arg1:Object):void{
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);
};
var idx:Number = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local6:Array;
var _local3:Object = _arg2.getBounds(_arg2.root);
var _local4:Number = 0;
var _local5:Number = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.right - _local3.left);
_local5 = (_local3.top - _local3.bottom);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
var _local3:Object = {};
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 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 = _arg2.split(".");
var _local5:Number = 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 getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array = _arg2.split(".");
var _local4:Number = 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 runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array = _arg2.split(".");
var _local5:Number = 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 adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
}
}//package mochi.as3
Section 17
//MochiCoins (mochi.as3.MochiCoins)
package mochi.as3 {
public class MochiCoins {
public static const STORE_SHOW:String = "StoreShow";
public static const STORE_HIDE:String = "StoreHide";
public static const ITEM_OWNED:String = "ItemOwned";
public static const ITEM_NEW:String = "ItemNew";
public static const STORE_ITEMS:String = "StoreItems";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IOError";
public static const NO_USER:String = "NoUser";
public static var _inventory:MochiInventory;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function get inventory():MochiInventory{
return (_inventory);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showStore(_arg1:Object=null):void{
MochiServices.setContainer();
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.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showItem", {options:_arg1}, null, null);
}
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.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showVideo", {options:_arg1}, null, null);
}
public static function getStoreItems():void{
MochiServices.send("coins_getStoreItems");
}
public static function requestFunding(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestFunding", _arg1);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
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);
}
addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_inventory = new MochiInventory();
});
addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_inventory = null;
});
}
}//package mochi.as3
Section 18
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Fragment:Number;
private var Sibling:MochiDigits;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function get value():Number{
return (Number(this.toString()));
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String = _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 reencode():void{
var _local1:uint = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function toString():String{
var _local1:String = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
}
}//package mochi.as3
Section 19
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher)
package mochi.as3 {
public class MochiEventDispatcher {
private var eventTable:Object;
public function MochiEventDispatcher():void{
eventTable = {};
}
public function addEventListener(_arg1:String, _arg2:Function):void{
removeEventListener(_arg1, _arg2);
eventTable[_arg1].push(_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 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);
};
}
}
}//package mochi.as3
Section 20
//MochiEvents (mochi.as3.MochiEvents)
package mochi.as3 {
import flash.display.*;
public class MochiEvents {
public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived";
public static const ALIGN_TOP_LEFT:String = "ALIGN_TL";
public static const ALIGN_TOP:String = "ALIGN_T";
public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR";
public static const ALIGN_LEFT:String = "ALIGN_L";
public static const ALIGN_CENTER:String = "ALIGN_C";
public static const ALIGN_RIGHT:String = "ALIGN_R";
public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL";
public static const ALIGN_BOTTOM:String = "ALIGN_B";
public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR";
public static const FORMAT_SHORT:String = "ShortForm";
public static const FORMAT_LONG:String = "LongForm";
private static var gameStart:Number;
private static var levelStart:Number;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function startSession(_arg1:String):void{
MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null);
}
public static function setNotifications(_arg1:MovieClip, _arg2:Object):void{
var _local4:Object;
var _local3:Object = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
_local3.clip = _arg1;
MochiServices.send("events_setNotifications", _local3, null, null);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
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 startPlay(_arg1:String="gameplay"):void{
MochiServices.send("events_setRoundID", {tag:String(_arg1)}, null, null);
}
public static function endPlay():void{
MochiServices.send("events_clearRoundID", null, null, null);
}
public static function trackEvent(_arg1:String, _arg2=null):void{
MochiServices.send("events_trackEvent", {tag:_arg1, value:_arg2}, null, null);
}
}
}//package mochi.as3
Section 21
//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 _consumableProperties:Object;
private var _syncPending:Boolean;
private var _outstandingID:Number;
private var _syncID:Number;
private var _names:Array;
private var _storeSync:Object;
private static const CONSUMER_KEY:String = "MochiConsumables";
private static const KEY_SALT:String = " syncMaint";
public static const READY:String = "InvReady";
public static const WRITTEN:String = "InvWritten";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IoError";
public static const VALUE_ERROR:String = "InvValueError";
public static const NOT_READY:String = "InvNotReady";
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();
};
}
public function release():void{
MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, loggedOut);
}
private function loggedOut(_arg1:Object=null):void{
_consumableProperties = null;
}
private function loggedIn(_arg1:Object=null):void{
MochiUserData.get(CONSUMER_KEY, getConsumableBag);
}
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) && (_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));
};
}
private function itemOwned(_arg1:Object):void{
_storeSync[_arg1.id] = {properties:_arg1.properties, count:_arg1.count};
}
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 + KEY_SALT)].value);
};
if (_local3 == 0){
} else {
newItems({id:_local2, count:_local3, properties:_storeSync[_local2].properties});
};
};
triggerEvent(READY, {});
}
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 sync(_arg1:Event=null):void{
var _local3:String;
if (((_syncPending) || ((_syncID == _outstandingID)))){
return;
};
_outstandingID = _syncID;
var _local2:Object = {};
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 getProperty(_arg1){
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (-1);
};
if (_consumableProperties[_arg1]){
return (MochiDigits(_consumableProperties[_arg1]).value);
};
return (undefined);
}
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);
}
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 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++;
}
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 nextName(_arg1:int):String{
return (_names[(_arg1 - 1)]);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
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);
}
}
}//package mochi.as3
Section 22
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.geom.*;
import flash.system.*;
public class MochiServices {
public static const CONNECTED:String = "onConnected";
private static var _id:String;
private static var _container:Object;
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _timer:Timer;
private static var _preserved:Object;
private static var _servURL:String = "http://www.mochiads.com/static/lib/services/";
private static var _services:String = "services.swf";
private static var _mochiLC:String = "MochiLC.swf";
private static var _swfVersion:String;
private static var _listenChannelName:String = "__ms_";
private static var _sendChannel:LocalConnection;
private static var _sendChannelName:String;
private static var _connecting:Boolean = false;
private static var _connected:Boolean = false;
public static var netup:Boolean = true;
public static var netupAttempted:Boolean = false;
public static var onError:Object;
public static var widget:Boolean = false;
private static var _mochiLocalConnection:MovieClip;
private static var _queue:Array;
private static var _nextCallbackID:Number;
private static var _callbacks:Object;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function get id():String{
return (_id);
}
public static function get clip():Object{
return (_container);
}
public static function get childClip():Object{
return (_clip);
}
public static function getVersion():String{
return ("3.9.2 as3");
}
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 isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
public static function get connected():Boolean{
return (_connected);
}
public static function warnID(_arg1:String, _arg2:Boolean):void{
_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;
};
};
};
var _local3:Number = 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++;
};
}
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 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();
_timer.removeEventListener(TimerEvent.TIMER, connectWait);
_timer = null;
} catch(error:Error) {
};
};
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
}
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);
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
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 loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(_arg2).servURL){
_servURL = urlOptions(_arg2).servURL;
};
var _local3:String = (_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(Event.COMPLETE, detach);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
var _local4:URLRequest = new URLRequest(_local3);
var _local5:URLVariables = 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);
}
private static function detach(_arg1:Event):void{
var _local2:LoaderInfo = LoaderInfo(_arg1.target);
_local2.removeEventListener(Event.COMPLETE, detach);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, detach);
_local2.removeEventListener(Event.COMPLETE, loadLCBridgeComplete);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, loadError);
}
private static function loadLCBridge(_arg1:Object):void{
var _local2:Loader = new Loader();
var _local3:String = (_servURL + _mochiLC);
var _local4:URLRequest = new URLRequest(_local3);
_local2.contentLoaderInfo.addEventListener(Event.COMPLETE, detach);
_local2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach);
_local2.contentLoaderInfo.addEventListener(Event.COMPLETE, loadLCBridgeComplete);
_local2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
_local2.load(_local4);
_arg1.addChild(_local2);
}
private static function loadLCBridgeComplete(_arg1:Event):void{
var _local2:Loader = LoaderInfo(_arg1.target).loader;
_mochiLocalConnection = MovieClip(_local2.content);
listen();
}
private static function loadError(_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
}
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");
} else {
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, connectWait);
_timer = null;
};
}
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...");
}
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 onReceive(_arg1:Object):void{
var methodName:String;
var pkg = _arg1;
var cb:String = pkg.callbackID;
var cblst:Object = _callbacks[cb];
if (!cblst){
return;
};
var method:* = cblst.callbackMethod;
methodName = "";
var obj:Object = 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];
}
private static function onEvent(_arg1:Object):void{
var _local2:String = _arg1.target;
var _local3:String = _arg1.event;
switch (_local2){
case "services":
MochiServices.triggerEvent(_arg1.event, _arg1.args);
break;
case "events":
MochiEvents.triggerEvent(_arg1.event, _arg1.args);
break;
case "coins":
MochiCoins.triggerEvent(_arg1.event, _arg1.args);
break;
case "social":
MochiSocial.triggerEvent(_arg1.event, _arg1.args);
break;
};
}
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);
};
};
};
};
}
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) {
};
};
};
};
}
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 urlOptions(_arg1:Object):Object{
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
var _local2:Object = {};
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 addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var avm1Click:DisplayObject;
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;
var vars:Object = 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);
var s = "?";
var i:Number = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://link.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
var _local2:Rectangle = 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);
};
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local4:int;
var _local14:Loader;
var _local3:Array = [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];
var _local5:Array = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
var _local6:Array = [0, 64, 0, 0, 0];
var _local7:MovieClip = new MovieClip();
var _local8:LocalConnection = new LocalConnection();
var _local9:String = ((("_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);
var _local10:ByteArray = new ByteArray();
var _local11:ByteArray = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
var _local12:uint = ((_local3.length + _local11.length) + 4);
var _local13:uint = (_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 addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
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);
}
}
}//package mochi.as3
Section 23
//MochiSocial (mochi.as3.MochiSocial)
package mochi.as3 {
public class MochiSocial {
public static const LOGGED_IN:String = "LoggedIn";
public static const LOGGED_OUT:String = "LoggedOut";
public static const LOGIN_SHOW:String = "LoginShow";
public static const LOGIN_HIDE:String = "LoginHide";
public static const LOGIN_SHOWN:String = "LoginShown";
public static const PROFILE_SHOW:String = "ProfileShow";
public static const PROFILE_HIDE:String = "ProfileHide";
public static const PROPERTIES_SAVED:String = "PropertySaved";
public static const WIDGET_LOADED:String = "WidgetLoaded";
public static const FRIEND_LIST:String = "FriendsList";
public static const PROFILE_DATA:String = "ProfileData";
public static const GAMEPLAY_DATA:String = "GameplayData";
public static const ACTION_CANCELED:String = "onCancel";
public static const ACTION_COMPLETE:String = "onComplete";
public static const USER_INFO:String = "UserInfo";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IOError";
public static const NO_USER:String = "NoUser";
public static const PROPERTIES_SIZE:String = "PropertiesSize";
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 getAPIURL():String{
if (!_user_info){
return (null);
};
return (_user_info.api_url);
}
public static function getAPIToken():String{
if (!_user_info){
return (null);
};
return (_user_info.api_token);
}
public static function showLoginWidget(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_showLoginWidget", {options:_arg1});
}
public static function hideLoginWidget():void{
MochiServices.send("social_hideLoginWidget");
}
public static function requestLogin(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestLogin", _arg1);
}
public static function saveUserProperties(_arg1:Object):void{
MochiServices.send("social_saveUserProperties", _arg1);
}
public static function getFriendsList(_arg1:Object=null):void{
MochiServices.send("social_getFriendsList", _arg1);
}
public static function postToStream(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_postToStream", _arg1);
}
public static function inviteFriends(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_inviteFriends", _arg1);
}
public static function requestFan(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestFan", _arg1);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
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 removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
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 24
//MochiUserData (mochi.as3.MochiUserData)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
public class MochiUserData extends EventDispatcher {
public var _loader:URLLoader;
public var key:String;// = null
public var data;// = null
public var error:Event;// = null
public var operation:String;// = null
public var callback:Function;// = null
public function MochiUserData(_arg1:String="", _arg2:Function=null){
this.key = _arg1;
this.callback = _arg2;
}
public function serialize(_arg1):ByteArray{
var _local2:ByteArray = new ByteArray();
_local2.objectEncoding = ObjectEncoding.AMF3;
_local2.writeObject(_arg1);
_local2.compress();
return (_local2);
}
public function deserialize(_arg1:ByteArray){
_arg1.objectEncoding = ObjectEncoding.AMF3;
_arg1.uncompress();
return (_arg1.readObject());
}
public function request(_arg1:String, _arg2:ByteArray):void{
var _operation = _arg1;
var _data = _arg2;
operation = _operation;
var api_url:String = MochiSocial.getAPIURL();
var api_token:String = MochiSocial.getAPIToken();
if ((((api_url == null)) || ((api_token == null)))){
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, "not logged in"));
return;
};
_loader = new URLLoader();
var args:URLVariables = new URLVariables();
args.op = _operation;
args.key = key;
var req:URLRequest = 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 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 errorHandler(_arg1:IOErrorEvent):void{
data = null;
error = _arg1;
if (callback != null){
performCallback();
} else {
dispatchEvent(_arg1);
};
close();
}
public function securityErrorHandler(_arg1:SecurityErrorEvent):void{
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.toString())));
}
public function performCallback():void{
try {
callback(this);
} catch(e:Error) {
trace(("[MochiUserData] exception during callback: " + e));
};
}
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 getEvent():void{
request("get", serialize(null));
}
public function putEvent(_arg1):void{
request("put", serialize(_arg1));
}
override public function toString():String{
return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]"));
}
public static function get(_arg1:String, _arg2:Function):void{
var _local3:MochiUserData = new MochiUserData(_arg1, _arg2);
_local3.getEvent();
}
public static function put(_arg1:String, _arg2, _arg3:Function):void{
var _local4:MochiUserData = new MochiUserData(_arg1, _arg3);
_local4.putEvent(_arg2);
}
}
}//package mochi.as3
Section 25
//AdvMovieClip (user_interface.core.AdvMovieClip)
package user_interface.core {
import flash.events.*;
import flash.display.*;
public class AdvMovieClip extends MovieClip {
public var introMode:Boolean;
private var forcedFrame:uint;
public function AdvMovieClip(){
var _local1:FrameEventCore = new FrameEventCore(this);
}
public function show(){
gotoAndPlay(FrameEventCore.FADE_IN);
}
public function hide(){
gotoAndPlay(FrameEventCore.FADE_OUT);
}
private function forceFrame(_arg1:Event):void{
forcedFrame--;
gotoAndStop(forcedFrame);
if (currentLabel == FrameEventCore.INTERACTIVE){
removeEventListener(Event.ENTER_FRAME, forceFrame);
gotoAndPlay(FrameEventCore.INTERACTIVE);
};
}
}
}//package user_interface.core
Section 26
//FrameEventCore (user_interface.core.FrameEventCore)
package user_interface.core {
import flash.events.*;
import flash.display.*;
public class FrameEventCore {
private var mc:MovieClip;
private var controller:EventDispatcher;
public static const INTRO:String = "intro";
public static const FADE_IN:String = "fadeIn";
public static const INTERACTIVE:String = "interactive";
public static const FADE_OUT:String = "fadeOut";
public static const INACTIVE:String = "inactive";
public function FrameEventCore(_arg1:MovieClip){
var _local2:FrameLabel;
var _local3:*;
super();
mc = _arg1;
for (_local3 in mc.currentScene.labels) {
_local2 = mc.currentScene.labels[_local3];
switch (_local2.name){
case INTRO:
mc.introMode = true;
mc.gotoAndStop(INTRO);
mc.addFrameScript(_local2.frame, intro);
break;
case FADE_IN:
mc.introMode = false;
mc.gotoAndStop(FADE_IN);
mc.addFrameScript(_local2.frame, fadeIn);
break;
case INTERACTIVE:
mc.addFrameScript(_local2.frame, activate);
break;
case FADE_OUT:
mc.addFrameScript(_local2.frame, fadeOut);
break;
case INACTIVE:
mc.addFrameScript(_local2.frame, inactive);
break;
default:
trace((("TIMELINE ERROR label: " + _local2.name) + " is not supported"));
break;
};
};
}
private function intro():void{
mc.dispatchEvent(new Event(INTRO));
}
private function fadeIn():void{
mc.dispatchEvent(new Event(FADE_IN));
}
public function activate():void{
mc.gotoAndStop(INTERACTIVE);
mc.dispatchEvent(new Event(INTERACTIVE));
}
private function fadeOut():void{
mc.dispatchEvent(new Event(FADE_OUT));
}
private function inactive():void{
mc.gotoAndStop(INACTIVE);
mc.dispatchEvent(new Event(INACTIVE));
}
}
}//package user_interface.core
Section 27
//ChooseScreen (user_interface.ChooseScreen)
package user_interface {
import flash.events.*;
import flash.display.*;
import caurina.transitions.*;
import game_code.*;
import user_interface.core.*;
public class ChooseScreen extends AdvMovieClip {
public var choosePlayerMC:mcChoosePlayer;
public var tournTableMC:MovieClip;
public var chooseGameMC:mcChooseGame;
public var gameinfoMC:MovieClip;
var PlayGame;// = true
public var PLAYER;// = 1
public var OPPONENT;
public var TOURN_STAGE;// = 0
public var GAME_TYPE;
public var DIFFICULTY;// = 1
public var GAME_LENGTH;// = 301
private var GoToHelp;// = false
private var controller:EventDispatcher;
var TournLayout;
var SemiLayout:Array;
var FinalLayout:Array;
public function ChooseScreen(){
SemiLayout = new Array();
FinalLayout = new Array();
super();
}
public function init(_arg1:EventDispatcher){
controller = _arg1;
addEventListener(FrameEventCore.INTERACTIVE, activateUserInterface);
addEventListener(FrameEventCore.INACTIVE, StartNextScreen);
controller.addEventListener(MainGame.SHOW_CHOOSE, fadeIn);
controller.addEventListener(MainGame.SHOW_NEXT_ROUND, fadeInRound);
}
private function fadeIn(_arg1:Event):void{
TOURN_STAGE = vars.QUARTERS;
show();
}
private function fadeInRound(_arg1:Event):void{
TOURN_STAGE++;
show();
}
function AddEventListenersForChooseGame(){
chooseGameMC.cacheAsBitmap = true;
chooseGameMC.quickgameB.addEventListener(MouseEvent.CLICK, StartQuickGame);
chooseGameMC.tournamentB.addEventListener(MouseEvent.CLICK, StartTournament);
chooseGameMC.dartattackB.addEventListener(MouseEvent.CLICK, StartDartAttack);
chooseGameMC.roundtheclockB.addEventListener(MouseEvent.CLICK, StartRoundtheClock);
}
function RemoveEventListenersForChooseGame(){
chooseGameMC.quickgameB.removeEventListener(MouseEvent.CLICK, StartQuickGame);
chooseGameMC.tournamentB.removeEventListener(MouseEvent.CLICK, StartTournament);
chooseGameMC.dartattackB.removeEventListener(MouseEvent.CLICK, StartDartAttack);
chooseGameMC.roundtheclockB.removeEventListener(MouseEvent.CLICK, StartRoundtheClock);
}
function SetChoosePlayers(){
choosePlayerMC.cacheAsBitmap = true;
choosePlayerMC.player1MC.visible = false;
choosePlayerMC.player2MC.visible = false;
choosePlayerMC.player3MC.visible = false;
choosePlayerMC.player4MC.visible = false;
choosePlayerMC.player5MC.visible = false;
choosePlayerMC.player6MC.visible = false;
choosePlayerMC.player7MC.visible = false;
choosePlayerMC.player8MC.visible = false;
switch (PLAYER){
case vars.PLAYER1:
choosePlayerMC.player1MC.visible = true;
break;
case vars.PLAYER2:
choosePlayerMC.player2MC.visible = true;
break;
case vars.PLAYER3:
choosePlayerMC.player3MC.visible = true;
break;
case vars.PLAYER4:
choosePlayerMC.player4MC.visible = true;
break;
case vars.PLAYER5:
choosePlayerMC.player5MC.visible = true;
break;
case vars.PLAYER6:
choosePlayerMC.player6MC.visible = true;
break;
case vars.PLAYER7:
choosePlayerMC.player7MC.visible = true;
break;
case vars.PLAYER8:
choosePlayerMC.player8MC.visible = true;
break;
};
}
function AddEventListenersForChoosePlayer(){
SetChoosePlayers();
choosePlayerMC.player1B.addEventListener(MouseEvent.CLICK, ChoosePlayer1);
choosePlayerMC.player2B.addEventListener(MouseEvent.CLICK, ChoosePlayer2);
choosePlayerMC.player3B.addEventListener(MouseEvent.CLICK, ChoosePlayer3);
choosePlayerMC.player4B.addEventListener(MouseEvent.CLICK, ChoosePlayer4);
choosePlayerMC.player5B.addEventListener(MouseEvent.CLICK, ChoosePlayer5);
choosePlayerMC.player6B.addEventListener(MouseEvent.CLICK, ChoosePlayer6);
choosePlayerMC.player7B.addEventListener(MouseEvent.CLICK, ChoosePlayer7);
choosePlayerMC.player8B.addEventListener(MouseEvent.CLICK, ChoosePlayer8);
gameinfoMC.playB.addEventListener(MouseEvent.CLICK, StartGame);
gameinfoMC.backB.addEventListener(MouseEvent.CLICK, BackToChooseGame);
gameinfoMC.gametitleMC.b301.addEventListener(MouseEvent.CLICK, SetGameLength301);
gameinfoMC.gametitleMC.b501.addEventListener(MouseEvent.CLICK, SetGameLength501);
gameinfoMC.gametitleMC.bAmateur.addEventListener(MouseEvent.CLICK, SetGameDiffAm);
gameinfoMC.gametitleMC.bPro.addEventListener(MouseEvent.CLICK, SetGameDiffPro);
}
function RemoveEventListenersForChoosePlayer(){
choosePlayerMC.player1B.removeEventListener(MouseEvent.CLICK, ChoosePlayer1);
choosePlayerMC.player2B.removeEventListener(MouseEvent.CLICK, ChoosePlayer2);
choosePlayerMC.player3B.removeEventListener(MouseEvent.CLICK, ChoosePlayer3);
choosePlayerMC.player4B.removeEventListener(MouseEvent.CLICK, ChoosePlayer4);
choosePlayerMC.player5B.removeEventListener(MouseEvent.CLICK, ChoosePlayer5);
choosePlayerMC.player6B.removeEventListener(MouseEvent.CLICK, ChoosePlayer6);
choosePlayerMC.player7B.removeEventListener(MouseEvent.CLICK, ChoosePlayer7);
choosePlayerMC.player8B.removeEventListener(MouseEvent.CLICK, ChoosePlayer8);
gameinfoMC.playB.removeEventListener(MouseEvent.CLICK, StartGame);
gameinfoMC.backB.removeEventListener(MouseEvent.CLICK, BackToChooseGame);
gameinfoMC.gametitleMC.b301.removeEventListener(MouseEvent.CLICK, SetGameLength301);
gameinfoMC.gametitleMC.b501.removeEventListener(MouseEvent.CLICK, SetGameLength501);
gameinfoMC.gametitleMC.bAmateur.removeEventListener(MouseEvent.CLICK, SetGameDiffAm);
gameinfoMC.gametitleMC.bPro.removeEventListener(MouseEvent.CLICK, SetGameDiffPro);
}
private function activateUserInterface(_arg1:Event):void{
controller.dispatchEvent(new Event(MainGame.FX_TRANSITION));
switch (TOURN_STAGE){
case vars.QUARTERS:
tournTableMC.visible = false;
Tweener.addTween(chooseGameMC, {x:300, time:1});
AddEventListenersForChooseGame();
break;
case vars.SEMI_FINAL:
ReturnToTournamentTableSemiFinal();
break;
case vars.FINAL:
ReturnToTournamentTableFinal();
break;
case vars.WINNER:
ReturnToTournamentTableWinner();
break;
};
}
function SetGameSkill(){
gameinfoMC.gametitleMC.mcAmateur.visible = false;
gameinfoMC.gametitleMC.mcPro.visible = false;
if (DIFFICULTY == vars.AMATEUR){
gameinfoMC.gametitleMC.mcAmateur.visible = true;
} else {
gameinfoMC.gametitleMC.mcPro.visible = true;
};
}
function SetGameLength(){
trace(gameinfoMC);
trace(gameinfoMC.gametitleMC);
trace(gameinfoMC.gametitleMC.mc301);
gameinfoMC.gametitleMC.mc301.visible = false;
gameinfoMC.gametitleMC.mc501.visible = false;
if (GAME_LENGTH == vars.THREE01){
gameinfoMC.gametitleMC.mc301.visible = true;
} else {
gameinfoMC.gametitleMC.mc501.visible = true;
};
}
private function StartQuickGame(_arg1:MouseEvent):void{
GAME_TYPE = vars.QUICK_GAME;
Tweener.addTween(chooseGameMC, {y:1000, time:1});
controller.dispatchEvent(new Event(MainGame.FX_TRANSITION));
Tweener.addTween(choosePlayerMC, {x:100, time:0.5, delay:0.7});
Tweener.addTween(gameinfoMC, {x:620, time:0.5, delay:0.7});
gameinfoMC.gametitleMC.gotoAndStop(1);
RemoveEventListenersForChooseGame();
AddEventListenersForChoosePlayer();
SetGameLength();
SetGameSkill();
}
function SetGameLength301(_arg1:Event){
GAME_LENGTH = vars.THREE01;
SetGameLength();
}
function SetGameLength501(_arg1:Event){
GAME_LENGTH = vars.FIVE01;
SetGameLength();
}
function SetGameDiffAm(_arg1:Event){
DIFFICULTY = vars.AMATEUR;
SetGameSkill();
}
function SetGameDiffPro(_arg1:Event){
DIFFICULTY = vars.PRO;
SetGameSkill();
}
private function StartTournament(_arg1:MouseEvent):void{
controller.dispatchEvent(new Event(MainGame.FX_TRANSITION));
GAME_TYPE = vars.TOURNAMENT_GAME;
Tweener.addTween(chooseGameMC, {y:1000, time:1});
Tweener.addTween(choosePlayerMC, {x:100, time:0.5, delay:0.7});
Tweener.addTween(gameinfoMC, {x:620, time:0.5, delay:0.7});
RemoveEventListenersForChooseGame();
AddEventListenersForChoosePlayer();
gameinfoMC.gametitleMC.gotoAndStop(2);
SetGameSkill();
SetGameLength();
}
private function StartDartAttack(_arg1:MouseEvent):void{
controller.dispatchEvent(new Event(MainGame.FX_TRANSITION));
GAME_TYPE = vars.DARTATTACK_GAME;
Tweener.addTween(chooseGameMC, {y:1000, time:1});
Tweener.addTween(choosePlayerMC, {x:100, time:0.5, delay:0.7});
Tweener.addTween(gameinfoMC, {x:620, time:0.5, delay:0.7});
RemoveEventListenersForChooseGame();
AddEventListenersForChoosePlayer();
gameinfoMC.gametitleMC.gotoAndStop(3);
SetGameSkill();
}
private function StartRoundtheClock(_arg1:MouseEvent):void{
controller.dispatchEvent(new Event(MainGame.FX_TRANSITION));
GAME_TYPE = vars.ROUNDTHECLOCK_GAME;
Tweener.addTween(chooseGameMC, {y:1000, time:1});
Tweener.addTween(choosePlayerMC, {x:100, time:0.5, delay:0.7});
Tweener.addTween(gameinfoMC, {x:620, time:0.5, delay:0.7});
RemoveEventListenersForChooseGame();
AddEventListenersForChoosePlayer();
gameinfoMC.gametitleMC.gotoAndStop(4);
SetGameSkill();
}
function ChoosePlayer1(_arg1:Event){
PLAYER = vars.PLAYER1;
controller.dispatchEvent(new Event(MainGame.FX_CLICK));
SetChoosePlayers();
}
function ChoosePlayer2(_arg1:Event){
PLAYER = vars.PLAYER2;
controller.dispatchEvent(new Event(MainGame.FX_CLICK));
SetChoosePlayers();
}
function ChoosePlayer3(_arg1:Event){
PLAYER = vars.PLAYER3;
controller.dispatchEvent(new Event(MainGame.FX_CLICK));
SetChoosePlayers();
}
function ChoosePlayer4(_arg1:Event){
PLAYER = vars.PLAYER4;
controller.dispatchEvent(new Event(MainGame.FX_CLICK));
SetChoosePlayers();
}
function ChoosePlayer5(_arg1:Event){
PLAYER = vars.PLAYER5;
controller.dispatchEvent(new Event(MainGame.FX_CLICK));
SetChoosePlayers();
}
function ChoosePlayer6(_arg1:Event){
PLAYER = vars.PLAYER6;
controller.dispatchEvent(new Event(MainGame.FX_CLICK));
SetChoosePlayers();
}
function ChoosePlayer7(_arg1:Event){
PLAYER = vars.PLAYER7;
controller.dispatchEvent(new Event(MainGame.FX_CLICK));
SetChoosePlayers();
}
function ChoosePlayer8(_arg1:Event){
PLAYER = vars.PLAYER8;
controller.dispatchEvent(new Event(MainGame.FX_CLICK));
SetChoosePlayers();
}
function StartGame(_arg1:Event){
MochiBot.track(this, "5d74f2a2");
trace("=====================================================SEND TO MOCHI !");
gameinfoMC.gametitleMC.b301.removeEventListener(MouseEvent.CLICK, SetGameLength301);
gameinfoMC.gametitleMC.b501.removeEventListener(MouseEvent.CLICK, SetGameLength501);
gameinfoMC.gametitleMC.bAmateur.removeEventListener(MouseEvent.CLICK, SetGameDiffAm);
gameinfoMC.gametitleMC.bPro.removeEventListener(MouseEvent.CLICK, SetGameDiffPro);
OPPONENT = (Math.floor((Math.random() * 8)) + 1);
if (OPPONENT == PLAYER){
OPPONENT = (PLAYER + 1);
if (OPPONENT == 9){
OPPONENT = 1;
};
};
switch (GAME_TYPE){
case vars.TOURNAMENT_GAME:
Tweener.addTween(gameinfoMC, {x:1000, time:0.5});
Tweener.addTween(choosePlayerMC, {x:-300, time:0.5});
Tweener.addTween(gameinfoMC, {x:1000, time:0.5});
CreateInitTournamament();
break;
default:
PlayGame = true;
hide();
};
}
function BeginTournament(_arg1:Event){
tournTableMC.playB.removeEventListener(MouseEvent.CLICK, BeginTournament);
PlayGame = true;
hide();
}
function TournamentOver(_arg1:Event){
PlayGame = false;
hide();
}
function BackToChooseGame(_arg1:Event){
RemoveEventListenersForChoosePlayer();
Tweener.addTween(chooseGameMC, {x:-600, y:151});
Tweener.addTween(chooseGameMC, {x:300, delay:0.5, time:1});
AddEventListenersForChooseGame();
Tweener.addTween(gameinfoMC, {x:1000, time:0.5});
Tweener.addTween(choosePlayerMC, {x:-300, time:0.5});
}
private function StartNextScreen(_arg1:Event){
if (PlayGame){
controller.dispatchEvent(new Event(MainGame.SET_DIFFICULTY));
controller.dispatchEvent(new Event(MainGame.START_GAME));
controller.dispatchEvent(new Event(MainGame.FX_TRANSITION));
} else {
controller.dispatchEvent(new Event(MainGame.SHOW_SPLASH));
};
}
function getUniqueRandom(_arg1, _arg2){
var _local6:*;
var _local3:* = new Array();
var _local4:* = 0;
while (_local4 < _arg1) {
_local3[_local4] = (_local4 + _arg2);
_local4++;
};
var _local5:* = new Array();
_local4 = (_local3.length - 1);
while (_local4 >= 0) {
_local6 = Math.floor((Math.random() * _local4));
_local5[_local4] = _local3[_local6];
_local3[_local6] = _local3[_local4];
_local4--;
};
return (_local5);
}
function CreateInitTournamament(){
TournLayout = getUniqueRandom(8, 1);
trace(TournLayout, PLAYER);
tournTableMC.visible = true;
Tweener.addTween(tournTableMC, {y:0, time:1, delay:0.5});
tournTableMC.player1.gotoAndStop(PLAYER);
var _local1:* = 0;
var _local2:* = TournLayout[0];
TournLayout[0] = PLAYER;
var _local3:* = 1;
while (_local3 < 8) {
if (TournLayout[_local3] == PLAYER){
TournLayout[_local3] = _local2;
};
_local3++;
};
trace(TournLayout, PLAYER);
tournTableMC.winMC.visible = false;
tournTableMC.winfaceMC.visible = false;
tournTableMC.player2.gotoAndStop(TournLayout[1]);
tournTableMC.player3.gotoAndStop(TournLayout[2]);
tournTableMC.player4.gotoAndStop(TournLayout[3]);
tournTableMC.player5.gotoAndStop(TournLayout[4]);
tournTableMC.player6.gotoAndStop(TournLayout[5]);
tournTableMC.player7.gotoAndStop(TournLayout[6]);
tournTableMC.player8.gotoAndStop(TournLayout[7]);
tournTableMC.player1sf.gotoAndStop(9);
tournTableMC.player2sf.gotoAndStop(9);
tournTableMC.player3sf.gotoAndStop(9);
tournTableMC.player4sf.gotoAndStop(9);
tournTableMC.player1f.gotoAndStop(9);
tournTableMC.player2f.gotoAndStop(9);
tournTableMC.playB.addEventListener(MouseEvent.CLICK, BeginTournament);
OPPONENT = TournLayout[1];
}
function ReturnToTournamentTableSemiFinal(){
tournTableMC.winMC.visible = false;
tournTableMC.winfaceMC.visible = false;
tournTableMC.playB.addEventListener(MouseEvent.CLICK, BeginTournament);
tournTableMC.visible = true;
Tweener.addTween(tournTableMC, {y:0, time:1, delay:0.5});
tournTableMC.player1sf.gotoAndStop(PLAYER);
tournTableMC.player1.gotoAndStop(PLAYER);
tournTableMC.player2.gotoAndStop(TournLayout[1]);
tournTableMC.player3.gotoAndStop(TournLayout[2]);
tournTableMC.player4.gotoAndStop(TournLayout[3]);
tournTableMC.player5.gotoAndStop(TournLayout[4]);
tournTableMC.player6.gotoAndStop(TournLayout[5]);
tournTableMC.player7.gotoAndStop(TournLayout[6]);
tournTableMC.player8.gotoAndStop(TournLayout[7]);
var _local1:* = Math.floor((Math.random() * 2));
if (_local1 == 0){
SemiLayout[1] = TournLayout[2];
} else {
SemiLayout[1] = TournLayout[3];
};
tournTableMC.player2sf.gotoAndStop(SemiLayout[1]);
_local1 = Math.floor((Math.random() * 2));
if (_local1 == 0){
SemiLayout[2] = TournLayout[4];
} else {
SemiLayout[2] = TournLayout[5];
};
tournTableMC.player3sf.gotoAndStop(SemiLayout[2]);
_local1 = Math.floor((Math.random() * 2));
if (_local1 == 0){
SemiLayout[3] = TournLayout[6];
} else {
SemiLayout[3] = TournLayout[7];
};
tournTableMC.player4sf.gotoAndStop(SemiLayout[3]);
tournTableMC.player1f.gotoAndStop(9);
tournTableMC.player2f.gotoAndStop(9);
OPPONENT = SemiLayout[1];
}
function ReturnToTournamentTableFinal(){
tournTableMC.winMC.visible = false;
tournTableMC.winfaceMC.visible = false;
tournTableMC.visible = true;
Tweener.addTween(tournTableMC, {y:0, time:1, delay:0.5});
tournTableMC.playB.addEventListener(MouseEvent.CLICK, BeginTournament);
tournTableMC.player1.gotoAndStop(PLAYER);
tournTableMC.player2.gotoAndStop(TournLayout[1]);
tournTableMC.player3.gotoAndStop(TournLayout[2]);
tournTableMC.player4.gotoAndStop(TournLayout[3]);
tournTableMC.player5.gotoAndStop(TournLayout[4]);
tournTableMC.player6.gotoAndStop(TournLayout[5]);
tournTableMC.player7.gotoAndStop(TournLayout[6]);
tournTableMC.player8.gotoAndStop(TournLayout[7]);
tournTableMC.player1sf.gotoAndStop(PLAYER);
tournTableMC.player2sf.gotoAndStop(SemiLayout[1]);
tournTableMC.player3sf.gotoAndStop(SemiLayout[2]);
tournTableMC.player4sf.gotoAndStop(SemiLayout[3]);
tournTableMC.player1f.gotoAndStop(PLAYER);
var _local1:* = Math.floor((Math.random() * 2));
if (_local1 == 0){
FinalLayout[1] = SemiLayout[2];
} else {
FinalLayout[1] = SemiLayout[3];
};
tournTableMC.player2f.gotoAndStop(FinalLayout[1]);
OPPONENT = FinalLayout[1];
}
function ReturnToTournamentTableWinner(){
tournTableMC.winMC.visible = true;
tournTableMC.winfaceMC.visible = true;
tournTableMC.winfaceMC.gotoAndStop(PLAYER);
tournTableMC.visible = true;
Tweener.addTween(tournTableMC, {y:0, time:1, delay:0.5});
tournTableMC.playB.addEventListener(MouseEvent.CLICK, TournamentOver);
tournTableMC.player1.gotoAndStop(PLAYER);
tournTableMC.player2.gotoAndStop(TournLayout[1]);
tournTableMC.player3.gotoAndStop(TournLayout[2]);
tournTableMC.player4.gotoAndStop(TournLayout[3]);
tournTableMC.player5.gotoAndStop(TournLayout[4]);
tournTableMC.player6.gotoAndStop(TournLayout[5]);
tournTableMC.player7.gotoAndStop(TournLayout[6]);
tournTableMC.player8.gotoAndStop(TournLayout[7]);
tournTableMC.player1sf.gotoAndStop(PLAYER);
tournTableMC.player2sf.gotoAndStop(SemiLayout[1]);
tournTableMC.player3sf.gotoAndStop(SemiLayout[2]);
tournTableMC.player4sf.gotoAndStop(SemiLayout[3]);
tournTableMC.player1f.gotoAndStop(PLAYER);
tournTableMC.player2f.gotoAndStop(FinalLayout[1]);
}
}
}//package user_interface
Section 28
//GameOverScreen (user_interface.GameOverScreen)
package user_interface {
import flash.events.*;
import user_interface.core.*;
public class GameOverScreen extends AdvMovieClip {
public var exitB:btContinue;
private var controller:EventDispatcher;
public function GameOverScreen(){
addFrameScript(0, frame1);
}
public function init(_arg1:EventDispatcher){
controller = _arg1;
addEventListener(FrameEventCore.INTERACTIVE, activateUserInterface);
controller.addEventListener(MainGame.SHOW_GAMEOVER, fadeIn);
}
private function activateUserInterface(_arg1:Event):void{
exitB.addEventListener(MouseEvent.CLICK, fadeOut);
}
private function fadeOut(_arg1:MouseEvent):void{
hide();
}
private function fadeIn(_arg1:Event):void{
controller.dispatchEvent(new Event(MainGame.SHOW_SPLASH));
show();
}
function frame1(){
}
}
}//package user_interface
Section 29
//GameScreen (user_interface.GameScreen)
package user_interface {
import flash.events.*;
import game_code.*;
import user_interface.core.*;
public class GameScreen extends AdvMovieClip {
private var controller:EventDispatcher;
public var Game:game;
var BackToSplash;// = true
public function GameScreen(){
Game = new game();
super();
visible = false;
}
public function init(_arg1:EventDispatcher){
controller = _arg1;
addEventListener(FrameEventCore.INTERACTIVE, activateUserInterface);
addEventListener(FrameEventCore.INACTIVE, StartNextScreen);
controller.addEventListener(MainGame.START_GAME, fadeIn);
controller.addEventListener(MainGame.LEAVE_GAME, startGameOver);
controller.addEventListener(MainGame.SHOW_NEXT_ROUND, startTournament);
Game.init(_arg1);
}
private function fadeIn(_arg1:Event):void{
trace("show game");
visible = true;
show();
}
private function activateUserInterface(_arg1:Event):void{
Game.Reset();
addChild(Game);
}
function startTournament(_arg1:Event){
BackToSplash = false;
removeChild(Game);
hide();
}
private function startGameOver(_arg1:Event):void{
BackToSplash = true;
removeChild(Game);
hide();
}
private function StartNextScreen(_arg1:Event){
trace("start game");
if (BackToSplash){
controller.dispatchEvent(new Event(MainGame.SHOW_SPLASH));
};
}
}
}//package user_interface
Section 30
//HelpScreen (user_interface.HelpScreen)
package user_interface {
import flash.events.*;
import flash.display.*;
import user_interface.core.*;
public class HelpScreen extends AdvMovieClip {
public var exitB:SimpleButton;
private var controller:EventDispatcher;
public function HelpScreen(){
addFrameScript(0, frame1);
}
public function init(_arg1:EventDispatcher){
controller = _arg1;
addEventListener(FrameEventCore.INTERACTIVE, activateUserInterface);
controller.addEventListener(MainGame.SHOW_HELP, fadeIn);
}
private function activateUserInterface(_arg1:Event):void{
exitB.addEventListener(MouseEvent.CLICK, fadeOut);
}
private function fadeOut(_arg1:MouseEvent):void{
hide();
}
private function fadeIn(_arg1:Event):void{
show();
}
function frame1(){
}
}
}//package user_interface
Section 31
//PauseScreen (user_interface.PauseScreen)
package user_interface {
import flash.events.*;
import user_interface.core.*;
public class PauseScreen extends AdvMovieClip {
public var backtogameB:btBackToGame;
public var helpB:btHelp;
public var exitB:btContinue;
private var controller:EventDispatcher;
public function PauseScreen(){
visible = false;
}
public function init(_arg1:EventDispatcher){
controller = _arg1;
addEventListener(FrameEventCore.INTERACTIVE, activateUserInterface);
controller.addEventListener(MainGame.SHOW_PAUSE, fadeIn);
}
private function fadeIn(_arg1:Event):void{
visible = true;
show();
}
private function activateUserInterface(_arg1:Event):void{
helpB.addEventListener(MouseEvent.CLICK, showHelp);
exitB.addEventListener(MouseEvent.CLICK, ExitGame);
backtogameB.addEventListener(MouseEvent.CLICK, ReturnToGame);
}
private function showHelp(_arg1:MouseEvent):void{
controller.dispatchEvent(new Event(MainGame.SHOW_HELP));
}
private function ExitGame(_arg1:MouseEvent):void{
visible = false;
controller.dispatchEvent(new Event(MainGame.SHOW_SPLASH));
}
private function ReturnToGame(_arg1:MouseEvent):void{
visible = false;
controller.dispatchEvent(new Event(MainGame.START_GAME));
}
}
}//package user_interface
Section 32
//SplashScreen (user_interface.SplashScreen)
package user_interface {
import flash.events.*;
import flash.display.*;
import user_interface.core.*;
import flash.net.*;
public class SplashScreen extends AdvMovieClip {
public var playB:playButton;
public var subB:SimpleButton;
public var helpB:SimpleButton;
private var GoToHelp;// = false
private var controller:EventDispatcher;
public function init(_arg1:EventDispatcher){
controller = _arg1;
addEventListener(FrameEventCore.INTERACTIVE, activateUserInterface);
addEventListener(FrameEventCore.INACTIVE, StartNextScreen);
controller.addEventListener(MainGame.SHOW_SPLASH, fadeIn);
}
private function fadeIn(_arg1:Event):void{
show();
}
private function activateUserInterface(_arg1:Event):void{
controller.dispatchEvent(new Event(MainGame.FX_SPLASH));
helpB.addEventListener(MouseEvent.CLICK, showHelp);
playB.addEventListener(MouseEvent.CLICK, startGame);
subB.addEventListener(MouseEvent.CLICK, goMb);
}
private function goMb(_arg1:MouseEvent):void{
var e = _arg1;
var url2 = "http://www.mousebreaker.com/?utm_source=distributiongames&utm_medium=DartsParty&utm_campaign=email";
var request:URLRequest = new URLRequest(url2);
try {
navigateToURL(request, "_blank");
} catch(e:Error) {
trace("Error occurred!");
};
}
private function showHelp(_arg1:MouseEvent):void{
controller.dispatchEvent(new Event(MainGame.SHOW_HELP));
}
private function startGame(_arg1:MouseEvent):void{
trace("hide");
hide();
}
private function StartNextScreen(_arg1:Event){
trace("start game");
controller.dispatchEvent(new Event(MainGame.SHOW_CHOOSE));
}
}
}//package user_interface
Section 33
//btBackToGame (btBackToGame)
package {
import flash.display.*;
public dynamic class btBackToGame extends SimpleButton {
}
}//package
Section 34
//btContinue (btContinue)
package {
import flash.display.*;
public dynamic class btContinue extends SimpleButton {
}
}//package
Section 35
//btDartAttack (btDartAttack)
package {
import flash.display.*;
public dynamic class btDartAttack extends SimpleButton {
}
}//package
Section 36
//btFX (btFX)
package {
import flash.display.*;
public dynamic class btFX extends SimpleButton {
}
}//package
Section 37
//btHelp (btHelp)
package {
import flash.display.*;
public dynamic class btHelp extends SimpleButton {
}
}//package
Section 38
//btMusic (btMusic)
package {
import flash.display.*;
public dynamic class btMusic extends SimpleButton {
}
}//package
Section 39
//btPause (btPause)
package {
import flash.display.*;
public dynamic class btPause extends SimpleButton {
}
}//package
Section 40
//btQuit (btQuit)
package {
import flash.display.*;
public dynamic class btQuit extends SimpleButton {
}
}//package
Section 41
//btRoundTheClock (btRoundTheClock)
package {
import flash.display.*;
public dynamic class btRoundTheClock extends SimpleButton {
}
}//package
Section 42
//btTournament (btTournament)
package {
import flash.display.*;
public dynamic class btTournament extends SimpleButton {
}
}//package
Section 43
//fxAah (fxAah)
package {
import flash.media.*;
public dynamic class fxAah extends Sound {
}
}//package
Section 44
//fxClaps (fxClaps)
package {
import flash.media.*;
public dynamic class fxClaps extends Sound {
}
}//package
Section 45
//fxClick (fxClick)
package {
import flash.media.*;
public dynamic class fxClick extends Sound {
}
}//package
Section 46
//fxImpact (fxImpact)
package {
import flash.media.*;
public dynamic class fxImpact extends Sound {
}
}//package
Section 47
//fxSplash (fxSplash)
package {
import flash.media.*;
public dynamic class fxSplash extends Sound {
}
}//package
Section 48
//fxStart (fxStart)
package {
import flash.media.*;
public dynamic class fxStart extends Sound {
}
}//package
Section 49
//fxSwoosh (fxSwoosh)
package {
import flash.media.*;
public dynamic class fxSwoosh extends Sound {
}
}//package
Section 50
//fxTransition (fxTransition)
package {
import flash.media.*;
public dynamic class fxTransition extends Sound {
}
}//package
Section 51
//MainGame (MainGame)
package {
import flash.events.*;
import flash.display.*;
import mochi.as3.*;
import app_sound.*;
import user_interface.*;
public dynamic class MainGame extends MovieClip {
public var helpScreenMC:HelpScreen;
public var musicB:btMusic;
public var startScreenMC:SplashScreen;
public var gameoverScreenMC:GameOverScreen;
public var chooseScreenMC:ChooseScreen;
public var soundMute:MovieClip;
public var gameScreenMC:GameScreen;
public static const START_GAME:String = "startGame";
public static const FX_SWITCH:String = "fxSwitch";
public static const MUSIC_SWITCH:String = "musicSwitch";
public static const SHOW_SPLASH:String = "showSplash";
public static const SHOW_HELP:String = "showHelp";
public static const SHOW_PAUSE:String = "showPause";
public static const SHOW_GAME:String = "showGame";
public static const SHOW_GAMEOVER:String = "showGameOver";
public static const SHOW_CHOOSE:String = "showChoose";
public static const SET_DIFFICULTY:String = "setDifficulty";
public static const LEAVE_GAME:String = "leavingGame";
public static const SHOW_NEXT_ROUND:String = "ShowNextRound";
public static const FX_SWOOSH:String = "fxSwoosh";
public static const FX_IMPACT:String = "fxImpact";
public static const FX_CLICK:String = "fxClick";
public static const FX_CLAPS:String = "fxClaps";
public static const FX_AAH:String = "fxAah";
public static const FX_START:String = "fxStart";
public static const FX_SPLASH:String = "fxSplash";
public static const FX_TRANSITION:String = "fxTransition";
public static var instance:MainGame;
public function MainGame(){
var _local1:SoundFX;
super();
instance = this;
helpScreenMC.init(this);
startScreenMC.init(this);
gameScreenMC.init(this);
gameoverScreenMC.init(this);
chooseScreenMC.init(this);
addEventListener(SET_DIFFICULTY, SetDifficulty);
_local1 = new SoundFX(new fxSwoosh(), MainGame.FX_SWOOSH, this);
_local1 = new SoundFX(new fxImpact(), MainGame.FX_IMPACT, this);
_local1 = new SoundFX(new fxClick(), MainGame.FX_CLICK, this);
_local1 = new SoundFX(new fxClaps(), MainGame.FX_CLAPS, this);
_local1 = new SoundFX(new fxAah(), MainGame.FX_AAH, this);
_local1 = new SoundFX(new fxStart(), MainGame.FX_START, this);
_local1 = new SoundFX(new fxSplash(), MainGame.FX_SPLASH, this);
_local1 = new SoundFX(new fxTransition(), MainGame.FX_TRANSITION, this);
musicB.addEventListener(MouseEvent.CLICK, changeMusic);
soundMute.visible = false;
soundMute.mouseEnabled = false;
soundMute.mouseChildren = false;
MochiAd.showPreGameAd({clip:root, id:"f9fce21f43e6cf24", res:"750x550"});
}
public function mochiDone(){
trace("=============================FOARGETABOUDIT");
dispatchEvent(new Event(MainGame.SHOW_SPLASH));
}
private function changeMusic(_arg1:MouseEvent):void{
if (soundMute.visible){
soundMute.visible = false;
} else {
soundMute.visible = true;
};
dispatchEvent(new Event(MainGame.FX_SWITCH));
}
private function showScreen(_arg1:MouseEvent):void{
}
function SetDifficulty(_arg1:Event){
trace("Set difficulty to", chooseScreenMC.PLAYER);
gameScreenMC.Game.GAME_TYPE = chooseScreenMC.GAME_TYPE;
gameScreenMC.Game.PLAYER = chooseScreenMC.PLAYER;
gameScreenMC.Game.OPPONENT = chooseScreenMC.OPPONENT;
gameScreenMC.Game.DIFFICULTY = chooseScreenMC.DIFFICULTY;
gameScreenMC.Game.GAME_LENGTH = chooseScreenMC.GAME_LENGTH;
}
}
}//package
Section 52
//mcBullseye (mcBullseye)
package {
import flash.display.*;
public dynamic class mcBullseye extends MovieClip {
}
}//package
Section 53
//mcBust (mcBust)
package {
import flash.display.*;
public dynamic class mcBust extends MovieClip {
}
}//package
Section 54
//mcChooseGame (mcChooseGame)
package {
import flash.display.*;
public dynamic class mcChooseGame extends MovieClip {
public var tournamentB:btTournament;
public var dartattackB:btDartAttack;
public var quickgameB:quickGameButton;
public var roundtheclockB:btRoundTheClock;
}
}//package
Section 55
//mcChoosePlayer (mcChoosePlayer)
package {
import flash.display.*;
public dynamic class mcChoosePlayer extends MovieClip {
public var player4B:SimpleButton;
public var player8MC:MovieClip;
public var player8B:SimpleButton;
public var player4MC:MovieClip;
public var player5MC:MovieClip;
public var player6MC:MovieClip;
public var player7MC:MovieClip;
public var player3B:SimpleButton;
public var player2B:SimpleButton;
public var player1MC:MovieClip;
public var player1B:SimpleButton;
public var player2MC:MovieClip;
public var player3MC:MovieClip;
public var player7B:SimpleButton;
public var player6B:SimpleButton;
public var player5B:SimpleButton;
public function mcChoosePlayer(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 56
//mcCrosshair (mcCrosshair)
package {
import flash.display.*;
public dynamic class mcCrosshair extends MovieClip {
public var dartarea:MovieClip;
}
}//package
Section 57
//mcDart (mcDart)
package {
import flash.display.*;
public dynamic class mcDart extends MovieClip {
public function mcDart(){
addFrameScript(16, frame17);
}
function frame17(){
stop();
}
}
}//package
Section 58
//mcDartboard (mcDartboard)
package {
import flash.display.*;
public dynamic class mcDartboard extends MovieClip {
public var section1:MovieClip;
public var section11:MovieClip;
public var section20:MovieClip;
public var bomb11:MovieClip;
public var bomb1:MovieClip;
public var bomb20:MovieClip;
public var section10:MovieClip;
public var bomb12:MovieClip;
public var bomb2:MovieClip;
public var section13:MovieClip;
public var bomb3:MovieClip;
public var bomb13:MovieClip;
public var section12:MovieClip;
public var bomb14:MovieClip;
public var bomb4:MovieClip;
public var bomb5:MovieClip;
public var bomb15:MovieClip;
public var bomb16:MovieClip;
public var bomb6:MovieClip;
public var bomb7:MovieClip;
public var bomb17:MovieClip;
public var bomb8:MovieClip;
public var bomb18:MovieClip;
public var dartboardMC:MovieClip;
public var section9:MovieClip;
public var section19:MovieClip;
public var bomb9:MovieClip;
public var bomb19:MovieClip;
public var section8:MovieClip;
public var section18:MovieClip;
public var waitMC:MovieClip;
public var section7:MovieClip;
public var section6:MovieClip;
public var quitB:btQuit;
public var section5:MovieClip;
public var section15:MovieClip;
public var section14:MovieClip;
public var section4:MovieClip;
public var section17:MovieClip;
public var section3:MovieClip;
public var section16:MovieClip;
public var section2:MovieClip;
public var bomb10:MovieClip;
}
}//package
Section 59
//mcDouble (mcDouble)
package {
import flash.display.*;
public dynamic class mcDouble extends MovieClip {
}
}//package
Section 60
//mcHit (mcHit)
package {
import flash.display.*;
public dynamic class mcHit extends MovieClip {
}
}//package
Section 61
//mcLose (mcLose)
package {
import flash.display.*;
public dynamic class mcLose extends MovieClip {
}
}//package
Section 62
//mcMiss (mcMiss)
package {
import flash.display.*;
public dynamic class mcMiss extends MovieClip {
}
}//package
Section 63
//mcNumber (mcNumber)
package {
import flash.display.*;
public dynamic class mcNumber extends MovieClip {
public function mcNumber(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9, 9, frame10);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
function frame3(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame6(){
stop();
}
function frame7(){
stop();
}
function frame8(){
stop();
}
function frame9(){
stop();
}
function frame10(){
stop();
}
}
}//package
Section 64
//mcPlayerFace (mcPlayerFace)
package {
import flash.display.*;
public dynamic class mcPlayerFace extends MovieClip {
}
}//package
Section 65
//mcStart (mcStart)
package {
import flash.display.*;
public dynamic class mcStart extends MovieClip {
}
}//package
Section 66
//mcTreble (mcTreble)
package {
import flash.display.*;
public dynamic class mcTreble extends MovieClip {
}
}//package
Section 67
//mcWin (mcWin)
package {
import flash.display.*;
public dynamic class mcWin extends MovieClip {
}
}//package
Section 68
//mcWinner (mcWinner)
package {
import flash.display.*;
public dynamic class mcWinner extends MovieClip {
public var backB:SimpleButton;
public var faceMC:mcPlayerFace;
}
}//package
Section 69
//mcYellowDart (mcYellowDart)
package {
import flash.display.*;
public dynamic class mcYellowDart extends MovieClip {
public function mcYellowDart(){
addFrameScript(16, frame17);
}
function frame17(){
stop();
}
}
}//package
Section 70
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
if (Security.sandboxType == "localWithFile"){
return (null);
};
var _local3:MochiBot = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
var _local4 = "http://core.mochibot.com/my/core.swf";
var _local5:URLVariables = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
var _local6:String = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
var _local7:URLRequest = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
var _local8:Loader = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 71
//MusicSoundTrack (MusicSoundTrack)
package {
import flash.media.*;
public dynamic class MusicSoundTrack extends Sound {
}
}//package
Section 72
//playButton (playButton)
package {
import flash.display.*;
public dynamic class playButton extends SimpleButton {
}
}//package
Section 73
//quickGameButton (quickGameButton)
package {
import flash.display.*;
public dynamic class quickGameButton extends SimpleButton {
}
}//package