Section 1
//MD5 (com.adobe.crypto.MD5)
package com.adobe.crypto {
import flash.utils.*;
import com.adobe.utils.*;
public class MD5 {
public static var digest:ByteArray;
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 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 ((IntUtil.rol(_local9, _arg7) + _arg3));
}
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));
}
public static function hash(_arg1:String):String{
var _local2:ByteArray = new ByteArray();
_local2.writeUTFBytes(_arg1);
return (hashBinary(_local2));
}
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 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 ((((IntUtil.toHex(_local2) + IntUtil.toHex(_local3)) + IntUtil.toHex(_local4)) + IntUtil.toHex(_local5)));
}
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 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));
}
public static function hashBytes(_arg1:ByteArray):String{
return (hashBinary(_arg1));
}
}
}//package com.adobe.crypto
Section 2
//PNGEncoder (com.adobe.images.PNGEncoder)
package com.adobe.images {
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
public class PNGEncoder {
private static var crcTableComputed:Boolean = false;
private static var crcTable:Array;
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);
}
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);
}
}
}//package com.adobe.images
Section 3
//JSON (com.adobe.serialization.json.JSON)
package com.adobe.serialization.json {
public class JSON {
public static function decode(_arg1:String){
var _local2:JSONDecoder = new JSONDecoder(_arg1);
return (_local2.getValue());
}
public static function encode(_arg1:Object):String{
var _local2:JSONEncoder = new JSONEncoder(_arg1);
return (_local2.getString());
}
}
}//package com.adobe.serialization.json
Section 4
//JSONDecoder (com.adobe.serialization.json.JSONDecoder)
package com.adobe.serialization.json {
public class JSONDecoder {
private var value;
private var tokenizer:JSONTokenizer;
private var token:JSONToken;
public function JSONDecoder(_arg1:String){
tokenizer = new JSONTokenizer(_arg1);
nextToken();
value = parseValue();
}
private function parseObject():Object{
var _local2:String;
var _local1:Object = new Object();
nextToken();
if (token.type == JSONTokenType.RIGHT_BRACE){
return (_local1);
};
while (true) {
if (token.type == JSONTokenType.STRING){
_local2 = String(token.value);
nextToken();
if (token.type == JSONTokenType.COLON){
nextToken();
_local1[_local2] = parseValue();
nextToken();
if (token.type == JSONTokenType.RIGHT_BRACE){
return (_local1);
};
if (token.type == JSONTokenType.COMMA){
nextToken();
} else {
tokenizer.parseError(("Expecting } or , but found " + token.value));
};
} else {
tokenizer.parseError(("Expecting : but found " + token.value));
};
} else {
tokenizer.parseError(("Expecting string but found " + token.value));
};
};
return (null);
}
private function parseValue():Object{
if (token == null){
tokenizer.parseError("Unexpected end of input");
};
switch (token.type){
case JSONTokenType.LEFT_BRACE:
return (parseObject());
case JSONTokenType.LEFT_BRACKET:
return (parseArray());
case JSONTokenType.STRING:
case JSONTokenType.NUMBER:
case JSONTokenType.TRUE:
case JSONTokenType.FALSE:
case JSONTokenType.NULL:
return (token.value);
default:
tokenizer.parseError(("Unexpected " + token.value));
};
return (null);
}
private function nextToken():JSONToken{
return ((token = tokenizer.getNextToken()));
}
public function getValue(){
return (value);
}
private function parseArray():Array{
var _local1:Array = new Array();
nextToken();
if (token.type == JSONTokenType.RIGHT_BRACKET){
return (_local1);
};
while (true) {
_local1.push(parseValue());
nextToken();
if (token.type == JSONTokenType.RIGHT_BRACKET){
return (_local1);
};
if (token.type == JSONTokenType.COMMA){
nextToken();
} else {
tokenizer.parseError(("Expecting ] or , but found " + token.value));
};
};
return (null);
}
}
}//package com.adobe.serialization.json
Section 5
//JSONEncoder (com.adobe.serialization.json.JSONEncoder)
package com.adobe.serialization.json {
import flash.utils.*;
public class JSONEncoder {
private var jsonString:String;
public function JSONEncoder(_arg1){
jsonString = convertToString(_arg1);
}
private function escapeString(_arg1:String):String{
var _local3:String;
var _local6:String;
var _local7:String;
var _local2 = "";
var _local4:Number = _arg1.length;
var _local5:int;
while (_local5 < _local4) {
_local3 = _arg1.charAt(_local5);
switch (_local3){
case "\"":
_local2 = (_local2 + "\\\"");
break;
case "\\":
_local2 = (_local2 + "\\\\");
break;
case "\b":
_local2 = (_local2 + "\\b");
break;
case "\f":
_local2 = (_local2 + "\\f");
break;
case "\n":
_local2 = (_local2 + "\\n");
break;
case "\r":
_local2 = (_local2 + "\\r");
break;
case "\t":
_local2 = (_local2 + "\\t");
break;
default:
if (_local3 < " "){
_local6 = _local3.charCodeAt(0).toString(16);
_local7 = ((_local6.length == 2)) ? "00" : "000";
_local2 = (_local2 + (("\\u" + _local7) + _local6));
} else {
_local2 = (_local2 + _local3);
};
};
_local5++;
};
return ((("\"" + _local2) + "\""));
}
private function arrayToString(_arg1:Array):String{
var _local2 = "";
var _local3:int;
while (_local3 < _arg1.length) {
if (_local2.length > 0){
_local2 = (_local2 + ",");
};
_local2 = (_local2 + convertToString(_arg1[_local3]));
_local3++;
};
return ((("[" + _local2) + "]"));
}
public function getString():String{
return (jsonString);
}
private function objectToString(_arg1:Object):String{
var value:Object;
var key:String;
var v:XML;
var o = _arg1;
var s = "";
var classInfo:XML = describeType(o);
if (classInfo.@name.toString() == "Object"){
for (key in o) {
value = o[key];
if ((value is Function)){
} else {
if (s.length > 0){
s = (s + ",");
};
s = (s + ((escapeString(key) + ":") + convertToString(value)));
};
};
} else {
for each (v in classInfo..*.(((name() == "variable")) || ((name() == "accessor")))) {
if (s.length > 0){
s = (s + ",");
};
s = (s + ((escapeString(v.@name.toString()) + ":") + convertToString(o[v.@name])));
};
};
return ((("{" + s) + "}"));
}
private function convertToString(_arg1):String{
if ((_arg1 is String)){
return (escapeString((_arg1 as String)));
};
if ((_arg1 is Number)){
return ((isFinite((_arg1 as Number))) ? _arg1.toString() : "null");
} else {
if ((_arg1 is Boolean)){
return ((_arg1) ? "true" : "false");
} else {
if ((_arg1 is Array)){
return (arrayToString((_arg1 as Array)));
};
if ((((_arg1 is Object)) && (!((_arg1 == null))))){
return (objectToString(_arg1));
};
};
};
return ("null");
}
}
}//package com.adobe.serialization.json
Section 6
//JSONParseError (com.adobe.serialization.json.JSONParseError)
package com.adobe.serialization.json {
public class JSONParseError extends Error {
private var _location:int;
private var _text:String;
public function JSONParseError(_arg1:String="", _arg2:int=0, _arg3:String=""){
super(_arg1);
name = "JSONParseError";
_location = _arg2;
_text = _arg3;
}
public function get location():int{
return (_location);
}
public function get text():String{
return (_text);
}
}
}//package com.adobe.serialization.json
Section 7
//JSONToken (com.adobe.serialization.json.JSONToken)
package com.adobe.serialization.json {
public class JSONToken {
private var _value:Object;
private var _type:int;
public function JSONToken(_arg1:int=-1, _arg2:Object=null){
_type = _arg1;
_value = _arg2;
}
public function get value():Object{
return (_value);
}
public function get type():int{
return (_type);
}
public function set type(_arg1:int):void{
_type = _arg1;
}
public function set value(_arg1:Object):void{
_value = _arg1;
}
}
}//package com.adobe.serialization.json
Section 8
//JSONTokenizer (com.adobe.serialization.json.JSONTokenizer)
package com.adobe.serialization.json {
public class JSONTokenizer {
private var loc:int;
private var ch:String;
private var obj:Object;
private var jsonString:String;
public function JSONTokenizer(_arg1:String){
jsonString = _arg1;
loc = 0;
nextChar();
}
private function skipComments():void{
if (ch == "/"){
nextChar();
switch (ch){
case "/":
do {
nextChar();
} while (((!((ch == "\n"))) && (!((ch == "")))));
nextChar();
break;
case "*":
nextChar();
while (true) {
if (ch == "*"){
nextChar();
if (ch == "/"){
nextChar();
break;
};
} else {
nextChar();
};
if (ch == ""){
parseError("Multi-line comment not closed");
};
};
break;
default:
parseError((("Unexpected " + ch) + " encountered (expecting '/' or '*' )"));
};
};
}
private function isDigit(_arg1:String):Boolean{
return ((((_arg1 >= "0")) && ((_arg1 <= "9"))));
}
private function readString():JSONToken{
var _local3:String;
var _local4:int;
var _local1:JSONToken = new JSONToken();
_local1.type = JSONTokenType.STRING;
var _local2 = "";
nextChar();
while (((!((ch == "\""))) && (!((ch == ""))))) {
if (ch == "\\"){
nextChar();
switch (ch){
case "\"":
_local2 = (_local2 + "\"");
break;
case "/":
_local2 = (_local2 + "/");
break;
case "\\":
_local2 = (_local2 + "\\");
break;
case "b":
_local2 = (_local2 + "\b");
break;
case "f":
_local2 = (_local2 + "\f");
break;
case "n":
_local2 = (_local2 + "\n");
break;
case "r":
_local2 = (_local2 + "\r");
break;
case "t":
_local2 = (_local2 + "\t");
break;
case "u":
_local3 = "";
_local4 = 0;
while (_local4 < 4) {
if (!isHexDigit(nextChar())){
parseError((" Excepted a hex digit, but found: " + ch));
};
_local3 = (_local3 + ch);
_local4++;
};
_local2 = (_local2 + String.fromCharCode(parseInt(_local3, 16)));
break;
default:
_local2 = (_local2 + ("\\" + ch));
};
} else {
_local2 = (_local2 + ch);
};
nextChar();
};
if (ch == ""){
parseError("Unterminated string literal");
};
nextChar();
_local1.value = _local2;
return (_local1);
}
private function nextChar():String{
return ((ch = jsonString.charAt(loc++)));
}
public function getNextToken():JSONToken{
var _local2:String;
var _local3:String;
var _local4:String;
var _local1:JSONToken = new JSONToken();
skipIgnored();
switch (ch){
case "{":
_local1.type = JSONTokenType.LEFT_BRACE;
_local1.value = "{";
nextChar();
break;
case "}":
_local1.type = JSONTokenType.RIGHT_BRACE;
_local1.value = "}";
nextChar();
break;
case "[":
_local1.type = JSONTokenType.LEFT_BRACKET;
_local1.value = "[";
nextChar();
break;
case "]":
_local1.type = JSONTokenType.RIGHT_BRACKET;
_local1.value = "]";
nextChar();
break;
case ",":
_local1.type = JSONTokenType.COMMA;
_local1.value = ",";
nextChar();
break;
case ":":
_local1.type = JSONTokenType.COLON;
_local1.value = ":";
nextChar();
break;
case "t":
_local2 = ((("t" + nextChar()) + nextChar()) + nextChar());
if (_local2 == "true"){
_local1.type = JSONTokenType.TRUE;
_local1.value = true;
nextChar();
} else {
parseError(("Expecting 'true' but found " + _local2));
};
break;
case "f":
_local3 = (((("f" + nextChar()) + nextChar()) + nextChar()) + nextChar());
if (_local3 == "false"){
_local1.type = JSONTokenType.FALSE;
_local1.value = false;
nextChar();
} else {
parseError(("Expecting 'false' but found " + _local3));
};
break;
case "n":
_local4 = ((("n" + nextChar()) + nextChar()) + nextChar());
if (_local4 == "null"){
_local1.type = JSONTokenType.NULL;
_local1.value = null;
nextChar();
} else {
parseError(("Expecting 'null' but found " + _local4));
};
break;
case "\"":
_local1 = readString();
break;
default:
if (((isDigit(ch)) || ((ch == "-")))){
_local1 = readNumber();
} else {
if (ch == ""){
return (null);
};
parseError((("Unexpected " + ch) + " encountered"));
};
};
return (_local1);
}
private function skipWhite():void{
while (isWhiteSpace(ch)) {
nextChar();
};
}
public function parseError(_arg1:String):void{
throw (new JSONParseError(_arg1, loc, jsonString));
}
private function isWhiteSpace(_arg1:String):Boolean{
return ((((((((_arg1 == " ")) || ((_arg1 == "\t")))) || ((_arg1 == "\n")))) || ((_arg1 == "\r"))));
}
private function skipIgnored():void{
var _local1:int;
do {
_local1 = loc;
skipWhite();
skipComments();
} while (_local1 != loc);
}
private function isHexDigit(_arg1:String):Boolean{
var _local2:String = _arg1.toUpperCase();
return (((isDigit(_arg1)) || ((((_local2 >= "A")) && ((_local2 <= "F"))))));
}
private function readNumber():JSONToken{
var _local1:JSONToken = new JSONToken();
_local1.type = JSONTokenType.NUMBER;
var _local2 = "";
if (ch == "-"){
_local2 = (_local2 + "-");
nextChar();
};
if (!isDigit(ch)){
parseError("Expecting a digit");
};
if (ch == "0"){
_local2 = (_local2 + ch);
nextChar();
if (isDigit(ch)){
parseError("A digit cannot immediately follow 0");
};
} else {
while (isDigit(ch)) {
_local2 = (_local2 + ch);
nextChar();
};
};
if (ch == "."){
_local2 = (_local2 + ".");
nextChar();
if (!isDigit(ch)){
parseError("Expecting a digit");
};
while (isDigit(ch)) {
_local2 = (_local2 + ch);
nextChar();
};
};
if ((((ch == "e")) || ((ch == "E")))){
_local2 = (_local2 + "e");
nextChar();
if ((((ch == "+")) || ((ch == "-")))){
_local2 = (_local2 + ch);
nextChar();
};
if (!isDigit(ch)){
parseError("Scientific notation number needs exponent value");
};
while (isDigit(ch)) {
_local2 = (_local2 + ch);
nextChar();
};
};
var _local3:Number = Number(_local2);
if (((isFinite(_local3)) && (!(isNaN(_local3))))){
_local1.value = _local3;
return (_local1);
};
parseError((("Number " + _local3) + " is not valid!"));
return (null);
}
}
}//package com.adobe.serialization.json
Section 9
//JSONTokenType (com.adobe.serialization.json.JSONTokenType)
package com.adobe.serialization.json {
public class JSONTokenType {
public static const NUMBER:int = 11;
public static const FALSE:int = 8;
public static const RIGHT_BRACKET:int = 4;
public static const NULL:int = 9;
public static const TRUE:int = 7;
public static const RIGHT_BRACE:int = 2;
public static const UNKNOWN:int = -1;
public static const COMMA:int = 0;
public static const LEFT_BRACKET:int = 3;
public static const STRING:int = 10;
public static const LEFT_BRACE:int = 1;
public static const COLON:int = 6;
}
}//package com.adobe.serialization.json
Section 10
//IntUtil (com.adobe.utils.IntUtil)
package com.adobe.utils {
public class IntUtil {
private static var hexChars:String = "0123456789abcdef";
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);
}
public static function ror(_arg1:int, _arg2:int):uint{
var _local3:int = (32 - _arg2);
return (((_arg1 << _local3) | (_arg1 >>> (32 - _local3))));
}
public static function rol(_arg1:int, _arg2:int):int{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
}
}//package com.adobe.utils
Section 11
//APIConnector (com.newgrounds.components.APIConnector)
package com.newgrounds.components {
import flash.events.*;
import flash.display.*;
import com.newgrounds.*;
import flash.utils.*;
public class APIConnector extends MovieClip {
private var _popDelay:Timer;
private var _initialized:Boolean;
private var _medalPopup:MedalPopup;
private var _movieId:String;
public var background:MovieClip;
public var closeButton:SimpleButton;
private var _showConnectingPopup:Boolean;// = true
public var viewLatestButton:SimpleButton;
private var _encryptionKey:String;
private var _useErrorPopup:Boolean;// = true
private var _movieVersion:String;
public var errorDialog:MovieClip;
public var viewAuthorizedButton:SimpleButton;
public function APIConnector(){
_popDelay = new Timer(3000, 1);
super();
addFrameScript(0, frame1, 6, frame7, 7, frame8);
if (((!((parent == null))) && ((getQualifiedClassName(parent) == "fl.livepreview::LivePreviewParent")))){
return;
};
useErrorPopup = true;
useMedalPopup = true;
_popDelay.addEventListener(TimerEvent.TIMER, errorTimerHandler);
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
if (stage){
addEventListener(Event.RENDER, renderHandler);
stage.invalidate();
} else {
clear();
};
}
private function newVersionAvailableHandler(_arg1:APIEvent):void{
gotoAndStop("new_version");
visible = true;
centerOnStage();
}
private function hostBlockedHandler(_arg1:APIEvent):void{
gotoAndStop("bad_host");
visible = true;
centerOnStage();
}
public function get movieVersion():String{
return (_movieVersion);
}
private function closeButtonClickHandler(_arg1:Event):void{
clear();
}
public function set movieVersion(_arg1:String):void{
_movieVersion = _arg1;
}
public function get debugMode():Boolean{
return (API.debugMode);
}
public function get showConnectingPopup():Boolean{
return (_showConnectingPopup);
}
private function enterFrameHandler(_arg1:Event):void{
forceAlwaysOnTop();
}
private function officialVersionClickHandler(_arg1:Event):void{
API.loadOfficialVersion();
}
public function set showConnectingPopup(_arg1:Boolean):void{
_showConnectingPopup = _arg1;
if (((!(_arg1)) && ((((currentLabel == "connecting")) || ((currentLabel == "connected")))))){
clear();
};
}
public function set encryptionKey(_arg1:String):void{
_encryptionKey = _arg1;
}
public function set debugMode(_arg1:Boolean):void{
API.debugMode = true;
}
public function set useMedalPopup(_arg1:Boolean):void{
if (((_arg1) && (!(_medalPopup)))){
_medalPopup = new MedalPopup();
addChild(_medalPopup);
} else {
if (((!(_arg1)) && (_medalPopup))){
removeChild(_medalPopup);
_medalPopup = null;
};
};
}
private function forceAlwaysOnTop():void{
var myIndex:uint;
var topIndex:uint;
if (((parent) && (visible))){
try {
myIndex = parent.getChildIndex(this);
topIndex = (parent.numChildren - 1);
if (myIndex != topIndex){
parent.setChildIndex(this, topIndex);
};
} catch(e:Error) {
};
};
}
public function clear():void{
gotoAndStop("idle");
}
private function movieConnectedHandler(_arg1:APIEvent):void{
if (_arg1.success){
if (((((((API.isPublishedHost()) && (API.IsCompatible()))) && (!(API.hasUserSession())))) && (!(API.debugMode)))){
gotoAndStop("no_login");
_popDelay.start();
visible = true;
} else {
if (showConnectingPopup){
gotoAndStop("connected");
};
};
} else {
gotoAndStop("no_connect");
_popDelay.start();
visible = true;
};
}
private function renderHandler(_arg1:Event):void{
removeEventListener(Event.RENDER, renderHandler);
clear();
connect();
}
public function set useErrorPopup(_arg1:Boolean):void{
_useErrorPopup = _arg1;
API.addEventListener(APIEvent.API_CONNECTED, movieConnectedHandler);
if (_useErrorPopup){
API.addEventListener(APIEvent.NEW_VERSION_AVAILABLE, newVersionAvailableHandler);
API.addEventListener(APIEvent.HOST_BLOCKED, hostBlockedHandler);
} else {
API.removeEventListener(APIEvent.NEW_VERSION_AVAILABLE, newVersionAvailableHandler);
API.removeEventListener(APIEvent.HOST_BLOCKED, hostBlockedHandler);
};
}
private function centerOnStage():void{
if (stage){
x = (stage.stageWidth / 2);
y = (stage.stageHeight / 2);
};
}
public function set movieId(_arg1:String):void{
_movieId = _arg1;
}
public function get encryptionKey():String{
return (_encryptionKey);
}
private function initButtons():void{
if (viewLatestButton){
viewLatestButton.addEventListener(MouseEvent.CLICK, officialVersionClickHandler);
};
if (viewAuthorizedButton){
viewAuthorizedButton.addEventListener(MouseEvent.CLICK, officialVersionClickHandler);
};
if (closeButton){
closeButton.addEventListener(MouseEvent.CLICK, closeButtonClickHandler);
};
}
public function connect():void{
API.setVersion(_movieVersion);
API.connect(root.loaderInfo, _movieId, _encryptionKey);
visible = true;
if (showConnectingPopup){
gotoAndStop("connecting");
};
}
public function get useErrorPopup():Boolean{
return (_useErrorPopup);
}
private function errorTimerHandler(_arg1:TimerEvent):void{
if (errorDialog){
errorDialog.gotoAndPlay("closeme");
} else {
clear();
};
}
function frame7(){
initButtons();
}
public function get movieId():String{
return (_movieId);
}
public function get useMedalPopup():Boolean{
return (!((_medalPopup == null)));
}
function frame8(){
initButtons();
}
function frame1(){
stop();
}
}
}//package com.newgrounds.components
Section 12
//FlashAd (com.newgrounds.components.FlashAd)
package com.newgrounds.components {
import flash.events.*;
import flash.display.*;
import com.newgrounds.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class FlashAd extends Sprite {
private var _adURLLoader:URLLoader;
private var _ad:Loader;
private var _adRect:Sprite;
private var _mask:Shape;
private var _showBackground:Boolean;
public var background:MovieClip;
private static const REMOVED_FROM_STAGE:String = "removedFromStage";
private static const DEBUG_AD_URL:String = "http://www.ngads.com/adtest.php";
private static var _adResetTime:uint = 0;
private static var _adURL:URLRequest;
public function FlashAd(_arg1:Boolean=true){
if (((!((parent == null))) && ((getQualifiedClassName(parent) == "fl.livepreview::LivePreviewParent")))){
return;
};
_adRect = new Sprite();
_adRect.graphics.beginFill(0);
_adRect.graphics.moveTo(0, 0);
_adRect.graphics.lineTo(300, 0);
_adRect.graphics.lineTo(300, 250);
_adRect.graphics.lineTo(0, 250);
_adRect.graphics.lineTo(0, 0);
_adRect.graphics.endFill();
_mask = new Shape();
_mask.graphics.beginFill(0);
_mask.graphics.moveTo(0, 0);
_mask.graphics.lineTo(300, 0);
_mask.graphics.lineTo(300, 250);
_mask.graphics.lineTo(0, 250);
_mask.graphics.lineTo(0, 0);
_mask.graphics.endFill();
addChild(_adRect);
_adRect.addChild(_mask);
_adRect.visible = false;
x = Math.round(x);
y = Math.round(y);
scaleX = 1;
scaleY = 1;
if (background){
if (background.ngLinkButton){
background.ngLinkButton.addEventListener(MouseEvent.CLICK, linkClickHandler);
};
if (background.loadingClip){
background.loadingClip.visible = false;
};
};
if (API.isFlashVersion(9, 0, 28)){
addEventListener(REMOVED_FROM_STAGE, onRemovedFromStage);
};
if (API.adsApproved){
loadAdFeed(API.adFeedURL);
} else {
API.addEventListener(APIEvent.ADS_APPROVED, onAdsApproved, false, 0, true);
};
this.showBackground = _arg1;
}
private function onAdFeedLoaded(_arg1:Event):void{
var _local2:URLLoader = URLLoader(_arg1.target);
if (((_local2.data) && (!((_local2.data == ""))))){
loadAd((_local2.data as String));
} else {
dispatchEvent(new APIEvent(APIEvent.AD_ATTACHED, false, new APIError("FLASH_ADS_NOT_APPROVED", "Unable to render ad")));
if (((background) && (background.loadingClip))){
background.loadingClip.visible = false;
};
};
}
private function onAdFeedError(_arg1:Event):void{
trace("[NewgroundsAPI] :: Unable to load ad feed!");
if (((background) && (background.loadingClip))){
background.loadingClip.visible = false;
};
}
private function onAdError(_arg1:Event):void{
dispatchEvent(new APIEvent(APIEvent.AD_ATTACHED, false, new APIError("FLASH_ADS_NOT_APPROVED", "Unable to render ad")));
removeAd();
}
private function onAdLoaded(_arg1:Event):void{
_adRect.addChild(_ad);
_ad.mask = _mask;
_adRect.visible = true;
if (background){
if (_showBackground){
_adRect.mask = background.adMask;
};
if (background.loadingClip){
background.loadingClip.visible = false;
};
};
trace("[NewgroundsAPI] :: Ad loaded!");
dispatchEvent(new APIEvent(APIEvent.AD_ATTACHED, true));
}
public function get showBackground():Boolean{
return (_showBackground);
}
public function set showBackground(_arg1:Boolean):void{
_showBackground = _arg1;
if (background){
background.visible = _arg1;
_adRect.mask = (_arg1) ? background.adMask : null;
};
}
private function get hasAdElapsed():Boolean{
if (getTimer() >= _adResetTime){
_adResetTime = (getTimer() + ((1000 * 60) * 5));
return (true);
};
return (false);
}
private function loadAdFeed(_arg1:String):void{
var adFeedURL = _arg1;
_adURLLoader = new URLLoader();
_adURLLoader.addEventListener(Event.COMPLETE, onAdFeedLoaded);
_adURLLoader.addEventListener(IOErrorEvent.IO_ERROR, onAdError);
_adURLLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onAdError);
if (!adFeedURL){
trace("[Newgrounds API] :: Invalid feed URL!");
return;
};
if (hasAdElapsed){
if (adFeedURL.indexOf("?") > -1){
_adURL = new URLRequest(((adFeedURL + "&random=") + Math.random()));
} else {
_adURL = new URLRequest(((adFeedURL + "?random=") + Math.random()));
};
};
try {
_adURLLoader.load(_adURL);
} catch(e:Error) {
onAdError(null);
};
if (((background) && (background.loadingClip))){
background.loadingClip.visible = true;
};
}
private function onAdsApproved(_arg1:APIEvent):void{
API.removeEventListener(APIEvent.ADS_APPROVED, onAdsApproved, false);
if (_arg1.success){
loadAdFeed(API.adFeedURL);
} else {
trace("[NewgroundsAPI] :: No ad feed URL supplied to Newgrounds API ad!");
};
}
private function loadAd(_arg1:String):void{
if (_ad){
removeAd();
};
_ad = new Loader();
_ad.contentLoaderInfo.addEventListener(Event.COMPLETE, onAdLoaded);
_ad.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onAdError);
_ad.load(new URLRequest(_arg1), new LoaderContext(false, new ApplicationDomain(null)));
if (((background) && (background.loadingClip))){
background.loadingClip.visible = true;
};
}
public function removeAd():void{
removeEventListener(REMOVED_FROM_STAGE, onRemovedFromStage);
if (((background) && (background.loadingClip))){
background.loadingClip.visible = false;
};
if (_adURLLoader){
try {
_adURLLoader.close();
} catch(e:Error) {
};
};
if (_adRect){
_adRect.visible = false;
};
if (_ad){
trace("[NewgroundsAPI] :: Ad removed");
try {
_ad.close();
} catch(e:Error) {
};
try {
Object(_ad).unloadAndStop(true);
} catch(e:Error) {
_ad.unload();
};
if (_ad.parent){
_ad.parent.removeChild(_ad);
};
};
_ad = null;
}
private function onRemovedFromStage(_arg1:Event):void{
removeAd();
}
private function linkClickHandler(_arg1:MouseEvent):void{
API.loadNewgrounds();
}
}
}//package com.newgrounds.components
Section 13
//MedalPopup (com.newgrounds.components.MedalPopup)
package com.newgrounds.components {
import flash.events.*;
import flash.display.*;
import com.newgrounds.*;
import flash.utils.*;
import flash.text.*;
public class MedalPopup extends MovieClip {
public var medalValueText:TextField;
public var medalContainer:Sprite;
private var _popDelay:Timer;
private var _initialized:Boolean;
private var _medalIcon:Bitmap;
public var medalNameText:TextField;
private var _medal:Medal;
private var _medalQueue:Array;
public function MedalPopup(){
_medalQueue = [];
_popDelay = new Timer(3000, 1);
super();
addFrameScript(0, frame1, 9, frame10, 18, frame19);
if (((!((parent == null))) && ((getQualifiedClassName(parent) == "fl.livepreview::LivePreviewParent")))){
return;
};
visible = false;
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
stop();
API.addEventListener(APIEvent.MEDAL_UNLOCKED, onMedalUnlocked, false, 0, true);
_popDelay.addEventListener(TimerEvent.TIMER, timerHandler);
}
private function timerHandler(_arg1:TimerEvent):void{
if (((_medalIcon) && (_medalIcon.parent))){
_medalIcon.parent.removeChild(_medalIcon);
_medalIcon = null;
};
gotoAndPlay("medal_hide");
_popDelay.stop();
}
private function showMedalInfo():void{
if (!_medal){
return;
};
if (medalContainer){
_medalIcon = _medal.createIconBitmap();
medalContainer.addChild(_medalIcon);
};
if (medalNameText){
medalNameText.text = _medal.name;
};
if (medalValueText){
medalValueText.text = (_medal.value.toString() + "pts");
};
_popDelay.start();
stop();
}
function frame10(){
showMedalInfo();
stop();
}
public function get popupTime():Number{
return ((_popDelay.delay / 1000));
}
private function onMedalUnlocked(_arg1:APIEvent):void{
if (((((_arg1.success) && (_arg1.data))) && ((_arg1.data is Medal)))){
_medalQueue.push(Medal(_arg1.data));
};
}
private function enterFrameHandler(_arg1:Event):void{
var myIndex:uint;
var topIndex:uint;
var event = _arg1;
if (((_medalQueue.length) && (!(visible)))){
_medal = _medalQueue.pop();
_popDelay.start();
gotoAndPlay("medal_show");
visible = true;
};
if (((visible) && (parent))){
try {
myIndex = parent.getChildIndex(this);
topIndex = (parent.numChildren - 1);
if (myIndex != topIndex){
parent.setChildIndex(this, topIndex);
};
} catch(error:Error) {
};
};
}
function frame1(){
stop();
}
function frame19(){
stop();
visible = false;
}
public function set popupTime(_arg1:Number):void{
if (isNaN(_arg1)){
_arg1 = 3;
};
_popDelay.delay = (_arg1 * 1000);
}
}
}//package com.newgrounds.components
Section 14
//API (com.newgrounds.API)
package com.newgrounds {
import flash.events.*;
import flash.display.*;
import com.newgrounds.components.*;
import flash.utils.*;
import com.adobe.serialization.json.*;
import flash.net.*;
import com.adobe.crypto.*;
import com.adobe.images.*;
import flash.system.*;
public class API {
private static const COMMANDS_WIKI_URL:String = "http://www.newgrounds.com/wiki/flashapi/commands/";
private static const AD_TERMS_URL:String = "http://www.newgrounds.com/wiki/flashads/terms/";
private static const GATEWAY_URL:String = "http://www.ngads.com/gateway_v2.php";
public static const VERSION:String = "2.3";
private static var connected:Boolean;
private static var user_id:uint;
private static var _preloadComplete:Boolean = false;
private static var user_email:String;
private static var _movieId:String;
private static var _saveFileId:uint;
private static var _isMetadataLoaded:Boolean = false;
private static var publisher_id:uint;
private static var _imageFilePath:String;
private static var _saveFilePath:String;
private static var ad_url:String;
private static var _debug:Boolean = true;
private static var _saveGroups:Array = [];
private static var do_echo:Boolean = false;
private static var session_id:String;
public static var errors:Dictionary = APIError.init_codes();
private static var timeoutTimer:Timer = new Timer(8000, 1);
private static var _medals:Array;
private static var user_name:String;
private static var period_aliases:Object = {t:{name:"Today", alias:"TODAY"}, p:{name:"Yesterday", alias:"YESTERDAY"}, w:{name:"This Week", alias:"THIS_WEEK"}, m:{name:"This Month", alias:"THIS_MONTH"}, y:{name:"This Year", alias:"THIS_YEAR"}, a:{name:"All-Time", alias:"ALL_TIME"}};
private static var _host:String;
private static var _connected:Boolean = false;
private static var _userpageFormat:String;
private static var _scoreboards:Array = new Array();
private static var _eventDispatcher:EventDispatcher = new EventDispatcher();
private static var compressor:BaseN = new BaseN(compression_radix);
private static var score_page_counts:Object = new Object();
private static var _adsApproved:Boolean = false;
private static var version:String;
public static var periods:Object = getPeriodAliases();
private static var _encryptionKey:String;
private static var root:DisplayObject;
private static var compression_radix:String = "/g8236klvBQ#&|;Zb*7CEA59%s`Oue1wziFp$rDVY@TKxUPWytSaGHJ>dmoMR^<0~4qNLhc(I+fjn)X";
private static var _preloadAssets:Array = [];
private static var sharedObjects:Dictionary = new Dictionary();
private static var _trackerId:uint;
private static var _saveFile:SaveFile;
private static var userpage_format:String;
private static var _saveGroupId:uint;
public static function loadUserPage(_arg1:uint=0, _arg2:String=null):Boolean{
var _local3:String;
if ((((_arg1 == 0)) && ((_arg2 == null)))){
if (hasUserSession()){
_arg1 = user_id;
_arg2 = user_name;
} else {
return (false);
};
};
if (publisher_id == 1){
_local3 = (("http://" + _arg2.toLowerCase()) + ".newgrounds.com");
navigateToURL(new URLRequest(_local3), "_blank");
return (true);
};
if (userpage_format){
_local3 = userpage_format;
_local3 = _local3.split(":user_id:").join(_arg1.toString());
_local3 = _local3.split(":user_name:").join(escape(_arg2));
navigateToURL(new URLRequest(_local3), "_blank");
return (true);
};
return (false);
}
public static function getPeriodAlias(_arg1:String):String{
var _local2:String;
for (_local2 in period_aliases) {
if (_local2 == _arg1){
return (period_aliases[_local2].alias);
};
};
return (null);
}
private static function onCommandError(_arg1:Event):void{
var _local2:SmartURLLoader = SmartURLLoader(_arg1.target);
var _local3:uint;
while (_local3 < _preloadAssets.length) {
if (_preloadAssets[_local3] == _local2){
_preloadAssets.splice(_local3, 1);
break;
};
_local3++;
};
}
private static function sendWarning(_arg1:String, _arg2:String=null):void{
if (_arg2){
_arg1 = (_arg1 + ((("\n[NewgroundsAPI WARNING] :: \tSee " + COMMANDS_WIKI_URL) + _arg2.toLowerCase()) + " for additional information."));
};
trace(("[NewgroundsAPI WARNING] :: " + _arg1));
}
public static function unlockMedal(_arg1:String):void{
var _local3:Object;
var _local4:Object;
if (((!(_arg1)) || ((_arg1 == "")))){
sendError({command_id:getCommandID("unlockMedal")}, new APIError("MISSING_PARAM", "missing required medal name"));
return;
};
var _local2:Medal = getMedalByName(_arg1);
if (!_local2){
sendMessage(("No medal with name: " + _arg1));
return;
};
if (((hasUserSession()) || (debugMode))){
sendMessage((("Attempting to unlock '" + _local2.name) + "'"));
if (_local2.unlocked){
sendWarning((("Medal '" + _local2.name) + "' is already unlocked!"));
return;
};
_local3 = new Object();
_local3.medal_id = _local2.id;
sendSecureCommand("unlockMedal", _local3);
} else {
sendMessage(("Locally unlocking " + _local2.name));
if (_local2.unlocked){
sendWarning((("Medal '" + _local2.name) + "' is already unlocked!"));
return;
};
_local2.unlocked = true;
_local4 = loadLocal("medals_unlocked");
if (!_local4){
_local4 = new Object();
};
_local4[_local2.id.toString()] = true;
saveLocal("medals_unlocked", _local4);
callListener(APIEvent.MEDAL_UNLOCKED, true, _local2);
};
}
public static function setVersion(_arg1:String):void{
if (((_arg1) && (!((_arg1 == ""))))){
version = _arg1;
};
}
public static function isFlashVersion(_arg1:uint, _arg2:uint=0, _arg3:uint=0, _arg4:uint=0):Boolean{
var _local6:Array = Capabilities.version.split(" ")[1].split(",");
var _local7:Array = arguments;
var _local8:uint;
while (_local8 < _local7.length) {
_local6[_local8] = uint(_local6[_local8]);
_local8++;
};
_local8 = 0;
while (_local8 < _local7.length) {
if (_local6[_local8] > _local7[_local8]){
return (true);
};
if (_local6[_local8] < _local7[_local8]){
return (false);
};
_local8++;
};
return (true);
}
public static function getUserID():uint{
return (user_id);
}
private static function getHost():String{
return (_host);
}
public static function hasUserEmail():Boolean{
return (((!((user_email == null))) && (!((user_email == "")))));
}
private static function uncompressHex(_arg1:String):String{
var _local4:uint;
var _local6:String;
var _local7:uint;
var _local8:String;
var _local2:uint = uint(_arg1.charAt(0));
var _local3 = "";
var _local5:uint = 1;
while (_local5 < _arg1.length) {
_local6 = _arg1.substr(_local5, 4);
_local7 = uint(compressor.decode(_local6));
_local8 = _local7.toString(16);
if ((_local5 + 4) < _arg1.length){
_local4 = 6;
} else {
_local4 = _local2;
};
while (_local8.length < _local4) {
_local8 = ("0" + _local8);
};
_local3 = (_local3 + _local8);
_local5 = (_local5 + 4);
};
return (_local3);
}
public static function getMedalByName(_arg1:String):Medal{
var _local2:Medal;
for each (_local2 in _medals) {
if (_local2.name == _arg1){
return (_local2);
};
};
return (null);
}
private static function callListener(_arg1:String, _arg2:Boolean=true, _arg3=undefined):void{
dispatchEvent(new APIEvent(_arg1, _arg2, _arg3));
}
public static function loadLocal(_arg1:String):Object{
var sharedObj:SharedObject;
var save_id = _arg1;
try {
if (!sharedObjects[save_id]){
sharedObjects[save_id] = SharedObject.getLocal(((("ng_ap_secure_" + _trackerId) + "_") + save_id));
};
sharedObj = sharedObjects[save_id];
if (((((sharedObj) && (sharedObj.data))) && (sharedObj.data[save_id]))){
return (decodeData(sharedObj.data[save_id]));
} else {
return (null);
};
} catch(e:Error) {
sendWarning(("loadLocal ERROR: " + e));
};
return (null);
}
private static function populateScoreBoards(_arg1:Array):void{
_scoreboards = [];
var _local2:uint;
while (_local2 < _arg1.length) {
_scoreboards.push(new ScoreBoard(_arg1[_local2].id, _arg1[_local2].name, ""));
_local2++;
};
}
public static function set debugMode(_arg1:Boolean):void{
_debug = _arg1;
}
public static function createAd():FlashAd{
sendMessage("You may see a security sandbox violation. This is normal!");
return (new FlashAd());
}
private static function populateSaveGroups(_arg1:Array):void{
var _local3:SaveGroup;
_saveGroups = [];
var _local2:uint;
while (_local2 < _arg1.length) {
_local3 = SaveGroup.createFromObject(_arg1[_local2]);
_saveGroups.push(_local3);
_local2++;
};
}
public static function getSaveGroupById(_arg1:uint):SaveGroup{
if (((!(_saveGroups)) || ((_saveGroups.length < 1)))){
sendWarning("No save groups found");
return (null);
};
var _local2:uint;
while (_local2 < _saveGroups.length) {
if (_saveGroups[_local2].id == _arg1){
return (_saveGroups[_local2]);
};
_local2++;
};
return (null);
}
private static function dispatchEvent(_arg1:Event):void{
_eventDispatcher.dispatchEvent(_arg1);
echo(("Fired Event: " + _arg1.type));
}
public static function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
_eventDispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
public static function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:uint=0, _arg5:Boolean=false):void{
_eventDispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public static function get adFeedURL():String{
return (ad_url);
}
public static function setUserEmail(_arg1:String):void{
user_email = _arg1;
}
public static function hasUserSession():Boolean{
return (((((!((session_id == null))) && (!((session_id == ""))))) && (!((publisher_id == 0)))));
}
private static function echo(_arg1:String):void{
if (do_echo){
trace(_arg1);
};
}
public static function getOfficialURL():String{
var _local1:String = ((((((GATEWAY_URL + "?tracker_id=") + _movieId) + "&command_id=") + getCommandID("loadOfficalVersion")) + "&seed=") + Math.random());
if (debugMode){
_local1 = (_local1 + "&debug=1");
};
return (_local1);
}
public static function executeSaveQuery(_arg1:SaveGroupQuery):void{
sendCommand("lookupSaveFiles", {publisher_id:publisher_id, group_id:_arg1.groupId, query:JSON.encode(_arg1.toObject())}, false, null, _arg1);
trace(JSON.encode(_arg1.toObject()));
}
public static function getScoreBoardById(_arg1:uint):ScoreBoard{
var _local2:ScoreBoard;
for each (_local2 in _scoreboards) {
if (_local2.id == _arg1){
return (_local2);
};
};
return (null);
}
private static function getPeriodAliases():Object{
var _local2:String;
var _local1:Object = new Object();
for (_local2 in period_aliases) {
_local1[period_aliases[_local2].alias] = _local2;
};
return (_local1);
}
private static function compressHex(_arg1:String):String{
var _local2:uint = (_arg1.length % 6);
var _local3 = "";
var _local4:uint;
while (_local4 < _arg1.length) {
_local3 = (_local3 + compressor.encode(uint(("0x" + _arg1.substr(_local4, 6))), 4));
_local4 = (_local4 + 6);
};
return ((_local2.toString() + _local3));
}
public static function get preloadComplete():Boolean{
return (_preloadComplete);
}
private static function assertConnected():Boolean{
if (!_connected){
return (false);
};
return (true);
}
public static function sendSecureCommand(_arg1:String, _arg2:Object, _arg3:Object=null, _arg4:Object=null, _arg5=null):void{
if (((((!(debugMode)) && (!(hasUserSession())))) && (!(hasUserEmail())))){
sendError({command_id:getCommandID(_arg1)}, new APIError("IDENTIFICATION_REQUIRED", (("You must be logged in or provide an e-mail address ( using NewgroundsAPI.setUserEmail(\"name@domain.com\"); ) to use " + _arg1) + "().")));
return;
};
if (!_arg1){
fatalError("Missing command", "sendSecureCommand");
};
if (!_arg2){
fatalError("Missing secure_params", "sendSecureCommand");
};
if (!_arg3){
_arg3 = new Object();
};
var _local6 = "";
var _local7:uint;
while (_local7 < 16) {
_local6 = (_local6 + compression_radix.charAt(Math.floor((Math.random() * compression_radix.length))));
_local7++;
};
if (((debugMode) && (!(session_id)))){
_arg2.session_id = "";
} else {
_arg2.session_id = session_id;
};
_arg2.as_version = 3;
_arg2.user_email = user_email;
_arg2.publisher_id = publisher_id;
_arg2.seed = _local6;
_arg2.command_id = getCommandID(_arg1);
var _local8:String = MD5.hash(_local6);
var _local9:String = RC4.encrypt(JSON.encode(_arg2), _encryptionKey);
var _local10:String = (_local8 + _local9);
_arg3.secure = compressHex(_local10);
sendCommand("securePacket", _arg3, false, _arg4, _arg5);
}
private static function sendError(_arg1:Object, _arg2:APIError):void{
trace(((((("[NewgroundsAPI ERROR] :: " + getCommandName(_arg1.command_id)) + "() - ") + _arg2.name) + ":\n\t\t\t\t") + _arg2.message));
}
public static function getUserName():String{
return (user_name);
}
private static function getCommandName(_arg1:String):String{
return (_arg1);
}
public static function sendMessage(_arg1:String, _arg2:Boolean=false):void{
var _local3:String = ("[NewgroundsAPI] :: " + _arg1);
trace(_local3);
}
public static function newSaveFile(_arg1:String):SaveFile{
var _local2:SaveGroup = getSaveGroupByName(_arg1);
if (_local2){
return (new SaveFile(_local2));
};
sendError({command_id:"newSaveFile"}, new APIError("INVALID_SAVE_GROUP", (("'" + _local2) + "' is not a valid save group.")));
return (null);
}
public static function get medals():Array{
return ((_medals) ? _medals.concat() : []);
}
public static function connectionTimeOut(_arg1:Event=null):void{
dispatchEvent(new APIEvent(APIEvent.API_CONNECTED, false, new APIError("CONNECTION_FAILED", "Connection to NewgroundsAPI gateway timed out.")));
}
private static function fatalError(_arg1:String, _arg2:String):void{
if (_arg2){
_arg1 = (_arg1 + ((("\n\tSee " + COMMANDS_WIKI_URL) + _arg2.toLowerCase()) + " for additional information."));
};
throw (new Error(("***ERROR*** class=API\n\n" + _arg1)));
}
public static function getScoreBoardByName(_arg1:String):ScoreBoard{
var _local2:ScoreBoard;
for each (_local2 in _scoreboards) {
if (_local2.name == _arg1){
return (_local2);
};
};
return (null);
}
private static function sendNotice(_arg1:String, _arg2:String=null):void{
if (_arg2){
_arg1 = (_arg1 + ((("\n[NewgroundsAPI NOTICE] :: \tSee " + COMMANDS_WIKI_URL) + _arg2.toLowerCase()) + " for additional information."));
};
trace(("[NewgroundsAPI NOTICE] :: " + _arg1));
}
public static function get debugMode():Boolean{
return (_debug);
}
public static function loadCustomLink(_arg1:String):void{
sendCommand("loadCustomLink", {host:getHost(), link:_arg1}, true);
}
public static function loadMySite():void{
sendCommand("loadMySite", {host:getHost()}, true);
}
public static function getTrackerID():uint{
return (_trackerId);
}
public static function get adsApproved():Boolean{
return (_adsApproved);
}
private static function sendCommand(_arg1:String, _arg2:Object, _arg3:Boolean=false, _arg4:Object=null, _arg5=null):void{
var _local7:String;
var _local8:String;
var _local9:String;
if (((!(connected)) && (!((_arg1 == "connectMovie"))))){
_local7 = (("NewgroundsAPI." + _arg1) + "() - NewgroundsAPI.connectMovie() must be called before this command can be called\n");
fatalError(_local7, "connectMovie");
};
var _local6:SmartURLLoader = new SmartURLLoader();
_local6.addVariable("command_id", getCommandID(_arg1));
_local6.addVariable("tracker_id", _movieId);
if (debugMode){
_local6.addVariable("debug", 1);
};
if (_arg2){
for (_local8 in _arg2) {
_local6.addVariable(_local8, _arg2[_local8]);
};
};
if (_arg4){
for (_local9 in _arg4) {
_local6.addFile(_local9, _arg4[_local9], _local9);
};
};
if (_arg3){
_local6.method = URLRequestMethod.GET;
} else {
_local6.method = URLRequestMethod.POST;
};
_local6.preventCache = true;
if (_arg3){
_local6.openBrowser = true;
_local6.method = URLRequestMethod.GET;
} else {
_local6.addEventListener(Event.COMPLETE, onCommandComplete);
_local6.addEventListener(IOErrorEvent.IO_ERROR, onCommandError);
_local6.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onCommandError);
_local6.method = URLRequestMethod.POST;
};
_local6.owner = _arg5;
_local6.load(GATEWAY_URL);
}
public static function checkFilePrivledges(_arg1:SaveFile):void{
sendCommand("checkFilePrivs", {group:_arg1.groupId, filename:_arg1.name, user_id:(user_id) ? user_id : 0, publisher_id:publisher_id});
}
public static function isPublishedHost():Boolean{
return (((!((getHost() == "localhost"))) && ((getHost().indexOf("file://") == -1))));
}
public static function loadOfficialVersion():void{
navigateToURL(new URLRequest(getOfficialURL()));
}
public static function createSaveQuery(_arg1:String):SaveGroupQuery{
var _local2:SaveGroup = getSaveGroupByName(_arg1);
if (_local2){
return (_local2.createQuery());
};
return (null);
}
public static function saveFile(_arg1:SaveFile, _arg2:Boolean=false):void{
var _local3:Object = _arg1.toObject();
_local3.user_name = user_name;
_local3.overwrite = (_arg2) ? 1 : 0;
var _local4:ByteArray = new ByteArray();
if ((_arg1.contents is ByteArray)){
_local4.writeByte(0);
_local4.writeBytes(_arg1.contents);
} else {
_local4.writeByte(1);
_local4.writeObject(_arg1.contents);
};
_local4.compress();
var _local5:Object = new Object();
_local5.file = _local4;
if (_arg1.thumbnail){
_local5.thumbnail = PNGEncoder.encode(_arg1.thumbnail);
};
sendSecureCommand("saveFile", _local3, null, _local5, _arg1);
}
public static function getMedalById(_arg1:uint):Medal{
var _local2:Medal;
for each (_local2 in _medals) {
if (_local2.id == _arg1){
return (_local2);
};
};
return (null);
}
public static function loadSaveFile(_arg1:Number, _arg2:Boolean=true){
var _local3:Object = {publisher_id:publisher_id, save_id:_arg1, get_contents:_arg2};
sendCommand("loadSaveFile", _local3);
}
public static function loadNewgrounds():void{
sendCommand("loadNewgrounds", {host:getHost()}, true);
}
public static function rateSaveFile(_arg1:SaveFile, _arg2:SaveRating, _arg3:Number):void{
sendSecureCommand("rateSaveFile", {group:_arg1.groupId, save_id:_arg1.id, rating_id:_arg2.id, vote:_arg3, user_id:user_id}, null, null, _arg1);
}
public static function IsCompatible():Boolean{
return (!((publisher_id == 0)));
}
public static function loadScores(_arg1:ScoreBoard, _arg2:String=null):void{
var _local3 = "loadScores";
if (!_arg1.id){
sendError({command_id:getCommandID(_local3)}, new APIError("MISSING_PARAM", "missing required ScoreBoard instance"));
return;
};
if (!hasUserSession()){
callListener(APIEvent.SCORES_LOADED, false, new APIError("SITE_ID_REQUIRED", (("Host '" + getHost()) + "' does not have high scores enabled")));
return;
};
var _local4:Object = {};
_local4.publisher_id = publisher_id;
_local4.period = _arg1.period;
_local4.board = _arg1.id;
_local4.num_results = _arg1.num_results;
_local4.page = _arg1.page;
if (((!(_arg2)) || ((_arg2 == "")))){
_local4.tag = _arg1.tag;
} else {
_local4.tag = _arg2;
};
sendCommand(_local3, _local4);
}
public static function logCustomEvent(_arg1:String):void{
sendCommand("logCustomEvent", {host:getHost(), event:_arg1});
}
public static function decodeData(_arg1:String){
return (JSON.decode(RC4.decrypt(uncompressHex(_arg1), _encryptionKey)));
}
public static function postScore(_arg1:String, _arg2:uint, _arg3:String=""):void{
if (((!(_arg1)) || ((_arg1 == "")))){
sendError({command_id:getCommandID("postScore")}, new APIError("MISSING_PARAM", "missing required parameter(s)"));
return;
};
if (_arg3 == null){
_arg3 = "";
};
sendSecureCommand("postScore", {user_name:user_name, board:_arg1, value:_arg2, publisher_id:publisher_id, tag:_arg3});
}
private static function onCommandComplete(_arg1:Event):void{
var _local4:Object;
var _local5:APIError;
var _local2:SmartURLLoader = SmartURLLoader(_arg1.target);
echo((("INPUT: \n" + _local2.response) + "\n"));
var _local3:uint;
while (_local3 < _preloadAssets.length) {
if (_preloadAssets[_local3] == _local2){
_preloadAssets.splice(_local3, 1);
break;
};
_local3++;
};
if (_local2.response){
_local4 = JSON.decode(_local2.response);
} else {
_local4 = {success:false};
};
if (!_local4.success){
trace(("Error: " + _local4));
_local5 = new APIError(_local4.error_code, _local4.error_msg);
sendError(_local4, _local5);
} else {
_local4.owner = _local2.owner;
doEvent(_local4);
};
}
public static function encodeData(_arg1:Object):String{
return (compressHex(RC4.encrypt(JSON.encode(_arg1), _encryptionKey)));
}
private static function populateMedals(_arg1:Array):void{
var _local2:uint;
var _local3:Object;
if (_medals === null){
_medals = new Array();
_local2 = 0;
while (_local2 < _arg1.length) {
_local3 = _arg1[_local2];
_medals.push(Medal.createFromObject(_local3));
_local2++;
};
};
trace("[NewgroundsAPI] :: Medals loaded!");
}
private static function doEvent(_arg1:Object):void{
var _local2:String;
var _local3:Object;
var _local4:String;
var _local5:Boolean;
var _local6:ScoreBoard;
var _local7:SaveFile;
var _local8:Array;
var _local9:*;
var _local10:String;
var _local11:Medal;
var _local12:SaveGroup;
var _local13:uint;
var _local14:Object;
var _local15:uint;
switch (getCommandName(_arg1.command_id)){
case "connectMovie":
timeoutTimer.stop();
sendMessage("You have successfully connected to the Newgrounds API Gateway");
sendMessage((("Movie identified as \"" + _arg1.movie_name) + "\""));
callListener(APIEvent.API_CONNECTED, _arg1.success, {title:_arg1.movie_name});
_local5 = false;
if (_arg1.ad_status === -1){
_local2 = "This movie was not approved to run Flash Ads.";
sendWarning(_local2);
sendWarning((("visit " + AD_TERMS_URL) + " to view our approval guidelines"));
if (!_arg1.ad_url){
callListener(APIEvent.ADS_APPROVED, false, new APIError("FLASH_ADS_NOT_APPROVED", _local2));
} else {
_local5 = true;
};
} else {
if (_arg1.ad_status === 0){
_local2 = "Flash Ads are currently awaiting approval.";
sendNotice(_local2);
if (!_arg1.ad_url){
callListener(APIEvent.ADS_APPROVED, false, new APIError("FLASH_ADS_NOT_APPROVED", _local2));
} else {
_local5 = true;
};
};
};
if (_arg1.ad_url){
ad_url = unescape(_arg1.ad_url);
if (!_local5){
sendMessage("This movie has been approved to run Flash Ads!");
};
_adsApproved = true;
callListener(APIEvent.ADS_APPROVED, true);
};
if (_arg1.deny_host){
_local2 = (getHost() + " does not have permission to run this movie!");
sendWarning(_local2);
sendWarning(("\tUpdate your API configuration to unblock " + getHost()));
callListener(APIEvent.HOST_BLOCKED, true, {real_url:unescape(_arg1.movie_url), url:getOfficialURL()});
};
if (_arg1.movie_version){
sendWarning("According to your API Configuration, this version is out of date.");
if (version){
sendWarning(("\tThe this movie is version " + version));
};
sendWarning(("\tThe most current version is " + _arg1.movie_version));
callListener(APIEvent.NEW_VERSION_AVAILABLE, true, {version:_arg1.movie_version, real_url:unescape(_arg1.movie_url), url:getOfficialURL()});
};
if (_arg1.request_portal_url){
sendCommand("setPortalID", {portal_url:_host});
};
sendCommand("preloadSettings", {publisher_id:publisher_id, user_id:user_id});
break;
case "preloadSettings":
if (_arg1.medals){
populateMedals(_arg1.medals);
if (((!(hasUserSession())) && (!(debugMode)))){
echo("Checking for SharedObject Medals...");
_local9 = loadLocal("medals_unlocked");
if (_local9){
for (_local10 in _local9) {
if (_local9[_local10]){
_local11 = getMedalById(uint(_local10));
echo(("Now unlocking " + _local11.name));
_local11.unlocked = true;
};
};
};
};
};
if (_arg1.save_groups){
populateSaveGroups(_arg1.save_groups);
};
if (_arg1.save_file_path){
_saveFilePath = (_arg1.save_file_path + "/");
};
if (_arg1.image_file_path){
_imageFilePath = (_arg1.image_file_path + "/");
};
if (_arg1.score_boards){
populateScoreBoards(_arg1.score_boards);
};
trace("[NewgroundsAPI] :: Metadata loaded!");
callListener(APIEvent.METADATA_LOADED);
if (((_saveFileId) && (_saveGroupId))){
_local12 = getSaveGroupById(_saveGroupId);
if (_local12){
callListener(APIEvent.FILE_REQUESTED, true, {save_id:_saveFileId, group:_local12});
};
};
_preloadComplete = true;
break;
case "logCustomEvent":
if (_arg1.success){
sendMessage((("Event '" + _arg1.event) + "' was logged."));
};
callListener(APIEvent.EVENT_LOGGED, _arg1.success, {event:_arg1.event});
break;
case "postScore":
if (_arg1.success){
_local4 = "User";
if (user_email){
_local4 = user_email;
} else {
if (user_name){
_local4 = user_name;
};
};
_local6 = getScoreBoardById(_arg1.board);
if (_local6){
sendMessage((((((_local4 + " posted ") + _arg1.value) + " to '") + _local6.name) + "'"));
};
_local3 = {score:_arg1.score, value:_arg1.value, username:_local4};
};
callListener(APIEvent.SCORE_POSTED, _arg1.success, _local3);
break;
case "loadScores":
_local3 = new Object();
_local6 = getScoreBoardById(_arg1.board);
if (_local6){
_local6.setScores(_arg1.scores, _arg1.period, _arg1.page, _arg1.num_results);
};
callListener(APIEvent.SCORES_LOADED, _arg1.success, _local6);
break;
case "unlockMedal":
if (_medals){
_local11 = getMedalByName(_arg1.medal_name);
if (_local11.unlocked){
return;
};
_local11.unlocked = true;
callListener(APIEvent.MEDAL_UNLOCKED, _arg1.success, _local11);
};
break;
case "getMedals":
populateMedals(_arg1.medals);
callListener(APIEvent.MEDALS_LOADED, _arg1.success, _local3);
break;
case "loadSaveFile":
_local12 = getSaveGroupById(_arg1.group_id);
_local7 = new SaveFile(_local12);
_local7.id = _arg1.file.save_id;
_local7.name = _arg1.file.filename;
_local7.fileUrl = (_saveFilePath + _arg1.file.file);
_local7.thumbnailUrl = (_imageFilePath + _arg1.file.thumb);
_local7.authorName = _arg1.file.user_name;
_local7.authorId = _arg1.file.user_id;
_local7.description = _arg1.file.description;
if (((_arg1.file.keys) && (_arg1.file.keys.length))){
_local13 = 0;
while (_local13 < _arg1.file.keys.length) {
_local7.setKey(_arg1.file.keys[_local13].id, _arg1.file.keys[_local13].value);
_local13++;
};
};
if (((_arg1.file.ratings) && (_arg1.file.ratings.length))){
_local13 = 0;
while (_local13 < _arg1.file.ratings.length) {
_local7.setRating(_arg1.file.ratings[_local13].id, _arg1.file.ratings[_local13].votes, _arg1.file.ratings[_local13].score);
_local13++;
};
};
if (_arg1.get_contents){
_local7.loadContents();
};
callListener(APIEvent.FILE_INITIALIZED, _arg1.success, _local7);
break;
case "lookupSaveFiles":
_local8 = [];
_local13 = 0;
while (_local13 < _arg1.files.length) {
_local14 = _arg1.files[_local13];
_local7 = new SaveFile(getSaveGroupById(_arg1.group_id));
_local7.name = _local14.filename;
_local7.id = _local14.save_id;
_local7.description = _local14.description;
_local7.thumbnailUrl = (_imageFilePath + _local14.thumb);
_local7.fileUrl = (_saveFilePath + _local14.file);
_local7.authorName = _local14.user_name;
_local7.authorId = _local14.user_id;
if (((_local14.keys) && (_local14.keys.length))){
_local15 = 0;
while (_local15 < _local14.keys.length) {
_local7.setKey(_local14.keys[_local15].id, _local14.keys[_local15].value);
_local15++;
};
};
if (((_local14.ratings) && (_local14.ratings.length))){
_local15 = 0;
while (_local15 < _local14.ratings.length) {
_local7.setRating(_local14.ratings[_local15].id, _local14.ratings[_local15].votes, _local14.ratings[_local15].score);
_local15++;
};
};
_local8.push(_local7);
_local13++;
};
_arg1.owner.dispatchEvent(new APIEvent(APIEvent.QUERY_COMPLETE, _arg1.success, _local8));
break;
case "rateSaveFile":
_local7 = _arg1.owner;
if (_arg1.success){
_local7.setRating(_arg1.rating_id, _arg1.votes, _arg1.score);
};
_local7.dispatchEvent(new APIEvent(APIEvent.VOTE_COMPLETE, _arg1.success, _arg1));
break;
case "saveFile":
_local3 = {save_id:_arg1.save_id, filename:_arg1.filename, file_url:_arg1.file_url, thumbnail:_arg1.thumbnail, icon:_arg1.icon};
_arg1.owner.dispatchEvent(new APIEvent(APIEvent.FILE_SAVED, _arg1.success, _local3));
break;
case "checkFilePrivs":
_local3 = {filename:_arg1.filename, folder:_arg1.folder, can_read:_arg1.can_read, can_write:_arg1.can_write};
callListener(APIEvent.FILE_PRIVS_LOADED, _arg1.success, _local3);
break;
};
}
public static function loadMedals():void{
if (_medals){
dispatchEvent(new APIEvent(APIEvent.MEDALS_LOADED, true, medals));
return;
};
var _local1:Object = new Object();
if (hasUserSession()){
_local1.publisher_id = publisher_id;
_local1.user_id = user_id;
};
sendCommand("getMedals", _local1);
}
public static function connect(_arg1:LoaderInfo, _arg2:String, _arg3:String=null):void{
var loaderInfo = _arg1;
var m_id = _arg2;
var encrypt_key = _arg3;
if (!loaderInfo){
fatalError("Null loaderInfo paremeter passed in to connectMovie!", "");
return;
};
try {
if (loaderInfo.loader){
loaderInfo = loaderInfo.loader.loaderInfo;
};
} catch(error:Error) {
};
_host = loaderInfo.url;
if ((((_host.indexOf("http://") > -1)) || ((_host.indexOf("https://") > -1)))){
_host = _host.split("/")[2].toLowerCase();
} else {
_host = "localhost";
};
var flashVars:Object = loaderInfo.parameters;
if (isPublishedHost()){
debugMode = false;
};
if (((!(debugMode)) && (flashVars))){
if (flashVars.NewgroundsAPI_UserName){
user_name = flashVars.NewgroundsAPI_UserName;
};
if (flashVars.NewgroundsAPI_UserID){
user_id = flashVars.NewgroundsAPI_UserID;
};
if (flashVars.NewgroundsAPI_PublisherID){
publisher_id = flashVars.NewgroundsAPI_PublisherID;
} else {
publisher_id = 1;
};
if (flashVars.NewgroundsAPI_UserpageFormat){
_userpageFormat = flashVars.NewgroundsAPI_UserpageFormat;
};
if (flashVars.NewgroundsAPI_SessionID){
session_id = flashVars.NewgroundsAPI_SessionID;
};
if (flashVars.NewgroundsAPI_SaveGroupID){
_saveGroupId = flashVars.NewgroundsAPI_SaveGroupID;
};
if (flashVars.NewgroundsAPI_SaveFileID){
_saveFileId = flashVars.NewgroundsAPI_SaveFileID;
};
} else {
publisher_id = 1;
session_id = "D3bu64p1U53R";
user_id = 10;
user_name = "API-Debugger";
};
if (connected){
return;
};
timeoutTimer.start();
if (!m_id){
fatalError("NewgroundsAPI.connectMovie() - missing required movieId parameter", "connectMovie");
};
_movieId = String(m_id);
_trackerId = uint(_movieId.substring(0, _movieId.indexOf(":")));
_encryptionKey = encrypt_key;
connected = true;
sendCommand("connectMovie", {host:getHost(), movie_version:version});
}
public static function saveLocal(_arg1:String, _arg2:Object, _arg3:uint=0):void{
var sharedObj:SharedObject;
var save_id = _arg1;
var save_data = _arg2;
var size_allocation = _arg3;
try {
if (!sharedObjects[save_id]){
sharedObjects[save_id] = SharedObject.getLocal(((("ng_ap_secure_" + _trackerId) + "_") + save_id));
};
sharedObj = sharedObjects[save_id];
sharedObj.data[save_id] = encodeData(save_data);
sharedObj.flush();
} catch(e:Error) {
sendWarning(("saveLocal ERROR: " + e));
};
}
public static function getPeriodName(_arg1:String):String{
var _local2:String;
for (_local2 in period_aliases) {
if (_local2 == _arg1){
return (period_aliases[_local2].name);
};
};
return (null);
}
public static function getSaveGroupByName(_arg1:String):SaveGroup{
if (((!(_saveGroups)) || ((_saveGroups.length < 1)))){
sendWarning("No save groups found");
return (null);
};
var _local2:uint;
while (_local2 < _saveGroups.length) {
if (_saveGroups[_local2].name == _arg1){
return (_saveGroups[_local2]);
};
_local2++;
};
return (null);
}
private static function getCommandID(_arg1:String):String{
return (_arg1);
}
public static function hasEventListener(_arg1:String):Boolean{
return (_eventDispatcher.hasEventListener(_arg1));
}
public static function isNewgrounds():Boolean{
return ((((publisher_id == 1)) || ((getHost().toLowerCase().indexOf("ungrounded.net") > -1))));
}
public static function isConnected():Boolean{
return (_connected);
}
}
}//package com.newgrounds
Section 15
//APIError (com.newgrounds.APIError)
package com.newgrounds {
import flash.utils.*;
public class APIError {
public var alias:String;
public var message:String;
public var name:String;
public var code:Number;// = 0
private static const always_caps:Array = new Array("API", "URL", "ID");
public static const error_names:Object = init_names();
public static const aliases:Array = new Array("UNKNOWN_ERROR", "INVALID_API_ID", "MISSING_PARAM", "INVALID_STAT_ID", "INVALID_COMMAND_ID", "FLASH_ADS_NOT_APPROVED", "PERMISSION_DENIED", "IDENTIFICATION_REQUIRED", "INVALID_EMAIL_ADDRESS", "BANNED_USER", "SESSION_EXPIRED", "INVALID_SCORE", "INVALID_MEDAL", "INVALID_FOLDER", "FILE_NOT_FOUND", "SITE_ID_REQUIRED", "UPLOAD_IN_PROGRESS", "USER_CANCELLED", "CONFIRM_REQUEST", "CONNECTION_FAILED");
public static const error_codes:Object = init_codes();
public function APIError(_arg1, _arg2:String){
if ((_arg1 is String)){
_arg1 = error_codes[_arg1];
} else {
if (!(_arg1 is uint)){
_arg1 = 0;
};
};
code = _arg1;
message = _arg2;
name = error_names[_arg1];
alias = aliases[_arg1];
}
public function isError():Boolean{
return (true);
}
private static function init_names():Array{
var _local3:Array;
var _local4:uint;
var _local5:String;
var _local1:Array = new Array();
var _local2:uint;
while (_local2 < aliases.length) {
_local3 = aliases[_local2].toLowerCase().split("_");
_local4 = 0;
while (_local4 < _local3.length) {
_local3[_local4] = (_local3[_local4].substr(0, 1).toUpperCase() + _local3[_local4].substr(1, _local3[_local4].length));
for each (_local5 in always_caps) {
if (_local3[_local4].toUpperCase() == _local5){
_local3[_local4] = _local3[_local4].toUpperCase();
};
};
_local4++;
};
_local1[_local2] = _local3.join(" ");
_local2++;
};
return (_local1);
}
public static function init_codes():Dictionary{
var _local1:Dictionary = new Dictionary();
var _local2:uint;
while (_local2 < aliases.length) {
_local1[aliases[_local2]] = _local2;
_local2++;
};
return (_local1);
}
}
}//package com.newgrounds
Section 16
//APIEvent (com.newgrounds.APIEvent)
package com.newgrounds {
import flash.events.*;
public class APIEvent extends Event {
private var _error:APIError;
private var _success:Boolean;
private var _target;
private var _data;
public static const AD_ATTACHED:String = "adAttached";
public static const FILE_PRIVS_LOADED:String = "filePrivsLoaded";
public static const ADS_APPROVED:String = "adsApproved";
public static const MEDAL_UNLOCKED:String = "medalUnlocked";
public static const MEDALS_LOADED:String = "medalsLoaded";
public static const FILE_REQUESTED:String = "fileRequested";
public static const METADATA_LOADED:String = "metadataLoaded";
public static const NEW_VERSION_AVAILABLE:String = "newVersionAvailable";
public static const API_CONNECTED:String = "movieConnected";
public static const EVENT_LOGGED:String = "eventLogged";
public static const FILE_SAVED:String = "fileSaved";
public static const SCORE_POSTED:String = "scorePosted";
public static const VOTE_COMPLETE:String = "voteComplete";
public static const FILE_LOADED:String = "fileLoaded";
public static const QUERY_COMPLETE:String = "queryComplete";
public static const SCORES_LOADED:String = "scoresLoaded";
public static const HOST_BLOCKED:String = "hostBlocked";
public static const FILE_INITIALIZED:String = "fileInitialized";
public function APIEvent(_arg1:String, _arg2:Boolean=true, _arg3=undefined){
super(_arg1);
_data = _arg3;
_success = _arg2;
}
public function get success():Boolean{
return (_success);
}
public function get data(){
return (_data);
}
}
}//package com.newgrounds
Section 17
//BaseN (com.newgrounds.BaseN)
package com.newgrounds {
import flash.utils.*;
public class BaseN {
private var _hashVal:Dictionary;
private var _hashIndex:String;
private var _base:Number;
public function BaseN(_arg1:String=null){
if (_arg1){
_hashIndex = _arg1;
} else {
_hashIndex = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~@#$%^&*()+|;/";
};
_base = _hashIndex.length;
_hashVal = new Dictionary();
var _local2:uint;
while (_local2 < _base) {
_hashVal[_hashIndex.charAt(_local2)] = _local2;
_local2++;
};
}
public function encode(_arg1:Number, _arg2:uint=1):String{
var _local3:String = _arg1.toString();
var _local4 = "";
if (_local3.charAt(0) == "-"){
_local4 = "-";
_local3 = _local3.substring(1);
};
var _local5:Array = _local3.split(".", 2);
_local4 = (_local4 + baseNEncoder(_local5[0], _arg2));
if (_local5.length > 1){
_local4 = (_local4 + ("." + baseNEncoder(_local5[1])));
};
return (_local4);
}
private function baseNDecoder(_arg1:String):uint{
var _local2:uint;
var _local3:uint;
while (_local3 < _arg1.length) {
_local2 = (_local2 * _base);
_local2 = (_local2 + _hashVal[_arg1.charAt(_local3)]);
_local3++;
};
return (_local2);
}
public function decode(_arg1:String):Number{
var _local2 = "";
if (_arg1.charAt(0) == "-"){
_local2 = "-";
_arg1 = _arg1.substring(1);
};
var _local3:Array = _arg1.split(".", 2);
_local2 = (_local2 + baseNDecoder(_local3[0]));
if (_local3.length > 1){
_local2 = (_local2 + ".");
_local2 = (_local2 + baseNDecoder(_local3[1]));
};
return (Number(_local2));
}
private function baseNEncoder(_arg1:uint, _arg2:uint=1):String{
var _local3 = "";
var _local4:uint = _arg1;
while (_local4 != 0) {
_local3 = (_hashIndex.charAt((_local4 % _base)) + _local3);
_local4 = (_local4 / _base);
};
if (_arg2){
while (_local3.length < _arg2) {
_local3 = (_hashIndex.charAt(0) + _local3);
};
};
return (_local3);
}
}
}//package com.newgrounds
Section 18
//Medal (com.newgrounds.Medal)
package com.newgrounds {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class Medal {
private var _unlocked:Boolean;// = false
private var _iconLoader:Loader;
private var _difficultyId:uint;
private var _icon:BitmapData;
private var _value:uint;
private var _iconUrl:URLRequest;
private var _name:String;
private var _id:uint;
private static const DIFFICULT_NAMES:Array = [null, "Easy", "Moderate", "Challenging", "Difficult", "Brutal"];
private static const DEFAULT_ICON:BitmapData = new BitmapData(50, 50, false, 0);
public function Medal(_arg1:uint, _arg2:String, _arg3:uint, _arg4:uint, _arg5:Boolean, _arg6:String){
var id = _arg1;
var name = _arg2;
var value = _arg3;
var difficulty = _arg4;
var unlocked = _arg5;
var iconUrl = _arg6;
_icon = DEFAULT_ICON;
super();
_id = id;
_name = name;
_value = value;
_difficultyId = difficulty;
_unlocked = unlocked;
if (iconUrl){
_iconUrl = new URLRequest(iconUrl);
_iconLoader = new Loader();
_iconLoader.contentLoaderInfo.addEventListener(Event.INIT, onIconLoaderInit);
_iconLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, onIconLoaderError);
_iconLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onIconLoaderError);
_iconLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, onIconLoaderComplete);
try {
_iconLoader.load(_iconUrl, new LoaderContext(true));
} catch(e:Error) {
onIconLoaderError(null);
};
};
}
public function get icon():BitmapData{
return (_icon);
}
public function set unlocked(_arg1:Boolean):void{
_unlocked = _arg1;
}
public function get bytesLoaded():uint{
return ((_iconLoader) ? _iconLoader.contentLoaderInfo.bytesLoaded : 0);
}
public function get name():String{
return (_name);
}
private function onIconLoaderComplete(_arg1:Event):void{
var _local2:Bitmap = (_iconLoader.content as Bitmap);
_icon = _local2.bitmapData;
_iconLoader.unload();
_iconLoader = null;
}
public function get bytesTotal():uint{
return ((_iconLoader) ? _iconLoader.contentLoaderInfo.bytesTotal : 0);
}
public function get id():uint{
return (_id);
}
public function unlock():void{
if (!_unlocked){
API.unlockMedal(_name);
};
}
private function onIconLoaderError(_arg1:IOErrorEvent):void{
trace((((("[NewgroundsAPI WARNING] :: Failed to load medal icon for " + name) + " (") + _iconUrl.url.split("/").pop()) + ")"));
_iconLoader.unload();
_iconLoader = null;
}
private function onIconLoaderInit(_arg1:Event):void{
}
public function get unlocked():Boolean{
return (_unlocked);
}
public function createIconBitmap():Bitmap{
return (new Bitmap(icon));
}
public function toString():String{
return (_name);
}
public function get value():uint{
return (_value);
}
public function get difficultyId():uint{
return (_difficultyId);
}
public function get difficulty():String{
return (DIFFICULT_NAMES[_difficultyId]);
}
public static function createFromObject(_arg1:Object):Medal{
return (new Medal(_arg1.medal_id, _arg1.medal_name, _arg1.medal_value, _arg1.medal_difficulty, _arg1.medal_unlocked, _arg1.medal_icon));
}
}
}//package com.newgrounds
Section 19
//RC4 (com.newgrounds.RC4)
package com.newgrounds {
public class RC4 {
private static var mykey:Array = new Array(0xFF);
private static var sbox:Array = new Array(0xFF);
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);
}
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));
}
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);
}
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 strToChars(_arg1:String):Array{
var _local2:Array = new Array();
var _local3:uint;
while (_local3 < _arg1.length) {
_local2.push(_arg1.charCodeAt(_local3));
_local3++;
};
return (_local2);
}
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 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 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);
}
}
}//package com.newgrounds
Section 20
//SaveFile (com.newgrounds.SaveFile)
package com.newgrounds {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
public class SaveFile extends EventDispatcher {
private var _group:SaveGroup;
private var _status:uint;
private var _fileUrl:String;
private var _ratings:Dictionary;
private var _id:uint;
private var _thumbnailUrl:String;
private var _description:String;
private var _keys:Dictionary;
private var _authorName:String;
private var _filename:String;
private var _thumbnail:BitmapData;
private var _authorId:uint;
private var _contents;
public function SaveFile(_arg1:SaveGroup){
_keys = new Dictionary();
_ratings = new Dictionary();
_group = _arg1;
_description = "";
}
public function get authorId():uint{
return (_authorId);
}
public function get name():String{
return (_filename);
}
public function set authorId(_arg1:uint):void{
_authorId = _arg1;
}
override public function toString():String{
var _local2:Object;
var _local3:Object;
var _local1 = (((((("Save File " + _filename) + " ID: ") + _id) + "\n ") + _description) + "\n");
for each (_local2 in _keys) {
_local1 = (_local1 + ((((" " + _group.getKeyById(_local2.id).name) + ": ") + _local2.val) + "\n"));
};
for each (_local3 in _ratings) {
_local1 = (_local1 + ((((((" " + _group.getRatingById(_local3.id).name) + "\n Score: ") + _local3.score) + " Votes: ") + _local3.votes) + "\n"));
};
return (_local1);
}
public function getRating(_arg1):Object{
var _local2:SaveRating;
if ((_arg1 is String)){
_local2 = _group.getRatingByName(_arg1);
} else {
_local2 = _group.getRatingById(_arg1);
};
if (_local2){
return (_ratings[_local2]);
};
return (null);
}
public function set name(_arg1:String):void{
_filename = _arg1;
}
public function get contents(){
return (_contents);
}
public function get id():uint{
return (_id);
}
public function setKey(_arg1, _arg2):void{
var _local3:SaveKey;
if ((_arg1 is String)){
_local3 = _group.getKeyByName(_arg1);
} else {
_local3 = _group.getKeyById(_arg1);
};
if (_local3){
_keys[_local3] = {id:_local3.id, val:_arg2};
};
}
public function setRating(_arg1, _arg2:Number, _arg3:Number):void{
var _local4:SaveRating;
if ((_arg1 is String)){
_local4 = _group.getRatingByName(_arg1);
} else {
_local4 = _group.getRatingById(_arg1);
};
if (_local4){
_ratings[_local4] = {id:_local4.id, name:_local4.name, votes:_arg2, score:_arg3};
};
}
public function loadContents():void{
var _local1:SmartURLLoader;
if (_fileUrl){
_local1 = new SmartURLLoader();
_local1.responseFormat = URLLoaderDataFormat.BINARY;
_local1.addEventListener(Event.COMPLETE, onContentsLoaded);
_local1.load(_fileUrl);
};
}
public function toObject():Object{
var _local2:Object;
var _local1:Object = {group:groupId, filename:name, description:description, shared:true};
_local1.keys = [];
for each (_local2 in _keys) {
_local1.keys.push({id:_local2.id, value:_local2.val});
};
return (_local1);
}
public function getKey(_arg1){
var _local2:SaveKey;
if ((_arg1 is String)){
_local2 = _group.getKeyByName(_arg1);
} else {
_local2 = _group.getKeyById(_arg1);
};
if (_local2){
return (_keys[_local2]);
};
return (null);
}
public function set fileUrl(_arg1:String):void{
_fileUrl = _arg1;
}
public function get groupName():String{
return (_group.name);
}
public function set contents(_arg1):void{
_contents = _arg1;
}
public function get authorName():String{
return (_authorName);
}
public function set id(_arg1:uint):void{
_id = _arg1;
}
public function loadAuthorPage(){
API.loadUserPage(_authorId, _authorName);
}
public function sendRating(_arg1:String, _arg2:Number):void{
var _local3:SaveRating = _group.getRatingByName(_arg1);
if (!_local3){
trace((("[NewgroundsAPISaveFile] " + _arg1) + " is not a recognized save file"));
return;
};
if ((((_arg2 < _local3.minValue)) || ((_arg2 > _local3.maxValue)))){
trace(((("[NewgroundsAPISaveFile] Vote must be between " + _local3.minValue) + " and ") + _local3.maxValue));
return;
};
_local3.voted = true;
API.rateSaveFile(this, _local3, _arg2);
}
public function set thumbnailUrl(_arg1:String):void{
_thumbnailUrl = _arg1;
}
public function set thumbnail(_arg1:BitmapData):void{
if (_thumbnail){
_thumbnail.dispose();
};
_thumbnail = _arg1.clone();
}
public function get groupType():uint{
return (_group.type);
}
public function get fileUrl():String{
return (_fileUrl);
}
public function get thumbnailUrl():String{
return (_thumbnailUrl);
}
public function get shared():Boolean{
return (true);
}
public function set authorName(_arg1:String):void{
_authorName = _arg1;
}
public function get thumbnail():BitmapData{
return (_thumbnail);
}
public function set description(_arg1:String):void{
_description = _arg1;
}
public function get groupId():uint{
return (_group.id);
}
public function get description():String{
return (_description);
}
public function save():void{
API.saveFile(this);
}
private function onContentsLoaded(_arg1:Event):void{
var _local2:ByteArray = _arg1.target.response;
_local2.uncompress();
var _local3:uint = _local2.readUnsignedByte();
if (_local3 == 0){
_contents = new ByteArray();
_contents.writeBytes(_local2, 1);
} else {
_contents = _local2.readObject();
};
dispatchEvent(new APIEvent(APIEvent.FILE_LOADED, true, contents));
}
}
}//package com.newgrounds
Section 21
//SaveGroup (com.newgrounds.SaveGroup)
package com.newgrounds {
public class SaveGroup {
private var _id:uint;
private var _keys:Array;
private var _type:uint;
private var _name:String;
private var _ratings:Array;
private var _files:Array;
public static const TYPE_SYSTEM:uint = 0;
public static const TYPE_PRIVATE:uint = 1;
public static const TYPE_MODERATED:uint = 3;
public static const TYPE_PUBLIC:uint = 2;
public function SaveGroup(_arg1:uint, _arg2:String, _arg3:uint){
_name = _arg2;
_id = _arg1;
_type = _arg3;
_ratings = [];
_keys = [];
_files = [];
}
public function toString():String{
return ((((((("SaveGroup { name: " + _name) + ", id: ") + _id) + ", keys: ") + _keys) + "}"));
}
public function getRatingById(_arg1:uint):SaveRating{
var _local2:uint;
while (_local2 < _ratings.length) {
if (_ratings[_local2].id == _arg1){
return (_ratings[_local2]);
};
_local2++;
};
return (null);
}
public function getKeyByName(_arg1:String):SaveKey{
var _local2:uint;
while (_local2 < _keys.length) {
if (_keys[_local2].name == _arg1){
return (_keys[_local2]);
};
_local2++;
};
return (null);
}
public function get name():String{
return (_name);
}
public function getKeyById(_arg1:uint):SaveKey{
var _local2:uint;
while (_local2 < _keys.length) {
if (_keys[_local2].id == _arg1){
return (_keys[_local2]);
};
_local2++;
};
return (null);
}
public function addRating(_arg1:SaveRating):void{
_ratings.push(_arg1);
}
public function get id():uint{
return (_id);
}
public function createQuery():SaveGroupQuery{
return (new SaveGroupQuery(this));
}
public function get keys():Array{
return (_keys.concat());
}
public function getRatingByName(_arg1:String):SaveRating{
var _local2:uint;
while (_local2 < _ratings.length) {
if (_ratings[_local2].name == _arg1){
return (_ratings[_local2]);
};
_local2++;
};
return (null);
}
public function get ratings():Array{
return (_ratings.concat());
}
public function get type():uint{
return (_type);
}
public function addKey(_arg1:SaveKey):void{
_keys.push(_arg1);
}
public static function createFromObject(_arg1:Object):SaveGroup{
var _local4:Object;
var _local5:Object;
var _local2:SaveGroup = new SaveGroup(_arg1.group_id, _arg1.group_name, _arg1.group_type);
var _local3:uint;
while (_local3 < _arg1.keys.length) {
_local4 = _arg1.keys[_local3];
_local2.addKey(new SaveKey(_local4.id, _local4.name, _local4.type));
_local3++;
};
_local3 = 0;
while (_local3 < _arg1.ratings.length) {
_local5 = _arg1.ratings[_local3];
_local2.addRating(new SaveRating(_local5.id, _local5.name, _local5.float, _local5.min, _local5.max));
_local3++;
};
return (_local2);
}
}
}//package com.newgrounds
Section 22
//SaveGroupQuery (com.newgrounds.SaveGroupQuery)
package com.newgrounds {
import flash.events.*;
public class SaveGroupQuery extends EventDispatcher {
private var _group:SaveGroup;
private var _fileConditions:Array;
private var _ratingConditions:Array;
private var _resultsPerPage:uint;
private var _sortConditions:Array;
private var _lookupRatings:Array;
private var _randomizeResults:Boolean;
private var _lookupKeys:Array;
private var _page:uint;
private var _groupBy:Array;
private var _keyConditions:Array;
public static const UPDATED_ON:uint = 5;
public static const TABLE_RATINGS:uint = 3;
public static const TABLE_FILES:uint = 1;
public static const TOTAL_VOTES:String = "votes";
public static const AUTHOR_ID:uint = 1;
public static const FILE_STATUS:uint = 7;
public static const TABLE_KEYS:uint = 2;
public static const FILE_NAME:uint = 3;
public static const SCORE:String = "score";
public static const TOTAL_VIEWS:uint = 6;
public static const CREATED_ON:uint = 4;
public static const FILE_ID:uint = 0;
public static const AUTHOR_NAME:uint = 2;
public function SaveGroupQuery(_arg1:SaveGroup){
_group = _arg1;
reset();
}
public function addKeyCondition(_arg1:String, _arg2:String, _arg3):void{
var _local4:SaveKey = _group.getKeyByName(_arg1);
if (!_local4){
return;
};
if (!checkValue(_arg3, _local4.type)){
return;
};
_keyConditions.push({key_id:_local4.id, operator:_arg2, value:_arg3});
}
public function sortOn(_arg1:uint, _arg2:Boolean=false):void{
addSortCondition(TABLE_FILES, _arg1, _arg2);
}
public function set isRandomized(_arg1:Boolean):void{
_randomizeResults = _arg1;
}
public function get isRandomized():Boolean{
return (_randomizeResults);
}
public function groupByRating(_arg1:String):void{
var _local2:SaveRating = _group.getRatingByName(_arg1);
if (!_local2){
return;
};
_groupBy.push({table:TABLE_RATINGS, field:_local2.id});
}
public function execute():void{
API.executeSaveQuery(this);
}
public function get page():uint{
return (_page);
}
public function groupByKey(_arg1:String):void{
var _local2:SaveKey = _group.getKeyByName(_arg1);
if (!_local2){
return;
};
_groupBy.push({table:TABLE_KEYS, field:_local2.id});
}
public function sortOnKey(_arg1:String, _arg2:Boolean=false):void{
addSortCondition(TABLE_KEYS, _group.getKeyByName(_arg1).id, _arg2);
}
public function toObject():Object{
var _local1:Object = {page:_page, num_results:_resultsPerPage};
if (isRandomized){
_local1.randomize = 1;
};
if (((_fileConditions) && ((_fileConditions.length > 0)))){
_local1.file_conditions = _fileConditions;
};
if (((_keyConditions) && ((_keyConditions.length > 0)))){
_local1.key_conditions = _keyConditions;
};
if (((_ratingConditions) && ((_ratingConditions.length > 0)))){
_local1.rating_conditions = _ratingConditions;
};
if (((_sortConditions) && ((_sortConditions.length > 0)))){
_local1.sort_conditions = _sortConditions;
};
if (((_lookupKeys) && ((_lookupKeys.length > 0)))){
_local1.lookup_keys = _lookupKeys;
};
if (((_lookupRatings) && ((_lookupRatings.length > 0)))){
_local1.lookup_ratings = _lookupRatings;
};
if (((_groupBy) && ((_groupBy.length > 0)))){
_local1.group_by = _groupBy;
};
return (_local1);
}
public function reset():void{
_fileConditions = [];
_keyConditions = [];
_ratingConditions = [];
_sortConditions = [];
_groupBy = [];
_lookupKeys = [];
_lookupRatings = [];
_randomizeResults = false;
_resultsPerPage = 20;
_page = 1;
}
public function includeKey(_arg1:String):void{
var _local2:SaveKey = _group.getKeyByName(_arg1);
if (_local2){
_lookupKeys.push(_local2.id);
};
}
private function checkValue(_arg1, _arg2:uint):Boolean{
return (true);
}
public function set page(_arg1:uint):void{
_page = _arg1;
}
public function addRatingCondition(_arg1:String, _arg2:String, _arg3, _arg4:String="score"):void{
var _local5:SaveRating = _group.getRatingByName(_arg1);
if (!_local5){
return;
};
_ratingConditions.push({rating_id:_local5.id, operator:_arg2, value:_arg3, column:_arg4});
}
public function includeRating(_arg1:String):void{
var _local2:SaveRating = _group.getRatingByName(_arg1);
if (_local2){
_lookupRatings.push(_local2.id);
};
}
public function sortOnRating(_arg1:String, _arg2:Boolean=false, _arg3:String="score"):void{
addSortCondition(TABLE_RATINGS, _group.getRatingByName(_arg1).id, _arg2, _arg3);
}
public function set resultsPerPage(_arg1:uint):void{
_resultsPerPage = _arg1;
}
public function excludeRating(_arg1:String):void{
var _local2:SaveRating = _group.getRatingByName(_arg1);
var _local3:uint;
while (_local3 < _lookupRatings.length) {
if (_lookupRatings[_local3] == _local2.id){
_lookupRatings.splice(_local3, 1);
return;
};
_local3++;
};
}
public function addFileCondition(_arg1:uint, _arg2:String, _arg3):void{
_fileConditions.push({field:_arg1, operator:_arg2, value:_arg3});
}
public function excludeKey(_arg1:String):void{
var _local2:SaveKey = _group.getKeyByName(_arg1);
var _local3:uint;
while (_local3 < _lookupKeys.length) {
if (_lookupKeys[_local3] == _local2.id){
_lookupKeys.splice(_local3, 1);
return;
};
_local3++;
};
}
public function get resultsPerPage():uint{
return (_resultsPerPage);
}
public function get groupId():uint{
return (_group.id);
}
override public function toString():String{
return ("");
}
private function addSortCondition(_arg1:uint, _arg2:uint, _arg3:Boolean=false, _arg4=null):void{
var _local5:Object = {table:_arg1, field:_arg2, desc:_arg3};
if (_arg4){
_local5.extra = _arg4;
};
_sortConditions.push(_local5);
}
public function groupBy(_arg1:uint):void{
_groupBy.push({table:TABLE_FILES, field:_arg1});
}
public function get group():SaveGroup{
return (_group);
}
}
}//package com.newgrounds
Section 23
//SaveKey (com.newgrounds.SaveKey)
package com.newgrounds {
public class SaveKey {
private var _id:uint;
private var _type:uint;
private var _name:String;
public static const TYPE_BOOLEAN:uint = 4;
public static const TYPE_STRING:uint = 3;
public static const TYPE_FLOAT:uint = 1;
public static const TYPE_INTEGER:uint = 2;
public function SaveKey(_arg1:uint, _arg2:String, _arg3:uint){
_id = _arg1;
_name = _arg2;
_type = _arg3;
}
public function isValueValid(_arg1):Boolean{
if (_type == TYPE_INTEGER){
return ((((_arg1 is int)) || ((_arg1 is uint))));
};
if (_type == TYPE_FLOAT){
return ((((((_arg1 is int)) || ((_arg1 is uint)))) || ((_arg1 is Number))));
};
if (_type == TYPE_STRING){
return ((_arg1 is String));
};
if (_type == TYPE_BOOLEAN){
return ((((((((_arg1 is Boolean)) || ((_arg1 === 0)))) || ((_arg1 === 1)))) || ((_arg1 == ""))));
};
return (false);
}
public function get name():String{
return (_name);
}
public function get type():uint{
return (_type);
}
public function get id():uint{
return (_id);
}
public function toString():String{
return (_name);
}
}
}//package com.newgrounds
Section 24
//SaveRating (com.newgrounds.SaveRating)
package com.newgrounds {
public class SaveRating {
private var _voted:Boolean;
private var _name:String;
private var _maxValue:Number;
private var _isFloat:Boolean;
private var _id:uint;
private var _minValue:Number;
public function SaveRating(_arg1:uint, _arg2:String, _arg3:Boolean, _arg4:Number=-INF, _arg5:Number=INF){
_id = _arg1;
_name = _arg2;
_isFloat = _arg3;
_minValue = _arg4;
_maxValue = _arg5;
}
public function get voted():Boolean{
return (_voted);
}
public function set voted(_arg1:Boolean):void{
_voted = _arg1;
}
public function toString():String{
return (_name);
}
public function get maxValue():Number{
return (_maxValue);
}
public function get name():String{
return (_name);
}
public function get isFloat():Boolean{
return (_isFloat);
}
public function get id():uint{
return (_id);
}
public function get minValue():Number{
return (_minValue);
}
}
}//package com.newgrounds
Section 25
//Score (com.newgrounds.Score)
package com.newgrounds {
public class Score {
private var _board:ScoreBoard;
private var _position:uint;
private var _numeric_value:uint;
private var _value:String;
private var _username:String;
private var _tag:String;
public function Score(_arg1:ScoreBoard, _arg2:Number, _arg3:String, _arg4:String, _arg5:uint, _arg6:String){
_board = _arg1;
_position = _arg2;
_username = _arg3;
_value = _arg4;
_numeric_value = _arg5;
_tag = _arg6;
}
public function get tag():String{
return (_tag);
}
public function get board():ScoreBoard{
return (_board);
}
public function get position():uint{
return (_position);
}
public function get value():String{
return (_value);
}
public function get username():String{
return (_username);
}
public function get numeric_value():uint{
return (_numeric_value);
}
}
}//package com.newgrounds
Section 26
//ScoreBoard (com.newgrounds.ScoreBoard)
package com.newgrounds {
import flash.events.*;
public class ScoreBoard extends EventDispatcher {
private var _scores:Array;
private var _tag:String;
private var _period:String;// = "Today"
private var _name:String;
private var _page:uint;// = 1
private var _id:uint;
private var _num_results:uint;// = 10
public function ScoreBoard(_arg1:uint, _arg2:String, _arg3:String){
_name = _arg2;
_id = _arg1;
_scores = [];
_tag = _arg3;
}
public function get period():String{
return (_period);
}
public function get name():String{
return (_name);
}
public function postScore(_arg1:uint):void{
API.postScore(_name, _arg1);
}
public function get page():uint{
return (_page);
}
public function get tag():String{
return (_tag);
}
public function exists():Boolean{
return ((_id > 0));
}
public function get scores():Array{
return (_scores);
}
public function get id():Number{
return (_id);
}
public function loadScores(_arg1:String="Today", _arg2:uint=1, _arg3:uint=10):void{
_period = _arg1;
if (((!(_period)) || ((_period == "")))){
_period = ScoreBoardPeriod.TODAY;
};
_page = _arg2;
_num_results = _arg3;
API.loadScores(this);
}
function setScores(_arg1:Array, _arg2:String, _arg3:Number, _arg4:Number):void{
var _local6:uint;
_period = _arg2;
_page = _arg3;
_num_results = _arg4;
_scores = [];
var _local5:uint;
while (_local5 < _arg1.length) {
_local6 = (((_num_results * (_page - 1)) + 1) + _local5);
_scores.push(new Score(this, _local6, _arg1[_local5].username, _arg1[_local5].value, _arg1[_local5].numeric_value, _arg1[_local5].tag));
_local5++;
};
}
public function get num_results():uint{
return (_num_results);
}
}
}//package com.newgrounds
Section 27
//ScoreBoardPeriod (com.newgrounds.ScoreBoardPeriod)
package com.newgrounds {
public class ScoreBoardPeriod {
public static const MONTH:String = "This Month";
public static const TODAY:String = "Today";
public static const WEEK:String = "This Week";
public static const ALL_TIME:String = "All-Time";
public static const YEAR:String = "This Year";
}
}//package com.newgrounds
Section 28
//SmartURLLoader (com.newgrounds.SmartURLLoader)
package com.newgrounds {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
import flash.errors.*;
public class SmartURLLoader extends EventDispatcher {
private var _urlRequest:URLRequest;
private var _method:String;// = "GET"
private var _files:Dictionary;
private var _hasVariables:Boolean;
private var _dataFormat:String;// = "text"
private var _urlLoader:URLLoader;
private var _preventCache:Boolean;// = false
private var _variables:Dictionary;
public var owner;
private var _openBrowser:Boolean;// = false
private static const CRLF:String = "
";
private static var _loaders:Dictionary = new Dictionary();
public function SmartURLLoader(){
_urlRequest = new URLRequest();
_variables = new Dictionary();
}
public function get response(){
return (_urlLoader.data);
}
public function set method(_arg1:String):void{
if (((hasFiles) && ((_arg1 == URLRequestMethod.GET)))){
throw (new IllegalOperationError("GET cannot be used to upload files."));
};
_method = _arg1;
}
private function onIOError(_arg1:IOErrorEvent):void{
dispatchEvent(_arg1);
dispose();
}
public function addVariable(_arg1:String, _arg2=""):void{
_variables[_arg1] = _arg2;
if (_arg2){
_hasVariables = true;
};
}
private function onSecurityError(_arg1:SecurityErrorEvent):void{
dispatchEvent(_arg1);
dispose();
}
public function get preventCache():Boolean{
return (_preventCache);
}
public function addFile(_arg1:String, _arg2:ByteArray, _arg3:String, _arg4:String="application/octect-stream"):void{
method = URLRequestMethod.POST;
if (!_files){
_files = new Dictionary();
};
_files[_arg1] = new File(_arg1, _arg2, _arg3, _arg4);
}
public function get openBrowser():Boolean{
return (_openBrowser);
}
public function set preventCache(_arg1:Boolean):void{
_preventCache = _arg1;
}
public function get responseFormat():String{
return (_dataFormat);
}
private function onComplete(_arg1:Event):void{
dispatchEvent(_arg1);
dispose();
}
public function dispose():void{
_files = null;
_variables = null;
if (_urlLoader){
_urlLoader.removeEventListener(Event.COMPLETE, onComplete);
_urlLoader.removeEventListener(ProgressEvent.PROGRESS, onProgress);
_urlLoader.removeEventListener(IOErrorEvent.IO_ERROR, onIOError);
_urlLoader.removeEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatus);
_urlLoader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
_urlLoader = null;
};
_urlRequest = null;
_loaders[this] = null;
}
public function get method():String{
return (_method);
}
public function close():void{
try {
_urlLoader.close();
} catch(e:Error) {
};
}
private function buildMultipartData(_arg1:String):ByteArray{
var _local3:String;
var _local4:File;
var _local2:ByteArray = new ByteArray();
_local2.endian = Endian.BIG_ENDIAN;
_arg1 = ("--" + _arg1);
for (_local3 in _variables) {
_local2.writeUTFBytes((_arg1 + CRLF));
_local2.writeUTFBytes(((("Content-Disposition: form-data; name=\"" + _local3) + "\"") + CRLF));
_local2.writeUTFBytes(CRLF);
_local2.writeUTFBytes((_variables[_local3] + CRLF));
};
if (hasFiles){
for each (_local4 in _files) {
_local2.writeUTFBytes((_arg1 + CRLF));
_local2.writeUTFBytes(("Content-Disposition: form-data; name=\"Filename\"" + CRLF));
_local2.writeUTFBytes(CRLF);
_local2.writeUTFBytes((_local4.fileName + CRLF));
_local2.writeUTFBytes((_arg1 + CRLF));
_local2.writeUTFBytes(((((("Content-Disposition: form-data; name=\"" + _local4.dataField) + "\"; filename=\"") + _local4.fileName) + "\"") + CRLF));
_local2.writeUTFBytes((("Content-Type: " + _local4.contentType) + CRLF));
_local2.writeUTFBytes(CRLF);
_local2.writeBytes(_local4.data);
_local2.writeUTFBytes(CRLF);
};
_local2.writeUTFBytes((_arg1 + CRLF));
_local2.writeUTFBytes(("Content-Disposition: form-data; name=\"Upload\"" + CRLF));
_local2.writeUTFBytes(CRLF);
_local2.writeUTFBytes(("Submit Query" + CRLF));
};
_local2.writeUTFBytes((_arg1 + "--"));
_local2.position = 0;
trace(_local2.readUTFBytes(_local2.length));
_local2.position = 0;
return (_local2);
}
public function clearVariables():void{
_variables = new Dictionary();
}
private function onProgress(_arg1:ProgressEvent):void{
dispatchEvent(_arg1);
}
public function load(_arg1:String):void{
var urlVariables:URLVariables;
var key:String;
var boundary:String;
var i:uint;
var event:SecurityErrorEvent;
var url = _arg1;
_urlRequest.url = url;
if (_preventCache){
url = (url + ("?seed=" + Math.random()));
if (_hasVariables){
url = (url + "&");
};
};
_urlRequest.method = _method;
if ((((_urlRequest.method == URLRequestMethod.GET)) || (!(hasFiles)))){
_urlRequest.contentType = "application/x-www-form-urlencoded";
if (_hasVariables){
urlVariables = new URLVariables();
for (key in _variables) {
urlVariables[key] = _variables[key];
};
_urlRequest.data = urlVariables;
};
} else {
boundary = "";
i = 0;
while (i < 32) {
boundary = (boundary + String.fromCharCode(uint((97 + (Math.random() * 25)))));
i = (i + 1);
};
_urlRequest.contentType = (("multipart/form-data; boundary=\"" + boundary) + "\"");
_urlRequest.data = buildMultipartData(boundary);
};
if (openBrowser){
navigateToURL(_urlRequest, "_blank");
} else {
_urlLoader = new URLLoader();
_urlLoader.dataFormat = _dataFormat;
_urlLoader.addEventListener(Event.COMPLETE, onComplete);
_urlLoader.addEventListener(ProgressEvent.PROGRESS, onProgress);
_urlLoader.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
_urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, onHTTPStatus);
_urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, onSecurityError);
_loaders[_urlLoader] = this;
try {
_urlLoader.load(_urlRequest);
} catch(error:Error) {
event = new SecurityErrorEvent(SecurityErrorEvent.SECURITY_ERROR, false, false, error.message);
onSecurityError(event);
};
};
}
public function set responseFormat(_arg1:String):void{
_dataFormat = _arg1;
}
public function clearFiles():void{
_files = null;
}
private function onHTTPStatus(_arg1:HTTPStatusEvent):void{
dispatchEvent(_arg1);
}
public function set openBrowser(_arg1:Boolean):void{
_openBrowser = _arg1;
}
public function get hasFiles():Boolean{
return (Boolean(_files));
}
}
}//package com.newgrounds
import flash.utils.*;
class File {
private var dataField:String;
private var contentType:String;
private var fileName:String;
private var data:ByteArray;
private function File(_arg1:String, _arg2:ByteArray, _arg3:String="Filedata", _arg4:String="application/octet-stream"){
this.fileName = _arg1;
this.data = _arg2;
this.dataField = _arg3;
this.contentType = _arg4;
}
}
Section 29
//NewgroundsAPIAsset_API_Conencted_8 (FlashAd_fla.NewgroundsAPIAsset_API_Conencted_8)
package FlashAd_fla {
import flash.display.*;
import com.newgrounds.components.*;
public dynamic class NewgroundsAPIAsset_API_Conencted_8 extends MovieClip {
public function NewgroundsAPIAsset_API_Conencted_8(){
addFrameScript(36, frame37);
}
function frame37(){
APIConnector(parent).clear();
}
}
}//package FlashAd_fla
Section 30
//NewgroundsAPIAsset_ConnectingAPI_7 (FlashAd_fla.NewgroundsAPIAsset_ConnectingAPI_7)
package FlashAd_fla {
import flash.display.*;
public dynamic class NewgroundsAPIAsset_ConnectingAPI_7 extends MovieClip {
public function NewgroundsAPIAsset_ConnectingAPI_7(){
addFrameScript(9, frame10);
}
function frame10(){
stop();
}
}
}//package FlashAd_fla
Section 31
//NewgroundsAPIAsset_Connection_Error_11 (FlashAd_fla.NewgroundsAPIAsset_Connection_Error_11)
package FlashAd_fla {
import flash.display.*;
import com.newgrounds.components.*;
public dynamic class NewgroundsAPIAsset_Connection_Error_11 extends MovieClip {
public function NewgroundsAPIAsset_Connection_Error_11(){
addFrameScript(9, frame10, 20, frame21);
}
function frame21(){
APIConnector(parent).clear();
}
function frame10(){
stop();
}
}
}//package FlashAd_fla
Section 32
//NewgroundsAPIAsset_FlashAd_Container_2 (FlashAd_fla.NewgroundsAPIAsset_FlashAd_Container_2)
package FlashAd_fla {
import flash.events.*;
import flash.display.*;
import com.newgrounds.*;
public dynamic class NewgroundsAPIAsset_FlashAd_Container_2 extends MovieClip {
public var ngLinkButton:SimpleButton;
public var adMask:MovieClip;
public function NewgroundsAPIAsset_FlashAd_Container_2(){
addFrameScript(0, frame1, 10, frame11);
}
function frame1(){
ngLinkButton.addEventListener(MouseEvent.CLICK, onNGLinkClicked);
}
public function onNGLinkClicked(_arg1:MouseEvent):void{
API.loadNewgrounds();
}
function frame11(){
gotoAndPlay(1);
}
}
}//package FlashAd_fla
Section 33
//NewgroundsAPIAsset_Load_Indicator_5 (FlashAd_fla.NewgroundsAPIAsset_Load_Indicator_5)
package FlashAd_fla {
import flash.events.*;
import flash.display.*;
public dynamic class NewgroundsAPIAsset_Load_Indicator_5 extends MovieClip {
public function NewgroundsAPIAsset_Load_Indicator_5(){
addFrameScript(0, frame1);
}
function frame1(){
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function onEnterFrame(_arg1:Event):void{
if (((visible) && (stage))){
rotation = (rotation + 30);
} else {
removeEventListener(Event.ENTER_FRAME, onEnterFrame);
};
}
}
}//package FlashAd_fla
Section 34
//NewgroundsAPIAsset_Login_Warning_9 (FlashAd_fla.NewgroundsAPIAsset_Login_Warning_9)
package FlashAd_fla {
import flash.display.*;
import com.newgrounds.components.*;
public dynamic class NewgroundsAPIAsset_Login_Warning_9 extends MovieClip {
public function NewgroundsAPIAsset_Login_Warning_9(){
addFrameScript(9, frame10, 20, frame21);
}
function frame21(){
APIConnector(parent).clear();
}
function frame10(){
stop();
}
}
}//package FlashAd_fla
Section 35
//ccent (ccent)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class ccent extends MovieClip {
public var bb:Rectangle;
public var img:gcenthair;
public var forcestrike:int;
public var eot:int;
public var idnum:int;
public var dir:int;
public var turnframe:int;
public var bounceimmune;
public var specialchunk:int;
public var turn:Boolean;
public var omegaturn:Boolean;
public function ccent(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
bb = new Rectangle(0, 0, 38, 24);
omegaturn = false;
turn = false;
turnframe = 0;
dir = 1;
forcestrike = -100;
eot = 0;
bounceimmune = false;
}
}
}//package
Section 36
//ccontrolinfo (ccontrolinfo)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class ccontrolinfo extends MovieClip {
public function ccontrolinfo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 37
//ccop (ccop)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class ccop extends MovieClip {
public var bb:Rectangle;
public var img:gcop;
public function ccop(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
bb = new Rectangle(-4, -16, 34, 40);
}
}
}//package
Section 38
//ccopcar (ccopcar)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class ccopcar extends MovieClip {
public var bb:Rectangle;
public var img:gcopcar;
public function ccopcar(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
bb = new Rectangle(24, 0, 24, 24);
}
}
}//package
Section 39
//cdieter (cdieter)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class cdieter extends MovieClip {
public var img:gdieter;
public function cdieter(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 40
//cgameover (cgameover)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class cgameover extends MovieClip {
public var br:gblank;
public var txtb:TextField;
public function cgameover(){
addFrameScript(0, frame1);
}
public function bmout(_arg1:MouseEvent){
txtb.textColor = 0xFFFFFF;
}
function frame1(){
stop();
br.buttonMode = true;
txtb.mouseWheelEnabled = false;
br.addEventListener(MouseEvent.MOUSE_OVER, bmover);
br.addEventListener(MouseEvent.MOUSE_OUT, bmout);
br.addEventListener(MouseEvent.CLICK, bmclick);
}
public function bmclick(_arg1:MouseEvent){
humancentipede(root).playsound(5);
humancentipede(root).flipmode("title");
}
public function bmover(_arg1:MouseEvent){
txtb.textColor = 0xFF;
}
}
}//package
Section 41
//chsentry (chsentry)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class chsentry extends MovieClip {
public var pp:gblank;
public var pq:gblank;
public var txtfinish:TextField;
public var xy:gblank;
public var xx:gblank;
public var fadetmr:int;
public var pd:gblank;
public var txtscore:TextField;
public var tstr:String;
public var bback:gblank;
public var fadeout:Boolean;
public var txtback:TextField;
public var a:gblank;
public var b:gblank;
public var c:gblank;
public var d:gblank;
public var e:gblank;
public var f:gblank;
public var g:gblank;
public var h:gblank;
public var i:int;
public var j:gblank;
public var k:gblank;
public var l:gblank;
public var m:gblank;
public var pand:gblank;
public var o:gblank;
public var p:gblank;
public var fadeframe:int;
public var r:gblank;
public var s:gblank;
public var t:gblank;
public var u:gblank;
public var v:gblank;
public var w:gblank;
public var q:gblank;
public var z:gblank;
public var n:gblank;
public var n0:gblank;
public var n1:gblank;
public var n3:gblank;
public var n4:gblank;
public var n5:gblank;
public var n6:gblank;
public var n7:gblank;
public var n8:gblank;
public var n9:gblank;
public var barfarray:Array;
public var n2:gblank;
public var pstar:gblank;
public var txtgrat:TextField;
public var pheart:gblank;
public var bdone:gblank;
public var pe:gblank;
public var txtname:TextField;
public function chsentry(){
addFrameScript(0, frame1);
}
public function bbout(_arg1:MouseEvent){
txtback.textColor = 0xFFFFFF;
}
public function bbover(_arg1:MouseEvent){
txtback.textColor = 0xFF0000;
}
public function bdover(_arg1:MouseEvent){
txtfinish.textColor = 0xFF0000;
}
function frame1(){
stop();
fadeout = false;
txtname.text = "";
barfarray = new Array();
i = 0;
tstr = "";
txtgrat.mouseWheelEnabled = false;
bback.addEventListener(MouseEvent.MOUSE_OVER, bbover);
bback.addEventListener(MouseEvent.MOUSE_OUT, bbout);
bdone.addEventListener(MouseEvent.MOUSE_OVER, bdover);
bdone.addEventListener(MouseEvent.MOUSE_OUT, bdout);
i = 0;
while (i < numChildren) {
if (getChildAt(i).name.length < 7){
barfarray.push(getChildAt(i));
};
i++;
};
i = 0;
while (i < barfarray.length) {
barfarray[i].buttonMode = true;
barfarray[i].addEventListener(MouseEvent.CLICK, bclick);
i++;
};
}
public function bclick(_arg1:MouseEvent){
if (fadeout){
return;
};
if (txtname.text.length < 3){
if (_arg1.target.name.length == 1){
txtname.appendText(_arg1.target.name.toUpperCase());
} else {
if (_arg1.target.name.charAt(0) == "p"){
switch (_arg1.target.name){
case "pp":
txtname.appendText(".");
break;
case "pq":
txtname.appendText("?");
break;
case "pe":
txtname.appendText("!");
break;
case "pheart":
txtname.appendText("@");
break;
case "pd":
txtname.appendText("$");
break;
case "pand":
txtname.appendText("&");
break;
case "pstar":
txtname.appendText("*");
break;
};
} else {
if ((((_arg1.target.name.charAt(0) == "n")) || ((_arg1.target.name.charAt(0) == "x")))){
txtname.appendText(_arg1.target.name.charAt(1).toUpperCase());
};
};
};
};
if (_arg1.target.name == "bback"){
if (txtname.text.length == 3){
tstr = txtname.text;
txtname.text = (tstr.charAt(0) + tstr.charAt(1));
} else {
if (txtname.text.length == 2){
tstr = txtname.text;
txtname.text = tstr.charAt(0);
} else {
if (txtname.text.length == 1){
txtname.text = "";
};
};
};
};
if (_arg1.target.name == "bdone"){
if (txtname.text == ""){
txtname.text = "NUL";
};
humancentipede(root).highscorename = txtname.text;
humancentipede(root).scoredest = "w1";
humancentipede(root).highscorerw("write");
fadetmr = getTimer();
humancentipede(root).playsound(5);
humancentipede(root).flipmode("update");
};
}
public function bdout(_arg1:MouseEvent){
txtfinish.textColor = 0xFFFFFF;
}
}
}//package
Section 42
//chsview (chsview)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class chsview extends MovieClip {
public var bb:gblank;
public var txtscore:TextField;
public var txtweekscore:TextField;
public var txtweekname:TextField;
public var txtb:TextField;
public var txtpscore:TextField;
public var txtpname:TextField;
public var txtname:TextField;
public function chsview(){
addFrameScript(0, frame1);
}
public function bnclick(_arg1:MouseEvent){
humancentipede(root).playsound(5);
if (txtb.text == "RETURN TO MAIN MENU"){
humancentipede(root).flipmode("title");
} else {
humancentipede(root).flipmode("gameover");
};
}
function frame1(){
stop();
txtname.mouseWheelEnabled = false;
txtscore.mouseWheelEnabled = false;
txtweekname.mouseWheelEnabled = false;
txtweekscore.mouseWheelEnabled = false;
txtpname.mouseWheelEnabled = false;
txtpscore.mouseWheelEnabled = false;
bb.buttonMode = true;
bb.addEventListener(MouseEvent.MOUSE_OVER, bnover);
bb.addEventListener(MouseEvent.MOUSE_OUT, bnout);
bb.addEventListener(MouseEvent.CLICK, bnclick);
}
public function bnout(_arg1:MouseEvent){
txtb.textColor = 0xFFFFFF;
}
public function bnover(_arg1:MouseEvent){
txtb.textColor = 0xFF;
}
}
}//package
Section 43
//cinfo (cinfo)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class cinfo extends MovieClip {
public var bstart:gblank;
public var cop:ccop;
public var cent1:ccent;
public var cent2:ccent;
public var cent3:ccent;
public var copcar:ccopcar;
public var txtlvlscores:TextField;
public var tomb:ctomb;
public var roofie:croofie;
public var txtstart:TextField;
public var cover:ctombcover;
public var scalp1:cscalp;
public var scalp2:cscalp;
public function cinfo(){
addFrameScript(0, frame1);
}
function frame1(){
cent1.img.hair.gotoAndStop(6);
cent2.img.hair.gotoAndStop(7);
cent3.img.hair.gotoAndStop(2);
tomb.img.gotoAndStop(5);
scalp2.img.gotoAndStop(2);
txtlvlscores.mouseWheelEnabled = false;
bstart.buttonMode = true;
bstart.addEventListener(MouseEvent.MOUSE_OVER, bover);
bstart.addEventListener(MouseEvent.MOUSE_OUT, bout);
bstart.addEventListener(MouseEvent.CLICK, bclick);
}
public function bout(_arg1:MouseEvent){
txtstart.textColor = 0xFFFFFF;
}
public function bclick(_arg1:MouseEvent){
humancentipede(root).playsound(5);
humancentipede(root).flipmode("info2");
humancentipede(root).unlockmedal("Reading Rainbow");
}
public function bover(_arg1:MouseEvent){
txtstart.textColor = 0xFF;
}
}
}//package
Section 44
//cinfo2 (cinfo2)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class cinfo2 extends MovieClip {
public var bb:gblank;
public var txtb:TextField;
public function cinfo2(){
addFrameScript(0, frame1);
}
public function bover(_arg1:MouseEvent){
txtb.textColor = 0xFF;
}
function frame1(){
stop();
bb.buttonMode = true;
bb.addEventListener(MouseEvent.MOUSE_OVER, bover);
bb.addEventListener(MouseEvent.MOUSE_OUT, bout);
bb.addEventListener(MouseEvent.CLICK, bclick);
}
public function bout(_arg1:MouseEvent){
txtb.textColor = 0xFFFFFF;
}
public function bclick(_arg1:MouseEvent){
humancentipede(root).playsound(5);
humancentipede(root).flipmode("playfield");
}
}
}//package
Section 45
//clogo (clogo)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class clogo extends MovieClip {
public var logoframe:int;
public var tmrlogo:int;
public var logo:glogo;
public var bmock:gblank;
public function clogo(){
addFrameScript(0, frame1);
}
function frame1(){
logo.alpha = 0;
bmock.buttonMode = true;
bmock.visible = false;
bmock.addEventListener(MouseEvent.CLICK, bclik);
}
public function bclik(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.i-mockery.com"), "_blank");
}
}
}//package
Section 46
//cmads (cmads)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class cmads extends MovieClip {
public var bb:Rectangle;
public var img:gmads;
public function cmads(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
bb = new Rectangle(2, 18, 24, 24);
}
}
}//package
Section 47
//cmedal (cmedal)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class cmedal extends MovieClip {
public var img:gmedal;
public var tmrmedal:int;
public var txtpoints:TextField;
public var dir:int;
public var txtname:TextField;
public var medalframe:int;
public var bmpicon:Bitmap;
public function cmedal(){
addFrameScript(0, frame1);
}
public function forgebmp(){
bmpicon = new Bitmap();
bmpicon.x = 3;
bmpicon.y = 3;
addChild(bmpicon);
}
function frame1(){
medalframe = 0;
dir = -1;
}
}
}//package
Section 48
//cplayfield (cplayfield)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class cplayfield extends MovieClip {
public var ttomb:ctombandcover;
public var border1:gblank;
public var border2:gblank;
public var border3:gblank;
public var tombarray:Array;
public var tx:int;
public var copcar:ccopcar;
public var cop:ccop;
public var ty:int;
public var scalp:cscalp;
public var rick:crick;
public var mads:cmads;
public var i:int;
public var roofie:croofie;
public var shot:gshot;
public function cplayfield(){
addFrameScript(0, frame1);
}
function frame1(){
tombarray = new Array();
i = 0;
tx = 0;
ty = 0;
mads = new cmads();
cop = new ccop();
copcar = new ccopcar();
shot = new gshot();
scalp = new cscalp();
roofie = new croofie();
rick = new crick();
i = 0;
while (i < 600) {
ttomb = new ctombandcover();
ttomb.x = (tx * 24);
ttomb.y = (ty * 24);
addChild(ttomb);
tombarray.push(ttomb);
ttomb.visible = false;
ttomb.idnum = i;
tx++;
if (tx == 25){
tx = 0;
ty++;
};
i++;
};
border1.idnum = 1;
border2.idnum = 2;
border3.idnum = 3;
tombarray.push(border1);
tombarray.push(border2);
tombarray.push(border3);
addChild(cop);
addChild(copcar);
addChild(shot);
addChild(scalp);
addChild(roofie);
addChild(mads);
addChild(rick);
}
public function init(){
mads.x = 286;
mads.y = 558;
cop.visible = false;
copcar.visible = false;
shot.visible = false;
scalp.visible = false;
roofie.visible = false;
rick.visible = false;
}
}
}//package
Section 49
//crick (crick)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class crick extends MovieClip {
public var img:grick;
public function crick(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 50
//croofie (croofie)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class croofie extends MovieClip {
public var img:groofie;
public function croofie(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 51
//cscalp (cscalp)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class cscalp extends MovieClip {
public var bb:Rectangle;
public var img:gscalp;
public function cscalp(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
bb = new Rectangle(0, 4, 24, 24);
}
}
}//package
Section 52
//cscorebar (cscorebar)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class cscorebar extends MovieClip {
public var txtscore:TextField;
public var txtlvl:TextField;
public var life1:gmadsico;
public var life2:gmadsico;
public var life3:gmadsico;
public var life4:gmadsico;
public var txthigh:TextField;
public var txtcombo:TextField;
public function cscorebar(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
txtcombo.visible = false;
visible = false;
}
}
}//package
Section 53
//cshot (cshot)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class cshot extends MovieClip {
public var img:gshot;
public function cshot(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 54
//cstory (cstory)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class cstory extends MovieClip {
public var txts:TextField;
public var txtn:TextField;
public var bb:gblank;
public var bn:gblank;
public var txtlazer:TextField;
public var txttop:TextField;
public var blazer:gblank;
public var txtb:TextField;
public function cstory(){
addFrameScript(0, frame1);
}
public function bnout(_arg1:MouseEvent){
txtn.textColor = 0xFFFFFF;
}
public function bclick(_arg1:MouseEvent){
humancentipede(root).playsound(5);
humancentipede(root).flipmode("info2");
}
public function bnover(_arg1:MouseEvent){
txtn.textColor = 0xFF;
}
function frame1(){
stop();
txts.mouseWheelEnabled = false;
txttop.mouseWheelEnabled = false;
txtlazer.mouseWheelEnabled = false;
txtlazer.visible = false;
bn.buttonMode = true;
bn.addEventListener(MouseEvent.MOUSE_OVER, bnover);
bn.addEventListener(MouseEvent.MOUSE_OUT, bnout);
bn.addEventListener(MouseEvent.CLICK, bnclick);
blazer.addEventListener(MouseEvent.CLICK, blclick);
blazer.buttonMode = true;
bb.buttonMode = true;
bb.addEventListener(MouseEvent.MOUSE_OVER, bover);
bb.addEventListener(MouseEvent.MOUSE_OUT, bout);
bb.addEventListener(MouseEvent.CLICK, bclick);
}
public function bout(_arg1:MouseEvent){
txtb.textColor = 0xFFFFFF;
}
public function bover(_arg1:MouseEvent){
txtb.textColor = 0xFF;
}
public function bnclick(_arg1:MouseEvent){
humancentipede(root).playsound(5);
humancentipede(root).flipmode("minfo");
}
public function blclick(_arg1:MouseEvent){
if (txtlazer.visible){
txttop.text = (("You are Dr. Heiter, a brilliant German surgeon " + "who has gone mad and surgically attached people ass-to-mouth ") + "to create\nthe human centipede.");
txtlazer.visible = false;
} else {
txttop.text = (("You are Dr. Laser, a brilliant German surgeon " + "who has gone mad and surgically attached people ass-to-mouth ") + "to create\nthe human centipede.");
humancentipede(root).playsound(14);
txtlazer.visible = true;
};
}
}
}//package
Section 55
//ctitle (ctitle)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class ctitle extends MovieClip {
public var img:gtitle;
public var bplay:gblank;
public var bng:gblank;
public var txtplay:TextField;
public var txtng:TextField;
public var bhs:gblank;
public var txths:TextField;
public function ctitle(){
addFrameScript(0, frame1);
}
public function bnout(_arg1:MouseEvent){
txtng.textColor = 0xFFFF00;
}
public function bkover(_arg1:MouseEvent){
txths.textColor = 0xFF;
}
public function bkclick(_arg1:MouseEvent){
humancentipede(root).playsound(5);
humancentipede(root).flipmode("hsview");
}
public function bnover(_arg1:MouseEvent){
txtng.textColor = 0xFF;
}
public function bmout(_arg1:MouseEvent){
txtplay.textColor = 0xFFFFFF;
}
public function bkout(_arg1:MouseEvent){
txths.textColor = 0xFFFFFF;
}
public function bmover(_arg1:MouseEvent){
txtplay.textColor = 0xFF;
}
function frame1(){
stop();
bplay.buttonMode = true;
bhs.buttonMode = true;
bng.buttonMode = true;
bplay.addEventListener(MouseEvent.MOUSE_OVER, bmover);
bplay.addEventListener(MouseEvent.MOUSE_OUT, bmout);
bplay.addEventListener(MouseEvent.CLICK, bmclick);
bhs.addEventListener(MouseEvent.MOUSE_OVER, bkover);
bhs.addEventListener(MouseEvent.MOUSE_OUT, bkout);
bhs.addEventListener(MouseEvent.CLICK, bkclick);
bng.addEventListener(MouseEvent.MOUSE_OVER, bnover);
bng.addEventListener(MouseEvent.MOUSE_OUT, bnout);
bng.addEventListener(MouseEvent.CLICK, bnclick);
}
public function bmclick(_arg1:MouseEvent){
humancentipede(root).playsound(5);
humancentipede(root).flipmode("story");
}
public function bnclick(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.newgrounds.com"), "_blank");
}
}
}//package
Section 56
//ctomb (ctomb)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class ctomb extends MovieClip {
public var img:gtomb;
public function ctomb(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 57
//ctombandcover (ctombandcover)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class ctombandcover extends MovieClip {
public var bb:Rectangle;
public var img:gtombandcover;
public var forcestrike:Boolean;
public var idnum:int;
public var id:String;
public var inter:Rectangle;
public var intamount:int;
public function ctombandcover(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
bb = new Rectangle(0, 0, 24, 24);
id = "tomb";
intamount = 0;
forcestrike = false;
}
}
}//package
Section 58
//ctombcover (ctombcover)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class ctombcover extends MovieClip {
public var img:gtombcover;
public function ctombcover(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 59
//cupdate (cupdate)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class cupdate extends MovieClip {
public var c3:ccent;
public var c1:ccent;
public var c2:ccent;
public function cupdate(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
c3.img.hair.gotoAndStop(2);
c2.img.hair.gotoAndStop(6);
c1.img.hair.gotoAndStop(7);
}
}
}//package
Section 60
//gblak (gblak)
package {
import flash.display.*;
public dynamic class gblak extends MovieClip {
}
}//package
Section 61
//gblank (gblank)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class gblank extends MovieClip {
public var id:String;
public var idnum:int;
public function gblank(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
alpha = 0;
id = "blank";
}
}
}//package
Section 62
//gcent (gcent)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class gcent extends MovieClip {
public function gcent(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 63
//gcenthair (gcenthair)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class gcenthair extends MovieClip {
public var hair:ghair;
public var cent:gcent;
public function gcenthair(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 64
//gcop (gcop)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class gcop extends MovieClip {
public function gcop(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 65
//gcopcar (gcopcar)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class gcopcar extends MovieClip {
public function gcopcar(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 66
//gcopscore (gcopscore)
package {
import flash.display.*;
import flash.text.*;
public dynamic class gcopscore extends MovieClip {
public var txt:TextField;
}
}//package
Section 67
//gdieter (gdieter)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class gdieter extends MovieClip {
public function gdieter(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 68
//ghair (ghair)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class ghair extends MovieClip {
public function ghair(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 69
//glazer (glazer)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class glazer extends MovieClip {
public function glazer(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 70
//glogo (glogo)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class glogo extends MovieClip {
public function glogo(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 71
//gmads (gmads)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class gmads extends MovieClip {
public function gmads(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 72
//gmadsico (gmadsico)
package {
import flash.display.*;
public dynamic class gmadsico extends MovieClip {
}
}//package
Section 73
//gmedal (gmedal)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class gmedal extends MovieClip {
public function gmedal(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 74
//gno (gno)
package {
import flash.display.*;
public dynamic class gno extends MovieClip {
}
}//package
Section 75
//grick (grick)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class grick extends MovieClip {
public function grick(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 76
//groofie (groofie)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class groofie extends MovieClip {
public function groofie(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 77
//gscalp (gscalp)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class gscalp extends MovieClip {
public function gscalp(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 78
//gshot (gshot)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class gshot extends MovieClip {
public function gshot(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 79
//gtitle (gtitle)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class gtitle extends MovieClip {
public function gtitle(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 80
//gtomb (gtomb)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class gtomb extends MovieClip {
public function gtomb(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 81
//gtombandcover (gtombandcover)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class gtombandcover extends MovieClip {
public var tomb:gtomb;
public var cover:gtombcover;
public function gtombandcover(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 82
//gtombcover (gtombcover)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class gtombcover extends MovieClip {
public function gtombcover(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 83
//humancentipede (humancentipede)
package {
import flash.events.*;
import flash.display.*;
import com.newgrounds.*;
import com.newgrounds.components.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.ui.*;
public class humancentipede extends MovieClip {
var dieterlazer:Boolean;// = false
var holdingx:Boolean;// = false
var holdingz:Boolean;// = false
var tmrcopmove:int;// = 0
var bginfo2:cinfo2;
var tombhealarray:Array;
var holdingspace:Boolean;// = false
var readyforrick:Boolean;// = false
var hitsoundchannel:SoundChannel;
var struckx:Boolean;// = false
var strucky:Boolean;// = false
var hiscore:int;// = 0
var roofiechill:int;// = 0
var titleframe:int;// = 0
var tmrcopani:int;// = 0
public var scoredest:String;// = "r1"
var ruinedtombs:int;// = 0
var master30:int;// = 0
public var scorebar:cscorebar;
var pedepurgearray:Array;
var rlevel:Number;// = 0
var tmrmusicdelay:int;// = 0
public var __setPropDict:Dictionary;
var superx:int;// = 0
var supery:int;// = 0
var bghsentry:chsentry;
var dead:Boolean;// = false
var tmrpressure:int;// = 0
var tombkillarray:Array;
var bginfo:cinfo;
var tombsoundchannel:SoundChannel;
var lazeron:Boolean;// = false
public var started:Boolean;// = false
public var oob:gno;
var copadvance:Boolean;// = false
var tmrcopspawn:int;// = 0
var holdingud:int;// = 0
public var bplay:gblank;
var tombcolorcounter:int;// = 0
var mintomb:int;// = 0
var soundarray:Array;
var tmrcombo:int;// = 0
var localstorage:SharedObject;
var tmruppede:int;// = 0
var copreserved:int;// = 0
var bghsview:chsview;
var next1up:int;// = 12000
var tmrmusic:int;// = 0
var combocounter:int;// = 0
var lastmx:int;// = 0
var lastmy:int;// = 0
public var highscorename:String;// = ""
var pedespeed:int;// = 0
var localscorearray:Array;
var pedearray:Array;
public var API_Settings:Object;
var scalpsoundchannel:SoundChannel;
var ricklvl:int;// = 2
var tmrtitle:int;// = 0
var carsoundchannel:SoundChannel;
public var billyad:FlashAd;
var pedechunk:int;// = 4
var tmrcomboflash:int;// = 0
var tmrdead:int;// = 0
var niceaim:int;// = 0
var scour:Number;// = 0
var lives:int;// = 0
var tombarray:Array;
var tmrrickspawn:int;// = 0
var bggameover:cgameover;
var shotsoundchannel:SoundChannel;
public var lazer:glazer;
var coptargety:int;// = 0
var roofieraise:int;// = 0
var mousecontrol:Boolean;// = true
public var tmr:Timer;
var underpressure:Boolean;// = false
var tmx:int;// = 0
var tmy:int;// = 0
var tmrupdate:int;// = 0
var mads:cmads;
var tmrroofiefreeze:int;// = 0
public var apicon:APIConnector;
var bgtitle:ctitle;
var dietersoundchannel:SoundChannel;
var donutbreak:Boolean;// = true
var tmrinfo:int;// = 0
var tmrroofie:int;// = 0
var bgupdate:cupdate;
var speedypede:int;// = 0
var cursorshow:Boolean;// = true
public var txtload:TextField;
var pausetmr:int;// = 0
var tmrlevelreload:int;// = 0
var holdinglmb:Boolean;// = false
var copchunk:int;// = 4
var disableweb:Boolean;// = false
var screenarray:Array;
var bglogo:clogo;
var copbypass:Boolean;// = false
var tmrrick:int;// = 0
var spawnedheads:int;// = 0
var ricksoundchannel:SoundChannel;
var medalsarray:Array;
var tmrmedal:int;// = 0
var holdinglr:int;// = 0
var level:int;// = 0
public var copscore:gcopscore;
var deadframe:int;// = 0
var tmrlazer:int;// = 0
var tmrrecoil:int;// = 0
var tmadx:int;// = 0
var tmady:int;// = 0
var deaddelay:int;// = 0
var bgplayfield:cplayfield;
public var txtplay:TextField;
var gamepaused:Boolean;// = false
var intertime:int;// = 0
var tmrpedeani:int;// = 0
var tmrcopscore:int;// = 0
public var blinder1:gblak;
public var blinder2:gblak;
var pedehuntergather:int;// = 50000
var antivenom:int;// = 0
var gravedamage:int;// = 0
var dietlvl:int;// = 2
var lazerframe:int;// = 0
var copkilla:int;// = 0
var lowscore:int;// = 0
var chargesoundchannel:SoundChannel;
var medalarray:Array;
var rscour:Number;// = 0
var tmrcop:int;// = 0
var tmrcarcheck:int;// = 0
var tmrpede:int;// = 0
var rlives:Number;// = 0
var bgstory:cstory;
var bgmsoundchannel:SoundChannel;
var gamestate:uint;// = 0
var tmrcarani:int;// = 0
var tmrtomb:int;// = 0
var tmrroofieani:int;// = 0
public var diet:cdieter;
var tombloop:int;// = 0
static const statehsview:uint = 7;
static const statestory:uint = 6;
static const keyspace:uint = 32;
static const stateloading:uint = 0;
static const keydown:uint = 40;
static const sfxdieter:uint = 11;
static const sfxcopcar:uint = 2;
static const statehsentry:uint = 3;
static const sfxlife:uint = 3;
static const stateupdate:uint = 10;
static const sfxcharge:uint = 10;
static const keyright:uint = 39;
static const sfxlazer:uint = 14;
static const sfxmusics:uint = 1;
static const statelogo:uint = 8;
static const stateinfo:uint = 4;
static const sfxmusic:uint = 0;
static const keyup:uint = 38;
static const sfxgameover:uint = 13;
static const stateinfo2:uint = 9;
static const stategameover:uint = 5;
static const keyc:uint = 67;
static const keyleft:uint = 37;
static const keyf:uint = 70;
static const sfxdead:uint = 8;
static const sfxrick:uint = 9;
static const statetitle:uint = 1;
static const sfxscalp:uint = 4;
static const keyp:uint = 80;
static const sfxtitle:uint = 12;
static const sfxhit:uint = 5;
static const sfxtomb:uint = 7;
static const keyx:uint = 88;
static const keyz:uint = 90;
static const stateplaying:uint = 2;
static const sfxshot:uint = 6;
public function humancentipede(){
__setPropDict = new Dictionary(true);
screenarray = new Array();
pedearray = new Array();
tombarray = new Array();
pedepurgearray = new Array();
tombhealarray = new Array();
tombkillarray = new Array();
bgmsoundchannel = new SoundChannel();
shotsoundchannel = new SoundChannel();
hitsoundchannel = new SoundChannel();
carsoundchannel = new SoundChannel();
tombsoundchannel = new SoundChannel();
scalpsoundchannel = new SoundChannel();
chargesoundchannel = new SoundChannel();
dietersoundchannel = new SoundChannel();
soundarray = new Array();
medalarray = new Array();
medalsarray = new Array();
ricksoundchannel = new SoundChannel();
localscorearray = new Array();
super();
addFrameScript(0, frame1, 1, frame2, 2, frame3);
Security.loadPolicyFile("http://www.rainbowcemetery.com/crossdomain.xml");
setInterval(RENDER, 0);
stage.addEventListener(KeyboardEvent.KEY_DOWN, userkeydown);
stage.addEventListener(KeyboardEvent.KEY_UP, userkeyup);
stage.addEventListener(MouseEvent.MOUSE_MOVE, usermousemove);
stage.addEventListener(MouseEvent.MOUSE_DOWN, usermouseclick);
stage.addEventListener(MouseEvent.MOUSE_UP, usermouseup);
API.addEventListener(APIEvent.MEDAL_UNLOCKED, onMedalUnlocked);
}
private function openHandler(_arg1:Event):void{
trace(("openHandler: " + _arg1));
}
function bblocaltoglobal(_arg1:DisplayObject):Rectangle{
var trec:Rectangle;
var arg:DisplayObject;
var obj = _arg1;
trec = new Rectangle(0, 0, 1, 1);
try {
trec = new Rectangle((obj.x + obj.bb.x), (obj.y + obj.bb.y), obj.bb.width, obj.bb.height);
} catch(error:Error) {
trace(obj.name);
};
return (trec);
}
function copcarani(){
var _local2:Rectangle;
var _local1:int;
if (bgplayfield.copcar.img.currentFrame < 3){
bgplayfield.copcar.x = (bgplayfield.copcar.x + (4 * bgplayfield.copcar.img.scaleX));
if ((bgplayfield.copcar.x % 24) == 0){
_local2 = bblocaltoglobal(bgplayfield.copcar);
_local1 = 0;
while (_local1 < tombarray.length) {
if ((((((((tombarray[_local1].id == "tomb")) && ((tombarray[_local1].x == _local2.x)))) && ((tombarray[_local1].y == _local2.y)))) && (tombarray[_local1].visible))){
tombarray[_local1].img.tomb.gotoAndStop((17 + tombcolorcounter));
donutbreak = false;
break;
};
_local1++;
};
};
if ((gtmr() - tmrcarani) >= 80){
if (bgplayfield.copcar.img.currentFrame == 1){
bgplayfield.copcar.img.nextFrame();
} else {
bgplayfield.copcar.img.prevFrame();
};
tmrcarani = gtmr();
};
if ((((bgplayfield.copcar.x < -72)) || ((bgplayfield.copcar.x > 600)))){
tmrcarcheck = gtmr();
bgplayfield.copcar.visible = false;
carsoundchannel.stop();
};
} else {
if ((gtmr() - tmrcarani) >= 40){
switch (bgplayfield.copcar.img.currentFrame){
case 3:
case 4:
case 5:
bgplayfield.copcar.img.nextFrame();
break;
case 6:
bgplayfield.copcar.visible = false;
bgplayfield.copcar.img.gotoAndStop(1);
tmrcarcheck = gtmr();
break;
};
tmrcarani = gtmr();
};
};
}
function madsytomb(_arg1:int, _arg2:Rectangle):int{
if ((((_arg1 <= 22)) && ((_arg1 > 0)))){
i = 500;
while (i <= 600) {
if (((tombarray[i].visible) && ((tombarray[i].id == "tomb")))){
if (_arg2.intersection(bblocaltoglobal(tombarray[i])).width > 5){
mads.y = (bblocaltoglobal(tombarray[i]).y - 42);
_arg1 = 0;
strucky = true;
break;
};
};
i++;
};
};
if ((((_arg1 >= -22)) && ((_arg1 < 0)))){
i = 500;
while (i <= 600) {
if (((tombarray[i].visible) && ((tombarray[i].id == "tomb")))){
if (_arg2.intersection(bblocaltoglobal(tombarray[i])).width > 5){
mads.y = (bblocaltoglobal(tombarray[i]).y + 6);
_arg1 = 0;
strucky = true;
break;
};
};
i++;
};
};
return (_arg1);
}
function usermouseclick(_arg1:MouseEvent){
if (((!(mousecontrol)) || (!((gamestate == stateplaying))))){
return;
};
holdinglmb = true;
}
function gatherlocalstorage(){
var _local1:int;
localstorage = SharedObject.getLocal("HUMAN-CENTIPEDE-THE-GAME");
if (localstorage.size > 0){
localscorearray = localstorage.data.localscore;
} else {
_local1 = 1;
while (_local1 <= 10) {
localscorearray.push({score:"0", name:"NUL"});
_local1++;
};
};
setlocalscores();
trace(localstorage.size);
}
function userkeyup(_arg1:KeyboardEvent){
if (gamestate == stateplaying){
switch (_arg1.keyCode){
case keyleft:
if (holdinglr == -1){
holdinglr = 0;
};
break;
case keyright:
if (holdinglr == 1){
holdinglr = 0;
};
break;
case keyup:
if (holdingud == -1){
holdingud = 0;
};
break;
case keydown:
if (holdingud == 1){
holdingud = 0;
};
break;
case keyspace:
holdingspace = false;
break;
case keyz:
holdingz = false;
break;
case keyx:
holdingx = false;
break;
};
};
}
function logoani(){
if ((gtmr() - bglogo.tmrlogo) >= 120){
switch (bglogo.logoframe){
case 1:
bglogo.bmock.visible = true;
bglogo.logo.alpha = (bglogo.logo.alpha + 0.2);
scoredest = "r1";
highscorerw("read");
gatherlocalstorage();
break;
case 0:
case 2:
case 3:
case 4:
case 27:
case 28:
case 29:
case 30:
case 31:
bglogo.logo.alpha = (bglogo.logo.alpha + 0.2);
break;
case 21:
case 22:
case 23:
case 24:
case 25:
case 48:
case 49:
case 50:
case 51:
case 52:
bglogo.logo.alpha = (bglogo.logo.alpha - 0.2);
if (bglogo.logoframe == 25){
bglogo.bmock.visible = false;
};
break;
case 26:
bglogo.logo.nextFrame();
break;
case 56:
flipmode("title");
};
bglogo.logoframe++;
bglogo.tmrlogo = gtmr();
};
}
public function unlockmedal(_arg1:String){
var _local2:Boolean;
var _local3:int;
if (bgstory.txtlazer.visible){
return;
};
_local2 = true;
_local3 = 0;
_local3 = 0;
while (_local3 < medalarray.length) {
if (_arg1 == medalarray[_local3]){
_local2 = false;
};
_local3++;
};
if (_local2){
API.unlockMedal(_arg1);
medalarray.push(_arg1);
};
}
function scalpani(){
var _local1:int;
bgplayfield.scalp.img.rotation = (bgplayfield.scalp.img.rotation + 15);
bgplayfield.scalp.y = (bgplayfield.scalp.y + 8);
if ((bgplayfield.scalp.y % 24) == 0){
_local1 = 0;
while (_local1 < tombarray.length) {
if ((((((((tombarray[_local1].id == "tomb")) && ((tombarray[_local1].x == bgplayfield.scalp.x)))) && ((tombarray[_local1].y == bgplayfield.scalp.y)))) && (!(tombarray[_local1].visible)))){
if (randm(1, 3) == 1){
tombarray[_local1].img.tomb.gotoAndStop((5 + tombcolorcounter));
tombarray[_local1].img.cover.gotoAndStop(1);
tombarray[_local1].visible = true;
};
break;
};
_local1++;
};
};
if (bgplayfield.scalp.y > 600){
bgplayfield.scalp.visible = false;
};
}
public function bplayover(_arg1:MouseEvent){
txtplay.textColor = 0xFF0000;
}
private function progressHandler(_arg1:ProgressEvent):void{
trace(((("progressHandler loaded:" + _arg1.bytesLoaded) + " total: ") + _arg1.bytesTotal));
}
function frame3(){
stop();
}
function r(_arg1:String):int{
var _local2 = -5;
switch (_arg1){
case "level":
_local2 = Math.floor((rlevel / 3.42));
break;
case "lives":
_local2 = Math.floor((rlives / 3.42));
break;
case "score":
_local2 = Math.floor((rscour / 3.42));
break;
};
if (_local2 == -5){
trace(_arg1);
};
return (_local2);
}
function frame2(){
nextFrame();
}
public function highscorerw(_arg1:String){
var request:URLRequest;
var namebuild:String;
var zoneeater:String;
var tscour:int;
var tei:int;
var txtin:String;
var rw = _arg1;
if (disableweb){
return;
};
var loader:URLLoader = new URLLoader();
configureListeners(loader);
var tdat:Date = new Date();
if (rw == "read"){
if (scoredest == "r1"){
request = new URLRequest(("http://www.rainbowcemetery.com/humancentipede/scores.php?filename=hcs/hcs.sco&scoresize=10&action=VIEW&viewtype=BBLL&jerktype=" + tdat.time));
} else {
if (scoredest == "r2"){
request = new URLRequest(("http://www.rainbowcemetery.com/humancentipede/scores.php?filename=hcs/hcsweek.sco&scoresize=10&action=VIEW&viewtype=BBLL&jerktype=" + tdat.time));
};
};
} else {
if (rw == "write"){
if (highscorename == "GAY"){
highscorename = "GAT";
};
if (highscorename == "FAG"){
highscorename = "FAT";
};
namebuild = "";
zoneeater = "";
tscour = 0;
tscour = r("score");
tei = 0;
while (tei < highscorename.length) {
zoneeater = highscorename.charAt(tei);
if (zoneeater == "&"){
zoneeater = "-";
};
namebuild = (namebuild + zoneeater);
tei = (tei + 1);
};
trace(namebuild);
if (scoredest == "w1"){
txtin = ((((("?filename=hcs/hcs.sco&scoresize=10&action=INSERT&winname=" + namebuild) + "&winscore=") + r("score")) + "&viewtype=BBLL&jerktype=") + tdat.time);
request = new URLRequest(("http://www.rainbowcemetery.com/humancentipede/scores.php" + txtin));
localscorearray.push({score:r("score"), name:highscorename});
localscorearray.sortOn("score", Array.NUMERIC);
localscorearray.reverse();
localscorearray.pop();
savelocalstorage();
} else {
if (scoredest == "w2"){
txtin = ((((("?filename=hcs/hcsweek.sco&scoresize=10&action=INSERT&winname=" + namebuild) + "&winscore=") + r("score")) + "&viewtype=BBLL&jerktype=") + tdat.time);
request = new URLRequest(("http://www.rainbowcemetery.com/humancentipede/scores.php" + txtin));
};
};
};
};
try {
loader.load(request);
} catch(error:Error) {
disableweb = true;
trace("Unable to load requested document.");
};
}
private function ioErrorHandler(_arg1:IOErrorEvent):void{
trace(("ioErrorHandler: " + _arg1));
disableweb = true;
}
function checkdeath(){
var _local4:Rectangle;
var _local5:Rectangle;
var _local1:int;
var _local2:Rectangle = bblocaltoglobal(mads);
var _local3:Boolean;
_local2.x = (_local2.x + 4);
_local2.y = (_local2.y + 4);
_local2.width = (_local2.width - 8);
_local2.height = (_local2.height - 8);
if (pedearray.length > 0){
_local1 = 0;
while (_local1 < pedearray.length) {
if (pedearray[_local1].visible){
_local5 = bblocaltoglobal(pedearray[_local1]);
bblocaltoglobal(pedearray[_local1]).x = (_local5.x - 24);
if (_local2.intersects(_local5)){
trace("pedestruck");
_local3 = true;
};
};
_local1++;
};
};
if (!_local3){
if (((bgplayfield.cop.visible) && ((bgplayfield.cop.img.currentFrame < 3)))){
_local4 = new Rectangle(bgplayfield.cop.x, bgplayfield.cop.y, 24, 24);
if (_local2.intersects(_local4)){
trace("copstruck");
_local3 = true;
};
};
};
if (!_local3){
if (bgplayfield.scalp.visible){
_local4 = bblocaltoglobal(bgplayfield.scalp);
if (_local2.intersects(_local4)){
trace("scalpstruck");
_local3 = true;
};
};
};
if (_local3){
bgmsoundchannel.stop();
scalpsoundchannel.stop();
carsoundchannel.stop();
ricksoundchannel.stop();
chargesoundchannel.stop();
dietersoundchannel.stop();
readyforrick = false;
playsound(sfxdead);
oob.visible = false;
bgplayfield.roofie.visible = false;
diet.visible = false;
scorebar.txtcombo.visible = false;
dead = true;
deaddelay = 80;
deadframe = 0;
unhold();
tmrdead = gtmr();
};
}
public function playsound(_arg1:int){
var _local2:SoundTransform;
var _local3:SoundChannel;
_local2 = new SoundTransform(1, 0);
switch (_arg1){
case 0:
case 1:
bgmsoundchannel.stop();
bgmsoundchannel = soundarray[_arg1].play(0, 999999999, _local2);
break;
case 2:
carsoundchannel.stop();
carsoundchannel = soundarray[_arg1].play(0, 999999999, _local2);
break;
case 3:
case 8:
case 12:
case 13:
case 14:
_local3 = soundarray[_arg1].play(0, 0, _local2);
break;
case 4:
scalpsoundchannel.stop();
scalpsoundchannel = soundarray[_arg1].play(0, 0, _local2);
break;
case 5:
hitsoundchannel.stop();
hitsoundchannel = soundarray[_arg1].play(0, 0, _local2);
break;
case 6:
shotsoundchannel.stop();
shotsoundchannel = soundarray[_arg1].play(0, 0, _local2);
break;
case 7:
tombsoundchannel.stop();
tombsoundchannel = soundarray[_arg1].play(0, tombloop, _local2);
break;
case 9:
ricksoundchannel.stop();
ricksoundchannel = soundarray[_arg1].play(0, 999999999, _local2);
break;
case 10:
chargesoundchannel.stop();
chargesoundchannel = soundarray[_arg1].play(0, 0, _local2);
break;
case 11:
chargesoundchannel.stop();
dietersoundchannel.stop();
dietersoundchannel = soundarray[_arg1].play(0, 999999999, _local2);
break;
};
}
function frame1(){
if ((((__setPropDict[apicon] == undefined)) || (!((int(__setPropDict[apicon]) == 1))))){
__setPropDict[apicon] = 1;
__setProp_apicon_Scene1_Layer1_0();
};
stop();
stage.scaleMode = StageScaleMode.SHOW_ALL;
API_Settings = {movie_id:"12160:5eSmfRME", enc_key:"gudWOWvucnlyafAGPlkWTyQPlsoJMizf", movie_version:"1"};
txtload.mouseWheelEnabled = false;
txtplay.mouseWheelEnabled = false;
txtplay.textColor = 0xFFFFFF;
txtplay.visible = false;
bplay.visible = false;
bplay.buttonMode = true;
bplay.addEventListener(MouseEvent.CLICK, bplayclick);
bplay.addEventListener(MouseEvent.MOUSE_OVER, bplayover);
bplay.addEventListener(MouseEvent.MOUSE_OUT, bplayout);
tmr = new Timer(0);
tmr.addEventListener(TimerEvent.TIMER, loading);
tmr.start();
}
function usermousemove(_arg1:MouseEvent){
var _local2:Boolean;
tmx = _arg1.stageX;
tmy = _arg1.stageY;
if (((((((!(mousecontrol)) || (!((gamestate == stateplaying))))) || (gamepaused))) || (dead))){
return;
};
var _local3:* = false;
if (!_local3){
mads.x = ((_arg1.stageX - 14) - 24);
mads.y = (_arg1.stageY - 18);
if (mads.x < 0){
mads.x = 0;
_local2 = true;
};
if (mads.x > 572){
mads.x = 572;
_local2 = true;
};
if (mads.y < 462){
mads.y = 462;
_local2 = true;
};
if (mads.y > 558){
mads.y = 558;
_local2 = true;
};
if (lazeron){
lazer.x = (mads.x + 44);
lazer.y = mads.y;
};
if (((_local2) && (cursorshow))){
oob.x = _arg1.stageX;
oob.y = _arg1.stageY;
oob.visible = true;
} else {
oob.visible = false;
};
};
if (_arg1.stageY > 390){
};
lastmx = _arg1.stageX;
lastmy = _arg1.stageY;
}
function fakoscore(_arg1:int){
var _local2:String;
_local2 = "";
scour = (scour + _arg1);
_local2 = (scour + "");
if (_local2.length > 6){
_local2 = _local2.substr((_local2.length - 6), 6);
};
scorebar.txtscore.text = _local2;
}
function madsxtomb(_arg1:int, _arg2:Rectangle):int{
var _local3:int;
if ((((_arg1 <= 22)) && ((_arg1 > 0)))){
_local3 = 500;
while (_local3 <= 600) {
if (((tombarray[_local3].visible) && ((tombarray[_local3].id == "tomb")))){
if (_arg2.intersection(bblocaltoglobal(tombarray[_local3])).width > 5){
mads.x = (bblocaltoglobal(tombarray[_local3]).x - 26);
_arg1 = 0;
struckx = true;
break;
};
};
_local3++;
};
};
if ((((_arg1 >= -22)) && ((_arg1 < 0)))){
_local3 = 500;
while (_local3 <= 600) {
if (((tombarray[_local3].visible) && ((tombarray[_local3].id == "tomb")))){
if (_arg2.intersection(bblocaltoglobal(tombarray[_local3])).width > 5){
mads.x = (bblocaltoglobal(tombarray[_local3]).x + 22);
_arg1 = 0;
struckx = true;
break;
};
};
_local3++;
};
};
return (_arg1);
}
function shotani(){
var _local3:Rectangle;
var _local6:Rectangle;
var _local1:int;
var _local2:int;
var _local4:Boolean;
var _local5:Array = new Array();
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:Boolean;
var _local11:Boolean;
var _local12:int;
var _local13:Boolean;
var _local14:int;
bgplayfield.shot.y = (bgplayfield.shot.y - 12);
if (bgplayfield.shot.y <= -16){
bgplayfield.shot.visible = false;
_local13 = true;
};
_local3 = new Rectangle(bgplayfield.shot.x, bgplayfield.shot.y, 2, 12);
if (((bgplayfield.shot.visible) && (diet.visible))){
if (bgplayfield.shot.hitTestObject(diet)){
playsound(sfxlazer);
dieterlazer = true;
bgplayfield.shot.visible = false;
diet.visible = false;
};
};
if (((((bgplayfield.shot.visible) && (bgplayfield.rick.visible))) && ((bgplayfield.rick.img.currentFrame < 5)))){
if (bgplayfield.shot.hitTestObject(bgplayfield.rick)){
bgplayfield.shot.visible = false;
unlockmedal("Together Forever");
changescore(5000);
bgplayfield.rick.img.gotoAndStop(5);
tmrrick = gtmr();
ricksoundchannel.stop();
};
};
if (((((bgplayfield.shot.visible) && (bgplayfield.copcar.visible))) && ((bgplayfield.copcar.img.currentFrame < 3)))){
if (bgplayfield.shot.hitTestObject(bgplayfield.copcar)){
bgplayfield.copcar.img.gotoAndStop(3);
bgplayfield.shot.visible = false;
tmrcarani = gtmr();
if (donutbreak){
unlockmedal("Donut Break");
};
changescore(1000);
carsoundchannel.stop();
};
};
if (((((bgplayfield.shot.visible) && (bgplayfield.cop.visible))) && ((bgplayfield.cop.img.currentFrame < 3)))){
if (bgplayfield.shot.hitTestObject(bgplayfield.cop)){
bgplayfield.cop.img.gotoAndStop(3);
bgplayfield.shot.visible = false;
tmrcopani = gtmr();
if (bgplayfield.cop.y >= 528){
_local14 = 900;
} else {
_local14 = (900 - ((528 - bgplayfield.cop.y) * 6));
if (_local14 < 500){
_local14 = 300;
};
};
if ((((_local14 >= 500)) && ((_local14 < 850)))){
_local14 = 600;
};
if (_local14 > 600){
_local14 = 900;
};
if (_local14 == 900){
if (!bgstory.txtlazer.visible){
copkilla++;
};
if (copkilla == 10){
unlockmedal("Cop Killa");
};
};
changescore(_local14);
copscore.txt.text = (_local14 + "");
copscore.x = (bgplayfield.cop.x + 24);
copscore.y = bgplayfield.cop.y;
tmrcopscore = gtmr();
copscore.visible = true;
playsound(sfxmusic);
};
};
if (((bgplayfield.shot.visible) && (bgplayfield.scalp.visible))){
if (_local3.intersects(bblocaltoglobal(bgplayfield.scalp))){
bgplayfield.scalp.visible = false;
bgplayfield.shot.visible = false;
changescore(200);
scalpsoundchannel.stop();
if (!bgstory.txtlazer.visible){
niceaim++;
};
if (niceaim == 10){
unlockmedal("Nice Aim");
};
};
};
if (((bgplayfield.shot.visible) && (bgplayfield.roofie.visible))){
if (bgplayfield.shot.hitTestObject(bgplayfield.roofie)){
bgplayfield.roofie.visible = false;
bgplayfield.shot.visible = false;
tmrroofie = gtmr();
if (pedespeed <= 20){
pedespeed = 40;
} else {
pedespeed = 60;
};
roofieraise++;
if (roofieraise >= 3){
unlockmedal("Raise The Roofie");
};
changescore(1500);
};
};
if (bgplayfield.shot.visible){
_local1 = (tombarray.length - 1);
while (_local1 >= 0) {
if (((tombarray[_local1].visible) && ((tombarray[_local1].id == "tomb")))){
if (tombarray[_local1].img.cover.currentFrame < 5){
if (_local3.intersects(bblocaltoglobal(tombarray[_local1]))){
tombarray[_local1].img.cover.nextFrame();
if (tombarray[_local1].img.cover.currentFrame == 5){
tombarray[_local1].visible = false;
ruinedtombs++;
if (tombarray[_local1].img.tomb.currentFrame >= 17){
if (!bgstory.txtlazer.visible){
antivenom++;
};
if (antivenom == 20){
unlockmedal("Antivenom");
};
} else {
if (!bgstory.txtlazer.visible){
gravedamage++;
};
if (gravedamage == 100){
unlockmedal("Grave Damage");
};
};
if (ruinedtombs >= 20){
_local5 = new Array();
_local2 = 0;
while (_local2 < tombarray.length) {
if (((!(tombarray[_local2].visible)) && ((tombarray[_local2].id == "tomb")))){
_local5.push(tombarray[_local2]);
};
_local2++;
};
if (_local5.length > 0){
_local12 = randm(0, (_local5.length - 1));
bgplayfield.roofie.x = tombarray[_local12].x;
bgplayfield.roofie.y = tombarray[_local12].y;
tmrroofie = gtmr();
bgplayfield.roofie.visible = true;
};
ruinedtombs = 0;
};
tombarray[_local1].img.cover.gotoAndStop(1);
changescore(1);
};
bgplayfield.shot.visible = false;
break;
};
};
};
_local1--;
};
};
if (bgplayfield.shot.visible){
_local1 = (pedearray.length - 1);
while (_local1 >= 0) {
if (((((((bgplayfield.shot.hitTestObject(pedearray[_local1])) && (pedearray[_local1].visible))) && ((pedearray[_local1].y >= 0)))) && (bgplayfield.shot.visible))){
bgplayfield.shot.visible = false;
pedearray[_local1].visible = false;
if (pedearray[_local1].specialchunk == 16){
if (!bgstory.txtlazer.visible){
speedypede++;
};
if (speedypede == 5){
unlockmedal("Speedy Pedey");
};
};
_local6 = new Rectangle((pedearray[_local1].x - 24), pedearray[_local1].y, 38, 24);
_local4 = true;
_local9 = pedearray[_local1].idnum;
pedepurgearray.push(pedearray[_local1]);
pedearray.splice(_local1, 1);
tmrlevelreload = gtmr();
break;
};
_local1--;
};
if (_local4){
_local1 = 0;
while (_local1 < pedearray.length) {
if (pedearray[_local1].idnum == (_local9 + 1)){
_local10 = false;
};
_local1++;
};
if (_local10){
changescore(100);
} else {
changescore(10);
};
_local1 = 0;
while (_local1 < tombarray.length) {
if ((((((tombarray[_local1].id == "tomb")) && (!(tombarray[_local1].visible)))) && (_local6.intersects(bblocaltoglobal(tombarray[_local1]))))){
tombarray[_local1].inter = _local6.intersection(bblocaltoglobal(tombarray[_local1]));
_local5.push(tombarray[_local1]);
};
_local1++;
};
if (_local5.length == 0){
trace("no tomb available");
} else {
if (_local5.length == 1){
_local5[0].img.cover.gotoAndStop(1);
_local5[0].img.tomb.gotoAndStop(1);
_local5[0].visible = true;
} else {
_local1 = 0;
while (_local1 < _local5.length) {
if ((_local5[_local1].inter.width * _local5[_local1].inter.height) > _local7){
_local7 = (_local5[_local1].inter.width * _local5[_local1].inter.height);
_local8 = _local5[_local1].idnum;
};
_local1++;
};
tombarray[_local8].img.cover.gotoAndStop(1);
tombarray[_local8].img.tomb.gotoAndStop(1);
tombarray[_local8].visible = true;
};
};
};
};
if (((!(bgplayfield.shot.visible)) && (!(_local13)))){
playsound(sfxhit);
};
}
function savelocalstorage(){
localstorage.data.localscore = localscorearray;
var flushStatus:String;
try {
flushStatus = localstorage.flush();
} catch(error:Error) {
trace("Error...Could not write SharedObject to disk");
};
if (flushStatus != null){
switch (flushStatus){
case SharedObjectFlushStatus.PENDING:
trace("Requesting permission to save object..");
localstorage.addEventListener(NetStatusEvent.NET_STATUS, onFlushStatus);
break;
case SharedObjectFlushStatus.FLUSHED:
trace("Value flushed to disk");
break;
};
};
setlocalscores();
}
public function bplayclick(_arg1:MouseEvent){
humancentipede(root).started = true;
apicon.visible = false;
billyad.visible = false;
}
private function onFlushStatus(_arg1:NetStatusEvent):void{
trace("User closed permission dialog...");
switch (_arg1.info.code){
case "SharedObject.Flush.Success":
trace("User granted permission -- value saved.");
break;
case "SharedObject.Flush.Failed":
trace("User denied permission -- value not saved.");
break;
};
localstorage.removeEventListener(NetStatusEvent.NET_STATUS, onFlushStatus);
}
function tombgenerate(){
var _local5:ctombandcover;
var _local1:int = randm(45, 55);
var _local2:int;
var _local3:Array = new Array();
var _local4:int;
var _local6:Boolean;
_local2 = 0;
while (_local2 < tombarray.length) {
if (tombarray[_local2].id == "tomb"){
tombarray[_local2].visible = false;
};
_local2++;
};
_local2 = 0;
while (_local2 < 599) {
_local3.push(_local2);
_local2++;
};
_local2 = 0;
while (_local2 < _local1) {
_local4 = randm(0, (_local3.length - 1));
_local5 = tombarray[_local3[_local4]];
_local5.img.tomb.gotoAndStop(5);
_local5.img.cover.gotoAndStop(1);
_local5.visible = true;
_local3.splice(_local4, 1);
_local2++;
};
}
function changelife(_arg1:int){
rlives = (rlives + (_arg1 * 3.42));
lives = r("lives");
if (r("lives") < 0){
if (r("score") > lowscore){
bghsentry.txtscore.text = (r("score") + "");
bghsentry.txtname.text = "";
flipmode("hsentry");
} else {
scoredest = "r1";
highscorerw("read");
flipmode("gameover");
};
} else {
if (_arg1 < 0){
changelevel(-1);
levelup();
} else {
if (_arg1 > 0){
playsound(sfxlife);
};
};
};
switch (lives){
case 0:
scorebar.life1.visible = false;
scorebar.life2.visible = false;
scorebar.life3.visible = false;
scorebar.life4.visible = false;
break;
case 1:
scorebar.life1.visible = true;
scorebar.life2.visible = false;
scorebar.life3.visible = false;
scorebar.life4.visible = false;
break;
case 2:
scorebar.life1.visible = true;
scorebar.life2.visible = true;
scorebar.life3.visible = false;
scorebar.life4.visible = false;
break;
case 3:
scorebar.life1.visible = true;
scorebar.life2.visible = true;
scorebar.life3.visible = true;
scorebar.life4.visible = false;
break;
case 4:
scorebar.life1.visible = true;
scorebar.life2.visible = true;
scorebar.life3.visible = true;
scorebar.life4.visible = true;
break;
};
}
function pausetoggle(){
if (!gamepaused){
gamepaused = true;
pausetmr = getTimer();
scalpsoundchannel.stop();
bgmsoundchannel.stop();
ricksoundchannel.stop();
carsoundchannel.stop();
chargesoundchannel.stop();
dietersoundchannel.stop();
} else {
intertime = (intertime + (getTimer() - pausetmr));
gamepaused = false;
if (((bgplayfield.rick.visible) && ((bgplayfield.rick.img.currentFrame < 5)))){
playsound(sfxrick);
};
if (bgplayfield.cop.visible){
playsound(sfxmusics);
} else {
playsound(sfxmusic);
};
if (bgplayfield.copcar.visible){
playsound(sfxcopcar);
};
if (((((lazeron) && ((lazerframe >= 23)))) && ((lazerframe < 105)))){
playsound(sfxdieter);
};
};
}
function unhold(){
holdingz = false;
holdingx = false;
holdingspace = false;
holdinglmb = false;
holdingud = 0;
holdinglr = 0;
}
function changescore(_arg1:int){
var _local2:String;
var _local3:Boolean;
if (bgstory.txtlazer.visible){
fakoscore(_arg1);
return;
};
_local2 = "";
_local3 = false;
if (scour != r("score")){
rscour = 0;
scour = 0;
} else {
rscour = (rscour + (_arg1 * 3.42));
scour = r("score");
if ((((r("score") >= next1up)) && ((next1up <= 300000)))){
changelife(1);
next1up = (next1up + 12000);
};
if (r("score") >= pedehuntergather){
if (pedehuntergather == 50000){
unlockmedal("Pede Gatherer");
pedehuntergather = 100000;
} else {
if (pedehuntergather == 100000){
unlockmedal("Pede Master");
pedehuntergather = 1000000;
};
};
};
if (scour > hiscore){
_local3 = true;
};
};
_local2 = (scour + "");
if (_local2.length > 6){
_local2 = _local2.substr((_local2.length - 6), 6);
};
if (_local3){
scorebar.txthigh.text = _local2;
hiscore = scour;
};
scorebar.txtscore.text = _local2;
}
function devisible(){
var _local1:int;
_local1 = 0;
while (_local1 < screenarray.length) {
screenarray[_local1].visible = false;
_local1++;
};
scorebar.visible = false;
}
public function bplayout(_arg1:MouseEvent){
if (currentFrame == 1){
txtplay.textColor = 0xFFFFFF;
};
}
function pedeani(){
var _local6:Rectangle;
var _local7:Rectangle;
var _local1:int;
var _local2:int;
var _local3:int;
var _local4 = 2;
var _local5 = 1;
var _local8 = 7;
var _local9:int;
var _local10:Boolean;
var _local11:int = pedechunk;
var _local12:Boolean;
var _local13:Boolean;
switch (pedechunk){
case 4:
_local8 = 7;
break;
case 8:
_local8 = 3;
break;
case 16:
_local8 = 1;
break;
case 32:
_local8 = 1;
break;
};
_local1 = 0;
while (_local1 < pedearray.length) {
if (pedearray[_local1].specialchunk > 0){
_local11 = pedearray[_local1].specialchunk;
} else {
_local11 = pedechunk;
};
if (((!(pedearray[_local1].turn)) && (((!(pedearray[_local1].omegaturn)) || ((pedearray[_local1].y == 576)))))){
pedearray[_local1].x = (pedearray[_local1].x + (_local11 * pedearray[_local1].img.scaleX));
if ((((((pedearray[_local1].x < -100)) && ((pedearray[_local1].y > -24)))) || ((pedearray[_local1].x > 700)))){
trace(((((("purging wanderman " + pedearray[_local1].idnum) + " x:") + pedearray[_local1].x) + " y:") + pedearray[_local1].y));
pedearray[_local1].visible = false;
};
skiptomb = false;
_local3 = 0;
while (_local3 < pedearray.length) {
if ((((((pedearray[_local3].idnum == (pedearray[_local1].idnum + 1))) && (((pedearray[_local3].turn) || (pedearray[_local3].omegaturn))))) && (pedearray[_local3].hitTestObject(pedearray[_local1])))){
skiptomb = true;
};
_local3++;
};
if (pedechunk > 8){
skiptomb = false;
};
if (!skiptomb){
_local2 = 0;
while (_local2 < tombarray.length) {
if (tombarray[_local2].visible){
if (tombarray[_local2].id == "blank"){
_local6 = new Rectangle(tombarray[_local2].x, tombarray[_local2].y, tombarray[_local2].width, tombarray[_local2].height);
} else {
_local6 = new Rectangle(tombarray[_local2].x, tombarray[_local2].y, 24, 24);
};
_local7 = bblocaltoglobal(pedearray[_local1]);
bblocaltoglobal(pedearray[_local1]).x = (_local7.x - 24);
if (((_local7.intersects(_local6)) && ((pedearray[_local1].idnum > -10)))){
if ((((((pedearray[_local1].img.scaleX == 1)) && (((_local7.x + 24) > _local6.x)))) || ((((pedearray[_local1].img.scaleX == -1)) && (((_local7.x + 4) < _local6.x)))))){
} else {
if ((((((tombarray[_local2].id == "blank")) && ((tombarray[_local2].idnum == 1)))) && ((pedearray[_local1].img.scaleX == 1)))){
_local12 = true;
};
if ((((((tombarray[_local2].id == "blank")) && ((tombarray[_local2].idnum == 2)))) && ((pedearray[_local1].img.scaleX == -1)))){
_local13 = true;
};
if (((!(_local12)) && (!(_local13)))){
if ((((tombarray[_local2].id == "tomb")) && ((tombarray[_local2].img.tomb.currentFrame >= 17)))){
pedearray[_local1].omegaturn = true;
} else {
pedearray[_local1].turn = true;
};
pedearray[_local1].turnframe = 0;
pedearray[_local1].bounceimmune = false;
if (pedearray[_local1].y >= 576){
pedearray[_local1].dir = -1;
if (((!(pedearray[_local1].omegaturn)) && (!(underpressure)))){
tmrpressure = gtmr();
underpressure = true;
};
pedearray[_local1].omegaturn = false;
} else {
if ((((pedearray[_local1].y <= 480)) && ((pedearray[_local1].dir == -1)))){
pedearray[_local1].dir = 1;
};
};
break;
};
};
};
};
_local2++;
};
};
if (((!(pedearray[_local1].turn)) && (!(pedearray[_local1].omegaturn)))){
_local3 = 0;
while (_local3 < pedearray.length) {
if ((((((pedearray[_local3].idnum == (pedearray[_local1].idnum + 1))) && ((pedearray[_local3].turnframe == _local8)))) && (pedearray[_local3].hitTestObject(pedearray[_local1])))){
pedearray[_local1].turn = true;
pedearray[_local1].turnframe = 0;
pedearray[_local1].bounceimmune = false;
if (pedearray[_local1].y >= 576){
pedearray[_local1].dir = -1;
if (((!(pedearray[_local1].omegaturn)) && (!(underpressure)))){
tmrpressure = gtmr();
underpressure = true;
};
pedearray[_local1].omegaturn = false;
} else {
if ((((pedearray[_local1].y <= 480)) && ((pedearray[_local1].dir == -1)))){
pedearray[_local1].dir = 1;
};
};
break;
};
_local3++;
};
};
if (((!(pedearray[_local1].turn)) && (!(pedearray[_local1].omegaturn)))){
_local10 = true;
_local3 = 0;
while (_local3 < pedearray.length) {
if (pedearray[_local3].idnum == (pedearray[_local1].idnum + 1)){
_local10 = false;
};
_local3++;
};
if (_local10){
_local3 = 0;
while (_local3 < pedearray.length) {
idpass = false;
if ((((((pedearray[_local3].idnum <= (pedearray[_local1].idnum - 2))) || ((pedearray[_local3].idnum >= (pedearray[_local1].idnum + 2))))) || ((((pedearray[_local1].idnum == -3)) && (!((_local1 == _local3))))))){
idpass = true;
};
if (((((idpass) && (!(pedearray[_local3].turn)))) && (!(pedearray[_local3].omegaturn)))){
if (((((((pedearray[_local1].hitTestObject(pedearray[_local3])) && ((pedearray[_local1].y == pedearray[_local3].y)))) && (!(pedearray[_local1].bounceimmune)))) && ((pedearray[_local1].img.scaleX == pedearray[_local3].img.scaleX)))){
pedearray[_local1].turn = true;
pedearray[_local1].turnframe = 0;
pedearray[_local1].bounceimmune = true;
pedearray[_local3].bounceimmune = true;
if (pedearray[_local1].y >= 576){
pedearray[_local1].dir = -1;
if (((!(pedearray[_local1].omegaturn)) && (!(underpressure)))){
tmrpressure = gtmr();
underpressure = true;
};
pedearray[_local1].omegaturn = false;
} else {
if ((((pedearray[_local1].y <= 480)) && ((pedearray[_local1].dir == -1)))){
pedearray[_local1].dir = 1;
};
};
break;
};
};
_local3++;
};
};
};
} else {
if (((pedearray[_local1].turn) || (((pedearray[_local1].omegaturn) && ((pedearray[_local1].y < 576)))))){
_local5 = pedearray[_local1].dir;
if (_local11 == 4){
_local4 = (2 * _local5);
switch (pedearray[_local1].turnframe){
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation + ((15 * pedearray[_local1].img.scaleX) * _local5));
pedearray[_local1].y = (pedearray[_local1].y + _local4);
break;
case 6:
pedearray[_local1].img.scaleX = (pedearray[_local1].img.scaleX * -1);
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation * -1);
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation + ((15 * (pedearray[_local1].img.scaleX * -1)) * _local5));
pedearray[_local1].y = (pedearray[_local1].y + _local4);
break;
case 7:
case 8:
case 9:
case 10:
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation + ((15 * (pedearray[_local1].img.scaleX * -1)) * _local5));
pedearray[_local1].y = (pedearray[_local1].y + _local4);
break;
case 11:
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation + ((15 * (pedearray[_local1].img.scaleX * -1)) * _local5));
pedearray[_local1].y = (pedearray[_local1].y + _local4);
pedearray[_local1].turn = false;
if (!pedearray[_local1].omegaturn){
pedearray[_local1].turnframe = -1;
};
break;
case 12:
pedearray[_local1].x = (pedearray[_local1].x + (_local11 * pedearray[_local1].img.scaleX));
pedearray[_local1].turnframe = -1;
break;
};
} else {
if (_local11 == 8){
_local4 = (4 * _local5);
switch (pedearray[_local1].turnframe){
case 0:
case 1:
case 2:
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation + ((30 * pedearray[_local1].img.scaleX) * _local5));
pedearray[_local1].y = (pedearray[_local1].y + _local4);
break;
case 3:
pedearray[_local1].img.scaleX = (pedearray[_local1].img.scaleX * -1);
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation * -1);
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation + ((30 * (pedearray[_local1].img.scaleX * -1)) * _local5));
pedearray[_local1].y = (pedearray[_local1].y + _local4);
break;
case 4:
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation + ((30 * (pedearray[_local1].img.scaleX * -1)) * _local5));
pedearray[_local1].y = (pedearray[_local1].y + _local4);
break;
case 5:
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation + ((30 * (pedearray[_local1].img.scaleX * -1)) * _local5));
pedearray[_local1].y = (pedearray[_local1].y + _local4);
pedearray[_local1].turn = false;
if (!pedearray[_local1].omegaturn){
pedearray[_local1].turnframe = -1;
};
break;
case 6:
pedearray[_local1].x = (pedearray[_local1].x + (_local11 * pedearray[_local1].img.scaleX));
pedearray[_local1].turnframe = -1;
break;
};
} else {
if (_local11 == 12){
_local4 = (6 * _local5);
switch (pedearray[_local1].turnframe){
case 0:
case 1:
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation + ((45 * pedearray[_local1].img.scaleX) * _local5));
pedearray[_local1].y = (pedearray[_local1].y + _local4);
break;
case 2:
pedearray[_local1].img.scaleX = (pedearray[_local1].img.scaleX * -1);
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation * -1);
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation + ((45 * (pedearray[_local1].img.scaleX * -1)) * _local5));
pedearray[_local1].y = (pedearray[_local1].y + _local4);
break;
case 3:
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation + ((45 * (pedearray[_local1].img.scaleX * -1)) * _local5));
pedearray[_local1].y = (pedearray[_local1].y + _local4);
pedearray[_local1].turn = false;
if (!pedearray[_local1].omegaturn){
pedearray[_local1].turnframe = -1;
};
break;
case 4:
pedearray[_local1].x = (pedearray[_local1].x + (_local11 * pedearray[_local1].img.scaleX));
pedearray[_local1].turnframe = -1;
break;
};
} else {
if (_local11 == 16){
_local4 = (8 * _local5);
switch (pedearray[_local1].turnframe){
case 0:
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation + ((90 * pedearray[_local1].img.scaleX) * _local5));
pedearray[_local1].y = (pedearray[_local1].y + _local4);
break;
case 1:
pedearray[_local1].img.scaleX = (pedearray[_local1].img.scaleX * -1);
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation * -1);
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation + ((45 * (pedearray[_local1].img.scaleX * -1)) * _local5));
pedearray[_local1].y = (pedearray[_local1].y + _local4);
break;
case 2:
pedearray[_local1].img.rotation = (pedearray[_local1].img.rotation + ((45 * (pedearray[_local1].img.scaleX * -1)) * _local5));
pedearray[_local1].y = (pedearray[_local1].y + _local4);
pedearray[_local1].turn = false;
if (!pedearray[_local1].omegaturn){
pedearray[_local1].turnframe = -1;
};
break;
case 3:
pedearray[_local1].x = (pedearray[_local1].x + (_local11 * pedearray[_local1].img.scaleX));
pedearray[_local1].turnframe = -1;
break;
};
};
};
};
};
pedearray[_local1].turnframe++;
};
};
_local1++;
};
_local1 = (pedearray.length - 1);
while (_local1 >= 0) {
if (!pedearray[_local1].visible){
pedepurgearray.push(pedearray[_local1]);
pedearray.splice(_local1, 1);
};
_local1--;
};
}
function deadani(){
var _local1:int;
var _local2 = 17;
switch (deadframe){
case 0:
mads.img.gotoAndStop(3);
break;
case 1:
case 2:
case 3:
mads.img.nextFrame();
break;
case 16:
_local1 = (pedearray.length - 1);
while (_local1 >= 0) {
pedearray[_local1].visible = false;
pedepurgearray.push(pedearray[_local1]);
pedearray.splice(_local1, 1);
_local1--;
};
lazer.visible = false;
if (!bgstory.txtlazer.visible){
dieterlazer = false;
};
lazeron = false;
bgplayfield.shot.visible = false;
bgplayfield.cop.visible = false;
bgplayfield.copcar.visible = false;
bgplayfield.scalp.visible = false;
bgplayfield.rick.visible = false;
copscore.visible = false;
underpressure = false;
tombhealarray = new Array();
_local1 = 0;
while (_local1 < tombarray.length) {
if (((tombarray[_local1].visible) && ((tombarray[_local1].id == "tomb")))){
if ((((tombarray[_local1].img.cover.currentFrame > 1)) || ((tombarray[_local1].img.tomb.currentFrame >= 17)))){
tombhealarray.push(tombarray[_local1]);
};
};
_local1++;
};
deaddelay = 133;
break;
};
if (deadframe >= _local2){
if ((((deadframe == _local2)) && ((tombhealarray.length > 0)))){
tombloop = tombhealarray.length;
playsound(sfxtomb);
};
if ((deadframe - _local2) < tombhealarray.length){
if (tombhealarray[(deadframe - _local2)].img.tomb.currentFrame >= 17){
tombhealarray[(deadframe - _local2)].visible = false;
tombhealarray[(deadframe - _local2)].img.cover.gotoAndStop(1);
tombhealarray[(deadframe - _local2)].img.tomb.gotoAndStop(1);
} else {
tombhealarray[(deadframe - _local2)].img.cover.gotoAndStop(1);
};
changescore(5);
} else {
if ((deadframe - _local2) == tombhealarray.length){
};
};
};
deadframe++;
}
private function randm(_arg1:int, _arg2:int):int{
return (Math.floor(((((_arg2 - _arg1) + 1) * Math.random()) + _arg1)));
}
function init(){
var _local1:int;
soundarray.push(new smusic());
soundarray.push(new smusics());
soundarray.push(new scopcar());
soundarray.push(new slife());
soundarray.push(new sscalp());
soundarray.push(new shit());
soundarray.push(new sshot());
soundarray.push(new stomb());
soundarray.push(new sdead());
soundarray.push(new srick());
soundarray.push(new scharge());
soundarray.push(new sdieter());
soundarray.push(new sttitle());
soundarray.push(new stgameover());
soundarray.push(new stlazer());
screenarray.push((bgplayfield = new cplayfield()));
screenarray.push((bgtitle = new ctitle()));
screenarray.push((bginfo = new cinfo()));
screenarray.push((bggameover = new cgameover()));
screenarray.push((bgstory = new cstory()));
screenarray.push((bghsview = new chsview()));
screenarray.push((bglogo = new clogo()));
screenarray.push((bghsentry = new chsentry()));
screenarray.push((bginfo2 = new cinfo2()));
screenarray.push((bgupdate = new cupdate()));
_local1 = 0;
while (_local1 < screenarray.length) {
addChild(screenarray[_local1]);
screenarray[_local1].x = 24;
_local1++;
};
flipmode("logo");
}
private function scoredld(_arg1:Event):void{
var _local5:String;
var _local2:URLLoader = URLLoader(_arg1.target);
var _local3:int;
trace(("completeHandler: " + _local2.data));
var _local4:String = _local2.data;
var _local6 = "";
scorearray = new Array();
scorenamesarray = new Array();
_local3 = 0;
while (_local3 < _local4.length) {
_local5 = _local4.charAt(_local3);
if (_local5 != null){
if (_local5 == "-"){
_local5 = "&";
};
if (_local5 == "<"){
scorearray.push(_local6);
_local6 = "";
} else {
if (_local5 == ">"){
scorenamesarray.push(_local6);
_local6 = "";
} else {
_local6 = (_local6 + _local5);
};
};
};
_local3++;
};
if ((((scoredest == "w1")) || ((scoredest == "r1")))){
lowscore = scorearray[(scorearray.length - 1)];
scorebar.txthigh.text = (scorearray[0] + "");
hiscore = scorearray[0];
bghsview.txtname.text = "";
bghsview.txtscore.text = "";
_local3 = 0;
while (_local3 < scorearray.length) {
bghsview.txtname.appendText((scorenamesarray[_local3].toUpperCase() + "\n"));
bghsview.txtscore.appendText((scorearray[_local3] + "\n"));
_local3++;
};
if (scoredest == "w1"){
scoredest = "w2";
highscorerw("write");
} else {
if (scoredest == "r1"){
scoredest = "r2";
highscorerw("read");
};
};
} else {
if ((((scoredest == "w2")) || ((scoredest == "r2")))){
bghsview.txtweekname.text = "";
bghsview.txtweekscore.text = "";
_local3 = 0;
while (_local3 < scorearray.length) {
bghsview.txtweekname.appendText((scorenamesarray[_local3].toUpperCase() + "\n"));
bghsview.txtweekscore.appendText((scorearray[_local3] + "\n"));
_local3++;
};
};
};
if (scorearray[(scorearray.length - 1)] < lowscore){
lowscore = (lowscore = scorearray[(scorearray.length - 1)]);
};
if (localscorearray[(localscorearray.length - 1)].score < lowscore){
lowscore = localscorearray[(localscorearray.length - 1)].score;
};
}
function levelup(){
var _local2:String;
var _local1:int;
underpressure = false;
dead = false;
mads.img.gotoAndStop(1);
changelevel(1);
_local2 = r("level").toString();
if (_local2.length < 2){
_local2 = ("0" + _local2);
};
scorebar.txtlvl.text = ("LEVEL" + _local2);
if (r("level") == ricklvl){
readyforrick = true;
tmrrickspawn = gtmr();
ricklvl = (ricklvl + 12);
};
if (r("level") == dietlvl){
diet.x = (randm(1, 24) * 24);
diet.y = (randm(1, 3) * 24);
diet.visible = true;
dietlvl = (dietlvl + 12);
};
_local1 = 0;
while (_local1 < tombarray.length) {
if (((tombarray[_local1].visible) && ((tombarray[_local1].id == "tomb")))){
if (tombarray[_local1].img.tomb.currentFrame < 17){
tombarray[_local1].img.tomb.gotoAndStop((5 + tombcolorcounter));
} else {
tombarray[_local1].img.tomb.gotoAndStop((17 + tombcolorcounter));
};
};
_local1++;
};
var _local3:int;
mintomb = ((r("level") * 10) + 10);
switch (r("level")){
case 1:
pedespeed = 0;
pedechunk = 4;
craftpede(11, 0);
break;
case 2:
pedespeed = 0;
pedechunk = 4;
craftpede(12, 0);
break;
case 3:
pedespeed = 0;
pedechunk = 4;
craftpede(11, 1);
break;
case 4:
pedespeed = 30;
pedechunk = 8;
craftpede(10, 2);
break;
case 5:
pedespeed = 30;
pedechunk = 8;
craftpede(9, 3);
break;
case 6:
pedespeed = 0;
pedechunk = 8;
craftpede(8, 4);
break;
case 7:
pedespeed = 0;
pedechunk = 8;
craftpede(7, 5);
break;
case 8:
pedespeed = 0;
pedechunk = 8;
craftpede(6, 6);
break;
case 9:
pedespeed = 0;
pedechunk = 8;
craftpede(6, 7);
break;
case 10:
pedespeed = 0;
pedechunk = 8;
craftpede(6, 8);
break;
case 11:
pedespeed = 0;
pedechunk = 8;
craftpede(6, 9);
break;
};
if (r("level") >= 12){
_local3 = randm(1, 5);
pedespeed = 0;
pedechunk = 8;
if (mintomb > 250){
mintomb = 250;
};
craftpede(6, 10);
};
spawnedheads = 0;
}
public function loading(_arg1:TimerEvent){
var _local2:int = this.root.loaderInfo.bytesLoaded;
var _local3:int = this.root.loaderInfo.bytesTotal;
var _local4:int = Math.floor(((_local2 / _local3) * 100));
var _local5:String = _local4.toString();
switch (_local5.length){
case 1:
_local5 = ("00" + _local5);
break;
case 2:
_local5 = ("0" + _local5);
break;
};
txtload.text = (_local5 + "%");
if (_local2 == _local3){
bplay.visible = true;
txtplay.visible = true;
};
if (humancentipede(root).started){
stage.quality = StageQuality.LOW;
tmr.stop();
nextFrame();
};
}
function lifeafterrick(){
bgplayfield.rick.visible = false;
ricksoundchannel.stop();
}
function tryshot(){
if (((!(bgplayfield.shot.visible)) && (!(lazeron)))){
if (!dieterlazer){
bgplayfield.shot.y = mads.y;
bgplayfield.shot.x = (mads.x + 20);
bgplayfield.shot.visible = true;
mads.img.gotoAndStop(2);
tmrrecoil = gtmr();
playsound(sfxshot);
} else {
if (((dieterlazer) && (!(lazeron)))){
unlockmedal("Dieter's Laser");
scorebar.txtcombo.visible = false;
reset(lazer);
lazer.alpha = 1;
reset(oob);
lazer.gotoAndStop(1);
lazer.y = mads.y;
lazer.x = (mads.x + 44);
lazerframe = 0;
tmrlazer = gtmr();
lazeron = true;
playsound(sfxcharge);
lazer.visible = true;
};
};
};
}
private function httpStatusHandler(_arg1:HTTPStatusEvent):void{
trace(("httpStatusHandler: " + _arg1));
}
function gtmr():int{
return ((getTimer() - intertime));
}
function craftpede(_arg1:int, _arg2:int){
var _local3:ccent;
var _local4:int;
var _local5:int = randm(8, 16);
var _local6:int;
bgplayfield.border3.x = (_local5 * 24);
if (_arg1 >= 1){
_local4 = _arg1;
while (_local4 > 0) {
_local3 = new ccent();
_local3.specialchunk = 0;
_local3.x = ((_local5 * 24) - ((_local4 + 1) * 32));
_local3.y = -24;
_local3.img.hair.gotoAndStop(randm(1, _local3.img.hair.totalFrames));
addChild(_local3);
pedearray.push(_local3);
_local3.idnum = (pedearray.length - 1);
_local4--;
};
_local4 = 0;
while (_local4 < _arg2) {
_local3 = new ccent();
_local3.specialchunk = 0;
_local3.idnum = -3;
_local3.y = (24 * _local4);
if ((_local4 % 2) == 0){
_local3.x = 16;
} else {
_local3.img.scaleX = -1;
_local3.x = 560;
};
_local3.img.hair.gotoAndStop(randm(1, _local3.img.hair.totalFrames));
addChild(_local3);
pedearray.push(_local3);
_local4++;
};
} else {
if ((((_arg1 == -1)) && ((pedearray.length < 14)))){
_local3 = new ccent();
_local3.idnum = -3;
_local3.specialchunk = 0;
_local3.y = (600 - (randm(1, 5) * 24));
if (randm(1, 2) == 1){
_local3.x = 16;
} else {
_local3.img.scaleX = -1;
_local3.x = 560;
};
_local3.img.hair.gotoAndStop(randm(1, _local3.img.hair.totalFrames));
addChild(_local3);
pedearray.push(_local3);
spawnedheads++;
if (spawnedheads >= r("level")){
pedespeed = 20;
_local3.specialchunk = 16;
};
};
};
reset(copscore);
if (medalsarray.length > 0){
_local4 = 0;
while (_local4 < medalsarray.length) {
reset(medalsarray[_local4]);
_local4++;
};
};
reset(blinder1);
reset(blinder2);
reset(oob);
}
function userkeydown(_arg1:KeyboardEvent){
if (gamestate == stateplaying){
if (dead){
return;
};
switch (_arg1.keyCode){
case keyleft:
holdinglr = -1;
break;
case keyright:
holdinglr = 1;
break;
case keyup:
holdingud = -1;
break;
case keydown:
holdingud = 1;
break;
case keyspace:
holdingspace = true;
break;
case keyz:
holdingz = true;
break;
case keyx:
holdingx = true;
break;
case keyp:
pausetoggle();
break;
case keyc:
if (cursorshow){
oob.visible = false;
};
cursorshow = !(cursorshow);
break;
};
};
if (_arg1.keyCode == keyf){
if (stage.displayState == StageDisplayState.NORMAL){
stage.displayState = StageDisplayState.FULL_SCREEN;
} else {
stage.displayState = StageDisplayState.NORMAL;
};
unhold();
};
}
function dietani(){
if (diet.img.currentFrame == 6){
diet.img.gotoAndStop(1);
} else {
diet.img.nextFrame();
};
}
private function reset(_arg1:DisplayObject){
setChildIndex(_arg1, (numChildren - 1));
}
function onMedalUnlocked(_arg1:APIEvent):void{
trace(((((("Medal " + _arg1.data.name) + " - ") + _arg1.data.value) + "pts") + " unlocked!"));
var _local2:cmedal = new cmedal();
var _local3:Bitmap = new Bitmap();
_local2.txtname.text = _arg1.data.name;
_local2.txtpoints.text = _arg1.data.value;
_local2.forgebmp();
_local2.bmpicon.bitmapData = _arg1.data.icon;
_local2.x = 648;
_local2.y = 0;
tmrmedal = gtmr();
addChild(_local2);
reset(blinder2);
medalsarray.push(_local2);
}
function lazerani(){
var _local5:Rectangle;
var _local1:int;
var _local2:int;
var _local3:Boolean;
var _local4:Array = new Array();
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:Boolean;
var _local10:Boolean;
var _local11:int;
var _local12:Boolean;
var _local13:int;
if (!lazer.visible){
lazer.visible = true;
};
if ((gtmr() - tmrlazer) >= 40){
if (lazerframe <= 23){
if ((((((((lazerframe == 5)) || ((lazerframe == 11)))) || ((lazerframe == 17)))) || ((lazerframe == 23)))){
lazer.gotoAndStop(1);
} else {
lazer.nextFrame();
};
} else {
if (lazer.alpha == 1){
lazer.alpha = 0.75;
mads.img.gotoAndStop(2);
playsound(sfxdieter);
combocounter = 0;
scorebar.txtcombo.visible = false;
scorebar.txtcombo.textColor = 0xFFFFFF;
};
if (lazer.currentFrame == 14){
lazer.gotoAndStop(11);
} else {
lazer.nextFrame();
};
};
tmrlazer = gtmr();
lazerframe++;
};
if (lazerframe >= 29){
if (diet.visible){
if (lazer.hitTestObject(diet)){
diet.visible = false;
combocounter++;
playsound(sfxhit);
};
};
if (((bgplayfield.rick.visible) && ((bgplayfield.rick.img.currentFrame < 5)))){
if (lazer.hitTestObject(bgplayfield.rick)){
unlockmedal("Together Forever");
changescore(5000);
bgplayfield.rick.img.gotoAndStop(5);
tmrrick = gtmr();
ricksoundchannel.stop();
combocounter++;
playsound(sfxhit);
};
};
if (((bgplayfield.copcar.visible) && ((bgplayfield.copcar.img.currentFrame < 3)))){
if (lazer.hitTestObject(bgplayfield.copcar)){
bgplayfield.copcar.img.gotoAndStop(3);
tmrcarani = gtmr();
if (donutbreak){
unlockmedal("Donut Break");
};
changescore(1000);
carsoundchannel.stop();
combocounter++;
playsound(sfxhit);
};
};
if (((bgplayfield.cop.visible) && ((bgplayfield.cop.img.currentFrame < 3)))){
if (lazer.hitTestObject(bgplayfield.cop)){
bgplayfield.cop.img.gotoAndStop(3);
tmrcopani = gtmr();
if (bgplayfield.cop.y >= 528){
_local13 = 900;
} else {
_local13 = (900 - ((528 - bgplayfield.cop.y) * 6));
if (_local13 < 500){
_local13 = 300;
};
};
if ((((_local13 >= 500)) && ((_local13 < 850)))){
_local13 = 600;
};
if (_local13 > 600){
_local13 = 900;
};
if (_local13 == 900){
if (!bgstory.txtlazer.visible){
copkilla++;
};
if (copkilla == 10){
unlockmedal("Cop Killa");
};
};
changescore(_local13);
copscore.txt.text = (_local13 + "");
copscore.x = (bgplayfield.cop.x + 24);
copscore.y = bgplayfield.cop.y;
tmrcopscore = gtmr();
copscore.visible = true;
playsound(sfxmusic);
combocounter++;
playsound(sfxhit);
};
};
if (bgplayfield.scalp.visible){
if (lazer.hitTestObject(bgplayfield.scalp)){
bgplayfield.scalp.visible = false;
changescore(200);
scalpsoundchannel.stop();
if (!bgstory.txtlazer.visible){
niceaim++;
};
if (niceaim == 10){
unlockmedal("Nice Aim");
};
combocounter++;
playsound(sfxhit);
};
};
if (bgplayfield.roofie.visible){
if (lazer.hitTestObject(bgplayfield.roofie)){
bgplayfield.roofie.visible = false;
tmrroofie = gtmr();
if (pedespeed <= 20){
pedespeed = 40;
} else {
pedespeed = 60;
};
roofieraise++;
if (roofieraise >= 3){
unlockmedal("Raise The Roofie");
};
changescore(1500);
combocounter++;
playsound(sfxhit);
};
};
_local1 = (tombarray.length - 1);
while (_local1 >= 0) {
if (((tombarray[_local1].visible) && ((tombarray[_local1].id == "tomb")))){
if (tombarray[_local1].img.cover.currentFrame < 5){
if (lazer.hitTestObject(tombarray[_local1])){
tombarray[_local1].img.cover.nextFrame();
if (tombarray[_local1].img.cover.currentFrame == 5){
tombarray[_local1].visible = false;
ruinedtombs++;
if (tombarray[_local1].img.tomb.currentFrame >= 17){
if (!bgstory.txtlazer.visible){
antivenom++;
};
if (antivenom == 20){
unlockmedal("Antivenom");
};
} else {
if (!bgstory.txtlazer.visible){
gravedamage++;
};
if (gravedamage == 100){
unlockmedal("Grave Damage");
};
};
if (ruinedtombs >= 20){
_local4 = new Array();
_local2 = 0;
while (_local2 < tombarray.length) {
if (((!(tombarray[_local2].visible)) && ((tombarray[_local2].id == "tomb")))){
_local4.push(tombarray[_local2]);
};
_local2++;
};
if (_local4.length > 0){
_local11 = randm(0, (_local4.length - 1));
bgplayfield.roofie.x = tombarray[_local11].x;
bgplayfield.roofie.y = tombarray[_local11].y;
tmrroofie = gtmr();
bgplayfield.roofie.visible = true;
};
ruinedtombs = 0;
};
tombarray[_local1].img.cover.gotoAndStop(1);
changescore(1);
};
combocounter++;
playsound(sfxhit);
};
};
};
_local1--;
};
_local1 = (pedearray.length - 1);
while (_local1 >= 0) {
if (((((lazer.hitTestObject(pedearray[_local1])) && (pedearray[_local1].visible))) && ((pedearray[_local1].y >= 0)))){
pedearray[_local1].visible = false;
if (pedearray[_local1].specialchunk == 16){
speedypede++;
if (speedypede == 5){
unlockmedal("Speedy Pedey");
};
};
_local5 = new Rectangle((pedearray[_local1].x - 24), pedearray[_local1].y, 38, 24);
_local3 = true;
_local8 = pedearray[_local1].idnum;
tmrlevelreload = gtmr();
changescore(100);
combocounter++;
playsound(sfxhit);
_local4 = new Array();
_local7 = 0;
_local6 = 0;
_local2 = 0;
while (_local2 < tombarray.length) {
if ((((((tombarray[_local2].id == "tomb")) && (!(tombarray[_local2].visible)))) && (_local5.intersects(bblocaltoglobal(tombarray[_local2]))))){
tombarray[_local2].inter = _local5.intersection(bblocaltoglobal(tombarray[_local2]));
_local4.push(tombarray[_local2]);
};
_local2++;
};
if (_local4.length == 0){
trace("no tomb available");
} else {
if (_local4.length == 1){
_local4[0].img.cover.gotoAndStop(1);
_local4[0].img.tomb.gotoAndStop(1);
_local4[0].visible = true;
} else {
_local2 = 0;
while (_local2 < _local4.length) {
if ((_local4[_local2].inter.width * _local4[_local2].inter.height) > _local6){
_local6 = (_local4[_local2].inter.width * _local4[_local2].inter.height);
_local7 = _local4[_local2].idnum;
};
_local2++;
};
tombarray[_local7].img.cover.gotoAndStop(1);
tombarray[_local7].img.tomb.gotoAndStop(1);
tombarray[_local7].visible = true;
};
};
};
_local1--;
};
if (combocounter > 1){
if (!scorebar.txtcombo.visible){
scorebar.txtcombo.visible = true;
};
scorebar.txtcombo.text = (combocounter + " X COMBO");
};
};
_local1 = (pedearray.length - 1);
while (_local1 >= 0) {
if (!pedearray[_local1].visible){
pedepurgearray.push(pedearray[_local1]);
pedearray.splice(_local1, 1);
};
_local1--;
};
if (lazerframe > 105){
tmrcombo = gtmr();
scorebar.txtcombo.textColor = 0xFF0000;
changescore((combocounter * 10));
dietersoundchannel.stop();
if (!bgstory.txtlazer.visible){
dieterlazer = false;
};
lazeron = false;
lazer.visible = false;
};
}
function medalani(){
var _local1:int;
_local1 = 0;
while (_local1 < medalsarray.length) {
if (medalsarray[_local1].medalframe <= 105){
medalsarray[_local1].x = (medalsarray[_local1].x - 2);
} else {
if (medalsarray[_local1].medalframe > 0xFF){
medalsarray[_local1].x = (medalsarray[_local1].x + 2);
if (medalsarray[_local1].x > 648){
medalsarray[_local1].visible = false;
};
};
};
if (((((medalsarray[_local1].medalframe % 6) == 0)) && ((((medalsarray[_local1].medalframe <= 105)) || ((medalsarray[_local1].medalframe > 0xFF)))))){
if (medalsarray[_local1].img.currentFrame == 1){
medalsarray[_local1].img.nextFrame();
} else {
medalsarray[_local1].img.prevFrame();
};
};
medalsarray[_local1].medalframe++;
_local1++;
};
}
function madssupertomb(_arg1:int, _arg2:int){
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Boolean;
var _local7:Rectangle = bblocaltoglobal(mads);
while (!(_local6)) {
if (_local3 < _arg1){
if ((_arg1 - _local3) >= 6){
_local3 = (_local3 + 6);
} else {
_local3 = (_local3 + (_arg1 - _local3));
};
} else {
if (_local3 > _arg1){
if ((_local3 - _arg1) >= 6){
_local3 = (_local3 - 6);
} else {
_local3 = (_local3 - (_local3 - _arg1));
};
};
};
if (_local4 < _arg2){
if ((_arg2 - _local4) >= 6){
_local4 = (_local4 + 6);
} else {
_local4 = (_local4 + (_arg2 - _local4));
};
} else {
if (_local4 > _arg2){
if ((_local4 - _arg2) >= 6){
_local4 = (_local4 - 6);
} else {
_local4 = (_local4 - (_local4 - _arg2));
};
};
};
_local7.x = (_local7.x + _local3);
if (_arg1 > 0){
_local5 = 500;
while (_local5 <= 600) {
if (((tombarray[_local5].visible) && ((tombarray[_local5].id == "tomb")))){
if (_local7.intersection(bblocaltoglobal(tombarray[_local5])).width > 5){
mads.x = (bblocaltoglobal(tombarray[_local5]).x - 26);
_arg1 = 0;
_local3 = 0;
_local7 = bblocaltoglobal(mads);
};
};
_local5++;
};
};
if (_arg1 < 0){
_local5 = 500;
while (_local5 <= 600) {
if (((tombarray[_local5].visible) && ((tombarray[_local5].id == "tomb")))){
if (_local7.intersection(bblocaltoglobal(tombarray[_local5])).width > 5){
mads.x = (bblocaltoglobal(tombarray[_local5]).x + 22);
_arg1 = 0;
_local3 = 0;
_local7 = bblocaltoglobal(mads);
};
};
_local5++;
};
};
_local7.y = (_local7.y + _local4);
if (_arg2 > 0){
_local5 = 500;
while (_local5 <= 600) {
if (((tombarray[_local5].visible) && ((tombarray[_local5].id == "tomb")))){
if (_local7.intersection(bblocaltoglobal(tombarray[_local5])).width > 5){
mads.y = (bblocaltoglobal(tombarray[_local5]).y - 42);
_arg2 = 0;
_local4 = 0;
_local7 = bblocaltoglobal(mads);
};
};
_local5++;
};
};
if (_arg2 < 0){
_local5 = 500;
while (_local5 <= 600) {
if (((tombarray[_local5].visible) && ((tombarray[_local5].id == "tomb")))){
if (_local7.intersection(bblocaltoglobal(tombarray[_local5])).width > 5){
mads.y = (bblocaltoglobal(tombarray[_local5]).y + 6);
_arg2 = 0;
_local4 = 0;
_local7 = bblocaltoglobal(mads);
};
};
_local5++;
};
};
if ((((Math.abs(_local3) >= Math.abs(_arg1))) && ((Math.abs(_local4) >= Math.abs(_arg2))))){
_local6 = true;
};
};
superx = _arg1;
supery = _arg2;
}
private function securityErrorHandler(_arg1:SecurityErrorEvent):void{
trace(("securityErrorHandler: " + _arg1));
disableweb = true;
}
function RENDER(){
var _local3:Rectangle;
var _local1:int;
var _local2:int;
var _local4:int;
var _local5:int;
var _local6:int;
if (gamestate == stateloading){
if (currentFrame == 3){
init();
};
} else {
if (gamestate == statelogo){
logoani();
} else {
if (gamestate == statetitle){
if ((getTimer() - tmrtitle) >= 80){
if (titleframe < 35){
if (titleframe == 17){
playsound(sfxtitle);
};
if (bgtitle.img.currentFrame == 6){
bgtitle.img.gotoAndStop(1);
} else {
bgtitle.img.nextFrame();
};
titleframe++;
} else {
if (titleframe == 35){
titleframe++;
};
};
tmrtitle = getTimer();
};
} else {
if (gamestate == stateupdate){
if ((getTimer() - tmruppede) >= 120){
if (bgupdate.c1.img.cent.currentFrame == 1){
bgupdate.c1.img.cent.nextFrame();
bgupdate.c2.img.cent.nextFrame();
bgupdate.c3.img.cent.nextFrame();
} else {
bgupdate.c1.img.cent.prevFrame();
bgupdate.c2.img.cent.prevFrame();
bgupdate.c3.img.cent.prevFrame();
};
tmruppede = getTimer();
};
if ((getTimer() - tmrupdate) >= 3000){
flipmode("hsviewfromentry");
};
} else {
if (gamestate == stateinfo){
if ((gtmr() - tmrinfo) >= 120){
if (bginfo.cover.img.currentFrame < 5){
bginfo.cover.img.nextFrame();
} else {
bginfo.cover.img.gotoAndStop(1);
};
if (bginfo.cent1.img.cent.currentFrame < 2){
bginfo.cent1.img.cent.nextFrame();
} else {
bginfo.cent1.img.cent.gotoAndStop(1);
};
if (bginfo.cent2.img.cent.currentFrame < 2){
bginfo.cent2.img.cent.nextFrame();
} else {
bginfo.cent2.img.cent.prevFrame();
};
if (bginfo.cent3.img.cent.currentFrame < 2){
bginfo.cent3.img.cent.nextFrame();
} else {
bginfo.cent3.img.cent.prevFrame();
};
bginfo.scalp1.img.rotation = (bginfo.scalp1.img.rotation + 45);
bginfo.scalp2.img.rotation = (bginfo.scalp2.img.rotation + 45);
if (bginfo.cop.img.currentFrame < 2){
bginfo.cop.img.nextFrame();
} else {
bginfo.cop.img.prevFrame();
};
if (bginfo.copcar.img.currentFrame < 2){
bginfo.copcar.img.nextFrame();
} else {
bginfo.copcar.img.prevFrame();
};
if (bginfo.roofie.img.currentFrame < 4){
bginfo.roofie.img.nextFrame();
} else {
bginfo.roofie.img.gotoAndStop(1);
};
tmrinfo = gtmr();
};
} else {
if (gamestate == stateplaying){
if (gamepaused){
return;
};
if ((gtmr() - master30) >= 20){
if (!dead){
if (holdingud != 0){
if (!holdingx){
_local5 = (12 * holdingud);
} else {
_local5 = (6 * holdingud);
};
};
if (holdinglr != 0){
if (!holdingx){
_local4 = (12 * holdinglr);
} else {
_local4 = (6 * holdinglr);
};
};
if (mousecontrol){
tmadx = 0;
tmady = 0;
};
struckx = false;
strucky = false;
mads.x = (mads.x + _local4);
mads.y = (mads.y + _local5);
if (mads.x < 0){
mads.x = 0;
};
if (mads.x > 572){
mads.x = 572;
};
if (mads.y < 462){
mads.y = 462;
};
if (mads.y > 558){
mads.y = 558;
};
if (lazeron){
lazer.x = (mads.x + 44);
lazer.y = mads.y;
};
if ((((((mads.img.currentFrame == 2)) && (((gtmr() - tmrrecoil) >= 40)))) && (!(lazeron)))){
mads.img.gotoAndStop(1);
};
if (((((holdingspace) || (holdinglmb))) || (holdingz))){
tryshot();
};
if (!bgplayfield.scalp.visible){
_local1 = 0;
while (_local1 < tombarray.length) {
if ((((tombarray[_local1].id == "tomb")) && (tombarray[_local1].visible))){
_local6++;
};
_local1++;
};
if (_local6 < mintomb){
bgplayfield.scalp.y = -24;
bgplayfield.scalp.x = (randm(0, 24) * 24);
bgplayfield.scalp.img.rotation = 90;
if (bgplayfield.scalp.img.currentFrame == 1){
bgplayfield.scalp.img.nextFrame();
} else {
bgplayfield.scalp.img.prevFrame();
};
bgplayfield.scalp.visible = true;
playsound(sfxscalp);
};
} else {
scalpani();
};
if (pedearray.length > 0){
if (roofiechill > pedespeed){
if ((gtmr() - tmrpede) >= roofiechill){
pedeani();
roofiechill = (roofiechill - Math.floor((roofiechill / 5)));
if (roofiechill < 20){
roofiechill = 0;
};
tmrpede = gtmr();
};
} else {
if ((gtmr() - tmrpede) >= pedespeed){
pedeani();
tmrpede = gtmr();
};
};
if ((gtmr() - tmrpedeani) >= 80){
_local1 = 0;
while (_local1 < pedearray.length) {
if (pedearray[_local1].img.cent.currentFrame < 2){
pedearray[_local1].img.cent.nextFrame();
} else {
pedearray[_local1].img.cent.prevFrame();
};
_local1++;
};
tmrpedeani = gtmr();
};
if (((((((gtmr() - tmrcarcheck) >= 2000)) && ((r("level") >= 4)))) && (!(bgplayfield.copcar.visible)))){
if (randm(1, 5) == 1){
bgplayfield.copcar.y = (randm(3, 15) * 24);
if (randm(1, 2) == 1){
bgplayfield.copcar.x = -72;
bgplayfield.copcar.img.scaleX = 1;
} else {
bgplayfield.copcar.x = 600;
bgplayfield.copcar.img.scaleX = -1;
};
bgplayfield.copcar.img.gotoAndStop(1);
bgplayfield.copcar.visible = true;
donutbreak = true;
playsound(sfxcopcar);
};
tmrcarcheck = gtmr();
};
if (((((gtmr() - tmrcopspawn) >= 2000)) && (!(bgplayfield.cop.visible)))){
if (randm(1, 3) == 1){
copreserved = randm(5, 8);
bgplayfield.cop.y = (600 - (copreserved * 24));
if (randm(1, 2) == 1){
bgplayfield.cop.img.scaleX = 1;
bgplayfield.cop.x = -24;
} else {
bgplayfield.cop.img.scaleX = -1;
bgplayfield.cop.x = 624;
};
if (pedechunk == 4){
copchunk = 4;
} else {
if (pedechunk == 8){
copchunk = 6;
if (r("level") >= 12){
copchunk = 12;
};
} else {
if (pedechunk == 16){
copchunk = 12;
};
};
};
copbypass = false;
bgplayfield.cop.visible = true;
coptargety = bgplayfield.cop.y;
copadvance = true;
playsound(sfxmusics);
};
tmrcopspawn = gtmr();
};
};
if (bgplayfield.copcar.visible){
copcarani();
};
if (((bgplayfield.cop.visible) && (((gtmr() - tmrcopmove) >= 30)))){
copani();
tmrcopmove = gtmr();
};
if (bgplayfield.roofie.visible){
if ((gtmr() - tmrroofieani) >= 120){
if (bgplayfield.roofie.img.currentFrame < 4){
bgplayfield.roofie.img.nextFrame();
} else {
bgplayfield.roofie.img.gotoAndStop(1);
};
tmrroofieani = gtmr();
};
if ((gtmr() - tmrroofie) >= 10000){
bgplayfield.roofie.visible = false;
tmrroofie = gtmr();
};
};
if (((((readyforrick) && (((gtmr() - tmrrickspawn) >= 10000)))) && (!(bgplayfield.rick.visible)))){
bgplayfield.rick.y = (randm(5, 10) * 24);
bgplayfield.rick.img.gotoAndStop(1);
if (randm(1, 2) == 1){
bgplayfield.rick.x = 600;
bgplayfield.rick.img.scaleX = -1;
} else {
bgplayfield.rick.x = -24;
bgplayfield.rick.img.scaleX = 1;
};
playsound(sfxrick);
bgplayfield.rick.visible = true;
readyforrick = false;
};
if (bgplayfield.rick.visible){
if (bgplayfield.rick.img.currentFrame <= 4){
if ((gtmr() - tmrrick) >= 240){
if (bgplayfield.rick.img.currentFrame < 4){
bgplayfield.rick.img.nextFrame();
} else {
if (bgplayfield.rick.img.currentFrame == 4){
bgplayfield.rick.img.gotoAndStop(1);
};
};
tmrrick = gtmr();
};
bgplayfield.rick.x = (bgplayfield.rick.x + (1 * bgplayfield.rick.img.scaleX));
switch (bgplayfield.rick.img.scaleX){
case -1:
if (bgplayfield.rick.x < -72){
lifeafterrick();
};
break;
case 1:
if (bgplayfield.rick.x > 672){
lifeafterrick();
};
break;
};
} else {
if ((gtmr() - tmrrick) >= 40){
switch (bgplayfield.rick.img.currentFrame){
case 5:
case 6:
case 7:
bgplayfield.rick.img.nextFrame();
break;
case 8:
bgplayfield.rick.visible = false;
break;
};
tmrrick = gtmr();
};
};
};
if (((!(lazeron)) && (scorebar.txtcombo.visible))){
if ((gtmr() - tmrcomboflash) >= 40){
if (scorebar.txtcombo.textColor == 0xFF0000){
scorebar.txtcombo.textColor = 0xFFFF00;
} else {
scorebar.txtcombo.textColor = 0xFF0000;
};
tmrcomboflash = gtmr();
};
if ((gtmr() - tmrcombo) >= 5000){
scorebar.txtcombo.visible = false;
};
};
if (bgplayfield.shot.visible){
shotani();
};
if (diet.visible){
dietani();
};
if (lazeron){
lazerani();
};
checkdeath();
if (pedearray.length == 0){
underpressure = false;
if ((gtmr() - tmrlevelreload) >= 1000){
tmrcarcheck = gtmr();
tmrcopspawn = gtmr();
changescore((r("level") * 100));
roofieraise = 0;
speedypede = 0;
levelup();
};
};
if (((underpressure) && (((gtmr() - tmrpressure) >= 3000)))){
craftpede(-1, 1);
tmrpressure = gtmr();
};
if (bgplayfield.cop.visible){
if (!copbypass){
if ((((bgplayfield.cop.img.scaleX == -1)) && ((bgplayfield.cop.x < mads.x)))){
if (bgplayfield.cop.y > (mads.y + mads.height)){
unlockmedal("Hop A Cop");
};
copbypass = true;
} else {
if ((((bgplayfield.cop.img.scaleX == 1)) && ((bgplayfield.cop.x > (mads.x + mads.width))))){
if (bgplayfield.cop.y > (mads.y + mads.height)){
unlockmedal("Hop A Cop");
};
copbypass = true;
};
};
} else {
if ((((bgplayfield.cop.img.scaleX == 1)) && ((bgplayfield.cop.x < mads.x)))){
if (bgplayfield.cop.y > (mads.y + mads.height)){
unlockmedal("Hop A Cop");
};
copbypass = false;
} else {
if ((((bgplayfield.cop.img.scaleX == -1)) && ((bgplayfield.cop.x > (mads.x + mads.width))))){
if (bgplayfield.cop.y > (mads.y + mads.height)){
unlockmedal("Hop A Cop");
};
copbypass = false;
};
};
};
};
} else {
if (dead){
if ((deadframe - 17) > (tombhealarray.length + 4)){
tmrcarcheck = gtmr();
tmrcopspawn = gtmr();
changelife(-1);
dead = false;
if (r("lives") >= 0){
playsound(sfxmusic);
};
};
};
};
if ((gtmr() - tmrtomb) >= 40){
_local1 = 0;
while (_local1 < tombarray.length) {
if ((((tombarray[_local1].id == "tomb")) && (tombarray[_local1].visible))){
if (tombarray[_local1].img.tomb.currentFrame < 4){
tombarray[_local1].img.tomb.nextFrame();
} else {
if (tombarray[_local1].img.tomb.currentFrame == 4){
tombarray[_local1].img.tomb.gotoAndStop((5 + tombcolorcounter));
};
};
};
_local1++;
};
tmrtomb = gtmr();
};
if (((copscore.visible) && (((gtmr() - tmrcopscore) >= 1000)))){
copscore.visible = false;
};
if (pedepurgearray.length > 0){
_local1 = 0;
while (_local1 < pedepurgearray.length) {
removeChild(pedepurgearray[_local1]);
_local1++;
};
pedepurgearray = new Array();
};
master30 = gtmr();
};
if (dead){
if ((gtmr() - tmrdead) >= deaddelay){
deadani();
tmrdead = gtmr();
};
};
};
};
};
};
};
};
if (medalsarray.length > 0){
if ((gtmr() - tmrmedal) >= 20){
medalani();
_local1 = (medalsarray.length - 1);
while (_local1 >= 0) {
if (!medalsarray[_local1].visible){
removeChild(medalsarray[_local1]);
medalsarray.splice(_local1, 1);
};
_local1--;
};
tmrmedal = gtmr();
};
};
}
public function flipmode(_arg1:String){
var _local2:int;
devisible();
switch (_arg1){
case "title":
titleframe = 0;
tmrtitle = getTimer();
bgtitle.img.gotoAndStop(1);
bgtitle.visible = true;
gamestate = statetitle;
break;
case "playfield":
bgplayfield.init();
dead = false;
mintomb = 0;
tombarray = bgplayfield.tombarray;
mads = bgplayfield.mads;
bgplayfield.visible = true;
lazer.visible = false;
lazer.gotoAndStop(1);
diet.visible = false;
diet.img.gotoAndStop(1);
lastmx = tmx;
lastmy = tmy;
reset(scorebar);
if (medalsarray.length > 0){
_local2 = 0;
while (_local2 < medalsarray.length) {
reset(medalsarray[_local2]);
_local2++;
};
};
reset(blinder1);
reset(blinder2);
reset(diet);
scorebar.txtscore.text = "0";
scorebar.txthigh.text = (hiscore + "");
if (!bgstory.txtlazer.visible){
dieterlazer = false;
rlives = (2 * 3.42);
lives = 2;
} else {
dieterlazer = true;
rlives = 0;
lives = 0;
};
Mouse.hide();
rscour = 0;
scour = 0;
rlevel = 0;
level = 0;
ricklvl = randm(8, 12);
dietlvl = randm(13, 16);
trace(((("rick:" + ricklvl) + " dieter:") + dietlvl));
roofieraise = 0;
changelife(0);
scorebar.visible = true;
tombgenerate();
intertime = 0;
unhold();
next1up = 12000;
tombcolorcounter = -1;
tmrlvlreload = gtmr();
ruinedtombs = 0;
tmrmusicdelay = 538;
playsound(sfxmusic);
copscore.visible = false;
gamestate = stateplaying;
break;
case "minfo":
bginfo.visible = true;
mousecontrol = true;
gamestate = stateinfo;
break;
case "info2":
bginfo2.visible = true;
gamestate = stateinfo2;
break;
case "kbinfo":
bginfo.controls.gotoAndStop(2);
bginfo.visible = true;
mousecontrol = false;
gamestate = stateinfo;
break;
case "gameover":
playsound(sfxgameover);
bgstory.txttop.text = (("You are Dr. Heiter, a brilliant German surgeon " + "who has gone mad and surgically attached people ass-to-mouth ") + "to create\nthe human centipede.");
bgstory.txtlazer.visible = false;
Mouse.show();
bggameover.visible = true;
gamestate = stategameover;
break;
case "story":
bgstory.visible = true;
gamestate = statestory;
break;
case "update":
tmrupdate = getTimer();
bgupdate.visible = true;
gamestate = stateupdate;
break;
case "hsview":
bghsview.txtb.text = "RETURN TO MAIN MENU";
bghsview.bb.x = 72;
bghsview.bb.width = 458;
bghsview.visible = true;
gamestate = statehsview;
break;
case "hsviewfromentry":
bghsview.txtb.text = "CONTINUE";
bghsview.bb.x = 202;
bghsview.bb.width = 196;
bghsview.visible = true;
gamestate = statehsview;
break;
case "hsentry":
Mouse.show();
bghsentry.visible = true;
gamestate = statehsentry;
break;
case "logo":
bglogo.logo.alpha = 0;
bglogo.logo.gotoAndStop(1);
bglogo.logoframe = 0;
bglogo.tmrlogo = gtmr();
bglogo.visible = true;
gamestate = statelogo;
break;
};
}
function setlocalscores(){
var _local1:int;
bghsview.txtpscore.text = "";
bghsview.txtpname.text = "";
_local1 = 0;
while (_local1 < localscorearray.length) {
bghsview.txtpname.appendText((localscorearray[_local1].name.toUpperCase() + "\n"));
bghsview.txtpscore.appendText((localscorearray[_local1].score + "\n"));
_local1++;
};
}
function changelevel(_arg1:Number){
rlevel = (rlevel + (_arg1 * 3.42));
level = r("level");
tombcolorcounter = (tombcolorcounter + _arg1);
if (tombcolorcounter > 11){
tombcolorcounter = 0;
};
}
function copani(){
var _local2:Rectangle;
var _local6:Rectangle;
var _local7:Rectangle;
var _local8:Rectangle;
var _local1:int;
var _local3:int;
var _local4:int = randm(1, 4);
var _local5:Array = new Array();
if (_local4 == 1){
_local3 = 0;
} else {
if (_local4 == 2){
_local3 = 1;
} else {
_local3 = 2;
};
};
if (bgplayfield.cop.img.currentFrame < 3){
if (bgplayfield.cop.y == coptargety){
_local1 = 1;
while (_local1 <= 8) {
if (_local1 != copreserved){
_local5.push((_local1 * 24));
};
_local1++;
};
copadvance = false;
_local6 = bblocaltoglobal(mads);
_local6.y--;
if ((((((bgplayfield.cop.x < 0)) && ((bgplayfield.cop.img.scaleX == 1)))) || ((((bgplayfield.cop.x > 600)) && ((bgplayfield.cop.img.scaleX == -1)))))){
copadvance = true;
switch (_local3){
case 0:
case 1:
coptargety = (600 - _local5[randm(0, (_local5.length - 1))]);
break;
case 2:
if (_local6.y != bgplayfield.cop.y){
coptargety = (Math.floor((_local6.y / 24)) * 24);
} else {
coptargety = (600 - _local5[randm(0, (_local5.length - 1))]);
};
break;
};
} else {
if ((((((bgplayfield.cop.x < -24)) && ((bgplayfield.cop.img.scaleX == -1)))) || ((((bgplayfield.cop.x > 600)) && ((bgplayfield.cop.img.scaleX == 1)))))){
bgplayfield.cop.visible = false;
playsound(sfxmusic);
tmrcopspawn = gtmr();
} else {
switch (_local3){
case 0:
coptargety = (600 - _local5[randm(0, (_local5.length - 1))]);
break;
case 1:
if (randm(1, 3) == 1){
copadvance = true;
};
if ((((copreserved > 1)) && ((copreserved < 8)))){
if (_local6.y < bgplayfield.cop.y){
coptargety = (600 - (randm((copreserved + 1), 8) * 24));
} else {
if (_local6.y > bgplayfield.cop.y){
coptargety = (600 - (randm(1, (copreserved - 1)) * 24));
} else {
coptargety = (600 - _local5[randm(0, (_local5.length - 1))]);
};
};
} else {
coptargety = (600 - _local5[randm(0, (_local5.length - 1))]);
};
break;
case 2:
copadvance = true;
if ((((copreserved > 1)) && ((copreserved < 8)))){
if (_local6.y < bgplayfield.cop.y){
coptargety = (600 - (randm((copreserved + 1), 8) * 24));
} else {
if (_local6.y > bgplayfield.cop.y){
coptargety = (600 - (randm(1, (copreserved - 1)) * 24));
} else {
coptargety = (600 - _local5[randm(0, (_local5.length - 1))]);
};
};
} else {
coptargety = (600 - _local5[randm(0, (_local5.length - 1))]);
};
break;
};
};
};
if (coptargety > 576){
coptargety = 576;
};
copreserved = ((600 - coptargety) / 24);
};
if (bgplayfield.cop.visible){
if (bgplayfield.cop.y < coptargety){
bgplayfield.cop.y = (bgplayfield.cop.y + copchunk);
} else {
if (bgplayfield.cop.y > coptargety){
bgplayfield.cop.y = (bgplayfield.cop.y - copchunk);
};
};
if (copadvance){
bgplayfield.cop.x = (bgplayfield.cop.x + (copchunk * bgplayfield.cop.img.scaleX));
};
_local7 = bblocaltoglobal(bgplayfield.cop);
_local1 = 425;
while (_local1 <= 600) {
if (((tombarray[_local1].visible) && ((tombarray[_local1].id == "tomb")))){
if (_local7.intersects(bblocaltoglobal(tombarray[_local1]))){
_local8 = _local7.intersection(bblocaltoglobal(tombarray[_local1]));
if ((_local8.width * _local8.height) >= 64){
tombarray[_local1].visible = false;
tombarray[_local1].img.tomb.gotoAndStop(1);
tombarray[_local1].img.cover.gotoAndStop(1);
};
};
};
_local1++;
};
if ((gtmr() - tmrcopani) >= 120){
if (bgplayfield.cop.img.currentFrame == 1){
bgplayfield.cop.img.nextFrame();
} else {
if (bgplayfield.cop.img.currentFrame == 2){
bgplayfield.cop.img.prevFrame();
};
};
tmrcopani = gtmr();
};
};
} else {
if ((gtmr() - tmrcopani) >= 40){
switch (bgplayfield.cop.img.currentFrame){
case 3:
case 4:
case 5:
bgplayfield.cop.img.nextFrame();
break;
case 6:
bgplayfield.cop.visible = false;
bgplayfield.cop.img.gotoAndStop(1);
tmrcopspawn = gtmr();
break;
};
tmrcopani = gtmr();
};
};
}
function usermouseup(_arg1:MouseEvent){
if (((!(mousecontrol)) || (!((gamestate == stateplaying))))){
return;
};
holdinglmb = false;
}
function __setProp_apicon_Scene1_Layer1_0(){
try {
apicon["componentInspectorSetting"] = true;
} catch(e:Error) {
};
apicon.debugMode = true;
apicon.encryptionKey = "gudWOWvucnlyafAGPlkWTyQPlsoJMizf";
apicon.movieId = "12160:5eSmfRME";
apicon.movieVersion = "";
apicon.showConnectingPopup = true;
apicon.useErrorPopup = true;
apicon.useMedalPopup = true;
try {
apicon["componentInspectorSetting"] = false;
} catch(e:Error) {
};
}
private function configureListeners(_arg1:IEventDispatcher):void{
_arg1.addEventListener(Event.COMPLETE, scoredld);
_arg1.addEventListener(Event.OPEN, openHandler);
_arg1.addEventListener(ProgressEvent.PROGRESS, progressHandler);
_arg1.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
_arg1.addEventListener(HTTPStatusEvent.HTTP_STATUS, httpStatusHandler);
_arg1.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
}
}
}//package
Section 84
//NewgroundsAPIAsset_big_popup_background (NewgroundsAPIAsset_big_popup_background)
package {
import flash.display.*;
public dynamic class NewgroundsAPIAsset_big_popup_background extends MovieClip {
public var shadow:MovieClip;
public var b:MovieClip;
public var c:MovieClip;
public var bl:MovieClip;
public var l:MovieClip;
public var br:MovieClip;
public var r:MovieClip;
public var tl:MovieClip;
public var t:MovieClip;
public var tr:MovieClip;
}
}//package
Section 85
//omegacrap (omegacrap)
package {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.media.*;
import flash.text.*;
import flash.system.*;
import flash.errors.*;
import flash.accessibility.*;
import flash.filters.*;
import flash.ui.*;
public dynamic class omegacrap extends MovieClip {
public function omegacrap(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 86
//scharge (scharge)
package {
import flash.media.*;
public dynamic class scharge extends Sound {
}
}//package
Section 87
//scopcar (scopcar)
package {
import flash.media.*;
public dynamic class scopcar extends Sound {
}
}//package
Section 88
//sdead (sdead)
package {
import flash.media.*;
public dynamic class sdead extends Sound {
}
}//package
Section 89
//sdieter (sdieter)
package {
import flash.media.*;
public dynamic class sdieter extends Sound {
}
}//package
Section 90
//shit (shit)
package {
import flash.media.*;
public dynamic class shit extends Sound {
}
}//package
Section 91
//slife (slife)
package {
import flash.media.*;
public dynamic class slife extends Sound {
}
}//package
Section 92
//smusic (smusic)
package {
import flash.media.*;
public dynamic class smusic extends Sound {
}
}//package
Section 93
//smusics (smusics)
package {
import flash.media.*;
public dynamic class smusics extends Sound {
}
}//package
Section 94
//srick (srick)
package {
import flash.media.*;
public dynamic class srick extends Sound {
}
}//package
Section 95
//sscalp (sscalp)
package {
import flash.media.*;
public dynamic class sscalp extends Sound {
}
}//package
Section 96
//sshot (sshot)
package {
import flash.media.*;
public dynamic class sshot extends Sound {
}
}//package
Section 97
//stgameover (stgameover)
package {
import flash.media.*;
public dynamic class stgameover extends Sound {
}
}//package
Section 98
//stlazer (stlazer)
package {
import flash.media.*;
public dynamic class stlazer extends Sound {
}
}//package
Section 99
//stomb (stomb)
package {
import flash.media.*;
public dynamic class stomb extends Sound {
}
}//package
Section 100
//sttitle (sttitle)
package {
import flash.media.*;
public dynamic class sttitle extends Sound {
}
}//package