Section 1
//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.4.1.10084";
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 2
//ByteArrayAsset (mx.core.ByteArrayAsset)
package mx.core {
import flash.utils.*;
public class ByteArrayAsset extends ByteArray implements IFlexAsset {
mx_internal static const VERSION:String = "3.4.1.10084";
public function ByteArrayAsset(){
super();
}
}
}//package mx.core
Section 3
//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.4.1.10084";
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 4
//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.4.1.10084";
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 5
//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.4.1.10084";
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 6
//IBorder (mx.core.IBorder)
package mx.core {
public interface IBorder {
function get borderMetrics():EdgeMetrics;
}
}//package mx.core
Section 7
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 8
//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(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 9
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(C:\autobuild\3.4.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function get isDocument():Boolean;
function set repeaters(C:\autobuild\3.4.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function initializeRepeaterArrays(C:\autobuild\3.4.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(C:\autobuild\3.4.0\frameworks\projects\framework\src;mx\core;IRepeaterClient.as:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 10
//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.4.1.10084";
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 11
//MovieClipLoaderAsset (mx.core.MovieClipLoaderAsset)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
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.4.1.10084";
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 12
//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 13
//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.4.1.10084";
private static var counter:int = 0;
public function NameUtil(){
super();
}
public static function displayObjectToString(displayObject:DisplayObject):String{
var result:String;
var o:DisplayObject;
var s:String;
var indices:Array;
var displayObject = displayObject;
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;
};
//unresolved jump
var _slot1 = e;
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 14
//Log (SWFStats.Log)
package SWFStats {
import flash.events.*;
import flash.utils.*;
import flash.system.*;
import flash.net.*;
import flash.external.*;
public final class Log {
private static const PingR:Timer = new Timer(30000);
private static const Random:Number = Math.random();
private static const PingF:Timer = new Timer(60000);
public static var GUID:String = "";
private static var Plays:int = 0;
private static var Enabled:Boolean = false;
private static var FirstPing:Boolean = true;
private static var Pings:int = 0;
public static var SourceUrl:String;
private static var HighestGoal:int = 0;
public static var SWFID:int = 0;
public function Log(){
super();
}
private static function GetCookie(n:String):int{
var cookie:SharedObject = SharedObject.getLocal("swfstats");
if (cookie.data[n] == undefined){
return (0);
};
return (int(cookie.data[n]));
}
private static function SaveCookie(n:String, v:int):void{
var cookie:SharedObject = SharedObject.getLocal("swfstats");
cookie.data[n] = v.toString();
cookie.flush();
}
public static function View(swfid:int=0, guid:String="", defaulturl:String=""):void{
SWFID = swfid;
GUID = guid;
Enabled = true;
if ((((SWFID == 0)) || ((GUID == "")))){
Enabled = false;
return;
};
if (((((!((defaulturl.indexOf("http://") == 0))) && (!((Security.sandboxType == "localWithNetwork"))))) && (!((Security.sandboxType == "localTrusted"))))){
Enabled = false;
return;
};
SourceUrl = GetUrl(defaulturl);
if ((((SourceUrl == null)) || ((SourceUrl == "")))){
Enabled = false;
return;
};
Security.allowDomain("http://tracker.swfstats.com/");
Security.allowInsecureDomain("http://tracker.swfstats.com/");
Security.loadPolicyFile("http://tracker.swfstats.com/crossdomain.xml");
Security.allowDomain("http://utils.swfstats.com/");
Security.allowInsecureDomain("http://utils.swfstats.com/");
Security.loadPolicyFile("http://utils.swfstats.com/crossdomain.xml");
var views:int = GetCookie("views");
views++;
SaveCookie("views", views);
Send("View", ("views=" + views));
PingF.addEventListener(TimerEvent.TIMER, PingServer);
PingF.start();
}
public static function LevelCounterMetric(name:String, level):void{
if (!Enabled){
return;
};
Send("LevelMetric", ((("name=" + escape(name)) + "&level=") + level));
}
private static function Send(page:String, data:String):void{
var sendaction:URLLoader = new URLLoader();
sendaction.addEventListener(IOErrorEvent.IO_ERROR, ErrorHandler);
sendaction.addEventListener(HTTPStatusEvent.HTTP_STATUS, StatusChange);
sendaction.addEventListener(SecurityErrorEvent.SECURITY_ERROR, ErrorHandler);
sendaction.load(new URLRequest(((((((((((("http://tracker.swfstats.com/Games/" + page) + ".html?guid=") + GUID) + "&swfid=") + SWFID) + "&") + data) + "&url=") + SourceUrl) + "&") + Random)));
}
public static function Play():void{
if (!Enabled){
return;
};
Plays++;
Send("Play", ("plays=" + Plays));
}
private static function GetUrl(defaulturl:String):String{
var url:String;
var defaulturl = defaulturl;
if (ExternalInterface.available){
url = String(ExternalInterface.call("window.location.href.toString"));
//unresolved jump
var _slot1 = s;
url = defaulturl;
} else {
if (defaulturl.indexOf("http://") == 0){
url = defaulturl;
};
};
if ((((((url == null)) || ((url == "")))) || ((url == "null")))){
if ((((Security.sandboxType == "localWithNetwork")) || ((Security.sandboxType == "localTrusted")))){
url = "http://local-testing/";
} else {
url = null;
};
};
return (url);
}
private static function ErrorHandler(... _args):void{
Enabled = false;
}
public static function LevelRangedMetric(name:String, level, value:int):void{
if (!Enabled){
return;
};
Send("LevelMetricRanged", ((((("name=" + escape(name)) + "&level=") + level) + "&value=") + value));
}
private static function StatusChange(... _args):void{
}
public static function Goal(n:int, name:String):void{
if (!Enabled){
return;
};
if (HighestGoal >= n){
return;
};
HighestGoal = n;
Send("Goal", ((("goal=" + n) + "&name=") + escape(name)));
}
private static function PingServer(... _args):void{
if (!Enabled){
return;
};
Pings++;
Send("Ping", (((FirstPing) ? "&firstping=yes" : "" + "&pings=") + Pings));
if (FirstPing){
PingF.stop();
PingR.addEventListener(TimerEvent.TIMER, PingServer);
PingR.start();
FirstPing = false;
};
}
public static function LevelAverageMetric(name:String, level, value:int):void{
if (!Enabled){
return;
};
Send("LevelMetricAverage", ((((("name=" + escape(name)) + "&level=") + level) + "&value=") + value));
}
public static function CustomMetric(name:String, group:String=null):void{
if (!Enabled){
return;
};
if (group == null){
group = "";
};
Send("CustomMetric", ((("name=" + escape(name)) + "&group=") + escape(group)));
}
}
}//package SWFStats
Section 15
//Main (Main)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import SWFStats.*;
public class Main extends Sprite {
public var Logo:Class;
private var LC:LocalConnection;
public var logo:MovieClip;
public function Main():void{
Logo = Main_Logo;
logo = new Logo();
super();
if (stage){
init();
} else {
addEventListener(Event.ADDED_TO_STAGE, init);
};
}
private function init(e:Event=null):void{
var e = e;
removeEventListener(Event.ADDED_TO_STAGE, init);
LC = new LocalConnection();
LC.connect("xEPLUMBERS");
//unresolved jump
var _slot1 = error;
LC.client = this;
addChild(logo);
NewgroundsAPI.linkAPI(this);
NewgroundsAPI.connectMovie(11891);
}
public function onLCStatus(statusEvent:StatusEvent):void{
if (statusEvent.level == "error"){
};
}
public function connectionHandler(LCMessage:String):void{
if (LCMessage == "x_play"){
Log.Play();
};
if (LCMessage == "x_sponsorclick"){
Log.CustomMetric("click_doppler");
};
if (LCMessage == "x_walkthroughclick"){
Log.CustomMetric("click_dopplerwalkthrough");
};
if (LCMessage == "x_win"){
Log.CustomMetric("endingscreen");
};
if (LCMessage == "x_klikscene"){
Log.CustomMetric("click_klikscene");
};
}
}
}//package
Section 16
//Main_Logo (Main_Logo)
package {
import flash.utils.*;
import mx.core.*;
public class Main_Logo extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Main_Logo(){
dataClass = Main_Logo_dataClass;
super();
initialWidth = (15200 / 20);
initialHeight = (10000 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package
Section 17
//Main_Logo_dataClass (Main_Logo_dataClass)
package {
import mx.core.*;
public class Main_Logo_dataClass extends ByteArrayAsset {
}
}//package
Section 18
//MochiBot (MochiBot)
package {
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("*");
Security.allowInsecureDomain("*");
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
Section 19
//NewgroundsAPI (NewgroundsAPI)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.text.*;
public class NewgroundsAPI {
public static const ADS_APPROVED:Number = 3;
public static const bridge:Sprite = new Sprite();
private static const STAT_NEW_VERSION:Number = 4;
private static const STAT_AUTHOR_SITE:Number = 2;
private static const GATEWAY_URL:String = "http://www.ngads.com/gateway.php";
private static const NEWGROUNDS_URL:String = "http://www.newgrounds.com";
private static const STAT_CUSTOM_STATS:Number = 50;
private static const STAT_MOVIE_VIEWS:Number = 1;
private static const STAT_NEWGROUNDS:Number = 3;
public static const NEW_VERSION:Number = 2;
public static const DENY_HOST:Number = 1;
private static var tracker_id:Number;
private static var movie_options:Object = new Object();
private static var connected:Boolean;
private static var custom_events:Object = new Object();
private static var host:String;
private static var linked:Boolean;
private static var events:Object = new Object();
private static var debug:Boolean;
private static var version:String;
private static var custom_links:Object = new Object();
private static var LC:LocalConnection;
public function NewgroundsAPI(){
super();
}
public static function getNewVersionURL(){
return (((((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + STAT_NEW_VERSION));
}
private static function ReadGatewayData(params:Object){
var i:*;
var _url:String;
var target_url:*;
var gateway_loader:URLLoader;
for (i in params) {
params[i] = unescape(params[i]);
movie_options[i] = params[i];
};
if (params["settings_loaded"]){
SendMessage("You have successfully connected to the Newgrounds API gateway!");
SendMessage((("Movie Identified as '" + movie_options["movie_name"]) + "'"));
if (movie_options["message"]){
SendMessage(movie_options["message"]);
};
if (movie_options["ad_url"]){
SendMessage("Your movie has been approved to run Flash Ads");
if (events[ADS_APPROVED]){
var _local6 = events;
_local6[ADS_APPROVED](movie_options["ad_url"]);
} else {
onAdsApproved(movie_options["ad_url"]);
};
};
if (((movie_options["movie_version"]) && (!((String(movie_options["movie_version"]) == String(version)))))){
SendMessage("WARNING: The movie version configured in your API settings does not match this movie's version!");
if (events[NEW_VERSION]){
_local6 = events;
_local6[NEW_VERSION]({version:movie_options["movie_version"], real_url:getMovieURL(), redirect_url:getNewVersionURL()});
} else {
onNewVersionAvailable(movie_options["movie_version"], getMovieURL(), getNewVersionURL());
};
};
if (movie_options["deny_host"]){
SendMessage("You have blocked 'localHost' in your API settings.");
SendMessage("If you wish to test your movie you will need to remove this block.");
if (events[DENY_HOST]){
_local6 = events;
_local6[DENY_HOST]({host:host, real_url:getMovieURL(), redirect_url:getNewVersionURL()});
} else {
onDenyHost(host, getMovieURL(), getNewVersionURL());
};
};
if (movie_options["request_portal_url"]){
_url = bridge.root.loaderInfo.url;
target_url = ((((GATEWAY_URL + "?&id=") + tracker_id) + "&portal_url=") + escape(_url));
gateway_loader = new URLLoader(new URLRequest(target_url));
};
if (events[69]){
_local6 = events;
_local6[69]();
};
} else {
if (!movie_options["settings_loaded"]){
SendError("Could not establish connection to the API gateway.");
};
};
}
public static function setMovieVersion(movie_version){
if (!movie_version){
SendError("Missing required 'version' in NewgroundsAPI.setMovieVersion(version:String)");
} else {
version = String(movie_version);
};
}
public static function loadCustomLink(link_name:String){
if (!link_name){
SendError("Missing required 'link_name' parameter in NewgroundsAPI.loadCustomLink(link_name:String)");
} else {
if (!custom_links[link_name]){
SendError(("Attempted to open undefined custom link: " + link_name));
} else {
SendLink(custom_links[link_name]);
};
};
}
public static function addCustomLink(stat_id:Number, stat_name:String){
if (!stat_id){
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else {
if (!stat_name){
SendError("Missing required 'link_name' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else {
custom_links[stat_name] = (STAT_CUSTOM_STATS + stat_id);
SendMessage(((("Created custom link " + stat_id) + ": ") + stat_name));
};
};
}
public static function getMovieURL(){
if (movie_options["movie_url"]){
return (movie_options["movie_url"]);
};
return ("Newgrounds.com");
}
public static function debugMode(){
debug = true;
}
public static function getAdURL(){
return (movie_options["ad_url"]);
}
private static function SendStat(stat_id:Number, open_in_browser:Boolean, extra=null){
var target_url:*;
var x:*;
var request:URLRequest;
var gateway_loader:URLLoader;
var stat_id = stat_id;
var open_in_browser = open_in_browser;
var extra = extra;
if (!tracker_id){
SendError("You must call NewgroundsAPI.connectMovie() with a valid movie id before using API features!");
} else {
var XML_Loaded:Function = function (event:Event){
var XML_child:XML;
var param_name:*;
var param_value:*;
XML.ignoreWhitespace = true;
var XML_in:XML = XML(event.target.data);
var ngparams:Object = new Object();
var XML_children:XMLList = XML_in.children();
for each (XML_child in XML_children) {
param_name = XML_child.localName();
param_value = XML_child.attribute("value");
if (param_value == Number(param_value)){
param_value = Number(param_value);
};
ngparams[param_name] = param_value;
};
ReadGatewayData(ngparams);
};
target_url = (((((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + stat_id) + addSeed());
if (extra){
for (x in extra) {
target_url = (target_url + ((("&" + escape(x)) + "=") + escape(extra[x])));
};
};
if (debug){
target_url = (target_url + "&debug=1");
};
if (open_in_browser){
request = new URLRequest((target_url + addSeed()));
navigateToURL(request, "_blank");
} else {
gateway_loader = new URLLoader(new URLRequest((target_url + addSeed())));
gateway_loader.addEventListener(Event.COMPLETE, XML_Loaded);
};
};
}
public static function onAdsApproved(ad_url:String){
}
private static function SendMessage(msg:String){
trace(("[NEWGROUNDS API] :: " + msg));
}
public static function linkAPI(movie){
movie.addChild(bridge);
linked = true;
}
public static function loadNewgrounds(event:Event=null, page:String=null){
var request:URLRequest;
var extra:*;
if (!tracker_id){
request = new URLRequest(((NEWGROUNDS_URL + "/") + page));
navigateToURL(request, "_blank");
} else {
extra = null;
if (page){
extra = new Object();
extra.page = page;
};
SendLink(STAT_NEWGROUNDS, extra);
};
}
private static function SendLink(id, extra=null){
SendStat(id, true, extra);
}
public static function logCustomEvent(event_name:String){
if (!event_name){
SendError("Missing required 'event_name' parameter in NewgroundsAPI.logCustomEvent(event_name:String)");
} else {
if (!custom_events[event_name]){
SendError(("Attempted to log undefined custom event: " + event_name));
} else {
SendEvent(custom_events[event_name]);
};
};
}
public static function loadMySite(event:Event=null){
SendLink(STAT_AUTHOR_SITE);
}
private static function SendError(msg:String){
trace(("[NEWGROUNDS API ERROR] :: " + msg));
}
public static function addCustomEvent(stat_id:Number, stat_name:String){
if (!stat_id){
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else {
if (!stat_name){
SendError("Missing required 'event_name' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else {
custom_events[stat_name] = (STAT_CUSTOM_STATS + stat_id);
SendMessage(("Created custom event: " + stat_name));
};
};
}
private static function addSeed(){
return (("&seed=" + Math.random()));
}
public static function addEventListener(event:Number, callback:Function){
events[event] = callback;
}
private static function SendEvent(id){
SendStat(id, false);
}
public static function onNewVersionAvailable(version:String, movie_url:String, redirect_url:String){
var _root:*;
var overlay:MovieClip;
var version = version;
var movie_url = movie_url;
var redirect_url = redirect_url;
var sw:* = bridge.stage.stageWidth;
var sh:* = bridge.stage.stageHeight;
var tw:* = 350;
var th:* = 160;
var mg:* = 20;
_root = bridge.root;
overlay = new MovieClip();
overlay.graphics.beginFill(0, 0.6);
overlay.graphics.lineStyle(0, 0);
overlay.graphics.drawRect(0, 0, sw, sh);
overlay.graphics.endFill();
var overlay_x:* = Math.round(((sw - tw) / 2));
var overlay_y:* = Math.round(((sh - th) / 2));
overlay.graphics.beginFill(102);
overlay.graphics.lineStyle(10, 0);
overlay.graphics.drawRect((overlay_x - mg), (overlay_y - mg), (tw + mg), (th + mg));
overlay.graphics.endFill();
overlay.close = function (event:Event){
_root.removeChild(overlay);
};
var close_x:* = new MovieClip();
close_x.graphics.beginFill(0, 0.1);
close_x.graphics.lineStyle(3, 22015);
close_x.graphics.drawRect(0, 0, 16, 16);
close_x.graphics.endFill();
close_x.graphics.moveTo(4, 4);
close_x.graphics.lineTo(13, 13);
close_x.graphics.moveTo(13, 4);
close_x.graphics.lineTo(4, 13);
close_x.x = ((overlay_x + tw) - 26);
close_x.y = (overlay_y - 10);
close_x.addEventListener(MouseEvent.CLICK, overlay.close);
var blankarea:TextField = new TextField();
blankarea.x = (overlay_x - mg);
blankarea.y = (overlay_y - mg);
blankarea.width = (tw + mg);
blankarea.height = (th + mg);
blankarea.selectable = false;
var header:TextField = new TextField();
header.width = tw;
header.x = overlay_x;
header.y = overlay_y;
header.height = 100;
header.selectable = false;
var header_format:TextFormat = new TextFormat();
header_format.font = "Arial Black";
header_format.color = 0xFFFFFF;
header_format.size = 20;
header.defaultTextFormat = header_format;
header.text = "New Version Available!";
var msgtext:TextField = new TextField();
msgtext.x = overlay_x;
msgtext.y = (overlay_y + 70);
msgtext.width = tw;
msgtext.height = 60;
msgtext.selectable = false;
var msgtext_format:TextFormat = new TextFormat();
msgtext_format.font = "Arial";
msgtext_format.color = 0xFFFFFF;
msgtext_format.size = 12;
msgtext_format.bold = true;
var msgtext_link:TextFormat = new TextFormat();
msgtext_link.font = "Arial";
msgtext_link.color = 0xFFFF00;
msgtext_link.size = 12;
msgtext_link.bold = true;
msgtext_link.url = redirect_url;
msgtext_link.target = "_blank";
if (version){
version = ("Version " + version);
} else {
version = "A new version";
};
msgtext.defaultTextFormat = msgtext_format;
msgtext.appendText((version + " is now available"));
if (movie_url){
msgtext.appendText(" at:\n");
msgtext.defaultTextFormat = msgtext_link;
msgtext.appendText(movie_url);
} else {
msgtext.appendText("!");
};
_root.addChild(overlay);
overlay.addChild(blankarea);
overlay.addChild(header);
overlay.addChild(msgtext);
overlay.addChild(close_x);
}
public static function onDenyHost(hostname:String, movie_url:String, redirect_url:String){
var sw:* = bridge.stage.stageWidth;
var sh:* = bridge.stage.stageHeight;
var tw:* = 350;
var th:* = 160;
var _root:* = bridge.root;
var overlay:MovieClip = new MovieClip();
overlay.graphics.beginFill(0x660000);
overlay.graphics.lineStyle(20, 0);
overlay.graphics.drawRect(0, 0, sw, sh);
overlay.graphics.endFill();
var blankarea:TextField = new TextField();
blankarea.x = 0;
blankarea.y = 0;
blankarea.width = sw;
blankarea.height = sh;
blankarea.selectable = false;
var header:TextField = new TextField();
header.x = Math.round(((sw - tw) / 2));
header.y = Math.round(((sh - th) / 2.5));
header.width = tw;
header.height = 100;
header.selectable = false;
var header_format:TextFormat = new TextFormat();
header_format.font = "Arial Black";
header_format.color = 0xFF0000;
header_format.size = 38;
header.defaultTextFormat = header_format;
header.text = "ERROR!";
var msgtext:TextField = new TextField();
msgtext.x = Math.round(((sw - tw) / 2));
msgtext.y = (Math.round(((sh - th) / 2.5)) + 80);
msgtext.width = tw;
msgtext.height = 80;
msgtext.selectable = false;
var msgtext_format:TextFormat = new TextFormat();
msgtext_format.font = "Arial";
msgtext_format.color = 0xFFFFFF;
msgtext_format.size = 12;
msgtext_format.bold = true;
var msgtext_link:TextFormat = new TextFormat();
msgtext_link.font = "Arial";
msgtext_link.color = 0xFFFF00;
msgtext_link.size = 12;
msgtext_link.bold = true;
msgtext_link.url = redirect_url;
msgtext_link.target = "_blank";
msgtext.defaultTextFormat = msgtext_format;
msgtext.appendText((("This movie has not been approved for use on " + hostname) + "\n"));
msgtext.appendText("For an approved copy, please visit:\n");
msgtext.defaultTextFormat = msgtext_link;
msgtext.appendText(movie_url);
_root.addChild(overlay);
overlay.addChild(blankarea);
overlay.addChild(header);
overlay.addChild(msgtext);
LC = new LocalConnection();
LC.send("xRPLUMBERS", "connectionHandler", "x_locked");
trace("sent");
}
public static function connectMovie(id:Number){
var _url:String;
var params:*;
if (!id){
SendError("Missing required 'id' parameter in NewgroundsAPI.connectMovie(id:Number)");
} else {
if (!linked){
SendError("Attempted to call MewgroundsAPI.connectMovie() without first calling NewgroundsAPI.linkAPI(this)");
} else {
if (!tracker_id){
SendMessage("Connecting to API gateway...");
tracker_id = id;
_url = bridge.root.loaderInfo.url;
host = _url.split("/")[2].toLowerCase();
if (host.length < 1){
host = "localhost";
};
params = new Object();
SendEvent(STAT_MOVIE_VIEWS);
};
};
};
}
public static function isInstalled(){
return (true);
}
}
}//package
Section 20
//Preloader (Preloader)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.text.*;
import SWFStats.*;
public class Preloader extends MovieClip {
private var AD:Class;
private var adBox:MovieClip;
private var Img:Class;
private var preloader:Shape;
private var progressText:TextField;
private static var playbutton:Sprite = new Sprite();
private static var ready:Boolean = false;
private static var Aub:Class = Preloader_Aub;
private static var buzz:Boolean = false;
private static var Play:Class = Preloader_Play;
private static var playb:Bitmap = new Play();
private static var aub:Bitmap = new Aub();
private static var skip:Boolean = false;
public function Preloader(){
Img = Preloader_Img;
AD = Preloader_AD;
super();
Log.View(247, "032d84ac-72dd-412e-9077-1ab97eca986e", root.loaderInfo.loaderURL);
MochiBot.track(this, "1b769028");
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
var _bg:Bitmap = new Img();
addChild(_bg);
var url:String = stage.loaderInfo.url;
var urlStart:Number = (url.indexOf("://") + 3);
var urlEnd:Number = url.indexOf("/", urlStart);
var domain:String = url.substring(urlStart, urlEnd);
var LastDot:Number = (domain.lastIndexOf(".") - 1);
var domEnd:Number = (domain.lastIndexOf(".", LastDot) + 1);
domain = domain.substring(domEnd, domain.length);
addChild(playbutton);
playbutton.addChild(playb);
playbutton.x = 90;
playbutton.y = -80;
playbutton.buttonMode = true;
playbutton.useHandCursor = true;
if (domain != "notdoppler.com"){
trace("spawning ad");
skip = true;
adBox = new AD();
addChild(adBox);
adBox.x = ((stage.stageWidth / 2) - (adBox.width / 2));
adBox.y = (((stage.stageHeight / 2) - (adBox.height / 2)) - 30);
};
addEventListener(Event.ENTER_FRAME, checkFrame);
loaderInfo.addEventListener(ProgressEvent.PROGRESS, progress);
preloader = new Shape();
preloader.graphics.beginFill(0xFFFFFF);
preloader.graphics.drawRect(0, 0, 8, 8);
preloader.graphics.endFill();
addChild(preloader);
addChild(aub);
playbutton.addEventListener(MouseEvent.MOUSE_OVER, overPlay);
playbutton.addEventListener(MouseEvent.MOUSE_OUT, outPlay);
playbutton.addEventListener(MouseEvent.CLICK, clickPlay);
progressText = new TextField();
var progressTextFormat:TextFormat = new TextFormat("_sans", 10, 0xFFFFFF, true);
progressTextFormat.align = TextFormatAlign.CENTER;
progressText.defaultTextFormat = progressTextFormat;
addChild(progressText);
stage.addEventListener(Event.RESIZE, onResize);
onResize();
}
private function outPlay(e:MouseEvent):void{
buzz = false;
}
private function startup():void{
stop();
removeChild(preloader);
removeChild(progressText);
removeChild(aub);
playbutton.removeEventListener(MouseEvent.MOUSE_OVER, overPlay);
playbutton.removeEventListener(MouseEvent.MOUSE_OUT, outPlay);
removeChild(playbutton);
if (skip){
trace("killing ad");
removeChild(adBox);
};
this.stage.frameRate = 50;
preloader = null;
progressText = null;
loaderInfo.removeEventListener(ProgressEvent.PROGRESS, progress);
var mainClass:Class = (getDefinitionByName("Main") as Class);
addChildAt((new (mainClass) as DisplayObject), 0);
}
private function progress(e:ProgressEvent):void{
if (progressText){
progressText.text = (Math.round(((e.bytesLoaded / e.bytesTotal) * 100)).toString() + " %");
};
if (preloader){
preloader.width = Math.round(((e.bytesLoaded / e.bytesTotal) * 600));
preloader.x = (680 - preloader.width);
aub.x = (preloader.x - 16);
progressText.x = 655;
};
}
private function onResize(e:Event=null):void{
if (preloader){
preloader.x = 80;
preloader.y = 420;
};
if (progressText){
progressText.x = 90;
progressText.y = 416;
};
aub.x = 80;
aub.y = 408;
}
private function overPlay(e:MouseEvent):void{
buzz = true;
}
private function clickPlay(e:MouseEvent):void{
ready = true;
playbutton.removeEventListener(MouseEvent.CLICK, clickPlay);
}
private function checkFrame(e:Event):void{
if (buzz){
playbutton.x = ((90 + (Math.random() * 3)) - 1);
};
if (currentFrame == totalFrames){
playbutton.y = 355;
if (ready){
removeEventListener(Event.ENTER_FRAME, checkFrame);
startup();
};
};
}
}
}//package
Section 21
//Preloader_AD (Preloader_AD)
package {
import mx.core.*;
import flash.utils.*;
public class Preloader_AD extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Preloader_AD(){
dataClass = Preloader_AD_dataClass;
super();
initialWidth = (6000 / 20);
initialHeight = (5000 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package
Section 22
//Preloader_AD_dataClass (Preloader_AD_dataClass)
package {
import mx.core.*;
public class Preloader_AD_dataClass extends ByteArrayAsset {
}
}//package
Section 23
//Preloader_Aub (Preloader_Aub)
package {
import mx.core.*;
public class Preloader_Aub extends BitmapAsset {
}
}//package
Section 24
//Preloader_Img (Preloader_Img)
package {
import mx.core.*;
public class Preloader_Img extends BitmapAsset {
}
}//package
Section 25
//Preloader_Play (Preloader_Play)
package {
import mx.core.*;
public class Preloader_Play extends BitmapAsset {
}
}//package