Section 1
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Sibling:MochiDigits;
private var Fragment:Number;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function reencode():void{
var _local1:uint;
_local1 = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function toString():String{
var _local1:String;
_local1 = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
public function get value():Number{
return (Number(this.toString()));
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String;
_local3 = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
Fragment = (_local3.charCodeAt(_temp1) ^ Encoder);
if (_arg2 < _local3.length){
Sibling = new MochiDigits(_arg1, _arg2);
} else {
Sibling = null;
};
reencode();
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
}
}//package mochi.as3
Section 2
//MochiScores (mochi.as3.MochiScores)
package mochi.as3 {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var n:Number;
var options = _arg1;
if (options != null){
if (options.clip != null){
if ((options.clip is Sprite)){
MochiServices.setContainer(options.clip);
};
delete options.clip;
} else {
MochiServices.setContainer();
};
MochiServices.stayOnTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
} else {
if ((options.score is MochiDigits)){
options.score = options.score.value;
};
};
n = Number(options.score);
if (isNaN(n)){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(n) != n){
trace((("WARNING: Submitted score '" + options.score) + "' will be truncated"));
};
options.score = n;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local2:Object;
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
_local2 = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
_arg1 = Number(_arg1);
if (isNaN(_arg1)){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((_arg1 == Number.NEGATIVE_INFINITY)) || ((_arg1 == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(_arg1) != _arg1){
trace((("WARNING: Submitted score '" + String(_arg1)) + "' will be truncated"));
};
_arg1 = Number(_arg1);
};
};
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (_arg1 != null){
if (_arg1.error != null){
if (_arg1.error == true){
if (onErrorHandler != null){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
};
};
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi.as3
Section 3
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
import flash.geom.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
public static var netupAttempted:Boolean = false;
private static var _sendChannel:LocalConnection;
private static var _clip:MovieClip;
private static var _loader:Loader;
private static var _id:String;
private static var _listenChannel:LocalConnection;
public static var widget:Boolean = false;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _connecting:Boolean = false;
public static var onError:Object;
private static var _listenChannelName:String = "__ms_";
private static var _servicesURL:String = "http://www.mochiads.com/static/lib/services/services.swf";
public static var netup:Boolean = true;
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function get connected():Boolean{
return (_connected);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (_clip != null){
if (_clip._queue != null){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
};
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_sendChannel.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
onError("NotConnected");
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
public static function get childClip():Object{
return (_clip);
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local3:Array;
var _local4:int;
var _local5:Array;
var _local6:Array;
var _local7:MovieClip;
var _local8:LocalConnection;
var _local9:String;
var _local10:ByteArray;
var _local11:ByteArray;
var _local12:uint;
var _local13:uint;
var _local14:Loader;
_local3 = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23];
_local5 = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
_local6 = [0, 64, 0, 0, 0];
_local7 = new MovieClip();
_local8 = new LocalConnection();
_local9 = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().getTime()));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
_local10 = new ByteArray();
_local11 = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
_local12 = ((_local3.length + _local11.length) + 4);
_local13 = (_local12 + 35);
_local10.endian = Endian.LITTLE_ENDIAN;
_local10.writeUTFBytes("FWS");
_local10.writeByte(8);
_local10.writeUnsignedInt(_local13);
for each (_local4 in _local5) {
_local10.writeByte(_local4);
};
_local10.writeUnsignedInt(_local12);
_local10.writeByte(136);
_local10.writeShort(_local11.length);
_local10.writeBytes(_local11);
for each (_local4 in _local3) {
_local10.writeByte(_local4);
};
for each (_local4 in _local6) {
_local10.writeByte(_local4);
};
_local14 = new Loader();
_local14.loadBytes(_local10);
_local7.addChild(_local14);
return (_local7);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var vars:Object;
var avm1Click:DisplayObject;
var s:String;
var i:Number;
var x:String;
var req:URLRequest;
var loader:Loader;
var setURL:Function;
var err:Function;
var complete:Function;
var url = _arg1;
var burl = _arg2;
var btn = _arg3;
var onClick = _arg4;
vars = new Object();
vars["mav"] = getVersion();
vars["swfv"] = "9";
vars["swfurl"] = btn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
s = "?";
i = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://x.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
var _local2:Rectangle;
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
_local2 = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = _local2.x;
avm1Click.y = _local2.y;
avm1Click.scaleX = (0.01 * _local2.width);
avm1Click.scaleY = (0.01 * _local2.height);
};
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
setURL(burl);
};
complete = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_listenChannel.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function getVersion():String{
return ("3.0");
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
if (_clip.parent != null){
Sprite(_clip.parent).removeChild(_clip);
};
}
private static function onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
_connected = false;
_listenChannel.connect(_listenChannelName);
break;
};
}
public static function get id():String{
return (_id);
}
private static function urlOptions(_arg1:Object):Object{
var _local2:Object;
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
_local2 = {};
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
private static function initComChannels():void{
if (!_connected){
_sendChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_sendChannel.send(_sendChannelName, "onReceive", {methodName:"registerGame", id:_id, clip:_container, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_listenChannel.addEventListener(StatusEvent.STATUS, MochiServices.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = this.client._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete this.client._callbacks[cb];
};
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
trace("connected!");
_connecting = false;
_connected = true;
while (_clip._queue.length > 0) {
_sendChannel.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function listen():void{
_listenChannel = new LocalConnection();
_listenChannel.client = _clip;
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
_listenChannel.allowDomain("*", "localhost");
_listenChannel.allowInsecureDomain("*", "localhost");
_listenChannel.connect(_listenChannelName);
trace("Waiting for MochiAds services to connect...");
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var clipname:String;
var f:Function;
var req:URLRequest;
var vars:URLVariables;
var id = _arg1;
var clip = _arg2;
clipname = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(clip).servicesURL != undefined){
_servicesURL = urlOptions(clip).servicesURL;
};
MochiServices.allowDomains(_servicesURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
f = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor((Math.random() * 99999))));
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
req = new URLRequest(_servicesURL);
vars = new URLVariables();
vars.listenLC = _listenChannelName;
vars.mochiad_options = clip.loaderInfo.parameters.mochiad_options;
if (widget){
vars.widget = true;
};
req.data = vars;
listen();
_loader.load(req);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_clip._nextcallbackID = 0;
_clip._callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
public static function get clip():Object{
return (_container);
}
public static function bringToTop(_arg1:Event):void{
var e = _arg1;
if (MochiServices.clip != null){
if (MochiServices.childClip != null){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
};
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
if ((clip is DisplayObject)){
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 createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function connectWait(_arg1:TimerEvent):void{
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
}
}
}//package mochi.as3
Section 4
//Symbol2_47 (ShadowKar_fla.Symbol2_47)
package ShadowKar_fla {
import flash.display.*;
public dynamic class Symbol2_47 extends MovieClip {
public function Symbol2_47(){
addFrameScript(19, frame20);
}
function frame20(){
stop();
}
}
}//package ShadowKar_fla
Section 5
//Symbol22_14 (ShadowKar_fla.Symbol22_14)
package ShadowKar_fla {
import flash.display.*;
public dynamic class Symbol22_14 extends MovieClip {
public function Symbol22_14(){
addFrameScript(26, frame27);
}
function frame27(){
stop();
}
}
}//package ShadowKar_fla
Section 6
//Block (Block)
package {
import flash.display.*;
public dynamic class Block extends MovieClip {
}
}//package
Section 7
//Bomb (Bomb)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
public class Bomb extends MovieClip {
private var Doc:Document;
private var HasExploded:Boolean;
public function Bomb(_arg1:Number, _arg2:Number, _arg3:Document):void{
Doc = _arg3;
x = _arg1;
y = _arg2;
addEventListener(Event.ENTER_FRAME, Update, false, 0, true);
}
private function Explode(_arg1:Boolean=true):void{
var _local2:int;
var _local3:HitBombSound;
var _local4:BoomSound;
if (!HasExploded){
if (_arg1){
_local2 = 0;
while (_local2 <= 10) {
Document.EnemySprite.addChild(new ExPar(x, y));
_local2++;
};
if ((((Math.abs((Document.Player.x - x)) < 40)) && ((Math.abs((Document.Player.y - y)) < 40)))){
_local3 = new HitBombSound();
_local3.play(0, 1, new SoundTransform(0.7));
Doc.AddScore(50);
Document.OverlaySprite.addChild(new ScoreText(50, x, y));
Document.Player.BombCombos++;
if (Document.Player.x < x){
Document.Player.SetVX(-6);
} else {
Document.Player.SetVX(6);
};
} else {
_local4 = new BoomSound();
_local4.play(0, 1, new SoundTransform(0.7));
};
};
if (parent){
parent.removeChild(this);
};
HasExploded = true;
};
}
private function Update(_arg1:Event):void{
if (!Document.START_GAME){
if (parent){
removeEventListener(Event.ENTER_FRAME, Update);
parent.removeChild(this);
};
} else {
y = (y + 3);
if (Document.Land.hitTestPoint(x, y, true)){
Explode();
};
if ((((Math.abs((Document.Player.x - x)) < 20)) && ((Math.abs((Document.Player.y - y)) < 20)))){
Explode();
};
if (x > 550){
Explode(false);
};
};
}
}
}//package
Section 8
//BoomSound (BoomSound)
package {
import flash.media.*;
public dynamic class BoomSound extends Sound {
}
}//package
Section 9
//BUNNY_INTRO (BUNNY_INTRO)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public dynamic class BUNNY_INTRO extends MovieClip {
public var buttonGiant:SimpleButton;
public function BUNNY_INTRO(){
addFrameScript(0, frame1, 160, frame161);
}
function frame161(){
stop();
if (parent){
stop();
MovieClip(root).addChild(new MainMenu());
parent.removeChild(this);
};
}
function frame1(){
buttonGiant.addEventListener(MouseEvent.CLICK, GoToSite, false, 0, true);
}
public function GoToSite(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.bunnygames.com/in.php?game=shadowkar&zone=intro");
navigateToURL(_local2);
}
}
}//package
Section 10
//BUNNYGAMES_LOGO (BUNNYGAMES_LOGO)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public dynamic class BUNNYGAMES_LOGO extends MovieClip {
public var inside:SimpleButton;
public function BUNNYGAMES_LOGO(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
inside.addEventListener(MouseEvent.CLICK, GoToSite, false, 0, true);
}
public function GoToSite(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.bunnygames.com/in.php?game=shadowkar&zone=bunny");
navigateToURL(_local2);
}
}
}//package
Section 11
//Car (Car)
package {
import flash.display.*;
public class Car extends Sprite {
public var BombCombos:int;// = 0
public var RingCombos:int;// = 0
private var Doc:Document;
private var AirTimeBonus:int;// = 0
private var Point1:CarPoint;
private var Body:CarBody;
private var Point2:CarPoint;
public function Car(_arg1:Document):void{
var _local2:Number;
var _local3:Number;
BombCombos = 0;
RingCombos = 0;
AirTimeBonus = 0;
super();
Doc = _arg1;
x = 0;
y = 0;
_local2 = 280;
_local3 = 373;
Point1 = new CarPoint();
Point1.x = (Point1.x + (-7.8 + _local2));
Point1.y = (Point1.y + (-0.6 + _local3));
Point2 = new CarPoint();
Point2.x = (Point2.x + (7.8 + _local2));
Point2.y = (Point2.y + (-0.5 + _local3));
Body = new CarBody();
Body.x = _local2;
Body.y = _local3;
addChild(Body);
}
private function GetDist(_arg1:CarPoint, _arg2:CarPoint):Number{
var _local3:Number;
var _local4:Number;
_local3 = (_arg2.x - _arg1.x);
_local4 = (_arg2.y - _arg1.y);
return (Math.sqrt(((_local3 * _local3) + (_local4 * _local4))));
}
override public function get x():Number{
return (Body.x);
}
override public function get y():Number{
return (Body.y);
}
public function SetVX(_arg1:Number):void{
Point1.vx = _arg1;
Point2.vx = _arg1;
Point1.vy = (-(Math.abs(_arg1)) - 6);
Point2.vy = (-(Math.abs(_arg1)) - 6);
}
public function Update(_arg1:Sprite):void{
var _local2:Number;
var _local3:Number;
var _local4:int;
if (_arg1.hitTestPoint(Point2.x, (Point2.y + 5), true)){
_local4 = 0;
if (BombCombos > 1){
_local4 = (BombCombos * 20);
Doc.AddScore(_local4);
Document.OverlaySprite.addChild(new ComboText(0, _local4));
};
if (RingCombos > 1){
_local4 = (RingCombos * 1500);
Doc.AddScore(_local4);
Document.OverlaySprite.addChild(new ComboText(1, _local4));
};
if (AirTimeBonus > 100){
_local4 = (5 * (AirTimeBonus - 100));
Doc.AddScore(_local4);
Document.OverlaySprite.addChild(new ComboText(4, _local4));
};
AirTimeBonus = 0;
BombCombos = 0;
RingCombos = 0;
if (Document.LEFT_KEY){
Point1.vx = Point1.Ease(Point1.vx, -(Point1.MAX_SPEED));
Point2.vx = Point2.Ease(Point2.vx, -(Point2.MAX_SPEED));
} else {
if (Document.RIGHT_KEY){
Point1.vx = Point1.Ease(Point1.vx, Point1.MAX_SPEED);
Point2.vx = Point2.Ease(Point2.vx, Point2.MAX_SPEED);
} else {
Point1.vx = Point1.Ease(Point1.vx, 0);
Point2.vx = Point2.Ease(Point2.vx, 0);
};
};
Document.GameSprite.addChild(new SmokePar(Point2.x, Point2.y));
} else {
AirTimeBonus++;
if (Document.LEFT_KEY){
Point1.vx = Point1.Ease(Point1.vx, (-(Point1.MAX_SPEED) / 2));
Point2.vx = Point2.Ease(Point2.vx, (-(Point2.MAX_SPEED) / 2));
} else {
if (Document.RIGHT_KEY){
Point1.vx = Point1.Ease(Point1.vx, (Point1.MAX_SPEED / 2));
Point2.vx = Point2.Ease(Point2.vx, (Point2.MAX_SPEED / 2));
};
};
};
Point1.Update(_arg1);
Point2.Update(_arg1);
if (Point2.x > 550){
Point2.vx = (Point1.vx = -(Point1.MAX_SPEED));
};
if (Point1.x < 0){
Point1.vx = (Point2.vx = Point1.MAX_SPEED);
};
while ((Point2.y - Point1.y) > 30) {
Point2.y = (Point2.y - 0.1);
};
while ((Point2.y - Point1.y) < -30) {
Point2.y = (Point2.y + 0.1);
};
_local2 = (Point2.x - Point1.x);
_local3 = (Point2.y - Point1.y);
Body.rotation = ((Math.atan2(_local3, _local2) * 180) / Math.PI);
Body.x = ((Point1.x + Point2.x) / 2);
Body.y = ((Point1.y + Point2.y) / 2);
}
}
}//package
Section 12
//CarBody (CarBody)
package {
import flash.display.*;
public dynamic class CarBody extends MovieClip {
}
}//package
Section 13
//CarPoint (CarPoint)
package {
import flash.display.*;
public class CarPoint extends MovieClip {
public const MAX_SPEED:Number = 7;
public var vx:Number;
public var vy:Number;
public var TouchingGround:Boolean;// = false
public function CarPoint():void{
TouchingGround = false;
super();
vy = 0;
vx = 0;
}
public function Ease(_arg1:Number, _arg2:Number):Number{
var _local3:Number;
var _local4:Number;
if (Math.abs((_arg2 - _arg1)) < 0.2){
return (_arg2);
};
_local3 = (_arg2 - _arg1);
_local4 = (_local3 * 0.2);
return ((_arg1 + _local4));
}
public function Update(_arg1:Sprite):void{
TouchingGround = false;
vy = (vy + 0.5);
while (_arg1.hitTestPoint(x, (y - 2), true)) {
vy = (vy - 0.5);
y = (y - 0.5);
TouchingGround = true;
};
y = (y + vy);
x = (x + vx);
}
}
}//package
Section 14
//ComboText (ComboText)
package {
import flash.display.*;
import flash.text.*;
public class ComboText extends MovieClip {
private var score:int;
private var type:int;
public var super_awesome_combo_text:TextField;
public static const TYPE_RING_COMBO:int = 1;
public static const TYPE_AIR_TIME:int = 4;
public static const TYPE_RING_NOBOMB:int = 3;
public static const TYPE_DUAL_COMBO:int = 2;
public static const TYPE_BOMB_COMBO:int = 0;
public static var NUM_ON_SCREEN:int = 0;
public function ComboText(_arg1:int, _arg2:int):void{
addFrameScript(0, frame1, 14, frame15, 134, frame135, 153, frame154);
NUM_ON_SCREEN++;
type = _arg1;
score = _arg2;
x = (-(Math.random()) * 100);
y = (50 + (NUM_ON_SCREEN * 50));
}
function frame154(){
if (parent){
NUM_ON_SCREEN--;
parent.removeChild(this);
};
}
function frame15(){
UpdateText();
}
function frame1(){
UpdateText();
}
private function UpdateText():void{
switch (type){
case TYPE_BOMB_COMBO:
super_awesome_combo_text.text = ("BOMB COMBO +" + score);
break;
case TYPE_RING_COMBO:
super_awesome_combo_text.text = ("RING COMBO +" + score);
break;
case TYPE_DUAL_COMBO:
super_awesome_combo_text.text = ("DUAL COMBO +" + score);
break;
case TYPE_RING_NOBOMB:
super_awesome_combo_text.text = ("NO BOMB RING BONUS +" + score);
break;
case TYPE_AIR_TIME:
super_awesome_combo_text.text = ("AIR TIME BONUS +" + score);
break;
};
}
function frame135(){
UpdateText();
}
}
}//package
Section 15
//Document (Document)
package {
import flash.display.*;
import flash.events.*;
import mochi.as3.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
import flash.geom.*;
public dynamic class Document extends MovieClip {
private var HeliTimer:Timer;
public var ngloader:NGLoader;
private var DistTimer:Timer;
private var MusicChannel:SoundChannel;
private var ExtraRing:Ring;
public var timeText:TextField;
public var scoreText:TextField;
public static var Player:Car;
public static var LEFT_KEY:Boolean;
public static var Land:Landscape;
public static var EnemySprite:Sprite;
public static var START_GAME:Boolean = false;
public static var GameSpeed:Number;
public static var UP_KEY:Boolean;
public static var OverlaySprite:Sprite;
public static var DistLeft:int;
public static var Score:int = 0;
public static var GameSprite:Sprite;
public static var RIGHT_KEY:Boolean;
public function Document():void{
addFrameScript(0, frame1);
ResetNewGame();
MusicChannel = new SoundChannel();
stage.scaleMode = StageScaleMode.NO_SCALE;
UP_KEY = (LEFT_KEY = (RIGHT_KEY = false));
stage.addEventListener(KeyboardEvent.KEY_DOWN, KeyDown, false, 0, true);
stage.addEventListener(KeyboardEvent.KEY_UP, KeyUp, false, 0, true);
}
private function AddCopter(_arg1:TimerEvent):void{
EnemySprite.addChild(new Helicopter(this));
}
private function TickDist(_arg1:TimerEvent):void{
DistLeft--;
if (DistLeft == 60){
OverlaySprite.addChild(new TimeNotice("ONE MINUTE LEFT"));
};
if (DistLeft == 30){
OverlaySprite.addChild(new TimeNotice("30 SECONDS LEFT"));
};
if (DistLeft == 10){
OverlaySprite.addChild(new TimeNotice("10 SECONDS LEFT"));
};
if (DistLeft == 5){
OverlaySprite.addChild(new TimeNotice("5"));
};
if (DistLeft == 4){
OverlaySprite.addChild(new TimeNotice("4"));
};
if (DistLeft == 3){
OverlaySprite.addChild(new TimeNotice("3"));
};
if (DistLeft == 2){
OverlaySprite.addChild(new TimeNotice("2"));
};
if (DistLeft == 1){
OverlaySprite.addChild(new TimeNotice("1"));
};
timeText.text = ("Time Left (s): " + DistLeft);
if (DistLeft < 1){
KillGame();
};
}
public function GetScore():int{
return (Score);
}
public function ToWurmyIntro():void{
var _local1:MenuMusic;
removeChild(ngloader);
_local1 = new MenuMusic();
MusicChannel = _local1.play();
addChild(new WurmyIntro());
}
function frame1(){
MochiServices.connect("bffe313760f58da7", root);
MochiBot.track(this, "668d3fc2");
}
private function UpdateGame(_arg1:Event):void{
if (START_GAME){
Land.ReDrawLand();
};
Player.Update(Land);
}
public function ResetNewGame():void{
GameSpeed = 0;
GameSprite = new Sprite();
GameSprite.x = (GameSprite.y = 0);
addChild(GameSprite);
EnemySprite = new Sprite();
EnemySprite.x = (EnemySprite.y = 0);
addChild(EnemySprite);
OverlaySprite = new Sprite();
OverlaySprite.x = (OverlaySprite.y = 0);
addChild(OverlaySprite);
Player = new Car(this);
GameSprite.addChild(Player);
Land = new Landscape();
GameSprite.addChild(Land);
CreateNewGame();
}
public function KillGame():void{
var _local1:MenuMusic;
var _local2:int;
_local1 = new MenuMusic();
MusicChannel.stop();
MusicChannel = _local1.play();
addChild(new HighScores(Score));
START_GAME = false;
OverlaySprite.removeChild(scoreText);
OverlaySprite.removeChild(timeText);
addChild(scoreText);
addChild(timeText);
HeliTimer.stop();
HeliTimer = null;
DistTimer.stop();
DistTimer = null;
GameSprite.removeChild(Player);
GameSprite.removeChild(Land);
GameSprite.removeChild(ExtraRing);
_local2 = 0;
while (_local2 < EnemySprite.numChildren) {
EnemySprite.removeChild(EnemySprite.getChildAt(_local2));
_local2++;
};
_local2 = 0;
while (_local2 < OverlaySprite.numChildren) {
OverlaySprite.removeChild(OverlaySprite.getChildAt(_local2));
_local2++;
};
_local2 = 0;
while (_local2 < GameSprite.numChildren) {
GameSprite.removeChild(GameSprite.getChildAt(_local2));
_local2++;
};
GameSprite.removeEventListener(Event.ENTER_FRAME, UpdateGame);
removeChild(EnemySprite);
removeChild(OverlaySprite);
removeChild(GameSprite);
EnemySprite = null;
OverlaySprite = null;
GameSprite = null;
ResetNewGame();
}
public function AddScore(_arg1:int):void{
var _local2:String;
Score = (Score + _arg1);
_local2 = "";
_arg1 = 0;
while (_arg1 <= (9 - Score.toString().length)) {
_local2 = (_local2 + "0");
_arg1++;
};
_local2 = (_local2 + Score.toString());
scoreText.text = ("Score: " + _local2);
}
private function KeyDown(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case 38:
UP_KEY = true;
break;
case 37:
LEFT_KEY = true;
break;
case 39:
RIGHT_KEY = true;
break;
};
}
private function KeyUp(_arg1:KeyboardEvent):void{
switch (_arg1.keyCode){
case 38:
UP_KEY = false;
break;
case 37:
LEFT_KEY = false;
break;
case 39:
RIGHT_KEY = false;
break;
};
}
public function PlayNewGame():void{
var _local1:GameMusic;
var _local2:BUNNYGAMES_LOGO;
_local1 = new GameMusic();
MusicChannel.stop();
MusicChannel = _local1.play(0, 99);
stage.focus = this;
START_GAME = true;
_local2 = new BUNNYGAMES_LOGO();
_local2.x = 5.6;
_local2.y = 4.2;
_local2.scaleX = (_local2.scaleY = (27.6 / 100));
OverlaySprite.addChild(_local2);
ExtraRing = new Ring(this);
GameSprite.addChild(ExtraRing);
HeliTimer = new Timer(2000, 0);
HeliTimer.addEventListener(TimerEvent.TIMER, AddCopter, false, 0, true);
HeliTimer.start();
DistTimer = new Timer(1000, 0);
DistTimer.addEventListener(TimerEvent.TIMER, TickDist, false, 0, true);
DistTimer.start();
}
public function CreateNewGame():void{
Score = 0;
AddScore(0);
removeChild(scoreText);
OverlaySprite.addChild(scoreText);
GameSpeed = 6;
DistLeft = 120;
removeChild(timeText);
OverlaySprite.addChild(timeText);
timeText.text = ("Time Left (s): " + DistLeft);
GameSprite.addEventListener(Event.ENTER_FRAME, UpdateGame, false, 0, true);
}
public static function SubmitScore(_arg1:int, _arg2:String):void{
var o:Object;
var boardID:String;
var i = _arg1;
var n = _arg2;
o = {n:[6, 7, 14, 5, 6, 10, 6, 5, 5, 6, 1, 12, 13, 6, 8, 8], f:function (_arg1:Number, _arg2:String):String{
if (_arg2.length == 16){
return (_arg2);
};
return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16))));
}};
boardID = o.f(0, "");
MochiScores.showLeaderboard({boardID:boardID, score:i, name:n});
}
}
}//package
Section 16
//ExPar (ExPar)
package {
import flash.display.*;
import flash.events.*;
public class ExPar extends MovieClip {
public function ExPar(_arg1:Number, _arg2:Number):void{
addFrameScript(53, frame54);
x = _arg1;
y = _arg2;
rotation = ((Math.random() * 180) - 90);
scaleX = (scaleY = (0.5 + (Math.random() * 1.5)));
addEventListener(Event.ENTER_FRAME, Move, false, 0, true);
}
function frame54(){
if (parent){
parent.removeChild(this);
};
}
private function Move(_arg1:Event):void{
x = (x - Document.GameSpeed);
}
}
}//package
Section 17
//GameMusic (GameMusic)
package {
import flash.media.*;
public dynamic class GameMusic extends Sound {
}
}//package
Section 18
//Helicopter (Helicopter)
package {
import flash.display.*;
import flash.events.*;
public class Helicopter extends MovieClip {
private var Doc:Document;
private var side:int;
private var BombDrop:int;// = 0
private var car:Car;
private var Light:Spotlight;
public function Helicopter(_arg1:Document):void{
BombDrop = 0;
side = ((int((Math.random() * 2)) - 0.5) * 2);
super();
Doc = _arg1;
if (side == 1){
x = -100;
y = ((Math.random() * 100) + 50);
} else {
x = 650;
y = ((Math.random() * 100) + 50);
scaleX = -1;
};
Light = new Spotlight();
Light.x = (Light.y = 0);
addChild(Light);
addEventListener(Event.ENTER_FRAME, Update, false, 0, true);
}
private function Update(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
if (Document.START_GAME == false){
removeEventListener(Event.ENTER_FRAME, Update);
if (parent){
parent.removeChild(this);
};
};
BombDrop++;
x = (x + (2 * side));
if ((((BombDrop > 40)) && ((x > 50)))){
Document.EnemySprite.addChild(new Bomb(x, y, Doc));
BombDrop = int((-(Math.random()) * 20));
};
_local2 = (Document.Player.x - x);
_local3 = (Document.Player.y - y);
Light.rotation = ((((Math.atan2(_local3, _local2) * 180) / Math.PI) * side) + ((side == -1)) ? 180 : 0);
if (side == 1){
if (x > 600){
removeEventListener(Event.ENTER_FRAME, Update);
if (parent){
parent.removeChild(this);
};
};
} else {
if (x < -100){
removeEventListener(Event.ENTER_FRAME, Update);
if (parent){
parent.removeChild(this);
};
};
};
}
}
}//package
Section 19
//HighScores (HighScores)
package {
import flash.display.*;
import flash.events.*;
import flash.text.*;
import flash.net.*;
public class HighScores extends MovieClip {
public var btmBtn:SimpleButton;
public var name_input:TextField;
public var submitBtn:SimpleButton;
private var sc:int;
public var moregames:SimpleButton;
public var scoreText:TextField;
public function HighScores(_arg1:int):void{
addFrameScript(0, frame1);
sc = _arg1;
scoreText.text = ("Score: " + _arg1);
x = 0;
y = 0;
}
function frame1(){
submitBtn.addEventListener(MouseEvent.MOUSE_DOWN, ShowScore, false, 0, true);
btmBtn.addEventListener(MouseEvent.MOUSE_DOWN, BackToMenu, false, 0, true);
moregames.addEventListener(MouseEvent.CLICK, GoToSite, false, 0, true);
}
public function BackToMenu(_arg1:MouseEvent):void{
MovieClip(root).addChild(new MainMenu());
parent.removeChild(this);
}
public function ShowScore(_arg1:MouseEvent):void{
Document.SubmitScore(this.sc, name_input.text);
removeChild(submitBtn);
}
public function GoToSite(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.bunnygames.com/in.php?game=shadowkar&zone=more");
navigateToURL(_local2);
}
}
}//package
Section 20
//HitBombSound (HitBombSound)
package {
import flash.media.*;
public dynamic class HitBombSound extends Sound {
}
}//package
Section 21
//HitRingSound (HitRingSound)
package {
import flash.media.*;
public dynamic class HitRingSound extends Sound {
}
}//package
Section 22
//Landscape (Landscape)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
public class Landscape extends Sprite {
private const HEIGHT_THRESHOLD:Number = 15;
private const DIST_BETWEEN_POINTS:Number = 55;
private const NUM_POINTS:Number = 10;
private var Points:Array;
private var LastPoint:Number;
public function Landscape():void{
var _local1:Number;
var _local2:int;
super();
x = (y = 0);
_local1 = 370;
LastPoint = _local1;
Points = new Array(0);
_local2 = 0;
while (_local2 <= ((550 / DIST_BETWEEN_POINTS) + 3)) {
Points.push(new Point((_local2 * DIST_BETWEEN_POINTS), _local1));
_local2++;
};
LastPoint = Points[(Points.length - 1)].y;
ReDrawLand();
}
public function ReDrawLand():void{
var _local1:int;
var _local2:Number;
var _local3:Number;
var _local4:Number;
if (Points[0].x < (-(DIST_BETWEEN_POINTS) * 2)){
AddNewPart();
};
graphics.clear();
graphics.beginFill(0, 1);
_local1 = 0;
while (_local1 <= (Points.length - 1)) {
Points[_local1].x = (Points[_local1].x - Document.GameSpeed);
if ((((_local1 < (Points.length - 1))) && (!((_local1 == 0))))){
_local2 = ((Points[_local1].x + Points[(_local1 + 1)].x) / 2);
_local3 = ((Points[_local1].y + Points[(_local1 + 1)].y) / 2);
graphics.curveTo(Points[_local1].x, Points[_local1].y, _local2, _local3);
} else {
graphics.lineTo(Points[_local1].x, Points[_local1].y);
};
_local1++;
};
graphics.lineTo((550 + (DIST_BETWEEN_POINTS * 2)), 450);
graphics.lineTo(0, 450);
graphics.lineTo(Points[0].x, Points[0].y);
graphics.endFill();
if ((Math.random() * 20) < 1){
_local4 = 400;
while (this.hitTestPoint(550, _local4, true)) {
_local4--;
};
Document.GameSprite.addChild(new Scenery(550, _local4));
};
}
public function AddNewPart():void{
var _local1:Number;
Points.shift();
do {
_local1 = ((Points[(Points.length - 2)].y + (Math.random() * HEIGHT_THRESHOLD)) - (HEIGHT_THRESHOLD / 2));
} while ((((_local1 > 370)) || ((_local1 < 200))));
Points.push(new Point((550 + (DIST_BETWEEN_POINTS * 2)), _local1));
LastPoint = Points[(Points.length - 1)].y;
}
}
}//package
Section 23
//MainMenu (MainMenu)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
import flash.geom.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class MainMenu extends MovieClip {
public var goBtn:SimpleButton;
public var insBtn:SimpleButton;
public var instructions:MovieClip;
public var moregames:SimpleButton;
public function MainMenu(){
addFrameScript(0, frame1);
}
public function HideInstructions(_arg1:MouseEvent):void{
instructions.visible = false;
}
public function goPlayGame(_arg1:MouseEvent):void{
if (parent){
MovieClip(root).PlayNewGame();
MovieClip(root).removeChild(this);
};
}
public function ShowInstructions(_arg1:MouseEvent):void{
instructions.visible = true;
}
function frame1(){
instructions.visible = false;
insBtn.addEventListener(MouseEvent.MOUSE_DOWN, ShowInstructions, false, 0, true);
instructions.addEventListener(MouseEvent.MOUSE_DOWN, HideInstructions, false, 0, true);
goBtn.addEventListener(MouseEvent.MOUSE_DOWN, goPlayGame, false, 0, true);
moregames.addEventListener(MouseEvent.CLICK, GoToSite, false, 0, true);
}
public function GoToSite(_arg1:MouseEvent):void{
var _local2:URLRequest;
_local2 = new URLRequest("http://www.bunnygames.com/in.php?game=shadowkar&zone=more");
navigateToURL(_local2);
}
}
}//package
Section 24
//MenuMusic (MenuMusic)
package {
import flash.media.*;
public dynamic class MenuMusic extends Sound {
}
}//package
Section 25
//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{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 26
//MUSIC_GAME (MUSIC_GAME)
package {
import flash.display.*;
public dynamic class MUSIC_GAME extends MovieClip {
}
}//package
Section 27
//MUSIC_MENU (MUSIC_MENU)
package {
import flash.display.*;
public dynamic class MUSIC_MENU extends MovieClip {
}
}//package
Section 28
//NGLoader (NGLoader)
package {
import flash.display.*;
import flash.events.*;
import flash.media.*;
import flash.text.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
import flash.geom.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class NGLoader extends MovieClip {
public const AUTO_PLAY:Boolean = false;
public var bar:MovieClip;
public var playButton:SimpleButton;
public var loadingComplete:Boolean;
public var initialized:Boolean;
public function NGLoader(){
addFrameScript(0, frame1, 1, frame2);
}
public function init():void{
if (initialized){
return;
};
initialized = true;
stop();
if (((root) && ((root is MovieClip)))){
MovieClip(root).stop();
};
loadingComplete = false;
addEventListener(Event.ENTER_FRAME, enterFrameHandler, false, 0, true);
if (meetsVersion([9, 0, 28, 0])){
addEventListener(Event.REMOVED_FROM_STAGE, cleanup, false, 0, true);
};
enterFrameHandler();
}
public function enterFrameHandler(_arg1:Event=null):void{
var _local2:Number;
if (!loadingComplete){
_local2 = 0;
if (loaderInfo){
_local2 = (loaderInfo.bytesLoaded / loaderInfo.bytesTotal);
};
if (bar){
bar.scaleX = _local2;
};
if (_local2 == 1){
loadingComplete = true;
if (AUTO_PLAY){
startMovie();
} else {
gotoAndPlay("loaded");
};
};
};
}
public function meetsVersion(_arg1:Array):Boolean{
var _local2:Array;
var _local3:uint;
_local2 = String(Capabilities.version.split(" ")[1]).split(",");
_local3 = 0;
while (_local3 < _arg1.length) {
if (uint(_local2[_local3]) > _arg1[_local3]){
return (true);
};
if (uint(_local2[_local3]) < _arg1[_local3]){
return (false);
};
_local3++;
};
return (true);
}
public function playButtonClickHandler(_arg1:Event=null):void{
startMovie();
}
function frame1(){
initialized = false;
init();
}
function frame2(){
stop();
if (((playButton) && (!(playButton.hasEventListener(MouseEvent.CLICK))))){
playButton.addEventListener(MouseEvent.CLICK, playButtonClickHandler, false, 0, true);
};
}
public function cleanup(_arg1:Event=null){
if (initialized){
removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
if (meetsVersion([9, 0, 28, 0])){
removeEventListener(Event.REMOVED_FROM_STAGE, cleanup);
};
};
initialized = false;
}
public function startMovie():void{
cleanup();
if (((root) && ((root is MovieClip)))){
MovieClip(root).play();
};
MovieClip(root).ToWurmyIntro();
dispatchEvent(new Event(Event.COMPLETE));
}
}
}//package
Section 29
//Ring (Ring)
package {
import flash.display.*;
import flash.events.*;
public class Ring extends MovieClip {
private var Doc:Document;
private var HasPassed:Boolean;
private var HitTestBlock:Block;
public function Ring(_arg1:Document):void{
Doc = _arg1;
HitTestBlock = new Block();
HitTestBlock.x = (HitTestBlock.y = 0);
HitTestBlock.alpha = 10;
addChild(HitTestBlock);
Restart();
addEventListener(Event.ENTER_FRAME, Move, false, 0, true);
}
private function Restart():void{
x = ((Math.random() * 100) + 1000);
y = ((Math.random() * 150) + 100);
HasPassed = false;
}
private function Move(_arg1:Event):void{
var _local2:HitRingSound;
var _local3:int;
x = (x - Document.GameSpeed);
if (x < -50){
Restart();
};
if (((HitTestBlock.hitTestObject(Document.Player)) && (!(HasPassed)))){
Doc.AddScore(500);
Document.OverlaySprite.addChild(new ScoreText(500, x, y));
Document.Player.RingCombos++;
if (Document.Player.BombCombos == 0){
Document.OverlaySprite.addChild(new ComboText(3, 1500));
Doc.AddScore(1500);
};
_local2 = new HitRingSound();
_local2.play();
_local3 = 0;
while (_local3 <= 10) {
Document.GameSprite.addChild(new ExPar(Document.Player.x, Document.Player.y));
_local3++;
};
HasPassed = true;
};
}
}
}//package
Section 30
//Scenery (Scenery)
package {
import flash.display.*;
import flash.events.*;
public class Scenery extends MovieClip {
public function Scenery(_arg1:Number, _arg2:Number):void{
addFrameScript(0, frame1);
scaleX = (scaleX * ((int((Math.random() * 2)) - 0.5) * 2));
gotoAndStop(Math.ceil((Math.random() * 6)));
x = _arg1;
y = (_arg2 + 3);
addEventListener(Event.ENTER_FRAME, Move, false, 0, true);
}
function frame1(){
stop();
}
private function Move(_arg1:Event):void{
x = (x - Document.GameSpeed);
if ((((x < -50)) && (parent))){
parent.removeChild(this);
};
}
}
}//package
Section 31
//ScoreText (ScoreText)
package {
import flash.display.*;
import flash.text.*;
public class ScoreText extends MovieClip {
private var score:int;
private var type:int;
public var scoreText:TextField;
public function ScoreText(_arg1:int, _arg2:Number, _arg3:Number):void{
addFrameScript(0, frame1, 19, frame20, 29, frame30);
score = _arg1;
x = _arg2;
y = _arg3;
}
function frame1(){
UpdateText();
}
function frame20(){
UpdateText();
}
function frame30(){
if (parent){
parent.removeChild(this);
};
}
private function UpdateText():void{
scoreText.text = ("+" + score);
}
}
}//package
Section 32
//SmokePar (SmokePar)
package {
import flash.display.*;
import flash.events.*;
public class SmokePar extends MovieClip {
public function SmokePar(_arg1:Number, _arg2:Number):void{
addFrameScript(18, frame19);
x = _arg1;
y = (_arg2 - 1);
rotation = (Math.random() * 30);
scaleX = (scaleY = (0.1 + (Math.random() * 0.5)));
addEventListener(Event.ENTER_FRAME, Move, false, 0, true);
}
function frame19(){
stop();
}
private function Move(_arg1:Event):void{
x = (x - Document.GameSpeed);
if (alpha > 0){
alpha = (alpha - 0.03);
} else {
if (parent){
parent.removeChild(this);
};
};
}
}
}//package
Section 33
//Spotlight (Spotlight)
package {
import flash.display.*;
public dynamic class Spotlight extends MovieClip {
}
}//package
Section 34
//TimeNotice (TimeNotice)
package {
import flash.display.*;
import flash.text.*;
public class TimeNotice extends MovieClip {
public var insideText2:TextField;
public var insideText:TextField;
private var txt:String;
public function TimeNotice(_arg1:String):void{
addFrameScript(0, frame1, 9, frame10, 34, frame35, 42, frame43, 43, frame44);
txt = _arg1;
x = 0;
y = 0;
switch (_arg1){
case "5":
case "4":
case "3":
case "2":
case "1":
scaleX = (scaleY = 3);
x = (x - (width / 3));
y = (y - (height + 400));
break;
default:
scaleX = (scaleY = 1);
};
}
function frame10(){
UpdateText();
}
function frame1(){
UpdateText();
}
function frame35(){
UpdateText();
}
function frame43(){
UpdateText();
}
function frame44(){
if (parent){
parent.removeChild(this);
};
}
private function UpdateText():void{
insideText.text = txt;
insideText2.text = txt;
}
}
}//package
Section 35
//WurmyIntro (WurmyIntro)
package {
import flash.display.*;
import flash.events.*;
import flash.net.*;
public dynamic class WurmyIntro extends MovieClip {
public var targetURL:URLRequest;
public var button:SimpleButton;
public var mc:BUNNY_INTRO;
public function WurmyIntro(){
addFrameScript(0, frame1, 177, frame178);
}
function frame178(){
if (parent){
stop();
mc = new BUNNY_INTRO();
mc.x = 30;
mc.y = 80;
MovieClip(root).addChild(mc);
parent.removeChild(this);
};
}
function frame1(){
button.addEventListener(MouseEvent.MOUSE_UP, function (_arg1:MouseEvent):void{
targetURL = new URLRequest("http://www.wurmy.com/");
navigateToURL(targetURL);
});
x = (550 / 2);
y = (400 / 2);
}
}
}//package