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;
public static function hash(_arg1:String):String{
var _local2:ByteArray = new ByteArray();
_local2.writeUTFBytes(_arg1);
return (hashBinary(_local2));
}
public static function hashBytes(_arg1:ByteArray):String{
return (hashBinary(_arg1));
}
public static function hashBinary(_arg1:ByteArray):String{
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local2 = 1732584193;
var _local3 = -271733879;
var _local4 = -1732584194;
var _local5 = 271733878;
var _local10:Array = createBlocks(_arg1);
var _local11:int = _local10.length;
var _local12:int;
while (_local12 < _local11) {
_local6 = _local2;
_local7 = _local3;
_local8 = _local4;
_local9 = _local5;
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 0))], 7, -680876936);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 1))], 12, -389564586);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 2))], 17, 606105819);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 3))], 22, -1044525330);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 4))], 7, -176418897);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 5))], 12, 1200080426);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 6))], 17, -1473231341);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 7))], 22, -45705983);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 8))], 7, 1770035416);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 9))], 12, -1958414417);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 10))], 17, -42063);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 11))], 22, -1990404162);
_local2 = ff(_local2, _local3, _local4, _local5, _local10[int((_local12 + 12))], 7, 1804603682);
_local5 = ff(_local5, _local2, _local3, _local4, _local10[int((_local12 + 13))], 12, -40341101);
_local4 = ff(_local4, _local5, _local2, _local3, _local10[int((_local12 + 14))], 17, -1502002290);
_local3 = ff(_local3, _local4, _local5, _local2, _local10[int((_local12 + 15))], 22, 1236535329);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 1))], 5, -165796510);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 6))], 9, -1069501632);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 11))], 14, 643717713);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 0))], 20, -373897302);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 5))], 5, -701558691);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 10))], 9, 38016083);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 15))], 14, -660478335);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 4))], 20, -405537848);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 9))], 5, 568446438);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 14))], 9, -1019803690);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 3))], 14, -187363961);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 8))], 20, 1163531501);
_local2 = gg(_local2, _local3, _local4, _local5, _local10[int((_local12 + 13))], 5, -1444681467);
_local5 = gg(_local5, _local2, _local3, _local4, _local10[int((_local12 + 2))], 9, -51403784);
_local4 = gg(_local4, _local5, _local2, _local3, _local10[int((_local12 + 7))], 14, 1735328473);
_local3 = gg(_local3, _local4, _local5, _local2, _local10[int((_local12 + 12))], 20, -1926607734);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 5))], 4, -378558);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 8))], 11, -2022574463);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 11))], 16, 1839030562);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 14))], 23, -35309556);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 1))], 4, -1530992060);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 4))], 11, 1272893353);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 7))], 16, -155497632);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 10))], 23, -1094730640);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 13))], 4, 681279174);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 0))], 11, -358537222);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 3))], 16, -722521979);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 6))], 23, 76029189);
_local2 = hh(_local2, _local3, _local4, _local5, _local10[int((_local12 + 9))], 4, -640364487);
_local5 = hh(_local5, _local2, _local3, _local4, _local10[int((_local12 + 12))], 11, -421815835);
_local4 = hh(_local4, _local5, _local2, _local3, _local10[int((_local12 + 15))], 16, 530742520);
_local3 = hh(_local3, _local4, _local5, _local2, _local10[int((_local12 + 2))], 23, -995338651);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 0))], 6, -198630844);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 7))], 10, 1126891415);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 14))], 15, -1416354905);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 5))], 21, -57434055);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 12))], 6, 1700485571);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 3))], 10, -1894986606);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 10))], 15, -1051523);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 1))], 21, -2054922799);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 8))], 6, 1873313359);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 15))], 10, -30611744);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 6))], 15, -1560198380);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 13))], 21, 1309151649);
_local2 = ii(_local2, _local3, _local4, _local5, _local10[int((_local12 + 4))], 6, -145523070);
_local5 = ii(_local5, _local2, _local3, _local4, _local10[int((_local12 + 11))], 10, -1120210379);
_local4 = ii(_local4, _local5, _local2, _local3, _local10[int((_local12 + 2))], 15, 718787259);
_local3 = ii(_local3, _local4, _local5, _local2, _local10[int((_local12 + 9))], 21, -343485551);
_local2 = (_local2 + _local6);
_local3 = (_local3 + _local7);
_local4 = (_local4 + _local8);
_local5 = (_local5 + _local9);
_local12 = (_local12 + 16);
};
digest = new ByteArray();
digest.writeInt(_local2);
digest.writeInt(_local3);
digest.writeInt(_local4);
digest.writeInt(_local5);
digest.position = 0;
return ((((IntUtil.toHex(_local2) + IntUtil.toHex(_local3)) + IntUtil.toHex(_local4)) + IntUtil.toHex(_local5)));
}
private static function f(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 & _arg2) | (~(_arg1) & _arg3)));
}
private static function g(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 & _arg3) | (_arg2 & ~(_arg3))));
}
private static function h(_arg1:int, _arg2:int, _arg3:int):int{
return (((_arg1 ^ _arg2) ^ _arg3));
}
private static function i(_arg1:int, _arg2:int, _arg3:int):int{
return ((_arg2 ^ (_arg1 | ~(_arg3))));
}
private static function transform(_arg1:Function, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int, _arg8:int):int{
var _local9:int = (((_arg2 + int(_arg1(_arg3, _arg4, _arg5))) + _arg6) + _arg8);
return ((IntUtil.rol(_local9, _arg7) + _arg3));
}
private static function ff(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(f, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function gg(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(g, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function hh(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(h, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function ii(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):int{
return (transform(i, _arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7));
}
private static function createBlocks(_arg1:ByteArray):Array{
var _local2:Array = new Array();
var _local3:int = (_arg1.length * 8);
var _local4 = 0xFF;
var _local5:int;
while (_local5 < _local3) {
_local2[int((_local5 >> 5))] = (_local2[int((_local5 >> 5))] | ((_arg1[(_local5 / 8)] & _local4) << (_local5 % 32)));
_local5 = (_local5 + 8);
};
_local2[int((_local3 >> 5))] = (_local2[int((_local3 >> 5))] | (128 << (_local3 % 32)));
_local2[int(((((_local3 + 64) >>> 9) << 4) + 14))] = _local3;
return (_local2);
}
}
}//package com.adobe.crypto
Section 2
//PNGEncoder (com.adobe.images.PNGEncoder)
package com.adobe.images {
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
public class PNGEncoder {
private static var crcTable:Array;
private static var crcTableComputed:Boolean = false;
public static function encode(_arg1:BitmapData):ByteArray{
var _local6:uint;
var _local7:int;
var _local2:ByteArray = new ByteArray();
_local2.writeUnsignedInt(2303741511);
_local2.writeUnsignedInt(218765834);
var _local3:ByteArray = new ByteArray();
_local3.writeInt(_arg1.width);
_local3.writeInt(_arg1.height);
_local3.writeUnsignedInt(134610944);
_local3.writeByte(0);
writeChunk(_local2, 1229472850, _local3);
var _local4:ByteArray = new ByteArray();
var _local5:int;
while (_local5 < _arg1.height) {
_local4.writeByte(0);
if (!_arg1.transparent){
_local7 = 0;
while (_local7 < _arg1.width) {
_local6 = _arg1.getPixel(_local7, _local5);
_local4.writeUnsignedInt(uint((((_local6 & 0xFFFFFF) << 8) | 0xFF)));
_local7++;
};
} else {
_local7 = 0;
while (_local7 < _arg1.width) {
_local6 = _arg1.getPixel32(_local7, _local5);
_local4.writeUnsignedInt(uint((((_local6 & 0xFFFFFF) << 8) | (_local6 >>> 24))));
_local7++;
};
};
_local5++;
};
_local4.compress();
writeChunk(_local2, 1229209940, _local4);
writeChunk(_local2, 1229278788, null);
return (_local2);
}
private static function writeChunk(_arg1:ByteArray, _arg2:uint, _arg3:ByteArray):void{
var _local8:uint;
var _local9:uint;
var _local10:uint;
if (!crcTableComputed){
crcTableComputed = true;
crcTable = [];
_local9 = 0;
while (_local9 < 0x0100) {
_local8 = _local9;
_local10 = 0;
while (_local10 < 8) {
if ((_local8 & 1)){
_local8 = uint((uint(3988292384) ^ uint((_local8 >>> 1))));
} else {
_local8 = uint((_local8 >>> 1));
};
_local10++;
};
crcTable[_local9] = _local8;
_local9++;
};
};
var _local4:uint;
if (_arg3 != null){
_local4 = _arg3.length;
};
_arg1.writeUnsignedInt(_local4);
var _local5:uint = _arg1.position;
_arg1.writeUnsignedInt(_arg2);
if (_arg3 != null){
_arg1.writeBytes(_arg3);
};
var _local6:uint = _arg1.position;
_arg1.position = _local5;
_local8 = 4294967295;
var _local7:int;
while (_local7 < (_local6 - _local5)) {
_local8 = uint((crcTable[((_local8 ^ _arg1.readUnsignedByte()) & uint(0xFF))] ^ uint((_local8 >>> 8))));
_local7++;
};
_local8 = uint((_local8 ^ uint(4294967295)));
_arg1.position = _local6;
_arg1.writeUnsignedInt(_local8);
}
}
}//package com.adobe.images
Section 3
//JSON (com.adobe.serialization.json.JSON)
package com.adobe.serialization.json {
public class JSON {
public static function encode(_arg1:Object):String{
var _local2:JSONEncoder = new JSONEncoder(_arg1);
return (_local2.getString());
}
public static function decode(_arg1:String){
var _local2:JSONDecoder = new JSONDecoder(_arg1);
return (_local2.getValue());
}
}
}//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){
this.tokenizer = new JSONTokenizer(_arg1);
this.nextToken();
this.value = this.parseValue();
}
public function getValue(){
return (this.value);
}
private function nextToken():JSONToken{
return ((this.token = this.tokenizer.getNextToken()));
}
private function parseArray():Array{
var _local1:Array = new Array();
this.nextToken();
if (this.token.type == JSONTokenType.RIGHT_BRACKET){
return (_local1);
};
while (true) {
_local1.push(this.parseValue());
this.nextToken();
if (this.token.type == JSONTokenType.RIGHT_BRACKET){
return (_local1);
};
if (this.token.type == JSONTokenType.COMMA){
this.nextToken();
} else {
this.tokenizer.parseError(("Expecting ] or , but found " + this.token.value));
};
};
return (null);
}
private function parseObject():Object{
var _local2:String;
var _local1:Object = new Object();
this.nextToken();
if (this.token.type == JSONTokenType.RIGHT_BRACE){
return (_local1);
};
while (true) {
if (this.token.type == JSONTokenType.STRING){
_local2 = String(this.token.value);
this.nextToken();
if (this.token.type == JSONTokenType.COLON){
this.nextToken();
_local1[_local2] = this.parseValue();
this.nextToken();
if (this.token.type == JSONTokenType.RIGHT_BRACE){
return (_local1);
};
if (this.token.type == JSONTokenType.COMMA){
this.nextToken();
} else {
this.tokenizer.parseError(("Expecting } or , but found " + this.token.value));
};
} else {
this.tokenizer.parseError(("Expecting : but found " + this.token.value));
};
} else {
this.tokenizer.parseError(("Expecting string but found " + this.token.value));
};
};
return (null);
}
private function parseValue():Object{
if (this.token == null){
this.tokenizer.parseError("Unexpected end of input");
};
switch (this.token.type){
case JSONTokenType.LEFT_BRACE:
return (this.parseObject());
case JSONTokenType.LEFT_BRACKET:
return (this.parseArray());
case JSONTokenType.STRING:
case JSONTokenType.NUMBER:
case JSONTokenType.TRUE:
case JSONTokenType.FALSE:
case JSONTokenType.NULL:
return (this.token.value);
default:
this.tokenizer.parseError(("Unexpected " + this.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){
this.jsonString = this.convertToString(_arg1);
}
public function getString():String{
return (this.jsonString);
}
private function convertToString(_arg1):String{
if ((_arg1 is String)){
return (this.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 (this.arrayToString((_arg1 as Array)));
};
if ((((_arg1 is Object)) && (!((_arg1 == null))))){
return (this.objectToString(_arg1));
};
};
};
return ("null");
}
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 + this.convertToString(_arg1[_local3]));
_local3++;
};
return ((("[" + _local2) + "]"));
}
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 + ((this.escapeString(key) + ":") + this.convertToString(value)));
};
};
} else {
for each (v in classInfo..*.(((name() == "variable")) || ((name() == "accessor")))) {
if (s.length > 0){
s = (s + ",");
};
s = (s + ((this.escapeString(v.@name.toString()) + ":") + this.convertToString(o[v.@name])));
};
};
return ((("{" + s) + "}"));
}
}
}//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";
this._location = _arg2;
this._text = _arg3;
}
public function get location():int{
return (this._location);
}
public function get text():String{
return (this._text);
}
}
}//package com.adobe.serialization.json
Section 7
//JSONToken (com.adobe.serialization.json.JSONToken)
package com.adobe.serialization.json {
public class JSONToken {
private var _type:int;
private var _value:Object;
public function JSONToken(_arg1:int=-1, _arg2:Object=null){
this._type = _arg1;
this._value = _arg2;
}
public function get type():int{
return (this._type);
}
public function set type(_arg1:int):void{
this._type = _arg1;
}
public function get value():Object{
return (this._value);
}
public function set value(_arg1:Object):void{
this._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 obj:Object;
private var jsonString:String;
private var loc:int;
private var ch:String;
public function JSONTokenizer(_arg1:String){
this.jsonString = _arg1;
this.loc = 0;
this.nextChar();
}
public function getNextToken():JSONToken{
var _local2:String;
var _local3:String;
var _local4:String;
var _local1:JSONToken = new JSONToken();
this.skipIgnored();
switch (this.ch){
case "{":
_local1.type = JSONTokenType.LEFT_BRACE;
_local1.value = "{";
this.nextChar();
break;
case "}":
_local1.type = JSONTokenType.RIGHT_BRACE;
_local1.value = "}";
this.nextChar();
break;
case "[":
_local1.type = JSONTokenType.LEFT_BRACKET;
_local1.value = "[";
this.nextChar();
break;
case "]":
_local1.type = JSONTokenType.RIGHT_BRACKET;
_local1.value = "]";
this.nextChar();
break;
case ",":
_local1.type = JSONTokenType.COMMA;
_local1.value = ",";
this.nextChar();
break;
case ":":
_local1.type = JSONTokenType.COLON;
_local1.value = ":";
this.nextChar();
break;
case "t":
_local2 = ((("t" + this.nextChar()) + this.nextChar()) + this.nextChar());
if (_local2 == "true"){
_local1.type = JSONTokenType.TRUE;
_local1.value = true;
this.nextChar();
} else {
this.parseError(("Expecting 'true' but found " + _local2));
};
break;
case "f":
_local3 = (((("f" + this.nextChar()) + this.nextChar()) + this.nextChar()) + this.nextChar());
if (_local3 == "false"){
_local1.type = JSONTokenType.FALSE;
_local1.value = false;
this.nextChar();
} else {
this.parseError(("Expecting 'false' but found " + _local3));
};
break;
case "n":
_local4 = ((("n" + this.nextChar()) + this.nextChar()) + this.nextChar());
if (_local4 == "null"){
_local1.type = JSONTokenType.NULL;
_local1.value = null;
this.nextChar();
} else {
this.parseError(("Expecting 'null' but found " + _local4));
};
break;
case "\"":
_local1 = this.readString();
break;
default:
if (((this.isDigit(this.ch)) || ((this.ch == "-")))){
_local1 = this.readNumber();
} else {
if (this.ch == ""){
return (null);
};
this.parseError((("Unexpected " + this.ch) + " encountered"));
};
};
return (_local1);
}
private function readString():JSONToken{
var _local3:String;
var _local4:int;
var _local1:JSONToken = new JSONToken();
_local1.type = JSONTokenType.STRING;
var _local2 = "";
this.nextChar();
while (((!((this.ch == "\""))) && (!((this.ch == ""))))) {
if (this.ch == "\\"){
this.nextChar();
switch (this.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 (!this.isHexDigit(this.nextChar())){
this.parseError((" Excepted a hex digit, but found: " + this.ch));
};
_local3 = (_local3 + this.ch);
_local4++;
};
_local2 = (_local2 + String.fromCharCode(parseInt(_local3, 16)));
break;
default:
_local2 = (_local2 + ("\\" + this.ch));
};
} else {
_local2 = (_local2 + this.ch);
};
this.nextChar();
};
if (this.ch == ""){
this.parseError("Unterminated string literal");
};
this.nextChar();
_local1.value = _local2;
return (_local1);
}
private function readNumber():JSONToken{
var _local1:JSONToken = new JSONToken();
_local1.type = JSONTokenType.NUMBER;
var _local2 = "";
if (this.ch == "-"){
_local2 = (_local2 + "-");
this.nextChar();
};
if (!this.isDigit(this.ch)){
this.parseError("Expecting a digit");
};
if (this.ch == "0"){
_local2 = (_local2 + this.ch);
this.nextChar();
if (this.isDigit(this.ch)){
this.parseError("A digit cannot immediately follow 0");
};
} else {
while (this.isDigit(this.ch)) {
_local2 = (_local2 + this.ch);
this.nextChar();
};
};
if (this.ch == "."){
_local2 = (_local2 + ".");
this.nextChar();
if (!this.isDigit(this.ch)){
this.parseError("Expecting a digit");
};
while (this.isDigit(this.ch)) {
_local2 = (_local2 + this.ch);
this.nextChar();
};
};
if ((((this.ch == "e")) || ((this.ch == "E")))){
_local2 = (_local2 + "e");
this.nextChar();
if ((((this.ch == "+")) || ((this.ch == "-")))){
_local2 = (_local2 + this.ch);
this.nextChar();
};
if (!this.isDigit(this.ch)){
this.parseError("Scientific notation number needs exponent value");
};
while (this.isDigit(this.ch)) {
_local2 = (_local2 + this.ch);
this.nextChar();
};
};
var _local3:Number = Number(_local2);
if (((isFinite(_local3)) && (!(isNaN(_local3))))){
_local1.value = _local3;
return (_local1);
};
this.parseError((("Number " + _local3) + " is not valid!"));
return (null);
}
private function nextChar():String{
return ((this.ch = this.jsonString.charAt(this.loc++)));
}
private function skipIgnored():void{
var _local1:int;
do {
_local1 = this.loc;
this.skipWhite();
this.skipComments();
} while (_local1 != this.loc);
}
private function skipComments():void{
if (this.ch == "/"){
this.nextChar();
switch (this.ch){
case "/":
do {
this.nextChar();
} while (((!((this.ch == "\n"))) && (!((this.ch == "")))));
this.nextChar();
break;
case "*":
this.nextChar();
while (true) {
if (this.ch == "*"){
this.nextChar();
if (this.ch == "/"){
this.nextChar();
break;
};
} else {
this.nextChar();
};
if (this.ch == ""){
this.parseError("Multi-line comment not closed");
};
};
break;
default:
this.parseError((("Unexpected " + this.ch) + " encountered (expecting '/' or '*' )"));
};
};
}
private function skipWhite():void{
while (this.isWhiteSpace(this.ch)) {
this.nextChar();
};
}
private function isWhiteSpace(_arg1:String):Boolean{
return ((((((((_arg1 == " ")) || ((_arg1 == "\t")))) || ((_arg1 == "\n")))) || ((_arg1 == "\r"))));
}
private function isDigit(_arg1:String):Boolean{
return ((((_arg1 >= "0")) && ((_arg1 <= "9"))));
}
private function isHexDigit(_arg1:String):Boolean{
var _local2:String = _arg1.toUpperCase();
return (((this.isDigit(_arg1)) || ((((_local2 >= "A")) && ((_local2 <= "F"))))));
}
public function parseError(_arg1:String):void{
throw (new JSONParseError(_arg1, this.loc, this.jsonString));
}
}
}//package com.adobe.serialization.json
Section 9
//JSONTokenType (com.adobe.serialization.json.JSONTokenType)
package com.adobe.serialization.json {
public class JSONTokenType {
public static const UNKNOWN:int = -1;
public static const COMMA:int = 0;
public static const LEFT_BRACE:int = 1;
public static const RIGHT_BRACE:int = 2;
public static const LEFT_BRACKET:int = 3;
public static const RIGHT_BRACKET:int = 4;
public static const COLON:int = 6;
public static const TRUE:int = 7;
public static const FALSE:int = 8;
public static const NULL:int = 9;
public static const STRING:int = 10;
public static const NUMBER:int = 11;
}
}//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 rol(_arg1:int, _arg2:int):int{
return (((_arg1 << _arg2) | (_arg1 >>> (32 - _arg2))));
}
public static function ror(_arg1:int, _arg2:int):uint{
var _local3:int = (32 - _arg2);
return (((_arg1 << _local3) | (_arg1 >>> (32 - _local3))));
}
public static function toHex(_arg1:int, _arg2:Boolean=false):String{
var _local4:int;
var _local5:int;
var _local3 = "";
if (_arg2){
_local4 = 0;
while (_local4 < 4) {
_local3 = (_local3 + (hexChars.charAt(((_arg1 >> (((3 - _local4) * 8) + 4)) & 15)) + hexChars.charAt(((_arg1 >> ((3 - _local4) * 8)) & 15))));
_local4++;
};
} else {
_local5 = 0;
while (_local5 < 4) {
_local3 = (_local3 + (hexChars.charAt(((_arg1 >> ((_local5 * 8) + 4)) & 15)) + hexChars.charAt(((_arg1 >> (_local5 * 8)) & 15))));
_local5++;
};
};
return (_local3);
}
}
}//package com.adobe.utils
Section 11
//Achievement (com.bored.services.data.Achievement)
package com.bored.services.data {
public class Achievement {
public var earnedImageUrl:String;
public var unearnedImageUrl:String;
public var earned:Boolean;
public var name:String;
public var description:String;
public function Achievement(_arg1:Object){
this.name = _arg1.name;
this.description = _arg1.description;
this.earned = _arg1.earned;
this.earnedImageUrl = _arg1.earnedImageUrl;
this.unearnedImageUrl = _arg1.unearnedImageUrl;
}
}
}//package com.bored.services.data
Section 12
//GameInfo (com.bored.services.data.GameInfo)
package com.bored.services.data {
public class GameInfo {
public var scores:Array;
public var achievements:Array;
public var username:String;
public function GameInfo(_arg1:Object){
var _local2:int;
super();
this.username = _arg1.username;
var _local3:Array = (((_arg1) && (_arg1.achievements))) ? _arg1.achievements : new Array();
_local2 = 0;
while (_local2 < _local3.length) {
this.achievements.push(new Achievement(_local3[_local2]));
_local2++;
};
var _local4:Array = (((_arg1) && (_arg1.scores))) ? _arg1.scores : new Array();
_local2 = 0;
while (_local2 < _local4.length) {
this.scores.push(new ScoreDefinition(_local4[_local2]));
_local2++;
};
}
}
}//package com.bored.services.data
Section 13
//ScoreDefinition (com.bored.services.data.ScoreDefinition)
package com.bored.services.data {
public class ScoreDefinition {
public var name:String;
public var code:String;
public var leaderboardAvailable:String;
public var bestScore:String;
public var format:String;
public var type:String;
public var formatParam:String;
public function ScoreDefinition(_arg1:Object){
this.name = _arg1.name;
this.type = _arg1.type;
this.code = _arg1.code;
this.bestScore = _arg1.bestScore;
this.format = _arg1.format;
this.formatParam = _arg1.formatParam;
this.leaderboardAvailable = _arg1.leaderboardAvailable;
}
}
}//package com.bored.services.data
Section 14
//DataReceivedEvent (com.bored.services.events.DataReceivedEvent)
package com.bored.services.events {
import flash.events.*;
public class DataReceivedEvent extends Event {
public var data;
public var key:String;
public static const SAVED_DATA_RECEIVED_EVT:String = "SavedDataReceivedEvent";
public function DataReceivedEvent(_arg1:String, _arg2:String, _arg3, _arg4:Boolean=false, _arg5:Boolean=false){
super(_arg1, _arg4, _arg5);
this.key = _arg2;
this.data = _arg3;
}
override public function toString():String{
return (formatToString("DataReceivedEvent", "type", "key", "data", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new DataReceivedEvent(this.type, this.key, this.data, this.bubbles, this.cancelable));
}
}
}//package com.bored.services.events
Section 15
//ObjectEvent (com.bored.services.events.ObjectEvent)
package com.bored.services.events {
import flash.events.*;
public class ObjectEvent extends Event {
private var _obj:Object;
public static const GAME_INFO_READY_EVT:String = "GameInfoReadyEvent";
public static const SCORE_SUBMISSION_COMPLETE_EVT:String = "ScoreSubmissionCompleteEvent";
public static const NOT_LOGGED_IN_ERROR_EVT:String = "NotLoggedInErrorEvent";
public static const LOGGED_IN_EVENT:String = "LoggedInEvent";
public function ObjectEvent(_arg1:String, _arg2:Object=null, _arg3:Boolean=false, _arg4:Boolean=false){
super(_arg1, _arg3, _arg4);
this._obj = _arg2;
}
public function get obj():Object{
return (this._obj);
}
override public function toString():String{
return (formatToString("ObjectEvent", "type", "obj", "bubbles", "cancelable"));
}
override public function clone():Event{
return (new ObjectEvent(this.type, this._obj, this.bubbles, this.cancelable));
}
public function set obj(_arg1:Object):void{
this._obj = _arg1;
}
}
}//package com.bored.services.events
Section 16
//UserProfile (com.bored.services.events.UserProfile)
package com.bored.services.events {
public class UserProfile {
public var avatarUrl:String;
}
}//package com.bored.services.events
Section 17
//BoredServices (com.bored.services.BoredServices)
package com.bored.services {
import flash.events.*;
import flash.display.*;
import com.bored.services.events.*;
import com.bored.services.data.*;
public class BoredServices {
private static var _userProfile:UserProfile;
private static var _loggedIn:Boolean = false;
private static var _lastScoreCodeSubmitted:String;
private static var _proxyDispatcher:EventDispatcher;
private static var _servicesObj:Object;
public function hasEventListener(_arg1:String):Boolean{
return (proxyDispatcher.hasEventListener(_arg1));
}
public function willTrigger(_arg1:String):Boolean{
return (proxyDispatcher.willTrigger(_arg1));
}
public static function showLoginUI(_arg1:Object=null):void{
if (_servicesObj){
_servicesObj.showLoginUI(_arg1);
};
}
public static function showAchievements():void{
if (_servicesObj){
_servicesObj.showAchievements();
};
}
public static function getGameInfo():void{
if (!_servicesObj){
return;
};
_servicesObj.addEventListener(ObjectEvent.GAME_INFO_READY_EVT, _slot1.redispatchGameInfoObj, false, 0, true);
_servicesObj.getGameInfo();
}
private static function onLoggedIn(_arg1:Event=null):void{
_loggedIn = true;
_slot1.dispatchEvent(new ObjectEvent(ObjectEvent.LOGGED_IN_EVENT));
}
public static function showMainLoginUI():void{
if (_servicesObj){
_servicesObj.showMainLoginUI();
};
}
private static function redispatchObjEvt(_arg1:Event):void{
var objEvt:ObjectEvent;
var obj:Object;
var a_evt = _arg1;
var evtToDispatch:Event = a_evt;
try {
obj = (a_evt as Object).obj;
objEvt = new ObjectEvent(a_evt.type, obj, a_evt.bubbles, a_evt.cancelable);
evtToDispatch = objEvt;
} catch(e:Error) {
};
_slot1.dispatchEvent(evtToDispatch);
}
public static function getRootContainer():DisplayObjectContainer{
var _local1:DisplayObjectContainer;
if (_servicesObj){
_local1 = _servicesObj.rootContainer;
};
return (_local1);
}
public static function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
proxyDispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
public static function addEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false, _arg4:int=0, _arg5:Boolean=false):void{
proxyDispatcher.addEventListener(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public static function showLeaderboard(_arg1:String=null):void{
if (_servicesObj){
if ((((null == _arg1)) && (!(_slot1.isLoggedIn)))){
_slot1.showMainLoginUI();
return;
};
_servicesObj.showLeaderboard(_arg1);
};
}
public static function get isLoggedIn():Boolean{
return (_loggedIn);
}
public static function dispatchEvent(_arg1:Event):Boolean{
return (proxyDispatcher.dispatchEvent(_arg1));
}
private static function onGetDataComplete(_arg1):void{
var _local2:Object = _arg1.obj;
var _local3:String = (_local2) ? _local2.key : null;
var _local4:* = (_local2) ? _local2.data : null;
_slot1.dispatchEvent(new DataReceivedEvent(DataReceivedEvent.SAVED_DATA_RECEIVED_EVT, _local3, _local4));
}
public static function hideLoginUI():void{
if (_servicesObj){
_servicesObj.hideLoginUI();
};
}
private static function redispatchScoreSubmissionObjEvt(_arg1:Event):void{
var _local4:Array;
var _local5:int;
var _local2:ObjectEvent = new ObjectEvent(_arg1.type);
var _local3:Array = (_arg1 as Object).obj;
if (((_local3) && (_local3.length))){
_local4 = new Array();
_local5 = 0;
while (_local5 < _local3.length) {
_local4.push(new Achievement(_local3[_local5]));
_local5++;
};
};
_local2.obj = _local4;
_slot1.dispatchEvent(_local2);
}
public static function get userProfile():UserProfile{
var _local1:UserProfile;
var _local2:Object;
if (((((!(_userProfile)) && (_servicesObj))) && (_servicesObj.userProfile))){
_local2 = _servicesObj.userProfile;
_userProfile = new UserProfile();
_userProfile.avatarUrl = _local2.getValue("avatar_url");
};
return (_userProfile);
}
public static function getData(_arg1:String):void{
if (_servicesObj){
_servicesObj.addEventListener(DataReceivedEvent.SAVED_DATA_RECEIVED_EVT, onGetDataComplete, false, 0, true);
_servicesObj.getData(_arg1);
};
}
public static function submitScore(_arg1, _arg2:Boolean=true, _arg3:String=null, _arg4:Boolean=false):void{
if (_servicesObj){
if (!_slot1.isLoggedIn){
_slot1.showMainLoginUI();
return;
};
_lastScoreCodeSubmitted = null;
if (_arg2){
_lastScoreCodeSubmitted = _arg3;
_servicesObj.addEventListener(ObjectEvent.SCORE_SUBMISSION_COMPLETE_EVT, showLeaderboardOnScoreSubmission, false, 0, true);
};
if (_arg4){
_servicesObj.addEventListener(ObjectEvent.SCORE_SUBMISSION_COMPLETE_EVT, showNewAchievementsOnScoreSubmission, false, 0, true);
};
_servicesObj.submitScore(_arg1, _arg3);
};
}
public static function submitAchievementAcquired(_arg1:String=null, _arg2:Boolean=false):void{
if (_servicesObj){
if (!_slot1.isLoggedIn){
_slot1.showMainLoginUI();
return;
};
if (_arg2){
_servicesObj.addEventListener(ObjectEvent.SCORE_SUBMISSION_COMPLETE_EVT, showNewAchievementsOnScoreSubmission, false, 0, true);
};
_servicesObj.submitScore(1, _arg1);
};
}
private static function redispatchGameInfoObj(_arg1:Event):void{
var _local2:ObjectEvent = new ObjectEvent(_arg1.type);
var _local3:Object = (_arg1 as Object).obj;
var _local4:GameInfo = new GameInfo(_local3);
_local2.obj = _local4;
_slot1.dispatchEvent(_local2);
}
public static function setData(_arg1:String, _arg2):void{
if (_servicesObj){
_servicesObj.setData(_arg1, _arg2);
};
}
private static function redispatch(_arg1:Event):void{
_slot1.dispatchEvent(_arg1);
}
public static function set servicesObj(_arg1:Object):void{
if (!_servicesObj){
_servicesObj = _arg1;
_loggedIn = _servicesObj.isLoggedIn;
if (_loggedIn){
onLoggedIn();
} else {
_servicesObj.addEventListener(ObjectEvent.LOGGED_IN_EVENT, onLoggedIn, false, 0, true);
};
_servicesObj.addEventListener(ObjectEvent.GAME_INFO_READY_EVT, redispatchObjEvt, false, 0, true);
_servicesObj.addEventListener(ObjectEvent.SCORE_SUBMISSION_COMPLETE_EVT, redispatchScoreSubmissionObjEvt);
_servicesObj.addEventListener(ObjectEvent.NOT_LOGGED_IN_ERROR_EVT, redispatchObjEvt, false, 0, true);
};
}
private static function get proxyDispatcher():EventDispatcher{
if (!_proxyDispatcher){
_proxyDispatcher = new EventDispatcher();
};
return (_proxyDispatcher);
}
private static function showNewAchievementsOnScoreSubmission(_arg1:Event):void{
var _local2:Array;
if (_servicesObj){
_servicesObj.removeEventListener(ObjectEvent.SCORE_SUBMISSION_COMPLETE_EVT, showLeaderboardOnScoreSubmission);
if (!_slot1.isLoggedIn){
_slot1.showMainLoginUI();
return;
};
_local2 = (_arg1 as Object).obj;
if (((_local2) && (_local2.length))){
_servicesObj.showAchievements(_local2);
};
};
}
public static function get servicesObj():Object{
return (_servicesObj);
}
public static function setRootContainer(_arg1:DisplayObjectContainer):void{
if (_servicesObj){
_servicesObj.rootContainer = _arg1;
};
}
private static function showLeaderboardOnScoreSubmission(_arg1:Event):void{
if (_servicesObj){
_servicesObj.removeEventListener(ObjectEvent.SCORE_SUBMISSION_COMPLETE_EVT, showLeaderboardOnScoreSubmission);
};
showLeaderboard(_lastScoreCodeSubmitted);
_lastScoreCodeSubmitted = null;
}
}
}//package com.bored.services
Section 18
//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 {
public var background:MovieClip;
private var _showBackground:Boolean;
private var _adURLLoader:URLLoader;
private var _adRect:Sprite;
private var _mask:Shape;
private var _ad:Loader;
private static const DEBUG_AD_URL:String = "http://www.ngads.com/adtest.php";
private static const REMOVED_FROM_STAGE:String = "removedFromStage";
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;
};
Security.allowDomain("server.cpmstar.com");
this._adRect = new Sprite();
this._adRect.graphics.beginFill(0);
this._adRect.graphics.moveTo(0, 0);
this._adRect.graphics.lineTo(300, 0);
this._adRect.graphics.lineTo(300, 250);
this._adRect.graphics.lineTo(0, 250);
this._adRect.graphics.lineTo(0, 0);
this._adRect.graphics.endFill();
this._mask = new Shape();
this._mask.graphics.beginFill(0);
this._mask.graphics.moveTo(0, 0);
this._mask.graphics.lineTo(300, 0);
this._mask.graphics.lineTo(300, 250);
this._mask.graphics.lineTo(0, 250);
this._mask.graphics.lineTo(0, 0);
this._mask.graphics.endFill();
addChild(this._adRect);
this._adRect.addChild(this._mask);
this._adRect.visible = false;
x = Math.round(x);
y = Math.round(y);
scaleX = 1;
scaleY = 1;
if (this.background){
if (this.background.ngLinkButton){
this.background.ngLinkButton.addEventListener(MouseEvent.CLICK, this.linkClickHandler);
};
if (this.background.loadingClip){
this.background.loadingClip.visible = false;
};
};
if (API.isFlashVersion(9, 0, 28)){
addEventListener(REMOVED_FROM_STAGE, this.onRemovedFromStage);
};
if (API.adsApproved){
this.loadAdFeed(API.adFeedURL);
} else {
API.addEventListener(APIEvent.ADS_APPROVED, this.onAdsApproved, false, 0, true);
};
this.showBackground = _arg1;
}
public function get showBackground():Boolean{
return (this._showBackground);
}
public function set showBackground(_arg1:Boolean):void{
this._showBackground = _arg1;
if (this.background){
this.background.visible = _arg1;
this._adRect.mask = (_arg1) ? this.background.adMask : null;
};
}
public function removeAd():void{
removeEventListener(REMOVED_FROM_STAGE, this.onRemovedFromStage);
if (((this.background) && (this.background.loadingClip))){
this.background.loadingClip.visible = false;
};
if (this._adURLLoader){
try {
this._adURLLoader.close();
} catch(e:Error) {
};
};
if (this._adRect){
this._adRect.visible = false;
};
if (this._ad){
trace("[NewgroundsAPI] :: Ad removed");
try {
this._ad.close();
} catch(e:Error) {
};
try {
Object(this._ad).unloadAndStop(true);
} catch(e:Error) {
_ad.unload();
};
if (this._ad.parent){
this._ad.parent.removeChild(this._ad);
};
};
this._ad = null;
}
private function onAdsApproved(_arg1:APIEvent):void{
API.removeEventListener(APIEvent.ADS_APPROVED, this.onAdsApproved, false);
if (_arg1.success){
this.loadAdFeed(API.adFeedURL);
} else {
trace("[NewgroundsAPI] :: No ad feed URL supplied to Newgrounds API ad!");
};
}
private function loadAdFeed(_arg1:String):void{
var adFeedURL = _arg1;
this._adURLLoader = new URLLoader();
this._adURLLoader.addEventListener(Event.COMPLETE, this.onAdFeedLoaded);
this._adURLLoader.addEventListener(IOErrorEvent.IO_ERROR, this.onAdError);
this._adURLLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.onAdError);
if (!adFeedURL){
trace("[Newgrounds API] :: Invalid feed URL!");
return;
};
if (this.hasAdElapsed){
if (adFeedURL.indexOf("?") > -1){
_adURL = new URLRequest(((adFeedURL + "&random=") + Math.random()));
} else {
_adURL = new URLRequest(((adFeedURL + "?random=") + Math.random()));
};
};
try {
this._adURLLoader.load(_adURL);
} catch(e:Error) {
onAdError(null);
};
if (((this.background) && (this.background.loadingClip))){
this.background.loadingClip.visible = true;
};
}
private function loadAd(_arg1:String):void{
var url = _arg1;
if (this._ad){
this.removeAd();
};
this._ad = new Loader();
this._ad.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onAdLoaded);
this._ad.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.onAdError);
try {
Object(this._ad.contentLoaderInfo).uncaughtErrorEvents.addEventListener("uncaughtError", function (_arg1:Event):void{
});
} catch(error:Error) {
};
this._ad.load(new URLRequest(url), new LoaderContext(false, new ApplicationDomain(null)));
if (((this.background) && (this.background.loadingClip))){
this.background.loadingClip.visible = true;
};
}
private function onAdFeedLoaded(_arg1:Event):void{
var _local2:URLLoader = URLLoader(_arg1.target);
if (((_local2.data) && (!((_local2.data == ""))))){
this.loadAd((_local2.data as String));
} else {
dispatchEvent(new APIEvent(APIEvent.AD_ATTACHED, false, new APIError("FLASH_ADS_NOT_APPROVED", "Unable to render ad")));
if (((this.background) && (this.background.loadingClip))){
this.background.loadingClip.visible = false;
};
};
}
private function onAdFeedError(_arg1:Event):void{
trace("[NewgroundsAPI] :: Unable to load ad feed!");
if (((this.background) && (this.background.loadingClip))){
this.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")));
this.removeAd();
}
private function onAdLoaded(_arg1:Event):void{
this._adRect.addChild(this._ad);
this._ad.mask = this._mask;
this._adRect.visible = true;
if (this.background){
if (this._showBackground){
this._adRect.mask = this.background.adMask;
};
if (this.background.loadingClip){
this.background.loadingClip.visible = false;
};
};
trace("[NewgroundsAPI] :: Ad loaded!");
dispatchEvent(new APIEvent(APIEvent.AD_ATTACHED, true));
}
private function onRemovedFromStage(_arg1:Event):void{
this.removeAd();
}
private function get hasAdElapsed():Boolean{
if (getTimer() >= _adResetTime){
_adResetTime = (getTimer() + ((1000 * 60) * 5));
return (true);
};
return (false);
}
private function linkClickHandler(_arg1:MouseEvent):void{
API.loadNewgrounds();
}
}
}//package com.newgrounds.components
Section 19
//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.images.*;
import com.adobe.crypto.*;
import flash.system.*;
public class API {
public static const VERSION:String = "2.4.18";
private static const GATEWAY_URL:String = "http://www.ngads.com/gateway_v2.php";
private static const AD_TERMS_URL:String = "http://www.newgrounds.com/wiki/flashads/terms/";
private static const COMMANDS_WIKI_URL:String = "http://www.newgrounds.com/wiki/flashapi/commands/";
private static var do_echo:Boolean = false;
private static var _debug:Boolean = true;
private static var _connected:Boolean = false;
private static var _isMetadataLoaded:Boolean = false;
private static var _preloadComplete:Boolean = false;
private static var _adsApproved:Boolean = false;
private static var _saveGroupId:uint;
private static var _saveFileId:uint;
private static var _trackerId:uint;
private static var _movieId:String;
private static var _encryptionKey:String;
private static var _url:String;
private static var _host:String;
private static var connected:Boolean;
private static var version:String;
private static var ad_url:String;
private static var _fakeSession:Boolean = false;
private static var publisher_id:uint;
private static var session_id:String;
private static var user_email:String;
private static var user_name:String;
private static var user_id:uint;
private static var userpage_format:String;
private static var _medals:Array;
private static var timeoutTimer:Timer = new Timer(8000, 1);
private static var _userpageFormat:String;
private static var _scoreboards:Array = new Array();
private static var _bridge:Bridge;
private static var save_file:SaveFile;
private static var _imageFilePath:String;
private static var _saveFilePath:String;
private static var _saveGroups:Array = [];
private static var root:DisplayObject;
private static var _eventDispatcher:EventDispatcher = new EventDispatcher();
private static var score_page_counts:Object = new Object();
private static var compression_radix:String = "/g8236klvBQ#&|;Zb*7CEA59%s`Oue1wziFp$rDVY@TKxUPWytSaGHJ>dmoMR^<0~4qNLhc(I+fjn)X";
private static var compressor:BaseN = new BaseN(compression_radix);
public static var errors:Dictionary = APIError.init_codes();
private static var sharedObjects:Dictionary = new Dictionary();
private static var _preloadAssets:Array = [];
public static var periods:Object = getPeriodAliases();
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 secureCommand:String;
public static function get adFeedURL():String{
return (ad_url);
}
public static function get preloadComplete():Boolean{
return (_preloadComplete);
}
private static function assertConnected():Boolean{
if (!_connected){
return (false);
};
return (true);
}
public static function setVersion(_arg1:String):void{
if (((_arg1) && (!((_arg1 == ""))))){
version = _arg1;
};
}
public static function setUserEmail(_arg1:String):void{
user_email = _arg1;
}
public static function setFakeSession(_arg1:Boolean):void{
_fakeSession = _arg1;
}
public static function getFakeSession():Boolean{
return (_fakeSession);
}
public static function get debugMode():Boolean{
return (_debug);
}
public static function set debugMode(_arg1:Boolean):void{
_debug = _arg1;
}
public static function getTrackerID():uint{
return (_trackerId);
}
public static function getUserID():uint{
return (user_id);
}
public static function getUserName():String{
return (user_name);
}
public static function isConnected():Boolean{
return (_connected);
}
public static function getID():uint{
return (_trackerId);
}
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 get adsApproved():Boolean{
return (_adsApproved);
}
public static function hasUserSession():Boolean{
return (((((!((session_id == null))) && (!((session_id == ""))))) && (!((publisher_id == 0)))));
}
public static function isNewgrounds():Boolean{
return ((((publisher_id == 1)) || (((_host) && ((_host.toLowerCase().indexOf("ungrounded.net") > -1))))));
}
public static function hostIsCompatible():Boolean{
return (!((publisher_id == 0)));
}
public static function hasUserEmail():Boolean{
return (((!((user_email == null))) && (!((user_email == "")))));
}
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.")));
}
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) {
};
_url = loaderInfo.url;
_host = _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 = 0;
};
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;
};
if (flashVars.NewgroundsAPI_SandboxID){
_bridge = new Bridge(flashVars.NewgroundsAPI_SandboxID);
};
} else {
publisher_id = 1;
if (_fakeSession){
session_id = "D3bu64p1U53R";
user_id = 10;
user_name = "API-Debugger";
};
};
if (connected){
fatalError("NewgroundsAPI.connect() - connection already in progress", "connect");
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});
}
private static function getHost():String{
return (_host);
}
public static function isPublishedHost():Boolean{
return (((!((getHost() == "localhost"))) && ((getHost().indexOf("file://") == -1))));
}
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 loadNewgrounds():void{
sendCommand("loadNewgrounds", {host:getHost()}, true);
}
public static function loadOfficialURL():void{
navigateToURL(new URLRequest(getOfficialURL()));
}
public static function loadMySite():void{
sendCommand("loadMySite", {host:getHost()}, true);
}
public static function loadCustomLink(_arg1:String):void{
sendCommand("loadCustomLink", {host:getHost(), link:_arg1}, true);
}
public static function logCustomEvent(_arg1:String):void{
sendCommand("logCustomEvent", {host:getHost(), event:_arg1});
}
public static function getScoreBoard(_arg1:String):ScoreBoard{
var _local2:ScoreBoard;
for each (_local2 in _scoreboards) {
if (_local2.name == _arg1){
return (_local2);
};
};
return (null);
}
public static function getScoreBoardById(_arg1:uint):ScoreBoard{
var _local2:ScoreBoard;
for each (_local2 in _scoreboards) {
if (_local2.id == _arg1){
return (_local2);
};
};
return (null);
}
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});
}
public static function loadScores(_arg1:String, _arg2:String=null, _arg3:String=null):void{
var _local4 = "loadScores";
var _local5:ScoreBoard = getScoreBoard(_arg1);
if (((!(_local5)) || (!(_local5.id)))){
sendError({command_id:getCommandID(_local4)}, new APIError("MISSING_PARAM", "missing required ScoreBoard instance"));
return;
};
var _local6:Object = {};
_local6.publisher_id = publisher_id;
if (_arg2){
_local6.period = _arg2;
} else {
_local6.period = _local5.period;
};
_local6.board = _local5.id;
_local6.num_results = _local5.num_results;
_local6.page = _local5.page;
if (((!(_arg3)) || ((_arg3 == "")))){
_local6.tag = _local5.tag;
} else {
_local6.tag = _arg3;
};
sendCommand(_local4, _local6);
}
public static function loadScoresInRange(_arg1:String, _arg2:String="All-Time", _arg3:uint=1, _arg4:uint=10):void{
if (((!(_arg1)) || ((_arg1 == "")))){
sendError({command_id:getCommandID("postScore")}, new APIError("MISSING_PARAM", "missing required parameter(s)"));
return;
};
var _local5:ScoreBoard = getScoreBoard(_arg1);
if (_local5){
_local5.loadScoresInRange(_arg2, _arg3, _arg4);
} else {
sendWarning((("loadScoresInRange: Scoreboard " + _arg1) + " could not be found."));
};
}
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++;
};
};
sendMessage("Medals loaded!");
}
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++;
};
}
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 getMedals():Array{
return (_medals);
}
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 getMedal(_arg1:String):Medal{
var _local2:Medal;
for each (_local2 in _medals) {
if (_local2.name == _arg1){
return (_local2);
};
};
return (null);
}
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 = getMedal(_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.UNLOCK_MEDAL, true, {medal:_local2});
};
}
public static function loadMedals():void{
if (_medals){
dispatchEvent(new APIEvent(APIEvent.MEDALS_LOADED, true, {medals:getMedals()}));
return;
};
var _local1:Object = new Object();
if (hasUserSession()){
_local1.publisher_id = publisher_id;
_local1.user_id = user_id;
};
sendCommand("getMedals", _local1);
}
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 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);
}
public static function encodeData(_arg1:Object):String{
return (compressHex(RC4.encrypt(JSON.encode(_arg1), _encryptionKey)));
}
public static function decodeData(_arg1:String){
return (JSON.decode(RC4.decrypt(uncompressHex(_arg1), _encryptionKey)));
}
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));
}
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 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);
}
public static function getSaveGroup(_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);
}
public static function getCurrentSaveFile(){
return (save_file);
}
public static function setCurrentSaveFile(_arg1:SaveFile){
save_file = _arg1;
}
public static function newSaveQuery(_arg1:String):SaveGroupQuery{
var _local2:SaveGroup = getSaveGroup(_arg1);
if (_local2){
return (_local2.newQuery());
};
return (null);
}
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);
}
public static function lookupSaveFiles(_arg1:SaveGroup):void{
var _local2:SaveGroupQuery = _arg1.getQuery(false);
sendCommand("lookupSaveFiles", {publisher_id:publisher_id, group_id:_arg1.id, query:_local2.toObject()}, false, null, _local2);
}
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 newSaveFile(_arg1:String):SaveFile{
var _local2:SaveGroup = getSaveGroup(_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 saveFile(_arg1:SaveFile, _arg2:Boolean=false, _arg3:Boolean=false):void{
var _local4:Object = _arg1.toObject();
_local4.user_name = user_name;
if (_arg1.id){
_local4.save_id = _arg1.id;
};
_local4.overwrite = (_arg2) ? 1 : 0;
if (_arg3){
_local4.draft = 1;
};
var _local5:ByteArray = new ByteArray();
if ((_arg1.contents is ByteArray)){
_local5.writeByte(0);
_local5.writeBytes(_arg1.contents);
} else {
_local5.writeByte(1);
_local5.writeObject(_arg1.contents);
};
_local5.compress();
var _local6:Object = new Object();
_local6.file = _local5;
if (_arg1.thumbnail){
_local6.thumbnail = PNGEncoder.encode(_arg1.thumbnail);
};
save_file = _arg1;
sendSecureCommand("saveFile", _local4, null, _local6, _arg1);
}
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 loadSaveFile(_arg1:Number, _arg2:Boolean=true){
var _local3:Object = {publisher_id:publisher_id, save_id:_arg1, get_contents:_arg2};
save_file = null;
sendCommand("loadSaveFile", _local3);
}
public static function loadFilesByDate(_arg1:String, _arg2:Boolean=true, _arg3:String=null, _arg4=null):void{
var _local7:*;
var _local5:SaveGroup = getSaveGroup(_arg1);
if (!_local5){
_local7 = new APIError("QUERY_INCOMPLETE", "The query could not be preformed, check the spelling of your save group name.");
sendError({command_id:"loadFilesByDate"}, _local7);
return;
};
var _local6:SaveGroupQuery = _local5.newQuery();
if (_arg3){
_local6.addKeyCondition(_arg3, "=", _arg4);
};
_local6.sortOn(SaveGroupQuery.CREATED_ON, _arg2);
_local6.execute();
}
public static function loadFilesByViews(_arg1:String, _arg2:Boolean=true, _arg3:String=null, _arg4=null):void{
var _local7:*;
var _local5:SaveGroup = getSaveGroup(_arg1);
if (!_local5){
_local7 = new APIError("QUERY_INCOMPLETE", "The query could not be preformed, check the spelling of your save group name.");
sendError({command_id:"loadFilesByViews"}, _local7);
return;
};
var _local6:SaveGroupQuery = _local5.newQuery();
if (_arg3){
_local6.addKeyCondition(_arg3, "=", _arg4);
};
_local6.sortOn(SaveGroupQuery.TOTAL_VIEWS, _arg2);
_local6.execute();
}
public static function loadFilesByRating(_arg1:String, _arg2:String, _arg3:Boolean=true, _arg4:String=null, _arg5=null):void{
var _local8:*;
var _local6:SaveGroup = getSaveGroup(_arg1);
if (!_local6){
_local8 = new APIError("QUERY_INCOMPLETE", "The query could not be preformed, check the spelling of your save group name.");
sendError({command_id:"loadFilesByDate"}, _local8);
return;
};
var _local7:SaveGroupQuery = _local6.newQuery();
if (_arg4){
_local7.addKeyCondition(_arg4, "=", _arg5);
};
_local7.sortOnRating(_arg2, _arg3);
_local7.execute();
}
public static function onRemoteAuthentication(_arg1:String){
var _local2:Object = JSON.decode(RC4.decrypt(_arg1, _encryptionKey));
user_id = _local2.NewgroundsAPI_UserID;
user_name = _local2.NewgroundsAPI_UserName;
session_id = _local2.NewgroundsAPI_SessionID;
publisher_id = _local2.NewgroundsAPI_PublisherID;
}
private static function doEvent(_arg1:Object):void{
var _local2:String;
var _local3:Object;
var _local4:String;
var _local5:Boolean;
var _local6:ScoreBoard;
var _local7:Array;
var _local8:*;
var _local9:String;
var _local10:Medal;
var _local11:SaveGroup;
var _local12:Object;
var _local13:Object;
var _local14:Object;
var _local15:SaveFile;
var _local16:uint;
var _local17:Object;
var _local18:uint;
var _local19:APIError;
var _local20:Object;
switch (getCommandName(_arg1.command_id)){
case "connectMovie":
timeoutTimer.stop();
if (_arg1.success){
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});
} else {
callListener(APIEvent.API_CONNECTED, _arg1.success, {});
return;
};
_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:_url});
};
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...");
_local8 = loadLocal("medals_unlocked");
if (_local8){
for (_local9 in _local8) {
if (_local8[_local9]){
_local10 = getMedalById(uint(_local9));
echo(("Now unlocking " + _local10.name));
_local10.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);
};
sendMessage("Metadata loaded!");
callListener(APIEvent.METADATA_LOADED, _arg1.success);
if (((_saveFileId) && (_saveGroupId))){
_local11 = getSaveGroupById(_saveGroupId);
if (_local11){
callListener(APIEvent.FILE_REQUESTED, true, {save_id:_saveFileId, group:_local11});
};
};
_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) + "'"));
};
if (_arg1.best_scores){
_local12 = {today:_arg1.best_scores.D, yesterday:_arg1.best_scores.P, week:_arg1.best_scores.W, year:_arg1.best_scores.Y, all_time:_arg1.best_scores.A};
} else {
_local12 = {};
};
if (_arg1.best_ranks){
_local13 = {today:_arg1.best_ranks.D, yesterday:_arg1.best_ranks.P, week:_arg1.best_ranks.W, year:_arg1.best_ranks.Y, all_time:_arg1.best_ranks.A};
} else {
_local13 = {};
};
if (_arg1.num_scores){
_local14 = {today:_arg1.num_scores.D, yesterday:_arg1.num_scores.P, week:_arg1.num_scores.W, year:_arg1.num_scores.Y, all_time:_arg1.num_scores.A};
} else {
_local14 = {};
};
_local3 = {score:_arg1.score, value:_arg1.value, username:_local4, best_scores:_local12, best_ranks:_local13, num_scores:_local14};
};
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, _arg1.num_scores);
};
callListener(APIEvent.SCORES_LOADED, _arg1.success, {board:_local6});
break;
case "unlockMedal":
if (_medals){
_local10 = getMedal(_arg1.medal_name);
if (_local10.unlocked){
return;
};
_local10.unlocked = true;
callListener(APIEvent.MEDAL_UNLOCKED, _arg1.success, {medal_id:_local10.id, medal:_local10});
};
break;
case "getMedals":
if (_arg1.success){
populateMedals(_arg1.medals);
};
callListener(APIEvent.MEDALS_LOADED, _arg1.success, _local3);
break;
case "loadSaveFile":
if (_arg1.success){
_local11 = getSaveGroupById(_arg1.group_id);
_local15 = new SaveFile(_local11);
_local15.id = _arg1.file.save_id;
_local15.name = _arg1.file.filename;
_local15.fileUrl = (_saveFilePath + _arg1.file.file);
_local15.thumbnailUrl = (_imageFilePath + _arg1.file.thumb);
_local15.authorName = _arg1.file.user_name;
_local15.authorId = _arg1.file.user_id;
_local15.setStatus(_arg1.file.status);
_local15.description = _arg1.file.description;
_local15.setFileSize(_arg1.file.file_size);
if (((_arg1.file.keys) && (_arg1.file.keys.length))){
_local16 = 0;
while (_local16 < _arg1.file.keys.length) {
_local15.setKey(_arg1.file.keys[_local16].id, _arg1.file.keys[_local16].value);
_local16++;
};
};
if (((_arg1.file.ratings) && (_arg1.file.ratings.length))){
_local16 = 0;
while (_local16 < _arg1.file.ratings.length) {
_local15.setRating(_arg1.file.ratings[_local16].id, _arg1.file.ratings[_local16].votes, _arg1.file.ratings[_local16].score);
_local16++;
};
};
if (_arg1.get_contents){
_local15.loadContents();
};
};
save_file = _local15;
callListener(APIEvent.FILE_INITIALIZED, _arg1.success, {save_id:_local15.id, file:_local15});
break;
case "lookupSaveFiles":
_local7 = [];
if (((_arg1.success) && (_arg1.files))){
_local16 = 0;
while (_local16 < _arg1.files.length) {
_local17 = _arg1.files[_local16];
_local15 = new SaveFile(getSaveGroupById(_arg1.group_id));
_local15.name = _local17.filename;
_local15.id = _local17.save_id;
_local15.description = _local17.description;
_local15.thumbnailUrl = (_imageFilePath + _local17.thumb);
_local15.fileUrl = (_saveFilePath + _local17.file);
_local15.authorName = _local17.user_name;
_local15.authorId = _local17.user_id;
_local15.setStatus(_local17.status);
_local15.setFileSize(_local17.file_size);
if (((_local17.keys) && (_local17.keys.length))){
_local18 = 0;
while (_local18 < _local17.keys.length) {
_local15.setKey(_local17.keys[_local18].id, _local17.keys[_local18].value);
_local18++;
};
};
if (((_local17.ratings) && (_local17.ratings.length))){
_local18 = 0;
while (_local18 < _local17.ratings.length) {
_local15.setRating(_local17.ratings[_local18].id, _local17.ratings[_local18].votes, _local17.ratings[_local18].score);
_local18++;
};
};
_local7.push(_local15);
_local16++;
};
};
_arg1.owner.setResults(_local7);
_arg1.owner.dispatchEvent(new APIEvent(APIEvent.QUERY_COMPLETE, _arg1.success, {query:_arg1.owner}));
callListener(APIEvent.QUERY_COMPLETE, _arg1.success, {query:_arg1.owner});
break;
case "rateSaveFile":
_local15 = _arg1.owner;
_arg1.success = ((_arg1.success) && (!(_arg1.already_voted)));
if (_arg1.success){
_local15.setRating(_arg1.rating_id, _arg1.votes, _arg1.score);
};
_arg1.file = _local15;
if (_arg1.already_voted){
_local19 = new APIError("PERMISSION_DENIED", "You have already voted on this item today");
_local15.dispatchEvent(new APIEvent(APIEvent.VOTE_COMPLETE, _arg1.success, {error:_local19, file:_local15, save_id:_local15.id}));
callListener(APIEvent.VOTE_COMPLETE, _arg1.success, _arg1);
} else {
_local20 = _local15.getRating(_arg1.rating_id);
_local15.dispatchEvent(new APIEvent(APIEvent.VOTE_COMPLETE, _arg1.success, {rating:_local20, file:_local15, save_id:_local15.id}));
API.callListener(APIEvent.VOTE_COMPLETE, _arg1.success, {rating:_local20, file:_local15, save_id:_local15.id});
};
break;
case "saveFile":
_local3 = {};
if (_arg1.success){
_local3 = {save_id:_arg1.save_id, filename:_arg1.filename, file_url:_arg1.file_url, thumbnail:_arg1.thumbnail, icon:_arg1.icon};
SaveFile(_arg1.owner).fileSaved(_local3);
};
_arg1.owner.dispatchEvent(new APIEvent(APIEvent.FILE_SAVED, _arg1.success, {save_id:save_file.id, file:save_file}));
callListener(APIEvent.FILE_SAVED, _arg1.success, {save_id:save_file.id, file:save_file});
save_file = null;
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 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 hasEventListener(_arg1:String):Boolean{
return (_eventDispatcher.hasEventListener(_arg1));
}
public static function removeEventListener(_arg1:String, _arg2:Function, _arg3:Boolean=false):void{
_eventDispatcher.removeEventListener(_arg1, _arg2, _arg3);
}
private static function dispatchEvent(_arg1:Event):void{
_eventDispatcher.dispatchEvent(_arg1);
echo(("Fired Event: " + _arg1.type));
}
static function callListener(_arg1:String, _arg2:Boolean=true, _arg3=undefined):void{
dispatchEvent(new APIEvent(_arg1, _arg2, _arg3));
if (_bridge){
_bridge.sendEvent(_arg1, {success:_arg2, data:_arg3});
};
}
private static function getCommandName(_arg1:String):String{
return (_arg1);
}
private static function getCommandID(_arg1:String):String{
return (_arg1);
}
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);
}
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 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 sendError(_arg1:Object, _arg2:APIError):void{
var _local3:String = ((((("[NewgroundsAPI ERROR] :: " + getCommandName(_arg1.command_id)) + "() - ") + _arg2.name) + ":\n\t\t\t\t") + _arg2.message);
trace(_local3);
if (_bridge){
_bridge.sendEvent("trace", {data:_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(_arg1);
if (_bridge){
_bridge.sendEvent("trace", {data:_arg1});
};
}
private static function sendNotice(_arg1:String, _arg2:String=null):void{
var _local3:String;
if (_arg2){
_arg1 = (_arg1 + ((("\n[NewgroundsAPI NOTICE] :: \tSee " + COMMANDS_WIKI_URL) + _arg2.toLowerCase()) + " for additional information."));
};
trace(_arg1);
if (_bridge){
_bridge.sendEvent("trace", {data:_arg1});
};
}
private static function fatalError(_arg1:String, _arg2:String):void{
if (_arg2){
_arg1 = (_arg1 + ((("\n\tSee " + COMMANDS_WIKI_URL) + _arg2.toLowerCase()) + " for additional information."));
};
trace(("***ERROR*** class=API\n\n" + _arg1));
}
public static function openLoginPage(){
if (hasUserSession()){
return;
};
}
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);
secureCommand = _arg1;
sendCommand("securePacket", _arg3, false, _arg4, _arg5);
}
public static function stopPendingCommands():void{
SmartURLLoader.closeAll();
}
private static function onCommandComplete(_arg1:Event):void{
var response:Object;
var error:APIError;
var e = _arg1;
var loader:SmartURLLoader = SmartURLLoader(e.target);
echo((("INPUT: \n" + loader.response) + "\n"));
var i:uint;
while (i < _preloadAssets.length) {
if (_preloadAssets[i] == loader){
_preloadAssets.splice(i, 1);
break;
};
i = (i + 1);
};
try {
response = JSON.decode(loader.response);
} catch(error:Error) {
};
if (!response){
response = {command_id:loader._command, success:false};
};
response.owner = loader.owner;
if (((!(response)) || (!(response.success)))){
if (response.command_id == "connectMovie"){
connected = false;
};
error = new APIError(response.error_code, response.error_msg);
sendError(response, error);
if (response.command_id){
doEvent(response);
};
} else {
doEvent(response);
};
}
private static function onCommandError(_arg1:Event):void{
var _local2:Object = {success:false};
var _local3:SmartURLLoader = SmartURLLoader(_arg1.target);
_local2.owner = _local3.owner;
var _local4:uint;
while (_local4 < _preloadAssets.length) {
if (_preloadAssets[_local4] == _local3){
_preloadAssets.splice(_local4, 1);
break;
};
_local4++;
};
if (_local3._command){
_local2.command_id = _local3._command;
if (_local2.command_id == "connectMovie"){
connected = false;
};
doEvent(_local2);
};
}
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;
};
if (_arg2.secure){
_local6._command = secureCommand;
} else {
_local6._command = getCommandID(_arg1);
};
_local6.owner = _arg5;
_local6.load(GATEWAY_URL);
}
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 createAd():FlashAd{
sendMessage("You may see a security sandbox violation. This is normal!");
return (new FlashAd());
}
public static function sendMessage(_arg1:String, _arg2:Boolean=false):void{
var _local3:String = ("[NewgroundsAPI] :: " + _arg1);
trace(_local3);
if (_bridge){
_bridge.sendEvent("trace", {data:_local3});
};
}
private static function echo(_arg1:String):void{
if (do_echo){
trace(_arg1);
};
}
}
}//package com.newgrounds
Section 20
//APIError (com.newgrounds.APIError)
package com.newgrounds {
import flash.utils.*;
public class APIError {
public var code:Number;// = 0
public var message:String;
public var name:String;
public var alias:String;
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");
private static const always_caps:Array = new Array("API", "URL", "ID");
public static const error_codes:Object = init_codes();
public static const error_names:Object = init_names();
public function APIError(_arg1, _arg2:String){
if ((_arg1 is String)){
_arg1 = error_codes[_arg1];
} else {
if (!(_arg1 is uint)){
_arg1 = 0;
};
};
this.code = _arg1;
this.message = _arg2;
this.name = error_names[_arg1];
this.alias = aliases[_arg1];
}
public function isError():Boolean{
return (true);
}
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);
}
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);
}
}
}//package com.newgrounds
Section 21
//APIEvent (com.newgrounds.APIEvent)
package com.newgrounds {
import flash.events.*;
public class APIEvent extends Event {
private var _data;
private var _success:Boolean;
private var _target;
private var _error:APIError;
public static const API_CONNECTED:String = "movieConnected";
public static const ADS_APPROVED:String = "adsApproved";
public static const AD_ATTACHED:String = "adAttached";
public static const HOST_BLOCKED:String = "hostBlocked";
public static const NEW_VERSION_AVAILABLE:String = "newVersionAvailable";
public static const EVENT_LOGGED:String = "eventLogged";
public static const SCORE_POSTED:String = "scorePosted";
public static const SCORES_LOADED:String = "scoresLoaded";
public static const UNLOCK_MEDAL:String = "unlockMedal";
public static const MEDAL_UNLOCKED:String = "medalUnlocked";
public static const MEDALS_LOADED:String = "medalsLoaded";
public static const METADATA_LOADED:String = "metadataLoaded";
public static const FILE_PRIVS_LOADED:String = "filePrivsLoaded";
public static const FILE_SAVED:String = "fileSaved";
public static const FILE_LOADED:String = "fileLoaded";
public static const FILE_INITIALIZED:String = "fileInitialized";
public static const FILE_REQUESTED:String = "fileRequested";
public static const QUERY_COMPLETE:String = "queryComplete";
public static const VOTE_COMPLETE:String = "voteComplete";
public function APIEvent(_arg1:String, _arg2:Boolean=true, _arg3=undefined){
super(_arg1);
this._data = _arg3;
this._success = _arg2;
}
public function get success():Boolean{
return (this._success);
}
public function get data(){
return (this._data);
}
}
}//package com.newgrounds
Section 22
//BaseN (com.newgrounds.BaseN)
package com.newgrounds {
import flash.utils.*;
public class BaseN {
private var _hashIndex:String;
private var _hashVal:Dictionary;
private var _base:Number;
public function BaseN(_arg1:String=null){
if (_arg1){
this._hashIndex = _arg1;
} else {
this._hashIndex = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~@#$%^&*()+|;/";
};
this._base = this._hashIndex.length;
this._hashVal = new Dictionary();
var _local2:uint;
while (_local2 < this._base) {
this._hashVal[this._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 + this.baseNEncoder(_local5[0], _arg2));
if (_local5.length > 1){
_local4 = (_local4 + ("." + this.baseNEncoder(_local5[1])));
};
return (_local4);
}
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 + this.baseNDecoder(_local3[0]));
if (_local3.length > 1){
_local2 = (_local2 + ".");
_local2 = (_local2 + this.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 = (this._hashIndex.charAt((_local4 % this._base)) + _local3);
_local4 = (_local4 / this._base);
};
if (_arg2){
while (_local3.length < _arg2) {
_local3 = (this._hashIndex.charAt(0) + _local3);
};
};
return (_local3);
}
private function baseNDecoder(_arg1:String):uint{
var _local2:uint;
var _local3:uint;
while (_local3 < _arg1.length) {
_local2 = (_local2 * this._base);
_local2 = (_local2 + this._hashVal[_arg1.charAt(_local3)]);
_local3++;
};
return (_local2);
}
}
}//package com.newgrounds
Section 23
//Bridge (com.newgrounds.Bridge)
package com.newgrounds {
import flash.events.*;
import flash.net.*;
public class Bridge {
private var _inConnection:LocalConnection;
private var _outConnection:LocalConnection;
private var _widgetId:String;
public function Bridge(_arg1:String){
this._widgetId = _arg1;
this._inConnection = new LocalConnection();
this._outConnection = new LocalConnection();
this._inConnection.client = this;
this._inConnection.connect(("rec_" + this._widgetId));
this._outConnection.addEventListener(StatusEvent.STATUS, this.onStatus);
}
public function sendCommand(_arg1:String, _arg2:Object):void{
if (this._outConnection){
this._outConnection.send(this._widgetId, "sendCommand", _arg1, this.scrubParameters(_arg2));
};
}
public function sendEvent(_arg1:String, _arg2:Object):void{
if (this._outConnection){
this._outConnection.send(this._widgetId, "sendEvent", _arg1, this.scrubParameters(_arg2));
};
}
public function receiveEvent(_arg1:String, _arg2:Object):void{
API.callListener(_arg1, _arg2.success, _arg2.data);
}
public function scrubParameters(_arg1:Object):Object{
var _local3:String;
var _local2:Object = new Object();
for (_local3 in _arg1) {
if ((((((((((_arg1[_local3] is String)) || ((_arg1[_local3] is Number)))) || ((_arg1[_local3] is uint)))) || ((_arg1[_local3] is int)))) || ((_arg1[_local3] is Boolean)))){
_local2[_local3] = _arg1[_local3];
};
};
return (_local2);
}
private function onStatus(_arg1:Event):void{
}
}
}//package com.newgrounds
Section 24
//Medal (com.newgrounds.Medal)
package com.newgrounds {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class Medal {
private var _id:uint;
private var _name:String;
private var _value:uint;
private var _difficultyId:uint;
private var _unlocked:Boolean;// = false
private var _iconUrl:URLRequest;
private var _iconLoader:Loader;
private var _icon:BitmapData;
private static const DEFAULT_ICON:BitmapData = new BitmapData(50, 50, false, 0);
private static const DIFFICULT_NAMES:Array = [null, "Easy", "Moderate", "Challenging", "Difficult", "Brutal"];
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;
this._icon = DEFAULT_ICON;
super();
this._id = id;
this._name = name;
this._value = value;
this._difficultyId = difficulty;
this._unlocked = unlocked;
if (iconUrl){
this._iconUrl = new URLRequest(iconUrl);
this._iconLoader = new Loader();
this._iconLoader.contentLoaderInfo.addEventListener(Event.INIT, this.onIconLoaderInit);
this._iconLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, this.onIconLoaderError);
this._iconLoader.contentLoaderInfo.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.onIconLoaderError);
this._iconLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, this.onIconLoaderComplete);
try {
this._iconLoader.load(this._iconUrl, new LoaderContext(true));
} catch(e:Error) {
onIconLoaderError(null);
};
};
}
public function get difficulty():String{
return (DIFFICULT_NAMES[this._difficultyId]);
}
public function get difficultyId():uint{
return (this._difficultyId);
}
public function get icon():BitmapData{
return (this._icon);
}
public function get id():uint{
return (this._id);
}
public function get name():String{
return (this._name);
}
public function get unlocked():Boolean{
return (this._unlocked);
}
public function isUnlocked():Boolean{
return (this._unlocked);
}
public function set unlocked(_arg1:Boolean):void{
this._unlocked = _arg1;
}
public function get value():uint{
return (this._value);
}
public function get bytesLoaded():uint{
return ((this._iconLoader) ? this._iconLoader.contentLoaderInfo.bytesLoaded : 0);
}
public function get bytesTotal():uint{
return ((this._iconLoader) ? this._iconLoader.contentLoaderInfo.bytesTotal : 0);
}
public function getID():uint{
return (this._id);
}
public function getName():String{
return (this._name);
}
public function getValue():uint{
return (this._value);
}
public function getDifficulty():String{
return (DIFFICULT_NAMES[this._difficultyId]);
}
private function onIconLoaderInit(_arg1:Event):void{
}
private function onIconLoaderError(_arg1:IOErrorEvent):void{
trace((((("[NewgroundsAPI WARNING] :: Failed to load medal icon for " + this.name) + " (") + this._iconUrl.url.split("/").pop()) + ")"));
this._iconLoader.unload();
this._iconLoader = null;
}
private function onIconLoaderComplete(_arg1:Event):void{
var _local2:Bitmap = (this._iconLoader.content as Bitmap);
this._icon = _local2.bitmapData;
this._iconLoader.unload();
this._iconLoader = null;
}
public function unlock():void{
if (!this._unlocked){
API.unlockMedal(this._name);
};
}
public function createIconBitmap():Bitmap{
return (new Bitmap(this.icon));
}
public function toString():String{
return (this._name);
}
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 25
//RC4 (com.newgrounds.RC4)
package com.newgrounds {
public class RC4 {
private static var sbox:Array = new Array(0xFF);
private static var mykey:Array = new Array(0xFF);
public static function encrypt(_arg1:String, _arg2:String):String{
var _local3:Array = strToChars(_arg1);
var _local4:Array = strToChars(_arg2);
var _local5:Array = calculate(_local3, _local4);
return (charsToHex(_local5));
}
public static function encryptbin(_arg1:String, _arg2:String):Array{
var _local3:Array = strToChars(_arg1);
var _local4:Array = strToChars(_arg2);
var _local5:Array = calculate(_local3, _local4);
return (_local5);
}
public static function decrypt(_arg1:String, _arg2:String):String{
var _local3:Array = hexToChars(_arg1);
var _local4:Array = strToChars(_arg2);
var _local5:Array = calculate(_local3, _local4);
return (charsToStr(_local5));
}
private static function initialize(_arg1:Array):void{
var _local3:uint;
var _local2:uint;
var _local4:uint = _arg1.length;
var _local5:uint;
while (_local5 <= 0xFF) {
mykey[_local5] = _arg1[(_local5 % _local4)];
sbox[_local5] = _local5;
_local5++;
};
_local5 = 0;
while (_local5 <= 0xFF) {
_local2 = (((_local2 + sbox[_local5]) + mykey[_local5]) % 0x0100);
_local3 = sbox[_local5];
sbox[_local5] = sbox[_local2];
sbox[_local2] = _local3;
_local5++;
};
}
private static function calculate(_arg1:Array, _arg2:Array):Array{
var _local6:uint;
var _local7:uint;
var _local8:uint;
var _local10:uint;
initialize(_arg2);
var _local3:uint;
var _local4:uint;
var _local5:Array = new Array();
var _local9:uint;
while (_local9 < _arg1.length) {
_local3 = ((_local3 + 1) % 0x0100);
_local4 = ((_local4 + sbox[_local3]) % 0x0100);
_local7 = sbox[_local3];
sbox[_local3] = sbox[_local4];
sbox[_local4] = _local7;
_local10 = ((sbox[_local3] + sbox[_local4]) % 0x0100);
_local6 = sbox[_local10];
_local8 = (_arg1[_local9] ^ _local6);
_local5.push(_local8);
_local9++;
};
return (_local5);
}
private static function charsToHex(_arg1:Array):String{
var _local2:String = new String("");
var _local3:Array = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
var _local4:uint;
while (_local4 < _arg1.length) {
_local2 = (_local2 + (_local3[(_arg1[_local4] >> 4)] + _local3[(_arg1[_local4] & 15)]));
_local4++;
};
return (_local2);
}
private static function hexToChars(_arg1:String):Array{
var _local2:Array = new Array();
var _local3:uint = ((_arg1.substr(0, 2))=="0x") ? 2 : 0;
while (_local3 < _arg1.length) {
_local2.push(parseInt(_arg1.substr(_local3, 2), 16));
_local3 = (_local3 + 2);
};
return (_local2);
}
private static function charsToStr(_arg1:Array):String{
var _local2:String = new String("");
var _local3:uint;
while (_local3 < _arg1.length) {
_local2 = (_local2 + String.fromCharCode(_arg1[_local3]));
_local3++;
};
return (_local2);
}
private static function strToChars(_arg1:String):Array{
var _local2:Array = new Array();
var _local3:uint;
while (_local3 < _arg1.length) {
_local2.push(_arg1.charCodeAt(_local3));
_local3++;
};
return (_local2);
}
}
}//package com.newgrounds
Section 26
//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 _filename:String;
private var _id:uint;
private var _description:String;
private var _contents;
private var _loader:SmartURLLoader;
private var _group:SaveGroup;
private var _keys:Dictionary;
private var _ratings:Dictionary;
private var _fileUrl:String;
private var _thumbnail:BitmapData;
private var _thumbnailUrl:String;
private var _authorId:uint;
private var _authorName:String;
private var _contentSize:uint;
private var _locked:Boolean;
private var _status:uint;
private var duplicate_id:uint;
private var _draft:Boolean;
public static const STATUS_PRIVATE = 1;
public static const STATUS_SHARED = 2;
public static const STATUS_UNAPPROVED = 3;
public static const STATUS_APPROVED = 4;
public function SaveFile(_arg1:SaveGroup){
this._keys = new Dictionary();
this._ratings = new Dictionary();
this._group = _arg1;
this._description = "";
}
public function get name():String{
return (this._filename);
}
public function set name(_arg1:String):void{
this._filename = _arg1;
}
public function get id():uint{
return (this._id);
}
public function set id(_arg1:uint):void{
this._id = _arg1;
}
public function get description():String{
return (this._description);
}
public function set description(_arg1:String):void{
this._description = _arg1;
}
public function get contents(){
return (this._contents);
}
public function set contents(_arg1):void{
this._contents = _arg1;
this._contentSize = 0;
}
public function get thumbnailUrl():String{
return (this._thumbnailUrl);
}
public function set thumbnailUrl(_arg1:String):void{
this._thumbnailUrl = _arg1;
}
public function get fileUrl():String{
return (this._fileUrl);
}
public function set fileUrl(_arg1:String):void{
this._fileUrl = _arg1;
}
public function get thumbnail():BitmapData{
return (this._thumbnail);
}
public function set thumbnail(_arg1:BitmapData):void{
if (this._thumbnail){
this._thumbnail.dispose();
};
this._thumbnail = _arg1.clone();
}
public function loadThumbnail():Loader{
var _local1:Loader = new Loader();
if (this._thumbnailUrl){
_local1.load(new URLRequest(this._thumbnailUrl));
};
return (_local1);
}
public function get bytesLoaded():uint{
return ((this._loader) ? this._loader.bytesLoaded : this._contentSize);
}
public function get bytesTotal():uint{
return (this._contentSize);
}
public function get status():uint{
return (this._status);
}
function setStatus(_arg1:uint):void{
this._status = _arg1;
}
public function get groupId():uint{
return (this._group.id);
}
public function get groupName():String{
return (this._group.name);
}
public function get groupType():uint{
return (this._group.type);
}
public function get authorName():String{
return (this._authorName);
}
public function set authorName(_arg1:String):void{
this._authorName = _arg1;
}
public function get authorId():uint{
return (this._authorId);
}
public function set authorId(_arg1:uint):void{
this._authorId = _arg1;
}
public function get draft():Boolean{
return (this._draft);
}
public function set draft(_arg1:Boolean):void{
this._draft = _arg1;
}
public function get locked():Boolean{
return (this._locked);
}
public function get shared():Boolean{
return ((this._status == STATUS_SHARED));
}
public function get isPrivate():Boolean{
return ((this._status == STATUS_PRIVATE));
}
public function get isPublic():Boolean{
if (this.isPrivate){
return (false);
};
if (((this._group.isType("SYSTEM")) || (this._group.isType("PRIVATE")))){
return (false);
};
if (this._group.isType("PUBLIC")){
return (true);
};
if (this.approved){
return (true);
};
return (false);
}
public function get approved():Boolean{
return ((this._status > STATUS_UNAPPROVED));
}
public function get keys():Dictionary{
return (this._keys);
}
public function get ratings():Dictionary{
return (this._ratings);
}
function setPermissions(_arg1:uint, _arg2:Boolean){
_arg2 = this._locked;
this._status = _arg1;
}
function setFileSize(_arg1:uint):void{
this._contentSize = _arg1;
}
public function isLocked():Boolean{
return (this._locked);
}
public function getDescription():String{
return (this._description);
}
public function getShared():Boolean{
return (this._draft);
}
public function getDuplicateID():uint{
return (this.duplicate_id);
}
public function getKeys():Dictionary{
return (this._keys);
}
public function getRatings():Dictionary{
return (this._ratings);
}
public function setKey(_arg1, _arg2):void{
var _local3:SaveKey;
if ((_arg1 is String)){
_local3 = this._group.getKeyName(_arg1);
} else {
_local3 = this._group.getKeyID(_arg1);
};
if (_local3){
switch (_local3.type){
case SaveKey.TYPE_BOOLEAN:
this._keys[_local3] = {id:_local3.id, value:Boolean(int(_arg2))};
break;
case SaveKey.TYPE_FLOAT:
this._keys[_local3] = {id:_local3.id, value:Number(_arg2)};
break;
case SaveKey.TYPE_INTEGER:
this._keys[_local3] = {id:_local3.id, value:int(_arg2)};
break;
case SaveKey.TYPE_STRING:
default:
this._keys[_local3] = {id:_local3.id, value:_arg2.toString()};
break;
};
};
}
public function getKey(_arg1){
var _local2:SaveKey;
if ((_arg1 is String)){
_local2 = this._group.getKeyName(_arg1);
} else {
_local2 = this._group.getKeyID(_arg1);
};
if (_local2){
return (this._keys[_local2]);
};
return (null);
}
public function setRating(_arg1, _arg2:Number, _arg3:Number):void{
var _local4:SaveRating;
if ((_arg1 is String)){
_local4 = this._group.getRatingName(_arg1);
} else {
_local4 = this._group.getRatingID(_arg1);
};
if (_local4){
this._ratings[_local4] = {id:_local4.id, name:_local4.name, votes:_arg2, score:_arg3};
};
}
public function getRating(_arg1):Object{
var _local2:SaveRating;
if ((_arg1 is String)){
_local2 = this._group.getRatingName(_arg1);
} else {
_local2 = this._group.getRatingID(_arg1);
};
if (_local2){
return (this._ratings[_local2]);
};
return (null);
}
public function sendRating(_arg1:String, _arg2:Number):void{
var _local3:SaveRating = this._group.getRatingName(_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);
}
override public function toString():String{
var _local2:Object;
var _local3:Object;
var _local1 = (((((("Save File " + this._filename) + " ID: ") + this._id) + "\n ") + this._description) + "\n");
for each (_local2 in this._keys) {
_local1 = (_local1 + ((((" " + this._group.getKeyID(_local2.id).name) + ": ") + _local2.val) + "\n"));
};
for each (_local3 in this._ratings) {
_local1 = (_local1 + ((((((" " + this._group.getRatingID(_local3.id).name) + "\n Score: ") + _local3.score) + " Votes: ") + _local3.votes) + "\n"));
};
return (_local1);
}
public function toObject():Object{
var _local2:Object;
var _local1:Object = {group:this.groupId, filename:this.name, description:this.description, shared:true};
_local1.keys = [];
for each (_local2 in this._keys) {
_local1.keys.push({id:_local2.id, value:_local2.val});
};
return (_local1);
}
public function save(_arg1:Boolean=false, _arg2:Boolean=false):void{
API.saveFile(this, _arg1, _arg2);
}
public function loadContents():void{
if (this._fileUrl){
this._loader = new SmartURLLoader();
this._loader.responseFormat = URLLoaderDataFormat.BINARY;
this._loader.addEventListener(Event.COMPLETE, this.onContentsLoaded);
this._loader.addEventListener(IOErrorEvent.IO_ERROR, this.onContentsError);
this._loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.onContentsError);
this._loader.load(this._fileUrl);
};
}
private function onContentsError(_arg1:Event):void{
this._loader = null;
dispatchEvent(new APIEvent(APIEvent.FILE_LOADED, false));
API.callListener(APIEvent.FILE_LOADED, false);
}
private function onContentsLoaded(_arg1:Event):void{
var _local2:ByteArray = _arg1.target.response;
this._contentSize = _local2.length;
_local2.uncompress();
var _local3:uint = _local2.readUnsignedByte();
if (_local3 == 0){
this._contents = new ByteArray();
this._contents.writeBytes(_local2, 1);
} else {
this._contents = _local2.readObject();
};
this._loader = null;
dispatchEvent(new APIEvent(APIEvent.FILE_LOADED, true, {file:this}));
API.callListener(APIEvent.FILE_LOADED, true, {file:this});
}
public function loadAuthorPage(){
API.loadUserPage(this._authorId, this._authorName);
}
function fileSaved(_arg1:Object):void{
this._id = _arg1.save_id;
this._thumbnailUrl = _arg1.thumbnail;
this._fileUrl = _arg1.file_url;
}
}
}//package com.newgrounds
Section 27
//SaveGroup (com.newgrounds.SaveGroup)
package com.newgrounds {
public class SaveGroup {
private var _name:String;
private var _id:uint;
private var _type:uint;
private var _keys:Array;
private var _ratings:Array;
private var _files:Array;
private var _query:SaveGroupQuery;
public static const TYPE_SYSTEM:uint = 0;
public static const TYPE_PRIVATE:uint = 1;
public static const TYPE_PUBLIC:uint = 2;
public static const TYPE_MODERATED:uint = 3;
public static const KEY_TYPES:Array = [null, "float", "integer", "string", "boolean"];
public static const TYPES:Object = {SYSTEM:0, PRIVATE:1, PUBLIC:2, MODERATED:3};
public function SaveGroup(_arg1:uint, _arg2:String, _arg3:uint){
this._name = _arg2;
this._id = _arg1;
this._type = _arg3;
this._ratings = [];
this._keys = [];
this._files = [];
this._query = new SaveGroupQuery(this);
}
public function get name():String{
return (this._name);
}
public function get id():uint{
return (this._id);
}
public function get type():uint{
return (this._type);
}
public function get keys():Array{
return (this._keys);
}
public function get ratings():Array{
return (this._ratings);
}
public function get group_id():uint{
return (this._id);
}
public function get group_name():String{
return (this._name);
}
public function addRating(_arg1:SaveRating):void{
this._ratings.push(_arg1);
}
function getRating(_arg1):SaveRating{
var _local2:uint;
while (_local2 < this._ratings.length) {
if ((((((((_arg1 is uint)) || ((_arg1 is int)))) || ((_arg1 is Number)))) && ((this._ratings[_local2].rating_id == _arg1)))){
return (this._ratings[_local2]);
};
if (this._ratings[_local2].name == _arg1){
return (this._ratings[_local2]);
};
_local2++;
};
return (null);
}
public function getRatingID(_arg1:uint):SaveRating{
var _local2:uint;
while (_local2 < this._ratings.length) {
if (this._ratings[_local2].id == _arg1){
return (this._ratings[_local2]);
};
_local2++;
};
return (null);
}
public function getRatingName(_arg1:String):SaveRating{
var _local2:uint;
while (_local2 < this._ratings.length) {
if (this._ratings[_local2].name == _arg1){
return (this._ratings[_local2]);
};
_local2++;
};
return (null);
}
public function addKey(_arg1:SaveKey):void{
this._keys.push(_arg1);
}
public function getKey(_arg1):SaveKey{
var _local2:uint;
while (_local2 < this._keys.length) {
if ((((((((_arg1 is Number)) || ((_arg1 is uint)))) || ((_arg1 is int)))) && ((this._keys[_local2].key_id == _arg1)))){
return (this._keys[_local2]);
};
if (this._keys[_local2].key_name == _arg1){
return (this._keys[_local2]);
};
_local2++;
};
return (null);
}
public function getKeyID(_arg1:uint):SaveKey{
var _local2:uint;
while (_local2 < this._keys.length) {
if (this._keys[_local2].id == _arg1){
return (this._keys[_local2]);
};
_local2++;
};
return (null);
}
public function getKeyType(_arg1:String, _arg2:Boolean=false){
var _local3:SaveKey = this.getKey(_arg1);
if (_local3){
return ((_arg2) ? KEY_TYPES[_local3.key_type] : _local3.key_type);
};
return (null);
}
public function getKeyName(_arg1:String):SaveKey{
var _local2:uint;
while (_local2 < this._keys.length) {
if (this._keys[_local2].name == _arg1){
return (this._keys[_local2]);
};
_local2++;
};
return (null);
}
public function isType(_arg1:String):Boolean{
return ((TYPES[this._type] == _arg1));
}
public function getID():uint{
return (this._id);
}
public function getName():String{
return (this._name);
}
public function getQuery(_arg1:Boolean=false){
return ((_arg1) ? this._query.toObject() : this._query);
}
public function newQuery():SaveGroupQuery{
return (new SaveGroupQuery(this));
}
public function newFile():SaveFile{
return (new SaveFile(this));
}
public function toString():String{
return ((((((("SaveGroup { name: " + this._name) + ", id: ") + this._id) + ", keys: ") + this._keys) + "}"));
}
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 28
//SaveGroupQuery (com.newgrounds.SaveGroupQuery)
package com.newgrounds {
import flash.events.*;
public class SaveGroupQuery extends EventDispatcher {
private var _group:SaveGroup;
private var _groupBy:Array;
private var _lookupKeys:Array;
private var _lookupRatings:Array;
private var _fileConditions:Array;
private var _keyConditions:Array;
private var _ratingConditions:Array;
private var _sortConditions:Array;
private var _page:uint;
private var _resultsPerPage:uint;
private var _randomizeResults:Boolean;
private var _results:Array;
public static const TABLE_FILES:uint = 1;
public static const TABLE_KEYS:uint = 2;
public static const TABLE_RATINGS:uint = 3;
public static const FILE_ID:uint = 0;
public static const AUTHOR_ID:uint = 1;
public static const AUTHOR_NAME:uint = 2;
public static const FILE_NAME:uint = 3;
public static const CREATED_ON:uint = 4;
public static const UPDATED_ON:uint = 5;
public static const TOTAL_VIEWS:uint = 6;
public static const FILE_STATUS:uint = 7;
public static const SCORE:String = "score";
public static const TOTAL_VOTES:String = "votes";
public function SaveGroupQuery(_arg1:SaveGroup){
this._results = [];
super();
this._group = _arg1;
this.reset();
}
public function clearCache():void{
this._results = [];
}
public function get group():SaveGroup{
return (this._group);
}
public function get groupId():uint{
return (this._group.id);
}
public function get resultsPerPage():uint{
return (this._resultsPerPage);
}
public function set resultsPerPage(_arg1:uint):void{
this._resultsPerPage = _arg1;
}
public function get page():uint{
return (this._page);
}
public function set page(_arg1:uint):void{
this._page = _arg1;
}
public function get randomized():Boolean{
return (this._randomizeResults);
}
public function set randomized(_arg1:Boolean):void{
this._randomizeResults = _arg1;
}
public function get results():Array{
return (this._results);
}
public function reset():void{
this._fileConditions = [];
this._keyConditions = [];
this._ratingConditions = [];
this._sortConditions = [];
this._groupBy = [];
this._lookupKeys = [];
this._lookupRatings = [];
this._randomizeResults = false;
this._resultsPerPage = 20;
this._page = 1;
this.clearCache();
}
function getGroup():SaveGroup{
return (this._group);
}
function getGroupID():uint{
return (this._group.getID());
}
public function includeKey(_arg1:String):void{
var _local2:SaveKey = this._group.getKeyName(_arg1);
if (_local2){
this._lookupKeys.push(_local2.id);
};
}
public function isRandomized():Boolean{
return (this._randomizeResults);
}
public function includeRating(_arg1:String):void{
var _local2:SaveRating = this._group.getRatingName(_arg1);
if (_local2){
this._lookupRatings.push(_local2.id);
};
}
public function excludeKey(_arg1:String):void{
var _local2:SaveKey = this._group.getKeyName(_arg1);
var _local3:uint;
while (_local3 < this._lookupKeys.length) {
if (this._lookupKeys[_local3] == _local2.id){
this._lookupKeys.splice(_local3, 1);
return;
};
_local3++;
};
}
public function excludeRating(_arg1:String):void{
var _local2:SaveRating = this._group.getRatingName(_arg1);
var _local3:uint;
while (_local3 < this._lookupRatings.length) {
if (this._lookupRatings[_local3] == _local2.id){
this._lookupRatings.splice(_local3, 1);
return;
};
_local3++;
};
}
public function groupBy(_arg1:uint):void{
this._groupBy.push({table:TABLE_FILES, field:_arg1});
}
public function groupByRating(_arg1:String):void{
var _local2:SaveRating = this._group.getRatingName(_arg1);
if (!_local2){
return;
};
this._groupBy.push({table:TABLE_RATINGS, field:_local2.id});
}
public function groupByKey(_arg1:String):void{
var _local2:SaveKey = this._group.getKeyName(_arg1);
if (!_local2){
return;
};
this._groupBy.push({table:TABLE_KEYS, field:_local2.id});
}
public function addFileCondition(_arg1:uint, _arg2:String, _arg3):void{
this._fileConditions.push({field:_arg1, operator:_arg2, value:_arg3});
}
public function addKeyCondition(_arg1:String, _arg2:String, _arg3):void{
var _local4:SaveKey = this._group.getKeyName(_arg1);
if (!_local4){
return;
};
if (!this.checkValue(_arg3, _local4.type)){
return;
};
this._keyConditions.push({key_id:_local4.id, operator:_arg2, value:_arg3});
}
public function addRatingCondition(_arg1:String, _arg2:String, _arg3, _arg4:String="score"):void{
var _local5:SaveRating = this._group.getRatingName(_arg1);
if (!_local5){
return;
};
this._ratingConditions.push({rating_id:_local5.id, operator:_arg2, value:_arg3, column:_arg4});
}
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;
};
this._sortConditions.push(_local5);
}
public function sortOn(_arg1:uint, _arg2:Boolean=false):void{
this.addSortCondition(TABLE_FILES, _arg1, _arg2);
}
public function sortOnKey(_arg1:String, _arg2:Boolean=false):void{
this.addSortCondition(TABLE_KEYS, this._group.getKeyName(_arg1).id, _arg2);
}
public function sortOnRating(_arg1:String, _arg2:Boolean=false, _arg3:String="score"):void{
this.addSortCondition(TABLE_RATINGS, this._group.getRatingName(_arg1).id, _arg2, _arg3);
}
public function sortOnRatingScore(_arg1:String, _arg2:Boolean){
this.sortOnRating(_arg1, _arg2, SCORE);
}
public function sortOnRatingVotes(_arg1:String, _arg2:Boolean){
this.sortOnRating(_arg1, _arg2, TOTAL_VOTES);
}
public function setResultsPerPage(_arg1:uint){
this._resultsPerPage = _arg1;
this.clearCache();
}
public function setPage(_arg1:Number){
this._page = _arg1;
this.clearCache();
}
public function setRandomize(_arg1:Boolean):void{
this._randomizeResults = _arg1;
}
public function execute():void{
API.executeSaveQuery(this);
}
private function checkValue(_arg1, _arg2:uint):Boolean{
return (true);
}
function setResults(_arg1:Array):void{
this._results = _arg1;
}
override public function toString():String{
return ("");
}
public function toObject():Object{
var _local1:Object = {page:this._page, num_results:this._resultsPerPage};
if (this.isRandomized()){
_local1.randomize = 1;
};
if (((this._fileConditions) && ((this._fileConditions.length > 0)))){
_local1.file_conditions = this._fileConditions;
};
if (((this._keyConditions) && ((this._keyConditions.length > 0)))){
_local1.key_conditions = this._keyConditions;
};
if (((this._ratingConditions) && ((this._ratingConditions.length > 0)))){
_local1.rating_conditions = this._ratingConditions;
};
if (((this._sortConditions) && ((this._sortConditions.length > 0)))){
_local1.sort_conditions = this._sortConditions;
};
if (((this._lookupKeys) && ((this._lookupKeys.length > 0)))){
_local1.lookup_keys = this._lookupKeys;
};
if (((this._lookupRatings) && ((this._lookupRatings.length > 0)))){
_local1.lookup_ratings = this._lookupRatings;
};
if (((this._groupBy) && ((this._groupBy.length > 0)))){
_local1.group_by = this._groupBy;
};
return (_local1);
}
}
}//package com.newgrounds
Section 29
//SaveKey (com.newgrounds.SaveKey)
package com.newgrounds {
public class SaveKey {
private var _id:uint;
private var _name:String;
private var _type:uint;
public static const TYPE_FLOAT:uint = 1;
public static const TYPE_INTEGER:uint = 2;
public static const TYPE_STRING:uint = 3;
public static const TYPE_BOOLEAN:uint = 4;
public function SaveKey(_arg1:uint, _arg2:String, _arg3:uint){
this._id = _arg1;
this._name = _arg2;
this._type = _arg3;
}
public function get id():uint{
return (this._id);
}
public function get name():String{
return (this._name);
}
public function get type():uint{
return (this._type);
}
public function get key_id():uint{
return (this._id);
}
public function get key_name():String{
return (this._name);
}
public function get key_type():uint{
return (this._type);
}
public function isValueValid(_arg1):Boolean{
if (this._type == TYPE_INTEGER){
return ((((_arg1 is int)) || ((_arg1 is uint))));
};
if (this._type == TYPE_FLOAT){
return ((((((_arg1 is int)) || ((_arg1 is uint)))) || ((_arg1 is Number))));
};
if (this._type == TYPE_STRING){
return ((_arg1 is String));
};
if (this._type == TYPE_BOOLEAN){
return ((((((((_arg1 is Boolean)) || ((_arg1 === 0)))) || ((_arg1 === 1)))) || ((_arg1 == ""))));
};
return (false);
}
public function toString():String{
return (this._name);
}
}
}//package com.newgrounds
Section 30
//SaveRating (com.newgrounds.SaveRating)
package com.newgrounds {
public class SaveRating {
private var _id:uint;
private var _name:String;
private var _minValue:Number;
private var _maxValue:Number;
private var _isFloat:Boolean;
private var _voted:Boolean;
public function SaveRating(_arg1:uint, _arg2:String, _arg3:Boolean, _arg4:Number=-INF, _arg5:Number=INF){
this._id = _arg1;
this._name = _arg2;
this._isFloat = _arg3;
this._minValue = _arg4;
this._maxValue = _arg5;
}
public function get rating_id():uint{
return (this._id);
}
public function get rating_name():String{
return (this._name);
}
public function get id():uint{
return (this._id);
}
public function get name():String{
return (this._name);
}
public function get minValue():Number{
return (this._minValue);
}
public function get maxValue():Number{
return (this._maxValue);
}
public function get isFloat():Boolean{
return (this._isFloat);
}
public function get voted():Boolean{
return (this._voted);
}
public function set voted(_arg1:Boolean):void{
this._voted = _arg1;
}
public function toString():String{
return (this._name);
}
}
}//package com.newgrounds
Section 31
//Score (com.newgrounds.Score)
package com.newgrounds {
public class Score {
private var _board:ScoreBoard;
private var _position:uint;
private var _username:String;
private var _value:String;
private var _numeric_value:uint;
private var _tag:String;
public function Score(_arg1:ScoreBoard, _arg2:Number, _arg3:String, _arg4:String, _arg5:uint, _arg6:String){
this._board = _arg1;
this._position = _arg2;
this._username = _arg3;
this._value = _arg4;
this._numeric_value = _arg5;
this._tag = _arg6;
}
public function get board():ScoreBoard{
return (this._board);
}
public function get position():uint{
return (this._position);
}
public function get username():String{
return (this._username);
}
public function get value():String{
return (this._value);
}
public function get numeric_value():uint{
return (this._numeric_value);
}
public function get tag():String{
return (this._tag);
}
}
}//package com.newgrounds
Section 32
//ScoreBoard (com.newgrounds.ScoreBoard)
package com.newgrounds {
import flash.events.*;
public class ScoreBoard extends EventDispatcher {
private var _name:String;
private var _id:uint;
private var _scores:Array;
private var _period:String;// = "Today"
private var _num_results:uint;// = 10
private var _numScores:uint;
private var _desiredNumResults:uint;
private var _startRank:uint;
private var _endRank:uint;
private var _page:uint;// = 1
private var _tag:String;
public function ScoreBoard(_arg1:uint, _arg2:String, _arg3:String){
this._name = _arg2;
this._id = _arg1;
this._scores = [];
this._tag = _arg3;
}
public function exists():Boolean{
return ((this._id > 0));
}
public function get id():Number{
return (this._id);
}
public function get name():String{
return (this._name);
}
public function get period():String{
return (this._period);
}
public function get page():uint{
return (this._page);
}
public function get num_results():uint{
return (this._num_results);
}
public function get scores():Array{
return (this._scores);
}
public function get tag():String{
return (this._tag);
}
public function get num_scores():uint{
return (this._numScores);
}
public function postScore(_arg1:uint, _arg2:String=null):void{
if (_arg2){
this._tag = _arg2;
};
API.postScore(this._name, _arg1);
}
public function loadScores(_arg1:String="Today", _arg2:uint=1, _arg3:uint=10):void{
this._period = _arg1;
if (((!(this._period)) || ((this._period == "")))){
this._period = ScoreBoardPeriod.TODAY;
};
this._page = _arg2;
this._num_results = _arg3;
this._desiredNumResults = 0;
API.loadScores(this.name);
}
public function loadScoresInRange(_arg1:String="Today", _arg2:uint=1, _arg3:uint=10):void{
if (_arg2 == 0){
_arg2 = 1;
};
if (_arg3 < _arg2){
_arg3 = _arg2;
};
this._period = _arg1;
if (((!(this._period)) || ((this._period == "")))){
this._period = ScoreBoardPeriod.TODAY;
};
this._desiredNumResults = ((_arg3 - _arg2) + 1);
this._num_results = this._desiredNumResults;
while (int(((_arg2 - 1) / this._num_results)) != int(((_arg3 - 1) / this._num_results))) {
this._num_results++;
};
this._page = ((_arg2 - 1) / this._num_results);
this._startRank = _arg2;
this._endRank = _arg3;
this._page++;
API.loadScores(this.name);
}
function setScores(_arg1:Array, _arg2:String, _arg3:Number, _arg4:Number, _arg5:uint):void{
var _local7:uint;
this._period = _arg2;
this._page = _arg3;
this._num_results = _arg4;
this._numScores = _arg5;
this._scores = [];
var _local6:uint;
while (_local6 < _arg1.length) {
_local7 = (((this._num_results * (this._page - 1)) + 1) + _local6);
if (((!(this._desiredNumResults)) || ((((_local7 >= this._startRank)) && ((_local7 <= this._endRank)))))){
this._scores.push(new Score(this, _local7, _arg1[_local6].username, _arg1[_local6].value, _arg1[_local6].numeric_value, _arg1[_local6].tag));
};
_local6++;
};
this._num_results = this._scores.length;
}
}
}//package com.newgrounds
Section 33
//ScoreBoardPeriod (com.newgrounds.ScoreBoardPeriod)
package com.newgrounds {
public class ScoreBoardPeriod {
public static const TODAY:String = "Today";
public static const WEEK:String = "This Week";
public static const MONTH:String = "This Month";
public static const YEAR:String = "This Year";
public static const ALL_TIME:String = "All-Time";
}
}//package com.newgrounds
Section 34
//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 _variables:Dictionary;
private var _files:Dictionary;
private var _hasVariables:Boolean;
private var _method:String;// = "GET"
private var _urlRequest:URLRequest;
private var _urlLoader:URLLoader;
private var _dataFormat:String;// = "text"
private var _openBrowser:Boolean;// = false
private var _preventCache:Boolean;// = false
var _command:String;
public var owner;
private static const CRLF:String = "
";
private static var _loaders:Dictionary = new Dictionary();
public function SmartURLLoader(){
this._urlRequest = new URLRequest();
this._variables = new Dictionary();
}
public function get responseFormat():String{
return (this._dataFormat);
}
public function set responseFormat(_arg1:String):void{
this._dataFormat = _arg1;
}
public function get response(){
return (this._urlLoader.data);
}
public function get hasFiles():Boolean{
return (Boolean(this._files));
}
public function get method():String{
return (this._method);
}
public function set method(_arg1:String):void{
if (((this.hasFiles) && ((_arg1 == URLRequestMethod.GET)))){
throw (new IllegalOperationError("GET cannot be used to upload files."));
};
this._method = _arg1;
}
public function get openBrowser():Boolean{
return (this._openBrowser);
}
public function set openBrowser(_arg1:Boolean):void{
this._openBrowser = _arg1;
}
public function get preventCache():Boolean{
return (this._preventCache);
}
public function set preventCache(_arg1:Boolean):void{
this._preventCache = _arg1;
}
public function get bytesLoaded():uint{
return ((this._urlLoader) ? this._urlLoader.bytesLoaded : 0);
}
public function get bytesTotal():uint{
return ((this._urlLoader) ? this._urlLoader.bytesTotal : 0);
}
public function addVariable(_arg1:String, _arg2=""):void{
this._variables[_arg1] = _arg2;
if (_arg2){
this._hasVariables = true;
};
}
public function addFile(_arg1:String, _arg2:ByteArray, _arg3:String, _arg4:String="application/octet-stream"):void{
this.method = URLRequestMethod.POST;
if (!this._files){
this._files = new Dictionary();
};
this._files[_arg1] = new File(_arg1, _arg2, _arg3, _arg4);
}
public function clearVariables():void{
this._variables = new Dictionary();
}
public function clearFiles():void{
this._files = null;
}
public function load(_arg1:String):void{
var urlVariables:URLVariables;
var key:String;
var boundary:String;
var i:uint;
var event:SecurityErrorEvent;
var url = _arg1;
this._urlRequest.url = url;
if (this._preventCache){
url = (url + ("?seed=" + Math.random()));
if (this._hasVariables){
url = (url + "&");
};
};
this._urlRequest.method = this._method;
if ((((this._urlRequest.method == URLRequestMethod.GET)) || (!(this.hasFiles)))){
this._urlRequest.contentType = "application/x-www-form-urlencoded";
if (this._hasVariables){
urlVariables = new URLVariables();
for (key in this._variables) {
urlVariables[key] = this._variables[key];
};
this._urlRequest.data = urlVariables;
};
} else {
boundary = "";
i = 0;
while (i < 32) {
boundary = (boundary + String.fromCharCode(uint((97 + (Math.random() * 25)))));
i = (i + 1);
};
this._urlRequest.contentType = (("multipart/form-data; boundary=\"" + boundary) + "\"");
this._urlRequest.data = this.buildMultipartData(boundary);
};
if (this.openBrowser){
navigateToURL(this._urlRequest, "_blank");
} else {
this._urlLoader = new URLLoader();
this._urlLoader.dataFormat = this._dataFormat;
this._urlLoader.addEventListener(Event.COMPLETE, this.onComplete);
this._urlLoader.addEventListener(ProgressEvent.PROGRESS, this.onProgress);
this._urlLoader.addEventListener(IOErrorEvent.IO_ERROR, this.onIOError);
this._urlLoader.addEventListener(HTTPStatusEvent.HTTP_STATUS, this.onHTTPStatus);
this._urlLoader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, this.onSecurityError);
_loaders[this._urlLoader] = this;
try {
this._urlLoader.load(this._urlRequest);
} catch(error:Error) {
event = new SecurityErrorEvent(SecurityErrorEvent.SECURITY_ERROR, false, false, error.message);
onSecurityError(event);
};
};
}
public function close():void{
try {
this._urlLoader.close();
} catch(e:Error) {
};
}
public function dispose():void{
this.close();
this._files = null;
this._variables = null;
if (this._urlLoader){
this._urlLoader.removeEventListener(Event.COMPLETE, this.onComplete);
this._urlLoader.removeEventListener(ProgressEvent.PROGRESS, this.onProgress);
this._urlLoader.removeEventListener(IOErrorEvent.IO_ERROR, this.onIOError);
this._urlLoader.removeEventListener(HTTPStatusEvent.HTTP_STATUS, this.onHTTPStatus);
this._urlLoader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, this.onSecurityError);
this._urlLoader = null;
};
this._urlRequest = null;
delete _loaders[this];
}
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 this._variables) {
_local2.writeUTFBytes((_arg1 + CRLF));
_local2.writeUTFBytes(((("Content-Disposition: form-data; name=\"" + _local3) + "\"") + CRLF));
_local2.writeUTFBytes(CRLF);
_local2.writeUTFBytes((this._variables[_local3] + CRLF));
};
if (this.hasFiles){
for each (_local4 in this._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;
_local2.position = 0;
return (_local2);
}
private function onComplete(_arg1:Event):void{
dispatchEvent(_arg1);
this.dispose();
}
private function onProgress(_arg1:ProgressEvent):void{
dispatchEvent(_arg1);
}
private function onIOError(_arg1:IOErrorEvent):void{
dispatchEvent(_arg1);
this.dispose();
}
private function onSecurityError(_arg1:SecurityErrorEvent):void{
dispatchEvent(_arg1);
this.dispose();
}
private function onHTTPStatus(_arg1:HTTPStatusEvent):void{
dispatchEvent(_arg1);
}
public static function closeAll():void{
var _local1:SmartURLLoader;
for each (_local1 in _loaders) {
if (_local1){
_local1.dispose();
};
};
_loaders = new Dictionary();
}
}
}//package com.newgrounds
import flash.utils.*;
class File {
private var fileName:String;
private var data:ByteArray;
private var dataField:String;
private var contentType:String;
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 35
//MochiAd (mochi.as3.MochiAd)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showClickAwayAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
var _local1:Object = this.parent._mochiad_ctr;
var _local2:Number = (getTimer() - this.started);
var _local3:Boolean;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(_arg1:String):String{
var _local2:String = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType == "application"){
return (_local2);
};
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var _local1:Object = this.parent._mochiad_ctr;
var _local2:Number = (getTimer() - this.started);
var _local3:Boolean;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
var _local3:Object = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _cleanup(_arg1:Object):void{
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
var idx:Number = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(_arg1:Object):MovieClip{
var clip:Object;
var mc:MovieClip;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
var DEFAULTS:Object = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!(clip is DisplayObject)){
trace("Warning: Object passed as container clip not a descendant of the DisplayObject type");
return (null);
};
if (MovieClip(clip).stage == null){
trace("Warning: Container clip for ad is not attached to the stage");
return (null);
};
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
var depth:Number = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
var wh:Array = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
} else {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
};
var lv:URLVariables = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime()));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:IOErrorEvent):void{
trace("[MochiAds] Blocked URL");
});
if (!options.skip){
loader.load(req);
};
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array = _arg2.split(".");
var _local5:Number = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local6:Array;
var _local3:Object = _arg2.getBounds(_arg2.root);
var _local4:Number = 0;
var _local5:Number = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array = _arg2.split(".");
var _local4:Number = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + _arg3.id));
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array = _arg2.split(".");
var _local5:Number = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function showPreGameAd(_arg1:Object):void{
var clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var complete:Boolean;
var unloaded:Boolean;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}, progress_override:function (_arg1:Object):Number{
return (NaN);
}, bar_offset:0};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
if (options.skip){
ad_timeout = 0;
};
delete options.ad_timeout;
var fadeout_time:Number = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
var fn:Function = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
var bar:MovieClip = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = (10 + options.bar_offset);
bar.y = (h - 20);
};
var bar_w:Number = ((w - bar.x) - 10);
var bar_color:Number = options.color;
delete options.color;
var bar_background:Number = options.background;
delete options.background;
var bar_outline:Number = options.outline;
delete options.outline;
var backing_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 1);
var backing:Object = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo(bar_w, 0);
backing.lineTo(bar_w, 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
var inside_mc:MovieClip = createEmptyMovieClip(bar, "_inside", 2);
var inside:Object = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo(bar_w, 0);
inside.lineTo(bar_w, 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
var outline_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 3);
var outline:Object = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo(bar_w, 0);
outline.lineTo(bar_w, 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
var progress:Number = Math.min(1, options.progress_override(clip));
var f:Function = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
if (!isNaN(progress)){
complete = (progress == 1);
} else {
if (clip.loaderInfo.bytesLoaded == clip.loaderInfo.bytesTotal){
complete = true;
} else {
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
return (_arg1);
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local12:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
var _local1:Object = this.parent.parent.root;
var _local2:Object = this.parent._mochiad_ctr;
var _local3:Number = (getTimer() - this.started);
var _local4:Boolean;
var _local5:Number = _local1.loaderInfo.bytesTotal;
var _local6:Number = _local1.loaderInfo.bytesLoaded;
var _local7:Number = Math.min(1, options.progress_override(_local1));
if (_local7 == 1){
complete = true;
};
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
var _local8:Number = ((100 * _local6) / _local5);
if (!isNaN(_local7)){
_local8 = (100 * _local7);
};
var _local9:Number = ((100 * _local3) / chk.ad_msec);
var _local10:Object = this._mochiad_bar._inside;
var _local11:Number = Math.min(100, Math.min(((_local8) || (0)), _local9));
_local11 = Math.max(this.last_pcnt, _local11);
this.last_pcnt = _local11;
_local10.scaleX = (_local11 * 0.01);
options.ad_progress(_local11);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local8});
if (_local8 >= 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local12 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local12 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local8 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (unloaded){
MochiAd.unload(_local1);
} else {
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var mc = _arg1;
var f:Function = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package mochi.as3
Section 36
//MochiCoins (mochi.as3.MochiCoins)
package mochi.as3 {
public class MochiCoins {
public static const STORE_HIDE:String = "StoreHide";
public static const NO_USER:String = "NoUser";
public static const IO_ERROR:String = "IOError";
public static const ITEM_NEW:String = "ItemNew";
public static const ITEM_OWNED:String = "ItemOwned";
public static const STORE_ITEMS:String = "StoreItems";
public static const ERROR:String = "Error";
public static const STORE_SHOW:String = "StoreShow";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static var _inventory:MochiInventory;
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function getStoreItems():void{
MochiServices.send("coins_getStoreItems");
}
public static function get inventory():MochiInventory{
return (_inventory);
}
public static function showStore(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showStore", {options:_arg1}, null, null);
}
public static function requestFunding(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestFunding", _arg1);
}
public static function showItem(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showItem call must pass an Object with an item key");
return;
};
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showItem", {options:_arg1}, null, null);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showVideo(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showVideo call must pass an Object with an item key");
return;
};
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showVideo", {options:_arg1}, null, null);
}
addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_inventory = new MochiInventory();
});
addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_inventory = null;
});
}
}//package mochi.as3
Section 37
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Sibling:MochiDigits;
private var Fragment:Number;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function reencode():void{
var _local1:uint = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function toString():String{
var _local1:String = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
Fragment = (_local3.charCodeAt(_temp1) ^ Encoder);
if (_arg2 < _local3.length){
Sibling = new MochiDigits(_arg1, _arg2);
} else {
Sibling = null;
};
reencode();
}
public function get value():Number{
return (Number(this.toString()));
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
}
}//package mochi.as3
Section 38
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher)
package mochi.as3 {
public class MochiEventDispatcher {
private var eventTable:Object;
public function MochiEventDispatcher():void{
eventTable = {};
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
return;
};
for (_local3 in eventTable[_arg1]) {
var _local6 = eventTable[_arg1];
_local6[_local3](_arg2);
};
}
public function removeEventListener(_arg1:String, _arg2:Function):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
eventTable[_arg1] = [];
return;
};
for (_local3 in eventTable[_arg1]) {
if (eventTable[_arg1][_local3] != _arg2){
} else {
eventTable[_arg1].splice(Number(_local3), 1);
};
};
}
public function addEventListener(_arg1:String, _arg2:Function):void{
removeEventListener(_arg1, _arg2);
eventTable[_arg1].push(_arg2);
}
}
}//package mochi.as3
Section 39
//MochiEvents (mochi.as3.MochiEvents)
package mochi.as3 {
import flash.display.*;
public class MochiEvents {
public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL";
public static const FORMAT_LONG:String = "LongForm";
public static const ALIGN_BOTTOM:String = "ALIGN_B";
public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived";
public static const FORMAT_SHORT:String = "ShortForm";
public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR";
public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR";
public static const ALIGN_TOP:String = "ALIGN_T";
public static const ALIGN_LEFT:String = "ALIGN_L";
public static const ALIGN_RIGHT:String = "ALIGN_R";
public static const ALIGN_TOP_LEFT:String = "ALIGN_TL";
public static const ALIGN_CENTER:String = "ALIGN_C";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
private static var gameStart:Number;
private static var levelStart:Number;
public static function endPlay():void{
MochiServices.send("events_clearRoundID", null, null, null);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function trackEvent(_arg1:String, _arg2=null):void{
MochiServices.send("events_trackEvent", {tag:_arg1, value:_arg2}, null, null);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function startSession(_arg1:String):void{
MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function setNotifications(_arg1:MovieClip, _arg2:Object):void{
var _local4:Object;
var _local3:Object = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
_local3.clip = _arg1;
MochiServices.send("events_setNotifications", _local3, null, null);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function startPlay(_arg1:String="gameplay"):void{
MochiServices.send("events_setRoundID", {tag:String(_arg1)}, null, null);
}
}
}//package mochi.as3
Section 40
//MochiInventory (mochi.as3.MochiInventory)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
public dynamic class MochiInventory extends Proxy {
private var _timer:Timer;
private var _names:Array;
private var _syncID:Number;
private var _consumableProperties:Object;
private var _storeSync:Object;
private var _outstandingID:Number;
private var _syncPending:Boolean;
public static const READY:String = "InvReady";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IoError";
private static const KEY_SALT:String = " syncMaint";
public static const WRITTEN:String = "InvWritten";
public static const NOT_READY:String = "InvNotReady";
public static const VALUE_ERROR:String = "InvValueError";
private static const CONSUMER_KEY:String = "MochiConsumables";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public function MochiInventory():void{
MochiCoins.addEventListener(MochiCoins.ITEM_OWNED, itemOwned);
MochiCoins.addEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, loggedOut);
_storeSync = new Object();
_syncPending = false;
_outstandingID = 0;
_syncID = 0;
_timer = new Timer(1000);
_timer.addEventListener(TimerEvent.TIMER, sync);
_timer.start();
if (MochiSocial.loggedIn){
loggedIn();
} else {
loggedOut();
};
}
private function newItems(_arg1:Object):void{
if (!this[(_arg1.id + KEY_SALT)]){
this[(_arg1.id + KEY_SALT)] = 0;
};
if (!this[_arg1.id]){
this[_arg1.id] = 0;
};
this[(_arg1.id + KEY_SALT)] = (this[(_arg1.id + KEY_SALT)] + _arg1.count);
this[_arg1.id] = (this[_arg1.id] + _arg1.count);
if (((_arg1.privateProperties) && (_arg1.privateProperties.consumable))){
if (!this[_arg1.privateProperties.tag]){
this[_arg1.privateProperties.tag] = 0;
};
this[_arg1.privateProperties.tag] = (this[_arg1.privateProperties.tag] + (_arg1.privateProperties.inc * _arg1.count));
};
}
public function release():void{
MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, loggedOut);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (-1);
};
if (_consumableProperties[_arg1]){
return (MochiDigits(_consumableProperties[_arg1]).value);
};
return (undefined);
}
private function loggedIn(_arg1:Object=null):void{
MochiUserData.get(CONSUMER_KEY, getConsumableBag);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (false);
};
if (_consumableProperties[_arg1] == undefined){
return (false);
};
return (true);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
return (((_arg1)>=_names.length) ? 0 : (_arg1 + 1));
}
private function putConsumableBag(_arg1:MochiUserData):void{
_syncPending = false;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
_outstandingID = -1;
};
triggerEvent(WRITTEN, {});
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:MochiDigits;
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return;
};
if (!(_arg2 is Number)){
triggerEvent(ERROR, {type:VALUE_ERROR, error:"Invalid type", arg:_arg2});
return;
};
if (_consumableProperties[_arg1]){
_local3 = MochiDigits(_consumableProperties[_arg1]);
if (_local3.value == _arg2){
return;
};
_local3.value = _arg2;
} else {
_names.push(_arg1);
_consumableProperties[_arg1] = new MochiDigits(_arg2);
};
_syncID++;
}
private function itemOwned(_arg1:Object):void{
_storeSync[_arg1.id] = {properties:_arg1.properties, count:_arg1.count};
}
private function sync(_arg1:Event=null):void{
var _local3:String;
if (((_syncPending) || ((_syncID == _outstandingID)))){
return;
};
_outstandingID = _syncID;
var _local2:Object = {};
for (_local3 in _consumableProperties) {
_local2[_local3] = MochiDigits(_consumableProperties[_local3]).value;
};
MochiUserData.put(CONSUMER_KEY, _local2, putConsumableBag);
_syncPending = true;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return (_names[(_arg1 - 1)]);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{
if (!_consumableProperties[_arg1]){
return (false);
};
_names.splice(_names.indexOf(_arg1), 1);
delete _consumableProperties[_arg1];
return (true);
}
private function getConsumableBag(_arg1:MochiUserData):void{
var _local2:String;
var _local3:Number;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
return;
};
_consumableProperties = {};
_names = new Array();
if (_arg1.data){
for (_local2 in _arg1.data) {
_names.push(_local2);
_consumableProperties[_local2] = new MochiDigits(_arg1.data[_local2]);
};
};
for (_local2 in _storeSync) {
_local3 = _storeSync[_local2].count;
if (_consumableProperties[(_local2 + KEY_SALT)]){
_local3 = (_local3 - _consumableProperties[(_local2 + KEY_SALT)].value);
};
if (_local3 == 0){
} else {
newItems({id:_local2, count:_local3, properties:_storeSync[_local2].properties});
};
};
triggerEvent(READY, {});
}
private function loggedOut(_arg1:Object=null):void{
_consumableProperties = null;
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
}
}//package mochi.as3
Section 41
//MochiScores (mochi.as3.MochiScores)
package mochi.as3 {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var n:Number;
var options = _arg1;
if (options != null){
delete options.clip;
MochiServices.setContainer();
MochiServices.bringToTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
} else {
if ((options.score is MochiDigits)){
options.score = options.score.value;
};
};
n = Number(options.score);
if (isNaN(n)){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(n) != n){
trace((("WARNING: Submitted score '" + options.score) + "' will be truncated"));
};
options.score = n;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.play();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.warnID(options.boardID, true);
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
var _local2:Object = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
_arg1 = Number(_arg1);
if (isNaN(_arg1)){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((_arg1 == Number.NEGATIVE_INFINITY)) || ((_arg1 == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(_arg1) != _arg1){
trace((("WARNING: Submitted score '" + String(_arg1)) + "' will be truncated"));
};
_arg1 = Number(_arg1);
};
};
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (((((_arg1) && ((_arg1.error == true)))) && (onErrorHandler))){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiServices.warnID(_arg1, true);
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi.as3
Section 42
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiServices {
public static const CONNECTED:String = "onConnected";
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _queue:Array;
private static var _swfVersion:String;
private static var _preserved:Object;
public static var netupAttempted:Boolean = false;
private static var _sendChannel:LocalConnection;
public static var servicesSync:MochiSync = new MochiSync();
private static var _nextCallbackID:Number;
private static var _clip:MovieClip;
private static var _id:String;
private static var _services:String = "services.swf";
private static var _servURL:String = "http://www.mochiads.com/static/lib/services/";
public static var widget:Boolean = false;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _loader:Loader;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
private static var _callbacks:Object;
private static var _connecting:Boolean = false;
private static var _mochiLocalConnection:MovieClip;
private static var _listenChannelName:String = "__ms_";
public static var onError:Object;
public static var netup:Boolean = true;
private static var _mochiLC:String = "MochiLC.swf";
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function get connected():Boolean{
return (_connected);
}
private static function onReceive(_arg1:Object):void{
var methodName:String;
var pkg = _arg1;
var cb:String = pkg.callbackID;
var cblst:Object = _callbacks[cb];
if (!cblst){
return;
};
var method:* = cblst.callbackMethod;
methodName = "";
var obj:Object = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete _callbacks[cb];
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_nextCallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + _arg1));
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_queue.push({methodName:_arg1, args:_arg2, callbackID:_nextCallbackID});
};
if (_clip != null){
if (_callbacks != null){
_callbacks[_nextCallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_nextCallbackID++;
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local4:int;
var _local14:Loader;
var _local3:Array = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23];
var _local5:Array = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
var _local6:Array = [0, 64, 0, 0, 0];
var _local7:MovieClip = new MovieClip();
var _local8:LocalConnection = new LocalConnection();
var _local9:String = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().time));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
var _local10:ByteArray = new ByteArray();
var _local11:ByteArray = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
var _local12:uint = ((_local3.length + _local11.length) + 4);
var _local13:uint = (_local12 + 35);
_local10.endian = Endian.LITTLE_ENDIAN;
_local10.writeUTFBytes("FWS");
_local10.writeByte(8);
_local10.writeUnsignedInt(_local13);
for each (_local4 in _local5) {
_local10.writeByte(_local4);
};
_local10.writeUnsignedInt(_local12);
_local10.writeByte(136);
_local10.writeShort(_local11.length);
_local10.writeBytes(_local11);
for each (_local4 in _local3) {
_local10.writeByte(_local4);
};
for each (_local4 in _local6) {
_local10.writeByte(_local4);
};
_local14 = new Loader();
_local14.loadBytes(_local10);
_local7.addChild(_local14);
return (_local7);
}
private static function detach(_arg1:Event):void{
var _local2:LoaderInfo = LoaderInfo(_arg1.target);
_local2.removeEventListener(Event.COMPLETE, detach);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, detach);
_local2.removeEventListener(Event.COMPLETE, loadLCBridgeComplete);
_local2.removeEventListener(IOErrorEvent.IO_ERROR, loadError);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
private static function loadLCBridgeComplete(_arg1:Event):void{
var _local2:Loader = LoaderInfo(_arg1.target).loader;
_mochiLocalConnection = MovieClip(_local2.content);
listen();
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_mochiLocalConnection.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, connectWait);
_timer = null;
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function getVersion():String{
return ("3.9 as3");
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
}
public static function warnID(_arg1:String, _arg2:Boolean):void{
_arg1 = _arg1.toLowerCase();
if (_arg1.length != 16){
trace((("WARNING: " + (_arg2) ? "board" : "game") + " ID is not the appropriate length"));
return;
} else {
if (_arg1 == "1e113c7239048b3f"){
if (_arg2){
trace("WARNING: Using testing board ID");
} else {
trace("WARNING: Using testing board ID as game ID");
};
return;
} else {
if (_arg1 == "84993a1de4031cd8"){
if (_arg2){
trace("WARNING: Using testing game ID as board ID");
} else {
trace("WARNING: Using testing game ID");
};
return;
};
};
};
var _local3:Number = 0;
while (_local3 < _arg1.length) {
switch (_arg1.charAt(_local3)){
case "0":
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
case "a":
case "b":
case "c":
case "d":
case "e":
case "f":
break;
default:
trace(("WARNING: Board ID contains illegal characters: " + _arg1));
return;
};
_local3++;
};
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (((_clip) && (_queue))){
while (_queue.length > 0) {
_local2 = _queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _callbacks[_local2.callbackID];
};
delete _callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
}
public static function get id():String{
return (_id);
}
private static function onEvent(_arg1:Object):void{
var _local2:String = _arg1.target;
var _local3:String = _arg1.event;
switch (_local2){
case "services":
MochiServices.triggerEvent(_arg1.event, _arg1.args);
break;
case "events":
MochiEvents.triggerEvent(_arg1.event, _arg1.args);
break;
case "coins":
MochiCoins.triggerEvent(_arg1.event, _arg1.args);
break;
case "social":
MochiSocial.triggerEvent(_arg1.event, _arg1.args);
break;
case "sync":
servicesSync.triggerEvent(_arg1.event, _arg1.args);
break;
};
}
private static function urlOptions(_arg1:Object):Object{
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
var _local2:Object = {};
if (_arg1.stage){
_local3 = _arg1.stage.loaderInfo.parameters.mochiad_options;
} else {
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
};
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var avm1Click:DisplayObject;
var x:String;
var req:URLRequest;
var loader:Loader;
var setURL:Function;
var err:Function;
var complete:Function;
var url = _arg1;
var burl = _arg2;
var btn = _arg3;
var onClick = _arg4;
var vars:Object = new Object();
vars["mav"] = getVersion();
vars["swfv"] = "9";
vars["swfurl"] = btn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
var s = "?";
var i:Number = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://link.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
var _local2:Rectangle = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = _local2.x;
avm1Click.y = _local2.y;
avm1Click.scaleX = (0.01 * _local2.width);
avm1Click.scaleY = (0.01 * _local2.height);
};
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
setURL(burl);
};
complete = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_clip.parent){
_clip.parent.removeChild(_clip);
};
if (_arg1 != null){
if ((_arg1 is DisplayObjectContainer)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is DisplayObjectContainer)){
DisplayObjectContainer(_container).addChild(_clip);
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
private static function loadError(_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
}
public static function get childClip():Object{
return (_clip);
}
private static function initComChannels():void{
if (!_connected){
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"registerGame", preserved:_preserved, id:_id, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_clip.onReceive = onReceive;
_clip.onEvent = onEvent;
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
while (_queue.length > 0) {
_mochiLocalConnection.send(_sendChannelName, "onReceive", _queue.shift());
};
};
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
private static function listen():void{
_mochiLocalConnection.connect(_listenChannelName);
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
trace("Waiting for MochiAds services to connect...");
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
private static function loadLCBridge(_arg1:Object):void{
var _local2:Loader = new Loader();
var _local3:String = (_servURL + _mochiLC);
var _local4:URLRequest = new URLRequest(_local3);
_local2.contentLoaderInfo.addEventListener(Event.COMPLETE, detach);
_local2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach);
_local2.contentLoaderInfo.addEventListener(Event.COMPLETE, loadLCBridgeComplete);
_local2.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
_local2.load(_local4);
_arg1.addChild(_local2);
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(_arg2).servURL){
_servURL = urlOptions(_arg2).servURL;
};
var _local3:String = (_servURL + _services);
if (urlOptions(_arg2).servicesURL){
_local3 = urlOptions(_arg2).servicesURL;
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().time) + "_") + Math.floor((Math.random() * 99999))));
MochiServices.allowDomains(_local3);
_clip = new MovieClip();
loadLCBridge(_clip);
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, detach);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, detach);
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
var _local4:URLRequest = new URLRequest(_local3);
var _local5:URLVariables = new URLVariables();
_local5.listenLC = _listenChannelName;
_local5.mochiad_options = _arg2.loaderInfo.parameters.mochiad_options;
_local5.api_version = getVersion();
if (widget){
_local5.widget = true;
};
_local4.data = _local5;
_loader.load(_local4);
_clip.addChild(_loader);
_sendChannel = new LocalConnection();
_queue = [];
_nextCallbackID = 0;
_callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
public static function get clip():Object{
return (_container);
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
warnID(id, false);
if ((clip is DisplayObject)){
if (clip.stage == null){
trace("MochiServices connect requires the containing clip be attached to the stage");
};
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function bringToTop(_arg1:Event=null):void{
var e = _arg1;
if (((!((MochiServices.clip == null))) && (!((MochiServices.childClip == null))))){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
}
public static function connectWait(_arg1:TimerEvent):void{
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
} else {
_timer.stop();
_timer.removeEventListener(TimerEvent.TIMER, connectWait);
_timer = null;
};
}
}
}//package mochi.as3
Section 43
//MochiSocial (mochi.as3.MochiSocial)
package mochi.as3 {
public class MochiSocial {
public static const LOGGED_IN:String = "LoggedIn";
public static const ACTION_CANCELED:String = "onCancel";
public static const PROPERTIES_SIZE:String = "PropertiesSize";
public static const IO_ERROR:String = "IOError";
public static const NO_USER:String = "NoUser";
public static const FRIEND_LIST:String = "FriendsList";
public static const PROFILE_DATA:String = "ProfileData";
public static const GAMEPLAY_DATA:String = "GameplayData";
public static const ACTION_COMPLETE:String = "onComplete";
public static const LOGIN_SHOW:String = "LoginShow";
public static const PROFILE_HIDE:String = "ProfileHide";
public static const USER_INFO:String = "UserInfo";
public static const PROPERTIES_SAVED:String = "PropertySaved";
public static const WIDGET_LOADED:String = "WidgetLoaded";
public static const ERROR:String = "Error";
public static const LOGGED_OUT:String = "LoggedOut";
public static const PROFILE_SHOW:String = "ProfileShow";
public static const LOGIN_HIDE:String = "LoginHide";
public static const LOGIN_SHOWN:String = "LoginShown";
public static var _user_info:Object = null;
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static function postToStream(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_postToStream", _arg1);
}
public static function getFriendsList(_arg1:Object=null):void{
MochiServices.send("social_getFriendsList", _arg1);
}
public static function requestLogin(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_requestLogin", _arg1);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function followRequest(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_followRequest", _arg1);
}
public static function saveUserProperties(_arg1:Object):void{
MochiServices.send("social_saveUserProperties", _arg1);
}
public static function getProfileData(_arg1:Object):void{
MochiServices.send("social_getProfileData", _arg1);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function inviteFriends(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_inviteFriends", _arg1);
}
public static function get loggedIn():Boolean{
return (!((_user_info == null)));
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function showLoginWidget(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("social_showLoginWidget", {options:_arg1});
}
public static function getAPIURL():String{
if (!_user_info){
return (null);
};
return (_user_info.api_url);
}
public static function hideLoginWidget():void{
MochiServices.send("social_hideLoginWidget");
}
public static function getAPIToken():String{
if (!_user_info){
return (null);
};
return (_user_info.api_token);
}
public static function getGameplayData(_arg1:Object):void{
MochiServices.send("social_getGameplayData", _arg1);
}
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_user_info = _arg1;
});
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_user_info = null;
});
}
}//package mochi.as3
Section 44
//MochiSync (mochi.as3.MochiSync)
package mochi.as3 {
import flash.utils.*;
public dynamic class MochiSync extends Proxy {
private var _syncContainer:Object;
public static var SYNC_PROPERTY:String = "UpdateProperty";
public static var SYNC_REQUEST:String = "SyncRequest";
public function MochiSync():void{
_syncContainer = {};
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
if (_syncContainer[_arg1] == _arg2){
return;
};
var _local3:String = _arg1.toString();
_syncContainer[_local3] = _arg2;
MochiServices.send("sync_propUpdate", {name:_local3, value:_arg2});
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
return (_syncContainer[_arg1]);
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
switch (_arg1){
case SYNC_REQUEST:
MochiServices.send("sync_syncronize", _syncContainer);
break;
case SYNC_PROPERTY:
_syncContainer[_arg2.name] = _arg2.value;
break;
};
}
}
}//package mochi.as3
Section 45
//MochiUserData (mochi.as3.MochiUserData)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
public class MochiUserData extends EventDispatcher {
public var callback:Function;// = null
public var operation:String;// = null
public var error:Event;// = null
public var data;// = null
public var _loader:URLLoader;
public var key:String;// = null
public function MochiUserData(_arg1:String="", _arg2:Function=null){
this.key = _arg1;
this.callback = _arg2;
}
public function serialize(_arg1):ByteArray{
var _local2:ByteArray = new ByteArray();
_local2.objectEncoding = ObjectEncoding.AMF3;
_local2.writeObject(_arg1);
_local2.compress();
return (_local2);
}
public function errorHandler(_arg1:IOErrorEvent):void{
data = null;
error = _arg1;
if (callback != null){
performCallback();
} else {
dispatchEvent(_arg1);
};
close();
}
public function putEvent(_arg1):void{
request("put", serialize(_arg1));
}
public function deserialize(_arg1:ByteArray){
_arg1.objectEncoding = ObjectEncoding.AMF3;
_arg1.uncompress();
return (_arg1.readObject());
}
public function securityErrorHandler(_arg1:SecurityErrorEvent):void{
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.toString())));
}
public function getEvent():void{
request("get", serialize(null));
}
override public function toString():String{
return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]"));
}
public function performCallback():void{
try {
callback(this);
} catch(e:Error) {
trace(("[MochiUserData] exception during callback: " + e));
};
}
public function request(_arg1:String, _arg2:ByteArray):void{
var _operation = _arg1;
var _data = _arg2;
operation = _operation;
var api_url:String = MochiSocial.getAPIURL();
var api_token:String = MochiSocial.getAPIToken();
if ((((api_url == null)) || ((api_token == null)))){
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, "not logged in"));
return;
};
_loader = new URLLoader();
var args:URLVariables = new URLVariables();
args.op = _operation;
args.key = key;
var req:URLRequest = new URLRequest((((MochiSocial.getAPIURL() + "/") + "MochiUserData?") + args.toString()));
req.method = URLRequestMethod.POST;
req.contentType = "application/x-mochi-userdata";
req.requestHeaders = [new URLRequestHeader("x-mochi-services-version", MochiServices.getVersion()), new URLRequestHeader("x-mochi-api-token", api_token)];
req.data = _data;
_loader.dataFormat = URLLoaderDataFormat.BINARY;
_loader.addEventListener(Event.COMPLETE, completeHandler);
_loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
try {
_loader.load(req);
} catch(e:SecurityError) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + e.toString())));
};
}
public function completeHandler(_arg1:Event):void{
var event = _arg1;
try {
if (_loader.data.length){
data = deserialize(_loader.data);
} else {
data = null;
};
} catch(e:Error) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("deserialize error: " + e.toString())));
return;
};
if (callback != null){
performCallback();
} else {
dispatchEvent(event);
};
close();
}
public function close():void{
if (_loader){
_loader.removeEventListener(Event.COMPLETE, completeHandler);
_loader.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
_loader.close();
_loader = null;
};
error = null;
callback = null;
}
public static function get(_arg1:String, _arg2:Function):void{
var _local3:MochiUserData = new MochiUserData(_arg1, _arg2);
_local3.getEvent();
}
public static function put(_arg1:String, _arg2, _arg3:Function):void{
var _local4:MochiUserData = new MochiUserData(_arg1, _arg3);
_local4.putEvent(_arg2);
}
}
}//package mochi.as3
Section 46
//BitmapAsset (mx.core.BitmapAsset)
package mx.core {
import flash.display.*;
public class BitmapAsset extends FlexBitmap implements IFlexAsset, IFlexDisplayObject {
mx_internal static const VERSION:String = "3.5.0.12683";
public function BitmapAsset(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
public function get measuredWidth():Number{
if (bitmapData){
return (bitmapData.width);
};
return (0);
}
public function get measuredHeight():Number{
if (bitmapData){
return (bitmapData.height);
};
return (0);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
}
}//package mx.core
Section 47
//ByteArrayAsset (mx.core.ByteArrayAsset)
package mx.core {
import flash.utils.*;
public class ByteArrayAsset extends ByteArray implements IFlexAsset {
mx_internal static const VERSION:String = "3.5.0.12683";
}
}//package mx.core
Section 48
//EdgeMetrics (mx.core.EdgeMetrics)
package mx.core {
public class EdgeMetrics {
public var top:Number;
public var left:Number;
public var bottom:Number;
public var right:Number;
mx_internal static const VERSION:String = "3.5.0.12683";
public static const EMPTY:EdgeMetrics = new EdgeMetrics(0, 0, 0, 0);
;
public function EdgeMetrics(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0){
this.left = _arg1;
this.top = _arg2;
this.right = _arg3;
this.bottom = _arg4;
}
public function clone():EdgeMetrics{
return (new EdgeMetrics(left, top, right, bottom));
}
}
}//package mx.core
Section 49
//FlexBitmap (mx.core.FlexBitmap)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexBitmap extends Bitmap {
mx_internal static const VERSION:String = "3.5.0.12683";
public function FlexBitmap(_arg1:BitmapData=null, _arg2:String="auto", _arg3:Boolean=false){
var bitmapData = _arg1;
var pixelSnapping = _arg2;
var smoothing = _arg3;
super(bitmapData, pixelSnapping, smoothing);
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 50
//FlexMovieClip (mx.core.FlexMovieClip)
package mx.core {
import flash.display.*;
import mx.utils.*;
public class FlexMovieClip extends MovieClip {
mx_internal static const VERSION:String = "3.5.0.12683";
public function FlexMovieClip(){
super();
try {
name = NameUtil.createUniqueName(this);
} catch(e:Error) {
};
}
override public function toString():String{
return (NameUtil.displayObjectToString(this));
}
}
}//package mx.core
Section 51
//FontAsset (mx.core.FontAsset)
package mx.core {
import flash.text.*;
public class FontAsset extends Font implements IFlexAsset {
mx_internal static const VERSION:String = "3.5.0.12683";
}
}//package mx.core
Section 52
//IBorder (mx.core.IBorder)
package mx.core {
public interface IBorder {
function get borderMetrics():EdgeMetrics;
}
}//package mx.core
Section 53
//IFlexAsset (mx.core.IFlexAsset)
package mx.core {
public interface IFlexAsset {
}
}//package mx.core
Section 54
//IFlexDisplayObject (mx.core.IFlexDisplayObject)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.accessibility.*;
public interface IFlexDisplayObject extends IBitmapDrawable, IEventDispatcher {
function get visible():Boolean;
function get rotation():Number;
function localToGlobal(_arg1:Point):Point;
function get name():String;
function set width(_arg1:Number):void;
function get measuredHeight():Number;
function get blendMode():String;
function get scale9Grid():Rectangle;
function set name(_arg1:String):void;
function set scaleX(_arg1:Number):void;
function set scaleY(_arg1:Number):void;
function get measuredWidth():Number;
function get accessibilityProperties():AccessibilityProperties;
function set scrollRect(_arg1:Rectangle):void;
function get cacheAsBitmap():Boolean;
function globalToLocal(_arg1:Point):Point;
function get height():Number;
function set blendMode(_arg1:String):void;
function get parent():DisplayObjectContainer;
function getBounds(_arg1:DisplayObject):Rectangle;
function get opaqueBackground():Object;
function set scale9Grid(_arg1:Rectangle):void;
function setActualSize(_arg1:Number, _arg2:Number):void;
function set alpha(_arg1:Number):void;
function set accessibilityProperties(_arg1:AccessibilityProperties):void;
function get width():Number;
function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Boolean=false):Boolean;
function set cacheAsBitmap(_arg1:Boolean):void;
function get scaleX():Number;
function get scaleY():Number;
function get scrollRect():Rectangle;
function get mouseX():Number;
function get mouseY():Number;
function set height(_arg1:Number):void;
function set mask(_arg1:DisplayObject):void;
function getRect(_arg1:DisplayObject):Rectangle;
function get alpha():Number;
function set transform(_arg1:Transform):void;
function move(_arg1:Number, _arg2:Number):void;
function get loaderInfo():LoaderInfo;
function get root():DisplayObject;
function hitTestObject(_arg1:DisplayObject):Boolean;
function set opaqueBackground(_arg1:Object):void;
function set visible(_arg1:Boolean):void;
function get mask():DisplayObject;
function set x(_arg1:Number):void;
function set y(_arg1:Number):void;
function get transform():Transform;
function set filters(_arg1:Array):void;
function get x():Number;
function get y():Number;
function get filters():Array;
function set rotation(_arg1:Number):void;
function get stage():Stage;
}
}//package mx.core
Section 55
//IRepeaterClient (mx.core.IRepeaterClient)
package mx.core {
public interface IRepeaterClient {
function get instanceIndices():Array;
function set instanceIndices(_arg1:Array):void;
function get isDocument():Boolean;
function set repeaters(_arg1:Array):void;
function initializeRepeaterArrays(_arg1:IRepeaterClient):void;
function get repeaters():Array;
function set repeaterIndices(_arg1:Array):void;
function get repeaterIndices():Array;
}
}//package mx.core
Section 56
//MovieClipAsset (mx.core.MovieClipAsset)
package mx.core {
public class MovieClipAsset extends FlexMovieClip implements IFlexAsset, IFlexDisplayObject, IBorder {
private var _measuredHeight:Number;
private var _measuredWidth:Number;
mx_internal static const VERSION:String = "3.5.0.12683";
public function MovieClipAsset(){
_measuredWidth = width;
_measuredHeight = height;
}
public function get measuredWidth():Number{
return (_measuredWidth);
}
public function get measuredHeight():Number{
return (_measuredHeight);
}
public function setActualSize(_arg1:Number, _arg2:Number):void{
width = _arg1;
height = _arg2;
}
public function move(_arg1:Number, _arg2:Number):void{
this.x = _arg1;
this.y = _arg2;
}
public function get borderMetrics():EdgeMetrics{
if (scale9Grid == null){
return (EdgeMetrics.EMPTY);
};
return (new EdgeMetrics(scale9Grid.left, scale9Grid.top, Math.ceil((measuredWidth - scale9Grid.right)), Math.ceil((measuredHeight - scale9Grid.bottom))));
}
}
}//package mx.core
Section 57
//MovieClipLoaderAsset (mx.core.MovieClipLoaderAsset)
package mx.core {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.system.*;
public class MovieClipLoaderAsset extends MovieClipAsset implements IFlexAsset, IFlexDisplayObject {
protected var initialHeight:Number;// = 0
private var loader:Loader;// = null
private var initialized:Boolean;// = false
protected var initialWidth:Number;// = 0
private var requestedHeight:Number;
private var requestedWidth:Number;
mx_internal static const VERSION:String = "3.5.0.12683";
public function MovieClipLoaderAsset(){
var _local1:LoaderContext = new LoaderContext();
_local1.applicationDomain = new ApplicationDomain(ApplicationDomain.currentDomain);
if (("allowLoadBytesCodeExecution" in _local1)){
_local1["allowLoadBytesCodeExecution"] = true;
};
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, completeHandler);
loader.loadBytes(movieClipData, _local1);
addChild(loader);
}
override public function get width():Number{
if (!initialized){
return (initialWidth);
};
return (super.width);
}
override public function set width(_arg1:Number):void{
if (!initialized){
requestedWidth = _arg1;
} else {
loader.width = _arg1;
};
}
override public function get measuredHeight():Number{
return (initialHeight);
}
private function completeHandler(_arg1:Event):void{
initialized = true;
initialWidth = loader.width;
initialHeight = loader.height;
if (!isNaN(requestedWidth)){
loader.width = requestedWidth;
};
if (!isNaN(requestedHeight)){
loader.height = requestedHeight;
};
dispatchEvent(_arg1);
}
override public function set height(_arg1:Number):void{
if (!initialized){
requestedHeight = _arg1;
} else {
loader.height = _arg1;
};
}
override public function get measuredWidth():Number{
return (initialWidth);
}
override public function get height():Number{
if (!initialized){
return (initialHeight);
};
return (super.height);
}
public function get movieClipData():ByteArray{
return (null);
}
}
}//package mx.core
Section 58
//mx_internal (mx.core.mx_internal)
package mx.core {
public namespace mx_internal = "http://www.adobe.com/2006/flex/mx/internal";
}//package mx.core
Section 59
//SoundAsset (mx.core.SoundAsset)
package mx.core {
import flash.media.*;
public class SoundAsset extends Sound implements IFlexAsset {
mx_internal static const VERSION:String = "3.5.0.12683";
}
}//package mx.core
Section 60
//NameUtil (mx.utils.NameUtil)
package mx.utils {
import flash.display.*;
import mx.core.*;
import flash.utils.*;
public class NameUtil {
mx_internal static const VERSION:String = "3.5.0.12683";
private static var counter:int = 0;
public static function displayObjectToString(_arg1:DisplayObject):String{
var result:String;
var o:DisplayObject;
var s:String;
var indices:Array;
var displayObject = _arg1;
try {
o = displayObject;
while (o != null) {
if (((((o.parent) && (o.stage))) && ((o.parent == o.stage)))){
break;
};
s = o.name;
if ((o is IRepeaterClient)){
indices = IRepeaterClient(o).instanceIndices;
if (indices){
s = (s + (("[" + indices.join("][")) + "]"));
};
};
result = ((result == null)) ? s : ((s + ".") + result);
o = o.parent;
};
} catch(e:SecurityError) {
};
return (result);
}
public static function createUniqueName(_arg1:Object):String{
if (!_arg1){
return (null);
};
var _local2:String = getQualifiedClassName(_arg1);
var _local3:int = _local2.indexOf("::");
if (_local3 != -1){
_local2 = _local2.substr((_local3 + 2));
};
var _local4:int = _local2.charCodeAt((_local2.length - 1));
if ((((_local4 >= 48)) && ((_local4 <= 57)))){
_local2 = (_local2 + "_");
};
return ((_local2 + counter++));
}
}
}//package mx.utils
Section 61
//NewgroundsAPIAsset_FlashAd_Container_23 (NewgroundsAPI_fla.NewgroundsAPIAsset_FlashAd_Container_23)
package NewgroundsAPI_fla {
import flash.events.*;
import flash.display.*;
import com.newgrounds.*;
public dynamic class NewgroundsAPIAsset_FlashAd_Container_23 extends MovieClip {
public var adMask:MovieClip;
public var ngLinkButton:SimpleButton;
public function NewgroundsAPIAsset_FlashAd_Container_23(){
addFrameScript(0, this.frame1, 10, this.frame11);
}
public function onNGLinkClicked(_arg1:MouseEvent):void{
API.loadNewgrounds();
}
function frame1(){
this.ngLinkButton.addEventListener(MouseEvent.CLICK, this.onNGLinkClicked);
}
function frame11(){
gotoAndPlay(1);
}
}
}//package NewgroundsAPI_fla
Section 62
//NewgroundsAPIAsset_Load_Indicator_3 (NewgroundsAPI_fla.NewgroundsAPIAsset_Load_Indicator_3)
package NewgroundsAPI_fla {
import flash.events.*;
import flash.display.*;
public dynamic class NewgroundsAPIAsset_Load_Indicator_3 extends MovieClip {
public function NewgroundsAPIAsset_Load_Indicator_3(){
addFrameScript(0, this.frame1);
}
public function onEnterFrame(_arg1:Event):void{
if (((visible) && (stage))){
rotation = (rotation + 30);
} else {
removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
};
}
function frame1(){
addEventListener(Event.ENTER_FRAME, this.onEnterFrame);
}
}
}//package NewgroundsAPI_fla
Section 63
//Camera3D (org.papervision3d.cameras.Camera3D)
package org.papervision3d.cameras {
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.geom.renderables.*;
import flash.utils.*;
public class Camera3D extends CameraObject3D {
protected var _focusFix:Matrix3D;
protected var _prevUseProjection:Boolean;
protected var _prevZoom:Number;
protected var _prevOrtho:Boolean;
protected var _prevWidth:Number;
protected var _prevHeight:Number;
protected var _prevFocus:Number;
protected var _projection:Matrix3D;
protected var _prevOrthoProjection:Boolean;
public function Camera3D(_arg1:Number=60, _arg2:Number=10, _arg3:Number=5000, _arg4:Boolean=false, _arg5:Boolean=false){
super(_arg2, 40);
this.fov = _arg1;
_prevFocus = 0;
_prevZoom = 0;
_prevOrtho = false;
_prevUseProjection = false;
_useCulling = _arg4;
_useProjectionMatrix = _arg5;
_far = _arg3;
_focusFix = Matrix3D.IDENTITY;
}
public function update(_arg1:Rectangle):void{
if (!_arg1){
throw (new Error(("Camera3D#update: Invalid viewport rectangle! " + _arg1)));
};
this.viewport = _arg1;
_prevFocus = this.focus;
_prevZoom = this.zoom;
_prevWidth = this.viewport.width;
_prevHeight = this.viewport.height;
if (_prevOrtho != this.ortho){
if (this.ortho){
_prevOrthoProjection = this.useProjectionMatrix;
this.useProjectionMatrix = true;
} else {
this.useProjectionMatrix = _prevOrthoProjection;
};
};
this.useProjectionMatrix = this._useProjectionMatrix;
_prevOrtho = this.ortho;
_prevUseProjection = _useProjectionMatrix;
this.useCulling = _useCulling;
}
public function get projection():Matrix3D{
return (_projection);
}
override public function set near(_arg1:Number):void{
if (_arg1 > 0){
this.focus = _arg1;
this.update(this.viewport);
};
}
override public function orbit(_arg1:Number, _arg2:Number, _arg3:Boolean=true, _arg4:DisplayObject3D=null):void{
var _local8:Number;
_arg4 = ((_arg4) || (_target));
_arg4 = ((_arg4) || (DisplayObject3D.ZERO));
if (_arg3){
_arg1 = (_arg1 * (Math.PI / 180));
_arg2 = (_arg2 * (Math.PI / 180));
};
var _local5:Number = (_arg4.world.n14 - this.x);
var _local6:Number = (_arg4.world.n24 - this.y);
var _local7:Number = (_arg4.world.n34 - this.z);
_local8 = Math.sqrt((((_local5 * _local5) + (_local6 * _local6)) + (_local7 * _local7)));
var _local9:Number = (Math.cos(_arg2) * Math.sin(_arg1));
var _local10:Number = (Math.sin(_arg2) * Math.sin(_arg1));
var _local11:Number = Math.cos(_arg1);
this.x = (_arg4.world.n14 + (_local9 * _local8));
this.y = (_arg4.world.n24 + (_local11 * _local8));
this.z = (_arg4.world.n34 + (_local10 * _local8));
this.lookAt(_arg4);
}
override public function set useCulling(_arg1:Boolean):void{
super.useCulling = _arg1;
if (_useCulling){
if (!this.culler){
this.culler = new FrustumCuller();
};
FrustumCuller(this.culler).initialize(this.fov, (this.viewport.width / this.viewport.height), (this.focus / this.zoom), _far);
} else {
this.culler = null;
};
}
override public function projectFaces(_arg1:Array, _arg2:DisplayObject3D, _arg3:RenderSessionData):Number{
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Vertex3D;
var _local25:Vertex3DInstance;
var _local26:Number;
var _local34:Array;
var _local36:Triangle3D;
var _local4:Matrix3D = _arg2.view;
var _local5:Number = _local4.n11;
var _local6:Number = _local4.n12;
var _local7:Number = _local4.n13;
var _local8:Number = _local4.n21;
var _local9:Number = _local4.n22;
var _local10:Number = _local4.n23;
var _local11:Number = _local4.n31;
var _local12:Number = _local4.n32;
var _local13:Number = _local4.n33;
var _local14:Number = _local4.n41;
var _local15:Number = _local4.n42;
var _local16:Number = _local4.n43;
var _local27:int;
var _local28:Number = _arg3.camera.focus;
var _local29:Number = (_local28 * _arg3.camera.zoom);
var _local30:Number = (viewport.width / 2);
var _local31:Number = (viewport.height / 2);
var _local32:Number = _arg3.camera.far;
var _local33:Number = (_local32 - _local28);
var _local35:Number = getTimer();
for each (_local36 in _arg1) {
_local34 = _local36.vertices;
_local27 = _local34.length;
while ((_local24 = _local34[--_local27])) {
if (_local24.timestamp == _local35){
} else {
_local24.timestamp = _local35;
_local17 = _local24.x;
_local18 = _local24.y;
_local19 = _local24.z;
_local22 = ((((_local17 * _local11) + (_local18 * _local12)) + (_local19 * _local13)) + _local4.n34);
_local25 = _local24.vertex3DInstance;
if (_useProjectionMatrix){
_local23 = ((((_local17 * _local14) + (_local18 * _local15)) + (_local19 * _local16)) + _local4.n44);
_local22 = (_local22 / _local23);
if ((_local25.visible = (((_local22 > 0)) && ((_local22 < 1))))){
_local20 = (((((_local17 * _local5) + (_local18 * _local6)) + (_local19 * _local7)) + _local4.n14) / _local23);
_local21 = (((((_local17 * _local8) + (_local18 * _local9)) + (_local19 * _local10)) + _local4.n24) / _local23);
_local25.x = (_local20 * _local30);
_local25.y = (_local21 * _local31);
_local25.z = (_local22 * _local23);
};
} else {
if ((_local25.visible = ((_local28 + _local22) > 0))){
_local20 = ((((_local17 * _local5) + (_local18 * _local6)) + (_local19 * _local7)) + _local4.n14);
_local21 = ((((_local17 * _local8) + (_local18 * _local9)) + (_local19 * _local10)) + _local4.n24);
_local26 = (_local29 / (_local28 + _local22));
_local25.x = (_local20 * _local26);
_local25.y = (_local21 * _local26);
_local25.z = _local22;
};
};
};
};
};
return (0);
}
override public function set orthoScale(_arg1:Number):void{
super.orthoScale = _arg1;
this.useProjectionMatrix = this.useProjectionMatrix;
_prevOrtho = !(this.ortho);
this.update(this.viewport);
}
override public function transformView(_arg1:Matrix3D=null):void{
if (((((((((((!((ortho == _prevOrtho))) || (!((_prevUseProjection == _useProjectionMatrix))))) || (!((focus == _prevFocus))))) || (!((zoom == _prevZoom))))) || (!((viewport.width == _prevWidth))))) || (!((viewport.height == _prevHeight))))){
update(viewport);
};
if (_target){
lookAt(_target);
} else {
if (_transformDirty){
updateTransform();
};
};
if (_useProjectionMatrix){
super.transformView();
this.eye.calculateMultiply4x4(_projection, this.eye);
} else {
_focusFix.copy(this.transform);
_focusFix.n14 = (_focusFix.n14 + (focus * this.transform.n13));
_focusFix.n24 = (_focusFix.n24 + (focus * this.transform.n23));
_focusFix.n34 = (_focusFix.n34 + (focus * this.transform.n33));
super.transformView(_focusFix);
};
if ((culler is FrustumCuller)){
FrustumCuller(culler).transform.copy(this.transform);
};
}
override public function set far(_arg1:Number):void{
if (_arg1 > this.focus){
_far = _arg1;
this.update(this.viewport);
};
}
override public function projectVertices(_arg1:Array, _arg2:DisplayObject3D, _arg3:RenderSessionData):Number{
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local22:Number;
var _local23:Number;
var _local24:Vertex3D;
var _local25:Vertex3DInstance;
var _local26:Number;
var _local4:Matrix3D = _arg2.view;
var _local5:Number = _local4.n11;
var _local6:Number = _local4.n12;
var _local7:Number = _local4.n13;
var _local8:Number = _local4.n21;
var _local9:Number = _local4.n22;
var _local10:Number = _local4.n23;
var _local11:Number = _local4.n31;
var _local12:Number = _local4.n32;
var _local13:Number = _local4.n33;
var _local14:Number = _local4.n41;
var _local15:Number = _local4.n42;
var _local16:Number = _local4.n43;
var _local27:int = _arg1.length;
var _local28:Number = _arg3.camera.focus;
var _local29:Number = (_local28 * _arg3.camera.zoom);
var _local30:Number = (viewport.width / 2);
var _local31:Number = (viewport.height / 2);
var _local32:Number = _arg3.camera.far;
var _local33:Number = (_local32 - _local28);
while ((_local24 = _arg1[--_local27])) {
_local17 = _local24.x;
_local18 = _local24.y;
_local19 = _local24.z;
_local22 = ((((_local17 * _local11) + (_local18 * _local12)) + (_local19 * _local13)) + _local4.n34);
_local25 = _local24.vertex3DInstance;
if (_useProjectionMatrix){
_local23 = ((((_local17 * _local14) + (_local18 * _local15)) + (_local19 * _local16)) + _local4.n44);
_local22 = (_local22 / _local23);
if ((_local25.visible = (((_local22 > 0)) && ((_local22 < 1))))){
_local20 = (((((_local17 * _local5) + (_local18 * _local6)) + (_local19 * _local7)) + _local4.n14) / _local23);
_local21 = (((((_local17 * _local8) + (_local18 * _local9)) + (_local19 * _local10)) + _local4.n24) / _local23);
_local25.x = (_local20 * _local30);
_local25.y = (_local21 * _local31);
_local25.z = (_local22 * _local23);
};
} else {
if ((_local25.visible = ((_local28 + _local22) > 0))){
_local20 = ((((_local17 * _local5) + (_local18 * _local6)) + (_local19 * _local7)) + _local4.n14);
_local21 = ((((_local17 * _local8) + (_local18 * _local9)) + (_local19 * _local10)) + _local4.n24);
_local26 = (_local29 / (_local28 + _local22));
_local25.x = (_local20 * _local26);
_local25.y = (_local21 * _local26);
_local25.z = _local22;
};
};
};
return (0);
}
override public function set useProjectionMatrix(_arg1:Boolean):void{
var _local2:Number;
var _local3:Number;
if (_arg1){
if (this.ortho){
_local2 = (viewport.width / 2);
_local3 = (viewport.height / 2);
_projection = createOrthoMatrix(-(_local2), _local2, -(_local3), _local3, -(_far), _far);
_projection = Matrix3D.multiply(_orthoScaleMatrix, _projection);
} else {
_projection = createPerspectiveMatrix(fov, (viewport.width / viewport.height), this.focus, this.far);
};
} else {
if (this.ortho){
_arg1 = true;
};
};
super.useProjectionMatrix = _arg1;
}
public static function createPerspectiveMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Matrix3D{
var _local5:Number = ((_arg1 / 2) * (Math.PI / 180));
var _local6:Number = Math.tan(_local5);
var _local7:Number = (1 / _local6);
return (new Matrix3D([(_local7 / _arg2), 0, 0, 0, 0, _local7, 0, 0, 0, 0, -(((_arg3 + _arg4) / (_arg3 - _arg4))), (((2 * _arg4) * _arg3) / (_arg3 - _arg4)), 0, 0, 1, 0]));
}
public static function createOrthoMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number):Matrix3D{
var _local7:Number = ((_arg2 + _arg1) / (_arg2 - _arg1));
var _local8:Number = ((_arg4 + _arg3) / (_arg4 - _arg3));
var _local9:Number = ((_arg6 + _arg5) / (_arg6 - _arg5));
var _local10:Matrix3D = new Matrix3D([(2 / (_arg2 - _arg1)), 0, 0, _local7, 0, (2 / (_arg4 - _arg3)), 0, _local8, 0, 0, (-2 / (_arg6 - _arg5)), _local9, 0, 0, 0, 1]);
_local10.calculateMultiply(Matrix3D.scaleMatrix(1, 1, -1), _local10);
return (_local10);
}
}
}//package org.papervision3d.cameras
Section 64
//Clipping (org.papervision3d.core.clipping.draw.Clipping)
package org.papervision3d.core.clipping.draw {
import flash.display.*;
import flash.geom.*;
import org.papervision3d.core.render.command.*;
public class Clipping {
public var minX:Number;// = -1000000
public var minY:Number;// = -1000000
private var zeroPoint:Point;
private var globalPoint:Point;
private var rectangleClipping:RectangleClipping;
public var maxX:Number;// = 1000000
public var maxY:Number;// = 1000000
public function Clipping(){
zeroPoint = new Point(0, 0);
super();
}
public function rect(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Boolean{
return (true);
}
public function screen(_arg1:Sprite):Clipping{
if (!rectangleClipping){
rectangleClipping = new RectangleClipping();
};
switch (_arg1.stage.align){
case StageAlign.TOP_LEFT:
zeroPoint.x = 0;
zeroPoint.y = 0;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.maxX = ((rectangleClipping.minX = globalPoint.x) + _arg1.stage.stageWidth);
rectangleClipping.maxY = ((rectangleClipping.minY = globalPoint.y) + _arg1.stage.stageHeight);
break;
case StageAlign.TOP_RIGHT:
zeroPoint.x = _arg1.stage.stageWidth;
zeroPoint.y = 0;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = ((rectangleClipping.maxX = globalPoint.x) - _arg1.stage.stageWidth);
rectangleClipping.maxY = ((rectangleClipping.minY = globalPoint.y) + _arg1.stage.stageHeight);
break;
case StageAlign.BOTTOM_LEFT:
zeroPoint.x = 0;
zeroPoint.y = _arg1.stage.stageHeight;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.maxX = ((rectangleClipping.minX = globalPoint.x) + _arg1.stage.stageWidth);
rectangleClipping.minY = ((rectangleClipping.maxY = globalPoint.y) - _arg1.stage.stageHeight);
break;
case StageAlign.BOTTOM_RIGHT:
zeroPoint.x = _arg1.stage.stageWidth;
zeroPoint.y = _arg1.stage.stageHeight;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = ((rectangleClipping.maxX = globalPoint.x) - _arg1.stage.stageWidth);
rectangleClipping.minY = ((rectangleClipping.maxY = globalPoint.y) - _arg1.stage.stageHeight);
break;
case StageAlign.TOP:
zeroPoint.x = (_arg1.stage.stageWidth / 2);
zeroPoint.y = 0;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = (globalPoint.x - (_arg1.stage.stageWidth / 2));
rectangleClipping.maxX = (globalPoint.x + (_arg1.stage.stageWidth / 2));
rectangleClipping.maxY = ((rectangleClipping.minY = globalPoint.y) + _arg1.stage.stageHeight);
break;
case StageAlign.BOTTOM:
zeroPoint.x = (_arg1.stage.stageWidth / 2);
zeroPoint.y = _arg1.stage.stageHeight;
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = (globalPoint.x - (_arg1.stage.stageWidth / 2));
rectangleClipping.maxX = (globalPoint.x + (_arg1.stage.stageWidth / 2));
rectangleClipping.minY = ((rectangleClipping.maxY = globalPoint.y) - _arg1.stage.stageHeight);
break;
case StageAlign.LEFT:
zeroPoint.x = 0;
zeroPoint.y = (_arg1.stage.stageHeight / 2);
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.maxX = ((rectangleClipping.minX = globalPoint.x) + _arg1.stage.stageWidth);
rectangleClipping.minY = (globalPoint.y - (_arg1.stage.stageHeight / 2));
rectangleClipping.maxY = (globalPoint.y + (_arg1.stage.stageHeight / 2));
break;
case StageAlign.RIGHT:
zeroPoint.x = _arg1.stage.stageWidth;
zeroPoint.y = (_arg1.stage.stageHeight / 2);
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = ((rectangleClipping.maxX = globalPoint.x) - _arg1.stage.stageWidth);
rectangleClipping.minY = (globalPoint.y - (_arg1.stage.stageHeight / 2));
rectangleClipping.maxY = (globalPoint.y + (_arg1.stage.stageHeight / 2));
break;
default:
zeroPoint.x = (_arg1.stage.stageWidth / 2);
zeroPoint.y = (_arg1.stage.stageHeight / 2);
globalPoint = _arg1.globalToLocal(zeroPoint);
rectangleClipping.minX = (globalPoint.x - (_arg1.stage.stageWidth / 2));
rectangleClipping.maxX = (globalPoint.x + (_arg1.stage.stageWidth / 2));
rectangleClipping.minY = (globalPoint.y - (_arg1.stage.stageHeight / 2));
rectangleClipping.maxY = (globalPoint.y + (_arg1.stage.stageHeight / 2));
};
return (rectangleClipping);
}
public function check(_arg1:RenderableListItem):Boolean{
return (true);
}
public function asRectangleClipping():RectangleClipping{
if (!rectangleClipping){
rectangleClipping = new RectangleClipping();
};
rectangleClipping.minX = -1000000;
rectangleClipping.minY = -1000000;
rectangleClipping.maxX = 1000000;
rectangleClipping.maxY = 1000000;
return (rectangleClipping);
}
}
}//package org.papervision3d.core.clipping.draw
Section 65
//RectangleClipping (org.papervision3d.core.clipping.draw.RectangleClipping)
package org.papervision3d.core.clipping.draw {
import org.papervision3d.core.render.command.*;
public class RectangleClipping extends Clipping {
public function RectangleClipping(_arg1:Number=-1000000, _arg2:Number=-1000000, _arg3:Number=1000000, _arg4:Number=1000000){
this.minX = _arg1;
this.maxX = _arg3;
this.minY = _arg2;
this.maxY = _arg4;
}
override public function check(_arg1:RenderableListItem):Boolean{
if (_arg1.maxX < minX){
return (false);
};
if (_arg1.minX > maxX){
return (false);
};
if (_arg1.maxY < minY){
return (false);
};
if (_arg1.minY > maxY){
return (false);
};
return (true);
}
override public function rect(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Boolean{
if (this.maxX < _arg1){
return (false);
};
if (this.minX > _arg3){
return (false);
};
if (this.maxY < _arg2){
return (false);
};
if (this.minY > _arg4){
return (false);
};
return (true);
}
public function toString():String{
return ((((((((("{minX:" + minX) + " maxX:") + maxX) + " minY:") + minY) + " maxY:") + maxY) + "}"));
}
override public function asRectangleClipping():RectangleClipping{
return (this);
}
}
}//package org.papervision3d.core.clipping.draw
Section 66
//DefaultClipping (org.papervision3d.core.clipping.DefaultClipping)
package org.papervision3d.core.clipping {
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
public class DefaultClipping {
public function testFace(_arg1:Triangle3D, _arg2:DisplayObject3D, _arg3:RenderSessionData):Boolean{
return (false);
}
public function clipFace(_arg1:Triangle3D, _arg2:DisplayObject3D, _arg3:MaterialObject3D, _arg4:RenderSessionData, _arg5:Array):Number{
return (0);
}
public function setDisplayObject(_arg1:DisplayObject3D, _arg2:RenderSessionData):void{
}
public function reset(_arg1:RenderSessionData):void{
}
}
}//package org.papervision3d.core.clipping
Section 67
//DefaultLineCuller (org.papervision3d.core.culling.DefaultLineCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.geom.renderables.*;
public class DefaultLineCuller implements ILineCuller {
public function testLine(_arg1:Line3D):Boolean{
return (((_arg1.v0.vertex3DInstance.visible) && (_arg1.v1.vertex3DInstance.visible)));
}
}
}//package org.papervision3d.core.culling
Section 68
//DefaultParticleCuller (org.papervision3d.core.culling.DefaultParticleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.geom.renderables.*;
public class DefaultParticleCuller implements IParticleCuller {
public function testParticle(_arg1:Particle):Boolean{
if (_arg1.material.invisible == false){
if (_arg1.vertex3D.vertex3DInstance.visible == true){
return (true);
};
};
return (false);
}
}
}//package org.papervision3d.core.culling
Section 69
//DefaultTriangleCuller (org.papervision3d.core.culling.DefaultTriangleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
public class DefaultTriangleCuller implements ITriangleCuller {
protected static var y2:Number;
protected static var y1:Number;
protected static var y0:Number;
protected static var x0:Number;
protected static var x1:Number;
protected static var x2:Number;
public function testFace(_arg1:Triangle3D, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance):Boolean{
var _local5:MaterialObject3D;
if (((((_arg2.visible) && (_arg3.visible))) && (_arg4.visible))){
_local5 = (_arg1.material) ? _arg1.material : _arg1.instance.material;
if (_local5.invisible){
return (false);
};
x0 = _arg2.x;
y0 = _arg2.y;
x1 = _arg3.x;
y1 = _arg3.y;
x2 = _arg4.x;
y2 = _arg4.y;
if (_local5.oneSide){
if (_local5.opposite){
if ((((x2 - x0) * (y1 - y0)) - ((y2 - y0) * (x1 - x0))) > 0){
return (false);
};
} else {
if ((((x2 - x0) * (y1 - y0)) - ((y2 - y0) * (x1 - x0))) < 0){
return (false);
};
};
};
return (true);
};
return (false);
}
}
}//package org.papervision3d.core.culling
Section 70
//FrustumCuller (org.papervision3d.core.culling.FrustumCuller)
package org.papervision3d.core.culling {
import org.papervision3d.objects.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.geom.renderables.*;
public class FrustumCuller implements IObjectCuller {
private var _tang:Number;
private var _near:Number;
private var _ratio:Number;
private var _fov:Number;
private var _far:Number;
private var _nh:Number;
private var _fh:Number;
private var _nw:Number;
public var transform:Matrix3D;
private var _sphereY:Number;
private var _sphereX:Number;
private var _fw:Number;
public static const OUTSIDE:int = -1;
public static const INSIDE:int = 1;
public static const INTERSECT:int = 0;
public function FrustumCuller(){
this.transform = Matrix3D.IDENTITY;
this.initialize();
}
public function get ratio():Number{
return (_ratio);
}
public function pointInFrustum(_arg1:Number, _arg2:Number, _arg3:Number):int{
var _local4:Matrix3D = this.transform;
var _local5:Number = (_arg1 - _local4.n14);
var _local6:Number = (_arg2 - _local4.n24);
var _local7:Number = (_arg3 - _local4.n34);
var _local8:Number = (((_local5 * _local4.n13) + (_local6 * _local4.n23)) + (_local7 * _local4.n33));
if ((((_local8 > _far)) || ((_local8 < _near)))){
return (OUTSIDE);
};
var _local9:Number = (((_local5 * _local4.n12) + (_local6 * _local4.n22)) + (_local7 * _local4.n32));
var _local10:Number = (_local8 * _tang);
if ((((_local9 > _local10)) || ((_local9 < -(_local10))))){
return (OUTSIDE);
};
var _local11:Number = (((_local5 * _local4.n11) + (_local6 * _local4.n21)) + (_local7 * _local4.n31));
_local10 = (_local10 * _ratio);
if ((((_local11 > _local10)) || ((_local11 < -(_local10))))){
return (OUTSIDE);
};
return (INSIDE);
}
public function get fov():Number{
return (_fov);
}
public function set ratio(_arg1:Number):void{
this.initialize(_fov, _arg1, _near, _far);
}
public function set near(_arg1:Number):void{
this.initialize(_fov, _ratio, _arg1, _far);
}
public function set fov(_arg1:Number):void{
this.initialize(_arg1, _ratio, _near, _far);
}
public function get far():Number{
return (_far);
}
public function initialize(_arg1:Number=60, _arg2:Number=1.333, _arg3:Number=1, _arg4:Number=5000):void{
_fov = _arg1;
_ratio = _arg2;
_near = _arg3;
_far = _arg4;
var _local5:Number = (((Math.PI / 180) * _fov) * 0.5);
_tang = Math.tan(_local5);
_nh = (_near * _tang);
_nw = (_nh * _ratio);
_fh = (_far * _tang);
_fw = (_fh * _ratio);
var _local6:Number = Math.atan((_tang * _ratio));
_sphereX = (1 / Math.cos(_local6));
_sphereY = (1 / Math.cos(_local5));
}
public function set far(_arg1:Number):void{
this.initialize(_fov, _ratio, _near, _arg1);
}
public function get near():Number{
return (_near);
}
public function sphereInFrustum(_arg1:DisplayObject3D, _arg2:BoundingSphere):int{
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local3:Number = (_arg2.radius * Math.max(_arg1.scaleX, Math.max(_arg1.scaleY, _arg1.scaleZ)));
var _local8:int = INSIDE;
var _local9:Matrix3D = this.transform;
var _local10:Number = (_arg1.world.n14 - _local9.n14);
var _local11:Number = (_arg1.world.n24 - _local9.n24);
var _local12:Number = (_arg1.world.n34 - _local9.n34);
_local7 = (((_local10 * _local9.n13) + (_local11 * _local9.n23)) + (_local12 * _local9.n33));
if ((((_local7 > (_far + _local3))) || ((_local7 < (_near - _local3))))){
return (OUTSIDE);
};
if ((((_local7 > (_far - _local3))) || ((_local7 < (_near + _local3))))){
_local8 = INTERSECT;
};
_local6 = (((_local10 * _local9.n12) + (_local11 * _local9.n22)) + (_local12 * _local9.n32));
_local4 = (_sphereY * _local3);
_local7 = (_local7 * _tang);
if ((((_local6 > (_local7 + _local4))) || ((_local6 < (-(_local7) - _local4))))){
return (OUTSIDE);
};
if ((((_local6 > (_local7 - _local4))) || ((_local6 < (-(_local7) + _local4))))){
_local8 = INTERSECT;
};
_local5 = (((_local10 * _local9.n11) + (_local11 * _local9.n21)) + (_local12 * _local9.n31));
_local7 = (_local7 * _ratio);
_local4 = (_sphereX * _local3);
if ((((_local5 > (_local7 + _local4))) || ((_local5 < (-(_local7) - _local4))))){
return (OUTSIDE);
};
if ((((_local5 > (_local7 - _local4))) || ((_local5 < (-(_local7) + _local4))))){
_local8 = INTERSECT;
};
return (_local8);
}
public function testObject(_arg1:DisplayObject3D):int{
var _local2:int = INSIDE;
if (((((!(_arg1.geometry)) || (!(_arg1.geometry.vertices)))) || (!(_arg1.geometry.vertices.length)))){
return (_local2);
};
switch (_arg1.frustumTestMethod){
case FrustumTestMethod.BOUNDING_SPHERE:
_local2 = sphereInFrustum(_arg1, _arg1.geometry.boundingSphere);
break;
case FrustumTestMethod.BOUNDING_BOX:
_local2 = aabbInFrustum(_arg1, _arg1.geometry.aabb);
break;
case FrustumTestMethod.NO_TESTING:
break;
default:
break;
};
return (_local2);
}
public function aabbInFrustum(_arg1:DisplayObject3D, _arg2:AxisAlignedBoundingBox, _arg3:Boolean=true):int{
var _local4:Vertex3D;
var _local5:Number3D;
var _local6:int;
var _local7:int;
var _local8:Array = _arg2.getBoxVertices();
for each (_local4 in _local8) {
_local5 = _local4.toNumber3D();
Matrix3D.multiplyVector(_arg1.world, _local5);
if (pointInFrustum(_local5.x, _local5.y, _local5.z) == INSIDE){
_local6++;
if (_arg3){
return (INSIDE);
};
} else {
_local7++;
};
if (((_local6) && (_local7))){
return (INTERSECT);
};
};
if (_local6){
return (((_local6 < 8)) ? INTERSECT : INSIDE);
//unresolved jump
};
return (OUTSIDE);
}
}
}//package org.papervision3d.core.culling
Section 71
//FrustumTestMethod (org.papervision3d.core.culling.FrustumTestMethod)
package org.papervision3d.core.culling {
public class FrustumTestMethod {
public static const BOUNDING_BOX:int = 1;
public static const NO_TESTING:int = -1;
public static const BOUNDING_SPHERE:int = 0;
}
}//package org.papervision3d.core.culling
Section 72
//ILineCuller (org.papervision3d.core.culling.ILineCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.geom.renderables.*;
public interface ILineCuller {
function testLine(_arg1:Line3D):Boolean;
}
}//package org.papervision3d.core.culling
Section 73
//IObjectCuller (org.papervision3d.core.culling.IObjectCuller)
package org.papervision3d.core.culling {
import org.papervision3d.objects.*;
public interface IObjectCuller {
function testObject(_arg1:DisplayObject3D):int;
}
}//package org.papervision3d.core.culling
Section 74
//IParticleCuller (org.papervision3d.core.culling.IParticleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.geom.renderables.*;
public interface IParticleCuller {
function testParticle(_arg1:Particle):Boolean;
}
}//package org.papervision3d.core.culling
Section 75
//ITriangleCuller (org.papervision3d.core.culling.ITriangleCuller)
package org.papervision3d.core.culling {
import org.papervision3d.core.geom.renderables.*;
public interface ITriangleCuller {
function testFace(_arg1:Triangle3D, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance):Boolean;
}
}//package org.papervision3d.core.culling
Section 76
//RectangleLineCuller (org.papervision3d.core.culling.RectangleLineCuller)
package org.papervision3d.core.culling {
import flash.geom.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.util.*;
public class RectangleLineCuller implements ILineCuller {
private var lineBoundsRect:Rectangle;
private var rectIntersection:Rectangle;
private var cullingRectangle:Rectangle;
public function RectangleLineCuller(_arg1:Rectangle=null):void{
if (_arg1){
this.cullingRectangle = _arg1;
};
lineBoundsRect = new Rectangle();
rectIntersection = new Rectangle();
}
public function testLine(_arg1:Line3D):Boolean{
if (((!(_arg1.v0.vertex3DInstance.visible)) || (!(_arg1.v1.vertex3DInstance.visible)))){
return (false);
};
var _local2:Number = _arg1.v0.vertex3DInstance.x;
var _local3:Number = _arg1.v0.vertex3DInstance.y;
var _local4:Number = _arg1.v1.vertex3DInstance.x;
var _local5:Number = _arg1.v1.vertex3DInstance.y;
lineBoundsRect.width = Math.abs((_local4 - _local2));
lineBoundsRect.height = Math.abs((_local5 - _local3));
if (_local2 < _local4){
lineBoundsRect.x = _local2;
} else {
lineBoundsRect.x = _local4;
};
if (_local3 < _local5){
lineBoundsRect.y = _local3;
} else {
lineBoundsRect.y = _local5;
};
if (cullingRectangle.containsRect(lineBoundsRect)){
return (true);
};
if (!FastRectangleTools.intersects(lineBoundsRect, cullingRectangle)){
return (false);
};
rectIntersection = FastRectangleTools.intersection(lineBoundsRect, cullingRectangle);
var _local6:Number = ((_local5 - _local3) / (_local4 - _local2));
var _local7:Number = (_local3 - (_local6 * _local2));
var _local8:Number = ((cullingRectangle.top - _local7) / _local6);
if ((((_local8 > rectIntersection.left)) && ((_local8 < rectIntersection.right)))){
return (true);
};
_local8 = ((cullingRectangle.bottom - _local7) / _local6);
if ((((_local8 > rectIntersection.left)) && ((_local8 < rectIntersection.right)))){
return (true);
};
var _local9:Number = ((_local6 * cullingRectangle.left) + _local7);
if ((((_local9 > rectIntersection.top)) && ((_local9 < rectIntersection.bottom)))){
return (true);
};
_local9 = ((_local6 * cullingRectangle.right) + _local7);
if ((((_local9 > rectIntersection.top)) && ((_local9 < rectIntersection.bottom)))){
return (true);
};
return (false);
}
}
}//package org.papervision3d.core.culling
Section 77
//RectangleParticleCuller (org.papervision3d.core.culling.RectangleParticleCuller)
package org.papervision3d.core.culling {
import flash.geom.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.util.*;
public class RectangleParticleCuller implements IParticleCuller {
public var cullingRectangle:Rectangle;
private static var vInstance:Vertex3DInstance;
private static var testPoint:Point;
public function RectangleParticleCuller(_arg1:Rectangle=null){
this.cullingRectangle = _arg1;
testPoint = new Point();
}
public function testParticle(_arg1:Particle):Boolean{
vInstance = _arg1.vertex3D.vertex3DInstance;
if (_arg1.material.invisible == false){
if (vInstance.visible){
if (FastRectangleTools.intersects(_arg1.renderRect, cullingRectangle)){
return (true);
};
};
};
return (false);
}
}
}//package org.papervision3d.core.culling
Section 78
//RectangleTriangleCuller (org.papervision3d.core.culling.RectangleTriangleCuller)
package org.papervision3d.core.culling {
import flash.geom.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.math.util.*;
public class RectangleTriangleCuller extends DefaultTriangleCuller implements ITriangleCuller {
public var cullingRectangle:Rectangle;
private static const DEFAULT_RECT_X:Number = -((DEFAULT_RECT_W / 2));
private static const DEFAULT_RECT_W:Number = 640;
private static const DEFAULT_RECT_H:Number = 480;
private static const DEFAULT_RECT_Y:Number = -((DEFAULT_RECT_H / 2));
private static var hitRect:Rectangle = new Rectangle();
public function RectangleTriangleCuller(_arg1:Rectangle=null):void{
cullingRectangle = new Rectangle(DEFAULT_RECT_X, DEFAULT_RECT_Y, DEFAULT_RECT_W, DEFAULT_RECT_H);
super();
if (_arg1){
this.cullingRectangle = _arg1;
};
}
override public function testFace(_arg1:Triangle3D, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance):Boolean{
if (super.testFace(_arg1, _arg2, _arg3, _arg4)){
hitRect.x = Math.min(_arg4.x, Math.min(_arg3.x, _arg2.x));
hitRect.width = (Math.max(_arg4.x, Math.max(_arg3.x, _arg2.x)) + Math.abs(hitRect.x));
hitRect.y = Math.min(_arg4.y, Math.min(_arg3.y, _arg2.y));
hitRect.height = (Math.max(_arg4.y, Math.max(_arg3.y, _arg2.y)) + Math.abs(hitRect.y));
return (FastRectangleTools.intersects(cullingRectangle, hitRect));
};
return (false);
}
}
}//package org.papervision3d.core.culling
Section 79
//ViewportObjectFilter (org.papervision3d.core.culling.ViewportObjectFilter)
package org.papervision3d.core.culling {
import org.papervision3d.objects.*;
import flash.utils.*;
public class ViewportObjectFilter implements IObjectCuller {
protected var _mode:int;
protected var objects:Dictionary;
public function ViewportObjectFilter(_arg1:int):void{
this.mode = _arg1;
init();
}
public function addObject(_arg1:DisplayObject3D):void{
objects[_arg1] = _arg1;
}
public function get mode():int{
return (_mode);
}
public function set mode(_arg1:int):void{
_mode = _arg1;
}
public function removeObject(_arg1:DisplayObject3D):void{
delete objects[_arg1];
}
private function init():void{
objects = new Dictionary(true);
}
public function testObject(_arg1:DisplayObject3D):int{
if (objects[_arg1]){
return ((1 - _mode));
};
return (mode);
}
public function destroy():void{
objects = null;
}
}
}//package org.papervision3d.core.culling
Section 80
//UserData (org.papervision3d.core.data.UserData)
package org.papervision3d.core.data {
public class UserData {
public var data;
public function UserData(_arg1=null){
this.data = _arg1;
}
}
}//package org.papervision3d.core.data
Section 81
//AbstractRenderable (org.papervision3d.core.geom.renderables.AbstractRenderable)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.objects.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.data.*;
public class AbstractRenderable implements IRenderable {
public var _userData:UserData;
public var instance:DisplayObject3D;
public function set userData(_arg1:UserData):void{
_userData = _arg1;
}
public function get userData():UserData{
return (_userData);
}
public function getRenderListItem():IRenderListItem{
return (null);
}
}
}//package org.papervision3d.core.geom.renderables
Section 82
//IRenderable (org.papervision3d.core.geom.renderables.IRenderable)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.render.command.*;
public interface IRenderable {
function getRenderListItem():IRenderListItem;
}
}//package org.papervision3d.core.geom.renderables
Section 83
//Line3D (org.papervision3d.core.geom.renderables.Line3D)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.render.command.*;
import org.papervision3d.materials.special.*;
import org.papervision3d.core.geom.*;
public class Line3D extends AbstractRenderable implements IRenderable {
public var size:Number;
public var material:LineMaterial;
public var cV:Vertex3D;
public var renderCommand:RenderLine;
public var v0:Vertex3D;
public var v1:Vertex3D;
public function Line3D(_arg1:Lines3D, _arg2:LineMaterial, _arg3:Number, _arg4:Vertex3D, _arg5:Vertex3D){
this.size = _arg3;
this.material = _arg2;
this.v0 = _arg4;
this.v1 = _arg5;
this.cV = _arg5;
this.instance = _arg1;
this.renderCommand = new RenderLine(this);
}
public function addControlVertex(_arg1:Number, _arg2:Number, _arg3:Number):void{
cV = new Vertex3D(_arg1, _arg2, _arg3);
if (instance.geometry.vertices.indexOf(cV) == -1){
instance.geometry.vertices.push(cV);
};
renderCommand.cV = cV.vertex3DInstance;
}
override public function getRenderListItem():IRenderListItem{
return (this.renderCommand);
}
}
}//package org.papervision3d.core.geom.renderables
Section 84
//Particle (org.papervision3d.core.geom.renderables.Particle)
package org.papervision3d.core.geom.renderables {
import flash.geom.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.materials.special.*;
public class Particle extends AbstractRenderable implements IRenderable {
public var size:Number;
public var renderScale:Number;
public var vertex3D:Vertex3D;
public var renderRect:Rectangle;
public var rotationZ:Number;// = 0
public var renderCommand:RenderParticle;
public var drawMatrix:Matrix;
public var material:ParticleMaterial;
public function Particle(_arg1:ParticleMaterial, _arg2:Number=1, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0){
this.material = _arg1;
this.size = _arg2;
this.renderCommand = new RenderParticle(this);
this.renderRect = new Rectangle();
vertex3D = new Vertex3D(_arg3, _arg4, _arg5);
drawMatrix = new Matrix();
}
public function updateRenderRect():void{
material.updateRenderRect(this);
}
public function set x(_arg1:Number):void{
vertex3D.x = _arg1;
}
public function set y(_arg1:Number):void{
vertex3D.y = _arg1;
}
public function set z(_arg1:Number):void{
vertex3D.z = _arg1;
}
public function get y():Number{
return (vertex3D.y);
}
public function get z():Number{
return (vertex3D.z);
}
override public function getRenderListItem():IRenderListItem{
return (renderCommand);
}
public function get x():Number{
return (vertex3D.x);
}
}
}//package org.papervision3d.core.geom.renderables
Section 85
//Triangle3D (org.papervision3d.core.geom.renderables.Triangle3D)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.objects.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.math.*;
import org.papervision3d.materials.*;
import org.papervision3d.materials.special.*;
public class Triangle3D extends AbstractRenderable implements IRenderable {
public var _uvArray:Array;
public var renderCommand:RenderTriangle;
public var id:Number;
public var material:MaterialObject3D;
public var faceNormal:Number3D;
public var screenZ:Number;
public var uv0:NumberUV;
public var uv1:NumberUV;
public var _materialName:String;
public var visible:Boolean;
public var uv2:NumberUV;
public var vertices:Array;
public var v0:Vertex3D;
public var v1:Vertex3D;
public var v2:Vertex3D;
private static var _totalFaces:Number = 0;
public function Triangle3D(_arg1:DisplayObject3D, _arg2:Array, _arg3:MaterialObject3D=null, _arg4:Array=null){
this.instance = _arg1;
faceNormal = new Number3D();
if (((_arg2) && ((_arg2.length == 3)))){
this.vertices = _arg2;
v0 = _arg2[0];
v1 = _arg2[1];
v2 = _arg2[2];
createNormal();
} else {
_arg2 = new Array();
v0 = (_arg2[0] = new Vertex3D());
v1 = (_arg2[1] = new Vertex3D());
v2 = (_arg2[2] = new Vertex3D());
};
this.material = _arg3;
this.uv = _arg4;
this.id = _totalFaces++;
this.renderCommand = new RenderTriangle(this);
}
public function set uv(_arg1:Array):void{
if (((_arg1) && ((_arg1.length == 3)))){
uv0 = NumberUV(_arg1[0]);
uv1 = NumberUV(_arg1[1]);
uv2 = NumberUV(_arg1[2]);
};
_uvArray = _arg1;
}
public function createNormal():void{
var _local1:Number3D = v0.getPosition();
var _local2:Number3D = v1.getPosition();
var _local3:Number3D = v2.getPosition();
_local2.minusEq(_local1);
_local3.minusEq(_local1);
faceNormal = Number3D.cross(_local2, _local3, faceNormal);
faceNormal.normalize();
}
override public function getRenderListItem():IRenderListItem{
return (renderCommand);
}
public function reset(_arg1:DisplayObject3D, _arg2:Array, _arg3:MaterialObject3D, _arg4:Array):void{
var _local5:MaterialObject3D;
this.instance = _arg1;
this.renderCommand.instance = _arg1;
this.renderCommand.renderer = _arg3;
this.vertices = _arg2;
updateVertices();
this.material = _arg3;
this.uv = _arg4;
if ((_arg3 is BitmapMaterial)){
BitmapMaterial(_arg3).uvMatrices[this.renderCommand] = null;
};
if ((_arg3 is CompositeMaterial)){
for each (_local5 in CompositeMaterial(_arg3).materials) {
if ((_local5 is BitmapMaterial)){
BitmapMaterial(_local5).uvMatrices[this.renderCommand] = null;
};
};
};
}
public function get uv():Array{
return (_uvArray);
}
public function updateVertices():void{
v0 = vertices[0];
v1 = vertices[1];
v2 = vertices[2];
}
}
}//package org.papervision3d.core.geom.renderables
Section 86
//Triangle3DInstance (org.papervision3d.core.geom.renderables.Triangle3DInstance)
package org.papervision3d.core.geom.renderables {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.math.*;
public class Triangle3DInstance {
public var container:Sprite;
public var instance:DisplayObject3D;
public var visible:Boolean;// = false
public var faceNormal:Number3D;
public var screenZ:Number;
public function Triangle3DInstance(_arg1:Triangle3D, _arg2:DisplayObject3D){
this.instance = _arg2;
faceNormal = new Number3D();
}
}
}//package org.papervision3d.core.geom.renderables
Section 87
//Vertex3D (org.papervision3d.core.geom.renderables.Vertex3D)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.math.*;
import flash.utils.*;
public class Vertex3D extends AbstractRenderable implements IRenderable {
public var z:Number;
public var vertex3DInstance:Vertex3DInstance;
public var extra:Object;
public var timestamp:Number;
public var normal:Number3D;
protected var position:Number3D;
public var connectedFaces:Dictionary;
public var x:Number;
public var y:Number;
private var persp:Number;// = 0
public function Vertex3D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
position = new Number3D();
super();
this.x = (position.x = _arg1);
this.y = (position.y = _arg2);
this.z = (position.z = _arg3);
this.vertex3DInstance = new Vertex3DInstance();
this.normal = new Number3D();
this.connectedFaces = new Dictionary();
}
public function perspective(_arg1:Number):Vertex3DInstance{
persp = (1 / (1 + (z / _arg1)));
return (new Vertex3DInstance((x * persp), (y * persp), z));
}
public function toNumber3D():Number3D{
return (new Number3D(x, y, z));
}
public function clone():Vertex3D{
var _local1:Vertex3D = new Vertex3D(x, y, z);
_local1.extra = extra;
_local1.vertex3DInstance = vertex3DInstance.clone();
_local1.normal = normal.clone();
return (_local1);
}
public function getPosition():Number3D{
position.x = x;
position.y = y;
position.z = z;
return (position);
}
public function calculateNormal():void{
var _local1:Triangle3D;
var _local2:Number;
var _local3:Number3D;
_local2 = 0;
normal.reset();
for each (_local1 in connectedFaces) {
if (_local1.faceNormal){
_local2++;
normal.plusEq(_local1.faceNormal);
};
};
_local3 = getPosition();
_local3.x = (_local3.x / _local2);
_local3.y = (_local3.y / _local2);
_local3.z = (_local3.z / _local2);
_local3.normalize();
normal.plusEq(_local3);
normal.normalize();
}
override public function getRenderListItem():IRenderListItem{
return (null);
}
public static function weighted(_arg1:Vertex3D, _arg2:Vertex3D, _arg3:Number, _arg4:Number):Vertex3D{
var _local5:Number = (_arg3 + _arg4);
var _local6:Number = (_arg3 / _local5);
var _local7:Number = (_arg4 / _local5);
return (new Vertex3D(((_arg1.x * _local6) + (_arg2.x * _local7)), ((_arg1.y * _local6) + (_arg2.y * _local7)), ((_arg1.z * _local6) + (_arg2.z * _local7))));
}
}
}//package org.papervision3d.core.geom.renderables
Section 88
//Vertex3DInstance (org.papervision3d.core.geom.renderables.Vertex3DInstance)
package org.papervision3d.core.geom.renderables {
import org.papervision3d.core.math.*;
public class Vertex3DInstance {
public var y:Number;
private var persp:Number;// = 0
public var normal:Number3D;
public var visible:Boolean;
public var extra:Object;
public var x:Number;
public var z:Number;
public function Vertex3DInstance(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
this.visible = false;
this.normal = new Number3D();
}
public function deperspective(_arg1:Number):Vertex3D{
persp = (1 + (z / _arg1));
return (new Vertex3D((x * persp), (y * persp), z));
}
public function distance(_arg1:Vertex3DInstance):Number{
return (Math.sqrt((((x - _arg1.x) * (x - _arg1.x)) + ((y - _arg1.y) * (y - _arg1.y)))));
}
public function clone():Vertex3DInstance{
var _local1:Vertex3DInstance = new Vertex3DInstance(x, y, z);
_local1.visible = visible;
_local1.extra = extra;
return (_local1);
}
public function distanceSqr(_arg1:Vertex3DInstance):Number{
return ((((x - _arg1.x) * (x - _arg1.x)) + ((y - _arg1.y) * (y - _arg1.y))));
}
public static function cross(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance):Number{
return (((_arg1.x * _arg2.y) - (_arg2.x * _arg1.y)));
}
public static function dot(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function subTo(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance):void{
_arg3.x = (_arg2.x - _arg1.x);
_arg3.y = (_arg2.y - _arg1.y);
}
public static function median(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance, _arg3:Number):Vertex3DInstance{
var _local4:Number = ((_arg1.z + _arg2.z) / 2);
var _local5:Number = (_arg3 + _arg1.z);
var _local6:Number = (_arg3 + _arg2.z);
var _local7:Number = ((1 / (_arg3 + _local4)) / 2);
return (new Vertex3DInstance((((_arg1.x * _local5) + (_arg2.x * _local6)) * _local7), (((_arg1.y * _local5) + (_arg2.y * _local6)) * _local7), _local4));
}
public static function sub(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance):Vertex3DInstance{
return (new Vertex3DInstance((_arg2.x - _arg1.x), (_arg2.y - _arg1.y)));
}
}
}//package org.papervision3d.core.geom.renderables
Section 89
//Lines3D (org.papervision3d.core.geom.Lines3D)
package org.papervision3d.core.geom {
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.log.*;
import org.papervision3d.materials.special.*;
import org.papervision3d.core.render.draw.*;
public class Lines3D extends Vertices3D {
private var _material:ILineDrawer;
public var lines:Array;
public function Lines3D(_arg1:LineMaterial=null, _arg2:String=null){
super(null, _arg2);
if (!_arg1){
this.material = new LineMaterial();
} else {
this.material = _arg1;
};
init();
}
private function init():void{
this.lines = new Array();
}
public function removeAllLines():void{
while (lines.length > 0) {
removeLine(lines[0]);
};
}
public function addLine(_arg1:Line3D):void{
lines.push(_arg1);
_arg1.instance = this;
if (geometry.vertices.indexOf(_arg1.v0) == -1){
geometry.vertices.push(_arg1.v0);
};
if (geometry.vertices.indexOf(_arg1.v1) == -1){
geometry.vertices.push(_arg1.v1);
};
if (_arg1.cV){
if (geometry.vertices.indexOf(_arg1.cV) == -1){
geometry.vertices.push(_arg1.cV);
};
};
}
public function addNewSegmentedLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number, _arg8:Number):Array{
var _local13:Line3D;
var _local15:Vertex3D;
var _local9:Number = ((_arg6 - _arg3) / _arg2);
var _local10:Number = ((_arg7 - _arg4) / _arg2);
var _local11:Number = ((_arg8 - _arg5) / _arg2);
var _local12:Array = new Array();
var _local14:Vertex3D = new Vertex3D(_arg3, _arg4, _arg5);
var _local16:Number = 0;
while (_local16 <= _arg2) {
_local15 = new Vertex3D((_arg3 + (_local9 * _local16)), (_arg4 + (_local10 * _local16)), (_arg5 + (_local11 * _local16)));
_local13 = new Line3D(this, (material as LineMaterial), _arg1, _local14, _local15);
addLine(_local13);
_local12.push(_local13);
_local14 = _local15;
_local16++;
};
return (_local12);
}
public function removeLine(_arg1:Line3D):void{
var _local2:int = lines.indexOf(_arg1);
if (_local2 > -1){
lines.splice(_local2, 1);
} else {
PaperLogger.warning("Papervision3D Lines3D.removeLine : WARNING removal of non-existant line attempted. ");
};
}
override public function project(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
var _local3:Line3D;
var _local4:Number;
var _local5:RenderLine;
super.project(_arg1, _arg2);
for each (_local3 in lines) {
if (_arg2.viewPort.lineCuller.testLine(_local3)){
_local5 = _local3.renderCommand;
_local5.renderer = _local3.material;
_local5.size = _local3.size;
_local4 = (_local4 + (_local5.screenZ = ((_local3.v0.vertex3DInstance.z + _local3.v1.vertex3DInstance.z) / 2)));
_local5.v0 = _local3.v0.vertex3DInstance;
_local5.v1 = _local3.v1.vertex3DInstance;
_arg2.renderer.addToRenderList(_local5);
};
};
return ((_local4 / (lines.length + 1)));
}
public function addNewLine(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Line3D{
var _local8:Line3D = new Line3D(this, (material as LineMaterial), _arg1, new Vertex3D(_arg2, _arg3, _arg4), new Vertex3D(_arg5, _arg6, _arg7));
addLine(_local8);
return (_local8);
}
}
}//package org.papervision3d.core.geom
Section 90
//TriangleMesh3D (org.papervision3d.core.geom.TriangleMesh3D)
package org.papervision3d.core.geom {
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.geom.renderables.*;
import flash.utils.*;
import org.papervision3d.core.render.draw.*;
public class TriangleMesh3D extends Vertices3D {
private var _tri:RenderTriangle;
private var _dtStore:Array;
private var _dtActive:Array;
public function TriangleMesh3D(_arg1:MaterialObject3D, _arg2:Array, _arg3:Array, _arg4:String=null){
_dtStore = new Array();
_dtActive = new Array();
super(_arg2, _arg4);
this.geometry.faces = ((_arg3) || (new Array()));
this.material = ((_arg1) || (MaterialObject3D.DEFAULT));
}
public function projectTexture(_arg1:String="x", _arg2:String="y"):void{
var _local10:String;
var _local11:Triangle3D;
var _local12:Array;
var _local13:Vertex3D;
var _local14:Vertex3D;
var _local15:Vertex3D;
var _local16:NumberUV;
var _local17:NumberUV;
var _local18:NumberUV;
var _local3:Array = this.geometry.faces;
var _local4:Object = this.boundingBox();
var _local5:Number = _local4.min[_arg1];
var _local6:Number = _local4.size[_arg1];
var _local7:Number = _local4.min[_arg2];
var _local8:Number = _local4.size[_arg2];
var _local9:MaterialObject3D = this.material;
for (_local10 in _local3) {
_local11 = _local3[Number(_local10)];
_local12 = _local11.vertices;
_local13 = _local12[0];
_local14 = _local12[1];
_local15 = _local12[2];
_local16 = new NumberUV(((_local13[_arg1] - _local5) / _local6), ((_local13[_arg2] - _local7) / _local8));
_local17 = new NumberUV(((_local14[_arg1] - _local5) / _local6), ((_local14[_arg2] - _local7) / _local8));
_local18 = new NumberUV(((_local15[_arg1] - _local5) / _local6), ((_local15[_arg2] - _local7) / _local8));
_local11.uv = [_local16, _local17, _local18];
};
}
public function quarterFaces():void{
var _local4:Triangle3D;
var _local6:Vertex3D;
var _local7:Vertex3D;
var _local8:Vertex3D;
var _local9:Vertex3D;
var _local10:Vertex3D;
var _local11:Vertex3D;
var _local12:NumberUV;
var _local13:NumberUV;
var _local14:NumberUV;
var _local15:NumberUV;
var _local16:NumberUV;
var _local17:NumberUV;
var _local18:Triangle3D;
var _local19:Triangle3D;
var _local20:Triangle3D;
var _local21:Triangle3D;
var _local1:Array = new Array();
var _local2:Array = new Array();
var _local3:Array = this.geometry.faces;
var _local5:int = _local3.length;
while ((_local4 = _local3[--_local5])) {
_local6 = _local4.v0;
_local7 = _local4.v1;
_local8 = _local4.v2;
_local9 = new Vertex3D(((_local6.x + _local7.x) / 2), ((_local6.y + _local7.y) / 2), ((_local6.z + _local7.z) / 2));
_local10 = new Vertex3D(((_local7.x + _local8.x) / 2), ((_local7.y + _local8.y) / 2), ((_local7.z + _local8.z) / 2));
_local11 = new Vertex3D(((_local8.x + _local6.x) / 2), ((_local8.y + _local6.y) / 2), ((_local8.z + _local6.z) / 2));
this.geometry.vertices.push(_local9, _local10, _local11);
_local12 = _local4.uv[0];
_local13 = _local4.uv[1];
_local14 = _local4.uv[2];
_local15 = new NumberUV(((_local12.u + _local13.u) / 2), ((_local12.v + _local13.v) / 2));
_local16 = new NumberUV(((_local13.u + _local14.u) / 2), ((_local13.v + _local14.v) / 2));
_local17 = new NumberUV(((_local14.u + _local12.u) / 2), ((_local14.v + _local12.v) / 2));
_local18 = new Triangle3D(this, [_local6, _local9, _local11], _local4.material, [_local12, _local15, _local17]);
_local19 = new Triangle3D(this, [_local9, _local7, _local10], _local4.material, [_local15, _local13, _local16]);
_local20 = new Triangle3D(this, [_local11, _local10, _local8], _local4.material, [_local17, _local16, _local14]);
_local21 = new Triangle3D(this, [_local9, _local10, _local11], _local4.material, [_local15, _local16, _local17]);
_local2.push(_local18, _local19, _local20, _local21);
};
this.geometry.faces = _local2;
this.mergeVertices();
this.geometry.ready = true;
}
override public function set material(_arg1:MaterialObject3D):void{
var _local2:Triangle3D;
super.material = _arg1;
for each (_local2 in geometry.faces) {
_local2.material = _arg1;
};
}
public function mergeVertices():void{
var _local3:Vertex3D;
var _local4:Triangle3D;
var _local5:Vertex3D;
var _local1:Dictionary = new Dictionary();
var _local2:Array = new Array();
for each (_local3 in this.geometry.vertices) {
for each (_local5 in _local1) {
if ((((((_local3.x == _local5.x)) && ((_local3.y == _local5.y)))) && ((_local3.z == _local5.z)))){
_local1[_local3] = _local5;
break;
};
};
if (!_local1[_local3]){
_local1[_local3] = _local3;
_local2.push(_local3);
};
};
this.geometry.vertices = _local2;
for each (_local4 in geometry.faces) {
_local4.v0 = (_local4.vertices[0] = _local1[_local4.v0]);
_local4.v1 = (_local4.vertices[1] = _local1[_local4.v1]);
_local4.v2 = (_local4.vertices[2] = _local1[_local4.v2]);
};
}
override public function project(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
var _local5:Triangle3D;
var _local6:Array;
var _local7:Number;
var _local8:Number;
var _local9:ITriangleCuller;
var _local10:Vertex3DInstance;
var _local11:Vertex3DInstance;
var _local12:Vertex3DInstance;
var _local13:Triangle3DInstance;
var _local14:Triangle3D;
var _local15:MaterialObject3D;
var _local16:RenderTriangle;
_dtStore = [];
_dtActive = new Array();
var _local3:int = this.geometry.vertices.length;
var _local4:Array = [];
if (((((((_arg2.clipping) && (this.useClipping))) && (!(this.culled)))) && ((_arg2.camera.useCulling) ? (cullTest == 0) : true))){
super.projectEmpty(_arg1, _arg2);
_arg2.clipping.setDisplayObject(this, _arg2);
for each (_local5 in this.geometry.faces) {
if (_arg2.clipping.testFace(_local5, this, _arg2)){
_arg2.clipping.clipFace(_local5, this, _local15, _arg2, _local4);
} else {
_local4.push(_local5);
};
};
super.project(_arg1, _arg2);
_arg2.camera.projectFaces(_local4, this, _arg2);
} else {
super.project(_arg1, _arg2);
_local4 = this.geometry.faces;
};
if (!this.culled){
_local6 = this.geometry.faces;
_local7 = 0;
_local8 = 0;
_local9 = _arg2.triangleCuller;
for each (_local14 in _local4) {
_local15 = (_local14.material) ? _local14.material : material;
_local10 = _local14.v0.vertex3DInstance;
_local11 = _local14.v1.vertex3DInstance;
_local12 = _local14.v2.vertex3DInstance;
if (_local9.testFace(_local14, _local10, _local11, _local12)){
_local16 = _local14.renderCommand;
_local7 = (_local7 + (_local16.screenZ = setScreenZ(meshSort, _local10, _local11, _local12)));
_local8++;
_local16.renderer = (_local15 as ITriangleDrawer);
_local16.v0 = _local10;
_local16.v1 = _local11;
_local16.v2 = _local12;
_local16.uv0 = _local14.uv0;
_local16.uv1 = _local14.uv1;
_local16.uv2 = _local14.uv2;
if (_arg2.quadrantTree){
if (_local16.create == null){
_local16.create = createRenderTriangle;
};
_local16.update();
if ((((_local16.area < 0)) && (((_local14.material.doubleSided) || (((_local14.material.oneSide) && (_local14.material.opposite))))))){
_local16.area = -(_local16.area);
};
};
_arg2.renderer.addToRenderList(_local16);
} else {
_arg2.renderStatistics.culledTriangles++;
};
};
if (_local3){
while (this.geometry.vertices.length > _local3) {
this.geometry.vertices.pop();
};
};
return ((this.screenZ = (_local7 / _local8)));
//unresolved jump
};
_arg2.renderStatistics.culledObjects++;
return (0);
}
public function createRenderTriangle(_arg1:Triangle3D, _arg2:MaterialObject3D, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance, _arg5:Vertex3DInstance, _arg6:NumberUV, _arg7:NumberUV, _arg8:NumberUV):RenderTriangle{
if (_dtStore.length){
_dtActive.push((_tri = _dtStore.pop()));
} else {
_dtActive.push((_tri = new RenderTriangle(_arg1)));
};
_tri.instance = this;
_tri.triangle = _arg1;
_tri.renderableInstance = _arg1;
_tri.renderer = _arg2;
_tri.create = createRenderTriangle;
_tri.v0 = _arg3;
_tri.v1 = _arg4;
_tri.v2 = _arg5;
_tri.uv0 = _arg6;
_tri.uv1 = _arg7;
_tri.uv2 = _arg8;
_tri.update();
return (_tri);
}
protected function setScreenZ(_arg1:uint, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance):Number{
switch (_arg1){
case DisplayObject3D.MESH_SORT_CENTER:
return ((((_arg2.z + _arg3.z) + _arg4.z) / 3));
case DisplayObject3D.MESH_SORT_FAR:
return (Math.max(_arg2.z, _arg3.z, _arg4.z));
case DisplayObject3D.MESH_SORT_CLOSE:
return (Math.min(_arg2.z, _arg3.z, _arg4.z));
};
return (0);
}
override public function clone():DisplayObject3D{
var _local1:DisplayObject3D = super.clone();
var _local2:TriangleMesh3D = new TriangleMesh3D(this.material, [], [], _local1.name);
if (this.materials){
_local2.materials = this.materials.clone();
};
if (_local1.geometry){
_local2.geometry = _local1.geometry.clone(_local2);
};
_local2.copyTransform(this);
return (_local2);
}
}
}//package org.papervision3d.core.geom
Section 91
//Vertices3D (org.papervision3d.core.geom.Vertices3D)
package org.papervision3d.core.geom {
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.geom.renderables.*;
public class Vertices3D extends DisplayObject3D {
public function Vertices3D(_arg1:Array, _arg2:String=null){
super(_arg2, new GeometryObject3D());
this.geometry.vertices = ((_arg1) || (new Array()));
}
override public function project(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
super.project(_arg1, _arg2);
if (this.culled){
return (0);
};
if ((_arg2.camera is IObjectCuller)){
return (projectFrustum(_arg1, _arg2));
};
if (((!(this.geometry)) || (!(this.geometry.vertices)))){
return (0);
};
return (_arg2.camera.projectVertices(this.geometry.vertices, this, _arg2));
}
public function projectEmpty(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
return (super.project(_arg1, _arg2));
}
public function worldBoundingBox():Object{
var _local3:Number3D;
var _local4:Vertex3D;
var _local1:Array = this.geometry.vertices;
var _local2:Object = new Object();
_local2.min = new Number3D(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
_local2.max = new Number3D(-(Number.MAX_VALUE), -(Number.MAX_VALUE), -(Number.MAX_VALUE));
_local2.size = new Number3D();
for each (_local4 in _local1) {
_local3 = _local4.getPosition();
Matrix3D.multiplyVector(this.world, _local3);
_local2.min.x = Math.min(_local3.x, _local2.min.x);
_local2.min.y = Math.min(_local3.y, _local2.min.y);
_local2.min.z = Math.min(_local3.z, _local2.min.z);
_local2.max.x = Math.max(_local3.x, _local2.max.x);
_local2.max.y = Math.max(_local3.y, _local2.max.y);
_local2.max.z = Math.max(_local3.z, _local2.max.z);
};
_local2.size.x = (_local2.max.x - _local2.min.x);
_local2.size.y = (_local2.max.y - _local2.min.y);
_local2.size.z = (_local2.max.z - _local2.min.z);
return (_local2);
}
public function boundingBox():Object{
var _local3:Vertex3D;
var _local1:Array = this.geometry.vertices;
var _local2:Object = new Object();
_local2.min = new Number3D(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
_local2.max = new Number3D(-(Number.MAX_VALUE), -(Number.MAX_VALUE), -(Number.MAX_VALUE));
_local2.size = new Number3D();
for each (_local3 in _local1) {
_local2.min.x = Math.min(_local3.x, _local2.min.x);
_local2.min.y = Math.min(_local3.y, _local2.min.y);
_local2.min.z = Math.min(_local3.z, _local2.min.z);
_local2.max.x = Math.max(_local3.x, _local2.max.x);
_local2.max.y = Math.max(_local3.y, _local2.max.y);
_local2.max.z = Math.max(_local3.z, _local2.max.z);
};
_local2.size.x = (_local2.max.x - _local2.min.x);
_local2.size.y = (_local2.max.y - _local2.min.y);
_local2.size.z = (_local2.max.z - _local2.min.z);
return (_local2);
}
public function projectFrustum(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
return (0);
}
public function transformVertices(_arg1:Matrix3D):void{
geometry.transformVertices(_arg1);
}
override public function clone():DisplayObject3D{
var _local1:DisplayObject3D = super.clone();
var _local2:Vertices3D = new Vertices3D(null, _local1.name);
_local2.material = _local1.material;
if (_local1.materials){
_local2.materials = _local1.materials.clone();
};
if (this.geometry){
_local2.geometry = this.geometry.clone(_local2);
};
_local2.copyTransform(this);
return (_local2);
}
}
}//package org.papervision3d.core.geom
Section 92
//PaperLoggerEvent (org.papervision3d.core.log.event.PaperLoggerEvent)
package org.papervision3d.core.log.event {
import flash.events.*;
import org.papervision3d.core.log.*;
public class PaperLoggerEvent extends Event {
public var paperLogVO:PaperLogVO;
public static const TYPE_LOGEVENT:String = "logEvent";
public function PaperLoggerEvent(_arg1:PaperLogVO){
super(TYPE_LOGEVENT);
this.paperLogVO = _arg1;
}
}
}//package org.papervision3d.core.log.event
Section 93
//AbstractPaperLogger (org.papervision3d.core.log.AbstractPaperLogger)
package org.papervision3d.core.log {
import org.papervision3d.core.log.event.*;
public class AbstractPaperLogger implements IPaperLogger {
public function registerWithPaperLogger(_arg1:PaperLogger):void{
_arg1.addEventListener(PaperLoggerEvent.TYPE_LOGEVENT, onLogEvent);
}
public function debug(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
}
public function warning(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
}
public function log(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
}
public function fatal(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
}
public function error(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
}
protected function onLogEvent(_arg1:PaperLoggerEvent):void{
var _local2:PaperLogVO = _arg1.paperLogVO;
switch (_local2.level){
case LogLevel.LOG:
log(_local2.msg, _local2.object, _local2.arg);
break;
case LogLevel.INFO:
info(_local2.msg, _local2.object, _local2.arg);
break;
case LogLevel.ERROR:
error(_local2.msg, _local2.object, _local2.arg);
break;
case LogLevel.DEBUG:
debug(_local2.msg, _local2.object, _local2.arg);
break;
case LogLevel.WARNING:
warning(_local2.msg, _local2.object, _local2.arg);
break;
case LogLevel.FATAL:
fatal(_local2.msg, _local2.object, _local2.arg);
break;
default:
log(_local2.msg, _local2.object, _local2.arg);
break;
};
}
public function unregisterFromPaperLogger(_arg1:PaperLogger):void{
_arg1.removeEventListener(PaperLoggerEvent.TYPE_LOGEVENT, onLogEvent);
}
public function info(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
}
}
}//package org.papervision3d.core.log
Section 94
//IPaperLogger (org.papervision3d.core.log.IPaperLogger)
package org.papervision3d.core.log {
public interface IPaperLogger {
function debug(_arg1:String, _arg2:Object=null, _arg3:Array=null):void;
function log(_arg1:String, _arg2:Object=null, _arg3:Array=null):void;
function error(_arg1:String, _arg2:Object=null, _arg3:Array=null):void;
function fatal(_arg1:String, _arg2:Object=null, _arg3:Array=null):void;
function warning(_arg1:String, _arg2:Object=null, _arg3:Array=null):void;
function info(_arg1:String, _arg2:Object=null, _arg3:Array=null):void;
}
}//package org.papervision3d.core.log
Section 95
//LogLevel (org.papervision3d.core.log.LogLevel)
package org.papervision3d.core.log {
public class LogLevel {
public static const FATAL:int = 5;
public static const ERROR:int = 4;
public static const LOG:int = 0;
public static const INFO:int = 1;
public static const DEBUG:int = 2;
public static const WARNING:int = 3;
}
}//package org.papervision3d.core.log
Section 96
//PaperLogger (org.papervision3d.core.log.PaperLogger)
package org.papervision3d.core.log {
import flash.events.*;
import org.papervision3d.core.log.event.*;
public class PaperLogger extends EventDispatcher {
public var traceLogger:PaperTraceLogger;
private static var instance:PaperLogger;
public function PaperLogger(){
if (instance){
throw (new Error("Don't call the PaperLogger constructor directly"));
};
traceLogger = new PaperTraceLogger();
registerLogger(traceLogger);
}
public function registerLogger(_arg1:AbstractPaperLogger):void{
_arg1.registerWithPaperLogger(this);
}
public function _debug(_arg1:String, _arg2:Object=null, ... _args):void{
var _local4:PaperLogVO = new PaperLogVO(LogLevel.DEBUG, _arg1, _arg2, _args);
var _local5:PaperLoggerEvent = new PaperLoggerEvent(_local4);
dispatchEvent(_local5);
}
public function _log(_arg1:String, _arg2:Object=null, ... _args):void{
var _local4:PaperLogVO = new PaperLogVO(LogLevel.LOG, _arg1, _arg2, _args);
var _local5:PaperLoggerEvent = new PaperLoggerEvent(_local4);
dispatchEvent(_local5);
}
public function _error(_arg1:String, _arg2:Object=null, ... _args):void{
var _local4:PaperLogVO = new PaperLogVO(LogLevel.ERROR, _arg1, _arg2, _args);
var _local5:PaperLoggerEvent = new PaperLoggerEvent(_local4);
dispatchEvent(_local5);
}
public function unregisterLogger(_arg1:AbstractPaperLogger):void{
_arg1.unregisterFromPaperLogger(this);
}
public function _info(_arg1:String, _arg2:Object=null, ... _args):void{
var _local4:PaperLogVO = new PaperLogVO(LogLevel.INFO, _arg1, _arg2, _args);
var _local5:PaperLoggerEvent = new PaperLoggerEvent(_local4);
dispatchEvent(_local5);
}
public function _warning(_arg1:String, _arg2:Object=null, ... _args):void{
var _local4:PaperLogVO = new PaperLogVO(LogLevel.WARNING, _arg1, _arg2, _args);
var _local5:PaperLoggerEvent = new PaperLoggerEvent(_local4);
dispatchEvent(_local5);
}
public static function debug(_arg1:String, _arg2:Object=null, ... _args):void{
getInstance()._debug(_arg1);
}
public static function log(_arg1:String, _arg2:Object=null, ... _args):void{
getInstance()._log(_arg1);
}
public static function error(_arg1:String, _arg2:Object=null, ... _args):void{
getInstance()._error(_arg1);
}
public static function getInstance():PaperLogger{
if (!instance){
instance = new (PaperLogger);
};
return (instance);
}
public static function warning(_arg1:String, _arg2:Object=null, ... _args):void{
getInstance()._warning(_arg1);
}
public static function info(_arg1:String, _arg2:Object=null, ... _args):void{
getInstance()._info(_arg1);
}
}
}//package org.papervision3d.core.log
Section 97
//PaperLogVO (org.papervision3d.core.log.PaperLogVO)
package org.papervision3d.core.log {
public class PaperLogVO {
public var msg:String;
public var level:int;
public var arg:Array;
public var object:Object;
public function PaperLogVO(_arg1:int, _arg2:String, _arg3:Object, _arg4:Array){
this.level = _arg1;
this.msg = _arg2;
this.object = _arg3;
this.arg = _arg4;
}
}
}//package org.papervision3d.core.log
Section 98
//PaperTraceLogger (org.papervision3d.core.log.PaperTraceLogger)
package org.papervision3d.core.log {
public class PaperTraceLogger extends AbstractPaperLogger implements IPaperLogger {
override public function warning(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
trace("WARNING:", _arg1, _arg3);
}
override public function log(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
trace("LOG:", _arg1, _arg3);
}
override public function error(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
trace("ERROR:", _arg1, _arg3);
}
override public function fatal(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
trace("FATAL:", _arg1, _arg3);
}
override public function info(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
trace("INFO:", _arg1, _arg3);
}
override public function debug(_arg1:String, _arg2:Object=null, _arg3:Array=null):void{
trace("DEBUG:", _arg1, _arg3);
}
}
}//package org.papervision3d.core.log
Section 99
//AbstractLightShadeMaterial (org.papervision3d.core.material.AbstractLightShadeMaterial)
package org.papervision3d.core.material {
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.math.*;
import flash.utils.*;
import org.papervision3d.core.render.material.*;
import org.papervision3d.materials.utils.*;
import org.papervision3d.core.render.draw.*;
public class AbstractLightShadeMaterial extends TriangleMaterial implements ITriangleDrawer, IUpdateBeforeMaterial {
public var lightMatrices:Dictionary;
private var _light:LightObject3D;
protected static var lightMatrix:Matrix3D;
public function AbstractLightShadeMaterial(){
init();
}
public function updateBeforeRender(_arg1:RenderSessionData):void{
var _local2:Object;
var _local3:DisplayObject3D;
for (_local2 in objects) {
_local3 = (_local2 as DisplayObject3D);
lightMatrices[_local2] = LightMatrix.getLightMatrix(light, _local3, _arg1, lightMatrices[_local2]);
};
}
protected function init():void{
lightMatrices = new Dictionary();
}
public function get light():LightObject3D{
return (_light);
}
public function set light(_arg1:LightObject3D):void{
_light = _arg1;
}
}
}//package org.papervision3d.core.material
Section 100
//TriangleMaterial (org.papervision3d.core.material.TriangleMaterial)
package org.papervision3d.core.material {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.draw.*;
public class TriangleMaterial extends MaterialObject3D implements ITriangleDrawer {
override public function drawTriangle(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
}
override public function drawRT(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData):void{
}
}
}//package org.papervision3d.core.material
Section 101
//FastRectangleTools (org.papervision3d.core.math.util.FastRectangleTools)
package org.papervision3d.core.math.util {
import flash.geom.*;
import org.papervision3d.core.math.*;
public class FastRectangleTools {
public static function getRotatedBounds(_arg1:Rectangle, _arg2:Number, _arg3:Rectangle=null):Rectangle{
if (!_arg3){
_arg3 = new Rectangle();
};
_arg2 = (_arg2 * Number3D.toRADIANS);
var _local4:Number = _arg1.width;
var _local5:Number = _arg1.height;
var _local6:Number = Math.abs(Math.sin(_arg2));
var _local7:Number = Math.abs(Math.cos(_arg2));
_arg3.left = (_arg1.x - (0.5 * ((_local4 * _local7) + (_local5 * _local6))));
_arg3.right = (_arg1.x + (0.5 * ((_local4 * _local7) + (_local5 * _local6))));
_arg3.top = (_arg1.y - (0.5 * ((_local4 * _local6) + (_local5 * _local7))));
_arg3.bottom = (_arg1.y + (0.5 * ((_local4 * _local6) + (_local5 * _local7))));
return (_arg3);
}
public static function intersection(_arg1:Rectangle, _arg2:Rectangle, _arg3:Rectangle=null):Rectangle{
if (!_arg3){
_arg3 = new Rectangle();
};
if (!intersects(_arg1, _arg2)){
_arg3.x = (_arg3.y = (_arg3.width = (_arg3.height = 0)));
return (_arg3);
};
_arg3.left = ((_arg1.left)>_arg2.left) ? _arg1.left : _arg2.left;
_arg3.right = ((_arg1.right)<_arg2.right) ? _arg1.right : _arg2.right;
_arg3.top = ((_arg1.top)>_arg2.top) ? _arg1.top : _arg2.top;
_arg3.bottom = ((_arg1.bottom)<_arg2.bottom) ? _arg1.bottom : _arg2.bottom;
return (_arg3);
}
public static function intersects(_arg1:Rectangle, _arg2:Rectangle):Boolean{
if (((!((((_arg1.right < _arg2.left)) || ((_arg1.left > _arg2.right))))) && (!((((_arg1.bottom < _arg2.top)) || ((_arg1.top > _arg2.bottom))))))){
return (true);
};
return (false);
}
}
}//package org.papervision3d.core.math.util
Section 102
//GLU (org.papervision3d.core.math.util.GLU)
package org.papervision3d.core.math.util {
public class GLU {
public static function unProject(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Array, _arg5:Array, _arg6:Array, _arg7:Array):Boolean{
var _local8:Array = new Array(16);
var _local9:Array = new Array(4);
multMatrices(_arg4, _arg5, _local8);
if (!invertMatrix(_local8, _local8)){
return (false);
};
_local9[0] = _arg1;
_local9[1] = _arg2;
_local9[2] = _arg3;
_local9[3] = 1;
_local9[0] = ((_local9[0] - _arg6[0]) / _arg6[2]);
_local9[1] = ((_local9[1] - _arg6[1]) / _arg6[3]);
_local9[0] = ((_local9[0] * 2) - 1);
_local9[1] = ((_local9[1] * 2) - 1);
_local9[2] = ((_local9[2] * 2) - 1);
multMatrixVec(_local8, _local9, _arg7);
if (_arg7[3] == 0){
return (false);
};
_arg7[0] = (_arg7[0] / _arg7[3]);
_arg7[1] = (_arg7[1] / _arg7[3]);
_arg7[2] = (_arg7[2] / _arg7[3]);
return (true);
}
public static function scale(_arg1:Array, _arg2:Number, _arg3:Number, _arg4:Number):void{
makeIdentity(_arg1);
_arg1[0] = _arg2;
_arg1[5] = _arg3;
_arg1[10] = _arg4;
}
public static function multMatrixVec(_arg1:Array, _arg2:Array, _arg3:Array):void{
var _local4:int;
_local4 = 0;
while (_local4 < 4) {
_arg3[_local4] = ((((_arg2[0] * _arg1[int(((0 * 4) + _local4))]) + (_arg2[1] * _arg1[int(((1 * 4) + _local4))])) + (_arg2[2] * _arg1[int(((2 * 4) + _local4))])) + (_arg2[3] * _arg1[int(((3 * 4) + _local4))]));
_local4++;
};
}
public static function invertMatrix(_arg1:Array, _arg2:Array):Boolean{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:Number;
var _local8:Array = new Array(4);
_local3 = 0;
while (_local3 < 4) {
_local8[_local3] = new Array(4);
_local4 = 0;
while (_local4 < 4) {
_local8[_local3][_local4] = _arg1[((_local3 * 4) + _local4)];
_local4++;
};
_local3++;
};
makeIdentity(_arg2);
_local3 = 0;
while (_local3 < 4) {
_local6 = _local3;
_local4 = (_local3 + 1);
while (_local4 < 4) {
if (Math.abs(_local8[_local4][_local3]) > Math.abs(_local8[_local3][_local3])){
_local6 = _local4;
};
_local4++;
};
if (_local6 != _local3){
_local5 = 0;
while (_local5 < 4) {
_local7 = _local8[_local3][_local5];
_local8[_local3][_local5] = _local8[_local6][_local5];
_local8[_local6][_local5] = _local7;
_local7 = _arg2[((_local3 * 4) + _local5)];
_arg2[((_local3 * 4) + _local5)] = _arg2[((_local6 * 4) + _local5)];
_arg2[((_local6 * 4) + _local5)] = _local7;
_local5++;
};
};
if (_local8[_local3][_local3] == 0){
return (false);
};
_local7 = _local8[_local3][_local3];
_local5 = 0;
while (_local5 < 4) {
_local8[_local3][_local5] = (_local8[_local3][_local5] / _local7);
_arg2[((_local3 * 4) + _local5)] = (_arg2[((_local3 * 4) + _local5)] / _local7);
_local5++;
};
_local4 = 0;
while (_local4 < 4) {
if (_local4 != _local3){
_local7 = _local8[_local4][_local3];
_local5 = 0;
while (_local5 < 4) {
_local8[_local4][_local5] = (_local8[_local4][_local5] - (_local8[_local3][_local5] * _local7));
_arg2[((_local4 * 4) + _local5)] = (_arg2[((_local4 * 4) + _local5)] - (_arg2[((_local3 * 4) + _local5)] * _local7));
_local5++;
};
};
_local4++;
};
_local3++;
};
return (true);
}
public static function ortho(_arg1:Array, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Number):Boolean{
var _local8:Number = ((_arg3 + _arg2) / (_arg3 - _arg2));
var _local9:Number = ((_arg4 + _arg5) / (_arg4 - _arg5));
var _local10:Number = ((_arg7 + _arg6) / (_arg7 - _arg6));
makeIdentity(_arg1);
_arg1[0] = (2 / (_arg3 - _arg2));
_arg1[5] = (2 / (_arg4 - _arg5));
_arg1[10] = (-2 / (_arg7 - _arg6));
_arg1[12] = _local8;
_arg1[13] = _local9;
_arg1[14] = _local10;
return (true);
}
public static function multMatrices(_arg1:Array, _arg2:Array, _arg3:Array):void{
var _local4:int;
var _local5:int;
_local4 = 0;
while (_local4 < 4) {
_local5 = 0;
while (_local5 < 4) {
_arg3[int(((_local4 * 4) + _local5))] = ((((_arg1[int(((_local4 * 4) + 0))] * _arg2[int(((0 * 4) + _local5))]) + (_arg1[int(((_local4 * 4) + 1))] * _arg2[int(((1 * 4) + _local5))])) + (_arg1[int(((_local4 * 4) + 2))] * _arg2[int(((2 * 4) + _local5))])) + (_arg1[int(((_local4 * 4) + 3))] * _arg2[int(((3 * 4) + _local5))]));
_local5++;
};
_local4++;
};
}
public static function perspective(_arg1:Array, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number):Boolean{
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number = ((_arg2 / 2) * (Math.PI / 180));
_local8 = (_arg5 - _arg4);
_local6 = Math.sin(_local9);
if ((((((_local8 == 0)) || ((_local6 == 0)))) || ((_arg3 == 0)))){
return (false);
};
_local7 = (Math.cos(_local9) / _local6);
makeIdentity(_arg1);
_arg1[0] = (_local7 / _arg3);
_arg1[5] = _local7;
_arg1[10] = (-((_arg5 + _arg4)) / _local8);
_arg1[11] = -1;
_arg1[14] = (-(((2 * _arg4) * _arg5)) / _local8);
_arg1[15] = 0;
return (true);
}
public static function makeIdentity(_arg1:Array):void{
_arg1[(0 + (4 * 0))] = 1;
_arg1[(0 + (4 * 1))] = 0;
_arg1[(0 + (4 * 2))] = 0;
_arg1[(0 + (4 * 3))] = 0;
_arg1[(1 + (4 * 0))] = 0;
_arg1[(1 + (4 * 1))] = 1;
_arg1[(1 + (4 * 2))] = 0;
_arg1[(1 + (4 * 3))] = 0;
_arg1[(2 + (4 * 0))] = 0;
_arg1[(2 + (4 * 1))] = 0;
_arg1[(2 + (4 * 2))] = 1;
_arg1[(2 + (4 * 3))] = 0;
_arg1[(3 + (4 * 0))] = 0;
_arg1[(3 + (4 * 1))] = 0;
_arg1[(3 + (4 * 2))] = 0;
_arg1[(3 + (4 * 3))] = 1;
}
}
}//package org.papervision3d.core.math.util
Section 103
//AxisAlignedBoundingBox (org.papervision3d.core.math.AxisAlignedBoundingBox)
package org.papervision3d.core.math {
import org.papervision3d.core.geom.renderables.*;
public class AxisAlignedBoundingBox {
public var minX:Number;
public var minY:Number;
public var minZ:Number;
public var maxX:Number;
public var maxY:Number;
public var maxZ:Number;
protected var _vertices:Array;
public function AxisAlignedBoundingBox(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Number, _arg6:Number){
this.minX = _arg1;
this.minY = _arg2;
this.minZ = _arg3;
this.maxX = _arg4;
this.maxY = _arg5;
this.maxZ = _arg6;
createBoxVertices();
}
protected function createBoxVertices():void{
_vertices = new Array();
_vertices.push(new Vertex3D(minX, minY, minZ));
_vertices.push(new Vertex3D(minX, minY, maxZ));
_vertices.push(new Vertex3D(minX, maxY, minZ));
_vertices.push(new Vertex3D(minX, maxY, maxZ));
_vertices.push(new Vertex3D(maxX, minY, minZ));
_vertices.push(new Vertex3D(maxX, minY, maxZ));
_vertices.push(new Vertex3D(maxX, maxY, minZ));
_vertices.push(new Vertex3D(maxX, maxY, maxZ));
}
public function getBoxVertices():Array{
return (_vertices);
}
public function merge(_arg1:AxisAlignedBoundingBox):void{
this.minX = Math.min(this.minX, _arg1.minX);
this.minY = Math.min(this.minY, _arg1.minY);
this.minZ = Math.min(this.minZ, _arg1.minZ);
this.maxX = Math.max(this.maxX, _arg1.maxX);
this.maxY = Math.max(this.maxY, _arg1.maxY);
this.maxZ = Math.max(this.maxZ, _arg1.maxZ);
createBoxVertices();
}
public static function createFromVertices(_arg1:Array):AxisAlignedBoundingBox{
var _local8:Vertex3D;
var _local2:Number = Number.MAX_VALUE;
var _local3:Number = Number.MAX_VALUE;
var _local4:Number = Number.MAX_VALUE;
var _local5:Number = -(_local2);
var _local6:Number = -(_local3);
var _local7:Number = -(_local4);
for each (_local8 in _arg1) {
_local2 = Math.min(_local2, _local8.x);
_local3 = Math.min(_local3, _local8.y);
_local4 = Math.min(_local4, _local8.z);
_local5 = Math.max(_local5, _local8.x);
_local6 = Math.max(_local6, _local8.y);
_local7 = Math.max(_local7, _local8.z);
};
return (new AxisAlignedBoundingBox(_local2, _local3, _local4, _local5, _local6, _local7));
}
}
}//package org.papervision3d.core.math
Section 104
//BoundingSphere (org.papervision3d.core.math.BoundingSphere)
package org.papervision3d.core.math {
import org.papervision3d.core.geom.renderables.*;
public class BoundingSphere {
public var maxDistance:Number;
public var radius:Number;
public function BoundingSphere(_arg1:Number){
this.maxDistance = _arg1;
this.radius = Math.sqrt(_arg1);
}
public static function getFromVertices(_arg1:Array):BoundingSphere{
var _local3:Number;
var _local4:Vertex3D;
var _local2:Number = 0;
for each (_local4 in _arg1) {
_local3 = (((_local4.x * _local4.x) + (_local4.y * _local4.y)) + (_local4.z * _local4.z));
_local2 = ((_local3)>_local2) ? _local3 : _local2;
};
return (new BoundingSphere(_local2));
}
}
}//package org.papervision3d.core.math
Section 105
//Matrix3D (org.papervision3d.core.math.Matrix3D)
package org.papervision3d.core.math {
import org.papervision3d.*;
public class Matrix3D {
public var n31:Number;
public var n32:Number;
public var n11:Number;
public var n34:Number;
public var n13:Number;
public var n14:Number;
public var n33:Number;
public var n12:Number;
public var n41:Number;
public var n42:Number;
public var n21:Number;
public var n22:Number;
public var n23:Number;
public var n24:Number;
public var n44:Number;
public var n43:Number;
private static var _cos:Function = Math.cos;
private static var _sin:Function = Math.sin;
private static var temp:Matrix3D = Matrix3D.IDENTITY;
private static var n3Di:Number3D = Number3D.ZERO;
private static var n3Dj:Number3D = Number3D.ZERO;
private static var n3Dk:Number3D = Number3D.ZERO;
private static var toDEGREES:Number = 57.2957795130823;
private static var toRADIANS:Number = 0.0174532925199433;
public function Matrix3D(_arg1:Array=null){
reset(_arg1);
}
public function calculateMultiply3x3(_arg1:Matrix3D, _arg2:Matrix3D):void{
var _local3:Number = _arg1.n11;
var _local4:Number = _arg2.n11;
var _local5:Number = _arg1.n21;
var _local6:Number = _arg2.n21;
var _local7:Number = _arg1.n31;
var _local8:Number = _arg2.n31;
var _local9:Number = _arg1.n12;
var _local10:Number = _arg2.n12;
var _local11:Number = _arg1.n22;
var _local12:Number = _arg2.n22;
var _local13:Number = _arg1.n32;
var _local14:Number = _arg2.n32;
var _local15:Number = _arg1.n13;
var _local16:Number = _arg2.n13;
var _local17:Number = _arg1.n23;
var _local18:Number = _arg2.n23;
var _local19:Number = _arg1.n33;
var _local20:Number = _arg2.n33;
this.n11 = (((_local3 * _local4) + (_local9 * _local6)) + (_local15 * _local8));
this.n12 = (((_local3 * _local10) + (_local9 * _local12)) + (_local15 * _local14));
this.n13 = (((_local3 * _local16) + (_local9 * _local18)) + (_local15 * _local20));
this.n21 = (((_local5 * _local4) + (_local11 * _local6)) + (_local17 * _local8));
this.n22 = (((_local5 * _local10) + (_local11 * _local12)) + (_local17 * _local14));
this.n23 = (((_local5 * _local16) + (_local11 * _local18)) + (_local17 * _local20));
this.n31 = (((_local7 * _local4) + (_local13 * _local6)) + (_local19 * _local8));
this.n32 = (((_local7 * _local10) + (_local13 * _local12)) + (_local19 * _local14));
this.n33 = (((_local7 * _local16) + (_local13 * _local18)) + (_local19 * _local20));
}
public function calculateMultiply4x4(_arg1:Matrix3D, _arg2:Matrix3D):void{
var _local3:Number = _arg1.n11;
var _local4:Number = _arg2.n11;
var _local5:Number = _arg1.n21;
var _local6:Number = _arg2.n21;
var _local7:Number = _arg1.n31;
var _local8:Number = _arg2.n31;
var _local9:Number = _arg1.n41;
var _local10:Number = _arg2.n41;
var _local11:Number = _arg1.n12;
var _local12:Number = _arg2.n12;
var _local13:Number = _arg1.n22;
var _local14:Number = _arg2.n22;
var _local15:Number = _arg1.n32;
var _local16:Number = _arg2.n32;
var _local17:Number = _arg1.n42;
var _local18:Number = _arg2.n42;
var _local19:Number = _arg1.n13;
var _local20:Number = _arg2.n13;
var _local21:Number = _arg1.n23;
var _local22:Number = _arg2.n23;
var _local23:Number = _arg1.n33;
var _local24:Number = _arg2.n33;
var _local25:Number = _arg1.n43;
var _local26:Number = _arg2.n43;
var _local27:Number = _arg1.n14;
var _local28:Number = _arg2.n14;
var _local29:Number = _arg1.n24;
var _local30:Number = _arg2.n24;
var _local31:Number = _arg1.n34;
var _local32:Number = _arg2.n34;
var _local33:Number = _arg1.n44;
var _local34:Number = _arg2.n44;
this.n11 = (((_local3 * _local4) + (_local11 * _local6)) + (_local19 * _local8));
this.n12 = (((_local3 * _local12) + (_local11 * _local14)) + (_local19 * _local16));
this.n13 = (((_local3 * _local20) + (_local11 * _local22)) + (_local19 * _local24));
this.n14 = ((((_local3 * _local28) + (_local11 * _local30)) + (_local19 * _local32)) + _local27);
this.n21 = (((_local5 * _local4) + (_local13 * _local6)) + (_local21 * _local8));
this.n22 = (((_local5 * _local12) + (_local13 * _local14)) + (_local21 * _local16));
this.n23 = (((_local5 * _local20) + (_local13 * _local22)) + (_local21 * _local24));
this.n24 = ((((_local5 * _local28) + (_local13 * _local30)) + (_local21 * _local32)) + _local29);
this.n31 = (((_local7 * _local4) + (_local15 * _local6)) + (_local23 * _local8));
this.n32 = (((_local7 * _local12) + (_local15 * _local14)) + (_local23 * _local16));
this.n33 = (((_local7 * _local20) + (_local15 * _local22)) + (_local23 * _local24));
this.n34 = ((((_local7 * _local28) + (_local15 * _local30)) + (_local23 * _local32)) + _local31);
this.n41 = (((_local9 * _local4) + (_local17 * _local6)) + (_local25 * _local8));
this.n42 = (((_local9 * _local12) + (_local17 * _local14)) + (_local25 * _local16));
this.n43 = (((_local9 * _local20) + (_local17 * _local22)) + (_local25 * _local24));
this.n44 = ((((_local9 * _local28) + (_local17 * _local30)) + (_local25 * _local32)) + _local33);
}
public function calculateSkewSymmetric(_arg1:Number3D):void{
this.n11 = 0;
this.n12 = -(_arg1.z);
this.n13 = _arg1.y;
this.n21 = _arg1.z;
this.n22 = 0;
this.n23 = -(_arg1.x);
this.n31 = -(_arg1.y);
this.n32 = _arg1.x;
this.n33 = 0;
}
public function get det():Number{
return ((((((this.n11 * this.n22) - (this.n21 * this.n12)) * this.n33) - (((this.n11 * this.n32) - (this.n31 * this.n12)) * this.n23)) + (((this.n21 * this.n32) - (this.n31 * this.n22)) * this.n13)));
}
public function copy(_arg1:Matrix3D):Matrix3D{
this.n11 = _arg1.n11;
this.n12 = _arg1.n12;
this.n13 = _arg1.n13;
this.n14 = _arg1.n14;
this.n21 = _arg1.n21;
this.n22 = _arg1.n22;
this.n23 = _arg1.n23;
this.n24 = _arg1.n24;
this.n31 = _arg1.n31;
this.n32 = _arg1.n32;
this.n33 = _arg1.n33;
this.n34 = _arg1.n34;
return (this);
}
public function copy3x3(_arg1:Matrix3D):Matrix3D{
this.n11 = _arg1.n11;
this.n12 = _arg1.n12;
this.n13 = _arg1.n13;
this.n21 = _arg1.n21;
this.n22 = _arg1.n22;
this.n23 = _arg1.n23;
this.n31 = _arg1.n31;
this.n32 = _arg1.n32;
this.n33 = _arg1.n33;
return (this);
}
public function calculateAdd(_arg1:Matrix3D, _arg2:Matrix3D):void{
this.n11 = (_arg1.n11 + _arg2.n11);
this.n12 = (_arg1.n12 + _arg2.n12);
this.n13 = (_arg1.n13 + _arg2.n13);
this.n14 = (_arg1.n14 + _arg2.n14);
this.n21 = (_arg1.n21 + _arg2.n21);
this.n22 = (_arg1.n22 + _arg2.n22);
this.n23 = (_arg1.n23 + _arg2.n23);
this.n24 = (_arg1.n24 + _arg2.n24);
this.n31 = (_arg1.n31 + _arg2.n31);
this.n32 = (_arg1.n32 + _arg2.n32);
this.n33 = (_arg1.n33 + _arg2.n33);
this.n34 = (_arg1.n34 + _arg2.n34);
}
public function calculateMultiply(_arg1:Matrix3D, _arg2:Matrix3D):void{
var _local3:Number = _arg1.n11;
var _local4:Number = _arg2.n11;
var _local5:Number = _arg1.n21;
var _local6:Number = _arg2.n21;
var _local7:Number = _arg1.n31;
var _local8:Number = _arg2.n31;
var _local9:Number = _arg1.n12;
var _local10:Number = _arg2.n12;
var _local11:Number = _arg1.n22;
var _local12:Number = _arg2.n22;
var _local13:Number = _arg1.n32;
var _local14:Number = _arg2.n32;
var _local15:Number = _arg1.n13;
var _local16:Number = _arg2.n13;
var _local17:Number = _arg1.n23;
var _local18:Number = _arg2.n23;
var _local19:Number = _arg1.n33;
var _local20:Number = _arg2.n33;
var _local21:Number = _arg1.n14;
var _local22:Number = _arg2.n14;
var _local23:Number = _arg1.n24;
var _local24:Number = _arg2.n24;
var _local25:Number = _arg1.n34;
var _local26:Number = _arg2.n34;
this.n11 = (((_local3 * _local4) + (_local9 * _local6)) + (_local15 * _local8));
this.n12 = (((_local3 * _local10) + (_local9 * _local12)) + (_local15 * _local14));
this.n13 = (((_local3 * _local16) + (_local9 * _local18)) + (_local15 * _local20));
this.n14 = ((((_local3 * _local22) + (_local9 * _local24)) + (_local15 * _local26)) + _local21);
this.n21 = (((_local5 * _local4) + (_local11 * _local6)) + (_local17 * _local8));
this.n22 = (((_local5 * _local10) + (_local11 * _local12)) + (_local17 * _local14));
this.n23 = (((_local5 * _local16) + (_local11 * _local18)) + (_local17 * _local20));
this.n24 = ((((_local5 * _local22) + (_local11 * _local24)) + (_local17 * _local26)) + _local23);
this.n31 = (((_local7 * _local4) + (_local13 * _local6)) + (_local19 * _local8));
this.n32 = (((_local7 * _local10) + (_local13 * _local12)) + (_local19 * _local14));
this.n33 = (((_local7 * _local16) + (_local13 * _local18)) + (_local19 * _local20));
this.n34 = ((((_local7 * _local22) + (_local13 * _local24)) + (_local19 * _local26)) + _local25);
}
public function reset(_arg1:Array=null):void{
if (((!(_arg1)) || ((_arg1.length < 12)))){
n11 = (n22 = (n33 = (n44 = 1)));
n12 = (n13 = (n14 = (n21 = (n23 = (n24 = (n31 = (n32 = (n34 = (n41 = (n42 = (n43 = 0)))))))))));
} else {
n11 = _arg1[0];
n12 = _arg1[1];
n13 = _arg1[2];
n14 = _arg1[3];
n21 = _arg1[4];
n22 = _arg1[5];
n23 = _arg1[6];
n24 = _arg1[7];
n31 = _arg1[8];
n32 = _arg1[9];
n33 = _arg1[10];
n34 = _arg1[11];
if (_arg1.length == 16){
n41 = _arg1[12];
n42 = _arg1[13];
n43 = _arg1[14];
n44 = _arg1[15];
} else {
n41 = (n42 = (n43 = 0));
n44 = 1;
};
};
}
public function invert():void{
temp.copy(this);
calculateInverse(temp);
}
public function calculateInverse(_arg1:Matrix3D):void{
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local2:Number = _arg1.det;
if (Math.abs(_local2) > 0.001){
_local2 = (1 / _local2);
_local3 = _arg1.n11;
_local4 = _arg1.n21;
_local5 = _arg1.n31;
_local6 = _arg1.n12;
_local7 = _arg1.n22;
_local8 = _arg1.n32;
_local9 = _arg1.n13;
_local10 = _arg1.n23;
_local11 = _arg1.n33;
_local12 = _arg1.n14;
_local13 = _arg1.n24;
_local14 = _arg1.n34;
this.n11 = (_local2 * ((_local7 * _local11) - (_local8 * _local10)));
this.n12 = (-(_local2) * ((_local6 * _local11) - (_local8 * _local9)));
this.n13 = (_local2 * ((_local6 * _local10) - (_local7 * _local9)));
this.n14 = (-(_local2) * (((_local6 * ((_local10 * _local14) - (_local11 * _local13))) - (_local7 * ((_local9 * _local14) - (_local11 * _local12)))) + (_local8 * ((_local9 * _local13) - (_local10 * _local12)))));
this.n21 = (-(_local2) * ((_local4 * _local11) - (_local5 * _local10)));
this.n22 = (_local2 * ((_local3 * _local11) - (_local5 * _local9)));
this.n23 = (-(_local2) * ((_local3 * _local10) - (_local4 * _local9)));
this.n24 = (_local2 * (((_local3 * ((_local10 * _local14) - (_local11 * _local13))) - (_local4 * ((_local9 * _local14) - (_local11 * _local12)))) + (_local5 * ((_local9 * _local13) - (_local10 * _local12)))));
this.n31 = (_local2 * ((_local4 * _local8) - (_local5 * _local7)));
this.n32 = (-(_local2) * ((_local3 * _local8) - (_local5 * _local6)));
this.n33 = (_local2 * ((_local3 * _local7) - (_local4 * _local6)));
this.n34 = (-(_local2) * (((_local3 * ((_local7 * _local14) - (_local8 * _local13))) - (_local4 * ((_local6 * _local14) - (_local8 * _local12)))) + (_local5 * ((_local6 * _local13) - (_local7 * _local12)))));
};
}
public function calculateTranspose():void{
var _local1:Number = this.n11;
var _local2:Number = this.n21;
var _local3:Number = this.n31;
var _local4:Number = this.n41;
var _local5:Number = this.n12;
var _local6:Number = this.n22;
var _local7:Number = this.n32;
var _local8:Number = this.n42;
var _local9:Number = this.n13;
var _local10:Number = this.n23;
var _local11:Number = this.n33;
var _local12:Number = this.n43;
var _local13:Number = this.n14;
var _local14:Number = this.n24;
var _local15:Number = this.n34;
var _local16:Number = this.n44;
this.n11 = _local1;
this.n12 = _local2;
this.n13 = _local3;
this.n14 = _local4;
this.n21 = _local5;
this.n22 = _local6;
this.n23 = _local7;
this.n24 = _local8;
this.n31 = _local9;
this.n32 = _local10;
this.n33 = _local11;
this.n34 = _local12;
this.n41 = _local13;
this.n42 = _local14;
this.n43 = _local15;
this.n44 = _local16;
}
public function toString():String{
var _local1 = "";
_local1 = (_local1 + ((((((((int((n11 * 1000)) / 1000) + "\t\t") + (int((n12 * 1000)) / 1000)) + "\t\t") + (int((n13 * 1000)) / 1000)) + "\t\t") + (int((n14 * 1000)) / 1000)) + "\n"));
_local1 = (_local1 + ((((((((int((n21 * 1000)) / 1000) + "\t\t") + (int((n22 * 1000)) / 1000)) + "\t\t") + (int((n23 * 1000)) / 1000)) + "\t\t") + (int((n24 * 1000)) / 1000)) + "\n"));
_local1 = (_local1 + ((((((((int((n31 * 1000)) / 1000) + "\t\t") + (int((n32 * 1000)) / 1000)) + "\t\t") + (int((n33 * 1000)) / 1000)) + "\t\t") + (int((n34 * 1000)) / 1000)) + "\n"));
_local1 = (_local1 + ((((((((int((n41 * 1000)) / 1000) + "\t\t") + (int((n42 * 1000)) / 1000)) + "\t\t") + (int((n43 * 1000)) / 1000)) + "\t\t") + (int((n44 * 1000)) / 1000)) + "\n"));
return (_local1);
}
public static function rotationMatrixWithReference(_arg1:Number3D, _arg2:Number, _arg3:Number3D):Matrix3D{
var _local4:Matrix3D = Matrix3D.translationMatrix(_arg3.x, -(_arg3.y), _arg3.z);
Matrix3D.translationMatrix(_arg3.x, -(_arg3.y), _arg3.z).calculateMultiply(_local4, Matrix3D.rotationMatrix(_arg1.x, _arg1.y, _arg1.z, _arg2));
_local4.calculateMultiply(_local4, Matrix3D.translationMatrix(-(_arg3.x), _arg3.y, -(_arg3.z)));
return (_local4);
}
public static function multiplyVector(_arg1:Matrix3D, _arg2:Number3D):void{
var _local4:Number;
var _local5:Number;
var _local3:Number = _arg2.x;
_local4 = _arg2.y;
_local5 = _arg2.z;
_arg2.x = ((((_local3 * _arg1.n11) + (_local4 * _arg1.n12)) + (_local5 * _arg1.n13)) + _arg1.n14);
_arg2.y = ((((_local3 * _arg1.n21) + (_local4 * _arg1.n22)) + (_local5 * _arg1.n23)) + _arg1.n24);
_arg2.z = ((((_local3 * _arg1.n31) + (_local4 * _arg1.n32)) + (_local5 * _arg1.n33)) + _arg1.n34);
}
public static function multiplyVector4x4(_arg1:Matrix3D, _arg2:Number3D):void{
var _local3:Number;
var _local4:Number;
var _local6:Number;
_local3 = _arg2.x;
_local4 = _arg2.y;
var _local5:Number = _arg2.z;
_local6 = (1 / ((((_local3 * _arg1.n41) + (_local4 * _arg1.n42)) + (_local5 * _arg1.n43)) + _arg1.n44));
_arg2.x = ((((_local3 * _arg1.n11) + (_local4 * _arg1.n12)) + (_local5 * _arg1.n13)) + _arg1.n14);
_arg2.y = ((((_local3 * _arg1.n21) + (_local4 * _arg1.n22)) + (_local5 * _arg1.n23)) + _arg1.n24);
_arg2.z = ((((_local3 * _arg1.n31) + (_local4 * _arg1.n32)) + (_local5 * _arg1.n33)) + _arg1.n34);
_arg2.x = (_arg2.x * _local6);
_arg2.y = (_arg2.y * _local6);
_arg2.z = (_arg2.z * _local6);
}
public static function multiply3x3(_arg1:Matrix3D, _arg2:Matrix3D):Matrix3D{
var _local3:Matrix3D = new (Matrix3D);
_local3.calculateMultiply3x3(_arg1, _arg2);
return (_local3);
}
public static function normalizeQuaternion(_arg1:Object):Object{
var _local2:Number = magnitudeQuaternion(_arg1);
_arg1.x = (_arg1.x / _local2);
_arg1.y = (_arg1.y / _local2);
_arg1.z = (_arg1.z / _local2);
_arg1.w = (_arg1.w / _local2);
return (_arg1);
}
public static function multiplyVector3x3(_arg1:Matrix3D, _arg2:Number3D):void{
var _local3:Number = _arg2.x;
var _local4:Number = _arg2.y;
var _local5:Number = _arg2.z;
_arg2.x = (((_local3 * _arg1.n11) + (_local4 * _arg1.n12)) + (_local5 * _arg1.n13));
_arg2.y = (((_local3 * _arg1.n21) + (_local4 * _arg1.n22)) + (_local5 * _arg1.n23));
_arg2.z = (((_local3 * _arg1.n31) + (_local4 * _arg1.n32)) + (_local5 * _arg1.n33));
}
public static function axis2quaternion(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Object{
var _local5:Number = Math.sin((_arg4 / 2));
var _local6:Number = Math.cos((_arg4 / 2));
var _local7:Object = new Object();
_local7.x = (_arg1 * _local5);
_local7.y = (_arg2 * _local5);
_local7.z = (_arg3 * _local5);
_local7.w = _local6;
return (normalizeQuaternion(_local7));
}
public static function translationMatrix(_arg1:Number, _arg2:Number, _arg3:Number):Matrix3D{
var _local4:Matrix3D = IDENTITY;
_local4.n14 = _arg1;
_local4.n24 = _arg2;
_local4.n34 = _arg3;
return (_local4);
}
public static function magnitudeQuaternion(_arg1:Object):Number{
return (Math.sqrt(((((_arg1.w * _arg1.w) + (_arg1.x * _arg1.x)) + (_arg1.y * _arg1.y)) + (_arg1.z * _arg1.z))));
}
public static function rotationX(_arg1:Number):Matrix3D{
var _local2:Matrix3D = IDENTITY;
var _local3:Number = Math.cos(_arg1);
var _local4:Number = Math.sin(_arg1);
_local2.n22 = _local3;
_local2.n23 = -(_local4);
_local2.n32 = _local4;
_local2.n33 = _local3;
return (_local2);
}
public static function rotationY(_arg1:Number):Matrix3D{
var _local2:Matrix3D = IDENTITY;
var _local3:Number = Math.cos(_arg1);
var _local4:Number = Math.sin(_arg1);
_local2.n11 = _local3;
_local2.n13 = -(_local4);
_local2.n31 = _local4;
_local2.n33 = _local3;
return (_local2);
}
public static function rotationZ(_arg1:Number):Matrix3D{
var _local2:Matrix3D = IDENTITY;
var _local3:Number = Math.cos(_arg1);
var _local4:Number = Math.sin(_arg1);
_local2.n11 = _local3;
_local2.n12 = -(_local4);
_local2.n21 = _local4;
_local2.n22 = _local3;
return (_local2);
}
public static function clone(_arg1:Matrix3D):Matrix3D{
return (new Matrix3D([_arg1.n11, _arg1.n12, _arg1.n13, _arg1.n14, _arg1.n21, _arg1.n22, _arg1.n23, _arg1.n24, _arg1.n31, _arg1.n32, _arg1.n33, _arg1.n34]));
}
public static function rotationMatrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Matrix3D=null):Matrix3D{
var _local6:Matrix3D;
if (!_arg5){
_local6 = IDENTITY;
} else {
_local6 = _arg5;
};
var _local7:Number = Math.cos(_arg4);
var _local8:Number = Math.sin(_arg4);
var _local9:Number = (1 - _local7);
var _local10:Number = ((_arg1 * _arg2) * _local9);
var _local11:Number = ((_arg2 * _arg3) * _local9);
var _local12:Number = ((_arg1 * _arg3) * _local9);
var _local13:Number = (_local8 * _arg3);
var _local14:Number = (_local8 * _arg2);
var _local15:Number = (_local8 * _arg1);
_local6.n11 = (_local7 + ((_arg1 * _arg1) * _local9));
_local6.n12 = (-(_local13) + _local10);
_local6.n13 = (_local14 + _local12);
_local6.n14 = 0;
_local6.n21 = (_local13 + _local10);
_local6.n22 = (_local7 + ((_arg2 * _arg2) * _local9));
_local6.n23 = (-(_local15) + _local11);
_local6.n24 = 0;
_local6.n31 = (-(_local14) + _local12);
_local6.n32 = (_local15 + _local11);
_local6.n33 = (_local7 + ((_arg3 * _arg3) * _local9));
_local6.n34 = 0;
return (_local6);
}
public static function add(_arg1:Matrix3D, _arg2:Matrix3D):Matrix3D{
var _local3:Matrix3D = new (Matrix3D);
_local3.calculateAdd(_arg1, _arg2);
return (_local3);
}
public static function multiply(_arg1:Matrix3D, _arg2:Matrix3D):Matrix3D{
var _local3:Matrix3D = new (Matrix3D);
_local3.calculateMultiply(_arg1, _arg2);
return (_local3);
}
public static function euler2quaternion(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Quaternion=null):Quaternion{
var _local13:Quaternion;
var _local5:Number = Math.sin((_arg1 * 0.5));
var _local6:Number = Math.cos((_arg1 * 0.5));
var _local7:Number = Math.sin((_arg2 * 0.5));
var _local8:Number = Math.cos((_arg2 * 0.5));
var _local9:Number = Math.sin((_arg3 * 0.5));
var _local10:Number = Math.cos((_arg3 * 0.5));
var _local11:Number = (_local6 * _local8);
var _local12:Number = (_local5 * _local7);
if (!_arg4){
_local13 = new Quaternion();
} else {
_local13 = _arg4;
};
_local13.x = ((_local9 * _local11) - (_local10 * _local12));
_local13.y = (((_local10 * _local5) * _local8) + ((_local9 * _local6) * _local7));
_local13.z = (((_local10 * _local6) * _local7) - ((_local9 * _local5) * _local8));
_local13.w = ((_local10 * _local11) + (_local9 * _local12));
return (_local13);
}
public static function quaternion2matrix(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:Matrix3D=null):Matrix3D{
var _local15:Matrix3D;
var _local6:Number = (_arg1 * _arg1);
var _local7:Number = (_arg1 * _arg2);
var _local8:Number = (_arg1 * _arg3);
var _local9:Number = (_arg1 * _arg4);
var _local10:Number = (_arg2 * _arg2);
var _local11:Number = (_arg2 * _arg3);
var _local12:Number = (_arg2 * _arg4);
var _local13:Number = (_arg3 * _arg3);
var _local14:Number = (_arg3 * _arg4);
if (!_arg5){
_local15 = IDENTITY;
} else {
_local15 = _arg5;
};
_local15.n11 = (1 - (2 * (_local10 + _local13)));
_local15.n12 = (2 * (_local7 - _local14));
_local15.n13 = (2 * (_local8 + _local12));
_local15.n21 = (2 * (_local7 + _local14));
_local15.n22 = (1 - (2 * (_local6 + _local13)));
_local15.n23 = (2 * (_local11 - _local9));
_local15.n31 = (2 * (_local8 - _local12));
_local15.n32 = (2 * (_local11 + _local9));
_local15.n33 = (1 - (2 * (_local6 + _local10)));
return (_local15);
}
public static function inverse(_arg1:Matrix3D):Matrix3D{
var _local2:Matrix3D = new (Matrix3D);
_local2.calculateInverse(_arg1);
return (_local2);
}
public static function euler2matrix(_arg1:Number3D):Matrix3D{
temp.reset();
var _local2:Matrix3D = temp;
_local2 = temp;
var _local3:Number = (_arg1.x * toRADIANS);
var _local4:Number = (_arg1.y * toRADIANS);
var _local5:Number = (_arg1.z * toRADIANS);
var _local6:Number = Math.cos(_local3);
var _local7:Number = Math.sin(_local3);
var _local8:Number = Math.cos(_local4);
var _local9:Number = Math.sin(_local4);
var _local10:Number = Math.cos(_local5);
var _local11:Number = Math.sin(_local5);
var _local12:Number = (_local6 * _local9);
var _local13:Number = (_local7 * _local9);
_local2.n11 = (_local8 * _local10);
_local2.n12 = (-(_local8) * _local11);
_local2.n13 = _local9;
_local2.n21 = ((_local13 * _local10) + (_local6 * _local11));
_local2.n22 = ((-(_local13) * _local11) + (_local6 * _local10));
_local2.n23 = (-(_local7) * _local8);
_local2.n31 = ((-(_local12) * _local10) + (_local7 * _local11));
_local2.n32 = ((_local12 * _local11) + (_local7 * _local10));
_local2.n33 = (_local6 * _local8);
return (_local2);
}
public static function scaleMatrix(_arg1:Number, _arg2:Number, _arg3:Number):Matrix3D{
var _local4:Matrix3D = IDENTITY;
_local4.n11 = _arg1;
_local4.n22 = _arg2;
_local4.n33 = _arg3;
return (_local4);
}
public static function rotateAxis(_arg1:Matrix3D, _arg2:Number3D):void{
var _local3:Number = _arg2.x;
var _local4:Number = _arg2.y;
var _local5:Number = _arg2.z;
_arg2.x = (((_local3 * _arg1.n11) + (_local4 * _arg1.n12)) + (_local5 * _arg1.n13));
_arg2.y = (((_local3 * _arg1.n21) + (_local4 * _arg1.n22)) + (_local5 * _arg1.n23));
_arg2.z = (((_local3 * _arg1.n31) + (_local4 * _arg1.n32)) + (_local5 * _arg1.n33));
_arg2.normalize();
}
public static function matrix2euler(_arg1:Matrix3D, _arg2:Number3D=null, _arg3:Number3D=null):Number3D{
_arg2 = ((_arg2) || (new Number3D()));
var _local4:Number = (((_arg3) && ((_arg3.x == 1)))) ? 1 : Math.sqrt((((_arg1.n11 * _arg1.n11) + (_arg1.n21 * _arg1.n21)) + (_arg1.n31 * _arg1.n31)));
var _local5:Number = (((_arg3) && ((_arg3.y == 1)))) ? 1 : Math.sqrt((((_arg1.n12 * _arg1.n12) + (_arg1.n22 * _arg1.n22)) + (_arg1.n32 * _arg1.n32)));
var _local6:Number = (((_arg3) && ((_arg3.z == 1)))) ? 1 : Math.sqrt((((_arg1.n13 * _arg1.n13) + (_arg1.n23 * _arg1.n23)) + (_arg1.n33 * _arg1.n33)));
var _local7:Number = (_arg1.n11 / _local4);
var _local8:Number = (_arg1.n21 / _local5);
var _local9:Number = (_arg1.n31 / _local6);
var _local10:Number = (_arg1.n32 / _local6);
var _local11:Number = (_arg1.n33 / _local6);
_local9 = ((_local9 > 1)) ? 1 : _local9;
_local9 = ((_local9 < -1)) ? -1 : _local9;
_arg2.y = Math.asin(-(_local9));
_arg2.z = Math.atan2(_local8, _local7);
_arg2.x = Math.atan2(_local10, _local11);
if (Papervision3D.useDEGREES){
_arg2.x = (_arg2.x * toDEGREES);
_arg2.y = (_arg2.y * toDEGREES);
_arg2.z = (_arg2.z * toDEGREES);
};
return (_arg2);
}
public static function multiplyQuaternion(_arg1:Object, _arg2:Object):Object{
var _local3:Number = _arg1.x;
var _local4:Number = _arg1.y;
var _local5:Number = _arg1.z;
var _local6:Number = _arg1.w;
var _local7:Number = _arg2.x;
var _local8:Number = _arg2.y;
var _local9:Number = _arg2.z;
var _local10:Number = _arg2.w;
var _local11:Object = new Object();
_local11.x = ((((_local6 * _local7) + (_local3 * _local10)) + (_local4 * _local9)) - (_local5 * _local8));
_local11.y = ((((_local6 * _local8) + (_local4 * _local10)) + (_local5 * _local7)) - (_local3 * _local9));
_local11.z = ((((_local6 * _local9) + (_local5 * _local10)) + (_local3 * _local8)) - (_local4 * _local7));
_local11.w = ((((_local6 * _local10) - (_local3 * _local7)) - (_local4 * _local8)) - (_local5 * _local9));
return (_local11);
}
public static function get IDENTITY():Matrix3D{
return (new Matrix3D([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]));
}
}
}//package org.papervision3d.core.math
Section 106
//Number2D (org.papervision3d.core.math.Number2D)
package org.papervision3d.core.math {
import org.papervision3d.*;
public class Number2D {
public var x:Number;
public var y:Number;
public static const DEGTORAD:Number = 0.0174532925199433;
public static const RADTODEG:Number = 57.2957795130823;
public function Number2D(_arg1:Number=0, _arg2:Number=0){
this.x = _arg1;
this.y = _arg2;
}
public function isModuloLessThan(_arg1:Number):Boolean{
return ((moduloSquared < (_arg1 * _arg1)));
}
public function reverse():void{
this.x = -(this.x);
this.y = -(this.y);
}
public function divideEq(_arg1:Number):void{
x = (x / _arg1);
y = (y / _arg1);
}
public function plusEq(_arg1:Number2D):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
}
public function multiplyEq(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
}
public function isModuloGreaterThan(_arg1:Number):Boolean{
return ((moduloSquared > (_arg1 * _arg1)));
}
public function toString():String{
var _local1:Number = (Math.round((this.x * 1000)) / 1000);
var _local2:Number = (Math.round((this.y * 1000)) / 1000);
return ((((("[" + _local1) + ", ") + _local2) + "]"));
}
public function reset(_arg1:Number=0, _arg2:Number=0):void{
this.x = _arg1;
this.y = _arg2;
}
public function get moduloSquared():Number{
return (((this.x * this.x) + (this.y * this.y)));
}
public function normalise():void{
var _local1:Number = this.modulo;
this.x = (this.x / _local1);
this.y = (this.y / _local1);
}
public function get modulo():Number{
return (Math.sqrt(((x * x) + (y * y))));
}
public function copyTo(_arg1:Number2D):void{
_arg1.x = this.x;
_arg1.y = this.y;
}
public function angle():Number{
if (Papervision3D.useDEGREES){
return ((RADTODEG * Math.atan2(y, x)));
};
return (Math.atan2(y, x));
}
public function rotate(_arg1:Number):void{
var _local4:Number2D;
if (Papervision3D.useDEGREES){
_arg1 = (_arg1 * DEGTORAD);
};
var _local2:Number = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
_local4 = clone();
this.x = ((_local4.x * _local2) - (_local4.y * _local3));
this.y = ((_local4.x * _local3) + (_local4.y * _local2));
}
public function minusEq(_arg1:Number2D):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
}
public function clone():Number2D{
return (new Number2D(this.x, this.y));
}
public function isModuloEqualTo(_arg1:Number):Boolean{
return ((moduloSquared == (_arg1 * _arg1)));
}
public function copyFrom(_arg1:Number2D):void{
this.x = _arg1.x;
this.y = _arg1.y;
}
public static function multiplyScalar(_arg1:Number2D, _arg2:Number):Number2D{
return (new Number2D((_arg1.x * _arg2), (_arg1.y * _arg2)));
}
public static function add(_arg1:Number2D, _arg2:Number2D):Number2D{
return (new Number2D((_arg1.x + _arg2.x), (_arg1.y + _arg2.y)));
}
public static function dot(_arg1:Number2D, _arg2:Number2D):Number{
return (((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)));
}
public static function subtract(_arg1:Number2D, _arg2:Number2D):Number2D{
return (new Number2D((_arg1.x - _arg2.x), (_arg1.y - _arg2.y)));
}
}
}//package org.papervision3d.core.math
Section 107
//Number3D (org.papervision3d.core.math.Number3D)
package org.papervision3d.core.math {
import org.papervision3d.*;
public class Number3D {
public var x:Number;
public var y:Number;
public var z:Number;
public static var toDEGREES:Number = 57.2957795130823;
private static var temp:Number3D = Number3D.ZERO;
public static var toRADIANS:Number = 0.0174532925199433;
public function Number3D(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
}
public function isModuloLessThan(_arg1:Number):Boolean{
return ((moduloSquared < (_arg1 * _arg1)));
}
public function rotateX(_arg1:Number):void{
if (Papervision3D.useDEGREES){
_arg1 = (_arg1 * toRADIANS);
};
var _local2:Number = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
temp.copyFrom(this);
this.y = ((temp.y * _local2) - (temp.z * _local3));
this.z = ((temp.y * _local3) + (temp.z * _local2));
}
public function rotateY(_arg1:Number):void{
if (Papervision3D.useDEGREES){
_arg1 = (_arg1 * toRADIANS);
};
var _local2:Number = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
temp.copyFrom(this);
this.x = ((temp.x * _local2) + (temp.z * _local3));
this.z = ((temp.x * -(_local3)) + (temp.z * _local2));
}
public function plusEq(_arg1:Number3D):void{
x = (x + _arg1.x);
y = (y + _arg1.y);
z = (z + _arg1.z);
}
public function multiplyEq(_arg1:Number):void{
x = (x * _arg1);
y = (y * _arg1);
z = (z * _arg1);
}
public function toString():String{
return (((((("x:" + (Math.round((x * 100)) / 100)) + " y:") + (Math.round((y * 100)) / 100)) + " z:") + (Math.round((z * 100)) / 100)));
}
public function normalize():void{
var _local1:Number = Math.sqrt((((this.x * this.x) + (this.y * this.y)) + (this.z * this.z)));
if (((!((_local1 == 0))) && (!((_local1 == 1))))){
_local1 = (1 / _local1);
this.x = (this.x * _local1);
this.y = (this.y * _local1);
this.z = (this.z * _local1);
};
}
public function rotateZ(_arg1:Number):void{
if (Papervision3D.useDEGREES){
_arg1 = (_arg1 * toRADIANS);
};
var _local2:Number = Math.cos(_arg1);
var _local3:Number = Math.sin(_arg1);
temp.copyFrom(this);
this.x = ((temp.x * _local2) - (temp.y * _local3));
this.y = ((temp.x * _local3) + (temp.y * _local2));
}
public function reset(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0):void{
x = _arg1;
y = _arg2;
z = _arg3;
}
public function get moduloSquared():Number{
return ((((this.x * this.x) + (this.y * this.y)) + (this.z * this.z)));
}
public function get modulo():Number{
return (Math.sqrt((((this.x * this.x) + (this.y * this.y)) + (this.z * this.z))));
}
public function copyTo(_arg1:Number3D):void{
_arg1.x = x;
_arg1.y = y;
_arg1.z = z;
}
public function isModuloGreaterThan(_arg1:Number):Boolean{
return ((moduloSquared > (_arg1 * _arg1)));
}
public function minusEq(_arg1:Number3D):void{
x = (x - _arg1.x);
y = (y - _arg1.y);
z = (z - _arg1.z);
}
public function clone():Number3D{
return (new Number3D(this.x, this.y, this.z));
}
public function isModuloEqualTo(_arg1:Number):Boolean{
return ((moduloSquared == (_arg1 * _arg1)));
}
public function copyFrom(_arg1:Number3D):void{
x = _arg1.x;
y = _arg1.y;
z = _arg1.z;
}
public static function sub(_arg1:Number3D, _arg2:Number3D):Number3D{
return (new Number3D((_arg1.x - _arg2.x), (_arg1.y - _arg2.y), (_arg1.z - _arg2.z)));
}
public static function add(_arg1:Number3D, _arg2:Number3D):Number3D{
return (new Number3D((_arg1.x + _arg2.x), (_arg1.y + _arg2.y), (_arg1.z + _arg2.z)));
}
public static function cross(_arg1:Number3D, _arg2:Number3D, _arg3:Number3D=null):Number3D{
if (!_arg3){
_arg3 = ZERO;
};
_arg3.reset(((_arg2.y * _arg1.z) - (_arg2.z * _arg1.y)), ((_arg2.z * _arg1.x) - (_arg2.x * _arg1.z)), ((_arg2.x * _arg1.y) - (_arg2.y * _arg1.x)));
return (_arg3);
}
public static function dot(_arg1:Number3D, _arg2:Number3D):Number{
return ((((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)) + (_arg2.z * _arg1.z)));
}
public static function get ZERO():Number3D{
return (new Number3D(0, 0, 0));
}
}
}//package org.papervision3d.core.math
Section 108
//NumberUV (org.papervision3d.core.math.NumberUV)
package org.papervision3d.core.math {
public class NumberUV {
public var u:Number;
public var v:Number;
public function NumberUV(_arg1:Number=0, _arg2:Number=0){
this.u = _arg1;
this.v = _arg2;
}
public function toString():String{
return (((("u:" + u) + " v:") + v));
}
public function clone():NumberUV{
return (new NumberUV(this.u, this.v));
}
public static function get ZERO():NumberUV{
return (new NumberUV(0, 0));
}
public static function median(_arg1:NumberUV, _arg2:NumberUV):NumberUV{
if (_arg1 == null){
return (null);
};
if (_arg2 == null){
return (null);
};
return (new NumberUV(((_arg1.u + _arg2.u) / 2), ((_arg1.v + _arg2.v) / 2)));
}
public static function weighted(_arg1:NumberUV, _arg2:NumberUV, _arg3:Number, _arg4:Number):NumberUV{
if (_arg1 == null){
return (null);
};
if (_arg2 == null){
return (null);
};
var _local5:Number = (_arg3 + _arg4);
var _local6:Number = (_arg3 / _local5);
var _local7:Number = (_arg4 / _local5);
return (new NumberUV(((_arg1.u * _local6) + (_arg2.u * _local7)), ((_arg1.v * _local6) + (_arg2.v * _local7))));
}
}
}//package org.papervision3d.core.math
Section 109
//Quaternion (org.papervision3d.core.math.Quaternion)
package org.papervision3d.core.math {
public class Quaternion {
private var _matrix:Matrix3D;
public var w:Number;
public var x:Number;
public var y:Number;
public var z:Number;
public static const EPSILON:Number = 1E-6;
public static const DEGTORAD:Number = 0.0174532925199433;
public static const RADTODEG:Number = 57.2957795130823;
public function Quaternion(_arg1:Number=0, _arg2:Number=0, _arg3:Number=0, _arg4:Number=1){
this.x = _arg1;
this.y = _arg2;
this.z = _arg3;
this.w = _arg4;
_matrix = Matrix3D.IDENTITY;
}
public function get matrix():Matrix3D{
var _local1:Number = (x * x);
var _local2:Number = (x * y);
var _local3:Number = (x * z);
var _local4:Number = (x * w);
var _local5:Number = (y * y);
var _local6:Number = (y * z);
var _local7:Number = (y * w);
var _local8:Number = (z * z);
var _local9:Number = (z * w);
_matrix.n11 = (1 - (2 * (_local5 + _local8)));
_matrix.n12 = (2 * (_local2 - _local9));
_matrix.n13 = (2 * (_local3 + _local7));
_matrix.n21 = (2 * (_local2 + _local9));
_matrix.n22 = (1 - (2 * (_local1 + _local8)));
_matrix.n23 = (2 * (_local6 - _local4));
_matrix.n31 = (2 * (_local3 - _local7));
_matrix.n32 = (2 * (_local6 + _local4));
_matrix.n33 = (1 - (2 * (_local1 + _local5)));
return (_matrix);
}
public function setFromEuler(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Boolean=false):void{
if (_arg4){
_arg1 = (_arg1 * DEGTORAD);
_arg2 = (_arg2 * DEGTORAD);
_arg3 = (_arg3 * DEGTORAD);
};
var _local5:Number = Math.sin((_arg1 * 0.5));
var _local6:Number = Math.cos((_arg1 * 0.5));
var _local7:Number = Math.sin((_arg2 * 0.5));
var _local8:Number = Math.cos((_arg2 * 0.5));
var _local9:Number = Math.sin((_arg3 * 0.5));
var _local10:Number = Math.cos((_arg3 * 0.5));
var _local11:Number = (_local6 * _local8);
var _local12:Number = (_local5 * _local7);
this.x = ((_local9 * _local11) - (_local10 * _local12));
this.y = (((_local10 * _local5) * _local8) + ((_local9 * _local6) * _local7));
this.z = (((_local10 * _local6) * _local7) - ((_local9 * _local5) * _local8));
this.w = ((_local10 * _local11) + (_local9 * _local12));
}
public function setFromAxisAngle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):void{
var _local5:Number = Math.sin((_arg4 / 2));
var _local6:Number = Math.cos((_arg4 / 2));
this.x = (_arg1 * _local5);
this.y = (_arg2 * _local5);
this.z = (_arg3 * _local5);
this.w = _local6;
this.normalize();
}
public function calculateMultiply(_arg1:Quaternion, _arg2:Quaternion):void{
this.x = ((((_arg1.w * _arg2.x) + (_arg1.x * _arg2.w)) + (_arg1.y * _arg2.z)) - (_arg1.z * _arg2.y));
this.y = ((((_arg1.w * _arg2.y) - (_arg1.x * _arg2.z)) + (_arg1.y * _arg2.w)) + (_arg1.z * _arg2.x));
this.z = ((((_arg1.w * _arg2.z) + (_arg1.x * _arg2.y)) - (_arg1.y * _arg2.x)) + (_arg1.z * _arg2.w));
this.w = ((((_arg1.w * _arg2.w) - (_arg1.x * _arg2.x)) - (_arg1.y * _arg2.y)) - (_arg1.z * _arg2.z));
}
public function toString():String{
return (((((((("Quaternion: x:" + this.x) + " y:") + this.y) + " z:") + this.z) + " w:") + this.w));
}
public function normalize():void{
var _local2:Number;
var _local1:Number = this.modulo;
if (Math.abs(_local1) < EPSILON){
x = (y = (z = 0));
w = 1;
} else {
_local2 = (1 / _local1);
x = (x * _local2);
y = (y * _local2);
z = (z * _local2);
w = (w * _local2);
};
}
public function toEuler():Number3D{
var _local1:Number3D = new Number3D();
var _local2:Quaternion = this;
var _local3:Number = ((_local2.x * _local2.y) + (_local2.z * _local2.w));
if (_local3 > 0.499){
_local1.x = (2 * Math.atan2(_local2.x, _local2.w));
_local1.y = (Math.PI / 2);
_local1.z = 0;
return (_local1);
};
if (_local3 < -0.499){
_local1.x = (-2 * Math.atan2(_local2.x, _local2.w));
_local1.y = (-(Math.PI) / 2);
_local1.z = 0;
return (_local1);
};
var _local4:Number = (_local2.x * _local2.x);
var _local5:Number = (_local2.y * _local2.y);
var _local6:Number = (_local2.z * _local2.z);
_local1.x = Math.atan2((((2 * _local2.y) * _local2.w) - ((2 * _local2.x) * _local2.z)), ((1 - (2 * _local5)) - (2 * _local6)));
_local1.y = Math.asin((2 * _local3));
_local1.z = Math.atan2((((2 * _local2.x) * _local2.w) - ((2 * _local2.y) * _local2.z)), ((1 - (2 * _local4)) - (2 * _local6)));
return (_local1);
}
public function get modulo():Number{
return (Math.sqrt(((((x * x) + (y * y)) + (z * z)) + (w * w))));
}
public function clone():Quaternion{
return (new Quaternion(this.x, this.y, this.z, this.w));
}
public function mult(_arg1:Quaternion):void{
var _local2:Number = this.w;
var _local3:Number = this.x;
var _local4:Number = this.y;
var _local5:Number = this.z;
x = ((((_local2 * _arg1.x) + (_local3 * _arg1.w)) + (_local4 * _arg1.z)) - (_local5 * _arg1.y));
y = ((((_local2 * _arg1.y) - (_local3 * _arg1.z)) + (_local4 * _arg1.w)) + (_local5 * _arg1.x));
z = ((((_local2 * _arg1.z) + (_local3 * _arg1.y)) - (_local4 * _arg1.x)) + (_local5 * _arg1.w));
w = ((((_local2 * _arg1.w) - (_local3 * _arg1.x)) - (_local4 * _arg1.y)) - (_local5 * _arg1.z));
}
public static function sub(_arg1:Quaternion, _arg2:Quaternion):Quaternion{
return (new Quaternion((_arg1.x - _arg2.x), (_arg1.y - _arg2.y), (_arg1.z - _arg2.z), (_arg1.w - _arg2.w)));
}
public static function add(_arg1:Quaternion, _arg2:Quaternion):Quaternion{
return (new Quaternion((_arg1.x + _arg2.x), (_arg1.y + _arg2.y), (_arg1.z + _arg2.z), (_arg1.w + _arg2.w)));
}
public static function createFromEuler(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Boolean=false):Quaternion{
if (_arg4){
_arg1 = (_arg1 * DEGTORAD);
_arg2 = (_arg2 * DEGTORAD);
_arg3 = (_arg3 * DEGTORAD);
};
var _local5:Number = Math.sin((_arg1 * 0.5));
var _local6:Number = Math.cos((_arg1 * 0.5));
var _local7:Number = Math.sin((_arg2 * 0.5));
var _local8:Number = Math.cos((_arg2 * 0.5));
var _local9:Number = Math.sin((_arg3 * 0.5));
var _local10:Number = Math.cos((_arg3 * 0.5));
var _local11:Number = (_local6 * _local8);
var _local12:Number = (_local5 * _local7);
var _local13:Quaternion = new (Quaternion);
_local13.x = ((_local9 * _local11) - (_local10 * _local12));
_local13.y = (((_local10 * _local5) * _local8) + ((_local9 * _local6) * _local7));
_local13.z = (((_local10 * _local6) * _local7) - ((_local9 * _local5) * _local8));
_local13.w = ((_local10 * _local11) + (_local9 * _local12));
return (_local13);
}
public static function createFromMatrix(_arg1:Matrix3D):Quaternion{
var _local3:Number;
var _local5:int;
var _local6:int;
var _local7:int;
var _local9:Array;
var _local10:Array;
var _local2:Quaternion = new (Quaternion);
var _local4:Array = new Array(4);
var _local8:Number = ((_arg1.n11 + _arg1.n22) + _arg1.n33);
if (_local8 > 0){
_local3 = Math.sqrt((_local8 + 1));
_local2.w = (_local3 / 2);
_local3 = (0.5 / _local3);
_local2.x = ((_arg1.n32 - _arg1.n23) * _local3);
_local2.y = ((_arg1.n13 - _arg1.n31) * _local3);
_local2.z = ((_arg1.n21 - _arg1.n12) * _local3);
} else {
_local9 = [1, 2, 0];
_local10 = [[_arg1.n11, _arg1.n12, _arg1.n13, _arg1.n14], [_arg1.n21, _arg1.n22, _arg1.n23, _arg1.n24], [_arg1.n31, _arg1.n32, _arg1.n33, _arg1.n34]];
_local5 = 0;
if (_local10[1][1] > _local10[0][0]){
_local5 = 1;
};
if (_local10[2][2] > _local10[_local5][_local5]){
_local5 = 2;
};
_local6 = _local9[_local5];
_local7 = _local9[_local6];
_local3 = Math.sqrt(((_local10[_local5][_local5] - (_local10[_local6][_local6] + _local10[_local7][_local7])) + 1));
_local4[_local5] = (_local3 * 0.5);
if (_local3 != 0){
_local3 = (0.5 / _local3);
};
_local4[3] = ((_local10[_local7][_local6] - _local10[_local6][_local7]) * _local3);
_local4[_local6] = ((_local10[_local6][_local5] + _local10[_local5][_local6]) * _local3);
_local4[_local7] = ((_local10[_local7][_local5] + _local10[_local5][_local7]) * _local3);
_local2.x = _local4[0];
_local2.y = _local4[1];
_local2.z = _local4[2];
_local2.w = _local4[3];
};
return (_local2);
}
public static function dot(_arg1:Quaternion, _arg2:Quaternion):Number{
return (((((_arg1.x * _arg2.x) + (_arg1.y * _arg2.y)) + (_arg1.z * _arg2.z)) + (_arg1.w * _arg2.w)));
}
public static function multiply(_arg1:Quaternion, _arg2:Quaternion):Quaternion{
var _local3:Quaternion = new (Quaternion);
_local3.x = ((((_arg1.w * _arg2.x) + (_arg1.x * _arg2.w)) + (_arg1.y * _arg2.z)) - (_arg1.z * _arg2.y));
_local3.y = ((((_arg1.w * _arg2.y) - (_arg1.x * _arg2.z)) + (_arg1.y * _arg2.w)) + (_arg1.z * _arg2.x));
_local3.z = ((((_arg1.w * _arg2.z) + (_arg1.x * _arg2.y)) - (_arg1.y * _arg2.x)) + (_arg1.z * _arg2.w));
_local3.w = ((((_arg1.w * _arg2.w) - (_arg1.x * _arg2.x)) - (_arg1.y * _arg2.y)) - (_arg1.z * _arg2.z));
return (_local3);
}
public static function createFromAxisAngle(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Quaternion{
var _local5:Quaternion = new (Quaternion);
_local5.setFromAxisAngle(_arg1, _arg2, _arg3, _arg4);
return (_local5);
}
public static function slerp(_arg1:Quaternion, _arg2:Quaternion, _arg3:Number):Quaternion{
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local4:Number = ((((_arg1.w * _arg2.w) + (_arg1.x * _arg2.x)) + (_arg1.y * _arg2.y)) + (_arg1.z * _arg2.z));
if (_local4 < 0){
_arg1.x = (_arg1.x * -1);
_arg1.y = (_arg1.y * -1);
_arg1.z = (_arg1.z * -1);
_arg1.w = (_arg1.w * -1);
_local4 = (_local4 * -1);
};
if ((_local4 + 1) > EPSILON){
if ((1 - _local4) >= EPSILON){
_local7 = Math.acos(_local4);
_local8 = (1 / Math.sin(_local7));
_local5 = (Math.sin((_local7 * (1 - _arg3))) * _local8);
_local6 = (Math.sin((_local7 * _arg3)) * _local8);
} else {
_local5 = (1 - _arg3);
_local6 = _arg3;
};
} else {
_arg2.y = -(_arg1.y);
_arg2.x = _arg1.x;
_arg2.w = -(_arg1.w);
_arg2.z = _arg1.z;
_local5 = Math.sin((Math.PI * (0.5 - _arg3)));
_local6 = Math.sin((Math.PI * _arg3));
};
return (new Quaternion(((_local5 * _arg1.x) + (_local6 * _arg2.x)), ((_local5 * _arg1.y) + (_local6 * _arg2.y)), ((_local5 * _arg1.z) + (_local6 * _arg2.z)), ((_local5 * _arg1.w) + (_local6 * _arg2.w))));
}
public static function createFromOrthoMatrix(_arg1:Matrix3D):Quaternion{
var _local2:Quaternion = new (Quaternion);
_local2.w = (Math.sqrt(Math.max(0, (((1 + _arg1.n11) + _arg1.n22) + _arg1.n33))) / 2);
_local2.x = (Math.sqrt(Math.max(0, (((1 + _arg1.n11) - _arg1.n22) - _arg1.n33))) / 2);
_local2.y = (Math.sqrt(Math.max(0, (((1 - _arg1.n11) + _arg1.n22) - _arg1.n33))) / 2);
_local2.z = (Math.sqrt(Math.max(0, (((1 - _arg1.n11) - _arg1.n22) + _arg1.n33))) / 2);
_local2.x = (((_arg1.n32 - _arg1.n23) < 0)) ? ((_local2.x < 0)) ? _local2.x : -(_local2.x) : ((_local2.x < 0)) ? -(_local2.x) : _local2.x;
_local2.y = (((_arg1.n13 - _arg1.n31) < 0)) ? ((_local2.y < 0)) ? _local2.y : -(_local2.y) : ((_local2.y < 0)) ? -(_local2.y) : _local2.y;
_local2.z = (((_arg1.n21 - _arg1.n12) < 0)) ? ((_local2.z < 0)) ? _local2.z : -(_local2.z) : ((_local2.z < 0)) ? -(_local2.z) : _local2.z;
return (_local2);
}
public static function conjugate(_arg1:Quaternion):Quaternion{
var _local2:Quaternion = new (Quaternion);
_local2.x = -(_arg1.x);
_local2.y = -(_arg1.y);
_local2.z = -(_arg1.z);
_local2.w = _arg1.w;
return (_local2);
}
public static function slerpOld(_arg1:Quaternion, _arg2:Quaternion, _arg3:Number):Quaternion{
var _local4:Quaternion = new (Quaternion);
var _local5:Number = ((((_arg1.w * _arg2.w) + (_arg1.x * _arg2.x)) + (_arg1.y * _arg2.y)) + (_arg1.z * _arg2.z));
if (Math.abs(_local5) >= 1){
_local4.w = _arg1.w;
_local4.x = _arg1.x;
_local4.y = _arg1.y;
_local4.z = _arg1.z;
return (_local4);
};
var _local6:Number = Math.acos(_local5);
var _local7:Number = Math.sqrt((1 - (_local5 * _local5)));
if (Math.abs(_local7) < 0.001){
_local4.w = ((_arg1.w * 0.5) + (_arg2.w * 0.5));
_local4.x = ((_arg1.x * 0.5) + (_arg2.x * 0.5));
_local4.y = ((_arg1.y * 0.5) + (_arg2.y * 0.5));
_local4.z = ((_arg1.z * 0.5) + (_arg2.z * 0.5));
return (_local4);
};
var _local8:Number = (Math.sin(((1 - _arg3) * _local6)) / _local7);
var _local9:Number = (Math.sin((_arg3 * _local6)) / _local7);
_local4.w = ((_arg1.w * _local8) + (_arg2.w * _local9));
_local4.x = ((_arg1.x * _local8) + (_arg2.x * _local9));
_local4.y = ((_arg1.y * _local8) + (_arg2.y * _local9));
_local4.z = ((_arg1.z * _local8) + (_arg2.z * _local9));
return (_local4);
}
}
}//package org.papervision3d.core.math
Section 110
//pv3dview (org.papervision3d.core.ns.pv3dview)
package org.papervision3d.core.ns {
public namespace pv3dview;
}//package org.papervision3d.core.ns
Section 111
//CameraObject3D (org.papervision3d.core.proto.CameraObject3D)
package org.papervision3d.core.proto {
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.log.*;
import org.papervision3d.*;
import org.papervision3d.core.math.util.*;
public class CameraObject3D extends DisplayObject3D {
protected var _orthoScale:Number;// = 1
public var culler:IObjectCuller;
public var sort:Boolean;
public var viewport:Rectangle;
protected var _target:DisplayObject3D;
protected var _orthoScaleMatrix:Matrix3D;
public var eye:Matrix3D;
protected var _ortho:Boolean;
protected var _useCulling:Boolean;
public var zoom:Number;
public var yUP:Boolean;
public var focus:Number;
protected var _useProjectionMatrix:Boolean;
protected var _far:Number;
public static var DEFAULT_VIEWPORT:Rectangle = new Rectangle(0, 0, 550, 400);
public static var DEFAULT_POS:Number3D = new Number3D(0, 0, -1000);
public static var DEFAULT_UP:Number3D = new Number3D(0, 1, 0);
private static var _flipY:Matrix3D = Matrix3D.scaleMatrix(1, -1, 1);
public function CameraObject3D(_arg1:Number=500, _arg2:Number=3){
this.x = DEFAULT_POS.x;
this.y = DEFAULT_POS.y;
this.z = DEFAULT_POS.z;
this.zoom = _arg2;
this.focus = _arg1;
this.eye = Matrix3D.IDENTITY;
this.viewport = DEFAULT_VIEWPORT;
this.sort = true;
_ortho = false;
_orthoScaleMatrix = Matrix3D.scaleMatrix(1, 1, 1);
if (Papervision3D.useRIGHTHANDED){
DEFAULT_UP.y = -1;
this.yUP = false;
this.lookAt(DisplayObject3D.ZERO);
} else {
this.yUP = true;
};
}
public function get target():DisplayObject3D{
return (_target);
}
public function get useProjectionMatrix():Boolean{
return (_useProjectionMatrix);
}
public function set fov(_arg1:Number):void{
if (((!(viewport)) || (viewport.isEmpty()))){
PaperLogger.warning("CameraObject3D#viewport not set, can't set fov!");
return;
};
var _local2:Number = 0;
var _local3:Number = 0;
var _local4:Number = 0;
if (_target){
_local2 = _target.world.n14;
_local3 = _target.world.n24;
_local4 = _target.world.n34;
};
var _local5:Number = (viewport.height / 2);
var _local6:Number = ((_arg1 / 2) * (Math.PI / 180));
this.focus = ((_local5 / Math.tan(_local6)) / this.zoom);
}
public function pan(_arg1:Number):void{
}
public function get far():Number{
return (_far);
}
public function set target(_arg1:DisplayObject3D):void{
_target = _arg1;
}
public function projectFaces(_arg1:Array, _arg2:DisplayObject3D, _arg3:RenderSessionData):Number{
return (0);
}
public function get useCulling():Boolean{
return (_useCulling);
}
public function set far(_arg1:Number):void{
if (_arg1 > this.focus){
_far = _arg1;
};
}
public function get near():Number{
return (this.focus);
}
public function transformView(_arg1:Matrix3D=null):void{
if (this.yUP){
eye.calculateMultiply(((_arg1) || (this.transform)), _flipY);
eye.invert();
} else {
eye.calculateInverse(((_arg1) || (this.transform)));
};
}
public function set useProjectionMatrix(_arg1:Boolean):void{
_useProjectionMatrix = _arg1;
}
public function tilt(_arg1:Number):void{
}
override public function lookAt(_arg1:DisplayObject3D, _arg2:Number3D=null):void{
if (this.yUP){
super.lookAt(_arg1, _arg2);
} else {
super.lookAt(_arg1, ((_arg2) || (DEFAULT_UP)));
};
}
public function get ortho():Boolean{
return (_ortho);
}
public function orbit(_arg1:Number, _arg2:Number, _arg3:Boolean=true, _arg4:DisplayObject3D=null):void{
}
public function get fov():Number{
if (((!(viewport)) || (viewport.isEmpty()))){
PaperLogger.warning("CameraObject3D#viewport not set, can't calculate fov!");
return (NaN);
};
var _local1:Number = 0;
var _local2:Number = 0;
var _local3:Number = 0;
if (_target){
_local1 = _target.world.n14;
_local2 = _target.world.n24;
_local3 = _target.world.n34;
};
var _local4:Number = (this.x - _local1);
var _local5:Number = (this.y - _local2);
var _local6:Number = (this.z - _local3);
var _local7:Number = this.focus;
var _local8:Number = this.zoom;
var _local9:Number = (Math.sqrt((((_local4 * _local4) + (_local5 * _local5)) + (_local6 * _local6))) + _local7);
var _local10:Number = (viewport.height / 2);
var _local11:Number = (180 / Math.PI);
return (((Math.atan(((((_local9 / _local7) / _local8) * _local10) / _local9)) * _local11) * 2));
}
public function set near(_arg1:Number):void{
if (_arg1 > 0){
this.focus = _arg1;
};
}
public function set useCulling(_arg1:Boolean):void{
_useCulling = _arg1;
}
public function set orthoScale(_arg1:Number):void{
_orthoScale = ((_arg1 > 0)) ? _arg1 : 0.0001;
_orthoScaleMatrix.n11 = _orthoScale;
_orthoScaleMatrix.n22 = _orthoScale;
_orthoScaleMatrix.n33 = _orthoScale;
}
public function unproject(_arg1:Number, _arg2:Number, _arg3:Number=0):Number3D{
var _local4:Number3D;
var _local5:Matrix3D;
var _local6:Array;
var _local7:Array;
var _local8:Array;
var _local9:Array;
var _local10:Array;
var _local11:Array;
var _local12:Number;
if (_useProjectionMatrix){
if (!viewport){
return (null);
};
_local5 = this.transform;
_local6 = [(-(viewport.width) / 2), (-(viewport.height) / 2), viewport.width, viewport.height];
_local7 = [_local5.n11, _local5.n21, _local5.n31, _local5.n41, _local5.n12, _local5.n22, _local5.n32, _local5.n42, _local5.n13, _local5.n23, _local5.n33, _local5.n43, _local5.n14, _local5.n24, _local5.n34, _local5.n44];
_local8 = new Array(16);
_local9 = new Array(4);
GLU.invertMatrix(_local7, _local7);
if (_ortho){
_local10 = new Array(16);
_local11 = new Array(16);
GLU.ortho(_local11, (viewport.width / 2), (-(viewport.width) / 2), (-(viewport.height) / 2), (viewport.height / 2), far, near);
GLU.scale(_local10, _orthoScale, _orthoScale, 1);
GLU.multMatrices(_local10, _local11, _local8);
} else {
GLU.perspective(_local8, fov, (viewport.width / viewport.height), -(near), -(far));
};
GLU.unProject(-(_arg1), _arg2, _arg3, _local7, _local8, _local6, _local9);
_local4 = new Number3D();
_local4.x = _local9[0];
_local4.y = _local9[1];
_local4.z = _local9[2];
} else {
_local12 = ((focus * zoom) / focus);
_local4 = new Number3D((_arg1 / _local12), ((yUP) ? -(_arg2) : _arg2 / _local12), focus);
Matrix3D.multiplyVector3x3(transform, _local4);
};
return (_local4);
}
public function set ortho(_arg1:Boolean):void{
_ortho = _arg1;
}
public function projectVertices(_arg1:Array, _arg2:DisplayObject3D, _arg3:RenderSessionData):Number{
return (0);
}
public function get orthoScale():Number{
return (_orthoScale);
}
}
}//package org.papervision3d.core.proto
Section 112
//DisplayObjectContainer3D (org.papervision3d.core.proto.DisplayObjectContainer3D)
package org.papervision3d.core.proto {
import flash.events.*;
import org.papervision3d.objects.*;
import flash.utils.*;
import org.papervision3d.core.log.*;
public class DisplayObjectContainer3D extends EventDispatcher {
protected var _childrenByName:Object;
public var root:DisplayObjectContainer3D;
private var _childrenTotal:int;
protected var _children:Dictionary;
public function DisplayObjectContainer3D():void{
this._children = new Dictionary(false);
this._childrenByName = new Dictionary(true);
this._childrenTotal = 0;
}
private function findChildByName(_arg1:String, _arg2:DisplayObject3D=null):DisplayObject3D{
var _local3:DisplayObject3D;
var _local4:DisplayObject3D;
_arg2 = ((_arg2) || (DisplayObject3D(this)));
if (!_arg2){
return (null);
};
if (_arg2.name == _arg1){
return (_arg2);
};
for each (_local3 in _arg2.children) {
_local4 = findChildByName(_arg1, _local3);
if (_local4){
return (_local4);
};
};
return (null);
}
public function getChildByName(_arg1:String, _arg2:Boolean=false):DisplayObject3D{
if (_arg2){
return (findChildByName(_arg1));
};
return (this._childrenByName[_arg1]);
}
override public function toString():String{
return (childrenList());
}
public function addChildren(_arg1:DisplayObject3D):DisplayObjectContainer3D{
var _local2:DisplayObject3D;
for each (_local2 in _arg1.children) {
_arg1.removeChild(_local2);
this.addChild(_local2);
};
return (this);
}
public function get numChildren():int{
return (this._childrenTotal);
}
public function removeChild(_arg1:DisplayObject3D):DisplayObject3D{
if (((_arg1) && (_children[_arg1]))){
delete _childrenByName[this._children[_arg1]];
delete _children[_arg1];
_arg1.parent = null;
_arg1.root = null;
_childrenTotal--;
return (_arg1);
};
return (null);
}
public function removeChildByName(_arg1:String):DisplayObject3D{
return (removeChild(getChildByName(_arg1)));
}
public function addChild(_arg1:DisplayObject3D, _arg2:String=null):DisplayObject3D{
if (_arg1.parent){
PaperLogger.error("DisplayObjectContainer.addChild : DisplayObject3D already has a parent, ie is already added to scene.");
};
_arg2 = ((((_arg2) || (_arg1.name))) || (String(_arg1.id)));
this._children[_arg1] = _arg2;
this._childrenByName[_arg2] = _arg1;
this._childrenTotal++;
_arg1.parent = this;
_arg1.root = this.root;
return (_arg1);
}
public function childrenList():String{
var _local2:String;
var _local1 = "";
for (_local2 in this._children) {
_local1 = (_local1 + (_local2 + "\n"));
};
return (_local1);
}
public function get children():Object{
return (this._childrenByName);
}
}
}//package org.papervision3d.core.proto
Section 113
//GeometryObject3D (org.papervision3d.core.proto.GeometryObject3D)
package org.papervision3d.core.proto {
import flash.events.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.geom.renderables.*;
import flash.utils.*;
public class GeometryObject3D extends EventDispatcher {
protected var _boundingSphereDirty:Boolean;// = true
public var dirty:Boolean;
protected var _aabbDirty:Boolean;// = true
public var _ready:Boolean;// = false
protected var _boundingSphere:BoundingSphere;
public var faces:Array;
private var _numInstances:uint;// = 0
public var vertices:Array;
protected var _aabb:AxisAlignedBoundingBox;
public function GeometryObject3D():void{
dirty = true;
}
public function transformVertices(_arg1:Matrix3D):void{
var _local15:Vertex3D;
var _local16:Number;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:Number;
var _local21:Number;
var _local2:Number = _arg1.n11;
var _local3:Number = _arg1.n12;
var _local4:Number = _arg1.n13;
var _local5:Number = _arg1.n21;
var _local6:Number = _arg1.n22;
var _local7:Number = _arg1.n23;
var _local8:Number = _arg1.n31;
var _local9:Number = _arg1.n32;
var _local10:Number = _arg1.n33;
var _local11:Number = _arg1.n14;
var _local12:Number = _arg1.n24;
var _local13:Number = _arg1.n34;
var _local14:int = vertices.length;
while ((_local15 = vertices[--_local14])) {
_local16 = _local15.x;
_local17 = _local15.y;
_local18 = _local15.z;
_local19 = ((((_local16 * _local2) + (_local17 * _local3)) + (_local18 * _local4)) + _local11);
_local20 = ((((_local16 * _local5) + (_local17 * _local6)) + (_local18 * _local7)) + _local12);
_local21 = ((((_local16 * _local8) + (_local17 * _local9)) + (_local18 * _local10)) + _local13);
_local15.x = _local19;
_local15.y = _local20;
_local15.z = _local21;
};
}
public function set ready(_arg1:Boolean):void{
if (_arg1){
createVertexNormals();
this.dirty = false;
};
_ready = _arg1;
}
public function flipFaces():void{
var _local1:Triangle3D;
var _local2:Vertex3D;
for each (_local1 in this.faces) {
_local2 = _local1.v0;
_local1.v0 = _local1.v2;
_local1.v2 = _local2;
_local1.createNormal();
};
this.ready = true;
}
private function createVertexNormals():void{
var _local2:Triangle3D;
var _local3:Vertex3D;
var _local1:Dictionary = new Dictionary(true);
for each (_local2 in faces) {
_local2.v0.connectedFaces[_local2] = _local2;
_local2.v1.connectedFaces[_local2] = _local2;
_local2.v2.connectedFaces[_local2] = _local2;
_local1[_local2.v0] = _local2.v0;
_local1[_local2.v1] = _local2.v1;
_local1[_local2.v2] = _local2.v2;
};
for each (_local3 in _local1) {
_local3.calculateNormal();
};
}
public function get boundingSphere():BoundingSphere{
if (_boundingSphereDirty){
_boundingSphere = BoundingSphere.getFromVertices(vertices);
_boundingSphereDirty = false;
};
return (_boundingSphere);
}
public function clone(_arg1:DisplayObject3D=null):GeometryObject3D{
var _local5:int;
var _local6:MaterialObject3D;
var _local7:Vertex3D;
var _local8:Triangle3D;
var _local9:Vertex3D;
var _local10:Vertex3D;
var _local11:Vertex3D;
var _local2:Dictionary = new Dictionary(true);
var _local3:Dictionary = new Dictionary(true);
var _local4:GeometryObject3D = new GeometryObject3D();
_local4.vertices = new Array();
_local4.faces = new Array();
_local5 = 0;
while (_local5 < this.vertices.length) {
_local7 = this.vertices[_local5];
_local3[_local7] = _local7.clone();
_local4.vertices.push(_local3[_local7]);
_local5++;
};
_local5 = 0;
while (_local5 < this.faces.length) {
_local8 = this.faces[_local5];
_local9 = _local3[_local8.v0];
_local10 = _local3[_local8.v1];
_local11 = _local3[_local8.v2];
_local4.faces.push(new Triangle3D(_arg1, [_local9, _local10, _local11], _local8.material, _local8.uv));
_local2[_local8.material] = _local8.material;
_local5++;
};
for each (_local6 in _local2) {
if (_local6){
_local6.registerObject(_arg1);
};
};
return (_local4);
}
public function get ready():Boolean{
return (_ready);
}
public function get aabb():AxisAlignedBoundingBox{
if (_aabbDirty){
_aabb = AxisAlignedBoundingBox.createFromVertices(vertices);
_aabbDirty = false;
};
return (_aabb);
}
}
}//package org.papervision3d.core.proto
Section 114
//LightObject3D (org.papervision3d.core.proto.LightObject3D)
package org.papervision3d.core.proto {
import org.papervision3d.objects.*;
import org.papervision3d.core.math.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.primitives.*;
public class LightObject3D extends DisplayObject3D {
public var flipped:Boolean;
public var lightMatrix:Matrix3D;
private var _showLight:Boolean;
private var displaySphere:Sphere;
public function LightObject3D(_arg1:Boolean=false, _arg2:Boolean=false){
this.lightMatrix = Matrix3D.IDENTITY;
this.showLight = _arg1;
this.flipped = _arg2;
}
public function get showLight():Boolean{
return (_showLight);
}
public function set showLight(_arg1:Boolean):void{
if (_showLight){
removeChild(displaySphere);
};
if (_arg1){
displaySphere = new Sphere(new WireframeMaterial(0xFFFF00), 10, 3, 2);
addChild(displaySphere);
};
_showLight = _arg1;
}
}
}//package org.papervision3d.core.proto
Section 115
//MaterialObject3D (org.papervision3d.core.proto.MaterialObject3D)
package org.papervision3d.core.proto {
import flash.events.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.render.command.*;
import flash.utils.*;
import org.papervision3d.core.render.material.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.render.draw.*;
public class MaterialObject3D extends EventDispatcher implements ITriangleDrawer {
public var widthOffset:Number;// = 0
public var name:String;
public var heightOffset:Number;// = 0
public var fillAlpha:Number;// = 0
public var fillColor:Number;
public var id:Number;
protected var objects:Dictionary;
public var baked:Boolean;// = false
public var invisible:Boolean;// = false
public var smooth:Boolean;// = false
public var bitmap:BitmapData;
public var lineAlpha:Number;// = 0
public var lineColor:Number;
public var lineThickness:Number;// = 1
public var interactive:Boolean;// = false
public var oneSide:Boolean;// = true
public var opposite:Boolean;// = false
public var maxU:Number;
public var tiled:Boolean;// = false
public var maxV:Number;
public static var DEFAULT_COLOR:int = 0;
public static var DEBUG_COLOR:int = 0xFF00FF;
private static var _totalMaterialObjects:Number = 0;
public function MaterialObject3D(){
lineColor = DEFAULT_COLOR;
fillColor = DEFAULT_COLOR;
super();
this.id = _totalMaterialObjects++;
MaterialManager.registerMaterial(this);
objects = new Dictionary(true);
}
public function getObjectList():Dictionary{
return (objects);
}
override public function toString():String{
return (((((("[MaterialObject3D] bitmap:" + this.bitmap) + " lineColor:") + this.lineColor) + " fillColor:") + fillColor));
}
public function drawRT(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData):void{
}
public function get doubleSided():Boolean{
return (!(this.oneSide));
}
public function unregisterObject(_arg1:DisplayObject3D):void{
if (((objects) && (objects[_arg1]))){
objects[_arg1] = null;
};
}
public function set doubleSided(_arg1:Boolean):void{
this.oneSide = !(_arg1);
}
public function registerObject(_arg1:DisplayObject3D):void{
objects[_arg1] = true;
}
public function updateBitmap():void{
}
public function clone():MaterialObject3D{
var _local1:MaterialObject3D = new MaterialObject3D();
_local1.copy(this);
return (_local1);
}
public function isUpdateable():Boolean{
return (!(baked));
}
public function copy(_arg1:MaterialObject3D):void{
this.bitmap = _arg1.bitmap;
this.smooth = _arg1.smooth;
this.lineColor = _arg1.lineColor;
this.lineAlpha = _arg1.lineAlpha;
this.fillColor = _arg1.fillColor;
this.fillAlpha = _arg1.fillAlpha;
this.oneSide = _arg1.oneSide;
this.opposite = _arg1.opposite;
this.invisible = _arg1.invisible;
this.name = _arg1.name;
this.maxU = _arg1.maxU;
this.maxV = _arg1.maxV;
}
public function destroy():void{
objects = null;
bitmap = null;
MaterialManager.unRegisterMaterial(this);
}
public function drawTriangle(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
}
public static function get DEFAULT():MaterialObject3D{
var _local1:MaterialObject3D = new WireframeMaterial();
_local1.lineColor = (0xFFFFFF * Math.random());
_local1.lineAlpha = 1;
_local1.fillColor = DEFAULT_COLOR;
_local1.fillAlpha = 1;
_local1.doubleSided = false;
return (_local1);
}
public static function get DEBUG():MaterialObject3D{
var _local1:MaterialObject3D = new (MaterialObject3D);
_local1.lineColor = (0xFFFFFF * Math.random());
_local1.lineAlpha = 1;
_local1.fillColor = DEBUG_COLOR;
_local1.fillAlpha = 0.37;
_local1.doubleSided = true;
return (_local1);
}
}
}//package org.papervision3d.core.proto
Section 116
//SceneObject3D (org.papervision3d.core.proto.SceneObject3D)
package org.papervision3d.core.proto {
import org.papervision3d.objects.*;
import org.papervision3d.core.log.*;
import org.papervision3d.materials.utils.*;
import org.papervision3d.*;
public class SceneObject3D extends DisplayObjectContainer3D {
public var objects:Array;
public var materials:MaterialsList;
public function SceneObject3D(){
this.objects = new Array();
this.materials = new MaterialsList();
PaperLogger.info((((((Papervision3D.NAME + " ") + Papervision3D.VERSION) + " (") + Papervision3D.DATE) + ")\n"));
this.root = this;
}
override public function removeChild(_arg1:DisplayObject3D):DisplayObject3D{
super.removeChild(_arg1);
var _local2:int;
while (_local2 < this.objects.length) {
if (this.objects[_local2] === _arg1){
this.objects.splice(_local2, 1);
return (_arg1);
};
_local2++;
};
return (_arg1);
}
override public function addChild(_arg1:DisplayObject3D, _arg2:String=null):DisplayObject3D{
var _local3:DisplayObject3D = super.addChild(_arg1, (_arg2) ? _arg2 : _arg1.name);
_arg1.scene = this;
_arg1.parent = null;
this.objects.push(_local3);
return (_local3);
}
}
}//package org.papervision3d.core.proto
Section 117
//AbstractRenderListItem (org.papervision3d.core.render.command.AbstractRenderListItem)
package org.papervision3d.core.render.command {
import flash.display.*;
import org.papervision3d.core.render.data.*;
public class AbstractRenderListItem implements IRenderListItem {
public var screenZ:Number;
public function render(_arg1:RenderSessionData, _arg2:Graphics):void{
}
}
}//package org.papervision3d.core.render.command
Section 118
//IRenderListItem (org.papervision3d.core.render.command.IRenderListItem)
package org.papervision3d.core.render.command {
import flash.display.*;
import org.papervision3d.core.render.data.*;
public interface IRenderListItem {
function render(_arg1:RenderSessionData, _arg2:Graphics):void;
}
}//package org.papervision3d.core.render.command
Section 119
//RenderableListItem (org.papervision3d.core.render.command.RenderableListItem)
package org.papervision3d.core.render.command {
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
public class RenderableListItem extends AbstractRenderListItem {
public var minX:Number;
public var minY:Number;
public var minZ:Number;
public var area:Number;
public var instance:DisplayObject3D;
public var renderableInstance:AbstractRenderable;
public var renderable:Class;
public var maxX:Number;
public var maxY:Number;
public var maxZ:Number;
public var quadrant:QuadTreeNode;
public function getZ(_arg1:Number, _arg2:Number, _arg3:Number):Number{
return (screenZ);
}
public function update():void{
}
public function hitTestPoint2D(_arg1:Point, _arg2:RenderHitData):RenderHitData{
return (_arg2);
}
public function quarter(_arg1:Number):Array{
return ([]);
}
}
}//package org.papervision3d.core.render.command
Section 120
//RenderLine (org.papervision3d.core.render.command.RenderLine)
package org.papervision3d.core.render.command {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.materials.special.*;
public class RenderLine extends RenderableListItem implements IRenderListItem {
public var size:Number;
private var fbz:Number;
private var db:Number;
private var bzf:Number;
private var axf:Number;
public var v1:Vertex3DInstance;
private var dx:Number;
private var dy:Number;
private var faz:Number;
private var det:Number;
private var ayf:Number;
private var da:Number;
private var ax:Number;
private var ay:Number;
private var az:Number;
public var renderer:LineMaterial;
private var l1:Number2D;
private var l2:Number2D;
private var azf:Number;
private var bxf:Number;
public var cV:Vertex3DInstance;
private var bx:Number;
private var by:Number;
private var bz:Number;
public var length:Number;
private var xfocus:Number;
private var cp3d:Number3D;
private var byf:Number;
private var p:Number2D;
private var v:Number2D;
public var v0:Vertex3DInstance;
public var line:Line3D;
private var yfocus:Number;
private static var mouseVector:Number3D = Number3D.ZERO;
private static var lineVector:Number3D = Number3D.ZERO;
public function RenderLine(_arg1:Line3D){
this.renderable = Line3D;
this.renderableInstance = _arg1;
this.line = _arg1;
this.instance = _arg1.instance;
v0 = _arg1.v0.vertex3DInstance;
v1 = _arg1.v1.vertex3DInstance;
cV = _arg1.cV.vertex3DInstance;
p = new Number2D();
l1 = new Number2D();
l2 = new Number2D();
v = new Number2D();
cp3d = new Number3D();
}
override public function render(_arg1:RenderSessionData, _arg2:Graphics):void{
renderer.drawLine(this, _arg2, _arg1);
}
override public function getZ(_arg1:Number, _arg2:Number, _arg3:Number):Number{
ax = v0.x;
ay = v0.y;
az = v0.z;
bx = v1.x;
by = v1.y;
bz = v1.z;
if ((((ax == _arg1)) && ((ay == _arg2)))){
return (az);
};
if ((((bx == _arg1)) && ((by == _arg2)))){
return (bz);
};
dx = (bx - ax);
dy = (by - ay);
azf = (az / _arg3);
bzf = (bz / _arg3);
faz = (1 + azf);
fbz = (1 + bzf);
xfocus = _arg1;
yfocus = _arg2;
axf = ((ax * faz) - (_arg1 * azf));
bxf = ((bx * fbz) - (_arg1 * bzf));
ayf = ((ay * faz) - (_arg2 * azf));
byf = ((by * fbz) - (_arg2 * bzf));
det = ((dx * (axf - bxf)) + (dy * (ayf - byf)));
db = ((dx * (axf - _arg1)) + (dy * (ayf - _arg2)));
da = ((dx * (_arg1 - bxf)) + (dy * (_arg2 - byf)));
return ((((da * az) + (db * bz)) / det));
}
override public function hitTestPoint2D(_arg1:Point, _arg2:RenderHitData):RenderHitData{
var _local3:Number;
var _local4:Number;
var _local5:Number;
if (renderer.interactive){
_local3 = line.size;
p.reset(_arg1.x, _arg1.y);
l1.reset(line.v0.vertex3DInstance.x, line.v0.vertex3DInstance.y);
l2.reset(line.v1.vertex3DInstance.x, line.v1.vertex3DInstance.y);
v.copyFrom(l2);
v.minusEq(l1);
_local4 = ((((p.x - l1.x) * (l2.x - l1.x)) + ((p.y - l1.y) * (l2.y - l1.y))) / ((v.x * v.x) + (v.y * v.y)));
if ((((_local4 > 0)) && ((_local4 < 1)))){
v.multiplyEq(_local4);
v.plusEq(l1);
v.minusEq(p);
_local5 = ((v.x * v.x) + (v.y * v.y));
if (_local5 < (_local3 * _local3)){
_arg2.displayObject3D = line.instance;
_arg2.material = renderer;
_arg2.renderable = line;
_arg2.hasHit = true;
cp3d.reset((line.v1.x - line.v0.x), (line.v1.y - line.v0.y), (line.v1.x - line.v0.x));
cp3d.x = (cp3d.x * _local4);
cp3d.y = (cp3d.y * _local4);
cp3d.z = (cp3d.z * _local4);
cp3d.x = (cp3d.x + line.v0.x);
cp3d.y = (cp3d.y + line.v0.y);
cp3d.z = (cp3d.z + line.v0.z);
_arg2.x = cp3d.x;
_arg2.y = cp3d.y;
_arg2.z = cp3d.z;
_arg2.u = 0;
_arg2.v = 0;
return (_arg2);
};
};
};
return (_arg2);
}
}
}//package org.papervision3d.core.render.command
Section 121
//RenderParticle (org.papervision3d.core.render.command.RenderParticle)
package org.papervision3d.core.render.command {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.materials.special.*;
public class RenderParticle extends RenderableListItem implements IRenderListItem {
public var renderMat:ParticleMaterial;
public var particle:Particle;
public function RenderParticle(_arg1:Particle){
this.particle = _arg1;
this.renderableInstance = _arg1;
this.renderable = Particle;
this.instance = _arg1.instance;
}
override public function render(_arg1:RenderSessionData, _arg2:Graphics):void{
particle.material.drawParticle(particle, _arg2, _arg1);
}
override public function hitTestPoint2D(_arg1:Point, _arg2:RenderHitData):RenderHitData{
renderMat = particle.material;
if (renderMat.interactive){
if (particle.renderRect.contains(_arg1.x, _arg1.y)){
_arg2.displayObject3D = particle.instance;
_arg2.material = renderMat;
_arg2.renderable = particle;
_arg2.hasHit = true;
_arg2.x = particle.x;
_arg2.y = particle.y;
_arg2.z = particle.z;
_arg2.u = 0;
_arg2.v = 0;
return (_arg2);
};
};
return (_arg2);
}
}
}//package org.papervision3d.core.render.command
Section 122
//RenderTriangle (org.papervision3d.core.render.command.RenderTriangle)
package org.papervision3d.core.render.command {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.render.draw.*;
public class RenderTriangle extends RenderableListItem implements IRenderListItem {
public var triangle:Triangle3D;
private var bzf:Number;
private var axf:Number;
private var det:Number;
private var v12:Vertex3DInstance;
private var faz:Number;
private var position:Number3D;
private var ayf:Number;
private var au:Number;
private var av:Number;
private var ax:Number;
private var ay:Number;
private var az:Number;
private var v20:Vertex3DInstance;
private var fbz:Number;
private var azf:Number;
private var bu:Number;
private var bv:Number;
private var bx:Number;
private var by:Number;
private var bz:Number;
private var fcz:Number;
private var uv01:NumberUV;
private var cu:Number;
private var cv:Number;
private var cx:Number;
private var cy:Number;
private var cz:Number;
public var v0:Vertex3DInstance;
public var v1:Vertex3DInstance;
private var da:Number;
private var db:Number;
private var dc:Number;
public var container:Sprite;
private var uv12:NumberUV;
public var v2:Vertex3DInstance;
private var cxf:Number;
private var uv20:NumberUV;
protected var vx0:Vertex3DInstance;
public var uv0:NumberUV;
public var uv1:NumberUV;
public var uv2:NumberUV;
protected var vx1:Vertex3DInstance;
protected var vx2:Vertex3DInstance;
public var renderer:ITriangleDrawer;
private var cyf:Number;
private var czf:Number;
private var bxf:Number;
protected var vPointL:Vertex3DInstance;
public var renderMat:MaterialObject3D;
private var byf:Number;
private var v01:Vertex3DInstance;
public var create:Function;
protected static var resPA:Vertex3DInstance = new Vertex3DInstance();
protected static var resBA:Vertex3DInstance = new Vertex3DInstance();
protected static var vPoint:Vertex3DInstance = new Vertex3DInstance();
protected static var resRA:Vertex3DInstance = new Vertex3DInstance();
public function RenderTriangle(_arg1:Triangle3D):void{
position = new Number3D();
super();
this.triangle = _arg1;
this.instance = _arg1.instance;
renderableInstance = _arg1;
renderable = Triangle3D;
this.v0 = _arg1.v0.vertex3DInstance;
this.v1 = _arg1.v1.vertex3DInstance;
this.v2 = _arg1.v2.vertex3DInstance;
this.uv0 = _arg1.uv0;
this.uv1 = _arg1.uv1;
this.uv2 = _arg1.uv2;
this.renderer = _arg1.material;
update();
}
private function deepHitTest(_arg1:Triangle3D, _arg2:Vertex3DInstance, _arg3:RenderHitData):RenderHitData{
var _local44:MovieMaterial;
var _local45:Rectangle;
var _local4:Vertex3DInstance = _arg1.v0.vertex3DInstance;
var _local5:Vertex3DInstance = _arg1.v1.vertex3DInstance;
var _local6:Vertex3DInstance = _arg1.v2.vertex3DInstance;
var _local7:Number = (_local6.x - _local4.x);
var _local8:Number = (_local6.y - _local4.y);
var _local9:Number = (_local5.x - _local4.x);
var _local10:Number = (_local5.y - _local4.y);
var _local11:Number = (_arg2.x - _local4.x);
var _local12:Number = (_arg2.y - _local4.y);
var _local13:Number = ((_local7 * _local7) + (_local8 * _local8));
var _local14:Number = ((_local7 * _local9) + (_local8 * _local10));
var _local15:Number = ((_local7 * _local11) + (_local8 * _local12));
var _local16:Number = ((_local9 * _local9) + (_local10 * _local10));
var _local17:Number = ((_local9 * _local11) + (_local10 * _local12));
var _local18:Number = (1 / ((_local13 * _local16) - (_local14 * _local14)));
var _local19:Number = (((_local16 * _local15) - (_local14 * _local17)) * _local18);
var _local20:Number = (((_local13 * _local17) - (_local14 * _local15)) * _local18);
var _local21:Number = (_arg1.v2.x - _arg1.v0.x);
var _local22:Number = (_arg1.v2.y - _arg1.v0.y);
var _local23:Number = (_arg1.v2.z - _arg1.v0.z);
var _local24:Number = (_arg1.v1.x - _arg1.v0.x);
var _local25:Number = (_arg1.v1.y - _arg1.v0.y);
var _local26:Number = (_arg1.v1.z - _arg1.v0.z);
var _local27:Number = ((_arg1.v0.x + (_local21 * _local19)) + (_local24 * _local20));
var _local28:Number = ((_arg1.v0.y + (_local22 * _local19)) + (_local25 * _local20));
var _local29:Number = ((_arg1.v0.z + (_local23 * _local19)) + (_local26 * _local20));
var _local30:Array = _arg1.uv;
var _local31:Number = _local30[0].u;
var _local32:Number = _local30[1].u;
var _local33:Number = _local30[2].u;
var _local34:Number = _local30[0].v;
var _local35:Number = _local30[1].v;
var _local36:Number = _local30[2].v;
var _local37:Number = ((((_local32 - _local31) * _local20) + ((_local33 - _local31) * _local19)) + _local31);
var _local38:Number = ((((_local35 - _local34) * _local20) + ((_local36 - _local34) * _local19)) + _local34);
if (triangle.material){
renderMat = _arg1.material;
} else {
renderMat = _arg1.instance.material;
};
var _local39:BitmapData = renderMat.bitmap;
var _local40:Number = 1;
var _local41:Number = 1;
var _local42:Number = 0;
var _local43:Number = 0;
if ((renderMat is MovieMaterial)){
_local44 = (renderMat as MovieMaterial);
_local45 = _local44.rect;
if (_local45){
_local42 = _local45.x;
_local43 = _local45.y;
_local40 = _local45.width;
_local41 = _local45.height;
};
} else {
if (_local39){
_local40 = (BitmapMaterial.AUTO_MIP_MAPPING) ? renderMat.widthOffset : _local39.width;
_local41 = (BitmapMaterial.AUTO_MIP_MAPPING) ? renderMat.heightOffset : _local39.height;
};
};
_arg3.displayObject3D = _arg1.instance;
_arg3.material = renderMat;
_arg3.renderable = _arg1;
_arg3.hasHit = true;
position.x = _local27;
position.y = _local28;
position.z = _local29;
Matrix3D.multiplyVector(_arg1.instance.world, position);
_arg3.x = position.x;
_arg3.y = position.y;
_arg3.z = position.z;
_arg3.u = ((_local37 * _local40) + _local42);
_arg3.v = ((_local41 - (_local38 * _local41)) + _local43);
return (_arg3);
}
override public function hitTestPoint2D(_arg1:Point, _arg2:RenderHitData):RenderHitData{
renderMat = triangle.material;
if (!renderMat){
renderMat = triangle.instance.material;
};
if (((renderMat) && (renderMat.interactive))){
vPointL = RenderTriangle.vPoint;
vPointL.x = _arg1.x;
vPointL.y = _arg1.y;
vx0 = triangle.v0.vertex3DInstance;
vx1 = triangle.v1.vertex3DInstance;
vx2 = triangle.v2.vertex3DInstance;
if (sameSide(vPointL, vx0, vx1, vx2)){
if (sameSide(vPointL, vx1, vx0, vx2)){
if (sameSide(vPointL, vx2, vx0, vx1)){
return (deepHitTest(triangle, vPointL, _arg2));
};
};
};
};
return (_arg2);
}
public function fivepointcut(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance, _arg5:Vertex3DInstance, _arg6:NumberUV, _arg7:NumberUV, _arg8:NumberUV, _arg9:NumberUV, _arg10:NumberUV):Array{
if (_arg1.distanceSqr(_arg4) < _arg2.distanceSqr(_arg5)){
return ([create(renderableInstance, renderer, _arg1, _arg2, _arg4, _arg6, _arg7, _arg9), create(renderableInstance, renderer, _arg2, _arg3, _arg4, _arg7, _arg8, _arg9), create(renderableInstance, renderer, _arg1, _arg4, _arg5, _arg6, _arg9, _arg10)]);
};
return ([create(renderableInstance, renderer, _arg1, _arg2, _arg5, _arg6, _arg7, _arg10), create(renderableInstance, renderer, _arg2, _arg3, _arg4, _arg7, _arg8, _arg9), create(renderableInstance, renderer, _arg2, _arg4, _arg5, _arg7, _arg9, _arg10)]);
}
override public function render(_arg1:RenderSessionData, _arg2:Graphics):void{
renderer.drawTriangle(this, _arg2, _arg1);
}
final override public function quarter(_arg1:Number):Array{
if (area < 20){
return (null);
};
v01 = Vertex3DInstance.median(v0, v1, _arg1);
v12 = Vertex3DInstance.median(v1, v2, _arg1);
v20 = Vertex3DInstance.median(v2, v0, _arg1);
uv01 = NumberUV.median(uv0, uv1);
uv12 = NumberUV.median(uv1, uv2);
uv20 = NumberUV.median(uv2, uv0);
return ([create(renderableInstance, renderer, v0, v01, v20, uv0, uv01, uv20), create(renderableInstance, renderer, v1, v12, v01, uv1, uv12, uv01), create(renderableInstance, renderer, v2, v20, v12, uv2, uv20, uv12), create(renderableInstance, renderer, v01, v12, v20, uv01, uv12, uv20)]);
}
final override public function getZ(_arg1:Number, _arg2:Number, _arg3:Number):Number{
ax = v0.x;
ay = v0.y;
az = v0.z;
bx = v1.x;
by = v1.y;
bz = v1.z;
cx = v2.x;
cy = v2.y;
cz = v2.z;
if ((((ax == _arg1)) && ((ay == _arg2)))){
return (az);
};
if ((((bx == _arg1)) && ((by == _arg2)))){
return (bz);
};
if ((((cx == _arg1)) && ((cy == _arg2)))){
return (cz);
};
azf = (az / _arg3);
bzf = (bz / _arg3);
czf = (cz / _arg3);
faz = (1 + azf);
fbz = (1 + bzf);
fcz = (1 + czf);
axf = ((ax * faz) - (_arg1 * azf));
bxf = ((bx * fbz) - (_arg1 * bzf));
cxf = ((cx * fcz) - (_arg1 * czf));
ayf = ((ay * faz) - (_arg2 * azf));
byf = ((by * fbz) - (_arg2 * bzf));
cyf = ((cy * fcz) - (_arg2 * czf));
det = (((axf * (byf - cyf)) + (bxf * (cyf - ayf))) + (cxf * (ayf - byf)));
da = (((_arg1 * (byf - cyf)) + (bxf * (cyf - _arg2))) + (cxf * (_arg2 - byf)));
db = (((axf * (_arg2 - cyf)) + (_arg1 * (cyf - ayf))) + (cxf * (ayf - _arg2)));
dc = (((axf * (byf - _arg2)) + (bxf * (_arg2 - ayf))) + (_arg1 * (ayf - byf)));
return (((((da * az) + (db * bz)) + (dc * cz)) / det));
}
override public function update():void{
if (v0.x > v1.x){
if (v0.x > v2.x){
maxX = v0.x;
} else {
maxX = v2.x;
};
} else {
if (v1.x > v2.x){
maxX = v1.x;
} else {
maxX = v2.x;
};
};
if (v0.x < v1.x){
if (v0.x < v2.x){
minX = v0.x;
} else {
minX = v2.x;
};
} else {
if (v1.x < v2.x){
minX = v1.x;
} else {
minX = v2.x;
};
};
if (v0.y > v1.y){
if (v0.y > v2.y){
maxY = v0.y;
} else {
maxY = v2.y;
};
} else {
if (v1.y > v2.y){
maxY = v1.y;
} else {
maxY = v2.y;
};
};
if (v0.y < v1.y){
if (v0.y < v2.y){
minY = v0.y;
} else {
minY = v2.y;
};
} else {
if (v1.y < v2.y){
minY = v1.y;
} else {
minY = v2.y;
};
};
if (v0.z > v1.z){
if (v0.z > v2.z){
maxZ = v0.z;
} else {
maxZ = v2.z;
};
} else {
if (v1.z > v2.z){
maxZ = v1.z;
} else {
maxZ = v2.z;
};
};
if (v0.z < v1.z){
if (v0.z < v2.z){
minZ = v0.z;
} else {
minZ = v2.z;
};
} else {
if (v1.z < v2.z){
minZ = v1.z;
} else {
minZ = v2.z;
};
};
screenZ = (((v0.z + v1.z) + v2.z) / 3);
area = (0.5 * (((v0.x * (v2.y - v1.y)) + (v1.x * (v0.y - v2.y))) + (v2.x * (v1.y - v0.y))));
}
public function sameSide(_arg1:Vertex3DInstance, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance):Boolean{
Vertex3DInstance.subTo(_arg4, _arg3, resBA);
Vertex3DInstance.subTo(_arg1, _arg3, resPA);
Vertex3DInstance.subTo(_arg2, _arg3, resRA);
return (((Vertex3DInstance.cross(resBA, resPA) * Vertex3DInstance.cross(resBA, resRA)) >= 0));
}
}
}//package org.papervision3d.core.render.command
Section 123
//QuadTree (org.papervision3d.core.render.data.QuadTree)
package org.papervision3d.core.render.data {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.clipping.draw.*;
public final class QuadTree {
private var _root:QuadTreeNode;
private var _rect:RectangleClipping;
private var _result:Array;
private var _maxlevel:uint;// = 4
private var _maxX:Number;
private var _maxY:Number;
private var _child:RenderableListItem;
private var _children:Array;
private var _minX:Number;
private var _minY:Number;
private var i:int;
private var _clip:Clipping;
private var _center:Array;
private var _except:DisplayObject3D;
public function get maxLevel():uint{
return (_maxlevel);
}
public function remove(_arg1:RenderableListItem):void{
_center = _arg1.quadrant.center;
_center.splice(_center.indexOf(_arg1), 1);
}
public function set maxLevel(_arg1:uint):void{
_maxlevel = _arg1;
if (_root){
_root.maxlevel = _maxlevel;
};
}
public function getOverlaps(_arg1:RenderableListItem, _arg2:DisplayObject3D=null):Array{
_result = [];
_minX = _arg1.minX;
_minY = _arg1.minY;
_maxX = _arg1.maxX;
_maxY = _arg1.maxY;
_except = _arg2;
getList(_arg1.quadrant);
getParent(_arg1.quadrant);
return (_result);
}
public function get clip():Clipping{
return (_clip);
}
public function render(_arg1:RenderSessionData, _arg2:Graphics):void{
_root.render(-(Infinity), _arg1, _arg2);
}
public function list():Array{
_result = [];
_minX = -1000000;
_minY = -1000000;
_maxX = 1000000;
_maxY = 1000000;
_except = null;
getList(_root);
return (_result);
}
public function getRoot():QuadTreeNode{
return (_root);
}
private function getList(_arg1:QuadTreeNode):void{
if (!_arg1){
return;
};
if (((_arg1.onlysourceFlag) && ((_except == _arg1.onlysource)))){
return;
};
if (_minX < _arg1.xdiv){
if (((_arg1.lefttopFlag) && ((_minY < _arg1.ydiv)))){
getList(_arg1.lefttop);
};
if (((_arg1.leftbottomFlag) && ((_maxY > _arg1.ydiv)))){
getList(_arg1.leftbottom);
};
};
if (_maxX > _arg1.xdiv){
if (((_arg1.righttopFlag) && ((_minY < _arg1.ydiv)))){
getList(_arg1.righttop);
};
if (((_arg1.rightbottomFlag) && ((_maxY > _arg1.ydiv)))){
getList(_arg1.rightbottom);
};
};
_children = _arg1.center;
if (_children != null){
i = _children.length;
while (i--) {
_child = _children[i];
if ((((((((((((_except == null)) || (!((_child.instance == _except))))) && ((_child.maxX > _minX)))) && ((_child.minX < _maxX)))) && ((_child.maxY > _minY)))) && ((_child.minY < _maxY)))){
_result.push(_child);
};
};
};
}
private function getParent(_arg1:QuadTreeNode=null):void{
if (!_arg1){
return;
};
_arg1 = _arg1.parent;
if ((((_arg1 == null)) || (((_arg1.onlysourceFlag) && ((_except == _arg1.onlysource)))))){
return;
};
_children = _arg1.center;
if (_children != null){
i = _children.length;
while (i--) {
_child = _children[i];
if ((((((((((((_except == null)) || (!((_child.instance == _except))))) && ((_child.maxX > _minX)))) && ((_child.minX < _maxX)))) && ((_child.maxY > _minY)))) && ((_child.minY < _maxY)))){
_result.push(_child);
};
};
};
getParent(_arg1);
}
public function add(_arg1:RenderableListItem):void{
if (_clip.check(_arg1)){
_root.push(_arg1);
};
}
public function set clip(_arg1:Clipping):void{
_clip = _arg1;
_rect = _clip.asRectangleClipping();
if (!_root){
_root = new QuadTreeNode(((_rect.minX + _rect.maxX) / 2), ((_rect.minY + _rect.maxY) / 2), (_rect.maxX - _rect.minX), (_rect.maxY - _rect.minY), 0, null, _maxlevel);
} else {
_root.reset(((_rect.minX + _rect.maxX) / 2), ((_rect.minY + _rect.maxY) / 2), (_rect.maxX - _rect.minX), (_rect.maxY - _rect.minY), _maxlevel);
};
}
}
}//package org.papervision3d.core.render.data
Section 124
//QuadTreeNode (org.papervision3d.core.render.data.QuadTreeNode)
package org.papervision3d.core.render.data {
import flash.display.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.render.command.*;
public final class QuadTreeNode {
public var parent:QuadTreeNode;
public var create:Function;
private var level:int;
public var righttopFlag:Boolean;
public var hasContent:Boolean;// = false
public var rightbottom:QuadTreeNode;
public var righttop:QuadTreeNode;
public var rightbottomFlag:Boolean;
public var onlysource:DisplayObject3D;
public var xdiv:Number;
private var halfheight:Number;
public var center:Array;
public var maxlevel:int;// = 4
private var render_center_length:int;// = -1
public var onlysourceFlag:Boolean;// = true
private var render_center_index:int;// = -1
private var halfwidth:Number;
public var lefttop:QuadTreeNode;
public var ydiv:Number;
public var leftbottom:QuadTreeNode;
public var lefttopFlag:Boolean;
public var leftbottomFlag:Boolean;
public function QuadTreeNode(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:int, _arg6:QuadTreeNode=null, _arg7:uint=4){
this.level = _arg5;
this.xdiv = _arg1;
this.ydiv = _arg2;
halfwidth = (_arg3 / 2);
halfheight = (_arg4 / 2);
this.parent = _arg6;
this.maxlevel = _arg7;
}
public function reset(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number, _arg5:uint):void{
this.xdiv = _arg1;
this.ydiv = _arg2;
halfwidth = (_arg3 / 2);
halfheight = (_arg4 / 2);
lefttopFlag = false;
leftbottomFlag = false;
righttopFlag = false;
rightbottomFlag = false;
onlysourceFlag = true;
onlysource = null;
render_center_length = -1;
render_center_index = -1;
hasContent = false;
maxlevel = _arg5;
}
public function push(_arg1:RenderableListItem):void{
hasContent = true;
if (onlysourceFlag){
if (((!((onlysource == null))) && (!((onlysource == _arg1.instance))))){
onlysourceFlag = false;
};
onlysource = _arg1.instance;
};
if (level < maxlevel){
if (_arg1.maxX <= xdiv){
if (_arg1.maxY <= ydiv){
if (lefttop == null){
lefttopFlag = true;
lefttop = new QuadTreeNode((xdiv - (halfwidth / 2)), (ydiv - (halfheight / 2)), halfwidth, halfheight, (level + 1), this, maxlevel);
} else {
if (!lefttopFlag){
lefttopFlag = true;
lefttop.reset((xdiv - (halfwidth / 2)), (ydiv - (halfheight / 2)), halfwidth, halfheight, maxlevel);
};
};
lefttop.push(_arg1);
return;
} else {
if (_arg1.minY >= ydiv){
if (leftbottom == null){
leftbottomFlag = true;
leftbottom = new QuadTreeNode((xdiv - (halfwidth / 2)), (ydiv + (halfheight / 2)), halfwidth, halfheight, (level + 1), this, maxlevel);
} else {
if (!leftbottomFlag){
leftbottomFlag = true;
leftbottom.reset((xdiv - (halfwidth / 2)), (ydiv + (halfheight / 2)), halfwidth, halfheight, maxlevel);
};
};
leftbottom.push(_arg1);
return;
};
};
} else {
if (_arg1.minX >= xdiv){
if (_arg1.maxY <= ydiv){
if (righttop == null){
righttopFlag = true;
righttop = new QuadTreeNode((xdiv + (halfwidth / 2)), (ydiv - (halfheight / 2)), halfwidth, halfheight, (level + 1), this, maxlevel);
} else {
if (!righttopFlag){
righttopFlag = true;
righttop.reset((xdiv + (halfwidth / 2)), (ydiv - (halfheight / 2)), halfwidth, halfheight, maxlevel);
};
};
righttop.push(_arg1);
return;
} else {
if (_arg1.minY >= ydiv){
if (rightbottom == null){
rightbottomFlag = true;
rightbottom = new QuadTreeNode((xdiv + (halfwidth / 2)), (ydiv + (halfheight / 2)), halfwidth, halfheight, (level + 1), this, maxlevel);
} else {
if (!rightbottomFlag){
rightbottomFlag = true;
rightbottom.reset((xdiv + (halfwidth / 2)), (ydiv + (halfheight / 2)), halfwidth, halfheight, maxlevel);
};
};
rightbottom.push(_arg1);
return;
};
};
};
};
};
if (center == null){
center = new Array();
};
center.push(_arg1);
_arg1.quadrant = this;
}
public function render(_arg1:Number, _arg2:RenderSessionData, _arg3:Graphics):void{
var _local4:RenderableListItem;
if (render_center_length == -1){
if (center != null){
render_center_length = center.length;
if (render_center_length > 1){
center.sortOn("screenZ", (Array.DESCENDING | Array.NUMERIC));
};
} else {
render_center_length = 0;
};
render_center_index = 0;
};
while (render_center_index < render_center_length) {
_local4 = center[render_center_index];
if (_local4.screenZ < _arg1){
break;
};
render_other(_local4.screenZ, _arg2, _arg3);
_local4.render(_arg2, _arg3);
_arg2.viewPort.lastRenderList.push(_local4);
render_center_index++;
};
if (render_center_index == render_center_length){
center = null;
};
render_other(_arg1, _arg2, _arg3);
}
public function getRect():Rectangle{
return (new Rectangle(xdiv, ydiv, (halfwidth * 2), (halfheight * 2)));
}
private function render_other(_arg1:Number, _arg2:RenderSessionData, _arg3:Graphics):void{
if (lefttopFlag){
lefttop.render(_arg1, _arg2, _arg3);
};
if (leftbottomFlag){
leftbottom.render(_arg1, _arg2, _arg3);
};
if (righttopFlag){
righttop.render(_arg1, _arg2, _arg3);
};
if (rightbottomFlag){
rightbottom.render(_arg1, _arg2, _arg3);
};
}
}
}//package org.papervision3d.core.render.data
Section 125
//RenderHitData (org.papervision3d.core.render.data.RenderHitData)
package org.papervision3d.core.render.data {
import org.papervision3d.objects.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
public class RenderHitData {
public var y:Number;
public var z:Number;
public var endTime:int;// = 0
public var startTime:int;// = 0
public var displayObject3D:DisplayObject3D;
public var hasHit:Boolean;// = false
public var material:MaterialObject3D;
public var renderable:IRenderable;
public var u:Number;
public var v:Number;
public var x:Number;
public function RenderHitData():void{
}
public function clear():void{
startTime = 0;
endTime = 0;
hasHit = false;
displayObject3D = null;
material = null;
renderable = null;
u = 0;
v = 0;
x = 0;
y = 0;
z = 0;
}
public function clone():RenderHitData{
var _local1:RenderHitData = new RenderHitData();
_local1.startTime = startTime;
_local1.endTime = endTime;
_local1.hasHit = hasHit;
_local1.displayObject3D = displayObject3D;
_local1.material = material;
_local1.renderable = renderable;
_local1.u = u;
_local1.v = v;
_local1.x = x;
_local1.y = y;
_local1.z = z;
return (_local1);
}
public function toString():String{
return (((displayObject3D + " ") + renderable));
}
}
}//package org.papervision3d.core.render.data
Section 126
//RenderSessionData (org.papervision3d.core.render.data.RenderSessionData)
package org.papervision3d.core.render.data {
import flash.display.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.view.*;
import org.papervision3d.core.render.*;
import org.papervision3d.core.clipping.*;
public class RenderSessionData {
public var container:Sprite;
public var renderer:IRenderEngine;
public var particleCuller:IParticleCuller;
public var viewPort:Viewport3D;
public var triangleCuller:ITriangleCuller;
public var clipping:DefaultClipping;
public var scene:SceneObject3D;
public var renderStatistics:RenderStatistics;
public var renderObjects:Array;
public var camera:CameraObject3D;
public var renderLayers:Array;
public var quadrantTree:QuadTree;
public var sorted:Boolean;
public function RenderSessionData():void{
this.renderStatistics = new RenderStatistics();
}
public function destroy():void{
triangleCuller = null;
particleCuller = null;
viewPort = null;
container = null;
scene = null;
camera = null;
renderer = null;
renderStatistics = null;
renderObjects = null;
renderLayers = null;
clipping = null;
quadrantTree = null;
}
public function clone():RenderSessionData{
var _local1:RenderSessionData = new RenderSessionData();
_local1.triangleCuller = triangleCuller;
_local1.particleCuller = particleCuller;
_local1.viewPort = viewPort;
_local1.container = container;
_local1.scene = scene;
_local1.camera = camera;
_local1.renderer = renderer;
_local1.renderStatistics = renderStatistics.clone();
_local1.clipping = clipping;
_local1.quadrantTree = quadrantTree;
return (_local1);
}
}
}//package org.papervision3d.core.render.data
Section 127
//RenderStatistics (org.papervision3d.core.render.data.RenderStatistics)
package org.papervision3d.core.render.data {
public class RenderStatistics {
public var renderTime:int;// = 0
public var culledObjects:int;// = 0
public var shadedTriangles:int;// = 0
public var culledParticles:int;// = 0
public var culledTriangles:int;// = 0
public var triangles:int;// = 0
public var particles:int;// = 0
public var rendered:int;// = 0
public var projectionTime:int;// = 0
public var filteredObjects:int;// = 0
public var lines:int;// = 0
public function clear():void{
projectionTime = 0;
renderTime = 0;
rendered = 0;
particles = 0;
triangles = 0;
culledTriangles = 0;
culledParticles = 0;
lines = 0;
shadedTriangles = 0;
filteredObjects = 0;
culledObjects = 0;
}
public function clone():RenderStatistics{
var _local1:RenderStatistics = new RenderStatistics();
_local1.projectionTime = projectionTime;
_local1.renderTime = renderTime;
_local1.rendered = rendered;
_local1.particles = particles;
_local1.triangles = triangles;
_local1.culledTriangles = culledTriangles;
_local1.lines = lines;
_local1.shadedTriangles = shadedTriangles;
_local1.filteredObjects = filteredObjects;
_local1.culledObjects = culledObjects;
return (_local1);
}
public function toString():String{
return (new String((((((((((((((((((("ProjectionTime:" + projectionTime) + " RenderTime:") + renderTime) + " Particles:") + particles) + " CulledParticles :") + culledParticles) + " Triangles:") + triangles) + " ShadedTriangles :") + shadedTriangles) + " CulledTriangles:") + culledTriangles) + " FilteredObjects:") + filteredObjects) + " CulledObjects:") + culledObjects) + "")));
}
}
}//package org.papervision3d.core.render.data
Section 128
//ILineDrawer (org.papervision3d.core.render.draw.ILineDrawer)
package org.papervision3d.core.render.draw {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
public interface ILineDrawer {
function drawLine(_arg1:RenderLine, _arg2:Graphics, _arg3:RenderSessionData):void;
}
}//package org.papervision3d.core.render.draw
Section 129
//IParticleDrawer (org.papervision3d.core.render.draw.IParticleDrawer)
package org.papervision3d.core.render.draw {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.geom.renderables.*;
public interface IParticleDrawer {
function drawParticle(_arg1:Particle, _arg2:Graphics, _arg3:RenderSessionData):void;
function updateRenderRect(_arg1:Particle):void;
}
}//package org.papervision3d.core.render.draw
Section 130
//ITriangleDrawer (org.papervision3d.core.render.draw.ITriangleDrawer)
package org.papervision3d.core.render.draw {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.render.command.*;
public interface ITriangleDrawer {
function drawTriangle(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void;
function drawRT(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData):void;
}
}//package org.papervision3d.core.render.draw
Section 131
//BasicRenderFilter (org.papervision3d.core.render.filter.BasicRenderFilter)
package org.papervision3d.core.render.filter {
public class BasicRenderFilter implements IRenderFilter {
public function filter(_arg1:Array):int{
return (0);
}
}
}//package org.papervision3d.core.render.filter
Section 132
//IRenderFilter (org.papervision3d.core.render.filter.IRenderFilter)
package org.papervision3d.core.render.filter {
public interface IRenderFilter {
function filter(_arg1:Array):int;
}
}//package org.papervision3d.core.render.filter
Section 133
//IUpdateAfterMaterial (org.papervision3d.core.render.material.IUpdateAfterMaterial)
package org.papervision3d.core.render.material {
import org.papervision3d.core.render.data.*;
public interface IUpdateAfterMaterial {
function updateAfterRender(_arg1:RenderSessionData):void;
}
}//package org.papervision3d.core.render.material
Section 134
//IUpdateBeforeMaterial (org.papervision3d.core.render.material.IUpdateBeforeMaterial)
package org.papervision3d.core.render.material {
import org.papervision3d.core.render.data.*;
public interface IUpdateBeforeMaterial {
function isUpdateable():Boolean;
function updateBeforeRender(_arg1:RenderSessionData):void;
}
}//package org.papervision3d.core.render.material
Section 135
//MaterialManager (org.papervision3d.core.render.material.MaterialManager)
package org.papervision3d.core.render.material {
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.proto.*;
import flash.utils.*;
public class MaterialManager {
private var materials:Dictionary;
private static var instance:MaterialManager;
public function MaterialManager():void{
if (instance){
throw (new Error("Only 1 instance of materialmanager allowed"));
};
init();
}
private function init():void{
materials = new Dictionary(true);
}
private function _unRegisterMaterial(_arg1:MaterialObject3D):void{
delete materials[_arg1];
}
public function updateMaterialsAfterRender(_arg1:RenderSessionData):void{
var _local2:IUpdateAfterMaterial;
var _local3:*;
for (_local3 in materials) {
if ((_local3 is IUpdateAfterMaterial)){
_local2 = (_local3 as IUpdateAfterMaterial);
_local2.updateAfterRender(_arg1);
};
};
}
private function _registerMaterial(_arg1:MaterialObject3D):void{
materials[_arg1] = true;
}
public function updateMaterialsBeforeRender(_arg1:RenderSessionData):void{
var _local2:IUpdateBeforeMaterial;
var _local3:*;
for (_local3 in materials) {
if ((_local3 is IUpdateBeforeMaterial)){
_local2 = (_local3 as IUpdateBeforeMaterial);
if (_local2.isUpdateable()){
_local2.updateBeforeRender(_arg1);
};
};
};
}
public static function getInstance():MaterialManager{
if (!instance){
instance = new (MaterialManager);
};
return (instance);
}
public static function unRegisterMaterial(_arg1:MaterialObject3D):void{
getInstance()._unRegisterMaterial(_arg1);
}
public static function registerMaterial(_arg1:MaterialObject3D):void{
getInstance()._registerMaterial(_arg1);
}
}
}//package org.papervision3d.core.render.material
Section 136
//BasicProjectionPipeline (org.papervision3d.core.render.project.BasicProjectionPipeline)
package org.papervision3d.core.render.project {
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
public class BasicProjectionPipeline extends ProjectionPipeline {
public function BasicProjectionPipeline(){
init();
}
protected function init():void{
}
override public function project(_arg1:RenderSessionData):void{
var _local3:DisplayObject3D;
var _local5:Number;
_arg1.camera.transformView();
var _local2:Array = _arg1.renderObjects;
var _local4:Number = _local2.length;
if (_arg1.camera.useProjectionMatrix){
for each (_local3 in _local2) {
if (_local3.visible){
if (_arg1.viewPort.viewportObjectFilter){
_local5 = _arg1.viewPort.viewportObjectFilter.testObject(_local3);
if (_local5){
projectObject(_local3, _arg1, _local5);
} else {
_arg1.renderStatistics.filteredObjects++;
};
} else {
projectObject(_local3, _arg1, 1);
};
};
};
} else {
for each (_local3 in _local2) {
if (_local3.visible){
if (_arg1.viewPort.viewportObjectFilter){
_local5 = _arg1.viewPort.viewportObjectFilter.testObject(_local3);
if (_local5){
projectObject(_local3, _arg1, _local5);
} else {
_arg1.renderStatistics.filteredObjects++;
};
} else {
projectObject(_local3, _arg1, 1);
};
};
};
};
}
protected function projectObject(_arg1:DisplayObject3D, _arg2:RenderSessionData, _arg3:Number):void{
_arg1.cullTest = _arg3;
if (_arg1.parent){
_arg1.project((_arg1.parent as DisplayObject3D), _arg2);
} else {
_arg1.project(_arg2.camera, _arg2);
};
}
}
}//package org.papervision3d.core.render.project
Section 137
//ProjectionPipeline (org.papervision3d.core.render.project.ProjectionPipeline)
package org.papervision3d.core.render.project {
import org.papervision3d.core.render.data.*;
public class ProjectionPipeline {
public function project(_arg1:RenderSessionData):void{
}
}
}//package org.papervision3d.core.render.project
Section 138
//IShaderRenderer (org.papervision3d.core.render.shader.IShaderRenderer)
package org.papervision3d.core.render.shader {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.materials.shaders.*;
public interface IShaderRenderer {
function destroy():void;
function getLayerForShader(_arg1:Shader):Sprite;
function clear():void;
function render(_arg1:RenderSessionData):void;
}
}//package org.papervision3d.core.render.shader
Section 139
//ShaderObjectData (org.papervision3d.core.render.shader.ShaderObjectData)
package org.papervision3d.core.render.shader {
import flash.display.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import flash.utils.*;
import org.papervision3d.materials.*;
import org.papervision3d.materials.shaders.*;
public class ShaderObjectData {
public var shaderRenderer:ShaderRenderer;
public var triangleUVS:Dictionary;
public var renderTriangleUVS:Dictionary;
public var lightMatrices:Dictionary;
public var shadedMaterial:ShadedMaterial;
public var uvMatrices:Dictionary;
private var origin:Point;
public var material:BitmapMaterial;
public var triangleRects:Dictionary;
protected var triangleBitmaps:Dictionary;
public var object:DisplayObject3D;
public function ShaderObjectData(_arg1:DisplayObject3D, _arg2:BitmapMaterial, _arg3:ShadedMaterial):void{
origin = new Point(0, 0);
super();
shaderRenderer = new ShaderRenderer();
lightMatrices = new Dictionary();
uvMatrices = new Dictionary();
this.object = _arg1;
this.material = _arg2;
this.shadedMaterial = _arg3;
triangleUVS = new Dictionary();
renderTriangleUVS = new Dictionary();
triangleBitmaps = new Dictionary();
triangleRects = new Dictionary();
}
public function getPerTriUVForDraw(_arg1:Triangle3D):Matrix{
var _local2:Matrix;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Rectangle;
if (!triangleUVS[_arg1]){
_local2 = (triangleUVS[_arg1] = new Matrix());
_local3 = material.bitmap.width;
_local4 = material.bitmap.height;
_local5 = (_arg1.uv[0].u * _local3);
_local6 = ((1 - _arg1.uv[0].v) * _local4);
_local7 = (_arg1.uv[1].u * _local3);
_local8 = ((1 - _arg1.uv[1].v) * _local4);
_local9 = (_arg1.uv[2].u * _local3);
_local10 = ((1 - _arg1.uv[2].v) * _local4);
_local11 = getRectFor(_arg1);
_local2.tx = (_local5 - _local11.x);
_local2.ty = (_local6 - _local11.y);
_local2.a = (_local7 - _local5);
_local2.b = (_local8 - _local6);
_local2.c = (_local9 - _local5);
_local2.d = (_local10 - _local6);
_local2.invert();
};
return (triangleUVS[_arg1]);
}
public function getRectFor(_arg1:Triangle3D):Rectangle{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Number;
if (!triangleRects[_arg1]){
_local2 = material.bitmap.width;
_local3 = material.bitmap.height;
_local4 = (_arg1.uv[0].u * _local2);
_local5 = ((1 - _arg1.uv[0].v) * _local3);
_local6 = (_arg1.uv[1].u * _local2);
_local7 = ((1 - _arg1.uv[1].v) * _local3);
_local8 = (_arg1.uv[2].u * _local2);
_local9 = ((1 - _arg1.uv[2].v) * _local3);
_local10 = Math.min(Math.min(_local4, _local6), _local8);
_local11 = Math.min(Math.min(_local5, _local7), _local9);
_local12 = Math.max(Math.max(_local4, _local6), _local8);
_local13 = Math.max(Math.max(_local5, _local7), _local9);
_local14 = (_local12 - _local10);
_local15 = (_local13 - _local11);
if (_local14 <= 0){
_local14 = 1;
};
if (_local15 <= 0){
_local15 = 1;
};
return ((triangleRects[_arg1] = new Rectangle(_local10, _local11, _local14, _local15)));
};
return (triangleRects[_arg1]);
}
private function perturbUVMatrix(_arg1:Matrix, _arg2:Triangle3D, _arg3:Number=2):void{
var _local4:Number = material.bitmap.width;
var _local5:Number = material.bitmap.height;
var _local6:Number = _arg2.uv[0].u;
var _local7:Number = (1 - _arg2.uv[0].v);
var _local8:Number = _arg2.uv[1].u;
var _local9:Number = (1 - _arg2.uv[1].v);
var _local10:Number = _arg2.uv[2].u;
var _local11:Number = (1 - _arg2.uv[2].v);
var _local12:Number = (_local6 * _local4);
var _local13:Number = (_local7 * _local5);
var _local14:Number = (_local8 * _local4);
var _local15:Number = (_local9 * _local5);
var _local16:Number = (_local10 * _local4);
var _local17:Number = (_local11 * _local5);
var _local18:Number = (((_local10 + _local8) + _local6) / 3);
var _local19:Number = (((_local11 + _local9) + _local7) / 3);
var _local20:Number = (_local6 - _local18);
var _local21:Number = (_local7 - _local19);
var _local22:Number = (_local8 - _local18);
var _local23:Number = (_local9 - _local19);
var _local24:Number = (_local10 - _local18);
var _local25:Number = (_local11 - _local19);
var _local26:Number = ((_local20)<0) ? -(_local20) : _local20;
var _local27:Number = ((_local21)<0) ? -(_local21) : _local21;
var _local28:Number = ((_local22)<0) ? -(_local22) : _local22;
var _local29:Number = ((_local23)<0) ? -(_local23) : _local23;
var _local30:Number = ((_local24)<0) ? -(_local24) : _local24;
var _local31:Number = ((_local25)<0) ? -(_local25) : _local25;
var _local32:Number = ((_local26)>_local27) ? (1 / _local26) : (1 / _local27);
var _local33:Number = ((_local28)>_local29) ? (1 / _local28) : (1 / _local29);
var _local34:Number = ((_local30)>_local31) ? (1 / _local30) : (1 / _local31);
_local12 = (_local12 - ((-(_local20) * _local32) * _arg3));
_local13 = (_local13 - ((-(_local21) * _local32) * _arg3));
_local14 = (_local14 - ((-(_local22) * _local33) * _arg3));
_local15 = (_local15 - ((-(_local23) * _local33) * _arg3));
_local16 = (_local16 - ((-(_local24) * _local34) * _arg3));
_local17 = (_local17 - ((-(_local25) * _local34) * _arg3));
_arg1.tx = _local12;
_arg1.ty = _local13;
_arg1.a = (_local14 - _local12);
_arg1.b = (_local15 - _local13);
_arg1.c = (_local16 - _local12);
_arg1.d = (_local17 - _local13);
}
public function getOutputBitmapFor(_arg1:Triangle3D):BitmapData{
var _local2:Rectangle;
var _local3:BitmapData;
var _local4:Rectangle;
if (!triangleBitmaps[_arg1]){
_local2 = getRectFor(_arg1);
_local3 = (triangleBitmaps[_arg1] = new BitmapData(Math.ceil(_local2.width), Math.ceil(_local2.height), false, 0));
_local4 = new Rectangle(0, 0, _local3.width, _local3.height);
_local3.copyPixels(material.bitmap, _local4, origin);
} else {
_local2 = getRectFor(_arg1);
};
if (((material.bitmap) && (_local2))){
triangleBitmaps[_arg1].copyPixels(material.bitmap, _local2, origin);
};
return (triangleBitmaps[_arg1]);
}
public function updateBeforeRender():void{
}
public function getPerTriUVForShader(_arg1:Triangle3D):Matrix{
var _local2:Matrix;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Rectangle;
if (!renderTriangleUVS[_arg1]){
_local2 = (renderTriangleUVS[_arg1] = new Matrix());
_local3 = material.bitmap.width;
_local4 = material.bitmap.height;
_local5 = (_arg1.uv[0].u * _local3);
_local6 = ((1 - _arg1.uv[0].v) * _local4);
_local7 = (_arg1.uv[1].u * _local3);
_local8 = ((1 - _arg1.uv[1].v) * _local4);
_local9 = (_arg1.uv[2].u * _local3);
_local10 = ((1 - _arg1.uv[2].v) * _local4);
_local11 = getRectFor(_arg1);
_local2.tx = (_local5 - _local11.x);
_local2.ty = (_local6 - _local11.y);
_local2.a = (_local7 - _local5);
_local2.b = (_local8 - _local6);
_local2.c = (_local9 - _local5);
_local2.d = (_local10 - _local6);
};
return (renderTriangleUVS[_arg1]);
}
public function getUVMatrixForTriangle(_arg1:Triangle3D, _arg2:Boolean=false):Matrix{
var _local3:Matrix;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
_local3 = uvMatrices[_arg1];
if (!_local3){
_local3 = new Matrix();
if (_arg2){
perturbUVMatrix(_local3, _arg1, 2);
} else {
if (material.bitmap){
_local4 = material.bitmap.width;
_local5 = material.bitmap.height;
_local6 = (_arg1.uv[0].u * _local4);
_local7 = ((1 - _arg1.uv[0].v) * _local5);
_local8 = (_arg1.uv[1].u * _local4);
_local9 = ((1 - _arg1.uv[1].v) * _local5);
_local10 = (_arg1.uv[2].u * _local4);
_local11 = ((1 - _arg1.uv[2].v) * _local5);
_local3.tx = _local6;
_local3.ty = _local7;
_local3.a = (_local8 - _local6);
_local3.b = (_local9 - _local7);
_local3.c = (_local10 - _local6);
_local3.d = (_local11 - _local7);
};
};
if (material.bitmap){
uvMatrices[_arg1] = _local3;
};
};
return (_local3);
}
public function destroy():void{
var _local1:Object;
for each (_local1 in uvMatrices) {
uvMatrices[_local1] = null;
};
uvMatrices = null;
shaderRenderer.destroy();
shaderRenderer = null;
lightMatrices = null;
}
}
}//package org.papervision3d.core.render.shader
Section 140
//ShaderRenderer (org.papervision3d.core.render.shader.ShaderRenderer)
package org.papervision3d.core.render.shader {
import flash.events.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import flash.utils.*;
import org.papervision3d.materials.shaders.*;
public class ShaderRenderer extends EventDispatcher implements IShaderRenderer {
public var container:Sprite;
public var shadeLayers:Dictionary;
public var outputBitmap:BitmapData;
public var bitmapContainer:Bitmap;
public var resizedInput:Boolean;// = false
public var bitmapLayer:Sprite;
private var _inputBitmapData:BitmapData;
public function ShaderRenderer(){
container = new Sprite();
bitmapLayer = new Sprite();
bitmapContainer = new Bitmap();
bitmapLayer.addChild(bitmapContainer);
bitmapLayer.blendMode = BlendMode.NORMAL;
shadeLayers = new Dictionary();
container.addChild(bitmapLayer);
}
public function clear():void{
var _local1:Sprite;
for each (_local1 in shadeLayers) {
if (((((inputBitmap) && ((inputBitmap.width > 0)))) && ((inputBitmap.height > 0)))){
_local1.graphics.clear();
_local1.graphics.beginFill(0, 1);
_local1.graphics.drawRect(0, 0, inputBitmap.width, inputBitmap.height);
_local1.graphics.endFill();
};
};
}
public function render(_arg1:RenderSessionData):void{
if (outputBitmap){
outputBitmap.fillRect(outputBitmap.rect, 0);
bitmapContainer.bitmapData = inputBitmap;
outputBitmap.draw(container, null, null, null, outputBitmap.rect, false);
if (outputBitmap.transparent){
outputBitmap.copyChannel(inputBitmap, outputBitmap.rect, new Point(0, 0), BitmapDataChannel.ALPHA, BitmapDataChannel.ALPHA);
};
};
}
public function get inputBitmap():BitmapData{
return (_inputBitmapData);
}
public function set inputBitmap(_arg1:BitmapData):void{
if (_arg1 != null){
if (_inputBitmapData != _arg1){
_inputBitmapData = _arg1;
if (outputBitmap){
if (((!((_inputBitmapData.width == outputBitmap.width))) || (!((_inputBitmapData.height == outputBitmap.height))))){
resizedInput = true;
outputBitmap.dispose();
outputBitmap = _inputBitmapData.clone();
};
} else {
resizedInput = true;
outputBitmap = _inputBitmapData.clone();
};
};
};
}
public function getLayerForShader(_arg1:Shader):Sprite{
var _local2:Sprite = new Sprite();
shadeLayers[_arg1] = _local2;
var _local3:Sprite = new Sprite();
_local2.addChild(_local3);
if (inputBitmap != null){
_local3.graphics.beginFill(0, 0);
_local3.graphics.drawRect(0, 0, inputBitmap.width, inputBitmap.height);
_local3.graphics.endFill();
};
container.addChild(_local2);
_local2.blendMode = _arg1.layerBlendMode;
return (_local2);
}
public function destroy():void{
bitmapLayer = null;
outputBitmap.dispose();
}
}
}//package org.papervision3d.core.render.shader
Section 141
//BasicRenderSorter (org.papervision3d.core.render.sort.BasicRenderSorter)
package org.papervision3d.core.render.sort {
public class BasicRenderSorter implements IRenderSorter {
public function sort(_arg1:Array):void{
_arg1.sortOn("screenZ", Array.NUMERIC);
}
}
}//package org.papervision3d.core.render.sort
Section 142
//IRenderSorter (org.papervision3d.core.render.sort.IRenderSorter)
package org.papervision3d.core.render.sort {
public interface IRenderSorter {
function sort(_arg1:Array):void;
}
}//package org.papervision3d.core.render.sort
Section 143
//AbstractRenderEngine (org.papervision3d.core.render.AbstractRenderEngine)
package org.papervision3d.core.render {
import flash.events.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.view.*;
public class AbstractRenderEngine extends EventDispatcher implements IRenderEngine {
public function AbstractRenderEngine(_arg1:IEventDispatcher=null){
super(_arg1);
}
public function addToRenderList(_arg1:RenderableListItem):int{
return (0);
}
public function removeFromRenderList(_arg1:IRenderListItem):int{
return (0);
}
public function renderScene(_arg1:SceneObject3D, _arg2:CameraObject3D, _arg3:Viewport3D):RenderStatistics{
return (null);
}
}
}//package org.papervision3d.core.render
Section 144
//IRenderEngine (org.papervision3d.core.render.IRenderEngine)
package org.papervision3d.core.render {
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.view.*;
public interface IRenderEngine {
function addToRenderList(_arg1:RenderableListItem):int;
function removeFromRenderList(_arg1:IRenderListItem):int;
function renderScene(_arg1:SceneObject3D, _arg2:CameraObject3D, _arg3:Viewport3D):RenderStatistics;
}
}//package org.papervision3d.core.render
Section 145
//IVirtualMouseEvent (org.papervision3d.core.utils.virtualmouse.IVirtualMouseEvent)
package org.papervision3d.core.utils.virtualmouse {
public interface IVirtualMouseEvent {
}
}//package org.papervision3d.core.utils.virtualmouse
Section 146
//VirtualMouse (org.papervision3d.core.utils.virtualmouse.VirtualMouse)
package org.papervision3d.core.utils.virtualmouse {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import org.papervision3d.core.log.*;
public class VirtualMouse extends EventDispatcher {
private var _container:Sprite;
private var _stage:Stage;
private var lastDownTarget:DisplayObject;
private var target:InteractiveObject;
private var updateMouseDown:Boolean;// = false
private var eventEvent:Class;
private var _lastEvent:Event;
private var mouseEventEvent:Class;
private var location:Point;
private var delta:int;// = 0
private var disabledEvents:Object;
private var ignoredInstances:Dictionary;
private var isLocked:Boolean;// = false
private var lastWithinStage:Boolean;// = true
private var lastLocation:Point;
private var isDoubleClickEvent:Boolean;// = false
private var lastMouseDown:Boolean;// = false
private var ctrlKey:Boolean;// = false
private var altKey:Boolean;// = false
private var _useNativeEvents:Boolean;// = false
private var shiftKey:Boolean;// = false
public static const UPDATE:String = "update";
private static var _mouseIsDown:Boolean = false;
public function VirtualMouse(_arg1:Stage=null, _arg2:Sprite=null, _arg3:Number=0, _arg4:Number=0){
disabledEvents = new Object();
ignoredInstances = new Dictionary(true);
eventEvent = VirtualMouseEvent;
mouseEventEvent = VirtualMouseMouseEvent;
super();
this.stage = _arg1;
this.container = _arg2;
location = new Point(_arg3, _arg4);
lastLocation = location.clone();
addEventListener(UPDATE, handleUpdate);
update();
}
public function get mouseIsDown():Boolean{
return (_mouseIsDown);
}
public function get container():Sprite{
return (_container);
}
public function exitContainer():void{
if (!container){
return;
};
var _local1:Point = target.globalToLocal(location);
if (!disabledEvents[MouseEvent.MOUSE_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
container.dispatchEvent(new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta));
dispatchEvent(new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta));
};
if (!disabledEvents[MouseEvent.ROLL_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
container.dispatchEvent(new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta));
dispatchEvent(new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta));
};
if (target != container){
if (!disabledEvents[MouseEvent.MOUSE_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
target.dispatchEvent(new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta));
dispatchEvent(new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta));
};
if (!disabledEvents[MouseEvent.ROLL_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
target.dispatchEvent(new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta));
dispatchEvent(new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, _local1.x, _local1.y, container, ctrlKey, altKey, shiftKey, _mouseIsDown, delta));
};
};
target = _stage;
}
public function release():void{
updateMouseDown = true;
_mouseIsDown = false;
if (!isLocked){
update();
};
}
private function keyHandler(_arg1:KeyboardEvent):void{
altKey = _arg1.altKey;
ctrlKey = _arg1.ctrlKey;
shiftKey = _arg1.shiftKey;
}
public function click():void{
press();
release();
}
public function disableEvent(_arg1:String):void{
disabledEvents[_arg1] = true;
}
public function set container(_arg1:Sprite):void{
_container = _arg1;
}
public function get lastEvent():Event{
return (_lastEvent);
}
private function handleUpdate(_arg1:Event):void{
var _local4:InteractiveObject;
var _local5:DisplayObject;
var _local9:Boolean;
if (!container){
return;
};
if (container.scrollRect){
PaperLogger.warning("The container that virtualMouse is trying to test against has a scrollRect defined, and may cause an issue with finding objects under a defined point. Use MovieMaterial.rect to set a rectangle area instead");
};
var _local2:Point = new Point();
_local2.x = container.x;
_local2.y = container.y;
container.x = (container.y = 0);
var _local3:Array = container.getObjectsUnderPoint(location);
container.x = _local2.x;
container.y = _local2.y;
var _local6:int = _local3.length;
while (_local6--) {
_local5 = _local3[_local6];
while (_local5) {
if (ignoredInstances[_local5]){
_local4 = null;
break;
};
if (((_local4) && ((_local5 is SimpleButton)))){
_local4 = null;
} else {
if (((_local4) && (!(DisplayObjectContainer(_local5).mouseChildren)))){
_local4 = null;
};
};
if (((((!(_local4)) && ((_local5 is InteractiveObject)))) && (InteractiveObject(_local5).mouseEnabled))){
_local4 = InteractiveObject(_local5);
};
_local5 = _local5.parent;
};
if (_local4){
break;
};
};
if (!_local4){
_local4 = container;
};
var _local7:Point = target.globalToLocal(location);
var _local8:Point = _local4.globalToLocal(location);
if (((!((lastLocation.x == location.x))) || (!((lastLocation.y == location.y))))){
_local9 = false;
if (stage){
_local9 = (((((((location.x >= 0)) && ((location.y >= 0)))) && ((location.x <= stage.stageWidth)))) && ((location.y <= stage.stageHeight)));
};
if (((((!(_local9)) && (lastWithinStage))) && (!(disabledEvents[Event.MOUSE_LEAVE])))){
_lastEvent = new eventEvent(Event.MOUSE_LEAVE, false, false);
stage.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (((_local9) && (!(disabledEvents[MouseEvent.MOUSE_MOVE])))){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_MOVE, true, false, _local8.x, _local8.y, _local4, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local4.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
lastWithinStage = _local9;
};
if (_local4 != target){
if (!disabledEvents[MouseEvent.MOUSE_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_OUT, true, false, _local7.x, _local7.y, _local4, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
target.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (!disabledEvents[MouseEvent.ROLL_OUT]){
_lastEvent = new mouseEventEvent(MouseEvent.ROLL_OUT, false, false, _local7.x, _local7.y, _local4, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
target.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (!disabledEvents[MouseEvent.MOUSE_OVER]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_OVER, true, false, _local8.x, _local8.y, target, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local4.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (!disabledEvents[MouseEvent.ROLL_OVER]){
_lastEvent = new mouseEventEvent(MouseEvent.ROLL_OVER, false, false, _local8.x, _local8.y, target, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local4.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
};
if (updateMouseDown){
if (_mouseIsDown){
if (!disabledEvents[MouseEvent.MOUSE_DOWN]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_DOWN, true, false, _local8.x, _local8.y, _local4, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local4.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
lastDownTarget = _local4;
updateMouseDown = false;
} else {
if (!disabledEvents[MouseEvent.MOUSE_UP]){
_lastEvent = new mouseEventEvent(MouseEvent.MOUSE_UP, true, false, _local8.x, _local8.y, _local4, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local4.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
if (((!(disabledEvents[MouseEvent.CLICK])) && ((_local4 == lastDownTarget)))){
_lastEvent = new mouseEventEvent(MouseEvent.CLICK, true, false, _local8.x, _local8.y, _local4, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local4.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
lastDownTarget = null;
updateMouseDown = false;
};
};
if (((((isDoubleClickEvent) && (!(disabledEvents[MouseEvent.DOUBLE_CLICK])))) && (_local4.doubleClickEnabled))){
_lastEvent = new mouseEventEvent(MouseEvent.DOUBLE_CLICK, true, false, _local8.x, _local8.y, _local4, ctrlKey, altKey, shiftKey, _mouseIsDown, delta);
_local4.dispatchEvent(_lastEvent);
dispatchEvent(_lastEvent);
};
lastLocation = location.clone();
lastMouseDown = _mouseIsDown;
target = _local4;
}
public function getLocation():Point{
return (location.clone());
}
public function lock():void{
isLocked = true;
}
public function get useNativeEvents():Boolean{
return (_useNativeEvents);
}
public function setLocation(_arg1, _arg2=null):void{
var _local3:Point;
if ((_arg1 is Point)){
_local3 = (_arg1 as Point);
location.x = _local3.x;
location.y = _local3.y;
} else {
location.x = Number(_arg1);
location.y = Number(_arg2);
};
if (!isLocked){
update();
};
}
public function unignore(_arg1:DisplayObject):void{
if ((_arg1 in ignoredInstances)){
delete ignoredInstances[_arg1];
};
}
public function doubleClick():void{
if (isLocked){
release();
} else {
click();
press();
isDoubleClickEvent = true;
release();
isDoubleClickEvent = false;
};
}
public function update():void{
dispatchEvent(new Event(UPDATE, false, false));
}
public function unlock():void{
isLocked = false;
update();
}
public function ignore(_arg1:DisplayObject):void{
ignoredInstances[_arg1] = true;
}
public function enableEvent(_arg1:String):void{
if ((_arg1 in disabledEvents)){
delete disabledEvents[_arg1];
};
}
public function press():void{
updateMouseDown = true;
_mouseIsDown = true;
if (!isLocked){
update();
};
}
public function set useNativeEvents(_arg1:Boolean):void{
if (_arg1 == _useNativeEvents){
return;
};
_useNativeEvents = _arg1;
if (_useNativeEvents){
eventEvent = VirtualMouseEvent;
mouseEventEvent = VirtualMouseMouseEvent;
} else {
eventEvent = Event;
mouseEventEvent = MouseEvent;
};
}
public function set x(_arg1:Number):void{
location.x = _arg1;
if (!isLocked){
update();
};
}
public function set y(_arg1:Number):void{
location.y = _arg1;
if (!isLocked){
update();
};
}
public function get y():Number{
return (location.y);
}
public function set stage(_arg1:Stage):void{
var _local2:Boolean;
if (_stage){
_local2 = true;
_stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyHandler);
_stage.removeEventListener(KeyboardEvent.KEY_UP, keyHandler);
} else {
_local2 = false;
};
_stage = _arg1;
if (_stage){
_stage.addEventListener(KeyboardEvent.KEY_DOWN, keyHandler);
_stage.addEventListener(KeyboardEvent.KEY_UP, keyHandler);
target = _stage;
if (!_local2){
update();
};
};
}
public function get stage():Stage{
return (_stage);
}
public function get x():Number{
return (location.x);
}
}
}//package org.papervision3d.core.utils.virtualmouse
Section 147
//VirtualMouseEvent (org.papervision3d.core.utils.virtualmouse.VirtualMouseEvent)
package org.papervision3d.core.utils.virtualmouse {
import flash.events.*;
public class VirtualMouseEvent extends Event implements IVirtualMouseEvent {
public function VirtualMouseEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false){
super(_arg1, _arg2, _arg3);
}
}
}//package org.papervision3d.core.utils.virtualmouse
Section 148
//VirtualMouseMouseEvent (org.papervision3d.core.utils.virtualmouse.VirtualMouseMouseEvent)
package org.papervision3d.core.utils.virtualmouse {
import flash.events.*;
import flash.display.*;
public class VirtualMouseMouseEvent extends MouseEvent implements IVirtualMouseEvent {
public function VirtualMouseMouseEvent(_arg1:String, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Number=NaN, _arg5:Number=NaN, _arg6:InteractiveObject=null, _arg7:Boolean=false, _arg8:Boolean=false, _arg9:Boolean=false, _arg10:Boolean=false, _arg11:int=0){
super(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11);
}
}
}//package org.papervision3d.core.utils.virtualmouse
Section 149
//InteractiveSceneManager (org.papervision3d.core.utils.InteractiveSceneManager)
package org.papervision3d.core.utils {
import flash.events.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.view.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.materials.*;
import org.papervision3d.events.*;
import org.papervision3d.core.utils.virtualmouse.*;
public class InteractiveSceneManager extends EventDispatcher {
public var currentMaterial:MaterialObject3D;
public var container:Sprite;
public var currentMousePos:Point;
public var debug:Boolean;// = false
public var mouse3D:Mouse3D;
public var enableOverOut:Boolean;// = true
public var currentDisplayObject3D:DisplayObject3D;
public var _viewportRendered:Boolean;// = false
public var virtualMouse:VirtualMouse;
public var lastMousePos:Point;
public var viewport:Viewport3D;
public var renderHitData:RenderHitData;
public var currentMouseDO3D:DisplayObject3D;// = null
public static var MOUSE_IS_DOWN:Boolean = false;
public function InteractiveSceneManager(_arg1:Viewport3D){
virtualMouse = new VirtualMouse();
mouse3D = new Mouse3D();
currentMousePos = new Point();
lastMousePos = new Point();
super();
this.viewport = _arg1;
this.container = _arg1.containerSprite;
init();
}
protected function handleMouseClick(_arg1:MouseEvent):void{
if ((_arg1 is IVirtualMouseEvent)){
return;
};
if (((renderHitData) && (renderHitData.hasHit))){
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_CLICK, currentDisplayObject3D);
};
}
protected function handleEnterFrame(_arg1:Event):void{
var _local3:MovieMaterial;
var _local2:Boolean = hasMouseMoved();
if (((_local2) || (_viewportRendered))){
updateRenderHitData();
_viewportRendered = false;
if ((_arg1 is IVirtualMouseEvent)){
return;
};
if (((virtualMouse) && (renderHitData))){
_local3 = (currentMaterial as MovieMaterial);
if (_local3){
virtualMouse.container = (_local3.movie as Sprite);
};
if (virtualMouse.container){
virtualMouse.setLocation(renderHitData.u, renderHitData.v);
};
if (((((Mouse3D.enabled) && (renderHitData))) && (renderHitData.hasHit))){
mouse3D.updatePosition(renderHitData);
};
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_MOVE, currentDisplayObject3D);
} else {
if (((renderHitData) && (renderHitData.hasHit))){
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_MOVE, currentDisplayObject3D);
};
};
};
lastMousePos.x = currentMousePos.x;
lastMousePos.y = currentMousePos.y;
}
public function updateAfterRender():void{
_viewportRendered = true;
}
public function initListeners():void{
if (viewport.interactive){
container.addEventListener(MouseEvent.MOUSE_DOWN, handleMousePress, false, 0, true);
container.addEventListener(MouseEvent.MOUSE_UP, handleMouseRelease, false, 0, true);
container.addEventListener(MouseEvent.CLICK, handleMouseClick, false, 0, true);
container.addEventListener(MouseEvent.DOUBLE_CLICK, handleMouseDoubleClick, false, 0, true);
container.stage.addEventListener(Event.ENTER_FRAME, handleEnterFrame, false, 0, true);
};
}
protected function initVirtualMouse():void{
virtualMouse.stage = container.stage;
virtualMouse.container = container;
}
protected function handleMouseOver(_arg1:DisplayObject3D):void{
if (hasMouseMoved()){
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_OVER, _arg1);
};
}
protected function resolveRenderHitData():void{
renderHitData = (viewport.hitTestPoint2D(currentMousePos) as RenderHitData);
}
public function updateRenderHitData():void{
resolveRenderHitData();
currentDisplayObject3D = renderHitData.displayObject3D;
currentMaterial = renderHitData.material;
manageOverOut();
}
protected function hasMouseMoved():Boolean{
currentMousePos.x = container.mouseX;
currentMousePos.y = container.mouseY;
return (!(currentMousePos.equals(lastMousePos)));
}
protected function dispatchObjectEvent(_arg1:String, _arg2:DisplayObject3D):void{
var _local3:Number;
var _local4:Number;
var _local5:InteractiveScene3DEvent;
if (((renderHitData) && (renderHitData.hasHit))){
_local3 = (renderHitData.u) ? renderHitData.u : 0;
_local4 = (renderHitData.v) ? renderHitData.v : 0;
_local5 = new InteractiveScene3DEvent(_arg1, _arg2, container, (renderHitData.renderable as Triangle3D), _local3, _local4, renderHitData);
_local5.renderHitData = renderHitData;
dispatchEvent(_local5);
_arg2.dispatchEvent(_local5);
} else {
dispatchEvent(new InteractiveScene3DEvent(_arg1, _arg2, container));
if (_arg2){
_arg2.dispatchEvent(new InteractiveScene3DEvent(_arg1, _arg2, container));
};
};
}
protected function handleMouseDoubleClick(_arg1:MouseEvent):void{
if ((_arg1 is IVirtualMouseEvent)){
return;
};
if (((renderHitData) && (renderHitData.hasHit))){
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_DOUBLE_CLICK, currentDisplayObject3D);
};
}
protected function handleMouseRelease(_arg1:MouseEvent):void{
if ((_arg1 is IVirtualMouseEvent)){
return;
};
MOUSE_IS_DOWN = false;
if (virtualMouse){
virtualMouse.release();
};
if (((((Mouse3D.enabled) && (renderHitData))) && (!((renderHitData.renderable == null))))){
mouse3D.updatePosition(renderHitData);
};
if (((renderHitData) && (renderHitData.hasHit))){
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_RELEASE, currentDisplayObject3D);
};
}
protected function handleAddedToStage(_arg1:Event):void{
container.removeEventListener(Event.ADDED_TO_STAGE, handleAddedToStage);
initVirtualMouse();
initListeners();
}
protected function handleMouseOut(_arg1:DisplayObject3D):void{
var _local2:MovieMaterial;
if (!hasMouseMoved()){
return;
};
if (_arg1){
_local2 = (_arg1.material as MovieMaterial);
if (_local2){
virtualMouse.exitContainer();
};
};
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_OUT, _arg1);
}
protected function manageOverOut():void{
if (!enableOverOut){
return;
};
if (((renderHitData) && (renderHitData.hasHit))){
if (((!(currentMouseDO3D)) && (currentDisplayObject3D))){
handleMouseOver(currentDisplayObject3D);
currentMouseDO3D = currentDisplayObject3D;
} else {
if (((currentMouseDO3D) && (!((currentMouseDO3D == currentDisplayObject3D))))){
handleMouseOut(currentMouseDO3D);
handleMouseOver(currentDisplayObject3D);
currentMouseDO3D = currentDisplayObject3D;
};
};
} else {
if (currentMouseDO3D != null){
handleMouseOut(currentMouseDO3D);
currentMouseDO3D = null;
};
};
}
public function destroy():void{
viewport = null;
renderHitData = null;
currentDisplayObject3D = null;
currentMaterial = null;
currentMouseDO3D = null;
virtualMouse.stage = null;
virtualMouse.container = null;
container.removeEventListener(MouseEvent.MOUSE_DOWN, handleMousePress);
container.removeEventListener(MouseEvent.MOUSE_UP, handleMouseRelease);
container.removeEventListener(MouseEvent.CLICK, handleMouseClick);
container.removeEventListener(MouseEvent.DOUBLE_CLICK, handleMouseDoubleClick);
if (container.stage){
container.stage.removeEventListener(Event.ENTER_FRAME, handleEnterFrame);
};
container = null;
}
public function init():void{
if (container){
if (container.stage){
initVirtualMouse();
initListeners();
} else {
container.addEventListener(Event.ADDED_TO_STAGE, handleAddedToStage, false, 0, true);
};
};
}
protected function handleMousePress(_arg1:MouseEvent):void{
if ((_arg1 is IVirtualMouseEvent)){
return;
};
MOUSE_IS_DOWN = true;
if (virtualMouse){
virtualMouse.press();
};
if (((((Mouse3D.enabled) && (renderHitData))) && (!((renderHitData.renderable == null))))){
mouse3D.updatePosition(renderHitData);
};
if (((renderHitData) && (renderHitData.hasHit))){
dispatchObjectEvent(InteractiveScene3DEvent.OBJECT_PRESS, currentDisplayObject3D);
};
}
}
}//package org.papervision3d.core.utils
Section 150
//Mouse3D (org.papervision3d.core.utils.Mouse3D)
package org.papervision3d.core.utils {
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.geom.renderables.*;
public class Mouse3D extends DisplayObject3D {
private var target:Number3D;
public static var enabled:Boolean = false;
private static var UP:Number3D = new Number3D(0, 1, 0);
public function Mouse3D():void{
target = new Number3D();
super();
}
public function updatePosition(_arg1:RenderHitData):void{
var _local3:Matrix3D;
var _local5:Number3D;
var _local6:Number3D;
var _local2:Triangle3D = (_arg1.renderable as Triangle3D);
target.x = _local2.faceNormal.x;
target.y = _local2.faceNormal.y;
target.z = _local2.faceNormal.z;
var _local4:Number3D = Number3D.sub(target, position);
_local4.normalize();
if (_local4.modulo > 0.1){
_local5 = Number3D.cross(_local4, UP);
_local5.normalize();
_local6 = Number3D.cross(_local4, _local5);
_local6.normalize();
_local3 = this.transform;
_local3.n11 = _local5.x;
_local3.n21 = _local5.y;
_local3.n31 = _local5.z;
_local3.n12 = -(_local6.x);
_local3.n22 = -(_local6.y);
_local3.n32 = -(_local6.z);
_local3.n13 = _local4.x;
_local3.n23 = _local4.y;
_local3.n33 = _local4.z;
} else {
_local3 = Matrix3D.IDENTITY;
};
this.transform = Matrix3D.multiply(_local2.instance.world, _local3);
x = _arg1.x;
y = _arg1.y;
z = _arg1.z;
}
}
}//package org.papervision3d.core.utils
Section 151
//StopWatch (org.papervision3d.core.utils.StopWatch)
package org.papervision3d.core.utils {
import flash.events.*;
import flash.utils.*;
public class StopWatch extends EventDispatcher {
private var startTime:int;
private var elapsedTime:int;
private var isRunning:Boolean;
private var stopTime:int;
public function start():void{
if (!isRunning){
startTime = getTimer();
isRunning = true;
};
}
public function stop():int{
if (isRunning){
stopTime = getTimer();
elapsedTime = (stopTime - startTime);
isRunning = false;
return (elapsedTime);
};
return (0);
}
public function reset():void{
isRunning = false;
}
}
}//package org.papervision3d.core.utils
Section 152
//IViewport3D (org.papervision3d.core.view.IViewport3D)
package org.papervision3d.core.view {
import org.papervision3d.core.render.data.*;
public interface IViewport3D {
function updateAfterRender(_arg1:RenderSessionData):void;
function updateBeforeRender(_arg1:RenderSessionData):void;
}
}//package org.papervision3d.core.view
Section 153
//InteractiveScene3DEvent (org.papervision3d.events.InteractiveScene3DEvent)
package org.papervision3d.events {
import flash.events.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
public class InteractiveScene3DEvent extends Event {
public var y:Number;// = 0
public var sprite:Sprite;// = null
public var renderHitData:RenderHitData;
public var face3d:Triangle3D;// = null
public var x:Number;// = 0
public var displayObject3D:DisplayObject3D;// = null
public static const OBJECT_ADDED:String = "objectAdded";
public static const OBJECT_PRESS:String = "mousePress";
public static const OBJECT_RELEASE:String = "mouseRelease";
public static const OBJECT_CLICK:String = "mouseClick";
public static const OBJECT_RELEASE_OUTSIDE:String = "mouseReleaseOutside";
public static const OBJECT_OUT:String = "mouseOut";
public static const OBJECT_MOVE:String = "mouseMove";
public static const OBJECT_OVER:String = "mouseOver";
public static const OBJECT_DOUBLE_CLICK:String = "mouseDoubleClick";
public function InteractiveScene3DEvent(_arg1:String, _arg2:DisplayObject3D=null, _arg3:Sprite=null, _arg4:Triangle3D=null, _arg5:Number=0, _arg6:Number=0, _arg7:RenderHitData=null, _arg8:Boolean=false, _arg9:Boolean=false){
super(_arg1, _arg8, _arg9);
this.displayObject3D = _arg2;
this.sprite = _arg3;
this.face3d = _arg4;
this.x = _arg5;
this.y = _arg6;
this.renderHitData = _arg7;
}
override public function toString():String{
return (((((((("Type : " + type) + ", DO3D : ") + displayObject3D) + " Sprite : ") + sprite) + " Face : ") + face3d));
}
}
}//package org.papervision3d.events
Section 154
//RendererEvent (org.papervision3d.events.RendererEvent)
package org.papervision3d.events {
import flash.events.*;
import org.papervision3d.core.render.data.*;
public class RendererEvent extends Event {
public var renderSessionData:RenderSessionData;
public static const PROJECTION_DONE:String = "projectionDone";
public static const RENDER_DONE:String = "renderDone";
public function RendererEvent(_arg1:String, _arg2:RenderSessionData){
super(_arg1);
this.renderSessionData = _arg2;
}
public function clear():void{
renderSessionData = null;
}
override public function clone():Event{
return (new RendererEvent(type, renderSessionData));
}
}
}//package org.papervision3d.events
Section 155
//PointLight3D (org.papervision3d.lights.PointLight3D)
package org.papervision3d.lights {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.math.*;
public class PointLight3D extends LightObject3D {
public static var DEFAULT_POS:Number3D = new Number3D(0, 0, -1000);
public function PointLight3D(_arg1:Boolean=false, _arg2:Boolean=false){
super(_arg1, _arg2);
x = DEFAULT_POS.x;
y = DEFAULT_POS.y;
z = DEFAULT_POS.z;
}
}
}//package org.papervision3d.lights
Section 156
//ILightShader (org.papervision3d.materials.shaders.ILightShader)
package org.papervision3d.materials.shaders {
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.shader.*;
public interface ILightShader {
function updateLightMatrix(_arg1:ShaderObjectData, _arg2:RenderSessionData):void;
}
}//package org.papervision3d.materials.shaders
Section 157
//IShader (org.papervision3d.materials.shaders.IShader)
package org.papervision3d.materials.shaders {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.render.shader.*;
public interface IShader {
function updateAfterRender(_arg1:RenderSessionData, _arg2:ShaderObjectData):void;
function destroy():void;
function renderLayer(_arg1:Triangle3D, _arg2:RenderSessionData, _arg3:ShaderObjectData):void;
function renderTri(_arg1:Triangle3D, _arg2:RenderSessionData, _arg3:ShaderObjectData, _arg4:BitmapData):void;
}
}//package org.papervision3d.materials.shaders
Section 158
//ShadedMaterial (org.papervision3d.materials.shaders.ShadedMaterial)
package org.papervision3d.materials.shaders {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.render.command.*;
import flash.utils.*;
import org.papervision3d.core.log.*;
import org.papervision3d.core.render.material.*;
import org.papervision3d.materials.*;
import org.papervision3d.core.render.shader.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.core.material.*;
public class ShadedMaterial extends TriangleMaterial implements ITriangleDrawer, IUpdateBeforeMaterial, IUpdateAfterMaterial {
public var shader:Shader;
private var _shaderCompositeMode:int;
public var material:BitmapMaterial;
public var shaderObjectData:Dictionary;
private static var bmp:BitmapData;
public function ShadedMaterial(_arg1:BitmapMaterial, _arg2:Shader, _arg3:int=0){
this.shader = _arg2;
this.material = _arg1;
shaderCompositeMode = _arg3;
init();
}
override public function registerObject(_arg1:DisplayObject3D):void{
super.registerObject(_arg1);
var _local2:ShaderObjectData = (shaderObjectData[_arg1] = new ShaderObjectData(_arg1, material, this));
_local2.shaderRenderer.inputBitmap = material.bitmap;
shader.setContainerForObject(_arg1, _local2.shaderRenderer.getLayerForShader(shader));
}
public function updateAfterRender(_arg1:RenderSessionData):void{
var _local2:ShaderObjectData;
for each (_local2 in shaderObjectData) {
shader.updateAfterRender(_arg1, _local2);
if (shaderCompositeMode == ShaderCompositeModes.PER_LAYER){
_local2.shaderRenderer.render(_arg1);
};
};
}
override public function drawTriangle(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
var _local6:ShaderObjectData = ShaderObjectData(shaderObjectData[_arg1.renderableInstance.instance]);
if (shaderCompositeMode == ShaderCompositeModes.PER_LAYER){
material.drawTriangle(_arg1, _arg2, _arg3, _local6.shaderRenderer.outputBitmap);
shader.renderLayer(_arg1.triangle, _arg3, _local6);
} else {
if (shaderCompositeMode == ShaderCompositeModes.PER_TRIANGLE_IN_BITMAP){
bmp = _local6.getOutputBitmapFor(_arg1.triangle);
material.drawTriangle(_arg1, _arg2, _arg3, bmp, (_local6.triangleUVS[_arg1.triangle]) ? _local6.triangleUVS[_arg1.triangle] : _local6.getPerTriUVForDraw(_arg1.triangle));
shader.renderTri(_arg1.triangle, _arg3, _local6, bmp);
};
};
}
private function init():void{
shaderObjectData = new Dictionary();
}
public function set shaderCompositeMode(_arg1:int):void{
_shaderCompositeMode = _arg1;
}
public function get shaderCompositeMode():int{
return (_shaderCompositeMode);
}
public function getOutputBitmapDataFor(_arg1:DisplayObject3D):BitmapData{
var _local2:ShaderObjectData;
if (shaderCompositeMode == ShaderCompositeModes.PER_LAYER){
if (shaderObjectData[_arg1]){
_local2 = ShaderObjectData(shaderObjectData[_arg1]);
return (_local2.shaderRenderer.outputBitmap);
};
PaperLogger.warning("object not registered with shaded material");
} else {
PaperLogger.warning("getOutputBitmapDataFor only works on per layer mode");
};
return (null);
}
override public function destroy():void{
var _local1:ShaderObjectData;
super.destroy();
for each (_local1 in shaderObjectData) {
_local1.destroy();
};
material = null;
shader = null;
}
override public function unregisterObject(_arg1:DisplayObject3D):void{
super.unregisterObject(_arg1);
var _local2:ShaderObjectData = shaderObjectData[_arg1];
_local2.destroy();
delete shaderObjectData[_arg1];
}
public function updateBeforeRender(_arg1:RenderSessionData):void{
var _local2:ShaderObjectData;
var _local3:ILightShader;
for each (_local2 in shaderObjectData) {
_local2.shaderRenderer.inputBitmap = material.bitmap;
if (shaderCompositeMode == ShaderCompositeModes.PER_LAYER){
if (_local2.shaderRenderer.resizedInput){
_local2.shaderRenderer.resizedInput = false;
_local2.uvMatrices = new Dictionary();
};
_local2.shaderRenderer.clear();
};
if ((shader is ILightShader)){
_local3 = (shader as ILightShader);
_local3.updateLightMatrix(_local2, _arg1);
};
};
}
}
}//package org.papervision3d.materials.shaders
Section 159
//Shader (org.papervision3d.materials.shaders.Shader)
package org.papervision3d.materials.shaders {
import flash.events.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.geom.renderables.*;
import flash.utils.*;
import org.papervision3d.core.render.shader.*;
import flash.filters.*;
public class Shader extends EventDispatcher implements IShader {
protected var layers:Dictionary;
protected var _blendMode:String;// = "multiply"
protected var _filter:BitmapFilter;
protected var _object:DisplayObject3D;
public function Shader(){
this.layers = new Dictionary(true);
}
public function set layerBlendMode(_arg1:String):void{
_blendMode = _arg1;
}
public function setContainerForObject(_arg1:DisplayObject3D, _arg2:Sprite):void{
layers[_arg1] = _arg2;
}
public function updateAfterRender(_arg1:RenderSessionData, _arg2:ShaderObjectData):void{
}
public function set filter(_arg1:BitmapFilter):void{
_filter = _arg1;
}
public function get layerBlendMode():String{
return (_blendMode);
}
public function get filter():BitmapFilter{
return (_filter);
}
public function destroy():void{
}
public function renderTri(_arg1:Triangle3D, _arg2:RenderSessionData, _arg3:ShaderObjectData, _arg4:BitmapData):void{
}
public function renderLayer(_arg1:Triangle3D, _arg2:RenderSessionData, _arg3:ShaderObjectData):void{
}
}
}//package org.papervision3d.materials.shaders
Section 160
//ShaderCompositeModes (org.papervision3d.materials.shaders.ShaderCompositeModes)
package org.papervision3d.materials.shaders {
public class ShaderCompositeModes {
public static var PER_TRIANGLE_IN_BITMAP:int = 1;
public static var PER_LAYER:int = 0;
}
}//package org.papervision3d.materials.shaders
Section 161
//CompositeMaterial (org.papervision3d.materials.special.CompositeMaterial)
package org.papervision3d.materials.special {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.core.material.*;
public class CompositeMaterial extends TriangleMaterial implements ITriangleDrawer {
public var materials:Array;
public function CompositeMaterial(){
init();
}
private function init():void{
materials = new Array();
}
override public function registerObject(_arg1:DisplayObject3D):void{
var _local2:MaterialObject3D;
super.registerObject(_arg1);
for each (_local2 in materials) {
_local2.registerObject(_arg1);
};
}
override public function drawTriangle(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
var _local6:MaterialObject3D;
for each (_local6 in materials) {
if (!_local6.invisible){
_local6.drawTriangle(_arg1, _arg2, _arg3);
};
};
}
public function removeAllMaterials():void{
materials = new Array();
}
override public function unregisterObject(_arg1:DisplayObject3D):void{
var _local2:MaterialObject3D;
super.unregisterObject(_arg1);
for each (_local2 in materials) {
_local2.unregisterObject(_arg1);
};
}
public function removeMaterial(_arg1:MaterialObject3D):void{
materials.splice(materials.indexOf(_arg1), 1);
}
public function addMaterial(_arg1:MaterialObject3D):void{
var _local2:Object;
var _local3:DisplayObject3D;
materials.push(_arg1);
for (_local2 in objects) {
_local3 = (_local2 as DisplayObject3D);
_arg1.registerObject(_local3);
};
}
}
}//package org.papervision3d.materials.special
Section 162
//LineMaterial (org.papervision3d.materials.special.LineMaterial)
package org.papervision3d.materials.special {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.render.draw.*;
public class LineMaterial extends MaterialObject3D implements ILineDrawer {
public function LineMaterial(_arg1:Number=0xFF0000, _arg2:Number=1){
this.lineColor = _arg1;
this.lineAlpha = _arg2;
}
public function drawLine(_arg1:RenderLine, _arg2:Graphics, _arg3:RenderSessionData):void{
_arg2.lineStyle(_arg1.size, lineColor, lineAlpha);
_arg2.moveTo(_arg1.v0.x, _arg1.v0.y);
if (_arg1.cV){
_arg2.curveTo(_arg1.cV.x, _arg1.cV.y, _arg1.v1.x, _arg1.v1.y);
} else {
_arg2.lineTo(_arg1.v1.x, _arg1.v1.y);
};
_arg2.moveTo(0, 0);
_arg2.lineStyle();
}
}
}//package org.papervision3d.materials.special
Section 163
//ParticleMaterial (org.papervision3d.materials.special.ParticleMaterial)
package org.papervision3d.materials.special {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.log.*;
import org.papervision3d.core.render.draw.*;
public class ParticleMaterial extends MaterialObject3D implements IParticleDrawer {
public var shape:int;
public var scale:Number;
public static var SHAPE_SQUARE:int = 0;
public static var SHAPE_CIRCLE:int = 1;
public function ParticleMaterial(_arg1:Number, _arg2:Number, _arg3:int=0, _arg4:Number=1){
this.shape = _arg3;
this.fillAlpha = _arg2;
this.fillColor = _arg1;
this.scale = _arg4;
}
public function drawParticle(_arg1:Particle, _arg2:Graphics, _arg3:RenderSessionData):void{
_arg2.beginFill(fillColor, fillAlpha);
var _local4:Rectangle = _arg1.renderRect;
if (shape == SHAPE_SQUARE){
_arg2.drawRect(_local4.x, _local4.y, _local4.width, _local4.height);
} else {
if (shape == SHAPE_CIRCLE){
_arg2.drawCircle((_local4.x + (_local4.width / 2)), (_local4.y + (_local4.width / 2)), (_local4.width / 2));
} else {
PaperLogger.warning("Particle material has no valid shape - Must be ParticleMaterial.SHAPE_SQUARE or ParticleMaterial.SHAPE_CIRCLE");
};
};
_arg2.endFill();
_arg3.renderStatistics.particles++;
}
public function updateRenderRect(_arg1:Particle):void{
var _local2:Rectangle = _arg1.renderRect;
if (_arg1.size == 0){
_local2.width = 1;
_local2.height = 1;
} else {
_local2.width = ((_arg1.renderScale * _arg1.size) * scale);
_local2.height = ((_arg1.renderScale * _arg1.size) * scale);
};
_local2.x = (_arg1.vertex3D.vertex3DInstance.x - (_local2.width / 2));
_local2.y = (_arg1.vertex3D.vertex3DInstance.y - (_local2.width / 2));
}
}
}//package org.papervision3d.materials.special
Section 164
//LightMatrix (org.papervision3d.materials.utils.LightMatrix)
package org.papervision3d.materials.utils {
import org.papervision3d.core.render.data.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.math.*;
import org.papervision3d.*;
import org.papervision3d.lights.*;
public class LightMatrix {
private static var _targetPos:Number3D = new Number3D();
private static var _lightUp:Number3D = new Number3D();
private static var _lightSide:Number3D = new Number3D();
private static var _lightDir:Number3D = new Number3D();
private static var lightMatrix:Matrix3D = Matrix3D.IDENTITY;
private static var invMatrix:Matrix3D = Matrix3D.IDENTITY;
protected static var UP:Number3D = new Number3D(0, 1, 0);
private static var _lightPos:Number3D = new Number3D();
public static function getLightMatrix(_arg1:LightObject3D, _arg2:DisplayObject3D, _arg3:RenderSessionData, _arg4:Matrix3D):Matrix3D{
var _local6:Matrix3D;
var _local7:Matrix3D;
var _local5:Matrix3D = (_arg4) ? _arg4 : Matrix3D.IDENTITY;
if (_arg1 == null){
_arg1 = new PointLight3D();
_arg1.copyPosition(_arg3.camera);
};
_targetPos.reset();
_lightPos.reset();
_lightDir.reset();
_lightUp.reset();
_lightSide.reset();
if (!_arg2){
return (_local5);
};
_local6 = _arg1.transform;
_local7 = _arg2.world;
_lightPos.x = -(_local6.n14);
_lightPos.y = -(_local6.n24);
_lightPos.z = -(_local6.n34);
_targetPos.x = -(_local7.n14);
_targetPos.y = -(_local7.n24);
_targetPos.z = -(_local7.n34);
_lightDir.x = (_targetPos.x - _lightPos.x);
_lightDir.y = (_targetPos.y - _lightPos.y);
_lightDir.z = (_targetPos.z - _lightPos.z);
invMatrix.calculateInverse(_arg2.world);
Matrix3D.multiplyVector3x3(invMatrix, _lightDir);
_lightDir.normalize();
_lightSide.x = ((_lightDir.y * UP.z) - (_lightDir.z * UP.y));
_lightSide.y = ((_lightDir.z * UP.x) - (_lightDir.x * UP.z));
_lightSide.z = ((_lightDir.x * UP.y) - (_lightDir.y * UP.x));
_lightSide.normalize();
_lightUp.x = ((_lightSide.y * _lightDir.z) - (_lightSide.z * _lightDir.y));
_lightUp.y = ((_lightSide.z * _lightDir.x) - (_lightSide.x * _lightDir.z));
_lightUp.z = ((_lightSide.x * _lightDir.y) - (_lightSide.y * _lightDir.x));
_lightUp.normalize();
if (((Papervision3D.useRIGHTHANDED) || (_arg2.flipLightDirection))){
_lightDir.x = -(_lightDir.x);
_lightDir.y = -(_lightDir.y);
_lightDir.z = -(_lightDir.z);
};
_local5.n11 = _lightSide.x;
_local5.n12 = _lightSide.y;
_local5.n13 = _lightSide.z;
_local5.n21 = _lightUp.x;
_local5.n22 = _lightUp.y;
_local5.n23 = _lightUp.z;
_local5.n31 = _lightDir.x;
_local5.n32 = _lightDir.y;
_local5.n33 = _lightDir.z;
return (_local5);
}
}
}//package org.papervision3d.materials.utils
Section 165
//MaterialsList (org.papervision3d.materials.utils.MaterialsList)
package org.papervision3d.materials.utils {
import org.papervision3d.core.proto.*;
import flash.utils.*;
public class MaterialsList {
protected var _materials:Dictionary;
public var materialsByName:Dictionary;
private var _materialsTotal:int;
public function MaterialsList(_arg1=null):void{
var _local2:String;
var _local3:String;
super();
this.materialsByName = new Dictionary(true);
this._materials = new Dictionary(false);
this._materialsTotal = 0;
if (_arg1){
if ((_arg1 is Array)){
for (_local2 in _arg1) {
this.addMaterial(_arg1[_local2]);
};
} else {
if ((_arg1 is Object)){
for (_local3 in _arg1) {
this.addMaterial(_arg1[_local3], _local3);
};
};
};
};
}
public function get numMaterials():int{
return (_materialsTotal);
}
public function addMaterial(_arg1:MaterialObject3D, _arg2:String=null):MaterialObject3D{
_arg2 = ((((_arg2) || (_arg1.name))) || (String(_arg1.id)));
this._materials[_arg1] = _arg2;
this.materialsByName[_arg2] = _arg1;
this._materialsTotal++;
return (_arg1);
}
public function removeMaterial(_arg1:MaterialObject3D):MaterialObject3D{
if (this._materials[_arg1]){
delete this.materialsByName[this._materials[_arg1]];
delete this._materials[_arg1];
_materialsTotal--;
};
return (_arg1);
}
public function toString():String{
var _local2:MaterialObject3D;
var _local1 = "";
for each (_local2 in this.materialsByName) {
_local1 = (_local1 + (this._materials[_local2] + "\n"));
};
return (_local1);
}
public function removeMaterialByName(_arg1:String):MaterialObject3D{
return (removeMaterial(getMaterialByName(_arg1)));
}
public function clone():MaterialsList{
var _local2:MaterialObject3D;
var _local1:MaterialsList = new MaterialsList();
for each (_local2 in this.materialsByName) {
_local1.addMaterial(_local2.clone(), this._materials[_local2]);
};
return (_local1);
}
public function getMaterialByName(_arg1:String):MaterialObject3D{
return ((this.materialsByName[_arg1]) ? this.materialsByName[_arg1] : this.materialsByName["all"]);
}
}
}//package org.papervision3d.materials.utils
Section 166
//PrecisionMode (org.papervision3d.materials.utils.PrecisionMode)
package org.papervision3d.materials.utils {
public class PrecisionMode {
public static var ORIGINAL:int = 0;
public static var STABLE:int = 1;
}
}//package org.papervision3d.materials.utils
Section 167
//RenderRecStorage (org.papervision3d.materials.utils.RenderRecStorage)
package org.papervision3d.materials.utils {
import flash.geom.*;
import org.papervision3d.core.geom.renderables.*;
public class RenderRecStorage {
public var mat:Matrix;
public var v0:Vertex3DInstance;
public var v1:Vertex3DInstance;
public var v2:Vertex3DInstance;
public function RenderRecStorage(){
v0 = new Vertex3DInstance();
v1 = new Vertex3DInstance();
v2 = new Vertex3DInstance();
mat = new Matrix();
super();
}
}
}//package org.papervision3d.materials.utils
Section 168
//BitmapMaterial (org.papervision3d.materials.BitmapMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.core.geom.renderables.*;
import flash.utils.*;
import org.papervision3d.core.log.*;
import org.papervision3d.materials.utils.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.core.material.*;
import org.papervision3d.*;
public class BitmapMaterial extends TriangleMaterial implements ITriangleDrawer {
protected var renderRecStorage:Array;
protected var dsbc:Number;
private var d2bc:Number;
private var b2:Number;
public var uvMatrices:Dictionary;
protected var _precise:Boolean;
protected var faz:Number;
protected var dsca:Number;
protected var ax:Number;
protected var ay:Number;
protected var az:Number;
private var d2ca:Number;
protected var tempPreGrp:Graphics;
public var precisionMode:int;
protected var fbz:Number;
private var c2:Number;
protected var mcax:Number;
protected var mcay:Number;
protected var mcaz:Number;
private var d2:Number;
protected var bx:Number;
protected var by:Number;
protected var bz:Number;
protected var fcz:Number;
public var minimumRenderSize:Number;// = 4
protected var dbcx:Number;
protected var dbcy:Number;
protected var cx:Number;
protected var cullRect:Rectangle;
protected var cz:Number;
protected var cy:Number;
protected var dmax:Number;
protected var dabx:Number;
private var dy:Number;
protected var _perPixelPrecision:int;// = 8
protected var daby:Number;
protected var tempPreRSD:RenderSessionData;
private var dx:Number;
private var x0:Number;
private var x1:Number;
private var x2:Number;
protected var mbcy:Number;
protected var mbcz:Number;
protected var mbcx:Number;
private var y0:Number;
protected var focus:Number;// = 200
private var y2:Number;
protected var _texture:Object;
protected var tempPreBmp:BitmapData;
private var y1:Number;
protected var tempTriangleMatrix:Matrix;
protected var maby:Number;
protected var mabz:Number;
private var d2ab:Number;
protected var dsab:Number;
protected var mabx:Number;
protected var dcax:Number;
protected var dcay:Number;
private var a2:Number;
protected var _precision:int;// = 8
protected static const DEFAULT_FOCUS:Number = 200;
protected static var _triMatrix:Matrix = new Matrix();
protected static var _triMap:Matrix;
public static var AUTO_MIP_MAPPING:Boolean = false;
public static var MIP_MAP_DEPTH:Number = 8;
protected static var hitRect:Rectangle = new Rectangle();
protected static var _localMatrix:Matrix = new Matrix();
public function BitmapMaterial(_arg1:BitmapData=null, _arg2:Boolean=false){
precisionMode = PrecisionMode.ORIGINAL;
uvMatrices = new Dictionary();
tempTriangleMatrix = new Matrix();
super();
if (_arg1){
texture = _arg1;
};
this.precise = _arg2;
createRenderRecStorage();
}
public function transformUV(_arg1:Triangle3D):Matrix{
var _local2:Array;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Matrix;
var _local16:Matrix;
if (!_arg1.uv){
PaperLogger.error("MaterialObject3D: transformUV() uv not found!");
} else {
if (bitmap){
_local2 = _arg1.uv;
_local3 = (bitmap.width * maxU);
_local4 = (bitmap.height * maxV);
_local5 = (_local3 * _arg1.uv0.u);
_local6 = (_local4 * (1 - _arg1.uv0.v));
_local7 = (_local3 * _arg1.uv1.u);
_local8 = (_local4 * (1 - _arg1.uv1.v));
_local9 = (_local3 * _arg1.uv2.u);
_local10 = (_local4 * (1 - _arg1.uv2.v));
if ((((((_local5 == _local7)) && ((_local6 == _local8)))) || ((((_local5 == _local9)) && ((_local6 == _local10)))))){
_local5 = (_local5 - ((_local5)>0.05) ? 0.05 : -0.05);
_local6 = (_local6 - ((_local6)>0.07) ? 0.07 : -0.07);
};
if ((((_local9 == _local7)) && ((_local10 == _local8)))){
_local9 = (_local9 - ((_local9)>0.05) ? 0.04 : -0.04);
_local10 = (_local10 - ((_local10)>0.06) ? 0.06 : -0.06);
};
_local11 = (_local7 - _local5);
_local12 = (_local8 - _local6);
_local13 = (_local9 - _local5);
_local14 = (_local10 - _local6);
_local15 = new Matrix(_local11, _local12, _local13, _local14, _local5, _local6);
if (Papervision3D.useRIGHTHANDED){
_local15.scale(-1, 1);
_local15.translate(_local3, 0);
};
_local15.invert();
_local16 = (uvMatrices[_arg1] = _local15.clone());
_local16.a = _local15.a;
_local16.b = _local15.b;
_local16.c = _local15.c;
_local16.d = _local15.d;
_local16.tx = _local15.tx;
_local16.ty = _local15.ty;
} else {
PaperLogger.error("MaterialObject3D: transformUV() material.bitmap not found!");
};
};
return (_local16);
}
public function transformUVRT(_arg1:RenderTriangle):Matrix{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Number;
var _local10:Number;
var _local11:Number;
var _local12:Number;
var _local13:Number;
var _local14:Matrix;
var _local15:Matrix;
if (bitmap){
_local2 = (bitmap.width * maxU);
_local3 = (bitmap.height * maxV);
_local4 = (_local2 * _arg1.uv0.u);
_local5 = (_local3 * (1 - _arg1.uv0.v));
_local6 = (_local2 * _arg1.uv1.u);
_local7 = (_local3 * (1 - _arg1.uv1.v));
_local8 = (_local2 * _arg1.uv2.u);
_local9 = (_local3 * (1 - _arg1.uv2.v));
if ((((((_local4 == _local6)) && ((_local5 == _local7)))) || ((((_local4 == _local8)) && ((_local5 == _local9)))))){
_local4 = (_local4 - ((_local4)>0.05) ? 0.05 : -0.05);
_local5 = (_local5 - ((_local5)>0.07) ? 0.07 : -0.07);
};
if ((((_local8 == _local6)) && ((_local9 == _local7)))){
_local8 = (_local8 - ((_local8)>0.05) ? 0.04 : -0.04);
_local9 = (_local9 - ((_local9)>0.06) ? 0.06 : -0.06);
};
_local10 = (_local6 - _local4);
_local11 = (_local7 - _local5);
_local12 = (_local8 - _local4);
_local13 = (_local9 - _local5);
_local14 = new Matrix(_local10, _local11, _local12, _local13, _local4, _local5);
if (Papervision3D.useRIGHTHANDED){
_local14.scale(-1, 1);
_local14.translate(_local2, 0);
};
_local14.invert();
_local15 = (uvMatrices[_arg1] = _local14.clone());
_local15.a = _local14.a;
_local15.b = _local14.b;
_local15.c = _local14.c;
_local15.d = _local14.d;
_local15.tx = _local14.tx;
_local15.ty = _local14.ty;
} else {
PaperLogger.error("MaterialObject3D: transformUV() material.bitmap not found!");
};
return (_local15);
}
protected function renderRec(_arg1:Matrix, _arg2:Vertex3DInstance, _arg3:Vertex3DInstance, _arg4:Vertex3DInstance, _arg5:Number):void{
az = _arg2.z;
bz = _arg3.z;
cz = _arg4.z;
if ((((((az <= 0)) && ((bz <= 0)))) && ((cz <= 0)))){
return;
};
cx = _arg4.x;
cy = _arg4.y;
bx = _arg3.x;
by = _arg3.y;
ax = _arg2.x;
ay = _arg2.y;
if (cullRect){
hitRect.x = ((bx < ax)) ? ((bx < cx)) ? bx : cx : ((ax < cx)) ? ax : cx;
hitRect.width = (((bx > ax)) ? ((bx > cx)) ? bx : cx : ((ax > cx)) ? ax : cx + ((hitRect.x < 0)) ? -(hitRect.x) : hitRect.x);
hitRect.y = ((by < ay)) ? ((by < cy)) ? by : cy : ((ay < cy)) ? ay : cy;
hitRect.height = (((by > ay)) ? ((by > cy)) ? by : cy : ((ay > cy)) ? ay : cy + ((hitRect.y < 0)) ? -(hitRect.y) : hitRect.y);
if (!(((hitRect.right < cullRect.left)) || ((hitRect.left > cullRect.right)))){
if (!(((hitRect.bottom < cullRect.top)) || ((hitRect.top > cullRect.bottom)))){
} else {
return;
};
} else {
return;
};
};
if ((((((((_arg5 >= 100)) || ((hitRect.width < minimumRenderSize)))) || ((hitRect.height < minimumRenderSize)))) || ((focus == Infinity)))){
a2 = (_arg3.x - _arg2.x);
b2 = (_arg3.y - _arg2.y);
c2 = (_arg4.x - _arg2.x);
d2 = (_arg4.y - _arg2.y);
tempTriangleMatrix.a = ((_arg1.a * a2) + (_arg1.b * c2));
tempTriangleMatrix.b = ((_arg1.a * b2) + (_arg1.b * d2));
tempTriangleMatrix.c = ((_arg1.c * a2) + (_arg1.d * c2));
tempTriangleMatrix.d = ((_arg1.c * b2) + (_arg1.d * d2));
tempTriangleMatrix.tx = (((_arg1.tx * a2) + (_arg1.ty * c2)) + _arg2.x);
tempTriangleMatrix.ty = (((_arg1.tx * b2) + (_arg1.ty * d2)) + _arg2.y);
if (lineAlpha){
tempPreGrp.lineStyle(lineThickness, lineColor, lineAlpha);
};
tempPreGrp.beginBitmapFill(tempPreBmp, tempTriangleMatrix, tiled, smooth);
tempPreGrp.moveTo(_arg2.x, _arg2.y);
tempPreGrp.lineTo(_arg3.x, _arg3.y);
tempPreGrp.lineTo(_arg4.x, _arg4.y);
tempPreGrp.endFill();
if (lineAlpha){
tempPreGrp.lineStyle();
};
tempPreRSD.renderStatistics.triangles++;
return;
};
faz = (focus + az);
fbz = (focus + bz);
fcz = (focus + cz);
mabz = (2 / (faz + fbz));
mbcz = (2 / (fbz + fcz));
mcaz = (2 / (fcz + faz));
mabx = (((ax * faz) + (bx * fbz)) * mabz);
maby = (((ay * faz) + (by * fbz)) * mabz);
mbcx = (((bx * fbz) + (cx * fcz)) * mbcz);
mbcy = (((by * fbz) + (cy * fcz)) * mbcz);
mcax = (((cx * fcz) + (ax * faz)) * mcaz);
mcay = (((cy * fcz) + (ay * faz)) * mcaz);
dabx = ((ax + bx) - mabx);
daby = ((ay + by) - maby);
dbcx = ((bx + cx) - mbcx);
dbcy = ((by + cy) - mbcy);
dcax = ((cx + ax) - mcax);
dcay = ((cy + ay) - mcay);
dsab = ((dabx * dabx) + (daby * daby));
dsbc = ((dbcx * dbcx) + (dbcy * dbcy));
dsca = ((dcax * dcax) + (dcay * dcay));
var _local6:int = (_arg5 + 1);
var _local7:RenderRecStorage = RenderRecStorage(renderRecStorage[int(_arg5)]);
var _local8:Matrix = _local7.mat;
if ((((((dsab <= _precision)) && ((dsca <= _precision)))) && ((dsbc <= _precision)))){
a2 = (_arg3.x - _arg2.x);
b2 = (_arg3.y - _arg2.y);
c2 = (_arg4.x - _arg2.x);
d2 = (_arg4.y - _arg2.y);
tempTriangleMatrix.a = ((_arg1.a * a2) + (_arg1.b * c2));
tempTriangleMatrix.b = ((_arg1.a * b2) + (_arg1.b * d2));
tempTriangleMatrix.c = ((_arg1.c * a2) + (_arg1.d * c2));
tempTriangleMatrix.d = ((_arg1.c * b2) + (_arg1.d * d2));
tempTriangleMatrix.tx = (((_arg1.tx * a2) + (_arg1.ty * c2)) + _arg2.x);
tempTriangleMatrix.ty = (((_arg1.tx * b2) + (_arg1.ty * d2)) + _arg2.y);
if (lineAlpha){
tempPreGrp.lineStyle(lineThickness, lineColor, lineAlpha);
};
tempPreGrp.beginBitmapFill(tempPreBmp, tempTriangleMatrix, tiled, smooth);
tempPreGrp.moveTo(_arg2.x, _arg2.y);
tempPreGrp.lineTo(_arg3.x, _arg3.y);
tempPreGrp.lineTo(_arg4.x, _arg4.y);
tempPreGrp.endFill();
if (lineAlpha){
tempPreGrp.lineStyle();
};
tempPreRSD.renderStatistics.triangles++;
return;
};
if ((((((dsab > _precision)) && ((dsca > _precision)))) && ((dsbc > _precision)))){
_local8.a = (_arg1.a * 2);
_local8.b = (_arg1.b * 2);
_local8.c = (_arg1.c * 2);
_local8.d = (_arg1.d * 2);
_local8.tx = (_arg1.tx * 2);
_local8.ty = (_arg1.ty * 2);
_local7.v0.x = (mabx * 0.5);
_local7.v0.y = (maby * 0.5);
_local7.v0.z = ((az + bz) * 0.5);
_local7.v1.x = (mbcx * 0.5);
_local7.v1.y = (mbcy * 0.5);
_local7.v1.z = ((bz + cz) * 0.5);
_local7.v2.x = (mcax * 0.5);
_local7.v2.y = (mcay * 0.5);
_local7.v2.z = ((cz + az) * 0.5);
renderRec(_local8, _arg2, _local7.v0, _local7.v2, _local6);
_local8.tx = (_local8.tx - 1);
renderRec(_local8, _local7.v0, _arg3, _local7.v1, _local6);
_local8.ty = (_local8.ty - 1);
_local8.tx = (_arg1.tx * 2);
renderRec(_local8, _local7.v2, _local7.v1, _arg4, _local6);
_local8.a = (-(_arg1.a) * 2);
_local8.b = (-(_arg1.b) * 2);
_local8.c = (-(_arg1.c) * 2);
_local8.d = (-(_arg1.d) * 2);
_local8.tx = ((-(_arg1.tx) * 2) + 1);
_local8.ty = ((-(_arg1.ty) * 2) + 1);
renderRec(_local8, _local7.v1, _local7.v2, _local7.v0, _local6);
return;
};
if (precisionMode == PrecisionMode.ORIGINAL){
d2ab = dsab;
d2bc = dsbc;
d2ca = dsca;
dmax = ((dsca > dsbc)) ? ((dsca > dsab)) ? dsca : dsab : ((dsbc > dsab)) ? dsbc : dsab;
} else {
dx = (_arg2.x - _arg3.x);
dy = (_arg2.y - _arg3.y);
d2ab = ((dx * dx) + (dy * dy));
dx = (_arg3.x - _arg4.x);
dy = (_arg3.y - _arg4.y);
d2bc = ((dx * dx) + (dy * dy));
dx = (_arg4.x - _arg2.x);
dy = (_arg4.y - _arg2.y);
d2ca = ((dx * dx) + (dy * dy));
dmax = ((d2ca > d2bc)) ? ((d2ca > d2ab)) ? d2ca : d2ab : ((d2bc > d2ab)) ? d2bc : d2ab;
};
if (d2ab == dmax){
_local8.a = (_arg1.a * 2);
_local8.b = _arg1.b;
_local8.c = (_arg1.c * 2);
_local8.d = _arg1.d;
_local8.tx = (_arg1.tx * 2);
_local8.ty = _arg1.ty;
_local7.v0.x = (mabx * 0.5);
_local7.v0.y = (maby * 0.5);
_local7.v0.z = ((az + bz) * 0.5);
renderRec(_local8, _arg2, _local7.v0, _arg4, _local6);
_local8.a = ((_arg1.a * 2) + _arg1.b);
_local8.c = ((2 * _arg1.c) + _arg1.d);
_local8.tx = (((_arg1.tx * 2) + _arg1.ty) - 1);
renderRec(_local8, _local7.v0, _arg3, _arg4, _local6);
return;
};
if (d2ca == dmax){
_local8.a = _arg1.a;
_local8.b = (_arg1.b * 2);
_local8.c = _arg1.c;
_local8.d = (_arg1.d * 2);
_local8.tx = _arg1.tx;
_local8.ty = (_arg1.ty * 2);
_local7.v2.x = (mcax * 0.5);
_local7.v2.y = (mcay * 0.5);
_local7.v2.z = ((cz + az) * 0.5);
renderRec(_local8, _arg2, _arg3, _local7.v2, _local6);
_local8.b = (_local8.b + _arg1.a);
_local8.d = (_local8.d + _arg1.c);
_local8.ty = (_local8.ty + (_arg1.tx - 1));
renderRec(_local8, _local7.v2, _arg3, _arg4, _local6);
return;
};
_local8.a = (_arg1.a - _arg1.b);
_local8.b = (_arg1.b * 2);
_local8.c = (_arg1.c - _arg1.d);
_local8.d = (_arg1.d * 2);
_local8.tx = (_arg1.tx - _arg1.ty);
_local8.ty = (_arg1.ty * 2);
_local7.v1.x = (mbcx * 0.5);
_local7.v1.y = (mbcy * 0.5);
_local7.v1.z = ((bz + cz) * 0.5);
renderRec(_local8, _arg2, _arg3, _local7.v1, _local6);
_local8.a = (_arg1.a * 2);
_local8.b = (_arg1.b - _arg1.a);
_local8.c = (_arg1.c * 2);
_local8.d = (_arg1.d - _arg1.c);
_local8.tx = (_arg1.tx * 2);
_local8.ty = (_arg1.ty - _arg1.tx);
renderRec(_local8, _arg2, _local7.v1, _arg4, _local6);
}
protected function createRenderRecStorage():void{
this.renderRecStorage = new Array();
var _local1:int;
while (_local1 <= 100) {
this.renderRecStorage[_local1] = new RenderRecStorage();
_local1++;
};
}
public function get texture():Object{
return (this._texture);
}
public function resetUVS():void{
uvMatrices = new Dictionary(false);
}
public function set pixelPrecision(_arg1:int):void{
_precision = ((_arg1 * _arg1) * 1.4);
_perPixelPrecision = _arg1;
}
protected function correctBitmap(_arg1:BitmapData):BitmapData{
var _local2:BitmapData;
var _local3:Number = (1 << MIP_MAP_DEPTH);
var _local4:Number = (_arg1.width / _local3);
_local4 = ((_local4 == uint(_local4))) ? _local4 : (uint(_local4) + 1);
var _local5:Number = (_arg1.height / _local3);
_local5 = ((_local5 == uint(_local5))) ? _local5 : (uint(_local5) + 1);
var _local6:Number = (_local3 * _local4);
var _local7:Number = (_local3 * _local5);
var _local8:Boolean;
if (_local6 > 2880){
_local6 = _arg1.width;
_local8 = false;
};
if (_local7 > 2880){
_local7 = _arg1.height;
_local8 = false;
};
if (!_local8){
PaperLogger.warning((("Material " + this.name) + ": Texture too big for mip mapping. Resizing recommended for better performance and quality."));
};
if (((_arg1) && (((!(((_arg1.width % _local3) == 0))) || (!(((_arg1.height % _local3) == 0))))))){
_local2 = new BitmapData(_local6, _local7, _arg1.transparent, 0);
widthOffset = _arg1.width;
heightOffset = _arg1.height;
this.maxU = (_arg1.width / _local6);
this.maxV = (_arg1.height / _local7);
_local2.draw(_arg1);
extendBitmapEdges(_local2, _arg1.width, _arg1.height);
} else {
this.maxU = (this.maxV = 1);
_local2 = _arg1;
};
return (_local2);
}
protected function createBitmap(_arg1:BitmapData):BitmapData{
var _local2:BitmapData;
resetMapping();
if (AUTO_MIP_MAPPING){
_local2 = correctBitmap(_arg1);
} else {
this.maxU = (this.maxV = 1);
_local2 = _arg1;
};
return (_local2);
}
public function get precise():Boolean{
return (_precise);
}
public function set texture(_arg1:Object):void{
if ((_arg1 is BitmapData) == false){
PaperLogger.error("BitmapMaterial.texture requires a BitmapData object for the texture");
return;
};
bitmap = createBitmap(BitmapData(_arg1));
_texture = _arg1;
}
override public function clone():MaterialObject3D{
var _local1:MaterialObject3D = super.clone();
_local1.maxU = this.maxU;
_local1.maxV = this.maxV;
return (_local1);
}
override public function drawTriangle(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
_triMap = (_arg5) ? _arg5 : ((uvMatrices[_arg1]) || (transformUVRT(_arg1)));
if (((!(_precise)) || (!(_triMap)))){
if (lineAlpha){
_arg2.lineStyle(lineThickness, lineColor, lineAlpha);
};
if (bitmap){
x0 = _arg1.v0.x;
y0 = _arg1.v0.y;
x1 = _arg1.v1.x;
y1 = _arg1.v1.y;
x2 = _arg1.v2.x;
y2 = _arg1.v2.y;
_triMatrix.a = (x1 - x0);
_triMatrix.b = (y1 - y0);
_triMatrix.c = (x2 - x0);
_triMatrix.d = (y2 - y0);
_triMatrix.tx = x0;
_triMatrix.ty = y0;
_localMatrix.a = _triMap.a;
_localMatrix.b = _triMap.b;
_localMatrix.c = _triMap.c;
_localMatrix.d = _triMap.d;
_localMatrix.tx = _triMap.tx;
_localMatrix.ty = _triMap.ty;
_localMatrix.concat(_triMatrix);
_arg2.beginBitmapFill((_arg4) ? _arg4 : bitmap, _localMatrix, tiled, smooth);
};
_arg2.moveTo(x0, y0);
_arg2.lineTo(x1, y1);
_arg2.lineTo(x2, y2);
_arg2.lineTo(x0, y0);
if (bitmap){
_arg2.endFill();
};
if (lineAlpha){
_arg2.lineStyle();
};
_arg3.renderStatistics.triangles++;
} else {
if (bitmap){
focus = _arg3.camera.focus;
tempPreBmp = (_arg4) ? _arg4 : bitmap;
tempPreRSD = _arg3;
tempPreGrp = _arg2;
cullRect = _arg3.viewPort.cullingRectangle;
renderRec(_triMap, _arg1.v0, _arg1.v1, _arg1.v2, 0);
};
};
}
public function get precision():int{
return (_precision);
}
public function resetMapping():void{
uvMatrices = new Dictionary();
}
override public function copy(_arg1:MaterialObject3D):void{
super.copy(_arg1);
this.maxU = _arg1.maxU;
this.maxV = _arg1.maxV;
}
override public function toString():String{
return (((((("Texture:" + this.texture) + " lineColor:") + this.lineColor) + " lineAlpha:") + this.lineAlpha));
}
public function get pixelPrecision():int{
return (_perPixelPrecision);
}
public function set precise(_arg1:Boolean):void{
_precise = _arg1;
}
protected function extendBitmapEdges(_arg1:BitmapData, _arg2:Number, _arg3:Number):void{
var _local6:int;
var _local4:Rectangle = new Rectangle();
var _local5:Point = new Point();
if (_arg1.width > _arg2){
_local4.x = (_arg2 - 1);
_local4.y = 0;
_local4.width = 1;
_local4.height = _arg3;
_local5.y = 0;
_local6 = _arg2;
while (_local6 < _arg1.width) {
_local5.x = _local6;
_arg1.copyPixels(_arg1, _local4, _local5);
_local6++;
};
};
if (_arg1.height > _arg3){
_local4.x = 0;
_local4.y = (_arg3 - 1);
_local4.width = _arg1.width;
_local4.height = 1;
_local5.x = 0;
_local6 = _arg3;
while (_local6 < _arg1.height) {
_local5.y = _local6;
_arg1.copyPixels(_arg1, _local4, _local5);
_local6++;
};
};
}
override public function destroy():void{
super.destroy();
if (uvMatrices){
uvMatrices = null;
};
if (bitmap){
bitmap.dispose();
};
this.renderRecStorage = null;
}
public function set precision(_arg1:int):void{
_precision = _arg1;
}
}
}//package org.papervision3d.materials
Section 169
//MovieMaterial (org.papervision3d.materials.MovieMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.log.*;
import org.papervision3d.core.render.material.*;
import org.papervision3d.core.render.draw.*;
public class MovieMaterial extends BitmapMaterial implements ITriangleDrawer, IUpdateBeforeMaterial, IUpdateAfterMaterial {
public var movieTransparent:Boolean;
private var quality:String;
private var materialIsUsed:Boolean;// = false
private var stage:Stage;
private var autoClipRect:Rectangle;
public var allowAutoResize:Boolean;// = false
public var movie:DisplayObject;
private var movieAnimated:Boolean;
protected var recreateBitmapInSuper:Boolean;
private var userClipRect:Rectangle;
public function MovieMaterial(_arg1:DisplayObject=null, _arg2:Boolean=false, _arg3:Boolean=false, _arg4:Boolean=false, _arg5:Rectangle=null){
movieTransparent = _arg2;
this.animated = _arg3;
this.precise = _arg4;
userClipRect = _arg5;
if (_arg1){
texture = _arg1;
};
}
protected function createBitmapFromSprite(_arg1:DisplayObject):BitmapData{
movie = _arg1;
initBitmap(movie);
drawBitmap();
bitmap = super.createBitmap(bitmap);
return (bitmap);
}
public function set rect(_arg1:Rectangle):void{
userClipRect = _arg1;
createBitmapFromSprite(movie);
}
public function updateAfterRender(_arg1:RenderSessionData):void{
if ((((movieAnimated == true)) && ((materialIsUsed == true)))){
drawBitmap();
if (recreateBitmapInSuper){
bitmap = super.createBitmap(bitmap);
recreateBitmapInSuper = false;
};
};
}
public function set animated(_arg1:Boolean):void{
movieAnimated = _arg1;
}
public function drawBitmap():void{
var _local3:String;
bitmap.fillRect(bitmap.rect, fillColor);
if (((stage) && (quality))){
_local3 = stage.quality;
stage.quality = quality;
};
var _local1:Rectangle = rect;
var _local2:Matrix = new Matrix(1, 0, 0, 1, -(_local1.x), -(_local1.y));
bitmap.draw(movie, _local2, movie.transform.colorTransform, null);
if (!userClipRect){
autoClipRect = movie.getBounds(movie);
};
if (((stage) && (quality))){
stage.quality = _local3;
};
}
override public function get texture():Object{
return (this._texture);
}
public function updateBeforeRender(_arg1:RenderSessionData):void{
var _local2:int;
var _local3:int;
materialIsUsed = false;
if (movieAnimated){
if (userClipRect){
_local2 = int((userClipRect.width + 0.5));
_local3 = int((userClipRect.height + 0.5));
} else {
_local2 = int((movie.width + 0.5));
_local3 = int((movie.height + 0.5));
};
if (((allowAutoResize) && (((!((_local2 == bitmap.width))) || (!((_local3 == bitmap.height))))))){
initBitmap(movie);
recreateBitmapInSuper = true;
};
};
}
protected function initBitmap(_arg1:DisplayObject):void{
if (bitmap){
bitmap.dispose();
};
if (userClipRect){
bitmap = new BitmapData(int((userClipRect.width + 0.5)), int((userClipRect.height + 0.5)), movieTransparent, fillColor);
} else {
if ((((_arg1.width == 0)) || ((_arg1.height == 0)))){
bitmap = new BitmapData(0x0100, 0x0100, movieTransparent, fillColor);
} else {
bitmap = new BitmapData(int((_arg1.width + 0.5)), int((_arg1.height + 0.5)), movieTransparent, fillColor);
};
};
}
public function get animated():Boolean{
return (movieAnimated);
}
public function get rect():Rectangle{
var _local1:Rectangle = ((userClipRect) || (autoClipRect));
if (((!(_local1)) && (movie))){
_local1 = movie.getBounds(movie);
};
return (_local1);
}
override public function set texture(_arg1:Object):void{
if ((_arg1 is DisplayObject) == false){
PaperLogger.error("MovieMaterial.texture requires a Sprite to be passed as the object");
return;
};
bitmap = createBitmapFromSprite(DisplayObject(_arg1));
_texture = _arg1;
}
override public function drawTriangle(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
materialIsUsed = true;
super.drawTriangle(_arg1, _arg2, _arg3, _arg4, _arg5);
}
public function setQuality(_arg1:String, _arg2:Stage, _arg3:Boolean=true):void{
this.quality = _arg1;
this.stage = _arg2;
if (_arg3){
createBitmapFromSprite(movie);
};
}
}
}//package org.papervision3d.materials
Section 170
//WireframeMaterial (org.papervision3d.materials.WireframeMaterial)
package org.papervision3d.materials {
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.render.draw.*;
import org.papervision3d.core.material.*;
public class WireframeMaterial extends TriangleMaterial implements ITriangleDrawer {
public function WireframeMaterial(_arg1:Number=0xFF00FF, _arg2:Number=1, _arg3:Number=0){
this.lineColor = _arg1;
this.lineAlpha = _arg2;
this.lineThickness = _arg3;
this.doubleSided = false;
}
override public function toString():String{
return (((("WireframeMaterial - color:" + this.lineColor) + " alpha:") + this.lineAlpha));
}
override public function drawTriangle(_arg1:RenderTriangle, _arg2:Graphics, _arg3:RenderSessionData, _arg4:BitmapData=null, _arg5:Matrix=null):void{
var _local6:Number = _arg1.v0.x;
var _local7:Number = _arg1.v0.y;
if (lineAlpha){
_arg2.lineStyle(lineThickness, lineColor, lineAlpha);
_arg2.moveTo(_local6, _local7);
_arg2.lineTo(_arg1.v1.x, _arg1.v1.y);
_arg2.lineTo(_arg1.v2.x, _arg1.v2.y);
_arg2.lineTo(_local6, _local7);
_arg2.lineStyle();
_arg3.renderStatistics.triangles++;
};
}
}
}//package org.papervision3d.materials
Section 171
//Plane (org.papervision3d.objects.primitives.Plane)
package org.papervision3d.objects.primitives {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.*;
public class Plane extends TriangleMesh3D {
public var segmentsH:Number;
public var segmentsW:Number;
public static var DEFAULT_SCALE:Number = 1;
public static var DEFAULT_SEGMENTS:Number = 1;
public static var DEFAULT_SIZE:Number = 500;
public function Plane(_arg1:MaterialObject3D=null, _arg2:Number=0, _arg3:Number=0, _arg4:Number=0, _arg5:Number=0){
super(_arg1, new Array(), new Array(), null);
this.segmentsW = ((_arg4) || (DEFAULT_SEGMENTS));
this.segmentsH = ((_arg5) || (this.segmentsW));
var _local6:Number = DEFAULT_SCALE;
if (!_arg3){
if (_arg2){
_local6 = _arg2;
};
if (((_arg1) && (_arg1.bitmap))){
_arg2 = (_arg1.bitmap.width * _local6);
_arg3 = (_arg1.bitmap.height * _local6);
} else {
_arg2 = (DEFAULT_SIZE * _local6);
_arg3 = (DEFAULT_SIZE * _local6);
};
};
buildPlane(_arg2, _arg3);
}
private function buildPlane(_arg1:Number, _arg2:Number):void{
var _local14:NumberUV;
var _local15:NumberUV;
var _local16:NumberUV;
var _local17:int;
var _local18:Number;
var _local19:Number;
var _local20:Vertex3D;
var _local21:Vertex3D;
var _local22:Vertex3D;
var _local3:Number = this.segmentsW;
var _local4:Number = this.segmentsH;
var _local5:Number = (_local3 + 1);
var _local6:Number = (_local4 + 1);
var _local7:Array = this.geometry.vertices;
var _local8:Array = this.geometry.faces;
var _local9:Number = (_arg1 / 2);
var _local10:Number = (_arg2 / 2);
var _local11:Number = (_arg1 / _local3);
var _local12:Number = (_arg2 / _local4);
var _local13:int;
while (_local13 < (_local3 + 1)) {
_local17 = 0;
while (_local17 < _local6) {
_local18 = ((_local13 * _local11) - _local9);
_local19 = ((_local17 * _local12) - _local10);
_local7.push(new Vertex3D(_local18, _local19, 0));
_local17++;
};
_local13++;
};
_local13 = 0;
while (_local13 < _local3) {
_local17 = 0;
while (_local17 < _local4) {
_local20 = _local7[((_local13 * _local6) + _local17)];
_local21 = _local7[((_local13 * _local6) + (_local17 + 1))];
_local22 = _local7[(((_local13 + 1) * _local6) + _local17)];
_local14 = new NumberUV((_local13 / _local3), (_local17 / _local4));
_local15 = new NumberUV((_local13 / _local3), ((_local17 + 1) / _local4));
_local16 = new NumberUV(((_local13 + 1) / _local3), (_local17 / _local4));
_local8.push(new Triangle3D(this, [_local20, _local22, _local21], material, [_local14, _local16, _local15]));
_local20 = _local7[(((_local13 + 1) * _local6) + (_local17 + 1))];
_local21 = _local7[(((_local13 + 1) * _local6) + _local17)];
_local22 = _local7[((_local13 * _local6) + (_local17 + 1))];
_local14 = new NumberUV(((_local13 + 1) / _local3), ((_local17 + 1) / _local4));
_local15 = new NumberUV(((_local13 + 1) / _local3), (_local17 / _local4));
_local16 = new NumberUV((_local13 / _local3), ((_local17 + 1) / _local4));
_local8.push(new Triangle3D(this, [_local20, _local22, _local21], material, [_local14, _local16, _local15]));
_local17++;
};
_local13++;
};
this.geometry.ready = true;
if (Papervision3D.useRIGHTHANDED){
this.geometry.flipFaces();
};
}
}
}//package org.papervision3d.objects.primitives
Section 172
//Sphere (org.papervision3d.objects.primitives.Sphere)
package org.papervision3d.objects.primitives {
import org.papervision3d.core.proto.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.geom.*;
import org.papervision3d.*;
public class Sphere extends TriangleMesh3D {
private var segmentsH:Number;
private var segmentsW:Number;
public static var MIN_SEGMENTSW:Number = 3;
public static var DEFAULT_SCALE:Number = 1;
public static var DEFAULT_RADIUS:Number = 100;
public static var DEFAULT_SEGMENTSH:Number = 6;
public static var MIN_SEGMENTSH:Number = 2;
public static var DEFAULT_SEGMENTSW:Number = 8;
public function Sphere(_arg1:MaterialObject3D=null, _arg2:Number=100, _arg3:int=8, _arg4:int=6){
super(_arg1, new Array(), new Array(), null);
this.segmentsW = Math.max(MIN_SEGMENTSW, ((_arg3) || (DEFAULT_SEGMENTSW)));
this.segmentsH = Math.max(MIN_SEGMENTSH, ((_arg4) || (DEFAULT_SEGMENTSH)));
if (_arg2 == 0){
_arg2 = DEFAULT_RADIUS;
};
var _local5:Number = DEFAULT_SCALE;
buildSphere(_arg2);
}
private function buildSphere(_arg1:Number):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local11:Triangle3D;
var _local12:Number;
var _local13:Number;
var _local14:Number;
var _local15:Array;
var _local16:Vertex3D;
var _local17:Number;
var _local18:Number;
var _local19:Number;
var _local20:int;
var _local21:Boolean;
var _local22:Vertex3D;
var _local23:Vertex3D;
var _local24:Vertex3D;
var _local25:Vertex3D;
var _local26:Number;
var _local27:Number;
var _local28:Number;
var _local29:Number;
var _local30:NumberUV;
var _local31:NumberUV;
var _local32:NumberUV;
var _local33:NumberUV;
var _local5:Number = Math.max(3, this.segmentsW);
var _local6:Number = Math.max(2, this.segmentsH);
var _local7:Array = this.geometry.vertices;
var _local8:Array = this.geometry.faces;
var _local9:Array = new Array();
_local3 = 0;
while (_local3 < (_local6 + 1)) {
_local12 = Number((_local3 / _local6));
_local13 = (-(_arg1) * Math.cos((_local12 * Math.PI)));
_local14 = (_arg1 * Math.sin((_local12 * Math.PI)));
_local15 = new Array();
_local2 = 0;
while (_local2 < _local5) {
_local17 = Number(((2 * _local2) / _local5));
_local18 = (_local14 * Math.sin((_local17 * Math.PI)));
_local19 = (_local14 * Math.cos((_local17 * Math.PI)));
if (!(((((_local3 == 0)) || ((_local3 == _local6)))) && ((_local2 > 0)))){
_local16 = new Vertex3D(_local19, _local13, _local18);
_local7.push(_local16);
};
_local15.push(_local16);
_local2++;
};
_local9.push(_local15);
_local3++;
};
var _local10:int = _local9.length;
_local3 = 0;
while (_local3 < _local10) {
_local20 = _local9[_local3].length;
if (_local3 > 0){
_local2 = 0;
while (_local2 < _local20) {
_local21 = (_local2 == (_local20 - 1));
_local22 = _local9[_local3][(_local21) ? 0 : (_local2 + 1)];
_local23 = _local9[_local3][(_local21) ? (_local20 - 1) : _local2];
_local24 = _local9[(_local3 - 1)][(_local21) ? (_local20 - 1) : _local2];
_local25 = _local9[(_local3 - 1)][(_local21) ? 0 : (_local2 + 1)];
_local26 = (_local3 / (_local10 - 1));
_local27 = ((_local3 - 1) / (_local10 - 1));
_local28 = ((_local2 + 1) / _local20);
_local29 = (_local2 / _local20);
_local30 = new NumberUV(_local28, _local27);
_local31 = new NumberUV(_local28, _local26);
_local32 = new NumberUV(_local29, _local26);
_local33 = new NumberUV(_local29, _local27);
if (_local3 < (_local9.length - 1)){
_local8.push(new Triangle3D(this, new Array(_local22, _local23, _local24), material, new Array(_local31, _local32, _local33)));
};
if (_local3 > 1){
_local8.push(new Triangle3D(this, new Array(_local22, _local24, _local25), material, new Array(_local31, _local33, _local30)));
};
_local2++;
};
};
_local3++;
};
for each (_local11 in _local8) {
_local11.renderCommand.create = createRenderTriangle;
};
this.geometry.ready = true;
if (Papervision3D.useRIGHTHANDED){
this.geometry.flipFaces();
};
}
}
}//package org.papervision3d.objects.primitives
Section 173
//DisplayObject3D (org.papervision3d.objects.DisplayObject3D)
package org.papervision3d.objects {
import org.papervision3d.core.render.data.*;
import org.papervision3d.view.layer.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.view.*;
import org.papervision3d.core.data.*;
import org.papervision3d.core.math.*;
import org.papervision3d.core.geom.renderables.*;
import org.papervision3d.core.log.*;
import org.papervision3d.materials.utils.*;
import org.papervision3d.materials.shaders.*;
import org.papervision3d.core.material.*;
import org.papervision3d.*;
public class DisplayObject3D extends DisplayObjectContainer3D {
public var extra:Object;
public var frustumTestMethod:int;// = 0
private var _rot:Quaternion;
public var id:int;
private var _rotationY:Number;
private var _rotationZ:Number;
public var cullTest:Number;// = 0
private var _lookatTarget:Number3D;
public var materials:MaterialsList;
public var meshSort:uint;// = 1
private var _rotationX:Number;
private var _qYaw:Quaternion;
private var _xAxis:Number3D;
private var _zAxis:Number3D;
private var _scaleDirty:Boolean;// = false
private var _autoCalcScreenCoords:Boolean;// = false
private var _tempScale:Number3D;
private var _numClones:uint;// = 0
public var alpha:Number;// = 1
public var useClipping:Boolean;// = true
public var screen:Number3D;
private var _scaleX:Number;
private var _scaleY:Number;
private var _scaleZ:Number;
public var geometry:GeometryObject3D;
private var _qPitch:Quaternion;
public var visible:Boolean;
protected var _userData:UserData;
public var screenZ:Number;
public var container:ViewportLayer;
protected var _useOwnContainer:Boolean;// = false
public var transform:Matrix3D;
private var _material:MaterialObject3D;
private var _position:Number3D;
public var name:String;
protected var _scene:SceneObject3D;// = null
private var _qRoll:Quaternion;
private var _localRotationZ:Number;// = 0
public var culled:Boolean;
public var world:Matrix3D;
public var blendMode:String;// = "normal"
private var _localRotationX:Number;// = 0
private var _localRotationY:Number;// = 0
public var view:Matrix3D;
public var parent:DisplayObjectContainer3D;
public var faces:Array;
private var _yAxis:Number3D;
public var flipLightDirection:Boolean;// = false
private var _rotation:Number3D;
protected var _transformDirty:Boolean;// = false
protected var _sorted:Array;
private var _rotationDirty:Boolean;// = false
public var parentContainer:DisplayObject3D;
public var testQuad:Boolean;// = true
public var filters:Array;
public static const MESH_SORT_CENTER:uint = 1;
private static const LEFT:Number3D = new Number3D(-1, 0, 0);
public static const MESH_SORT_CLOSE:uint = 3;
private static const BACKWARD:Number3D = new Number3D(0, 0, -1);
private static const FORWARD:Number3D = new Number3D(0, 0, 1);
public static const MESH_SORT_FAR:uint = 2;
private static const DOWN:Number3D = new Number3D(0, -1, 0);
private static const UP:Number3D = new Number3D(0, 1, 0);
private static const RIGHT:Number3D = new Number3D(1, 0, 0);
private static var entry_count:uint = 0;
private static var _newID:int = 0;
private static var _tempMatrix:Matrix3D = Matrix3D.IDENTITY;
public static var sortedArray:Array = new Array();
public static var faceLevelMode:Boolean;
private static var _tempQuat:Quaternion = new Quaternion();
private static var toRADIANS:Number = 0.0174532925199433;
private static var toDEGREES:Number = 57.2957795130823;
public function DisplayObject3D(_arg1:String=null, _arg2:GeometryObject3D=null):void{
faces = new Array();
filters = [];
screen = new Number3D();
_position = Number3D.ZERO;
_lookatTarget = Number3D.ZERO;
_zAxis = Number3D.ZERO;
_xAxis = Number3D.ZERO;
_yAxis = Number3D.ZERO;
_rotation = Number3D.ZERO;
_rot = new Quaternion();
_qPitch = new Quaternion();
_qYaw = new Quaternion();
_qRoll = new Quaternion();
super();
if (_arg1 != null){
PaperLogger.info(("DisplayObject3D: " + _arg1));
};
this.culled = false;
this.transform = Matrix3D.IDENTITY;
this.world = Matrix3D.IDENTITY;
this.view = Matrix3D.IDENTITY;
this.x = 0;
this.y = 0;
this.z = 0;
rotationX = 0;
rotationY = 0;
rotationZ = 0;
_localRotationX = (_localRotationY = (_localRotationZ = 0));
var _local3:Number = (Papervision3D.usePERCENT) ? 100 : 1;
scaleX = _local3;
scaleY = _local3;
scaleZ = _local3;
_tempScale = new Number3D();
this.visible = true;
this.id = _newID++;
this.name = ((_arg1) || (String(this.id)));
_numClones = 0;
if (_arg2){
addGeometry(_arg2);
};
}
public function set localRotationX(_arg1:Number):void{
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
if (this._transformDirty){
updateTransform();
};
_qPitch.setFromAxisAngle(transform.n11, transform.n21, transform.n31, (_localRotationX - _arg1));
this.transform.calculateMultiply3x3(_qPitch.matrix, transform);
_localRotationX = _arg1;
_rotationDirty = true;
}
public function set y(_arg1:Number):void{
this.transform.n24 = _arg1;
}
public function set z(_arg1:Number):void{
this.transform.n34 = _arg1;
}
override public function addChild(_arg1:DisplayObject3D, _arg2:String=null):DisplayObject3D{
_arg1 = super.addChild(_arg1, _arg2);
if (_arg1.scene == null){
_arg1.scene = scene;
};
if (this.useOwnContainer){
_arg1.parentContainer = this;
};
return (_arg1);
}
public function setChildMaterialByName(_arg1:String, _arg2:MaterialObject3D):void{
setChildMaterial(getChildByName(_arg1, true), _arg2);
}
public function moveDown(_arg1:Number):void{
translate(_arg1, DOWN);
}
public function project(_arg1:DisplayObject3D, _arg2:RenderSessionData):Number{
var _local5:DisplayObject3D;
if (this._transformDirty){
updateTransform();
};
this.world.calculateMultiply(_arg1.world, this.transform);
if (_arg2.camera.culler){
if (this === _arg2.camera){
this.culled = true;
} else {
this.culled = (_arg2.camera.culler.testObject(this) < 0);
};
if (this.culled){
_arg2.renderStatistics.culledObjects++;
return (0);
};
} else {
this.culled = false;
};
if (_arg1 !== _arg2.camera){
if (_arg2.camera.useProjectionMatrix){
this.view.calculateMultiply4x4(_arg1.view, this.transform);
} else {
this.view.calculateMultiply(_arg1.view, this.transform);
};
} else {
if (_arg2.camera.useProjectionMatrix){
this.view.calculateMultiply4x4(_arg2.camera.eye, this.transform);
} else {
this.view.calculateMultiply(_arg2.camera.eye, this.transform);
};
};
if (_autoCalcScreenCoords){
calculateScreenCoords(_arg2.camera);
};
var _local3:Number = 0;
var _local4:Number = 0;
for each (_local5 in this._childrenByName) {
if (_local5.visible){
_local3 = (_local3 + _local5.project(this, _arg2));
_local4++;
};
};
return ((this.screenZ = (_local3 / _local4)));
}
public function set scene(_arg1:SceneObject3D):void{
var _local2:DisplayObject3D;
_scene = _arg1;
for each (_local2 in this._childrenByName) {
if (_local2.scene == null){
_local2.scene = _scene;
};
};
}
public function setChildMaterial(_arg1:DisplayObject3D, _arg2:MaterialObject3D, _arg3:MaterialObject3D=null):void{
var _local4:Triangle3D;
if (!_arg1){
return;
};
if (((!(_arg3)) || ((_arg1.material === _arg3)))){
_arg1.material = _arg2;
};
if (((_arg1.geometry) && (_arg1.geometry.faces))){
for each (_local4 in _arg1.geometry.faces) {
if (((!(_arg3)) || ((_local4.material === _arg3)))){
_local4.material = _arg2;
};
};
};
}
public function get userData():UserData{
return (_userData);
}
public function get material():MaterialObject3D{
return (_material);
}
public function set userData(_arg1:UserData):void{
_userData = _arg1;
}
public function set rotationX(_arg1:Number):void{
this._rotationX = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
this._transformDirty = true;
}
public function calculateScreenCoords(_arg1:CameraObject3D):void{
var _local2:Number;
var _local3:Number;
var _local4:Number;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
if (_arg1.useProjectionMatrix){
_local2 = 0;
_local3 = 0;
_local4 = 0;
_local5 = ((((_local2 * view.n41) + (_local3 * view.n42)) + (_local4 * view.n43)) + view.n44);
_local6 = (_arg1.viewport.width / 2);
_local7 = (_arg1.viewport.height / 2);
screen.x = (((((_local2 * view.n11) + (_local3 * view.n12)) + (_local4 * view.n13)) + view.n14) / _local5);
screen.y = (((((_local2 * view.n21) + (_local3 * view.n22)) + (_local4 * view.n23)) + view.n24) / _local5);
screen.z = ((((_local2 * view.n31) + (_local3 * view.n32)) + (_local4 * view.n33)) + view.n34);
screen.x = (screen.x * _local6);
screen.y = (screen.y * _local7);
} else {
_local8 = ((_arg1.focus * _arg1.zoom) / (_arg1.focus + view.n34));
screen.x = (view.n14 * _local8);
screen.y = (view.n24 * _local8);
screen.z = view.n34;
};
}
public function lookAt(_arg1:DisplayObject3D, _arg2:Number3D=null):void{
var _local3:DisplayObject3D;
var _local4:Matrix3D;
if ((this is CameraObject3D)){
_position.reset(this.x, this.y, this.z);
} else {
_local3 = (this.parent as DisplayObject3D);
if (_local3){
world.calculateMultiply(_local3.world, transform);
} else {
world.copy(transform);
};
_position.reset(world.n14, world.n24, world.n34);
};
if ((_arg1 is CameraObject3D)){
_lookatTarget.reset(_arg1.x, _arg1.y, _arg1.z);
} else {
_local3 = (_arg1.parent as DisplayObject3D);
if (_local3){
_arg1.world.calculateMultiply(_local3.world, _arg1.transform);
} else {
_arg1.world.copy(_arg1.transform);
};
_lookatTarget.reset(_arg1.world.n14, _arg1.world.n24, _arg1.world.n34);
};
_zAxis.copyFrom(_lookatTarget);
_zAxis.minusEq(_position);
_zAxis.normalize();
if (_zAxis.modulo > 0.1){
_xAxis = Number3D.cross(_zAxis, ((_arg2) || (UP)), _xAxis);
_xAxis.normalize();
_yAxis = Number3D.cross(_zAxis, _xAxis, _yAxis);
_yAxis.normalize();
_local4 = this.transform;
_local4.n11 = (_xAxis.x * _scaleX);
_local4.n21 = (_xAxis.y * _scaleX);
_local4.n31 = (_xAxis.z * _scaleX);
_local4.n12 = (-(_yAxis.x) * _scaleY);
_local4.n22 = (-(_yAxis.y) * _scaleY);
_local4.n32 = (-(_yAxis.z) * _scaleY);
_local4.n13 = (_zAxis.x * _scaleZ);
_local4.n23 = (_zAxis.y * _scaleZ);
_local4.n33 = (_zAxis.z * _scaleZ);
_localRotationX = (_localRotationY = (_localRotationZ = 0));
this._transformDirty = false;
this._rotationDirty = true;
} else {
PaperLogger.error("lookAt error");
};
}
public function set rotationZ(_arg1:Number):void{
this._rotationZ = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
this._transformDirty = true;
}
public function pitch(_arg1:Number):void{
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
if (this._transformDirty){
updateTransform();
};
_qPitch.setFromAxisAngle(transform.n11, transform.n21, transform.n31, _arg1);
this.transform.calculateMultiply3x3(_qPitch.matrix, transform);
_localRotationX = (_localRotationX + _arg1);
_rotationDirty = true;
}
public function set rotationY(_arg1:Number):void{
this._rotationY = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
this._transformDirty = true;
}
public function get position():Number3D{
_position.reset(this.x, this.y, this.z);
return (_position);
}
public function get sceneX():Number{
return (this.world.n14);
}
public function get scaleX():Number{
if (Papervision3D.usePERCENT){
return ((this._scaleX * 100));
};
return (this._scaleX);
}
public function get scaleY():Number{
if (Papervision3D.usePERCENT){
return ((this._scaleY * 100));
};
return (this._scaleY);
}
public function get scaleZ():Number{
if (Papervision3D.usePERCENT){
return ((this._scaleZ * 100));
};
return (this._scaleZ);
}
public function get scale():Number{
if ((((this._scaleX == this._scaleY)) && ((this._scaleX == this._scaleZ)))){
if (Papervision3D.usePERCENT){
return ((this._scaleX * 100));
};
return (this._scaleX);
//unresolved jump
};
return (NaN);
}
public function set position(_arg1:Number3D):void{
this.x = _arg1.x;
this.y = _arg1.y;
this.z = _arg1.z;
}
public function moveUp(_arg1:Number):void{
translate(_arg1, UP);
}
public function get sceneZ():Number{
return (this.world.n34);
}
public function get sceneY():Number{
return (this.world.n24);
}
public function distanceTo(_arg1:DisplayObject3D):Number{
var _local2:Number = (this.x - _arg1.x);
var _local3:Number = (this.y - _arg1.y);
var _local4:Number = (this.z - _arg1.z);
return (Math.sqrt((((_local2 * _local2) + (_local3 * _local3)) + (_local4 * _local4))));
}
public function addGeometry(_arg1:GeometryObject3D=null):void{
if (_arg1){
this.geometry = _arg1;
};
}
protected function setParentContainer(_arg1:DisplayObject3D, _arg2:Boolean=true):void{
var _local3:DisplayObject3D;
if (((_arg2) && (!((_arg1 == this))))){
parentContainer = _arg1;
};
for each (_local3 in children) {
_local3.setParentContainer(_arg1, _arg2);
};
}
private function updateMaterials(_arg1:DisplayObject3D, _arg2:MaterialObject3D, _arg3:MaterialObject3D):void{
var _local4:DisplayObject3D;
var _local5:Triangle3D;
_arg2.unregisterObject(_arg1);
if ((((_arg3 is AbstractLightShadeMaterial)) || ((_arg3 is ShadedMaterial)))){
_arg3.registerObject(_arg1);
};
if (_arg1.material === _arg2){
_arg1.material = _arg3;
};
if (((((_arg1.geometry) && (_arg1.geometry.faces))) && (_arg1.geometry.faces.length))){
for each (_local5 in _arg1.geometry.faces) {
if (_local5.material === _arg2){
_local5.material = _arg3;
};
};
};
for each (_local4 in _arg1.children) {
updateMaterials(_local4, _arg2, _arg3);
};
}
public function clone():DisplayObject3D{
var _local3:DisplayObject3D;
var _local1:String = ((this.name + "_") + _numClones++);
var _local2:DisplayObject3D = new DisplayObject3D(_local1);
if (this.material){
_local2.material = this.material;
};
if (this.materials){
_local2.materials = this.materials.clone();
};
if (this.geometry){
_local2.geometry = this.geometry.clone(_local2);
_local2.geometry.ready = true;
};
_local2.copyTransform(this);
for each (_local3 in this.children) {
_local2.addChild(_local3.clone());
};
return (_local2);
}
public function set material(_arg1:MaterialObject3D):void{
if (_material){
_material.unregisterObject(this);
};
_material = _arg1;
if (_material){
_material.registerObject(this);
};
}
private function updateRotation():void{
_tempScale.x = (Papervision3D.usePERCENT) ? (_scaleX * 100) : _scaleX;
_tempScale.y = (Papervision3D.usePERCENT) ? (_scaleY * 100) : _scaleY;
_tempScale.z = (Papervision3D.usePERCENT) ? (_scaleZ * 100) : _scaleZ;
_rotation = Matrix3D.matrix2euler(this.transform, _rotation, _tempScale);
this._rotationX = (_rotation.x * toRADIANS);
this._rotationY = (_rotation.y * toRADIANS);
this._rotationZ = (_rotation.z * toRADIANS);
this._rotationDirty = false;
}
public function hitTestObject(_arg1:DisplayObject3D, _arg2:Number=1):Boolean{
var _local3:Number = (this.x - _arg1.x);
var _local4:Number = (this.y - _arg1.y);
var _local5:Number = (this.z - _arg1.z);
var _local6:Number = (((_local3 * _local3) + (_local4 * _local4)) + (_local5 * _local5));
var _local7:Number = (this.geometry) ? this.geometry.boundingSphere.maxDistance : 0;
var _local8:Number = (_arg1.geometry) ? _arg1.geometry.boundingSphere.maxDistance : 0;
_local7 = (_local7 * _arg2);
return (((_local7 + _local8) > _local6));
}
public function translate(_arg1:Number, _arg2:Number3D):void{
var _local3:Number3D = _arg2.clone();
if (this._transformDirty){
updateTransform();
};
Matrix3D.rotateAxis(transform, _local3);
this.x = (this.x + (_arg1 * _local3.x));
this.y = (this.y + (_arg1 * _local3.y));
this.z = (this.z + (_arg1 * _local3.z));
}
public function get localRotationZ():Number{
return ((Papervision3D.useDEGREES) ? (_localRotationZ * toDEGREES) : _localRotationZ);
}
public function get localRotationY():Number{
return ((Papervision3D.useDEGREES) ? (_localRotationY * toDEGREES) : _localRotationY);
}
public function get z():Number{
return (this.transform.n34);
}
public function get localRotationX():Number{
return ((Papervision3D.useDEGREES) ? (_localRotationX * toDEGREES) : _localRotationX);
}
public function get x():Number{
return (this.transform.n14);
}
public function get y():Number{
return (this.transform.n24);
}
public function moveLeft(_arg1:Number):void{
translate(_arg1, LEFT);
}
public function replaceMaterialByName(_arg1:MaterialObject3D, _arg2:String):void{
if (!this.materials){
return;
};
var _local3:MaterialObject3D = this.materials.getMaterialByName(_arg2);
if (!_local3){
return;
};
if (this.material === _local3){
this.material = _arg1;
};
_local3 = this.materials.removeMaterial(_local3);
_arg1 = this.materials.addMaterial(_arg1, _arg2);
updateMaterials(this, _local3, _arg1);
}
public function get scene():SceneObject3D{
return (_scene);
}
public function set useOwnContainer(_arg1:Boolean):void{
_useOwnContainer = _arg1;
setParentContainer(this, true);
}
public function getMaterialByName(_arg1:String):MaterialObject3D{
var _local3:DisplayObject3D;
var _local2:MaterialObject3D = (this.materials) ? this.materials.getMaterialByName(_arg1) : null;
if (_local2){
return (_local2);
};
for each (_local3 in this._childrenByName) {
_local2 = _local3.getMaterialByName(_arg1);
if (_local2){
return (_local2);
};
};
return (null);
}
public function copyTransform(_arg1):void{
var _local4:DisplayObject3D;
if ((_arg1 is DisplayObject3D)){
_local4 = DisplayObject3D(_arg1);
if (_local4._transformDirty){
_local4.updateTransform();
};
};
var _local2:Matrix3D = this.transform;
var _local3:Matrix3D = ((_arg1 is DisplayObject3D)) ? _arg1.transform : _arg1;
_local2.n11 = _local3.n11;
_local2.n12 = _local3.n12;
_local2.n13 = _local3.n13;
_local2.n14 = _local3.n14;
_local2.n21 = _local3.n21;
_local2.n22 = _local3.n22;
_local2.n23 = _local3.n23;
_local2.n24 = _local3.n24;
_local2.n31 = _local3.n31;
_local2.n32 = _local3.n32;
_local2.n33 = _local3.n33;
_local2.n34 = _local3.n34;
this._transformDirty = false;
this._rotationDirty = true;
}
public function get rotationY():Number{
if (this._rotationDirty){
updateRotation();
};
return ((Papervision3D.useDEGREES) ? (this._rotationY * toDEGREES) : this._rotationY);
}
public function get rotationZ():Number{
if (this._rotationDirty){
updateRotation();
};
return ((Papervision3D.useDEGREES) ? (this._rotationZ * toDEGREES) : this._rotationZ);
}
public function set scaleY(_arg1:Number):void{
if (this._rotationDirty){
updateRotation();
};
if (Papervision3D.usePERCENT){
this._scaleY = (_arg1 / 100);
} else {
this._scaleY = _arg1;
};
this._transformDirty = true;
}
public function roll(_arg1:Number):void{
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
if (_transformDirty){
updateTransform();
};
_qRoll.setFromAxisAngle(transform.n13, transform.n23, transform.n33, _arg1);
transform.calculateMultiply3x3(_qRoll.matrix, transform);
_localRotationZ = (_localRotationZ + _arg1);
_rotationDirty = true;
}
public function set scaleZ(_arg1:Number):void{
if (this._rotationDirty){
updateRotation();
};
if (Papervision3D.usePERCENT){
this._scaleZ = (_arg1 / 100);
} else {
this._scaleZ = _arg1;
};
this._transformDirty = true;
}
public function get rotationX():Number{
if (this._rotationDirty){
updateRotation();
};
return ((Papervision3D.useDEGREES) ? (this._rotationX * toDEGREES) : this._rotationX);
}
public function set scale(_arg1:Number):void{
if (this._rotationDirty){
updateRotation();
};
if (Papervision3D.usePERCENT){
_arg1 = (_arg1 / 100);
};
this._scaleX = (this._scaleY = (this._scaleZ = _arg1));
this._transformDirty = true;
}
public function get autoCalcScreenCoords():Boolean{
return (_autoCalcScreenCoords);
}
public function yaw(_arg1:Number):void{
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
if (_transformDirty){
updateTransform();
};
_qYaw.setFromAxisAngle(transform.n12, transform.n22, transform.n32, _arg1);
transform.calculateMultiply3x3(_qYaw.matrix, transform);
_localRotationY = (_localRotationY + _arg1);
_rotationDirty = true;
}
public function set scaleX(_arg1:Number):void{
if (this._rotationDirty){
updateRotation();
};
if (Papervision3D.usePERCENT){
this._scaleX = (_arg1 / 100);
} else {
this._scaleX = _arg1;
};
this._transformDirty = true;
}
public function createViewportLayer(_arg1:Viewport3D, _arg2:Boolean=true):ViewportLayer{
var _local3:ViewportLayer = _arg1.getChildLayer(this, true);
if (_arg2){
addChildrenToLayer(this, _local3);
};
return (_local3);
}
override public function toString():String{
return (((((((this.name + ": x:") + Math.round(this.x)) + " y:") + Math.round(this.y)) + " z:") + Math.round(this.z)));
}
public function moveForward(_arg1:Number):void{
translate(_arg1, FORWARD);
}
public function addChildrenToLayer(_arg1:DisplayObject3D, _arg2:ViewportLayer):void{
var _local3:DisplayObject3D;
for each (_local3 in _arg1.children) {
_arg2.addDisplayObject3D(_local3);
_local3.addChildrenToLayer(_local3, _arg2);
};
}
public function copyPosition(_arg1):void{
var _local2:Matrix3D = this.transform;
var _local3:Matrix3D = ((_arg1 is DisplayObject3D)) ? _arg1.transform : _arg1;
_local2.n14 = _local3.n14;
_local2.n24 = _local3.n24;
_local2.n34 = _local3.n34;
}
public function get useOwnContainer():Boolean{
return (_useOwnContainer);
}
public function updateTransform():void{
_rot.setFromEuler(_rotationY, _rotationZ, _rotationX);
this.transform.copy3x3(_rot.matrix);
_tempMatrix.reset();
_tempMatrix.n11 = this._scaleX;
_tempMatrix.n22 = this._scaleY;
_tempMatrix.n33 = this._scaleZ;
this.transform.calculateMultiply(this.transform, _tempMatrix);
_transformDirty = false;
}
public function hitTestPoint(_arg1:Number, _arg2:Number, _arg3:Number):Boolean{
var _local4:Number = (this.x - _arg1);
var _local5:Number = (this.y - _arg2);
var _local6:Number = (this.z - _arg3);
var _local7:Number = (((_local4 * _local4) + (_local5 * _local5)) + (_local6 * _local6));
var _local8:Number = (this.geometry) ? this.geometry.boundingSphere.maxDistance : 0;
return ((_local8 > _local7));
}
public function moveBackward(_arg1:Number):void{
translate(_arg1, BACKWARD);
}
public function set localRotationY(_arg1:Number):void{
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
if (_transformDirty){
updateTransform();
};
_qYaw.setFromAxisAngle(transform.n12, transform.n22, transform.n32, (_localRotationY - _arg1));
transform.calculateMultiply3x3(_qYaw.matrix, transform);
_localRotationY = _arg1;
_rotationDirty = true;
}
public function set localRotationZ(_arg1:Number):void{
_arg1 = (Papervision3D.useDEGREES) ? (_arg1 * toRADIANS) : _arg1;
if (_transformDirty){
updateTransform();
};
_qRoll.setFromAxisAngle(transform.n13, transform.n23, transform.n33, (_localRotationZ - _arg1));
transform.calculateMultiply3x3(_qRoll.matrix, transform);
_localRotationZ = _arg1;
_rotationDirty = true;
}
public function moveRight(_arg1:Number):void{
translate(_arg1, RIGHT);
}
public function set x(_arg1:Number):void{
this.transform.n14 = _arg1;
}
public function materialsList():String{
var _local2:String;
var _local3:DisplayObject3D;
var _local1 = "";
for (_local2 in this.materials) {
_local1 = (_local1 + (_local2 + "\n"));
};
for each (_local3 in this._childrenByName) {
for (_local2 in _local3.materials.materialsByName) {
_local1 = (_local1 + (("+ " + _local2) + "\n"));
};
};
return (_local1);
}
public function set autoCalcScreenCoords(_arg1:Boolean):void{
_autoCalcScreenCoords = _arg1;
}
public static function get ZERO():DisplayObject3D{
return (new (DisplayObject3D));
}
}
}//package org.papervision3d.objects
Section 174
//BasicRenderEngine (org.papervision3d.render.BasicRenderEngine)
package org.papervision3d.render {
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.view.layer.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.proto.*;
import org.papervision3d.view.*;
import org.papervision3d.core.render.material.*;
import org.papervision3d.core.utils.*;
import org.papervision3d.core.render.*;
import org.papervision3d.core.clipping.*;
import org.papervision3d.events.*;
import org.papervision3d.core.render.sort.*;
import org.papervision3d.core.render.project.*;
import org.papervision3d.core.render.filter.*;
public class BasicRenderEngine extends AbstractRenderEngine implements IRenderEngine {
public var clipping:DefaultClipping;
protected var renderDoneEvent:RendererEvent;
public var sorter:IRenderSorter;
public var projectionPipeline:ProjectionPipeline;
protected var renderList:Array;
protected var renderStatistics:RenderStatistics;
protected var cleanRHD:RenderHitData;
protected var projectionDoneEvent:RendererEvent;
protected var renderSessionData:RenderSessionData;
protected var stopWatch:StopWatch;
public var filter:IRenderFilter;
public function BasicRenderEngine():void{
cleanRHD = new RenderHitData();
super();
init();
}
protected function doRender(_arg1:RenderSessionData, _arg2:Array=null):RenderStatistics{
var _local3:RenderableListItem;
var _local5:ViewportLayer;
stopWatch.reset();
stopWatch.start();
MaterialManager.getInstance().updateMaterialsBeforeRender(_arg1);
filter.filter(renderList);
sorter.sort(renderList);
var _local4:Viewport3D = _arg1.viewPort;
while ((_local3 = renderList.pop())) {
_local5 = _local4.accessLayerFor(_local3, true);
_local3.render(_arg1, _local5.graphicsChannel);
_local4.lastRenderList.push(_local3);
_local5.processRenderItem(_local3);
};
MaterialManager.getInstance().updateMaterialsAfterRender(_arg1);
_arg1.renderStatistics.renderTime = stopWatch.stop();
_arg1.viewPort.updateAfterRender(_arg1);
return (renderStatistics);
}
protected function init():void{
renderStatistics = new RenderStatistics();
projectionPipeline = new BasicProjectionPipeline();
stopWatch = new StopWatch();
sorter = new BasicRenderSorter();
filter = new BasicRenderFilter();
renderList = new Array();
clipping = null;
renderSessionData = new RenderSessionData();
renderSessionData.renderer = this;
projectionDoneEvent = new RendererEvent(RendererEvent.PROJECTION_DONE, renderSessionData);
renderDoneEvent = new RendererEvent(RendererEvent.RENDER_DONE, renderSessionData);
}
override public function renderScene(_arg1:SceneObject3D, _arg2:CameraObject3D, _arg3:Viewport3D):RenderStatistics{
_arg2.viewport = _arg3.sizeRectangle;
renderSessionData.scene = _arg1;
renderSessionData.camera = _arg2;
renderSessionData.viewPort = _arg3;
renderSessionData.container = _arg3.containerSprite;
renderSessionData.triangleCuller = _arg3.triangleCuller;
renderSessionData.particleCuller = _arg3.particleCuller;
renderSessionData.renderObjects = _arg1.objects;
renderSessionData.renderLayers = null;
renderSessionData.renderStatistics.clear();
renderSessionData.clipping = clipping;
if (clipping){
clipping.reset(renderSessionData);
};
_arg3.updateBeforeRender(renderSessionData);
projectionPipeline.project(renderSessionData);
if (hasEventListener(RendererEvent.PROJECTION_DONE)){
dispatchEvent(projectionDoneEvent);
};
doRender(renderSessionData, null);
if (hasEventListener(RendererEvent.RENDER_DONE)){
dispatchEvent(renderDoneEvent);
};
return (renderSessionData.renderStatistics);
}
public function hitTestPoint2D(_arg1:Point, _arg2:Viewport3D):RenderHitData{
return (_arg2.hitTestPoint2D(_arg1));
}
override public function removeFromRenderList(_arg1:IRenderListItem):int{
return (renderList.splice(renderList.indexOf(_arg1), 1));
}
override public function addToRenderList(_arg1:RenderableListItem):int{
return (renderList.push(_arg1));
}
private function getLayerObjects(_arg1:Array):Array{
var _local3:ViewportLayer;
var _local2:Array = new Array();
for each (_local3 in _arg1) {
_local2 = _local2.concat(_local3.getLayerObjects());
};
return (_local2);
}
public function destroy():void{
renderDoneEvent = null;
projectionDoneEvent = null;
projectionPipeline = null;
sorter = null;
filter = null;
renderStatistics = null;
renderList = null;
renderSessionData.destroy();
renderSessionData = null;
cleanRHD = null;
stopWatch = null;
clipping = null;
}
public function renderLayers(_arg1:SceneObject3D, _arg2:CameraObject3D, _arg3:Viewport3D, _arg4:Array=null):RenderStatistics{
renderSessionData.scene = _arg1;
renderSessionData.camera = _arg2;
renderSessionData.viewPort = _arg3;
renderSessionData.container = _arg3.containerSprite;
renderSessionData.triangleCuller = _arg3.triangleCuller;
renderSessionData.particleCuller = _arg3.particleCuller;
renderSessionData.renderObjects = getLayerObjects(_arg4);
renderSessionData.renderLayers = _arg4;
renderSessionData.renderStatistics.clear();
renderSessionData.clipping = clipping;
_arg3.updateBeforeRender(renderSessionData);
projectionPipeline.project(renderSessionData);
if (hasEventListener(RendererEvent.PROJECTION_DONE)){
dispatchEvent(projectionDoneEvent);
};
doRender(renderSessionData);
if (hasEventListener(RendererEvent.RENDER_DONE)){
dispatchEvent(renderDoneEvent);
};
return (renderSessionData.renderStatistics);
}
}
}//package org.papervision3d.render
Section 175
//Scene3D (org.papervision3d.scenes.Scene3D)
package org.papervision3d.scenes {
import org.papervision3d.core.proto.*;
public class Scene3D extends SceneObject3D {
}
}//package org.papervision3d.scenes
Section 176
//ViewportLayerSortMode (org.papervision3d.view.layer.util.ViewportLayerSortMode)
package org.papervision3d.view.layer.util {
public class ViewportLayerSortMode {
public static var Z_SORT:String = "z";
public static var ORIGIN_SORT:String = "origin";
public static var INDEX_SORT:String = "index";
}
}//package org.papervision3d.view.layer.util
Section 177
//ViewportBaseLayer (org.papervision3d.view.layer.ViewportBaseLayer)
package org.papervision3d.view.layer {
import org.papervision3d.objects.*;
import org.papervision3d.view.*;
public class ViewportBaseLayer extends ViewportLayer {
public function ViewportBaseLayer(_arg1:Viewport3D){
super(_arg1, null);
}
override public function getChildLayer(_arg1:DisplayObject3D, _arg2:Boolean=true, _arg3:Boolean=false):ViewportLayer{
if (layers[_arg1]){
return (layers[_arg1]);
};
if (((_arg2) || (_arg1.useOwnContainer))){
return (getChildLayerFor(_arg1, _arg3));
};
return (this);
}
override public function updateBeforeRender():void{
clear();
var _local1:int = (childLayers.length - 1);
while (_local1 >= 0) {
if (childLayers[_local1].dynamicLayer){
removeLayerAt(_local1);
};
_local1--;
};
super.updateBeforeRender();
}
}
}//package org.papervision3d.view.layer
Section 178
//ViewportLayer (org.papervision3d.view.layer.ViewportLayer)
package org.papervision3d.view.layer {
import flash.display.*;
import org.papervision3d.objects.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.view.*;
import flash.utils.*;
import org.papervision3d.core.log.*;
import org.papervision3d.view.layer.util.*;
public class ViewportLayer extends Sprite {
public var layerIndex:Number;
public var layers:Dictionary;
public var childLayers:Array;
public var weight:Number;// = 0
public var dynamicLayer:Boolean;// = false
public var forceDepth:Boolean;// = false
public var displayObject3D:DisplayObject3D;
public var sortMode:String;
protected var viewport:Viewport3D;
public var displayObjects:Dictionary;
public var graphicsChannel:Graphics;
public var originDepth:Number;// = 0
public var screenDepth:Number;// = 0
public function ViewportLayer(_arg1:Viewport3D, _arg2:DisplayObject3D, _arg3:Boolean=false){
layers = new Dictionary(true);
displayObjects = new Dictionary(true);
sortMode = ViewportLayerSortMode.Z_SORT;
super();
this.viewport = _arg1;
this.displayObject3D = _arg2;
this.dynamicLayer = _arg3;
this.graphicsChannel = this.graphics;
if (_arg3){
this.filters = _arg2.filters;
this.blendMode = _arg2.blendMode;
this.alpha = _arg2.alpha;
};
if (_arg2){
addDisplayObject3D(_arg2);
_arg2.container = this;
};
init();
}
public function removeLayerAt(_arg1:Number):void{
var _local2:DisplayObject3D;
for each (_local2 in childLayers[_arg1].displayObjects) {
unlinkChild(_local2);
};
removeChild(childLayers[_arg1]);
childLayers.splice(_arg1, 1);
}
private function onChildAdded(_arg1:ViewportLayerEvent):void{
if (_arg1.do3d){
linkChild(_arg1.do3d, _arg1.layer, _arg1);
};
}
public function addLayer(_arg1:ViewportLayer):void{
var _local2:DisplayObject3D;
var _local3:ViewportLayer;
if (childLayers.indexOf(_arg1) != -1){
PaperLogger.warning("Child layer already exists in ViewportLayer");
return;
};
childLayers.push(_arg1);
addChild(_arg1);
_arg1.addEventListener(ViewportLayerEvent.CHILD_ADDED, onChildAdded);
_arg1.addEventListener(ViewportLayerEvent.CHILD_REMOVED, onChildRemoved);
for each (_local2 in _arg1.displayObjects) {
linkChild(_local2, _arg1);
};
for each (_local3 in _arg1.layers) {
for each (_local2 in _local3.displayObjects) {
linkChild(_local2, _local3);
};
};
}
protected function getChildLayerFor(_arg1:DisplayObject3D, _arg2:Boolean=false):ViewportLayer{
var _local3:ViewportLayer;
if (_arg1){
_local3 = new ViewportLayer(viewport, _arg1, _arg1.useOwnContainer);
addLayer(_local3);
if (_arg2){
_arg1.addChildrenToLayer(_arg1, _local3);
};
return (_local3);
} else {
PaperLogger.warning("Needs to be a do3d");
};
return (null);
}
public function updateAfterRender():void{
var _local1:ViewportLayer;
for each (_local1 in childLayers) {
_local1.updateAfterRender();
};
}
protected function init():void{
childLayers = new Array();
}
public function clear():void{
graphicsChannel.clear();
reset();
}
public function childLayerIndex(_arg1:DisplayObject3D):Number{
_arg1 = (_arg1.parentContainer) ? _arg1.parentContainer : _arg1;
var _local2:int;
while (_local2 < childLayers.length) {
if (childLayers[_local2].hasDisplayObject3D(_arg1)){
return (_local2);
};
_local2++;
};
return (-1);
}
protected function reset():void{
if (!forceDepth){
screenDepth = 0;
originDepth = 0;
};
this.weight = 0;
}
public function updateInfo():void{
var _local1:ViewportLayer;
for each (_local1 in childLayers) {
_local1.updateInfo();
if (!forceDepth){
if (!isNaN(_local1.screenDepth)){
this.weight = (this.weight + _local1.weight);
this.screenDepth = (this.screenDepth + (_local1.screenDepth * _local1.weight));
this.originDepth = (this.originDepth + (_local1.originDepth * _local1.weight));
};
};
};
if (!forceDepth){
this.screenDepth = (this.screenDepth / this.weight);
this.originDepth = (this.originDepth / this.weight);
};
}
public function getChildLayer(_arg1:DisplayObject3D, _arg2:Boolean=true, _arg3:Boolean=false):ViewportLayer{
_arg1 = (_arg1.parentContainer) ? _arg1.parentContainer : _arg1;
if (layers[_arg1]){
return (layers[_arg1]);
};
if (_arg2){
return (getChildLayerFor(_arg1, _arg3));
};
return (null);
}
protected function orderLayers():void{
var _local2:ViewportLayer;
var _local1:int;
while (_local1 < childLayers.length) {
_local2 = childLayers[_local1];
if (this.getChildIndex(_local2) != _local1){
this.setChildIndex(_local2, _local1);
};
_local2.sortChildLayers();
_local1++;
};
}
public function updateBeforeRender():void{
var _local1:ViewportLayer;
clear();
for each (_local1 in childLayers) {
_local1.updateBeforeRender();
};
}
public function hasDisplayObject3D(_arg1:DisplayObject3D):Boolean{
return (!((displayObjects[_arg1] == null)));
}
public function sortChildLayers():void{
switch (sortMode){
case ViewportLayerSortMode.Z_SORT:
childLayers.sortOn("screenDepth", (Array.DESCENDING | Array.NUMERIC));
break;
case ViewportLayerSortMode.INDEX_SORT:
childLayers.sortOn("layerIndex", Array.NUMERIC);
break;
case ViewportLayerSortMode.ORIGIN_SORT:
childLayers.sortOn(["originDepth", "screenDepth"], [(Array.DESCENDING | Array.NUMERIC), (Array.DESCENDING | Array.NUMERIC)]);
break;
};
orderLayers();
}
private function onChildRemoved(_arg1:ViewportLayerEvent):void{
if (_arg1.do3d){
unlinkChild(_arg1.do3d, _arg1);
};
}
public function removeAllLayers():void{
var _local1:int = (childLayers.length - 1);
while (_local1 >= 0) {
removeLayerAt(_local1);
_local1--;
};
}
public function processRenderItem(_arg1:RenderableListItem):void{
if (!forceDepth){
if (!isNaN(_arg1.screenZ)){
this.screenDepth = (this.screenDepth + _arg1.screenZ);
if (_arg1.instance){
this.originDepth = (this.originDepth + _arg1.instance.world.n34);
this.originDepth = (this.originDepth + _arg1.instance.screen.z);
};
this.weight++;
};
};
}
public function removeLayer(_arg1:ViewportLayer):void{
var _local2:int = getChildIndex(_arg1);
if (_local2 > -1){
removeLayerAt(_local2);
} else {
PaperLogger.error("Layer not found for removal.");
};
}
private function linkChild(_arg1:DisplayObject3D, _arg2:ViewportLayer, _arg3:ViewportLayerEvent=null):void{
layers[_arg1] = _arg2;
dispatchEvent(new ViewportLayerEvent(ViewportLayerEvent.CHILD_ADDED, _arg1, _arg2));
}
public function addDisplayObject3D(_arg1:DisplayObject3D, _arg2:Boolean=false):void{
if (!_arg1){
return;
};
displayObjects[_arg1] = _arg1;
dispatchEvent(new ViewportLayerEvent(ViewportLayerEvent.CHILD_ADDED, _arg1, this));
if (_arg2){
_arg1.addChildrenToLayer(_arg1, this);
};
}
public function removeDisplayObject3D(_arg1:DisplayObject3D):void{
displayObjects[_arg1] = null;
dispatchEvent(new ViewportLayerEvent(ViewportLayerEvent.CHILD_REMOVED, _arg1, this));
}
private function unlinkChild(_arg1:DisplayObject3D, _arg2:ViewportLayerEvent=null):void{
layers[_arg1] = null;
dispatchEvent(new ViewportLayerEvent(ViewportLayerEvent.CHILD_REMOVED, _arg1));
}
public function getLayerObjects(_arg1:Array=null):Array{
var _local2:DisplayObject3D;
var _local3:ViewportLayer;
if (!_arg1){
_arg1 = new Array();
};
for each (_local2 in this.displayObjects) {
if (_local2){
_arg1.push(_local2);
};
};
for each (_local3 in childLayers) {
_local3.getLayerObjects(_arg1);
};
return (_arg1);
}
}
}//package org.papervision3d.view.layer
Section 179
//ViewportLayerEvent (org.papervision3d.view.layer.ViewportLayerEvent)
package org.papervision3d.view.layer {
import flash.events.*;
import org.papervision3d.objects.*;
public class ViewportLayerEvent extends Event {
public var layer:ViewportLayer;
public var do3d:DisplayObject3D;
public static const CHILD_REMOVED:String = "childRemoved";
public static const CHILD_ADDED:String = "childAdded";
public function ViewportLayerEvent(_arg1:String, _arg2:DisplayObject3D=null, _arg3:ViewportLayer=null){
super(_arg1, false, false);
this.do3d = _arg2;
this.layer = _arg3;
}
}
}//package org.papervision3d.view.layer
Section 180
//Viewport3D (org.papervision3d.view.Viewport3D)
package org.papervision3d.view {
import flash.events.*;
import flash.display.*;
import org.papervision3d.core.render.data.*;
import flash.geom.*;
import org.papervision3d.objects.*;
import org.papervision3d.view.layer.*;
import org.papervision3d.core.render.command.*;
import org.papervision3d.core.culling.*;
import org.papervision3d.core.geom.renderables.*;
import flash.utils.*;
import org.papervision3d.core.log.*;
import org.papervision3d.core.view.*;
import org.papervision3d.core.utils.*;
import org.papervision3d.core.render.*;
public class Viewport3D extends Sprite implements IViewport3D {
public var interactiveSceneManager:InteractiveSceneManager;
public var lastRenderList:Array;
public var cullingRectangle:Rectangle;
protected var _interactive:Boolean;
private var stageScaleModeSet:Boolean;// = false
protected var _autoCulling:Boolean;
protected var _viewportObjectFilter:ViewportObjectFilter;
public var particleCuller:IParticleCuller;
protected var _height:Number;
protected var _width:Number;
public var lineCuller:ILineCuller;
protected var _layerInstances:Dictionary;
protected var _autoScaleToStage:Boolean;
public var triangleCuller:ITriangleCuller;
protected var _lastRenderer:IRenderEngine;
protected var _hWidth:Number;
protected var _containerSprite:ViewportBaseLayer;
protected var _hHeight:Number;
public var sizeRectangle:Rectangle;
protected var renderHitData:RenderHitData;
protected var _autoClipping:Boolean;
public function Viewport3D(_arg1:Number=640, _arg2:Number=480, _arg3:Boolean=false, _arg4:Boolean=false, _arg5:Boolean=true, _arg6:Boolean=true){
init();
this.interactive = _arg4;
this.viewportWidth = _arg1;
this.viewportHeight = _arg2;
this.autoClipping = _arg5;
this.autoCulling = _arg6;
this.autoScaleToStage = _arg3;
this._layerInstances = new Dictionary(true);
}
public function set viewportWidth(_arg1:Number):void{
_width = _arg1;
_hWidth = (_arg1 / 2);
containerSprite.x = _hWidth;
cullingRectangle.x = -(_hWidth);
cullingRectangle.width = _arg1;
sizeRectangle.width = _arg1;
if (_autoClipping){
scrollRect = sizeRectangle;
};
}
public function get autoCulling():Boolean{
return (_autoCulling);
}
protected function onStageResize(_arg1:Event=null):void{
if (_autoScaleToStage){
viewportWidth = stage.stageWidth;
viewportHeight = stage.stageHeight;
};
}
public function set autoCulling(_arg1:Boolean):void{
if (_arg1){
triangleCuller = new RectangleTriangleCuller(cullingRectangle);
particleCuller = new RectangleParticleCuller(cullingRectangle);
lineCuller = new RectangleLineCuller(cullingRectangle);
} else {
if (!_arg1){
triangleCuller = new DefaultTriangleCuller();
particleCuller = new DefaultParticleCuller();
lineCuller = new DefaultLineCuller();
};
};
_autoCulling = _arg1;
}
public function getChildLayer(_arg1:DisplayObject3D, _arg2:Boolean=true, _arg3:Boolean=true):ViewportLayer{
return (containerSprite.getChildLayer(_arg1, _arg2, _arg3));
}
protected function init():void{
this.renderHitData = new RenderHitData();
lastRenderList = new Array();
sizeRectangle = new Rectangle();
cullingRectangle = new Rectangle();
_containerSprite = new ViewportBaseLayer(this);
_containerSprite.doubleClickEnabled = true;
addChild(_containerSprite);
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
addEventListener(Event.REMOVED_FROM_STAGE, onRemovedFromStage);
}
public function get autoClipping():Boolean{
return (_autoClipping);
}
public function updateAfterRender(_arg1:RenderSessionData):void{
var _local2:ViewportLayer;
if (interactive){
interactiveSceneManager.updateAfterRender();
};
if (_arg1.renderLayers){
for each (_local2 in _arg1.renderLayers) {
_local2.updateInfo();
_local2.sortChildLayers();
_local2.updateAfterRender();
};
} else {
containerSprite.updateInfo();
containerSprite.updateAfterRender();
};
containerSprite.sortChildLayers();
}
protected function onAddedToStage(_arg1:Event):void{
if (_autoScaleToStage){
setStageScaleMode();
};
stage.addEventListener(Event.RESIZE, onStageResize);
onStageResize();
}
public function get containerSprite():ViewportLayer{
return (_containerSprite);
}
public function set autoClipping(_arg1:Boolean):void{
if (_arg1){
scrollRect = sizeRectangle;
} else {
scrollRect = null;
};
_autoClipping = _arg1;
}
protected function setStageScaleMode():void{
if (!stageScaleModeSet){
PaperLogger.info("Viewport autoScaleToStage : Papervision has changed the Stage scale mode.");
stage.align = StageAlign.TOP_LEFT;
stage.scaleMode = StageScaleMode.NO_SCALE;
stageScaleModeSet = true;
};
}
public function accessLayerFor(_arg1:RenderableListItem, _arg2:Boolean=false):ViewportLayer{
var _local3:DisplayObject3D;
if (_arg1.renderableInstance){
_local3 = _arg1.renderableInstance.instance;
_local3 = (_local3.parentContainer) ? _local3.parentContainer : _local3;
if (containerSprite.layers[_local3]){
if (_arg2){
_local3.container = containerSprite.layers[_local3];
};
return (containerSprite.layers[_local3]);
} else {
if (_local3.useOwnContainer){
return (containerSprite.getChildLayer(_local3, true, true));
};
};
};
return (containerSprite);
}
public function get viewportWidth():Number{
return (_width);
}
public function set interactive(_arg1:Boolean):void{
if (_arg1 != _interactive){
if (((_interactive) && (interactiveSceneManager))){
interactiveSceneManager.destroy();
interactiveSceneManager = null;
};
_interactive = _arg1;
if (_arg1){
interactiveSceneManager = new InteractiveSceneManager(this);
};
};
}
public function set viewportObjectFilter(_arg1:ViewportObjectFilter):void{
_viewportObjectFilter = _arg1;
}
public function set autoScaleToStage(_arg1:Boolean):void{
_autoScaleToStage = _arg1;
if (((_arg1) && (!((stage == null))))){
setStageScaleMode();
onStageResize();
};
}
public function set viewportHeight(_arg1:Number):void{
_height = _arg1;
_hHeight = (_arg1 / 2);
containerSprite.y = _hHeight;
cullingRectangle.y = -(_hHeight);
cullingRectangle.height = _arg1;
sizeRectangle.height = _arg1;
if (_autoClipping){
scrollRect = sizeRectangle;
};
}
public function updateBeforeRender(_arg1:RenderSessionData):void{
var _local2:ViewportLayer;
lastRenderList.length = 0;
if (_arg1.renderLayers){
for each (_local2 in _arg1.renderLayers) {
_local2.updateBeforeRender();
};
} else {
_containerSprite.updateBeforeRender();
};
_layerInstances = new Dictionary(true);
}
public function hitTestMouse():RenderHitData{
var _local1:Point = new Point(containerSprite.mouseX, containerSprite.mouseY);
return (hitTestPoint2D(_local1));
}
public function get interactive():Boolean{
return (_interactive);
}
public function get autoScaleToStage():Boolean{
return (_autoScaleToStage);
}
public function hitTestPointObject(_arg1:Point, _arg2:DisplayObject3D):RenderHitData{
var _local3:RenderableListItem;
var _local4:RenderHitData;
var _local5:IRenderListItem;
var _local6:uint;
if (interactive){
_local4 = new RenderHitData();
_local6 = lastRenderList.length;
while ((_local5 = lastRenderList[--_local6])) {
if ((_local5 is RenderableListItem)){
_local3 = (_local5 as RenderableListItem);
if ((_local3.renderableInstance is Triangle3D)){
if (Triangle3D(_local3.renderableInstance).instance != _arg2){
continue;
};
} else {
continue;
};
_local4 = _local3.hitTestPoint2D(_arg1, _local4);
if (_local4.hasHit){
return (_local4);
};
};
};
};
return (new RenderHitData());
}
public function hitTestPoint2D(_arg1:Point):RenderHitData{
var _local2:RenderableListItem;
var _local3:RenderHitData;
var _local4:IRenderListItem;
var _local5:uint;
renderHitData.clear();
if (interactive){
_local3 = renderHitData;
_local5 = lastRenderList.length;
while ((_local4 = lastRenderList[--_local5])) {
if ((_local4 is RenderableListItem)){
_local2 = (_local4 as RenderableListItem);
_local3 = _local2.hitTestPoint2D(_arg1, _local3);
if (_local3.hasHit){
return (_local3);
};
};
};
};
return (renderHitData);
}
protected function onRemovedFromStage(_arg1:Event):void{
stage.removeEventListener(Event.RESIZE, onStageResize);
}
public function get viewportHeight():Number{
return (_height);
}
public function destroy():void{
if (interactiveSceneManager){
interactiveSceneManager.destroy();
interactiveSceneManager = null;
};
lastRenderList = null;
}
public function get viewportObjectFilter():ViewportObjectFilter{
return (_viewportObjectFilter);
}
}
}//package org.papervision3d.view
Section 181
//Papervision3D (org.papervision3d.Papervision3D)
package org.papervision3d {
import org.papervision3d.core.log.*;
public class Papervision3D {
public static var useDEGREES:Boolean = true;
public static var useRIGHTHANDED:Boolean = false;
public static var PAPERLOGGER:PaperLogger = PaperLogger.getInstance();
public static var NAME:String = "Papervision3D";
public static var DATE:String = "March 12th, 2009";
public static var AUTHOR:String = "(c) 2006-2008 Copyright by Carlos Ulloa | John Grden | Ralph Hauwert | Tim Knip | Andy Zupko";
public static var VERSION:String = "2.0.0";
public static var usePERCENT:Boolean = false;
}
}//package org.papervision3d
Section 182
//Achievements (Achievements)
package {
import com.newgrounds.*;
public class Achievements {
public static const _ss793:int = 18;
public static const _ti358:int = 1;
public static const _um815:int = 2;
public static const _dn359:int = 10;
public static const _dd753:int = 8;
public static const _dx101:int = 4;
public static const _pa186:int = 5;
public static const _ti268:int = 15;
public static const _lc707:int = 12;
public static const _oc384:int = 14;
public static const _xa544:int = 13;
public static const _yc227:int = 6;
public static const _nv106:int = 7;
public static const _hu459:int = 11;
public static const _sl480:int = 16;
public static const _es850:int = 17;
public static const _xt100:int = 3;
public static const _lk535:int = 0;
public static const _wm651:int = 9;
public static var achievement_unlocked:Array;
public static function unlock(_arg1:int):void{
var _local2:String;
if (Preloader._yl227){
_local2 = Main._wh740((irrcrpt("dfklhyhphqw_", 3) + _arg1.toString()));
if (Preloader.version == Preloader._vw589){
API.unlockMedal(_local2);
};
if (!achievement_unlocked[_arg1]){
achievement_unlocked[_arg1] = true;
Messages.add(_local2, Res._sn428, true);
if (!Main._bu847){
if (Achievements.achievement_unlocked.indexOf(false) == -1){
Main._bu847 = true;
Messages.add(Main._wh740(irrcrpt("woyppw_rsa_glemrefpi", 4)), Res._jt851[Main._ot632()]);
};
};
};
};
}
public static function _if192(_arg1:APIEvent):void{
if (_arg1.success){
};
}
public static function init():void{
achievement_unlocked = new Array(_ss793);
var _local1:int;
while (_local1 < _ss793) {
achievement_unlocked[_local1] = false;
_local1++;
};
}
}
}//package
Section 183
//Audio (Audio)
package {
import flash.events.*;
import flash.display.*;
import flash.media.*;
public class Audio {
public static const _wc698:int = 16;
public static const _yq503:Number = 1;
public static const _eq175:Number = 0.65;
public static var _is223:SoundTransform = new SoundTransform();
public static var _lj573:SoundChannel = new SoundChannel();
public static var _dg143:int;
public static var _qq304:MovieClip = null;
public static var _ed459:SoundTransform = new SoundTransform();
public static var _xr672:Class = null;
public static var _tg504:Array = new Array(_wc698);
public static var _mu730:Array = new Array(_wc698);
public static var _hd11:Array = new Array(_wc698);
public static var _kg298:SoundChannel = new SoundChannel();
public static function _eb405(_arg1:Class):void{
if (Main.music_on){
if (_xr672 != _arg1){
_wr699();
_xr672 = _arg1;
_qq304 = new (_arg1);
_qq304.play();
Main._we939.addChild(_qq304);
_rm283((Main.music_on) ? 1 : 0);
};
};
}
public static function _rt304(_arg1:Event):void{
_kg298.removeEventListener(Event.SOUND_COMPLETE, _rt304);
switch (Main._jh775){
case 0:
_eb405(Res._be106);
break;
case 1:
_eb405(Res._sh887);
break;
default:
_eb405(Res._qr911);
break;
};
}
public static function _rm283(_arg1:Number):void{
if (_qq304 != null){
_qq304.soundTransform = new SoundTransform((_arg1 * _eq175), 0);
};
}
public static function tick():void{
var _local1:int;
while (_local1 < _wc698) {
if ((((_mu730[_local1] >= 0)) && ((--_mu730[_local1] == -1)))){
Audio._dc461(_hd11[_local1], _tg504[_local1]);
};
_local1++;
};
}
public static function _dc461(_arg1:Sound, _arg2:Number=1, _arg3:Number=0):void{
var _sound = _arg1;
var _volume = _arg2;
var _pan = _arg3;
if (Main.sfx_on){
try {
_ed459.volume = (_volume * _yq503);
_ed459.pan = _pan;
_lj573 = _sound.play();
_lj573.soundTransform = _ed459;
} catch(error:Error) {
};
};
}
public static function _wr699():void{
if (_qq304 != null){
_qq304.stop();
Main._we939.removeChild(_qq304);
_qq304 = null;
_xr672 = null;
};
}
public static function _vu586(_arg1:Sound):void{
Audio._wr699();
_is223.volume = (Main.music_on) ? _eq175 : 0;
_kg298 = _arg1.play();
_kg298.soundTransform = _is223;
_kg298.addEventListener(Event.SOUND_COMPLETE, _rt304);
}
public static function _nj45(_arg1:Sound, _arg2:Number=1, _arg3:int=0):void{
var _local4:int;
if (_arg1 != null){
_local4 = 0;
while (_local4 < _wc698) {
if ((((_mu730[_local4] == _arg3)) && ((_arg1.length == _hd11[_local4].length)))){
return;
};
_local4++;
};
_hd11[_dg143] = _arg1;
_mu730[_dg143] = _arg3;
_tg504[_dg143] = _arg2;
if (++_dg143 >= _wc698){
_dg143 = 0;
};
};
}
}
}//package
Section 184
//FWAd_AS3 (FWAd_AS3)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.system.*;
import flash.ui.*;
public class FWAd_AS3 extends Sprite {
public var loadingBar_bar:Sprite;
public var _FWAd:Object;
public var loadingBar:Sprite;
private var timeoutId:int;// = -1
public static const loadFrameworkTimeoutTime:int = 8;
public static const swfFolder:String = (("http://" + swfDomain) + "/");
public static const loadFrameworkTimes:int = 2;
public static const ifLoadFrameworkErrorCanPlayGame:Boolean = true;
public static const frameworkSWFPath:String = (swfFolder + "Framework.swf");
public static const swfDomain:String = "flashcfg.youyouwin.com";
public static const newsSWFPath:String = (swfFolder + "News.swf");
public static const ifAdFailCanPlayGame:Boolean = true;
public static const ifAddCallBackErrorCanPlayGame:Boolean = false;
public static var xx:int;
public static var hei:int;
public static var loadFrameworkFailed:Boolean;
public static var _stage;
public static var id:String;
public static var xml:XML;
public static var lc_connName:String;
public static var onClickStartBtn:Function;
public static var yy:int;
public static var noShowLogo:Boolean;
public static var loadFrameworkSuccess:Boolean;
public static var frameworkLoader:Loader;
public static var loadGameCompleted:Boolean;
public static var AD_TYPE_CONTAINER:String = "container";
public static var AD_TYPE_LOADING:String = "loading";
public static var noShowForbidden:Boolean;
public static var hasLoadOnce:Boolean;
public static var canNotShowAd:Boolean;
public static var checkNewsFirstInitIntervalId:int = -1;
public static var newsLoader:Loader;
public static var frameworkInitFinished:Boolean;
public static var _root;
public static var newsValues:Object = {x:0, y:0};
public static var wid:int;
public static var news_lc:LocalConnection;
public static var ifIsLoadingAdShowStartBtn:Boolean;
public static var restLoadFrameworkTimes:int;
public static var onLoadXML:Function;
public static var lc:LocalConnection;
public static var lc_sendName:String;
public static var adType:String = AD_TYPE_LOADING;
public function FWAd_AS3(_arg1:Object){
xx = _arg1.x;
yy = _arg1.y;
wid = _arg1.wid;
hei = _arg1.hei;
id = _arg1.id;
adType = _arg1.adType;
ifIsLoadingAdShowStartBtn = _arg1.ifIsLoadingAdShowStartBtn;
noShowLogo = _arg1.noShowLogo;
noShowForbidden = _arg1.noShowForbidden;
if (_arg1.onClickCloseBtn){
onClickStartBtn = _arg1.onClickCloseBtn;
} else {
onClickStartBtn = _arg1.onClickStartBtn;
};
_FWAd = FWAd_AS3;
this.addEventListener(Event.ADDED_TO_STAGE, added);
}
private function added(_arg1:Event):void{
var event = _arg1;
this.removeEventListener(Event.ADDED_TO_STAGE, added);
this.addEventListener(Event.REMOVED_FROM_STAGE, removed);
Security.allowDomain(swfDomain);
Security.allowInsecureDomain(swfDomain);
try {
fscommand("showMenu", "false");
} catch(e:Error) {
};
_root = stage.getChildAt(0);
_stage = stage;
_root.contextMenu = new ContextMenu();
_root.contextMenu.hideBuiltInItems();
try {
fscommand("trapallkeys", "true");
} catch(e:Error) {
};
loadGameCompleted = (_root.loaderInfo.bytesLoaded == _root.loaderInfo.bytesTotal);
if (frameworkLoader){
frameworkInitFinished = true;
checkLoadGameCompleteAndTryStart();
if (frameworkInitFinished){
lc.client = this;
lc.send(lc_sendName, "that2this", "reset");
};
} else {
frameworkLoader = new Loader();
frameworkLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadFrameworkComplete);
frameworkLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadFrameworkError);
restLoadFrameworkTimes = loadFrameworkTimes;
loadFramework();
};
this.addChild(frameworkLoader);
var loadingBar_hei:Number = 8;
var loadingBar_x:Number = 10;
var loadingBar_wid:Number = (wid - (2 * loadingBar_x));
loadingBar = new Sprite();
loadingBar.x = loadingBar_x;
loadingBar.y = ((hei - loadingBar_hei) - 6);
this.addChild(loadingBar);
var loadingBar_bottom:Sprite = new Sprite();
loadingBar.addChild(loadingBar_bottom);
loadingBar_bar = new Sprite();
loadingBar.addChild(loadingBar_bar);
var loadingBar_line:Sprite = new Sprite();
loadingBar.addChild(loadingBar_line);
var g:Graphics = loadingBar_bottom.graphics;
g.clear();
g.beginFill(0x333333);
g.drawRect(0, 0, loadingBar_wid, loadingBar_hei);
g.endFill();
g = loadingBar_bar.graphics;
g.clear();
g.beginGradientFill("linear", [0xFFFFFF, 16750950], [1, 1], [63, 0xFF], new Matrix(0.006, 0, 0, 1, 0, 0));
loadingBar_bar.rotation = 90;
g.drawRect(0, -(loadingBar_wid), loadingBar_hei, loadingBar_wid);
g.endFill();
g = loadingBar_line.graphics;
g.clear();
g.lineStyle(1, 0x666666);
g.drawRect(0, 0, loadingBar_wid, loadingBar_hei);
g.endFill();
loadingBar_bar.width = 1;
loadingBar_bar.scaleX = 1;
switch (adType){
case AD_TYPE_LOADING:
break;
default:
loadingBar.visible = false;
break;
};
if (loadGameCompleted){
loadingBar.visible = false;
} else {
_root.loaderInfo.addEventListener(ProgressEvent.PROGRESS, loadGameProgress);
_root.loaderInfo.addEventListener(Event.COMPLETE, loadGameComplete);
};
}
public function that2this(... _args):void{
var result:*;
var args = _args;
switch (args[0]){
case "initFinished":
frameworkInitFinished = true;
lc.send(lc_sendName, "that2this", "confirmInitFinished", getFWAdValuesByNameArr(args.slice(1)));
break;
case "AsmMachine.run()":
try {
result = Runner.runStr16(this, args[2]);
lc.send(lc_sendName, "that2this", "AsmMachine.run()", args[1], "success", result);
} catch(e:Error) {
lc.send(lc_sendName, "that2this", "AsmMachine.run()", args[1], "error", e.toString());
};
break;
case "clickStartBtn":
clickStartBtn();
break;
case "canNotShowAd":
case "noId":
canNotShowAd = true;
checkLoadGameCompleteAndTryStart();
break;
case "xml":
try {
xml = new XML(args[1]);
} catch(e:Error) {
trace(("e=" + e));
};
if (onLoadXML != null){
onLoadXML();
};
break;
};
}
private function getFWAdValuesByNameArr(_arg1:Array):Object{
var _local3:String;
var _local2:Object = new Object();
for each (_local3 in _arg1) {
_local2[_local3] = FWAd_AS3[_local3];
};
return (_local2);
}
private function clickStartBtn():void{
if (onClickStartBtn != null){
onClickStartBtn();
onClickStartBtn = null;
};
if (this.parent){
this.parent.removeChild(this);
};
this.visible = false;
this.x = -10000;
}
private function loadGameProgress(_arg1:ProgressEvent):void{
var _local2:Number;
switch (adType){
case AD_TYPE_LOADING:
_local2 = (_arg1.bytesLoaded / _arg1.bytesTotal);
loadingBar_bar.scaleX = 1;
loadingBar_bar.scaleY = _local2;
break;
default:
_root.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, loadGameProgress);
break;
};
}
private function removed(_arg1:Event):void{
this.removeEventListener(Event.REMOVED_FROM_STAGE, removed);
_root.loaderInfo.removeEventListener(ProgressEvent.PROGRESS, loadGameProgress);
_root.loaderInfo.removeEventListener(Event.COMPLETE, loadGameComplete);
onClickStartBtn = null;
if (frameworkInitFinished){
lc.send(lc_sendName, "that2this", "removed");
lc.client = new Object();
};
}
private function loadFrameworkError(_arg1:IOErrorEvent):void{
var event = _arg1;
trace(("剩余尝试加载次数:" + restLoadFrameworkTimes));
clearTimeout(timeoutId);
if (--restLoadFrameworkTimes < 0){
loadFrameworkFailed = true;
checkLoadGameCompleteAndTryStart();
} else {
try {
frameworkLoader.close();
} catch(e:Error) {
};
loadFramework();
};
}
private function loadFrameworkComplete(_arg1:Event):void{
this.addEventListener(Event.ENTER_FRAME, checkFrameworkFirstInit);
}
private function checkFrameworkFirstInit(_arg1:Event){
var movie:AVM1Movie;
var event = _arg1;
try {
movie = (frameworkLoader.content as AVM1Movie);
} catch(e:Error) {
return;
};
var ran:int = Math.round((movie.getBounds(movie).x / 10));
if (ran < -1000){
this.removeEventListener(Event.ENTER_FRAME, checkFrameworkFirstInit);
lc_connName = ("_FWAd" + ran);
lc_sendName = ("_Framework" + ran);
lc = new LocalConnection();
lc.allowDomain("*");
lc.addEventListener(StatusEvent.STATUS, lc_onStatus);
lc.connect(lc_connName);
lc.client = this;
loadFrameworkSuccess = true;
clearTimeout(timeoutId);
checkLoadGameCompleteAndTryStart();
};
}
private function checkLoadGameCompleteAndTryStart():void{
if (loadGameCompleted){
if (loadFrameworkFailed){
trace("加载 framework 失败");
if (((ifLoadFrameworkErrorCanPlayGame) || (checkIsOurDomain()))){
trace("自动跳到游戏");
clickStartBtn();
} else {
trace("不自动跳到游戏");
};
} else {
if (canNotShowAd){
if (checkIsOurDomain()){
clickStartBtn();
};
};
};
};
}
private function loadFrameworkTimeout():void{
trace("loadFrameworkTimeout");
loadFrameworkError(null);
}
private function loadGameComplete(_arg1:Event):void{
loadGameCompleted = true;
loadingBar.visible = false;
checkLoadGameCompleteAndTryStart();
if (frameworkInitFinished){
lc.send(lc_sendName, "that2this", "loadGameCompleted");
};
}
private function loadFramework():void{
frameworkLoader.load(new URLRequest(frameworkSWFPath));
clearTimeout(timeoutId);
timeoutId = setTimeout(loadFrameworkTimeout, (loadFrameworkTimeoutTime * 1000));
}
private function lc_onStatus(_arg1:StatusEvent):void{
switch (_arg1.level){
case "error":
trace(("lc onStatus 出错 event=" + _arg1));
break;
};
}
public function closeAd():void{
clickStartBtn();
}
private function checkIsOurDomain():Boolean{
var _local1:String;
if (_root.loaderInfo){
_local1 = _root.loaderInfo.url.toLowerCase();
return ((((((((_local1.indexOf(".youyouwin.com/") > 0)) || ((_local1.indexOf(".7k7k.com/") > 0)))) || ((_local1.indexOf(".flash8.net/") > 0)))) || ((_local1.indexOf("file:///") == 0))));
};
return (true);
}
public static function showNews(_arg1:Object=null):void{
var _local2:String;
clearInterval(checkNewsFirstInitIntervalId);
newsValues.wid = wid;
for (_local2 in _arg1) {
newsValues[_local2] = _arg1[_local2];
};
if (newsValues.id){
} else {
newsValues.id = (id + "_news");
};
var _local3:Sprite = ((newsValues.container) || (_root));
if (_local3){
newsLoader = new Loader();
_local3.addChild(newsLoader);
newsLoader.x = newsValues.x;
newsLoader.y = newsValues.y;
newsLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadNewsComplete);
newsLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadNewsError);
newsLoader.load(new URLRequest(newsSWFPath));
} else {
trace("未指定容器,请改成例如: FWAd_AS3.showNews({container:root}");
};
news_lc = new LocalConnection();
news_lc.addEventListener(StatusEvent.STATUS, news_lc_status);
}
public static function checkNewsFirstInit():void{
var movie:AVM1Movie;
try {
movie = (newsLoader.content as AVM1Movie);
} catch(e:Error) {
return;
};
var ran:int = Math.round((movie.getBounds(movie).x / 10));
if (ran < -1000){
clearInterval(checkNewsFirstInitIntervalId);
news_lc.send(("_News" + ran), "that2this", "newsValues", newsValues);
};
}
public static function showAd(_arg1:Object=null):void{
var _local3:String;
var _local4:Sprite;
var _local2:Object = {x:xx, y:yy, wid:wid, hei:hei, id:id, adType:AD_TYPE_CONTAINER};
for (_local3 in _arg1) {
_local2[_local3] = _arg1[_local3];
};
_local4 = ((_local2.container) || (_root));
if (_local4){
if (_local2.adType == AD_TYPE_LOADING){
if (hasLoadOnce){
trace("缓冲广告不允许重复初始化");
return;
};
hasLoadOnce = true;
};
} else {
trace("未指定容器,请改成例如: FWAd_AS3.showAd({container:root}");
return;
};
_local4.addChild(new FWAd_AS3(_local2));
}
public static function loadNewsError(_arg1:IOErrorEvent):void{
}
public static function loadNewsComplete(_arg1:Event):void{
clearInterval(checkNewsFirstInitIntervalId);
checkNewsFirstInitIntervalId = setInterval(checkNewsFirstInit, 100);
}
public static function news_lc_status(... _args):void{
}
public static function getParam(_arg1:String):String{
if (xml){
return (String(xml.attribute(_arg1)));
};
trace("xml未加载完毕, 或xml加载失败");
return (null);
}
}
}//package
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.system.*;
class Runner {
private static var numData:ByteArray = new ByteArray();
private static var offset:int;
private static var codeData:ByteArray;
private function Runner(){
}
private static function readDoubleRev():Number{
numData[3] = codeData[offset++];
numData[2] = codeData[offset++];
numData[1] = codeData[offset++];
numData[0] = codeData[offset++];
numData[7] = codeData[offset++];
numData[6] = codeData[offset++];
numData[5] = codeData[offset++];
numData[4] = codeData[offset++];
numData.position = 0;
return (numData.readDouble());
}
public static function run(_arg1, _arg2:ByteArray){
var _local9:int;
var _local10:String;
var _local11:int;
var _local12:int;
var _local13:String;
var _local14:*;
var _local15:*;
var _local16:*;
var _local17:*;
var _local18:int;
var _local19:String;
var _local20:String;
var _local21:int;
var _local22:Class;
var _local23:*;
var _local24:int;
var _local25:int;
var _local26:int;
var _local27:int;
codeData = _arg2;
if (codeData.length > 0){
} else {
return;
};
codeData.uncompress();
var _local3:Array = new Array();
var _local4:int = codeData.readShort();
var _local5:Array = codeData.readObject();
var _local6:Array = codeData.readObject();
if (_local5){
_local9 = _local5.length;
while (--_local9 >= 0) {
_local10 = _local5[_local9];
if (_local10 === null){
} else {
switch (_local10){
case "this":
case "'this'":
_local5[_local9] = _arg1;
break;
case "arguments":
case "'arguments'":
throw (new Error("暂不支持 arguments"));
case "super":
case "'super'":
throw (new Error("暂不支持 super"));
case "_root":
_local5[_local9] = _arg1.root;
break;
case "_parent":
_local5[_local9] = _arg1.parent;
break;
case "_global":
throw (new Error("暂不支持 _global"));
};
};
};
} else {
_local5 = new Array();
};
var _local7:Array = new Array();
offset = codeData.position;
var _local8:int = codeData.length;
while (offset < _local8) {
_local26 = codeData[offset++];
if (_local26 >= 128){
var _temp1 = codeData[offset++];
_local25 = (_temp1 | (codeData[offset++] << 8));
} else {
_local25 = 0;
};
switch (_local26){
case 0:
break;
case 4:
if ((_arg1 is MovieClip)){
_arg1.nextFrame();
};
break;
case 5:
if ((_arg1 is MovieClip)){
_arg1.prevFrame();
};
break;
case 6:
if ((_arg1 is MovieClip)){
_arg1.play();
};
break;
case 7:
if ((_arg1 is MovieClip)){
_arg1.stop();
};
break;
case 11:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = (_local16 - _local17);
_local3.push(_local15);
break;
case 12:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = (_local16 * _local17);
_local3.push(_local15);
break;
case 13:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = (_local16 / _local17);
_local3.push(_local15);
break;
case 16:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = ((_local16) && (_local17));
_local3.push(_local15);
break;
case 17:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = ((_local16) || (_local17));
_local3.push(_local15);
break;
case 18:
_local15 = _local3.pop();
_local15 = !(_local15);
_local3.push(_local15);
break;
case 19:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = (_local16 == _local17);
_local3.push(_local15);
break;
case 23:
_local3.pop();
break;
case 24:
_local15 = _local3.pop();
_local15 = int(_local15);
_local3.push(_local15);
break;
case 28:
cacheVariable(_local3);
break;
case 29:
throw (new Error("不支持 setVariable"));
case 38:
_local15 = _local3.pop();
trace(_local15);
break;
case 48:
_local15 = _local3.pop();
_local15 = int(_local15);
if (_local15 <= 0){
_local15 = 0;
} else {
_local15 = int((Math.random() * _local15));
};
_local3.push(_local15);
break;
case 50:
_local15 = _local3.pop();
_local15 = _local15.charCodeAt(0);
_local3.push(_local15);
break;
case 51:
_local15 = _local3.pop();
_local15 = String.fromCharCode(_local15);
_local3.push(_local15);
break;
case 52:
_local15 = getTimer();
_local3.push(_local15);
break;
case 61:
_local20 = getFNameAndArgs(_local3, _local7);
_local15 = _arg1[_local20].apply(_arg1, _local7);
_local3.push(_local15);
break;
case 62:
_local15 = _local3.pop();
return (_local15);
case 63:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = (_local16 % _local17);
_local3.push(_local15);
break;
case 64:
_local20 = getFNameAndArgs(_local3, _local7);
_local15 = newClass(_local20, _local7);
_local3.push(_local15);
break;
case 66:
_local21 = _local3.pop();
_local15 = new Array();
while (--_local21 >= 0) {
_local15.push(_local3.pop());
};
_local3.push(_local15);
break;
case 67:
_local21 = _local3.pop();
_local15 = new Object();
while (--_local21 >= 0) {
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15[_local16] = _local17;
};
_local3.push(_local15);
break;
case 68:
_local15 = _local3.pop();
_local15 = typeof(_local15);
_local3.push(_local15);
break;
case 71:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = (_local16 + _local17);
_local3.push(_local15);
break;
case 72:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = (_local16 < _local17);
_local3.push(_local15);
break;
case 73:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = (_local16 == _local17);
_local3.push(_local15);
break;
case 74:
_local15 = _local3.pop();
_local15 = Number(_local15);
_local3.push(_local15);
break;
case 75:
_local15 = _local3.pop();
_local15 = String(_local15);
_local3.push(_local15);
break;
case 76:
_local15 = _local3.pop();
_local3.push(_local15);
_local3.push(_local15);
break;
case 77:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local3.push(_local17);
_local3.push(_local16);
break;
case 78:
cacheMember(_local3);
break;
case 79:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = _local3.pop();
_local15[_local16] = _local17;
break;
case 80:
_local15 = _local3.pop();
_local15++;
_local3.push(_local15);
break;
case 81:
_local15 = _local3.pop();
_local15--;
_local3.push(_local15);
break;
case 82:
_local20 = _local3.pop();
_local23 = _local3.pop();
_local21 = _local3.pop();
_local15 = new Array();
while (--_local21 >= 0) {
_local15.push(_local3.pop());
};
_local15 = _local23[_local20].apply(_local23, _local15);
_local3.push(_local15);
break;
case 83:
_local13 = cacheMember(_local3);
_local3.pop();
_local3.push(_local13);
_local20 = getFNameAndArgs(_local3, _local7);
_local15 = newClass(_local20, _local7);
_local3.push(_local15);
break;
case 84:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = (_local16 is _local17);
_local3.push(_local15);
break;
case 85:
_local14 = _local3.pop();
_local3.push(null);
for (_local13 in _local14) {
_local3.push(_local13);
};
break;
case 96:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = (_local16 & _local17);
_local3.push(_local15);
break;
case 97:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = (_local16 | _local17);
_local3.push(_local15);
break;
case 98:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = (_local16 ^ _local17);
_local3.push(_local15);
break;
case 99:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = (_local16 << _local17);
_local3.push(_local15);
break;
case 100:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = (_local16 >> _local17);
_local3.push(_local15);
break;
case 101:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = (_local16 >>> _local17);
_local3.push(_local15);
break;
case 102:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = (_local16 === _local17);
_local3.push(_local15);
break;
case 103:
_local17 = _local3.pop();
_local16 = _local3.pop();
_local15 = (_local16 > _local17);
_local3.push(_local15);
break;
case 129:
if ((_arg1 is MovieClip)){
var _temp2 = codeData[offset++];
_arg1.gotoAndStop(((_temp2 | (codeData[offset++] << 8)) + 1));
} else {
offset = (offset + 2);
};
break;
case 131:
_local16 = getStr();
_local17 = getStr();
if (_local16.indexOf("FSCommand:") == 0){
_local16 = _local16.substr(10);
fscommand(_local16, _local17);
} else {
if (_local17.indexOf("_level") == 0){
} else {
navigateToURL(new URLRequest(_local16), _local17);
};
};
break;
case 135:
_local18 = codeData[offset++];
_local15 = _local3[(_local3.length - 1)];
_local5[_local18] = _local15;
break;
case 150:
_local27 = (offset + _local25);
while (offset < _local27) {
switch (codeData[offset++]){
case 0:
_local3.push(getStr());
break;
case 1:
_local3.push(readFloatRev());
break;
case 2:
_local3.push(null);
break;
case 3:
_local3.push(undefined);
break;
case 4:
_local3.push(_local5[codeData[offset++]]);
break;
case 5:
_local3.push((codeData[offset++]) ? true : false);
break;
case 6:
_local3.push(readDoubleRev());
break;
case 7:
var _temp3 = codeData[offset++];
var _temp4 = (_temp3 | (codeData[offset++] << 8));
var _temp5 = (_temp4 | (codeData[offset++] << 16));
_local3.push((_temp5 | (codeData[offset++] << 24)));
break;
case 8:
_local3.push(_local6[codeData[offset++]]);
break;
case 9:
var _temp6 = codeData[offset++];
_local3.push(_local6[(_temp6 | (codeData[offset++] << 8))]);
break;
default:
throw (new Error("未处理的 push type"));
};
};
break;
case 153:
var _temp7 = codeData[offset++];
_local24 = (_temp7 | (codeData[offset++] << 8));
if ((_local24 >>> 15)){
_local24 = (_local24 | 4294901760);
};
offset = (offset + _local24);
break;
case 157:
_local15 = _local3.pop();
if (_local15){
var _temp8 = codeData[offset++];
_local24 = (_temp8 | (codeData[offset++] << 8));
if ((_local24 >>> 15)){
_local24 = (_local24 | 4294901760);
};
offset = (offset + _local24);
} else {
offset = (offset + 2);
};
break;
default:
throw (new Error(("暂不支持的 op: " + _local26)));
};
};
return (null);
}
private static function varName2Obj(_arg1:String){
var varName = _arg1;
try {
return (getDefinitionByName(varName));
} catch(e:Error) {
};
try {
return (getDefinitionByName(("flash.display." + varName)));
} catch(e:Error) {
};
try {
return (getDefinitionByName(("flash.text." + varName)));
} catch(e:Error) {
};
return (new GetVariableCache(varName));
}
public static function runStr16(_arg1, _arg2:String){
var _local3:Array = _arg2.split(" ");
var _local4:ByteArray = new ByteArray();
var _local5:int;
for each (_arg2 in _local3) {
var _temp1 = _local5;
_local5 = (_local5 + 1);
var _local8 = _temp1;
_local4[_local8] = int(("0x" + _arg2));
};
return (run(_arg1, _local4));
}
private static function newClass(_arg1:String, _arg2:Array){
var _local3:Class = (varName2Obj(_arg1) as Class);
switch (_arg2.length){
case 0:
return (new (_local3));
case 1:
return (new _local3(_arg2[0]));
case 2:
return (new _local3(_arg2[0], _arg2[1]));
case 3:
return (new _local3(_arg2[0], _arg2[1], _arg2[2]));
case 4:
return (new _local3(_arg2[0], _arg2[1], _arg2[2], _arg2[3]));
case 5:
return (new _local3(_arg2[0], _arg2[1], _arg2[2], _arg2[3], _arg2[4]));
case 6:
return (new _local3(_arg2[0], _arg2[1], _arg2[2], _arg2[3], _arg2[4], _arg2[5]));
case 7:
return (new _local3(_arg2[0], _arg2[1], _arg2[2], _arg2[3], _arg2[4], _arg2[5], _arg2[6]));
case 8:
return (new _local3(_arg2[0], _arg2[1], _arg2[2], _arg2[3], _arg2[4], _arg2[5], _arg2[6], _arg2[7]));
case 9:
return (new _local3(_arg2[0], _arg2[1], _arg2[2], _arg2[3], _arg2[4], _arg2[5], _arg2[6], _arg2[7], _arg2[8]));
case 10:
return (new _local3(_arg2[0], _arg2[1], _arg2[2], _arg2[3], _arg2[4], _arg2[5], _arg2[6], _arg2[7], _arg2[8], _arg2[9]));
default:
throw (new Error(("暂不支持的参数个数: " + _arg2.length)));
};
}
private static function getFNameAndArgs(_arg1:Array, _arg2:Array, _arg3:Boolean=true):String{
var _local4:String;
_arg2.splice(0, _arg2.length);
if (_arg3){
_local4 = _arg1.pop();
};
var _local5:int = _arg1.pop();
while (--_local5 >= 0) {
_arg2.push(_arg1.pop());
};
return (_local4);
}
private static function getStr():String{
var _local1:int;
if (codeData[offset]){
_local1 = 1;
do {
var _temp1 = _local1;
_local1 = (_local1 + 1);
} while (codeData[(offset + _temp1)]);
codeData.position = offset;
offset = (offset + _local1);
return (codeData.readUTFBytes(_local1));
};
offset++;
return ("");
}
private static function cacheMember(_arg1:Array):String{
var varName:String;
var value:*;
var stack = _arg1;
varName = stack.pop();
var obj:Object = stack.pop();
if ((obj is GetVariableCache)){
varName = (((obj as GetVariableCache).varName + ".") + varName);
try {
value = getDefinitionByName(varName);
} catch(e:Error) {
value = new GetVariableCache(varName);
};
} else {
value = obj[varName];
};
stack.push(value);
return (varName);
}
private static function readFloatRev():Number{
numData[3] = codeData[offset++];
numData[2] = codeData[offset++];
numData[1] = codeData[offset++];
numData[0] = codeData[offset++];
numData.position = 0;
return (numData.readFloat());
}
private static function cacheVariable(_arg1:Array):String{
var _local2:String = _arg1.pop();
var _local3:* = varName2Obj(_local2);
_arg1.push(_local3);
return (_local2);
}
}
class GetVariableCache {
public var varName:String;
private function GetVariableCache(_arg1:String){
varName = _arg1;
}
}
Section 185
//Gfx (Gfx)
package {
import flash.display.*;
import flash.geom.*;
import flash.filters.*;
import flash.text.*;
public class Gfx {
public static const LEFT:int = 8;
public static const _vg618:TextFormat = new TextFormat(irrcrpt("lfrj_ktsy", 5), 20, 0xAEAEAE, true);
public static const _lg346:int = 0x0100;
public static const _qh836:int = 0x0200;
public static const _jl282:TextFormat = new TextFormat(irrcrpt("lfrj_ktsy", 5), 12, 0xFFFFFF, true);
public static const _rm609:int = -2;
public static const _mw955:TextFormat = new TextFormat(irrcrpt("jdph_irqw", 3), 12, 0xAEAEAE, true);
public static const BOTTOM:int = 4;
public static const TOP:int = 1;
public static const _ba854:String = "Gfx__ba854";
public static const _fv714:TextFormat = new TextFormat(irrcrpt("icog_hqpv", 2), 12, 0xFFFFFF, true);
public static const _fe270:TextFormat = new TextFormat(irrcrpt("icog_hqpv", 2), 20, 0xFFFFFF, true);
public static const RIGHT:int = 2;
public static var hframe:int;
public static var _gq65:ColorMatrixFilter;
public static var _cd197:Rectangle = new Rectangle();
public static var _ir613:BitmapData;
public static var vscale:Number;
public static var _tr895:BitmapData;
public static var _vq403:int;
public static var _sq320:String;
public static var height:int;
public static var vframe:int;
public static var _sa921:TextFormat = new TextFormat(irrcrpt("jdph_irqw", 3), 20, 0xFFFFFF, true);
public static var _cy300:TextField = new TextField();
public static var _md964:BitmapData;
public static var width:int;
public static var matrix:Matrix = new Matrix();
public static var hscale:Number;
public static var _gm877:Point = new Point();
public static var _mi317:ColorMatrixFilter;
public static var _vr685:Array = new Array();
public static function _rm64(_arg1:BitmapData, _arg2:BitmapData, _arg3:int=0, _arg4:int=0, _arg5:int=0, _arg6:int=1, _arg7:int=1, _arg8:int=-1, _arg9:ColorTransform=null, _arg10:Boolean=false, _arg11:Boolean=false, _arg12:int=-1, _arg13:int=-1):void{
width = ((_arg12 == -1)) ? (_arg2.width / _arg6) : _arg12;
height = ((_arg13 == -1)) ? (_arg2.height / _arg7) : _arg13;
_cd197.width = width;
_cd197.height = height;
if (_arg8 != -1){
_arg3 = (_arg3 + _sn465(_arg8, width));
_arg4 = (_arg4 + _kc87(_arg8, height));
};
hframe = (_arg5 % _arg6);
vframe = (_arg5 / _arg6);
if (((((!((_arg9 == null))) || (_arg10))) || (_arg11))){
matrix.identity();
if (((_arg10) || (_arg11))){
matrix.scale((_arg10) ? -1 : 1, (_arg11) ? -1 : 1);
matrix.translate((_arg10) ? ((_arg3 + (hframe * width)) + width) : (_arg3 - (hframe * width)), (_arg11) ? ((_arg4 + (vframe * height)) + height) : (_arg4 - (vframe * height)));
} else {
matrix.translate((_arg3 - (hframe * width)), (_arg4 - (vframe * height)));
};
_cd197.x = _arg3;
_cd197.y = _arg4;
_arg1.draw(_arg2, matrix, _arg9, null, _cd197, false);
} else {
_cd197.x = (hframe * width);
_cd197.y = (vframe * height);
_gm877.x = _arg3;
_gm877.y = _arg4;
_arg1.copyPixels(_arg2, _cd197, _gm877, null, null, true);
};
}
public static function _ia682(_arg1:BitmapData, _arg2:BitmapData, _arg3:Number, _arg4:Number, _arg5:int, _arg6:int, _arg7:int, _arg8:int=-1, _arg9:ColorTransform=null, _arg10:Number=1, _arg11:Number=1, _arg12:Boolean=false, _arg13:Boolean=false):void{
width = ((_arg2.width / _arg6) * _arg10);
height = ((_arg2.height / _arg7) * _arg11);
if (_arg8 != -1){
if ((_arg8 & _lg346) != 0){
_arg3 = (_arg3 - (width / 2));
} else {
if ((_arg8 & RIGHT) != 0){
_arg3 = (_arg3 - width);
};
};
if ((_arg8 & _qh836) != 0){
_arg4 = (_arg4 - (height / 2));
};
if ((_arg8 & BOTTOM) != 0){
_arg4 = (_arg4 - height);
};
};
matrix.identity();
if (_arg12){
matrix.scale(-(_arg10), _arg11);
matrix.translate(((_arg3 + ((_arg5 % _arg6) * width)) + width), (_arg4 - (int((_arg5 / _arg6)) * height)));
} else {
matrix.scale(_arg10, _arg11);
matrix.translate((_arg3 - ((_arg5 % _arg6) * width)), (_arg4 - (int((_arg5 / _arg6)) * height)));
};
_cd197.x = _arg3;
_cd197.y = _arg4;
_cd197.width = (width + 1);
_cd197.height = (height + 1);
_arg1.draw(_arg2, matrix, _arg9, null, _cd197, _arg13);
}
public static function _rg253(_arg1:BitmapData, _arg2:String, _arg3:Number, _arg4:Number, _arg5:int, _arg6:ColorTransform, _arg7:String, _arg8:int, _arg9:int=0, _arg10:Boolean=false):void{
if (_arg2.length == 0){
return;
};
_sa921.font = _arg7;
_sa921.size = _arg8;
_sa921.color = _arg9;
_sa921.bold = true;
_yy947(_arg2, -1, _arg7, _arg8, _arg9, _arg10);
Gfx._rm64(_arg1, Gfx._tr895, _arg3, _arg4, 0, 1, 1, _arg5, _arg6);
}
public static function _eo234(_arg1:BitmapData, _arg2:Number):void{
_arg1.colorTransform(_arg1.rect, new ColorTransform((1 - _arg2), (1 - _arg2), (1 - _arg2), 1, 1, 1, 1, 1));
}
public static function fillRect(_arg1:BitmapData, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):void{
if (_arg6 != -1){
_arg2 = (_arg2 + _sn465(_arg6, _arg4));
_arg3 = (_arg3 + _kc87(_arg6, _arg5));
};
_cd197.x = _arg2;
_cd197.y = _arg3;
_cd197.width = _arg4;
_cd197.height = _arg5;
_arg1.fillRect(_cd197, _arg7);
}
public static function _kc87(_arg1:int, _arg2:Number):int{
if ((_arg1 & _qh836) != 0){
return ((-(_arg2) >> 1));
};
if ((_arg1 & BOTTOM) != 0){
return (-(_arg2));
};
return (0);
}
public static function _ec952(_arg1:BitmapData, _arg2:BitmapData, _arg3:int, _arg4:int, _arg5:int, _arg6:ColorTransform, _arg7:Number=0, _arg8:Boolean=false, _arg9:Number=1, _arg10:Boolean=false):void{
width = (_arg2.width * _arg9);
height = (_arg2.height * _arg9);
if (_arg5 != -1){
_arg3 = (_arg3 + _sn465(_arg5, width));
_arg4 = (_arg4 + _kc87(_arg5, height));
};
matrix.identity();
if (_arg8){
matrix.scale(-1, 1);
matrix.translate(width, 0);
};
matrix.scale((1 / _arg9), (1 / _arg9));
matrix.translate((-(width) >> 1), (-(height) >> 1));
matrix.rotate(_arg7);
matrix.translate((width >> 1), (height >> 1));
matrix.translate(_arg3, _arg4);
_arg1.draw(_arg2, matrix, _arg6, null, null, _arg10);
}
public static function _vc637(_arg1:BitmapData, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:ColorTransform):void{
if (_arg6 != -1){
_arg2 = (_arg2 + _sn465(_arg6, _arg4));
_arg3 = (_arg3 + _kc87(_arg6, _arg5));
};
_cd197.x = _arg2;
_cd197.y = _arg3;
_cd197.width = _arg4;
_cd197.height = _arg5;
_arg1.colorTransform(_cd197, _arg7);
}
public static function _vq222(_arg1:BitmapData):BitmapData{
var _local2:Number = 0;
var _local3:Number = 0.3086;
var _local4:Number = 0.6094;
var _local5:Number = 0.082;
var _local6:Number = (((1 - _local2) * _local3) + _local2);
var _local7:Number = ((1 - _local2) * _local4);
var _local8:Number = ((1 - _local2) * _local5);
var _local9:Number = ((1 - _local2) * _local3);
var _local10:Number = (((1 - _local2) * _local4) + _local2);
var _local11:Number = ((1 - _local2) * _local5);
var _local12:Number = ((1 - _local2) * _local3);
var _local13:Number = ((1 - _local2) * _local4);
var _local14:Number = (((1 - _local2) * _local5) + _local2);
_gq65 = new ColorMatrixFilter([_local6, _local7, _local8, 0, 0, _local9, _local10, _local11, 0, 0, _local12, _local13, _local14, 0, 0, 0, 0, 0, 1, 0]);
_arg1.applyFilter(_arg1, _arg1.rect, new Point(0, 0), _gq65);
return (_arg1);
}
public static function _sn465(_arg1:int, _arg2:Number):int{
if ((_arg1 & _lg346) != 0){
return ((-(_arg2) >> 1));
};
if ((_arg1 & RIGHT) != 0){
return (-(_arg2));
};
return (0);
}
public static function _yy947(_arg1:String, _arg2:int, _arg3:String="", _arg4:int=0, _arg5:int=0, _arg6:Boolean=false):BitmapData{
_sq320 = Main._we939.quality;
Main._we939.quality = StageQuality.HIGH;
_sa921.font = _arg3;
_sa921.size = _arg4;
_sa921.color = _arg5;
_sa921.bold = true;
_cy300.autoSize = TextFieldAutoSize.LEFT;
_cy300.defaultTextFormat = _sa921;
_cy300.embedFonts = true;
_cy300.htmlText = ((irrcrpt("<d>", 2) + _arg1) + irrcrpt("</d>", 2));
if (_arg6){
_cy300.filters = [new GlowFilter(0, 1, 4, 4, 3, 1, false, false)];
} else {
_cy300.filters = null;
};
if (_arg2 != -1){
_cy300.width = _arg2;
_cy300.wordWrap = true;
} else {
_cy300.wordWrap = false;
};
_tr895 = new BitmapData(_cy300.width, _cy300.height, true, 0);
matrix.identity();
matrix.ty = _rm609;
_tr895.draw(_cy300, matrix, null, null, null, true);
Main._we939.quality = _sq320;
return (_tr895);
}
public static function _ko491(_arg1:BitmapData, _arg2:BitmapData, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int, _arg8:int, _arg9:ColorTransform, _arg10:Number, _arg11:Number, _arg12:Boolean=false, _arg13:Boolean=false):void{
width = (_arg2.width / _arg4);
height = (_arg2.height / _arg5);
hscale = (_arg10 / width);
vscale = (_arg11 / height);
width = (width * hscale);
height = (height * vscale);
if (_arg8 != -1){
_arg6 = (_arg6 + _sn465(_arg8, width));
_arg7 = (_arg7 + _kc87(_arg8, height));
};
matrix.identity();
if (_arg12){
matrix.scale(-(hscale), vscale);
matrix.translate(((_arg6 + ((_arg3 % _arg4) * width)) + width), (_arg7 - (int((_arg3 / _arg4)) * height)));
} else {
matrix.scale(hscale, vscale);
matrix.translate((_arg6 - ((_arg3 % _arg4) * width)), (_arg7 - (int((_arg3 / _arg4)) * height)));
};
_cd197.x = _arg6;
_cd197.y = _arg7;
_cd197.width = width;
_cd197.height = height;
_arg1.draw(_arg2, matrix, _arg9, null, _cd197, _arg13);
}
}
}//package
Section 186
//Gfx__ba854 (Gfx__ba854)
package {
import mx.core.*;
public class Gfx__ba854 extends FontAsset {
}
}//package
Section 187
//irrcrpt (irrcrpt)
package {
public function irrcrpt(_arg1:String, _arg2:int):String{
var _local5:int;
var _local3:String = new String();
var _local4:int;
while (_local4 < _arg1.length) {
_local5 = _arg1.charCodeAt(_local4);
if ((((_local5 >= 48)) && ((_local5 <= 57)))){
_local5 = ((_local5 - _arg2) - 48);
if (_local5 < 0){
_local5 = (_local5 + ((57 - 48) + 1));
};
_local5 = ((_local5 % ((57 - 48) + 1)) + 48);
} else {
if ((((_local5 >= 65)) && ((_local5 <= 90)))){
_local5 = ((_local5 - _arg2) - 65);
if (_local5 < 0){
_local5 = (_local5 + ((90 - 65) + 1));
};
_local5 = ((_local5 % ((90 - 65) + 1)) + 65);
} else {
if ((((_local5 >= 97)) && ((_local5 <= 122)))){
_local5 = ((_local5 - _arg2) - 97);
if (_local5 < 0){
_local5 = (_local5 + ((122 - 97) + 1));
};
_local5 = ((_local5 % ((122 - 97) + 1)) + 97);
};
};
};
_local3 = (_local3 + String.fromCharCode(_local5));
_local4++;
};
return (_local3);
}
}//package
Section 188
//Main (Main)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import org.papervision3d.materials.*;
import flash.filters.*;
import mochi.as3.*;
import org.papervision3d.objects.primitives.*;
import flash.net.*;
import com.bored.services.*;
import flash.system.*;
import flash.ui.*;
public class Main extends PaperBase {
private const _mf769:int = 5;
private const LEFT:int = 8;
private const _ib837:int = 6;
private const _ec146:int = 11;
private const _qm960:int = 3;
private const _up433:BitmapData;
private const _md113:int = 310;
private const _em163:int = 2;
private const _ot875:Array;
private const _xb933:int = 3;
private const _eh970:int = 10;
private const _wt653:int = 0;
private const _vq467:BitmapData;
private const _jv249:int;
private const _ap902:int;
private const _rw574:int = 4;
private const _gj520:int = 2;
private const _cx475:int = 180;
private const _uc175:int = 52;
private const _aw782:int = 180000;
private const _gg268:int = 100;
private const _aw670:int = 0;
private const _ww945:Array;
private const _sl159:int = 0;
private const _tb292:int = 9;
private const _fp160:String;
private const _lo84:int = 1;
private const _br900:int = -204;
private const _th711:Number = 0.2;
private const _fa807:String;
private const _sh60:int = 3;
private const _hj343:int;
private const _uq455:int = 3;
private const _kv199:int = 7;
private const _ps160:int;
private const _jk280:int = 1;
private const _qw322:int = 250;
private const _kd573:int = 5;
private const _hb879:int = 5;
private const _uh897:int = 48;
private const _se546:int = 4;
private const _wk400:int = 0;
private const _ek939:int = 5;
private const gameKey:String;
private const _rm364:int = 2;
private const _aj35:int = 242;
private const TOP:int = 1;
private const _xn864:int = 1;
private const _ut528:int = 8;
private const _uq496:int = 4;
private const _kc278:BitmapMaterial;
private const _ao405:Class;
private const _nq187:int;
private const _tp250:int = 10;
private const _mv836:int = 11;
private const _gu350:int = 8;
private const _pc880:int = 1;
private const _na871:int = 3;
private const _lg346:int = 0x0100;
private const _re320:int = 12;
private const _jy499:int;
private const _gd842:int = 8;
private const _nx975:int;
private const _he741:Array;
private const _vv553:int = 110;
private const _uf199:int;
private const RIGHT:int = 2;
private const _na672:int = 4;
private const _rd386:int;
private const _nk221:int = 1;
private const _rr654:int = 38;
private const _of807:int = 6;
private const _gb576:int;
private const _uv72:String;
private const _qh836:int = 0x0200;
private const BOTTOM:int = 4;
private const _fl687:int = 4;
private const _wl480:int = 1;
private const _yi24:int = 7;
private const _xq738:int = 4;
private const _ci543:int = 10;
private const _pa181:int = 5;
private const _nm668:int;
private const _yd254:int = 50;
private const _lv43:int = 2;
private const _ai954:int;
private const _yo373:int = 0;
private const _ul785:int = 13;
private const _fy767:int = 32;
private const _au803:int = 6;
private const SELECTED:int = 2;
private const _uk102:int = 3;
private const _xf657:int;
private const _pm244:int = 0;
private const _pp568:Array;
private const _ln948:int = 2;
private const _uo712:int = 1;
private const _wp652:int = 14;
private const _st336:int;
private const _lv443:int = 442;
private const _gx153:int = 8;
private const _cg188:int = 100;
private const _il912:int = 1;
private const _fl169:int = 9;
private const _gf660:int = 5;
private const _qt405:int = 2;
private const _yl926:int = 99;
private const _fc477:Array;
private const _or632:int = 8;
private const _qi30:int = 2;
private const _kl899:int = 1;
private const _yi424:int = 0;
private const _dm315:int = 3;
private const _ij645:int = 0;
private const _sa550:int = 7;
private const _ea162:int = 5;
private const _gg662:int = 100;
private const _ak504:int = -1;
private const _gf457:int = 2;
private const _qk621:int = 3;
private const _sv468:int = 3;
private const _ke938:int = 9;
private const _md567:int = 6;
private const _ev44:int = 0;
private const _wp33:int = 12;
private const _eh939:int = 1;
private const _rk568:String;
private const _bs286:int = 1;
private const _og323:int;
private const _og324:int = 2;
private const _td410:int = 0;
private const _ac90:int = 1;
private const _tr919:Array;
private var tutorial_image_timer:int;
private var _yh268:int;// = 0
private var _bk102:int;
private var _im602:int;
private var mouse_column:int;
private var _jw314:Number;
private var _xc904:int;
private var hiscore_3_minutes:MochiDigits;
private var _kx335:Array;
private var _ty347:int;// = -1
private var _ik686:int;
private var _pj673:Plane;
private var _iy954:Array;
private var _aa792:Array;
private var _ru12:int;
private var _vt754:int;
private var stats:Array;
private var image_score_value:BitmapData;
private var hiscore_display:int;
private var _nj622:Boolean;
public var _cm132:MovieClip;
private var _xt367:int;
private var hint_y:int;
private var _aw689:Array;
private var show_level_up_text:Boolean;
private var _tf312:int;// = 0
private var _hi387:int;
private var _am677:int;
private var _rc449:Number;
private var _nu757:Array;
private var _ci916:Sprite;
private var _qu395:Number;// = 0
private var _fa839:SharedObject;
private var _gu447:int;
private var _yd984:Array;
private var global_stats:Array;
private var _ee164:Number;
private var hint_angle:Number;// = 0
private var _ao510:Array;
private var _br702:Boolean;// = false
private var paused:Boolean;
private var _yl481:int;// = 0
private var prev_mouse_c:int;
private var _nk517:Array;
private var hiscore_casual:MochiDigits;
private var image_stat_value:BitmapData;
private var _vm930:Array;
private var _gx734:Array;
private var _hp931:Array;
private var prev_mouse_r:int;
private var _fl619:Boolean;// = false
private var _ei420:Array;
private var _gn833:Array;
private var _dg324:int;
private var _vc800:Number;
private var _gm877:Point;
private var _xk480:Array;
private var _mi317:ColorMatrixFilter;
private var HINT_TIMER_MAX:int;// = 500
private var _bp434:Boolean;
private var _qy562:Array;
private var tutorial_image_index:int;
private var _ho744:Number;// = 0
private var _kf211:BitmapData;
private var _hc43:Number;
private var _bt921:Boolean;
private var _nx725:Array;
private var _nt122:Array;
private var _ti534:Number;
private var _ta935:Number;
private var _nb514:BitmapData;
private var _dn86:int;
private var _hy797:Point;
private var _gl465:int;
private var _tp187:BitmapData;
private var _ig612:int;
private var _et473:Array;
private var tutorial_image_opacity:Number;
private var _ao468:int;
private var image_hiscore_value:BitmapData;
private var _cd197:Rectangle;
private var _dl953:BitmapData;
private var _ks307:Array;
private var _ck712:Array;
private var _kf147:int;// = 0
private var bonus_desc_scale:Number;
private var _wn543:MochiDigits;
private var _ch444:Array;
private var _ll600:int;
private var debug:Boolean;// = false
private var _ei266:Rectangle;
private var hiscore_100_moves:MochiDigits;
private var _np937:Array;
private var _kh673:int;// = 0
private var ticks:int;// = 0
private var _vn766:Boolean;
private var new_hiscore:Boolean;
private var image_chain_length:BitmapData;
private var _kt685:int;// = -1
private var _qi735:Array;
private var board_vy:Number;
private var image_stat_label:BitmapData;
private var _vk275:Boolean;// = false
private var _om384:int;
private var _up935:Array;
private var _sw615:MovieClip;// = null
private var _ju401:Boolean;
private var board_yo:Number;
private var _fp878:Boolean;
private var _ml355:Number;
private var _ai891:Number;
private var _ve642:Array;
private var bonus_effect_timer:int;
private var _cm858:int;
private var _rl968:int;
private var mouse_row:int;
private var last_blob_cleared_y:int;
private var bonus_type:int;
private var _ys443:Array;
private var _fq753:Number;
private var _tn768:int;
private var image_hiscore_label:BitmapData;
private var hint_timer:int;
private var _al956:Stats;
private var _yc18:Number;// = 0
private var _le723:Boolean;
private var _cn629:MochiDigits;
private var matrix:Matrix;
private var prev_mouseY:int;
private var hi_stats:Array;
private var _vu908:Array;
private var clear_colour:int;// = 0
private var _tp505:Array;
public static const _mc654:int = 7;
public static const _bx358:int = (_al555 >> 1);
public static const _al555:int = 640;
public static const _ps667:int = 9;
public static const _mk424:int = 9;
public static const _yt719:int = 2;
public static const _mb217:int = 6;
public static const _mc625:int = -1;
public static const _ol566:int = 5;
public static const _ym371:int = 0;
public static const _qf788:int = -1;
public static const _gn62:int = 8;
public static const _bt419:int = 7;
public static const _rd609:int = 480;
public static const _cj956:int = 3;
public static const _jq829:int = 6;
public static const _ri788:int = (_rd609 >> 1);
public static const _pj46:int = 10;
public static const _cy833:BitmapData = new BitmapData(_al555, _rd609, false);
public static const _dq58:int = 5;
public static const _bx629:int = 4;
public static const _kw973:int = -2;
public static const _ew71:int = 1;
public static const _ul266:int = 1;
public static var _bu847:Boolean = false;
public static var bloke_on:Boolean = true;
public static var _mf298:int = -1;
public static var _aw558;
public static var music_on:Boolean = true;
public static var messages_on:Boolean = true;
public static var _we939:Stage;
public static var _jh775:int = 0;
public static var sfx_on:Boolean = true;
public static var _ff115:int = _mf298;
public static var _sh134:int;
public static var daytime:Boolean = true;
public static var one_click:Boolean = false;
public static var _yd22:int = 0;
public static var _jw579:Boolean = false;
public function Main(){
var _local1:int;
_rk568 = irrcrpt("x2.7.9, 46vj Pqxgodgt 4232", 2);
_fa839 = SharedObject.getLocal(irrcrpt("fsqfssdpi6_z480", 4), "/");
matrix = new Matrix();
_cd197 = new Rectangle();
_gm877 = new Point();
_yd984 = ["casual", "timed", "100_moves"];
_qi735 = ["Casual", "Timed", "100 Moves"];
_he741 = ["c1b879bf909dfa34", "840c21100149fa53", "bdb95d73b0cf5f52"];
_ao405 = Main__ao405;
_up433 = Bitmap(new _ao405()).bitmapData;
_nx975 = (_up433.width / _tp250);
_uf199 = (_up433.height / _xn864);
_jy499 = (_ke938 * _nx975);
_ai954 = (_wp33 * _uf199);
_vq467 = new BitmapData(Res._ch177.width, Res._ch177.height, true);
_ap902 = (_md113 + _jy499);
_og323 = (_md113 + (_jy499 >> 1));
_jv249 = (((_ri788 - (_ai954 >> 1)) - _uf199) - 9);
_rd386 = (_jv249 + _ai954);
_st336 = (Res._xe216[0].width / Res._wx777);
_nq187 = Res._xe216[0].height;
_ps160 = (_st336 * _gu350);
_gb576 = (_og323 - (_ps160 >> 1));
_xf657 = ((_rd609 - _nq187) - 5);
_kc278 = new BitmapMaterial(_vq467);
_hp931 = new Array();
_et473 = new Array();
_nu757 = new Array();
_ck712 = new Array();
_vu908 = new Array();
_cn629 = new MochiDigits();
_ci916 = new Sprite();
_wn543 = new MochiDigits();
hiscore_casual = new MochiDigits(100000);
hiscore_3_minutes = new MochiDigits(100000);
hiscore_100_moves = new MochiDigits(100000);
stats = new Array(_gd842);
hi_stats = new Array(_gd842);
_ks307 = new Array(_gd842);
_gx734 = new Array(_gd842);
_pp568 = [30000, 100, 10, 1, 1, 10000, 5, 10000];
_ot875 = ["SCORE", "BLOBS", "MOVES", "CHAIN", "COMBO", "BONUS", "CLEARANCE", "TIME"];
global_stats = new Array(_xq738);
_qy562 = new Array(_xq738);
_nk517 = new Array(_sh60);
_vm930 = new Array(_gu350);
_nx725 = new Array(_gu350);
_ch444 = new Array(_gu350);
_hj343 = (_ri788 - ((_md567 * _uh897) >> 1));
_ys443 = new Array(_ut528);
_up935 = new Array(_ut528);
_xk480 = new Array(_ut528);
_ei420 = new Array(_ut528);
_iy954 = new Array(_ut528);
_aa792 = new Array(_yd254);
_gn833 = new Array(_yd254);
_aw689 = new Array(_yd254);
_ao510 = new Array(_yd254);
_tr919 = [9, 10];
_fc477 = [2, 4];
_nt122 = new Array(_pa181);
_ve642 = new Array(_pa181);
_kx335 = new Array(_pa181);
_np937 = new Array(_pa181);
_tp505 = new Array(_pa181);
_ww945 = [1, 2, 424, false, 1, 72, 395, false, 1, 0xFF, 415, false, 1, 383, 426, false, 1, 584, 403, false, 0, 114, 397, false, 0, 231, 415, true, 0, 249, 427, false, 0, 427, 449, false, 0, 496, 411, false, 2, -47, 496, false, 2, 33, 518, false, 2, 486, 0x0202, false, 2, 590, 502, false];
_nm668 = (_ww945.length >> 2);
_uv72 = irrcrpt("7665f71g50h6ef03", 2);
_cm132 = new MovieClip();
_fa807 = irrcrpt("lxxt://ekm.evqsvkeqiw.gsq/ewwixw/ekm/EKM.waj", 4);
_fp160 = irrcrpt("gig342h0000648h6fe40fh0e8g4egf86", 4);
gameKey = irrcrpt("dqodqqbng-4", 2);
_ei266 = new Rectangle(0, 0, (_al555 + 32), _og324);
_hy797 = new Point();
super();
trace(irrcrpt("Ohw'v sodb Erperrcoh 5!", 3));
if (Preloader._uy339){
MochiSocial.addEventListener(MochiSocial.ERROR, _rh793);
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, _id587);
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, _gs957);
};
_local1 = 0;
while (_local1 < _gd842) {
hi_stats[_local1] = 0;
_local1++;
};
_local1 = 0;
while (_local1 < _xq738) {
global_stats[_local1] = 0;
_local1++;
};
Achievements.init();
Messages.init();
Res.init();
_qf134();
_local1 = 0;
while (_local1 < (Res._mx164.length >> 1)) {
_tp505[_local1] = Res._mx164[_local1].width;
_local1++;
};
_ww312(-1, true);
init(_al555, _rd609);
_pj673.x = (_md113 - 172);
_pj673.y = (_jv249 + 46);
_pj673.visible = false;
addChild(_ci916);
_ci916.visible = false;
if (Preloader._bf448){
startTransition(_ym371);
} else {
startTransition(_ew71);
};
if (Preloader.version == Preloader._lx61){
addEventListener(Event.ADDED_TO_STAGE, _nh496);
} else {
addEventListener(Event.ENTER_FRAME, update);
};
}
final private function _td668(_arg1:int):void{
var _local2:int;
while (_local2 < _gx153) {
if ((((_local2 == _arg1)) || ((_arg1 == -1)))){
_nx725[_local2] = Gfx._yy947(_vm930[_local2], -1, irrcrpt("jdph_irqw", 3), 12, (daytime) ? 0x282828 : 0xFFFFFF);
};
_local2++;
};
}
final private function _iu445():void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local1:int;
_local2 = 0;
while (_local2 < _ke938) {
_local3 = 0;
while (_local3 < _wp33) {
if (((!((_ck712[_local2][_local3] == _sl159))) || ((_hp931[_local2][_local3] == -1)))){
_local1++;
_ck712[_local2][_local3] = _sl159;
_local4 = _local3;
while (_local4 >= 0) {
_et473[_local2][_local4] = 0.1;
_local4--;
};
};
_local3++;
};
_local2++;
};
_mj452(((_local1 * _local1) * 10), _om384, last_blob_cleared_y);
_fp878 = true;
_le723 = false;
_dl737(_gj520, true, 1);
switch (_tn768){
case _ln948:
_cy500(_na871);
if ((((stats[_gj520] == 50)) || ((stats[_gj520] == 80)))){
Audio._vu586(Res._ej852);
_jh775++;
};
break;
case _ev44:
if ((stats[_gj520] % _gg268) == 0){
_xs768();
};
break;
};
_dl737(_rw574, false, _rl968);
if (_rl968 > 1){
Messages.add(((_rl968.toString() + " ") + Res._sc554.combo));
if (_rl968 >= 30){
Achievements.unlock(Achievements._xa544);
};
if (_rl968 >= 20){
Achievements.unlock(Achievements._nv106);
};
if (_rl968 >= 10){
Achievements.unlock(Achievements._ti358);
};
};
var _local5:int = ((_am677 / _yl926) * 100);
_dl737(_of807, false, _local5);
if (_local5 >= 100){
Achievements.unlock(Achievements._sl480);
};
if (_local5 >= 50){
Achievements.unlock(Achievements._dn359);
};
if (_local5 >= 25){
Achievements.unlock(Achievements._dx101);
};
if (_local5 >= 100){
Messages.add(Res._sc554.board_cleared);
Audio._dc461(Res._jt851[_ot632()]);
_mj452(50000, _bx358, _ri788);
} else {
if (_local5 >= 25){
Messages.add((_local5.toString() + Res._sc554.clearance));
};
};
_dl737(_uo712, true, _am677);
if (Math.floor((stats[_uo712] / 100)) > _ru12){
Messages.add(((Utils._km167((++_ru12 * 100)) + " ") + Res._sc554.blobs_cleared));
};
if (stats[_uo712] >= 3000){
Achievements.unlock(Achievements._ti268);
} else {
if (stats[_uo712] >= 2000){
Achievements.unlock(Achievements._wm651);
} else {
if (stats[_uo712] >= 1000){
Achievements.unlock(Achievements._xt100);
};
};
};
}
final private function resume():void{
if (paused){
paused = false;
Menu.reset();
if (bloke_on){
_sw615.play();
};
};
}
final private function _dm139(_arg1:int, _arg2:Number):void{
graphics.beginFill(_arg1, _arg2);
graphics.drawRect(0, 0, _al555, _rd609);
graphics.endFill();
}
final private function _ij104(_arg1:Boolean=false):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
if (((!(_arg1)) && ((_tn768 == _ln948)))){
_local2 = (_gg662 - stats[_gj520]);
_local2 = Math.max(0, _local2);
if (((((_local2 % 10) == 0)) || ((_local2 == 1)))){
Messages.add(((_local2.toString() + " ") + ((_local2 == 1)) ? Res._sc554.move_left : Res._sc554.moves_left));
};
if (_local2 <= 0){
_js834(false);
};
};
if (!_nj622){
_xt367 = 0;
_vn766 = false;
_local3 = 0;
while (_local3 < _ke938) {
_local4 = 0;
while (_local4 < _wp33) {
if (_local4 > 0){
if ((((_hp931[_local3][_local4] == _bt419)) || (_ju941(_local3, _local4)))){
_xt367++;
if ((((_xt367 == 0)) || ((Math.random() < 0.5)))){
_ll600 = _lf261(_local3);
hint_y = _sa454(_local4);
hint_timer = HINT_TIMER_MAX;
};
};
};
if (_hp931[_local3][_local4] == _mk424){
_vn766 = true;
if (_local4 == _ec146){
_xt367++;
};
};
_local4++;
};
_local3++;
};
if (_xt367 == 0){
if (_arg1){
_xl789(_yo373, 4, 5);
_xl789(_yo373, 5, 5);
_xl789(_yo373, 5, 6);
_xt367++;
} else {
_local5 = -1;
_local6 = 0;
while (_local6 < _gx153) {
if (_vm930[_local6] >= _cg188){
switch (_local6){
case _yi424:
_local3 = 0;
while (_local3 < _ke938) {
if (_hp931[_local3][1] == _mk424){
_local5 = _local6;
};
_local3++;
};
break;
case _jk280:
case _sv468:
case _au803:
_local5 = _local6;
break;
case _kd573:
case _lv43:
_local3 = 0;
while (_local3 < _ke938) {
_local4 = 1;
while (_local4 < _ke938) {
if ((((_hp931[_local3][_local4] == _ol566)) || ((_hp931[_local3][_local4] == _or632)))){
_local5 = _local6;
};
_local4++;
};
_local3++;
};
break;
case _sa550:
_local3 = 0;
while (_local3 < _ke938) {
_local4 = 1;
while (_local4 < _ke938) {
if ((((_hp931[_local3][_local4] >= _eh970)) && ((_hp931[_local3][_local4] <= _wp652)))){
_local5 = _local6;
};
_local4++;
};
_local3++;
};
break;
};
if (_local5 != -1){
_local6 = _gx153;
};
};
_local6++;
};
if (_local5 != -1){
_xt367++;
_ll600 = (_gb576 + (_local5 * _st336));
hint_y = _xf657;
hint_timer = HINT_TIMER_MAX;
};
};
};
if (_xt367 == 0){
_js834(false);
} else {
if (_xt367 < 4){
Messages.add(Res._sc554.warning);
_wq930(_ib837);
};
};
};
}
final private function _lf753(_arg1:int, _arg2:int):void{
var _local3 = -1;
if (_cn629.value == 3){
_local3 = ((_sh134 > 2)) ? _or632 : _ol566;
Audio._dc461(Res._ne701);
} else {
if (_cn629.value >= 5){
_local3 = _bt419;
Audio._dc461(Res._cn439[_ot632()]);
};
};
if (_cn629.value >= 5){
if (++_vt754 >= 4){
_vt754 = 0;
_wq930(_se546);
} else {
_wq930(_em163);
};
} else {
if (_cn629.value == 3){
_vt754 = 0;
_wq930(_qk621);
};
};
if (_local3 != -1){
_xl789(_local3, _arg1, 0);
};
}
final private function _yn844():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:String;
var _local5:Array;
var _local6:String;
var _local7:int;
switch (_mf298){
case _mc625:
_cy833.fillRect(_cy833.rect, 0xFFFFFF);
break;
case _kw973:
_cy833.fillRect(_cy833.rect, 0x5500);
Gfx._rg253(_cy833, (irrcrpt("whvw_prgh = ", 3) + _yl481.toString()), 8, (_rd609 - 8), (BOTTOM | LEFT), null, irrcrpt("icog_hqpv", 2), 32);
break;
case _jq829:
drawBackground();
Gfx._rm64(_cy833, _dl953, _bx358, 9, 0, 1, 1, (TOP | _lg346));
Gfx._rm64(_cy833, Res._nw470[_gu447][tutorial_image_index], _bx358, 206, 0, 1, 1, (TOP | _lg346), null);
_local2 = Res._nw470[_gu447].length;
if (_local2 > 1){
if (++tutorial_image_timer > 70){
Gfx._rm64(_cy833, Res._nw470[_gu447][((tutorial_image_index + 1) % _local2)], _bx358, 206, 0, 1, 1, (TOP | _lg346), new ColorTransform(1, 1, 1, tutorial_image_opacity), false, false);
if ((tutorial_image_opacity = (tutorial_image_opacity + 0.05)) >= 1){
tutorial_image_timer = 0;
tutorial_image_opacity = 0;
if (++tutorial_image_index >= _local2){
tutorial_image_index = 0;
};
};
};
};
break;
case _ew71:
case _mc654:
drawBackground();
break;
case _yt719:
drawBackground();
if (debug){
Gfx._rg253(_cy833, irrcrpt("Fgdwiikpi qp!", 2), 8, 8, -1, null, irrcrpt("keqi_jsrx", 4), 16, 0xFFFFFF);
};
Messages.draw();
break;
case _cj956:
drawBackground();
if (!_bp434){
if (!_pj673.visible){
_bb408(_cy833, true);
};
if (_le723){
_cy833.draw(_ci916);
};
_om90();
};
_tw597();
if (_fq753 > 0){
Gfx._eo234(_cy833, _fq753);
};
break;
case _gn62:
drawBackground();
if (board_yo < _rd609){
Gfx._ec952(_cy833, _vq467, _og323, (419 + board_yo), (_lg346 | BOTTOM), null, _ml355);
_om90();
};
_tw597();
switch (Preloader.version){
case Preloader._mx778:
Gfx._rm64(_cy833, Res._px744, _bx358, ((_ri788 - 100) + _ai891), 0, 1, 1, (_qh836 | _lg346));
break;
default:
_ky209(_og323, 300, false);
break;
};
Messages.draw();
break;
case _dq58:
drawBackground();
Gfx._rg253(_cy833, _rk568, 8, 8, -1, null, irrcrpt("keqi_jsrx", 4), 12, 0xFFFFFF, false);
break;
case _ps667:
drawBackground();
_qx790(_bx358, _ri788, 470, 246, (_lg346 | _qh836), 0);
_local3 = 142;
_local5 = [_xb933, _rw574, _ek939, _of807];
_local1 = 0;
while (_local1 < 4) {
switch (_local5[_local1]){
case _xb933:
_local4 = int(hi_stats[_xb933]).toString();
break;
case _rw574:
_local4 = int(hi_stats[_rw574]).toString();
break;
case _ek939:
_local4 = Utils._km167(hi_stats[_ek939]);
break;
case _of807:
_local4 = (int(hi_stats[_of807]).toString() + "%");
break;
};
Gfx._rm64(_cy833, _ks307[_local5[_local1]], (_bx358 - 200), _local3, 0, 1, 1, -1, new ColorTransform(1, 1, 1, _hc43));
Gfx._rg253(_cy833, _local4, (_bx358 + 200), _local3, (TOP | RIGHT), new ColorTransform(1, 1, 1, _hc43), irrcrpt("hbnf_gpou", 1), 16, 0xAEAEAE);
_local3 = (_local3 + 25);
_local1++;
};
_local1 = 0;
while (_local1 < _xq738) {
switch (_local1){
case _wt653:
case _kl899:
case _qm960:
_local4 = Utils._km167(global_stats[_local1]);
break;
case _qi30:
_local4 = Utils._wy927(global_stats[_qi30], true);
break;
};
Gfx._rm64(_cy833, _qy562[_local1], (_bx358 - 200), _local3, 0, 1, 1, -1, new ColorTransform(1, 1, 1, _hc43));
Gfx._rg253(_cy833, _local4, (_bx358 + 200), _local3, (TOP | RIGHT), new ColorTransform(1, 1, 1, _hc43), irrcrpt("hbnf_gpou", 1), 16, 0xAEAEAE);
_local3 = (_local3 + 25);
_local1++;
};
break;
case _pj46:
drawBackground();
_local1 = 0;
while (_local1 < _md567) {
_local6 = (irrcrpt(" ", 1) + _wh740((irrcrpt("dfklhyhphqw_", 3) + ((_ik686 * _md567) + _local1).toString())));
Gfx._yy947(_local6, -1, irrcrpt("lfrj_ktsy", 5), 20, 0xAEAEAE);
_local7 = ((_hj343 + (_local1 * _uh897)) + (Menu._sb840 >> 1));
Menu._so345(Main._cy833, _bx358, _local7, (Gfx._tr895.width + (Menu._kp551 << 1)), (_qh836 | _lg346));
Gfx._rm64(Main._cy833, Gfx._tr895, _bx358, (_local7 + 1), 0, 1, 1, (_qh836 | _lg346));
Gfx._rm64(Main._cy833, Res._tg333, (_bx358 - (Gfx._tr895.width >> 1)), _local7, (Achievements.achievement_unlocked[(_local1 + (_ik686 * _md567))]) ? 0 : 1, 2, 1, (Gfx._qh836 | Gfx.LEFT));
_local1++;
};
break;
case _bx629:
drawBackground();
break;
};
if (Menu._di566){
Menu.draw();
};
graphics.clear();
graphics.beginBitmapFill(_cy833, null, false, false);
graphics.drawRect(0, 0, _al555, _rd609);
graphics.endFill();
if (_vc800 > 0){
_dm139(0xFFFFFF, _vc800);
_vc800 = (_vc800 - 0.05);
};
if (_yd22 != 0){
_dm139(0xFFFFFF, _qu395);
};
}
final private function _to459():void{
if (_yd22 == 0){
_pj673.visible = true;
_pj673.rotationY = (_pj673.rotationY - _mf769);
if (_pj673.rotationY <= 0){
_pj673.rotationY = 0;
_pj673.visible = false;
_bp434 = false;
_vc800 = 1;
Audio._dc461(Res._rm828);
switch (_tn768){
case _ln948:
Messages.add(((_gg662.toString() + " ") + Res._sc554.moves_left));
break;
};
};
};
}
final private function _ky209(_arg1:int, _arg2:int, _arg3:Boolean):void{
var _local5:int;
var _local6:String;
Gfx._rm64(_cy833, Res._px744, _arg1, _ai891, 0, 1, 1, (TOP | _lg346));
var _local4 = 160;
var _local7:Array = (_arg3) ? hi_stats : _gx734;
_local5 = 1;
while (_local5 < _gd842) {
switch (_local5){
case _uo712:
_local6 = Utils._km167(_local7[_uo712]);
break;
case _gj520:
_local6 = Utils._km167(_local7[_gj520]);
break;
case _xb933:
_local6 = int(_local7[_xb933]).toString();
break;
case _rw574:
_local6 = int(_local7[_rw574]).toString();
break;
case _ek939:
_local6 = Utils._km167(_local7[_ek939]);
break;
case _of807:
_local6 = (int(_local7[_of807]).toString() + "%");
break;
case _kv199:
_local6 = Utils._wy927(_local7[_kv199], true);
break;
};
Gfx._rm64(_cy833, _ks307[_local5], (_arg1 - (_arg2 >> 1)), _local4, 0, 1, 1, -1, new ColorTransform(1, 1, 1, _hc43));
Gfx._rg253(_cy833, _local6, (_arg1 + (_arg2 >> 1)), _local4, (TOP | RIGHT), new ColorTransform(1, 1, 1, _hc43), irrcrpt("jdph_irqw", 3), 16, 0xFFFFFF);
_local4 = (_local4 + 21);
_local5++;
};
var _local8 = 4;
var _local9:int = ((_gu350 * (_nx975 + _local8)) - _local8);
var _local10:int = ((_arg1 - (_local9 >> 1)) - _ta935);
_local5 = 0;
while (_local5 < _gu350) {
Gfx._rm64(_cy833, _up433, (_local10 + (_local5 * (_nx975 + _local8))), 310, _local5, _tp250, 1);
Gfx._rg253(_cy833, _ch444[_local5], ((_local10 + (_local5 * (_nx975 + _local8))) + (_nx975 >> 1)), 348, (TOP | _lg346), null, irrcrpt("icog_hqpv", 2), 10, 0xFFFFFF);
_local5++;
};
}
final private function _sg937():void{
var _local1:int;
var _local2:int;
_local1 = 0;
while (_local1 < _ke938) {
_local2 = 1;
while (_local2 < _wp33) {
if (_hp931[_local1][_local2] >= _eh970){
var _local3 = _vu908[_local1];
var _local4 = _local2;
var _local5 = (_local3[_local4] + 1);
_local3[_local4] = _local5;
if (_local5 >= Res._mo567){
_vu908[_local1][_local2] = -((100 + _ks684(100)));
};
};
_local2++;
};
_local1++;
};
}
final private function _up231():int{
return (((mouseX - _gb576) / _st336));
}
final private function _lr733(_arg1:int, _arg2:int, _arg3:Boolean):Boolean{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:int;
var _local11:Number = _nu757[_arg1][_arg2];
_local6 = (_arg3) ? 0 : -1;
while (_local6 < 1) {
_local7 = (_arg3) ? 0 : -1;
while (_local7 < 1) {
_local10 = 0;
_local4 = 0;
while (_local4 < 2) {
_local5 = 0;
while (_local5 < 2) {
_local8 = ((_arg1 + _local6) + _local4);
_local9 = ((_arg2 + _local7) + _local5);
if (((((_pr501(_local8, _local9)) && ((_hp931[_local8][_local9] == _bt419)))) && ((_nu757[_local8][_local9] == _local11)))){
++_local10;
if (_local10 == 4){
return (true);
};
};
_local5++;
};
_local4++;
};
_local7++;
};
_local6++;
};
return (false);
}
final private function _cn456(_arg1:Boolean):void{
var _local2:int;
var _local3:int;
if (_we939.quality != irrcrpt("QTB", 5)){
_local3 = 0;
while (_local3 < _nm668) {
_local2 = _ww945[(_local3 << 2)];
if (((((_arg1) && ((_local2 >= 2)))) || (((!(_arg1)) && ((_local2 < 2)))))){
Gfx._ia682(_cy833, Res._tf514[(_local2 + (daytime) ? 4 : 11)], _ww945[((_local3 << 2) + 1)], _ww945[((_local3 << 2) + 2)], 0, 1, 1, (BOTTOM | LEFT), null, 1, (0.9 + (Math.sin(_yc18) * (((_local3 % 2) == 0)) ? 0.1 : -0.1)), _ww945[((_local3 << 2) + 3)]);
};
_local3++;
};
};
}
final private function _so794():void{
var _local1:int;
var _local2:int;
_vn766 = false;
_cm858 = 0;
_local1 = 0;
while (_local1 < _ke938) {
_hp931[_local1] = new Array(_wp33);
_et473[_local1] = new Array(_wp33);
_nu757[_local1] = new Array(_wp33);
_ck712[_local1] = new Array(_wp33);
_vu908[_local1] = new Array(_wp33);
_local2 = 0;
while (_local2 < _wp33) {
_et473[_local1][_local2] = 0;
_nu757[_local1][_local2] = 0;
_ck712[_local1][_local2] = _sl159;
_vu908[_local1][_local2] = 0;
_xl789(-1, _local1, _local2);
_local2++;
};
_local1++;
};
}
final private function _pc708(_arg1:int, _arg2:int):void{
switch (_arg1){
case _ev44:
hiscore_casual.setValue(_arg2);
break;
case _eh939:
hiscore_3_minutes.setValue(_arg2);
break;
case _ln948:
hiscore_100_moves.setValue(_arg2);
break;
};
}
final private function _wv749():Boolean{
var _local1:Boolean;
var _local2:int;
while (_local2 < _ke938) {
if (_hp931[_local2][_ec146] == _mk424){
_local1 = true;
_yg442(_local2, _ec146, SELECTED);
};
_local2++;
};
if (_local1){
_gp80();
};
return (_local1);
}
final private function _av106(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int):Boolean{
if (((!(_pr501(_arg4, _arg5))) || (!((_ck712[_arg4][_arg5] == _sl159))))){
return (false);
};
if (((!((_hp931[_arg4][_arg5] == _arg1))) && (!((_hp931[_arg4][_arg5] == _mb217))))){
return (false);
};
return (true);
}
final private function _kd446():void{
var _local1:int;
while (_local1 < _pa181) {
_nt122[_local1] = (_nt122[_local1] + _kx335[_local1]);
if ((_nt122[_local1] + _tp505[_np937[_local1]]) < 0){
_ww312(_local1);
};
_local1++;
};
}
final private function _aa693(_arg1:Boolean, _arg2:Boolean=false):void{
var _local3:int;
var _local4:int;
_ci916.graphics.clear();
if (((_arg1) && (_le723))){
Audio._dc461(Res._oa730);
};
_rl968 = 0;
_am677 = 0;
_cn629.setValue(0);
_ao468 = -1;
_le723 = false;
if (_arg2){
mouse_column = (mouse_row = -1);
prev_mouse_c = (prev_mouse_r = -1);
};
_local3 = 0;
while (_local3 < _ke938) {
_local4 = 0;
while (_local4 < _wp33) {
_ck712[_local3][_local4] = _sl159;
_local4++;
};
_local3++;
};
}
final private function _io848(_arg1:KeyboardEvent):void{
var _local2:int;
if (debug){
switch (_arg1.keyCode){
case Keyboard.UP:
_kj334.z--;
break;
case Keyboard.DOWN:
_kj334.z++;
break;
case Keyboard.NUMPAD_MULTIPLY:
_vk275 = !(_vk275);
break;
case Keyboard.END:
_js834(true);
break;
case Keyboard.ENTER:
_local2 = 0;
while (_local2 < _gu350) {
_vm930[_local2] = _cg188;
_local2++;
};
break;
case Keyboard.SPACE:
if (_vk275){
tick();
};
break;
case Keyboard.ESCAPE:
_wm274();
break;
case Keyboard.CONTROL:
if (debug){
if (!_br702){
addChild(_al956);
} else {
removeChild(_al956);
};
_br702 = !(_br702);
};
break;
case Keyboard.BACKSPACE:
_mf298 = _kw973;
Menu.reset();
_vv100();
addChild(new Stats());
if (Preloader._uy339){
MochiSocial.hideLoginWidget();
};
break;
case Keyboard.TAB:
_yl481 = ((_yl481 == 0)) ? 1 : 0;
break;
case Keyboard.NUMPAD_0:
Achievements.unlock(_ks684(Achievements._ss793));
break;
case Keyboard.NUMPAD_1:
_sh134++;
break;
};
} else {
switch (_arg1.keyCode){
case Keyboard.F3:
if (((!(debug)) && ((Preloader.host.length == 0)))){
debug = true;
_al956 = new Stats();
Audio._dc461(Res._jt851[2]);
};
break;
case Keyboard.SPACE:
if ((((_mf298 == _cj956)) && (!(paused)))){
one_click = !(one_click);
if (_xx788()){
_aa693(false, true);
Messages.add(Menu.getString(Menu._nx831), Res._jy892[_ot632()]);
};
};
break;
case Keyboard.ESCAPE:
if (_mf298 == _cj956){
_wm274();
};
break;
};
};
}
final private function _ug668(_arg1:int):void{
var _local2:int;
var _local3:String;
_local2 = 0;
while (_local2 < _gd842) {
switch (_local2){
case _wk400:
_local3 = Res._sc554.score;
break;
case _uo712:
_local3 = Res._sc554.summary_blobs;
break;
case _gj520:
_local3 = Res._sc554.summary_moves;
break;
case _xb933:
_local3 = Res._sc554.summary_chain;
break;
case _rw574:
_local3 = Res._sc554.summary_combo;
break;
case _ek939:
_local3 = Res._sc554.summary_bonus;
break;
case _of807:
_local3 = Res._sc554.summary_clearance;
break;
case _kv199:
_local3 = Res._sc554.summary_time;
break;
};
_ks307[_local2] = Gfx._yy947(_local3, -1, irrcrpt("keqi_jsrx", 4), 16, _arg1);
_local2++;
};
_local2 = 0;
while (_local2 < _xq738) {
switch (_local2){
case _wt653:
_local3 = Res._sc554.total_blobs;
break;
case _kl899:
_local3 = Res._sc554.total_games;
break;
case _qm960:
_local3 = Res._sc554.total_moves;
break;
case _qi30:
_local3 = Res._sc554.total_time;
break;
};
_qy562[_local2] = Gfx._yy947(_local3, -1, irrcrpt("hbnf_gpou", 1), 16, _arg1);
_local2++;
};
_nb514 = Bitmap(new Res._iq796()).bitmapData;
_kf211 = Gfx._yy947(Res._sc554.score, -1, irrcrpt("keqi_jsrx", 4), 24, 0xAEAEAE);
image_hiscore_label = Gfx._yy947(Res._sc554.hiscore, -1, irrcrpt("jdph_irqw", 3), 24, 0xAEAEAE);
Gfx._rm64(_nb514, _kf211, 6, 8);
Gfx._rm64(_nb514, image_hiscore_label, 6, 58);
}
final private function update(_arg1:Event):void{
if (!_vk275){
tick();
};
_yn844();
}
final private function _bb595():void{
var _local1:Array;
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:URLRequest;
var _local6:Loader;
var _local7:int;
_qu395 = (_qu395 + (_yd22 * _th711));
if ((((_qu395 <= -1)) || ((_qu395 >= 2)))){
if (_yd22 == _ul266){
cleanUp();
_ff115 = _mf298;
switch (_ff115){
case _mc625:
_we939 = stage;
stage.quality = StageQuality.HIGH;
stage.addEventListener(KeyboardEvent.KEY_UP, _io848);
stage.addEventListener(MouseEvent.MOUSE_DOWN, _dt893);
stage.addEventListener(MouseEvent.MOUSE_UP, _bu914);
stage.addEventListener(Event.DEACTIVATE, _jh777);
Res._vt334();
break;
};
switch (_kt685){
case _ym371:
switch (Preloader.version){
case Preloader._wy814:
Security.allowDomain(_fa807);
_local5 = new URLRequest(_fa807);
_local6 = new Loader();
_local6.contentLoaderInfo.addEventListener(Event.COMPLETE, _mo636);
_local6.load(_local5);
break;
};
_yq279(Res._cx770, true, true, 50, 50, (Preloader.version == Preloader._mb185));
break;
case _ew71:
Audio._eb405(Res._be106);
_jh775 = 0;
Menu._jd533(Res._sc554.click_to_start, Menu._oo73, _bx358, (_rd609 - 100), (TOP | _lg346));
Menu._bs79();
if (Preloader._uy339){
MochiSocial.showLoginWidget({x:8, y:(_rd609 - 40)});
};
_yq279(Res._tm777, true, true);
break;
case _yt719:
_ul160();
if (Preloader.version == Preloader._wy814){
};
break;
case _jq829:
_gu447 = 0;
_ba165();
break;
case _cj956:
_hx407();
break;
case _dq58:
_local1 = [Res._sc554.title_credits, "", Res._sc554.developed_by_megadev, "", Res._sc554.credits_code, Res._sc554.credits_mike, "", Res._sc554.credits_art, Res._sc554.credits_jon, "", Res._sc554.credits_audio, Res._sc554.credits_nick, "", Res._sc554.credits_qa, Res._sc554.credits_dan];
_local2 = 27;
_local3 = (_local1.length * _local2);
_local4 = (_ri788 - (_local3 >> 1));
_local7 = 0;
while (_local7 < _local1.length) {
Menu._jd533(_local1[_local7], ((_local1[_local7].toString() == "")) ? Menu._sf291 : Menu._pc437, _bx358, (_local4 + (_local7 * _local2)), (TOP | _lg346));
_local7++;
};
Menu._jd533(Res._sc554.exit, Menu._do401, (_al555 - 20), (_rd609 - 8), (BOTTOM | RIGHT));
Menu._jd533("", Menu._cl62, 8, (_rd609 - 8), (BOTTOM | LEFT));
break;
case _ps667:
_ug668(0xAEAEAE);
_hc43 = 0;
Menu._jd533("", Menu._bm126, _bx358, 50, (TOP | _lg346));
Menu._jd533(Res._sc554.exit, Menu._oo73, _bx358, (_rd609 - 50), (BOTTOM | _lg346));
break;
case _pj46:
_ik686 = 0;
_fq768(0);
break;
case _bx629:
switch (Preloader.version){
case Preloader._wy814:
_dv203(_ev44);
break;
default:
Menu.setup(Menu._lu215);
break;
};
break;
};
_mf298 = _kt685;
_yd22 = 0;
startTransition(_mf298, _qf788);
} else {
_yd22 = 0;
};
};
}
final private function _xl789(_arg1:int, _arg2:int, _arg3:int):void{
if (_arg1 == -1){
if (((((((!((bonus_type == _sv468))) && (!(_vn766)))) && ((_ks684(20) == 0)))) && ((_arg3 < 3)))){
_arg1 = _mk424;
_vn766 = true;
} else {
if (_ks684(100) < 3){
_arg1 = _mb217;
} else {
if ((((_sh134 > 1)) && ((_ks684(100) < (3 + _sh134))))){
_arg1 = (_eh970 + _ks684(_gf660));
} else {
_arg1 = _ks684(((_sh134 > 0)) ? _gf660 : (_gf660 - 1));
};
};
};
};
_hp931[_arg2][_arg3] = _arg1;
_vu908[_arg2][_arg3] = 0;
}
final private function _qx790(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int=0):void{
_arg1 = (_arg1 + Gfx._sn465(_arg5, _arg3));
_arg2 = (_arg2 + Gfx._kc87(_arg5, _arg4));
Gfx._rm64(_cy833, Res._br741, _arg1, _arg2);
Gfx._rm64(_cy833, Res._br741, (_arg1 + _arg3), _arg2, 0, 1, 1, (TOP | RIGHT), null, true);
Gfx._rm64(_cy833, Res._br741, _arg1, (_arg2 + _arg4), 0, 1, 1, (BOTTOM | LEFT), null, false, true);
Gfx._rm64(_cy833, Res._br741, (_arg1 + _arg3), (_arg2 + _arg4), 0, 1, 1, (BOTTOM | RIGHT), null, true, true);
}
final private function _jm113():void{
if (_wn543.value >= _la955(_tn768)){
_pc708(_tn768, _wn543.value);
};
global_stats[_wt653] = (global_stats[_wt653] + stats[_uo712]);
global_stats[_qi30] = (global_stats[_qi30] + stats[_kv199]);
global_stats[_qm960] = (global_stats[_qm960] + stats[_gj520]);
var _local1 = global_stats;
var _local2 = _kl899;
var _local3 = (_local1[_local2] + 1);
_local1[_local2] = _local3;
if (global_stats[_kl899] >= 100){
Achievements.unlock(Achievements._hu459);
};
if (global_stats[_wt653] >= 100000){
Achievements.unlock(Achievements._pa186);
};
if (Preloader.version == Preloader._uy796){
Preloader._oy156.scores.submit(_wn543.value, _ha812(_tn768));
Preloader._oy156.stats.submit(irrcrpt("Eorev", 3), stats[_uo712]);
Preloader._oy156.stats.submit(irrcrpt("Mpohftu dibjo", 1), stats[_xb933]);
Preloader._oy156.stats.submit(irrcrpt("Eljjhvw frper", 3), stats[_rw574]);
Preloader._oy156.stats.submit(irrcrpt("Gtfwi hqjfwfshj", 5), stats[_of807]);
Preloader._oy156.stats.submit(irrcrpt("Qtsljxy hmfns", 5), stats[_xb933]);
Preloader._oy156.stats.submit(irrcrpt("Usfbtvsf dpmmfdufe", 1), _ch444[_mk424]);
};
}
final private function _wm719():void{
_cy833.draw(_sw615, new Matrix(1, 0, 0, 1, 120, 350), null, null, null, false);
}
final private function _ba165():void{
var _local1:int = Res._bo205.width;
var _local2 = 20;
var _local3:BitmapData = Gfx._yy947((((((_wh740(irrcrpt("lsa_xs_tpec", 4)) + irrcrpt(" (", 5)) + (_gu447 + 1)) + "/") + _tb292) + ")"), -1, irrcrpt("jdph_irqw", 3), 22, 0x808080);
var _local4:String = (irrcrpt("vwvqtkcn_", 2) + _gu447);
var _local5:BitmapData = Gfx._yy947(Res._sc554[_local4], 235, irrcrpt("keqi_jsrx", 4), 12, 0x808080);
var _local6:int = ((((((_local2 + _local3.height) + _local2) + _local5.height) + _local2) + Res._nw470[_gu447][0].height) + _local2);
_dl953 = new BitmapData(_local1, Res._bo205.height, true, 0);
Gfx._rm64(_dl953, Res._bo205);
Gfx._rm64(_dl953, _local3, (_local1 >> 1), _local2, 0, 1, 1, (TOP | _lg346), null);
Gfx._rm64(_dl953, Gfx._tr895, (_local1 >> 1), (45 + 75), 0, 1, 1, (_qh836 | _lg346));
tutorial_image_index = 0;
tutorial_image_timer = 0;
tutorial_image_opacity = 0;
Menu.reset();
if (_gu447 > 0){
Menu._jd533("", Menu._nc687, (_bx358 >> 1), 445, (TOP | _lg346));
};
Menu._jd533(Res._sc554.exit, Menu._oo73, _bx358, 445, (TOP | _lg346));
if (_gu447 < (_tb292 - 1)){
Menu._jd533("", Menu._kv45, (_bx358 + (_bx358 >> 1)), 445, (TOP | _lg346));
};
}
final private function _wl516(_arg1:int, _arg2:int):void{
if (((((((((((_pr501(_arg1, _arg2)) && (!((_hp931[_arg1][_arg2] == _bt419))))) && ((((_cn629.value > 0)) || (_ju941(_arg1, _arg2)))))) && ((((((_hp931[_arg1][_arg2] == _ao468)) || ((_ao468 == -1)))) || ((_hp931[_arg1][_arg2] == _mb217)))))) && ((_ck712[_arg1][_arg2] == _sl159)))) && (!((_hp931[_arg1][_arg2] == -1))))){
if ((((_ao468 < 0)) && (!((_hp931[_arg1][_arg2] == _mb217))))){
_ao468 = _hp931[_arg1][_arg2];
};
if ((((_cn629.value < 1)) || (((Math.abs((mouse_column - _arg1)) + Math.abs((mouse_row - _arg2))) < 2)))){
if (!_le723){
_le723 = true;
_ci916.graphics.clear();
_ci916.graphics.moveTo(mouseX, mouseY);
_ci916.graphics.lineStyle(_fl169, 0xFFFFFF);
_ig612 = mouseX;
prev_mouseY = mouseY;
prev_mouse_c = mouse_column;
prev_mouse_r = mouse_row;
Audio._dc461(Res._do803[_ot632()]);
} else {
Audio._dc461(Res._do803[_ot632()]);
};
_ck712[_arg1][_arg2] = SELECTED;
mouse_column = _arg1;
mouse_row = _arg2;
_cn629.addValue(1);
_nl40();
};
} else {
_aa693(true);
};
}
final private function _hx407():void{
var _local1:int;
_ug668(0xFFFFFF);
Particles.init();
Messages.init();
_local1 = 0;
while (_local1 < _yd254) {
_aa792[_local1] = -1;
_local1++;
};
_local1 = 0;
while (_local1 < _ut528) {
_ei420[_local1] = 0;
_local1++;
};
_local1 = 0;
while (_local1 < _gu350) {
_vm930[_local1] = (_ch444[_local1] = 0);
_ch444[_local1] = 0;
_local1++;
};
_td668(-1);
_local1 = 0;
while (_local1 < _gd842) {
stats[_local1] = (_gx734[_local1] = 0);
_local1++;
};
_local1 = 0;
while (_local1 < _sh60) {
_nk517[_local1] = false;
_local1++;
};
_gl465 = 0;
_sh134 = 0;
show_level_up_text = false;
_wn543.setValue(0);
_im602 = 0;
hiscore_display = _la955(_tn768);
_bp434 = true;
paused = false;
_nj622 = false;
new_hiscore = false;
_ju401 = false;
_fp878 = false;
_dg324 = 0;
bonus_type = -1;
bonus_effect_timer = 0;
_bk102 = -1;
_kh673 = 0;
_ru12 = 0;
_vt754 = 0;
_cy500(-1);
_so794();
_aa693(false, true);
_bb408(_vq467, false);
_pj673.visible = false;
_pj673.rotationY = _cx475;
_vc800 = 0;
_ml355 = 0;
board_yo = 0;
board_vy = 0;
Audio._eb405(Res._be106);
_jh775 = 0;
_ij104(true);
_wq930(_ij645);
Audio._dc461(Res._vt564);
Audio._dc461(Res._dt328);
}
final private function _nh496(_arg1:Event=null):void{
this.removeEventListener(Event.ADDED_TO_STAGE, _nh496);
addEventListener(Event.ENTER_FRAME, update);
Preloader._ji476 = false;
Preloader._ku255 = "";
BoredServices.setRootContainer(stage);
BoredServices.showLoginUI();
}
final private function _qn558(_arg1:int, _arg2:int, _arg3:Boolean=true):void{
var _local5:int;
var _local6:int;
if (!_id273(_hp931[_arg1][_arg2])){
return;
};
_fl619 = false;
var _local4 = (_hp931[_arg1][_arg2] == _mb217);
var _local7:int;
var _local8 = -1;
_local5 = 0;
while (_local5 < (_local4) ? 7 : 1) {
if (((!(_local4)) || (((!((_local5 == _ol566))) || (_bu847))))){
_aa693(false, false);
_local6 = _tv783(_arg1, _arg2, (_local4) ? _local5 : _hp931[_arg1][_arg2]);
if (_local6 > _local7){
_local7 = _local6;
_local8 = _local5;
};
};
_local5++;
};
if (_local7 > 2){
if (_local4){
_aa693(false, false);
_tv783(_arg1, _arg2, _local8);
};
_le723 = true;
_ao468 = (_local4) ? _local8 : _hp931[_arg1][_arg2];
_cn629.setValue(_local7);
if (_arg3){
Audio._dc461(Res._do803[_ot632()]);
};
} else {
_aa693(false, false);
};
_nl40();
}
final private function _xl218():void{
_xc904 = _ld723();
mouse_column = ((mouseX - _md113) / _nx975);
mouse_row = ((mouseY - _jv249) / _uf199);
if (_xx788()){
if (one_click){
if (((!((mouse_column == prev_mouse_c))) || (!((mouse_row == prev_mouse_r))))){
if (_xc904 == _aw670){
_yx806(false);
prev_mouse_c = mouse_column;
prev_mouse_r = mouse_row;
} else {
_aa693(false, true);
};
};
} else {
if (((!((mouseX == _ig612))) || (!((mouseY == prev_mouseY))))){
if (((_le723) && (_fl619))){
_ci916.graphics.lineStyle(_fl169, 0xFFFFFF);
_ci916.graphics.moveTo(_ig612, prev_mouseY);
_ci916.graphics.lineTo(mouseX, mouseY);
if (((!((mouse_column == prev_mouse_c))) || (!((mouse_row == prev_mouse_r))))){
if (((((Math.abs((mouse_column - prev_mouse_c)) + Math.abs((mouse_row - prev_mouse_r))) > 1)) || (!((_xc904 == _aw670))))){
_aa693(true);
} else {
_wl516(mouse_column, mouse_row);
prev_mouse_c = mouse_column;
prev_mouse_r = mouse_row;
};
};
};
};
};
if (((!((mouseX == _ig612))) || (!((mouseY == prev_mouseY))))){
hint_timer = HINT_TIMER_MAX;
_ig612 = mouseX;
prev_mouseY = mouseY;
};
};
}
final private function _uk601():void{
_he121(irrcrpt("xfajIfyf()", 5));
try {
_fa839.data.exists = true;
_fa839.data.music_on = music_on;
_fa839.data.sfx_on = sfx_on;
_fa839.data.daytime = daytime;
_fa839.data.one_click = one_click;
_fa839.data.bloke_on = bloke_on;
_fa839.data.messages_on = messages_on;
_fa839.data.hiscore_casual = hiscore_casual.value;
_fa839.data.hiscore_3_minutes = hiscore_3_minutes.value;
_fa839.data.hiscore_100_moves = hiscore_100_moves.value;
_fa839.data.hi_stats = hi_stats;
_fa839.data.global_stats = global_stats;
_fa839.data.achievement_unlocked = Achievements.achievement_unlocked;
_fa839.flush();
} catch(e:Error) {
Security.showSettings(SecurityPanel.LOCAL_STORAGE);
};
}
final private function _gy710():void{
if (bloke_on){
_yh340();
};
_ho744 = (_ho744 + 0.1);
if (((((++_tf312 % 30) == 0)) && ((++clear_colour >= _gf660)))){
clear_colour = 0;
};
if (show_level_up_text >= 0){
_jw314--;
if (_jw314 > 0){
_jw314 = (_jw314 * 0.9);
} else {
_jw314 = (_jw314 + (_jw314 / 2));
};
if (_jw314 < -(_al555)){
show_level_up_text = false;
};
};
if ((((hint_timer <= 0)) || (((((!(paused)) && (!(_nj622)))) && (!(_bp434)))))){
hint_angle = (hint_angle + 0.2);
if (--hint_timer < -80){
hint_timer = HINT_TIMER_MAX;
};
};
Particles.tick();
_dc877();
_dj755();
Messages.tick();
if (_bp434){
_to459();
} else {
if (bonus_effect_timer > 0){
_li568();
} else {
if (_dg324 > 0){
if (--_dg324 <= 0){
_kx37();
};
} else {
if (_fp878){
_ss257();
};
};
};
if (!_nj622){
_hj830();
};
};
if ((ticks % 3) == 0){
_sg937();
};
_ei384();
}
final private function _uh56():void{
if (show_level_up_text){
Gfx._rm64(_cy833, Res._ht448, (_bx358 - _jw314), _ri788, 0, 1, 1, (_qh836 | _lg346));
};
Gfx._rm64(_cy833, _nb514, 0, 7);
Gfx._rm64(_cy833, image_score_value, 210, 41, 0, 1, 1, (TOP | RIGHT));
Gfx._rm64(_cy833, image_hiscore_value, 210, 93, 0, 1, 1, (TOP | RIGHT));
if (_tn768 != _ev44){
Gfx._rm64(_cy833, Res._is161, 0, 137);
Gfx._rm64(_cy833, image_stat_label, 6, 144);
if ((((((((_tn768 == _eh939)) && (((_aw782 - stats[_kv199]) > 10000)))) || ((((_tn768 == _ln948)) && (((_gg662 - stats[_gj520]) > 4)))))) || (((ticks % 10) < 5)))){
Gfx._rm64(_cy833, image_stat_value, 210, 162, 0, 1, 1, (TOP | RIGHT));
};
};
if (((!(paused)) && (!(_nj622)))){
Gfx._rm64(_cy833, Res._mm419, _aj35, _lv443);
if (((((((_le723) && ((_xc904 == _aw670)))) && ((_cn629.value > 1)))) && ((_ck712[mouse_column][mouse_row] == SELECTED)))){
Gfx._rm64(_cy833, image_chain_length, mouseX, mouseY, 0, 1, 1, (BOTTOM | LEFT));
};
};
if ((((((((hint_timer <= 0)) && (!(paused)))) && (!(_nj622)))) && (!(_bp434)))){
Gfx._rm64(_cy833, Res._gn652, (_ll600 - (Math.cos(hint_angle) * 8)), (hint_y - (Math.cos(hint_angle) * 8)), 0, 1, 1, (BOTTOM | RIGHT));
};
}
final private function _kx37():void{
var _local2:int;
var _local3:int;
var _local1:int;
_local2 = 0;
while (_local2 < _ke938) {
_local3 = 0;
while (_local3 < _wp33) {
if ((((_hp931[_local2][_local3] == _bt419)) && ((_ck712[_local2][_local3] == SELECTED)))){
_local1++;
_yd465(_local2, _local3, true, false);
};
_local3++;
};
_local2++;
};
if (_local1 > 0){
_gp80();
} else {
_iu445();
};
}
public function _mk971(_arg1:String):void{
}
public function _tp260(_arg1:Object):void{
switch (_arg1.id){
case _uv72:
_jw579 = true;
break;
};
}
final private function _xx788():Boolean{
if (((((((((((!(_bp434)) && (!(paused)))) && (!(_nj622)))) && (!(_fp878)))) && ((_dg324 <= 0)))) && ((bonus_effect_timer <= 0)))){
return (true);
};
return (false);
}
final private function _oc975(_arg1:Object):void{
MochiSocial.removeEventListener(MochiSocial.ACTION_COMPLETE, _di344);
MochiSocial.removeEventListener(MochiSocial.ACTION_CANCELED, _oc975);
}
final private function _af612(_arg1:Object):void{
if (_arg1.success){
if (_arg1.loggedIn){
trace(_arg1.username);
} else {
trace(irrcrpt("Sodbhu orjjhg rxw", 3));
};
} else {
trace(_arg1.error);
};
}
final private function tick():void{
var _local1:int;
ticks++;
Audio.tick();
_dp727();
switch (_mf298){
case _ym371:
if (((!((_sw615 == null))) && ((_sw615.currentFrame >= _sw615.totalFrames)))){
_vv100();
startTransition(_ew71);
};
break;
case _kw973:
if ((ticks % 20) == 0){
};
break;
case _ew71:
if (((!((_sw615 == null))) && ((_sw615.currentFrame >= _sw615.totalFrames)))){
_sw615.stop();
};
break;
case _yt719:
Messages.tick();
break;
case _cj956:
if (!paused){
_xl218();
_gy710();
if (_fq753 > 0){
_fq753 = (_fq753 - 0.05);
};
} else {
if (_fq753 < 0.8){
_fq753 = (_fq753 + 0.05);
};
};
break;
case _gn62:
_gy710();
_vx743();
if (messages_on){
Messages.tick();
};
break;
case _ps667:
if (_hc43 < 1){
_hc43 = (_hc43 + 0.1);
};
break;
};
_ee164 = getTimer();
if (Menu._di566){
Menu.tick();
};
if (_yd22 != 0){
_bb595();
};
}
final private function _nl40():void{
image_chain_length = Gfx._yy947(_cn629.value.toString(), -1, irrcrpt("keqi_jsrx", 4), 16, 0xFFFFFF, true);
}
final private function drawBackground():void{
var _local1:int;
Gfx._rm64(_cy833, Res._tf514[(daytime) ? 0 : 7], 0, 0, 0, 1, 1, -1, null, false, false, _al555, 349);
if (_we939.quality != irrcrpt("MPX", 1)){
_local1 = 0;
while (_local1 < _pa181) {
if (_nt122[_local1] < _al555){
Gfx._rm64(_cy833, Res._mx164[(_np937[_local1] + (daytime) ? 0 : 5)], _nt122[_local1], _ve642[_local1]);
};
_local1++;
};
};
if (_we939.quality == irrcrpt("ORZ", 3)){
Gfx._rm64(_cy833, Res._tf514[(daytime) ? 1 : 8], -16, 349, 0, 1, 1, -1, null, false, false, 672, 131);
} else {
_local1 = 0;
while (_local1 < _fy767) {
_ei266.y = (_local1 * _og324);
_hy797.x = (-16 + (Math.sin((_yc18 + (_local1 * 0.8))) * _local1));
_hy797.y = (349 + (_local1 * _og324));
_cy833.copyPixels(Res._tf514[(daytime) ? 1 : 8], _ei266, _hy797);
_local1++;
};
};
Gfx._rm64(_cy833, Res._tf514[(daytime) ? 2 : 9], 0, _rd609, 0, 1, 1, (BOTTOM | LEFT), null, false, false, _al555, 96);
Gfx._rm64(_cy833, Res._tf514[(daytime) ? 3 : 10], 0, (_rd609 - 114), _kf147, 1, 6, -1, null, false, false, _al555, 60);
_cn456(false);
if ((((_mf298 == _cj956)) && ((_rc449 > 0)))){
if (_we939.quality != irrcrpt("MPX", 1)){
Gfx._eo234(_cy833, _rc449);
};
_rc449 = (_rc449 - 0.1);
};
}
final private function _dq375(_arg1:int, _arg2:int, _arg3:int, _arg4:int):Boolean{
if ((((((((mouseX > _arg1)) && ((mouseX < (_arg1 + _arg3))))) && ((mouseY > _arg2)))) && ((mouseY < (_arg2 + _arg4))))){
return (true);
};
return (false);
}
final private function submitScore():void{
var _local1:Boolean;
if (Preloader._jp365){
MochiScores.showLeaderboard({boardID:_he741[_tn768], score:_wn543.value, onClose:_tx969, onError:_tx969});
} else {
switch (Preloader.version){
case Preloader._wy814:
_aw558.initAGUI({iconGraphic:Res._ft87, onClose:_tx969, onError:_tx969});
_aw558.showScoreboardSubmit(_wn543.value, "", _ha812(_tn768));
break;
case Preloader._mx778:
MindJoltAPI.service.submitScore(_wn543.value, _ha812(_tn768), _ul160);
break;
case Preloader._la384:
break;
case Preloader._lx61:
BoredServices.submitScore(_wn543.value, true, _ha812(_tn768), true);
Menu.reset();
Menu._jd533(Res._sc554.retry, Menu._lb454, _bx358, (_rd609 - 69), (_lg346 | TOP));
Menu._jd533(Res._sc554.quit, Menu._my463, _bx358, (_rd609 - 34), (_lg346 | TOP));
break;
};
};
if (_local1){
Menu._jd533("", Menu._nt905, _bx358, (_rd609 - 16), (BOTTOM | _lg346));
};
}
final private function _lf261(_arg1:int, _arg2:Boolean=false):int{
return (((_md113 + (_arg1 * _nx975)) + (_arg2) ? (_nx975 >> 1) : 0));
}
final private function _ww312(_arg1:int, _arg2:Boolean=false):void{
var _local3:int;
while (_local3 < _pa181) {
if ((((_arg1 == -1)) || ((_local3 == _arg1)))){
_nt122[_local3] = ((_arg2) ? 0 : _al555 + _ks684(_al555));
_ve642[_local3] = (_local3 * (140 / _pa181));
_kx335[_local3] = -((((_local3 + 1) << 1) * 0.125));
_np937[_local3] = _local3;
};
_local3++;
};
}
final private function _js834(_arg1:Boolean):void{
if (!_nj622){
_nj622 = true;
_dn86 = 0;
_ai891 = -(_rd609);
_ti534 = 1;
if (!_arg1){
Messages.add(((_tn768 == _eh939)) ? Res._sc554.out_of_time : Res._sc554.out_of_moves);
};
_aa693(false);
_wq930(_yi24);
_bb408(_vq467, false);
Gfx._vq222(_vq467);
stats[_wk400] = _wn543.value;
_tx969();
_jm113();
_uk601();
};
}
final private function _dt893(_arg1:MouseEvent):void{
_fl619 = true;
if (_yd22 == 0){
if (!Menu._di566){
switch (_mf298){
case _cj956:
if (_xx788()){
switch (_xc904){
case _aw670:
if (((!((mouse_column == -1))) && (!((mouse_row == -1))))){
if ((((_ck712[mouse_column][mouse_row] == SELECTED)) && ((((_cn629.value >= 3)) || ((_ao468 == _bt419)))))){
_am677 = 0;
_gp80();
_lf753(mouse_column, mouse_row);
} else {
if (!one_click){
_aa693(true, false);
switch (_hp931[mouse_column][mouse_row]){
case _bt419:
_yd465(mouse_column, mouse_row, true, true);
break;
default:
_wl516(mouse_column, mouse_row);
break;
};
};
};
};
break;
};
};
break;
};
};
};
}
final private function _mu544(_arg1:int, _arg2:int):void{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Boolean;
if (_hp931[_arg1][_arg2] != -1){
_local3 = _hp931[_arg1][_arg2];
_local4 = _lf261(_arg1, true);
_local5 = _sa454(_arg2, true);
_local6 = true;
switch (_local3){
case _bt419:
if (bonus_type == -1){
if (++_rl968 == 3){
_wq930(_ea162);
};
};
_rc449 = 0.7;
Audio._nj45(Res._wd459[_ks684(3)]);
_mo869(_pm244, _local4, _local5);
break;
case _ol566:
Audio._nj45(Res._lh846);
Particles.add(_local4, _local5, _ol566);
Particles.add(_local4, _local5, Particles._gy123, 1);
break;
case _or632:
Audio._nj45(Res._nw83);
Particles.add(_local4, _local5, Particles._be783, 1);
_hp931[_arg1][_arg2] = _ol566;
_local6 = false;
break;
case _mk424:
_vn766 = false;
Particles.add(_local4, _local5, _mk424);
if (_arg2 == _ec146){
_mj452(((_cm858 + 1) * 1000), _local4, _local5);
if (++_cm858 >= 10){
Achievements.unlock(Achievements._es850);
};
Messages.add(Res._sc554.treasure_get);
Audio._dc461(Res._tc749[_ot632()]);
} else {
Messages.add(Res._sc554.treasure_kill);
};
break;
case _eh970:
case _mv836:
case _re320:
case _ul785:
case _wp652:
_hp931[_arg1][_arg2] = (_yo373 + (_local3 - _eh970));
_local6 = false;
_mo869(_pc880, _local4, _local5);
Audio._nj45(Res._pn645);
break;
default:
Particles.add(_local4, _local5, _local3);
break;
};
if (_local6){
if (_vm930[_local3] < _cg188){
var _local7 = _vm930;
var _local8 = _local3;
var _local9 = (_local7[_local8] + 1);
_local7[_local8] = _local9;
if (_local9 == _cg188){
Audio._dc461(Res._ai98[_ot632()]);
};
_td668(_local3);
};
_local7 = _ch444;
_local8 = _local3;
_local9 = (_local7[_local8] + 1);
_local7[_local8] = _local9;
_am677++;
_hp931[_arg1][_arg2] = -1;
} else {
_ck712[_arg1][_arg2] = _sl159;
};
_om384 = _local4;
last_blob_cleared_y = _local5;
};
}
final private function _dj755():void{
var _local1:int;
while (_local1 < _ut528) {
if (_ei420[_local1] > 0){
var _local2 = _xk480;
var _local3 = _local1;
var _local4 = (_local2[_local3] - 1);
_local2[_local3] = _local4;
if (_local4 < 0){
_ei420[_local1] = (_ei420[_local1] - 0.02);
};
_local2 = _up935;
_local3 = _local1;
_local4 = (_local2[_local3] - 1);
_local2[_local3] = _local4;
};
_local1++;
};
}
final private function _ov571():void{
if (_sw615 != null){
_sw615.stop();
_sw615 = null;
};
}
final private function _bu914(_arg1:MouseEvent):void{
if (_yd22 == 0){
if (((Menu._di566) && ((Menu._dr642 >= 0)))){
_yp366(Menu._le703[Menu._dr642]);
} else {
switch (_mf298){
case _ym371:
_vv100();
startTransition(_ew71);
break;
case _ew71:
_yp366(Menu._oo73);
break;
case _cj956:
if (_xx788()){
switch (_xc904){
case _aw670:
if (((_fl619) && (_le723))){
if (_cn629.value <= 1){
_yx806(false);
} else {
if (_cn629.value == 2){
_aa693(true, false);
} else {
if (_cn629.value >= 3){
_am677 = 0;
_gp80();
_lf753(mouse_column, mouse_row);
};
};
};
};
break;
case _lo84:
_aa693(false, true);
if (((!((_bk102 == -1))) && ((_vm930[_bk102] >= _cg188)))){
_vb449(_bk102);
};
break;
case _gf457:
pause();
break;
default:
_aa693(true, true);
break;
};
};
break;
};
};
};
_fl619 = false;
}
final private function pause():void{
if (((((((!(paused)) && ((_mf298 == _cj956)))) && ((_yd22 == 0)))) && (!(_pj673.visible)))){
_aa693(false);
paused = true;
Menu.setup(Menu._kh631);
Audio._dc461(Res._jy892[_ot632()]);
if (bloke_on){
_sw615.stop();
};
};
}
public function _id587(_arg1:Object):void{
MochiSocial.getFriendsList();
switch (_mf298){
case _cj956:
if (_nj622){
_tx969();
};
break;
case _ew71:
break;
};
}
final private function _vx743():void{
var _local1:int;
_ai891 = (_ai891 + (_ti534 = (_ti534 + 0.5)));
if (_ai891 >= 0){
_ai891 = 0;
_ti534 = (-(_ti534) / 2);
};
if (board_yo < (_rd609 * 2)){
_ml355 = (_ml355 + 0.008);
board_yo = (board_yo + (board_vy = (board_vy + 0.5)));
} else {
switch (Preloader.version){
case Preloader._mx778:
case Preloader._la384:
if (++_dn86 == 120){
_ov571();
_mf298 = _mc654;
Audio._wr699();
submitScore();
};
break;
default:
if (_hc43 < 1){
_hc43 = (_hc43 + 0.1);
} else {
if (_ta935 > 0){
_ta935 = Math.max(0, (_ta935 = (_ta935 - (1 + (_ta935 * 0.2)))));
};
_local1 = 0;
while (_local1 < _gd842) {
if ((((_gx734[_local1] < stats[_local1])) && ((((_local1 == 0)) || ((_gx734[(_local1 - 1)] >= stats[(_local1 - 1)])))))){
_gx734[_local1] = Math.min((_gx734[_local1] = (_gx734[_local1] + _pp568[_local1])), stats[_local1]);
if (_gx734[_local1] == stats[_local1]){
Audio._dc461(Res._fl164[_ot632()]);
} else {
if ((ticks % 3) == 0){
Audio._dc461(Res._ea27[_ot632()]);
};
};
};
_local1++;
};
};
break;
};
};
}
final private function _la955(_arg1:int):int{
switch (_arg1){
case _ev44:
return (hiscore_casual.value);
case _eh939:
return (hiscore_3_minutes.value);
case _ln948:
return (hiscore_100_moves.value);
};
return (-1);
}
final private function _li568():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:Array;
bonus_effect_timer--;
switch (bonus_type){
case _yi424:
if (_pj673.rotationX > -180){
_pj673.rotationX = (_pj673.rotationX - _mf769);
if (!_bt921){
if (_pj673.rotationX <= -90){
_bt921 = true;
_local4 = new Array(_ke938);
_local3 = 0;
while (_local3 < 2) {
_local1 = 0;
while (_local1 < _ke938) {
if (_local3 == 0){
_local4[_local1] = new Array(_wp33);
_local2 = 1;
while (_local2 < _wp33) {
_local4[_local1][_local2] = _hp931[_local1][(_wp33 - _local2)];
_local2++;
};
} else {
_local2 = 1;
while (_local2 < _wp33) {
_hp931[_local1][_local2] = _local4[_local1][_local2];
_vu908[_local1][_local2] = 0;
_local2++;
};
};
_local1++;
};
_local3++;
};
_bb408(_vq467, false);
_pj673.rotationX = 90;
};
} else {
if (_pj673.rotationX <= 0){
_pj673.rotationX = 0;
_pj673.visible = false;
_vc800 = 1;
bonus_effect_timer = 0;
_wv749();
};
};
};
break;
case _sv468:
_xf759();
break;
};
if (bonus_effect_timer <= 0){
bonus_type = -1;
_ij104(false);
};
}
final private function _mj452(_arg1:int, _arg2:int, _arg3:int):void{
var _local4:int;
if (_arg1 > 10){
_cm811(_arg1);
_dl737(_ek939, false, _arg1);
if (messages_on){
_up935[_kh673] = _arg3;
_ei420[_kh673] = 1;
_xk480[_kh673] = 30;
_iy954[_kh673] = Gfx._yy947(Utils._km167(_arg1), -1, irrcrpt("lfrj_ktsy", 5), 20, 0xFFFFFF, true);
_local4 = _iy954[_kh673].width;
_ys443[_kh673] = (_arg2 - (_local4 >> 1));
if (++_kh673 >= _ut528){
_kh673 = 0;
};
};
};
}
final private function _vv100():void{
var _ce594:SoundTransform;
if (_sw615 != null){
_ce594 = _sw615.soundTransform;
_ce594.volume = 0;
_sw615.soundTransform = _ce594;
_sw615.stop();
try {
removeChild(_sw615);
} catch(e:Error) {
};
_sw615 = null;
};
}
final private function _wq930(_arg1:int):void{
_ty347 = _arg1;
if (bloke_on){
if (_sw615 != null){
_sw615.stop();
};
switch (_arg1){
case _ij645:
_sw615 = new Res._ei484();
break;
case _bs286:
_sw615 = new Res._ga179();
break;
case _em163:
_sw615 = new Res._vr74();
break;
case _qk621:
_sw615 = new Res._fe305();
break;
case _se546:
_sw615 = new Res._hk398();
Audio._dc461(Res._id150);
break;
case _ib837:
_sw615 = new Res._qp653();
break;
case _ea162:
_sw615 = new Res._cf770();
break;
case _yi24:
_sw615 = new Res._tr643();
break;
};
_sw615.play();
if (!sfx_on){
_sw615.soundTransform = new SoundTransform(0);
};
};
}
final private function _yd465(_arg1:int, _arg2:int, _arg3:Boolean, _arg4:Boolean=false):void{
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
_local7 = -2;
while (_local7 <= 2) {
_local8 = -2;
while (_local8 <= 2) {
if ((Math.abs(_local7) + Math.abs(_local8)) < 3){
_yg442((_arg1 + _local7), (_arg2 + _local8), (_arg3) ? _il912 : SELECTED);
};
_local8++;
};
_local7++;
};
_ck712[_arg1][_arg2] = SELECTED;
_ao468 = _bt419;
if (_arg4){
Audio._dc461(Res._do803[_ot632()]);
};
}
final private function _ks684(_arg1:int):int{
return (((_arg1 == 0)) ? 0 : Math.floor((Math.random() * _arg1)));
}
final private function _jh777(_arg1:Event):void{
pause();
}
final private function _di344(_arg1:Object):void{
_oc975(_arg1);
}
final private function _om90():void{
var _local1:int;
var _local2:int;
var _local3:int;
var _local4:int = (_xf657 + board_yo);
_local3 = 0;
while (_local3 < 2) {
_local2 = 0;
while (_local2 < _gu350) {
_local1 = ((_gb576 + (_local2 * _st336)) + (_st336 >> 1));
if (_local3 == 0){
if ((((_local2 == _au803)) && ((_vm930[_local2] >= _cg188)))){
Gfx._rm64(_cy833, Res._xe216[clear_colour], _local1, _local4, ((Res._wx777 / _cg188) * _vm930[_local2]), Res._wx777, 1, (TOP | _lg346));
} else {
Gfx._rm64(_cy833, Res._xe216[_local2], _local1, _local4, ((Res._wx777 / _cg188) * _vm930[_local2]), Res._wx777, 1, (TOP | _lg346));
};
} else {
if (_vm930[_local2] >= _cg188){
Gfx._rm64(_cy833, Res._me502, _local1, (_local4 - 20), 0, 1, 1, (TOP | _lg346), new ColorTransform(1, 1, 1, (0.5 + (Math.sin(_ho744) * 0.5))));
};
Gfx._rm64(_cy833, _nx725[_local2], _local1, _local4, 0, 1, 1, (_qh836 | _lg346));
};
_local2++;
};
_local3++;
};
if ((((((_xc904 == _lo84)) && (!(_nj622)))) && (!(paused)))){
if (bonus_desc_scale < 1){
bonus_desc_scale = Math.min(1, (bonus_desc_scale = (bonus_desc_scale + 0.1)));
};
Gfx._ia682(_cy833, _tp187, _og323, (_local4 - 5), 0, 1, 1, (BOTTOM | _lg346), null, 1, bonus_desc_scale);
};
}
final private function _vb449(_arg1:int):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:Boolean;
bonus_type = _arg1;
switch (_arg1){
case _yi424:
_local6 = true;
_bt921 = false;
bonus_effect_timer = 1000;
_pj673.visible = true;
_bb408(_vq467, false);
Audio._dc461(Res._dt328);
break;
case _jk280:
_local6 = true;
_local4 = 0;
while (_local4 < 2) {
_local5 = 0;
_local2 = 0;
while (_local2 < _ke938) {
_local3 = (_wp33 - 3);
while (_local3 < _wp33) {
if ((((((_local4 == 0)) && ((((_hp931[_local2][_local3] == _or632)) || ((_hp931[_local2][_local3] >= ((_eh970) && ((_hp931[_local2][_local3] <= _wp652))))))))) || ((_local4 == 1)))){
_ck712[_local2][_local3] = ((_hp931[_local2][_local3] == _bt419)) ? _il912 : SELECTED;
_local5++;
};
_local3++;
};
_local2++;
};
if (_local5 > 0){
_gp80();
};
_local4++;
};
break;
case _lv43:
_local4 = 0;
while (_local4 < 2) {
_local5 = 0;
_local2 = 0;
while (_local2 < _ke938) {
_local3 = 1;
while (_local3 < _wp33) {
if ((((((_local4 == 0)) && ((_hp931[_local2][_local3] == _or632)))) || ((((_local4 == 1)) && ((_hp931[_local2][_local3] == _ol566)))))){
_ck712[_local2][_local3] = SELECTED;
_local5++;
};
_local3++;
};
_local2++;
};
if (_local5 > 0){
_local6 = true;
_gp80();
};
_local4++;
};
break;
case _sv468:
_local6 = true;
_vn766 = false;
bonus_effect_timer = 30;
Audio._dc461(Res._yf337);
break;
case _na672:
_local2 = 0;
while (_local2 < _ke938) {
_local3 = 1;
while (_local3 < _wp33) {
if (_hp931[_local2][_local3] == _bt419){
_yd465(_local2, _local3, false, false);
_local5++;
};
_local3++;
};
_local2++;
};
if (_local5 > 0){
_local6 = true;
_gp80();
};
break;
case _au803:
_local2 = 0;
while (_local2 < _ke938) {
_local3 = 1;
while (_local3 < _wp33) {
if (_hp931[_local2][_local3] == clear_colour){
_ck712[_local2][_local3] = SELECTED;
_local5++;
};
_local3++;
};
_local2++;
};
if (_local5 > 0){
_local6 = true;
_gp80();
};
break;
case _kd573:
_local2 = 0;
while (_local2 < _ke938) {
_local3 = 1;
while (_local3 < _wp33) {
switch (_hp931[_local2][_local3]){
case _ol566:
case _or632:
_hp931[_local2][_local3] = _bt419;
_local6 = true;
break;
};
_local3++;
};
_local2++;
};
break;
case _sa550:
_local2 = 0;
while (_local2 < _ke938) {
_local3 = 1;
while (_local3 < _wp33) {
if ((((_hp931[_local2][_local3] >= _eh970)) && ((_hp931[_local2][_local3] <= _wp652)))){
_ck712[_local2][_local3] = SELECTED;
_local5++;
};
_local3++;
};
_local2++;
};
if (_local5 > 0){
bonus_effect_timer = 30;
_local6 = true;
_gp80();
};
break;
};
if (_local6){
_vm930[_arg1] = 0;
_td668(_arg1);
Audio._dc461(Res._gt537[_ot632()]);
_wq930(_se546);
} else {
Audio._dc461(Res._oa730);
_wq930(_qk621);
};
}
final private function _id273(_arg1:int):Boolean{
switch (_arg1){
case _ol566:
return (_bu847);
case -1:
case _or632:
case _bt419:
case _eh970:
case _mv836:
case _re320:
case _ul785:
case _wp652:
return (false);
};
return (true);
}
final private function _gp80():void{
var _local1:int;
var _local2:int;
var _local3:int;
_fl619 = false;
_le723 = false;
hint_timer = HINT_TIMER_MAX;
_ci916.graphics.clear();
_dg324 = _hb879;
var _local4:Boolean;
_local1 = 0;
while (_local1 < 2) {
_local2 = 0;
while (_local2 < _ke938) {
_local3 = 0;
while (_local3 < _wp33) {
if (_ck712[_local2][_local3] != _sl159){
if ((((_local1 == 0)) && (!((_hp931[_local2][_local3] == _bt419))))){
if (!_local4){
switch (_hp931[_local2][_local3]){
case _yo373:
case _nk221:
case _rm364:
case _dm315:
case _fl687:
case _mb217:
case _ol566:
_local4 = true;
break;
};
};
_mu544(_local2, _local3);
} else {
if ((((_local1 == 1)) && ((_hp931[_local2][_local3] == _bt419)))){
switch (_ck712[_local2][_local3]){
case _il912:
_dg324 = _ci543;
_ck712[_local2][_local3] = SELECTED;
break;
case SELECTED:
_mu544(_local2, _local3);
break;
};
};
};
};
_local3++;
};
_local2++;
};
_local1++;
};
_dl737(_xb933, false, _cn629.value);
if (_cn629.value > 4){
if (_cn629.value >= 30){
Achievements.unlock(Achievements._lc707);
};
if (_cn629.value >= 20){
Achievements.unlock(Achievements._yc227);
};
if (_cn629.value >= 10){
Achievements.unlock(Achievements._lk535);
};
};
if (_local4){
switch (_cn629.value){
case 3:
Audio._dc461(Res._sh789[0]);
break;
case 4:
Audio._dc461(Res._sh789[1]);
break;
default:
Audio._dc461(Res._sh789[2]);
break;
};
};
}
public function _rh793(_arg1:String):void{
}
final private function _xf759():void{
var _local1:int;
var _local2:int;
_local1 = 0;
while (_local1 < _ke938) {
_local2 = 0;
while (_local2 < _wp33) {
_xl789(-1, _local1, _local2);
_local2++;
};
_local1++;
};
}
final private function _cm811(_arg1:int):void{
if (!debug){
_wn543.addValue(_arg1);
if (((!(new_hiscore)) && ((_wn543.value > _la955(_tn768))))){
new_hiscore = true;
Messages.add(Res._sc554.new_high_score);
};
if (_wn543.value >= 500000){
Achievements.unlock(Achievements._oc384);
} else {
if (_wn543.value >= 250000){
Achievements.unlock(Achievements._dd753);
} else {
if (_wn543.value >= 100000){
Achievements.unlock(Achievements._um815);
};
};
};
};
}
final private function _tv783(_arg1:int, _arg2:int, _arg3:int):int{
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:Boolean;
var _local9 = 1;
_ck712[_arg1][_arg2] = SELECTED;
while (_local8) {
_local8 = false;
_local4 = 0;
while (_local4 < _ke938) {
_local5 = 1;
while (_local5 < _wp33) {
if (_ck712[_local4][_local5] != _sl159){
_local6 = -1;
while (_local6 < 2) {
_local7 = -1;
while (_local7 < 2) {
if ((Math.abs(_local6) + Math.abs(_local7)) < 2){
if (_av106(_arg3, _local4, _local5, (_local4 + _local6), (_local5 + _local7))){
_ck712[(_local4 + _local6)][(_local5 + _local7)] = SELECTED;
_local8 = true;
_local9++;
};
};
_local7++;
};
_local6++;
};
};
_local5++;
};
_local4++;
};
};
return (_local9);
}
final private function _fa374():void{
if (Preloader._jp365){
MochiScores.closeLeaderboard();
};
startTransition(_yt719);
}
final private function _uy821():void{
var _local1:int;
while (_local1 < _ut528) {
if (_ei420[_local1] > 0){
Gfx._rm64(_cy833, _iy954[_local1], _ys443[_local1], _up935[_local1], 0, 1, 1, -1, new ColorTransform(1, 1, 1, _ei420[_local1]));
};
_local1++;
};
}
final private function _tx969():void{
var _local1:Boolean;
if (Preloader._jp365){
MochiScores.closeLeaderboard();
};
_mf298 = _gn62;
_hc43 = 0;
_ta935 = _al555;
switch (Preloader.version){
case Preloader._mx778:
case Preloader._la384:
break;
default:
Menu.reset();
_local1 = Preloader._jp365;
if (!Preloader._jp365){
switch (Preloader.version){
case Preloader._lx61:
_local1 = true;
break;
case Preloader._wy814:
_local1 = true;
break;
};
};
if (_local1){
Menu._jd533(Res._sc554.submit_score, Menu._hr685, _bx358, (_rd609 - 104), (_lg346 | TOP));
};
Menu._jd533(Res._sc554.retry, Menu._lb454, _bx358, (_rd609 - 69), (_lg346 | TOP));
Menu._jd533(Res._sc554.quit, Menu._my463, _bx358, (_rd609 - 34), (_lg346 | TOP));
break;
};
}
final private function _yp366(_arg1:int):void{
var _option = _arg1;
if (_option != -1){
if (_option != Menu._vi606){
Audio._dc461(Res._jy892[_ot632()]);
};
switch (_option){
case Menu._nt905:
_tx969();
break;
case Menu._qu850:
startTransition(_ps667);
break;
case Menu._dk268:
MochiCoins.showStore();
break;
case Menu._wy312:
Menu.setup(Menu._eu774);
break;
case Menu._oo122:
_tn768 = _ev44;
startTransition(_cj956);
break;
case Menu._be634:
_tn768 = _eh939;
startTransition(_cj956);
break;
case Menu._oa34:
_tn768 = _ln948;
startTransition(_cj956);
break;
case Menu._tk966:
startTransition(_jq829);
break;
case Menu._vq267:
startTransition(_bx629);
break;
case Menu._hr685:
_wq930(_ij645);
_mf298 = _mc654;
Menu.reset();
submitScore();
break;
case Menu._oo73:
if (_mf298 == _ew71){
_vv100();
startTransition(_yt719);
} else {
if (_mf298 != _yt719){
startTransition(_yt719);
} else {
Menu.setup(Menu._ft764);
};
};
break;
case Menu._bc874:
if (_mf298 == _cj956){
Menu.setup(Menu._kh631);
} else {
Menu.setup(Menu._ft764);
};
_uk601();
break;
case Menu._do401:
startTransition(_yt719);
break;
case Menu._tp732:
startTransition(_dq58);
break;
case Menu._xj838:
_wm274();
break;
case Menu._se226:
Menu.setup(Menu._nr548);
break;
case Menu._lb454:
if (_mf298 == _cj956){
Menu.setup(Menu._iq103);
} else {
if (Preloader._jp365){
MochiScores.closeLeaderboard();
};
startTransition(_cj956);
};
break;
case Menu._rs271:
startTransition(_cj956);
break;
case Menu._by962:
resume();
_js834(true);
break;
case Menu._ti450:
case Menu._vn267:
Menu.setup(Menu._kh631);
break;
case Menu._my463:
if (Preloader._jp365){
MochiScores.closeLeaderboard();
};
if (_mf298 == _gn62){
startTransition(_yt719);
} else {
Menu.setup(Menu._ba865);
};
break;
case Menu._np795:
_jm113();
_uk601();
if (Preloader._jp365){
MochiScores.closeLeaderboard();
};
startTransition(_yt719);
break;
case Menu._dq526:
if (_mf298 == _yt719){
Menu.setup(Menu._ft764);
} else {
Menu.setup(Menu._kh631);
};
break;
case Menu._gt669:
if (music_on){
music_on = false;
Audio._wr699();
} else {
music_on = true;
switch (_mf298){
case _cj956:
switch (Main._jh775){
case 0:
Audio._eb405(Res._be106);
break;
case 1:
Audio._eb405(Res._sh887);
break;
default:
Audio._eb405(Res._qr911);
break;
};
break;
default:
Audio._eb405(Res._be106);
break;
};
};
Menu.setup(Menu._ur311, false);
break;
case Menu._vi606:
sfx_on = !(sfx_on);
Menu.setup(Menu._ur311, false);
Audio._dc461(Res._id150);
break;
case Menu._ow834:
messages_on = !(messages_on);
Menu.setup(Menu._ur311, false);
break;
case Menu._nx831:
one_click = !(one_click);
Menu.setup(Menu._ur311, false);
break;
case Menu._im884:
daytime = !(daytime);
if (_mf298 == _cj956){
_cy500(-1);
_td668(-1);
};
Menu.setup(Menu._ur311, false);
break;
case Menu._eq390:
try {
stage.fullScreenSourceRect = new Rectangle(0, 0, _al555, _rd609);
if (stage.displayState == StageDisplayState.FULL_SCREEN){
stage.displayState = StageDisplayState.NORMAL;
} else {
stage.displayState = StageDisplayState.FULL_SCREEN;
};
Menu.setup(Menu._ur311, false);
} catch(e:Error) {
};
break;
case Menu._ry931:
bloke_on = !(bloke_on);
if (_mf298 == _cj956){
if (bloke_on){
_wq930(_ty347);
_sw615.stop();
} else {
_ov571();
};
};
Menu.setup(Menu._ur311, false);
break;
case Menu._nv561:
navigateToURL(new URLRequest(Preloader._at261), irrcrpt("_eodqn", 3));
break;
case Menu._wr321:
navigateToURL(new URLRequest(Preloader._ln372), irrcrpt("_cmbol", 1));
break;
case Menu._pv573:
navigateToURL(new URLRequest(Preloader._ck148), irrcrpt("_gqfsp", 5));
break;
case Menu._cl62:
navigateToURL(new URLRequest(irrcrpt("myyu://bbb.rjlfija.ht.zp", 5)), irrcrpt("_fpero", 4));
break;
case Menu._dm806:
navigateToURL(new URLRequest(Preloader._yf723), irrcrpt("_gqfsp", 5));
break;
case Menu._un253:
Menu.setup(Menu._ya163);
break;
case Menu._nc687:
if (--_gu447 < 0){
_gu447 = (_tb292 - 1);
};
_ba165();
break;
case Menu._kv45:
if (++_gu447 >= _tb292){
_gu447 = 0;
};
_ba165();
break;
case Menu._lf304:
navigateToURL(new URLRequest(Preloader._ku255), irrcrpt("_cmbol", 1));
break;
case Menu._ao784:
startTransition(_pj46);
break;
case Menu._sb45:
if (--_ik686 < 0){
_ik686 = (_uk102 - 1);
};
_fq768(_ik686);
break;
case Menu._ct740:
if (++_ik686 >= _uk102){
_ik686 = 0;
};
_fq768(_ik686);
break;
case Menu._vx583:
_dv203(_ev44);
break;
case Menu._gr357:
_dv203(_eh939);
break;
case Menu._fx82:
_dv203(_ln948);
break;
};
};
}
final private function _pr501(_arg1:int, _arg2:int):Boolean{
if ((((((((_arg1 < 0)) || ((_arg1 >= _ke938)))) || ((_arg2 < 1)))) || ((_arg2 >= _wp33)))){
return (false);
};
return (true);
}
final private function _dl737(_arg1:int, _arg2:Boolean=true, _arg3:Number=1):void{
if (_arg2){
stats[_arg1] = (stats[_arg1] + _arg3);
} else {
stats[_arg1] = Math.max(_arg3, stats[_arg1]);
};
hi_stats[_arg1] = Math.max(stats[_arg1], hi_stats[_arg1]);
}
final private function _ju941(_arg1:int, _arg2:int):Boolean{
var _local4:int;
var _local5:int;
if (!_id273(_hp931[_arg1][_arg2])){
return (false);
};
var _local3 = (_hp931[_arg1][_arg2] == _mb217);
_local4 = 0;
while (_local4 < (_local3) ? 7 : 1) {
_local5 = _tv783(_arg1, _arg2, (_local3) ? _local4 : _hp931[_arg1][_arg2]);
_aa693(false, false);
if (_local5 > 2){
return (true);
};
_local4++;
};
return (false);
}
final private function cleanUp():void{
_vv100();
_ov571();
Menu.reset();
_fq753 = 0;
_dl953 = null;
paused = false;
}
final private function _bf159(_arg1:Object):void{
if (_arg1.success){
trace(_arg1.playerName);
trace(_arg1.score);
} else {
trace(_arg1.error);
_tx969();
};
}
final private function _ei384():void{
if (_im602 < _wn543.value){
_im602 = Math.min((_im602 = (_im602 + 250)), _wn543.value);
_cy500(_td410);
};
if (hiscore_display < _la955(_tn768)){
hiscore_display = Math.min((hiscore_display = (hiscore_display + 1000)), _la955(_tn768));
_cy500(_ac90);
};
}
final private function _yg442(_arg1:int, _arg2:int, _arg3:int):void{
if (((_pr501(_arg1, _arg2)) && (!((_hp931[_arg1][_arg2] == -1))))){
_ck712[_arg1][_arg2] = _arg3;
};
}
final private function _dv203(_arg1:int):void{
if (Preloader._jp365){
Menu.reset();
Menu._bs79();
MochiScores.showLeaderboard({boardID:_he741[_arg1], onClose:_fa374, onError:_fa374});
} else {
switch (Preloader.version){
case Preloader._wy814:
Menu.reset();
_aw558.initAGUI({iconGraphic:Res._ft87, onClose:_fa374, onError:_fa374});
_aw558.showScoreboardList(null, _ha812(_arg1));
break;
};
};
}
final private function _ss257():void{
var _local1:int;
var _local2:int;
var _local3:Boolean;
_fp878 = false;
_local1 = 0;
while (_local1 < _ke938) {
_local2 = (_wp33 - 1);
while (_local2 >= 0) {
if (_hp931[_local1][_local2] != -1){
if (_et473[_local1][_local2] != 0){
_fp878 = true;
if (_et473[_local1][_local2] < _uf199){
_et473[_local1][_local2] = (_et473[_local1][_local2] + _wl480);
};
_nu757[_local1][_local2] = (_nu757[_local1][_local2] + _et473[_local1][_local2]);
if (_nu757[_local1][_local2] >= _uf199){
_hp931[_local1][(_local2 + 1)] = _hp931[_local1][_local2];
_hp931[_local1][_local2] = -1;
_et473[_local1][(_local2 + 1)] = _et473[_local1][_local2];
_nu757[_local1][_local2] = 0;
_nu757[_local1][(_local2 + 1)] = 0;
if ((((_local2 == (_wp33 - 2))) || ((((_hp931[_local1][(_local2 + 2)] > -1)) && ((_et473[_local1][(_local2 + 2)] == 0)))))){
_et473[_local1][_local2] = 0;
_et473[_local1][(_local2 + 1)] = 0;
};
if (_local2 == 0){
_xl789(-1, _local1, _local2);
};
};
};
};
_local2--;
};
_local1++;
};
if (!_fp878){
_ao468 = -1;
bonus_type = -1;
prev_mouse_c = (prev_mouse_r = -1);
_local3 = _wv749();
if (!_local3){
_cn629.setValue(0);
_ij104(false);
};
};
}
final private function _wm274():void{
if (paused){
resume();
} else {
pause();
};
}
final private function _he121(_arg1:String):void{
if (debug){
trace(_arg1);
};
}
final private function _qf134():void{
_he121(irrcrpt("qtfiIfyf()", 5));
try {
if (_fa839.data.exists){
music_on = _fa839.data.music_on;
sfx_on = _fa839.data.sfx_on;
daytime = _fa839.data.daytime;
one_click = _fa839.data.one_click;
bloke_on = _fa839.data.bloke_on;
messages_on = _fa839.data.messages_on;
hiscore_casual.setValue(_fa839.data.hiscore_casual);
hiscore_3_minutes.setValue(_fa839.data.hiscore_3_minutes);
hiscore_100_moves.setValue(_fa839.data.hiscore_100_moves);
hi_stats = _fa839.data.hi_stats;
global_stats = _fa839.data.global_stats;
Achievements.achievement_unlocked = _fa839.data.achievement_unlocked;
};
} catch(e:Error) {
_he121((irrcrpt("fssps = ", 1) + e));
};
_bu847 = (Achievements.achievement_unlocked.indexOf(false) == -1);
}
final private function _nu26(_arg1:int):String{
switch (_arg1){
case _yi424:
return (Res._sc554.flip);
case _na672:
return (Res._sc554.detonate_all);
case _lv43:
return (Res._sc554.skull_destroyer);
case _kd573:
return (Res._sc554.skulls_to_bombs);
case _sv468:
return (Res._sc554.randomise);
case _jk280:
return (Res._sc554.bottom_row);
case _sa550:
return (Res._sc554.thaw_frozen);
case _au803:
return (Res._sc554.clear_colour);
};
return ("");
}
final private function _qa925(_arg1:Boolean):void{
}
final private function _dc877():void{
var _local1:int;
while (_local1 < _yd254) {
if (_aa792[_local1] != -1){
if ((ticks % _fc477[_aa792[_local1]]) == 0){
var _local2 = _ao510;
var _local3 = _local1;
var _local4 = (_local2[_local3] + 1);
_local2[_local3] = _local4;
if (_local4 >= _tr919[_aa792[_local1]]){
_aa792[_local1] = -1;
};
};
};
_local1++;
};
}
final private function _mo869(_arg1:int, _arg2:int, _arg3:int):void{
_aa792[_yh268] = _arg1;
_gn833[_yh268] = _arg2;
_aw689[_yh268] = _arg3;
_ao510[_yh268] = 0;
if (++_yh268 >= _yd254){
_yh268 = 0;
};
}
final private function _bh378():void{
var _local1:int;
while (_local1 < _yd254) {
if (_aa792[_local1] != -1){
Gfx._rm64(_cy833, Res._wu228[_aa792[_local1]], _gn833[_local1], _aw689[_local1], _ao510[_local1], _tr919[_aa792[_local1]], 1, (_lg346 | _qh836));
};
_local1++;
};
}
public function _gs957(_arg1:Object):void{
_jw579 = false;
switch (_mf298){
case _cj956:
if (_nj622){
_tx969();
};
break;
case _ew71:
break;
};
}
final private function startTransition(_arg1:int, _arg2:int=1):void{
if (_yd22 == 0){
_yd22 = _arg2;
_kt685 = _arg1;
_qu395 = ((_arg2 == _ul266)) ? 0 : 1;
if (_arg2 == _ul266){
if (_mf298 == _yt719){
_vv100();
};
if (Preloader._uy339){
MochiSocial.hideLoginWidget();
};
};
};
}
final private function _ld723():int{
var _local1:int;
if (_dq375(_md113, (_jv249 + _uf199), _jy499, (_ai954 - _uf199))){
_bk102 = -1;
return (_aw670);
};
if (_dq375(_gb576, _xf657, (_st336 * _gu350), _nq187)){
_local1 = _bk102;
_bk102 = _up231();
if (_bk102 != _local1){
_tp187 = Gfx._yy947(_nu26(_bk102), -1, irrcrpt("icog_hqpv", 2), 12, 0xFFFFFF, true);
bonus_desc_scale = 0;
};
return (_lo84);
};
if (_dq375(_aj35, _lv443, _uc175, _rr654)){
return (_gf457);
};
return (_ak504);
}
final private function _hj830():void{
var _local1:int;
_dl737(_kv199, true, (getTimer() - _ee164));
if (_tn768 == _eh939){
if (!_ju401){
if (stats[_kv199] >= (_aw782 - 10000)){
_ju401 = true;
Audio._dc461(Res._th179);
};
};
if (stats[_kv199] >= _aw782){
stats[_kv199] = _aw782;
_js834(false);
} else {
_cy500(_na871);
if (Math.floor((stats[_kv199] / 60000)) >= _gl465){
_local1 = (_sh60 - _gl465);
Messages.add(((_local1.toString() + " ") + ((_local1 == 1)) ? Res._sc554.minute_left : Res._sc554.minutes_left));
_nk517[_gl465] = true;
_gl465++;
};
switch (_jh775){
case 0:
if (stats[_kv199] >= 60000){
Audio._vu586(Res._ej852);
_jh775++;
};
break;
case 1:
if (stats[_kv199] >= 120000){
Audio._vu586(Res._ej852);
_jh775++;
};
break;
};
};
};
}
public function _pr319(_arg1:Object):void{
}
final private function _xs768():void{
Audio._vu586(Res._ej852);
switch (++_sh134){
case 2:
case 4:
_jh775++;
break;
};
_jw314 = _al555;
show_level_up_text = true;
}
private function _ah468(_arg1:Object):void{
}
final private function _mo636(_arg1:Event):void{
_aw558 = _arg1.currentTarget.content;
addChild(_aw558);
_aw558.init(_fp160, gameKey);
}
final private function _yq279(_arg1:Class, _arg2:Boolean=true, _arg3:Boolean=true, _arg4:int=0, _arg5:int=0, _arg6:Boolean=false):void{
_sw615 = new (_arg1);
_sw615.tabEnabled = false;
_sw615.x = (_bx358 + _arg4);
_sw615.y = (_ri788 + _arg5);
if (_arg2){
_sw615.play();
} else {
_sw615.stop();
};
if (((!(sfx_on)) || (_arg6))){
_sw615.soundTransform = new SoundTransform(0);
};
if (_arg3){
addChild(_sw615);
};
}
final private function _yh340():void{
if (_sw615 != null){
if (_sw615.currentFrame >= _sw615.totalFrames){
switch (_ty347){
case _yi24:
_sw615.gotoAndPlay((_sw615.totalFrames - 1));
break;
case _ib837:
_sw615.gotoAndPlay(44);
break;
case _se546:
_sw615.gotoAndPlay(0);
break;
default:
_wq930(((Math.random() < 0.1)) ? _bs286 : _ij645);
break;
};
};
};
}
final private function _fq768(_arg1:int):void{
Menu.reset();
Menu._jd533(((((((Res._sc554.title_achievements + irrcrpt(" (", 2)) + Res._sc554.page) + (_ik686 + 1)) + irrcrpt(" / ", 2)) + _uk102) + ")"), Menu._pc437, _bx358, 20, (_lg346 | TOP));
Menu._jd533(Res._sc554.exit, Menu._oo73, _bx358, (_rd609 - 20), (BOTTOM | _lg346));
if (_ik686 > 0){
Menu._jd533("", Menu._sb45, (_al555 >> 2), (_rd609 - 20), (BOTTOM | _lg346));
};
if (_ik686 < (_uk102 - 1)){
Menu._jd533("", Menu._ct740, (_al555 * 0.75), (_rd609 - 20), (BOTTOM | _lg346));
};
}
override protected function init3d():void{
_kj334.z = -2165;
_pj673 = new Plane(_kc278, Res._ch177.width, Res._ch177.height, 8, 8);
_kc278.interactive = false;
_kc278.oneSide = true;
_kc278.doubleSided = false;
_kc278.smooth = false;
_af103.addChild(_pj673);
_kj334.zoom = _qw322;
_pj673.visible = false;
}
final private function _ah362(_arg1:Event=null):void{
MochiSocial.addEventListener(MochiSocial.ACTION_COMPLETE, _di344);
MochiSocial.addEventListener(MochiSocial.ACTION_CANCELED, _oc975);
MochiSocial.postToStream({});
}
final private function _tw597():void{
if (bloke_on){
_wm719();
};
_bh378();
Particles.draw();
_cn456(true);
if (!_bp434){
_uh56();
};
_uy821();
Messages.draw();
}
final private function _ul160():void{
cleanUp();
Audio._eb405(Res._be106);
_jh775 = 0;
Menu.setup(Menu._ft764);
if (Preloader._uy339){
MochiSocial.showLoginWidget({x:8, y:(_rd609 - 40)});
};
if (Preloader._ji476){
_yq279(Res._ku472, true, true, (-560 + 470), -56);
};
}
final private function _dp727():void{
if (!paused){
_kd446();
_yc18 = (_yc18 + 0.05);
if (((((ticks % 10) == 0)) && ((++_kf147 >= 6)))){
_kf147 = 0;
};
};
}
final private function _sa454(_arg1:int, _arg2:Boolean=false):int{
return (((_jv249 + (_arg1 * _uf199)) + (_arg2) ? (_uf199 >> 1) : 0));
}
public function _nc44(_arg1:Object):void{
BoredServices.servicesObj = _arg1;
}
final private function _yx806(_arg1:Boolean):void{
_aa693(false, false);
switch (_hp931[mouse_column][mouse_row]){
case _bt419:
_yd465(mouse_column, mouse_row, true, _arg1);
break;
default:
_qn558(mouse_column, mouse_row, _arg1);
break;
};
}
final private function _ha812(_arg1:int):String{
var _local2:String;
switch (Preloader.version){
case Preloader._lx61:
_local2 = (irrcrpt("fsqfssdpi6_", 4) + _yd984[_arg1]);
break;
case Preloader._wy814:
_local2 = _qi735[_arg1];
break;
default:
_local2 = _yd984[_arg1];
break;
};
return (_local2);
}
final private function _cy500(_arg1:int=-1):void{
var _local4:String;
var _local2 = 0xAEAEAE;
var _local3:int;
while (_local3 < _uq496) {
if ((((_local3 == _arg1)) || ((_arg1 == -1)))){
switch (_local3){
case _td410:
image_score_value = Gfx._yy947(Utils._km167(_im602), -1, irrcrpt("jdph_irqw", 3), 20, 0x808080);
break;
case _ac90:
image_hiscore_value = Gfx._yy947(Utils._km167(hiscore_display), -1, irrcrpt("keqi_jsrx", 4), 20, 0x808080);
break;
case _qt405:
if (_tn768 != _ev44){
image_stat_label = Gfx._yy947(((_tn768 == _eh939)) ? Res._sc554.time : Res._sc554.moves, -1, irrcrpt("jdph_irqw", 3), 24, 0xAEAEAE);
};
break;
case _na871:
if (_tn768 != _ev44){
_local4 = ((_tn768 == _eh939)) ? Utils._wy927((_aw782 - stats[_kv199]), false) : Math.max(0, (_gg662 - stats[_gj520])).toString();
image_stat_value = Gfx._yy947(_local4, -1, irrcrpt("icog_hqpv", 2), 20, 0x808080);
};
break;
};
};
_local3++;
};
}
final private function _bb408(_arg1:BitmapData, _arg2:Boolean):void{
var _local3:int;
var _local4:int;
var _local5:int;
var _local6:int;
var _local7:int;
var _local8:int;
var _local9:int;
var _local10:ColorTransform;
var _local11:Boolean;
var _local12:int = (_arg2) ? _md113 : 0;
var _local13:int = (_arg2) ? _jv249 : 0;
if (!_arg2){
_arg1.fillRect(new Rectangle(_local12, _local13, Res._ch177.width, Res._ch177.height), 0);
Gfx._rm64(_arg1, (daytime) ? Res._ch177 : Res._oj450);
_local12 = (_local12 + 7);
_local13 = (_local13 + (4 - _uf199));
} else {
Gfx._rm64(_arg1, (daytime) ? Res._ch177 : Res._oj450, _og323, 11, 0, 1, 1, (TOP | _lg346));
};
if (((((((_le723) && ((_xc904 == _aw670)))) && ((_ck712[mouse_column][mouse_row] == SELECTED)))) && (((ticks % 8) < 5)))){
if ((((_cn629.value == 3)) || ((_cn629.value >= 5)))){
Gfx._rm64(_cy833, ((_cn629.value == 3)) ? Res._rm552 : Res._kx277, _lf261(mouse_column, true), ((_jv249 + _uf199) + 4), 0, 1, 1, (_lg346 | _qh836));
};
};
_local7 = 0;
while (_local7 < 3) {
_local3 = 0;
while (_local3 < _ke938) {
_local4 = (_fp878) ? 0 : 1;
while (_local4 < _wp33) {
_local8 = _hp931[_local3][_local4];
if (_local8 != -1){
_local9 = _ck712[_local3][_local4];
_local5 = (_local12 + (_local3 * _nx975));
_local6 = ((_local13 + (_local4 * _uf199)) + _nu757[_local3][_local4]);
_local11 = (((((_local7 == 0)) && ((_local9 == _sl159)))) || ((((_local7 == 2)) && (!((_local9 == _sl159))))));
if ((((((_local7 == 1)) && (!((_local9 == _sl159))))) && (((ticks % 6) < 4)))){
Gfx._rm64(_arg1, Res._ai406, (_local5 + (_nx975 >> 1)), (_local6 + (_uf199 >> 1)), 0, 1, 1, (_lg346 | _qh836), null);
};
if (_local11){
_local10 = ((((_local4 == 0)) && (_fp878))) ? new ColorTransform(1, 1, 1, (_nu757[_local3][_local4] / _uf199)) : null;
if (_local8 >= _eh970){
Gfx._rm64(_arg1, Res._be769, _local5, _local6, (((_local8 - _eh970) * Res._mo567) + Math.max(0, _vu908[_local3][_local4])), Res._mo567, Res._qf707, -1, _local10, false, false, 35, 39);
} else {
Gfx._rm64(_arg1, _up433, _local5, _local6, _local8, _tp250, _xn864, -1, _local10, false, false, 33, 36);
};
};
};
_local4++;
};
_local3++;
};
_local7++;
};
}
public static function _wh740(_arg1:String):String{
return (String(Res._sc554[_arg1]));
}
public static function _ot632():Number{
if (_mf298 != _cj956){
return (0);
};
return (_jh775);
}
}
}//package
Section 189
//Main__ao405 (Main__ao405)
package {
import mx.core.*;
public class Main__ao405 extends BitmapAsset {
}
}//package
Section 190
//Menu (Menu)
package {
import flash.display.*;
import flash.geom.*;
public class Menu {
public static const _do401:int = 36;
public static const _he919:int = -4;
public static const _sb840:int = _jl260.height;
public static const _tb129:int = _jl260.width;
public static const _kp551:int = _ia270.width;
public static const _by962:int = 40;
public static const _bm126:int = -6;
public static const _kv45:int = 38;
public static const _pv573:int = 24;
public static const _dm806:int = 5;
public static const _un253:int = 10;
public static const _bc874:int = 13;
public static const _vi606:int = 16;
public static const _ti450:int = 41;
public static const _nr548:Array = [_he919, _sf291, _by962, _ti450];
public static const _qu850:int = 25;
public static const _pv747:int = -1;
public static const _gr357:int = 48;
public static const _fx82:int = 49;
public static const _sf74:int = -3;
public static const _kp335:int = -2;
public static const _oo122:int = 26;
public static const _eq390:int = 20;
public static const _se226:int = 11;
public static const _ba865:Array = [_sf74, _sf291, _np795, _dq526];
public static const _xj838:int = 7;
public static const _gt669:int = 15;
public static const _wy312:int = 0;
public static const _hr685:int = 9;
public static const _ia270:BitmapData = Bitmap(new _kg398()).bitmapData;
public static const _nt905:int = 30;
public static const _ao784:int = 44;
public static const _nx831:int = 18;
public static const _dk268:int = 39;
public static const _im884:int = 19;
public static const _dq526:int = 35;
public static const _ur892:int = 8;
public static const _sf291:int = -20;
public static const _oa34:int = 28;
public static const _oo73:int = 6;
public static const _kh631:Array = [_if917, _sf291, _xj838, _se226, _lb454, _un253, _lf304, _dm806, _my463];
public static const _np795:int = 34;
public static const _yi202:int = -10;
public static const _ya163:Array = [_pv747, _sf291, _gt669, _vi606, _eq390, _ow834, _nx831, _im884, _ry931, _bc874];
public static const _xh557:int = -5;
public static const _bm699:Class = Menu__bm699;
public static const _uy297:int = 10;
public static const _ft764:Array = [_yl460, _sf291, _wy312, _tk966, _un253, _qu850, _ao784, _vq267, _tp732, _lf304, _dm806];
public static const _ry931:int = 21;
public static const _rs271:int = 42;
public static const _eu774:Array = [_kp335, _sf291, _oo122, _be634, _oa34, _oo73];
public static const _lu215:Array = [_yi202, _sf291, _vx583, _gr357, _fx82, _oo73];
public static const _kg398:Class = Menu__kg398;
public static const _ow834:int = 17;
public static const _vn267:int = 43;
public static const _lf304:int = 14;
public static const _pc437:int = -21;
public static const _cl62:int = 4;
public static const _au62:int = -8;
public static const _vq267:int = 2;
public static const _tp732:int = 3;
public static const _iq103:Array = [_au62, _sf291, _rs271, _vn267];
public static const _my463:int = 8;
public static const _if917:int = -9;
public static const _lb454:int = 12;
public static const _nv561:int = 22;
public static const _tk966:int = 1;
public static const _jl260:BitmapData = Bitmap(new _bm699()).bitmapData;
public static const _sb45:int = 45;
public static const _be634:int = 27;
public static const _vx583:int = 47;
public static const _nc687:int = 37;
public static const _ct740:int = 46;
public static const _yl460:int = -7;
public static const _wr321:int = 23;
public static var _di566:Boolean = false;
public static var _rv571:Array = new Array(_uy297);
public static var _dn698:Array = new Array(_uy297);
public static var _sm326:Array = new Array(_uy297);
public static var _no397:Array = new Array(_uy297);
public static var _we729:int;
public static var _le703:Array = new Array(_uy297);
public static var _hp543:Number;
public static var _ob238:int;
public static var _jx732:int = 0;
public static var _ur311:Array;
public static var _dr642:int = -1;
public static var _ho897:Array = new Array(_uy297);
public static var menu_angle:Number = 0;
public static function getString(_arg1:int):String{
switch (_arg1){
case _yi202:
return (Res._sc554.choose_leaderboard);
case _yl460:
return (Res._sc554.title_main_menu);
case _bm126:
return (Res._sc554.title_stats);
case _kp335:
return (Res._sc554.title_select_game_mode);
case _pv747:
return (Res._sc554.title_options);
case _xh557:
return (Res._sc554.title_credits);
case _if917:
return (Res._sc554.title_paused);
case _he919:
return (Res._sc554.confirm_give_up);
case _sf74:
return (Res._sc554.confirm_quit);
case _au62:
return (Res._sc554.confirm_retry);
case _un253:
return (Res._sc554.options);
case _tp732:
return (Res._sc554.credits);
case _tk966:
return (Res._sc554.how_to_play);
case _vq267:
return (Res._sc554.leaderboard);
case _oo73:
case _bc874:
case _do401:
case _nt905:
return (Res._sc554.back);
case _cl62:
return (Res._sc554.visit_megadev);
case _lf304:
return (Res._sc554.play_original);
case _dm806:
return (Res._sc554.more_games);
case _oo122:
case _vx583:
return (Res._sc554.casual);
case _be634:
case _gr357:
return (Res._sc554.timed);
case _oa34:
case _fx82:
return (Res._sc554.limited_moves);
case _my463:
return (Res._sc554.quit);
case _xj838:
return (Res._sc554.resume);
case _wy312:
return (Res._sc554.start_game);
case _hr685:
return (Res._sc554.submit_score);
case _lb454:
return (Res._sc554.retry);
case _se226:
return (Res._sc554.give_up);
case _np795:
case _by962:
case _rs271:
return (Res._sc554.yes);
case _dq526:
case _ti450:
case _vn267:
return (Res._sc554.no);
case _gt669:
return ((Main.music_on) ? Res._sc554.music_on : Res._sc554.music_off);
case _vi606:
return ((Main.sfx_on) ? Res._sc554.sound_on : Res._sc554.sound_off);
case _ow834:
return ((Main.messages_on) ? Res._sc554.messages_on : Res._sc554.messages_off);
case _nx831:
return ((Main.one_click) ? Res._sc554.one_click_on : Res._sc554.one_click_off);
case _im884:
return ((Main.daytime) ? Res._sc554.daytime_on : Res._sc554.daytime_off);
case _eq390:
return (((Main._we939.displayState == StageDisplayState.FULL_SCREEN)) ? Res._sc554.full_screen_on : Res._sc554.full_screen_off);
case _ry931:
return ((Main.bloke_on) ? Res._sc554.text_bloke_on : Res._sc554.text_bloke_off);
case _dk268:
return (Res._sc554.show_store);
case _qu850:
return (Res._sc554.view_stats);
case _ao784:
return (Res._sc554.achievements);
case _sb45:
case _nc687:
return (Res._sc554.previous);
case _ct740:
case _kv45:
return (Res._sc554.next);
};
return ("");
}
public static function _dj895():int{
_ob238 = 0;
while (_ob238 < _we729) {
if ((((((((Main._we939.mouseX > (_rv571[_ob238] - (_no397[_ob238] >> 1)))) && ((Main._we939.mouseX < (_rv571[_ob238] + (_no397[_ob238] >> 1)))))) && ((Main._we939.mouseY > _sm326[_ob238])))) && ((Main._we939.mouseY < (_sm326[_ob238] + _ho897[_ob238]))))){
return (_ob238);
};
_ob238++;
};
return (-1);
}
public static function _so345(_arg1:BitmapData, _arg2:int, _arg3:int, _arg4:int, _arg5:int=-1, _arg6:Number=1):void{
var _local7:Number = ((_arg4 - (_kp551 << 1)) / _tb129);
if (_arg5 != -1){
_arg2 = (_arg2 + Gfx._sn465(_arg5, _arg4));
_arg3 = (_arg3 + Gfx._kc87(_arg5, Menu._sb840));
};
Gfx._rm64(_arg1, _ia270, _arg2, _arg3, 0, 1, 1, (Gfx.TOP | Gfx.LEFT), new ColorTransform(1, 1, 1, _arg6));
Gfx._ia682(_arg1, _jl260, (_arg2 + _kp551), _arg3, 0, 1, 1, (Gfx.TOP | Gfx.LEFT), new ColorTransform(1, 1, 1, _arg6), _local7);
Gfx._rm64(_arg1, _ia270, (_arg2 + _arg4), _arg3, 0, 1, 1, (Gfx.TOP | Gfx.RIGHT), new ColorTransform(1, 1, 1, _arg6), true);
}
public static function _bs79():void{
if (Preloader._at261.length > 0){
Menu._jd533("", Menu._nv561, (Main._al555 - 8), (Main._rd609 - 8), (Gfx.BOTTOM | Gfx.RIGHT));
};
if (Preloader._ln372.length > 0){
_jd533("", Menu._wr321, 8, (Main._rd609 - 8), (Gfx.BOTTOM | Gfx.LEFT));
};
if (Preloader._ck148.length > 0){
_jd533("", Menu._pv573, ((8 + Res._qg857.width) + 8), (Main._rd609 - 8), (Gfx.BOTTOM | Gfx.LEFT));
};
}
public static function draw():void{
_ob238 = 0;
while (_ob238 < _we729) {
if ((((_ob238 == _dr642)) || ((_hp543 > 0)))){
if (_ob238 == _dr642){
Gfx._ia682(Main._cy833, _dn698[_ob238], _rv571[_ob238], (_sm326[_ob238] + (_ho897[_ob238] >> 1)), 0, 1, 1, (Gfx._qh836 | Gfx._lg346), null, (1 + (Math.sin(menu_angle) * 0.05)), (1 + (Math.sin(menu_angle) * 0.025)), false, true);
} else {
Gfx._ia682(Main._cy833, _dn698[_ob238], _rv571[_ob238], (_sm326[_ob238] + _ho897[_ob238]), 0, 1, 1, (Gfx.BOTTOM | Gfx._lg346), null, 1, (1 + (_hp543 * Math.sin(menu_angle))));
};
} else {
Gfx._rm64(Main._cy833, _dn698[_ob238], _rv571[_ob238], _sm326[_ob238], 0, 1, 1, (Gfx.TOP | Gfx._lg346));
};
_ob238++;
};
}
public static function reset():void{
_di566 = false;
_we729 = 0;
_dr642 = -1;
}
public static function setup(_arg1:Array, _arg2:Boolean=true):void{
var _local4:int;
var _local5:String;
var _local6:int;
var _local7:Boolean;
var _local8:Boolean;
var _local9:int;
_we729 = 0;
_dr642 = -1;
_di566 = true;
_ur311 = _arg1;
var _local3:int;
_local9 = 0;
while (_local9 < 2) {
_ob238 = 0;
while (_ob238 < _arg1.length) {
_local6 = _arg1[_ob238];
_local7 = true;
_local8 = true;
if (_local9 == 1){
_local5 = getString(_local6);
};
switch (_local6){
case _ao784:
_local8 = Preloader._yl227;
break;
case _lf304:
_local8 = (Preloader._ku255.length > 0);
break;
case _dm806:
_local8 = (Preloader._yf723.length > 0);
break;
case _eq390:
_local8 = ((Preloader._hx159) && (Main._we939.hasOwnProperty(irrcrpt("inxuqfdXyfyj", 5))));
break;
case _vq267:
_local8 = Preloader._dt847;
break;
};
if (_local8){
if (_arg1[_ob238] != _sf291){
if (_local9 == 0){
_local3 = (_local3 + (_sb840 + _ur892));
} else {
_jd533(_local5, _local6, Main._bx358, _local4, (Gfx.TOP | Gfx._lg346));
_local4 = (_local4 + (_sb840 + _ur892));
};
} else {
if (_local9 == 0){
_local3 = (_local3 + (_sb840 >> 1));
} else {
_local4 = (_local4 + (_sb840 >> 1));
};
};
};
if (_local9 == 0){
_local4 = ((Main._ri788 - (_local3 >> 1)) - _ur892);
};
_ob238++;
};
_local9++;
};
_bs79();
_hp543 = (_arg2) ? _hp543 : 0;
}
public static function tick():void{
var _local1:int;
if (((_di566) && ((Main._yd22 == 0)))){
menu_angle = (menu_angle + 0.4);
if (_hp543 > 0){
_hp543 = (_hp543 - (0.005 + (_hp543 * 0.1)));
if (_hp543 < 0){
_hp543 = 0;
};
} else {
_local1 = _dj895();
if (_local1 != _dr642){
_jx732 = 0;
if (_le703[_local1] >= 0){
_dr642 = _local1;
Audio._dc461(Res._mk720[Main._ot632()]);
} else {
_dr642 = -1;
};
};
};
};
}
public static function _jd533(_arg1:String, _arg2:int, _arg3:int, _arg4:int, _arg5:int):void{
var _local6:int;
if (_arg2 == _sf291){
return;
};
if (!_di566){
_di566 = true;
_we729 = 0;
};
_hp543 = 1;
menu_angle = (Math.PI + (Math.PI / 2));
_le703[_we729] = _arg2;
if (_arg1.length == 0){
_arg1 = getString(_arg2);
};
switch (_arg2){
case _cl62:
_dn698[_we729] = Res._qk755;
break;
case _nv561:
_dn698[_we729] = Res._bw949;
break;
case _wr321:
_dn698[_we729] = Res._qg857;
break;
case _pv573:
_dn698[_we729] = Res._jt200;
break;
default:
Gfx._yy947(_arg1, -1, irrcrpt("jdph_irqw", 3), 20, 0xAEAEAE);
_local6 = (Gfx._tr895.width + (_kp551 << 1));
_dn698[_we729] = new BitmapData(_local6, _sb840, true, 0);
_so345(_dn698[_we729], 0, 0, _local6, -1);
Gfx._rm64(_dn698[_we729], Gfx._tr895, (_local6 >> 1), ((_sb840 >> 1) + 2), 0, 1, 1, (Gfx._lg346 | Gfx._qh836));
break;
};
_no397[_we729] = _dn698[_we729].width;
_ho897[_we729] = _dn698[_we729].height;
_arg3 = (_arg3 + (Gfx._sn465(_arg5, _no397[_we729]) + (_no397[_we729] >> 1)));
_arg4 = (_arg4 + Gfx._kc87(_arg5, _dn698[_we729].height));
_rv571[_we729] = _arg3;
_sm326[_we729] = _arg4;
_we729++;
}
}
}//package
Section 191
//Menu__bm699 (Menu__bm699)
package {
import mx.core.*;
public class Menu__bm699 extends BitmapAsset {
}
}//package
Section 192
//Menu__kg398 (Menu__kg398)
package {
import mx.core.*;
public class Menu__kg398 extends BitmapAsset {
}
}//package
Section 193
//Messages (Messages)
package {
import flash.geom.*;
import flash.media.*;
public class Messages {
public static const _ao727:int = 8;
public static var bar_vcent:int;
public static var _vl549:Array = new Array(_ao727);
public static var _vl795:Array = new Array(_ao727);
public static var _ni195:int;
public static var m:int;
public static var _un127:Array = new Array(_ao727);
public static var _if510:Array = new Array(_ao727);
public static var _up960:Array = new Array(_ao727);
public static var _rl897:Array = new Array(_ao727);
public static function add(_arg1:String, _arg2:Sound=null, _arg3:Boolean=false):void{
if (_arg2 != null){
Audio._nj45(_arg2);
};
if (((Main.messages_on) || (_arg3))){
m = 0;
while (m < _ao727) {
if (_vl549[m] <= 0){
if (_arg3){
_arg1 = (irrcrpt(" ", 2) + _arg1);
};
_up960[m] = Gfx._yy947(_arg1, -1, irrcrpt("hbnf_gpou", 1), 20, 0xAEAEAE, false);
_if510[m] = Main._al555;
_vl549[m] = 0.85;
_vl795[m] = 150;
_rl897[m] = _arg3;
m = _ao727;
};
m++;
};
};
}
public static function draw():void{
m = 0;
while (m < _ao727) {
if (_vl549[m] > 0){
_ni195 = -(_if510[m]);
bar_vcent = ((Main._rd609 - 56) - (m * 32));
Menu._so345(Main._cy833, (_ni195 + (_up960[m].width >> 1)), bar_vcent, (_up960[m].width + (Menu._kp551 << 1)), (Gfx._lg346 | Gfx._qh836), _vl549[m]);
Gfx._rm64(Main._cy833, _up960[m], _ni195, (bar_vcent + 2), 0, 1, 1, (Gfx._qh836 | Gfx.LEFT), new ColorTransform(1, 1, 1, _vl549[m]));
if (_rl897[m]){
Gfx._rm64(Main._cy833, Res._tg333, (_ni195 + 2), bar_vcent, 0, 2, 1, (Gfx._qh836 | Gfx.LEFT), new ColorTransform(1, 1, 1, _vl549[m]));
};
};
m++;
};
}
public static function tick():void{
m = 0;
while (m < _ao727) {
if (_vl549[m] > 0){
if (_if510[m] > 0){
_if510[m] = (_if510[m] - (1 + (_if510[m] * 0.2)));
} else {
var _local1 = _vl795;
var _local2 = m;
var _local3 = (_local1[_local2] - 1);
_local1[_local2] = _local3;
if (_local3 < 0){
_vl549[m] = (_vl549[m] - 0.02);
};
};
};
m++;
};
}
public static function init():void{
m = 0;
while (m < _ao727) {
_vl549[m] = 0;
m++;
};
}
}
}//package
Section 194
//MindJoltAPI (MindJoltAPI)
package {
import flash.events.*;
import flash.display.*;
import flash.net.*;
import flash.system.*;
public class MindJoltAPI {
public static var ad:Object = {showPreGameAd:showPreGameAd};
private static var callback:Function;
private static var gameKey:String;
private static var clip:MovieClip;
public static var service:Object = {connect:load_service};
private static var version:String = irrcrpt("2.1.4", 1);
private static var options:Object;
private static function load_service_complete(_arg1:Event):void{
if (((!((_arg1.currentTarget.content == null))) && (!((_arg1.currentTarget.content.service == null))))){
service = _arg1.currentTarget.content.service;
trace(irrcrpt("[NjoeKpmuBQJ] tfswjdf tvddfttgvmmz mpbefe", 1));
service.connect(gameKey, clip, callback);
if (options != null){
service.showPreGameAd(options);
};
service.getLogger().info(((irrcrpt("RnsiOtqyFUN qtfijw ajwxnts [", 5) + version) + "]"));
} else {
trace(irrcrpt("[OkpfLqnvCRK] hckngf vq nqcf", 2));
};
}
private static function load_service(_arg1:String, _arg2:MovieClip, _arg3:Function=null){
var _local4:Object;
var _local5:Loader;
_slot1.gameKey = _arg1;
_slot1.clip = _arg2;
_slot1.callback = _arg3;
if (service.submitScore == null){
Security.allowDomain(irrcrpt("xyfynh.rnsiotqy.htr", 5));
_local4 = LoaderInfo(_arg2.root.loaderInfo).parameters;
_local5 = new Loader();
_local5.contentLoaderInfo.addEventListener(Event.COMPLETE, load_service_complete);
_local5.load(new URLRequest(((_local4.mjPath) || (irrcrpt("myyu://xyfynh.rnsiotqy.htr/fun/fx8/fun_qthfq_fx8.xbk", 5)))));
_arg2.addChild(_local5);
};
}
public static function showPreGameAd(_arg1:Object=null){
if (clip == null){
trace(irrcrpt("[RnsiOtqyFUN] Dtz rzxy hfqq RnsiOtqyFUN.xjwanhj.htssjhy gjktwj RnsiOtqyFUN.fi.xmtbUwjLfrjFi.", 5));
};
if (_arg1 == null){
_arg1 = {};
};
if (service.showPreGameAd != undefined){
service.showPreGameAd(_arg1);
} else {
_slot1.options = _arg1;
if (_arg1["ad_started"] == null){
_arg1["clip"].stop();
};
};
}
}
}//package
Section 195
//PaperBase (PaperBase)
package {
import flash.events.*;
import flash.display.*;
import org.papervision3d.view.*;
import org.papervision3d.render.*;
import org.papervision3d.scenes.*;
import org.papervision3d.cameras.*;
public class PaperBase extends Sprite {
public var renderer:BasicRenderEngine;
public var _fa278:Viewport3D;
public var _af103:Scene3D;
public var _kj334:Camera3D;
protected function init3d():void{
}
protected function _hk316():void{
}
protected function onEnterFrame(_arg1:Event):void{
_hk316();
renderer.renderScene(_af103, _kj334, _fa278);
}
protected function _sv888(_arg1:Number, _arg2:Number):void{
_fa278 = new Viewport3D(_arg1, _arg2, false, true, true, true);
addChild(_fa278);
renderer = new BasicRenderEngine();
_af103 = new Scene3D();
_kj334 = new Camera3D();
}
public function init(_arg1:Number=800, _arg2:Number=600):void{
_sv888(_arg1, _arg2);
init3d();
_pm951();
_ss91();
}
protected function _pm951():void{
}
protected function _ss91():void{
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
}
}//package
Section 196
//Particles (Particles)
package {
import flash.display.*;
public class Particles {
public static const _fy960:int = 3;
public static const _gy123:int = -1;
public static const _ts387:BitmapData = Bitmap(new _vv654()).bitmapData;
public static const _xy687:int = 0x0200;
public static const _vv654:Class = Particles__vv654;
public static const _xk550:int = 5;
public static const _sg479:Class = Particles__sg479;
public static const _ac917:BitmapData = Bitmap(new _sg479()).bitmapData;
public static const _uu652:Class = Particles__uu652;
public static const _be783:int = -2;
public static const _is928:Number = 0.392699081698724;
public static const _id536:int = 8;
public static const _gw252:int = 16;
public static const _xy235:int = 6;
public static const _rn686:BitmapData = Bitmap(new _uu652()).bitmapData;
public static const _vy919:int = 7;
public static var y:int;
public static var _nt750:Array = new Array(_xy687);
public static var _wd301:Array = new Array(_xy687);
public static var _tl393:Array = new Array(_xy687);
public static var _ya602:Array = new Array(_xy687);
public static var _ow242:Array = new Array(_xy687);
public static var _ss647:Array = new Array(_xy687);
public static var _ob238:int;
public static var _cu474:int = 0;
public static var x:int;
public static var _kd542:Array = new Array(_xy687);
public static var ticks:int = 0;
public static function init():void{
_cu474 = 0;
_ob238 = 0;
while (_ob238 < _xy687) {
_ow242[_ob238] = Main._rd609;
_ob238++;
};
}
public static function add(_arg1:int, _arg2:int, _arg3:int, _arg4:int=16):void{
var _local5:Number;
var _local6:int;
var _local7:Boolean;
if ((((_arg3 == _gy123)) || ((_arg3 == _be783)))){
_local7 = true;
} else {
_arg1 = (_arg1 - 9);
_arg2 = (_arg2 - 9);
};
_ob238 = 0;
while (_ob238 < _arg4) {
_local5 = (Math.random() * Math.PI);
_local6 = ((_id536 / 2) + (Math.random() * _id536));
_tl393[_cu474] = _arg3;
switch (_arg3){
case Main._mk424:
_tl393[_cu474] = _xy235;
break;
case Main._mb217:
_tl393[_cu474] = Math.floor((Math.random() * 5));
break;
case Main._bt419:
case Main._ol566:
_tl393[_cu474] = 5;
break;
};
if (_local7){
_wd301[_cu474] = (-8 + (Math.random() * 16));
_ss647[_cu474] = (-6 - (Math.random() * 4));
} else {
_wd301[_cu474] = (Math.sin(((_is928 * _ob238) + _local5)) * _local6);
_ss647[_cu474] = (-2 + (Math.cos(((_is928 * _ob238) + _local5)) * _local6));
};
_nt750[_cu474] = _arg1;
_ow242[_cu474] = _arg2;
_kd542[_cu474] = 0;
_ya602[_cu474] = 0;
if (++_cu474 >= _xy687){
_cu474 = 0;
};
_ob238++;
};
}
public static function tick():void{
ticks++;
_ob238 = 0;
while (_ob238 < _xy687) {
if (_ow242[_ob238] < Main._rd609){
_nt750[_ob238] = (_nt750[_ob238] + _wd301[_ob238]);
_ow242[_ob238] = (_ow242[_ob238] + _ss647[_ob238]);
_wd301[_ob238] = (_wd301[_ob238] * 0.99);
_ss647[_ob238] = (_ss647[_ob238] + 0.4);
switch (_tl393[_ob238]){
case _gy123:
case _be783:
_ya602[_ob238] = (_ya602[_ob238] + (_wd301[_ob238] / 10));
break;
default:
if (((((ticks % 8) == 0)) && ((Math.random() < 0.4)))){
var _local1 = _kd542;
var _local2 = _ob238;
var _local3 = (_local1[_local2] + 1);
_local1[_local2] = _local3;
if (_local3 >= _fy960){
_ow242[_ob238] = Main._rd609;
};
};
break;
};
};
_ob238++;
};
}
public static function draw():void{
_ob238 = 0;
while (_ob238 < _xy687) {
if (_ow242[_ob238] < Main._rd609){
switch (_tl393[_ob238]){
case _gy123:
case _be783:
Gfx._ec952(Main._cy833, ((_tl393[_ob238] == _gy123)) ? _rn686 : _ac917, _nt750[_ob238], _ow242[_ob238], (Gfx._lg346 | Gfx._qh836), null, _ya602[_ob238]);
break;
default:
Gfx._rm64(Main._cy833, _ts387, _nt750[_ob238], _ow242[_ob238], ((_tl393[_ob238] * _fy960) + _kd542[_ob238]), _fy960, _vy919, -1, null, false, false, 18, 18);
break;
};
};
_ob238++;
};
}
}
}//package
Section 197
//Particles__sg479 (Particles__sg479)
package {
import mx.core.*;
public class Particles__sg479 extends BitmapAsset {
}
}//package
Section 198
//Particles__uu652 (Particles__uu652)
package {
import mx.core.*;
public class Particles__uu652 extends BitmapAsset {
}
}//package
Section 199
//Particles__vv654 (Particles__vv654)
package {
import mx.core.*;
public class Particles__vv654 extends BitmapAsset {
}
}//package
Section 200
//Preloader (Preloader)
package {
import flash.events.*;
import flash.display.*;
import com.newgrounds.*;
import com.newgrounds.components.*;
import flash.utils.*;
import mochi.as3.*;
import flash.net.*;
import flash.text.*;
import flash.system.*;
import flash.media.*;
public dynamic class Preloader extends MovieClip {
private const _bx358:int;
private const _al555:int = 640;
private const _nl310:String;
private const _cr555:String;
private const _rd609:int = 480;
private const _ri788:int;
private const _bu122:String;
private var _du406:int;// = 0
private var _aw673:int;// = 452
private var _xl794:int;// = 0
private var _mj215:Boolean;// = true
private var _xm605:int;// = 200
private var _ss358:Class;
private var _yl481:Boolean;// = false
private var _de97:Boolean;// = false
private var _yl443:Boolean;// = false
private var _lt378:Sprite;
private var _nh245:Boolean;// = false
private var _fq305:Boolean;// = false
private var _lv839:Boolean;// = true
private var _qj757:FlashAd;// = null
private var _tt668:Number;// = 0
public static const _wh463:int = 10;
public static const _lv456:int = 1;
public static const _vy841:int = 2;
public static const _vw589:int = 6;
public static const _tm724:int = 0;
public static const _lx61:int = 7;
public static const _wy814:int = 11;
public static const _mb185:int = 8;
public static const _mx778:int = 4;
public static const _la384:int = 5;
public static const _nr640:int = 3;
public static const _uy796:int = 9;
public static var _yl227:Boolean = true;
public static var _hx159:Boolean = false;
public static var _uw88:Class = Preloader__uw88;
public static var _ln372:String = irrcrpt("jvvr://vykvvgt.eqo/Ogicfgx", 2);
public static var _ck148:String = irrcrpt("myyu://bbb.kfhjgttp.htr/#!/ufljx/Rjlfija/85005167290", 5);
public static var _am804:Class = Preloader__am804;
public static var _yf723:String = "";
public static var host:String;
public static var _dt847:Boolean = false;
public static var _jp365:Boolean = false;
public static var _ty173:Class = Preloader__ty173;
public static var _uy339:Boolean = false;
public static var _na614:Boolean = false;
public static var _ku255:String = irrcrpt("lxxt://aaa.qmrhnspx.gsq/keqiw/fsqfssdpi", 4);
public static var _fp899:String = "";
public static var version:int = 0;
public static var _at261:String = irrcrpt("myyu://bbb.rjlfija.ht.zp", 5);
public static var _un836:Array = new Array(5);
public static var _oy156;
public static var _yg121:BitmapData = Bitmap(new _am804()).bitmapData;
public static var _ut387:Sprite;
public static var _bf448:Boolean = true;
public static var _ji476:Boolean = true;
public function Preloader(){
var _ad450:Object;
var _ey973:String;
var request:URLRequest;
var loader:Loader;
var _ob238:int;
var _id428:TextFormat;
var _xj418:TextField;
_bx358 = (_al555 >> 1);
_ri788 = (_rd609 >> 1);
_ss358 = Preloader__ss358;
_nl310 = irrcrpt("T43L2MLX950Z80VG", 5);
_cr555 = irrcrpt("49d6e58i4ih33074", 3);
_bu122 = irrcrpt("Ymnx lfrj nx xnyj-qthpji. Yt tgyfns f qnhjsxj uqjfxj j-rfnq nskt@rjlfija.ht.zp", 5);
super();
host = this.root.loaderInfo.url.split("/")[2];
trace((irrcrpt("mtxy = ", 5) + host));
_yl481 = (host.length == 0);
if (!_yl481){
switch (version){
case _vw589:
break;
case _mx778:
if (host.indexOf(irrcrpt("okpflqnv", 2)) == -1){
version = _tm724;
};
break;
case _uy796:
if (host.indexOf(irrcrpt("mqpitgicvg", 2)) == -1){
version = _tm724;
};
break;
case _wh463:
if ((((host.indexOf(irrcrpt("dtzdtzbns", 5)) == -1)) && ((host.indexOf(irrcrpt("0n0n", 3)) == -1)))){
version = _tm724;
};
break;
};
};
var _ho938:Boolean;
switch (version){
case _wy814:
_un836[0] = irrcrpt("ctoqticogu.eqo", 2);
_fq305 = true;
_jp365 = false;
_ku255 = "";
_de97 = false;
_ji476 = false;
_dt847 = true;
_ln372 = irrcrpt("kwws://wzlwwhu.frp/duprujdphv", 3);
_ck148 = irrcrpt("iuuq://xxx.gbdfcppl.dpn/qbhft/Bsnps-Hbnft/20633190172", 1);
_yf723 = irrcrpt("myyu://fwrtwlfrjx.htr", 5);
_fp899 = irrcrpt("jvvr://ctoqticogu.eqo", 2);
break;
case _wh463:
FWAd_AS3.showAd({container:this, x:0, y:0, wid:_al555, hei:_rd609, id:irrcrpt("phjdghy-Erperrcoh5-4", 3), adType:irrcrpt("psehmrk", 4), onClickStartBtn:_xy281});
_fq305 = true;
_at261 = irrcrpt("kwws://zzz.brxbrxzlq.frp", 3);
_ji476 = false;
_bf448 = false;
_jp365 = false;
_ln372 = "";
_ck148 = "";
_ku255 = "";
break;
case _mb185:
_jp365 = true;
_de97 = false;
_ji476 = false;
_un836[0] = irrcrpt("boelpo", 1);
_ku255 = "";
_fp899 = irrcrpt("jvvr://yyy.cpfmqp.eqo/ctecfg/", 2);
_at261 = irrcrpt("lxxt://aaa.erhosr.gsq/evgehi/", 4);
break;
case _vw589:
API.connect(loaderInfo, irrcrpt("37575:jXmtWXO9", 2), irrcrpt("7t7nang89MiIQGf7PTR96pEmlfW0nJbt", 5));
_qj757 = API.createAd();
addChild(_qj757);
_qj757.x = (_bx358 - (_qj757.width >> 1));
_qj757.y = (_ri788 - (_qj757.height >> 1));
_jp365 = true;
_dt847 = true;
_fq305 = true;
_aw673 = (_rd609 - 16);
break;
case _tm724:
_de97 = true;
_jp365 = true;
_dt847 = true;
break;
case _lv456:
_un836[0] = irrcrpt("gmbtihbnfmjdfotf.dpn", 1);
_un836[1] = irrcrpt("ogicfgx.eq.wm", 2);
_jp365 = true;
_dt847 = true;
break;
case _vy841:
_un836[0] = irrcrpt("ogicfgx.eq.wm", 2);
_de97 = false;
_jp365 = true;
_dt847 = true;
_hx159 = true;
break;
case _nr640:
_jp365 = true;
_dt847 = true;
if (host.length > 0){
_ho938 = false;
};
break;
case _mx778:
_nh245 = true;
_bf448 = false;
break;
case _la384:
_ji476 = false;
_ku255 = "";
_at261 = "";
break;
case _lx61:
_ji476 = false;
_ku255 = "";
_at261 = "";
break;
case _uy796:
_ad450 = LoaderInfo(root.loaderInfo).parameters;
_ey973 = ((_ad450.kongregate_api_path) || (irrcrpt("myyu://bbb.ptslwjlfyj.htr/kqfxm/FUN_FX8_Qthfq.xbk", 5)));
Security.allowDomain(_ey973);
request = new URLRequest(_ey973);
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, _vg471);
loader.load(request);
this.addChild(loader);
break;
};
trace(irrcrpt("xibu???", 1));
if (_ho938){
_ho938 = (_un836[0] == undefined);
_ob238 = 0;
while (_ob238 < _un836.length) {
trace((((irrcrpt("wmxi_psgo_yvp[", 4) + _ob238) + irrcrpt("] = ", 2)) + _un836[_ob238]));
if (((!((_un836[_ob238] == undefined))) && (!((host.indexOf(_un836[_ob238]) == -1))))){
trace(irrcrpt("xnyj nx tp!", 5));
_ho938 = true;
_ob238 = _un836.length;
};
_ob238 = (_ob238 + 1);
};
};
if (_ho938){
_mj215 = !(_fq305);
try {
if (((((_de97) || (_uy339))) || (_jp365))){
MochiServices.connect(_cr555, root, _mk971);
};
if (_de97){
MochiAd.showPreGameAd({clip:root, id:_cr555, res:irrcrpt("973a713", 3), background:13429999, color:7321558, outline:7321558, no_bg:true, ad_finished:_ta114, ad_failed:_ta114, ad_skipped:_ta114});
_lv839 = false;
};
if (_nh245){
MindJoltAPI.service.connect(_nl310, this, null);
MindJoltAPI.ad.showPreGameAd({clip:this, ad_started:null, ad_finished:_jo433});
_lv839 = false;
};
} catch(error:Error) {
};
if (_fp899.length > 0){
_ut387 = new Sprite();
switch (version){
case _mb185:
_ut387.addChild(Bitmap(new _uw88()));
break;
case _uy796:
break;
};
_ut387.x = (_bx358 - (_ut387.width >> 1));
_ut387.y = (_ri788 - (_ut387.height >> 1));
_ut387.addEventListener(MouseEvent.MOUSE_DOWN, _he624);
_ut387.tabEnabled = false;
_ut387.buttonMode = true;
addChild(_ut387);
};
_na614 = ((!(_nh245)) && (!(_de97)));
trace((irrcrpt("xmtb_uwtlwjxx_gfw = ", 5) + _na614));
stop();
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
stage.focus = this;
addEventListener(Event.ENTER_FRAME, tick);
} else {
_id428 = new TextFormat();
_id428.font = irrcrpt("Duldo", 3);
_id428.size = 16;
_id428.color = 0xFFFFFF;
_xj418 = new TextField();
_xj418.defaultTextFormat = _id428;
_xj418.text = _bu122;
_xj418.width = _al555;
_xj418.wordWrap = true;
addChild(_xj418);
_xj418.x = 40;
_xj418.y = 220;
};
}
final private function _ta114():void{
trace(irrcrpt("npdijBetEpof()", 1));
_lv839 = true;
if (_nt564()){
_yl443 = true;
};
}
final private function init():void{
var _local2:Object;
trace(irrcrpt("lqlw()", 3));
if (_qj757 != null){
SoundMixer.stopAll();
_qj757.removeAd();
};
removeEventListener(Event.ENTER_FRAME, tick);
_am804 = null;
_yg121 = null;
nextFrame();
var _local1:Class = Class(getDefinitionByName(irrcrpt("Rfns", 5)));
if (_local1){
_local2 = new (_local1);
addChild((_local2 as DisplayObject));
};
}
final private function _xy281():void{
play();
}
public function tick(_arg1:Event):void{
if (_yl481){
if (_xl794 < root.loaderInfo.bytesTotal){
_xl794 = (_xl794 + 10000);
};
_du406 = Math.min(root.loaderInfo.bytesTotal, _xl794);
} else {
_du406 = root.loaderInfo.bytesLoaded;
};
if (((((_fq305) && (!(_mj215)))) && ((_lt378 == null)))){
if (_nt564()){
_lt378 = new Sprite();
_lt378.addChild(Bitmap(new _ss358()));
_lt378.x = (_bx358 - (_lt378.width >> 1));
_lt378.y = ((_rd609 - 16) - _lt378.height);
_lt378.addEventListener(MouseEvent.MOUSE_DOWN, _qp879);
_lt378.tabEnabled = false;
_lt378.buttonMode = true;
addChild(_lt378);
};
};
graphics.clear();
graphics.beginBitmapFill(_yg121, null, false, false);
graphics.drawRect(0, 0, _al555, _rd609);
if (((_na614) && (!(_nt564())))){
graphics.beginFill(13429999);
graphics.drawRect(16, _aw673, (_al555 - 32), 12);
graphics.beginFill(7321558);
graphics.drawRect(17, (_aw673 + 1), (_al555 - 34), 10);
graphics.beginFill(13429999);
graphics.drawRect(16, _aw673, ((_al555 - 32) * (_du406 / root.loaderInfo.bytesTotal)), 12);
};
graphics.endFill();
if (_tt668 > 0){
graphics.beginFill(0, Math.min(1, _tt668));
graphics.drawRect(0, 0, _al555, _rd609);
graphics.endFill();
};
if (!_yl443){
if (((_lv839) && (_nt564()))){
if (!_fq305){
_yl443 = true;
} else {
if ((((((version == _wy814)) && (_mj215))) && ((_xm605 > 0)))){
if (--_xm605 <= 0){
_yl443 = true;
};
};
};
};
} else {
if ((_tt668 = (_tt668 + 0.05)) > 2){
init();
};
};
}
final private function _qp879(_arg1:MouseEvent):void{
_mj215 = true;
_lt378.removeEventListener(MouseEvent.MOUSE_DOWN, _qp879, false);
removeChild(_lt378);
_lt378 = null;
if (version == _wy814){
_ut387 = new _ty173();
_ut387.x = 45;
_ut387.y = 45;
_ut387.addEventListener(MouseEvent.MOUSE_DOWN, _he624);
_ut387.buttonMode = true;
_ut387.tabEnabled = false;
addChild(_ut387);
} else {
_yl443 = true;
};
}
final private function _nt564():Boolean{
if (_du406 >= root.loaderInfo.bytesTotal){
return (true);
};
return (false);
}
final private function _jo433():void{
trace(irrcrpt("qmrhNspxEhWlsar()", 4));
_lv839 = true;
if (_nt564()){
_yl443 = true;
};
}
final private function _vg471(_arg1:Event):void{
_oy156 = _arg1.target.content;
_oy156.services.connect();
}
final private function _he624(_arg1:MouseEvent):void{
_ut387.removeEventListener(MouseEvent.MOUSE_DOWN, _he624, false);
navigateToURL(new URLRequest(_fp899), irrcrpt("_cmbol", 1));
if (version == _wy814){
_ut387.buttonMode = false;
} else {
removeChild(_ut387);
_ut387 = null;
};
}
final private function _mk971(_arg1:String):void{
trace(((irrcrpt("oqejkUgtxkeguGttqt(", 2) + _arg1) + ")"));
}
}
}//package
Section 201
//Preloader__am804 (Preloader__am804)
package {
import mx.core.*;
public class Preloader__am804 extends BitmapAsset {
}
}//package
Section 202
//Preloader__ss358 (Preloader__ss358)
package {
import mx.core.*;
public class Preloader__ss358 extends BitmapAsset {
}
}//package
Section 203
//Preloader__ty173 (Preloader__ty173)
package {
import mx.core.*;
import flash.utils.*;
public class Preloader__ty173 extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Preloader__ty173(){
dataClass = Preloader__ty173_dataClass;
super();
initialWidth = (11000 / 20);
initialHeight = (8000 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package
Section 204
//Preloader__ty173_dataClass (Preloader__ty173_dataClass)
package {
import mx.core.*;
public class Preloader__ty173_dataClass extends ByteArrayAsset {
}
}//package
Section 205
//Preloader__uw88 (Preloader__uw88)
package {
import mx.core.*;
public class Preloader__uw88 extends BitmapAsset {
}
}//package
Section 206
//Res (Res)
package {
import flash.display.*;
import flash.media.*;
import flash.utils.*;
public class Res {
public static const _dn90:Class = Res__dn90;
public static const _uw88:Class = Res__uw88;
public static const _sh789:Array = [new _fh389(), new _na490(), new _yd861()];
public static const _qg857:BitmapData = Bitmap(new _cl953()).bitmapData;
public static const _pe519:Class = Res__pe519;
public static const _ei484:Class = Res__ei484;
public static const _hd433:Class = Res__hd433;
public static const _sf132:Class = Res__sf132;
public static const _uy807:Class = Res__uy807;
public static const _gn652:BitmapData = Bitmap(new _vw313()).bitmapData;
public static const _ir861:Class = Res__ir861;
public static const _mx164:Array = [Bitmap(new _wm479()).bitmapData, Bitmap(new _uv107()).bitmapData, Bitmap(new _mj166()).bitmapData, Bitmap(new _gk238()).bitmapData, Bitmap(new _dx543()).bitmapData, Bitmap(new _lg915()).bitmapData, Bitmap(new _gk849()).bitmapData, Bitmap(new _hd433()).bitmapData, Bitmap(new _ee895()).bitmapData, Bitmap(new _fi57()).bitmapData];
public static const _ht448:BitmapData = Bitmap(new _kp326()).bitmapData;
public static const _ix836:Class = Res__ix836;
public static const _dt328:Sound = new _st146();
public static const _xr71:Class = Res__xr71;
public static const _vw313:Class = Res__vw313;
public static const _ai98:Array = [new _gg126(), new _tv135(), new _ma494()];
public static const _mm733:Class = Res__mm733;
public static const _sn428:Sound = new _hi716();
public static const _is161:BitmapData = Bitmap(new _fj359()).bitmapData;
public static const _ap453:Class = Res__ap453;
public static const _cp172:Class = Res__cp172;
public static const _bk485:Class = Res__bk485;
public static const _rh647:Class = Res__rh647;
public static const _kj982:Class = Res__kj982;
public static const _lx257:Class = Res__lx257;
public static const _gt537:Array = [new _tq46(), new _rq537(), new _lx257()];
public static const _cn439:Array = [new _bw863(), new _ny225(), new _io871()];
public static const _sv950:Class = Res__sv950;
public static const _va577:Class = Res__va577;
public static const _gg126:Class = Res__gg126;
public static const _gk849:Class = Res__gk849;
public static const _ne701:Sound = new _mu850();
public static const _jt851:Array = [new _be797(), new _mf100(), new _cp172()];
public static const _tf514:Array = [Bitmap(new _gw158()).bitmapData, Bitmap(new _rn463()).bitmapData, Bitmap(new _aq495()).bitmapData, Bitmap(new _xk263()).bitmapData, Bitmap(new _dn90()).bitmapData, Bitmap(new _pe519()).bitmapData, Bitmap(new _gm804()).bitmapData, Bitmap(new _rg154()).bitmapData, Bitmap(new _iv134()).bitmapData, Bitmap(new _cp948()).bitmapData, Bitmap(new _py896()).bitmapData, Bitmap(new _ci734()).bitmapData, Bitmap(new _du174()).bitmapData, Bitmap(new _sd298()).bitmapData];
public static const _wv719:Class = Res__wv719;
public static const _jq357:Class = Res__jq357;
public static const _kp983:Class = Res__kp983;
public static const _qr521:BitmapData = Bitmap(new _gw158()).bitmapData;
public static const _px942:Class = Res__px942;
public static const _rm552:BitmapData = Bitmap(new _ex524()).bitmapData;
public static const _iq796:Class = Res__iq796;
public static const _wm479:Class = Res__wm479;
public static const _pd589:Class = Res__pd589;
public static const _dt114:Class = Res__dt114;
public static const _cl953:Class = Res__cl953;
public static const _wj879:Class = Res__wj879;
public static const _gm804:Class = Res__gm804;
public static const _id150:Sound = new _ja722();
public static const _ur895:Class = Res__ur895;
public static const _jy892:Array = [new _vw585(), new _pd589(), new _dt516()];
public static const _bm570:Class = Res__bm570;
public static const _ex524:Class = Res__ex524;
public static const _tq46:Class = Res__tq46;
public static const _cd569:Class = Res__cd569;
public static const _mf100:Class = Res__mf100;
public static const _ga179:Class = Res__ga179;
public static const _gw158:Class = Res__gw158;
public static const _uv107:Class = Res__uv107;
public static const _mm419:BitmapData = Bitmap(new _go699()).bitmapData;
public static const _rl807:Class = Res__rl807;
public static const _oa730:Sound = new _fb143();
public static const _xe216:Array = [Bitmap(new _hg448()).bitmapData, Bitmap(new _lx580()).bitmapData, Bitmap(new _la54()).bitmapData, Bitmap(new _rh647()).bitmapData, Bitmap(new _le505()).bitmapData, Bitmap(new _nm71()).bitmapData, Bitmap(new _pg204()).bitmapData, Bitmap(new _ox278()).bitmapData];
public static const _fj191:Class = Res__fj191;
public static const _na490:Class = Res__na490;
public static const _nw470:Array = [[Bitmap(new _nx622()).bitmapData], [Bitmap(new _kp983()).bitmapData, Bitmap(new _ix836()).bitmapData, Bitmap(new _in36()).bitmapData, Bitmap(new _kp983()).bitmapData, Bitmap(new _bm570()).bitmapData, Bitmap(new _in36()).bitmapData], [Bitmap(new _bk485()).bitmapData, Bitmap(new _jq357()).bitmapData, Bitmap(new _hu465()).bitmapData], [Bitmap(new _sf132()).bitmapData], [Bitmap(new _cd569()).bitmapData], [Bitmap(new _uy807()).bitmapData], [Bitmap(new _mx433()).bitmapData], [Bitmap(new _xt196()).bitmapData], [Bitmap(new _mi351()).bitmapData]];
public static const _hu465:Class = Res__hu465;
public static const _lh846:Sound = new _mt92();
public static const _jy417:Class = Res__jy417;
public static const _pp571:Class = Res__pp571;
public static const _ea27:Array = [new _is818(), new _mm733(), new _sk336()];
public static const _yf337:Sound = new _pc95();
public static const _sc247:Class = Res__sc247;
public static const _th179:Sound = new _lo131();
public static const _do803:Array = [new _wv719(), new _jy417(), new _px942()];
public static const _go699:Class = Res__go699;
public static const _wd459:Array = [new _lq201(), new _pw201(), new _en447()];
public static const _lo131:Class = Res__lo131;
public static const _mj166:Class = Res__mj166;
public static const _tr643:Class = Res__tr643;
public static const _pj481:Class = Res__pj481;
public static const _hi716:Class = Res__hi716;
public static const _px744:BitmapData = Bitmap(new _sv950()).bitmapData;
public static const _vw585:Class = Res__vw585;
public static const _kx277:BitmapData = Bitmap(new _qt643()).bitmapData;
public static const _ox278:Class = Res__ox278;
public static const _vc794:Class = Res__vc794;
public static const _iv134:Class = Res__iv134;
public static const _cf770:Class = Res__cf770;
public static const _lq201:Class = Res__lq201;
public static const _yd861:Class = Res__yd861;
public static const _mx433:Class = Res__mx433;
public static const _ai406:BitmapData = Bitmap(new _va577()).bitmapData;
public static const _oj450:BitmapData = Bitmap(new _sc247()).bitmapData;
public static const _be769:BitmapData = Bitmap(new _mv840()).bitmapData;
public static const _ej852:Sound = new _bk765();
public static const _aq495:Class = Res__aq495;
public static const _in36:Class = Res__in36;
public static const _ja722:Class = Res__ja722;
public static const _jt200:BitmapData = Bitmap(new _ms75()).bitmapData;
public static const _fl164:Array = [new _pp571(), new _vc794(), new _tu153()];
public static const _ft87:Bitmap = new _ex56();
public static const _io871:Class = Res__io871;
public static const _qt643:Class = Res__qt643;
public static const _fb143:Class = Res__fb143;
public static const _rn463:Class = Res__rn463;
public static const _mu850:Class = Res__mu850;
public static const _rg154:Class = Res__rg154;
public static const _vt564:Sound = new _fj191();
public static const _tm777:Class = Res__tm777;
public static const _tp803:Class = Res__tp803;
public static const _kp326:Class = Res__kp326;
public static const _pc95:Class = Res__pc95;
public static const _ra610:Class = Res__ra610;
public static const _bo205:BitmapData = Bitmap(new _kj982()).bitmapData;
public static const _ch177:BitmapData = Bitmap(new _rv757()).bitmapData;
public static const _bk765:Class = Res__bk765;
public static const _df594:Class = Res__df594;
public static const _tc749:Array = [new _ur895(), new _ra610(), new _dt114()];
public static const _ny225:Class = Res__ny225;
public static const _pw201:Class = Res__pw201;
public static const _rv757:Class = Res__rv757;
public static const _fe305:Class = Res__fe305;
public static const _wu228:Array = [Bitmap(new _ir861()).bitmapData, Bitmap(new _yy313()).bitmapData];
public static const _ma494:Class = Res__ma494;
public static const _mk720:Array = [new _bd806(), new _nd924(), new _wj879()];
public static const _qf707:int = 5;
public static const _nw83:Sound = new _ng890();
public static const _rm828:Sound = new _mv180();
public static const _pg204:Class = Res__pg204;
public static const _hg448:Class = Res__hg448;
public static const _mv840:Class = Res__mv840;
public static const _ku472:Class = Res__ku472;
public static const _me502:BitmapData = Bitmap(new _rl807()).bitmapData;
public static const _qr911:Class = Res__qr911;
public static const _ex56:Class = Res__ex56;
public static const _yy313:Class = Res__yy313;
public static const _dx543:Class = Res__dx543;
public static const _en447:Class = Res__en447;
public static const _vr74:Class = Res__vr74;
public static const _tg333:BitmapData = Bitmap(new _ap453()).bitmapData;
public static const _be797:Class = Res__be797;
public static const _fi57:Class = Res__fi57;
public static const _pn645:Sound = new _pj481();
public static const _fh389:Class = Res__fh389;
public static const _tu153:Class = Res__tu153;
public static const _tv135:Class = Res__tv135;
public static const _xt196:Class = Res__xt196;
public static const _sk336:Class = Res__sk336;
public static const _bw863:Class = Res__bw863;
public static const _dt516:Class = Res__dt516;
public static const _xk263:Class = Res__xk263;
public static const _du174:Class = Res__du174;
public static const _st146:Class = Res__st146;
public static const _mv180:Class = Res__mv180;
public static const _br741:BitmapData = Bitmap(new _df594()).bitmapData;
public static const _py896:Class = Res__py896;
public static const _hk398:Class = Res__hk398;
public static const _ci734:Class = Res__ci734;
public static const _gk238:Class = Res__gk238;
public static const _ee895:Class = Res__ee895;
public static const _nm71:Class = Res__nm71;
public static const _la54:Class = Res__la54;
public static const _rq537:Class = Res__rq537;
public static const _cx770:Class = Res__cx770;
public static const _bd806:Class = Res__bd806;
public static const _qk755:BitmapData = Bitmap(new _tp803()).bitmapData;
public static const _lg915:Class = Res__lg915;
public static const _sh887:Class = Res__sh887;
public static const _nd924:Class = Res__nd924;
public static const _fj359:Class = Res__fj359;
public static const _mo567:int = 7;
public static const _qp653:Class = Res__qp653;
public static const _wx777:int = 29;
public static const _be106:Class = Res__be106;
public static const _mt92:Class = Res__mt92;
public static const _sd298:Class = Res__sd298;
public static const _ms75:Class = Res__ms75;
public static const _lx580:Class = Res__lx580;
public static const _nx622:Class = Res__nx622;
public static const _cp948:Class = Res__cp948;
public static const _mi351:Class = Res__mi351;
public static const _tq398:Class = Res__tq398;
public static const _ng890:Class = Res__ng890;
public static const _le505:Class = Res__le505;
public static const _is818:Class = Res__is818;
public static var _sc554:XML;
public static var _bw949:BitmapData;
public static function init():void{
switch (Preloader.version){
case Preloader._mb185:
_bw949 = Bitmap(new _uw88()).bitmapData;
break;
case Preloader._wh463:
_bw949 = Bitmap(new _tq398()).bitmapData;
break;
default:
_bw949 = _qk755;
break;
};
}
public static function _vt334():void{
var _local1:ByteArray = new _xr71();
var _local2:String = _local1.readUTFBytes(_local1.length);
_sc554 = new XML(_local2);
}
}
}//package
Section 207
//Res__ap453 (Res__ap453)
package {
import mx.core.*;
public class Res__ap453 extends BitmapAsset {
}
}//package
Section 208
//Res__aq495 (Res__aq495)
package {
import mx.core.*;
public class Res__aq495 extends BitmapAsset {
}
}//package
Section 209
//Res__bd806 (Res__bd806)
package {
import mx.core.*;
public class Res__bd806 extends SoundAsset {
}
}//package
Section 210
//Res__be106 (Res__be106)
package {
import flash.utils.*;
import mx.core.*;
public class Res__be106 extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Res__be106(){
dataClass = Res__be106_dataClass;
super();
initialWidth = (11000 / 20);
initialHeight = (8000 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package
Section 211
//Res__be106_dataClass (Res__be106_dataClass)
package {
import mx.core.*;
public class Res__be106_dataClass extends ByteArrayAsset {
}
}//package
Section 212
//Res__be797 (Res__be797)
package {
import mx.core.*;
public class Res__be797 extends SoundAsset {
}
}//package
Section 213
//Res__bk485 (Res__bk485)
package {
import mx.core.*;
public class Res__bk485 extends BitmapAsset {
}
}//package
Section 214
//Res__bk765 (Res__bk765)
package {
import mx.core.*;
public class Res__bk765 extends SoundAsset {
}
}//package
Section 215
//Res__bm570 (Res__bm570)
package {
import mx.core.*;
public class Res__bm570 extends BitmapAsset {
}
}//package
Section 216
//Res__bw863 (Res__bw863)
package {
import mx.core.*;
public class Res__bw863 extends SoundAsset {
}
}//package
Section 217
//Res__cd569 (Res__cd569)
package {
import mx.core.*;
public class Res__cd569 extends BitmapAsset {
}
}//package
Section 218
//Res__cf770 (Res__cf770)
package {
import mx.core.*;
public class Res__cf770 extends MovieClipAsset {
}
}//package
Section 219
//Res__ci734 (Res__ci734)
package {
import mx.core.*;
public class Res__ci734 extends BitmapAsset {
}
}//package
Section 220
//Res__cl953 (Res__cl953)
package {
import mx.core.*;
public class Res__cl953 extends BitmapAsset {
}
}//package
Section 221
//Res__cp172 (Res__cp172)
package {
import mx.core.*;
public class Res__cp172 extends SoundAsset {
}
}//package
Section 222
//Res__cp948 (Res__cp948)
package {
import mx.core.*;
public class Res__cp948 extends BitmapAsset {
}
}//package
Section 223
//Res__cx770 (Res__cx770)
package {
import mx.core.*;
public class Res__cx770 extends MovieClipAsset {
}
}//package
Section 224
//Res__df594 (Res__df594)
package {
import mx.core.*;
public class Res__df594 extends BitmapAsset {
}
}//package
Section 225
//Res__dn90 (Res__dn90)
package {
import mx.core.*;
public class Res__dn90 extends BitmapAsset {
}
}//package
Section 226
//Res__dt114 (Res__dt114)
package {
import mx.core.*;
public class Res__dt114 extends SoundAsset {
}
}//package
Section 227
//Res__dt516 (Res__dt516)
package {
import mx.core.*;
public class Res__dt516 extends SoundAsset {
}
}//package
Section 228
//Res__du174 (Res__du174)
package {
import mx.core.*;
public class Res__du174 extends BitmapAsset {
}
}//package
Section 229
//Res__dx543 (Res__dx543)
package {
import mx.core.*;
public class Res__dx543 extends BitmapAsset {
}
}//package
Section 230
//Res__ee895 (Res__ee895)
package {
import mx.core.*;
public class Res__ee895 extends BitmapAsset {
}
}//package
Section 231
//Res__ei484 (Res__ei484)
package {
import mx.core.*;
public class Res__ei484 extends MovieClipAsset {
}
}//package
Section 232
//Res__en447 (Res__en447)
package {
import mx.core.*;
public class Res__en447 extends SoundAsset {
}
}//package
Section 233
//Res__ex524 (Res__ex524)
package {
import mx.core.*;
public class Res__ex524 extends BitmapAsset {
}
}//package
Section 234
//Res__ex56 (Res__ex56)
package {
import mx.core.*;
public class Res__ex56 extends BitmapAsset {
}
}//package
Section 235
//Res__fb143 (Res__fb143)
package {
import mx.core.*;
public class Res__fb143 extends SoundAsset {
}
}//package
Section 236
//Res__fe305 (Res__fe305)
package {
import mx.core.*;
public class Res__fe305 extends MovieClipAsset {
}
}//package
Section 237
//Res__fh389 (Res__fh389)
package {
import mx.core.*;
public class Res__fh389 extends SoundAsset {
}
}//package
Section 238
//Res__fi57 (Res__fi57)
package {
import mx.core.*;
public class Res__fi57 extends BitmapAsset {
}
}//package
Section 239
//Res__fj191 (Res__fj191)
package {
import mx.core.*;
public class Res__fj191 extends SoundAsset {
}
}//package
Section 240
//Res__fj359 (Res__fj359)
package {
import mx.core.*;
public class Res__fj359 extends BitmapAsset {
}
}//package
Section 241
//Res__ga179 (Res__ga179)
package {
import mx.core.*;
public class Res__ga179 extends MovieClipAsset {
}
}//package
Section 242
//Res__gg126 (Res__gg126)
package {
import mx.core.*;
public class Res__gg126 extends SoundAsset {
}
}//package
Section 243
//Res__gk238 (Res__gk238)
package {
import mx.core.*;
public class Res__gk238 extends BitmapAsset {
}
}//package
Section 244
//Res__gk849 (Res__gk849)
package {
import mx.core.*;
public class Res__gk849 extends BitmapAsset {
}
}//package
Section 245
//Res__gm804 (Res__gm804)
package {
import mx.core.*;
public class Res__gm804 extends BitmapAsset {
}
}//package
Section 246
//Res__go699 (Res__go699)
package {
import mx.core.*;
public class Res__go699 extends BitmapAsset {
}
}//package
Section 247
//Res__gw158 (Res__gw158)
package {
import mx.core.*;
public class Res__gw158 extends BitmapAsset {
}
}//package
Section 248
//Res__hd433 (Res__hd433)
package {
import mx.core.*;
public class Res__hd433 extends BitmapAsset {
}
}//package
Section 249
//Res__hg448 (Res__hg448)
package {
import mx.core.*;
public class Res__hg448 extends BitmapAsset {
}
}//package
Section 250
//Res__hi716 (Res__hi716)
package {
import mx.core.*;
public class Res__hi716 extends SoundAsset {
}
}//package
Section 251
//Res__hk398 (Res__hk398)
package {
import mx.core.*;
public class Res__hk398 extends MovieClipAsset {
}
}//package
Section 252
//Res__hu465 (Res__hu465)
package {
import mx.core.*;
public class Res__hu465 extends BitmapAsset {
}
}//package
Section 253
//Res__in36 (Res__in36)
package {
import mx.core.*;
public class Res__in36 extends BitmapAsset {
}
}//package
Section 254
//Res__io871 (Res__io871)
package {
import mx.core.*;
public class Res__io871 extends SoundAsset {
}
}//package
Section 255
//Res__iq796 (Res__iq796)
package {
import mx.core.*;
public class Res__iq796 extends BitmapAsset {
}
}//package
Section 256
//Res__ir861 (Res__ir861)
package {
import mx.core.*;
public class Res__ir861 extends BitmapAsset {
}
}//package
Section 257
//Res__is818 (Res__is818)
package {
import mx.core.*;
public class Res__is818 extends SoundAsset {
}
}//package
Section 258
//Res__iv134 (Res__iv134)
package {
import mx.core.*;
public class Res__iv134 extends BitmapAsset {
}
}//package
Section 259
//Res__ix836 (Res__ix836)
package {
import mx.core.*;
public class Res__ix836 extends BitmapAsset {
}
}//package
Section 260
//Res__ja722 (Res__ja722)
package {
import mx.core.*;
public class Res__ja722 extends SoundAsset {
}
}//package
Section 261
//Res__jq357 (Res__jq357)
package {
import mx.core.*;
public class Res__jq357 extends BitmapAsset {
}
}//package
Section 262
//Res__jy417 (Res__jy417)
package {
import mx.core.*;
public class Res__jy417 extends SoundAsset {
}
}//package
Section 263
//Res__kj982 (Res__kj982)
package {
import mx.core.*;
public class Res__kj982 extends BitmapAsset {
}
}//package
Section 264
//Res__kp326 (Res__kp326)
package {
import mx.core.*;
public class Res__kp326 extends BitmapAsset {
}
}//package
Section 265
//Res__kp983 (Res__kp983)
package {
import mx.core.*;
public class Res__kp983 extends BitmapAsset {
}
}//package
Section 266
//Res__ku472 (Res__ku472)
package {
import flash.utils.*;
import mx.core.*;
public class Res__ku472 extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Res__ku472(){
dataClass = Res__ku472_dataClass;
super();
initialWidth = (0x3200 / 20);
initialHeight = (9600 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package
Section 267
//Res__ku472_dataClass (Res__ku472_dataClass)
package {
import mx.core.*;
public class Res__ku472_dataClass extends ByteArrayAsset {
}
}//package
Section 268
//Res__la54 (Res__la54)
package {
import mx.core.*;
public class Res__la54 extends BitmapAsset {
}
}//package
Section 269
//Res__le505 (Res__le505)
package {
import mx.core.*;
public class Res__le505 extends BitmapAsset {
}
}//package
Section 270
//Res__lg915 (Res__lg915)
package {
import mx.core.*;
public class Res__lg915 extends BitmapAsset {
}
}//package
Section 271
//Res__lo131 (Res__lo131)
package {
import mx.core.*;
public class Res__lo131 extends SoundAsset {
}
}//package
Section 272
//Res__lq201 (Res__lq201)
package {
import mx.core.*;
public class Res__lq201 extends SoundAsset {
}
}//package
Section 273
//Res__lx257 (Res__lx257)
package {
import mx.core.*;
public class Res__lx257 extends SoundAsset {
}
}//package
Section 274
//Res__lx580 (Res__lx580)
package {
import mx.core.*;
public class Res__lx580 extends BitmapAsset {
}
}//package
Section 275
//Res__ma494 (Res__ma494)
package {
import mx.core.*;
public class Res__ma494 extends SoundAsset {
}
}//package
Section 276
//Res__mf100 (Res__mf100)
package {
import mx.core.*;
public class Res__mf100 extends SoundAsset {
}
}//package
Section 277
//Res__mi351 (Res__mi351)
package {
import mx.core.*;
public class Res__mi351 extends BitmapAsset {
}
}//package
Section 278
//Res__mj166 (Res__mj166)
package {
import mx.core.*;
public class Res__mj166 extends BitmapAsset {
}
}//package
Section 279
//Res__mm733 (Res__mm733)
package {
import mx.core.*;
public class Res__mm733 extends SoundAsset {
}
}//package
Section 280
//Res__ms75 (Res__ms75)
package {
import mx.core.*;
public class Res__ms75 extends BitmapAsset {
}
}//package
Section 281
//Res__mt92 (Res__mt92)
package {
import mx.core.*;
public class Res__mt92 extends SoundAsset {
}
}//package
Section 282
//Res__mu850 (Res__mu850)
package {
import mx.core.*;
public class Res__mu850 extends SoundAsset {
}
}//package
Section 283
//Res__mv180 (Res__mv180)
package {
import mx.core.*;
public class Res__mv180 extends SoundAsset {
}
}//package
Section 284
//Res__mv840 (Res__mv840)
package {
import mx.core.*;
public class Res__mv840 extends BitmapAsset {
}
}//package
Section 285
//Res__mx433 (Res__mx433)
package {
import mx.core.*;
public class Res__mx433 extends BitmapAsset {
}
}//package
Section 286
//Res__na490 (Res__na490)
package {
import mx.core.*;
public class Res__na490 extends SoundAsset {
}
}//package
Section 287
//Res__nd924 (Res__nd924)
package {
import mx.core.*;
public class Res__nd924 extends SoundAsset {
}
}//package
Section 288
//Res__ng890 (Res__ng890)
package {
import mx.core.*;
public class Res__ng890 extends SoundAsset {
}
}//package
Section 289
//Res__nm71 (Res__nm71)
package {
import mx.core.*;
public class Res__nm71 extends BitmapAsset {
}
}//package
Section 290
//Res__nx622 (Res__nx622)
package {
import mx.core.*;
public class Res__nx622 extends BitmapAsset {
}
}//package
Section 291
//Res__ny225 (Res__ny225)
package {
import mx.core.*;
public class Res__ny225 extends SoundAsset {
}
}//package
Section 292
//Res__ox278 (Res__ox278)
package {
import mx.core.*;
public class Res__ox278 extends BitmapAsset {
}
}//package
Section 293
//Res__pc95 (Res__pc95)
package {
import mx.core.*;
public class Res__pc95 extends SoundAsset {
}
}//package
Section 294
//Res__pd589 (Res__pd589)
package {
import mx.core.*;
public class Res__pd589 extends SoundAsset {
}
}//package
Section 295
//Res__pe519 (Res__pe519)
package {
import mx.core.*;
public class Res__pe519 extends BitmapAsset {
}
}//package
Section 296
//Res__pg204 (Res__pg204)
package {
import mx.core.*;
public class Res__pg204 extends BitmapAsset {
}
}//package
Section 297
//Res__pj481 (Res__pj481)
package {
import mx.core.*;
public class Res__pj481 extends SoundAsset {
}
}//package
Section 298
//Res__pp571 (Res__pp571)
package {
import mx.core.*;
public class Res__pp571 extends SoundAsset {
}
}//package
Section 299
//Res__pw201 (Res__pw201)
package {
import mx.core.*;
public class Res__pw201 extends SoundAsset {
}
}//package
Section 300
//Res__px942 (Res__px942)
package {
import mx.core.*;
public class Res__px942 extends SoundAsset {
}
}//package
Section 301
//Res__py896 (Res__py896)
package {
import mx.core.*;
public class Res__py896 extends BitmapAsset {
}
}//package
Section 302
//Res__qp653 (Res__qp653)
package {
import mx.core.*;
public class Res__qp653 extends MovieClipAsset {
}
}//package
Section 303
//Res__qr911 (Res__qr911)
package {
import flash.utils.*;
import mx.core.*;
public class Res__qr911 extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Res__qr911(){
dataClass = Res__qr911_dataClass;
super();
initialWidth = (11000 / 20);
initialHeight = (8000 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package
Section 304
//Res__qr911_dataClass (Res__qr911_dataClass)
package {
import mx.core.*;
public class Res__qr911_dataClass extends ByteArrayAsset {
}
}//package
Section 305
//Res__qt643 (Res__qt643)
package {
import mx.core.*;
public class Res__qt643 extends BitmapAsset {
}
}//package
Section 306
//Res__ra610 (Res__ra610)
package {
import mx.core.*;
public class Res__ra610 extends SoundAsset {
}
}//package
Section 307
//Res__rg154 (Res__rg154)
package {
import mx.core.*;
public class Res__rg154 extends BitmapAsset {
}
}//package
Section 308
//Res__rh647 (Res__rh647)
package {
import mx.core.*;
public class Res__rh647 extends BitmapAsset {
}
}//package
Section 309
//Res__rl807 (Res__rl807)
package {
import mx.core.*;
public class Res__rl807 extends BitmapAsset {
}
}//package
Section 310
//Res__rn463 (Res__rn463)
package {
import mx.core.*;
public class Res__rn463 extends BitmapAsset {
}
}//package
Section 311
//Res__rq537 (Res__rq537)
package {
import mx.core.*;
public class Res__rq537 extends SoundAsset {
}
}//package
Section 312
//Res__rv757 (Res__rv757)
package {
import mx.core.*;
public class Res__rv757 extends BitmapAsset {
}
}//package
Section 313
//Res__sc247 (Res__sc247)
package {
import mx.core.*;
public class Res__sc247 extends BitmapAsset {
}
}//package
Section 314
//Res__sd298 (Res__sd298)
package {
import mx.core.*;
public class Res__sd298 extends BitmapAsset {
}
}//package
Section 315
//Res__sf132 (Res__sf132)
package {
import mx.core.*;
public class Res__sf132 extends BitmapAsset {
}
}//package
Section 316
//Res__sh887 (Res__sh887)
package {
import flash.utils.*;
import mx.core.*;
public class Res__sh887 extends MovieClipLoaderAsset {
public var dataClass:Class;
private static var bytes:ByteArray = null;
public function Res__sh887(){
dataClass = Res__sh887_dataClass;
super();
initialWidth = (11000 / 20);
initialHeight = (8000 / 20);
}
override public function get movieClipData():ByteArray{
if (bytes == null){
bytes = ByteArray(new dataClass());
};
return (bytes);
}
}
}//package
Section 317
//Res__sh887_dataClass (Res__sh887_dataClass)
package {
import mx.core.*;
public class Res__sh887_dataClass extends ByteArrayAsset {
}
}//package
Section 318
//Res__sk336 (Res__sk336)
package {
import mx.core.*;
public class Res__sk336 extends SoundAsset {
}
}//package
Section 319
//Res__st146 (Res__st146)
package {
import mx.core.*;
public class Res__st146 extends SoundAsset {
}
}//package
Section 320
//Res__sv950 (Res__sv950)
package {
import mx.core.*;
public class Res__sv950 extends BitmapAsset {
}
}//package
Section 321
//Res__tm777 (Res__tm777)
package {
import mx.core.*;
public class Res__tm777 extends MovieClipAsset {
}
}//package
Section 322
//Res__tp803 (Res__tp803)
package {
import mx.core.*;
public class Res__tp803 extends BitmapAsset {
}
}//package
Section 323
//Res__tq398 (Res__tq398)
package {
import mx.core.*;
public class Res__tq398 extends BitmapAsset {
}
}//package
Section 324
//Res__tq46 (Res__tq46)
package {
import mx.core.*;
public class Res__tq46 extends SoundAsset {
}
}//package
Section 325
//Res__tr643 (Res__tr643)
package {
import mx.core.*;
public class Res__tr643 extends MovieClipAsset {
}
}//package
Section 326
//Res__tu153 (Res__tu153)
package {
import mx.core.*;
public class Res__tu153 extends SoundAsset {
}
}//package
Section 327
//Res__tv135 (Res__tv135)
package {
import mx.core.*;
public class Res__tv135 extends SoundAsset {
}
}//package
Section 328
//Res__ur895 (Res__ur895)
package {
import mx.core.*;
public class Res__ur895 extends SoundAsset {
}
}//package
Section 329
//Res__uv107 (Res__uv107)
package {
import mx.core.*;
public class Res__uv107 extends BitmapAsset {
}
}//package
Section 330
//Res__uw88 (Res__uw88)
package {
import mx.core.*;
public class Res__uw88 extends BitmapAsset {
}
}//package
Section 331
//Res__uy807 (Res__uy807)
package {
import mx.core.*;
public class Res__uy807 extends BitmapAsset {
}
}//package
Section 332
//Res__va577 (Res__va577)
package {
import mx.core.*;
public class Res__va577 extends BitmapAsset {
}
}//package
Section 333
//Res__vc794 (Res__vc794)
package {
import mx.core.*;
public class Res__vc794 extends SoundAsset {
}
}//package
Section 334
//Res__wj879 (Res__wj879)
package {
import mx.core.*;
public class Res__wj879 extends SoundAsset {
}
}//package
Section 335
//Res__wm479 (Res__wm479)
package {
import mx.core.*;
public class Res__wm479 extends BitmapAsset {
}
}//package
Section 336
//Res__vr74 (Res__vr74)
package {
import mx.core.*;
public class Res__vr74 extends MovieClipAsset {
}
}//package
Section 337
//Res__vw313 (Res__vw313)
package {
import mx.core.*;
public class Res__vw313 extends BitmapAsset {
}
}//package
Section 338
//Res__vw585 (Res__vw585)
package {
import mx.core.*;
public class Res__vw585 extends SoundAsset {
}
}//package
Section 339
//Res__wv719 (Res__wv719)
package {
import mx.core.*;
public class Res__wv719 extends SoundAsset {
}
}//package
Section 340
//Res__xk263 (Res__xk263)
package {
import mx.core.*;
public class Res__xk263 extends BitmapAsset {
}
}//package
Section 341
//Res__xr71 (Res__xr71)
package {
import mx.core.*;
public class Res__xr71 extends ByteArrayAsset {
}
}//package
Section 342
//Res__xt196 (Res__xt196)
package {
import mx.core.*;
public class Res__xt196 extends BitmapAsset {
}
}//package
Section 343
//Res__yd861 (Res__yd861)
package {
import mx.core.*;
public class Res__yd861 extends SoundAsset {
}
}//package
Section 344
//Res__yy313 (Res__yy313)
package {
import mx.core.*;
public class Res__yy313 extends BitmapAsset {
}
}//package
Section 345
//Stats (Stats)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.text.*;
import flash.system.*;
public class Stats extends Sprite {
protected const WIDTH:uint = 70;
protected const _gs416:uint = 100;
protected var _oc159:uint;
protected var timer:uint;
protected var _te977:uint;
protected var _cd197:Rectangle;
protected var _rw884:Object;
protected var _ci562:uint;
protected var xml:XML;
protected var _ql37:Bitmap;
protected var _xp278:uint;
protected var _xh950:Number;
protected var fps:uint;
protected var text:TextField;
protected var style:StyleSheet;
protected var _uo575:uint;
protected var _lr809:Number;
public function Stats(_arg1:Object=null):void{
_rw884 = {bg:51, fps:0xFFFF00, _te977:0xFF00, _xh950:0xFFFF, memmax:0xFF0070};
super();
if (_arg1){
if (_arg1.bg != null){
_rw884.bg = _arg1.bg;
};
if (_arg1.fps != null){
_rw884.fps = _arg1.fps;
};
if (_arg1._te977 != null){
_rw884._te977 = _arg1._te977;
};
if (_arg1._xh950 != null){
_rw884._xh950 = _arg1._xh950;
};
if (_arg1.memmax != null){
_rw884.memmax = _arg1.memmax;
};
};
_lr809 = 0;
xml = <xml><fps>FPS:</fps><_te977>MS:</_te977><_xh950>MEM:</_xh950><memMax>MAX:</memMax></xml>
;
style = new StyleSheet();
style.setStyle(irrcrpt("apo", 3), {fontSize:irrcrpt("0qy", 1), fontFamily:irrcrpt("_werw", 4), leading:irrcrpt("-5sa", 3)});
style.setStyle(irrcrpt("isv", 3), {color:_gm102(_rw884.fps)});
style.setStyle(irrcrpt("nt", 1), {color:_gm102(_rw884._te977)});
style.setStyle(irrcrpt("ogo", 2), {color:_gm102(_rw884._xh950)});
style.setStyle(irrcrpt("ogoOcz", 2), {color:_gm102(_rw884.memmax)});
text = new TextField();
text.width = WIDTH;
text.height = 50;
text.styleSheet = style;
text.condenseWhite = true;
text.selectable = false;
text.mouseEnabled = false;
_ql37 = new Bitmap();
_ql37.y = 50;
_cd197 = new Rectangle((WIDTH - 1), 0, 1, (_gs416 - 50));
addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
addEventListener(Event.REMOVED_FROM_STAGE, _pg113, false, 0, true);
}
private function _gm102(_arg1:int):String{
return (("#" + _arg1.toString(16)));
}
private function init(_arg1:Event):void{
graphics.beginFill(_rw884.bg);
graphics.drawRect(0, 0, WIDTH, _gs416);
graphics.endFill();
addChild(text);
_ql37.bitmapData = new BitmapData(WIDTH, (_gs416 - 50), false, _rw884.bg);
addChild(_ql37);
addEventListener(MouseEvent.CLICK, _dm574);
addEventListener(Event.ENTER_FRAME, update);
}
private function update(_arg1:Event):void{
timer = getTimer();
if ((timer - 1000) > _uo575){
_uo575 = timer;
_xh950 = Number((System.totalMemory * 9.54E-7).toFixed(3));
_lr809 = ((_lr809 > _xh950)) ? _lr809 : _xh950;
_ci562 = Math.min(_ql37.height, ((fps / stage.frameRate) * _ql37.height));
_xp278 = (Math.min(_ql37.height, Math.sqrt(Math.sqrt((_xh950 * 5000)))) - 2);
_oc159 = (Math.min(_ql37.height, Math.sqrt(Math.sqrt((_lr809 * 5000)))) - 2);
_ql37.bitmapData.scroll(-1, 0);
_ql37.bitmapData.fillRect(_cd197, _rw884.bg);
_ql37.bitmapData.setPixel((_ql37.width - 1), (_ql37.height - _ci562), _rw884.fps);
_ql37.bitmapData.setPixel((_ql37.width - 1), (_ql37.height - ((timer - _te977) >> 1)), _rw884._te977);
_ql37.bitmapData.setPixel((_ql37.width - 1), (_ql37.height - _xp278), _rw884._xh950);
_ql37.bitmapData.setPixel((_ql37.width - 1), (_ql37.height - _oc159), _rw884.memmax);
xml.fps = (((irrcrpt("ISV: ", 3) + fps) + irrcrpt(" / ", 3)) + stage.frameRate);
xml._xh950 = (irrcrpt("PHP: ", 3) + _xh950);
xml.memMax = (irrcrpt("NBY: ", 1) + _lr809);
fps = 0;
};
fps++;
xml._te977 = (irrcrpt("QW: ", 4) + (timer - _te977));
_te977 = timer;
text.htmlText = xml;
}
private function _dm574(_arg1:MouseEvent):void{
if (((mouseY / height) > 0.5)){
stage.frameRate--;
} else {
stage.frameRate++;
};
xml.fps = (((irrcrpt("JTW: ", 4) + fps) + irrcrpt(" / ", 1)) + stage.frameRate);
text.htmlText = xml;
}
private function _pg113(_arg1:Event):void{
graphics.clear();
while (numChildren > 0) {
removeChildAt(0);
};
_ql37.bitmapData.dispose();
removeEventListener(MouseEvent.CLICK, _dm574);
removeEventListener(Event.ENTER_FRAME, update);
}
}
}//package
Section 346
//Utils (Utils)
package {
public class Utils {
public static function _fl742(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (Math.atan2((_arg2 - _arg4), (_arg1 - _arg3)));
}
public static function _vo232(_arg1:int, _arg2:int, _arg3:int, _arg4:int):Number{
return (Math.sqrt((Math.pow((_arg1 - _arg3), 2) + Math.pow((_arg2 - _arg4), 2))));
}
public static function _km167(_arg1:Number):String{
var _local2:String = String(_arg1);
var _local3 = "";
var _local4:String = ((_local2.indexOf(".") == -1)) ? _local2 : _local2.substr(0, _local2.indexOf("."));
var _local5:int = _local4.length;
while (_local5 >= 0) {
_local3 = (_local4.substr(_local5, 1) + _local3);
if ((((((((_local4.length - _local5) % 3) == 0)) && ((_local5 < _local4.length)))) && ((_local5 > 0)))){
_local3 = ("," + _local3);
};
_local5--;
};
return (_local3);
}
public static function _wy927(_arg1:Number, _arg2:Boolean):String{
var _local4:Number;
var _local3:int = Math.floor((_arg1 / 3600000));
_local4 = (_arg1 - (_local3 * 3600000));
var _local5:int = Math.floor((_local4 / 60000));
_local4 = (_local4 - (_local5 * 60000));
var _local6:int = Math.floor((_local4 / 1000));
_local4 = (_local4 - (_local6 * 1000));
return (((((((_arg2) ? (_local3.toString() + ":") : "" + ((_local5 < 10)) ? "0" : "") + _local5.toString()) + ":") + ((_local6 < 10)) ? "0" : "") + _local6.toString()));
}
}
}//package