Section 1
//DefaultMedalIcon (com.newgrounds.assets.DefaultMedalIcon)
package com.newgrounds.assets {
import flash.display.*;
public dynamic class DefaultMedalIcon extends BitmapData {
public function DefaultMedalIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package com.newgrounds.assets
Section 2
//DefaultSaveIcon (com.newgrounds.assets.DefaultSaveIcon)
package com.newgrounds.assets {
import flash.display.*;
public dynamic class DefaultSaveIcon extends BitmapData {
public function DefaultSaveIcon(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package com.newgrounds.assets
Section 3
//APIConnector (com.newgrounds.components.APIConnector)
package com.newgrounds.components {
import flash.utils.*;
import flash.display.*;
import com.newgrounds.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.text.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.media.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class APIConnector extends MovieClip {
public var loader:Preloader;
public var ad:FlashAd;
public var __setPropDict:Dictionary;
public var apiId:String;
public var encryptionKey:String;
public var movieVersion:String;
public var debugMode:String;
public var connectorType:String;
public var redirectOnHostBlocked:Boolean;
public var redirectOnNewVersion:Boolean;
public var adType:String;
public var className:String;
public var _redirect:Boolean;
public function APIConnector(){
__setPropDict = new Dictionary(true);
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9, 9, frame10, 10, frame11, 11, frame12, 12, frame13, 13, frame14, 14, frame15, 15, frame16, 16, frame17, 17, frame18, 18, frame19, 19, frame20, 20, frame21);
}
public function _onLoaded():void{
var mainClass:Class;
var main:*;
gotoAndStop("invisible");
if (_redirect){
API.loadOfficialVersion();
return;
};
if (className){
try {
mainClass = (getDefinitionByName(className) as Class);
if (((mainClass) && (parent))){
main = new (mainClass);
parent.addChild(main);
parent.removeChild(this);
};
} catch(error) {
Logger.logError(("Unable to create main class: " + className));
};
};
}
public function _apiConnect():void{
var _local1:* = API;
if (((_local1) && (!(_local1.connected)))){
if (!apiId){
Logger.logError("No API ID entered in the API Connector component.", "You can create an API ID for this submission at http://newgrounds.com/account/flashapi", "Enter your API ID into the API Connector using the Component Inspector (Window -> Component Inspector).");
return;
};
switch (debugMode){
case "Off":
default:
_local1.debugMode = _local1.RELEASE_MODE;
break;
case "Simulate Logged-in User":
_local1.debugMode = _local1.DEBUG_MODE_LOGGED_IN;
break;
case "Simulate Logged-out User":
_local1.debugMode = _local1.DEBUG_MODE_LOGGED_OUT;
break;
case "Simulate New Version":
_local1.debugMode = _local1.DEBUG_MODE_NEW_VERSION;
break;
case "Simulate Host Blocked":
_local1.debugMode = _local1.DEBUG_MODE_HOST_BLOCKED;
break;
};
_local1.addEventListener(APIEvent.API_CONNECTED, _onConnected);
_local1.connect(root, apiId, encryptionKey, movieVersion);
};
}
public function _onConnected(_arg1:APIEvent):void{
if (((((redirectOnNewVersion) && (_arg1.success))) && (_arg1.data.newVersion))){
_redirect = true;
};
if (((((redirectOnHostBlocked) && (!(_arg1.success)))) && ((_arg1.error == APIEvent.ERROR_HOST_BLOCKED)))){
_redirect = true;
};
if (_redirect){
gotoAndStop("adPreloader");
forceAlwaysOnTop();
};
}
public function forceAlwaysOnTop():void{
var _local1:uint;
if (parent){
_local1 = (parent.numChildren - 1);
if (parent.getChildIndex(this) != _local1){
parent.setChildIndex(this, _local1);
};
};
if (stage){
x = ((stage.stageWidth - width) / 2);
y = ((stage.stageHeight - height) / 2);
visible = true;
};
if (((root) && ((root is MovieClip)))){
MovieClip(root).stop();
};
}
function __setProp_ad_APIConnector_AD_0(){
if ((((__setPropDict[ad] == undefined)) || (!((((int(__setPropDict[ad]) >= 1)) && ((int(__setPropDict[ad]) <= 21))))))){
__setPropDict[ad] = currentFrame;
try {
ad["componentInspectorSetting"] = true;
} catch(e:Error) {
};
ad.apiId = "";
ad.showBorder = true;
ad.adType = "Video";
try {
ad["componentInspectorSetting"] = false;
} catch(e:Error) {
};
};
}
function frame1(){
__setProp_ad_APIConnector_AD_0();
stop();
if (((root) && ((root is MovieClip)))){
MovieClip(root).stop();
};
x = int(x);
y = int(y);
if (!debugMode){
debugMode = "Simulate Logged-in User";
};
if (!connectorType){
connectorType = "Flash Ad + Preloader";
};
if (!adType){
adType = "Video";
};
if (ad){
ad.adType = adType;
};
switch (connectorType){
case "Flash Ad + Preloader":
gotoAndStop("adPreloader");
break;
case "Flash Ad Only":
gotoAndStop("ad");
break;
case "Invisible":
gotoAndStop("invisible");
break;
};
_apiConnect();
}
function frame2(){
__setProp_ad_APIConnector_AD_0();
}
function frame3(){
__setProp_ad_APIConnector_AD_0();
}
function frame4(){
__setProp_ad_APIConnector_AD_0();
}
function frame5(){
__setProp_ad_APIConnector_AD_0();
}
function frame6(){
__setProp_ad_APIConnector_AD_0();
}
function frame7(){
__setProp_ad_APIConnector_AD_0();
}
function frame8(){
__setProp_ad_APIConnector_AD_0();
}
function frame9(){
__setProp_ad_APIConnector_AD_0();
}
function frame10(){
__setProp_ad_APIConnector_AD_0();
}
function frame11(){
__setProp_ad_APIConnector_AD_0();
}
function frame12(){
__setProp_ad_APIConnector_AD_0();
}
function frame13(){
__setProp_ad_APIConnector_AD_0();
}
function frame14(){
__setProp_ad_APIConnector_AD_0();
}
function frame15(){
__setProp_ad_APIConnector_AD_0();
}
function frame16(){
__setProp_ad_APIConnector_AD_0();
}
function frame17(){
__setProp_ad_APIConnector_AD_0();
}
function frame18(){
__setProp_ad_APIConnector_AD_0();
}
function frame19(){
__setProp_ad_APIConnector_AD_0();
}
function frame20(){
__setProp_ad_APIConnector_AD_0();
}
function frame21(){
__setProp_ad_APIConnector_AD_0();
}
}
}//package com.newgrounds.components
Section 4
//FlashAd (com.newgrounds.components.FlashAd)
package com.newgrounds.components {
import flash.utils.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.text.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.media.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class FlashAd extends FlashAdBase {
public var newgroundsButton:SimpleButton;
public var playButton:MovieClip;
public var adContainer:MovieClip;
public function FlashAd(){
addFrameScript(0, frame1, 29, frame30);
}
public function onPlayClick(_arg1:MouseEvent):void{
removeAd();
if (parent){
parent.removeChild(this);
};
}
function frame1(){
stop();
}
function frame30(){
if (this["playButton"]){
this["playButton"].addEventListener(MouseEvent.CLICK, onPlayClick);
};
}
}
}//package com.newgrounds.components
Section 5
//FlashAdBase (com.newgrounds.components.FlashAdBase)
package com.newgrounds.components {
import flash.display.*;
import com.newgrounds.*;
import flash.events.*;
import flash.net.*;
import flash.system.*;
public class FlashAdBase extends MovieClip {
private var _showBorder:Boolean;// = true
public var showPlayButton:Boolean;
private var _fullScreen:Boolean;
public var adType:String;
public var VIDEO_ADS:String;// = "Video"
public var SIMPLE_ADS:String;// = "Simple"
private var _adFeedLoader:URLLoader;
private var _ad:Loader;
public function FlashAdBase(){
this.adType = this.VIDEO_ADS;
super();
try {
Security.allowDomain("server.cpmstar.com");
Security.allowInsecureDomain("server.cpmstar.com");
} catch(error) {
};
x = int(x);
y = int(y);
stop();
if (this["newgroundsButton"]){
this["newgroundsButton"].addEventListener(MouseEvent.CLICK, this.onNGClick);
};
addEventListener(Event.REMOVED_FROM_STAGE, this.onRemovedFromStage);
addEventListener(Event.ENTER_FRAME, this.init);
}
public function get _adContainer():Sprite{
return (this["adContainer"]);
}
public function get _newgroundsButton():DisplayObject{
return (this["newgroundsButton"]);
}
public function get fullScreen():Boolean{
return (this._fullScreen);
}
public function set fullScreen(_arg1:Boolean):void{
this._fullScreen = _arg1;
if (_arg1){
if (stage){
this.drawFullScreenRect();
} else {
addEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage);
};
} else {
graphics.clear();
};
}
public function get showBorder():Boolean{
return (this._showBorder);
}
public function set showBorder(_arg1:Boolean):void{
this._showBorder = _arg1;
if (this._showBorder){
if (this._ad){
if (this._ad.content){
if (this.showPlayButton){
gotoAndStop("loadedPlay");
} else {
gotoAndStop("loaded");
};
} else {
gotoAndStop("loading");
};
} else {
gotoAndStop("idle");
};
} else {
gotoAndStop("noBorder");
};
}
private function init(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, this.init);
if (API.adFeedURL){
this.loadAdFeed();
} else {
API.addEventListener(APIEvent.API_CONNECTED, this.loadAdFeed);
};
}
private function loadAdFeed(_arg1:APIEvent=null):void{
var event = _arg1;
if (!API.adFeedURL){
return;
};
if (this._showBorder){
gotoAndStop("loading");
};
this._adFeedLoader = new URLLoader();
this._adFeedLoader.addEventListener(Event.COMPLETE, this.onAdFeedLoaded);
this._adFeedLoader.addEventListener(IOErrorEvent.IO_ERROR, this.onAdError);
this._adFeedLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.onAdError);
var adFeedRequest:URLRequest = new URLRequest(API.adFeedURL);
try {
this._adFeedLoader.load(adFeedRequest);
} catch(e:Error) {
onAdError();
};
}
private function onAdFeedLoaded(_arg1:Event):void{
if (((((this._adFeedLoader) && (this._adFeedLoader.data))) && (!((this._adFeedLoader.data == ""))))){
this.loadAd(this._adFeedLoader.data);
} else {
this.onAdError();
};
}
private function loadAd(_arg1:String):void{
var adURL = _arg1;
if (this._ad){
this.removeAd();
};
Logger.logMessage("Loading flash ad...");
this._ad = new Loader();
this._ad.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.onAdError);
try {
Object(this._ad.contentLoaderInfo).uncaughtErrorEvents.addEventListener("uncaughtError", function (_arg1:Event):void{
_arg1.preventDefault();
});
} catch(error:Error) {
};
try {
if (this.adType != this.VIDEO_ADS){
if (adURL.indexOf("?") >= 0){
adURL = (adURL + "&");
} else {
adURL = (adURL + "?");
};
adURL = (adURL + "blockoverlays=1");
};
this._ad.load(new URLRequest(adURL), new LoaderContext(false, new ApplicationDomain(null)));
if (this._adContainer){
this._adContainer.addChild(this._ad);
};
if (this._showBorder){
if (this.showPlayButton){
gotoAndStop("loadedPlay");
} else {
gotoAndStop("loaded");
};
};
} catch(error:Error) {
onAdError();
};
}
private function drawFullScreenRect():void{
if (stage){
x = ((stage.stageWidth - width) / 2);
y = ((stage.stageHeight - height) / 2);
graphics.beginFill(0);
graphics.drawRect(-(stage.stageWidth), -(stage.stageHeight), (stage.stageWidth * 2), (stage.stageHeight * 2));
graphics.endFill();
};
}
public function removeAd():void{
removeEventListener(Event.REMOVED_FROM_STAGE, this.onRemovedFromStage);
if (this._adFeedLoader){
try {
this._adFeedLoader.close();
} catch(e:Error) {
};
};
if (this._ad){
try {
this._ad.close();
} catch(e:Error) {
};
try {
Object(this._ad).unloadAndStop(true);
} catch(e:Error) {
_ad.unload();
};
if (this._ad.parent){
this._ad.parent.removeChild(this._ad);
};
this._ad = null;
};
Logger.logError("Ad destroyed.");
}
private function onAdError(_arg1:Event=null):void{
Logger.logError("Unable to load ad.");
this.removeAd();
}
private function onRemovedFromStage(_arg1:Event):void{
this.removeAd();
}
private function onAddedToStage(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, this.onAddedToStage);
if (this.fullScreen){
this.drawFullScreenRect();
};
}
private function onNGClick(_arg1:MouseEvent):void{
API.loadNewgrounds();
}
}
}//package com.newgrounds.components
Section 6
//Preloader (com.newgrounds.components.Preloader)
package com.newgrounds.components {
import flash.utils.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import flash.text.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.media.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class Preloader extends MovieClip {
public var loadingBar:MovieClip;
public var playButton:MovieClip;
public var autoPlay:Boolean;
public var className:String;
public function Preloader(){
addFrameScript(0, frame1, 9, frame10);
}
public function enterFrameHandler(_arg1:Event):void{
var _local2:Number = 0;
if (loaderInfo){
_local2 = (loaderInfo.bytesLoaded / loaderInfo.bytesTotal);
};
if (loadingBar){
loadingBar.gotoAndStop((int((_local2 * (loadingBar.totalFrames - 1))) + 1));
};
if (_local2 >= 1){
removeEventListener(Event.ENTER_FRAME, enterFrameHandler);
gotoAndStop("loaded");
};
}
public function _onPlayClick(_arg1:MouseEvent):void{
var _local2:MovieClip = (root as MovieClip);
var _local3:MovieClip = (parent as MovieClip);
if (_local2){
_local2.play();
_local2.nextFrame();
};
if (((_local3) && (_local3._onLoaded))){
_local3._onLoaded();
};
}
function frame1(){
stop();
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
function frame10(){
if (playButton){
playButton.addEventListener(MouseEvent.CLICK, _onPlayClick);
playButton.stop();
playButton.buttonMode = true;
};
if (autoPlay){
_onPlayClick(null);
};
}
}
}//package com.newgrounds.components
Section 7
//MD5 (com.newgrounds.crypto.MD5)
package com.newgrounds.crypto {
import flash.utils.*;
public class MD5 {
public static var digest:ByteArray;
private static var hexChars:String = "0123456789abcdef";
public static function hash(_arg1:String):String{
var _local2:ByteArray = new ByteArray();
_local2.writeUTFBytes(_arg1);
return (hashBinary(_local2));
}
public static function hashBytes(_arg1:ByteArray):String{
return (hashBinary(_arg1));
}
public static function hashBinary(_arg1:ByteArray):String{
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local2 = 1732584193;
var _local3 = -271733879;
var _local4 = -1732584194;
var _local5 = 271733878;
var _local10:Array = createBlocks(_arg1);
var _local11:int = _local10.length;
var _local12:int;
while (_local12 < _local11) {
_local6 = _local2;
_local7 = _local3;
_local8 = _local4;
_local9 = _local5;
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 0))], 7, -680876936);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 1))], 12, -389564586);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 2))], 17, 606105819);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 3))], 22, -1044525330);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 4))], 7, -176418897);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 5))], 12, 1200080426);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 6))], 17, -1473231341);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 7))], 22, -45705983);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 8))], 7, 1770035416);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 9))], 12, -1958414417);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 10))], 17, -42063);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 11))], 22, -1990404162);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 12))], 7, 1804603682);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 13))], 12, -40341101);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 14))], 17, -1502002290);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 15))], 22, 1236535329);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 1))], 5, -165796510);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 6))], 9, -1069501632);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 11))], 14, 643717713);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 0))], 20, -373897302);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 5))], 5, -701558691);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 10))], 9, 38016083);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 15))], 14, -660478335);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 4))], 20, -405537848);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 9))], 5, 568446438);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 14))], 9, -1019803690);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 3))], 14, -187363961);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 8))], 20, 1163531501);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 13))], 5, -1444681467);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 2))], 9, -51403784);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 7))], 14, 1735328473);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 12))], 20, -1926607734);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 5))], 4, -378558);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 8))], 11, -2022574463);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 11))], 16, 1839030562);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 14))], 23, -35309556);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 1))], 4, -1530992060);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 4))], 11, 1272893353);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 7))], 16, -155497632);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 10))], 23, -1094730640);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 13))], 4, 681279174);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 0))], 11, -358537222);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 3))], 16, -722521979);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 6))], 23, 76029189);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 9))], 4, -640364487);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 12))], 11, -421815835);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 15))], 16, 530742520);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 2))], 23, -995338651);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 0))], 6, -198630844);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 7))], 10, 1126891415);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 14))], 15, -1416354905);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 5))], 21, -57434055);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 12))], 6, 1700485571);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 3))], 10, -1894986606);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 10))], 15, -1051523);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 1))], 21, -2054922799);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 8))], 6, 1873313359);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 15))], 10, -30611744);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 6))], 15, -1560198380);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 13))], 21, 1309151649);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 4))], 6, -145523070);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 11))], 10, -1120210379);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 2))], 15, 718787259);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 9))], 21, -343485551);
_local2 = (_local2 + _local6);
_local3 = (_local3 + _local7);
_local4 = (_local4 + _local8);
_local5 = (_local5 + _local9);
_local12 = (_local12 + 16);
};
digest = new ByteArray();
digest.writeInt(_local2);
digest.writeInt(_local3);
digest.writeInt(_local4);
digest.writeInt(_local5);
digest.position = 0;
return ((((toHex(_local2) + toHex(_local3)) + toHex(_local4)) + toHex(_local5)));
}
private static function f(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 & _arg2) | (~(_arg1) & _arg3)));
}
private static function g(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 & _arg3) | (_arg2 & ~(_arg3))));
}
private static function h(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 ^ _arg2) ^ _arg3));
}
private static function i(_arg1:int, _arg2:int, _arg3:int):int{
return ((_arg2 ^ (_arg1 | ~(_arg3))));
}
private static function transform(_arg1:Function, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int, _arg8:int):int{
var _local9:int = (((_arg2 + int(_arg1(_arg3, _arg4, _arg5))) + _arg6) + _arg8);
return ((rol(_local9, _arg7) + _arg3));
}
private static function ff(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(f, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function gg(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(g, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function hh(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(h, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function ii(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(i, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function createBlocks(_arg1:ByteArray):Array{
var _local2:Array = new Array();
var _local3:int = (_arg1.length * 8);
var _local4 = 0xFF;
var _local5:int;
while (_local5 < _local3) {
_local2[int((_local5 >> 5))] = (_local2[int((_local5 >> 5))] | ((_arg1[(_local5 / 8)] & _local4) << (_local5 % 32)));
_local5 = (_local5 + 8);
};
_local2[int((_local3 >> 5))] = (_local2[int((_local3 >> 5))] | (128 << (_local3 % 32)));
_local2[int(((((_local3 + 64) >>> 9) << 4) + 14))] = _local3;
return (_local2);
}
public static function rol(_arg1:int, _arg2:int):int{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
public static function ror(_arg1:int, _arg2:int):uint{
var _local3:int = (32 - _arg2);
return (((_arg1 << _local3) | (_arg1 >>> (32 - _local3))));
}
public static function toHex(_arg1:int, _arg2:Boolean=false):String{
var _local4:int;
var _local5:int;
var _local3 = "";
if (_arg2){
_local4 = 0;
while (_local4 < 4) {
_local3 = (_local3 + (hexChars.charAt(((_arg1 >> (((3 - _local4) * 8) + 4)) & 15)) + hexChars.charAt(((_arg1 >> ((3 - _local4) * 8)) & 15))));
_local4++;
};
} else {
_local5 = 0;
while (_local5 < 4) {
_local3 = (_local3 + (hexChars.charAt(((_arg1 >> ((_local5 * 8) + 4)) & 15)) + hexChars.charAt(((_arg1 >> (_local5 * 8)) & 15))));
_local5++;
};
};
return (_local3);
}
}
}//package com.newgrounds.crypto
Section 8
//RC4 (com.newgrounds.crypto.RC4)
package com.newgrounds.crypto {
public class RC4 {
private static var sbox:Array = new Array(0xFF);
private static var mykey:Array = new Array(0xFF);
public static function encrypt(_arg1:String, _arg2:String):String{
var _local3:Array = strToChars(_arg1);
var _local4:Array = strToChars(_arg2);
var _local5:Array = calculate(_local3, _local4);
return (charsToHex(_local5));
}
public static function encryptbin(_arg1:String, _arg2:String):Array{
var _local3:Array = strToChars(_arg1);
var _local4:Array = strToChars(_arg2);
var _local5:Array = calculate(_local3, _local4);
return (_local5);
}
public static function decrypt(_arg1:String, _arg2:String):String{
var _local3:Array = hexToChars(_arg1);
var _local4:Array = strToChars(_arg2);
var _local5:Array = calculate(_local3, _local4);
return (charsToStr(_local5));
}
private static function initialize(_arg1:Array):void{
var _local3:uint;
var _local2:uint;
var _local4:uint = _arg1.length;
var _local5:uint;
while (_local5 <= 0xFF) {
mykey[_local5] = _arg1[(_local5 % _local4)];
sbox[_local5] = _local5;
_local5++;
};
_local5 = 0;
while (_local5 <= 0xFF) {
_local2 = (((_local2 + sbox[_local5]) + mykey[_local5]) % 0x0100);
_local3 = sbox[_local5];
sbox[_local5] = sbox[_local2];
sbox[_local2] = _local3;
_local5++;
};
}
private static function calculate(_arg1:Array, _arg2:Array):Array{
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local10:uint;
initialize(_arg2);
var _local3:uint;
var _local4:uint;
var _local5:Array = new Array();
var _local9:uint;
while (_local9 < _arg1.length) {
_local3 = ((_local3 + 1) % 0x0100);
_local4 = ((_local4 + sbox[_local3]) % 0x0100);
_local7 = sbox[_local3];
sbox[_local3] = sbox[_local4];
sbox[_local4] = _local7;
_local10 = ((sbox[_local3] + sbox[_local4]) % 0x0100);
_local6 = sbox[_local10];
_local8 = (_arg1[_local9] ^ _local6);
_local5.push(_local8);
_local9++;
};
return (_local5);
}
private static function charsToHex(_arg1:Array):String{
var _local2:String = new String("");
var _local3:Array = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
var _local4:uint;
while (_local4 < _arg1.length) {
_local2 = (_local2 + (_local3[(_arg1[_local4] >> 4)] + _local3[(_arg1[_local4] & 15)]));
_local4++;
};
return (_local2);
}
private static function hexToChars(_arg1:String):Array{
var _local2:Array = new Array();
var _local3:uint = ((_arg1.substr(0, 2))=="0x") ? 2 : 0;
while (_local3 < _arg1.length) {
_local2.push(parseInt(_arg1.substr(_local3, 2), 16));
_local3 = (_local3 + 2);
};
return (_local2);
}
private static function charsToStr(_arg1:Array):String{
var _local2:String = new String("");
var _local3:uint;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode(_arg1[_local3]));
_local3++;
};
return (_local2);
}
private static function strToChars(_arg1:String):Array{
var _local2:Array = new Array();
var _local3:uint;
while (_local3 < _arg1.length) {
_local2.push(_arg1.charCodeAt(_local3));
_local3++;
};
return (_local2);
}
}
}//package com.newgrounds.crypto
Section 9
//decodeJson (com.newgrounds.encoders.json.decodeJson)
package com.newgrounds.encoders.json {
public const decodeJson:Function = initDecodeJson();
}//package com.newgrounds.encoders.json
import flash.utils.*;
private const initDecodeJson:Function = function ():Function{
var position:uint;
var byteInput:ByteArray;
var char:uint;
var charConvert:ByteArray;
var isNumberChar:ByteArray;
var stringHelper:ByteArray;
var isWhitespace:ByteArray;
var parseNumber:Function;
var parseWhitespace:Function;
var parse:Object;
charConvert = new ByteArray();
(charConvert.length = 0x0100);
(charConvert[34] = 34);
(charConvert[92] = 92);
(charConvert[47] = 47);
(charConvert[98] = 8);
(charConvert[102] = 12);
(charConvert[110] = 10);
(charConvert[114] = 13);
(charConvert[116] = 9);
isNumberChar = new ByteArray();
(isNumberChar.length = 0x0100);
(isNumberChar[43] = 1);
(isNumberChar[45] = 1);
(isNumberChar[46] = 1);
(isNumberChar[48] = 1);
(isNumberChar[49] = 1);
(isNumberChar[50] = 1);
(isNumberChar[51] = 1);
(isNumberChar[52] = 1);
(isNumberChar[53] = 1);
(isNumberChar[54] = 1);
(isNumberChar[55] = 1);
(isNumberChar[56] = 1);
(isNumberChar[57] = 1);
(isNumberChar[69] = 1);
(isNumberChar[101] = 1);
stringHelper = new ByteArray();
(stringHelper.length = 0x0100);
var i:int;
while (i < 0x0100) {
i = (i + 1);
var _local2 = i;
(stringHelper[_local2] = 1);
};
(stringHelper[34] = 0);
(stringHelper[92] = 0);
isWhitespace = new ByteArray();
(isWhitespace.length = 0x0100);
(isWhitespace[9] = 1);
(isWhitespace[10] = 1);
(isWhitespace[13] = 1);
(isWhitespace[32] = 1);
parseNumber = function ():Number{
if (position === 1){
(byteInput.position = 0);
return (parseFloat(byteInput.readUTFBytes(byteInput.length)));
};
(byteInput.position = (position - 1));
do {
} while (isNumberChar[byteInput[position++]]);
return (Number(byteInput.readUTFBytes(((position-- - byteInput.position) - 1))));
};
parseWhitespace = function ():Object{
while (isWhitespace[byteInput[position]]) {
position++;
};
return (parse[byteInput[position++]]());
};
var parseStringEscaped:Function = function (_arg1:String):String{
do {
if ((char = byteInput[position++]) === 117){
(byteInput.position = position);
(char = parseInt(byteInput.readUTFBytes(4), 16));
(position = (position + 4));
} else {
if (!(char = charConvert[char])){
throw (new Error(("Unknown escaped character encountered at position " + (position - 1))));
};
(byteInput.position = position);
};
_arg1 = (_arg1 + String.fromCharCode(char));
_arg1;
do {
} while (stringHelper[byteInput[position++]]);
if ((position - 1) > byteInput.position){
_arg1 = (_arg1 + byteInput.readUTFBytes(((position - 1) - byteInput.position)));
_arg1;
};
} while (byteInput[(position - 1)] === 92);
return (_arg1);
};
parse = {34:function ():String{
if (stringHelper[byteInput[position++]]){
(byteInput.position = (position - 1));
do {
} while (stringHelper[byteInput[position++]]);
if (byteInput[(position - 1)] === 92){
return (parseStringEscaped(byteInput.readUTFBytes(((position - 1) - byteInput.position))));
};
return (byteInput.readUTFBytes(((position - 1) - byteInput.position)));
//unresolved jump
};
if (byteInput[(position - 1)] === 92){
return (parseStringEscaped(""));
};
return ("");
}, 123:function ():Object{
var _local2:*;
while (isWhitespace[byteInput[position]]) {
position++;
};
if (byteInput[position] === 125){
position++;
return ({});
};
var _local1:* = {};
do {
do {
_local2 = parse[byteInput[position++]]();
_local2;
if (byteInput[position] !== 58){
while (isWhitespace[byteInput[position]]) {
position++;
};
if (byteInput[position++] !== 58){
throw (new Error(("Expected : at " + (position - 1))));
};
} else {
position++;
};
var _temp1 = _local2;
(_local1[_temp1] = parse[byteInput[position++]]());
} while (byteInput[position++] === 44);
if (byteInput[(position - 1)] === 125){
return (_local1);
};
while (isWhitespace[byteInput[position]]) {
position++;
};
} while (byteInput[position++] === 44);
if (byteInput[(position - 1)] !== 125){
throw (new Error(("Expected , or } at " + (position - 1))));
};
return (_local1);
}, 91:function ():Object{
while (isWhitespace[byteInput[position]]) {
position++;
};
if (byteInput[position] === 93){
position++;
return ([]);
};
var _local1:* = [];
do {
do {
(_local1[_local1.length] = parse[byteInput[position++]]());
} while (byteInput[position++] === 44);
if (byteInput[(position - 1)] === 93){
return (_local1);
};
position--;
while (isWhitespace[byteInput[position]]) {
position++;
};
} while (byteInput[position++] === 44);
if (byteInput[(position - 1)] !== 93){
throw (new Error(("Expected , or ] at " + (position - 1))));
};
return (_local1);
}, 116:function ():Boolean{
if ((((((byteInput[position] === 114)) && ((byteInput[(position + 1)] === 117)))) && ((byteInput[(position + 2)] === 101)))){
(position = (position + 3));
return (true);
};
throw (new Error(("Expected \"true\" at position " + position)));
}, 102:function ():Boolean{
if ((((((((byteInput[position] === 97)) && ((byteInput[(position + 1)] === 108)))) && ((byteInput[(position + 2)] === 115)))) && ((byteInput[(position + 3)] === 101)))){
(position = (position + 4));
return (false);
};
throw (new Error(("Expected \"false\" at position " + (position - 1))));
}, 110:function ():Object{
if ((((((byteInput[position] === 117)) && ((byteInput[(position + 1)] === 108)))) && ((byteInput[(position + 2)] === 108)))){
(position = (position + 3));
return (null);
};
throw (new Error(("Expected \"null\" at position " + position)));
}, 110:function ():void{
throw (new Error(("Unexpected end of array at " + position)));
}, 125:function ():void{
throw (new Error(("Unexpected end of object at " + position)));
}, 44:function ():void{
throw (new Error(("Unexpected comma at " + position)));
}, 45:parseNumber, 48:parseNumber, 49:parseNumber, 50:parseNumber, 51:parseNumber, 52:parseNumber, 53:parseNumber, 54:parseNumber, 55:parseNumber, 56:parseNumber, 57:parseNumber, 13:parseWhitespace, 10:parseWhitespace, 9:parseWhitespace, 32:parseWhitespace};
return (function (_arg1):Object{
var input = _arg1;
if ((input is String)){
(byteInput = new ByteArray());
byteInput.writeUTFBytes((input as String));
} else {
if ((input is ByteArray)){
(byteInput = (input as ByteArray));
} else {
throw (new Error((("Unexpected input <" + input) + ">")));
};
};
(position = 0);
try {
return (parse[byteInput[position++]]());
} catch(e:TypeError) {
if ((position - 1) < byteInput.length){
(e.message = ((((((((("Unexpected character " + String.fromCharCode(byteInput[(position - 1)])) + " (0x") + byteInput[(position - 1)].toString(16)) + ")") + " at position ") + (position - 1)) + " (") + e.message) + ")"));
};
throw (e);
};
return (null);
});
};
Section 10
//encodeJson (com.newgrounds.encoders.json.encodeJson)
package com.newgrounds.encoders.json {
public const encodeJson:Function = initDecodeJson();
}//package com.newgrounds.encoders.json
import flash.utils.*;
private const initDecodeJson:Function = function ():Function{
var result:IDataOutput;
var i:int;
var j:int;
var strLen:int;
var str:String;
var char:int;
var tempBytes:ByteArray;
var blockNonFiniteNumbers:Boolean;
var charConvert:Array;
var parseString:Function;
var parse:Object;
tempBytes = new ByteArray();
charConvert = new Array(0x0100);
j = 0;
while (j < 10) {
(charConvert[j] = ((j + 48) | 808464384));
j = (j + 1);
};
while (j < 16) {
(charConvert[j] = ((j + 55) | 808464384));
j = (j + 1);
};
while (j < 26) {
(charConvert[j] = ((j + 32) | 808464640));
j = (j + 1);
};
while (j < 32) {
(charConvert[j] = ((j + 39) | 808464640));
j = (j + 1);
};
while (j < 0x0100) {
(charConvert[j] = j);
j = (j + 1);
};
(charConvert[10] = 23662);
(charConvert[13] = 23666);
(charConvert[9] = 23668);
(charConvert[8] = 23650);
(charConvert[12] = 23654);
(charConvert[8] = 23650);
(charConvert[34] = 23586);
(charConvert[92] = 0x5C5C);
(charConvert[127] = 808466246);
var parseArray:Function = function (_arg1:Array):void{
result.writeByte(91);
var _local2:int;
var _local3:int = (_arg1.length - 1);
if (_local3 >= 0){
while (_local2 < _local3) {
parse[typeof(_arg1[_local2])](_arg1[_local2]);
result.writeByte(44);
var _temp1 = _local2;
_local2 = (_local2 + 1);
_temp1;
};
parse[typeof(_arg1[_local2])](_arg1[_local2]);
};
result.writeByte(93);
};
parseString = function (_arg1:String):void{
result.writeByte(34);
(tempBytes.position = 0);
(tempBytes.length = 0);
tempBytes.writeUTFBytes(_arg1);
(i = 0);
(j = 0);
(strLen = tempBytes.length);
while (j < strLen) {
(char = charConvert[tempBytes[j++]]);
if (char > 0x0100){
if ((j - 1) > i){
result.writeBytes(tempBytes, i, ((j - 1) - i));
};
if (char > 65536){
result.writeShort(23669);
result.writeUnsignedInt(char);
} else {
result.writeShort(char);
};
(i = j);
};
};
if (strLen > i){
result.writeBytes(tempBytes, i, (strLen - i));
};
result.writeByte(34);
};
parse = {object:function (_arg1:Object):void{
var _local2:*;
if (_arg1){
if ((_arg1 is Array)){
parseArray(_arg1);
} else {
result.writeByte(123);
_local2 = true;
for (str in _arg1) {
if (_local2){
_local2 = false;
_local2;
} else {
result.writeByte(44);
};
parseString(str);
result.writeByte(58);
parse[typeof(_arg1[str])](_arg1[str]);
};
result.writeByte(125);
};
} else {
result.writeUnsignedInt(1853189228);
};
}, string:parseString, number:function (_arg1:Number):void{
if (((blockNonFiniteNumbers) && (!(isFinite(_arg1))))){
throw (new Error((("Number " + _arg1) + " is not encodable")));
};
result.writeUTFBytes(String(_arg1));
}, boolean:function (_arg1:Boolean):void{
if (_arg1){
result.writeUnsignedInt(1953658213);
} else {
result.writeByte(102);
result.writeUnsignedInt(1634497381);
};
}, xml:function (_arg1:Object):void{
if ((((!(_arg1.toXMLString) is Function)) || ((_temp2 == null)))){
throw (new Error("unserializable XML object encountered"));
};
parseString(_arg1);
}, undefined:function (_arg1:Boolean):void{
result.writeUnsignedInt(1853189228);
}};
return (function (_arg1:Object, _arg2:IDataOutput=null, _arg3:Boolean=false):String{
var byteOutput:*;
var input = _arg1;
var writeTo = _arg2;
var strictNumberSupport = _arg3;
(blockNonFiniteNumbers = strictNumberSupport);
try {
if (writeTo){
(result = writeTo);
(result.endian = "bigEndian");
parse[typeof(input)](input);
(byteOutput.position = 0);
return (byteOutput.readUTFBytes(byteOutput.length));
} else {
switch (typeof(input)){
case "xml":
if ((((!(input.toXMLString) is Function)) || ((_local5 == null)))){
throw (new Error("unserializable XML object encountered"));
};
case "object":
case "string":
var _local5 = new ByteArray();
byteOutput = _local5;
(result = _local5);
(result.endian = "bigEndian");
parse[typeof(input)](input);
(byteOutput.position = 0);
return (byteOutput.readUTFBytes(byteOutput.length));
case "number":
if (((blockNonFiniteNumbers) && (!(isFinite((input as Number)))))){
throw (new Error((("Number " + input) + " is not encodable")));
};
return (String(input));
case "boolean":
return ((input) ? "true" : "false");
case "undefined":
return ("null");
default:
throw (new Error((("Unexpected type \"" + typeof(input)) + "\" encountered")));
};
};
} catch(e:TypeError) {
throw (new Error("Unexpected type encountered"));
};
return (null);
});
};
Section 11
//JSON (com.newgrounds.encoders.json.JSON)
package com.newgrounds.encoders.json {
public class JSON {
public static function encode(_arg1:Object):String{
return (encodeJson(_arg1));
}
public static function decode(_arg1:String):Object{
return (decodeJson(_arg1));
}
}
}//package com.newgrounds.encoders.json
Section 12
//BaseN (com.newgrounds.encoders.BaseN)
package com.newgrounds.encoders {
import flash.utils.*;
public class BaseN {
private var _hash:String;
private var _base:uint;
private var _reverseHash:Dictionary;
private static const DEFAULT_HASH:String = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~@#$%^&*()+|;/";
public function BaseN(_arg1:String){
if (_arg1){
this._hash = _arg1;
} else {
this._hash = DEFAULT_HASH;
};
this._base = this._hash.length;
this._reverseHash = new Dictionary();
var _local2:uint;
while (_local2 < this._hash.length) {
this._reverseHash[this._hash.charAt(_local2)] = _local2;
_local2++;
};
}
public function encodeUint(_arg1:uint, _arg2:uint=1):String{
var _local3 = "";
var _local4:uint = _arg1;
while (_local4 != 0) {
_local3 = (this._hash.charAt((_local4 % this._base)) + _local3);
_local4 = (_local4 / this._base);
};
while (_local3.length < _arg2) {
_local3 = (this._hash.charAt(0) + _local3);
};
return (_local3);
}
public function decodeUint(_arg1:String):uint{
var _local2:uint;
var _local3:uint;
while (_local3 < _arg1.length) {
_local2 = (_local2 * this._base);
_local2 = (_local2 + this._reverseHash[_arg1.charAt(_local3)]);
_local3++;
};
return (_local2);
}
}
}//package com.newgrounds.encoders
Section 13
//PNGEncoder (com.newgrounds.encoders.PNGEncoder)
package com.newgrounds.encoders {
import flash.utils.*;
import flash.display.*;
import flash.geom.*;
public class PNGEncoder {
private static var crcTable:Array;
private static var crcTableComputed:Boolean = false;
public static function encode(_arg1:BitmapData):ByteArray{
var _local6:uint;
var _local7:int;
var _local2:ByteArray = new ByteArray();
_local2.writeUnsignedInt(2303741511);
_local2.writeUnsignedInt(218765834);
var _local3:ByteArray = new ByteArray();
_local3.writeInt(_arg1.width);
_local3.writeInt(_arg1.height);
_local3.writeUnsignedInt(134610944);
_local3.writeByte(0);
writeChunk(_local2, 1229472850, _local3);
var _local4:ByteArray = new ByteArray();
var _local5:int;
while (_local5 < _arg1.height) {
_local4.writeByte(0);
if (!_arg1.transparent){
_local7 = 0;
while (_local7 < _arg1.width) {
_local6 = _arg1.getPixel(_local7, _local5);
_local4.writeUnsignedInt(uint((((_local6 & 0xFFFFFF) << 8) | 0xFF)));
_local7++;
};
} else {
_local7 = 0;
while (_local7 < _arg1.width) {
_local6 = _arg1.getPixel32(_local7, _local5);
_local4.writeUnsignedInt(uint((((_local6 & 0xFFFFFF) << 8) | (_local6 >>> 24))));
_local7++;
};
};
_local5++;
};
_local4.compress();
writeChunk(_local2, 1229209940, _local4);
writeChunk(_local2, 1229278788, null);
return (_local2);
}
private static function writeChunk(_arg1:ByteArray, _arg2:uint, _arg3:ByteArray):void{
var _local8:uint;
var _local9:uint;
var _local10:uint;
if (!crcTableComputed){
crcTableComputed = true;
crcTable = [];
_local9 = 0;
while (_local9 < 0x0100) {
_local8 = _local9;
_local10 = 0;
while (_local10 < 8) {
if ((_local8 & 1)){
_local8 = uint((uint(3988292384) ^ uint((_local8 >>> 1))));
} else {
_local8 = uint((_local8 >>> 1));
};
_local10++;
};
crcTable[_local9] = _local8;
_local9++;
};
};
var _local4:uint;
if (_arg3 != null){
_local4 = _arg3.length;
};
_arg1.writeUnsignedInt(_local4);
var _local5:uint = _arg1.position;
_arg1.writeUnsignedInt(_arg2);
if (_arg3 != null){
_arg1.writeBytes(_arg3);
};
var _local6:uint = _arg1.position;
_arg1.position = _local5;
_local8 = 4294967295;
var _local7:int;
while (_local7 < (_local6 - _local5)) {
_local8 = uint((crcTable[((_local8 ^ _arg1.readUnsignedByte()) & uint(0xFF))] ^ uint((_local8 >>> 8))));
_local7++;
};
_local8 = uint((_local8 ^ uint(4294967295)));
_arg1.position = _local6;
_arg1.writeUnsignedInt(_local8);
}
}
}//package com.newgrounds.encoders
Section 14
//APIShim (com.newgrounds.shims.APIShim)
package com.newgrounds.shims {
import flash.display.*;
import com.newgrounds.*;
import com.newgrounds.components.*;
public class APIShim extends MovieClip {
private var __a:API;
private var __b:FlashAdBase;
}
}//package com.newgrounds.shims
Section 15
//API (com.newgrounds.API)
package com.newgrounds {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import com.newgrounds.encoders.json.*;
import com.newgrounds.crypto.*;
import flash.system.*;
public class API {
public static const RELEASE_MODE:String = "releaseMode";
public static const DEBUG_MODE_LOGGED_IN:String = "debugModeLoggedIn";
public static const DEBUG_MODE_LOGGED_OUT:String = "debugModeLoggedOut";
public static const DEBUG_MODE_NEW_VERSION:String = "debugModeNewVersion";
public static const DEBUG_MODE_HOST_BLOCKED:String = "debugModeHostBlocked";
private static const TEST_AD_FEED_URL:String = "http://www.ngads.com/adtest.php";
public static const VERSION:String = "3.1.0 AS3";
private static var _bridge:Bridge;
private static var _dispatcher:APIEventDispatcher = new APIEventDispatcher();
private static var _movieName:String;
private static var _movieVersion:String;
private static var _root:DisplayObject;
private static var _connection:APIConnection = new APIConnection();
private static var _debugMode:String = "debugModeLoggedIn";
private static var _newVersion:Boolean;
private static var _adsApproved:Boolean = false;
private static var _adFeedURL:String;
private static var _medals:Object = new Object();
private static var _medalsArray:Array = [];
private static var _scoreBoards:Object = new Object();
private static var _scoreBoardsArray:Array = [];
private static var _saveGroups:Object = new Object();
private static var _saveGroupsArray:Array = [];
private static var _imageFilePath:String;
private static var _saveFilePath:String;
private static var _sharedObjects:Object = new Object();
private static var _requestedSaveFileId:uint;
private static var _requestedSaveGroupId:uint;
public static function get connected():Boolean{
return (_connection.connected);
}
public static function get isNetworkHost():Boolean{
return (_connection.isNetworkHost);
}
public static function get apiId():String{
_connection.assertInitialized();
return (_connection.apiId);
}
public static function get debugMode():String{
return (_debugMode);
}
public static function set debugMode(_arg1:String):void{
_debugMode = _arg1;
}
public static function get publisherId():uint{
_connection.assertInitialized();
return (_connection.publisherId);
}
public static function get sessionId():String{
_connection.assertInitialized();
return (_connection.sessionId);
}
public static function get hostDomain():String{
_connection.assertInitialized();
return (_connection.hostDomain);
}
public static function get hostURL():String{
_connection.assertInitialized();
return (_connection.hostURL);
}
public static function get isNewgrounds():Boolean{
return ((_connection.publisherId == 1));
}
public static function get hasUserSession():Boolean{
_connection.assertInitialized();
return (_connection.hasUserSession);
}
public static function get username():String{
_connection.assertInitialized();
return (_connection.username);
}
public static function get userId():uint{
_connection.assertInitialized();
return (_connection.userId);
}
private static function assertConnected(_arg1:String=null):Boolean{
if (_connection.assertConnected()){
return (true);
};
if (_arg1){
dispatchEvent(_arg1, null, APIEvent.ERROR_NOT_CONNECTED);
};
return (false);
}
public static function get adsApproved():Boolean{
return (_adsApproved);
}
public static function get adFeedURL():String{
return (_adFeedURL);
}
public static function get medals():Array{
return (_medalsArray);
}
public static function get scoreBoards():Array{
return (_scoreBoardsArray);
}
public static function get saveGroups():Array{
return (_saveGroupsArray);
}
public static function connect(_arg1:DisplayObject, _arg2:String, _arg3:String=null, _arg4:String=""):void{
var _local5:uint;
APIEventDispatcher.globalDispatcher = _dispatcher;
Security.loadPolicyFile("http://apifiles.ngfiles.com/crossdomain.xml");
if (_connection.initialized){
Logger.logError("Connection already in progress. Please call API.disconnect() before attempting another connection.");
dispatchEvent(APIEvent.API_CONNECTED, false, APIEvent.ERROR_NOT_CONNECTED);
return;
};
_arg2 = trimWhitespace(_arg2);
if (_arg3){
_arg3 = trimWhitespace(_arg3);
};
if (((!(_arg2)) || ((_arg2 == "")))){
Logger.logError("No apiId given. Please use the API ID from your API settings page.");
dispatchEvent(APIEvent.API_CONNECTED, false, APIEvent.ERROR_INVALID_ARGUMENT);
return;
};
Logger.logMessage((("====== Newgrounds API v" + VERSION) + " ======"));
_connection.connectionState = APIConnection.CONNECTING;
_root = _arg1;
_movieVersion = _arg4;
_connection.apiId = _arg2;
_local5 = _arg2.indexOf(":");
if (_local5 != -1){
_connection.trackerId = uint(_arg2.substring(0, _local5));
} else {
_connection.trackerId = uint(_arg2);
};
if (!_connection.trackerId){
Logger.logError(("Invalid API ID: " + _arg2));
dispatchEvent(APIEvent.API_CONNECTED, false, APIEvent.ERROR_INVALID_ARGUMENT);
return;
};
_connection.encryptionKey = _arg3;
_connection.initialized = true;
if (!_root.loaderInfo){
Logger.logWarning("The root DisplayObject is currently not on the stage. Connection will be completed once it is added to stage.");
};
_root.addEventListener(Event.ENTER_FRAME, checkRootLoaderInfo);
checkRootLoaderInfo(null);
}
private static function doConnect(_arg1:Object):void{
if (((isNetworkHost) && (!((_debugMode == RELEASE_MODE))))){
Logger.logMessage("Live file detected, turning off debug mode.");
_debugMode = RELEASE_MODE;
};
if (((_arg1) && (_arg1.NewgroundsAPI_SandboxID))){
_bridge = new Bridge(_arg1.NewgroundsAPI_SandboxID);
APICommand.bridge = _bridge;
};
if (_debugMode == RELEASE_MODE){
if (_arg1){
if (_arg1.NewgroundsAPI_UserName){
_connection.username = _arg1.NewgroundsAPI_UserName;
};
if (_arg1.NewgroundsAPI_UserID){
_connection.userId = _arg1.NewgroundsAPI_UserID;
};
if (_arg1.NewgroundsAPI_PublisherID){
_connection.publisherId = _arg1.NewgroundsAPI_PublisherID;
};
if (_arg1.NewgroundsAPI_UserpageFormat){
_connection.userpageFormat = _arg1.NewgroundsAPI_UserpageFormat;
};
if (_arg1.NewgroundsAPI_SessionID){
_connection.sessionId = _arg1.NewgroundsAPI_SessionID;
};
if (_arg1.NewgroundsAPI_SaveGroupID){
_requestedSaveGroupId = _arg1.NewgroundsAPI_SaveGroupID;
};
if (_arg1.NewgroundsAPI_SaveFileID){
_requestedSaveFileId = _arg1.NewgroundsAPI_SaveFileID;
};
};
} else {
_connection.debug = true;
if ((((_debugMode == DEBUG_MODE_LOGGED_IN)) || ((_debugMode == DEBUG_MODE_LOGGED_OUT)))){
_connection.publisherId = 1;
};
if (_debugMode == DEBUG_MODE_LOGGED_IN){
_connection.sessionId = "D3bu64p1U53R";
_connection.userId = 10;
_connection.username = "API-Debugger";
};
};
_connection.sendSimpleCommand("connectMovie", onConnect, {host:_connection.hostDomain, movie_version:_movieVersion, publisher_id:_connection.publisherId});
}
private static function onConnect(_arg1:APIEvent):void{
var _local2:Object = _arg1.data;
if (!_arg1.success){
Logger.logError("Unable to connect to the API.");
_connection.reset();
dispatchEvent(APIEvent.API_CONNECTED, _arg1.data, _arg1.error);
return;
};
if (debugMode != RELEASE_MODE){
_adFeedURL = TEST_AD_FEED_URL;
} else {
if (_local2.ad_url){
_adFeedURL = unescape(_local2.ad_url);
};
};
switch (_local2.ad_status){
case -1:
Logger.logWarning("Your movie is not approved to run Flash Ads.");
break;
case 0:
Logger.logWarning("Your movie is still awaiting approval to run Flash Ads.");
break;
case 1:
Logger.logMessage("Your movie is approved to run Flash Ads!");
break;
};
_adsApproved = (_local2.ad_status == 1);
if ((((_debugMode == DEBUG_MODE_HOST_BLOCKED)) || (_local2.deny_host))){
Logger.logWarning((_connection.hostDomain + " does not have permission to host this movie!"), "Update your API configuration to allow this host.");
dispatchEvent(APIEvent.API_CONNECTED, {officialURL:unescape(_local2.movie_url)}, APIEvent.ERROR_HOST_BLOCKED);
_connection.reset();
return;
};
_movieName = (_local2.movieName) ? _local2.movieName : "";
Logger.logMessage("Connecting to the Newgrounds API Gateway...", (("----- " + _local2.movie_name) + " -----"));
if (_debugMode == DEBUG_MODE_NEW_VERSION){
_local2.movie_version = "Debug Mode";
};
if (_local2.movie_version){
Logger.logMessage("A new version of this movie is available.", ("Current version:\t" + _movieVersion), ("Newest version:\t" + _local2.movie_version), "Use API.loadOfficialVersion() to link to the latest version.");
_newVersion = true;
} else {
_newVersion = false;
};
if (_local2.request_portal_url){
_connection.sendSimpleCommand("setPortalID", null, {portal_url:_connection.hostURL});
};
_connection.sendSimpleCommand("preloadSettings", onMetadataLoaded, {publisher_id:_connection.publisherId, user_id:_connection.userId});
}
private static function onMetadataLoaded(_arg1:APIEvent):void{
var _local3:uint;
var _local4:uint;
var _local6:Object;
var _local7:Object;
var _local8:Boolean;
var _local9:Boolean;
var _local10:Boolean;
var _local11:Medal;
var _local12:Object;
var _local13:ScoreBoard;
var _local14:Object;
var _local15:Array;
var _local16:Array;
var _local17:SaveGroup;
var _local18:Object;
var _local19:Object;
var _local2:Object = _arg1.data;
if (!_arg1.success){
Logger.logWarning("Unable to load movie metadata.");
disconnect();
dispatchEvent(APIEvent.API_CONNECTED, null, _arg1.error);
return;
};
var _local5:uint;
if (_local2.medals){
_local5 = _local2.medals.length;
if (hasUserSession){
_local6 = loadLocal(("medals_unlocked_" + username));
} else {
_local6 = loadLocal("medals_unlocked");
};
_local3 = 0;
while (_local3 < _local5) {
_local7 = _local2.medals[_local3];
_local8 = _local7.medal_unlocked;
_local9 = ((_local6) && (_local6[_local7.medal_id]));
_local10 = (hasUserSession) ? _local8 : _local9;
if (debugMode != RELEASE_MODE){
_local10 = false;
};
_local11 = new Medal(_connection, _local7.medal_id, _local7.medal_name, _local7.medal_description, Boolean(int(_local7.secret)), _local10, _local7.medal_value, _local7.medal_difficulty, _local7.medal_icon);
_local11.addEventListener(APIEvent.MEDAL_UNLOCKED, onMedalUnlocked, false, 0, true);
_local11.addEventListener(APIEvent.MEDAL_UNLOCK_CONFIRMED, onMedalUnlockConfirmed, false, 0, true);
_medals[_local11.name] = _local11;
_medalsArray.push(_local11);
Logger.logMessage(_local11);
if (((((hasUserSession) && (_local9))) && (!(_local8)))){
Logger.logMessage((("Server missed the \"" + _local11.name) + "\" unlock. Resending..."));
_local11.unlock();
};
_local3++;
};
};
Logger.logMessage((((_local5 + " medal") + ((_local5)!=1) ? "s" : "") + " initialized."));
_local5 = 0;
if (_local2.score_boards){
_local5 = _local2.score_boards.length;
_local3 = 0;
while (_local3 < _local5) {
_local12 = _local2.score_boards[_local3];
_local13 = new ScoreBoard(_connection, _local12.name, _local12.id);
_scoreBoards[_local13.name] = _local13;
_scoreBoardsArray.push(_local13);
Logger.logMessage(_local13);
_local3++;
};
};
Logger.logMessage((((_local5 + " scoreboard") + ((_local5)!=1) ? "s" : "") + " initialized."));
_local5 = 0;
if (_local2.save_groups){
_local5 = _local2.save_groups.length;
_local3 = 0;
while (_local3 < _local5) {
_local14 = _local2.save_groups[_local3];
_local15 = [];
if (_local14.keys){
_local4 = 0;
while (_local4 < _local14.keys.length) {
_local18 = _local14.keys[_local4];
_local15.push(new SaveKey(_local18.name, _local18.id, _local18.type));
_local4++;
};
};
_local16 = [];
if (_local14.ratings){
_local3 = 0;
while (_local3 < _local14.ratings.length) {
_local19 = _local14.ratings[_local3];
_local16.push(new SaveRating(_local19.name, _local19.id, _local19.float, _local19.min, _local19.max));
_local3++;
};
};
_local17 = new SaveGroup(_connection, _local14.group_name, _local14.group_id, _local14.group_type, _local15, _local16);
_saveGroups[_local17.name] = _local17;
_saveGroupsArray.push(_local17);
Logger.logMessage(_local17);
_local3++;
};
};
Logger.logMessage((((_local5 + " save group") + ((_local5)!=1) ? "s" : "") + " initialized."));
if (_local2.save_file_path){
_saveFilePath = (_local2.save_file_path + "/");
SaveFile._saveFilePath = _saveFilePath;
Logger.logInternal(("Save file path: " + _saveFilePath));
};
if (_local2.image_file_path){
_imageFilePath = (_local2.image_file_path + "/");
SaveFile._imageFilePath = _imageFilePath;
Logger.logInternal(("Image file path: " + _imageFilePath));
};
Logger.logMessage("Connection complete!");
_connection.connectionState = APIConnection.CONNECTED;
dispatchEvent(APIEvent.API_CONNECTED, {movieName:_movieName, newVersion:_newVersion});
if (((_requestedSaveFileId) && (_requestedSaveGroupId))){
API.addEventListener(APIEvent.FILE_LOADED, onRequestedFileLoaded);
API.loadSaveFile(_requestedSaveFileId, false);
};
}
public static function disconnect():void{
var _local1:Medal;
if (!_connection.connected){
Logger.logWarning("The Newgrounds API is already disconnected.");
return;
};
_connection.reset();
for each (_local1 in _medals) {
_local1.removeEventListener(APIEvent.MEDAL_UNLOCKED, onMedalUnlocked);
_local1.removeEventListener(APIEvent.MEDAL_UNLOCK_CONFIRMED, onMedalUnlockConfirmed);
};
_newVersion = false;
_medals = new Object();
_medalsArray = [];
_scoreBoards = new Object();
_scoreBoardsArray = [];
_saveGroups = new Object();
_saveGroupsArray = [];
_sharedObjects = new Object();
_imageFilePath = null;
_saveFilePath = null;
Logger.logMessage("Disconnected from the Newgrounds API.");
}
public static function loadNewgrounds():void{
_connection.loadInBrowser("loadNewgrounds");
}
public static function loadOfficialVersion():void{
if (_connection.assertInitialized()){
_connection.loadInBrowser("loadOfficialVersion", false);
};
}
public static function loadMySite():void{
if (_connection.assertInitialized()){
_connection.loadInBrowser("loadMySite");
};
}
public static function loadCustomLink(_arg1:String):void{
if (_connection.assertInitialized()){
_connection.loadInBrowser("loadCustomLink", true, {link:_arg1});
};
}
public static function getMedal(_arg1:String):Medal{
return (_medals[_arg1]);
}
public static function unlockMedal(_arg1:String):void{
if (!assertConnected()){
return;
};
var _local2:Medal = _medals[_arg1];
if (!_local2){
Logger.logError((("No medal named \"" + _arg1) + "\" was found."));
return;
};
_local2.unlock();
}
private static function onMedalUnlocked(_arg1:APIEvent):void{
var _local2:Medal;
var _local3:Object;
if (_arg1.success){
_local2 = Medal(_arg1.data);
if (hasUserSession){
_local3 = loadLocal(("medals_unlocked_" + username));
if (!_local3){
_local3 = new Object();
};
_local3[_local2.id] = true;
saveLocal(("medals_unlocked_" + username), _local3);
} else {
_local3 = loadLocal("medals_unlocked");
if (!_local3){
_local3 = new Object();
};
_local3[Medal(_arg1.data).id] = true;
saveLocal("medals_unlocked", _local3);
Logger.logMessage((("User is not logged in. Medal \"" + _local2.name) + "\" unlocked locally."));
};
};
}
private static function onMedalUnlockConfirmed(_arg1:APIEvent):void{
var _local2:Object;
if (hasUserSession){
_local2 = loadLocal(("medals_unlocked_" + username));
if (!_local2){
_local2 = new Object();
} else {
delete _local2[Medal(_arg1.data).id];
};
saveLocal(("medals_unlocked_" + username), _local2);
};
}
public static function clearLocalMedals():void{
var _local1:Medal;
for each (_local1 in _medals) {
_local1.setUnlocked(false);
};
if (!hasUserSession){
saveLocal("medals_unlocked", new Object());
};
}
public static function getScoreBoard(_arg1:String):ScoreBoard{
if (!assertConnected()){
return (null);
};
return (_scoreBoards[_arg1]);
}
public static function loadScores(_arg1:String, _arg2:String="All-Time", _arg3:uint=1, _arg4:uint=10, _arg5:String=null):ScoreBoard{
if (!assertConnected()){
return (null);
};
var _local6:ScoreBoard = _scoreBoards[_arg1];
if (!_local6){
Logger.logError((("No scoreboard named \"" + _arg1) + "\" was found."));
dispatchEvent(APIEvent.SCORES_LOADED, null, APIEvent.ERROR_INVALID_ARGUMENT);
return (null);
};
_local6.period = _arg2;
_local6.firstResult = _arg3;
_local6.numResults = _arg4;
_local6.tag = _arg5;
_local6.loadScores();
return (_local6);
}
public static function postScore(_arg1:String, _arg2:Number, _arg3:String=null):void{
if (!assertConnected()){
return;
};
if (!hasUserSession){
Logger.logError("The user must be logged-in to post a score.");
dispatchEvent(APIEvent.SCORE_POSTED, null, APIEvent.ERROR_NOT_LOGGED_IN);
return;
};
var _local4:ScoreBoard = _scoreBoards[_arg1];
if (!_local4){
Logger.logError((("No scoreboard named \"" + _arg1) + "\" was found."));
dispatchEvent(APIEvent.SCORE_POSTED, null, APIEvent.ERROR_INVALID_ARGUMENT);
return;
};
_local4.postScore(_arg2, _arg3);
}
public static function getSaveGroup(_arg1:String):SaveGroup{
if (!assertConnected()){
return (null);
};
return (_saveGroups[_arg1]);
}
private static function getSaveGroupById(_arg1:uint):SaveGroup{
var _local2:SaveGroup;
for each (_local2 in _saveGroups) {
if (_local2.id == _arg1){
return (_local2);
};
};
return (null);
}
public static function createSaveFile(_arg1:String):SaveFile{
if (!assertConnected()){
return (null);
};
var _local2:SaveGroup = getSaveGroup(_arg1);
if (!_local2){
Logger.logError((("The save group \"" + _arg1) + "\" was not found."));
return (null);
};
return (new SaveFile(_local2));
}
public static function loadSaveFile(_arg1:uint, _arg2:Boolean=true):void{
_connection.sendSimpleCommand("loadSaveFile", onFileLoaded, {save_id:_arg1, get_contents:_arg2});
}
private static function onFileLoaded(_arg1:APIEvent):void{
var _local2:SaveFile;
if (_arg1.success){
_local2 = SaveFile.fromObject(getSaveGroupById(_arg1.data.group_id), _arg1.data.file);
if (_arg1.data.get_contents){
_local2.load();
} else {
dispatchEvent(APIEvent.FILE_LOADED, _local2);
};
} else {
Logger.logError("Unable to load file:", _arg1.error);
dispatchEvent(APIEvent.FILE_LOADED, null, _arg1.error);
};
}
public static function createSaveQuery(_arg1:String):SaveQuery{
if (!assertConnected()){
return (null);
};
var _local2:SaveGroup = getSaveGroup(_arg1);
if (!_local2){
Logger.logError((("The save group \"" + _arg1) + "\" was not found."));
return (null);
};
var _local3:SaveQuery = new SaveQuery(_local2);
return (_local3);
}
public static function createSaveQueryByDate(_arg1:String, _arg2:Boolean=true):SaveQuery{
var _local3:SaveQuery = createSaveQuery(_arg1);
if (!_local3){
return (null);
};
_local3.sortOn(SaveQuery.CREATED_ON, _arg2);
return (_local3);
}
public static function createSaveQueryByName(_arg1:String, _arg2:String, _arg3:Boolean=false, _arg4:Boolean=false):SaveQuery{
var _local5:SaveQuery = createSaveQuery(_arg1);
_local5.addCondition(SaveQuery.FILE_NAME, (_arg3) ? SaveQuery.OPERATOR_EQUAL : SaveQuery.OPERATOR_CONTAINS, _arg2);
return (_local5);
}
public static function createSaveQueryByRating(_arg1:String, _arg2:String, _arg3:Boolean=true):SaveQuery{
var _local4:SaveQuery = createSaveQuery(_arg1);
_local4.sortOn(_arg2, _arg3);
return (_local4);
}
private static function onRequestedFileLoaded(_arg1:APIEvent):void{
var _local2:SaveFile;
API.removeEventListener(APIEvent.FILE_LOADED, onRequestedFileLoaded);
if (_arg1.success){
_local2 = (_arg1.data as SaveFile);
if (_local2){
dispatchEvent(APIEvent.FILE_REQUESTED, _local2);
};
};
}
public static function addEventListener(_arg1:String, _arg2:Function, _arg3:int=0, _arg4:Boolean=true):void{
_dispatcher.addEventListener(_arg1, _arg2, false, _arg3, _arg4);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
private static function dispatchEvent(_arg1:String, _arg2=null, _arg3:String=null):void{
_dispatcher.dispatchEvent(new APIEvent(_arg1, _arg2, _arg3));
}
public static function saveLocal(_arg1:String, _arg2:Object):Boolean{
var sharedObject:SharedObject;
var sharedObjectName:String;
var saveId = _arg1;
var saveData = _arg2;
try {
sharedObjectName = ((("ng_ap_secure_" + _connection.trackerId) + "_") + RC4.encrypt(saveId, _connection.encryptionKey));
if (!_sharedObjects[saveId]){
_sharedObjects[saveId] = SharedObject.getLocal(sharedObjectName);
};
sharedObject = _sharedObjects[saveId];
sharedObject.data.data = encodeData(saveData);
} catch(error:Error) {
Logger.logError("Unable to save local data.", error);
return (false);
};
return (true);
}
public static function loadLocal(_arg1:String):Object{
var sharedObject:SharedObject;
var sharedObjectName:String;
var saveId = _arg1;
try {
sharedObjectName = ((("ng_ap_secure_" + _connection.trackerId) + "_") + RC4.encrypt(saveId, _connection.encryptionKey));
if (!_sharedObjects[saveId]){
_sharedObjects[saveId] = SharedObject.getLocal(sharedObjectName);
};
sharedObject = _sharedObjects[saveId];
if (((((sharedObject) && (sharedObject.data))) && (sharedObject.data.data))){
return (decodeData(sharedObject.data.data));
};
return (null);
} catch(error:Error) {
Logger.logError("Unable to load local data.", error);
};
return (null);
}
public static function logCustomEvent(_arg1:String):void{
if (assertConnected()){
Logger.logMessage(("Logged event: " + _arg1));
_connection.sendSimpleCommand("logCustomEvent", null, {event:_arg1});
};
}
private static function encodeData(_arg1:Object):String{
if (!_connection.assertInitialized()){
return (null);
};
return (RC4.encrypt(JSON.encode(_arg1), _connection.encryptionKey));
}
private static function decodeData(_arg1:String):Object{
if (!_connection.assertInitialized()){
return (null);
};
try {
return ((JSON.decode(RC4.decrypt(_arg1, _connection.encryptionKey)) as Object));
} catch(error:Error) {
};
return (null);
}
public static function stopPendingCommands():void{
APICommand.stopPendingCommands();
Logger.logMessage("Pending commands stopped.");
}
private static function trimWhitespace(_arg1:String):String{
if (!_arg1){
return (null);
};
var _local2:int;
while (_arg1.charAt(_local2) == " ") {
_local2++;
};
var _local3:int = (_arg1.length - 1);
while ((((_arg1.charAt(_local3) == " ")) && ((_local3 >= 0)))) {
_local3--;
};
return (_arg1.slice(_local2, (_local3 + 1)));
}
private static function checkRootLoaderInfo(_arg1:Event):void{
var event = _arg1;
var loaderInfo:LoaderInfo = _root.loaderInfo;
if (loaderInfo){
try {
while (loaderInfo.loader) {
loaderInfo = loaderInfo.loader.loaderInfo;
};
} catch(error:Error) {
return;
};
_root.removeEventListener(Event.ENTER_FRAME, checkRootLoaderInfo);
_connection.hostURL = loaderInfo.url;
doConnect(loaderInfo.parameters);
};
}
}
}//package com.newgrounds
Section 16
//APICommand (com.newgrounds.APICommand)
package com.newgrounds {
import flash.utils.*;
import flash.events.*;
import flash.net.*;
import com.newgrounds.encoders.json.*;
import com.newgrounds.crypto.*;
import com.newgrounds.encoders.*;
public class APICommand extends APIEventDispatcher {
private var _command:String;
private var _parameters:Object;
private var _secureParameters:Object;
private var _files:Object;
private var _preventCache:Boolean;
private var _hasTimeout:Boolean;
private var _timeoutTimer:Timer;
private var _loader:URLLoader;
private static const TIMEOUT_INTERVAL:uint = 10000;
private static const THROTTLE_INTERVAL:uint = 10050;
private static const THROTTLE_TICK_INTERVAL:uint = 1000;
private static const THROTTLE_THRESHOLD:uint = 24;
private static const ENCRYPTOR_RADIX:String = "/g8236klvBQ#&|;Zb*7CEA59%s`Oue1wziFp$rDVY@TKxUPWytSaGHJ>dmoMR^<0~4qNLhc(I+fjn)X";
private static const CRLF:String = "
";
public static var bridge:Bridge;
private static var _throttleTimestamp:uint;
private static var _throttleCount:int = 0;
private static var _commandQueue:Array = [];
private static var _encryptor:BaseN = new BaseN(ENCRYPTOR_RADIX);
private static var _pendingCommands:Array = [];
private static var _throttleTimer:Timer = function ():Timer{
var _local1:* = new Timer(THROTTLE_TICK_INTERVAL, 0);
_local1.addEventListener(TimerEvent.TIMER, onThrottleTimer);
_local1.start();
return (_local1);
}();
public function APICommand(_arg1:String){
this._command = _arg1;
this._parameters = new Object();
this._secureParameters = new Object();
this._timeoutTimer = new Timer(TIMEOUT_INTERVAL, 1);
this._timeoutTimer.addEventListener(TimerEvent.TIMER, this.onTimeout);
this._hasTimeout = true;
}
public function get command():String{
return (this._command);
}
public function set command(_arg1:String):void{
this._command = _arg1;
}
public function get hasTimeout():Boolean{
return (this._hasTimeout);
}
public function set hasTimeout(_arg1:Boolean):void{
this._hasTimeout = _arg1;
}
public function get parameters():Object{
return (this._parameters);
}
public function set parameters(_arg1:Object):void{
var _local2:String;
this._parameters = new Object();
if (_arg1){
for (_local2 in _arg1) {
this._parameters[_local2] = _arg1[_local2];
};
};
}
public function get preventCache():Boolean{
return (this._preventCache);
}
public function set preventCache(_arg1:Boolean):void{
this._preventCache = _arg1;
}
public function get secureParameters():Object{
return (this._secureParameters);
}
public function set secureParameters(_arg1:Object):void{
var _local2:String;
this._secureParameters = new Object();
if (_arg1){
for (_local2 in _arg1) {
this._secureParameters[_local2] = _arg1[_local2];
};
};
}
public function get hasSecureParameters():Boolean{
var _local1:String;
for (_local1 in this._secureParameters) {
return (true);
};
return (false);
}
public function addFile(_arg1:String, _arg2:ByteArray, _arg3:String, _arg4:String="application/octet-stream"):void{
if (!this._files){
this._files = new Object();
};
var _local5:Object = {filename:_arg1, data:_arg2, dataField:_arg3, contentType:_arg4};
this._files[_arg1] = _local5;
}
public function removeFile(_arg1:String):void{
if (this._files){
delete this._files[_arg1];
};
}
public function clearFiles():void{
this._files = null;
}
public function close():void{
var _local1:uint;
if (this._loader){
try {
this._loader.close();
} catch(error:Error) {
};
this._timeoutTimer.stop();
_local1 = 0;
while (_local1 < _pendingCommands.length) {
if (_pendingCommands[_local1] == this){
_pendingCommands.splice(_local1, 1);
break;
};
_local1++;
};
this._loader = null;
};
}
public function loadInBrowser(_arg1:APIConnection, _arg2:Boolean):void{
var _local4:String;
var _local5:String;
this._parameters.command_id = this._command;
this._parameters.tracker_id = (_arg1.apiId) ? _arg1.apiId : 1;
if (_arg1.debug){
this._parameters.debug = 1;
};
var _local3:String = ((_arg1.apiURL + "?host=") + escape(_arg1.hostDomain));
for (_local4 in this._parameters) {
_local3 = (_local3 + ((("&" + escape(_local4)) + "=") + escape(this._parameters[_local4])));
};
if (_arg2){
_local5 = "_blank";
} else {
_local5 = "_top";
};
navigateToURL(new URLRequest(_local3), _local5);
}
public function send(_arg1:APIConnection):void{
if (_throttleCount >= THROTTLE_THRESHOLD){
_commandQueue.push({connection:_arg1, command:this});
} else {
this.sendInternal(_arg1);
};
}
private function sendInternal(_arg1:APIConnection):void{
var _local2:Object;
var _local3:String;
var _local4:*;
var _local5:uint;
var _local6:String;
var _local7:Object;
var _local8:String;
var _local9:String;
var _local10:String;
var _local11:String;
_local2 = new URLVariables();
_local2.command_id = this._command;
_local2.tracker_id = _arg1.apiId;
if (_arg1.debug){
_local2.debug = 1;
};
if (this._preventCache){
_local2.seed = Math.random();
};
for (_local3 in this._parameters) {
_local4 = this._parameters[_local3];
if (_local4 != null){
if ((_local4 is Boolean)){
_local2[_local3] = int(_local4);
} else {
_local2[_local3] = _local4;
};
};
};
if (this.hasSecureParameters){
_local7 = new Object();
for (_local3 in this._secureParameters) {
_local4 = this._secureParameters[_local3];
if (_local4 != null){
if ((_local4 is Boolean)){
_local7[_local3] = int(_local4);
} else {
_local7[_local3] = _local4;
};
};
};
_local8 = "";
_local5 = 0;
while (_local5 < 16) {
_local8 = (_local8 + ENCRYPTOR_RADIX.charAt(uint((Math.random() * ENCRYPTOR_RADIX.length))));
_local5++;
};
_local2.command_id = "securePacket";
_local7.command_id = this._command;
_local7.as_version = 3;
_local7.session_id = _arg1.sessionId;
_local7.user_email = _arg1.userEmail;
_local7.publisher_id = _arg1.publisherId;
_local7.seed = _local8;
_local9 = MD5.hash(_local8);
_local10 = RC4.encrypt(JSON.encode(_local7), _arg1.encryptionKey);
_local2.secure = encryptHex((_local9 + _local10));
};
Logger.logInternal("Sending packet:", _local2);
if (this._files){
_local11 = "";
_local5 = 0;
while (_local5 < 32) {
_local11 = (_local11 + String.fromCharCode(uint((97 + (Math.random() * 25)))));
_local5++;
};
_local6 = (("multipart/form-data; boundary=\"" + _local11) + "\"");
_local2 = this.buildMultipartData(_local11, _local2, this._files);
} else {
for (_local3 in _local2) {
if (typeof(_local2[_local3]) == "object"){
_local2[_local3] = JSON.encode(_local2[_local3]);
};
};
_local6 = "application/x-www-form-urlencoded";
};
_pendingCommands.push(this);
_throttleCount++;
_throttleTimestamp = getTimer();
this.startLoader(_arg1.apiURL, _local2, _local6);
}
private function onTimeout(_arg1):void{
this.close();
Logger.logError("Command timed out.");
dispatchEvent(new APIEvent(APIEvent.COMMAND_COMPLETE, null, APIEvent.ERROR_TIMED_OUT));
}
private function onError(_arg1:String):void{
Logger.logError("Error when sending command:", _arg1);
dispatchEvent(new APIEvent(APIEvent.COMMAND_COMPLETE, null, APIEvent.ERROR_UNKNOWN));
this.close();
}
private function onComplete(_arg1:String):void{
var response:Object;
var data = _arg1;
try {
if (((!(data)) || ((data == "")))){
throw (new Error());
};
Logger.logInternal("Received packet:", data);
response = JSON.decode(data);
if (!response){
throw (new Error());
};
if (bridge){
bridge.sendEvent(response.command_id, response);
};
dispatchEvent(new APIEvent(APIEvent.COMMAND_COMPLETE, response, (((response) && (response.success))) ? APIEvent.ERROR_NONE : APIEvent.ERROR_COMMAND_FAILED));
} catch(e) {
Logger.logError(("Invalid response returned from server: " + data));
dispatchEvent(new APIEvent(APIEvent.COMMAND_COMPLETE, null, APIEvent.ERROR_BAD_RESPONSE));
};
this.close();
}
private function startLoader(_arg1:String, _arg2:Object, _arg3:String):void{
var url = _arg1;
var data = _arg2;
var contentType = _arg3;
var urlRequest:URLRequest = new URLRequest(url);
urlRequest.data = data;
urlRequest.method = URLRequestMethod.POST;
urlRequest.contentType = contentType;
this._loader = new URLLoader();
this._loader.addEventListener(Event.COMPLETE, this.as3CompleteHandler);
this._loader.addEventListener(Event.OPEN, this.as3UpdateHandler);
this._loader.addEventListener(ProgressEvent.PROGRESS, this.as3UpdateHandler);
this._loader.addEventListener(IOErrorEvent.IO_ERROR, this.as3ErrorHandler);
this._loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.as3ErrorHandler);
try {
this._loader.load(urlRequest);
if (this._hasTimeout){
this._timeoutTimer.start();
};
} catch(error) {
onError("Security error");
};
}
private function as3CompleteHandler(_arg1:Event):void{
this.onComplete(this._loader.data);
}
private function as3UpdateHandler(_arg1:Event):void{
if (this._timeoutTimer.running){
this._timeoutTimer.reset();
this._timeoutTimer.start();
};
}
private function as3ErrorHandler(_arg1:Event):void{
this.onError(_arg1.toString());
}
private function buildMultipartData(_arg1:String, _arg2:Object, _arg3:Object):ByteArray{
var _local5:String;
var _local6:Object;
var _local4:ByteArray = new ByteArray();
_local4.endian = Endian.BIG_ENDIAN;
_arg1 = ("--" + _arg1);
for (_local5 in _arg2) {
_local4.writeUTFBytes((_arg1 + CRLF));
_local4.writeUTFBytes(((("Content-Disposition: form-data; name=\"" + _local5) + "\"") + CRLF));
_local4.writeUTFBytes(CRLF);
_local4.writeUTFBytes((_arg2[_local5].toString() + CRLF));
};
if (this._files){
for each (_local6 in _arg3) {
_local4.writeUTFBytes((_arg1 + CRLF));
_local4.writeUTFBytes(("Content-Disposition: form-data; name=\"Filename\"" + CRLF));
_local4.writeUTFBytes(CRLF);
_local4.writeUTFBytes((_local6.filename + CRLF));
_local4.writeUTFBytes((_arg1 + CRLF));
_local4.writeUTFBytes(((((("Content-Disposition: form-data; name=\"" + _local6.dataField) + "\"; filename=\"") + _local6.filename) + "\"") + CRLF));
_local4.writeUTFBytes((("Content-Type: " + _local6.contentType) + CRLF));
_local4.writeUTFBytes(CRLF);
_local4.writeBytes(_local6.data);
_local4.writeUTFBytes(CRLF);
};
_local4.writeUTFBytes((_arg1 + CRLF));
_local4.writeUTFBytes(("Content-Disposition: form-data; name=\"Upload\"" + CRLF));
_local4.writeUTFBytes(CRLF);
_local4.writeUTFBytes(("Submit Query" + CRLF));
};
_local4.writeUTFBytes((_arg1 + "--"));
_local4.position = 0;
return (_local4);
}
public static function stopPendingCommands():void{
var _local1:APICommand;
for each (_local1 in _pendingCommands) {
_local1.close();
};
_pendingCommands = [];
}
private static function onThrottleTimer(_arg1):void{
var _local2:Object;
if ((getTimer() - _throttleTimestamp) >= THROTTLE_INTERVAL){
_throttleCount = 0;
_throttleCount = 0;
while (((_commandQueue.length) && ((_throttleCount < THROTTLE_THRESHOLD)))) {
_local2 = _commandQueue.shift();
_local2.command.send(_local2.connection);
_throttleCount++;
};
};
}
private static function encryptHex(_arg1:String):String{
var _local2:uint = (_arg1.length % 6);
var _local3 = "";
var _local4:uint;
while (_local4 < _arg1.length) {
_local3 = (_local3 + _encryptor.encodeUint(uint(("0x" + _arg1.substr(_local4, 6))), 4));
_local4 = (_local4 + 6);
};
return ((_local2.toString() + _local3));
}
}
}//package com.newgrounds
Section 17
//APIConnection (com.newgrounds.APIConnection)
package com.newgrounds {
import flash.system.*;
public class APIConnection {
public var initialized:Boolean;
public var connectionState:String;// = "notConnected"
public var apiURL:String;// = "http://www.ngads.com/gateway_v2.php"
public var apiId:String;
public var debug:Boolean;
public var trackerId:uint;
public var publisherId:uint;
public var encryptionKey:String;
public var sessionId:String;
public var userEmail:String;
public var username:String;
public var userId:uint;
public var userpageFormat:uint;
private var _hostURL:String;
public var hostDomain:String;
public static const NOT_CONNECTED:String = "notConnected";
public static const CONNECTING:String = "connecting";
public static const CONNECTED:String = "connected";
public function APIConnection(){
this.reset();
}
public function get hostURL():String{
return (this._hostURL);
}
public function set hostURL(_arg1:String):void{
var _local2:Array;
this._hostURL = _arg1;
this.hostDomain = null;
if (this._hostURL){
_local2 = this._hostURL.split("/");
if (((!((_local2[0] == "file:"))) && (!((this._hostURL == "localhost"))))){
this.hostDomain = _local2[2];
};
};
if (!this.hostDomain){
this.hostDomain = "localhost";
};
}
public function get sandboxType():String{
return (Security.sandboxType);
}
public function get isNetworkHost():Boolean{
switch (this.sandboxType){
case "localWithFile":
case "localWithNetwork":
case "localTrusted":
case "application":
return (false);
case "remote":
default:
return (true);
};
}
public function get hasUserSession():Boolean{
return (((((!((this.sessionId == null))) && (!((this.sessionId == ""))))) && (!((this.publisherId == 0)))));
}
public function get connected():Boolean{
return ((this.connectionState == CONNECTED));
}
public function reset():void{
this.connectionState = NOT_CONNECTED;
this.encryptionKey = null;
this.sessionId = null;
this.userEmail = null;
this.username = null;
this.userId = 0;
this.userpageFormat = 0;
}
public function assertInitialized():Boolean{
if (!this.initialized){
Logger.logError("You must initialized the API using API.connect() before using this command.");
return (false);
};
return (true);
}
public function assertConnected():Boolean{
if (!(this.connectionState) == CONNECTED){
Logger.logError("You must establish a connection using API.connect() before using this command.");
return (false);
};
return (true);
}
public function sendSimpleCommand(_arg1:String, _arg2:Function, _arg3:Object=null, _arg4:Object=null):void{
var _local5:APICommand = new APICommand(_arg1);
_local5.parameters = _arg3;
_local5.secureParameters = _arg4;
if (_arg2 != null){
_local5.addEventListener(APIEvent.COMMAND_COMPLETE, _arg2);
};
_local5.send(this);
}
public function sendCommand(_arg1:APICommand):void{
_arg1.send(this);
}
public function loadInBrowser(_arg1:String, _arg2:Boolean=true, _arg3:Object=null):void{
var _local4:APICommand = new APICommand(_arg1);
_local4.parameters = _arg3;
_local4.loadInBrowser(this, _arg2);
}
}
}//package com.newgrounds
Section 18
//APIEvent (com.newgrounds.APIEvent)
package com.newgrounds {
import flash.events.*;
public class APIEvent extends Event {
private var _data;
private var _success:Boolean;
private var _error:String;
static const COMMAND_COMPLETE:String = "commandComplete";
static const MEDAL_UNLOCK_CONFIRMED:String = "medalUnlockConfirmed";
static const ICON_LOADED:String = "iconLoaded";
public static const API_CONNECTED:String = "movieConnected";
public static const LOG:String = "log";
public static const MEDAL_UNLOCKED:String = "medalUnlocked";
public static const SCORES_LOADED:String = "scoresLoaded";
public static const SCORE_POSTED:String = "scorePosted";
public static const QUERY_COMPLETE:String = "queryComplete";
public static const FILE_LOADED:String = "fileLoaded";
public static const FILE_SAVED:String = "fileSaved";
public static const FILE_REQUESTED:String = "fileRequested";
public static const VOTE_COMPLETE:String = "voteComplete";
public static const ERROR_NONE:String = "noError";
public static const ERROR_UNKNOWN:String = "unknownError";
public static const ERROR_COMMAND_FAILED:String = "commandFailed";
public static const ERROR_NOT_CONNECTED:String = "notConnected";
public static const ERROR_INVALID_ARGUMENT:String = "invalidArgument";
public static const ERROR_TIMED_OUT:String = "timedOut";
public static const ERROR_BAD_FILE:String = "badFile";
public static const ERROR_BAD_RESPONSE:String = "badResponse";
public static const ERROR_SENDING_COMMAND:String = "errorSendingCommand";
public static const ERROR_HOST_BLOCKED:String = "hostBlocked";
public static const ERROR_ALREADY_VOTED:String = "alreadyVoted";
public static const ERROR_NOT_LOGGED_IN:String = "notLoggedIn";
public static const ERROR_WRONG_ENCRYPTION_KEY:String = "wrongEncryptionKey";
public function APIEvent(_arg1:String, _arg2=null, _arg3:String=null){
super(_arg1);
if (((((!(_arg3)) || ((_arg3 == "")))) || ((_arg3 == ERROR_NONE)))){
this._error = ERROR_NONE;
this._success = true;
} else {
this._error = _arg3;
this._success = false;
};
if (_arg2){
this._data = _arg2;
} else {
this._data = {};
};
}
override public function clone():Event{
return (new APIEvent(type, this._data, this._error));
}
public function get success():Boolean{
return (this._success);
}
public function get data(){
return (this._data);
}
public function get error():String{
return (this._error);
}
}
}//package com.newgrounds
Section 19
//APIEventDispatcher (com.newgrounds.APIEventDispatcher)
package com.newgrounds {
import flash.display.*;
import com.newgrounds.*;
import flash.events.*;
class APIEventDispatcher extends EventDispatcher {
private static var _globalDispatcher:EventDispatcher;
private static var _eventQueue:Array = initEventQueue();
private static var _ticker:Sprite;
override public function dispatchEvent(_arg1:Event):Boolean{
_eventQueue.push({dispatcher:this, event:_arg1});
return (true);
}
private function actualDispatchEvent(_arg1:Event):void{
var _local2:Boolean = super.dispatchEvent(_arg1);
if (((_globalDispatcher) && (!((this == _globalDispatcher))))){
_globalDispatcher.dispatchEvent(_arg1);
};
}
public static function get globalDispatcher():EventDispatcher{
return (_globalDispatcher);
}
public static function set globalDispatcher(_arg1:EventDispatcher):void{
_globalDispatcher = _arg1;
}
private static function initEventQueue():Array{
_ticker = new Sprite();
_ticker.addEventListener(Event.ENTER_FRAME, runEventQueue);
return ([]);
}
private static function runEventQueue(_arg1):void{
var _local3:Array;
var _local4:uint;
var _local5:Object;
var _local2:uint = _eventQueue.length;
if (_local2){
_local3 = _eventQueue;
_eventQueue = [];
_local4 = 0;
while (_local4 < _local2) {
_local5 = _local3[_local4];
_local5.dispatcher.actualDispatchEvent(_local5.event);
_local4++;
};
};
}
}
}//package com.newgrounds
Section 20
//BitmapLoader (com.newgrounds.BitmapLoader)
package com.newgrounds {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.system.*;
public class BitmapLoader extends APIEventDispatcher {
private var _url:String;
private var _bitmapData:BitmapData;
private var _loaded:Boolean;// = true
private var _loader:Loader;
private static const LOADER_CONTEXT:LoaderContext = new LoaderContext(true);
static var _cacheSeed:uint = 0;
public function BitmapLoader(_arg1:BitmapData, _arg2:String){
this._bitmapData = _arg1;
this._url = _arg2;
}
public function get url():String{
return (this._url);
}
public function set url(_arg1:String):void{
this._loaded = false;
this._url = _arg1;
}
public function get bitmapData():BitmapData{
return (this._bitmapData);
}
public function set bitmapData(_arg1:BitmapData):void{
this._bitmapData = _arg1;
this._loaded = true;
}
public function get loaded():Boolean{
return (this._loaded);
}
private function createLoader():Loader{
var _local1:Loader = new Loader();
var _local2:URLRequest = new URLRequest(this._url);
_local2.method = URLRequestMethod.GET;
_local2.data = _cacheSeed.toString();
_local1.load(_local2, LOADER_CONTEXT);
return (_local1);
}
private function disposeLoader():void{
if (this._loader){
try {
this._loader.contentLoaderInfo.removeEventListener(Event.COMPLETE, this.onLoadComplete);
this._loader.contentLoaderInfo.removeEventListener(IOErrorEvent.IO_ERROR, this.onLoadComplete);
this._loader.unload();
} catch(error) {
};
this._loader = null;
};
}
public function load():void{
if (((!(this._url)) || ((this._url == "")))){
this.onLoadComplete(null);
return;
};
this.disposeLoader();
this._loader = this.createLoader();
this._loader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onLoadComplete);
this._loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.onLoadComplete);
}
public function attachBitmap(_arg1:DisplayObjectContainer):Sprite{
var _local2:Sprite = new Sprite();
if (((((!(this._loaded)) && (this._url))) && (!((this._url == ""))))){
if (!this._loader){
this.load();
};
_local2.addChild(this.createLoader());
} else {
_local2.addChild(new Bitmap(this._bitmapData));
};
if (_arg1){
_arg1.addChild(_local2);
};
return (_local2);
}
private function onLoadComplete(_arg1:Event):void{
var bitmapData:BitmapData;
var event = _arg1;
try {
if (((((((event) && ((event.type == Event.COMPLETE)))) && (this._loader))) && ((this._loader.content is Bitmap)))){
bitmapData = Bitmap(this._loader.content).bitmapData;
this._bitmapData = bitmapData;
this._loaded = true;
};
} catch(error:SecurityError) {
if (bitmapData){
bitmapData.dispose();
};
};
this.disposeLoader();
dispatchEvent(new APIEvent(APIEvent.ICON_LOADED, this, (this._loaded) ? null : APIEvent.ERROR_BAD_FILE));
}
}
}//package com.newgrounds
Section 21
//Bridge (com.newgrounds.Bridge)
package com.newgrounds {
import flash.events.*;
import flash.net.*;
public class Bridge {
private var _inConnection:LocalConnection;
private var _outConnection:LocalConnection;
private var _widgetId:String;
public function Bridge(_arg1:String){
this._widgetId = _arg1;
this._inConnection = new LocalConnection();
this._outConnection = new LocalConnection();
this._inConnection.client = this;
try {
this._inConnection.connect(("rec_" + this._widgetId));
} catch(error) {
};
this._outConnection.addEventListener(StatusEvent.STATUS, this.onStatus);
Logger.addEventListener(APIEvent.LOG, this.onLogMessage);
}
private function onLogMessage(_arg1:APIEvent):void{
try {
this._outConnection.send(this._widgetId, "sendEvent", "trace", String(_arg1.data));
} catch(error) {
};
}
public function sendEvent(_arg1:String, _arg2:Object):void{
if (this._outConnection){
_arg2 = {data:_arg2};
this._outConnection.send(this._widgetId, "sendEvent", _arg1, _arg2);
};
}
public function receiveEvent(_arg1:String, _arg2:Object):void{
}
private function onStatus(_arg1:Event):void{
}
}
}//package com.newgrounds
Section 22
//Logger (com.newgrounds.Logger)
package com.newgrounds {
import flash.events.*;
public class Logger {
static const PRIORITY_INTERNAL:uint = 0;
public static const PRIORITY_MESSAGE:uint = 1;
public static const PRIORITY_WARNING:uint = 2;
public static const PRIORITY_ERROR:uint = 3;
public static const PRIORITY_MAX:uint = 4;
private static const HEADER:String = "[Newgrounds API] :: ";
private static var _eventDispatcher:EventDispatcher = new EventDispatcher();
private static var _messageLevel:uint = 1;
private static var _throwLevel:uint = 4;
static function logInternal(... _args):void{
log(PRIORITY_INTERNAL, _args);
}
public static function logMessage(... _args):void{
log(PRIORITY_MESSAGE, _args);
}
public static function logWarning(... _args):void{
log(PRIORITY_WARNING, _args);
}
public static function logError(... _args):void{
log(PRIORITY_ERROR, _args);
}
private static function log(_arg1:uint=1, _arg2:Array=null):void{
var _local3:uint;
if (_arg1 >= _messageLevel){
_local3 = 0;
while (_local3 < _arg2.length) {
trace((HEADER + _arg2[_local3]));
_eventDispatcher.dispatchEvent(new APIEvent(APIEvent.LOG, _arg2[_local3]));
_local3++;
};
};
if (_arg1 >= _throwLevel){
throw (new Error(_arg2.join("\n")));
};
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_eventDispatcher.addEventListener(_arg1, _arg2, false, 0, false);
}
}
}//package com.newgrounds
Section 23
//Medal (com.newgrounds.Medal)
package com.newgrounds {
import flash.display.*;
import com.newgrounds.assets.*;
public class Medal extends APIEventDispatcher {
private var _connection:APIConnection;
private var _name:String;
private var _id:uint;
private var _description:String;
private var _secret:Boolean;
private var _value:uint;
private var _unlocked:Boolean;
private var _difficulty:String;
private var _iconLoader:BitmapLoader;
public static const ICON_WIDTH:uint = 50;
public static const ICON_HEIGHT:uint = 50;
public static const DIFFICULTY_EASY:String = "Easy";
public static const DIFFICULTY_MODERATE:String = "Moderate";
public static const DIFFICULTY_CHALLENGING:String = "Challenging";
public static const DIFFICULTY_DIFFICULT:String = "Difficult";
public static const DIFFICULTY_BRUTAL:String = "Brutal";
private static const DIFFICULTIES:Array = ["Unknown", DIFFICULTY_EASY, DIFFICULTY_MODERATE, DIFFICULTY_CHALLENGING, DIFFICULTY_DIFFICULT, DIFFICULTY_BRUTAL];
public static const DEFAULT_ICON:BitmapData = new DefaultMedalIcon(ICON_WIDTH, ICON_HEIGHT);
public function Medal(_arg1:APIConnection, _arg2:uint, _arg3:String, _arg4:String, _arg5:Boolean, _arg6:Boolean, _arg7:uint, _arg8:uint, _arg9:String){
this._connection = _arg1;
this._id = _arg2;
this._name = _arg3;
this._description = _arg4;
this._secret = _arg5;
this._unlocked = _arg6;
this._value = _arg7;
this._difficulty = DIFFICULTIES[_arg8];
this._iconLoader = new BitmapLoader(DEFAULT_ICON, _arg9);
this._iconLoader.load();
}
public function get difficulty():String{
return (this._difficulty);
}
public function get icon():BitmapData{
return (this._iconLoader.bitmapData);
}
public function get id():uint{
return (this._id);
}
public function get name():String{
return (this._name);
}
public function get description():String{
return (this._description);
}
public function get secret():Boolean{
return (this._secret);
}
public function get unlocked():Boolean{
return (this._unlocked);
}
public function get value():uint{
return (this._value);
}
override public function toString():String{
return (((((((("Medal: " + this._name) + "\t\t(") + (this._unlocked) ? "unlocked, " : "locked, ") + this._value) + "pts, ") + this._difficulty) + ")"));
}
public function attachIcon(_arg1:DisplayObjectContainer):Sprite{
return (this._iconLoader.attachBitmap(_arg1));
}
public function unlock():void{
if (this._unlocked){
Logger.logWarning((("Medal \"" + this._name) + "\" is already unlocked."));
return;
};
Logger.logMessage((("Unlocking medal \"" + this.name) + "\"..."));
this._unlocked = true;
if (this._connection.hasUserSession){
this._connection.sendSimpleCommand("unlockMedal", this.onUnlockConfirmed, null, {medal_id:this.id});
};
dispatchEvent(new APIEvent(APIEvent.MEDAL_UNLOCKED, this));
}
function setUnlocked(_arg1:Boolean):void{
this._unlocked = _arg1;
}
private function onUnlockConfirmed(_arg1:APIEvent):void{
if (_arg1.success){
Logger.logMessage((("Medal \"" + this.name) + "\" unlocked."));
} else {
Logger.logError((("Failed to unlock \"" + this.name) + "\"!"));
};
dispatchEvent(new APIEvent(APIEvent.MEDAL_UNLOCK_CONFIRMED, this, _arg1.error));
}
}
}//package com.newgrounds
Section 24
//SaveFile (com.newgrounds.SaveFile)
package com.newgrounds {
import flash.utils.*;
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.net.*;
import com.newgrounds.encoders.*;
import com.newgrounds.assets.*;
public class SaveFile extends APIEventDispatcher {
private var _group:SaveGroup;
private var _name:String;
private var _id:uint;
private var _description:String;
private var _authorId:uint;
private var _authorName:String;
private var _createdDate:String;
private var _modifiedDate:String;
private var _views:uint;
private var _readOnly:Boolean;
private var _public:Boolean;
private var _approved:Boolean;
private var _draft:Boolean;
private var _iconLoader:BitmapLoader;
private var _keys:Object;
private var _ratings:Object;
private var _dataURL:String;
private var _data;
private var _dataLoaded:Boolean;
private var _encodedData;
private var _encoderQueue:Array;
private var _encoding:Boolean;
private var _encodingParent:Object;
private var _encodingProperty:String;
private var _fileSize:uint;
private var _dataLoader:URLLoader;
public static const ICON_WIDTH:uint = 90;
public static const ICON_HEIGHT:uint = 90;
private static const STATUS_PRIVATE:uint = 0;
private static const STATUS_SHARED:uint = 1;
private static const STATUS_UNAPPROVED:uint = 2;
private static const STATUS_APPROVED:uint = 3;
public static const DEFAULT_ICON:BitmapData = new DefaultSaveIcon(ICON_WIDTH, ICON_HEIGHT);
private static var _currentFile:SaveFile;
static var _imageFilePath:String = "";
static var _saveFilePath:String = "";
public function SaveFile(_arg1:SaveGroup){
this._iconLoader = new BitmapLoader(DEFAULT_ICON, null);
this._group = _arg1;
this._keys = {};
this._ratings = {};
}
public function get group():SaveGroup{
return (this._group);
}
public function get name():String{
return (this._name);
}
public function set name(_arg1:String):void{
this._name = _arg1;
}
public function get description():String{
return (this._description);
}
public function set description(_arg1:String):void{
this._description = _arg1;
}
public function get id():uint{
return (this._id);
}
public function get data():Object{
return (this._data);
}
public function set data(_arg1:Object):void{
this._data = _arg1;
}
public function get bytesLoaded():uint{
if (this._data){
return (this.bytesTotal);
};
if (!this._dataLoader){
return (0);
};
return (this._dataLoader.bytesLoaded);
}
public function get bytesTotal():uint{
return (this._fileSize);
}
public function get readOnly():Boolean{
return (this._readOnly);
}
public function get draft():Boolean{
return (this._draft);
}
public function set draft(_arg1:Boolean):void{
this._draft = _arg1;
}
public function get authorId():uint{
return (this._authorId);
}
public function get authorName():String{
return (this._authorName);
}
public function get keys():Object{
return (this._keys);
}
public function get ratings():Object{
return (this._ratings);
}
public function get views():uint{
return (this._views);
}
public function get createdDate():String{
return (this._createdDate);
}
public function get updatedDate():String{
return (this._modifiedDate);
}
override public function toString():String{
return (("Save File: " + this._name));
}
public function get icon():BitmapData{
return (this._iconLoader.bitmapData);
}
public function set icon(_arg1:BitmapData):void{
this.createIcon(_arg1);
}
public function get iconLoaded():Boolean{
return (this._iconLoader.loaded);
}
public function createIcon(_arg1:IBitmapDrawable):void{
var _local3:Number;
var _local4:Number;
var _local8:Number;
var _local9:Rectangle;
var _local2:BitmapData = new BitmapData(ICON_WIDTH, ICON_HEIGHT, false, 0);
var _local5:Number = 0;
var _local6:Number = 0;
_local3 = Object(_arg1).width;
_local4 = Object(_arg1).height;
if ((_arg1 is DisplayObject)){
_local9 = DisplayObject(_arg1).getBounds(null);
_local5 = _local9.left;
_local6 = _local9.top;
};
var _local7:Matrix = new Matrix();
_local8 = Math.min((ICON_WIDTH / _local3), (ICON_HEIGHT / _local4));
_local7.translate(-(_local5), -(_local6));
_local7.scale(_local8, _local8);
_local7.translate(((ICON_WIDTH - (_local3 * _local8)) / 2), ((ICON_HEIGHT - (_local4 * _local8)) / 2));
_local2.draw(_arg1, _local7);
this._iconLoader.bitmapData = _local2;
}
public function attachIcon(_arg1:DisplayObjectContainer):Sprite{
if (this._iconLoader){
return (this._iconLoader.attachBitmap(_arg1));
};
Logger.logError("No icon available for this sumbission.");
return (null);
}
public function save():void{
if (!this._group.connection.hasUserSession){
Logger.logError("The user must be logged-in to save a file.");
dispatchEvent(new APIEvent(APIEvent.FILE_SAVED, null, APIEvent.ERROR_NOT_LOGGED_IN));
return;
};
BitmapLoader._cacheSeed++;
_currentFile = this;
this.encodeData(true);
}
private function doSave():void{
var _local3:String;
var _local4:Array;
var _local5:String;
var _local6:SaveKey;
var _local7:SaveRating;
var _local8:ByteArray;
var _local1:APICommand = new APICommand("saveFile");
_local1.secureParameters.group = this._group.id;
_local1.secureParameters.user_name = this._group.connection.username;
_local1.secureParameters.filename = this._name;
_local1.secureParameters.description = this._description;
if (this._draft){
_local1.secureParameters.draft = true;
};
if (((this._id) && (!(this._readOnly)))){
_local1.secureParameters.overwrite = 1;
_local1.secureParameters.save_id = this._id;
};
var _local2:Array = [];
for (_local3 in this._keys) {
_local6 = this._group.getKey(_local3);
if (_local6){
_local2.push({id:_local6.id, value:_local6.validateValue(this._keys[_local3])});
} else {
Logger.logError((((("No key named \"" + _local3) + "\" in save group \"") + this._group.name) + "\"."));
};
};
_local1.secureParameters.keys = _local2;
_local4 = [];
for (_local5 in this._ratings) {
_local7 = this._group.getRating(_local5);
if (_local7){
_local4.push({id:_local7.id, value:_local7.validateValue(this._ratings[_local5])});
} else {
Logger.logError((((("No rating named \"" + _local5) + "\" in save group \"") + this._group.name) + "\"."));
};
};
_local1.secureParameters.ratings = _local4;
_local8 = new ByteArray();
_local8.writeObject(this._encodedData);
_local8.compress();
_local1.addFile("file", _local8, "file");
if (this.iconLoaded){
_local1.addFile("thumbnail", PNGEncoder.encode(this.icon), "thumbnail");
};
_local1.addEventListener(APIEvent.COMMAND_COMPLETE, this.onSaveComplete);
this._group.connection.sendCommand(_local1);
}
private function encodeData(_arg1:Boolean):void{
this._encoderQueue = [];
this._encoding = _arg1;
if (_arg1){
this._encodedData = this._data;
this.preEncodeObject(this, "_encodedData");
} else {
this.preEncodeObject(this, "_data");
};
this.encodeObject();
}
private function preEncodeObject(_arg1:Object, _arg2:String):void{
var _local4:Boolean;
var _local6:Boolean;
var _local7:String;
var _local3:Object = _arg1[_arg2];
try {
if (this._encoding){
_local4 = (_local3 is BitmapData);
} else {
_local4 = (_local3.type == "__bitmap");
};
} catch(error) {
};
var _local5:Object = _local3;
_local6 = (_local3 is ByteArray);
if (_local4){
this._encoderQueue.push({parent:_arg1, property:_arg2});
} else {
if ((((typeof(_local3) == "object")) && (!(_local6)))){
if (this._encoding){
if ((_local3 is Array)){
_local5 = [];
} else {
_local5 = {};
};
for (_local7 in _local3) {
_local5[_local7] = _local3[_local7];
};
_arg1[_arg2] = _local5;
};
for (_local7 in _local5) {
this.preEncodeObject(_local5, _local7);
};
};
};
}
private function encodeObject():void{
var _local5:Object;
if (!this._encoderQueue.length){
if (this._encoding){
this.doSave();
} else {
this._dataLoaded = true;
this.checkLoadComplete();
};
return;
};
var _local1:Object = this._encoderQueue.pop();
var _local2:Object = _local1.parent;
var _local3:String = _local1.property;
var _local4:Object = _local2[_local3];
if (this._encoding){
_local5 = {type:"__bitmap", width:_local4.width, height:_local4.height, transparent:_local4.transparent};
_local2[_local3] = _local5;
_local5.data = new ByteArray();
_local5.data.writeBytes(_local4.getPixels(_local4.rect));
_local5.data.position = 0;
} else {
_local5 = new BitmapData(_local4.width, _local4.height, _local4.transparent);
new BitmapData(_local4.width, _local4.height, _local4.transparent).setPixels(_local5.rect, _local4.data);
_local2[_local3] = _local5;
};
this.encodeObject();
}
private function onIconLoaded(_arg1:APIEvent):void{
if (((!(_arg1.success)) && (this._iconLoader.url))){
Logger.logWarning("Unable to load the icon for this save file.");
};
this._iconLoader.removeEventListener(APIEvent.ICON_LOADED, this.onIconLoaded);
this.checkLoadComplete();
}
private function checkLoadComplete():void{
if (((this._dataLoaded) && (this.iconLoaded))){
Logger.logMessage("Data loaded.");
dispatchEvent(new APIEvent(APIEvent.FILE_LOADED, this));
};
}
private function onDataLoaded(_arg1):void{
var byteArray:ByteArray;
var data = _arg1;
try {
if (data){
byteArray = data;
byteArray.uncompress();
this._data = byteArray.readObject();
this.encodeData(false);
};
} catch(error:Error) {
Logger.logError("Error while loading data:", error);
dispatchEvent(new APIEvent(APIEvent.FILE_LOADED, this, APIEvent.ERROR_BAD_FILE));
};
}
private function onDataError(_arg1:String):void{
Logger.logError("Unable to load data:", _arg1);
dispatchEvent(new APIEvent(APIEvent.FILE_LOADED, this, APIEvent.ERROR_BAD_FILE));
}
private function onSaveComplete(_arg1:APIEvent):void{
if (_arg1.success){
Logger.logMessage((("File \"" + this._name) + "\" saved!"));
if (_arg1.data){
this._id = _arg1.data.save_id;
this._dataURL = unescape(_arg1.data.file_url);
};
dispatchEvent(new APIEvent(APIEvent.FILE_SAVED, this));
} else {
Logger.logError((("Error saving file \"" + this._name) + "\":"), _arg1.error);
dispatchEvent(new APIEvent(APIEvent.FILE_SAVED, this, _arg1.error));
};
}
public function sendVote(_arg1:String, _arg2:Number):void{
var _local3:SaveRating = this._group.getRating(_arg1);
if (!_local3){
Logger.logError((("No save rating named \"" + _arg1) + "\" exists for this save group."));
dispatchEvent(new APIEvent(APIEvent.VOTE_COMPLETE, {}, APIEvent.ERROR_INVALID_ARGUMENT));
return;
};
_arg2 = _local3.validateValue(_arg2);
if (isNaN(_arg2)){
Logger.logError((((((((("Invalid vote (" + _arg2) + "). ") + _arg1) + " allows a range of ") + _local3.minimum) + "-") + _local3.maximum) + "."));
dispatchEvent(new APIEvent(APIEvent.VOTE_COMPLETE, {}, APIEvent.ERROR_INVALID_ARGUMENT));
return;
};
Logger.logMessage((((((("Voting " + _arg2) + " for ") + _arg1) + " on ") + this._name) + "..."));
this._group.connection.sendSimpleCommand("rateSaveFile", this.onVoteComplete, null, {group:this._group.id, save_id:this._id, rating_id:_local3.id, vote:_arg2});
}
private function onVoteComplete(_arg1:APIEvent):void{
var _local3:SaveRating;
var _local2:String = _arg1.error;
if (_arg1.data.already_voted){
Logger.logError("Vote failed. You've already voted on this rating today.");
_local2 = APIEvent.ERROR_ALREADY_VOTED;
};
if (_local2 == APIEvent.ERROR_NONE){
_local3 = this._group.getRatingById(_arg1.data.rating_id);
if (_local3){
this._ratings[_local3.name] = _local3.validateValue(_arg1.data.score);
};
Logger.logMessage("Vote complete!");
};
dispatchEvent(new APIEvent(APIEvent.VOTE_COMPLETE, this, _local2));
}
public function clone():SaveFile{
var _local2:String;
var _local1:SaveFile = new SaveFile(this._group);
_local1._data = this._data;
_local1._description = this._description;
_local1._draft = this._draft;
_local1._fileSize = this._fileSize;
_local1._iconLoader.bitmapData = this._iconLoader.bitmapData;
for (_local2 in this._keys) {
_local1._keys[_local2] = this._keys[_local2];
};
for (_local2 in this._ratings) {
_local1._ratings[_local2] = this._ratings[_local2];
};
_local1._name = this._name;
return (_local1);
}
public function load():void{
_currentFile = this;
this._dataLoaded = false;
this._data = null;
if (!this.iconLoaded){
this._iconLoader.addEventListener(APIEvent.ICON_LOADED, this.onIconLoaded);
this._iconLoader.load();
};
this._dataLoader = new URLLoader();
this._dataLoader.dataFormat = URLLoaderDataFormat.BINARY;
this._dataLoader.addEventListener(Event.COMPLETE, this.as3DataLoaded);
this._dataLoader.addEventListener(IOErrorEvent.IO_ERROR, this.as3DataError);
this._dataLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.as3DataError);
this._dataLoader.load(new URLRequest(this._dataURL));
}
private function as3DataLoaded(_arg1:Event):void{
this.onDataLoaded(this._dataLoader.data);
}
private function as3DataError(_arg1:Event):void{
this.onDataError(_arg1.toString());
}
private function decodeObject(_arg1:Object):Object{
var _local2:BitmapData;
var _local3:String;
if (getQualifiedClassName(_arg1) == "Object"){
if (_arg1.type == "__bitmap"){
_local2 = new BitmapData(_arg1.width, _arg1.height, _arg1.transparent);
_local2.setPixels(_local2.rect, _arg1.data);
_arg1 = _local2;
} else {
for (_local3 in _arg1) {
_arg1[_local3] = this.decodeObject(_arg1[_local3]);
};
};
};
return (_arg1);
}
public static function get currentFile():SaveFile{
return (_currentFile);
}
static function fromObject(_arg1:SaveGroup, _arg2:Object):SaveFile{
var _local4:Object;
var _local5:Object;
var _local6:SaveKey;
var _local7:SaveRating;
var _local3:SaveFile = new SaveFile(_arg1);
_local3._name = _arg2.filename;
_local3._description = _arg2.description;
_local3._id = _arg2.save_id;
_local3._authorId = _arg2.user_id;
_local3._authorName = _arg2.user_name;
_local3._createdDate = _arg2.created;
_local3._modifiedDate = _arg2.last_update;
_local3._views = _arg2.views;
if (((_arg2.thumb) && (!((_arg2.thumb == ""))))){
_local3._iconLoader.url = (_imageFilePath + _arg2.thumb);
};
_local3._dataURL = (_saveFilePath + _arg2.file);
_local3._fileSize = _arg2.file_size;
_local3._approved = !((_arg2.status == STATUS_UNAPPROVED));
_local3._readOnly = false;
_local3._public = ((!((_arg2.status == STATUS_PRIVATE))) && (!((_arg2.status == STATUS_UNAPPROVED))));
for each (_local4 in _arg2.keys) {
_local6 = _arg1.getKeyById(_local4.id);
if (_local6){
_local3._keys[_local6.name] = _local6.validateValue(_local4.value);
};
};
for each (_local5 in _arg2.ratings) {
_local7 = _arg1.getRatingById(_local5.id);
if (_local7){
_local3._ratings[_local7.name] = _local7.validateValue(_local5.score);
};
};
return (_local3);
}
}
}//package com.newgrounds
Section 25
//SaveGroup (com.newgrounds.SaveGroup)
package com.newgrounds {
public class SaveGroup {
private var _connection:APIConnection;
private var _name:String;
private var _id:uint;
private var _type:uint;
private var _keysArray:Array;
private var _ratingsArray:Array;
private var _keys:Object;
private var _ratings:Object;
public static const TYPE_SYSTEM:uint = 0;
public static const TYPE_PRIVATE:uint = 1;
public static const TYPE_PUBLIC:uint = 2;
public static const TYPE_MODERATED:uint = 3;
public function SaveGroup(_arg1:APIConnection, _arg2:String, _arg3:uint, _arg4:uint, _arg5:Array, _arg6:Array){
var _local7:uint;
var _local8:SaveKey;
var _local9:SaveRating;
super();
this._connection = _arg1;
this._id = _arg3;
this._name = _arg2;
this._type = _arg4;
this._keysArray = _arg5;
this._ratingsArray = _arg6;
this._keys = new Object();
this._ratings = new Object();
for each (_local8 in _arg5) {
this._keys[_local8.name] = _local8;
};
for each (_local9 in _arg6) {
this._ratings[_local9.name] = _local9;
};
}
public function get connection():APIConnection{
return (this._connection);
}
public function get name():String{
return (this._name);
}
public function get type():uint{
return (this._type);
}
public function get id():uint{
return (this._id);
}
public function get keys():Array{
return (this._keysArray);
}
public function get ratings():Array{
return (this._ratingsArray);
}
public function getKey(_arg1:String):SaveKey{
return (this._keys[_arg1]);
}
public function getRating(_arg1:String):SaveRating{
return (this._ratings[_arg1]);
}
public function getKeyById(_arg1:uint):SaveKey{
var _local2:SaveKey;
for each (_local2 in this._keys) {
if (_local2.id == _arg1){
return (_local2);
};
};
return (null);
}
public function getRatingById(_arg1:uint):SaveRating{
var _local2:SaveRating;
for each (_local2 in this._ratings) {
if (_local2.id == _arg1){
return (_local2);
};
};
return (null);
}
public function toString():String{
return (((((("SaveGroup: " + this.name) + " Keys: ") + this._keysArray) + " Ratings: ") + this._ratingsArray));
}
}
}//package com.newgrounds
Section 26
//SaveKey (com.newgrounds.SaveKey)
package com.newgrounds {
public class SaveKey {
private var _name:String;
private var _id:uint;
private var _type:uint;
public static const TYPE_FLOAT:uint = 1;
public static const TYPE_INTEGER:uint = 2;
public static const TYPE_STRING:uint = 3;
public static const TYPE_BOOLEAN:uint = 4;
public function SaveKey(_arg1:String, _arg2:uint, _arg3:uint){
this._name = _arg1;
this._id = _arg2;
this._type = _arg3;
}
public function get name():String{
return (this._name);
}
public function get id():uint{
return (this._id);
}
public function get type():uint{
return (this._type);
}
public function validateValue(_arg1){
var _local2:int;
switch (this._type){
case TYPE_INTEGER:
_arg1 = Number(_arg1);
if (!isNaN(_arg1)){
_local2 = int(_arg1);
if (_local2 != _arg1){
Logger.logWarning((((((("Float value " + _arg1) + " given for integer key \"") + this._name) + "\". Clamping to ") + _local2) + "."));
};
return (_local2);
};
break;
case TYPE_FLOAT:
_arg1 = Number(_arg1);
if (!isNaN(_arg1)){
return (isNaN(Number(_arg1)));
};
break;
case TYPE_BOOLEAN:
return (Boolean(_arg1));
case TYPE_STRING:
return ((_arg1) ? _arg1.toString() : "");
};
return (null);
}
public function toString():String{
return (this._name);
}
}
}//package com.newgrounds
Section 27
//SaveQuery (com.newgrounds.SaveQuery)
package com.newgrounds {
public class SaveQuery extends APIEventDispatcher {
private var _connection:APIConnection;
private var _group:SaveGroup;
private var _page:uint;// = 1
private var _resultsPerPage:uint;// = 10
private var _isRandomized:Boolean;// = false
private var _files:Array;
private var _totalResults:uint;
private var _lookupKeys:Array;
private var _lookupRatings:Array;
private var _fileConditions:Array;
private var _keyConditions:Array;
private var _ratingConditions:Array;
private var _sortFields:Array;
public static const FILE_ID:String = "fileId";
public static const AUTHOR_ID:String = "authorId";
public static const AUTHOR_NAME:String = "authorName";
public static const FILE_NAME:String = "fileName";
public static const CREATED_ON:String = "createdOn";
public static const UPDATED_ON:String = "updatedOn";
public static const FILE_VIEWS:String = "fileViews";
public static const FILE_STATUS:String = "fileStatus";
private static const FILE_FIELDS:Array = [FILE_ID, AUTHOR_ID, AUTHOR_NAME, FILE_NAME, CREATED_ON, UPDATED_ON, FILE_VIEWS, FILE_STATUS];
public static const OPERATOR_EQUAL:String = "=";
public static const OPERATOR_LESS_THAN:String = "<";
public static const OPERATOR_GREATER_THAN:String = ">";
public static const OPERATOR_NOT_EQUAL:String = "!=";
public static const OPERATOR_LESS_OR_EQUAL:String = "<=";
public static const OPERATOR_GREATER_OR_EQUAL:String = ">=";
public static const OPERATOR_CONTAINS:String = "*";
public static const OPERATOR_NOT_CONTAINS:String = "!*";
public static const OPERATOR_NOT_BEGINS_WITH:String = "!*=";
public static const OPERATOR_NOT_ENDS_WITH:String = "!=*";
public static const OPERATOR_BEGINS_WITH:String = "*=";
public static const OPERATOR_ENDS_WITH:String = "=*";
private static const TABLE_FILES:uint = 1;
private static const TABLE_KEYS:uint = 2;
private static const TABLE_RATINGS:uint = 3;
public function SaveQuery(_arg1:SaveGroup){
this._group = _arg1;
this._connection = _arg1.connection;
this.reset();
}
public function get group():SaveGroup{
return (this._group);
}
public function get resultsPerPage():uint{
return (this._resultsPerPage);
}
public function set resultsPerPage(_arg1:uint):void{
this._resultsPerPage = Math.min(Math.max(_arg1, 1), 100);
}
public function get page():uint{
return (this._page);
}
public function set page(_arg1:uint):void{
this._page = Math.max(_arg1, 1);
}
public function prevPage():void{
this.page--;
}
public function nextPage():void{
this.page++;
}
public function get isRandomized():Boolean{
return (this._isRandomized);
}
public function set isRandomized(_arg1:Boolean):void{
this._isRandomized = _arg1;
}
public function get files():Array{
return (this._files);
}
public function reset():void{
this._page = 1;
this._resultsPerPage = 10;
this._isRandomized = false;
this._lookupKeys = [];
this._lookupRatings = [];
this._fileConditions = [];
this._keyConditions = [];
this._ratingConditions = [];
this._sortFields = [];
this._files = [];
this.includeAllFields();
}
public function clone():SaveQuery{
var _local1:SaveQuery = new SaveQuery(this._group);
_local1._page = this._page;
_local1._resultsPerPage = this._resultsPerPage;
_local1._isRandomized = this._isRandomized;
_local1._lookupKeys = this._lookupKeys.concat();
_local1._lookupRatings = this._lookupRatings.concat();
_local1._fileConditions = this._fileConditions.concat();
_local1._keyConditions = this._keyConditions.concat();
_local1._ratingConditions = this._ratingConditions.concat();
return (_local1);
}
private function includeAllFields():void{
var _local1:SaveKey;
var _local2:SaveRating;
for each (_local1 in this._group.keys) {
this._lookupKeys.push(_local1.id);
};
for each (_local2 in this._group.ratings) {
this._lookupRatings.push(_local2.id);
};
}
public function addCondition(_arg1:String, _arg2:String, _arg3):void{
var _local4:int;
var _local5:SaveKey;
var _local6:Array;
var _local7:SaveRating;
_local4 = FILE_FIELDS.indexOf(_arg1);
if (_local4 >= 0){
this._fileConditions.push({field:_local4, operator:_arg2, value:_arg3});
} else {
_local5 = this._group.getKey(_arg1);
if (_local5){
_arg3 = _local5.validateValue(_arg3);
this._keyConditions.push({key_id:_local5.id, operator:_arg2, value:_arg3});
return;
};
_local6 = _arg1.split(".");
_local7 = this._group.getRating(_local6[0]);
if (_local7){
_arg3 = _local7.validateValue(_arg3);
this._ratingConditions.push({rating_id:_local7.id, operator:_arg2, value:_arg3, column:(_local6[1]) ? _local6[1] : "score"});
return;
};
Logger.logError((((("The save group \"" + this._group.name) + "\" does not have a field named \"") + _arg1) + "\"."));
};
}
public function sortOn(_arg1:String, _arg2:Boolean=false):void{
var _local3:int;
var _local4:SaveKey;
var _local5:Array;
var _local6:SaveRating;
_local3 = FILE_FIELDS.indexOf(_arg1);
if (_local3 >= 0){
this._sortFields.push({table:TABLE_FILES, field:_local3, desc:_arg2});
} else {
_local4 = this._group.getKey(_arg1);
if (_local4){
this._sortFields.push({table:TABLE_KEYS, field:_local4.id, desc:_arg2});
return;
};
_local5 = _arg1.split(".");
_local6 = this._group.getRating(_local5[0]);
if (_local6){
this._sortFields.push({table:TABLE_RATINGS, field:_local6.id, desc:_arg2, extra:(_local5[1]) ? _local5[1] : "score"});
return;
};
Logger.logError((((("The save group \"" + this._group.name) + "\" does not have a field named \"") + _arg1) + "\"."));
};
}
public function execute():void{
var _local1:Object = {};
_local1.page = this._page;
_local1.num_results = this._resultsPerPage;
if (this._isRandomized){
_local1.randomize = 1;
};
if (((this._lookupKeys) && (this._lookupKeys.length))){
_local1.lookup_keys = this._lookupKeys;
};
if (((this._lookupRatings) && (this._lookupRatings.length))){
_local1.lookup_ratings = this._lookupRatings;
};
if (((this._fileConditions) && (this._fileConditions.length))){
_local1.file_conditions = this._fileConditions;
};
if (((this._keyConditions) && (this._keyConditions.length))){
_local1.key_conditions = this._keyConditions;
};
if (((this._ratingConditions) && (this._ratingConditions.length))){
_local1.rating_conditions = this._ratingConditions;
};
if (((this._sortFields) && (this._sortFields.length))){
_local1.sort_conditions = this._sortFields;
};
this._connection.sendSimpleCommand("lookupSaveFiles", this.onQueryComplete, {publisher_id:this._connection.publisherId, group_id:this._group.id, query:_local1});
}
private function onQueryComplete(_arg1:APIEvent):void{
var _local2:Object;
var _local3:uint;
var _local4:SaveFile;
if (_arg1.success){
_local2 = _arg1.data;
this._files = [];
if (_local2.files){
_local3 = 0;
while (_local3 < _local2.files.length) {
_local4 = SaveFile.fromObject(this._group, _local2.files[_local3]);
if (_local4){
this._files.push(_local4);
};
_local3++;
};
};
dispatchEvent(new APIEvent(APIEvent.QUERY_COMPLETE, this));
} else {
Logger.logError(("Query failed: " + _arg1.error));
dispatchEvent(new APIEvent(APIEvent.QUERY_COMPLETE, this, _arg1.error));
};
}
}
}//package com.newgrounds
Section 28
//SaveRating (com.newgrounds.SaveRating)
package com.newgrounds {
public class SaveRating {
private var _name:String;
private var _id:uint;
private var _isFloat:Boolean;
private var _minimum:Number;
private var _maximum:Number;
public function SaveRating(_arg1:String, _arg2:uint, _arg3:Boolean, _arg4:Number, _arg5:Number){
this._name = _arg1;
this._id = _arg2;
this._isFloat = _arg3;
this._minimum = _arg4;
this._maximum = _arg5;
}
public function get name():String{
return (this._name);
}
public function get id():uint{
return (this._id);
}
public function get isFloat():Boolean{
return (this._isFloat);
}
public function get minimum():Number{
return (this._minimum);
}
public function get maximum():Number{
return (this._maximum);
}
public function validateValue(_arg1):Number{
var _local3:int;
var _local2:Number = Number(_arg1);
if (isNaN(_local2)){
Logger.logError((("Invalid value for rating \"" + this._name) + "\"."));
return (NaN);
};
if (_local2 < this._minimum){
Logger.logWarning((((((_local2 + " is out of acceptable range for rating \"") + this._name) + "\". Clamping to ") + this._minimum) + "."));
return (this._minimum);
};
if (_local2 > this._maximum){
Logger.logWarning((((((_local2 + " is out of acceptable range for rating \"") + this._name) + "\". Clamping to ") + this._maximum) + "."));
return (this._maximum);
};
if (!this.isFloat){
_local3 = int(_local2);
if (_local3 != _local2){
Logger.logWarning((((((("Float value " + _local2) + " given for integer rating \"") + this._name) + "\". Clamping to ") + _local3) + "."));
};
return (_local3);
};
return (_local2);
}
public function toString():String{
return (this._name);
}
}
}//package com.newgrounds
Section 29
//Score (com.newgrounds.Score)
package com.newgrounds {
public class Score {
private var _numericValue:Number;
private var _rank:uint;
private var _username:String;
private var _score:String;
private var _tag:String;
public function Score(_arg1:uint, _arg2:String, _arg3:String, _arg4:Number, _arg5:String){
this._rank = _arg1;
this._username = _arg2;
this._score = _arg3;
this._numericValue = _arg4;
this._tag = _arg5;
}
public function get numericValue():Number{
return (this._numericValue);
}
public function get rank():uint{
return (this._rank);
}
public function get score():String{
return (this._score);
}
public function get tag():String{
return (this._tag);
}
public function get username():String{
return (this._username);
}
public function toString():String{
return (((((this._rank + ".\t") + this._username) + "\t") + this._score));
}
}
}//package com.newgrounds
Section 30
//ScoreBoard (com.newgrounds.ScoreBoard)
package com.newgrounds {
public class ScoreBoard extends APIEventDispatcher {
private var _connection:APIConnection;
private var _name:String;
private var _id:uint;
private var _period:String;// = "All-Time"
private var _firstResult:uint;// = 1
private var _numResults:uint;// = 10
private var _tag:String;
private var _scores:Array;
public static const TODAY:String = "Today";
public static const THIS_WEEK:String = "This Week";
public static const THIS_MONTH:String = "This Month";
public static const THIS_YEAR:String = "This Year";
public static const ALL_TIME:String = "All-Time";
public function ScoreBoard(_arg1:APIConnection, _arg2:String, _arg3:uint){
this._connection = _arg1;
this._name = _arg2;
this._id = _arg3;
}
public function get name():String{
return (this._name);
}
public function get scores():Array{
return (this._scores);
}
public function get period():String{
return (this._period);
}
public function set period(_arg1:String):void{
this._period = _arg1;
}
public function get firstResult():uint{
return (this._firstResult);
}
public function set firstResult(_arg1:uint):void{
this._firstResult = Math.max(1, _arg1);
}
public function get numResults():uint{
return (this._numResults);
}
public function set numResults(_arg1:uint):void{
this._numResults = _arg1;
}
public function get tag():String{
return (this._tag);
}
public function set tag(_arg1:String):void{
this._tag = _arg1;
}
public function get page():uint{
return ((Math.ceil(((this._firstResult - 1) / this._numResults)) + 1));
}
public function prevPage():void{
if (this.firstResult > this._numResults){
this.firstResult = (this.firstResult - this._numResults);
};
}
public function nextPage():void{
this.firstResult = (this.firstResult + this._numResults);
}
public function loadScores():void{
this._connection.sendSimpleCommand("loadScores", this.onScoresLoaded, {publisher_id:this._connection.publisherId, board:this._id, page:(((this._firstResult - 1) / this._numResults) + 1), num_results:this._numResults, period:this._period, tag:this._tag});
}
public function postScore(_arg1:Number, _arg2:String=null):void{
if (isNaN(_arg1)){
Logger.logError(("Cannot post invalid score: " + _arg1));
dispatchEvent(new APIEvent(APIEvent.SCORE_POSTED, null, APIEvent.ERROR_INVALID_ARGUMENT));
return;
};
Logger.logMessage((((((("Posting a score of " + _arg1) + " by ") + this._connection.username) + " to scoreboard \"") + this._name) + "\"..."));
this._connection.sendSimpleCommand("postScore", this.onScorePosted, null, {user_name:this._connection.username, board:this._id, value:_arg1, tag:_arg2});
}
private function onScoresLoaded(_arg1:APIEvent):void{
var _local3:uint;
var _local4:uint;
var _local5:Object;
var _local2:Object = _arg1.data;
this._scores = [];
if (_local2.first_result){
_local3 = _local2.first_result;
} else {
_local3 = this._firstResult;
};
if (_local2.scores){
_local4 = 0;
while (_local4 < _local2.scores.length) {
_local5 = _local2.scores[_local4];
if (_local5){
this._scores[_local4] = new Score(_local3, _local5.username, _local5.value, _local5.numeric_value, _local5.tag);
};
_local4++;
_local3++;
};
};
dispatchEvent(new APIEvent(APIEvent.SCORES_LOADED, this));
}
private function onScorePosted(_arg1:APIEvent):void{
var _local2:Object;
var _local3:Object;
if (_arg1.success){
Logger.logMessage("Score posted!");
_local2 = _arg1.data;
_local3 = {};
_local3.score = _local2.value;
_local3.scoreBoard = this;
} else {
Logger.logError(("Error posting score: " + _arg1.error));
};
dispatchEvent(new APIEvent(APIEvent.SCORE_POSTED, _local3, _arg1.error));
}
override public function toString():String{
return (("Scoreboard: " + this._name));
}
}
}//package com.newgrounds
Section 31
//BaseButton (fl.controls.BaseButton)
package fl.controls {
import flash.utils.*;
import flash.display.*;
import flash.events.*;
import fl.core.*;
import fl.events.*;
public class BaseButton extends UIComponent {
protected var background:DisplayObject;
protected var mouseState:String;
protected var _selected:Boolean;// = false
protected var _autoRepeat:Boolean;// = false
protected var pressTimer:Timer;
private var _mouseStateLocked:Boolean;// = false
private var unlockedMouseState:String;
private static var defaultStyles:Object = {upSkin:"Button_upSkin", downSkin:"Button_downSkin", overSkin:"Button_overSkin", disabledSkin:"Button_disabledSkin", selectedDisabledSkin:"Button_selectedDisabledSkin", selectedUpSkin:"Button_selectedUpSkin", selectedDownSkin:"Button_selectedDownSkin", selectedOverSkin:"Button_selectedOverSkin", focusRectSkin:null, focusRectPadding:null, repeatDelay:500, repeatInterval:35};
public function BaseButton(){
buttonMode = true;
mouseChildren = false;
useHandCursor = false;
setupMouseEvents();
setMouseState("up");
pressTimer = new Timer(1, 0);
pressTimer.addEventListener(TimerEvent.TIMER, buttonDown, false, 0, true);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override public function set enabled(_arg1:Boolean):void{
super.enabled = _arg1;
mouseEnabled = _arg1;
}
public function get selected():Boolean{
return (_selected);
}
public function set selected(_arg1:Boolean):void{
if (_selected == _arg1){
return;
};
_selected = _arg1;
invalidate(InvalidationType.STATE);
}
public function get autoRepeat():Boolean{
return (_autoRepeat);
}
public function set autoRepeat(_arg1:Boolean):void{
_autoRepeat = _arg1;
}
public function set mouseStateLocked(_arg1:Boolean):void{
_mouseStateLocked = _arg1;
if (_arg1 == false){
setMouseState(unlockedMouseState);
} else {
unlockedMouseState = mouseState;
};
}
public function setMouseState(_arg1:String):void{
if (_mouseStateLocked){
unlockedMouseState = _arg1;
return;
};
if (mouseState == _arg1){
return;
};
mouseState = _arg1;
invalidate(InvalidationType.STATE);
}
protected function setupMouseEvents():void{
addEventListener(MouseEvent.ROLL_OVER, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_DOWN, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.MOUSE_UP, mouseEventHandler, false, 0, true);
addEventListener(MouseEvent.ROLL_OUT, mouseEventHandler, false, 0, true);
}
protected function mouseEventHandler(_arg1:MouseEvent):void{
if (_arg1.type == MouseEvent.MOUSE_DOWN){
setMouseState("down");
startPress();
} else {
if ((((_arg1.type == MouseEvent.ROLL_OVER)) || ((_arg1.type == MouseEvent.MOUSE_UP)))){
setMouseState("over");
endPress();
} else {
if (_arg1.type == MouseEvent.ROLL_OUT){
setMouseState("up");
endPress();
};
};
};
}
protected function startPress():void{
if (_autoRepeat){
pressTimer.delay = Number(getStyleValue("repeatDelay"));
pressTimer.start();
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function buttonDown(_arg1:TimerEvent):void{
if (!_autoRepeat){
endPress();
return;
};
if (pressTimer.currentCount == 1){
pressTimer.delay = Number(getStyleValue("repeatInterval"));
};
dispatchEvent(new ComponentEvent(ComponentEvent.BUTTON_DOWN, true));
}
protected function endPress():void{
pressTimer.reset();
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
super.draw();
}
protected function drawBackground():void{
var _local1:String = (enabled) ? mouseState : "disabled";
if (selected){
_local1 = (("selected" + _local1.substr(0, 1).toUpperCase()) + _local1.substr(1));
};
_local1 = (_local1 + "Skin");
var _local2:DisplayObject = background;
background = getDisplayObjectInstance(getStyleValue(_local1));
addChildAt(background, 0);
if (((!((_local2 == null))) && (!((_local2 == background))))){
removeChild(_local2);
};
}
protected function drawLayout():void{
background.width = width;
background.height = height;
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 32
//Button (fl.controls.Button)
package fl.controls {
import flash.display.*;
import fl.core.*;
import fl.managers.*;
public class Button extends LabelButton implements IFocusManagerComponent {
protected var _emphasized:Boolean;// = false
protected var emphasizedBorder:DisplayObject;
private static var defaultStyles:Object = {emphasizedSkin:"Button_emphasizedSkin", emphasizedPadding:2};
public static var createAccessibilityImplementation:Function;
public function get emphasized():Boolean{
return (_emphasized);
}
public function set emphasized(_arg1:Boolean):void{
_emphasized = _arg1;
invalidate(InvalidationType.STYLES);
}
override protected function draw():void{
if (((isInvalid(InvalidationType.STYLES)) || (isInvalid(InvalidationType.SIZE)))){
drawEmphasized();
};
super.draw();
if (emphasizedBorder != null){
setChildIndex(emphasizedBorder, (numChildren - 1));
};
}
protected function drawEmphasized():void{
var _local2:Number;
if (emphasizedBorder != null){
removeChild(emphasizedBorder);
};
emphasizedBorder = null;
if (!_emphasized){
return;
};
var _local1:Object = getStyleValue("emphasizedSkin");
if (_local1 != null){
emphasizedBorder = getDisplayObjectInstance(_local1);
};
if (emphasizedBorder != null){
addChildAt(emphasizedBorder, 0);
_local2 = Number(getStyleValue("emphasizedPadding"));
emphasizedBorder.x = (emphasizedBorder.y = -(_local2));
emphasizedBorder.width = (width + (_local2 * 2));
emphasizedBorder.height = (height + (_local2 * 2));
};
}
override public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
var _local3:*;
super.drawFocus(_arg1);
if (_arg1){
_local2 = Number(getStyleValue("emphasizedPadding"));
if ((((_local2 < 0)) || (!(_emphasized)))){
_local2 = 0;
};
_local3 = getStyleValue("focusRectPadding");
_local3 = ((_local3)==null) ? 2 : _local3;
_local3 = (_local3 + _local2);
uiFocusRect.x = -(_local3);
uiFocusRect.y = -(_local3);
uiFocusRect.width = (width + (_local3 * 2));
uiFocusRect.height = (height + (_local3 * 2));
};
}
override protected function initializeAccessibility():void{
if (Button.createAccessibilityImplementation != null){
Button.createAccessibilityImplementation(this);
};
}
public static function getStyleDefinition():Object{
return (UIComponent.mergeStyles(LabelButton.getStyleDefinition(), defaultStyles));
}
}
}//package fl.controls
Section 33
//ButtonLabelPlacement (fl.controls.ButtonLabelPlacement)
package fl.controls {
public class ButtonLabelPlacement {
public static const BOTTOM:String = "bottom";
public static const TOP:String = "top";
public static const LEFT:String = "left";
public static const RIGHT:String = "right";
}
}//package fl.controls
Section 34
//LabelButton (fl.controls.LabelButton)
package fl.controls {
import flash.display.*;
import flash.events.*;
import fl.core.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.ui.*;
public class LabelButton extends BaseButton implements IFocusManagerComponent {
public var textField:TextField;
protected var _labelPlacement:String;// = "right"
protected var _toggle:Boolean;// = false
protected var icon:DisplayObject;
protected var oldMouseState:String;
protected var _label:String;// = "Label"
protected var mode:String;// = "center"
private static var defaultStyles:Object = {icon:null, upIcon:null, downIcon:null, overIcon:null, disabledIcon:null, selectedDisabledIcon:null, selectedUpIcon:null, selectedDownIcon:null, selectedOverIcon:null, textFormat:null, disabledTextFormat:null, textPadding:5, embedFonts:false};
public static var createAccessibilityImplementation:Function;
public function get label():String{
return (_label);
}
public function set label(_arg1:String):void{
_label = _arg1;
if (textField.text != _label){
textField.text = _label;
dispatchEvent(new ComponentEvent(ComponentEvent.LABEL_CHANGE));
};
invalidate(InvalidationType.SIZE);
invalidate(InvalidationType.STYLES);
}
public function get labelPlacement():String{
return (_labelPlacement);
}
public function set labelPlacement(_arg1:String):void{
_labelPlacement = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get toggle():Boolean{
return (_toggle);
}
public function set toggle(_arg1:Boolean):void{
if (((!(_arg1)) && (super.selected))){
selected = false;
};
_toggle = _arg1;
if (_toggle){
addEventListener(MouseEvent.CLICK, toggleSelected, false, 0, true);
} else {
removeEventListener(MouseEvent.CLICK, toggleSelected);
};
invalidate(InvalidationType.STATE);
}
protected function toggleSelected(_arg1:MouseEvent):void{
selected = !(selected);
dispatchEvent(new Event(Event.CHANGE, true));
}
override public function get selected():Boolean{
return ((_toggle) ? _selected : false);
}
override public function set selected(_arg1:Boolean):void{
_selected = _arg1;
if (_toggle){
invalidate(InvalidationType.STATE);
};
}
override protected function configUI():void{
super.configUI();
textField = new TextField();
textField.type = TextFieldType.DYNAMIC;
textField.selectable = false;
addChild(textField);
}
override protected function draw():void{
if (textField.text != _label){
label = _label;
};
if (isInvalid(InvalidationType.STYLES, InvalidationType.STATE)){
drawBackground();
drawIcon();
drawTextFormat();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
drawLayout();
};
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function drawIcon():void{
var _local1:DisplayObject = icon;
var _local2:String = (enabled) ? mouseState : "disabled";
if (selected){
_local2 = (("selected" + _local2.substr(0, 1).toUpperCase()) + _local2.substr(1));
};
_local2 = (_local2 + "Icon");
var _local3:Object = getStyleValue(_local2);
if (_local3 == null){
_local3 = getStyleValue("icon");
};
if (_local3 != null){
icon = getDisplayObjectInstance(_local3);
};
if (icon != null){
addChildAt(icon, 1);
};
if (((!((_local1 == null))) && (!((_local1 == icon))))){
removeChild(_local1);
};
}
protected function drawTextFormat():void{
var _local1:Object = UIComponent.getStyleDefinition();
var _local2:TextFormat = (enabled) ? (_local1.defaultTextFormat as TextFormat) : (_local1.defaultDisabledTextFormat as TextFormat);
textField.setTextFormat(_local2);
var _local3:TextFormat = (getStyleValue((enabled) ? "textFormat" : "disabledTextFormat") as TextFormat);
if (_local3 != null){
textField.setTextFormat(_local3);
} else {
_local3 = _local2;
};
textField.defaultTextFormat = _local3;
setEmbedFont();
}
protected function setEmbedFont(){
var _local1:Object = getStyleValue("embedFonts");
if (_local1 != null){
textField.embedFonts = _local1;
};
}
override protected function drawLayout():void{
var _local7:Number;
var _local8:Number;
var _local1:Number = Number(getStyleValue("textPadding"));
var _local2:String = ((((icon == null)) && ((mode == "center")))) ? ButtonLabelPlacement.TOP : _labelPlacement;
textField.height = (textField.textHeight + 4);
var _local3:Number = (textField.textWidth + 4);
var _local4:Number = (textField.textHeight + 4);
var _local5:Number = ((icon)==null) ? 0 : (icon.width + _local1);
var _local6:Number = ((icon)==null) ? 0 : (icon.height + _local1);
textField.visible = (label.length > 0);
if (icon != null){
icon.x = Math.round(((width - icon.width) / 2));
icon.y = Math.round(((height - icon.height) / 2));
};
if (textField.visible == false){
textField.width = 0;
textField.height = 0;
} else {
if ((((_local2 == ButtonLabelPlacement.BOTTOM)) || ((_local2 == ButtonLabelPlacement.TOP)))){
_local7 = Math.max(0, Math.min(_local3, (width - (2 * _local1))));
if ((height - 2) > _local4){
_local8 = _local4;
} else {
_local8 = (height - 2);
};
_local3 = _local7;
textField.width = _local3;
_local4 = _local8;
textField.height = _local4;
textField.x = Math.round(((width - _local3) / 2));
textField.y = Math.round(((((height - textField.height) - _local6) / 2) + ((_local2)==ButtonLabelPlacement.BOTTOM) ? _local6 : 0));
if (icon != null){
icon.y = Math.round(((_local2)==ButtonLabelPlacement.BOTTOM) ? (textField.y - _local6) : ((textField.y + textField.height) + _local1));
};
} else {
_local7 = Math.max(0, Math.min(_local3, ((width - _local5) - (2 * _local1))));
_local3 = _local7;
textField.width = _local3;
textField.x = Math.round(((((width - _local3) - _local5) / 2) + ((_local2)!=ButtonLabelPlacement.LEFT) ? _local5 : 0));
textField.y = Math.round(((height - textField.height) / 2));
if (icon != null){
icon.x = Math.round(((_local2)!=ButtonLabelPlacement.LEFT) ? (textField.x - _local5) : ((textField.x + _local3) + _local1));
};
};
};
super.drawLayout();
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
if (oldMouseState == null){
oldMouseState = mouseState;
};
setMouseState("down");
startPress();
};
}
override protected function keyUpHandler(_arg1:KeyboardEvent):void{
if (!enabled){
return;
};
if (_arg1.keyCode == Keyboard.SPACE){
setMouseState(oldMouseState);
oldMouseState = null;
endPress();
dispatchEvent(new MouseEvent(MouseEvent.CLICK));
};
}
override protected function initializeAccessibility():void{
if (LabelButton.createAccessibilityImplementation != null){
LabelButton.createAccessibilityImplementation(this);
};
}
public static function getStyleDefinition():Object{
return (mergeStyles(defaultStyles, BaseButton.getStyleDefinition()));
}
}
}//package fl.controls
Section 35
//Slider (fl.controls.Slider)
package fl.controls {
import flash.display.*;
import flash.events.*;
import fl.core.*;
import fl.managers.*;
import fl.events.*;
import flash.ui.*;
public class Slider extends UIComponent implements IFocusManagerComponent {
protected var _direction:String;
protected var _minimum:Number;// = 0
protected var _maximum:Number;// = 10
protected var _value:Number;// = 0
protected var _tickInterval:Number;// = 0
protected var _snapInterval:Number;// = 0
protected var _liveDragging:Boolean;// = false
protected var tickContainer:Sprite;
protected var thumb:BaseButton;
protected var track:BaseButton;
protected static const TRACK_STYLES:Object = {upSkin:"sliderTrackSkin", overSkin:"sliderTrackSkin", downSkin:"sliderTrackSkin", disabledSkin:"sliderTrackDisabledSkin"};
protected static const THUMB_STYLES:Object = {upSkin:"thumbUpSkin", overSkin:"thumbOverSkin", downSkin:"thumbDownSkin", disabledSkin:"thumbDisabledSkin"};
protected static const TICK_STYLES:Object = {upSkin:"tickSkin"};
protected static var defaultStyles:Object = {thumbUpSkin:"SliderThumb_upSkin", thumbOverSkin:"SliderThumb_overSkin", thumbDownSkin:"SliderThumb_downSkin", thumbDisabledSkin:"SliderThumb_disabledSkin", sliderTrackSkin:"SliderTrack_skin", sliderTrackDisabledSkin:"SliderTrack_disabledSkin", tickSkin:"SliderTick_skin", focusRectSkin:null, focusRectPadding:null};
public function Slider(){
_direction = SliderDirection.HORIZONTAL;
super();
setStyles();
}
public function get direction():String{
return (_direction);
}
public function set direction(_arg1:String):void{
_direction = _arg1;
var _local2 = (_direction == SliderDirection.VERTICAL);
if (isLivePreview){
if (_local2){
setScaleY(-1);
y = track.height;
} else {
setScaleY(1);
y = 0;
};
positionThumb();
return;
};
if (((_local2) && (componentInspectorSetting))){
if ((rotation % 90) == 0){
setScaleY(-1);
};
};
if (!componentInspectorSetting){
rotation = (_local2) ? 90 : 0;
};
}
public function get minimum():Number{
return (_minimum);
}
public function set minimum(_arg1:Number):void{
_minimum = _arg1;
this.value = Math.max(_arg1, this.value);
invalidate(InvalidationType.DATA);
}
public function get maximum():Number{
return (_maximum);
}
public function set maximum(_arg1:Number):void{
_maximum = _arg1;
this.value = Math.min(_arg1, this.value);
invalidate(InvalidationType.DATA);
}
public function get tickInterval():Number{
return (_tickInterval);
}
public function set tickInterval(_arg1:Number):void{
_tickInterval = _arg1;
invalidate(InvalidationType.SIZE);
}
public function get snapInterval():Number{
return (_snapInterval);
}
public function set snapInterval(_arg1:Number):void{
_snapInterval = _arg1;
}
public function set liveDragging(_arg1:Boolean):void{
_liveDragging = _arg1;
}
public function get liveDragging():Boolean{
return (_liveDragging);
}
override public function get enabled():Boolean{
return (super.enabled);
}
override public function set enabled(_arg1:Boolean):void{
if (enabled == _arg1){
return;
};
super.enabled = _arg1;
track.enabled = (thumb.enabled = _arg1);
}
override public function setSize(_arg1:Number, _arg2:Number):void{
if ((((_direction == SliderDirection.VERTICAL)) && (!(isLivePreview)))){
super.setSize(_arg2, _arg1);
} else {
super.setSize(_arg1, _arg2);
};
invalidate(InvalidationType.SIZE);
}
public function get value():Number{
return (_value);
}
public function set value(_arg1:Number):void{
doSetValue(_arg1);
}
protected function doSetValue(_arg1:Number, _arg2:String=null, _arg3:String=null, _arg4:int=undefined):void{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local5:Number = _value;
if (((!((_snapInterval == 0))) && (!((_snapInterval == 1))))){
_local6 = Math.pow(10, getPrecision(snapInterval));
_local7 = (_snapInterval * _local6);
_local8 = Math.round((_arg1 * _local6));
_local9 = (Math.round((_local8 / _local7)) * _local7);
_arg1 = (_local9 / _local6);
_value = Math.max(minimum, Math.min(maximum, _arg1));
} else {
_value = Math.max(minimum, Math.min(maximum, Math.round(_arg1)));
};
if (((!((_local5 == _value))) && (((((liveDragging) && (!((_arg3 == null))))) || ((_arg2 == InteractionInputType.KEYBOARD)))))){
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, _arg3, _arg2, _arg4));
};
positionThumb();
}
protected function setStyles():void{
copyStylesToChild(thumb, THUMB_STYLES);
copyStylesToChild(track, TRACK_STYLES);
}
override protected function draw():void{
if (isInvalid(InvalidationType.STYLES)){
setStyles();
invalidate(InvalidationType.SIZE, false);
};
if (isInvalid(InvalidationType.SIZE)){
track.setSize(_width, track.height);
track.drawNow();
thumb.drawNow();
};
if (tickInterval > 0){
drawTicks();
} else {
clearTicks();
};
positionThumb();
super.draw();
}
protected function positionThumb():void{
thumb.x = ((((_direction)==SliderDirection.VERTICAL) ? (maximum - value) : (value - minimum) / (maximum - minimum)) * _width);
}
protected function drawTicks():void{
var _local5:DisplayObject;
clearTicks();
tickContainer = new Sprite();
var _local1:Number = ((maximum)<1) ? (tickInterval / 100) : tickInterval;
var _local2:Number = ((maximum - minimum) / _local1);
var _local3:Number = (_width / _local2);
var _local4:uint;
while (_local4 <= _local2) {
_local5 = getDisplayObjectInstance(getStyleValue("tickSkin"));
_local5.x = (_local3 * _local4);
_local5.y = ((track.y - _local5.height) - 2);
tickContainer.addChild(_local5);
_local4++;
};
addChild(tickContainer);
}
protected function clearTicks():void{
if (((!(tickContainer)) || (!(tickContainer.parent)))){
return;
};
removeChild(tickContainer);
}
protected function calculateValue(_arg1:Number, _arg2:String, _arg3:String, _arg4:int=undefined):void{
var _local5:Number = ((_arg1 / _width) * (maximum - minimum));
if (_direction == SliderDirection.VERTICAL){
_local5 = (maximum - _local5);
} else {
_local5 = (minimum + _local5);
};
doSetValue(_local5, _arg2, _arg3, _arg4);
}
protected function doDrag(_arg1:MouseEvent):void{
var _local2:Number = (_width / snapInterval);
var _local3:Number = track.mouseX;
calculateValue(_local3, InteractionInputType.MOUSE, SliderEventClickTarget.THUMB);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_DRAG, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
protected function thumbPressHandler(_arg1:MouseEvent):void{
var _local2:DisplayObjectContainer = focusManager.form;
_local2.addEventListener(MouseEvent.MOUSE_MOVE, doDrag, false, 0, true);
_local2.addEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler, false, 0, true);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_PRESS, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
protected function thumbReleaseHandler(_arg1:MouseEvent):void{
var _local2:DisplayObjectContainer = focusManager.form;
_local2.removeEventListener(MouseEvent.MOUSE_MOVE, doDrag);
_local2.removeEventListener(MouseEvent.MOUSE_UP, thumbReleaseHandler);
dispatchEvent(new SliderEvent(SliderEvent.THUMB_RELEASE, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.THUMB, InteractionInputType.MOUSE));
}
protected function onTrackClick(_arg1:MouseEvent):void{
calculateValue(track.mouseX, InteractionInputType.MOUSE, SliderEventClickTarget.TRACK);
if (!liveDragging){
dispatchEvent(new SliderEvent(SliderEvent.CHANGE, value, SliderEventClickTarget.TRACK, InteractionInputType.MOUSE));
};
}
override protected function keyDownHandler(_arg1:KeyboardEvent):void{
var _local3:Number;
if (!enabled){
return;
};
var _local2:Number = ((snapInterval)>0) ? snapInterval : 1;
var _local4 = (direction == SliderDirection.HORIZONTAL);
if ((((((_arg1.keyCode == Keyboard.DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.LEFT)) && (_local4))))){
_local3 = (value - _local2);
} else {
if ((((((_arg1.keyCode == Keyboard.UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.RIGHT)) && (_local4))))){
_local3 = (value + _local2);
} else {
if ((((((_arg1.keyCode == Keyboard.PAGE_DOWN)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.HOME)) && (_local4))))){
_local3 = minimum;
} else {
if ((((((_arg1.keyCode == Keyboard.PAGE_UP)) && (!(_local4)))) || ((((_arg1.keyCode == Keyboard.END)) && (_local4))))){
_local3 = maximum;
};
};
};
};
if (!isNaN(_local3)){
_arg1.stopPropagation();
doSetValue(_local3, InteractionInputType.KEYBOARD, null, _arg1.keyCode);
};
}
override protected function configUI():void{
super.configUI();
thumb = new BaseButton();
thumb.setSize(13, 13);
thumb.autoRepeat = false;
addChild(thumb);
thumb.addEventListener(MouseEvent.MOUSE_DOWN, thumbPressHandler, false, 0, true);
track = new BaseButton();
track.move(0, 0);
track.setSize(80, 4);
track.autoRepeat = false;
track.useHandCursor = false;
track.addEventListener(MouseEvent.CLICK, onTrackClick, false, 0, true);
addChildAt(track, 0);
}
protected function getPrecision(_arg1:Number):Number{
var _local2:String = _arg1.toString();
if (_local2.indexOf(".") == -1){
return (0);
};
return (_local2.split(".").pop().length);
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
}
}//package fl.controls
Section 36
//SliderDirection (fl.controls.SliderDirection)
package fl.controls {
public class SliderDirection {
public static var HORIZONTAL:String = "horizontal";
public static var VERTICAL:String = "vertical";
}
}//package fl.controls
Section 37
//ComponentShim (fl.core.ComponentShim)
package fl.core {
import flash.display.*;
public dynamic class ComponentShim extends MovieClip {
}
}//package fl.core
Section 38
//InvalidationType (fl.core.InvalidationType)
package fl.core {
public class InvalidationType {
public static const ALL:String = "all";
public static const SIZE:String = "size";
public static const STYLES:String = "styles";
public static const RENDERER_STYLES:String = "rendererStyles";
public static const STATE:String = "state";
public static const DATA:String = "data";
public static const SCROLL:String = "scroll";
public static const SELECTED:String = "selected";
}
}//package fl.core
Section 39
//UIComponent (fl.core.UIComponent)
package fl.core {
import flash.utils.*;
import flash.display.*;
import flash.events.*;
import fl.managers.*;
import fl.events.*;
import flash.text.*;
import flash.system.*;
public class UIComponent extends Sprite {
public const version:String = "3.0.3.1";
public var focusTarget:IFocusManagerComponent;
protected var isLivePreview:Boolean;// = false
private var tempText:TextField;
protected var instanceStyles:Object;
protected var sharedStyles:Object;
protected var callLaterMethods:Dictionary;
protected var invalidateFlag:Boolean;// = false
protected var _enabled:Boolean;// = true
protected var invalidHash:Object;
protected var uiFocusRect:DisplayObject;
protected var isFocused:Boolean;// = false
private var _focusEnabled:Boolean;// = true
private var _mouseFocusEnabled:Boolean;// = true
protected var _width:Number;
protected var _height:Number;
protected var _x:Number;
protected var _y:Number;
protected var startWidth:Number;
protected var startHeight:Number;
protected var _imeMode:String;// = null
protected var _oldIMEMode:String;// = null
protected var errorCaught:Boolean;// = false
protected var _inspector:Boolean;// = false
public static var inCallLaterPhase:Boolean = false;
private static var defaultStyles:Object = {focusRectSkin:"focusRectSkin", focusRectPadding:2, textFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), disabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultTextFormat:new TextFormat("_sans", 11, 0, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0), defaultDisabledTextFormat:new TextFormat("_sans", 11, 0x999999, false, false, false, "", "", TextFormatAlign.LEFT, 0, 0, 0, 0)};
private static var focusManagers:Dictionary = new Dictionary(true);
private static var focusManagerUsers:Dictionary = new Dictionary(true);
public static var createAccessibilityImplementation:Function;
public function UIComponent(){
instanceStyles = {};
sharedStyles = {};
invalidHash = {};
callLaterMethods = new Dictionary();
StyleManager.registerInstance(this);
configUI();
invalidate(InvalidationType.ALL);
tabEnabled = (this is IFocusManagerComponent);
focusRect = false;
if (tabEnabled){
addEventListener(FocusEvent.FOCUS_IN, focusInHandler);
addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler);
addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler);
addEventListener(KeyboardEvent.KEY_UP, keyUpHandler);
};
initializeFocusManager();
addEventListener(Event.ENTER_FRAME, hookAccessibility, false, 0, true);
}
public function get componentInspectorSetting():Boolean{
return (_inspector);
}
public function set componentInspectorSetting(_arg1:Boolean):void{
_inspector = _arg1;
if (_inspector){
beforeComponentParameters();
} else {
afterComponentParameters();
};
}
protected function beforeComponentParameters():void{
}
protected function afterComponentParameters():void{
}
public function get enabled():Boolean{
return (_enabled);
}
public function set enabled(_arg1:Boolean):void{
if (_arg1 == _enabled){
return;
};
_enabled = _arg1;
invalidate(InvalidationType.STATE);
}
public function setSize(_arg1:Number, _arg2:Number):void{
_width = _arg1;
_height = _arg2;
invalidate(InvalidationType.SIZE);
dispatchEvent(new ComponentEvent(ComponentEvent.RESIZE, false));
}
override public function get width():Number{
return (_width);
}
override public function set width(_arg1:Number):void{
if (_width == _arg1){
return;
};
setSize(_arg1, height);
}
override public function get height():Number{
return (_height);
}
override public function set height(_arg1:Number):void{
if (_height == _arg1){
return;
};
setSize(width, _arg1);
}
public function setStyle(_arg1:String, _arg2:Object):void{
if ((((instanceStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
instanceStyles[_arg1] = _arg2;
invalidate(InvalidationType.STYLES);
}
public function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public function getStyle(_arg1:String):Object{
return (instanceStyles[_arg1]);
}
public function move(_arg1:Number, _arg2:Number):void{
_x = _arg1;
_y = _arg2;
super.x = Math.round(_arg1);
super.y = Math.round(_arg2);
dispatchEvent(new ComponentEvent(ComponentEvent.MOVE));
}
override public function get x():Number{
return ((isNaN(_x)) ? super.x : _x);
}
override public function set x(_arg1:Number):void{
move(_arg1, _y);
}
override public function get y():Number{
return ((isNaN(_y)) ? super.y : _y);
}
override public function set y(_arg1:Number):void{
move(_x, _arg1);
}
override public function get scaleX():Number{
return ((width / startWidth));
}
override public function set scaleX(_arg1:Number):void{
setSize((startWidth * _arg1), height);
}
override public function get scaleY():Number{
return ((height / startHeight));
}
override public function set scaleY(_arg1:Number):void{
setSize(width, (startHeight * _arg1));
}
protected function getScaleY():Number{
return (super.scaleY);
}
protected function setScaleY(_arg1:Number):void{
super.scaleY = _arg1;
}
protected function getScaleX():Number{
return (super.scaleX);
}
protected function setScaleX(_arg1:Number):void{
super.scaleX = _arg1;
}
override public function get visible():Boolean{
return (super.visible);
}
override public function set visible(_arg1:Boolean):void{
if (super.visible == _arg1){
return;
};
super.visible = _arg1;
var _local2:String = (_arg1) ? ComponentEvent.SHOW : ComponentEvent.HIDE;
dispatchEvent(new ComponentEvent(_local2, true));
}
public function validateNow():void{
invalidate(InvalidationType.ALL, false);
draw();
}
public function invalidate(_arg1:String="all", _arg2:Boolean=true):void{
invalidHash[_arg1] = true;
if (_arg2){
this.callLater(draw);
};
}
public function setSharedStyle(_arg1:String, _arg2:Object):void{
if ((((sharedStyles[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
sharedStyles[_arg1] = _arg2;
if (instanceStyles[_arg1] == null){
invalidate(InvalidationType.STYLES);
};
}
public function get focusEnabled():Boolean{
return (_focusEnabled);
}
public function set focusEnabled(_arg1:Boolean):void{
_focusEnabled = _arg1;
}
public function get mouseFocusEnabled():Boolean{
return (_mouseFocusEnabled);
}
public function set mouseFocusEnabled(_arg1:Boolean):void{
_mouseFocusEnabled = _arg1;
}
public function get focusManager():IFocusManager{
var o:DisplayObject = this;
while (o) {
if (UIComponent.focusManagers[o] != null){
return (IFocusManager(UIComponent.focusManagers[o]));
};
try {
o = o.parent;
} catch(se:SecurityError) {
return (null);
};
};
return (null);
}
public function set focusManager(_arg1:IFocusManager):void{
UIComponent.focusManagers[this] = _arg1;
}
public function drawFocus(_arg1:Boolean):void{
var _local2:Number;
isFocused = _arg1;
if (((!((uiFocusRect == null))) && (contains(uiFocusRect)))){
removeChild(uiFocusRect);
uiFocusRect = null;
};
if (_arg1){
uiFocusRect = (getDisplayObjectInstance(getStyleValue("focusRectSkin")) as Sprite);
if (uiFocusRect == null){
return;
};
_local2 = Number(getStyleValue("focusRectPadding"));
uiFocusRect.x = -(_local2);
uiFocusRect.y = -(_local2);
uiFocusRect.width = (width + (_local2 * 2));
uiFocusRect.height = (height + (_local2 * 2));
addChildAt(uiFocusRect, 0);
};
}
public function setFocus():void{
if (stage){
stage.focus = this;
};
}
public function getFocus():InteractiveObject{
if (stage){
return (stage.focus);
};
return (null);
}
protected function setIMEMode(_arg1:Boolean){
var enabled = _arg1;
if (_imeMode != null){
if (enabled){
IME.enabled = true;
_oldIMEMode = IME.conversionMode;
try {
if (((!(errorCaught)) && (!((IME.conversionMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _imeMode;
};
errorCaught = false;
} catch(e:Error) {
errorCaught = true;
throw (new Error(("IME mode not supported: " + _imeMode)));
};
} else {
if (((!((IME.conversionMode == IMEConversionMode.UNKNOWN))) && (!((_oldIMEMode == IMEConversionMode.UNKNOWN))))){
IME.conversionMode = _oldIMEMode;
};
IME.enabled = false;
};
};
}
public function drawNow():void{
draw();
}
protected function configUI():void{
isLivePreview = checkLivePreview();
var _local1:Number = rotation;
rotation = 0;
var _local2:Number = super.width;
var _local3:Number = super.height;
var _local4 = 1;
super.scaleY = _local4;
super.scaleX = _local4;
setSize(_local2, _local3);
move(super.x, super.y);
rotation = _local1;
startWidth = _local2;
startHeight = _local3;
if (numChildren > 0){
removeChildAt(0);
};
}
protected function checkLivePreview():Boolean{
var className:String;
if (parent == null){
return (false);
};
try {
className = getQualifiedClassName(parent);
} catch(e:Error) {
};
return ((className == "fl.livepreview::LivePreviewParent"));
}
protected function isInvalid(_arg1:String, ... _args):Boolean{
if (((invalidHash[_arg1]) || (invalidHash[InvalidationType.ALL]))){
return (true);
};
while (_args.length > 0) {
if (invalidHash[_args.pop()]){
return (true);
};
};
return (false);
}
protected function validate():void{
invalidHash = {};
}
protected function draw():void{
if (isInvalid(InvalidationType.SIZE, InvalidationType.STYLES)){
if (((isFocused) && (focusManager.showFocusIndicator))){
drawFocus(true);
};
};
validate();
}
protected function getDisplayObjectInstance(_arg1:Object):DisplayObject{
var skin = _arg1;
var classDef:Object;
if ((skin is Class)){
return ((new (skin) as DisplayObject));
};
if ((skin is DisplayObject)){
(skin as DisplayObject).x = 0;
(skin as DisplayObject).y = 0;
return ((skin as DisplayObject));
};
try {
classDef = getDefinitionByName(skin.toString());
} catch(e:Error) {
try {
classDef = (loaderInfo.applicationDomain.getDefinition(skin.toString()) as Object);
} catch(e:Error) {
};
};
if (classDef == null){
return (null);
};
return ((new (classDef) as DisplayObject));
}
protected function getStyleValue(_arg1:String):Object{
return (((instanceStyles[_arg1])==null) ? sharedStyles[_arg1] : instanceStyles[_arg1]);
}
protected function copyStylesToChild(_arg1:UIComponent, _arg2:Object):void{
var _local3:String;
for (_local3 in _arg2) {
_arg1.setStyle(_local3, getStyleValue(_arg2[_local3]));
};
}
protected function callLater(_arg1:Function):void{
var fn = _arg1;
if (inCallLaterPhase){
return;
};
callLaterMethods[fn] = true;
if (stage != null){
try {
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
} catch(se:SecurityError) {
addEventListener(Event.ENTER_FRAME, callLaterDispatcher, false, 0, true);
};
} else {
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
};
}
private function callLaterDispatcher(_arg1:Event):void{
var method:Object;
var event = _arg1;
if (event.type == Event.ADDED_TO_STAGE){
try {
removeEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher);
stage.addEventListener(Event.RENDER, callLaterDispatcher, false, 0, true);
stage.invalidate();
return;
} catch(se1:SecurityError) {
addEventListener(Event.ENTER_FRAME, callLaterDispatcher, false, 0, true);
};
} else {
event.target.removeEventListener(Event.RENDER, callLaterDispatcher);
event.target.removeEventListener(Event.ENTER_FRAME, callLaterDispatcher);
try {
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, callLaterDispatcher, false, 0, true);
return;
};
} catch(se2:SecurityError) {
};
};
inCallLaterPhase = true;
var methods:Dictionary = callLaterMethods;
for (method in methods) {
method();
delete methods[method];
};
inCallLaterPhase = false;
}
private function initializeFocusManager():void{
var _local1:IFocusManager;
var _local2:Dictionary;
if (stage == null){
addEventListener(Event.ADDED_TO_STAGE, addedHandler, false, 0, true);
} else {
createFocusManager();
_local1 = focusManager;
if (_local1 != null){
_local2 = focusManagerUsers[_local1];
if (_local2 == null){
_local2 = new Dictionary(true);
focusManagerUsers[_local1] = _local2;
};
_local2[this] = true;
};
};
addEventListener(Event.REMOVED_FROM_STAGE, removedHandler);
}
private function addedHandler(_arg1:Event):void{
removeEventListener(Event.ADDED_TO_STAGE, addedHandler);
initializeFocusManager();
}
private function removedHandler(_arg1:Event):void{
var _local3:Dictionary;
var _local4:Boolean;
var _local5:*;
var _local6:*;
var _local7:IFocusManager;
removeEventListener(Event.REMOVED_FROM_STAGE, removedHandler);
addEventListener(Event.ADDED_TO_STAGE, addedHandler);
var _local2:IFocusManager = focusManager;
if (_local2 != null){
_local3 = focusManagerUsers[_local2];
if (_local3 != null){
delete _local3[this];
_local4 = true;
for (_local5 in _local3) {
_local4 = false;
break;
};
if (_local4){
delete focusManagerUsers[_local2];
_local3 = null;
};
};
if (_local3 == null){
_local2.deactivate();
for (_local6 in focusManagers) {
_local7 = focusManagers[_local6];
if (_local2 == _local7){
delete focusManagers[_local6];
};
};
};
};
}
protected function createFocusManager():void{
var stageAccessOK:Boolean;
try {
stage.getChildAt(0);
} catch(se:SecurityError) {
stageAccessOK = false;
};
var myTopLevel:DisplayObjectContainer;
if (stageAccessOK){
myTopLevel = stage;
} else {
myTopLevel = this;
try {
while (myTopLevel.parent != null) {
myTopLevel = myTopLevel.parent;
};
} catch(se:SecurityError) {
};
};
if (focusManagers[myTopLevel] == null){
focusManagers[myTopLevel] = new FocusManager(myTopLevel);
};
}
protected function isOurFocus(_arg1:DisplayObject):Boolean{
return ((_arg1 == this));
}
protected function focusInHandler(_arg1:FocusEvent):void{
var _local2:IFocusManager;
if (isOurFocus((_arg1.target as DisplayObject))){
_local2 = focusManager;
if (((_local2) && (_local2.showFocusIndicator))){
drawFocus(true);
isFocused = true;
};
};
}
protected function focusOutHandler(_arg1:FocusEvent):void{
if (isOurFocus((_arg1.target as DisplayObject))){
drawFocus(false);
isFocused = false;
};
}
protected function keyDownHandler(_arg1:KeyboardEvent):void{
}
protected function keyUpHandler(_arg1:KeyboardEvent):void{
}
protected function hookAccessibility(_arg1:Event):void{
removeEventListener(Event.ENTER_FRAME, hookAccessibility);
initializeAccessibility();
}
protected function initializeAccessibility():void{
if (UIComponent.createAccessibilityImplementation != null){
UIComponent.createAccessibilityImplementation(this);
};
}
public static function getStyleDefinition():Object{
return (defaultStyles);
}
public static function mergeStyles(... _args):Object{
var _local5:Object;
var _local6:String;
var _local2:Object = {};
var _local3:uint = _args.length;
var _local4:uint;
while (_local4 < _local3) {
_local5 = _args[_local4];
for (_local6 in _local5) {
if (_local2[_local6] != null){
} else {
_local2[_local6] = _args[_local4][_local6];
};
};
_local4++;
};
return (_local2);
}
}
}//package fl.core
Section 40
//ComponentEvent (fl.events.ComponentEvent)
package fl.events {
import flash.events.*;
public class ComponentEvent extends Event {
public static const BUTTON_DOWN:String = "buttonDown";
public static const LABEL_CHANGE:String = "labelChange";
public static const HIDE:String = "hide";
public static const SHOW:String = "show";
public static const RESIZE:String = "resize";
public static const MOVE:String = "move";
public static const ENTER:String = "enter";
public function ComponentEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
override public function toString():String{
return (formatToString("ComponentEvent", "type", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ComponentEvent(type, bubbles, cancelable));
}
}
}//package fl.events
Section 41
//InteractionInputType (fl.events.InteractionInputType)
package fl.events {
public class InteractionInputType {
public static const MOUSE:String = "mouse";
public static const KEYBOARD:String = "keyboard";
}
}//package fl.events
Section 42
//SliderEvent (fl.events.SliderEvent)
package fl.events {
import flash.events.*;
public class SliderEvent extends Event {
protected var _triggerEvent:String;
protected var _value:Number;
protected var _keyCode:Number;
protected var _clickTarget:String;
public static const CHANGE:String = "change";
public static const THUMB_DRAG:String = "thumbDrag";
public static const THUMB_PRESS:String = "thumbPress";
public static const THUMB_RELEASE:String = "thumbRelease";
public function SliderEvent(_arg1:String, _arg2:Number, _arg3:String, _arg4:String, _arg5:int=0){
_value = _arg2;
_keyCode = _arg5;
_triggerEvent = _arg4;
_clickTarget = _arg3;
super(_arg1);
}
public function get value():Number{
return (_value);
}
public function get keyCode():Number{
return (_keyCode);
}
public function get triggerEvent():String{
return (_triggerEvent);
}
public function get clickTarget():String{
return (_clickTarget);
}
override public function toString():String{
return (formatToString("SliderEvent", "type", "value", "bubbles", "cancelable", "keyCode", "triggerEvent", "clickTarget"));
}
override public function clone():Event{
return (new SliderEvent(type, _value, _clickTarget, _triggerEvent, _keyCode));
}
}
}//package fl.events
Section 43
//SliderEventClickTarget (fl.events.SliderEventClickTarget)
package fl.events {
public class SliderEventClickTarget {
public static const THUMB:String = "thumb";
public static const TRACK:String = "track";
}
}//package fl.events
Section 44
//FocusManager (fl.managers.FocusManager)
package fl.managers {
import flash.utils.*;
import fl.controls.*;
import flash.display.*;
import flash.events.*;
import fl.core.*;
import flash.text.*;
import flash.ui.*;
public class FocusManager implements IFocusManager {
private var _form:DisplayObjectContainer;
private var focusableObjects:Dictionary;
private var focusableCandidates:Array;
private var activated:Boolean;// = false
private var calculateCandidates:Boolean;// = true
private var lastFocus:InteractiveObject;
private var _showFocusIndicator:Boolean;// = true
private var lastAction:String;
private var defButton:Button;
private var _defaultButton:Button;
private var _defaultButtonEnabled:Boolean;// = true
public function FocusManager(_arg1:DisplayObjectContainer){
focusableObjects = new Dictionary(true);
if (_arg1 != null){
_form = _arg1;
activate();
};
}
private function addedHandler(_arg1:Event):void{
var _local2:DisplayObject = DisplayObject(_arg1.target);
if (_local2.stage){
addFocusables(DisplayObject(_arg1.target));
};
}
private function removedHandler(_arg1:Event):void{
var _local2:int;
var _local4:InteractiveObject;
var _local3:DisplayObject = DisplayObject(_arg1.target);
if ((((_local3 is IFocusManagerComponent)) && ((focusableObjects[_local3] == true)))){
if (_local3 == lastFocus){
IFocusManagerComponent(lastFocus).drawFocus(false);
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler, false);
delete focusableObjects[_local3];
calculateCandidates = true;
} else {
if ((((_local3 is InteractiveObject)) && ((focusableObjects[_local3] == true)))){
_local4 = (_local3 as InteractiveObject);
if (_local4){
if (_local4 == lastFocus){
lastFocus = null;
};
delete focusableObjects[_local4];
calculateCandidates = true;
};
_local3.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler, false, 0, true);
};
};
removeFocusables(_local3);
}
private function addFocusables(_arg1:DisplayObject, _arg2:Boolean=false):void{
var focusable:IFocusManagerComponent;
var io:InteractiveObject;
var doc:DisplayObjectContainer;
var docParent:DisplayObjectContainer;
var i:int;
var child:DisplayObject;
var o = _arg1;
var skipTopLevel = _arg2;
if (!skipTopLevel){
if ((o is IFocusManagerComponent)){
focusable = IFocusManagerComponent(o);
if (focusable.focusEnabled){
if (((focusable.tabEnabled) && (isTabVisible(o)))){
focusableObjects[o] = true;
calculateCandidates = true;
};
o.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler, false, 0, true);
o.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler, false, 0, true);
};
} else {
if ((o is InteractiveObject)){
io = (o as InteractiveObject);
if (((((io) && (io.tabEnabled))) && ((findFocusManagerComponent(io) == io)))){
focusableObjects[io] = true;
calculateCandidates = true;
};
io.addEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler, false, 0, true);
io.addEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler, false, 0, true);
};
};
};
if ((o is DisplayObjectContainer)){
doc = DisplayObjectContainer(o);
o.addEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler, false, 0, true);
docParent = null;
try {
docParent = doc.parent;
} catch(se:SecurityError) {
docParent = null;
};
if ((((((doc is Stage)) || ((docParent is Stage)))) || (doc.tabChildren))){
i = 0;
while (i < doc.numChildren) {
try {
child = doc.getChildAt(i);
if (child != null){
addFocusables(doc.getChildAt(i));
};
} catch(error:SecurityError) {
};
i = (i + 1);
};
};
};
}
private function removeFocusables(_arg1:DisplayObject):void{
var _local2:Object;
var _local3:DisplayObject;
if ((_arg1 is DisplayObjectContainer)){
_arg1.removeEventListener(Event.TAB_CHILDREN_CHANGE, tabChildrenChangeHandler, false);
_arg1.removeEventListener(Event.TAB_INDEX_CHANGE, tabIndexChangeHandler, false);
for (_local2 in focusableObjects) {
_local3 = DisplayObject(_local2);
if (DisplayObjectContainer(_arg1).contains(_local3)){
if (_local3 == lastFocus){
lastFocus = null;
};
_local3.removeEventListener(Event.TAB_ENABLED_CHANGE, tabEnabledChangeHandler, false);
delete focusableObjects[_local2];
calculateCandidates = true;
};
};
};
}
private function isTabVisible(_arg1:DisplayObject):Boolean{
var p:DisplayObjectContainer;
var o = _arg1;
try {
p = o.parent;
while (((((p) && (!((p is Stage))))) && (!(((p.parent) && ((p.parent is Stage))))))) {
if (!p.tabChildren){
return (false);
};
p = p.parent;
};
} catch(se:SecurityError) {
};
return (true);
}
private function isValidFocusCandidate(_arg1:DisplayObject, _arg2:String):Boolean{
var _local3:IFocusManagerGroup;
if (!isEnabledAndVisible(_arg1)){
return (false);
};
if ((_arg1 is IFocusManagerGroup)){
_local3 = IFocusManagerGroup(_arg1);
if (_arg2 == _local3.groupName){
return (false);
};
};
return (true);
}
private function isEnabledAndVisible(_arg1:DisplayObject):Boolean{
var formParent:DisplayObjectContainer;
var tf:TextField;
var sb:SimpleButton;
var o = _arg1;
try {
formParent = DisplayObject(form).parent;
while (o != formParent) {
if ((o is UIComponent)){
if (!UIComponent(o).enabled){
return (false);
};
} else {
if ((o is TextField)){
tf = TextField(o);
if ((((tf.type == TextFieldType.DYNAMIC)) || (!(tf.selectable)))){
return (false);
};
} else {
if ((o is SimpleButton)){
sb = SimpleButton(o);
if (!sb.enabled){
return (false);
};
};
};
};
if (!o.visible){
return (false);
};
o = o.parent;
};
} catch(se:SecurityError) {
};
return (true);
}
private function tabEnabledChangeHandler(_arg1:Event):void{
calculateCandidates = true;
var _local2:InteractiveObject = InteractiveObject(_arg1.target);
var _local3 = (focusableObjects[_local2] == true);
if (_local2.tabEnabled){
if (((!(_local3)) && (isTabVisible(_local2)))){
if (!(_local2 is IFocusManagerComponent)){
_local2.focusRect = false;
};
focusableObjects[_local2] = true;
};
} else {
if (_local3){
delete focusableObjects[_local2];
};
};
}
private function tabIndexChangeHandler(_arg1:Event):void{
calculateCandidates = true;
}
private function tabChildrenChangeHandler(_arg1:Event):void{
if (_arg1.target != _arg1.currentTarget){
return;
};
calculateCandidates = true;
var _local2:DisplayObjectContainer = DisplayObjectContainer(_arg1.target);
if (_local2.tabChildren){
addFocusables(_local2, true);
} else {
removeFocusables(_local2);
};
}
public function activate():void{
if (activated){
return;
};
addFocusables(form);
form.addEventListener(Event.ADDED, addedHandler, false, 0, true);
form.addEventListener(Event.REMOVED, removedHandler, false, 0, true);
try {
form.stage.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.stage.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.stage.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.stage.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
} catch(se:SecurityError) {
form.addEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false, 0, true);
form.addEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false, 0, true);
form.addEventListener(Event.ACTIVATE, activateHandler, false, 0, true);
form.addEventListener(Event.DEACTIVATE, deactivateHandler, false, 0, true);
};
form.addEventListener(FocusEvent.FOCUS_IN, focusInHandler, true, 0, true);
form.addEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true, 0, true);
form.addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler, false, 0, true);
form.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true, 0, true);
activated = true;
if (lastFocus){
setFocus(lastFocus);
};
}
public function deactivate():void{
if (!activated){
return;
};
focusableObjects = new Dictionary(true);
focusableCandidates = null;
lastFocus = null;
defButton = null;
form.removeEventListener(Event.ADDED, addedHandler, false);
form.removeEventListener(Event.REMOVED, removedHandler, false);
try {
form.stage.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false);
form.stage.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false);
form.stage.removeEventListener(Event.ACTIVATE, activateHandler, false);
form.stage.removeEventListener(Event.DEACTIVATE, deactivateHandler, false);
} catch(se:SecurityError) {
};
form.removeEventListener(FocusEvent.MOUSE_FOCUS_CHANGE, mouseFocusChangeHandler, false);
form.removeEventListener(FocusEvent.KEY_FOCUS_CHANGE, keyFocusChangeHandler, false);
form.removeEventListener(Event.ACTIVATE, activateHandler, false);
form.removeEventListener(Event.DEACTIVATE, deactivateHandler, false);
form.removeEventListener(FocusEvent.FOCUS_IN, focusInHandler, true);
form.removeEventListener(FocusEvent.FOCUS_OUT, focusOutHandler, true);
form.removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler, false);
form.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, true);
activated = false;
}
private function focusInHandler(_arg1:FocusEvent):void{
var _local3:Button;
if (!activated){
return;
};
var _local2:InteractiveObject = InteractiveObject(_arg1.target);
if (form.contains(_local2)){
lastFocus = findFocusManagerComponent(InteractiveObject(_local2));
if ((lastFocus is Button)){
_local3 = Button(lastFocus);
if (defButton){
defButton.emphasized = false;
defButton = _local3;
_local3.emphasized = true;
};
} else {
if (((defButton) && (!((defButton == _defaultButton))))){
defButton.emphasized = false;
defButton = _defaultButton;
_defaultButton.emphasized = true;
};
};
};
}
private function focusOutHandler(_arg1:FocusEvent):void{
if (!activated){
return;
};
var _local2:InteractiveObject = (_arg1.target as InteractiveObject);
}
private function activateHandler(_arg1:Event):void{
if (!activated){
return;
};
var _local2:InteractiveObject = InteractiveObject(_arg1.target);
if (lastFocus){
if ((lastFocus is IFocusManagerComponent)){
IFocusManagerComponent(lastFocus).setFocus();
} else {
form.stage.focus = lastFocus;
};
};
lastAction = "ACTIVATE";
}
private function deactivateHandler(_arg1:Event):void{
if (!activated){
return;
};
var _local2:InteractiveObject = InteractiveObject(_arg1.target);
}
private function mouseFocusChangeHandler(_arg1:FocusEvent):void{
if (!activated){
return;
};
if ((_arg1.relatedObject is TextField)){
return;
};
_arg1.preventDefault();
}
private function keyFocusChangeHandler(_arg1:FocusEvent):void{
if (!activated){
return;
};
showFocusIndicator = true;
if ((((((_arg1.keyCode == Keyboard.TAB)) || ((_arg1.keyCode == 0)))) && (!(_arg1.isDefaultPrevented())))){
setFocusToNextObject(_arg1);
_arg1.preventDefault();
};
}
private function keyDownHandler(_arg1:KeyboardEvent):void{
if (!activated){
return;
};
if (_arg1.keyCode == Keyboard.TAB){
lastAction = "KEY";
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
};
if (((((((defaultButtonEnabled) && ((_arg1.keyCode == Keyboard.ENTER)))) && (defaultButton))) && (defButton.enabled))){
sendDefaultButtonEvent();
};
}
private function mouseDownHandler(_arg1:MouseEvent):void{
if (!activated){
return;
};
if (_arg1.isDefaultPrevented()){
return;
};
var _local2:InteractiveObject = getTopLevelFocusTarget(InteractiveObject(_arg1.target));
if (!_local2){
return;
};
showFocusIndicator = false;
if (((((!((_local2 == lastFocus))) || ((lastAction == "ACTIVATE")))) && (!((_local2 is TextField))))){
setFocus(_local2);
};
lastAction = "MOUSEDOWN";
}
public function get defaultButton():Button{
return (_defaultButton);
}
public function set defaultButton(_arg1:Button):void{
var _local2:Button = (_arg1) ? Button(_arg1) : null;
if (_local2 != _defaultButton){
if (_defaultButton){
_defaultButton.emphasized = false;
};
if (defButton){
defButton.emphasized = false;
};
_defaultButton = _local2;
defButton = _local2;
if (_local2){
_local2.emphasized = true;
};
};
}
public function sendDefaultButtonEvent():void{
defButton.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
private function setFocusToNextObject(_arg1:FocusEvent):void{
if (!hasFocusableObjects()){
return;
};
var _local2:InteractiveObject = getNextFocusManagerComponent(_arg1.shiftKey);
if (_local2){
setFocus(_local2);
};
}
private function hasFocusableObjects():Boolean{
var _local1:Object;
for (_local1 in focusableObjects) {
return (true);
};
return (false);
}
public function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject{
var _local8:IFocusManagerGroup;
if (!hasFocusableObjects()){
return (null);
};
if (calculateCandidates){
sortFocusableObjects();
calculateCandidates = false;
};
var _local2:DisplayObject = form.stage.focus;
_local2 = DisplayObject(findFocusManagerComponent(InteractiveObject(_local2)));
var _local3 = "";
if ((_local2 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local2);
_local3 = _local8.groupName;
};
var _local4:int = getIndexOfFocusedObject(_local2);
var _local5:Boolean;
var _local6:int = _local4;
if (_local4 == -1){
if (_arg1){
_local4 = focusableCandidates.length;
};
_local5 = true;
};
var _local7:int = getIndexOfNextObject(_local4, _arg1, _local5, _local3);
return (findFocusManagerComponent(focusableCandidates[_local7]));
}
private function getIndexOfFocusedObject(_arg1:DisplayObject):int{
var _local2:int = focusableCandidates.length;
var _local3:int;
_local3 = 0;
while (_local3 < _local2) {
if (focusableCandidates[_local3] == _arg1){
return (_local3);
};
_local3++;
};
return (-1);
}
private function getIndexOfNextObject(_arg1:int, _arg2:Boolean, _arg3:Boolean, _arg4:String):int{
var _local7:DisplayObject;
var _local8:IFocusManagerGroup;
var _local9:int;
var _local10:DisplayObject;
var _local11:IFocusManagerGroup;
var _local5:int = focusableCandidates.length;
var _local6:int = _arg1;
while (true) {
if (_arg2){
_arg1--;
} else {
_arg1++;
};
if (_arg3){
if (((_arg2) && ((_arg1 < 0)))){
break;
};
if (((!(_arg2)) && ((_arg1 == _local5)))){
break;
};
} else {
_arg1 = ((_arg1 + _local5) % _local5);
if (_local6 == _arg1){
break;
};
};
if (isValidFocusCandidate(focusableCandidates[_arg1], _arg4)){
_local7 = DisplayObject(findFocusManagerComponent(focusableCandidates[_arg1]));
if ((_local7 is IFocusManagerGroup)){
_local8 = IFocusManagerGroup(_local7);
_local9 = 0;
while (_local9 < focusableCandidates.length) {
_local10 = focusableCandidates[_local9];
if ((_local10 is IFocusManagerGroup)){
_local11 = IFocusManagerGroup(_local10);
if ((((_local11.groupName == _local8.groupName)) && (_local11.selected))){
_arg1 = _local9;
break;
};
};
_local9++;
};
};
return (_arg1);
};
};
return (_arg1);
}
private function sortFocusableObjects():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))) && ((_local2.tabIndex > 0)))){
sortFocusableObjectsTabIndex();
return;
};
focusableCandidates.push(_local2);
};
focusableCandidates.sort(sortByDepth);
}
private function sortFocusableObjectsTabIndex():void{
var _local1:Object;
var _local2:InteractiveObject;
focusableCandidates = [];
for (_local1 in focusableObjects) {
_local2 = InteractiveObject(_local1);
if (((_local2.tabIndex) && (!(isNaN(Number(_local2.tabIndex)))))){
focusableCandidates.push(_local2);
};
};
focusableCandidates.sort(sortByTabIndex);
}
private function sortByDepth(_arg1:InteractiveObject, _arg2:InteractiveObject):Number{
var index:int;
var tmp:String;
var tmp2:String;
var aa = _arg1;
var bb = _arg2;
var val1 = "";
var val2 = "";
var zeros = "0000";
var a:DisplayObject = DisplayObject(aa);
var b:DisplayObject = DisplayObject(bb);
try {
while (((!((a == DisplayObject(form)))) && (a.parent))) {
index = getChildIndex(a.parent, a);
tmp = index.toString(16);
if (tmp.length < 4){
tmp2 = (zeros.substring(0, (4 - tmp.length)) + tmp);
};
val1 = (tmp2 + val1);
a = a.parent;
};
} catch(se1:SecurityError) {
};
try {
while (((!((b == DisplayObject(form)))) && (b.parent))) {
index = getChildIndex(b.parent, b);
tmp = index.toString(16);
if (tmp.length < 4){
tmp2 = (zeros.substring(0, (4 - tmp.length)) + tmp);
};
val2 = (tmp2 + val2);
b = b.parent;
};
} catch(se2:SecurityError) {
};
return (((val1 > val2)) ? 1 : ((val1 < val2)) ? -1 : 0);
}
private function getChildIndex(_arg1:DisplayObjectContainer, _arg2:DisplayObject):int{
return (_arg1.getChildIndex(_arg2));
}
private function sortByTabIndex(_arg1:InteractiveObject, _arg2:InteractiveObject):int{
return (((_arg1.tabIndex > _arg2.tabIndex)) ? 1 : ((_arg1.tabIndex < _arg2.tabIndex)) ? -1 : sortByDepth(_arg1, _arg2));
}
public function get defaultButtonEnabled():Boolean{
return (_defaultButtonEnabled);
}
public function set defaultButtonEnabled(_arg1:Boolean):void{
_defaultButtonEnabled = _arg1;
}
public function get nextTabIndex():int{
return (0);
}
public function get showFocusIndicator():Boolean{
return (_showFocusIndicator);
}
public function set showFocusIndicator(_arg1:Boolean):void{
_showFocusIndicator = _arg1;
}
public function get form():DisplayObjectContainer{
return (_form);
}
public function set form(_arg1:DisplayObjectContainer):void{
_form = _arg1;
}
public function getFocus():InteractiveObject{
var _local1:InteractiveObject = form.stage.focus;
return (findFocusManagerComponent(_local1));
}
public function setFocus(_arg1:InteractiveObject):void{
if ((_arg1 is IFocusManagerComponent)){
IFocusManagerComponent(_arg1).setFocus();
} else {
form.stage.focus = _arg1;
};
}
public function showFocus():void{
}
public function hideFocus():void{
}
public function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject{
var component = _arg1;
var p:InteractiveObject = component;
try {
while (component) {
if ((((component is IFocusManagerComponent)) && (IFocusManagerComponent(component).focusEnabled))){
return (component);
};
component = component.parent;
};
} catch(se:SecurityError) {
};
return (p);
}
private function getTopLevelFocusTarget(_arg1:InteractiveObject):InteractiveObject{
var o = _arg1;
try {
while (o != InteractiveObject(form)) {
if ((((((((o is IFocusManagerComponent)) && (IFocusManagerComponent(o).focusEnabled))) && (IFocusManagerComponent(o).mouseFocusEnabled))) && (UIComponent(o).enabled))){
return (o);
};
o = o.parent;
if (o == null){
break;
};
};
} catch(se:SecurityError) {
};
return (null);
}
}
}//package fl.managers
Section 45
//IFocusManager (fl.managers.IFocusManager)
package fl.managers {
import fl.controls.*;
import flash.display.*;
public interface IFocusManager {
function get defaultButton():Button;
function set defaultButton(_arg1:Button):void;
function get defaultButtonEnabled():Boolean;
function set defaultButtonEnabled(_arg1:Boolean):void;
function get nextTabIndex():int;
function get showFocusIndicator():Boolean;
function set showFocusIndicator(_arg1:Boolean):void;
function getFocus():InteractiveObject;
function setFocus(_arg1:InteractiveObject):void;
function showFocus():void;
function hideFocus():void;
function activate():void;
function deactivate():void;
function findFocusManagerComponent(_arg1:InteractiveObject):InteractiveObject;
function getNextFocusManagerComponent(_arg1:Boolean=false):InteractiveObject;
function get form():DisplayObjectContainer;
function set form(_arg1:DisplayObjectContainer):void;
}
}//package fl.managers
Section 46
//IFocusManagerComponent (fl.managers.IFocusManagerComponent)
package fl.managers {
public interface IFocusManagerComponent {
function get focusEnabled():Boolean;
function set focusEnabled(_arg1:Boolean):void;
function get mouseFocusEnabled():Boolean;
function get tabEnabled():Boolean;
function get tabIndex():int;
function setFocus():void;
function drawFocus(_arg1:Boolean):void;
}
}//package fl.managers
Section 47
//IFocusManagerGroup (fl.managers.IFocusManagerGroup)
package fl.managers {
public interface IFocusManagerGroup {
function get groupName():String;
function set groupName(_arg1:String):void;
function get selected():Boolean;
function set selected(_arg1:Boolean):void;
}
}//package fl.managers
Section 48
//StyleManager (fl.managers.StyleManager)
package fl.managers {
import flash.utils.*;
import fl.core.*;
import flash.text.*;
public class StyleManager {
private var styleToClassesHash:Object;
private var classToInstancesDict:Dictionary;
private var classToStylesDict:Dictionary;
private var classToDefaultStylesDict:Dictionary;
private var globalStyles:Object;
private static var _instance:StyleManager;
public function StyleManager(){
styleToClassesHash = {};
classToInstancesDict = new Dictionary(true);
classToStylesDict = new Dictionary(true);
classToDefaultStylesDict = new Dictionary(true);
globalStyles = UIComponent.getStyleDefinition();
}
private static function getInstance(){
if (_instance == null){
_instance = new (StyleManager);
};
return (_instance);
}
public static function registerInstance(_arg1:UIComponent):void{
var target:Class;
var defaultStyles:Object;
var styleToClasses:Object;
var n:String;
var instance = _arg1;
var inst:StyleManager = getInstance();
var classDef:Class = getClassDef(instance);
if (classDef == null){
return;
};
if (inst.classToInstancesDict[classDef] == null){
inst.classToInstancesDict[classDef] = new Dictionary(true);
target = classDef;
while (defaultStyles == null) {
if (target["getStyleDefinition"] != null){
defaultStyles = target["getStyleDefinition"]();
break;
};
try {
target = (instance.loaderInfo.applicationDomain.getDefinition(getQualifiedSuperclassName(target)) as Class);
} catch(err:Error) {
try {
target = (getDefinitionByName(getQualifiedSuperclassName(target)) as Class);
} catch(e:Error) {
defaultStyles = UIComponent.getStyleDefinition();
break;
};
};
};
styleToClasses = inst.styleToClassesHash;
for (n in defaultStyles) {
if (styleToClasses[n] == null){
styleToClasses[n] = new Dictionary(true);
};
styleToClasses[n][classDef] = true;
};
inst.classToDefaultStylesDict[classDef] = defaultStyles;
if (inst.classToStylesDict[classDef] == null){
inst.classToStylesDict[classDef] = {};
};
};
inst.classToInstancesDict[classDef][instance] = true;
setSharedStyles(instance);
}
private static function setSharedStyles(_arg1:UIComponent):void{
var _local5:String;
var _local2:StyleManager = getInstance();
var _local3:Class = getClassDef(_arg1);
var _local4:Object = _local2.classToDefaultStylesDict[_local3];
for (_local5 in _local4) {
_arg1.setSharedStyle(_local5, getSharedStyle(_arg1, _local5));
};
}
private static function getSharedStyle(_arg1:UIComponent, _arg2:String):Object{
var _local3:Class = getClassDef(_arg1);
var _local4:StyleManager = getInstance();
var _local5:Object = _local4.classToStylesDict[_local3][_arg2];
if (_local5 != null){
return (_local5);
};
_local5 = _local4.globalStyles[_arg2];
if (_local5 != null){
return (_local5);
};
return (_local4.classToDefaultStylesDict[_local3][_arg2]);
}
public static function getComponentStyle(_arg1:Object, _arg2:String):Object{
var _local3:Class = getClassDef(_arg1);
var _local4:Object = getInstance().classToStylesDict[_local3];
return (((_local4)==null) ? null : _local4[_arg2]);
}
public static function clearComponentStyle(_arg1:Object, _arg2:String):void{
var _local3:Class = getClassDef(_arg1);
var _local4:Object = getInstance().classToStylesDict[_local3];
if (((!((_local4 == null))) && (!((_local4[_arg2] == null))))){
delete _local4[_arg2];
invalidateComponentStyle(_local3, _arg2);
};
}
public static function setComponentStyle(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Class = getClassDef(_arg1);
var _local5:Object = getInstance().classToStylesDict[_local4];
if (_local5 == null){
_local5 = (getInstance().classToStylesDict[_local4] = {});
};
if (_local5 == _arg3){
return;
};
_local5[_arg2] = _arg3;
invalidateComponentStyle(_local4, _arg2);
}
private static function getClassDef(_arg1:Object):Class{
var component = _arg1;
if ((component is Class)){
return ((component as Class));
};
try {
return ((getDefinitionByName(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
if ((component is UIComponent)){
try {
return ((component.loaderInfo.applicationDomain.getDefinition(getQualifiedClassName(component)) as Class));
} catch(e:Error) {
};
};
};
return (null);
}
private static function invalidateStyle(_arg1:String):void{
var _local3:Object;
var _local2:Dictionary = getInstance().styleToClassesHash[_arg1];
if (_local2 == null){
return;
};
for (_local3 in _local2) {
invalidateComponentStyle(Class(_local3), _arg1);
};
}
private static function invalidateComponentStyle(_arg1:Class, _arg2:String):void{
var _local4:Object;
var _local5:UIComponent;
var _local3:Dictionary = getInstance().classToInstancesDict[_arg1];
if (_local3 == null){
return;
};
for (_local4 in _local3) {
_local5 = (_local4 as UIComponent);
if (_local5 == null){
} else {
_local5.setSharedStyle(_arg2, getSharedStyle(_local5, _arg2));
};
};
}
public static function setStyle(_arg1:String, _arg2:Object):void{
var _local3:Object = getInstance().globalStyles;
if ((((_local3[_arg1] === _arg2)) && (!((_arg2 is TextFormat))))){
return;
};
_local3[_arg1] = _arg2;
invalidateStyle(_arg1);
}
public static function clearStyle(_arg1:String):void{
setStyle(_arg1, null);
}
public static function getStyle(_arg1:String):Object{
return (getInstance().globalStyles[_arg1]);
}
}
}//package fl.managers
Section 49
//Color (fl.motion.Color)
package fl.motion {
import flash.display.*;
import flash.geom.*;
public class Color extends ColorTransform {
private var _tintColor:Number;// = 0
private var _tintMultiplier:Number;// = 0
public function Color(_arg1:Number=1, _arg2:Number=1, _arg3:Number=1, _arg4:Number=1, _arg5:Number=0, _arg6:Number=0, _arg7:Number=0, _arg8:Number=0){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8);
}
public function get brightness():Number{
return ((this.redOffset) ? (1 - this.redMultiplier) : (this.redMultiplier - 1));
}
public function set brightness(_arg1:Number):void{
if (_arg1 > 1){
_arg1 = 1;
} else {
if (_arg1 < -1){
_arg1 = -1;
};
};
var _local2:Number = (1 - Math.abs(_arg1));
var _local3:Number = 0;
if (_arg1 > 0){
_local3 = (_arg1 * 0xFF);
};
this.redMultiplier = (this.greenMultiplier = (this.blueMultiplier = _local2));
this.redOffset = (this.greenOffset = (this.blueOffset = _local3));
}
public function setTint(_arg1:uint, _arg2:Number):void{
this._tintColor = _arg1;
this._tintMultiplier = _arg2;
this.redMultiplier = (this.greenMultiplier = (this.blueMultiplier = (1 - _arg2)));
var _local3:uint = ((_arg1 >> 16) & 0xFF);
var _local4:uint = ((_arg1 >> 8) & 0xFF);
var _local5:uint = (_arg1 & 0xFF);
this.redOffset = Math.round((_local3 * _arg2));
this.greenOffset = Math.round((_local4 * _arg2));
this.blueOffset = Math.round((_local5 * _arg2));
}
public function get tintColor():uint{
return (this._tintColor);
}
public function set tintColor(_arg1:uint):void{
this.setTint(_arg1, this.tintMultiplier);
}
private function deriveTintColor():uint{
var _local1:Number = (1 / this.tintMultiplier);
var _local2:uint = Math.round((this.redOffset * _local1));
var _local3:uint = Math.round((this.greenOffset * _local1));
var _local4:uint = Math.round((this.blueOffset * _local1));
var _local5:uint = (((_local2 << 16) | (_local3 << 8)) | _local4);
return (_local5);
}
public function get tintMultiplier():Number{
return (this._tintMultiplier);
}
public function set tintMultiplier(_arg1:Number):void{
this.setTint(this.tintColor, _arg1);
}
private function parseXML(_arg1:XML=null):Color{
var _local3:XML;
var _local4:String;
var _local5:uint;
if (!_arg1){
return (this);
};
var _local2:XML = _arg1.elements()[0];
if (!_local2){
return (this);
};
for each (_local3 in _local2.attributes()) {
_local4 = _local3.localName();
if (_local4 == "tintColor"){
_local5 = (Number(_local3.toString()) as uint);
this.tintColor = _local5;
} else {
this[_local4] = Number(_local3.toString());
};
};
return (this);
}
public static function fromXML(_arg1:XML):Color{
return (Color(new (Color).parseXML(_arg1)));
}
public static function interpolateTransform(_arg1:ColorTransform, _arg2:ColorTransform, _arg3:Number):ColorTransform{
var _local4:Number = (1 - _arg3);
var _local5:ColorTransform = new ColorTransform(((_arg1.redMultiplier * _local4) + (_arg2.redMultiplier * _arg3)), ((_arg1.greenMultiplier * _local4) + (_arg2.greenMultiplier * _arg3)), ((_arg1.blueMultiplier * _local4) + (_arg2.blueMultiplier * _arg3)), ((_arg1.alphaMultiplier * _local4) + (_arg2.alphaMultiplier * _arg3)), ((_arg1.redOffset * _local4) + (_arg2.redOffset * _arg3)), ((_arg1.greenOffset * _local4) + (_arg2.greenOffset * _arg3)), ((_arg1.blueOffset * _local4) + (_arg2.blueOffset * _arg3)), ((_arg1.alphaOffset * _local4) + (_arg2.alphaOffset * _arg3)));
return (_local5);
}
public static function interpolateColor(_arg1:uint, _arg2:uint, _arg3:Number):uint{
var _local4:Number = (1 - _arg3);
var _local5:uint = ((_arg1 >> 24) & 0xFF);
var _local6:uint = ((_arg1 >> 16) & 0xFF);
var _local7:uint = ((_arg1 >> 8) & 0xFF);
var _local8:uint = (_arg1 & 0xFF);
var _local9:uint = ((_arg2 >> 24) & 0xFF);
var _local10:uint = ((_arg2 >> 16) & 0xFF);
var _local11:uint = ((_arg2 >> 8) & 0xFF);
var _local12:uint = (_arg2 & 0xFF);
var _local13:uint = ((_local5 * _local4) + (_local9 * _arg3));
var _local14:uint = ((_local6 * _local4) + (_local10 * _arg3));
var _local15:uint = ((_local7 * _local4) + (_local11 * _arg3));
var _local16:uint = ((_local8 * _local4) + (_local12 * _arg3));
var _local17:uint = ((((_local13 << 24) | (_local14 << 16)) | (_local15 << 8)) | _local16);
return (_local17);
}
}
}//package fl.motion
Section 50
//FunTextInfo_29 (HighonRollerCoaster_fla.FunTextInfo_29)
package HighonRollerCoaster_fla {
import flash.display.*;
public dynamic class FunTextInfo_29 extends MovieClip {
public function FunTextInfo_29(){
addFrameScript(0, frame1);
}
function frame1(){
this.mouseChildren = false;
this.mouseEnabled = false;
}
}
}//package HighonRollerCoaster_fla
Section 51
//MainTimeline (HighonRollerCoaster_fla.MainTimeline)
package HighonRollerCoaster_fla {
import flash.utils.*;
import fl.controls.*;
import flash.display.*;
import com.newgrounds.*;
import flash.events.*;
import fl.motion.*;
import flash.geom.*;
import fl.events.*;
import flash.net.*;
import flash.text.*;
import com.newgrounds.components.*;
import flash.system.*;
import flash.ui.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.media.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public const THENOSEMILK_PLAYLIST:String = "UU5FG3CA3XHF4gNY6bnTbPlg";
public const NOSEMILKMEDIA_PLAYLIST:String = "UUqLhbX_JmPfdynk2AJENp_g";
public const NM_MUSIC_VIDEO_PLAYLIST:String = "PLDFB8A1DDDDCCB330";
public const THENOSEMILK_SHOW_PLAYLIST:String = "PL3E91839E4C7E340B";
public const WOP_PLAYLIST:String = "PL8561C8DDCDF86813";
public const RANDOM_SHORTS_PLAYLIST:String = "PL3B5202695E464AD2";
public const NOSEMILKMEDIA_SOCIAL_OBJ:Object;
public const THENOSEMILK_SOCIAL_OBJ:Object;
public var toggle_720p:MovieClip;
public var icon_youtube2:MovieClip;
public var toggle_1080p:MovieClip;
public var icon_twitter:MovieClip;
public var __id0_:APIConnector;
public var restart_all:MovieClip;
public var play_button:MovieClip;
public var icon_facebook2:MovieClip;
public var icon_newgrounds:MovieClip;
public var pause_button:MovieClip;
public var textBoxDebug:TextField;
public var toggle_480p:MovieClip;
public var icon_facebook:MovieClip;
public var icon_newgrounds2:MovieClip;
public var icon_email:EmailButton;
public var icon_twitter2:MovieClip;
public var restart_current:MovieClip;
public var icon_youtube:MovieClip;
public var thenosemilk_website_text:MovieClip;
public var __setPropDict:Dictionary;
public var youtubeVideoId:String;
public var cueThisPlaylist:String;
public var shufflePlaylist:Boolean;
public var social_network_links_obj:Object;
public var chromeless_player:Boolean;
public var rootLoaderInfo;
public var urlLoadingSWF;
public var player:Object;
public var msgBox:MsgBox;
public var pauseClicked:Boolean;
public var youtube_type_of_player_url:String;
public var youtube_size_width:int;
public var youtube_size_height:int;
public var loader:Loader;
public var playerStateShuffleCounter:int;
public var currentIndexPlaylist:int;
public var timerToShowAd:Timer;
public var timerCloseAdButton:Timer;
public var arrayTimerCloseAdButton:Array;
public var flashAd;
public var adBack:AdBack;
public var dontAllowClickBox:DontAllowClickBox;
public var playButtonRectObj:PlayButtonRectObj;
public var arrayFlashAd:Array;
public var arrayDontAllowClickBox:Array;
public var arrayAdBack:Array;
public var arrayPlayButtonRectObj:Array;
public var arrayRelatedObjects:Array;
public var videoNumber:int;
public var url:URLRequest;
public var albinoBlackSheep:AlbinoBlackSheep;
public var ngTrans:NGTrans2;
public var c;
public var colorTransformColor:uint;
public var colorTransformAlpha:Number;
public var volume_slider:Slider;
public var eventAddedBool:Boolean;
public var getPlaybackQuality:String;
public var getVolume:int;
public var customStartVolume:int;
public function MainTimeline(){
__setPropDict = new Dictionary(true);
NOSEMILKMEDIA_SOCIAL_OBJ = new Object();
THENOSEMILK_SOCIAL_OBJ = new Object();
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9, 9, frame10, 10, frame11, 11, frame12, 12, frame13, 13, frame14, 14, frame15);
}
public function onAPIConnected(_arg1:APIEvent):void{
if (_arg1.success){
trace("The API is connected and ready to use!");
} else {
trace(("Error connecting to the API: " + _arg1.error));
};
}
public function onLoaderInit(_arg1:Event):void{
addChild(loader);
loader.content.addEventListener("onReady", onPlayerReady);
loader.content.addEventListener("onError", onPlayerError);
loader.content.addEventListener("onStateChange", onPlayerStateChange);
loader.content.addEventListener("onPlaybackQualityChange", onVideoPlaybackQualityChange);
}
public function onPlayerReady(_arg1:Event):void{
trace("player ready:", Object(_arg1).data);
player = loader.content;
player.setSize(youtube_size_width, youtube_size_height);
player.cuePlaylist({list:cueThisPlaylist});
player.loadVideoById(youtubeVideoId);
player.setShuffle(shufflePlaylist);
player.playVideo();
player.pauseVideo();
player.setLoop(true);
removeChild(loader);
}
public function onPlayerError(_arg1:Event):void{
trace("player error:", Object(_arg1).data);
}
public function onPlayerStateChange(_arg1:Event):void{
var _local2:* = Object(_arg1).data;
trace("player state:", _local2);
var _local3:String = player.getVideoUrl();
trace("Video id:", _local3);
if ((((shufflePlaylist == true)) && ((_local2 == 3)))){
if (playerStateShuffleCounter != 0){
};
if (playerStateShuffleCounter < 2){
player.setShuffle(shufflePlaylist);
};
playerStateShuffleCounter++;
};
if (_local3.indexOf(youtubeVideoId) == -1){
if (((!((getChildByName("restart_all") == null))) && (!(restart_all.visible)))){
restart_all.visible = true;
};
if (currentIndexPlaylist != player.getPlaylistIndex()){
if (((!((videoNumber == 1))) && (chromeless_player))){
startShowingTimerAd();
} else {
if (!chromeless_player){
startShowingTimerAd();
};
};
currentIndexPlaylist = player.getPlaylistIndex();
videoNumber++;
};
};
}
public function startShowingTimerAd():void{
if (timerToShowAd == null){
timerToShowAd = new Timer(8000, 1);
timerToShowAd.addEventListener(TimerEvent.TIMER_COMPLETE, timerShowAd, false, 0, true);
timerToShowAd.start();
};
}
public function timerShowAd(_arg1:TimerEvent):void{
flashAd = new FlashAd();
flashAd.adType = "video";
flashAd.showBorder = false;
arrayFlashAd.push(flashAd);
adBack = new AdBack();
adBack.x = 251;
adBack.y = 26;
arrayAdBack.push(adBack);
dontAllowClickBox = new DontAllowClickBox();
dontAllowClickBox.alpha = 0.75;
arrayDontAllowClickBox.push(dontAllowClickBox);
stage.addChild(dontAllowClickBox);
dontAllowClickBox.x = -668;
dontAllowClickBox.y = -339;
playButtonRectObj = new PlayButtonRectObj();
arrayPlayButtonRectObj.push(playButtonRectObj);
stage.addChild(adBack);
adBack.addChild(flashAd);
adBack.addChild(playButtonRectObj);
flashAd.x = 5;
flashAd.y = 5;
playButtonRectObj.y = ((flashAd.y + flashAd.height) + 7);
playButtonRectObj.x = (((flashAd.width / 2) - (playButtonRectObj.width / 2)) + 20);
playButtonRectObj.mouseEnabled = false;
playButtonRectObj.alpha = 0.16;
timerCloseAdButton = new DataTimer(3500, 1);
playButtonRectObj.relatedObjects = new Object();
playButtonRectObj.relatedObjects.dontAllowClickBox = dontAllowClickBox;
playButtonRectObj.relatedObjects.flashAd = flashAd;
playButtonRectObj.relatedObjects.adBack = adBack;
playButtonRectObj.relatedObjects.timerCloseAdButton = timerCloseAdButton;
arrayRelatedObjects.push(playButtonRectObj.relatedObjects);
arrayTimerCloseAdButton.push(timerCloseAdButton);
timerCloseAdButton.addEventListener(TimerEvent.TIMER_COMPLETE, timerCloseAdButtonAppear, false, 0, true);
timerCloseAdButton.start();
player.pauseVideo();
_arg1.target.removeEventListener(TimerEvent.TIMER_COMPLETE, timerShowAd);
timerToShowAd = null;
}
public function timerCloseAdButtonAppear(_arg1:TimerEvent):void{
playButtonRectObj.alpha = 1;
playButtonRectObj.mouseEnabled = true;
playButtonRectObj.addEventListener(MouseEvent.CLICK, adRemoved, false, 0, true);
}
public function adRemoved(_arg1:Event){
var _local2:* = _arg1.target;
player.playVideo();
adBack.parent.removeChild(adBack);
dontAllowClickBox.parent.removeChild(dontAllowClickBox);
_local2.removeEventListener(MouseEvent.CLICK, adRemoved);
flashAd = null;
_local2 = null;
adBack = null;
dontAllowClickBox = null;
timerCloseAdButton.removeEventListener(TimerEvent.TIMER_COMPLETE, timerCloseAdButtonAppear);
timerCloseAdButton = null;
}
public function onVideoPlaybackQualityChange(_arg1:Event):void{
trace("video quality:", Object(_arg1).data);
}
public function showMsgBox(_arg1:int, _arg2:int){
msgBox.alpha = 0.9;
stage.addChild(msgBox);
msgBox.x = _arg1;
msgBox.y = _arg2;
}
public function removeMsgBox(){
if (msgBox.parent){
stage.removeChild(msgBox);
};
}
public function onMouseEventListener(_arg1:MouseEvent){
var _local2:URLRequest;
if (_arg1.type == MouseEvent.CLICK){
switch (_arg1.target.name){
case "icon_youtube":
_local2 = new URLRequest(social_network_links_obj.youtube);
navigateToURL(_local2, "_blank");
break;
case "icon_facebook":
_local2 = new URLRequest("http://facebook.com/thenosemilk");
navigateToURL(_local2, "_blank");
break;
case "icon_twitter":
_local2 = new URLRequest("http://twitter.com/thenosemilk");
navigateToURL(_local2, "_blank");
break;
case "icon_newgrounds":
_local2 = new URLRequest(social_network_links_obj.newgrounds);
navigateToURL(_local2, "_blank");
break;
case "thenosemilk_website_text":
API.loadMySite();
break;
};
} else {
if (_arg1.type == MouseEvent.MOUSE_OVER){
_arg1.target.alpha = 0.6;
switch (_arg1.target.name){
case "icon_youtube":
msgBox.textBox.text = "YOU LUBE\nIf you subscribe on YOU LUBE you get to watch me lube my knuckle hair!";
showMsgBox((_arg1.target.x - (msgBox.width / 2)), (_arg1.target.y - msgBox.height));
break;
};
} else {
if (_arg1.type == MouseEvent.MOUSE_OUT){
_arg1.target.alpha = 1;
switch (_arg1.target.name){
case "icon_youtube":
removeMsgBox();
break;
};
};
};
};
}
public function mouseClickSpecialSites(_arg1:MouseEvent):void{
if (_arg1.target.name == "albinoBlackSheep"){
url = new URLRequest("http://albinoblacksheep.com/");
navigateToURL(url, "_blank");
};
}
public function specialLinkMouseClickListener(_arg1:MouseEvent):void{
switch (_arg1.target.name){
case "ngTrans":
url = new URLRequest(social_network_links_obj.newgrounds);
navigateToURL(url, "_blank");
break;
};
}
public function addedToStage(_arg1:Event):void{
trace("Not working..");
}
public function eventEnterFrame(_arg1:Event):void{
if (eventAddedBool == false){
player.playVideo();
addChild(icon_facebook2);
icon_facebook2.visible = true;
addChild(icon_twitter2);
icon_twitter2.visible = true;
addChild(icon_newgrounds2);
icon_newgrounds2.visible = true;
addChild(icon_email);
icon_email.visible = true;
addChild(restart_current);
addChild(restart_all);
addChild(thenosemilk_website_text);
if (chromeless_player){
addChild(icon_youtube2);
icon_youtube2.visible = true;
} else {
toggle_480p.visible = false;
toggle_720p.visible = false;
toggle_1080p.visible = false;
pause_button.visible = false;
play_button.visible = false;
play_button.visible = false;
volume_slider.visible = false;
icon_youtube2.visible = false;
restart_current.visible = false;
restart_all.x = 280;
icon_email.x = 410;
icon_facebook2.x = 425;
icon_twitter2.x = 455;
icon_newgrounds2.x = 480;
thenosemilk_website_text.x = 525;
};
if (ngTrans != null){
addChild(ngTrans);
};
eventAddedBool = true;
};
if (((((((chromeless_player) && ((((player.getPlayerState() == 2)) || ((player.getPlayerState() == -1)))))) && ((flashAd == null)))) && (!(pauseClicked)))){
};
}
public function onMouseEventListener2(_arg1:MouseEvent){
var _local2:URLRequest;
if (_arg1.type == MouseEvent.CLICK){
switch (_arg1.target.name){
case "icon_email":
_local2 = new URLRequest("http://feedburner.google.com/fb/a/mailverify?uri=thenosemilk");
navigateToURL(_local2, "_blank");
break;
case "icon_youtube2":
_local2 = new URLRequest(social_network_links_obj.youtube);
navigateToURL(_local2, "_blank");
break;
case "icon_facebook2":
_local2 = new URLRequest("http://facebook.com/thenosemilk");
navigateToURL(_local2, "_blank");
break;
case "icon_twitter2":
_local2 = new URLRequest("http://twitter.com/thenosemilk");
navigateToURL(_local2, "_blank");
break;
case "icon_newgrounds2":
_local2 = new URLRequest(social_network_links_obj.newgrounds);
navigateToURL(_local2, "_blank");
break;
case "thenosemilk_website_text":
API.loadMySite();
break;
case "toggle_480p":
player.setPlaybackQuality("default");
c.setTint(colorTransformColor, colorTransformAlpha);
_arg1.target.transform.colorTransform = c;
toggle_720p.transform.colorTransform = new ColorTransform();
toggle_1080p.transform.colorTransform = new ColorTransform();
break;
case "toggle_720p":
player.setPlaybackQuality("hd720");
c.setTint(colorTransformColor, colorTransformAlpha);
_arg1.target.transform.colorTransform = c;
toggle_480p.transform.colorTransform = new ColorTransform();
toggle_1080p.transform.colorTransform = new ColorTransform();
break;
case "toggle_1080p":
player.setPlaybackQuality("hd1080");
c.setTint(colorTransformColor, colorTransformAlpha);
_arg1.target.transform.colorTransform = c;
toggle_480p.transform.colorTransform = new ColorTransform();
toggle_720p.transform.colorTransform = new ColorTransform();
break;
case "pause_button":
pauseClicked = true;
player.pauseVideo();
c.setTint(colorTransformColor, colorTransformAlpha);
_arg1.target.transform.colorTransform = c;
play_button.transform.colorTransform = new ColorTransform();
break;
case "play_button":
pauseClicked = false;
player.playVideo();
c.setTint(colorTransformColor, colorTransformAlpha);
_arg1.target.transform.colorTransform = c;
pause_button.transform.colorTransform = new ColorTransform();
break;
case "restart_current":
pauseClicked = false;
pause_button.transform.colorTransform = new ColorTransform();
player.seekTo(0);
break;
case "restart_all":
pauseClicked = false;
pause_button.transform.colorTransform = new ColorTransform();
player.cueVideoById(youtubeVideoId);
player.playVideo();
startShowingTimerAd();
break;
};
} else {
if (_arg1.type == MouseEvent.MOUSE_OVER){
_arg1.target.alpha = 0.6;
switch (_arg1.target.name){
case "icon_email":
msgBox.textBox.text = "EMAIL\nWe want you to know when we make more shorts! Click to get new COMICS, SHORTS and other updates in your email!";
showMsgBox((_arg1.target.x - (msgBox.width / 2)), (_arg1.target.y - msgBox.height));
break;
case "icon_youtube2":
msgBox.textBox.text = "YOU LUBE\nIf you subscribe on YOU LUBE you get to watch me lube my knuckle hair!";
showMsgBox((_arg1.target.x - (msgBox.width / 2)), (_arg1.target.y - msgBox.height));
break;
case "icon_facebook2":
msgBox.textBox.text = "FACEBOOK\nMake Mr. Zuckerberg proud by getting more of our stuff on Facebook!";
showMsgBox((_arg1.target.x - (msgBox.width / 2)), (_arg1.target.y - msgBox.height));
break;
case "icon_twitter2":
msgBox.textBox.text = "TWITTER\nFollow the little birdies before the cat gets to NOM NOM.";
showMsgBox((_arg1.target.x - (msgBox.width / 2)), (_arg1.target.y - msgBox.height));
break;
case "icon_newgrounds2":
msgBox.textBox.text = "NEWGROUNDS\nFollow me on newgrounds 'lieK a BO$$'.";
showMsgBox((_arg1.target.x - (msgBox.width / 2)), (_arg1.target.y - msgBox.height));
break;
case "thenosemilk_website_text":
msgBox.textBox.text = "WEBSITE\nThe only place where you get to read about how I found dinosaur testicles in my backyard in COMIC form!";
showMsgBox(((_arg1.target.x - (msgBox.width / 2)) - 40), (_arg1.target.y - msgBox.height));
break;
};
} else {
if (_arg1.type == MouseEvent.MOUSE_OUT){
_arg1.target.alpha = 1;
switch (_arg1.target.name){
case "icon_email":
removeMsgBox();
break;
case "icon_youtube2":
removeMsgBox();
break;
case "icon_facebook2":
removeMsgBox();
break;
case "icon_twitter2":
removeMsgBox();
break;
case "icon_newgrounds2":
removeMsgBox();
break;
case "thenosemilk_website_text":
removeMsgBox();
break;
};
};
};
};
}
public function sliderEventChange(_arg1:SliderEvent):void{
player.setVolume(_arg1.target.value);
}
function __setProp___id0__Scene1_LOADER_0(){
if ((((__setPropDict[__id0_] == undefined)) || (!((int(__setPropDict[__id0_]) == 1))))){
__setPropDict[__id0_] = 1;
try {
__id0_["componentInspectorSetting"] = true;
} catch(e:Error) {
};
__id0_.apiId = "23492:gt5LIQSf";
__id0_.encryptionKey = "s4f6W1xmkrSuu5UBIr7iadROWIWpidIE";
__id0_.debugMode = "Simulate Logged-in User";
__id0_.movieVersion = "";
__id0_.connectorType = "Flash Ad + Preloader";
__id0_.redirectOnNewVersion = true;
__id0_.redirectOnHostBlocked = true;
__id0_.adType = "Video";
try {
__id0_["componentInspectorSetting"] = false;
} catch(e:Error) {
};
};
}
function __setProp_volume_slider_Scene1_Layer2_1(){
if ((((__setPropDict[volume_slider] == undefined)) || (!((((int(__setPropDict[volume_slider]) >= 2)) && ((int(__setPropDict[volume_slider]) <= 15))))))){
__setPropDict[volume_slider] = currentFrame;
try {
volume_slider["componentInspectorSetting"] = true;
} catch(e:Error) {
};
volume_slider.direction = "horizontal";
volume_slider.enabled = true;
volume_slider.liveDragging = true;
volume_slider.maximum = 100;
volume_slider.minimum = 0;
volume_slider.snapInterval = 1;
volume_slider.tickInterval = 0;
volume_slider.value = 50;
volume_slider.visible = true;
try {
volume_slider["componentInspectorSetting"] = false;
} catch(e:Error) {
};
};
}
function frame1(){
__setProp___id0__Scene1_LOADER_0();
API.debugMode = API.RELEASE_MODE;
API.addEventListener(APIEvent.API_CONNECTED, onAPIConnected);
NOSEMILKMEDIA_SOCIAL_OBJ.youtube = "http://youtube.com/nosemilkmedia";
NOSEMILKMEDIA_SOCIAL_OBJ.newgrounds = "http://nosemilkmedia.newgrounds.com";
THENOSEMILK_SOCIAL_OBJ.youtube = "http://youtube.com/thenosemilk";
THENOSEMILK_SOCIAL_OBJ.newgrounds = "http://thenosemilk.newgrounds.com";
youtubeVideoId = "CjtxHSkfR90";
cueThisPlaylist = NOSEMILKMEDIA_PLAYLIST;
shufflePlaylist = false;
social_network_links_obj = NOSEMILKMEDIA_SOCIAL_OBJ;
chromeless_player = true;
Security.allowDomain("www.youtube.com");
Security.allowDomain("youtube.com");
Security.allowDomain("s.ytimg.com");
Security.allowDomain("i.ytimg.com");
rootLoaderInfo = this.root.loaderInfo;
urlLoadingSWF = rootLoaderInfo.url;
textBoxDebug.text = urlLoadingSWF;
msgBox = new MsgBox();
pauseClicked = false;
if (chromeless_player){
youtube_type_of_player_url = "http://www.youtube.com/apiplayer?version=3";
youtube_size_width = 848;
youtube_size_height = 454;
} else {
youtube_type_of_player_url = (("http://www.youtube.com/v/" + youtubeVideoId) + "?version=3");
youtube_size_width = 848;
youtube_size_height = 480;
};
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.INIT, onLoaderInit);
loader.load(new URLRequest(youtube_type_of_player_url));
playerStateShuffleCounter = 0;
currentIndexPlaylist = -999999;
timerToShowAd = null;
arrayTimerCloseAdButton = [];
flashAd = null;
arrayFlashAd = [];
arrayDontAllowClickBox = [];
arrayAdBack = [];
arrayPlayButtonRectObj = [];
arrayRelatedObjects = [];
videoNumber = 1;
icon_youtube.buttonMode = true;
icon_facebook.buttonMode = true;
icon_twitter.buttonMode = true;
icon_newgrounds.buttonMode = true;
thenosemilk_website_text.buttonMode = true;
icon_youtube.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener, false, 0, true);
icon_facebook.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener, false, 0, true);
icon_twitter.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener, false, 0, true);
icon_newgrounds.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener, false, 0, true);
thenosemilk_website_text.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener, false, 0, true);
icon_youtube.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener, false, 0, true);
icon_facebook.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener, false, 0, true);
icon_twitter.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener, false, 0, true);
icon_newgrounds.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener, false, 0, true);
thenosemilk_website_text.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener, false, 0, true);
icon_youtube.addEventListener(MouseEvent.CLICK, onMouseEventListener, false, 0, true);
icon_facebook.addEventListener(MouseEvent.CLICK, onMouseEventListener, false, 0, true);
icon_twitter.addEventListener(MouseEvent.CLICK, onMouseEventListener, false, 0, true);
icon_newgrounds.addEventListener(MouseEvent.CLICK, onMouseEventListener, false, 0, true);
thenosemilk_website_text.addEventListener(MouseEvent.CLICK, onMouseEventListener, false, 0, true);
if (urlLoadingSWF.indexOf("albinoblacksheep.com") != -1){
albinoBlackSheep = new AlbinoBlackSheep();
addChild(albinoBlackSheep);
albinoBlackSheep.name = "albinoBlackSheep";
albinoBlackSheep.x = (thenosemilk_website_text.x - 30);
albinoBlackSheep.y = ((thenosemilk_website_text.y + thenosemilk_website_text.height) - 45);
albinoBlackSheep.addEventListener(MouseEvent.CLICK, mouseClickSpecialSites, false, 0, true);
albinoBlackSheep.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener, false, 0, true);
albinoBlackSheep.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener, false, 0, true);
albinoBlackSheep.mouseEnabled = true;
albinoBlackSheep.mouseChildren = false;
albinoBlackSheep.buttonMode = true;
};
}
function frame2(){
__setProp_volume_slider_Scene1_Layer2_1();
stop();
if (chromeless_player){
if (((!((urlLoadingSWF.indexOf("newgrounds.com") == -1))) || (!((urlLoadingSWF.indexOf("ungrounded.net") == -1))))){
ngTrans = new NGTrans2();
addChild(ngTrans);
ngTrans.name = "ngTrans";
ngTrans.x = 710;
ngTrans.y = 409;
ngTrans.scaleX = 1;
ngTrans.scaleY = 1;
ngTrans.buttonMode = true;
ngTrans.addEventListener(MouseEvent.CLICK, specialLinkMouseClickListener, false, 0, true);
};
};
addChild(loader);
player.playVideo();
if (ngTrans != null){
addChild(ngTrans);
};
c = new Color();
colorTransformColor = 16750899;
colorTransformAlpha = 0.75;
msgBox.textBox.text = "Bwahahaha!";
restart_all.visible = false;
addEventListener(Event.ENTER_FRAME, eventEnterFrame, false, 0, true);
eventAddedBool = false;
icon_email.buttonMode = true;
icon_youtube2.buttonMode = true;
icon_facebook2.buttonMode = true;
icon_twitter2.buttonMode = true;
icon_newgrounds2.buttonMode = true;
thenosemilk_website_text.buttonMode = true;
toggle_480p.buttonMode = true;
toggle_720p.buttonMode = true;
toggle_1080p.buttonMode = true;
pause_button.buttonMode = true;
play_button.buttonMode = true;
restart_current.buttonMode = true;
restart_all.buttonMode = true;
icon_email.mouseChildren = false;
thenosemilk_website_text.mouseChildren = false;
icon_facebook2.mouseChildren = false;
toggle_480p.mouseChildren = false;
toggle_720p.mouseChildren = false;
toggle_1080p.mouseChildren = false;
pause_button.mouseChildren = false;
play_button.mouseChildren = false;
restart_current.mouseChildren = false;
restart_all.mouseChildren = false;
volume_slider.addEventListener(SliderEvent.CHANGE, sliderEventChange, false, 0, true);
icon_email.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener2, false, 0, true);
icon_youtube2.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener2, false, 0, true);
icon_facebook2.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener2, false, 0, true);
icon_twitter2.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener2, false, 0, true);
icon_newgrounds2.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener2, false, 0, true);
thenosemilk_website_text.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener2, false, 0, true);
toggle_480p.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener2, false, 0, true);
toggle_720p.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener2, false, 0, true);
toggle_1080p.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener2, false, 0, true);
pause_button.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener2, false, 0, true);
play_button.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener2, false, 0, true);
restart_current.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener2, false, 0, true);
restart_all.addEventListener(MouseEvent.MOUSE_OVER, onMouseEventListener2, false, 0, true);
icon_email.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener2, false, 0, true);
icon_youtube2.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener2, false, 0, true);
icon_facebook2.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener2, false, 0, true);
icon_twitter2.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener2, false, 0, true);
icon_newgrounds2.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener2, false, 0, true);
thenosemilk_website_text.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener2, false, 0, true);
toggle_480p.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener2, false, 0, true);
toggle_720p.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener2, false, 0, true);
toggle_1080p.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener2, false, 0, true);
pause_button.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener2, false, 0, true);
play_button.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener2, false, 0, true);
restart_current.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener2, false, 0, true);
restart_all.addEventListener(MouseEvent.MOUSE_OUT, onMouseEventListener2, false, 0, true);
icon_email.addEventListener(MouseEvent.CLICK, onMouseEventListener2, false, 0, true);
icon_youtube2.addEventListener(MouseEvent.CLICK, onMouseEventListener2, false, 0, true);
icon_facebook2.addEventListener(MouseEvent.CLICK, onMouseEventListener2, false, 0, true);
icon_twitter2.addEventListener(MouseEvent.CLICK, onMouseEventListener2, false, 0, true);
icon_newgrounds2.addEventListener(MouseEvent.CLICK, onMouseEventListener2, false, 0, true);
thenosemilk_website_text.addEventListener(MouseEvent.CLICK, onMouseEventListener2, false, 0, true);
toggle_480p.addEventListener(MouseEvent.CLICK, onMouseEventListener2, false, 0, true);
toggle_720p.addEventListener(MouseEvent.CLICK, onMouseEventListener2, false, 0, true);
toggle_1080p.addEventListener(MouseEvent.CLICK, onMouseEventListener2, false, 0, true);
pause_button.addEventListener(MouseEvent.CLICK, onMouseEventListener2, false, 0, true);
play_button.addEventListener(MouseEvent.CLICK, onMouseEventListener2, false, 0, true);
restart_current.addEventListener(MouseEvent.CLICK, onMouseEventListener2, false, 0, true);
restart_all.addEventListener(MouseEvent.CLICK, onMouseEventListener2, false, 0, true);
getPlaybackQuality = player.getPlaybackQuality();
trace(getPlaybackQuality, "getPlaybackQuality");
c.setTint(colorTransformColor, colorTransformAlpha);
toggle_480p.transform.colorTransform = c;
getVolume = player.getVolume();
trace(getVolume, "getVolume");
customStartVolume = 50;
player.setVolume(customStartVolume);
volume_slider.value = customStartVolume;
}
function frame3(){
__setProp_volume_slider_Scene1_Layer2_1();
}
function frame4(){
__setProp_volume_slider_Scene1_Layer2_1();
}
function frame5(){
__setProp_volume_slider_Scene1_Layer2_1();
}
function frame6(){
__setProp_volume_slider_Scene1_Layer2_1();
}
function frame7(){
__setProp_volume_slider_Scene1_Layer2_1();
}
function frame8(){
__setProp_volume_slider_Scene1_Layer2_1();
}
function frame9(){
__setProp_volume_slider_Scene1_Layer2_1();
}
function frame10(){
__setProp_volume_slider_Scene1_Layer2_1();
}
function frame11(){
__setProp_volume_slider_Scene1_Layer2_1();
}
function frame12(){
__setProp_volume_slider_Scene1_Layer2_1();
}
function frame13(){
__setProp_volume_slider_Scene1_Layer2_1();
}
function frame14(){
__setProp_volume_slider_Scene1_Layer2_1();
}
function frame15(){
__setProp_volume_slider_Scene1_Layer2_1();
}
}
}//package HighonRollerCoaster_fla
Section 52
//Timeline_21 (HighonRollerCoaster_fla.Timeline_21)
package HighonRollerCoaster_fla {
import flash.display.*;
public dynamic class Timeline_21 extends MovieClip {
public function Timeline_21(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
buttonMode = true;
}
}
}//package HighonRollerCoaster_fla
Section 53
//Timeline_25 (HighonRollerCoaster_fla.Timeline_25)
package HighonRollerCoaster_fla {
import flash.display.*;
public dynamic class Timeline_25 extends MovieClip {
public function Timeline_25(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package HighonRollerCoaster_fla
Section 54
//AdBack (AdBack)
package {
import flash.display.*;
public dynamic class AdBack extends MovieClip {
}
}//package
Section 55
//AlbinoBlackSheep (AlbinoBlackSheep)
package {
import flash.display.*;
public dynamic class AlbinoBlackSheep extends MovieClip {
}
}//package
Section 56
//DataTimer (DataTimer)
package {
import flash.utils.*;
public class DataTimer extends Timer {
private var _data:Object;
public function DataTimer(_arg1:Number, _arg2:int=0){
super(_arg1, _arg2);
_data = {};
}
public function get data():Object{
return (_data);
}
public function set data(_arg1:Object):void{
_data = _arg1;
}
}
}//package
Section 57
//DontAllowClickBox (DontAllowClickBox)
package {
import flash.display.*;
public dynamic class DontAllowClickBox extends MovieClip {
}
}//package
Section 58
//EmailButton (EmailButton)
package {
import flash.display.*;
public dynamic class EmailButton extends MovieClip {
}
}//package
Section 59
//focusRectSkin (focusRectSkin)
package {
import flash.display.*;
public dynamic class focusRectSkin extends MovieClip {
}
}//package
Section 60
//MsgBox (MsgBox)
package {
import flash.display.*;
import flash.text.*;
public dynamic class MsgBox extends MovieClip {
public var textBox:TextField;
}
}//package
Section 61
//NGTrans (NGTrans)
package {
import flash.display.*;
public dynamic class NGTrans extends MovieClip {
}
}//package
Section 62
//NGTrans2 (NGTrans2)
package {
import flash.display.*;
public dynamic class NGTrans2 extends MovieClip {
}
}//package
Section 63
//PlayButtonRectObj (PlayButtonRectObj)
package {
import flash.display.*;
public dynamic class PlayButtonRectObj extends MovieClip {
public function PlayButtonRectObj(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
buttonMode = true;
}
}
}//package
Section 64
//SliderThumb_disabledSkin (SliderThumb_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_disabledSkin extends MovieClip {
}
}//package
Section 65
//SliderThumb_downSkin (SliderThumb_downSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_downSkin extends MovieClip {
}
}//package
Section 66
//SliderThumb_overSkin (SliderThumb_overSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_overSkin extends MovieClip {
}
}//package
Section 67
//SliderThumb_upSkin (SliderThumb_upSkin)
package {
import flash.display.*;
public dynamic class SliderThumb_upSkin extends MovieClip {
}
}//package
Section 68
//SliderTick_skin (SliderTick_skin)
package {
import flash.display.*;
public dynamic class SliderTick_skin extends MovieClip {
}
}//package
Section 69
//SliderTrack_disabledSkin (SliderTrack_disabledSkin)
package {
import flash.display.*;
public dynamic class SliderTrack_disabledSkin extends MovieClip {
}
}//package
Section 70
//SliderTrack_skin (SliderTrack_skin)
package {
import flash.display.*;
public dynamic class SliderTrack_skin extends MovieClip {
}
}//package