Section 1
//KongregateEvent (com.kongregate.as3.client.events.KongregateEvent)
package com.kongregate.as3.client.events {
import flash.events.*;
public class KongregateEvent extends Event {
public static const COMPLETE:String = "component_api_available";
public function KongregateEvent(_arg1:String){
super(_arg1);
}
}
}//package com.kongregate.as3.client.events
Section 2
//AbstractShadowService (com.kongregate.as3.client.services.AbstractShadowService)
package com.kongregate.as3.client.services {
import flash.events.*;
public class AbstractShadowService extends EventDispatcher {
protected function alert(_arg1:String, _arg2:String, _arg3="", _arg4:String=""):void{
trace(((((((("Kongregate API: " + _arg1) + ".") + _arg2) + "(") + _arg3) + ") ") + _arg4));
}
}
}//package com.kongregate.as3.client.services
Section 3
//HighScoreServiceShadow (com.kongregate.as3.client.services.HighScoreServiceShadow)
package com.kongregate.as3.client.services {
public class HighScoreServiceShadow extends AbstractShadowService implements IHighScoreServices {
private var mode:String;
public function HighScoreServiceShadow(){
mode = "";
}
public function submit(_arg1:Number, _arg2:String=null):void{
alert("IHighScoreServices", "submit", arguments);
}
public function connect():Boolean{
alert("IKongregateServices", "connect");
return (true);
}
public function requestList(_arg1:Function):void{
alert("IHighScoreServices", "requestList", "", (("[Mode: " + mode) + "]"));
_arg1({success:false});
}
public function setMode(_arg1:String):void{
alert("IHighScoreServices", "setMode", arguments);
this.mode = _arg1;
}
}
}//package com.kongregate.as3.client.services
Section 4
//IHighScoreServices (com.kongregate.as3.client.services.IHighScoreServices)
package com.kongregate.as3.client.services {
public interface IHighScoreServices {
function setMode(_arg1:String):void;
function submit(_arg1:Number, _arg2:String=null):void;
function requestList(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 5
//IKongregateServices (com.kongregate.as3.client.services.IKongregateServices)
package com.kongregate.as3.client.services {
import flash.events.*;
public interface IKongregateServices extends IEventDispatcher {
function getPlayerInfo(_arg1:Function):void;
function connect(_arg1:Number=-1):Boolean;
}
}//package com.kongregate.as3.client.services
Section 6
//IStatServices (com.kongregate.as3.client.services.IStatServices)
package com.kongregate.as3.client.services {
public interface IStatServices {
function submitArray(_arg1:Array):void;
function submit(_arg1:String, _arg2:Number):void;
}
}//package com.kongregate.as3.client.services
Section 7
//IUserServices (com.kongregate.as3.client.services.IUserServices)
package com.kongregate.as3.client.services {
public interface IUserServices {
function getName():String;
function getPlayerInfo(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 8
//KongregateServiceShadow (com.kongregate.as3.client.services.KongregateServiceShadow)
package com.kongregate.as3.client.services {
public class KongregateServiceShadow extends AbstractShadowService implements IKongregateServices {
public function getName():String{
alert("IKongregateServices", "getName");
return ("Guest");
}
public function connect(_arg1:Number=-1):Boolean{
alert("IKongregateServices", "connect", arguments);
return (true);
}
public function getPlayerInfo(_arg1:Function):void{
alert("IKongregateServices", "getPlayerInfo");
_arg1(new Object());
}
}
}//package com.kongregate.as3.client.services
Section 9
//StatServiceShadow (com.kongregate.as3.client.services.StatServiceShadow)
package com.kongregate.as3.client.services {
public class StatServiceShadow extends AbstractShadowService implements IStatServices {
public function submitArray(_arg1:Array):void{
alert("IStatServices", "submitArray", arguments);
}
public function submit(_arg1:String, _arg2:Number):void{
alert("IStatServices", "submitStat", arguments);
}
}
}//package com.kongregate.as3.client.services
Section 10
//UserServiceShadow (com.kongregate.as3.client.services.UserServiceShadow)
package com.kongregate.as3.client.services {
public class UserServiceShadow extends AbstractShadowService implements IUserServices {
public function getName():String{
alert("UserService", "getName");
return ("Guest");
}
public function getPlayerInfo(_arg1:Function):void{
alert("UserService", "getPlayerInfo");
_arg1({isGuest:true, name:"Guest", points:0, level:0, isMode:false, isAdmin:false, isDeveloper:false, avatarPath:"", chatAvatarPath:""});
}
}
}//package com.kongregate.as3.client.services
Section 11
//IAPIBootstrap (com.kongregate.as3.client.IAPIBootstrap)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
public interface IAPIBootstrap {
function init(_arg1:Event=null, _arg2:Stage=null):void;
function hideLog():void;
function showLog(_arg1:int=0):void;
}
}//package com.kongregate.as3.client
Section 12
//KongregateAPI (com.kongregate.as3.client.KongregateAPI)
package com.kongregate.as3.client {
import flash.events.*;
import com.kongregate.as3.client.services.*;
import flash.display.*;
import flash.system.*;
import flash.errors.*;
import flash.net.*;
import flash.utils.*;
import com.kongregate.as3.client.events.*;
public class KongregateAPI extends Sprite {
private const VERSION:Number = 1;
private var loader:Loader;
private var loadedDomain:ApplicationDomain;
private static const CLASS_USER:String = "com.kongregate.as3.client.services.UserServices";
private static const CLASS_STATS:String = "com.kongregate.as3.client.services.StatServices";
private static const CLASS_SERVICES:String = "com.kongregate.as3.client.services.KongregateServices";
private static const CLASS_SCORES:String = "com.kongregate.as3.client.services.HighScoreServices";
private static const DEBUG_API_URL:String = "//Linuxpc/kongregate/public/flash/API_AS3.swf";
private static var _connected:Boolean;
private static var kUser:IUserServices;
private static var _loaded:Boolean;
private static var kServices:IKongregateServices;
private static var kScores:IHighScoreServices;
private static var mInstance:KongregateAPI;
private static var kStats:IStatServices;
private static var kAPI:IAPIBootstrap;
public function KongregateAPI(){
if (mInstance != null){
throw (new Error("Warning: KongregateAPI has been added to stage more than once or accessed improperly. Use getInstance() or a stage reference to access."));
};
mInstance = this;
this.addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
}
public function get loaded():Boolean{
return (_loaded);
}
public function get connected():Boolean{
return (_connected);
}
private function alertConnected(_arg1:TimerEvent=null):void{
var _local2:KongregateEvent;
var _local3:Boolean;
_local2 = new KongregateEvent(KongregateEvent.COMPLETE);
_local3 = this.dispatchEvent(_local2);
}
private function init(_arg1:Event):void{
var _local2:Object;
var _local3:String;
var _local4:URLRequest;
var _local5:LoaderContext;
this.removeEventListener(Event.ADDED_TO_STAGE, init);
_loaded = false;
_connected = false;
_local2 = LoaderInfo(root.loaderInfo).parameters;
_local3 = _local2.api_path;
if (_local3 == null){
trace("Alert: Kongregate API could not be loaded, due to local testing. API will load when the game is uploaded.");
createShadowServices();
return;
};
Security.allowDomain("*.kongregate.com");
Security.allowDomain("kongregatetrunk.com");
_local4 = new URLRequest(_local3);
_local5 = new LoaderContext(false);
_local5.applicationDomain = ApplicationDomain.currentDomain;
_local5.securityDomain = SecurityDomain.currentDomain;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.load(_local4, _local5);
}
public function get api():IAPIBootstrap{
return (kAPI);
}
private function loadComplete(_arg1:Event):void{
getServices();
}
public function get scores():IHighScoreServices{
return (kScores);
}
private function ioErrorHandler(_arg1:IOErrorEvent):void{
throw (new IOError(("API file not found. " + _arg1)));
}
public function get services():IKongregateServices{
return (kServices);
}
public function get stats():IStatServices{
return (kStats);
}
private function createShadowServices():void{
var _local1:Timer;
trace(">>> Kongregate Shadow Services instantiated for local development..");
kServices = new KongregateServiceShadow();
kScores = new HighScoreServiceShadow();
kStats = new StatServiceShadow();
kUser = new UserServiceShadow();
_local1 = new Timer(200, 1);
_local1.addEventListener(TimerEvent.TIMER_COMPLETE, alertConnected);
_local1.start();
_connected = true;
}
public function get user():IUserServices{
return (kUser);
}
private function getServices():void{
var _local1:ApplicationDomain;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local1 = ApplicationDomain.currentDomain;
kAPI = IAPIBootstrap(loader.getChildAt(0));
this.addChild(loader);
_local2 = _local1.getDefinition(CLASS_SERVICES);
trace(_local2);
kServices = _local2.getInstance();
_local3 = _local1.getDefinition(CLASS_SCORES);
kScores = _local3.getInstance();
_local4 = _local1.getDefinition(CLASS_STATS);
kStats = _local4.getInstance();
_local5 = _local1.getDefinition(CLASS_USER);
kUser = _local5.getInstance();
kServices.connect(VERSION);
_loaded = true;
_connected = true;
alertConnected();
}
public static function getInstance():KongregateAPI{
if (!(mInstance)){
throw (new IllegalOperationError("You must add the Kongregate API component to the stage before attempting to access it."));
};
return (mInstance);
}
}
}//package com.kongregate.as3.client
Section 13
//MochiBot (com.mochibot.MochiBot)
package com.mochibot {
import flash.display.*;
import flash.system.*;
import flash.net.*;
public dynamic class MochiBot extends Sprite {
public function MochiBot(){
super();
}
public static function track(parent:Sprite, tag:String):MochiBot{
if (Security.sandboxType == "localWithFile"){
return (null);
};
var self:MochiBot = new (MochiBot);
parent.addChild(self);
Security.allowDomain("core.mochibot.com");
Security.allowInsecureDomain("core.mochibot.com");
var server:String = "http://core.mochibot.com/my/core.swf";
var lv:URLVariables = new URLVariables();
lv["sb"] = Security.sandboxType;
lv["v"] = Capabilities.version;
lv["swfid"] = tag;
lv["mv"] = "8";
lv["fv"] = "9";
var url:String = self.root.loaderInfo.loaderURL;
if (url.indexOf("http") == 0){
lv["url"] = url;
} else {
lv["url"] = "local";
};
var req:URLRequest = new URLRequest(server);
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
var loader:Loader = new Loader();
self.addChild(loader);
loader.load(req);
return (self);
}
}
}//package com.mochibot
Section 14
//DeployConstants (com.zipzapplay.config.DeployConstants)
package com.zipzapplay.config {
public class DeployConstants {
public static const S3_GAMEASSETS_DIR:String = "gameAssets/";
public static const S3_GAMES_DIR:String = "games/";
public static const IMAGE_UPLOAD_URL:String = "http://%SERVER_ADDRESS%:88/upload/upload.php";
public static const S3_USER_DIR:String = "user/";
public static const WEBFRAMEWORK_PATH:String = "production/client/WebFrameWork.swf";
public static const IMAGE_DOWNLOAD_URL:String = "http://%SERVER_ADDRESS%:88/upload/images";
public static const MAIN_SITE_URL:String = "http://www.playcrafter.com/";
public static const GRANDFATHER_USER_ID:int = 12000;
public static const DEPLOY_DESTINATION:String = "production";
public static const STANDALONE_PLAYER_URL:String = "http://playcrafter.s3.amazonaws.com/production/standalone/EmbeddableLoader.swf";
public static const WEBFRAMEWORK_LOCK_URI:String = "http://playcrafter.s3.amazonaws.com/production/client/";
public static const LB_REQUEST_URI:String = "http://www.playcrafter.com/loadBalance/getAvailableServers.php";
public static const GA_TRACKER_ID:String = "UA-4983341-3";
public static const STANDALONE_GA_TRACKER_ID:String = "UA-4983341-6";
public static const S3_GAMESCREENSHOT_LARGE_DIR:String = "gameScreensLarge/";
public static const DEBUG:Boolean = false;
public static const S3_GAMEPIECES_DIR:String = "gamePieces/";
public static const SITE_TITLE:String = "PlayCrafter: Create flash games using a free online game maker";
public static const LOCAL:Boolean = false;
public static const S3_URL:String = "http://playcrafter.s3.amazonaws.com/production/V3/";
public static const REAL_STANDALONE_PLAYER_URL:String = "http://playcrafter.s3.amazonaws.com/production/standalone/StandAlonePlayer.swf";
public static const OLD_USER_ID:int = 9951;
public static const FEATURED_GAMES_URL:String = "http://playcrafter.s3.amazonaws.com/production/pub/welcomeGamesConfig.xml";
public static const SWEAR_URL:String = "http://playcrafter.s3.amazonaws.com/production/pub/badwords.txt";
public static const S3_GAMESCREENSHOT_DIR:String = "gameScreens/";
public static const RELEASE:Boolean = true;
public static const OLD_USER_METRICS_ID:int = 108000;
public static const LOAD_MODULE_URL:String = "http://playcrafter.s3.amazonaws.com/production/client/";
public function DeployConstants(){
super();
}
}
}//package com.zipzapplay.config
Section 15
//GameWonEvent (com.zipzapplay.events.GameWonEvent)
package com.zipzapplay.events {
import flash.events.*;
public class GameWonEvent extends Event {
public static const GAME_WON_EVENT:String = "zzpGameWon";
public function GameWonEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false){
super(type, bubbles, cancelable);
}
override public function toString():String{
return (formatToString("GameWonEvent", "type", "bubbles", "cancelable", "eventPhase"));
}
override public function clone():Event{
trace("GameWonEvent inside clone.");
return (new GameWonEvent(type, bubbles, cancelable));
}
}
}//package com.zipzapplay.events
Section 16
//LevelCompletedEvent (com.zipzapplay.events.LevelCompletedEvent)
package com.zipzapplay.events {
import flash.events.*;
public class LevelCompletedEvent extends Event {
public var levelCompleted:int;
public static const LEVEL_COMPLETED_EVENT:String = "zzpLevelCompleted";
public function LevelCompletedEvent(type:String, bubbles:Boolean=false, cancelable:Boolean=false, level:int=0){
super(type, bubbles, cancelable);
levelCompleted = level;
}
override public function toString():String{
return (formatToString("LevelCompletedEvent", "type", "bubbles", "cancelable", "eventPhase", "levelCompleted"));
}
override public function clone():Event{
trace("LevelCompletedEvent inside clone.");
return (new LevelCompletedEvent(type, bubbles, cancelable, levelCompleted));
}
}
}//package com.zipzapplay.events
Section 17
//StandAloneEvent (com.zipzapplay.events.StandAloneEvent)
package com.zipzapplay.events {
import flash.events.*;
public class StandAloneEvent extends Event {
public static const AD_SHOWN:String = "zzpAdShown";
public static const HIDE_SHARE_BUTTON:String = "zzpHideShareButton";
public function StandAloneEvent(type:String){
super(type);
}
}
}//package com.zipzapplay.events
Section 18
//TopScoreEvent (com.zipzapplay.events.TopScoreEvent)
package com.zipzapplay.events {
import flash.events.*;
public class TopScoreEvent extends Event {
public var points:int;
public var strokes:int;
public var sortBy:int;
public var time:int;
public static const REPORT_SCORE:String = "zzpReportTopScore";
public function TopScoreEvent(points:int, time:int, strokes:int, sortBy:int){
super(REPORT_SCORE, false, false);
this.points = points;
this.time = time;
this.strokes = strokes;
this.sortBy = sortBy;
}
override public function clone():Event{
trace("TopScoreEvent inside clone.");
return (new TopScoreEvent(points, time, strokes, sortBy));
}
override public function toString():String{
return (formatToString("TopScoreEvent", "type", "bubbles", "cancelable", "eventPhase", "points", "time", "strokes", "sortBy"));
}
}
}//package com.zipzapplay.events
Section 19
//AwardType (com.zipzapplay.network.AwardType)
package com.zipzapplay.network {
public class AwardType {
public static const POINTS:int = 1;
public static const STROKE:int = 0;
public static const TIME:int = 2;
public function AwardType(){
super();
}
}
}//package com.zipzapplay.network
Section 20
//ExportVars (generated.ExportVars)
package generated {
public class ExportVars {
public static const mochiBotID:String = "11254e29";
public static const authorID:String = "25485 ";
public static const mochiAdsID:String = "47b52b1922eaa28a";
public static const gameID:String = "91450 ";
public function ExportVars(){
super();
}
}
}//package generated
Section 21
//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.0.0.0";
public function BitmapAsset(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){
super(bitmapData, pixelSnapping, smoothing);
}
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(newWidth:Number, newHeight:Number):void{
width = newWidth;
height = newHeight;
}
public function move(x:Number, y:Number):void{
this.x = x;
this.y = y;
}
}
}//package mx.core
Section 22
//ByteArrayAsset (mx.core.ByteArrayAsset)
package mx.core {
import flash.utils.*;
public class ByteArrayAsset extends ByteArray implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
public function ByteArrayAsset(){
super();
}
}
}//package mx.core
Section 23
//EdgeMetrics (mx.core.EdgeMetrics)
package mx.core {
public class EdgeMetrics {
public var top:Number;
public var left:Number;
public var bottom:Number;
public var right:Number;
mx_internal static const VERSION:String = "3.0.0.0";
public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0);
;
public function EdgeMetrics(left:Number=0, top:Number=0, right:Number=0, bottom:Number=0){
super();
this.left = left;
this.top = top;
this.right = right;
this.bottom = bottom;
}
public function clone():EdgeMetrics{
return (new EdgeMetrics(left, top, right, bottom));
}
}
}//package mx.core
Section 24
//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.0.0.0";
public function FlexBitmap(bitmapData:BitmapData=null, pixelSnapping:String="auto", smoothing:Boolean=false){
var bitmapData = bitmapData;
var pixelSnapping = pixelSnapping;
var smoothing = smoothing;
super(bitmapData, pixelSnapping, smoothing);
name = NameUtil.createUniqueName(this);
//unresolved jump
var _slot1 = e;
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 25
//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.0.0.0";
public function FlexMovieClip(){
super();
name = NameUtil.createUniqueName(this);
//unresolved jump
var _slot1 = e;
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 26
//FontAsset (mx.core.FontAsset)
package mx.core {
import flash.text.*;
public class FontAsset extends Font implements IFlexAsset {
mx_internal static const VERSION:String = "3.0.0.0";
public function FontAsset(){
super();
}
}
}//package mx.core
Section 27
//IBorder (mx.core.IBorder)
package mx.core {
public interface IBorder {
function get borderMetrics():EdgeMetrics;
}
}//package mx.core
Section 28
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 29
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.display.*;
import flash.geom.*;
import flash.accessibility.*;
import flash.events.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get visible():Boolean;
function get rotation():Number;
function localToGlobal(void:Point):Point;
function get name():String;
function set width(flash.display:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(flash.display:String):void;
function set scaleX(flash.display:Number):void;
function set scaleY(flash.display:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(flash.display:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(void:Point):Point;
function get height():Number;
function set blendMode(flash.display:String):void;
function get parent():DisplayObjectContainer;
function getBounds(String:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(flash.display:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(flash.display:Number):void;
function set accessibilityProperties(flash.display:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(flash.display: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(flash.display:Number):void;
function set mask(flash.display:DisplayObject):void;
function getRect(String:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(flash.display:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(mx.core:IFlexDisplayObject/mx.core:IFlexDisplayObject:stage/get:DisplayObject):Boolean;
function set opaqueBackground(flash.display:Object):void;
function set visible(flash.display:Boolean):void;
function get mask():DisplayObject;
function set x(flash.display:Number):void;
function set y(flash.display:Number):void;
function get transform():Transform;
function set filters(flash.display:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(flash.display:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 30
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(E:\dev\3.0.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function get isDocument():Boolean;
function set repeaters(E:\dev\3.0.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function initializeRepeaterArrays(E:\dev\3.0.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(E:\dev\3.0.x\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 31
//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.0.0.0";
public function MovieClipAsset(){
super();
_measuredWidth = width;
_measuredHeight = height;
}
public function get measuredWidth():Number{
return (_measuredWidth);
}
public function get measuredHeight():Number{
return (_measuredHeight);
}
public function setActualSize(newWidth:Number, newHeight:Number):void{
width = newWidth;
height = newHeight;
}
public function move(x:Number, y:Number):void{
this.x = x;
this.y = y;
}
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 32
//MovieClipLoaderAsset (mx.core.MovieClipLoaderAsset)
package mx.core {
import flash.utils.*;
import flash.events.*;
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.0.0.0";
public function MovieClipLoaderAsset(){
super();
var loaderContext:LoaderContext = new LoaderContext();
loaderContext.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
if (("allowLoadBytesCodeExecution" in loaderContext)){
loaderContext["allowLoadBytesCodeExecution"] = true;
};
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader.loadBytes(movieClipData, loaderContext);
addChild(loader);
}
override public function get width():Number{
if (!(initialized)){
return (initialWidth);
};
return (super.width);
}
override public function set width(value:Number):void{
if (!(initialized)){
requestedWidth = value;
} else {
loader.width = value;
};
}
override public function get measuredHeight():Number{
return (initialHeight);
}
private function completeHandler(event:Event):void{
initialized = true;
initialWidth = loader.width;
initialHeight = loader.height;
if (!(isNaN(requestedWidth))){
loader.width = requestedWidth;
};
if (!(isNaN(requestedHeight))){
loader.height = requestedHeight;
};
dispatchEvent(event);
}
override public function set height(value:Number):void{
if (!(initialized)){
requestedHeight = value;
} else {
loader.height = value;
};
}
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 33
//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 34
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import flash.utils.*;
import mx.core.*;
public class NameUtil {
mx_internal static const VERSION:String = "3.0.0.0";
private static var counter:int = 0;
public function NameUtil(){
super();
}
public static function displayObjectToString(displayObject:DisplayObject):String{
var result:String;
var s:String;
var indices:Array;
var o:DisplayObject = 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;
};
return (result);
}
public static function createUniqueName(object:Object):String{
if (!(object)){
return (null);
};
var name:String = getQualifiedClassName(object);
var index:int = name.indexOf("::");
if (index != -1){
name = name.substr((index + 2));
};
var charCode:int = name.charCodeAt((name.length - 1));
if ((((charCode >= 48)) && ((charCode <= 57)))){
name = (name + "_");
};
return ((name + counter++));
}
}
}//package mx.utils
Section 35
//EasyText (EasyText)
package {
import flash.text.*;
public class EasyText extends TextField {
public function EasyText(text:String, size:Number, color:uint){
super();
var format:TextFormat = new TextFormat("CgWesterveldt Light Adj", size, color);
format.align = TextFormatAlign.CENTER;
this.embedFonts = true;
this.autoSize = TextFieldAutoSize.CENTER;
this.defaultTextFormat = format;
this.text = text;
}
}
}//package
Section 36
//EmbeddableLoader (EmbeddableLoader)
package {
import flash.display.*;
import flash.text.*;
import generated.*;
import com.zipzapplay.config.*;
import com.mochibot.*;
public class EmbeddableLoader extends Sprite {
private var _gameLoader:StandAloneLoader;
private var _loaderCover:LoaderCover;
private var _shareButtonFreeURIs:Array;
private var _playing:Boolean;// = false
private var topScoreForwarder:TopScoreForwarder;// = null
private var _lockToURIs:Array;
private var _adFreeURIs:Array;
private var _loaderURL:String;
private static const I_EXIST_ONLY_TO_EMBED_A_FONT:String = "EmbeddableLoader_I_EXIST_ONLY_TO_EMBED_A_FONT";
private static const WIDTH:Number = 558;
private static const HEIGHT:Number = 430;
private static var _debugText:String = "";
private static var _debugWindow:TextField;
public function EmbeddableLoader(){
var gameIDString:String;
var cover:LoaderWithAd;
_adFreeURIs = ["file:///home/hersh/code/embeddableLoader/bin/NoAd.swf", "http://playcrafter.s3.amazonaws.com/staging/standalone/NoAd.swf", "kongregate.com", "flashgamelicense.com"];
_shareButtonFreeURIs = ["kongregate.com", "playcrafter.s3.amazonaws.com/staging/", "flashgamelicense.com"];
_lockToURIs = [];
super();
_loaderURL = root.loaderInfo.url;
if (shouldLock()){
return;
};
_gameLoader = new StandAloneLoader();
_gameLoader.y = -10000;
addChild(_gameLoader);
topScoreForwarder = new TopScoreForwarder(this, _gameLoader, LoaderInfo(root.loaderInfo));
if (shouldShowAd()){
cover = new LoaderWithAd();
addChild(cover);
cover.showAd();
_loaderCover = cover;
_gameLoader.adShown = true;
} else {
_loaderCover = new LoaderWithoutAd();
addChild(_loaderCover);
};
_loaderCover.playGameCallback = playGame;
_gameLoader.progressFunction = _loaderCover.setProgress;
var parameters:Object = getURLParams();
if (int(ExportVars.gameID) == 0){
gameIDString = parameters["gameID"];
} else {
gameIDString = ExportVars.gameID;
};
if (((!((gameIDString == null))) && (!((gameIDString == ""))))){
_gameLoader.loadGame(int(gameIDString), shouldShowShare());
notifyMochiBot();
};
}
private function shouldShowAd():Boolean{
var uri:String;
if (ExportVars.mochiAdsID == ""){
return (false);
};
for each (uri in _adFreeURIs) {
if (((!((_loaderURL == null))) && (!((_loaderURL.indexOf(uri) == -1))))){
return (false);
};
};
return (true);
}
private function setupDebug():void{
_debugWindow = new TextField();
_debugWindow.width = 500;
_debugWindow.height = 400;
_debugWindow.text = _debugText;
_debugWindow.mouseEnabled = false;
addChild(_debugWindow);
}
private function playGame():void{
if (!(_playing)){
_playing = true;
_gameLoader.y = 0;
removeChild(_loaderCover);
stage.frameRate = 99;
};
}
private function stringToObject(str:String):Object{
var part:String;
var assignmentHalves:Array;
var result:Object = new Object();
var parts:Array = str.split("&");
for each (part in parts) {
assignmentHalves = part.split("=");
if (assignmentHalves.length == 2){
result[assignmentHalves[0]] = assignmentHalves[1];
};
};
return (result);
}
private function shouldLock():Boolean{
var uri:String;
if (_lockToURIs.length == 0){
return (false);
};
for each (uri in _lockToURIs) {
if (((!((_loaderURL == null))) && (!((_loaderURL.indexOf(uri) == -1))))){
return (false);
};
};
return (true);
}
private function notifyMochiBot():void{
if ((((DeployConstants.LOCAL == false)) && (!((ExportVars.mochiBotID == ""))))){
MochiBot.track(this, ExportVars.mochiBotID);
};
}
private function shouldShowShare():Boolean{
var uri:String;
for each (uri in _shareButtonFreeURIs) {
if (((!((_loaderURL == null))) && (!((_loaderURL.indexOf(uri) == -1))))){
return (false);
};
};
return (true);
}
private function getURLParams():Object{
var questionIndex:int;
if (_loaderURL != null){
questionIndex = _loaderURL.indexOf("?");
if (questionIndex != -1){
return (stringToObject(_loaderURL.substr((questionIndex + 1))));
};
return (new Object());
//unresolved jump
};
return (root.loaderInfo.parameters);
}
public static function debugWrite(text:String):void{
if (_debugWindow != null){
_debugWindow.appendText((text + "\n"));
} else {
_debugText = (_debugText + (text + "\n"));
};
}
}
}//package
Section 37
//EmbeddableLoader_I_EXIST_ONLY_TO_EMBED_A_FONT (EmbeddableLoader_I_EXIST_ONLY_TO_EMBED_A_FONT)
package {
import mx.core.*;
public class EmbeddableLoader_I_EXIST_ONLY_TO_EMBED_A_FONT extends FontAsset {
}
}//package
Section 38
//LoaderCover (LoaderCover)
package {
import flash.display.*;
public class LoaderCover extends Sprite {
public var playGameCallback:Function;
public function LoaderCover(){
super();
}
public function setProgress(percentage:Number):void{
}
}
}//package
Section 39
//LoaderWithAd (LoaderWithAd)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import com.zipzapplay.config.*;
import generated.*;
public class LoaderWithAd extends LoaderCover {
private var _loadingIndicator:LoadingIndicator;
private var _mochiAdArgs:Object;
private var _adHolder:MovieClip;
private static const SignPost:Class = LoaderWithAd_SignPost;
private static const Background:Class = LoaderWithAd_Background;
public function LoaderWithAd(){
super();
var background:DisplayObject = new Background();
Bitmap(background).smoothing = true;
addChild(background);
this.addEventListener(MouseEvent.CLICK, goToMainSite);
background.addEventListener(MouseEvent.CLICK, goToMainSite);
var signpost:DisplayObject = new SignPost();
signpost.x = 15;
signpost.y = 170;
addChild(signpost);
signpost.addEventListener(MouseEvent.CLICK, goToMainSite);
_loadingIndicator = new LoadingIndicator(0xFFFFFF);
_loadingIndicator.x = 50;
_loadingIndicator.y = 95;
addChild(_loadingIndicator);
var mochiWidth:int = 300;
var mochiHeight:int = 250;
_adHolder = new MovieClip();
_adHolder.x = 247;
_adHolder.y = 80;
addChild(_adHolder);
_mochiAdArgs = {clip:_adHolder, id:ExportVars.mochiAdsID, res:((("" + mochiWidth) + "x") + mochiHeight)};
var smallTextSize:Number = 14;
var sponsoredBy:EasyText = new EasyText("sponsored by:", smallTextSize, 0xFFFFFF);
addChild(sponsoredBy);
sponsoredBy.x = ((_adHolder.x + (mochiWidth / 2)) - (sponsoredBy.textWidth / 2));
sponsoredBy.y = ((_adHolder.y - sponsoredBy.textHeight) - 7);
var sharesRevenue:EasyText = new EasyText("PlayCrafter shares ad revenue with creators", smallTextSize, 2583642);
addChild(sharesRevenue);
sharesRevenue.x = ((_adHolder.x + (mochiWidth / 2)) - (sharesRevenue.textWidth / 2));
sharesRevenue.y = ((_adHolder.y + mochiHeight) + 2);
}
public function showAd():void{
MochiAd.showClickAwayAd(_mochiAdArgs);
}
private function showPlayButton():void{
var button:PlayButton = new PlayButton();
addChild(button);
button.x = 30;
button.y = 90;
button.addEventListener(MouseEvent.CLICK, playClicked);
}
private function playClicked(mEvent:Event):void{
if (playGameCallback != null){
trace("LoaderWithAd PlayClicked");
mEvent.stopPropagation();
playGameCallback();
};
}
private function goToMainSite(event:Event=null):void{
trace("LoaderWithAd goToMainSite");
navigateToURL(new URLRequest(DeployConstants.MAIN_SITE_URL));
}
override public function setProgress(percentage:Number):void{
if (percentage >= 100){
showPlayButton();
};
_loadingIndicator.setProgress(percentage);
}
}
}//package
Section 40
//LoaderWithAd_Background (LoaderWithAd_Background)
package {
import mx.core.*;
public class LoaderWithAd_Background extends BitmapAsset {
}
}//package
Section 41
//LoaderWithAd_SignPost (LoaderWithAd_SignPost)
package {
import flash.utils.*;
import mx.core.*;
public class LoaderWithAd_SignPost extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function LoaderWithAd_SignPost(){
dataClass = LoaderWithAd_SignPost_dataClass;
super();
initialWidth = (4400 / 20);
initialHeight = (5180 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package
Section 42
//LoaderWithAd_SignPost_dataClass (LoaderWithAd_SignPost_dataClass)
package {
import mx.core.*;
public class LoaderWithAd_SignPost_dataClass extends ByteArrayAsset {
}
}//package
Section 43
//LoaderWithoutAd (LoaderWithoutAd)
package {
import flash.events.*;
import flash.net.*;
import com.zipzapplay.config.*;
import flash.display.*;
import flash.geom.*;
public class LoaderWithoutAd extends LoaderCover {
private var _loadingIndicator:LoadingIndicator;
private static const SignPost:Class = LoaderWithoutAd_SignPost;
private static const Background:Class = LoaderWithoutAd_Background;
public function LoaderWithoutAd(){
super();
var background:DisplayObject = new Background();
Bitmap(background).smoothing = true;
addChild(background);
this.addEventListener(MouseEvent.CLICK, goToMainSite);
background.addEventListener(MouseEvent.CLICK, goToMainSite);
var signpost:DisplayObject = new SignPost();
signpost.x = 127;
signpost.y = 130;
signpost.scaleX = 1.4;
signpost.scaleY = 1.4;
addChild(signpost);
signpost.addEventListener(MouseEvent.CLICK, goToMainSite);
_loadingIndicator = new LoadingIndicator(12644607);
_loadingIndicator.x = 190;
_loadingIndicator.y = 40;
_loadingIndicator.scaleX = 1.2;
_loadingIndicator.scaleY = 1.2;
addChild(_loadingIndicator);
scrollRect = new Rectangle(0, 0, 558, 430);
}
private function goToMainSite(event:Event=null):void{
navigateToURL(new URLRequest(DeployConstants.MAIN_SITE_URL));
}
override public function setProgress(percentage:Number):void{
if ((((percentage >= 100)) && (!((playGameCallback == null))))){
playGameCallback();
};
_loadingIndicator.setProgress(percentage);
}
}
}//package
Section 44
//LoaderWithoutAd_Background (LoaderWithoutAd_Background)
package {
import mx.core.*;
public class LoaderWithoutAd_Background extends BitmapAsset {
}
}//package
Section 45
//LoaderWithoutAd_SignPost (LoaderWithoutAd_SignPost)
package {
import flash.utils.*;
import mx.core.*;
public class LoaderWithoutAd_SignPost extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function LoaderWithoutAd_SignPost(){
dataClass = LoaderWithoutAd_SignPost_dataClass;
super();
initialWidth = (4400 / 20);
initialHeight = (5180 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package
Section 46
//LoaderWithoutAd_SignPost_dataClass (LoaderWithoutAd_SignPost_dataClass)
package {
import mx.core.*;
public class LoaderWithoutAd_SignPost_dataClass extends ByteArrayAsset {
}
}//package
Section 47
//LoadingIndicator (LoadingIndicator)
package {
import flash.display.*;
public class LoadingIndicator extends Sprite {
private var _bar:RoundedProgressBar;
private var _label:EasyText;
public function LoadingIndicator(borderColor:uint){
super();
_label = new EasyText("Game Loading...", 25, 0xFFFFFF);
_label.x = 5;
addChild(_label);
_bar = new RoundedProgressBar((_label.width + 10), borderColor);
_bar.x = 0;
_bar.y = (_label.height + 5);
addChild(_bar);
}
public function setProgress(percentage:Number):void{
_bar.setProgress(percentage);
}
}
}//package
Section 48
//MochiAd (MochiAd)
package {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.system.*;
import flash.net.*;
public class MochiAd {
public function MochiAd(){
super();
}
public static function getVersion():String{
return ("2.5");
}
public static function showClickAwayAd(options:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = options;
var DEFAULTS:Object = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (width:Number, height:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
if (!(MochiAd.load(options))){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
var sendHostProgress:Boolean;
mc.regContLC = function (lc_name:String):void{
mc._containerLCName = lc_name;
};
chk["onEnterFrame"] = function ():void{
var total:Number;
if (!(this.parent)){
delete this.onEnterFrame;
return;
};
var ad_clip:Object = this.parent._mochiad_ctr;
var elapsed:Number = (getTimer() - this.started);
var finished:Boolean;
if (!(chk.showing)){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
finished = true;
chk.started = getTimer();
} else {
if (elapsed > chk.ad_timeout){
options.ad_failed();
finished = true;
};
};
};
if (this.root == null){
finished = true;
};
if (finished){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(server:String):String{
var hostname:String = server.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(hostname);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(hostname);
return (hostname);
}
public static function unload(clip:Object):Boolean{
if (((clip.clip) && (clip.clip._mochiad))){
clip = clip.clip;
};
if (clip.origFrameRate != undefined){
clip.stage.frameRate = clip.origFrameRate;
};
if (!(clip._mochiad)){
return (false);
};
if (clip._mochiad._containerLCName != undefined){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"unload"});
};
if (clip._mochiad.onUnload){
clip._mochiad.onUnload();
};
delete clip._mochiad_loaded;
delete clip._mochiad;
return (true);
}
public static function showInterLevelAd(options:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = options;
var DEFAULTS:Object = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (width:Number, height:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = options.fadeout_time;
delete options.fadeout_time;
if (!(MochiAd.load(options))){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
if (!(this.parent)){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var p:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0){
this.parent.alpha = (p * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (msec:Number):void{
var _chk:Object = mc._mochiad_wait;
_chk.server_control = true;
_chk.showing = true;
_chk.started = getTimer();
_chk.ad_msec = (msec - 250);
};
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
chk["onEnterFrame"] = function ():void{
var total:Number;
if (!(this.parent)){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var ad_clip:Object = this.parent._mochiad_ctr;
var elapsed:Number = (getTimer() - this.started);
var finished:Boolean;
if (!(chk.showing)){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (elapsed > chk.ad_timeout){
options.ad_failed();
finished = true;
};
};
};
if (elapsed > chk.ad_msec){
finished = true;
};
if (finished){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(options:Object, defaults:Object):Object{
var k:String;
var pairs:Array;
var i:Number;
var kv:Array;
var optcopy:Object = {};
for (k in defaults) {
optcopy[k] = defaults[k];
};
if (options){
for (k in options) {
optcopy[k] = options[k];
};
};
if (optcopy.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
options = optcopy.clip.loaderInfo.parameters.mochiad_options;
if (options){
pairs = options.split("&");
i = 0;
while (i < pairs.length) {
kv = pairs[i].split("=");
optcopy[unescape(kv[0])] = unescape(kv[1]);
i++;
};
};
if (optcopy.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (optcopy);
}
public static function _cleanup(mc:Object):void{
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = mc;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
lc.client = null;
lc.close();
//unresolved jump
var _slot1 = e;
};
setTimeout(f, 0);
};
var idx:Number = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(options:Object):MovieClip{
var clip:Object;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = options;
var DEFAULTS:Object = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!(MochiAd._isNetworkAvailable())){
return (null);
};
if (clip._mochiad_loaded){
return (null);
};
//unresolved jump
var _slot1 = e;
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
var depth:Number = options.depth;
delete options.depth;
var mc:MovieClip = createEmptyMovieClip(clip, "_mochiad", depth);
var wh:Array = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
var lv:URLVariables = new URLVariables();
for (k in options) {
v = options[k];
if (!((v is Function))){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (ev:Object):void{
ev.target.removeEventListener(ev.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest((server + ".swf"));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(base:Object, methodName:String, argsArray:Array):Object{
var nameArray:Array = methodName.split(".");
var i:Number = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return (undefined);
};
base = base[nameArray[i]];
i++;
};
if (typeof(base[nameArray[i]]) == "function"){
return (base[nameArray[i]].apply(base, argsArray));
};
return (undefined);
}
public static function createEmptyMovieClip(parent:Object, name:String, depth:Number):MovieClip{
var mc:MovieClip = new MovieClip();
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
parent[name] = mc;
mc["_name"] = name;
return (mc);
}
public static function _getRes(options:Object, clip:Object):Array{
var xy:Array;
var b:Object = clip.getBounds(clip.root);
var w:Number = 0;
var h:Number = 0;
if (typeof(options.res) != "undefined"){
xy = options.res.split("x");
w = parseFloat(xy[0]);
h = parseFloat(xy[1]);
} else {
w = (b.xMax - b.xMin);
h = (b.yMax - b.yMin);
};
if ((((w == 0)) || ((h == 0)))){
w = clip.stage.stageWidth;
h = clip.stage.stageHeight;
};
return ([w, h]);
}
public static function adShowing(mc:Object):void{
mc.origFrameRate = mc.stage.frameRate;
mc.stage.frameRate = 30;
}
public static function getValue(base:Object, objectName:String):Object{
var nameArray:Array = objectName.split(".");
var i:Number = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return (undefined);
};
base = base[nameArray[i]];
i++;
};
return (base[nameArray[i]]);
}
public static function rpc(clip:Object, callbackID:Number, arg:Object):void{
var _local4:Object;
var _local5:Object;
switch (arg.id){
case "setValue":
MochiAd.setValue(clip, arg.objectName, arg.value);
break;
case "getValue":
_local4 = MochiAd.getValue(clip, arg.objectName);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(clip, arg.method, arg.args);
clip._mochiad.lc.send(clip._mochiad._containerLCName, "rpcResult", callbackID, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + arg.id));
};
}
public static function setValue(base:Object, objectName:String, value:Object):void{
var nameArray:Array = objectName.split(".");
var i:Number = 0;
while (i < (nameArray.length - 1)) {
if ((((base[nameArray[i]] == undefined)) || ((base[nameArray[i]] == null)))){
return;
};
base = base[nameArray[i]];
i++;
};
base[nameArray[i]] = value;
}
public static function showPreGameAd(options:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var complete:Boolean;
var unloaded:Boolean;
var sendHostProgress:Boolean;
var r:MovieClip;
var options = options;
var DEFAULTS:Object = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (width:Number, height:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (percent:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
setTimeout(options.ad_finished, 100);
return;
};
clip = options.clip;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = options.fadeout_time;
delete options.fadeout_time;
if (!(MochiAd.load(options))){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
var fn:Function = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
var bar:MovieClip = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
var bar_color:Number = options.color;
delete options.color;
var bar_background:Number = options.background;
delete options.background;
var bar_outline:Number = options.outline;
delete options.outline;
var backing_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 1);
var backing:Object = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
var inside_mc:MovieClip = createEmptyMovieClip(bar, "_inside", 2);
var inside:Object = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
var outline_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 3);
var outline:Object = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var p:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (p > 0){
this.parent.alpha = (p * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
var f:Function = function (ev:Event):void{
ev.target.removeEventListener(ev.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (msec:Number):void{
var _chk:Object = mc._mochiad_wait;
_chk.server_control = true;
_chk.showing = true;
_chk.started = getTimer();
_chk.ad_msec = msec;
};
mc.rpc = function (callbackID:Number, arg:Object):void{
MochiAd.rpc(clip, callbackID, arg);
};
mc.rpcTestFn = function (s:String):Object{
trace(("[MOCHIAD rpcTestFn] " + s));
return (s);
};
mc.regContLC = function (lc_name:String):void{
mc._containerLCName = lc_name;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (lc_name:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var total:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
var _clip:Object = this.parent.parent.root;
var ad_clip:Object = this.parent._mochiad_ctr;
var elapsed:Number = (getTimer() - this.started);
var finished:Boolean;
var clip_total:Number = _clip.loaderInfo.bytesTotal;
var clip_loaded:Number = _clip.loaderInfo.bytesLoaded;
if (complete){
clip_loaded = Math.max(1, clip_loaded);
clip_total = clip_loaded;
};
var clip_pcnt:Number = ((100 * clip_loaded) / clip_total);
var ad_pcnt:Number = ((100 * elapsed) / chk.ad_msec);
var _inside:Object = this._mochiad_bar._inside;
var pcnt:Number = Math.min(100, Math.min(((clip_pcnt) || (0)), ad_pcnt));
pcnt = Math.max(this.last_pcnt, pcnt);
this.last_pcnt = pcnt;
_inside.scaleX = (pcnt * 0.01);
options.ad_progress(pcnt);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:clip_pcnt});
if (clip_pcnt == 100){
sendHostProgress = false;
};
};
if (!(chk.showing)){
total = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (total > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((elapsed > chk.ad_timeout)) && ((clip_pcnt == 100)))){
options.ad_failed();
finished = true;
};
};
};
if (elapsed > chk.ad_msec){
finished = true;
};
if (((complete) && (finished))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(options:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(options);
}
public static function showTimedAd(options:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(options);
}
public static function doOnEnterFrame(mc:MovieClip):void{
var mc = mc;
var f:Function = function (ev:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
ev.target.removeEventListener(ev.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 49
//MyProxy (MyProxy)
package {
import flash.utils.*;
public class MyProxy extends Proxy {
public var adobeSucks:int;
public function MyProxy(){
super();
}
}
}//package
Section 50
//PlayButton (PlayButton)
package {
import flash.events.*;
import flash.display.*;
import flash.filters.*;
public class PlayButton extends Sprite {
private const _TOP_PAD:Number = 10;
private const _RIGHT_PAD:Number = 20;
private const _LEFT_PAD:Number = 20;
private const _BOTTOM_PAD:Number = 10;
private var _border:Array;
private var _colors:Object;
private var _label:EasyText;
public function PlayButton(){
_colors = {up:{border:13925397, fill:0xFFFFFF}, over:{border:32615, fill:13434870}, down:{border:0xFFFFFF, fill:7058342}};
_border = [[0.5, 0], [70, 3], [99, 0], [98, 70], [100, 100], [40, 98], [0, 99], [1, 60]];
super();
addEventListener(MouseEvent.MOUSE_DOWN, onMouseDown);
addEventListener(MouseEvent.MOUSE_UP, onMouseUp);
addEventListener(MouseEvent.ROLL_OUT, onRollOut);
addEventListener(MouseEvent.ROLL_OVER, onRollOver);
_label = new EasyText("Play Game", 40, _colors.up.border);
addChild(_label);
_label.x = _LEFT_PAD;
_label.y = _TOP_PAD;
draw(_colors.up);
this.filters = [new DropShadowFilter(0, 0, 0, 0.15, 10, 10)];
}
private function strokeBox():void{
var point:Array;
var boxScaleX:Number = (((_LEFT_PAD + _label.width) + _RIGHT_PAD) / 100);
var boxScaleY:Number = (((_TOP_PAD + _label.height) + _BOTTOM_PAD) / 100);
var lastPoint:Array = _border[(_border.length - 1)];
graphics.moveTo((lastPoint[0] * boxScaleX), (lastPoint[1] * boxScaleY));
for each (point in _border) {
graphics.lineTo((point[0] * boxScaleX), (point[1] * boxScaleY));
};
}
private function onMouseUp(e:MouseEvent):void{
draw(_colors.up);
}
private function draw(colors:Object):void{
_label.textColor = colors.border;
graphics.clear();
graphics.beginFill(colors.fill);
strokeBox();
graphics.endFill();
graphics.lineStyle(2, colors.border);
strokeBox();
}
private function onMouseDown(e:MouseEvent):void{
draw(_colors.down);
}
private function onRollOver(e:MouseEvent):void{
draw(_colors.over);
}
private function onRollOut(e:MouseEvent):void{
draw(_colors.up);
}
}
}//package
Section 51
//RoundedProgressBar (RoundedProgressBar)
package {
import flash.display.*;
import flash.filters.*;
public class RoundedProgressBar extends Sprite {
private var _totalWidth:Number;// = 100
private var _height:Number;// = 7
private var _borderThickness:Number;// = 1.4
private var _scaledBar:Sprite;
public function RoundedProgressBar(totalWidth:Number, borderColor:uint){
super();
_scaledBar = new Sprite();
_scaledBar.graphics.beginFill(0xFFFFFF);
_scaledBar.graphics.drawRect(0, 0, 1, 1);
_scaledBar.scaleY = _height;
_scaledBar.x = (_height / 2);
addChild(_scaledBar);
_totalWidth = totalWidth;
graphics.beginFill(0xFFFFFF);
graphics.drawRoundRectComplex(0, 0, (_height / 2), _height, (_height / 2), 0, (_height / 2), 0);
graphics.endFill();
var outline:Sprite = new Sprite();
outline.graphics.lineStyle(_borderThickness, borderColor, 1, true);
outline.graphics.drawRoundRect(0, 0, _totalWidth, _height, _height);
addChild(outline);
setProgress(0);
this.filters = [new GlowFilter(0xFFFFFF, 0.3)];
}
public function setProgress(percentage:Number):void{
_scaledBar.scaleX = ((percentage / 100) * (_totalWidth - _height));
}
}
}//package
Section 52
//StandAloneLoader (StandAloneLoader)
package {
import flash.events.*;
import flash.display.*;
import com.zipzapplay.config.*;
import flash.system.*;
import generated.*;
import flash.net.*;
import com.zipzapplay.events.*;
public class StandAloneLoader extends Loader {
public var shouldShowShareButton:Boolean;
private var _adobeSucksMyAss:MyProxy;
public var progressFunction:Function;
public var buttonShown:Boolean;// = true
public var adShown:Boolean;// = false
public function StandAloneLoader(){
_adobeSucksMyAss = new MyProxy();
super();
}
private function serverFromURL(url:String):String{
var chunks:Array = url.split("/");
return (chunks[2]);
}
public function onAssetProgress(event:ProgressEvent):void{
if (((!(shouldShowShareButton)) && (buttonShown))){
buttonShown = false;
trace("Hiding share button.");
this.contentLoaderInfo.sharedEvents.dispatchEvent(new StandAloneEvent(StandAloneEvent.HIDE_SHARE_BUTTON));
};
if (adShown){
adShown = false;
this.contentLoaderInfo.sharedEvents.dispatchEvent(new StandAloneEvent(StandAloneEvent.AD_SHOWN));
};
progressFunction((50 + ((50 * event.bytesLoaded) / event.bytesTotal)));
}
public function onSWFProgress(event:ProgressEvent):void{
if (progressFunction != null){
progressFunction(((50 * event.bytesLoaded) / event.bytesTotal));
};
}
public function onLoadingComplete(unused:Event):void{
if (progressFunction != null){
progressFunction(50);
};
}
public function loadGame(gameID:int, shouldShowShare:Boolean):void{
var domain:String = serverFromURL(DeployConstants.REAL_STANDALONE_PLAYER_URL);
Security.allowDomain(domain);
Security.allowInsecureDomain(domain);
shouldShowShareButton = shouldShowShare;
var url:String = ((DeployConstants.REAL_STANDALONE_PLAYER_URL + "?gameID=") + gameID);
if (int(ExportVars.authorID) != 0){
url = (url + ("&authorID=" + int(ExportVars.authorID)));
};
EmbeddableLoader.debugWrite(("loading " + url));
this.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onSWFProgress);
this.contentLoaderInfo.sharedEvents.addEventListener(ProgressEvent.PROGRESS, onAssetProgress);
this.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoadingComplete);
this.name = "ZZPMiniLoader2";
this.load(new URLRequest(url), new LoaderContext(false, new ApplicationDomain()));
}
}
}//package
Section 53
//TopScoreForwarder (TopScoreForwarder)
package {
import flash.display.*;
import flash.events.*;
import com.kongregate.as3.client.*;
import flash.net.*;
import com.zipzapplay.events.*;
import com.zipzapplay.network.*;
public class TopScoreForwarder {
private var kongregate:KongregateAPI;
private var rootSprite:Sprite;
private var onKongregate:Boolean;
private var MindJoltAPI:Object;
private var onMindjolt:Boolean;
public function TopScoreForwarder(container:Sprite, loader:Loader, loaderInfo:LoaderInfo){
super();
trace("TopScoreForwarder constructor");
if ((((loader == null)) || ((loaderInfo == null)))){
trace("TopScoreForwarder loader/loaderInfo null");
return;
};
rootSprite = container;
setupAPIs(container, loaderInfo);
if (loader.contentLoaderInfo != null){
if (loader.contentLoaderInfo.sharedEvents != null){
loader.contentLoaderInfo.sharedEvents.addEventListener(TopScoreEvent.REPORT_SCORE, submitTopScore);
loader.contentLoaderInfo.sharedEvents.addEventListener(LevelCompletedEvent.LEVEL_COMPLETED_EVENT, submitLevelCompleted);
loader.contentLoaderInfo.sharedEvents.addEventListener(GameWonEvent.GAME_WON_EVENT, submitGameWon);
} else {
trace("TopScoreForwarder sharedEvents is null");
};
} else {
trace("TopScoreForwarder contentLoaderInfo is null");
};
}
public function submitGameWon(event:Event):void{
trace("TopScoreForwarder submitGameWon called");
if (onKongregate){
kongregate.stats.submit("GameCompleted", 1);
};
}
public function submitTopScore(event:Event):void{
var pointValue:int;
var singleScore:int;
trace("TopScoreForwarder submitTopScore called");
var obj:Object = event;
var MAX_TIME_OR_STROKES:int = 50000;
switch (obj.sortBy){
case AwardType.STROKE:
pointValue = obj.strokes;
singleScore = (MAX_TIME_OR_STROKES - obj.strokes);
break;
case AwardType.TIME:
pointValue = obj.time;
singleScore = (MAX_TIME_OR_STROKES - obj.time);
break;
case AwardType.POINTS:
default:
pointValue = obj.points;
singleScore = obj.points;
break;
};
trace(("TopScoreForwarder.as submitTopScore: " + pointValue));
if (onKongregate){
kongregate.stats.submit("HighScore-Normal", pointValue);
};
if (onMindjolt){
if (MindJoltAPI != null){
trace(("TopScoreForwarder.as submitting mindjolt score:" + singleScore.toString()));
MindJoltAPI.service.submitScore(pointValue);
};
};
}
private function mindjoltLoadFinished(e:Event):void{
MindJoltAPI = e.currentTarget.content;
MindJoltAPI.service.connect();
trace("[MindJoltAPI] service manually loaded");
}
private function setupAPIs(container:Sprite, loaderInfo:LoaderInfo):void{
var gameParams:Object;
var urlLoader:Loader;
onKongregate = false;
onMindjolt = false;
var loaderURL:String = loaderInfo.url;
if (loaderURL != null){
if (loaderURL.indexOf("kongregate.com") != -1){
onKongregate = true;
};
if (loaderURL.indexOf("mindjolt") != -1){
onMindjolt = true;
};
};
if (onKongregate){
kongregate = new KongregateAPI();
if (container != null){
container.addChild(kongregate);
} else {
trace("TopScoreForwarder container is null");
};
};
if (onMindjolt){
gameParams = loaderInfo.parameters;
urlLoader = new Loader();
urlLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, mindjoltLoadFinished);
urlLoader.load(new URLRequest(((gameParams.mjPath) || ("http://static.mindjolt.com/api/as3/scoreapi_as3_local.swf"))));
container.addChild(urlLoader);
};
}
public function submitLevelCompleted(event:Event):void{
trace("TopScoreForwarder submitLevelCompleted called");
var obj:Object = event;
if (obj.levelCompleted != null){
trace(("TopScoreForwarder.as submitLevelCompleted: " + obj.levelCompleted));
if (onKongregate){
kongregate.stats.submit("LevelCompleted", obj.levelCompleted);
};
};
}
}
}//package