Section 1
//URLNavigator (com.zorked.URLNavigator)
package com.zorked {
import flash.net.*;
import flash.external.*;
public class URLNavigator {
public static function ChangePage(_arg1, _arg2:String="_self"):void{
var _local4:String;
var _local3:URLRequest = ((_arg1 is String)) ? new URLRequest(_arg1) : _arg1;
if (!ExternalInterface.available){
navigateToURL(_local3, _arg2);
} else {
_local4 = String(ExternalInterface.call("function() {return navigator.userAgent;}")).toLowerCase();
if (((!((_local4.indexOf("firefox") == -1))) || (((!((_local4.indexOf("msie") == -1))) && ((uint(_local4.substr((_local4.indexOf("msie") + 5), 3)) >= 7)))))){
ExternalInterface.call("window.open", _local3.url, _arg2);
} else {
navigateToURL(_local3, _arg2);
};
};
}
}
}//package com.zorked
Section 2
//AdLoader (CPMStar.AdLoader)
package CPMStar {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class AdLoader extends Sprite {
private var cpmstarLoader:Loader;
private var contentspotid:String;
public function AdLoader(_arg1:String){
this.contentspotid = _arg1;
addEventListener(Event.ADDED, addedHandler);
}
private function dispatchHandler(_arg1:Event):void{
dispatchEvent(_arg1);
}
private function addedHandler(_arg1:Event):void{
removeEventListener(Event.ADDED, addedHandler);
Security.allowDomain("server.cpmstar.com");
var _local2 = "http://server.cpmstar.com/adviewas3.swf";
var _local3:DisplayObjectContainer = parent;
cpmstarLoader = new Loader();
cpmstarLoader.contentLoaderInfo.addEventListener(Event.INIT, dispatchHandler);
cpmstarLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dispatchHandler);
cpmstarLoader.load(new URLRequest(((_local2 + "?contentspotid=") + contentspotid)));
addChild(cpmstarLoader);
}
}
}//package CPMStar
Section 3
//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 reencode():void{
var _local1:uint = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function toString():String{
var _local1:String = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
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 get value():Number{
return (Number(this.toString()));
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
}
}//package mochi.as3
Section 4
//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 _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
var _local2:Object = {};
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 5
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.net.*;
import flash.utils.*;
import flash.system.*;
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 _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().getTime()));
_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 stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, _slot1.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 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://x.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);
};
}
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, _slot1.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 _local4:Array;
var _local5:Number;
var _local6:Array;
var _local2:Object = {};
var _local3:String = _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, _slot1.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, _slot1.onStatus);
_clip.onReceive = function (_arg1:Object):void{
var methodName:String;
var pkg = _arg1;
var cb:String = pkg.callbackID;
var cblst:Object = this.client._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 this.client._callbacks[cb];
};
_clip.onError = function ():void{
_slot1.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{
_slot1.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 id = _arg1;
var clip = _arg2;
var clipname:String = ("_mochiservices_com_" + id);
if (_clip != null){
return (_clip);
};
if (!_slot1.isNetworkAvailable()){
return (null);
};
if (urlOptions(clip).servicesURL != undefined){
_servicesURL = urlOptions(clip).servicesURL;
};
_slot1.allowDomains(_servicesURL);
_clip = createEmptyMovieClip(clip, clipname, 10336, false);
_loader = new Loader();
var f:Function = function (_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
_slot1.disconnect();
_slot1.onError("IOError");
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().getTime()) + "_") + Math.floor((Math.random() * 99999))));
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, f);
var req:URLRequest = new URLRequest(_servicesURL);
var vars:URLVariables = 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 (_slot1.clip != null){
if (_slot1.childClip != null){
try {
if (_slot1.clip.numChildren > 1){
_slot1.clip.setChildIndex(_slot1.childClip, (_slot1.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, _slot1.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){
_slot1.onError = onError;
} else {
if (_slot1.onError == null){
_slot1.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
var mc:MovieClip = 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)");
_slot1.disconnect();
_slot1.onError("IOError");
};
}
}
}//package mochi.as3
Section 6
//BitmapAsset (mx.core.BitmapAsset)
package mx.core {
import flash.display.*;
public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject {
mx_internal static const VERSION:String = "3.2.0.3958";
public function BitmapAsset(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
public function get measuredWidth():Number{
if (bitmapData){
return (bitmapData.width);
};
return (0);
}
public function get measuredHeight():Number{
if (bitmapData){
return (bitmapData.height);
};
return (0);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
}
}//package mx.core
Section 7
//ByteArrayAsset (mx.core.ByteArrayAsset)
package mx.core {
import flash.utils.*;
public class ByteArrayAsset extends ByteArray implements IFlexAsset {
mx_internal static const VERSION:String = "3.2.0.3958";
}
}//package mx.core
Section 8
//EdgeMetrics (mx.core.EdgeMetrics)
package mx.core {
public class EdgeMetrics {
public var top:Number;
public var left:Number;
public var bottom:Number;
public var right:Number;
mx_internal static const VERSION:String = "3.2.0.3958";
public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0);
;
public function EdgeMetrics(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){
this.left = _arg1;
this.top = _arg2;
this.right = _arg3;
this.bottom = _arg4;
}
public function clone():EdgeMetrics{
return (new EdgeMetrics(left, top, right, bottom));
}
}
}//package mx.core
Section 9
//FlexBitmap (mx.core.FlexBitmap)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexBitmap extends Bitmap {
mx_internal static const VERSION:String = "3.2.0.3958";
public function FlexBitmap(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
var bitmapData = _arg1;
var pixelSnapping = _arg2;
var smoothing = _arg3;
super(bitmapData, pixelSnapping, smoothing);
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 10
//FlexMovieClip (mx.core.FlexMovieClip)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexMovieClip extends MovieClip {
mx_internal static const VERSION:String = "3.2.0.3958";
public function FlexMovieClip(){
super();
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 11
//FontAsset (mx.core.FontAsset)
package mx.core {
import flash.text.*;
public class FontAsset extends Font implements IFlexAsset {
mx_internal static const VERSION:String = "3.2.0.3958";
}
}//package mx.core
Section 12
//IBorder (mx.core.IBorder)
package mx.core {
public interface IBorder {
function get borderMetrics():EdgeMetrics;
}
}//package mx.core
Section 13
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 14
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.accessibility.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get visible():Boolean;
function get rotation():Number;
function localToGlobal(_arg1:Point):Point;
function get name():String;
function set width(_arg1:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(_arg1:String):void;
function set scaleX(_arg1:Number):void;
function set scaleY(_arg1:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(_arg1:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(_arg1:Point):Point;
function get height():Number;
function set blendMode(_arg1:String):void;
function get parent():DisplayObjectContainer;
function getBounds(_arg1:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(_arg1:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(_arg1:Number):void;
function set accessibilityProperties(_arg1:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(_arg1:Boolean):void;
function get scaleX():Number;
function get scaleY():Number;
function get scrollRect():Rectangle;
function get mouseX():Number;
function get mouseY():Number;
function set height(_arg1:Number):void;
function set mask(_arg1:DisplayObject):void;
function getRect(_arg1:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(_arg1:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(_arg1:DisplayObject):Boolean;
function set opaqueBackground(_arg1:Object):void;
function set visible(_arg1:Boolean):void;
function get mask():DisplayObject;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function get transform():Transform;
function set filters(_arg1:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(_arg1:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 15
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(_arg1:Array):void;
function get isDocument():Boolean;
function set repeaters(_arg1:Array):void;
function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(_arg1:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 16
//MovieClipAsset (mx.core.MovieClipAsset)
package mx.core {
public class MovieClipAsset extends FlexMovieClip implements IFlexAsset, IFlexDisplayObject, IBorder {
private var _measuredHeight:Number;
private var _measuredWidth:Number;
mx_internal static const VERSION:String = "3.2.0.3958";
public function MovieClipAsset(){
_measuredWidth = width;
_measuredHeight = height;
}
public function get measuredWidth():Number{
return (_measuredWidth);
}
public function get measuredHeight():Number{
return (_measuredHeight);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
public function get borderMetrics():EdgeMetrics{
if (scale9Grid == null){
return (EdgeMetrics.EMPTY);
};
return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil((measuredWidth - scale9Grid.right)), Math.ceil((measuredHeight - scale9Grid.bottom))));
}
}
}//package mx.core
Section 17
//MovieClipLoaderAsset (mx.core.MovieClipLoaderAsset)
package mx.core {
import flash.events.*;
import flash.utils.*;
import flash.display.*;
import flash.system.*;
public class MovieClipLoaderAsset extends MovieClipAsset implements IFlexAsset, IFlexDisplayObject {
protected var initialHeight:Number;// = 0
private var loader:Loader;// = null
private var initialized:Boolean;// = false
protected var initialWidth:Number;// = 0
private var requestedHeight:Number;
private var requestedWidth:Number;
mx_internal static const VERSION:String = "3.2.0.3958";
public function MovieClipLoaderAsset(){
var _local1:LoaderContext = new LoaderContext();
_local1.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
if (("allowLoadBytesCodeExecution" in _local1)){
_local1["allowLoadBytesCodeExecution"] = true;
};
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader.loadBytes(movieClipData, _local1);
addChild(loader);
}
override public function get width():Number{
if (!initialized){
return (initialWidth);
};
return (super.width);
}
override public function set width(_arg1:Number):void{
if (!initialized){
requestedWidth = _arg1;
} else {
loader.width = _arg1;
};
}
override public function get measuredHeight():Number{
return (initialHeight);
}
private function completeHandler(_arg1:Event):void{
initialized = true;
initialWidth = loader.width;
initialHeight = loader.height;
if (!isNaN(requestedWidth)){
loader.width = requestedWidth;
};
if (!isNaN(requestedHeight)){
loader.height = requestedHeight;
};
dispatchEvent(_arg1);
}
override public function set height(_arg1:Number):void{
if (!initialized){
requestedHeight = _arg1;
} else {
loader.height = _arg1;
};
}
override public function get measuredWidth():Number{
return (initialWidth);
}
override public function get height():Number{
if (!initialized){
return (initialHeight);
};
return (super.height);
}
public function get movieClipData():ByteArray{
return (null);
}
}
}//package mx.core
Section 18
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 19
//SoundAsset (mx.core.SoundAsset)
package mx.core {
import flash.media.*;
public class SoundAsset extends Sound implements IFlexAsset {
mx_internal static const VERSION:String = "3.2.0.3958";
}
}//package mx.core
Section 20
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
import flash.utils.*;
public class NameUtil {
mx_internal static const VERSION:String = "3.2.0.3958";
private static var counter:int = 0;
public static function displayObjectToString(_arg1:DisplayObject):String{
var result:String;
var o:DisplayObject;
var s:String;
var indices:Array;
var displayObject = _arg1;
try {
o = displayObject;
while (o != null) {
if (((((o.parent) && (o.stage))) && ((o.parent == o.stage)))){
break;
};
s = o.name;
if ((o is IRepeaterClient)){
indices = IRepeaterClient(o).instanceIndices;
if (indices){
s = (s + (("[" + indices.join("][")) + "]"));
};
};
result = ((result == null)) ? s : ((s + ".") + result);
o = o.parent;
};
} catch(e:SecurityError) {
};
return (result);
}
public static function createUniqueName(_arg1:Object):String{
if (!_arg1){
return (null);
};
var _local2:String = getQualifiedClassName(_arg1);
var _local3:int = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
var _local4:int = _local2.charCodeAt((_local2.length - 1));
if ((((_local4 >= 48)) && ((_local4 <= 57)))){
_local2 = (_local2 + "_");
};
return ((_local2 + counter++));
}
}
}//package mx.utils
Section 21
//Background (Background)
package {
import flash.geom.*;
import flash.display.*;
public class Background extends Sprite {
private const StarSpread:Number = 0.6;
private const MoonHeight:Number;
private const ScrollSpeed:Number = 0.04;
private const StarCount:Number = 100;
private var MoonImg:Class;
private var mSky:Sprite;
private var BackgroundImg:Class;
private var mBackground:Sprite;
public function Background(){
MoonHeight = (Game.ScreenHeight * 0.6);
BackgroundImg = Background_BackgroundImg;
MoonImg = Background_MoonImg;
super();
}
public function update(_arg1:Point):void{
mBackground.x = (-((_arg1.x * ScrollSpeed)) % Game.ScreenWidth);
mBackground.y = (((_arg1.y + (Game.ScreenHeight * 0.5)) - mBackground.height) + Water.WaveHeight);
mSky.y = ((((_arg1.y * ScrollSpeed) + Game.ScreenHeight) - mSky.height) + Water.WaveHeight);
}
public function init(_arg1:Point):void{
var _local5:Bitmap;
var _local2:Matrix = new Matrix();
_local2.createGradientBox((Game.ScreenWidth * 2), (Game.ScreenWidth * 2), (Math.PI / 2), 0, 0);
mSky = new Sprite();
mSky.graphics.beginGradientFill(GradientType.LINEAR, [3885431, 8626168, 14336511], [1, 1, 1], [64, 128, 176], _local2, SpreadMethod.PAD);
mSky.graphics.drawRect(0, 0, (Game.ScreenWidth * 2), 940);
mSky.graphics.endFill();
mSky.graphics.beginFill(0xFFFFFF);
var _local3:Number = 0;
while (_local3 < StarCount) {
mSky.graphics.drawCircle((Math.random() * mSky.width), (((Math.random() * Math.random()) * StarSpread) * mSky.height), 1);
_local3++;
};
mSky.graphics.endFill();
mSky.y = ((Game.ScreenHeight * 0.5) - mSky.height);
var _local4:Bitmap = new BackgroundImg();
mBackground = new Sprite();
mBackground.graphics.beginBitmapFill(_local4.bitmapData, new Matrix(1, 0, 0, 1, 0, -1), true, true);
mBackground.graphics.drawRect(0, 0, (_local4.width * 2), _local4.height);
mBackground.graphics.endFill();
_local5 = new MoonImg();
_local5.x = (Game.ScreenWidth * 0.6);
_local5.y = MoonHeight;
mSky.addChild(_local5);
addChild(mSky);
addChild(mBackground);
}
public function reset():void{
x = 0;
}
}
}//package
Section 22
//Background_BackgroundImg (Background_BackgroundImg)
package {
import mx.core.*;
public class Background_BackgroundImg extends BitmapAsset {
}
}//package
Section 23
//Background_MoonImg (Background_MoonImg)
package {
import mx.core.*;
public class Background_MoonImg extends BitmapAsset {
}
}//package
Section 24
//ClammitLoader (ClammitLoader)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import mochi.as3.*;
import CPMStar.*;
import flash.utils.*;
public dynamic class ClammitLoader extends MovieClip {
private var mBar:Sprite;
private var mStartButton:Sprite;
private var mStartTime:Number;
private var mLoading:Boolean;// = true
private var mAdContainer:Sprite;
private var StartGameImg:Class;
private var mOnReady:Function;
private static const ScreenWidth:int = 640;
private static const AdWidth:int = 300;
private static const BarY:int = 380;
private static const AdHeight:int = 250;
private static const ScreenHeight:int = 480;
private static const AdBorder:int = 10;
private static const AdOffsetY:int = 40;
private static const BarWidth:int = 400;
private static const AdDuration:int = 4000;
private static const BarHeight:int = 15;
public function ClammitLoader(){
StartGameImg = ClammitLoader_StartGameImg;
super();
addEventListener(Event.ENTER_FRAME, onEnterFrame);
loaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
var _local1:Matrix = new Matrix();
_local1.createGradientBox(ScreenWidth, ScreenHeight, (Math.PI / 2), 0, 0);
graphics.beginGradientFill(GradientType.LINEAR, [16700269, 16637918], [1, 1], [0, 0xFF], _local1, SpreadMethod.PAD);
graphics.drawRect(0, 0, ScreenWidth, ScreenHeight);
graphics.endFill();
mAdContainer = new Sprite();
mAdContainer.graphics.beginFill(0xFFFFFF);
mAdContainer.graphics.drawRect(0, 0, (AdWidth + (AdBorder * 2)), (AdHeight + (AdBorder * 2)));
mAdContainer.graphics.endFill();
mAdContainer.x = ((ScreenWidth - mAdContainer.width) * 0.5);
mAdContainer.y = (((ScreenHeight - mAdContainer.height) * 0.5) - AdOffsetY);
var _local2:AdLoader = new AdLoader("641QA71BF517");
_local2.x = AdBorder;
_local2.y = AdBorder;
mAdContainer.addChild(_local2);
addChild(mAdContainer);
mStartTime = new Date().getTime();
mBar = new Sprite();
mBar.x = ((ScreenWidth - BarWidth) * 0.5);
mBar.y = BarY;
addChild(mBar);
}
private function onStart(_arg1:Event):void{
graphics.clear();
removeChild(mAdContainer);
removeChild(mStartButton);
var _local2:Class = (getDefinitionByName("Main") as Class);
addChild((new (_local2) as DisplayObject));
MochiServices.connect("bde6d65af9ebf2b7", root);
}
public function onEnterFrame(_arg1:Event):void{
if (currentFrame >= totalFrames){
removeChild(mBar);
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
stop();
loaderInfo.removeEventListener(ProgressEvent.PROGRESS, onProgress);
mStartButton = new Sprite();
mStartButton.addChild(new StartGameImg());
mStartButton.x = ((ScreenWidth - mStartButton.width) * 0.5);
mStartButton.y = BarY;
mStartButton.buttonMode = true;
mStartButton.addEventListener(MouseEvent.CLICK, onStart);
addChild(mStartButton);
};
}
private function onProgress(_arg1:ProgressEvent):void{
var _local2:Number = (loaderInfo.bytesLoaded / loaderInfo.bytesTotal);
mBar.graphics.clear();
mBar.graphics.beginFill(0xFFFFFF);
mBar.graphics.drawRect(0, 0, (_local2 * BarWidth), BarHeight);
mBar.graphics.endFill();
mBar.graphics.lineStyle(3, 0xFFFFFF);
mBar.graphics.moveTo(0, 0);
mBar.graphics.lineTo(BarWidth, 0);
mBar.graphics.lineTo(BarWidth, BarHeight);
mBar.graphics.lineTo(0, BarHeight);
mBar.graphics.lineTo(0, 0);
}
}
}//package
Section 25
//ClammitLoader_StartGameImg (ClammitLoader_StartGameImg)
package {
import mx.core.*;
public class ClammitLoader_StartGameImg extends BitmapAsset {
}
}//package
Section 26
//Foreground (Foreground)
package {
import flash.geom.*;
import flash.display.*;
public class Foreground extends Sprite {
private const FloorLevel:Number;
private var StartImg:Class;
private var mPastStart:Boolean;// = false
private var mStart:Bitmap;
private var FloorImg:Class;
public function Foreground(){
FloorLevel = (((Game.ScreenHeight * 0.5) - Game.FloorHeight) - Game.StoneSize);
StartImg = Foreground_StartImg;
FloorImg = Foreground_FloorImg;
super();
}
public function update(_arg1:Point):void{
if (((!(mPastStart)) && ((_arg1.x > mStart.width)))){
mPastStart = true;
removeChild(mStart);
};
x = (-(_arg1.x) % Game.ScreenWidth);
y = _arg1.y;
}
public function reset():void{
addChild(mStart);
x = 0;
mPastStart = false;
}
public function init(_arg1:Point):void{
var _local2:Sprite = new Sprite();
var _local3:Bitmap = new FloorImg();
_local2.graphics.beginBitmapFill(_local3.bitmapData, new Matrix(1, 0, 0, 1, 0, -1), true);
_local2.graphics.drawRect(0, 0, (Game.ScreenWidth * 2), _local3.height);
_local2.graphics.endFill();
_local2.y = FloorLevel;
graphics.beginFill(16775619);
graphics.drawRect(0, (FloorLevel + (_local2.height * 0.5)), (Game.ScreenWidth * 2), Game.ScreenHeight);
graphics.endFill();
mStart = new StartImg();
addChild(_local2);
addChild(mStart);
y = _arg1.y;
}
}
}//package
Section 27
//Foreground_FloorImg (Foreground_FloorImg)
package {
import mx.core.*;
public class Foreground_FloorImg extends BitmapAsset {
}
}//package
Section 28
//Foreground_StartImg (Foreground_StartImg)
package {
import mx.core.*;
public class Foreground_StartImg extends BitmapAsset {
}
}//package
Section 29
//Game (Game)
package {
import flash.events.*;
import mx.core.*;
import flash.utils.*;
import flash.geom.*;
import flash.display.*;
import flash.ui.*;
public class Game extends Sprite {
private var mPaused:Boolean;
private var mProps:Array;
private var mKeyRight:Boolean;// = false
private var mForeground:Foreground;
private var mThrown:Boolean;
private var mGuy:Guy;
private var mScore:Number;
private var mSunk:Boolean;
private var mWater:Water;
private var mPosition:Point;
private var mMaxHeight:Number;
private var mMain:Main;
private var mHUD:HUD;
private var mSplashManager:SplashManager;
private var mKeyLeft:Boolean;// = false
private var mScreenPos:Point;
private var mSkipCount:Number;
private var mTrickManager:TrickManager;
private var mVelocity:Point;
private var mStone:Stone;
private var mBackground:Background;
private static const MagicSkipAngle:Number = 30;
private static const MinVelocityX:Number = 10;
public static const MaxHeight:Number = 60;
private static const FloorFriction:Number = 0.9;
private static const DiveSpeed:Number = 2;
private static const PointsPerMetre:Number = 250;
private static const WaterResistance:Number = 0.95;
public static const ScreenWidth:Number = 640;
private static const MaxThrowRotation:Number = 20;
private static const StartPosition:Number = 20;
private static const RotateSpeed:Number = 3.5;
private static const ThrowStrength:Number = 100;
private static const Gravity:Number = -0.5;
private static const BounceDampX:Number = 0.6;
private static const BounceDampY:Number = 0.5;
public static const FloorHeight:Number = -330;
private static const BounceRotMultiplier:Number = 0.6;
private static const ThrowArmLength:Number = 30;
private static const ThrowPivotY:Number = 100;
private static const ThrowPivotX:Number = 0;
public static const ScreenHeight:Number = 480;
private static const WaterGravity:Number = -3;
private static const PixelsPerMetre:Number = 150;
public static const StoneSize:Number = 15;
private static const StartRotation:Number = -20;
private static const MinThrowRotation:Number = -75;
private static const CloudCount:Number = 30;
private static var PerfectSkimSound:Class = Game_PerfectSkimSound;
private static var TrickSound:Class = Game_TrickSound;
private static var mSkimSound:SoundAsset = (new SkimSound() as SoundAsset);
private static var mThrowSound:SoundAsset = (new ThrowSound() as SoundAsset);
private static var mSplashSound:SoundAsset = (new SplashSound() as SoundAsset);
private static var SplashSound:Class = Game_SplashSound;
private static var mTrickSound:SoundAsset = (new TrickSound() as SoundAsset);
private static var SkimSound:Class = Game_SkimSound;
private static var ThrowSound:Class = Game_ThrowSound;
private static var CloudImg:Class = Game_CloudImg;
private static var mPerfectSkimSound:SoundAsset = (new PerfectSkimSound() as SoundAsset);
public function Game(){
mProps = new Array();
mPosition = new Point(0, 0);
mScreenPos = new Point(0, 0);
mVelocity = new Point(0, 0);
super();
}
private function setDefaultValues():void{
mPaused = false;
mSunk = false;
mThrown = false;
mSkipCount = 0;
mScore = 0;
mMaxHeight = 0;
mStone.setRotation(StartRotation);
positionStone();
positionScreen();
stage.focus = this;
}
private function positionScreen():void{
mScreenPos.x = (mPosition.x - (ScreenWidth * 0.5));
mScreenPos.y = mPosition.y;
if (mScreenPos.x < 0){
mScreenPos.x = 0;
mStone.x = mPosition.x;
} else {
mStone.x = (ScreenWidth * 0.5);
};
mStone.y = (ScreenHeight * 0.5);
}
public function pause(_arg1:Event=null):void{
if (!mPaused){
mPaused = true;
mHUD.doPause();
} else {
unpause();
};
}
private function doTrick(_arg1:String):void{
mTrickManager.addTrick(_arg1);
if (_arg1.indexOf("skip") == -1){
mStone.onTrick();
} else {
mStone.onSkip(_arg1.charAt(0));
};
}
public function rotateLeft():void{
if (mThrown){
if (!mSunk){
mStone.spin(-(RotateSpeed));
};
} else {
if (mStone.getRotation() > MinThrowRotation){
mStone.rotate(-(RotateSpeed));
};
};
}
public function restart(_arg1:Event=null):void{
mTrickManager.reset();
mStone.reset();
mGuy.reset();
mForeground.reset();
mBackground.reset();
mHUD.reset();
setDefaultValues();
var _local2:Number = 0;
while (_local2 < mProps.length) {
mProps[_local2].reset();
_local2++;
};
}
public function stop():void{
removeEventListener(Event.ENTER_FRAME, update);
stage.removeEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
stage.removeEventListener(KeyboardEvent.KEY_UP, onKeyUp);
stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
}
public function sink():void{
mVelocity.y = WaterGravity;
mSunk = true;
mScore = getScore();
mStone.onSink();
var _local1:Timer = new Timer(1000, 1);
_local1.addEventListener(TimerEvent.TIMER_COMPLETE, mHUD.doSummary);
_local1.start();
mSplashSound.play();
}
public function init(_arg1:Main):void{
var _local2:Number;
var _local3:Prop;
mMain = _arg1;
mBackground = new Background();
mBackground.init(mScreenPos);
mForeground = new Foreground();
mForeground.init(mScreenPos);
mSplashManager = new SplashManager();
mSplashManager.init();
mTrickManager = new TrickManager();
mTrickManager.init();
mHUD = new HUD();
mHUD.init(mMain, this, mTrickManager);
mStone = new Stone();
mStone.init(mTrickManager);
setDefaultValues();
mGuy = new Guy();
mGuy.init(mScreenPos);
mWater = new Water();
mWater.init(mScreenPos);
addEventListener(Event.ENTER_FRAME, update);
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
stage.addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
_local2 = 0;
while (_local2 < CloudCount) {
_local3 = new Prop();
_local3.addChild(new CloudImg());
_local3.init(mPosition, ((Math.random() * ScreenWidth) * 2), ((Math.random() * 5000) + 150));
mProps.push(_local3);
_local2++;
};
mProps.sort(Prop.compare);
addChild(mBackground);
_local2 = 0;
while (_local2 < mProps.length) {
addChild(mProps[_local2]);
_local2++;
};
addChild(mWater);
addChild(mForeground);
addChild(mGuy);
addChild(mStone);
addChild(mSplashManager);
addChild(mHUD);
}
public function rotateRight():void{
if (mThrown){
if (!mSunk){
mStone.spin(RotateSpeed);
};
} else {
if (mStone.getRotation() < MaxThrowRotation){
mStone.rotate(RotateSpeed);
};
};
}
public function getSkipCount():Number{
return (mSkipCount);
}
private function doThrow():void{
mThrown = true;
var _local1:Number = ((-(mStone.getRotation()) * Math.PI) / 180);
mVelocity.x = (Math.cos(_local1) * ThrowStrength);
mVelocity.y = (Math.sin(_local1) * ThrowStrength);
mGuy.onThrow();
mStone.onThrow();
mThrowSound.play();
}
private function unpause():void{
mHUD.reset();
mPaused = false;
stage.focus = this;
}
private function checkTricks():void{
if (mStone.getTurns() > 360){
mStone.adjustTurns(-360);
doTrick("fflip");
mTrickSound.play();
} else {
if (mStone.getTurns() < -360){
mStone.adjustTurns(360);
doTrick("bflip");
mTrickSound.play();
};
};
}
private function updateScreenItems():void{
var _local1:Number = 0;
while (_local1 < mProps.length) {
mProps[_local1].update(mScreenPos);
if (mProps[_local1].isGone()){
mProps[_local1].takeNewPosition(mScreenPos);
};
_local1++;
};
mSplashManager.update(mScreenPos);
mBackground.update(mScreenPos);
mForeground.update(mScreenPos);
mWater.update(mScreenPos);
mGuy.update(mScreenPos);
}
public function getDistancePoints():Number{
return (Math.floor((getCurrentDistance() * PointsPerMetre)));
}
public function onKeyUp(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == Keyboard.LEFT)) || ((_arg1.keyCode == Keyboard.UP)))){
mKeyLeft = false;
} else {
if ((((_arg1.keyCode == Keyboard.RIGHT)) || ((_arg1.keyCode == Keyboard.DOWN)))){
mKeyRight = false;
} else {
if (_arg1.keyCode == Keyboard.SPACE){
if (mHUD.inSummary()){
restart();
} else {
if (((!(mThrown)) && (!(mPaused)))){
doThrow();
};
};
} else {
if (_arg1.keyCode == 80){
pause();
} else {
if (_arg1.keyCode == 77){
mMain.mute();
} else {
if (_arg1.keyCode == Keyboard.ENTER){
if (((mHUD.inSummary()) || (((!(mPaused)) && (!(mSunk)))))){
restart();
};
};
};
};
};
};
};
}
public function onMouseUp(_arg1:MouseEvent):void{
}
public function onKeyDown(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == Keyboard.LEFT)) || ((_arg1.keyCode == Keyboard.UP)))){
mKeyLeft = true;
} else {
if ((((_arg1.keyCode == Keyboard.RIGHT)) || ((_arg1.keyCode == Keyboard.DOWN)))){
mKeyRight = true;
};
};
}
private function positionStone():void{
if (mGuy){
mGuy.rotation = mStone.getRotation();
mPosition = mGuy.getHandPosition();
};
}
public function update(_arg1:Event):void{
if (!mPaused){
positionScreen();
updateKeys();
updateScreenItems();
if (mThrown){
if (!mSunk){
checkTricks();
mVelocity.y = (mVelocity.y + Gravity);
} else {
if (mPosition.y < FloorHeight){
mVelocity.y = 0;
mVelocity.x = (mVelocity.x * FloorFriction);
} else {
mVelocity.x = (mVelocity.x * WaterResistance);
};
};
mPosition = mPosition.add(mVelocity);
if ((((((mPosition.y < 0)) && ((mVelocity.y < 0)))) && (!(mSunk)))){
doBounce();
};
} else {
positionStone();
};
mHUD.update();
if (mPosition.y > mMaxHeight){
mMaxHeight = mPosition.y;
};
mStone.update(mVelocity);
};
}
private function hasEnoughBounce():Boolean{
return ((mVelocity.x > MinVelocityX));
}
public function getScore():Number{
return ((mScore + getDistancePoints()));
}
private function updateKeys():void{
if (mKeyLeft){
rotateLeft();
} else {
if (mKeyRight){
rotateRight();
};
};
}
public function getCurrentDistance():Number{
if (mThrown){
return (((mPosition.x - StartPosition) / PixelsPerMetre));
};
return (0);
}
private function doBounce():void{
var _local1:Number;
var _local2:Number;
mSplashManager.addSplash(mPosition.x, mScreenPos);
if (hasEnoughBounce()){
_local1 = ((-(mStone.getRotation()) + 360) % 180);
_local2 = ((_local1 * Math.PI) / 180);
mVelocity.x = ((mVelocity.length * Math.cos(_local2)) * BounceDampX);
mVelocity.y = ((mVelocity.length * Math.sin(_local2)) * BounceDampY);
if (mVelocity.x < DiveSpeed){
mVelocity.x = DiveSpeed;
};
doBoost(_local1);
mSkipCount++;
mStone.setTurns(0);
mStone.spin((_local1 * BounceRotMultiplier));
if ((((mStone.getTurns() < -180)) || ((mStone.getTurns() > 180)))){
doTrick("switch");
};
if (mPosition.y < 0){
mPosition.y = 0;
};
} else {
mTrickManager.clear();
sink();
};
}
public function getMaxHeight():Number{
return ((mMaxHeight / PixelsPerMetre));
}
public function getCurrentHeight():Number{
if (mThrown){
return ((mPosition.y / PixelsPerMetre));
};
return (0);
}
private function doBoost(_arg1:Number):void{
var _local4:Number;
var _local2:Boolean;
var _local3:Number = Math.abs((_arg1 - MagicSkipAngle));
if ((((_local3 < 20)) && ((_arg1 > 5)))){
_local4 = 1;
if (_local3 < 10){
doTrick("pskip");
_local4 = 1.4;
mHUD.setMessage("Perfect!");
_local2 = false;
mPerfectSkimSound.play();
} else {
if (_local3 < 20){
doTrick("gskip");
_local4 = 1.2;
mHUD.setMessage("Good");
mSkimSound.play();
};
};
mVelocity.x = (mVelocity.x * _local4);
mVelocity.y = (mVelocity.y * _local4);
} else {
doTrick("skip");
mSkimSound.play();
};
if (_local2){
mScore = (mScore + Math.floor(mTrickManager.getTotalPoints()));
mTrickManager.clear();
};
}
public function onMouseMove(_arg1:MouseEvent):void{
}
}
}//package
Section 30
//Game_CloudImg (Game_CloudImg)
package {
import mx.core.*;
public class Game_CloudImg extends BitmapAsset {
}
}//package
Section 31
//Game_PerfectSkimSound (Game_PerfectSkimSound)
package {
import mx.core.*;
public class Game_PerfectSkimSound extends SoundAsset {
}
}//package
Section 32
//Game_SkimSound (Game_SkimSound)
package {
import mx.core.*;
public class Game_SkimSound extends SoundAsset {
}
}//package
Section 33
//Game_SplashSound (Game_SplashSound)
package {
import mx.core.*;
public class Game_SplashSound extends SoundAsset {
}
}//package
Section 34
//Game_ThrowSound (Game_ThrowSound)
package {
import mx.core.*;
public class Game_ThrowSound extends SoundAsset {
}
}//package
Section 35
//Game_TrickSound (Game_TrickSound)
package {
import mx.core.*;
public class Game_TrickSound extends SoundAsset {
}
}//package
Section 36
//Guy (Guy)
package {
import flash.geom.*;
import flash.display.*;
public class Guy extends Sprite {
private var GuyThrowImg:Class;
private var mAbsolutePosition:Point;
private var GuyImg:Class;
private var mBitmap:Bitmap;
public function Guy(){
GuyImg = Guy_GuyImg;
GuyThrowImg = Guy_GuyThrowImg;
super();
}
public function onThrow():void{
var _local1:Bitmap;
_local1 = mBitmap;
mBitmap = new GuyThrowImg();
mBitmap.smoothing = true;
mBitmap.x = -43;
mBitmap.y = -64;
removeChild(_local1);
addChild(mBitmap);
}
public function update(_arg1:Point):void{
x = (mAbsolutePosition.x - _arg1.x);
y = ((Game.ScreenHeight * 0.5) - (mAbsolutePosition.y - _arg1.y));
}
public function getHandPosition():Point{
var _local1:Number = (((-(rotation) - 27) * Math.PI) / 180);
return (new Point(((-(Math.cos(_local1)) * 46.6) + mAbsolutePosition.x), ((-(Math.sin(_local1)) * 46.6) + mAbsolutePosition.y)));
}
public function reset():void{
var _local1:Bitmap;
_local1 = mBitmap;
mBitmap = new GuyImg();
mBitmap.smoothing = true;
mBitmap.x = -43;
mBitmap.y = -64;
removeChild(_local1);
addChild(mBitmap);
}
public function init(_arg1:Point):void{
mBitmap = new GuyImg();
mBitmap.smoothing = true;
addChild(mBitmap);
mBitmap.x = -43;
mBitmap.y = -64;
mAbsolutePosition = new Point(82, 60);
update(_arg1);
}
}
}//package
Section 37
//Guy_GuyImg (Guy_GuyImg)
package {
import mx.core.*;
public class Guy_GuyImg extends BitmapAsset {
}
}//package
Section 38
//Guy_GuyThrowImg (Guy_GuyThrowImg)
package {
import mx.core.*;
public class Guy_GuyThrowImg extends BitmapAsset {
}
}//package
Section 39
//HUD (HUD)
package {
import flash.events.*;
import flash.geom.*;
import flash.display.*;
import mochi.as3.*;
import com.zorked.*;
import flash.text.*;
public class HUD extends Sprite {
private var mMessageTextFormat:TextFormat;
private var mHeightBar:Sprite;
private var DavidSans:Class;
private var mTrickTextFormat:TextFormat;
private var mTrickScoreField:TextField;
private var mDistanceField:TextField;
private var StoneSmallImg:Class;
private var SubmitScoreImg:Class;
private var mGameControlsContainer:Sprite;
private var mHighScores:Sprite;
private var mTrickField:TextField;
private var BackImg:Class;
private var PlayAgainImg:Class;
private var mMessageField:TextField;
private var MenuImg:Class;
private var mMain:Main;
private var MainMenuImg:Class;
private var mStoneHeightBitmap:Bitmap;
private var mTextFormat:TextFormat;
private var RestartImg:Class;
private var mRecordedScore:Number;
private var MoreGamesImg:Class;
private var mInSummary:Boolean;// = false
private var mScoreField:TextField;
private var mPauseControlsContainer:Sprite;
private var mTrickScoreTextFormat:TextFormat;
private var mSummaryControlsContainer:Sprite;
private var mTrickManager:TrickManager;
private var mGame:Game;
private static const HeightBarLength:Number = 300;
private static const MessageFadeRate:Number = 0.02;
private static const MaxTrickStringLength:Number = 60;
public function HUD(){
DavidSans = HUD_DavidSans;
StoneSmallImg = HUD_StoneSmallImg;
PlayAgainImg = HUD_PlayAgainImg;
MainMenuImg = HUD_MainMenuImg;
MoreGamesImg = HUD_MoreGamesImg;
RestartImg = HUD_RestartImg;
BackImg = HUD_BackImg;
MenuImg = HUD_MenuImg;
SubmitScoreImg = HUD_SubmitScoreImg;
super();
}
public function init(_arg1:Main, _arg2:Game, _arg3:TrickManager):void{
mMain = _arg1;
mGame = _arg2;
mTrickManager = _arg3;
mMessageTextFormat = new TextFormat("DavidSans", 12, 16768324);
mTextFormat = new TextFormat("DavidSans", 12, 0xFFFFFF);
mTrickScoreTextFormat = new TextFormat("DavidSans", 12, 12020073);
mInSummary = false;
setup();
}
public function doSummary(_arg1:Event=null):void{
var _local2:Number;
var _local3:TextField;
if (contains(mGameControlsContainer)){
removeChild(mGameControlsContainer);
};
mInSummary = true;
mRecordedScore = mGame.getScore();
var _local4:TextFormat = new TextFormat("DavidSans", 15, 0xFF0000);
var _local5:TextFormat = new TextFormat("DavidSans", 12, 6512526);
var _local6:Array = new Array(new Array("totalDistance", (mGame.getCurrentDistance().toFixed(2) + "m"), _local5), new Array("maxHeight", (mGame.getMaxHeight().toFixed(2) + "m"), _local5), new Array("numTricks", mTrickManager.getTotalTricks().toString(), _local5), new Array("longestCombo", mTrickManager.getHighestCombo().toString(), _local5), new Array("numSkips", mGame.getSkipCount(), _local5), new Array("score", getScoreGrouped(mRecordedScore), _local4));
_local2 = 0;
while (_local2 < _local6.length) {
_local3 = TextField(mSummaryControlsContainer.getChildByName(_local6[_local2][0]));
_local3.text = _local6[_local2][1];
_local3.setTextFormat(_local6[_local2][2]);
_local2++;
};
addChild(mSummaryControlsContainer);
}
public function doPause():void{
if (!contains(mPauseControlsContainer)){
addChild(mPauseControlsContainer);
};
}
public function inSummary():Boolean{
return (mInSummary);
}
public function setMessage(_arg1:String):void{
mMessageField.text = _arg1;
mMessageField.setTextFormat(mMessageTextFormat);
mMessageField.x = ((Game.ScreenWidth * 0.5) - ((mMessageField.text.length * 8) * 0.5));
mMessageField.alpha = 1;
}
public function doScore(_arg1:Event=null):void{
var matrix:Matrix;
var o:Object;
var boardID:String;
var pEvent = _arg1;
if (mRecordedScore != -1){
mHighScores = new Sprite();
matrix = new Matrix();
matrix.createGradientBox(Game.ScreenWidth, Game.ScreenHeight, (Math.PI / 2), 0, 0);
mHighScores.graphics.beginGradientFill(GradientType.LINEAR, [16700269, 16637918], [1, 1], [0, 0xFF], matrix, SpreadMethod.PAD);
mHighScores.graphics.drawRect(0, 0, Game.ScreenWidth, Game.ScreenHeight);
mHighScores.graphics.endFill();
o = {n:[15, 14, 12, 8, 8, 11, 0, 2, 11, 6, 9, 4, 3, 1, 0, 0], 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:mRecordedScore, clip:mHighScores, onClose:onHideScores, onDisplay:onDisplayScores});
addChild(mHighScores);
};
}
private function onHideScores():void{
removeChild(mHighScores);
}
public function reset():void{
if (contains(mPauseControlsContainer)){
removeChild(mPauseControlsContainer);
};
if (contains(mSummaryControlsContainer)){
removeChild(mSummaryControlsContainer);
};
if (!contains(mGameControlsContainer)){
addChild(mGameControlsContainer);
};
mInSummary = false;
mRecordedScore = -1;
}
public function update():void{
if (!mInSummary){
mDistanceField.text = (("Distance: " + mGame.getCurrentDistance().toFixed(2)) + "m");
mScoreField.text = ("Score: " + getScoreGrouped(mGame.getScore()));
mTrickField.text = mTrickManager.getTrickString();
if (mTrickField.text.length > MaxTrickStringLength){
mTrickField.text = (".." + mTrickField.text.slice(((mTrickField.text.length - MaxTrickStringLength) + 2)));
};
mTrickField.x = ((Game.ScreenWidth * 0.5) - ((mTrickField.text.length * 8) * 0.5));
if (mTrickManager.getPoints() > 0){
mTrickScoreField.text = ((mTrickManager.getPoints().toString() + " x ") + mTrickManager.getMultiplier().toFixed(2));
mTrickScoreField.x = ((Game.ScreenWidth * 0.5) - ((mTrickScoreField.text.length * 8) * 0.5));
} else {
mTrickScoreField.text = "";
};
mDistanceField.setTextFormat(mTextFormat);
mScoreField.setTextFormat(mTextFormat);
mTrickField.setTextFormat(mTextFormat);
mTrickScoreField.setTextFormat(mTrickScoreTextFormat);
mStoneHeightBitmap.y = (((1 - (mGame.getCurrentHeight() / Game.MaxHeight)) * HeightBarLength) - (mStoneHeightBitmap.height * 0.5));
if (mMessageField.alpha > 0){
mMessageField.alpha = (mMessageField.alpha - MessageFadeRate);
};
};
}
private function gotoMiniJuegos(_arg1:Event):void{
var e = _arg1;
var url = "http://www.minijuegos.com/";
try {
URLNavigator.ChangePage(url, "_blank");
} catch(e:Error) {
};
}
private function getScoreGrouped(_arg1:Number):String{
var _local2:String = _arg1.toString();
var _local3 = "";
var _local4:Number = 3;
while (_local4 < _local2.length) {
_local3 = (("," + _local2.slice(-(_local4), ((_local2.length - _local4) + 3))) + _local3);
_local4 = (_local4 + 3);
};
_local3 = (_local2.slice(0, (((_local2.length - 1) % 3) + 1)) + _local3);
return (_local3);
}
private function onDisplayScores():void{
var _local1:Bitmap = new MoreGamesImg();
var _local2:SimpleButton = new SimpleButton(_local1, _local1, _local1, _local1);
_local2.x = ((Game.ScreenWidth - _local1.width) * 0.5);
_local2.y = ((Game.ScreenHeight - _local1.height) - 15);
_local2.useHandCursor = true;
_local2.addEventListener(MouseEvent.CLICK, gotoMiniJuegos);
mHighScores.addChild(_local2);
}
private function setup():void{
var _local1:Bitmap;
var _local2:SimpleButton;
var _local3:Number;
var _local4:TextField;
mGameControlsContainer = new Sprite();
mPauseControlsContainer = new Sprite();
mSummaryControlsContainer = new Sprite();
addChild(mGameControlsContainer);
var _local5:TextFormat = new TextFormat("DavidSans", 12, 0);
var _local6:TextFormat = new TextFormat("DavidSans", 20, 0);
mScoreField = new TextField();
mScoreField.type = TextFieldType.DYNAMIC;
mScoreField.border = false;
mScoreField.x = 10;
mScoreField.y = 10;
mScoreField.width = 500;
mScoreField.multiline = false;
mScoreField.wordWrap = false;
mScoreField.selectable = false;
mScoreField.embedFonts = true;
mDistanceField = new TextField();
mDistanceField.type = TextFieldType.DYNAMIC;
mDistanceField.border = false;
mDistanceField.x = (Game.ScreenWidth - 140);
mDistanceField.y = 10;
mDistanceField.width = 500;
mDistanceField.multiline = false;
mDistanceField.wordWrap = false;
mDistanceField.selectable = false;
mDistanceField.embedFonts = true;
mMessageField = new TextField();
mMessageField.type = TextFieldType.DYNAMIC;
mMessageField.border = false;
mMessageField.x = (Game.ScreenWidth / 2);
mMessageField.y = 80;
mMessageField.width = 500;
mMessageField.multiline = false;
mMessageField.wordWrap = false;
mMessageField.selectable = false;
mMessageField.embedFonts = true;
mTrickField = new TextField();
mTrickField.type = TextFieldType.DYNAMIC;
mTrickField.border = false;
mTrickField.x = (Game.ScreenWidth / 2);
mTrickField.y = 300;
mTrickField.width = 500;
mTrickField.multiline = false;
mTrickField.wordWrap = false;
mTrickField.selectable = false;
mTrickField.embedFonts = true;
mTrickScoreField = new TextField();
mTrickScoreField.type = TextFieldType.DYNAMIC;
mTrickScoreField.border = false;
mTrickScoreField.x = (Game.ScreenWidth / 2);
mTrickScoreField.y = 320;
mTrickScoreField.width = 500;
mTrickScoreField.multiline = false;
mTrickScoreField.wordWrap = false;
mTrickScoreField.selectable = false;
mTrickScoreField.embedFonts = true;
mHeightBar = new Sprite();
mHeightBar.graphics.lineStyle(2, 0xFFFFFF);
mHeightBar.graphics.beginFill(0xFFFFFF);
mHeightBar.graphics.moveTo(0, 0);
mHeightBar.graphics.lineTo(16, 0);
mHeightBar.graphics.moveTo(0, HeightBarLength);
mHeightBar.graphics.lineTo(16, HeightBarLength);
mHeightBar.graphics.moveTo(8, 0);
mHeightBar.graphics.lineTo(8, HeightBarLength);
mHeightBar.graphics.endFill();
mStoneHeightBitmap = new StoneSmallImg();
mStoneHeightBitmap.scaleX = 0.5;
mStoneHeightBitmap.scaleY = 0.5;
mStoneHeightBitmap.x = (8 - (mStoneHeightBitmap.width * 0.5));
mStoneHeightBitmap.y = (100 - (mStoneHeightBitmap.height * 0.5));
mHeightBar.addChild(mStoneHeightBitmap);
mHeightBar.x = (Game.ScreenWidth - 40);
mHeightBar.y = 50;
mGameControlsContainer.addChild(mHeightBar);
mGameControlsContainer.addChild(mScoreField);
mGameControlsContainer.addChild(mDistanceField);
mGameControlsContainer.addChild(mMessageField);
mGameControlsContainer.addChild(mTrickField);
mGameControlsContainer.addChild(mTrickScoreField);
_local1 = new MenuImg();
_local2 = new SimpleButton(_local1, _local1, _local1, _local1);
_local2.x = ((Game.ScreenWidth - _local2.width) - 10);
_local2.y = ((Game.ScreenHeight - _local2.height) - 10);
_local2.useHandCursor = true;
_local2.addEventListener(MouseEvent.CLICK, mGame.pause);
mGameControlsContainer.addChild(_local2);
var _local7:Point = new Point((Game.ScreenWidth * 0.7), (Game.ScreenHeight * 0.2));
mPauseControlsContainer.graphics.beginFill(0xFFFFFF);
mPauseControlsContainer.graphics.drawRect(0, 0, _local7.x, _local7.y);
mPauseControlsContainer.graphics.endFill();
mPauseControlsContainer.alpha = 0.9;
mPauseControlsContainer.x = ((Game.ScreenWidth - mPauseControlsContainer.width) * 0.5);
mPauseControlsContainer.y = ((Game.ScreenHeight - mPauseControlsContainer.height) * 0.5);
_local4 = new TextField();
_local4.type = TextFieldType.DYNAMIC;
_local4.border = false;
_local4.x = 10;
_local4.y = 10;
_local4.width = 500;
_local4.multiline = false;
_local4.wordWrap = false;
_local4.selectable = false;
_local4.embedFonts = true;
_local4.text = "Paused";
_local4.setTextFormat(_local6);
mPauseControlsContainer.addChild(_local4);
_local1 = new RestartImg();
_local2 = new SimpleButton(_local1, _local1, _local1, _local1);
_local2.width = 120;
_local2.height = 30;
_local2.x = 15;
_local2.y = ((_local7.y - _local2.height) - 10);
_local2.useHandCursor = true;
_local2.addEventListener(MouseEvent.CLICK, mGame.restart);
mPauseControlsContainer.addChild(_local2);
_local1 = new BackImg();
_local2 = new SimpleButton(_local1, _local1, _local1, _local1);
_local2.width = 120;
_local2.height = 30;
_local2.x = ((_local7.x - _local2.width) * 0.5);
_local2.y = ((_local7.y - _local2.height) - 10);
_local2.useHandCursor = true;
_local2.addEventListener(MouseEvent.CLICK, mGame.pause);
mPauseControlsContainer.addChild(_local2);
_local1 = new MainMenuImg();
_local2 = new SimpleButton(_local1, _local1, _local1, _local1);
_local2.width = 120;
_local2.height = 30;
_local2.x = ((_local7.x - _local2.width) - 10);
_local2.y = ((_local7.y - _local2.height) - 10);
_local2.useHandCursor = true;
_local2.addEventListener(MouseEvent.CLICK, mMain.startMenu);
mPauseControlsContainer.addChild(_local2);
mSummaryControlsContainer.graphics.beginFill(0xFFFFFF);
mSummaryControlsContainer.graphics.drawRect(0, 0, (Game.ScreenWidth * 0.8), (Game.ScreenHeight * 0.8));
mSummaryControlsContainer.graphics.endFill();
mSummaryControlsContainer.alpha = 0.9;
mSummaryControlsContainer.x = ((Game.ScreenWidth - mSummaryControlsContainer.width) * 0.5);
mSummaryControlsContainer.y = ((Game.ScreenHeight - mSummaryControlsContainer.height) * 0.5);
_local4 = new TextField();
_local4.type = TextFieldType.DYNAMIC;
_local4.border = false;
_local4.x = 10;
_local4.y = 10;
_local4.width = 500;
_local4.multiline = false;
_local4.wordWrap = false;
_local4.selectable = false;
_local4.embedFonts = true;
_local4.text = "Results";
_local4.setTextFormat(_local6);
mSummaryControlsContainer.addChild(_local4);
var _local8:Array = new Array(new Array("totalDistance", "Total Distance: "), new Array("maxHeight", "Maximum Height: "), new Array("numTricks", "Number of Tricks: "), new Array("longestCombo", "Longest Combo: "), new Array("numSkips", "Number of Skips: "), new Array("score", "Final Score: "));
_local3 = 0;
while (_local3 < _local8.length) {
_local4 = new TextField();
_local4.type = TextFieldType.DYNAMIC;
_local4.border = false;
_local4.x = 50;
_local4.y = (70 + (_local3 * 40));
_local4.width = 500;
_local4.multiline = false;
_local4.wordWrap = false;
_local4.selectable = false;
_local4.embedFonts = true;
_local4.text = _local8[_local3][1];
_local4.setTextFormat(_local5);
mSummaryControlsContainer.addChild(_local4);
_local4 = new TextField();
_local4.type = TextFieldType.DYNAMIC;
_local4.border = false;
_local4.x = 250;
_local4.y = (70 + (_local3 * 40));
_local4.width = 500;
_local4.multiline = false;
_local4.wordWrap = false;
_local4.selectable = false;
_local4.embedFonts = true;
_local4.name = _local8[_local3][0];
mSummaryControlsContainer.addChild(_local4);
_local3++;
};
_local1 = new PlayAgainImg();
_local2 = new SimpleButton(_local1, _local1, _local1, _local1);
_local2.x = 15;
_local2.y = (mSummaryControlsContainer.height - 40);
_local2.width = 120;
_local2.height = 30;
_local2.useHandCursor = true;
_local2.addEventListener(MouseEvent.CLICK, mGame.restart);
mSummaryControlsContainer.addChild(_local2);
_local1 = new SubmitScoreImg();
_local2 = new SimpleButton(_local1, _local1, _local1, _local1);
_local2.x = 200;
_local2.y = (mSummaryControlsContainer.height - 40);
_local2.width = 120;
_local2.height = 30;
_local2.useHandCursor = true;
_local2.addEventListener(MouseEvent.CLICK, doScore);
mSummaryControlsContainer.addChild(_local2);
_local1 = new MainMenuImg();
_local2 = new SimpleButton(_local1, _local1, _local1, _local1);
_local2.width = 120;
_local2.height = 30;
_local2.x = 380;
_local2.y = (mSummaryControlsContainer.height - 40);
_local2.useHandCursor = true;
_local2.addEventListener(MouseEvent.CLICK, mMain.startMenu);
mSummaryControlsContainer.addChild(_local2);
}
}
}//package
Section 40
//HUD_BackImg (HUD_BackImg)
package {
import mx.core.*;
public class HUD_BackImg extends BitmapAsset {
}
}//package
Section 41
//HUD_DavidSans (HUD_DavidSans)
package {
import mx.core.*;
public class HUD_DavidSans extends FontAsset {
}
}//package
Section 42
//HUD_MainMenuImg (HUD_MainMenuImg)
package {
import mx.core.*;
public class HUD_MainMenuImg extends BitmapAsset {
}
}//package
Section 43
//HUD_MenuImg (HUD_MenuImg)
package {
import mx.core.*;
public class HUD_MenuImg extends BitmapAsset {
}
}//package
Section 44
//HUD_MoreGamesImg (HUD_MoreGamesImg)
package {
import mx.core.*;
public class HUD_MoreGamesImg extends BitmapAsset {
}
}//package
Section 45
//HUD_PlayAgainImg (HUD_PlayAgainImg)
package {
import mx.core.*;
public class HUD_PlayAgainImg extends BitmapAsset {
}
}//package
Section 46
//HUD_RestartImg (HUD_RestartImg)
package {
import mx.core.*;
public class HUD_RestartImg extends BitmapAsset {
}
}//package
Section 47
//HUD_StoneSmallImg (HUD_StoneSmallImg)
package {
import mx.core.*;
public class HUD_StoneSmallImg extends BitmapAsset {
}
}//package
Section 48
//HUD_SubmitScoreImg (HUD_SubmitScoreImg)
package {
import mx.core.*;
public class HUD_SubmitScoreImg extends BitmapAsset {
}
}//package
Section 49
//Main (Main)
package {
import flash.events.*;
import mx.core.*;
import flash.utils.*;
import flash.display.*;
import flash.media.*;
import CPMStar.*;
public dynamic class Main extends Sprite {
private var MiniLoad:Class;
private var mTimerSWF:Timer;
private var SoundImg:Class;
private var mSoundOn:Boolean;// = true
private var mMenu:MainMenu;
private var mBackgroundMusic:SoundChannel;// = null
private var NoSoundImg:Class;
private var mMuteButton:SimpleButton;
private var mMiniLoad:MovieClip;
private var mGame:Game;
private static var AmbienceSound:Class = Main_AmbienceSound;
public static var _mochiads_game_id:String = "bde6d65af9ebf2b7";
private static var mAmbience:SoundAsset = (new AmbienceSound() as SoundAsset);
public function Main():void{
NoSoundImg = Main_NoSoundImg;
SoundImg = Main_SoundImg;
MiniLoad = Main_MiniLoad;
super();
init();
}
public function startMenu(_arg1:Event=null):void{
if (mGame){
mGame.stop();
removeChild(mGame);
};
mMenu = new MainMenu();
addChildAt(mMenu, 0);
mMenu.init(this);
}
public function soundOn():Boolean{
return (mSoundOn);
}
public function init():void{
if (stage){
showMinijuegosSWF();
} else {
addEventListener(Event.ADDED_TO_STAGE, showMinijuegosSWF);
};
}
private function siteLock(_arg1:Array):Boolean{
var _local2:String = stage.loaderInfo.url;
var _local3:Number = (_local2.indexOf("://") + 3);
var _local4:Number = _local2.indexOf("/", _local3);
var _local5:String = _local2.substring(_local3, _local4);
var _local6:Number = 0;
var _local7:Number = 0;
while (_local7 < _arg1.length) {
_local6 = _local5.indexOf(_arg1[_local7]);
if (((!((_local6 == -1))) && ((_local6 == (_local5.length - _arg1[_local7].length))))){
return (true);
};
_local7++;
};
return (false);
}
public function mute(_arg1:Event=null):void{
mSoundOn = !(mSoundOn);
if (mSoundOn){
SoundMixer.soundTransform = new SoundTransform(1);
mMuteButton.upState = (mMuteButton.downState = (mMuteButton.overState = new SoundImg()));
} else {
SoundMixer.soundTransform = new SoundTransform(0);
mMuteButton.upState = (mMuteButton.downState = (mMuteButton.overState = new NoSoundImg()));
};
}
private function start(_arg1:Event=null):void{
removeEventListener(Event.ADDED_TO_STAGE, start);
mBackgroundMusic = mAmbience.play(0, int.MAX_VALUE);
stage.stageFocusRect = false;
startMenu();
var _local2:Bitmap = new SoundImg();
mMuteButton = new SimpleButton(_local2, _local2, _local2, _local2);
mMuteButton.x = 10;
mMuteButton.y = ((Game.ScreenHeight - mMuteButton.height) - 10);
mMuteButton.useHandCursor = true;
mMuteButton.addEventListener(MouseEvent.CLICK, mute);
addChild(mMuteButton);
}
public function startGame(_arg1:Event=null):void{
if (mMenu){
mMenu.stop();
removeChild(mMenu);
};
mGame = new Game();
addChildAt(mGame, 0);
mGame.init(this);
}
private function showMinijuegosSWF(_arg1:Event=null):void{
var e = _arg1;
mMiniLoad = new MiniLoad();
addChild(mMiniLoad);
mMiniLoad.play();
mTimerSWF = new Timer(3300, 1);
mTimerSWF.addEventListener(TimerEvent.TIMER_COMPLETE, function (_arg1:Event):void{
removeChild(mMiniLoad);
start();
});
mTimerSWF.start();
}
}
}//package
Section 50
//Main_AmbienceSound (Main_AmbienceSound)
package {
import mx.core.*;
public class Main_AmbienceSound extends SoundAsset {
}
}//package
Section 51
//Main_MiniLoad (Main_MiniLoad)
package {
import mx.core.*;
import flash.utils.*;
public class Main_MiniLoad extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Main_MiniLoad(){
dataClass = Main_MiniLoad_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package
Section 52
//Main_MiniLoad_dataClass (Main_MiniLoad_dataClass)
package {
import mx.core.*;
public class Main_MiniLoad_dataClass extends ByteArrayAsset {
}
}//package
Section 53
//Main_NoSoundImg (Main_NoSoundImg)
package {
import mx.core.*;
public class Main_NoSoundImg extends BitmapAsset {
}
}//package
Section 54
//Main_SoundImg (Main_SoundImg)
package {
import mx.core.*;
public class Main_SoundImg extends BitmapAsset {
}
}//package
Section 55
//MainMenu (MainMenu)
package {
import flash.events.*;
import flash.geom.*;
import flash.display.*;
import mochi.as3.*;
import com.zorked.*;
import flash.net.*;
import flash.ui.*;
public class MainMenu extends Sprite {
private var mMain:Main;
private var DecoLogoImg:Class;
private var StartGameImg:Class;
private var MoreGamesImg:Class;
private var mMainContainer:Sprite;
private var ViewScoresImg:Class;
private var MiniLogoImg:Class;
private var mInstructionsContainer:Sprite;
private var InstructionsBackgroundImg:Class;
private var MenuBackgroundImg:Class;
private var mHighScores:Sprite;
private var BackImg:Class;
private var InstructionsImg:Class;
public function MainMenu(){
BackImg = MainMenu_BackImg;
DecoLogoImg = MainMenu_DecoLogoImg;
InstructionsBackgroundImg = MainMenu_InstructionsBackgroundImg;
InstructionsImg = MainMenu_InstructionsImg;
MenuBackgroundImg = MainMenu_MenuBackgroundImg;
MiniLogoImg = MainMenu_MiniLogoImg;
MoreGamesImg = MainMenu_MoreGamesImg;
StartGameImg = MainMenu_StartGameImg;
ViewScoresImg = MainMenu_ViewScoresImg;
super();
}
private function onHideScores():void{
removeChild(mHighScores);
}
public function doInstructions(_arg1:Event=null):void{
if (contains(mMainContainer)){
removeChild(mMainContainer);
};
addChild(mInstructionsContainer);
}
public function doViewScores(_arg1:Event=null):void{
var pEvent = _arg1;
mHighScores = new Sprite();
var matrix:Matrix = new Matrix();
matrix.createGradientBox(Game.ScreenWidth, Game.ScreenHeight, (Math.PI / 2), 0, 0);
mHighScores.graphics.beginGradientFill(GradientType.LINEAR, [16700269, 16637918], [1, 1], [0, 0xFF], matrix, SpreadMethod.PAD);
mHighScores.graphics.drawRect(0, 0, Game.ScreenWidth, Game.ScreenHeight);
mHighScores.graphics.endFill();
var o:Object = {n:[15, 14, 12, 8, 8, 11, 0, 2, 11, 6, 9, 4, 3, 1, 0, 0], f:function (_arg1:Number, _arg2:String):String{
if (_arg2.length == 16){
return (_arg2);
};
return (this.f((_arg1 + 1), (_arg2 + this.n[_arg1].toString(16))));
}};
var boardID:String = o.f(0, "");
MochiScores.showLeaderboard({boardID:boardID, clip:mHighScores, onClose:onHideScores, onDisplay:onDisplayScores});
addChild(mHighScores);
}
private function gotoMiniJuegos(_arg1:Event):void{
var e = _arg1;
var url = "http://www.minijuegos.com/";
try {
URLNavigator.ChangePage(url, "_blank");
} catch(e:Error) {
};
}
public function update(_arg1:Event):void{
}
public function stop():void{
removeEventListener(Event.ENTER_FRAME, update);
stage.removeEventListener(KeyboardEvent.KEY_UP, onKeyUp);
}
public function init(_arg1:Main):void{
var _local2:Bitmap;
var _local3:SimpleButton;
var _local4:Matrix;
mMain = _arg1;
mInstructionsContainer = new Sprite();
mMainContainer = new Sprite();
_local4 = new Matrix();
_local4.createGradientBox(Game.ScreenWidth, Game.ScreenHeight, (Math.PI / 2), 0, 0);
mMainContainer.graphics.beginGradientFill(GradientType.LINEAR, [16700269, 16637918], [1, 1], [0, 0xFF], _local4, SpreadMethod.PAD);
mMainContainer.graphics.drawRect(0, 0, Game.ScreenWidth, 225);
mMainContainer.graphics.endFill();
_local2 = new MenuBackgroundImg();
mMainContainer.addChild(_local2);
_local2 = new StartGameImg();
_local3 = new SimpleButton(_local2, _local2, _local2, _local2);
_local3.x = 430;
_local3.y = 290;
_local3.useHandCursor = true;
_local3.addEventListener(MouseEvent.CLICK, mMain.startGame);
mMainContainer.addChild(_local3);
_local2 = new InstructionsImg();
_local3 = new SimpleButton(_local2, _local2, _local2, _local2);
_local3.x = 430;
_local3.y = 330;
_local3.useHandCursor = true;
_local3.addEventListener(MouseEvent.CLICK, doInstructions);
mMainContainer.addChild(_local3);
_local2 = new MoreGamesImg();
_local3 = new SimpleButton(_local2, _local2, _local2, _local2);
_local3.x = 430;
_local3.y = 370;
_local3.useHandCursor = true;
_local3.addEventListener(MouseEvent.CLICK, gotoMiniJuegos);
mMainContainer.addChild(_local3);
_local2 = new ViewScoresImg();
_local3 = new SimpleButton(_local2, _local2, _local2, _local2);
_local3.x = 430;
_local3.y = 410;
_local3.useHandCursor = true;
_local3.addEventListener(MouseEvent.CLICK, doViewScores);
mMainContainer.addChild(_local3);
_local2 = new MiniLogoImg();
_local3 = new SimpleButton(_local2, _local2, _local2, _local2);
_local3.x = 15;
_local3.y = 15;
_local3.useHandCursor = true;
_local3.addEventListener(MouseEvent.CLICK, gotoMiniJuegos);
mMainContainer.addChild(_local3);
_local2 = new DecoLogoImg();
_local3 = new SimpleButton(_local2, _local2, _local2, _local2);
_local3.x = 15;
_local3.y = 65;
_local3.useHandCursor = true;
_local3.addEventListener(MouseEvent.CLICK, gotoDecoGames);
mMainContainer.addChild(_local3);
_local4 = new Matrix();
_local4.createGradientBox(Game.ScreenWidth, Game.ScreenHeight, (Math.PI / 2), 0, 0);
mInstructionsContainer.graphics.beginGradientFill(GradientType.LINEAR, [8626168, 14336511], [1, 1], [0, 0xFF], _local4, SpreadMethod.PAD);
mInstructionsContainer.graphics.drawRect(0, 0, Game.ScreenWidth, Game.ScreenHeight);
mInstructionsContainer.graphics.endFill();
_local2 = new InstructionsBackgroundImg();
mInstructionsContainer.addChild(_local2);
_local2 = new BackImg();
_local3 = new SimpleButton(_local2, _local2, _local2, _local2);
_local3.width = 120;
_local3.height = 30;
_local3.x = ((Game.ScreenWidth - _local3.width) - 10);
_local3.y = ((Game.ScreenHeight - _local3.height) - 10);
_local3.useHandCursor = true;
_local3.addEventListener(MouseEvent.CLICK, doMain);
mInstructionsContainer.addChild(_local3);
addEventListener(Event.ENTER_FRAME, update);
stage.addEventListener(KeyboardEvent.KEY_UP, onKeyUp);
addChild(mMainContainer);
}
public function doMain(_arg1:Event=null):void{
if (contains(mInstructionsContainer)){
removeChild(mInstructionsContainer);
};
addChild(mMainContainer);
}
private function onDisplayScores():void{
var _local1:Bitmap = new MoreGamesImg();
var _local2:SimpleButton = new SimpleButton(_local1, _local1, _local1, _local1);
_local2.x = ((Game.ScreenWidth - _local1.width) * 0.5);
_local2.y = ((Game.ScreenHeight - _local1.height) - 15);
_local2.useHandCursor = true;
_local2.addEventListener(MouseEvent.CLICK, gotoMiniJuegos);
mHighScores.addChild(_local2);
}
private function gotoDecoGames(_arg1:Event):void{
var e = _arg1;
var url = "http://www.decogames.com/";
try {
URLNavigator.ChangePage(url, "_blank");
} catch(e:Error) {
};
}
public function onKeyUp(_arg1:KeyboardEvent):void{
if ((((_arg1.keyCode == Keyboard.ENTER)) || ((_arg1.keyCode == Keyboard.SPACE)))){
mMain.startGame();
};
}
}
}//package
Section 56
//MainMenu_BackImg (MainMenu_BackImg)
package {
import mx.core.*;
public class MainMenu_BackImg extends BitmapAsset {
}
}//package
Section 57
//MainMenu_DecoLogoImg (MainMenu_DecoLogoImg)
package {
import mx.core.*;
public class MainMenu_DecoLogoImg extends BitmapAsset {
}
}//package
Section 58
//MainMenu_InstructionsBackgroundImg (MainMenu_InstructionsBackgroundImg)
package {
import mx.core.*;
public class MainMenu_InstructionsBackgroundImg extends BitmapAsset {
}
}//package
Section 59
//MainMenu_InstructionsImg (MainMenu_InstructionsImg)
package {
import mx.core.*;
public class MainMenu_InstructionsImg extends BitmapAsset {
}
}//package
Section 60
//MainMenu_MenuBackgroundImg (MainMenu_MenuBackgroundImg)
package {
import mx.core.*;
public class MainMenu_MenuBackgroundImg extends BitmapAsset {
}
}//package
Section 61
//MainMenu_MiniLogoImg (MainMenu_MiniLogoImg)
package {
import mx.core.*;
public class MainMenu_MiniLogoImg extends BitmapAsset {
}
}//package
Section 62
//MainMenu_MoreGamesImg (MainMenu_MoreGamesImg)
package {
import mx.core.*;
public class MainMenu_MoreGamesImg extends BitmapAsset {
}
}//package
Section 63
//MainMenu_StartGameImg (MainMenu_StartGameImg)
package {
import mx.core.*;
public class MainMenu_StartGameImg extends BitmapAsset {
}
}//package
Section 64
//MainMenu_ViewScoresImg (MainMenu_ViewScoresImg)
package {
import mx.core.*;
public class MainMenu_ViewScoresImg extends BitmapAsset {
}
}//package
Section 65
//Prop (Prop)
package {
import flash.geom.*;
import flash.display.*;
public class Prop extends Sprite {
private var mAbsolutePosition:Point;
private var mZ:Number;
public function init(_arg1:Point, _arg2:Number, _arg3:Number, _arg4:Number=0.2, _arg5:Number=1):void{
mAbsolutePosition = new Point(_arg2, _arg3);
update(_arg1);
mZ = _arg4;
scaleX = _arg5;
scaleY = _arg5;
}
public function takeNewPosition(_arg1:Point):void{
mAbsolutePosition.x = ((_arg1.x + ((Math.random() * (Game.ScreenWidth * 2)) * (1 - mZ))) + Game.ScreenWidth);
}
public function update(_arg1:Point):void{
x = (mAbsolutePosition.x - (_arg1.x * (1 - mZ)));
y = ((Game.ScreenHeight * 0.5) - (mAbsolutePosition.y - _arg1.y));
}
public function isGone():Boolean{
return ((x < -(width)));
}
public function reset():void{
mAbsolutePosition.x = ((Math.random() * (Game.ScreenWidth * 2)) * (1 - mZ));
}
public static function compare(_arg1:Prop, _arg2:Prop):Number{
if (_arg1.mZ > _arg2.mZ){
return (-1);
};
return (1);
}
}
}//package
Section 66
//Splash (Splash)
package {
import flash.geom.*;
import flash.display.*;
public class Splash extends Sprite {
private var mDroplets:Array;
private var mCreationTime:Number;
private var mAbsoluteX:Number;
private static const DropletDistance:Number = 120;
private static const Lifespan:Number = 600;
private static const DropletVelocity:Number = 10;
private static const MaxDroplets:Number = 10;
private static const PositionY:Number = 0;
private static const MinDroplets:Number = 5;
private static const DropletRotationSpeed:Number = 8;
private static const DropletScale:Number = 0.4;
private static var DropletImg:Class = Splash_DropletImg;
public function init(_arg1:Number):void{
var _local2:Bitmap;
var _local3:Sprite;
mAbsoluteX = _arg1;
mCreationTime = new Date().time;
mDroplets = new Array();
var _local4:Number = ((Math.random() * (MaxDroplets - MinDroplets)) + MinDroplets);
var _local5:Number = 0;
while (_local5 < _local4) {
_local2 = new DropletImg();
_local2.x = (-(_local2.width) * 0.5);
_local2.y = (-(_local2.height) * 0.5);
_local3 = new Sprite();
_local3.addChild(_local2);
_local3.rotation = (-(Math.random()) * 180);
_local3.x = 0;
_local3.y = 0;
_local3.scaleX = DropletScale;
_local3.scaleY = DropletScale;
mDroplets.push(_local3);
addChild(_local3);
_local5++;
};
}
public function isGone(_arg1:Point, _arg2:Number):Boolean{
return (((((_arg2 - mCreationTime) > Lifespan)) || ((mAbsoluteX < _arg1.x))));
}
public function update(_arg1:Point, _arg2:Number):void{
var _local4:Sprite;
var _local5:Number;
var _local3:Number = Math.min(1, Math.max((1 - ((_arg2 - mCreationTime) / Lifespan)), 0));
if (_arg2 != 0){
alpha = _local3;
};
x = (mAbsoluteX - _arg1.x);
y = ((Game.ScreenHeight * 0.5) - (PositionY - _arg1.y));
var _local6:Number = 0;
while (_local6 < mDroplets.length) {
_local4 = mDroplets[_local6];
_local5 = ((_local4.rotation * Math.PI) / 180);
_local4.x = (_local4.x + (Math.cos(_local5) * DropletVelocity));
_local4.y = (_local4.y + (Math.sin(_local5) * DropletVelocity));
if ((((_local4.rotation < -90)) || ((_local4.rotation > 90)))){
_local4.rotation = (_local4.rotation - DropletRotationSpeed);
} else {
_local4.rotation = (_local4.rotation + DropletRotationSpeed);
};
_local6++;
};
}
}
}//package
Section 67
//Splash_DropletImg (Splash_DropletImg)
package {
import mx.core.*;
public class Splash_DropletImg extends BitmapAsset {
}
}//package
Section 68
//SplashManager (SplashManager)
package {
import flash.geom.*;
import flash.display.*;
public class SplashManager extends Sprite {
private var mSplashes:Array;
private var mSplashBitmap:Bitmap;
private static var SplashImg:Class = SplashManager_SplashImg;
public function init():void{
mSplashBitmap = new SplashImg();
mSplashBitmap.x = (-(mSplashBitmap.width) * 0.5);
mSplashBitmap.y = (-(mSplashBitmap.height) * 0.5);
mSplashes = new Array();
}
public function addSplash(_arg1:Number, _arg2:Point):void{
var _local3:Splash = new Splash();
_local3.addChild(mSplashBitmap);
_local3.init(_arg1);
_local3.update(_arg2, 0);
mSplashes.push(_local3);
addChild(_local3);
}
public function update(_arg1:Point):void{
var _local2:Number = new Date().time;
var _local3:Number = 0;
while (_local3 < mSplashes.length) {
mSplashes[_local3].update(_arg1, _local2);
if (mSplashes[_local3].isGone(_arg1, _local2)){
removeChild(mSplashes[_local3]);
mSplashes.splice(_local3, 1);
};
_local3++;
};
}
}
}//package
Section 69
//SplashManager_SplashImg (SplashManager_SplashImg)
package {
import mx.core.*;
public class SplashManager_SplashImg extends BitmapAsset {
}
}//package
Section 70
//Stone (Stone)
package {
import flash.geom.*;
import flash.display.*;
public class Stone extends Sprite {
private var mTurns:Number;
private var FlashImg:Class;
private var mPerfectSkipBitmap:Bitmap;
private var GlowImg:Class;
private var PerfectSkipImg:Class;
private var mFlashBitmap:Bitmap;
private var mStoneSprite:Sprite;
private var GoodSkipImg:Class;
private var mGlowBitmap:Bitmap;
private var ThrowLinesImg:Class;
private var mThrowLinesBitmap:Bitmap;
private var mSkipSprite:Sprite;
private var mAngularVelocity:Number;
private var mTrickManager:TrickManager;
private var mGoodSkipBitmap:Bitmap;
private var StoneImg:Class;
private static const AngularDampening:Number = 0.8;
private static const MaxGlowComboCount:Number = 8;
private static const FlashAlphaFadeRate:Number = 0.05;
public function Stone(){
StoneImg = Stone_StoneImg;
GlowImg = Stone_GlowImg;
FlashImg = Stone_FlashImg;
GoodSkipImg = Stone_GoodSkipImg;
PerfectSkipImg = Stone_PerfectSkipImg;
ThrowLinesImg = Stone_ThrowLinesImg;
super();
}
public function setRotation(_arg1:Number):void{
mStoneSprite.rotation = _arg1;
}
public function spin(_arg1:Number):void{
mAngularVelocity = (mAngularVelocity + _arg1);
}
public function onTrick():void{
mFlashBitmap.alpha = 1;
}
public function onSkip(_arg1:String):void{
if (_arg1 == "g"){
mGoodSkipBitmap.alpha = 1;
} else {
if (_arg1 == "p"){
mPerfectSkipBitmap.alpha = 1;
};
};
if (mThrowLinesBitmap.alpha > 0){
mThrowLinesBitmap.alpha = 0;
};
}
public function adjustTurns(_arg1:Number):void{
mTurns = (mTurns + _arg1);
}
public function update(_arg1:Point):void{
mGlowBitmap.alpha = Math.min(1, (mTrickManager.getCurrentComboCount() / MaxGlowComboCount));
if (mFlashBitmap.alpha > 0){
mFlashBitmap.alpha = (mFlashBitmap.alpha - FlashAlphaFadeRate);
};
if (mGoodSkipBitmap.alpha > 0){
mGoodSkipBitmap.alpha = (mGoodSkipBitmap.alpha - FlashAlphaFadeRate);
};
if (mPerfectSkipBitmap.alpha > 0){
mPerfectSkipBitmap.alpha = (mPerfectSkipBitmap.alpha - FlashAlphaFadeRate);
};
if (mThrowLinesBitmap.alpha > 0){
mThrowLinesBitmap.alpha = (mThrowLinesBitmap.alpha - FlashAlphaFadeRate);
};
mStoneSprite.rotation = (mStoneSprite.rotation + mAngularVelocity);
mTurns = (mTurns + mAngularVelocity);
mAngularVelocity = (mAngularVelocity * AngularDampening);
mSkipSprite.rotation = ((-(Math.atan((_arg1.y / _arg1.x))) * 180) / Math.PI);
}
public function reset():void{
mTurns = 0;
mAngularVelocity = 0;
mFlashBitmap.alpha = 0;
mGoodSkipBitmap.alpha = 0;
mPerfectSkipBitmap.alpha = 0;
mThrowLinesBitmap.alpha = 0;
}
public function init(_arg1:TrickManager):void{
var _local2:Bitmap;
mTrickManager = _arg1;
mSkipSprite = new Sprite();
mStoneSprite = new Sprite();
_local2 = new StoneImg();
_local2.smoothing = true;
_local2.x = (-(_local2.width) / 2);
_local2.y = (-(_local2.height) / 2);
mGoodSkipBitmap = new GoodSkipImg();
mGoodSkipBitmap.smoothing = true;
mSkipSprite.addChild(mGoodSkipBitmap);
mGoodSkipBitmap.x = ((-(_local2.width) / 2) - mGoodSkipBitmap.width);
mGoodSkipBitmap.y = (-(mGoodSkipBitmap.height) / 2);
mGoodSkipBitmap.alpha = 0;
mPerfectSkipBitmap = new PerfectSkipImg();
mPerfectSkipBitmap.smoothing = true;
mSkipSprite.addChild(mPerfectSkipBitmap);
mPerfectSkipBitmap.x = ((-(_local2.width) / 2) - mPerfectSkipBitmap.width);
mPerfectSkipBitmap.y = (-(mPerfectSkipBitmap.height) / 2);
mPerfectSkipBitmap.alpha = 0;
mThrowLinesBitmap = new ThrowLinesImg();
mThrowLinesBitmap.smoothing = true;
mSkipSprite.addChild(mThrowLinesBitmap);
mThrowLinesBitmap.x = ((-(_local2.width) / 2) - mThrowLinesBitmap.width);
mThrowLinesBitmap.y = (-(mThrowLinesBitmap.height) / 2);
mThrowLinesBitmap.alpha = 0;
mFlashBitmap = new FlashImg();
mFlashBitmap.smoothing = true;
mStoneSprite.addChild(mFlashBitmap);
mFlashBitmap.x = (-(mFlashBitmap.width) / 2);
mFlashBitmap.y = (-(mFlashBitmap.height) / 2);
mFlashBitmap.alpha = 0;
mGlowBitmap = new GlowImg();
mGlowBitmap.smoothing = true;
mStoneSprite.addChild(mGlowBitmap);
mGlowBitmap.x = (-(mGlowBitmap.width) / 2);
mGlowBitmap.y = (-(mGlowBitmap.height) / 2);
mGlowBitmap.alpha = 0;
mStoneSprite.addChild(_local2);
addChild(mSkipSprite);
addChild(mStoneSprite);
mTurns = 0;
mAngularVelocity = 0;
}
public function rotate(_arg1:Number):void{
mStoneSprite.rotation = (mStoneSprite.rotation + _arg1);
}
public function onThrow():void{
mThrowLinesBitmap.alpha = 1;
}
public function getTurns():Number{
return (mTurns);
}
public function setTurns(_arg1:Number):void{
mTurns = _arg1;
}
public function getRotation():Number{
return (mStoneSprite.rotation);
}
public function onSink():void{
}
}
}//package
Section 71
//Stone_FlashImg (Stone_FlashImg)
package {
import mx.core.*;
public class Stone_FlashImg extends BitmapAsset {
}
}//package
Section 72
//Stone_GlowImg (Stone_GlowImg)
package {
import mx.core.*;
public class Stone_GlowImg extends BitmapAsset {
}
}//package
Section 73
//Stone_GoodSkipImg (Stone_GoodSkipImg)
package {
import mx.core.*;
public class Stone_GoodSkipImg extends BitmapAsset {
}
}//package
Section 74
//Stone_PerfectSkipImg (Stone_PerfectSkipImg)
package {
import mx.core.*;
public class Stone_PerfectSkipImg extends BitmapAsset {
}
}//package
Section 75
//Stone_StoneImg (Stone_StoneImg)
package {
import mx.core.*;
public class Stone_StoneImg extends BitmapAsset {
}
}//package
Section 76
//Stone_ThrowLinesImg (Stone_ThrowLinesImg)
package {
import mx.core.*;
public class Stone_ThrowLinesImg extends BitmapAsset {
}
}//package
Section 77
//Trick (Trick)
package {
public class Trick {
private var mPoints:Number;
private var mName:String;
private var mMultiplier:Number;
public function Trick(_arg1:String, _arg2:Number, _arg3:Number=1){
mName = _arg1;
mPoints = _arg2;
mMultiplier = _arg3;
}
public function getName():String{
return (mName);
}
public function getMultiplier():Number{
return (mMultiplier);
}
public function getPoints():Number{
return (mPoints);
}
}
}//package
Section 78
//TrickManager (TrickManager)
package {
public class TrickManager {
private var mTrickList:Object;
private var mTrickCount:Number;
private var mCurrentComboCount:Number;
private var mTricks:Array;
private var mHighestCombo:Number;
public function getHighestCombo():Number{
return (mHighestCombo);
}
public function getLastTrick():String{
if (mTricks.length < 1){
return (null);
};
return (mTricks[(mTricks.length - 1)][0]);
}
public function getCurrentComboCount():Number{
return (mCurrentComboCount);
}
public function reset():void{
mTricks = new Array();
mCurrentComboCount = 0;
mHighestCombo = 0;
mTrickCount = 0;
}
public function init():void{
mTrickList = new Object();
mTrickList["switch"] = new Trick("Switch", 100);
mTrickList["fflip"] = new Trick("Flip", 500);
mTrickList["bflip"] = new Trick("Backflip", 500);
mTrickList["skip"] = new Trick("Skip", 500);
mTrickList["gskip"] = new Trick("Good Skip", 700);
mTrickList["pskip"] = new Trick("Perfect Skip", 1000);
mTricks = new Array();
mTrickCount = 0;
mCurrentComboCount = 0;
mHighestCombo = 0;
}
public function getPoints():Number{
var _local1:Number = 0;
var _local2:Number = 0;
while (_local2 < mTricks.length) {
_local1 = (_local1 + (mTrickList[mTricks[_local2][0]].getPoints() * mTricks[_local2][1]));
_local2++;
};
return (_local1);
}
public function getTotalTricks():Number{
return (mTrickCount);
}
public function getTotalPoints():Number{
return ((getPoints() * getMultiplier()));
}
public function addTrick(_arg1:String):void{
if ((_arg1 in mTrickList)){
if ((((mTricks.length > 0)) && ((mTricks[(mTricks.length - 1)][0] == _arg1)))){
mTricks[(mTricks.length - 1)][1] = (mTricks[(mTricks.length - 1)][1] + 1);
} else {
mTricks.push(new Array(_arg1, 1));
};
mTrickCount++;
mCurrentComboCount++;
if (mCurrentComboCount > mHighestCombo){
mHighestCombo = mCurrentComboCount;
};
} else {
throw ("Invalid trick");
};
}
public function clear():void{
mTricks = new Array();
mCurrentComboCount = 0;
}
public function getTrickString():String{
var _local1 = "";
var _local2:Number = 0;
while (_local2 < mTricks.length) {
_local1 = (_local1 + ((mTrickList[mTricks[_local2][0]].getName() + " x") + mTricks[_local2][1].toString()));
if (_local2 < (mTricks.length - 1)){
_local1 = (_local1 + " + ");
};
_local2++;
};
return (_local1);
}
public function getMultiplier():Number{
var _local1:Number = 0;
var _local2:Number = 0;
while (_local2 < mTricks.length) {
_local1 = (_local1 + mTricks[_local2][1]);
_local2++;
};
var _local3:Number = 0;
_local2 = 0;
while (_local2 < _local1) {
_local3 = (_local3 + (1 / (_local2 + 1)));
_local2++;
};
return (_local3);
}
}
}//package
Section 79
//Water (Water)
package {
import flash.geom.*;
import flash.display.*;
public class Water extends Sprite {
private var WaterlineImg:Class;
public static const WaveHeight:Number = 5;
private static const WaterDepth:Number = (((Game.ScreenHeight * 0.5) - Game.FloorHeight) + (Game.StoneSize * 2));
public function Water(){
WaterlineImg = Water_WaterlineImg;
super();
}
public function update(_arg1:Point):void{
x = (-(_arg1.x) % Game.ScreenWidth);
y = ((Game.ScreenHeight * 0.5) + _arg1.y);
}
public function init(_arg1:Point):void{
var _local2:Matrix = new Matrix();
_local2.createGradientBox((Game.ScreenWidth * 2), WaterDepth, (Math.PI / 2), 0, 0);
graphics.beginGradientFill(GradientType.LINEAR, [4351968, 3097479], [1, 1], [0, 0xFF], _local2);
graphics.drawRect(0, (WaveHeight * 2), (Game.ScreenWidth * 2), WaterDepth);
graphics.endFill();
var _local3:Bitmap = new WaterlineImg();
graphics.beginBitmapFill(_local3.bitmapData, new Matrix(1, 0, 0, 1, 0, -1));
graphics.drawRect(0, 0, (Game.ScreenWidth * 2), 20);
graphics.endFill();
y = (240 + _arg1.y);
}
}
}//package
Section 80
//Water_WaterlineImg (Water_WaterlineImg)
package {
import mx.core.*;
public class Water_WaterlineImg extends BitmapAsset {
}
}//package