STORY   LOOP   FURRY   PORN   GAMES
• C •   SERVICES [?] [R] RND   POPULAR
Archived flashes:
229595
/disc/ · /res/     /show/ · /fap/ · /gg/ · /swf/P0001 · P2595 · P5190

<div style="position:absolute;top:-99px;left:-99px;"><img src="http://swfchan.com:57475/68711372?noj=FRM68711372-22DC" width="1" height="1"></div>

Puzzle & Brain & Match 3 - Bomboozle 2.swf

This is the info page for
Flash #231559

(Click the ID number above for more basic data on this flash file.)


ActionScript [AS3]
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
//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 12
//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 13
//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 14
//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 15
//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 16
//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 17
//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 18
//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 19
//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 20
//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 21
//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 22
//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 23
//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 24
//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 25
//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 26
//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 27
//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 28
//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 29
//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 30
//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 31
//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 32
//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 33
//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 34
//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 35
//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 36
//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 37
//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 38
//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 39
//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 40
//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 41
//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 42
//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 43
//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 44
//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 45
//IBorder (mx.core.IBorder) package mx.core { public interface IBorder { function get borderMetrics():EdgeMetrics; } }//package mx.core
Section 46
//IFlexAsset (mx.core.IFlexAsset) package mx.core { public interface IFlexAsset { } }//package mx.core
Section 47
//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 48
//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 49
//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 50
//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 51
//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 52
//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 53
//NameUtil (mx.utils.NameUtil) package mx.utils { import flash.display.*; import flash.utils.*; import mx.core.*; public class NameUtil { mx_internal static const VERSION:String = "3.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 54
//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 55
//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 56
//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 57
//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 58
//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 59
//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 60
//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 61
//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 62
//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 63
//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 64
//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 65
//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 66
//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 67
//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 68
//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 69
//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 70
//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 71
//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 72
//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 73
//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 74
//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 75
//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 76
//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 77
//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 78
//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 79
//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 80
//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 81
//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 82
//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 83
//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 84
//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 85
//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 86
//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 87
//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 88
//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 89
//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 90
//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 91
//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 92
//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 93
//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 94
//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 95
//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 96
//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 97
//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 98
//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 99
//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 100
//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 101
//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 102
//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 103
//pv3dview (org.papervision3d.core.ns.pv3dview) package org.papervision3d.core.ns { public namespace pv3dview; }//package org.papervision3d.core.ns
Section 104
//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 105
//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 106
//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 107
//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 108
//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 109
//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 110
//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 111
//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 112
//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 113
//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 114
//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 115
//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 116
//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 117
//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 118
//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 119
//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 120
//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 121
//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 122
//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 123
//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 124
//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 125
//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 126
//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 127
//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 128
//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 129
//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 130
//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 131
//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 132
//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 133
//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 134
//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 135
//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 136
//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 137
//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 138
//IVirtualMouseEvent (org.papervision3d.core.utils.virtualmouse.IVirtualMouseEvent) package org.papervision3d.core.utils.virtualmouse { public interface IVirtualMouseEvent { } }//package org.papervision3d.core.utils.virtualmouse
Section 139
//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 140
//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 141
//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 142
//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 143
//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 144
//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 145
//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 146
//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 147
//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 148
//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 149
//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 150
//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 151
//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 152
//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 153
//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 154
//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 155
//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 156
//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 157
//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 158
//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 159
//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 160
//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 161
//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 162
//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 163
//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 164
//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 165
//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 166
//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 167
//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 168
//Scene3D (org.papervision3d.scenes.Scene3D) package org.papervision3d.scenes { import org.papervision3d.core.proto.*; public class Scene3D extends SceneObject3D { } }//package org.papervision3d.scenes
Section 169
//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 170
//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 171
//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 172
//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 173
//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 174
//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 175
//Achievements (Achievements) package { import com.newgrounds.*; public class Achievements { public static const _ti514:int = 1; public static const _pa799:int = 5; public static const _dn277:int = 10; public static const _lu242:int = 18; public static const _es851:int = 17; public static const _xt792:int = 3; public static const _lc481:int = 12; public static const _um783:int = 2; public static const _dd638:int = 8; public static const _oc802:int = 14; public static const _hu830:int = 11; public static const _xa301:int = 13; public static const _ti208:int = 15; public static const _sl879:int = 16; public static const _yc627:int = 6; public static const _nv307:int = 7; public static const _lk178:int = 0; public static const _wm177:int = 9; public static const _dx141:int = 4; public static var achievement_unlocked:Array; public static function unlock(_arg1:int):void{ var _local2:String; if (Preloader._tn35){ _local2 = Main._ky813((irrcrpt("fhmnjajrjsy_", 5) + _arg1.toString())); if (Preloader.version == Preloader._xh649){ API.addEventListener(APIEvent.MEDAL_UNLOCKED, _ta619); API.unlockMedal(_local2); }; if (!achievement_unlocked[_arg1]){ achievement_unlocked[_arg1] = true; Messages.add(_local2, Res._st324, true); if (!Main._xx60){ if (Achievements.achievement_unlocked.indexOf(false) == -1){ Main._xx60 = true; Messages.add(Main._ky813(irrcrpt("xpzqqx_stb_hmfnsfgqj", 5)), Res._uc292[Main._ko79()]); }; }; }; }; } public static function init():void{ achievement_unlocked = new Array(_lu242); var _local1:int; while (_local1 < _lu242) { achievement_unlocked[_local1] = false; _local1++; }; } public static function _ta619(_arg1:APIEvent):void{ if (_arg1.success){ }; } } }//package
Section 176
//Audio (Audio) package { import flash.events.*; import flash.display.*; import flash.media.*; public class Audio { public static const _jy807:Number = 1; public static const _tg300:int = 16; public static const _eu417:Number = 0.65; public static var _vt823:SoundTransform = new SoundTransform(); public static var _rc774:Array = new Array(_tg300); public static var _dv79:Class = null; public static var _vq266:SoundChannel = new SoundChannel(); public static var _qf890:MovieClip = null; public static var _rl678:Array = new Array(_tg300); public static var _li849:Array = new Array(_tg300); public static var _gm115:SoundTransform = new SoundTransform(); public static var _im854:int; public static var _wn565:SoundChannel = new SoundChannel(); public static function _ml388(_arg1:Sound, _arg2:Number=1, _arg3:int=0):void{ var _local4:int; if (_arg1 != null){ _local4 = 0; while (_local4 < _tg300) { if ((((_rc774[_local4] == _arg3)) && ((_arg1.length == _rl678[_local4].length)))){ return; }; _local4++; }; _rl678[_im854] = _arg1; _rc774[_im854] = _arg3; _li849[_im854] = _arg2; if (++_im854 >= _tg300){ _im854 = 0; }; }; } public static function _ks707():void{ if (_qf890 != null){ _qf890.stop(); Main._td676.removeChild(_qf890); _qf890 = null; _dv79 = null; }; } public static function _uo387(_arg1:Sound, _arg2:Number=1, _arg3:Number=0):void{ var _sound = _arg1; var _volume = _arg2; var _pan = _arg3; if (Main.sfx_on){ try { _gm115.volume = (_volume * _jy807); _gm115.pan = _pan; _wn565 = _sound.play(); _wn565.soundTransform = _gm115; } catch(error:Error) { }; }; } public static function _vt779(_arg1:Sound):void{ Audio._ks707(); _vt823.volume = (Main.music_on) ? _eu417 : 0; _vq266 = _arg1.play(); _vq266.soundTransform = _vt823; _vq266.addEventListener(Event.SOUND_COMPLETE, _mk211); } public static function tick():void{ var _local1:int; while (_local1 < _tg300) { if ((((_rc774[_local1] >= 0)) && ((--_rc774[_local1] == -1)))){ Audio._uo387(_rl678[_local1], _li849[_local1]); }; _local1++; }; } public static function _te326(_arg1:Class):void{ if (Main.music_on){ if (_dv79 != _arg1){ _ks707(); _dv79 = _arg1; _qf890 = new (_arg1); _qf890.play(); Main._td676.addChild(_qf890); _ss923((Main.music_on) ? 1 : 0); }; }; } public static function _ss923(_arg1:Number):void{ if (_qf890 != null){ _qf890.soundTransform = new SoundTransform((_arg1 * _eu417), 0); }; } public static function _mk211(_arg1:Event):void{ _vq266.removeEventListener(Event.SOUND_COMPLETE, _mk211); switch (Main._vg295){ case 0: _te326(Res._hk607); break; case 1: _te326(Res._ei91); break; default: _te326(Res._ga10); break; }; } } }//package
Section 177
//Gfx (Gfx) package { import flash.display.*; import flash.geom.*; import flash.filters.*; import flash.text.*; public class Gfx { public static const _yg175:TextFormat = new TextFormat(irrcrpt("hbnf_gpou", 1), 12, 0xFFFFFF, true); public static const _fp393:String = "Gfx__fp393"; public static const LEFT:int = 8; public static const _ew507:int = 0x0100; public static const _uf814:int = 0x0200; public static const BOTTOM:int = 4; public static const TOP:int = 1; public static const _th126:int = -2; public static const _vc798:TextFormat = new TextFormat(irrcrpt("icog_hqpv", 2), 20, 0xFFFFFF, true); public static const _yd727:TextFormat = new TextFormat(irrcrpt("keqi_jsrx", 4), 20, 0xAEAEAE, true); public static const _tv753:TextFormat = new TextFormat(irrcrpt("lfrj_ktsy", 5), 12, 0xFFFFFF, true); public static const _qn765:TextFormat = new TextFormat(irrcrpt("icog_hqpv", 2), 12, 0xAEAEAE, true); public static const RIGHT:int = 2; public static var _is82:Point = new Point(); public static var hframe:int; public static var _hp794:ColorMatrixFilter; public static var _fa441:BitmapData; public static var vscale:Number; public static var _vq648:BitmapData; public static var height:int; public static var _lk197:String; public static var vframe:int; public static var _uk870:TextField = new TextField(); public static var matrix:Matrix = new Matrix(); public static var width:int; public static var _pr435:ColorMatrixFilter; public static var _ug39:int; public static var _is605:Rectangle = new Rectangle(); public static var _fa185:BitmapData; public static var hscale:Number; public static var _vk446:Array = new Array(); public static var _ei713:TextFormat = new TextFormat(irrcrpt("jdph_irqw", 3), 20, 0xFFFFFF, true); public static function _tf167(_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 & _ew507) != 0){ _arg3 = (_arg3 - (width / 2)); } else { if ((_arg8 & RIGHT) != 0){ _arg3 = (_arg3 - width); }; }; if ((_arg8 & _uf814) != 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))); }; _is605.x = _arg3; _is605.y = _arg4; _is605.width = (width + 1); _is605.height = (height + 1); _arg1.draw(_arg2, matrix, _arg9, null, _is605, _arg13); } public static function _gp45(_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 + _aj377(_arg5, width)); _arg4 = (_arg4 + _sj755(_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 _aj377(_arg1:int, _arg2:Number):int{ if ((_arg1 & _ew507) != 0){ return ((-(_arg2) >> 1)); }; if ((_arg1 & RIGHT) != 0){ return (-(_arg2)); }; return (0); } public static function fillRect(_arg1:BitmapData, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:int):void{ if (_arg6 != -1){ _arg2 = (_arg2 + _aj377(_arg6, _arg4)); _arg3 = (_arg3 + _sj755(_arg6, _arg5)); }; _is605.x = _arg2; _is605.y = _arg3; _is605.width = _arg4; _is605.height = _arg5; _arg1.fillRect(_is605, _arg7); } public static function _sg219(_arg1:BitmapData, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int, _arg7:ColorTransform):void{ if (_arg6 != -1){ _arg2 = (_arg2 + _aj377(_arg6, _arg4)); _arg3 = (_arg3 + _sj755(_arg6, _arg5)); }; _is605.x = _arg2; _is605.y = _arg3; _is605.width = _arg4; _is605.height = _arg5; _arg1.colorTransform(_is605, _arg7); } public static function _wq819(_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; _is605.width = width; _is605.height = height; if (_arg8 != -1){ _arg3 = (_arg3 + _aj377(_arg8, width)); _arg4 = (_arg4 + _sj755(_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))); }; _is605.x = _arg3; _is605.y = _arg4; _arg1.draw(_arg2, matrix, _arg9, null, _is605, false); } else { _is605.x = (hframe * width); _is605.y = (vframe * height); _is82.x = _arg3; _is82.y = _arg4; _arg1.copyPixels(_arg2, _is605, _is82, null, null, true); }; } public static function _xk303(_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 _yx11(_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 + _aj377(_arg8, width)); _arg7 = (_arg7 + _sj755(_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))); }; _is605.x = _arg6; _is605.y = _arg7; _is605.width = width; _is605.height = height; _arg1.draw(_arg2, matrix, _arg9, null, _is605, _arg13); } public static function _xf630(_arg1:String, _arg2:int, _arg3:String="", _arg4:int=0, _arg5:int=0, _arg6:Boolean=false):BitmapData{ _lk197 = Main._td676.quality; Main._td676.quality = StageQuality.HIGH; _ei713.font = _arg3; _ei713.size = _arg4; _ei713.color = _arg5; _ei713.bold = true; _uk870.autoSize = TextFieldAutoSize.LEFT; _uk870.defaultTextFormat = _ei713; _uk870.embedFonts = true; _uk870.htmlText = ((irrcrpt("<d>", 2) + _arg1) + irrcrpt("</f>", 4)); if (_arg6){ _uk870.filters = [new GlowFilter(0, 1, 4, 4, 3, 1, false, false)]; } else { _uk870.filters = null; }; if (_arg2 != -1){ _uk870.width = _arg2; _uk870.wordWrap = true; } else { _uk870.wordWrap = false; }; _fa185 = new BitmapData(_uk870.width, _uk870.height, true, 0); matrix.identity(); matrix.ty = _th126; _fa185.draw(_uk870, matrix, null, null, null, true); Main._td676.quality = _lk197; return (_fa185); } public static function _sj755(_arg1:int, _arg2:Number):int{ if ((_arg1 & _uf814) != 0){ return ((-(_arg2) >> 1)); }; if ((_arg1 & BOTTOM) != 0){ return (-(_arg2)); }; return (0); } public static function _kd615(_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; }; _ei713.font = _arg7; _ei713.size = _arg8; _ei713.color = _arg9; _ei713.bold = true; _xf630(_arg2, -1, _arg7, _arg8, _arg9, _arg10); Gfx._wq819(_arg1, Gfx._fa185, _arg3, _arg4, 0, 1, 1, _arg5, _arg6); } public static function _oc28(_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); _hp794 = 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), _hp794); return (_arg1); } } }//package
Section 178
//Gfx__fp393 (Gfx__fp393) package { import mx.core.*; public class Gfx__fp393 extends FontAsset { } }//package
Section 179
//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 180
//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 flash.system.*; import flash.ui.*; public class Main extends PaperBase { private const _gg452:int = 4; private const _au447:int = 4; private const _eq880:int = 8; private const LEFT:int = 8; private const _ai243:int = 310; private const _lo782:int = 1; private const _kl113:int = 2; private const _bs99:int = 6; private const _mc264:int = 3; private const _ur614:int = 5; private const _rm768:Number = 0.2; private const _og592:int; private const _rm652:int = 6; private const _aw882:int = 0; private const _uh848:int = 48; private const _kd533:int = 2; private const _ib875:int = 2; private const _ke629:int; private const _ry871:int = 442; private const _gw817:Class; private const _jy518:int = 10; private const _bt192:int = 5; private const _qm873:int = 3; private const _xy926:int = 250; private const _jv387:int; private const _ya68:int = 3; private const _eh883:int = 11; private const _yi299:int = 4; private const _ft51:int = 6; private const _se651:int = 0; private const _jl492:int = 32; private const _cx259:int = 0; private const _ia103:int = 100; private const _ej716:int = 7; private const _ak376:int = -1; private const _na94:int = 0; private const _qk254:int = 180; private const _uv927:int = 4; private const _ap710:int = 12; private const _bx360:int; private const _rm247:int = 10; private const _eq374:int = 52; private const _rd679:int = 3; private const _nw837:int = 0; private const TOP:int = 1; private const _mk833:int = 1; private const _gb26:int; private const _tp491:int = 8; private const _yf703:int = 4; private const _me188:int = 9; private const _id890:int = 1; private const _pc645:Array; private const _nc804:int; private const _ij196:int = 1; private const _bo340:int = 50; private const _cr778:int; private const _sf206:int = 0; private const _rn375:int = 1; private const _tr576:int = 0; private const _ac224:int = 8; private const _be329:Array; private const _ow554:BitmapMaterial; private const _iq857:int = 100; private const _nk795:int = 7; private const _rd366:BitmapData; private const _mv758:int = 2; private const _ri823:int = 180000; private const _bx16:int = 0; private const _hb361:int = 13; private const RIGHT:int = 2; private const _sh429:int = 1; private const _ew507:int = 0x0100; private const _lv857:int = 7; private const _mb850:int = 1; private const _tf299:BitmapData; private const BOTTOM:int = 4; private const _vv223:int; private const _sv806:int = 6; private const _vi172:int; private const _oa494:int = 3; private const _ul889:int = 12; private const _kh214:int = 99; private const _ps807:int = 1; private const _yq547:int; private const _br567:int = 2; private const _em633:int = 5; private const _lh149:int = 2; private const _wp621:int; private const _nl348:int = 8; private const _vt28:Array; private const _yi54:int = 3; private const _pm286:int = 2; private const SELECTED:int = 2; private const _wp639:int = 10; private const _dt367:int = 5; private const _xf655:int; private const _kv733:int = 100; private const _gn100:int = 2; private const _re290:int = 14; private const _gf503:int = 2; private const _qi854:int = 3; private const _ea447:int = 3; private const _yi737:String; private const _qr558:Array; private const _hr769:int = 38; private const _vy676:int = 4; private const _hj806:int; private const _yt755:int = 1; private const _im10:int = 242; private const _uf814:int = 0x0200; private const _nr709:Array; private const _fl292:int = 0; private const _is451:int = 5; private const _sa787:int = 11; private const _ci275:int; private const _br285:int = 110; private const _ne797:Array; private const _gt718:int = 5; private const _tm447:Array; private const _md438:int; private const _ps550:int = 1; private const _qk879:int = -204; private const _he186:int = 3; private const _fc162:int = 1; private const _ba307:String; private const _kw451:int = 1; private const _jk578:int = 5; private const _sl87:int = 9; private const _vq553:int = 9; private const _wt748:int = 0; private var tutorial_image_timer:int; private var _sq917:Array; private var _ba59:Number;// = 0 private var clear_colour:int;// = 0 private var _ck148:Boolean;// = false private var _yh274:Array; private var _mf531:Rectangle; private var _tw270:Number; private var _de775:Boolean; private var mouse_column:int; private var _jd721:int;// = -1 private var hiscore_3_minutes:MochiDigits; private var _mo28:Number; private var _kc438:Array; private var _rl572:Number; private var _ey156:Array; private var _qa301:Boolean; private var _yc85:int; private var _pc34:Boolean; private var _tp417:Array; private var _av219:Sprite; private var image_score_value:BitmapData; private var hiscore_display:int; private var _nt883:int;// = 0 private var _sn584:BitmapData; private var _bf705:int;// = -1 private var hint_y:int; private var _aa341:int; private var show_level_up_text:Boolean; private var _uo163:MovieClip;// = null private var _ww846:Boolean; private var _sw47:int;// = 0 private var _to376:int; private var global_stats:Array; private var _le358:Boolean;// = false private var _dp110:Array; private var _wl753:Array; private var hint_angle:Number;// = 0 private var image_stat_value:BitmapData; private var _qv386:Array; private var paused:Boolean; private var hiscore_casual:MochiDigits; private var prev_mouse_c:int; private var _cn144:Array; private var prev_mouse_r:int; private var _om508:int; private var _bk42:Plane; private var HINT_TIMER_MAX:int;// = 500 private var _vc806:Array; private var _js806:int; private var _et675:int;// = 0 private var _xm80:Number; private var tutorial_image_index:int; private var _tp394:Boolean; private var _qp871:Boolean;// = false private var _jx282:Array; private var _nc820:Array; private var _jw64:Boolean; private var _if753:SharedObject; private var _ig849:Array; private var image_hiscore_value:BitmapData; private var _wm437:Number; private var tutorial_image_opacity:Number; private var _dm922:int; private var _hx120:Array; private var bonus_desc_scale:Number; private var _ss89:Number; private var _dn906:Point; private var _yh722:int;// = 0 private var _is605:Rectangle; private var debug:Boolean;// = false private var _tg284:Stats; private var _na225:int; private var hiscore_100_moves:MochiDigits; private var _di591:Number; private var _is82:Point; private var image_chain_length:BitmapData; private var _oy688:int; private var new_hiscore:Boolean; private var _qq566:MochiDigits; private var _xs820:int; private var _ti245:Number; private var _xr859:int; private var image_stat_label:BitmapData; private var board_vy:Number; private var _ho474:Boolean; private var _gq853:Array; private var _he580:Array; private var ticks:int;// = 0 private var _ai508:Number;// = 0 private var _bf159:Array; private var _fp607:Array; private var _gn248:int; private var _ff726:Array; private var board_yo:Number; private var bonus_effect_timer:int; private var _bb827:Number; private var _rj787:Number; private var mouse_row:int; private var _mo755:int; private var _iu626:int; private var _pr435:ColorMatrixFilter; private var _tx416:int;// = 0 private var bonus_type:int; private var last_blob_cleared_y:int; private var _tn643:int; private var _un326:BitmapData; private var _dx554:int; private var _lv491:Array; private var _nh828:int; private var _aw828:int; private var hint_timer:int; private var _ah358:int; private var image_hiscore_label:BitmapData; private var _ve792:Array; private var _km529:MochiDigits; private var _cl441:Number;// = 0 private var _ci296:BitmapData; private var _ty538:Array; private var _ik515:int; private var matrix:Matrix; private var _bt378:int; private var _yl723:Array; private var _xl805:Array; private var _dc205:Array; private var _al739:BitmapData; private var prev_mouseY:int; private var hi_stats:Array; private var _am713:Array; private var _lf721:Array; public static const _mc578:int = 9; public static const _wk854:int = 1; public static const _cj173:int = 6; public static const _dm287:int = 7; public static const _qw186:int = 3; public static const _ww820:int = 10; public static const _pj255:int = 8; public static const _gt481:int = 480; public static const _qf537:int = 0; public static const _mo346:int = 5; public static const _ym563:int = 1; public static const _kv746:int = -1; public static const _dq259:int = -2; public static const _ol244:int = 9; public static const _ev223:int = 4; public static const _yd763:int = 2; public static const _tc118:int = (_pn357 >> 1); public static const _ec365:BitmapData = new BitmapData(_pn357, _gt481, false); public static const _pn357:int = 640; public static const _yo361:int = 5; public static const _eh786:int = 7; public static const _ln566:int = -1; public static const _xn486:int = 6; public static const _sn405:int = (_gt481 >> 1); public static var _vg295:int = 0; public static var _vl825:Boolean = false; public static var _xx60:Boolean = false; public static var _vo500:int; public static var bloke_on:Boolean = true; public static var _ky298:int = _bh368; public static var _td676:Stage; public static var _bh368:int = -1; public static var music_on:Boolean = true; public static var _mj416:int = 0; public static var messages_on:Boolean = true; public static var sfx_on:Boolean = true; public static var daytime:Boolean = true; public static var one_click:Boolean = false; public function Main(){ var _local1:int; _yi737 = irrcrpt("z4.9.4, 52xl Rsziqfiv 6454", 4); _if753 = SharedObject.getLocal(irrcrpt("cpncppamf3_w157", 1), "/"); matrix = new Matrix(); _is605 = new Rectangle(); _is82 = new Point(); _pc645 = ["casual", "timed", "100_moves"]; _nr709 = ["c1b879bf909dfa34", "840c21100149fa53", "bdb95d73b0cf5f52"]; _gw817 = Main__gw817; _tf299 = Bitmap(new _gw817()).bitmapData; _bx360 = (_tf299.width / _rm247); _yq547 = (_tf299.height / _mk833); _jv387 = (_vq553 * _bx360); _og592 = (_ap710 * _yq547); _rd366 = new BitmapData(Res._nw116.width, Res._nw116.height, true); _md438 = (_ai243 + _jv387); _ke629 = (_ai243 + (_jv387 >> 1)); _wp621 = (((_sn405 - (_og592 >> 1)) - _yq547) - 9); _vv223 = (_wp621 + _og592); _nc804 = (Res._gs209[0].width / Res._nx551); _vi172 = Res._gs209[0].height; _xf655 = (_nc804 * _nl348); _ci275 = (_ke629 - (_xf655 >> 1)); _gb26 = ((_gt481 - _vi172) - 5); _ow554 = new BitmapMaterial(_rd366); _lf721 = new Array(); _lv491 = new Array(); _wl753 = new Array(); _xl805 = new Array(); _yl723 = new Array(); _km529 = new MochiDigits(); _av219 = new Sprite(); _qq566 = new MochiDigits(); hiscore_casual = new MochiDigits(100000); hiscore_3_minutes = new MochiDigits(100000); hiscore_100_moves = new MochiDigits(100000); _sq917 = new Array(_eq880); hi_stats = new Array(_eq880); _ig849 = new Array(_eq880); _ff726 = new Array(_eq880); _vt28 = [30000, 100, 10, 1, 1, 10000, 5, 10000]; _ne797 = ["SCORE", "BLOBS", "MOVES", "CHAIN", "COMBO", "BONUS", "CLEARANCE", "TIME"]; global_stats = new Array(_uv927); _dc205 = new Array(_uv927); _nc820 = new Array(_rd679); _qv386 = new Array(_nl348); _he580 = new Array(_nl348); _jx282 = new Array(_nl348); _hj806 = (_sn405 - ((_ft51 * _uh848) >> 1)); _bf159 = new Array(_ac224); _dp110 = new Array(_ac224); _kc438 = new Array(_ac224); _ey156 = new Array(_ac224); _hx120 = new Array(_ac224); _ve792 = new Array(_bo340); _gq853 = new Array(_bo340); _vc806 = new Array(_bo340); _tp417 = new Array(_bo340); _be329 = [9, 10]; _qr558 = [3, 0]; _yh274 = new Array(_is451); _ty538 = new Array(_is451); _cn144 = new Array(_is451); _fp607 = new Array(_is451); _am713 = new Array(_is451); _tm447 = [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]; _cr778 = (_tm447.length >> 2); _ba307 = irrcrpt("9887h93i72j8gh25", 4); _mf531 = new Rectangle(0, 0, (_pn357 + 32), _br567); _dn906 = new Point(); super(); MochiSocial.addEventListener(MochiSocial.ERROR, _di780); MochiSocial.addEventListener(MochiSocial.LOGGED_IN, _dt554); MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, _pm279); addEventListener(Event.ENTER_FRAME, update); _local1 = 0; while (_local1 < _eq880) { hi_stats[_local1] = 0; _local1++; }; _local1 = 0; while (_local1 < _uv927) { global_stats[_local1] = 0; _local1++; }; Achievements.init(); Messages.init(); _fl302(); _local1 = 0; while (_local1 < (Res._wl255.length >> 1)) { _am713[_local1] = Res._wl255[_local1].width; _local1++; }; _kn727(-1, true); init(_pn357, _gt481); _bk42.x = (_ai243 - 172); _bk42.y = (_wp621 + 46); _bk42.visible = false; addChild(_av219); _av219.visible = false; if (Preloader._yq216){ startTransition(_qf537); } else { startTransition(_ym563); }; } final private function _np469(_arg1:int, _arg2:int, _arg3:Boolean):void{ var _local5:int; var _local6:String; Gfx._wq819(_ec365, Res._qr133, _arg1, _bb827, 0, 1, 1, (TOP | _ew507)); var _local4 = 160; var _local7:Array = (_arg3) ? hi_stats : _ff726; _local5 = 1; while (_local5 < _eq880) { switch (_local5){ case _id890: _local6 = Utils._cc744(_local7[_id890]); break; case _lh149: _local6 = Utils._cc744(_local7[_lh149]); break; case _oa494: _local6 = int(_local7[_oa494]).toString(); break; case _yf703: _local6 = int(_local7[_yf703]).toString(); break; case _dt367: _local6 = Utils._cc744(_local7[_dt367]); break; case _rm652: _local6 = (int(_local7[_rm652]).toString() + "%"); break; case _ej716: _local6 = Utils._rg731(_local7[_ej716], true); break; }; Gfx._wq819(_ec365, _ig849[_local5], (_arg1 - (_arg2 >> 1)), _local4, 0, 1, 1, -1, new ColorTransform(1, 1, 1, _tw270)); Gfx._kd615(_ec365, _local6, (_arg1 + (_arg2 >> 1)), _local4, (TOP | RIGHT), new ColorTransform(1, 1, 1, _tw270), irrcrpt("keqi_jsrx", 4), 16, 0xFFFFFF); _local4 = (_local4 + 21); _local5++; }; var _local8 = 4; var _local9:int = ((_nl348 * (_bx360 + _local8)) - _local8); var _local10:int = ((_arg1 - (_local9 >> 1)) - _rl572); _local5 = 0; while (_local5 < _nl348) { Gfx._wq819(_ec365, _tf299, (_local10 + (_local5 * (_bx360 + _local8))), 310, _local5, _rm247, 1); Gfx._kd615(_ec365, _jx282[_local5], ((_local10 + (_local5 * (_bx360 + _local8))) + (_bx360 >> 1)), 348, (TOP | _ew507), null, irrcrpt("jdph_irqw", 3), 10, 0xFFFFFF); _local5++; }; } final private function _nt80(_arg1:int):void{ Menu.reset(); Menu._oh373(((((((Res._sa258.title_achievements + irrcrpt(" (", 1)) + Res._sa258.page) + (_to376 + 1)) + irrcrpt(" / ", 1)) + _ya68) + ")"), Menu._bc858, _tc118, 20, (_ew507 | TOP)); Menu._oh373(Res._sa258.exit, Menu._nm694, _tc118, (_gt481 - 20), (BOTTOM | _ew507)); if (_to376 > 0){ Menu._oh373("", Menu._ti207, (_pn357 >> 2), (_gt481 - 20), (BOTTOM | _ew507)); }; if (_to376 < (_ya68 - 1)){ Menu._oh373("", Menu._do163, (_pn357 * 0.75), (_gt481 - 20), (BOTTOM | _ew507)); }; } final private function _pr137():void{ MochiScores.closeLeaderboard(); startTransition(_ym563); } final private function resume():void{ if (paused){ paused = false; Menu.reset(); if (bloke_on){ _uo163.play(); }; }; } final private function _ee210():void{ var _wy131:SoundTransform; if (_uo163 != null){ _wy131 = _uo163.soundTransform; _wy131.volume = 0; _uo163.soundTransform = _wy131; _uo163.stop(); try { removeChild(_uo163); } catch(e:Error) { }; _uo163 = null; }; } final private function _fq683():void{ var _local1:Array; var _local2:int; var _local3:int; var _local4:int; var _local5:int; _ba59 = (_ba59 + (_mj416 * _rm768)); if ((((_ba59 <= -1)) || ((_ba59 >= 2)))){ if (_mj416 == _wk854){ cleanUp(); _ky298 = _bh368; switch (_ky298){ case _ln566: _td676 = stage; stage.quality = StageQuality.HIGH; stage.addEventListener(KeyboardEvent.KEY_UP, _sh866); stage.addEventListener(MouseEvent.MOUSE_DOWN, _so887); stage.addEventListener(MouseEvent.MOUSE_UP, _io685); stage.addEventListener(Event.DEACTIVATE, _mu340); Res._up489(); break; }; switch (_bf705){ case _qf537: _dr686(Res._tr710, true, true, 50, 50); break; case _ym563: Audio._te326(Res._hk607); _vg295 = 0; Menu._oh373(Res._sa258.click_to_start, Menu._nm694, _tc118, (_gt481 - 100), (TOP | _ew507)); if (Preloader._bw689){ MochiSocial.showLoginWidget({x:8, y:(_gt481 - 40)}); }; _dr686(Res._qp640, true, true); break; case _yd763: _wm434(); break; case _cj173: _na225 = 0; _pj399(); break; case _qw186: _vm221(); break; case _mo346: _local1 = [Res._sa258.title_credits, "", Res._sa258.developed_by_megadev, "", Res._sa258.credits_code, Res._sa258.credits_mike, "", Res._sa258.credits_art, Res._sa258.credits_jon, "", Res._sa258.credits_audio, Res._sa258.credits_nick, "", Res._sa258.credits_qa, Res._sa258.credits_dan]; _local2 = 27; _local3 = (_local1.length * _local2); _local4 = (_sn405 - (_local3 >> 1)); _local5 = 0; while (_local5 < _local1.length) { Menu._oh373(_local1[_local5], ((_local1[_local5].toString() == "")) ? Menu._yd455 : Menu._bc858, _tc118, (_local4 + (_local5 * _local2)), (TOP | _ew507)); _local5++; }; Menu._oh373(Res._sa258.exit, Menu._uk859, (_pn357 - 20), (_gt481 - 8), (BOTTOM | RIGHT)); Menu._oh373("", Menu._uq379, 8, (_gt481 - 8), (BOTTOM | LEFT)); break; case _mc578: _cn876(0xAEAEAE); _tw270 = 0; Menu._oh373("", Menu._ot441, _tc118, 50, (TOP | _ew507)); Menu._oh373(Res._sa258.exit, Menu._nm694, _tc118, (_gt481 - 50), (BOTTOM | _ew507)); break; case _ww820: _to376 = 0; _nt80(0); break; case _ev223: Menu._oh373("", Menu._dm131, (_pn357 >> 2), (_gt481 - 60), (TOP | _ew507)); Menu._oh373("", Menu._ct608, _tc118, (_gt481 - 60), (TOP | _ew507)); Menu._oh373("", Menu._be242, (_pn357 * 0.75), (_gt481 - 60), (TOP | _ew507)); MochiScores.showLeaderboard({boardID:_nr709[_ah358], onClose:_pr137, onError:_pr137}); break; }; _bh368 = _bf705; _mj416 = 0; startTransition(_bh368, _kv746); } else { _mj416 = 0; }; }; } final private function _ed366(_arg1:int):void{ var _local2:int; var _local3:int; var _local4:int; Audio._uo387(Res._cg16[_ko79()]); var _local5:int; bonus_type = _arg1; _qv386[_arg1] = 0; _he590(_arg1); switch (_arg1){ case _na94: _jw64 = false; bonus_effect_timer = 1000; _bk42.visible = true; _du149(_rd366, false); Audio._uo387(Res._be288); break; case _ps550: _local4 = 0; while (_local4 < 2) { _local5 = 0; _local2 = 0; while (_local2 < _vq553) { _local3 = (_ap710 - 3); while (_local3 < _ap710) { if ((((((_local4 == 0)) && ((((_lf721[_local2][_local3] == _tp491)) || ((_lf721[_local2][_local3] >= ((_wp639) && ((_lf721[_local2][_local3] <= _re290))))))))) || ((_local4 == 1)))){ _xl805[_local2][_local3] = ((_lf721[_local2][_local3] == _dm287)) ? _rn375 : SELECTED; _local5++; }; _local3++; }; _local2++; }; if (_local5 > 0){ _vu798(); }; _local4++; }; _local5 = 0; break; case _kd533: _local4 = 0; while (_local4 < 2) { _local5 = 0; _local2 = 0; while (_local2 < _vq553) { _local3 = 1; while (_local3 < _ap710) { if ((((((_local4 == 0)) && ((_lf721[_local2][_local3] == _tp491)))) || ((((_local4 == 1)) && ((_lf721[_local2][_local3] == _yo361)))))){ _xl805[_local2][_local3] = SELECTED; _local5++; }; _local3++; }; _local2++; }; if (_local5 > 0){ _vu798(); }; _local4++; }; _local5 = 0; break; case _yi54: _de775 = false; bonus_effect_timer = 30; Audio._uo387(Res._cn505); break; case _au447: _local2 = 0; while (_local2 < _vq553) { _local3 = 1; while (_local3 < _ap710) { if (_lf721[_local2][_local3] == _dm287){ _kd904(_local2, _local3, false, false); _local5++; }; _local3++; }; _local2++; }; break; case _jk578: _local2 = 0; while (_local2 < _vq553) { _local3 = 1; while (_local3 < _ap710) { if (_lf721[_local2][_local3] == clear_colour){ _xl805[_local2][_local3] = SELECTED; _local5++; }; _local3++; }; _local2++; }; break; case _sv806: _local2 = 0; while (_local2 < _vq553) { _local3 = 1; while (_local3 < _ap710) { if (_lf721[_local2][_local3] == _yo361){ _lf721[_local2][_local3] = _dm287; }; _local3++; }; _local2++; }; break; case _lv857: _local2 = 0; while (_local2 < _vq553) { _local3 = 1; while (_local3 < _ap710) { if ((((_lf721[_local2][_local3] >= _wp639)) && ((_lf721[_local2][_local3] <= _re290)))){ _xl805[_local2][_local3] = SELECTED; _local5++; }; _local3++; }; _local2++; }; break; }; if (_local5 > 0){ _vu798(); }; } final private function _ni618(_arg1:Boolean, _arg2:Boolean=false):void{ var _local3:int; var _local4:int; _av219.graphics.clear(); if (((_arg1) && (_tp394))){ Audio._uo387(Res._sh137); }; _aw828 = 0; _mo755 = 0; _km529.setValue(0); _aa341 = -1; _tp394 = false; if (_arg2){ mouse_column = (mouse_row = -1); prev_mouse_c = (prev_mouse_r = -1); }; _local3 = 0; while (_local3 < _vq553) { _local4 = 0; while (_local4 < _ap710) { _xl805[_local3][_local4] = _sf206; _local4++; }; _local3++; }; } final private function _uh844():int{ return (((mouseX - _ci275) / _nc804)); } final private function _fh639(_arg1:int, _arg2:int, _arg3:int):void{ _ve792[_nt883] = _arg1; _gq853[_nt883] = _arg2; _vc806[_nt883] = _arg3; _tp417[_nt883] = 0; if (++_nt883 >= _bo340){ _nt883 = 0; }; } final private function _ya652(_arg1:int):void{ var _option = _arg1; if (_option != -1){ if (_option != Menu._vn447){ Audio._uo387(Res._wx461[_ko79()]); }; switch (_option){ case Menu._vx515: startTransition(_mc578); break; case Menu._pc182: MochiCoins.showStore(); break; case Menu._un298: Menu.setup(Menu._wc666); break; case Menu._ao519: _ah358 = _tr576; startTransition(_qw186); break; case Menu._nt129: _ah358 = _fc162; startTransition(_qw186); break; case Menu._tb458: _ah358 = _pm286; startTransition(_qw186); break; case Menu._uq907: startTransition(_cj173); break; case Menu._xq427: startTransition(_ev223); break; case Menu._lf304: _ju756(_se651); _bh368 = _eh786; Menu.reset(); MochiScores.showLeaderboard({boardID:_nr709[_ah358], score:_qq566.value, onClose:_qj648, onError:_qj648}); break; case Menu._nm694: if (_bh368 == _ym563){ _ee210(); startTransition(_yd763); } else { if (_bh368 != _yd763){ startTransition(_yd763); } else { Menu.setup(Menu._uy637); }; }; break; case Menu._yl736: if (_bh368 == _qw186){ Menu.setup(Menu._xy47); } else { Menu.setup(Menu._uy637); }; _dm625(); break; case Menu._uk859: startTransition(_yd763); break; case Menu._gd173: Menu.setup(Menu._wc666); break; case Menu._md681: startTransition(_mo346); break; case Menu._vq797: _jx923(); break; case Menu._gf162: Menu.setup(Menu._il455); break; case Menu._cl534: if (_bh368 == _qw186){ Menu.setup(Menu._pa464); } else { if (Preloader._bw689){ MochiScores.closeLeaderboard(); }; startTransition(_qw186); }; break; case Menu._oo81: startTransition(_qw186); break; case Menu._gx182: resume(); _lf766(true); break; case Menu._gu36: case Menu._oa504: Menu.setup(Menu._xy47); break; case Menu._by460: if (Preloader._bw689){ MochiScores.closeLeaderboard(); }; if (_bh368 == _pj255){ startTransition(_yd763); } else { Menu.setup(Menu._ut401); }; break; case Menu._tk822: _dg646(); _dm625(); if (Preloader._bw689){ MochiScores.closeLeaderboard(); }; startTransition(_yd763); break; case Menu._oo832: if (_bh368 == _yd763){ Menu.setup(Menu._uy637); } else { Menu.setup(Menu._xy47); }; break; case Menu._xj725: if (music_on){ music_on = false; Audio._ks707(); } else { music_on = true; switch (_bh368){ case _qw186: switch (Main._vg295){ case 0: Audio._te326(Res._hk607); break; case 1: Audio._te326(Res._ei91); break; default: Audio._te326(Res._ga10); break; }; break; default: Audio._te326(Res._hk607); break; }; }; Menu.setup(Menu._dj411, false); break; case Menu._vn447: sfx_on = !(sfx_on); Menu.setup(Menu._dj411, false); Audio._uo387(Res._gy750); break; case Menu._np713: messages_on = !(messages_on); Menu.setup(Menu._dj411, false); break; case Menu._lb14: one_click = !(one_click); Menu.setup(Menu._dj411, false); break; case Menu._sb782: daytime = !(daytime); if (_bh368 == _qw186){ _xl419(-1); _he590(-1); }; Menu.setup(Menu._dj411, false); break; case Menu._dq253: try { stage.fullScreenSourceRect = new Rectangle(0, 0, _pn357, _gt481); if (stage.displayState == StageDisplayState.FULL_SCREEN){ stage.displayState = StageDisplayState.NORMAL; } else { stage.displayState = StageDisplayState.FULL_SCREEN; }; Menu.setup(Menu._dj411, false); } catch(e:Error) { }; break; case Menu._my365: bloke_on = !(bloke_on); if (_bh368 == _qw186){ if (bloke_on){ _ju756(_jd721); _uo163.stop(); } else { _hk387(); }; }; Menu.setup(Menu._dj411, false); break; case Menu._uq379: navigateToURL(new URLRequest(irrcrpt("lxxt://aaa.qikehiz.gs.yo", 4)), irrcrpt("_fpero", 4)); break; case Menu._tp611: navigateToURL(new URLRequest(irrcrpt("kwws://zzz.phjdghy.fr.xn/jdphv.kwpo", 3)), irrcrpt("_eodqn", 3)); break; case Menu._pv449: Menu.setup(Menu._ao650); break; case Menu._fx903: if (--_na225 < 0){ _na225 = (_sl87 - 1); }; _pj399(); break; case Menu._rs848: if (++_na225 >= _sl87){ _na225 = 0; }; _pj399(); break; case Menu._se113: navigateToURL(new URLRequest(Preloader._kg909), irrcrpt("_eodqn", 3)); break; case Menu._ss111: startTransition(_ww820); break; case Menu._ti207: if (--_to376 < 0){ _to376 = (_ya68 - 1); }; _nt80(_to376); break; case Menu._do163: if (++_to376 >= _ya68){ _to376 = 0; }; _nt80(_to376); break; }; }; } private function _qx852(_arg1:Object):void{ } final private function _bk489(_arg1:int):void{ if (!debug){ _qq566.addValue(_arg1); if (((!(new_hiscore)) && ((_qq566.value > _ec37(_ah358))))){ new_hiscore = true; Messages.add(Res._sa258.new_high_score); }; if (_qq566.value >= 500000){ Achievements.unlock(Achievements._oc802); } else { if (_qq566.value >= 250000){ Achievements.unlock(Achievements._dd638); } else { if (_qq566.value >= 100000){ Achievements.unlock(Achievements._um783); }; }; }; }; } final private function _so402(_arg1:int):String{ switch (_arg1){ case _na94: return (Res._sa258.flip); case _au447: return (Res._sa258.detonate_all); case _kd533: return (Res._sa258.skull_destroyer); case _sv806: return (Res._sa258.skulls_to_bombs); case _yi54: return (Res._sa258.randomise); case _ps550: return (Res._sa258.bottom_row); case _lv857: return (Res._sa258.thaw_frozen); case _jk578: return (Res._sa258.clear_colour); }; return (""); } final private function _so887(_arg1:MouseEvent):void{ _ck148 = true; if (_mj416 == 0){ if (!Menu._xy601){ switch (_bh368){ case _qw186: if (_jh783()){ switch (_oy688){ case _aw882: if (((!((mouse_column == -1))) && (!((mouse_row == -1))))){ if ((((_xl805[mouse_column][mouse_row] == SELECTED)) && ((((_km529.value >= 3)) || ((_aa341 == _dm287)))))){ _mo755 = 0; _vu798(); _ui149(mouse_column, mouse_row); } else { if (!one_click){ _ni618(true, false); switch (_lf721[mouse_column][mouse_row]){ case _dm287: _kd904(mouse_column, mouse_row, true, true); break; default: _gs169(mouse_column, mouse_row); break; }; }; }; }; break; }; }; break; }; }; }; } final private function _ec37(_arg1:int):int{ switch (_arg1){ case _tr576: return (hiscore_casual.value); case _fc162: return (hiscore_3_minutes.value); case _pm286: return (hiscore_100_moves.value); }; return (-1); } final private function _tp655():void{ var _local1:int; _bb827 = (_bb827 + (_wm437 = (_wm437 + 0.5))); if (_bb827 >= 0){ _bb827 = 0; _wm437 = (-(_wm437) / 2); }; if (board_yo < (_gt481 * 2)){ _xm80 = (_xm80 + 0.008); board_yo = (board_yo + (board_vy = (board_vy + 0.5))); } else { switch (Preloader.version){ case Preloader._sf918: case Preloader._nx773: if (++_om508 == 120){ _hk387(); _bh368 = _eh786; Audio._ks707(); _cd835(); }; break; default: if (_tw270 < 1){ _tw270 = (_tw270 + 0.1); } else { if (_rl572 > 0){ _rl572 = Math.max(0, (_rl572 = (_rl572 - (1 + (_rl572 * 0.2))))); }; _local1 = 0; while (_local1 < _eq880) { if ((((_ff726[_local1] < _sq917[_local1])) && ((((_local1 == 0)) || ((_ff726[(_local1 - 1)] >= _sq917[(_local1 - 1)])))))){ _ff726[_local1] = Math.min((_ff726[_local1] = (_ff726[_local1] + _vt28[_local1])), _sq917[_local1]); if (_ff726[_local1] == _sq917[_local1]){ Audio._uo387(Res._lv743[_ko79()]); } else { if ((ticks % 3) == 0){ Audio._uo387(Res._aj632[_ko79()]); }; }; }; _local1++; }; }; break; }; }; } final private function _rm547():void{ var _local1:int; _lj34(_ej716, true, (getTimer() - _rj787)); if (_ah358 == _fc162){ if (!_pc34){ if (_sq917[_ej716] >= (_ri823 - 10000)){ _pc34 = true; Audio._uo387(Res._mk594); }; }; if (_sq917[_ej716] >= _ri823){ _sq917[_ej716] = _ri823; _lf766(false); } else { _xl419(_qm873); if (Math.floor((_sq917[_ej716] / 60000)) >= _iu626){ _local1 = (_rd679 - _iu626); Messages.add(((_local1.toString() + " ") + ((_local1 == 1)) ? Res._sa258.minute_left : Res._sa258.minutes_left)); _nc820[_iu626] = true; _iu626++; }; switch (_vg295){ case 0: if (_sq917[_ej716] >= 60000){ Audio._vt779(Res._ai165); _vg295++; }; break; case 1: if (_sq917[_ej716] >= 120000){ Audio._vt779(Res._ai165); _vg295++; }; break; }; }; }; } final private function _lf766(_arg1:Boolean):void{ if (!_qa301){ _qa301 = true; _om508 = 0; _bb827 = -(_gt481); _wm437 = 1; if (!_arg1){ Messages.add(((_ah358 == _fc162)) ? Res._sa258.out_of_time : Res._sa258.out_of_moves); }; _ni618(false); _ju756(_nk795); _du149(_rd366, false); Gfx._oc28(_rd366); _sq917[_nw837] = _qq566.value; _qj648(); _dg646(); _dm625(); }; } final private function _cd835():void{ switch (Preloader.version){ case Preloader._sf918: MindJoltAPI.service._cd835(_qq566.value, _pc645[_ah358], _wm434); break; case Preloader._nx773: break; }; } final private function _yn607(_arg1:int, _arg2:int, _arg3:int):void{ if (((_db77(_arg1, _arg2)) && (!((_lf721[_arg1][_arg2] == -1))))){ _xl805[_arg1][_arg2] = _arg3; }; } final private function _up479(_arg1:Event=null):void{ MochiSocial.addEventListener(MochiSocial.ACTION_COMPLETE, _rh179); MochiSocial.addEventListener(MochiSocial.ACTION_CANCELED, _if749); MochiSocial.postToStream({}); } final private function _aw317(_arg1:String):void{ if (debug){ trace(_arg1); }; } final private function _db77(_arg1:int, _arg2:int):Boolean{ if ((((((((_arg1 < 0)) || ((_arg1 >= _vq553)))) || ((_arg2 < 1)))) || ((_arg2 >= _ap710)))){ return (false); }; return (true); } final private function _dg646():void{ if (_qq566.value >= _ec37(_ah358)){ _wd249(_ah358, _qq566.value); }; global_stats[_bx16] = (global_stats[_bx16] + _sq917[_id890]); global_stats[_gn100] = (global_stats[_gn100] + _sq917[_ej716]); global_stats[_mc264] = (global_stats[_mc264] + _sq917[_lh149]); var _local1 = global_stats; var _local2 = _yt755; var _local3 = (_local1[_local2] + 1); _local1[_local2] = _local3; if (global_stats[_yt755] >= 100){ Achievements.unlock(Achievements._hu830); }; if (global_stats[_bx16] >= 100000){ Achievements.unlock(Achievements._pa799); }; } final private function update(_arg1:Event):void{ if (!_le358){ tick(); }; _id153(); } final private function _dg888(_arg1:int, _arg2:int):void{ var _local3:int; var _local4:int; var _local5:int; var _local6:Boolean; if (_lf721[_arg1][_arg2] != -1){ _local3 = _lf721[_arg1][_arg2]; _local4 = _ci806(_arg1, true); _local5 = _we839(_arg2, true); _local6 = true; switch (_local3){ case _dm287: if (bonus_type == -1){ if (++_aw828 == 3){ _ju756(_em633); }; }; _mo28 = 0.7; Audio._ml388(Res._rr525[_dy627(3)]); _fh639(_cx259, _local4, _local5); break; case _yo361: Audio._ml388(Res._ea545); Particles.add(_local4, _local5, _yo361); Particles.add(_local4, _local5, Particles._qu15, 1); break; case _tp491: Audio._ml388(Res._jt506); Particles.add(_local4, _local5, Particles._wo491, 1); _lf721[_arg1][_arg2] = _yo361; _local6 = false; break; case _ol244: _de775 = false; Particles.add(_local4, _local5, _ol244); if (_arg2 == _sa787){ _ow499(((_nh828 + 1) * 1000), _ci806(_arg1, true), _we839((_sa787 - 1), true)); if (++_nh828 >= 10){ Achievements.unlock(Achievements._es851); }; Messages.add(Res._sa258.treasure_get); Audio._uo387(Res._nq92[_ko79()]); } else { Messages.add(Res._sa258.treasure_kill); }; break; case _wp639: case _eh883: case _ul889: case _hb361: case _re290: _lf721[_arg1][_arg2] = (_fl292 + (_local3 - _wp639)); _local6 = false; _fh639(_sh429, _local4, _local5); Audio._ml388(Res._bu786); break; default: Particles.add(_local4, _local5, _local3); break; }; if (_local6){ if (_qv386[_local3] < _kv733){ var _local7 = _qv386; var _local8 = _local3; var _local9 = (_local7[_local8] + 1); _local7[_local8] = _local9; if (_local9 == _kv733){ Audio._uo387(Res._kc787[_ko79()]); }; _he590(_local3); }; _local7 = _jx282; _local8 = _local3; _local9 = (_local7[_local8] + 1); _local7[_local8] = _local9; _mo755++; _lf721[_arg1][_arg2] = -1; } else { _xl805[_arg1][_arg2] = _sf206; }; _tn643 = _local4; last_blob_cleared_y = _local5; }; } final private function _xl419(_arg1:int=-1):void{ var _local4:String; var _local2 = 0xAEAEAE; var _local3:int; while (_local3 < _gg452) { if ((((_local3 == _arg1)) || ((_arg1 == -1)))){ switch (_local3){ case _wt748: image_score_value = Gfx._xf630(Utils._cc744(_xr859), -1, irrcrpt("icog_hqpv", 2), 20, 0x808080); break; case _ps807: image_hiscore_value = Gfx._xf630(Utils._cc744(hiscore_display), -1, irrcrpt("lfrj_ktsy", 5), 20, 0x808080); break; case _kl113: if (_ah358 != _tr576){ image_stat_label = Gfx._xf630(((_ah358 == _fc162)) ? Res._sa258.time : Res._sa258.moves, -1, irrcrpt("jdph_irqw", 3), 24, 0xAEAEAE); }; break; case _qm873: if (_ah358 != _tr576){ _local4 = ((_ah358 == _fc162)) ? Utils._rg731((_ri823 - _sq917[_ej716]), false) : Math.max(0, (_iq857 - _sq917[_lh149])).toString(); image_stat_value = Gfx._xf630(_local4, -1, irrcrpt("keqi_jsrx", 4), 20, 0x808080); }; break; }; }; _local3++; }; } final private function _to241():void{ var _local1:int; var _local2:int; _de775 = false; _nh828 = 0; _local1 = 0; while (_local1 < _vq553) { _lf721[_local1] = new Array(_ap710); _lv491[_local1] = new Array(_ap710); _wl753[_local1] = new Array(_ap710); _xl805[_local1] = new Array(_ap710); _yl723[_local1] = new Array(_ap710); _local2 = 0; while (_local2 < _ap710) { _lv491[_local1][_local2] = 0; _wl753[_local1][_local2] = 0; _xl805[_local1][_local2] = _sf206; _yl723[_local1][_local2] = 0; _es159(-1, _local1, _local2); _local2++; }; _local1++; }; } final private function _cq637():void{ if (!paused){ _nu123(); _ai508 = (_ai508 + 0.05); if (((((ticks % 10) == 0)) && ((++_yh722 >= 6)))){ _yh722 = 0; }; }; } final private function _cm275():void{ var _local1:int; var _local2:int; _local1 = 0; while (_local1 < _vq553) { _local2 = 1; while (_local2 < _ap710) { if (_lf721[_local1][_local2] >= _wp639){ var _local3 = _yl723[_local1]; var _local4 = _local2; var _local5 = (_local3[_local4] + 1); _local3[_local4] = _local5; if (_local5 >= Res._ku785){ _yl723[_local1][_local2] = -((100 + _dy627(100))); }; }; _local2++; }; _local1++; }; } final private function _ci806(_arg1:int, _arg2:Boolean=false):int{ return (((_ai243 + (_arg1 * _bx360)) + (_arg2) ? (_bx360 >> 1) : 0)); } public function _vr142(_arg1:String):void{ } final private function _gs169(_arg1:int, _arg2:int):void{ if (((((((((((_db77(_arg1, _arg2)) && (!((_lf721[_arg1][_arg2] == _dm287))))) && ((((_km529.value > 0)) || (_mx752(_arg1, _arg2)))))) && ((((((_lf721[_arg1][_arg2] == _aa341)) || ((_aa341 == -1)))) || ((_lf721[_arg1][_arg2] == _xn486)))))) && ((_xl805[_arg1][_arg2] == _sf206)))) && (!((_lf721[_arg1][_arg2] == -1))))){ if ((((_aa341 < 0)) && (!((_lf721[_arg1][_arg2] == _xn486))))){ _aa341 = _lf721[_arg1][_arg2]; }; if ((((_km529.value < 1)) || (((Math.abs((mouse_column - _arg1)) + Math.abs((mouse_row - _arg2))) < 2)))){ if (!_tp394){ _tp394 = true; _av219.graphics.clear(); _av219.graphics.moveTo(mouseX, mouseY); _av219.graphics.lineStyle(_me188, 0xFFFFFF); _dx554 = mouseX; prev_mouseY = mouseY; prev_mouse_c = mouse_column; prev_mouse_r = mouse_row; Audio._uo387(Res._is187[_ko79()]); } else { Audio._uo387(Res._is187[_ko79()]); }; _xl805[_arg1][_arg2] = SELECTED; mouse_column = _arg1; mouse_row = _arg2; _km529.addValue(1); _bu551(); }; } else { _ni618(true); }; } final private function _lj34(_arg1:int, _arg2:Boolean=true, _arg3:Number=1):void{ if (_arg2){ _sq917[_arg1] = (_sq917[_arg1] + _arg3); } else { _sq917[_arg1] = Math.max(_arg3, _sq917[_arg1]); }; hi_stats[_arg1] = Math.max(_sq917[_arg1], hi_stats[_arg1]); } final private function _dr686(_arg1:Class, _arg2:Boolean=true, _arg3:Boolean=true, _arg4:int=0, _arg5:int=0):void{ _uo163 = new (_arg1); _uo163.tabEnabled = false; _uo163.x = (_tc118 + _arg4); _uo163.y = (_sn405 + _arg5); if (_arg2){ _uo163.play(); } else { _uo163.stop(); }; if (!sfx_on){ _uo163.soundTransform = new SoundTransform(0); }; if (_arg3){ addChild(_uo163); }; } final private function _kx31():void{ if (show_level_up_text){ Gfx._wq819(_ec365, Res._ts332, (_tc118 - _ti245), _sn405, 0, 1, 1, (_uf814 | _ew507)); }; Gfx._wq819(_ec365, _ci296, 0, 7); Gfx._wq819(_ec365, image_score_value, 210, 41, 0, 1, 1, (TOP | RIGHT)); Gfx._wq819(_ec365, image_hiscore_value, 210, 93, 0, 1, 1, (TOP | RIGHT)); if (_ah358 != _tr576){ Gfx._wq819(_ec365, Res._kx634, 0, 137); Gfx._wq819(_ec365, image_stat_label, 6, 144); if ((((((((_ah358 == _fc162)) && (((_ri823 - _sq917[_ej716]) > 10000)))) || ((((_ah358 == _pm286)) && (((_iq857 - _sq917[_lh149]) > 4)))))) || (((ticks % 10) < 5)))){ Gfx._wq819(_ec365, image_stat_value, 210, 162, 0, 1, 1, (TOP | RIGHT)); }; }; if (((!(paused)) && (!(_qa301)))){ Gfx._wq819(_ec365, Res._wu452, _im10, _ry871); if (((((((_tp394) && ((_oy688 == _aw882)))) && ((_km529.value > 1)))) && ((_xl805[mouse_column][mouse_row] == SELECTED)))){ Gfx._wq819(_ec365, image_chain_length, mouseX, mouseY, 0, 1, 1, (BOTTOM | LEFT)); }; }; if ((((((((hint_timer <= 0)) && (!(paused)))) && (!(_qa301)))) && (!(_ho474)))){ Gfx._wq819(_ec365, Res._td334, (_js806 - (Math.cos(hint_angle) * 8)), (hint_y - (Math.cos(hint_angle) * 8)), 0, 1, 1, (BOTTOM | RIGHT)); }; } final private function _pj399():void{ var _local1:int = Res._ht708.width; var _local2 = 20; var _local3:BitmapData = Gfx._xf630((((((_ky813(irrcrpt("mtb_yt_uqfd", 5)) + irrcrpt(" (", 4)) + (_na225 + 1)) + "/") + _sl87) + ")"), -1, irrcrpt("jdph_irqw", 3), 22, 0x808080); var _local4:String = (irrcrpt("xyxsvmep_", 4) + _na225); var _local5:BitmapData = Gfx._xf630(Res._sa258[_local4], 235, irrcrpt("jdph_irqw", 3), 12, 0x808080); var _local6:int = ((((((_local2 + _local3.height) + _local2) + _local5.height) + _local2) + Res._ac799[_na225][0].height) + _local2); _un326 = new BitmapData(_local1, Res._ht708.height, true, 0); Gfx._wq819(_un326, Res._ht708); Gfx._wq819(_un326, _local3, (_local1 >> 1), _local2, 0, 1, 1, (TOP | _ew507), null); Gfx._wq819(_un326, Gfx._fa185, (_local1 >> 1), (45 + 75), 0, 1, 1, (_uf814 | _ew507)); tutorial_image_index = 0; tutorial_image_timer = 0; tutorial_image_opacity = 0; Menu.reset(); if (_na225 > 0){ Menu._oh373("", Menu._fx903, (_tc118 >> 1), 445, (TOP | _ew507)); }; Menu._oh373(Res._sa258.exit, Menu._nm694, _tc118, 445, (TOP | _ew507)); if (_na225 < (_sl87 - 1)){ Menu._oh373("", Menu._rs848, (_tc118 + (_tc118 >> 1)), 445, (TOP | _ew507)); }; } final private function _vu798():void{ var _local1:int; var _local2:int; var _local3:int; _ck148 = false; _tp394 = false; hint_timer = HINT_TIMER_MAX; _av219.graphics.clear(); _ik515 = _bt192; _local1 = 0; while (_local1 < 2) { _local2 = 0; while (_local2 < _vq553) { _local3 = 0; while (_local3 < _ap710) { if (_xl805[_local2][_local3] != _sf206){ if ((((_local1 == 0)) && (!((_lf721[_local2][_local3] == _dm287))))){ _dg888(_local2, _local3); } else { if ((((_local1 == 1)) && ((_lf721[_local2][_local3] == _dm287)))){ switch (_xl805[_local2][_local3]){ case _rn375: _ik515 = _jy518; _xl805[_local2][_local3] = SELECTED; break; case SELECTED: _dg888(_local2, _local3); break; }; }; }; }; _local3++; }; _local2++; }; _local1++; }; _lj34(_oa494, false, _km529.value); if (_km529.value > 4){ if (_km529.value >= 30){ Achievements.unlock(Achievements._lc481); }; if (_km529.value >= 20){ Achievements.unlock(Achievements._yc627); }; if (_km529.value >= 10){ Achievements.unlock(Achievements._lk178); }; }; switch (_km529.value){ case 3: Audio._uo387(Res._gw549[0]); break; case 4: Audio._uo387(Res._gw549[1]); break; default: Audio._uo387(Res._gw549[2]); break; }; } final private function _sh866(_arg1:KeyboardEvent):void{ var _local2:int; if (debug){ switch (_arg1.keyCode){ case Keyboard.UP: _iy112.z--; break; case Keyboard.DOWN: _iy112.z++; break; case Keyboard.NUMPAD_MULTIPLY: _le358 = !(_le358); break; case Keyboard.END: _lf766(true); break; case Keyboard.ENTER: _local2 = 0; while (_local2 < _nl348) { _qv386[_local2] = _kv733; _local2++; }; break; case Keyboard.SPACE: if (_le358){ tick(); }; break; case Keyboard.ESCAPE: _jx923(); break; case Keyboard.CONTROL: if (debug){ if (!_qp871){ addChild(_tg284); } else { removeChild(_tg284); }; _qp871 = !(_qp871); }; break; case Keyboard.BACKSPACE: _bh368 = _dq259; Menu.reset(); _ee210(); addChild(new Stats()); if (Preloader._bw689){ MochiSocial.hideLoginWidget(); }; break; case Keyboard.TAB: _tx416 = ((_tx416 == 0)) ? 1 : 0; break; case Keyboard.NUMPAD_0: Achievements.unlock(_dy627(Achievements._lu242)); break; case Keyboard.NUMPAD_1: _vo500++; break; }; } else { switch (_arg1.keyCode){ case Keyboard.F3: if (((((!(debug)) && ((_bh368 == _ym563)))) && ((Preloader.host.length == 0)))){ debug = true; _tg284 = new Stats(); Audio._uo387(Res._uc292[2]); }; break; case Keyboard.SPACE: if ((((_bh368 == _qw186)) && (!(paused)))){ one_click = !(one_click); if (_jh783()){ _ni618(false, true); Messages.add(Menu.getString(Menu._lb14), Res._wx461[_ko79()]); }; }; break; case Keyboard.ESCAPE: if (_bh368 == _qw186){ _jx923(); }; break; }; }; } final private function _hk387():void{ if (_uo163 != null){ _uo163.stop(); _uo163 = null; }; } final private function drawBackground():void{ var _local1:int; Gfx._wq819(_ec365, Res._qi385[(daytime) ? 0 : 7], 0, 0, 0, 1, 1, -1, null, false, false, _pn357, 349); if (_td676.quality != irrcrpt("QTB", 5)){ _local1 = 0; while (_local1 < _is451) { if (_yh274[_local1] < _pn357){ Gfx._wq819(_ec365, Res._wl255[(_fp607[_local1] + (daytime) ? 0 : 5)], _yh274[_local1], _ty538[_local1]); }; _local1++; }; }; if (_td676.quality == irrcrpt("QTB", 5)){ Gfx._wq819(_ec365, Res._qi385[(daytime) ? 1 : 8], -16, 349, 0, 1, 1, -1, null, false, false, 672, 131); } else { _local1 = 0; while (_local1 < _jl492) { _mf531.y = (_local1 * _br567); _dn906.x = (-16 + (Math.sin((_ai508 + (_local1 * 0.8))) * _local1)); _dn906.y = (349 + (_local1 * _br567)); _ec365.copyPixels(Res._qi385[(daytime) ? 1 : 8], _mf531, _dn906); _local1++; }; }; Gfx._wq819(_ec365, Res._qi385[(daytime) ? 2 : 9], 0, _gt481, 0, 1, 1, (BOTTOM | LEFT), null, false, false, _pn357, 96); Gfx._wq819(_ec365, Res._qi385[(daytime) ? 3 : 10], 0, (_gt481 - 114), _yh722, 1, 6, -1, null, false, false, _pn357, 60); _mi594(false); if ((((_bh368 == _qw186)) && ((_mo28 > 0)))){ if (_td676.quality != irrcrpt("ORZ", 3)){ Gfx._xk303(_ec365, _mo28); }; _mo28 = (_mo28 - 0.1); }; } final private function tick():void{ var _local1:int; ticks++; Audio.tick(); _cq637(); switch (_bh368){ case _qf537: if (((!((_uo163 == null))) && ((_uo163.currentFrame >= _uo163.totalFrames)))){ _ee210(); startTransition(_ym563); }; break; case _dq259: if ((ticks % 20) == 0){ }; break; case _ym563: if (((!((_uo163 == null))) && ((_uo163.currentFrame >= _uo163.totalFrames)))){ _uo163.stop(); }; break; case _yd763: Messages.tick(); break; case _qw186: if (!paused){ _sv582(); _pg63(); if (_ss89 > 0){ _ss89 = (_ss89 - 0.05); }; } else { if (_ss89 < 0.8){ _ss89 = (_ss89 + 0.05); }; }; break; case _pj255: _pg63(); _tp655(); if (messages_on){ Messages.tick(); }; break; case _mc578: if (_tw270 < 1){ _tw270 = (_tw270 + 0.1); }; break; }; _rj787 = getTimer(); if (Menu._xy601){ Menu.tick(); }; if (_mj416 != 0){ _fq683(); }; } public function _vl637(_arg1:Object):void{ } final private function _ad444(_arg1:int, _arg2:int, _arg3:Boolean=true):void{ var _local5:int; var _local6:int; if (!_fp688(_lf721[_arg1][_arg2])){ return; }; _ck148 = false; var _local4 = (_lf721[_arg1][_arg2] == _xn486); var _local7:int; var _local8 = -1; _local5 = 0; while (_local5 < (_local4) ? 7 : 1) { if (((!(_local4)) || (((!((_local5 == _yo361))) || (_xx60))))){ _ni618(false, false); _local6 = _cu864(_arg1, _arg2, (_local4) ? _local5 : _lf721[_arg1][_arg2]); if (_local6 > _local7){ _local7 = _local6; _local8 = _local5; }; }; _local5++; }; if (_local7 > 2){ if (_local4){ _ni618(false, false); _cu864(_arg1, _arg2, _local8); }; _tp394 = true; _aa341 = (_local4) ? _local8 : _lf721[_arg1][_arg2]; _km529.setValue(_local7); if (_arg3){ Audio._uo387(Res._is187[_ko79()]); }; } else { _ni618(false, false); }; _bu551(); } final private function _ct727(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int):Boolean{ if (((!(_db77(_arg4, _arg5))) || (!((_xl805[_arg4][_arg5] == _sf206))))){ return (false); }; if (((!((_lf721[_arg4][_arg5] == _arg1))) && (!((_lf721[_arg4][_arg5] == _xn486))))){ return (false); }; return (true); } final private function _if749(_arg1:Object):void{ MochiSocial.removeEventListener(MochiSocial.ACTION_COMPLETE, _rh179); MochiSocial.removeEventListener(MochiSocial.ACTION_CANCELED, _if749); } final private function _fq75():void{ var _local1:int; while (_local1 < _bo340) { if (_ve792[_local1] != -1){ Gfx._wq819(_ec365, Res._lg219[_ve792[_local1]], _gq853[_local1], _vc806[_local1], _tp417[_local1], _be329[_ve792[_local1]], 1, (_ew507 | _uf814)); }; _local1++; }; } public function _di780(_arg1:String):void{ } final private function _io685(_arg1:MouseEvent):void{ if (_mj416 == 0){ if (((Menu._xy601) && ((Menu._jw485 >= 0)))){ _ya652(Menu._ao442[Menu._jw485]); } else { switch (_bh368){ case _qf537: _ee210(); startTransition(_ym563); break; case _ym563: _ya652(Menu._nm694); break; case _qw186: if (_jh783()){ switch (_oy688){ case _aw882: if (((_ck148) && (_tp394))){ if (_km529.value <= 1){ _ck517(false); } else { if (_km529.value == 2){ _ni618(true, false); } else { if (_km529.value >= 3){ _mo755 = 0; _vu798(); _ui149(mouse_column, mouse_row); }; }; }; }; break; case _lo782: _ni618(false, true); if (((!((_xs820 == -1))) && ((_qv386[_xs820] >= _kv733)))){ _ed366(_xs820); }; break; case _gf503: pause(); break; default: _ni618(true, true); break; }; }; break; }; }; }; _ck148 = false; } final private function _hd530(_arg1:int, _arg2:Number):void{ graphics.beginFill(_arg1, _arg2); graphics.drawRect(0, 0, _pn357, _gt481); graphics.endFill(); } final private function pause():void{ if (((((((!(paused)) && ((_bh368 == _qw186)))) && ((_mj416 == 0)))) && (!(_bk42.visible)))){ _ni618(false); paused = true; Menu.setup(Menu._xy47); Audio._uo387(Res._wx461[_ko79()]); if (bloke_on){ _uo163.stop(); }; }; } final private function _ha399(_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 = _wl753[_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 (((((_db77(_local8, _local9)) && ((_lf721[_local8][_local9] == _dm287)))) && ((_wl753[_local8][_local9] == _local11)))){ ++_local10; if (_local10 == 4){ return (true); }; }; _local5++; }; _local4++; }; _local7++; }; _local6++; }; return (false); } final private function _ss533(_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 _wm434():void{ cleanUp(); Audio._te326(Res._hk607); _vg295 = 0; Menu.setup(Menu._uy637); if (Preloader._bw689){ MochiSocial.showLoginWidget({x:8, y:(_gt481 - 40)}); }; if (Preloader._eb352){ _dr686(Res._vr906, true, true, (-560 + 470), -56); }; } final private function _id66():void{ var _local1:int; var _local2:int; var _local3:int; var _local4:int = (_gb26 + board_yo); _local3 = 0; while (_local3 < 2) { _local2 = 0; while (_local2 < _nl348) { _local1 = ((_ci275 + (_local2 * _nc804)) + (_nc804 >> 1)); if (_local3 == 0){ if ((((_local2 == _jk578)) && ((_qv386[_local2] >= _kv733)))){ Gfx._wq819(_ec365, Res._gs209[clear_colour], _local1, _local4, ((Res._nx551 / _kv733) * _qv386[_local2]), Res._nx551, 1, (TOP | _ew507)); } else { Gfx._wq819(_ec365, Res._gs209[_local2], _local1, _local4, ((Res._nx551 / _kv733) * _qv386[_local2]), Res._nx551, 1, (TOP | _ew507)); }; } else { if (_qv386[_local2] >= _kv733){ Gfx._wq819(_ec365, Res._oj410, _local1, (_local4 - 20), 0, 1, 1, (TOP | _ew507), new ColorTransform(1, 1, 1, (0.5 + (Math.sin(_cl441) * 0.5)))); }; Gfx._wq819(_ec365, _he580[_local2], _local1, _local4, 0, 1, 1, (_uf814 | _ew507)); }; _local2++; }; _local3++; }; if ((((((_oy688 == _lo782)) && (!(_qa301)))) && (!(paused)))){ if (bonus_desc_scale < 1){ bonus_desc_scale = Math.min(1, (bonus_desc_scale = (bonus_desc_scale + 0.1))); }; Gfx._tf167(_ec365, _sn584, _ke629, (_local4 - 5), 0, 1, 1, (BOTTOM | _ew507), null, 1, bonus_desc_scale); }; } final private function _mi594(_arg1:Boolean):void{ var _local2:int; var _local3:int; if (_td676.quality != irrcrpt("NQY", 2)){ _local3 = 0; while (_local3 < _cr778) { _local2 = _tm447[(_local3 << 2)]; if (((((_arg1) && ((_local2 >= 2)))) || (((!(_arg1)) && ((_local2 < 2)))))){ Gfx._tf167(_ec365, Res._qi385[(_local2 + (daytime) ? 4 : 11)], _tm447[((_local3 << 2) + 1)], _tm447[((_local3 << 2) + 2)], 0, 1, 1, (BOTTOM | LEFT), null, 1, (0.9 + (Math.sin(_ai508) * (((_local3 % 2) == 0)) ? 0.1 : -0.1)), _tm447[((_local3 << 2) + 3)]); }; _local3++; }; }; } public function _dt554(_arg1:Object):void{ MochiSocial.getFriendsList(); switch (_bh368){ case _qw186: if (_qa301){ _qj648(); }; break; case _ym563: break; }; } final private function _fl302():void{ _aw317(irrcrpt("psehHexe()", 4)); try { if (_if753.data.exists){ music_on = _if753.data.music_on; sfx_on = _if753.data.sfx_on; daytime = _if753.data.daytime; one_click = _if753.data.one_click; bloke_on = _if753.data.bloke_on; messages_on = _if753.data.messages_on; hiscore_casual.setValue(_if753.data.hiscore_casual); hiscore_3_minutes.setValue(_if753.data.hiscore_3_minutes); hiscore_100_moves.setValue(_if753.data.hiscore_100_moves); hi_stats = _if753.data.hi_stats; global_stats = _if753.data.global_stats; Achievements.achievement_unlocked = _if753.data.achievement_unlocked; }; } catch(e:Error) { _aw317((irrcrpt("fssps = ", 1) + e)); }; _xx60 = (Achievements.achievement_unlocked.indexOf(false) == -1); } final private function _nu123():void{ var _local1:int; while (_local1 < _is451) { _yh274[_local1] = (_yh274[_local1] + _cn144[_local1]); if ((_yh274[_local1] + _am713[_fp607[_local1]]) < 0){ _kn727(_local1); }; _local1++; }; } final private function _nx870():void{ _ec365.draw(_uo163, new Matrix(1, 0, 0, 1, 120, 350), null, null, null, false); } final private function _af777():void{ var _local1:int; var _local2:int; var _local3:int; var _local4:Array; bonus_effect_timer--; switch (bonus_type){ case _na94: if (_bk42.rotationX > -180){ _bk42.rotationX = (_bk42.rotationX - _gt718); if (!_jw64){ if (_bk42.rotationX <= -90){ _jw64 = true; _local4 = new Array(_vq553); _local3 = 0; while (_local3 < 2) { _local1 = 0; while (_local1 < _vq553) { if (_local3 == 0){ _local4[_local1] = new Array(_ap710); _local2 = 1; while (_local2 < _ap710) { _local4[_local1][_local2] = _lf721[_local1][(_ap710 - _local2)]; _local2++; }; } else { _local2 = 1; while (_local2 < _ap710) { _lf721[_local1][_local2] = _local4[_local1][_local2]; _yl723[_local1][_local2] = 0; _local2++; }; }; _local1++; }; _local3++; }; _du149(_rd366, false); _bk42.rotationX = 90; }; } else { if (_bk42.rotationX <= 0){ _bk42.rotationX = 0; _bk42.visible = false; _di591 = 1; bonus_effect_timer = 0; _ji889(); }; }; }; break; case _yi54: _ch264(); break; }; if (bonus_effect_timer <= 0){ bonus_type = -1; }; } final private function _ch309():void{ var _local2:int; var _local3:int; var _local1:int; _local2 = 0; while (_local2 < _vq553) { _local3 = 0; while (_local3 < _ap710) { if ((((_lf721[_local2][_local3] == _dm287)) && ((_xl805[_local2][_local3] == SELECTED)))){ _local1++; _kd904(_local2, _local3, true, false); }; _local3++; }; _local2++; }; if (_local1 > 0){ _vu798(); } else { _tl561(); }; } final private function _es159(_arg1:int, _arg2:int, _arg3:int):void{ if (_arg1 == -1){ if (((((((!((bonus_type == _yi54))) && (!(_de775)))) && ((_dy627(20) == 0)))) && ((_arg3 < 3)))){ _arg1 = _ol244; _de775 = true; } else { if (_dy627(100) < 3){ _arg1 = _xn486; } else { if ((((_vo500 > 1)) && ((_dy627(100) < (3 + _vo500))))){ _arg1 = (_wp639 + _dy627(_ur614)); } else { _arg1 = _dy627(((_vo500 > 0)) ? _ur614 : (_ur614 - 1)); }; }; }; }; _lf721[_arg2][_arg3] = _arg1; _yl723[_arg2][_arg3] = 0; } final private function _we839(_arg1:int, _arg2:Boolean=false):int{ return (((_wp621 + (_arg1 * _yq547)) + (_arg2) ? (_yq547 >> 1) : 0)); } final private function _nj149():void{ Audio._vt779(Res._ai165); switch (++_vo500){ case 2: case 4: _vg295++; break; }; _ti245 = _pn357; show_level_up_text = true; } final private function _mu340(_arg1:Event):void{ pause(); } final private function _mu222(_arg1:int, _arg2:int, _arg3:int, _arg4:int, _arg5:int, _arg6:int=0):void{ _arg1 = (_arg1 + Gfx._aj377(_arg5, _arg3)); _arg2 = (_arg2 + Gfx._sj755(_arg5, _arg4)); Gfx._wq819(_ec365, Res._ch390, _arg1, _arg2); Gfx._wq819(_ec365, Res._ch390, (_arg1 + _arg3), _arg2, 0, 1, 1, (TOP | RIGHT), null, true); Gfx._wq819(_ec365, Res._ch390, _arg1, (_arg2 + _arg4), 0, 1, 1, (BOTTOM | LEFT), null, false, true); Gfx._wq819(_ec365, Res._ch390, (_arg1 + _arg3), (_arg2 + _arg4), 0, 1, 1, (BOTTOM | RIGHT), null, true, true); } final private function _cu864(_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; _xl805[_arg1][_arg2] = SELECTED; while (_local8) { _local8 = false; _local4 = 0; while (_local4 < _vq553) { _local5 = 1; while (_local5 < _ap710) { if (_xl805[_local4][_local5] != _sf206){ _local6 = -1; while (_local6 < 2) { _local7 = -1; while (_local7 < 2) { if ((Math.abs(_local6) + Math.abs(_local7)) < 2){ if (_ct727(_arg3, _local4, _local5, (_local4 + _local6), (_local5 + _local7))){ _xl805[(_local4 + _local6)][(_local5 + _local7)] = SELECTED; _local8 = true; _local9++; }; }; _local7++; }; _local6++; }; }; _local5++; }; _local4++; }; }; return (_local9); } final private function _ia20():int{ var _local1:int; if (_ss533(_ai243, (_wp621 + _yq547), _jv387, (_og592 - _yq547))){ _xs820 = -1; return (_aw882); }; if (_ss533(_ci275, _gb26, (_nc804 * _nl348), _vi172)){ _local1 = _xs820; _xs820 = _uh844(); if (_xs820 != _local1){ _sn584 = Gfx._xf630(_so402(_xs820), -1, irrcrpt("lfrj_ktsy", 5), 12, 0xFFFFFF, true); bonus_desc_scale = 0; }; return (_lo782); }; if (_ss533(_im10, _ry871, _eq374, _hr769)){ return (_gf503); }; return (_ak376); } final private function _ta717(_arg1:Boolean=false):void{ var _local2:int; var _local3:int; var _local4:int; if (((!(_arg1)) && ((_ah358 == _pm286)))){ _local2 = (_iq857 - _sq917[_lh149]); _local2 = Math.max(0, _local2); if (((((_local2 % 10) == 0)) || ((_local2 == 1)))){ Messages.add(((_local2.toString() + " ") + ((_local2 == 1)) ? Res._sa258.move_left : Res._sa258.moves_left)); }; if (_local2 <= 0){ _lf766(false); }; }; if (!_qa301){ _gn248 = 0; _local3 = 0; while (_local3 < _vq553) { _local4 = 1; while (_local4 < _ap710) { if ((((_lf721[_local3][_local4] == _dm287)) || (_mx752(_local3, _local4)))){ _gn248++; if ((((_gn248 == 0)) || ((Math.random() < 0.5)))){ _js806 = _ci806(_local3); hint_y = _we839(_local4); hint_timer = HINT_TIMER_MAX; }; }; _local4++; }; _local3++; }; switch (_gn248){ case 0: if (_arg1){ _es159(_fl292, 4, 5); _es159(_fl292, 5, 5); _es159(_fl292, 5, 6); } else { _lf766(false); }; break; case 1: case 2: case 3: Messages.add(Res._sa258.warning); _ju756(_bs99); break; }; }; } final private function _ow499(_arg1:int, _arg2:int, _arg3:int):void{ var _local4:int; _bk489(_arg1); _lj34(_dt367, false, _arg1); if (messages_on){ _dp110[_sw47] = _arg3; _ey156[_sw47] = 1; _kc438[_sw47] = 30; _hx120[_sw47] = Gfx._xf630(Utils._cc744(_arg1), -1, irrcrpt("icog_hqpv", 2), 20, 0xFFFFFF, true); _local4 = _hx120[_sw47].width; _bf159[_sw47] = (_arg2 - (_local4 >> 1)); if (++_sw47 >= _ac224){ _sw47 = 0; }; }; } final private function _jh783():Boolean{ if (((((((((((!(_ho474)) && (!(paused)))) && (!(_qa301)))) && (!(_ww846)))) && ((_ik515 <= 0)))) && ((bonus_effect_timer <= 0)))){ return (true); }; return (false); } public function _pm279(_arg1:Object):void{ _vl825 = false; switch (_bh368){ case _qw186: if (_qa301){ _qj648(); }; break; case _ym563: break; }; } final private function _mx752(_arg1:int, _arg2:int):Boolean{ var _local4:int; var _local5:int; if (!_fp688(_lf721[_arg1][_arg2])){ return (false); }; var _local3 = (_lf721[_arg1][_arg2] == _xn486); _local4 = 0; while (_local4 < (_local3) ? 7 : 1) { _local5 = _cu864(_arg1, _arg2, (_local3) ? _local4 : _lf721[_arg1][_arg2]); _ni618(false, false); if (_local5 > 2){ return (true); }; _local4++; }; return (false); } final private function _ui149(_arg1:int, _arg2:int):void{ var _local3 = -1; if (_km529.value == 3){ _local3 = ((_vo500 > 2)) ? _tp491 : _yo361; Audio._uo387(Res._fl871); } else { if (_km529.value >= 5){ _local3 = _dm287; Audio._uo387(Res._id875[_ko79()]); }; }; if (_km529.value >= 5){ if (++_yc85 >= 4){ _yc85 = 0; _ju756(_yi299); } else { _ju756(_ib875); }; } else { if (_km529.value == 3){ _yc85 = 0; _ju756(_ea447); }; }; if (_local3 != -1){ _es159(_local3, _arg1, 0); }; } final private function _id153():void{ var _local1:int; var _local2:int; var _local3:int; var _local4:String; var _local5:Array; var _local6:String; var _local7:int; switch (_bh368){ case _ln566: _ec365.fillRect(_ec365.rect, 0xFFFFFF); break; case _dq259: _ec365.fillRect(_ec365.rect, 0x5500); Gfx._kd615(_ec365, (irrcrpt("whvw_prgh = ", 3) + _tx416.toString()), 8, (_gt481 - 8), (BOTTOM | LEFT), null, irrcrpt("icog_hqpv", 2), 32); break; case _cj173: drawBackground(); Gfx._wq819(_ec365, _un326, _tc118, 9, 0, 1, 1, (TOP | _ew507)); Gfx._wq819(_ec365, Res._ac799[_na225][tutorial_image_index], _tc118, 206, 0, 1, 1, (TOP | _ew507), null); _local2 = Res._ac799[_na225].length; if (_local2 > 1){ if (++tutorial_image_timer > 70){ Gfx._wq819(_ec365, Res._ac799[_na225][((tutorial_image_index + 1) % _local2)], _tc118, 206, 0, 1, 1, (TOP | _ew507), 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 _ym563: case _eh786: drawBackground(); break; case _yd763: drawBackground(); if (debug){ Gfx._kd615(_ec365, irrcrpt("Fgdwiikpi qp!", 2), 8, 8, -1, null, irrcrpt("jdph_irqw", 3), 16, 0xFFFFFF); }; Messages.draw(); break; case _qw186: drawBackground(); if (!_ho474){ if (!_bk42.visible){ _du149(_ec365, true); }; if (_tp394){ _ec365.draw(_av219); }; _id66(); }; _cw875(); if (_ss89 > 0){ Gfx._xk303(_ec365, _ss89); }; break; case _pj255: drawBackground(); if (board_yo < _gt481){ Gfx._gp45(_ec365, _rd366, _ke629, (419 + board_yo), (_ew507 | BOTTOM), null, _xm80); _id66(); }; _cw875(); switch (Preloader.version){ case Preloader._sf918: Gfx._wq819(_ec365, Res._qr133, _tc118, ((_sn405 - 100) + _bb827), 0, 1, 1, (_uf814 | _ew507)); break; default: _np469(_ke629, 300, false); break; }; Messages.draw(); break; case _mo346: drawBackground(); Gfx._kd615(_ec365, _yi737, 8, 8, -1, null, irrcrpt("lfrj_ktsy", 5), 12, 0xFFFFFF, false); break; case _mc578: drawBackground(); _mu222(_tc118, _sn405, 470, 246, (_ew507 | _uf814), 0); _local3 = 142; _local5 = [_oa494, _yf703, _dt367, _rm652]; _local1 = 0; while (_local1 < 4) { switch (_local5[_local1]){ case _oa494: _local4 = int(hi_stats[_oa494]).toString(); break; case _yf703: _local4 = int(hi_stats[_yf703]).toString(); break; case _dt367: _local4 = Utils._cc744(hi_stats[_dt367]); break; case _rm652: _local4 = (int(hi_stats[_rm652]).toString() + "%"); break; }; Gfx._wq819(_ec365, _ig849[_local5[_local1]], (_tc118 - 200), _local3, 0, 1, 1, -1, new ColorTransform(1, 1, 1, _tw270)); Gfx._kd615(_ec365, _local4, (_tc118 + 200), _local3, (TOP | RIGHT), new ColorTransform(1, 1, 1, _tw270), irrcrpt("icog_hqpv", 2), 16, 0xAEAEAE); _local3 = (_local3 + 25); _local1++; }; _local1 = 0; while (_local1 < _uv927) { switch (_local1){ case _bx16: case _yt755: case _mc264: _local4 = Utils._cc744(global_stats[_local1]); break; case _gn100: _local4 = Utils._rg731(global_stats[_gn100], true); break; }; Gfx._wq819(_ec365, _dc205[_local1], (_tc118 - 200), _local3, 0, 1, 1, -1, new ColorTransform(1, 1, 1, _tw270)); Gfx._kd615(_ec365, _local4, (_tc118 + 200), _local3, (TOP | RIGHT), new ColorTransform(1, 1, 1, _tw270), irrcrpt("icog_hqpv", 2), 16, 0xAEAEAE); _local3 = (_local3 + 25); _local1++; }; break; case _ww820: drawBackground(); _local1 = 0; while (_local1 < _ft51) { _local6 = (irrcrpt(" ", 3) + _ky813((irrcrpt("dfklhyhphqw_", 3) + ((_to376 * _ft51) + _local1).toString()))); Gfx._xf630(_local6, -1, irrcrpt("lfrj_ktsy", 5), 20, 0xAEAEAE); _local7 = ((_hj806 + (_local1 * _uh848)) + (Menu._fl591 >> 1)); Menu._ij427(Main._ec365, _tc118, _local7, (Gfx._fa185.width + (Menu._fy714 << 1)), (_uf814 | _ew507)); Gfx._wq819(Main._ec365, Gfx._fa185, _tc118, (_local7 + 1), 0, 1, 1, (_uf814 | _ew507)); Gfx._wq819(Main._ec365, Res._rm819, (_tc118 - (Gfx._fa185.width >> 1)), _local7, (Achievements.achievement_unlocked[(_local1 + (_to376 * _ft51))]) ? 0 : 1, 2, 1, (Gfx._uf814 | Gfx.LEFT)); _local1++; }; break; case _ev223: drawBackground(); break; }; if (Menu._xy601){ Menu.draw(); }; graphics.clear(); graphics.beginBitmapFill(_ec365, null, false, false); graphics.drawRect(0, 0, _pn357, _gt481); graphics.endFill(); if (_di591 > 0){ _hd530(0xFFFFFF, _di591); _di591 = (_di591 - 0.05); }; if (_mj416 != 0){ _hd530(0xFFFFFF, _ba59); }; } final private function _ji889():Boolean{ var _local1:Boolean; var _local2:int; while (_local2 < _vq553) { if (_lf721[_local2][_sa787] == _ol244){ _local1 = true; _yn607(_local2, _sa787, SELECTED); }; _local2++; }; if (_local1){ _vu798(); }; return (_local1); } public function _tv413(_arg1:Object):void{ switch (_arg1.id){ case _ba307: _vl825 = true; break; }; } final private function _af220():void{ if (_mj416 == 0){ _bk42.visible = true; _bk42.rotationY = (_bk42.rotationY - _gt718); if (_bk42.rotationY <= 0){ _bk42.rotationY = 0; _bk42.visible = false; _ho474 = false; _di591 = 1; Audio._uo387(Res._do821); switch (_ah358){ case _pm286: Messages.add(((_iq857.toString() + " ") + Res._sa258.moves_left)); break; }; }; }; } final private function cleanUp():void{ _ee210(); _hk387(); Menu.reset(); _ss89 = 0; _un326 = null; paused = false; } final private function _vm221():void{ var _local1:int; _cn876(0xFFFFFF); Particles.init(); Messages.init(); _local1 = 0; while (_local1 < _bo340) { _ve792[_local1] = -1; _local1++; }; _local1 = 0; while (_local1 < _ac224) { _ey156[_local1] = 0; _local1++; }; _local1 = 0; while (_local1 < _nl348) { _qv386[_local1] = (_jx282[_local1] = 0); _jx282[_local1] = 0; _local1++; }; _he590(-1); _local1 = 0; while (_local1 < _eq880) { _sq917[_local1] = (_ff726[_local1] = 0); _local1++; }; _local1 = 0; while (_local1 < _rd679) { _nc820[_local1] = false; _local1++; }; _iu626 = 0; _vo500 = 0; show_level_up_text = false; _qq566.setValue(0); _xr859 = 0; hiscore_display = _ec37(_ah358); _ho474 = true; paused = false; _qa301 = false; new_hiscore = false; _pc34 = false; _ww846 = false; _ik515 = 0; bonus_type = -1; bonus_effect_timer = 0; _xs820 = -1; _sw47 = 0; _dm922 = 0; _yc85 = 0; _xl419(-1); _to241(); _ni618(false, true); _du149(_rd366, false); _bk42.visible = false; _bk42.rotationY = _qk254; _di591 = 0; _xm80 = 0; board_yo = 0; board_vy = 0; Audio._te326(Res._hk607); _vg295 = 0; _ta717(true); _ju756(_se651); Audio._uo387(Res._wd694); Audio._uo387(Res._be288); } final private function _dm625():void{ _aw317(irrcrpt("vdyhGdwd()", 3)); try { _if753.data.exists = true; _if753.data.music_on = music_on; _if753.data.sfx_on = sfx_on; _if753.data.daytime = daytime; _if753.data.one_click = one_click; _if753.data.bloke_on = bloke_on; _if753.data.messages_on = messages_on; _if753.data.hiscore_casual = hiscore_casual.value; _if753.data.hiscore_3_minutes = hiscore_3_minutes.value; _if753.data.hiscore_100_moves = hiscore_100_moves.value; _if753.data.hi_stats = hi_stats; _if753.data.global_stats = global_stats; _if753.data.achievement_unlocked = Achievements.achievement_unlocked; _if753.flush(); } catch(e:Error) { Security.showSettings(SecurityPanel.LOCAL_STORAGE); }; } final private function _ch264():void{ var _local1:int; var _local2:int; _local1 = 0; while (_local1 < _vq553) { _local2 = 0; while (_local2 < _ap710) { _es159(-1, _local1, _local2); _local2++; }; _local1++; }; } final private function _ju756(_arg1:int):void{ _jd721 = _arg1; if (bloke_on){ if (_uo163 != null){ _uo163.stop(); }; switch (_arg1){ case _se651: _uo163 = new Res._ra568(); break; case _ij196: _uo163 = new Res._dt495(); break; case _ib875: _uo163 = new Res._rq644(); break; case _ea447: _uo163 = new Res._ty117(); break; case _yi299: _uo163 = new Res._ur115(); Audio._uo387(Res._gy750); break; case _bs99: _uo163 = new Res._tq257(); break; case _em633: _uo163 = new Res._lx487(); break; case _nk795: _uo163 = new Res._lo740(); break; }; _uo163.play(); if (!sfx_on){ _uo163.soundTransform = new SoundTransform(0); }; }; } final private function _he590(_arg1:int):void{ var _local2:int; while (_local2 < _eq880) { if ((((_local2 == _arg1)) || ((_arg1 == -1)))){ _he580[_local2] = Gfx._xf630(_qv386[_local2], -1, irrcrpt("jdph_irqw", 3), 12, (daytime) ? 0x282828 : 0xFFFFFF); }; _local2++; }; } final private function _ck517(_arg1:Boolean):void{ _ni618(false, false); switch (_lf721[mouse_column][mouse_row]){ case _dm287: _kd904(mouse_column, mouse_row, true, _arg1); break; default: _ad444(mouse_column, mouse_row, _arg1); break; }; } final private function _fa163():void{ var _local1:int; while (_local1 < _ac224) { if (_ey156[_local1] > 0){ var _local2 = _kc438; var _local3 = _local1; var _local4 = (_local2[_local3] - 1); _local2[_local3] = _local4; if (_local4 < 0){ _ey156[_local1] = (_ey156[_local1] - 0.02); }; _local2 = _dp110; _local3 = _local1; _local4 = (_local2[_local3] - 1); _local2[_local3] = _local4; }; _local1++; }; } final private function _cw875():void{ if (bloke_on){ _nx870(); }; _fq75(); Particles.draw(); _mi594(true); if (!_ho474){ _kx31(); }; _aa824(); Messages.draw(); } final private function _kd904(_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){ _yn607((_arg1 + _local7), (_arg2 + _local8), (_arg3) ? _rn375 : SELECTED); }; _local8++; }; _local7++; }; _xl805[_arg1][_arg2] = SELECTED; _aa341 = _dm287; if (_arg4){ Audio._uo387(Res._is187[_ko79()]); }; } final private function _jx923():void{ if (paused){ resume(); } else { pause(); }; } final private function _tl561():void{ var _local2:int; var _local3:int; var _local4:int; var _local1:int; _local2 = 0; while (_local2 < _vq553) { _local3 = 0; while (_local3 < _ap710) { if (((!((_xl805[_local2][_local3] == _sf206))) || ((_lf721[_local2][_local3] == -1)))){ _local1++; _xl805[_local2][_local3] = _sf206; _local4 = _local3; while (_local4 >= 0) { _lv491[_local2][_local4] = 0.1; _local4--; }; }; _local3++; }; _local2++; }; _ow499(((_local1 * _local1) * 10), _tn643, last_blob_cleared_y); _ww846 = true; _tp394 = false; _lj34(_lh149, true, 1); switch (_ah358){ case _pm286: _xl419(_qm873); if ((((_sq917[_lh149] == 50)) || ((_sq917[_lh149] == 80)))){ Audio._vt779(Res._ai165); _vg295++; }; break; case _tr576: if ((_sq917[_lh149] % _ia103) == 0){ _nj149(); }; break; }; _lj34(_yf703, false, _aw828); if (_aw828 > 1){ Messages.add(((_aw828.toString() + " ") + Res._sa258.combo)); if (_aw828 >= 30){ Achievements.unlock(Achievements._xa301); }; if (_aw828 >= 20){ Achievements.unlock(Achievements._nv307); }; if (_aw828 >= 10){ Achievements.unlock(Achievements._ti514); }; }; var _local5:int = ((_mo755 / _kh214) * 100); _lj34(_rm652, false, _local5); if (_local5 >= 100){ Achievements.unlock(Achievements._sl879); }; if (_local5 >= 50){ Achievements.unlock(Achievements._dn277); }; if (_local5 >= 25){ Achievements.unlock(Achievements._dx141); }; if (_local5 >= 100){ Messages.add(Res._sa258.board_cleared); Audio._uo387(Res._uc292[_ko79()]); _ow499(50000, _tc118, _sn405); } else { if (_local5 >= 25){ Messages.add((_local5.toString() + Res._sa258.clearance)); }; }; _lj34(_id890, true, _mo755); if (Math.floor((_sq917[_id890] / 100)) > _dm922){ Messages.add(((Utils._cc744((++_dm922 * 100)) + " ") + Res._sa258.blobs_cleared)); }; if (_sq917[_id890] >= 3000){ Achievements.unlock(Achievements._ti208); } else { if (_sq917[_id890] >= 2000){ Achievements.unlock(Achievements._wm177); } else { if (_sq917[_id890] >= 1000){ Achievements.unlock(Achievements._xt792); }; }; }; } final private function _dy627(_arg1:int):int{ return (((_arg1 == 0)) ? 0 : Math.floor((Math.random() * _arg1))); } final private function _wd249(_arg1:int, _arg2:int):void{ switch (_arg1){ case _tr576: hiscore_casual.setValue(_arg2); break; case _fc162: hiscore_3_minutes.setValue(_arg2); break; case _pm286: hiscore_100_moves.setValue(_arg2); break; }; } final private function _rt574():void{ if (_xr859 < _qq566.value){ _xr859 = Math.min((_xr859 = (_xr859 + 250)), _qq566.value); _xl419(_wt748); }; if (hiscore_display < _ec37(_ah358)){ hiscore_display = Math.min((hiscore_display = (hiscore_display + 1000)), _ec37(_ah358)); _xl419(_ps807); }; } final private function startTransition(_arg1:int, _arg2:int=1):void{ if (_mj416 == 0){ _mj416 = _arg2; _bf705 = _arg1; _ba59 = ((_arg2 == _wk854)) ? 0 : 1; if (_arg2 == _wk854){ if (_bh368 == _yd763){ _ee210(); }; if (Preloader._bw689){ MochiSocial.hideLoginWidget(); }; }; }; } final private function _du149(_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) ? _ai243 : 0; var _local13:int = (_arg2) ? _wp621 : 0; if (!_arg2){ _arg1.fillRect(new Rectangle(_local12, _local13, Res._nw116.width, Res._nw116.height), 0); Gfx._wq819(_arg1, (daytime) ? Res._nw116 : Res._ft904); _local12 = (_local12 + 7); _local13 = (_local13 + (4 - _yq547)); } else { Gfx._wq819(_arg1, (daytime) ? Res._nw116 : Res._ft904, _ke629, 11, 0, 1, 1, (TOP | _ew507)); }; if (((((((_tp394) && ((_oy688 == _aw882)))) && ((_xl805[mouse_column][mouse_row] == SELECTED)))) && (((ticks % 8) < 5)))){ if ((((_km529.value == 3)) || ((_km529.value >= 5)))){ Gfx._wq819(_ec365, ((_km529.value == 3)) ? Res._up50 : Res._yg762, _ci806(mouse_column, true), ((_wp621 + _yq547) + 4), 0, 1, 1, (_ew507 | _uf814)); }; }; _local7 = 0; while (_local7 < 3) { _local3 = 0; while (_local3 < _vq553) { _local4 = (_ww846) ? 0 : 1; while (_local4 < _ap710) { _local8 = _lf721[_local3][_local4]; if (_local8 != -1){ _local9 = _xl805[_local3][_local4]; _local5 = (_local12 + (_local3 * _bx360)); _local6 = ((_local13 + (_local4 * _yq547)) + _wl753[_local3][_local4]); _local11 = (((((_local7 == 0)) && ((_local9 == _sf206)))) || ((((_local7 == 2)) && (!((_local9 == _sf206)))))); if ((((((_local7 == 1)) && (!((_local9 == _sf206))))) && (((ticks % 6) < 4)))){ Gfx._wq819(_arg1, Res._xe604, (_local5 + (_bx360 >> 1)), (_local6 + (_yq547 >> 1)), 0, 1, 1, (_ew507 | _uf814), null); }; if (_local11){ _local10 = ((((_local4 == 0)) && (_ww846))) ? new ColorTransform(1, 1, 1, (_wl753[_local3][_local4] / _yq547)) : null; if (_local8 >= _wp639){ Gfx._wq819(_arg1, Res._gn654, _local5, _local6, (((_local8 - _wp639) * Res._ku785) + Math.max(0, _yl723[_local3][_local4])), Res._ku785, Res._xr345, -1, _local10, false, false, 35, 39); } else { Gfx._wq819(_arg1, _tf299, _local5, _local6, _local8, _rm247, _mk833, -1, _local10, false, false, 33, 36); }; }; }; _local4++; }; _local3++; }; _local7++; }; } final private function _bu551():void{ image_chain_length = Gfx._xf630(_km529.value.toString(), -1, irrcrpt("keqi_jsrx", 4), 16, 0xFFFFFF, true); } final private function _aa824():void{ var _local1:int; while (_local1 < _ac224) { if (_ey156[_local1] > 0){ Gfx._wq819(_ec365, _hx120[_local1], _bf159[_local1], _dp110[_local1], 0, 1, 1, -1, new ColorTransform(1, 1, 1, _ey156[_local1])); }; _local1++; }; } final private function _kx501():void{ var _local1:int; while (_local1 < _bo340) { if (_ve792[_local1] != -1){ if (((!(((ticks % _qr558[_ve792[_local1]]) == 0))) && ((++_tp417[_local1] >= _be329[_ve792[_local1]])))){ _ve792[_local1] = -1; }; }; _local1++; }; } final private function _xj711():void{ var _local1:int; var _local2:int; var _local3:Boolean; _ww846 = false; _local1 = 0; while (_local1 < _vq553) { _local2 = (_ap710 - 1); while (_local2 >= 0) { if (_lf721[_local1][_local2] != -1){ if (_lv491[_local1][_local2] != 0){ _ww846 = true; if (_lv491[_local1][_local2] < _yq547){ _lv491[_local1][_local2] = (_lv491[_local1][_local2] + _kw451); }; _wl753[_local1][_local2] = (_wl753[_local1][_local2] + _lv491[_local1][_local2]); if (_wl753[_local1][_local2] >= _yq547){ _lf721[_local1][(_local2 + 1)] = _lf721[_local1][_local2]; _lf721[_local1][_local2] = -1; _lv491[_local1][(_local2 + 1)] = _lv491[_local1][_local2]; _wl753[_local1][_local2] = 0; _wl753[_local1][(_local2 + 1)] = 0; if ((((_local2 == (_ap710 - 2))) || ((((_lf721[_local1][(_local2 + 2)] > -1)) && ((_lv491[_local1][(_local2 + 2)] == 0)))))){ _lv491[_local1][_local2] = 0; _lv491[_local1][(_local2 + 1)] = 0; }; if (_local2 == 0){ _es159(-1, _local1, _local2); }; }; }; }; _local2--; }; _local1++; }; if (!_ww846){ _aa341 = -1; bonus_type = -1; prev_mouse_c = (prev_mouse_r = -1); _local3 = _ji889(); if (!_local3){ _km529.setValue(0); _ta717(false); }; }; } final private function _kn727(_arg1:int, _arg2:Boolean=false):void{ var _local3:int; while (_local3 < _is451) { if ((((_arg1 == -1)) || ((_local3 == _arg1)))){ _yh274[_local3] = ((_arg2) ? 0 : _pn357 + _dy627(_pn357)); _ty538[_local3] = (_local3 * (140 / _is451)); _cn144[_local3] = -((((_local3 + 1) << 1) * 0.125)); _fp607[_local3] = _local3; }; _local3++; }; } final private function _cm526(_arg1:Boolean):void{ } override protected function init3d():void{ _iy112.z = -2165; _bk42 = new Plane(_ow554, Res._nw116.width, Res._nw116.height, 8, 8); _ow554.interactive = false; _ow554.oneSide = true; _ow554.doubleSided = false; _ow554.smooth = false; _kh894.addChild(_bk42); _iy112.zoom = _xy926; _bk42.visible = false; } final private function _qj648():void{ if (Preloader._bw689){ MochiScores.closeLeaderboard(); }; _bh368 = _pj255; _tw270 = 0; _rl572 = _pn357; switch (Preloader.version){ case Preloader._sf918: case Preloader._nx773: break; default: Menu.reset(); if (Preloader._bw689){ Menu._oh373(Res._sa258.submit_score, Menu._lf304, _tc118, (_gt481 - 104), (_ew507 | TOP)); }; Menu._oh373(Res._sa258.retry, Menu._cl534, _tc118, (_gt481 - 69), (_ew507 | TOP)); Menu._oh373(Res._sa258.quit, Menu._by460, _tc118, (_gt481 - 34), (_ew507 | TOP)); break; }; } final private function _fp688(_arg1:int):Boolean{ switch (_arg1){ case _yo361: return (_xx60); case -1: case _tp491: case _dm287: case _wp639: case _eh883: case _ul889: case _hb361: case _re290: return (false); }; return (true); } final private function _bs283():void{ if (_uo163 != null){ if (_uo163.currentFrame >= _uo163.totalFrames){ switch (_jd721){ case _nk795: _uo163.gotoAndPlay((_uo163.totalFrames - 1)); break; case _bs99: _uo163.gotoAndPlay(44); break; case _yi299: _uo163.gotoAndPlay(0); break; default: _ju756(((Math.random() < 0.1)) ? _ij196 : _se651); break; }; }; }; } final private function _sv582():void{ _oy688 = _ia20(); mouse_column = ((mouseX - _ai243) / _bx360); mouse_row = ((mouseY - _wp621) / _yq547); if (_jh783()){ if (one_click){ if (((!((mouse_column == prev_mouse_c))) || (!((mouse_row == prev_mouse_r))))){ if (_oy688 == _aw882){ _ck517(false); prev_mouse_c = mouse_column; prev_mouse_r = mouse_row; } else { _ni618(false, true); }; }; } else { if (((!((mouseX == _dx554))) || (!((mouseY == prev_mouseY))))){ if (((_tp394) && (_ck148))){ _av219.graphics.lineStyle(_me188, 0xFFFFFF); _av219.graphics.moveTo(_dx554, prev_mouseY); _av219.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)) || (!((_oy688 == _aw882))))){ _ni618(true); } else { _gs169(mouse_column, mouse_row); prev_mouse_c = mouse_column; prev_mouse_r = mouse_row; }; }; }; }; }; if (((!((mouseX == _dx554))) || (!((mouseY == prev_mouseY))))){ hint_timer = HINT_TIMER_MAX; _dx554 = mouseX; prev_mouseY = mouseY; }; }; } final private function _cn876(_arg1:int):void{ var _local2:int; var _local3:String; _local2 = 0; while (_local2 < _eq880) { switch (_local2){ case _nw837: _local3 = Res._sa258.score; break; case _id890: _local3 = Res._sa258.summary_blobs; break; case _lh149: _local3 = Res._sa258.summary_moves; break; case _oa494: _local3 = Res._sa258.summary_chain; break; case _yf703: _local3 = Res._sa258.summary_combo; break; case _dt367: _local3 = Res._sa258.summary_bonus; break; case _rm652: _local3 = Res._sa258.summary_clearance; break; case _ej716: _local3 = Res._sa258.summary_time; break; }; _ig849[_local2] = Gfx._xf630(_local3, -1, irrcrpt("lfrj_ktsy", 5), 16, _arg1); _local2++; }; _local2 = 0; while (_local2 < _uv927) { switch (_local2){ case _bx16: _local3 = Res._sa258.total_blobs; break; case _yt755: _local3 = Res._sa258.total_games; break; case _mc264: _local3 = Res._sa258.total_moves; break; case _gn100: _local3 = Res._sa258.total_time; break; }; _dc205[_local2] = Gfx._xf630(_local3, -1, irrcrpt("keqi_jsrx", 4), 16, _arg1); _local2++; }; _ci296 = Bitmap(new Res._le118()).bitmapData; _al739 = Gfx._xf630(Res._sa258.score, -1, irrcrpt("lfrj_ktsy", 5), 24, 0xAEAEAE); image_hiscore_label = Gfx._xf630(Res._sa258.hiscore, -1, irrcrpt("jdph_irqw", 3), 24, 0xAEAEAE); Gfx._wq819(_ci296, _al739, 6, 8); Gfx._wq819(_ci296, image_hiscore_label, 6, 58); } final private function _rh179(_arg1:Object):void{ _if749(_arg1); } final private function _pg63():void{ if (bloke_on){ _bs283(); }; _cl441 = (_cl441 + 0.1); if (((((++_et675 % 30) == 0)) && ((++clear_colour >= _ur614)))){ clear_colour = 0; }; if (show_level_up_text >= 0){ _ti245--; if (_ti245 > 0){ _ti245 = (_ti245 * 0.9); } else { _ti245 = (_ti245 + (_ti245 / 2)); }; if (_ti245 < -(_pn357)){ show_level_up_text = false; }; }; if ((((hint_timer <= 0)) || (((((!(paused)) && (!(_qa301)))) && (!(_ho474)))))){ hint_angle = (hint_angle + 0.2); if (--hint_timer < -80){ hint_timer = HINT_TIMER_MAX; }; }; Particles.tick(); _kx501(); _fa163(); Messages.tick(); if (_ho474){ _af220(); } else { if (bonus_effect_timer > 0){ _af777(); } else { if (_ik515 > 0){ if (--_ik515 <= 0){ _ch309(); }; } else { if (_ww846){ _xj711(); }; }; }; if (!_qa301){ _rm547(); }; }; if ((ticks % 3) == 0){ _cm275(); }; _rt574(); } public static function _ky813(_arg1:String):String{ return (String(Res._sa258[_arg1])); } public static function _ko79():Number{ if (_bh368 != _qw186){ return (0); }; return (_vg295); } } }//package
Section 181
//Main__gw817 (Main__gw817) package { import mx.core.*; public class Main__gw817 extends BitmapAsset { } }//package
Section 182
//Menu (Menu) package { import flash.display.*; import flash.geom.*; public class Menu { public static const _vn447:int = 16; public static const _bc858:int = -11; public static const _xb62:int = -5; public static const _uy637:Array = [_rw632, _yd455, _un298, _uq907, _pv449, _vx515, _ss111, _md681]; public static const _tb458:int = 27; public static const _my365:int = 21; public static const _pp236:int = -1; public static const _vx515:int = 23; public static const _pc182:int = 39; public static const _uo866:int = -3; public static const _oa504:int = 43; public static const _ti207:int = 45; public static const _dm131:int = 47; public static const _xy47:Array = [_gj118, _yd455, _vq797, _gf162, _cl534, _pv449, _se113, _by460]; public static const _wc666:Array = [_of85, _yd455, _ao519, _nt129, _tb458, _nm694]; public static const _by460:int = 8; public static const _uq379:int = 4; public static const _be242:int = 49; public static const _qg631:int = 10; public static const _do163:int = 46; public static const _cl534:int = 12; public static const _ut401:Array = [_uo866, _yd455, _tk822, _oo832]; public static const _ao519:int = 25; public static const _ai705:BitmapData = Bitmap(new _mx879()).bitmapData; public static const _gj118:int = -9; public static const _pa464:Array = [_ek230, _yd455, _oo81, _oa504]; public static const _al389:int = -4; public static const _jt346:BitmapData = Bitmap(new _uy23()).bitmapData; public static const _gf162:int = 11; public static const _kp103:int = 8; public static const _gx182:int = 40; public static const _se113:int = 14; public static const _uk859:int = 36; public static const _fl591:int = _ai705.height; public static const _xj725:int = 15; public static const _mx879:Class = Menu__mx879; public static const _np713:int = 17; public static const _un298:int = 0; public static const _ao650:Array = [_pp236, _yd455, _xj725, _vn447, _dq253, _np713, _lb14, _sb782, _my365, _yl736]; public static const _dq253:int = 20; public static const _tk822:int = 34; public static const _ot441:int = -6; public static const _gu36:int = 41; public static const _ek230:int = -8; public static const _ss111:int = 44; public static const _ct608:int = 48; public static const _rw632:int = -7; public static const _nm694:int = 6; public static const _lf304:int = 9; public static const _oo832:int = 35; public static const _md681:int = 3; public static const _sb782:int = 19; public static const _uy23:Class = Menu__uy23; public static const _nt129:int = 26; public static const _il455:Array = [_al389, _yd455, _gx182, _gu36]; public static const _oo81:int = 42; public static const _tp611:int = 5; public static const _rs848:int = 38; public static const _xq427:int = 2; public static const _og727:int = _ai705.width; public static const _gd173:int = 24; public static const _yd455:int = -10; public static const _fx903:int = 37; public static const _uq907:int = 1; public static const _yl736:int = 13; public static const _pv449:int = 10; public static const _fy714:int = _jt346.width; public static const _lb14:int = 18; public static const _of85:int = -2; public static const _vq797:int = 7; public static var _om672:int = 0; public static var _jh735:int; public static var _dj411:Array; public static var _xy601:Boolean = false; public static var _wh278:Array = new Array(_qg631); public static var _qy658:Array = new Array(_qg631); public static var _kf550:Array = new Array(_qg631); public static var _xt642:Array = new Array(_qg631); public static var _ao442:Array = new Array(_qg631); public static var _jw485:int = -1; public static var _un471:int; public static var _gm705:Number; public static var menu_angle:Number = 0; public static var _ql867:Array = new Array(_qg631); public static function getString(_arg1:int):String{ switch (_arg1){ case _rw632: return (Res._sa258.title_main_menu); case _ot441: return (Res._sa258.title_stats); case _of85: return (Res._sa258.title_select_game_mode); case _pp236: return (Res._sa258.title_options); case _xb62: return (Res._sa258.title_credits); case _gj118: return (Res._sa258.title_paused); case _al389: return (Res._sa258.confirm_give_up); case _uo866: return (Res._sa258.confirm_quit); case _ek230: return (Res._sa258.confirm_retry); case _pv449: return (Res._sa258.options); case _md681: return (Res._sa258.credits); case _uq907: return (Res._sa258.how_to_play); case _xq427: return (Res._sa258.leaderboard); case _nm694: case _yl736: case _uk859: return (Res._sa258.back); case _uq379: return (Res._sa258.visit_megadev); case _se113: return (Res._sa258.play_original); case _tp611: return (Res._sa258.more_games); case _ao519: case _dm131: return (Res._sa258.casual); case _nt129: case _ct608: return (Res._sa258.timed); case _tb458: case _be242: return (Res._sa258.limited_moves); case _by460: return (Res._sa258.quit); case _vq797: return (Res._sa258.resume); case _un298: return (Res._sa258.start_game); case _lf304: return (Res._sa258.submit_score); case _cl534: return (Res._sa258.retry); case _gf162: return (Res._sa258.give_up); case _tk822: case _gx182: case _oo81: return (Res._sa258.yes); case _oo832: case _gu36: case _oa504: return (Res._sa258.no); case _xj725: return ((Main.music_on) ? Res._sa258.music_on : Res._sa258.music_off); case _vn447: return ((Main.sfx_on) ? Res._sa258.sound_on : Res._sa258.sound_off); case _np713: return ((Main.messages_on) ? Res._sa258.messages_on : Res._sa258.messages_off); case _lb14: return ((Main.one_click) ? Res._sa258.one_click_on : Res._sa258.one_click_off); case _sb782: return ((Main.daytime) ? Res._sa258.daytime_on : Res._sa258.daytime_off); case _dq253: return (((Main._td676.displayState == StageDisplayState.FULL_SCREEN)) ? Res._sa258.full_screen_on : Res._sa258.full_screen_off); case _my365: return ((Main.bloke_on) ? Res._sa258.text_bloke_on : Res._sa258.text_bloke_off); case _pc182: return (Res._sa258.show_store); case _vx515: return (Res._sa258.view_stats); case _ss111: return (Res._sa258.achievements); case _ti207: case _fx903: return (Res._sa258.previous); case _do163: case _rs848: return (Res._sa258.next); }; return (""); } public static function tick():void{ var _local1:int; if (((_xy601) && ((Main._mj416 == 0)))){ menu_angle = (menu_angle + 0.4); if (_gm705 > 0){ _gm705 = (_gm705 - (0.005 + (_gm705 * 0.1))); if (_gm705 < 0){ _gm705 = 0; }; } else { _local1 = _nh200(); if (_local1 != _jw485){ _om672 = 0; if (_ao442[_local1] >= 0){ _jw485 = _local1; Audio._uo387(Res._mf43[Main._ko79()]); } else { _jw485 = -1; }; }; }; }; } public static function _nh200():int{ _jh735 = 0; while (_jh735 < _un471) { if ((((((((Main._td676.mouseX > (_wh278[_jh735] - (_xt642[_jh735] >> 1)))) && ((Main._td676.mouseX < (_wh278[_jh735] + (_xt642[_jh735] >> 1)))))) && ((Main._td676.mouseY > _qy658[_jh735])))) && ((Main._td676.mouseY < (_qy658[_jh735] + _kf550[_jh735]))))){ return (_jh735); }; _jh735++; }; return (-1); } public static function draw():void{ _jh735 = 0; while (_jh735 < _un471) { if ((((_jh735 == _jw485)) || ((_gm705 > 0)))){ if (_jh735 == _jw485){ Gfx._tf167(Main._ec365, _ql867[_jh735], _wh278[_jh735], (_qy658[_jh735] + (_kf550[_jh735] >> 1)), 0, 1, 1, (Gfx._uf814 | Gfx._ew507), null, (1 + (Math.sin(menu_angle) * 0.05)), (1 + (Math.sin(menu_angle) * 0.025)), false, true); } else { Gfx._tf167(Main._ec365, _ql867[_jh735], _wh278[_jh735], (_qy658[_jh735] + _kf550[_jh735]), 0, 1, 1, (Gfx.BOTTOM | Gfx._ew507), null, 1, (1 + (_gm705 * Math.sin(menu_angle)))); }; } else { Gfx._wq819(Main._ec365, _ql867[_jh735], _wh278[_jh735], _qy658[_jh735], 0, 1, 1, (Gfx.TOP | Gfx._ew507)); }; _jh735++; }; } public static function reset():void{ _xy601 = false; _un471 = 0; _jw485 = -1; } public static function _ij427(_arg1:BitmapData, _arg2:int, _arg3:int, _arg4:int, _arg5:int=-1, _arg6:Number=1):void{ var _local7:Number = ((_arg4 - (_fy714 << 1)) / _og727); if (_arg5 != -1){ _arg2 = (_arg2 + Gfx._aj377(_arg5, _arg4)); _arg3 = (_arg3 + Gfx._sj755(_arg5, Menu._fl591)); }; Gfx._wq819(_arg1, _jt346, _arg2, _arg3, 0, 1, 1, (Gfx.TOP | Gfx.LEFT), new ColorTransform(1, 1, 1, _arg6)); Gfx._tf167(_arg1, _ai705, (_arg2 + _fy714), _arg3, 0, 1, 1, (Gfx.TOP | Gfx.LEFT), new ColorTransform(1, 1, 1, _arg6), _local7); Gfx._wq819(_arg1, _jt346, (_arg2 + _arg4), _arg3, 0, 1, 1, (Gfx.TOP | Gfx.RIGHT), new ColorTransform(1, 1, 1, _arg6), true); } 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; _un471 = 0; _jw485 = -1; _xy601 = true; _dj411 = _arg1; var _local3:int; _local9 = 0; while (_local9 < 2) { _jh735 = 0; while (_jh735 < _arg1.length) { _local6 = _arg1[_jh735]; _local7 = true; _local8 = true; if (_local9 == 1){ _local5 = getString(_local6); }; switch (_local6){ case _ss111: _local8 = Preloader._tn35; break; case _sb782: break; case _dq253: _local8 = ((Preloader._id222) && (Main._td676.hasOwnProperty(irrcrpt("ejtqmbzTubuf", 1)))); break; case _se113: _local8 = (Preloader._kg909.length > 0); break; }; if (_local8){ if (_arg1[_jh735] != _yd455){ if (_local9 == 0){ _local3 = (_local3 + (_fl591 + _kp103)); } else { _oh373(_local5, _local6, Main._tc118, _local4, (Gfx.TOP | Gfx._ew507)); _local4 = (_local4 + (_fl591 + _kp103)); }; } else { if (_local9 == 0){ _local3 = (_local3 + (_fl591 >> 1)); } else { _local4 = (_local4 + (_fl591 >> 1)); }; }; }; if (_local9 == 0){ _local4 = ((Main._sn405 - (_local3 >> 1)) - _kp103); }; _jh735++; }; _local9++; }; if (Preloader._vu339){ _oh373("", _uq379, (Main._pn357 - 8), (Main._gt481 - 8), (Gfx.BOTTOM | Gfx.RIGHT)); }; _gm705 = (_arg2) ? _gm705 : 0; } public static function _oh373(_arg1:String, _arg2:int, _arg3:int, _arg4:int, _arg5:int):void{ var _local6:int; if (_arg2 == _yd455){ return; }; if (!_xy601){ _xy601 = true; _un471 = 0; }; _gm705 = 1; menu_angle = (Math.PI + (Math.PI / 2)); _ao442[_un471] = _arg2; if (_arg1.length == 0){ _arg1 = getString(_arg2); }; switch (_arg2){ case _uq379: _ql867[_un471] = Res._mm353; break; default: Gfx._xf630(_arg1, -1, irrcrpt("lfrj_ktsy", 5), 20, 0xAEAEAE); _local6 = (Gfx._fa185.width + (_fy714 << 1)); _ql867[_un471] = new BitmapData(_local6, _fl591, true, 0); _ij427(_ql867[_un471], 0, 0, _local6, -1); Gfx._wq819(_ql867[_un471], Gfx._fa185, (_local6 >> 1), ((_fl591 >> 1) + 2), 0, 1, 1, (Gfx._ew507 | Gfx._uf814)); break; }; _xt642[_un471] = _ql867[_un471].width; _kf550[_un471] = _ql867[_un471].height; _arg3 = (_arg3 + (Gfx._aj377(_arg5, _xt642[_un471]) + (_xt642[_un471] >> 1))); _arg4 = (_arg4 + Gfx._sj755(_arg5, _ql867[_un471].height)); _wh278[_un471] = _arg3; _qy658[_un471] = _arg4; _un471++; } } }//package
Section 183
//Menu__mx879 (Menu__mx879) package { import mx.core.*; public class Menu__mx879 extends BitmapAsset { } }//package
Section 184
//Menu__uy23 (Menu__uy23) package { import mx.core.*; public class Menu__uy23 extends BitmapAsset { } }//package
Section 185
//Messages (Messages) package { import flash.geom.*; import flash.media.*; public class Messages { public static const _cx393:int = 8; public static var bar_vcent:int; public static var _cy734:Array = new Array(_cx393); public static var _sq596:int; public static var _ob207:Array = new Array(_cx393); public static var m:int; public static var _fl410:Array = new Array(_cx393); public static var _ru438:Array = new Array(_cx393); public static var _kp718:Array = new Array(_cx393); public static var _ll345:Array = new Array(_cx393); public static function add(_arg1:String, _arg2:Sound=null, _arg3:Boolean=false):void{ if (_arg2 != null){ Audio._ml388(_arg2); }; if (((Main.messages_on) || (_arg3))){ m = 0; while (m < _cx393) { if (_cy734[m] <= 0){ if (_arg3){ _arg1 = (irrcrpt(" ", 3) + _arg1); }; _fl410[m] = Gfx._xf630(_arg1, -1, irrcrpt("lfrj_ktsy", 5), 20, 0xAEAEAE, false); _ob207[m] = Main._pn357; _cy734[m] = 0.85; _ll345[m] = 150; _kp718[m] = _arg3; m = _cx393; }; m++; }; }; } public static function tick():void{ m = 0; while (m < _cx393) { if (_cy734[m] > 0){ if (_ob207[m] > 0){ _ob207[m] = (_ob207[m] - (1 + (_ob207[m] * 0.2))); } else { var _local1 = _ll345; var _local2 = m; var _local3 = (_local1[_local2] - 1); _local1[_local2] = _local3; if (_local3 < 0){ _cy734[m] = (_cy734[m] - 0.02); }; }; }; m++; }; } public static function init():void{ m = 0; while (m < _cx393) { _cy734[m] = 0; m++; }; } public static function draw():void{ m = 0; while (m < _cx393) { if (_cy734[m] > 0){ _sq596 = -(_ob207[m]); bar_vcent = ((Main._gt481 - 56) - (m * 32)); Menu._ij427(Main._ec365, (_sq596 + (_fl410[m].width >> 1)), bar_vcent, (_fl410[m].width + (Menu._fy714 << 1)), (Gfx._ew507 | Gfx._uf814), _cy734[m]); Gfx._wq819(Main._ec365, _fl410[m], _sq596, (bar_vcent + 2), 0, 1, 1, (Gfx._uf814 | Gfx.LEFT), new ColorTransform(1, 1, 1, _cy734[m])); if (_kp718[m]){ Gfx._wq819(Main._ec365, Res._rm819, (_sq596 + 2), bar_vcent, 0, 2, 1, (Gfx._uf814 | Gfx.LEFT), new ColorTransform(1, 1, 1, _cy734[m])); }; }; m++; }; } } }//package
Section 186
//MindJoltAPI (MindJoltAPI) package { import flash.events.*; import flash.display.*; import flash.net.*; import flash.system.*; public class MindJoltAPI { private static var callback:Function; private static var clip:MovieClip; public static var _ih564:Object = {showPreGameAd:showPreGameAd}; private static var version:String = irrcrpt("4.3.6", 3); private static var _kj118:String; public static var service:Object = {connect:_nu499}; private static var options:Object; private static function _ah84(_arg1:Event):void{ if (((!((_arg1.currentTarget.content == null))) && (!((_arg1.currentTarget.content.service == null))))){ service = _arg1.currentTarget.content.service; trace(irrcrpt("[PlqgMrowDSL] vhuylfh vxffhvvixoob ordghg", 3)); service.connect(_kj118, clip, callback); if (options != null){ service.showPreGameAd(options); }; service.getLogger().info(((irrcrpt("PlqgMrowDSL ordghu yhuvlrq [", 3) + version) + "]")); } else { trace(irrcrpt("[NjoeKpmuBQJ] gbjmfe up mpbe", 1)); }; } private static function _nu499(_arg1:String, _arg2:MovieClip, _arg3:Function=null){ var _local4:Object; var _local5:Loader; _slot1._kj118 = _arg1; _slot1.clip = _arg2; _slot1.callback = _arg3; if (service._cd835 == null){ Security.allowDomain(irrcrpt("uvcvke.okpflqnv.eqo", 2)); _local4 = LoaderInfo(_arg2.root.loaderInfo).parameters; _local5 = new Loader(); _local5.contentLoaderInfo.addEventListener(Event.COMPLETE, _ah84); _local5.load(new URLRequest(((_local4.mjPath) || (irrcrpt("jvvr://uvcvke.okpflqnv.eqo/crk/cu5/crk_nqecn_cu5.uyh", 2))))); _arg2.addChild(_local5); }; } public static function showPreGameAd(_arg1:Object=null){ if (clip == null){ trace(irrcrpt("[OkpfLqnvCRK] Aqw owuv ecnn OkpfLqnvCRK.ugtxkeg.eqppgev dghqtg OkpfLqnvCRK.cf.ujqyRtgIcogCf.", 2)); }; 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 187
//PaperBase (PaperBase) package { import flash.events.*; import flash.display.*; import org.papervision3d.view.*; import org.papervision3d.render.*; import org.papervision3d.cameras.*; import org.papervision3d.scenes.*; public class PaperBase extends Sprite { public var renderer:BasicRenderEngine; public var _iy112:Camera3D; public var _at839:Viewport3D; public var _kh894:Scene3D; protected function init3d():void{ } protected function _gy833():void{ addEventListener(Event.ENTER_FRAME, onEnterFrame); } protected function _nt14():void{ } public function init(_arg1:Number=800, _arg2:Number=600):void{ _ba761(_arg1, _arg2); init3d(); _nt14(); _gy833(); } protected function _ba761(_arg1:Number, _arg2:Number):void{ _at839 = new Viewport3D(_arg1, _arg2, false, true, true, true); addChild(_at839); renderer = new BasicRenderEngine(); _kh894 = new Scene3D(); _iy112 = new Camera3D(); } protected function onEnterFrame(_arg1:Event):void{ _ss186(); renderer.renderScene(_kh894, _iy112, _at839); } protected function _ss186():void{ } } }//package
Section 188
//Particles (Particles) package { import flash.display.*; public class Particles { public static const _lx10:Class = Particles__lx10; public static const _or179:int = 3; public static const _be328:BitmapData = Bitmap(new _pg799()).bitmapData; public static const _yl753:int = 5; public static const _qu15:int = -1; public static const _gg594:int = 0x0200; public static const _wy850:int = 8; public static const _fy461:int = 7; public static const _pg799:Class = Particles__pg799; public static const _mx414:BitmapData = Bitmap(new _am504()).bitmapData; public static const _am504:Class = Particles__am504; public static const _nv357:Number = 0.392699081698724; public static const _dk214:int = 16; public static const _px585:BitmapData = Bitmap(new _lx10()).bitmapData; public static const _wo491:int = -2; public static const _fe10:int = 6; public static var _xc82:Array = new Array(_gg594); public static var _xl875:Array = new Array(_gg594); public static var _dt803:Array = new Array(_gg594); public static var _gs717:Array = new Array(_gg594); public static var _yf465:int = 0; public static var _dq15:Array = new Array(_gg594); public static var _jh735:int; public static var _dj919:Array = new Array(_gg594); public static var _bu717:Array = new Array(_gg594); public static var ticks:int = 0; public static var x:int; public static var y:int; public static function init():void{ _yf465 = 0; _jh735 = 0; while (_jh735 < _gg594) { _xc82[_jh735] = Main._gt481; _jh735++; }; } public static function tick():void{ ticks++; _jh735 = 0; while (_jh735 < _gg594) { if (_xc82[_jh735] < Main._gt481){ _bu717[_jh735] = (_bu717[_jh735] + _dq15[_jh735]); _xc82[_jh735] = (_xc82[_jh735] + _xl875[_jh735]); _dq15[_jh735] = (_dq15[_jh735] * 0.99); _xl875[_jh735] = (_xl875[_jh735] + 0.4); switch (_dj919[_jh735]){ case _qu15: case _wo491: _dt803[_jh735] = (_dt803[_jh735] + (_dq15[_jh735] / 10)); break; default: if (((((ticks % 8) == 0)) && ((Math.random() < 0.4)))){ var _local1 = _gs717; var _local2 = _jh735; var _local3 = (_local1[_local2] + 1); _local1[_local2] = _local3; if (_local3 >= _or179){ _xc82[_jh735] = Main._gt481; }; }; break; }; }; _jh735++; }; } 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 == _qu15)) || ((_arg3 == _wo491)))){ _local7 = true; } else { _arg1 = (_arg1 - 9); _arg2 = (_arg2 - 9); }; _jh735 = 0; while (_jh735 < _arg4) { _local5 = (Math.random() * Math.PI); _local6 = ((_wy850 / 2) + (Math.random() * _wy850)); _dj919[_yf465] = _arg3; switch (_arg3){ case Main._ol244: _dj919[_yf465] = _fe10; break; case Main._xn486: _dj919[_yf465] = Math.floor((Math.random() * 5)); break; case Main._dm287: case Main._yo361: _dj919[_yf465] = 5; break; }; if (_local7){ _dq15[_yf465] = (-8 + (Math.random() * 16)); _xl875[_yf465] = (-6 - (Math.random() * 4)); } else { _dq15[_yf465] = (Math.sin(((_nv357 * _jh735) + _local5)) * _local6); _xl875[_yf465] = (-2 + (Math.cos(((_nv357 * _jh735) + _local5)) * _local6)); }; _bu717[_yf465] = _arg1; _xc82[_yf465] = _arg2; _gs717[_yf465] = 0; _dt803[_yf465] = 0; if (++_yf465 >= _gg594){ _yf465 = 0; }; _jh735++; }; } public static function draw():void{ _jh735 = 0; while (_jh735 < _gg594) { if (_xc82[_jh735] < Main._gt481){ switch (_dj919[_jh735]){ case _qu15: case _wo491: Gfx._gp45(Main._ec365, ((_dj919[_jh735] == _qu15)) ? _be328 : _px585, _bu717[_jh735], _xc82[_jh735], (Gfx._ew507 | Gfx._uf814), null, _dt803[_jh735]); break; default: Gfx._wq819(Main._ec365, _mx414, _bu717[_jh735], _xc82[_jh735], ((_dj919[_jh735] * _or179) + _gs717[_jh735]), _or179, _fy461, -1, null, false, false, 18, 18); break; }; }; _jh735++; }; } } }//package
Section 189
//Particles__am504 (Particles__am504) package { import mx.core.*; public class Particles__am504 extends BitmapAsset { } }//package
Section 190
//Particles__lx10 (Particles__lx10) package { import mx.core.*; public class Particles__lx10 extends BitmapAsset { } }//package
Section 191
//Particles__pg799 (Particles__pg799) package { import mx.core.*; public class Particles__pg799 extends BitmapAsset { } }//package
Section 192
//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.media.*; public dynamic class Preloader extends MovieClip { private const _tb221:String; private const _wr664:String; private const _tc118:int; private const _pn357:int = 640; private const _gt481:int = 480; private const _sb313:String; private const _sn405:int; private var _lt95:Boolean;// = false private var _up829:FlashAd;// = null private var _dc188:Boolean;// = false private var _tx416:Boolean;// = false private var _nj734:int;// = 0 private var _br860:Boolean;// = false private var _yw195:Boolean;// = true private var _ut646:int;// = 0 private var _ul761:Number;// = 0 public static const _aw804:int = 1; public static const _nx773:int = 5; public static const _xh649:int = 6; public static const _sh397:int = 7; public static const _au695:int = 0; public static const _sf918:int = 4; public static const _kp368:int = 3; public static const _he695:int = 2; public static var _yq216:Boolean = true; public static var _eb352:Boolean = true; public static var _tn35:Boolean = true; public static var _bw689:Boolean = false; public static var _na451:BitmapData = Bitmap(new _cy430()).bitmapData; public static var version:int = 0; public static var _cy430:Class = Preloader__cy430; public static var _kg909:String = irrcrpt("jvvr://yyy.okpflqnv.eqo/icogu/dqodqqbng", 2); public static var host:String; public static var _ku894:Array = new Array(5); public static var _mj483:Boolean = false; public static var _vu339:Boolean = true; public static var _id222:Boolean = false; public function Preloader(){ var _jh735:int; var _ho137:TextFormat; var _qr124:TextField; _tc118 = (_pn357 >> 1); _sn405 = (_gt481 >> 1); _tb221 = irrcrpt("R21J0KJV738X68TE", 3); _sb313 = irrcrpt("27b4c36g2gf11852", 1); _wr664 = irrcrpt("Vjku icog ku ukvg-nqemgf. Vq qdvckp c nkegpug rngcug g-ockn kphq@ogicfgx.eq.wm", 2); super(); host = this.root.loaderInfo.url.split("/")[2]; trace((irrcrpt("krvw = ", 3) + host)); _tx416 = (host.length == 0); if (version == _xh649){ if (host.indexOf(irrcrpt("xqjurxqghg", 3)) == -1){ version = _au695; trace(irrcrpt("sfzlmyd!", 5)); }; }; var _vw792:Boolean; switch (version){ case _xh649: API.connect(loaderInfo, irrcrpt("37575:jXmtWXO9", 2), irrcrpt("4q4kxkd56JfFNDc4MQO63mBjicT7kGyq", 2)); _up829 = API.createAd(); addChild(_up829); _up829.x = (_tc118 - (_up829.width >> 1)); _up829.y = (_sn405 - (_up829.height >> 1)); _bw689 = true; break; case _au695: _lt95 = true; _bw689 = true; break; case _aw804: _ku894[0] = irrcrpt("hncujicognkegpug.eqo", 2); _ku894[1] = irrcrpt("qikehiz.gs.yo", 4); _bw689 = true; break; case _he695: _ku894[0] = irrcrpt("nfhbefw.dp.vl", 1); _lt95 = false; _bw689 = true; break; case _kp368: _bw689 = true; if (host.length > 0){ _vw792 = false; }; break; case _sf918: _ku894[0] = irrcrpt("plqgmrow.frp", 3); _dc188 = true; _yq216 = false; break; case _nx773: _eb352 = false; _kg909 = ""; _vu339 = false; break; case _sh397: trace(irrcrpt("AJWXNTS_GTWJI", 5)); _eb352 = false; _kg909 = ""; _vu339 = false; stop(); addEventListener(Event.ADDED_TO_STAGE, _ce118); return; }; trace(irrcrpt("xibu???", 1)); if (_vw792){ _vw792 = (_ku894[0] == undefined); _jh735 = 0; while (_jh735 < _ku894.length) { trace((((irrcrpt("vlwh_orfn_xuo[", 3) + _jh735) + irrcrpt("] = ", 3)) + _ku894[_jh735])); if (((!((_ku894[_jh735] == undefined))) && ((host.indexOf(_ku894[_jh735]) == (host.length - _ku894[_jh735].length))))){ trace(irrcrpt("xnyj nx tp!", 5)); _vw792 = true; _jh735 = _ku894.length; }; _jh735 = (_jh735 + 1); }; }; if (_vw792){ try { if (((_lt95) || (_bw689))){ MochiServices.connect(_sb313, root, _vr142); }; if (_lt95){ MochiAd.showPreGameAd({clip:root, id:_sb313, res:irrcrpt("751y591", 1), background:13429999, color:7321558, outline:7321558, no_bg:true, ad_finished:_nb425, ad_failed:_nb425, ad_skipped:_nb425}); _yw195 = false; }; if (_dc188){ MindJoltAPI.service.connect(_tb221, this, null); MindJoltAPI._ih564.showPreGameAd({clip:this, ad_started:null, ad_finished:_kf221}); _yw195 = false; }; } catch(error:Error) { }; _mj483 = ((!(_dc188)) && (!(_lt95))); trace((irrcrpt("ujqy_rtqitguu_dct = ", 2) + _mj483)); stop(); stage.scaleMode = StageScaleMode.NO_SCALE; stage.align = StageAlign.TOP_LEFT; stage.focus = this; if (version != _sh397){ addEventListener(Event.ENTER_FRAME, tick); }; } else { _ho137 = new TextFormat(); _ho137.font = irrcrpt("Ctkcn", 2); _ho137.size = 16; _ho137.color = 0xFFFFFF; _qr124 = new TextField(); _qr124.defaultTextFormat = _ho137; _qr124.text = _wr664; _qr124.width = _pn357; _qr124.wordWrap = true; addChild(_qr124); _qr124.x = 40; _qr124.y = 220; }; } final private function _nb425():void{ trace(irrcrpt("rthmnFixItsj()", 5)); _yw195 = true; if (_eo635()){ _br860 = true; }; } final private function _vr142(_arg1:String):void{ trace(((irrcrpt("qsglmWivzmgiwIvvsv(", 4) + _arg1) + ")")); } final private function _kf221():void{ trace(irrcrpt("rnsiOtqyFiXmtbs()", 5)); _yw195 = true; if (_eo635()){ _br860 = true; }; } final private function init():void{ var _local2:Object; trace(irrcrpt("mrmx()", 4)); if (_up829 != null){ SoundMixer.stopAll(); _up829.removeAd(); }; removeEventListener(Event.ENTER_FRAME, tick); _cy430 = null; _na451 = null; nextFrame(); var _local1:Class = Class(getDefinitionByName(irrcrpt("Rfns", 5))); if (_local1){ _local2 = new (_local1); addChild((_local2 as DisplayObject)); }; } final private function _ce118(_arg1:Event=null):void{ this.removeEventListener(Event.ADDED_TO_STAGE, _ce118); init(); } public function tick(_arg1:Event):void{ if (_tx416){ if (_nj734 < root.loaderInfo.bytesTotal){ _nj734 = (_nj734 + 5000); }; _ut646 = Math.min(root.loaderInfo.bytesTotal, _nj734); } else { _ut646 = root.loaderInfo.bytesLoaded; }; graphics.clear(); graphics.beginBitmapFill(_na451, null, false, false); graphics.drawRect(0, 0, _pn357, _gt481); if (_mj483){ graphics.beginFill(13429999); graphics.drawRect(16, (_gt481 - 28), (_pn357 - 32), 12); graphics.beginFill(7321558); graphics.drawRect(17, (_gt481 - 27), (_pn357 - 34), 10); graphics.beginFill(13429999); graphics.drawRect(16, (_gt481 - 28), ((_pn357 - 32) * (_ut646 / root.loaderInfo.bytesTotal)), 12); }; graphics.endFill(); if (_ul761 > 0){ graphics.beginFill(0, Math.min(1, _ul761)); graphics.drawRect(0, 0, _pn357, _gt481); graphics.endFill(); }; if (!_br860){ if (((_yw195) && (_eo635()))){ _br860 = true; }; } else { if ((_ul761 = (_ul761 + 0.05)) > 2){ init(); }; }; } final private function _eo635():Boolean{ if (_ut646 >= root.loaderInfo.bytesTotal){ return (true); }; return (false); } } }//package
Section 193
//Preloader__cy430 (Preloader__cy430) package { import mx.core.*; public class Preloader__cy430 extends BitmapAsset { } }//package
Section 194
//Res (Res) package { import flash.display.*; import flash.media.*; import flash.utils.*; public class Res { public static const _sd749:Class = Res__sd749; public static const _gn654:BitmapData = Bitmap(new _dn908()).bitmapData; public static const _ap68:Class = Res__ap68; public static const _hi317:Class = Res__hi317; public static const _sk382:Class = Res__sk382; public static const _kc787:Array = [new _pp836(), new _vc110(), new _tu655()]; public static const _aq775:Class = Res__aq775; public static const _lx487:Class = Res__lx487; public static const _ra568:Class = Res__ra568; public static const _rh759:Class = Res__rh759; public static const _qt486:BitmapData = Bitmap(new _uw322()).bitmapData; public static const _ao912:Class = Res__ao912; public static const _vw435:Class = Res__vw435; public static const _uu336:Class = Res__uu336; public static const _dn908:Class = Res__dn908; public static const _cl804:Class = Res__cl804; public static const _lv743:Array = [new _bw153(), new _ny148(), new _io428()]; public static const _tu655:Class = Res__tu655; public static const _pj667:Class = Res__pj667; public static const _yd243:Class = Res__yd243; public static const _in392:Class = Res__in392; public static const _mi142:Class = Res__mi142; public static const _ss91:Class = Res__ss91; public static const _tr710:Class = Res__tr710; public static const _ea545:Sound = new _fj883(); public static const _wl255:Array = [Bitmap(new _vv775()).bitmapData, Bitmap(new _go800()).bitmapData, Bitmap(new _lg139()).bitmapData, Bitmap(new _gk632()).bitmapData, Bitmap(new _hd504()).bitmapData, Bitmap(new _ir493()).bitmapData, Bitmap(new _wm58()).bitmapData, Bitmap(new _uv403()).bitmapData, Bitmap(new _mj705()).bitmapData, Bitmap(new _gk206()).bitmapData]; public static const _gs209:Array = [Bitmap(new _rh759()).bitmapData, Bitmap(new _la749()).bitmapData, Bitmap(new _df584()).bitmapData, Bitmap(new _ex554()).bitmapData, Bitmap(new _ss91()).bitmapData, Bitmap(new _rl824()).bitmapData, Bitmap(new _kp142()).bitmapData, Bitmap(new _ox99()).bitmapData]; public static const _sc201:Class = Res__sc201; public static const _td334:BitmapData = Bitmap(new _ex376()).bitmapData; public static const _yg762:BitmapData = Bitmap(new _py122()).bitmapData; public static const _la749:Class = Res__la749; public static const _qi385:Array = [Bitmap(new _uw322()).bitmapData, Bitmap(new _hg874()).bitmapData, Bitmap(new _mv461()).bitmapData, Bitmap(new _rv859()).bitmapData, Bitmap(new _gm710()).bitmapData, Bitmap(new _ms435()).bitmapData, Bitmap(new _dx31()).bitmapData, Bitmap(new _vw435()).bitmapData, Bitmap(new _nm104()).bitmapData, Bitmap(new _sv201()).bitmapData, Bitmap(new _sc201()).bitmapData, Bitmap(new _sd749()).bitmapData, Bitmap(new _va152()).bitmapData, Bitmap(new _fi157()).bitmapData]; public static const _jt506:Sound = new _nd879(); public static const _ty117:Class = Res__ty117; public static const _st785:Class = Res__st785; public static const _hu439:Class = Res__hu439; public static const _wx461:Array = [new _tv248(), new _ma796(), new _pc390()]; public static const _cg16:Array = [new _mu766(), new _ng740(), new _bk881()]; public static const _uc292:Array = [new _is482(), new _mm926(), new _sk382()]; public static const _ma796:Class = Res__ma796; public static const _wv845:Class = Res__wv845; public static const _ci67:Class = Res__ci67; public static const _is187:Array = [new _mi142(), new _kj556(), new _cl804()]; public static const _nx551:int = 29; public static const _py122:Class = Res__py122; public static const _mt157:Class = Res__mt157; public static const _ai165:Sound = new _wj809(); public static const _oj410:BitmapData = Bitmap(new _tp381()).bitmapData; public static const _be288:Sound = new _jy51(); public static const _nd879:Class = Res__nd879; public static const _mv461:Class = Res__mv461; public static const _be605:Class = Res__be605; public static const _bm575:Class = Res__bm575; public static const _nw116:BitmapData = Bitmap(new _pe159()).bitmapData; public static const _gk632:Class = Res__gk632; public static const _mk594:Sound = new _vw912(); public static const _hg874:Class = Res__hg874; public static const _pc390:Class = Res__pc390; public static const _vw912:Class = Res__vw912; public static const _mf43:Array = [new _mf50(), new _cp93(), new _gg160()]; public static const _sg156:Class = Res__sg156; public static const _mj705:Class = Res__mj705; public static const _vr906:Class = Res__vr906; public static const _dt495:Class = Res__dt495; public static const _ku785:int = 7; public static const _st324:Sound = new _xt781(); public static const _uw322:Class = Res__uw322; public static const _px850:Class = Res__px850; public static const _cf633:Class = Res__cf633; public static const _nm104:Class = Res__nm104; public static const _dx31:Class = Res__dx31; public static const _mf50:Class = Res__mf50; public static const _gg160:Class = Res__gg160; public static const _wm58:Class = Res__wm58; public static const _sh137:Sound = new _st785(); public static const _wd694:Sound = new _be605(); public static const _kj556:Class = Res__kj556; public static const _iq591:Class = Res__iq591; public static const _lq779:Class = Res__lq779; public static const _fj883:Class = Res__fj883; public static const _gm710:Class = Res__gm710; public static const _ht708:BitmapData = Bitmap(new _cd65()).bitmapData; public static const _nq92:Array = [new _pd402(), new _dt536(), new _mt157()]; public static const _rg376:Class = Res__rg376; public static const _le118:Class = Res__le118; public static const _rl824:Class = Res__rl824; public static const _va152:Class = Res__va152; public static const _tq79:Class = Res__tq79; public static const _ch390:BitmapData = Bitmap(new _qt750()).bitmapData; public static const _nx110:Class = Res__nx110; public static const _sf883:Class = Res__sf883; public static const _ex554:Class = Res__ex554; public static const _jy51:Class = Res__jy51; public static const _do821:Sound = new _fb402(); public static const _jq846:Class = Res__jq846; public static const _qt750:Class = Res__qt750; public static const _rv859:Class = Res__rv859; public static const _bd797:Class = Res__bd797; public static const _id875:Array = [new _yd243(), new _pj667(), new _ja755()]; public static const _cp93:Class = Res__cp93; public static const _bw153:Class = Res__bw153; public static const _ms435:Class = Res__ms435; public static const _wu452:BitmapData = Bitmap(new _ao912()).bitmapData; public static const _mv827:Class = Res__mv827; public static const _ac799:Array = [[Bitmap(new _iv840()).bitmapData], [Bitmap(new _uu336()).bitmapData, Bitmap(new _sg156()).bitmapData, Bitmap(new _fj200()).bitmapData, Bitmap(new _uu336()).bitmapData, Bitmap(new _ap68()).bitmapData, Bitmap(new _fj200()).bitmapData], [Bitmap(new _nx110()).bitmapData, Bitmap(new _kp231()).bitmapData, Bitmap(new _ix214()).bitmapData], [Bitmap(new _in392()).bitmapData], [Bitmap(new _bm163()).bitmapData], [Bitmap(new _bk74()).bitmapData], [Bitmap(new _jq846()).bitmapData], [Bitmap(new _hu439()).bitmapData], [Bitmap(new _sf883()).bitmapData]]; public static const _df584:Class = Res__df584; public static const _bu786:Sound = new _hi317(); public static const _vc110:Class = Res__vc110; public static const _rm819:BitmapData = Bitmap(new _rn162()).bitmapData; public static const _ix214:Class = Res__ix214; public static const _bk881:Class = Res__bk881; public static const _aj632:Array = [new _lq779(), new _pw219(), new _en241()]; public static const _go800:Class = Res__go800; public static const _up50:BitmapData = Bitmap(new _aq775()).bitmapData; public static const _ur115:Class = Res__ur115; public static const _fh818:Class = Res__fh818; public static const _ga10:Class = Res__ga10; public static const _gk206:Class = Res__gk206; public static const _fj200:Class = Res__fj200; public static const _ft904:BitmapData = Bitmap(new _du31()).bitmapData; public static const _sv201:Class = Res__sv201; public static const _mm353:BitmapData = Bitmap(new _yy441()).bitmapData; public static const _tp381:Class = Res__tp381; public static const _pw219:Class = Res__pw219; public static const _pe159:Class = Res__pe159; public static const _bm163:Class = Res__bm163; public static const _ir493:Class = Res__ir493; public static const _iv840:Class = Res__iv840; public static const _kx634:BitmapData = Bitmap(new _iq591()).bitmapData; public static const _kp231:Class = Res__kp231; public static const _hd504:Class = Res__hd504; public static const _du31:Class = Res__du31; public static const _lg219:Array = [Bitmap(new _rg376()).bitmapData, Bitmap(new _xk275()).bitmapData]; public static const _mu766:Class = Res__mu766; public static const _lo740:Class = Res__lo740; public static const _yy441:Class = Res__yy441; public static const _fl871:Sound = new _bd797(); public static const _tv248:Class = Res__tv248; public static const _rq644:Class = Res__rq644; public static const _gw549:Array = [new _tq79(), new _kg314(), new _bm575()]; public static const _ei91:Class = Res__ei91; public static const _pp836:Class = Res__pp836; public static const _vv775:Class = Res__vv775; public static const _wj809:Class = Res__wj809; public static const _qr133:BitmapData = Bitmap(new _ci67()).bitmapData; public static const _ja755:Class = Res__ja755; public static const _mm926:Class = Res__mm926; public static const _ng740:Class = Res__ng740; public static const _cp129:Class = Res__cp129; public static const _io428:Class = Res__io428; public static const _ox99:Class = Res__ox99; public static const _ee771:Class = Res__ee771; public static const _qp640:Class = Res__qp640; public static const _xe604:BitmapData = Bitmap(new _ee771()).bitmapData; public static const _tq257:Class = Res__tq257; public static const _xr345:int = 5; public static const _xk275:Class = Res__xk275; public static const _cd65:Class = Res__cd65; public static const _ex376:Class = Res__ex376; public static const _pd402:Class = Res__pd402; public static const _bk74:Class = Res__bk74; public static const _cn505:Sound = new _mv827(); public static const _ny148:Class = Res__ny148; public static const _dt536:Class = Res__dt536; public static const _na895:Class = Res__na895; public static const _kg314:Class = Res__kg314; public static const _is482:Class = Res__is482; public static const _hk607:Class = Res__hk607; public static const _gy750:Sound = new _wv845(); public static const _en241:Class = Res__en241; public static const _kp142:Class = Res__kp142; public static const _fi157:Class = Res__fi157; public static const _rn162:Class = Res__rn162; public static const _ts332:BitmapData = Bitmap(new _cp129()).bitmapData; public static const _xt781:Class = Res__xt781; public static const _uv403:Class = Res__uv403; public static const _rr525:Array = [new _px850(), new _fh818(), new _na895()]; public static const _fb402:Class = Res__fb402; public static const _lg139:Class = Res__lg139; public static var _sa258:XML; public static function _up489():void{ var _local1:ByteArray = new _cf633(); var _local2:String = _local1.readUTFBytes(_local1.length); _sa258 = new XML(_local2); } } }//package
Section 195
//Res__ao912 (Res__ao912) package { import mx.core.*; public class Res__ao912 extends BitmapAsset { } }//package
Section 196
//Res__ap68 (Res__ap68) package { import mx.core.*; public class Res__ap68 extends BitmapAsset { } }//package
Section 197
//Res__aq775 (Res__aq775) package { import mx.core.*; public class Res__aq775 extends BitmapAsset { } }//package
Section 198
//Res__bd797 (Res__bd797) package { import mx.core.*; public class Res__bd797 extends SoundAsset { } }//package
Section 199
//Res__be605 (Res__be605) package { import mx.core.*; public class Res__be605 extends SoundAsset { } }//package
Section 200
//Res__bk74 (Res__bk74) package { import mx.core.*; public class Res__bk74 extends BitmapAsset { } }//package
Section 201
//Res__bk881 (Res__bk881) package { import mx.core.*; public class Res__bk881 extends SoundAsset { } }//package
Section 202
//Res__bm163 (Res__bm163) package { import mx.core.*; public class Res__bm163 extends BitmapAsset { } }//package
Section 203
//Res__bm575 (Res__bm575) package { import mx.core.*; public class Res__bm575 extends SoundAsset { } }//package
Section 204
//Res__bw153 (Res__bw153) package { import mx.core.*; public class Res__bw153 extends SoundAsset { } }//package
Section 205
//Res__cd65 (Res__cd65) package { import mx.core.*; public class Res__cd65 extends BitmapAsset { } }//package
Section 206
//Res__cf633 (Res__cf633) package { import mx.core.*; public class Res__cf633 extends ByteArrayAsset { } }//package
Section 207
//Res__ci67 (Res__ci67) package { import mx.core.*; public class Res__ci67 extends BitmapAsset { } }//package
Section 208
//Res__cl804 (Res__cl804) package { import mx.core.*; public class Res__cl804 extends SoundAsset { } }//package
Section 209
//Res__cp129 (Res__cp129) package { import mx.core.*; public class Res__cp129 extends BitmapAsset { } }//package
Section 210
//Res__cp93 (Res__cp93) package { import mx.core.*; public class Res__cp93 extends SoundAsset { } }//package
Section 211
//Res__df584 (Res__df584) package { import mx.core.*; public class Res__df584 extends BitmapAsset { } }//package
Section 212
//Res__dn908 (Res__dn908) package { import mx.core.*; public class Res__dn908 extends BitmapAsset { } }//package
Section 213
//Res__dt495 (Res__dt495) package { import mx.core.*; public class Res__dt495 extends MovieClipAsset { } }//package
Section 214
//Res__dt536 (Res__dt536) package { import mx.core.*; public class Res__dt536 extends SoundAsset { } }//package
Section 215
//Res__du31 (Res__du31) package { import mx.core.*; public class Res__du31 extends BitmapAsset { } }//package
Section 216
//Res__dx31 (Res__dx31) package { import mx.core.*; public class Res__dx31 extends BitmapAsset { } }//package
Section 217
//Res__ee771 (Res__ee771) package { import mx.core.*; public class Res__ee771 extends BitmapAsset { } }//package
Section 218
//Res__ei91 (Res__ei91) package { import flash.utils.*; import mx.core.*; public class Res__ei91 extends MovieClipLoaderAsset { public var dataClass:Class; private static var bytes:ByteArray = null; public function Res__ei91(){ dataClass = Res__ei91_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 219
//Res__ei91_dataClass (Res__ei91_dataClass) package { import mx.core.*; public class Res__ei91_dataClass extends ByteArrayAsset { } }//package
Section 220
//Res__en241 (Res__en241) package { import mx.core.*; public class Res__en241 extends SoundAsset { } }//package
Section 221
//Res__ex376 (Res__ex376) package { import mx.core.*; public class Res__ex376 extends BitmapAsset { } }//package
Section 222
//Res__ex554 (Res__ex554) package { import mx.core.*; public class Res__ex554 extends BitmapAsset { } }//package
Section 223
//Res__fb402 (Res__fb402) package { import mx.core.*; public class Res__fb402 extends SoundAsset { } }//package
Section 224
//Res__fh818 (Res__fh818) package { import mx.core.*; public class Res__fh818 extends SoundAsset { } }//package
Section 225
//Res__fi157 (Res__fi157) package { import mx.core.*; public class Res__fi157 extends BitmapAsset { } }//package
Section 226
//Res__fj200 (Res__fj200) package { import mx.core.*; public class Res__fj200 extends BitmapAsset { } }//package
Section 227
//Res__fj883 (Res__fj883) package { import mx.core.*; public class Res__fj883 extends SoundAsset { } }//package
Section 228
//Res__ga10 (Res__ga10) package { import flash.utils.*; import mx.core.*; public class Res__ga10 extends MovieClipLoaderAsset { public var dataClass:Class; private static var bytes:ByteArray = null; public function Res__ga10(){ dataClass = Res__ga10_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 229
//Res__ga10_dataClass (Res__ga10_dataClass) package { import mx.core.*; public class Res__ga10_dataClass extends ByteArrayAsset { } }//package
Section 230
//Res__gg160 (Res__gg160) package { import mx.core.*; public class Res__gg160 extends SoundAsset { } }//package
Section 231
//Res__gk206 (Res__gk206) package { import mx.core.*; public class Res__gk206 extends BitmapAsset { } }//package
Section 232
//Res__gk632 (Res__gk632) package { import mx.core.*; public class Res__gk632 extends BitmapAsset { } }//package
Section 233
//Res__gm710 (Res__gm710) package { import mx.core.*; public class Res__gm710 extends BitmapAsset { } }//package
Section 234
//Res__go800 (Res__go800) package { import mx.core.*; public class Res__go800 extends BitmapAsset { } }//package
Section 235
//Res__hd504 (Res__hd504) package { import mx.core.*; public class Res__hd504 extends BitmapAsset { } }//package
Section 236
//Res__hg874 (Res__hg874) package { import mx.core.*; public class Res__hg874 extends BitmapAsset { } }//package
Section 237
//Res__hi317 (Res__hi317) package { import mx.core.*; public class Res__hi317 extends SoundAsset { } }//package
Section 238
//Res__hk607 (Res__hk607) package { import flash.utils.*; import mx.core.*; public class Res__hk607 extends MovieClipLoaderAsset { public var dataClass:Class; private static var bytes:ByteArray = null; public function Res__hk607(){ dataClass = Res__hk607_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 239
//Res__hk607_dataClass (Res__hk607_dataClass) package { import mx.core.*; public class Res__hk607_dataClass extends ByteArrayAsset { } }//package
Section 240
//Res__hu439 (Res__hu439) package { import mx.core.*; public class Res__hu439 extends BitmapAsset { } }//package
Section 241
//Res__in392 (Res__in392) package { import mx.core.*; public class Res__in392 extends BitmapAsset { } }//package
Section 242
//Res__io428 (Res__io428) package { import mx.core.*; public class Res__io428 extends SoundAsset { } }//package
Section 243
//Res__iq591 (Res__iq591) package { import mx.core.*; public class Res__iq591 extends BitmapAsset { } }//package
Section 244
//Res__ir493 (Res__ir493) package { import mx.core.*; public class Res__ir493 extends BitmapAsset { } }//package
Section 245
//Res__is482 (Res__is482) package { import mx.core.*; public class Res__is482 extends SoundAsset { } }//package
Section 246
//Res__iv840 (Res__iv840) package { import mx.core.*; public class Res__iv840 extends BitmapAsset { } }//package
Section 247
//Res__ix214 (Res__ix214) package { import mx.core.*; public class Res__ix214 extends BitmapAsset { } }//package
Section 248
//Res__ja755 (Res__ja755) package { import mx.core.*; public class Res__ja755 extends SoundAsset { } }//package
Section 249
//Res__jq846 (Res__jq846) package { import mx.core.*; public class Res__jq846 extends BitmapAsset { } }//package
Section 250
//Res__jy51 (Res__jy51) package { import mx.core.*; public class Res__jy51 extends SoundAsset { } }//package
Section 251
//Res__kg314 (Res__kg314) package { import mx.core.*; public class Res__kg314 extends SoundAsset { } }//package
Section 252
//Res__kj556 (Res__kj556) package { import mx.core.*; public class Res__kj556 extends SoundAsset { } }//package
Section 253
//Res__kp142 (Res__kp142) package { import mx.core.*; public class Res__kp142 extends BitmapAsset { } }//package
Section 254
//Res__kp231 (Res__kp231) package { import mx.core.*; public class Res__kp231 extends BitmapAsset { } }//package
Section 255
//Res__la749 (Res__la749) package { import mx.core.*; public class Res__la749 extends BitmapAsset { } }//package
Section 256
//Res__le118 (Res__le118) package { import mx.core.*; public class Res__le118 extends BitmapAsset { } }//package
Section 257
//Res__lg139 (Res__lg139) package { import mx.core.*; public class Res__lg139 extends BitmapAsset { } }//package
Section 258
//Res__lo740 (Res__lo740) package { import mx.core.*; public class Res__lo740 extends MovieClipAsset { } }//package
Section 259
//Res__lq779 (Res__lq779) package { import mx.core.*; public class Res__lq779 extends SoundAsset { } }//package
Section 260
//Res__lx487 (Res__lx487) package { import mx.core.*; public class Res__lx487 extends MovieClipAsset { } }//package
Section 261
//Res__ma796 (Res__ma796) package { import mx.core.*; public class Res__ma796 extends SoundAsset { } }//package
Section 262
//Res__mf50 (Res__mf50) package { import mx.core.*; public class Res__mf50 extends SoundAsset { } }//package
Section 263
//Res__mi142 (Res__mi142) package { import mx.core.*; public class Res__mi142 extends SoundAsset { } }//package
Section 264
//Res__mj705 (Res__mj705) package { import mx.core.*; public class Res__mj705 extends BitmapAsset { } }//package
Section 265
//Res__mm926 (Res__mm926) package { import mx.core.*; public class Res__mm926 extends SoundAsset { } }//package
Section 266
//Res__ms435 (Res__ms435) package { import mx.core.*; public class Res__ms435 extends BitmapAsset { } }//package
Section 267
//Res__mt157 (Res__mt157) package { import mx.core.*; public class Res__mt157 extends SoundAsset { } }//package
Section 268
//Res__mu766 (Res__mu766) package { import mx.core.*; public class Res__mu766 extends SoundAsset { } }//package
Section 269
//Res__mv461 (Res__mv461) package { import mx.core.*; public class Res__mv461 extends BitmapAsset { } }//package
Section 270
//Res__mv827 (Res__mv827) package { import mx.core.*; public class Res__mv827 extends SoundAsset { } }//package
Section 271
//Res__na895 (Res__na895) package { import mx.core.*; public class Res__na895 extends SoundAsset { } }//package
Section 272
//Res__nd879 (Res__nd879) package { import mx.core.*; public class Res__nd879 extends SoundAsset { } }//package
Section 273
//Res__ng740 (Res__ng740) package { import mx.core.*; public class Res__ng740 extends SoundAsset { } }//package
Section 274
//Res__nm104 (Res__nm104) package { import mx.core.*; public class Res__nm104 extends BitmapAsset { } }//package
Section 275
//Res__nx110 (Res__nx110) package { import mx.core.*; public class Res__nx110 extends BitmapAsset { } }//package
Section 276
//Res__ny148 (Res__ny148) package { import mx.core.*; public class Res__ny148 extends SoundAsset { } }//package
Section 277
//Res__ox99 (Res__ox99) package { import mx.core.*; public class Res__ox99 extends BitmapAsset { } }//package
Section 278
//Res__pc390 (Res__pc390) package { import mx.core.*; public class Res__pc390 extends SoundAsset { } }//package
Section 279
//Res__pd402 (Res__pd402) package { import mx.core.*; public class Res__pd402 extends SoundAsset { } }//package
Section 280
//Res__pe159 (Res__pe159) package { import mx.core.*; public class Res__pe159 extends BitmapAsset { } }//package
Section 281
//Res__pj667 (Res__pj667) package { import mx.core.*; public class Res__pj667 extends SoundAsset { } }//package
Section 282
//Res__pp836 (Res__pp836) package { import mx.core.*; public class Res__pp836 extends SoundAsset { } }//package
Section 283
//Res__pw219 (Res__pw219) package { import mx.core.*; public class Res__pw219 extends SoundAsset { } }//package
Section 284
//Res__px850 (Res__px850) package { import mx.core.*; public class Res__px850 extends SoundAsset { } }//package
Section 285
//Res__py122 (Res__py122) package { import mx.core.*; public class Res__py122 extends BitmapAsset { } }//package
Section 286
//Res__qp640 (Res__qp640) package { import mx.core.*; public class Res__qp640 extends MovieClipAsset { } }//package
Section 287
//Res__qt750 (Res__qt750) package { import mx.core.*; public class Res__qt750 extends BitmapAsset { } }//package
Section 288
//Res__ra568 (Res__ra568) package { import mx.core.*; public class Res__ra568 extends MovieClipAsset { } }//package
Section 289
//Res__rg376 (Res__rg376) package { import mx.core.*; public class Res__rg376 extends BitmapAsset { } }//package
Section 290
//Res__rh759 (Res__rh759) package { import mx.core.*; public class Res__rh759 extends BitmapAsset { } }//package
Section 291
//Res__rl824 (Res__rl824) package { import mx.core.*; public class Res__rl824 extends BitmapAsset { } }//package
Section 292
//Res__rn162 (Res__rn162) package { import mx.core.*; public class Res__rn162 extends BitmapAsset { } }//package
Section 293
//Res__rq644 (Res__rq644) package { import mx.core.*; public class Res__rq644 extends MovieClipAsset { } }//package
Section 294
//Res__rv859 (Res__rv859) package { import mx.core.*; public class Res__rv859 extends BitmapAsset { } }//package
Section 295
//Res__sc201 (Res__sc201) package { import mx.core.*; public class Res__sc201 extends BitmapAsset { } }//package
Section 296
//Res__sd749 (Res__sd749) package { import mx.core.*; public class Res__sd749 extends BitmapAsset { } }//package
Section 297
//Res__sf883 (Res__sf883) package { import mx.core.*; public class Res__sf883 extends BitmapAsset { } }//package
Section 298
//Res__sg156 (Res__sg156) package { import mx.core.*; public class Res__sg156 extends BitmapAsset { } }//package
Section 299
//Res__sk382 (Res__sk382) package { import mx.core.*; public class Res__sk382 extends SoundAsset { } }//package
Section 300
//Res__ss91 (Res__ss91) package { import mx.core.*; public class Res__ss91 extends BitmapAsset { } }//package
Section 301
//Res__st785 (Res__st785) package { import mx.core.*; public class Res__st785 extends SoundAsset { } }//package
Section 302
//Res__sv201 (Res__sv201) package { import mx.core.*; public class Res__sv201 extends BitmapAsset { } }//package
Section 303
//Res__tp381 (Res__tp381) package { import mx.core.*; public class Res__tp381 extends BitmapAsset { } }//package
Section 304
//Res__tq257 (Res__tq257) package { import mx.core.*; public class Res__tq257 extends MovieClipAsset { } }//package
Section 305
//Res__tq79 (Res__tq79) package { import mx.core.*; public class Res__tq79 extends SoundAsset { } }//package
Section 306
//Res__tr710 (Res__tr710) package { import mx.core.*; public class Res__tr710 extends MovieClipAsset { } }//package
Section 307
//Res__tu655 (Res__tu655) package { import mx.core.*; public class Res__tu655 extends SoundAsset { } }//package
Section 308
//Res__tv248 (Res__tv248) package { import mx.core.*; public class Res__tv248 extends SoundAsset { } }//package
Section 309
//Res__ty117 (Res__ty117) package { import mx.core.*; public class Res__ty117 extends MovieClipAsset { } }//package
Section 310
//Res__ur115 (Res__ur115) package { import mx.core.*; public class Res__ur115 extends MovieClipAsset { } }//package
Section 311
//Res__uu336 (Res__uu336) package { import mx.core.*; public class Res__uu336 extends BitmapAsset { } }//package
Section 312
//Res__uw322 (Res__uw322) package { import mx.core.*; public class Res__uw322 extends BitmapAsset { } }//package
Section 313
//Res__uv403 (Res__uv403) package { import mx.core.*; public class Res__uv403 extends BitmapAsset { } }//package
Section 314
//Res__va152 (Res__va152) package { import mx.core.*; public class Res__va152 extends BitmapAsset { } }//package
Section 315
//Res__vc110 (Res__vc110) package { import mx.core.*; public class Res__vc110 extends SoundAsset { } }//package
Section 316
//Res__wj809 (Res__wj809) package { import mx.core.*; public class Res__wj809 extends SoundAsset { } }//package
Section 317
//Res__wm58 (Res__wm58) package { import mx.core.*; public class Res__wm58 extends BitmapAsset { } }//package
Section 318
//Res__vr906 (Res__vr906) package { import flash.utils.*; import mx.core.*; public class Res__vr906 extends MovieClipLoaderAsset { public var dataClass:Class; private static var bytes:ByteArray = null; public function Res__vr906(){ dataClass = Res__vr906_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 319
//Res__vr906_dataClass (Res__vr906_dataClass) package { import mx.core.*; public class Res__vr906_dataClass extends ByteArrayAsset { } }//package
Section 320
//Res__vw435 (Res__vw435) package { import mx.core.*; public class Res__vw435 extends BitmapAsset { } }//package
Section 321
//Res__vv775 (Res__vv775) package { import mx.core.*; public class Res__vv775 extends BitmapAsset { } }//package
Section 322
//Res__wv845 (Res__wv845) package { import mx.core.*; public class Res__wv845 extends SoundAsset { } }//package
Section 323
//Res__vw912 (Res__vw912) package { import mx.core.*; public class Res__vw912 extends SoundAsset { } }//package
Section 324
//Res__xk275 (Res__xk275) package { import mx.core.*; public class Res__xk275 extends BitmapAsset { } }//package
Section 325
//Res__xt781 (Res__xt781) package { import mx.core.*; public class Res__xt781 extends SoundAsset { } }//package
Section 326
//Res__yd243 (Res__yd243) package { import mx.core.*; public class Res__yd243 extends SoundAsset { } }//package
Section 327
//Res__yy441 (Res__yy441) package { import mx.core.*; public class Res__yy441 extends BitmapAsset { } }//package
Section 328
//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 _jq45:uint = 100; protected var _ur153:uint; protected var _wy81:uint; protected var _la237:Number; protected var timer:uint; protected var _ao389:Bitmap; protected var _ot139:Number; protected var xml:XML; protected var _ei924:uint; protected var _is605:Rectangle; protected var _yp353:Object; protected var _hy279:uint; protected var fps:uint; protected var text:TextField; protected var style:StyleSheet; protected var _ld683:uint; public function Stats(_arg1:Object=null):void{ _yp353 = {bg:51, fps:0xFFFF00, _hy279:0xFF00, _la237:0xFFFF, memmax:0xFF0070}; super(); if (_arg1){ if (_arg1.bg != null){ _yp353.bg = _arg1.bg; }; if (_arg1.fps != null){ _yp353.fps = _arg1.fps; }; if (_arg1._hy279 != null){ _yp353._hy279 = _arg1._hy279; }; if (_arg1._la237 != null){ _yp353._la237 = _arg1._la237; }; if (_arg1.memmax != null){ _yp353.memmax = _arg1.memmax; }; }; _ot139 = 0; xml = <xml><fps>FPS:</fps><_hy279>MS:</_hy279><_la237>MEM:</_la237><memMax>MAX:</memMax></xml> ; style = new StyleSheet(); style.setStyle(irrcrpt("crq", 5), {fontSize:irrcrpt("2sa", 3), fontFamily:irrcrpt("_ucpu", 2), leading:irrcrpt("-3qy", 1)}); style.setStyle(irrcrpt("hru", 2), {color:_aw844(_yp353.fps)}); style.setStyle(irrcrpt("nt", 1), {color:_aw844(_yp353._hy279)}); style.setStyle(irrcrpt("rjr", 5), {color:_aw844(_yp353._la237)}); style.setStyle(irrcrpt("nfnNby", 1), {color:_aw844(_yp353.memmax)}); text = new TextField(); text.width = WIDTH; text.height = 50; text.styleSheet = style; text.condenseWhite = true; text.selectable = false; text.mouseEnabled = false; _ao389 = new Bitmap(); _ao389.y = 50; _is605 = new Rectangle((WIDTH - 1), 0, 1, (_jq45 - 50)); addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true); addEventListener(Event.REMOVED_FROM_STAGE, _ei546, false, 0, true); } private function _aw844(_arg1:int):String{ return (("#" + _arg1.toString(16))); } private function update(_arg1:Event):void{ timer = getTimer(); if ((timer - 1000) > _ei924){ _ei924 = timer; _la237 = Number((System.totalMemory * 9.54E-7).toFixed(3)); _ot139 = ((_ot139 > _la237)) ? _ot139 : _la237; _ur153 = Math.min(_ao389.height, ((fps / stage.frameRate) * _ao389.height)); _ld683 = (Math.min(_ao389.height, Math.sqrt(Math.sqrt((_la237 * 5000)))) - 2); _wy81 = (Math.min(_ao389.height, Math.sqrt(Math.sqrt((_ot139 * 5000)))) - 2); _ao389.bitmapData.scroll(-1, 0); _ao389.bitmapData.fillRect(_is605, _yp353.bg); _ao389.bitmapData.setPixel((_ao389.width - 1), (_ao389.height - _ur153), _yp353.fps); _ao389.bitmapData.setPixel((_ao389.width - 1), (_ao389.height - ((timer - _hy279) >> 1)), _yp353._hy279); _ao389.bitmapData.setPixel((_ao389.width - 1), (_ao389.height - _ld683), _yp353._la237); _ao389.bitmapData.setPixel((_ao389.width - 1), (_ao389.height - _wy81), _yp353.memmax); xml.fps = (((irrcrpt("KUX: ", 5) + fps) + irrcrpt(" / ", 2)) + stage.frameRate); xml._la237 = (irrcrpt("QIQ: ", 4) + _la237); xml.memMax = (irrcrpt("PDA: ", 3) + _ot139); fps = 0; }; fps++; xml._hy279 = (irrcrpt("OU: ", 2) + (timer - _hy279)); _hy279 = timer; text.htmlText = xml; } private function init(_arg1:Event):void{ graphics.beginFill(_yp353.bg); graphics.drawRect(0, 0, WIDTH, _jq45); graphics.endFill(); addChild(text); _ao389.bitmapData = new BitmapData(WIDTH, (_jq45 - 50), false, _yp353.bg); addChild(_ao389); addEventListener(MouseEvent.CLICK, _jo659); addEventListener(Event.ENTER_FRAME, update); } private function _ei546(_arg1:Event):void{ graphics.clear(); while (numChildren > 0) { removeChildAt(0); }; _ao389.bitmapData.dispose(); removeEventListener(MouseEvent.CLICK, _jo659); removeEventListener(Event.ENTER_FRAME, update); } private function _jo659(_arg1:MouseEvent):void{ if (((mouseY / height) > 0.5)){ stage.frameRate--; } else { stage.frameRate++; }; xml.fps = (((irrcrpt("JTW: ", 4) + fps) + irrcrpt(" / ", 3)) + stage.frameRate); text.htmlText = xml; } } }//package
Section 329
//Utils (Utils) package { public class Utils { public static function _cc744(_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 _ys794(_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 _rg731(_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())); } public static function _rm243(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{ return (Math.atan2((_arg2 - _arg4), (_arg1 - _arg3))); } } }//package

Library Items

Symbol 1 GraphicUsed by:15
Symbol 2 GraphicUsed by:3
Symbol 3 MovieClipUses:2Used by:15
Symbol 4 GraphicUsed by:15
Symbol 5 GraphicUsed by:8
Symbol 6 GraphicUsed by:8
Symbol 7 GraphicUsed by:8
Symbol 8 ButtonUses:5 6 7Used by:15
Symbol 9 BitmapUsed by:10
Symbol 10 GraphicUses:9Used by:15
Symbol 11 GraphicUsed by:15
Symbol 12 GraphicUsed by:15
Symbol 13 GraphicUsed by:14
Symbol 14 MovieClip {NewgroundsAPI_fla.NewgroundsAPIAsset_Load_Indicator_3} [NewgroundsAPI_fla.NewgroundsAPIAsset_Load_Indicator_3]Uses:13Used by:15
Symbol 15 MovieClip {NewgroundsAPI_fla.NewgroundsAPIAsset_FlashAd_Container_23} [NewgroundsAPI_fla.NewgroundsAPIAsset_FlashAd_Container_23]Uses:1 3 4 8 10 11 12 14Used by:16
Symbol 16 MovieClip {com.newgrounds.components.FlashAd} [com.newgrounds.components.FlashAd]Uses:15
Symbol 17 Bitmap {Preloader__cy430}
Symbol 18 Sound {Res__yd243} [Res__yd243]
Symbol 19 BitmapUsed by:20
Symbol 20 GraphicUses:19Used by:72
Symbol 21 BitmapUsed by:22
Symbol 22 GraphicUses:21Used by:72
Symbol 23 GraphicUsed by:72
Symbol 24 BitmapUsed by:25
Symbol 25 GraphicUses:24Used by:72
Symbol 26 BitmapUsed by:27
Symbol 27 GraphicUses:26Used by:72
Symbol 28 BitmapUsed by:29
Symbol 29 GraphicUses:28Used by:72
Symbol 30 BitmapUsed by:31
Symbol 31 GraphicUses:30Used by:72
Symbol 32 BitmapUsed by:33
Symbol 33 GraphicUses:32Used by:72
Symbol 34 BitmapUsed by:35 70
Symbol 35 GraphicUses:34Used by:72
Symbol 36 SoundUsed by:72
Symbol 37 SoundUsed by:72
Symbol 38 SoundUsed by:72
Symbol 39 BitmapUsed by:40
Symbol 40 GraphicUses:39Used by:42 72
Symbol 41 SoundUsed by:72
Symbol 42 MovieClipUses:40Used by:72
Symbol 43 BitmapUsed by:44
Symbol 44 GraphicUses:43Used by:45 51
Symbol 45 MovieClipUses:44Used by:72
Symbol 46 BitmapUsed by:47
Symbol 47 GraphicUses:46Used by:72
Symbol 48 BitmapUsed by:49
Symbol 49 GraphicUses:48Used by:50
Symbol 50 MovieClipUses:49Used by:72
Symbol 51 MovieClipUses:44Used by:72
Symbol 52 BitmapUsed by:53
Symbol 53 GraphicUses:52Used by:54
Symbol 54 MovieClipUses:53Used by:72
Symbol 55 SoundUsed by:72
Symbol 56 SoundUsed by:72
Symbol 57 GraphicUsed by:58
Symbol 58 MovieClipUses:57Used by:72
Symbol 59 BitmapUsed by:60
Symbol 60 GraphicUses:59Used by:72
Symbol 61 BitmapUsed by:62
Symbol 62 GraphicUses:61Used by:63
Symbol 63 MovieClipUses:62Used by:72
Symbol 64 SoundUsed by:72
Symbol 65 BitmapUsed by:66
Symbol 66 GraphicUses:65Used by:67
Symbol 67 MovieClipUses:66Used by:72
Symbol 68 SoundUsed by:72
Symbol 69 SoundUsed by:72
Symbol 70 GraphicUses:34Used by:71
Symbol 71 MovieClipUses:70Used by:72
Symbol 72 MovieClip {Res__qp640} [titlescreen_symbol]Uses:20 22 23 25 27 29 31 33 35 36 37 38 40 41 42 45 47 50 51 54 55 56 58 60 63 64 67 68 69 71
Symbol 73 Sound {Res__is482} [Res__is482]
Symbol 74 Sound {Res__pp836} [Res__pp836]
Symbol 75 Sound {Res__mm926} [Res__mm926]
Symbol 76 Sound {Res__mv827} [Res__mv827]
Symbol 77 Sound {Res__wv845} [Res__wv845]
Symbol 78 Sound {Res__vc110} [Res__vc110]
Symbol 79 Sound {Res__fj883} [Res__fj883]
Symbol 80 Sound {Res__gg160} [Res__gg160]
Symbol 81 Sound {Res__bd797} [Res__bd797]
Symbol 82 Sound {Res__nd879} [Res__nd879]
Symbol 83 Sound {Res__na895} [Res__na895]
Symbol 84 Sound {Res__pd402} [Res__pd402]
Symbol 85 Sound {Res__mu766} [Res__mu766]
Symbol 86 Sound {Res__fb402} [Res__fb402]
Symbol 87 Sound {Res__bm575} [Res__bm575]
Symbol 88 Sound {Res__io428} [Res__io428]
Symbol 89 BitmapUsed by:90
Symbol 90 GraphicUses:89Used by:116 145 162 185 214 227 248
Symbol 91 BitmapUsed by:92
Symbol 92 GraphicUses:91Used by:116 145 162 185 214 227 248 281
Symbol 93 BitmapUsed by:94
Symbol 94 GraphicUses:93Used by:116 145 162 185 214 227 248 281
Symbol 95 BitmapUsed by:96
Symbol 96 GraphicUses:95Used by:116 145 162 185 214 227 248
Symbol 97 BitmapUsed by:98
Symbol 98 GraphicUses:97Used by:116 145 162 185 214 227 248
Symbol 99 BitmapUsed by:100
Symbol 100 GraphicUses:99Used by:116 145 162 185 214 227 248 281
Symbol 101 BitmapUsed by:102
Symbol 102 GraphicUses:101Used by:116 145 162 185 214 227 248
Symbol 103 BitmapUsed by:104
Symbol 104 GraphicUses:103Used by:116 162 185 214 227 248
Symbol 105 BitmapUsed by:106
Symbol 106 GraphicUses:105Used by:116 162 185 214 227 248
Symbol 107 BitmapUsed by:108
Symbol 108 GraphicUses:107Used by:116 162 185 214 227 248
Symbol 109 BitmapUsed by:110
Symbol 110 GraphicUses:109Used by:115 213
Symbol 111 BitmapUsed by:112
Symbol 112 GraphicUses:111Used by:115 184
Symbol 113 BitmapUsed by:114
Symbol 114 GraphicUses:113Used by:115 150
Symbol 115 MovieClipUses:110 112 114Used by:116 162 185 214 227 248
Symbol 116 MovieClip {Res__ra568} [Bloke_Idle_symbol]Uses:90 92 94 96 98 100 102 104 106 108 115
Symbol 117 Sound {Res__tu655} [Res__tu655]
Symbol 118 Sound {Res__fh818} [Res__fh818]
Symbol 119 Sound {Res__kj556} [Res__kj556]
Symbol 120 BitmapUsed by:121
Symbol 121 GraphicUses:120Used by:145 248
Symbol 122 BitmapUsed by:123
Symbol 123 GraphicUses:122Used by:124
Symbol 124 MovieClipUses:123Used by:145 248
Symbol 125 SoundUsed by:145
Symbol 126 BitmapUsed by:127
Symbol 127 GraphicUses:126Used by:130
Symbol 128 BitmapUsed by:129
Symbol 129 GraphicUses:128Used by:130
Symbol 130 MovieClipUses:127 129Used by:145
Symbol 131 BitmapUsed by:132
Symbol 132 GraphicUses:131Used by:145 281
Symbol 133 BitmapUsed by:134
Symbol 134 GraphicUses:133Used by:145 281
Symbol 135 BitmapUsed by:136
Symbol 136 GraphicUses:135Used by:145 281
Symbol 137 BitmapUsed by:138
Symbol 138 GraphicUses:137Used by:145 248
Symbol 139 BitmapUsed by:140
Symbol 140 GraphicUses:139Used by:145 248
Symbol 141 BitmapUsed by:142
Symbol 142 GraphicUses:141Used by:145
Symbol 143 BitmapUsed by:144
Symbol 144 GraphicUses:143Used by:145
Symbol 145 MovieClip {Res__lo740} [Bloke_Gameover_symbol]Uses:90 92 94 96 98 100 102 121 124 125 130 132 134 136 138 140 142 144
Symbol 146 Sound {Res__vw912} [Res__vw912]
Symbol 147 Sound {Res__mi142} [Res__mi142]
Symbol 148 Sound {Res__pc390} [Res__pc390]
Symbol 149 Sound {Res__pw219} [Res__pw219]
Symbol 150 MovieClipUses:114Used by:162 214 227 248
Symbol 151 BitmapUsed by:152
Symbol 152 GraphicUses:151Used by:162 185
Symbol 153 BitmapUsed by:154
Symbol 154 GraphicUses:153Used by:162 185
Symbol 155 BitmapUsed by:156
Symbol 156 GraphicUses:155Used by:162 185
Symbol 157 BitmapUsed by:158
Symbol 158 GraphicUses:157Used by:162 185
Symbol 159 BitmapUsed by:160
Symbol 160 GraphicUses:159Used by:162 185
Symbol 161 SoundUsed by:162
Symbol 162 MovieClip {Res__rq644} [Bloke_Scribble_symbol]Uses:90 92 94 96 98 100 102 104 106 108 115 150 152 154 156 158 160 161
Symbol 163 Sound {Res__ny148} [Res__ny148]
Symbol 164 Sound {Res__tv248} [Res__tv248]
Symbol 165 BitmapUsed by:166
Symbol 166 GraphicUses:165Used by:167
Symbol 167 MovieClipUses:166Used by:185
Symbol 168 BitmapUsed by:169
Symbol 169 GraphicUses:168Used by:170
Symbol 170 MovieClipUses:169Used by:185
Symbol 171 SoundUsed by:185
Symbol 172 BitmapUsed by:173
Symbol 173 GraphicUses:172Used by:174
Symbol 174 MovieClipUses:173Used by:185
Symbol 175 BitmapUsed by:176
Symbol 176 GraphicUses:175Used by:177
Symbol 177 MovieClipUses:176Used by:185 214
Symbol 178 BitmapUsed by:179
Symbol 179 GraphicUses:178Used by:180
Symbol 180 MovieClipUses:179Used by:185
Symbol 181 BitmapUsed by:182
Symbol 182 GraphicUses:181Used by:183
Symbol 183 MovieClipUses:182Used by:185
Symbol 184 MovieClipUses:112Used by:185 214 227
Symbol 185 MovieClip {Res__ty117} [Bloke_ScribbleWrong_symbol]Uses:90 92 94 96 98 100 102 104 106 108 115 152 154 156 158 160 167 170 171 174 177 180 183 184
Symbol 186 Sound {Res__ja755} [Res__ja755]
Symbol 187 Sound {Res__cl804} [Res__cl804]
Symbol 188 BitmapUsed by:189
Symbol 189 GraphicUses:188Used by:214 281
Symbol 190 SoundUsed by:214
Symbol 191 BitmapUsed by:192
Symbol 192 GraphicUses:191Used by:214 281
Symbol 193 BitmapUsed by:194
Symbol 194 GraphicUses:193Used by:214 281
Symbol 195 BitmapUsed by:196
Symbol 196 GraphicUses:195Used by:214 281
Symbol 197 BitmapUsed by:198
Symbol 198 GraphicUses:197Used by:214 281
Symbol 199 BitmapUsed by:200
Symbol 200 GraphicUses:199Used by:214 281
Symbol 201 BitmapUsed by:202
Symbol 202 GraphicUses:201Used by:203
Symbol 203 MovieClipUses:202Used by:214
Symbol 204 BitmapUsed by:205
Symbol 205 GraphicUses:204Used by:206
Symbol 206 MovieClipUses:205Used by:214
Symbol 207 BitmapUsed by:208
Symbol 208 GraphicUses:207Used by:209
Symbol 209 MovieClipUses:208Used by:214
Symbol 210 BitmapUsed by:211
Symbol 211 GraphicUses:210Used by:212
Symbol 212 MovieClipUses:211Used by:214
Symbol 213 MovieClipUses:110Used by:214
Symbol 214 MovieClip {Res__lx487} [Bloke_Bombshock_symbol]Uses:90 92 94 96 98 100 102 104 106 189 115 190 177 192 194 196 198 200 203 206 209 212 108 150 184 213
Symbol 215 Sound {Res__bk881} [Res__bk881]
Symbol 216 Sound {Res__lq779} [Res__lq779]
Symbol 217 Sound {Res__px850} [Res__px850]
Symbol 218 Sound {Res__mf50} [Res__mf50]
Symbol 219 Sound {Res__mt157} [Res__mt157]
Symbol 220 Sound {Res__dt536} [Res__dt536]
Symbol 221 Sound {Res__cp93} [Res__cp93]
Symbol 222 Sound {Res__xt781} [Res__xt781]
Symbol 223 Sound {Res__bw153} [Res__bw153]
Symbol 224 BitmapUsed by:225
Symbol 225 GraphicUses:224Used by:227 281
Symbol 226 SoundUsed by:227
Symbol 227 MovieClip {Res__dt495} [Bloke_Idle2_symbol]Uses:90 92 94 96 98 100 102 104 106 108 115 184 150 225 226
Symbol 228 Sound {Res__ng740} [Res__ng740]
Symbol 229 Sound {Res__ma796} [Res__ma796]
Symbol 230 Sound {Res__sk382} [Res__sk382]
Symbol 231 Sound {Res__jy51} [Res__jy51]
Symbol 232 Sound {Res__en241} [Res__en241]
Symbol 233 Sound {Res__be605} [Res__be605]
Symbol 234 SoundUsed by:248
Symbol 235 BitmapUsed by:236
Symbol 236 GraphicUses:235Used by:248
Symbol 237 BitmapUsed by:238
Symbol 238 GraphicUses:237Used by:248
Symbol 239 BitmapUsed by:240
Symbol 240 GraphicUses:239Used by:248
Symbol 241 BitmapUsed by:242
Symbol 242 GraphicUses:241Used by:248
Symbol 243 BitmapUsed by:244
Symbol 244 GraphicUses:243Used by:245
Symbol 245 MovieClipUses:244Used by:248
Symbol 246 BitmapUsed by:247
Symbol 247 GraphicUses:246Used by:248
Symbol 248 MovieClip {Res__tq257} [Bloke_Scared_symbol]Uses:90 92 94 96 98 100 102 104 106 108 115 234 236 150 238 240 242 245 138 247 140 121 124
Symbol 249 Sound {Res__tq79} [Res__tq79]
Symbol 250 GraphicUsed by:259
Symbol 251 SoundUsed by:259
Symbol 252 BitmapUsed by:253
Symbol 253 GraphicUses:252Used by:254
Symbol 254 MovieClipUses:253Used by:255
Symbol 255 MovieClipUses:254Used by:259
Symbol 256 SoundUsed by:259
Symbol 257 GraphicUsed by:259
Symbol 258 SoundUsed by:259
Symbol 259 MovieClip {Res__tr710} [logo_symbol]Uses:250 251 255 256 257 258
Symbol 260 Sound {Res__st785} [Res__st785]
Symbol 261 Sound {Res__kg314} [Res__kg314]
Symbol 262 Sound {Res__pj667} [Res__pj667]
Symbol 263 Sound {Res__hi317} [Res__hi317]
Symbol 264 Sound {Res__wj809} [Res__wj809]
Symbol 265 BitmapUsed by:266
Symbol 266 GraphicUses:265Used by:281
Symbol 267 BitmapUsed by:268
Symbol 268 GraphicUses:267Used by:281
Symbol 269 BitmapUsed by:270
Symbol 270 GraphicUses:269Used by:281
Symbol 271 BitmapUsed by:272
Symbol 272 GraphicUses:271Used by:281
Symbol 273 BitmapUsed by:274
Symbol 274 GraphicUses:273Used by:281
Symbol 275 BitmapUsed by:276
Symbol 276 GraphicUses:275Used by:281
Symbol 277 BitmapUsed by:278
Symbol 278 GraphicUses:277Used by:281
Symbol 279 BitmapUsed by:280
Symbol 280 GraphicUses:279Used by:281
Symbol 281 MovieClip {Res__ur115} [Bloke_Happydance_symbol]Uses:92 94 266 132 268 134 196 270 272 189 100 194 198 225 274 276 136 278 192 280 200
Symbol 282 Bitmap {Res__ms435}
Symbol 283 Bitmap {Res__mv461}
Symbol 284 Bitmap {Res__gk206}
Symbol 285 Bitmap {Res__rl824}
Symbol 286 Bitmap {Res__du31}
Symbol 287 Bitmap {Menu__uy23}
Symbol 288 Bitmap {Res__sv201}
Symbol 289 Bitmap {Res__iq591}
Symbol 290 Bitmap {Res__dx31}
Symbol 291 Bitmap {Res__jq846}
Symbol 292 Bitmap {Res__bm163}
Symbol 293 BinaryData {Res__ga10_dataClass}
Symbol 294 Bitmap {Res__uv403}
Symbol 295 Bitmap {Res__sf883}
Symbol 296 BinaryData {Res__vr906_dataClass}
Symbol 297 Bitmap {Res__xk275}
Symbol 298 Bitmap {Res__qt750}
Symbol 299 Bitmap {Res__rg376}
Symbol 300 Bitmap {Res__sg156}
Symbol 301 Bitmap {Particles__pg799}
Symbol 302 Bitmap {Res__ox99}
Symbol 303 Bitmap {Res__nm104}
Symbol 304 MovieClip {Res__vr906}
Symbol 305 Bitmap {Res__sd749}
Symbol 306 Bitmap {Particles__lx10}
Symbol 307 Bitmap {Res__ci67}
Symbol 308 Bitmap {Res__yy441}
Symbol 309 Bitmap {Res__le118}
Symbol 310 Bitmap {Res__nx110}
Symbol 311 Bitmap {Res__ap68}
Symbol 312 Bitmap {Res__dn908}
Symbol 313 Bitmap {Res__fi157}
Symbol 314 Bitmap {Res__vw435}
Symbol 315 Bitmap {Res__iv840}
Symbol 316 Bitmap {Res__ix214}
Symbol 317 Bitmap {Res__hu439}
Symbol 318 Bitmap {Res__cp129}
Symbol 319 Bitmap {Res__hd504}
Symbol 320 Bitmap {Res__va152}
Symbol 321 Bitmap {Res__ee771}
Symbol 322 Bitmap {Res__uu336}
Symbol 323 Bitmap {Res__uw322}
Symbol 324 Bitmap {Res__rh759}
Symbol 325 Bitmap {Res__go800}
Symbol 326 Bitmap {Res__py122}
Symbol 327 Bitmap {Res__ex554}
Symbol 328 Bitmap {Res__hg874}
Symbol 329 Bitmap {Res__lg139}
Symbol 330 Bitmap {Res__kp231}
Symbol 331 Bitmap {Res__gk632}
Symbol 332 BinaryData {Res__hk607_dataClass}
Symbol 333 Bitmap {Res__pe159}
Symbol 334 Bitmap {Menu__mx879}
Symbol 335 Bitmap {Res__fj200}
Symbol 336 Bitmap {Res__ss91}
Symbol 337 BinaryData {Res__ei91_dataClass}
Symbol 338 Bitmap {Res__sc201}
Symbol 339 Bitmap {Res__ao912}
Symbol 340 Bitmap {Res__in392}
Symbol 341 Bitmap {Res__rv859}
Symbol 342 Bitmap {Res__gm710}
Symbol 343 BinaryData {Res__cf633}
Symbol 344 Bitmap {Particles__am504}
Symbol 345 Bitmap {Res__aq775}
Symbol 346 Bitmap {Res__df584}
Symbol 347 Font {Gfx__fp393}
Symbol 348 Bitmap {Main__gw817}
Symbol 349 Bitmap {Res__bk74}
Symbol 350 Bitmap {Res__cd65}
Symbol 351 Bitmap {Res__ex376}
Symbol 352 Bitmap {Res__la749}
Symbol 353 Bitmap {Res__tp381}
Symbol 354 Bitmap {Res__ir493}
Symbol 355 Bitmap {Res__wm58}
Symbol 356 Bitmap {Res__mj705}
Symbol 357 Bitmap {Res__rn162}
Symbol 358 Bitmap {Res__kp142}
Symbol 359 Bitmap {Res__vv775}

Instance Names

"adMask"Symbol 15 MovieClip {NewgroundsAPI_fla.NewgroundsAPIAsset_FlashAd_Container_23} [NewgroundsAPI_fla.NewgroundsAPIAsset_FlashAd_Container_23] Frame 1Symbol 3 MovieClip
"ngLinkButton"Symbol 15 MovieClip {NewgroundsAPI_fla.NewgroundsAPIAsset_FlashAd_Container_23} [NewgroundsAPI_fla.NewgroundsAPIAsset_FlashAd_Container_23] Frame 1Symbol 8 Button
"background"Symbol 16 MovieClip {com.newgrounds.components.FlashAd} [com.newgrounds.components.FlashAd] Frame 1Symbol 15 MovieClip {NewgroundsAPI_fla.NewgroundsAPIAsset_FlashAd_Container_23} [NewgroundsAPI_fla.NewgroundsAPIAsset_FlashAd_Container_23]

Special Tags

FileAttributes (69)Timeline Frame 1Access network only, Metadata present, AS3.
SWFMetaData (77)Timeline Frame 1458 bytes "<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'><rdf:Description rdf:about='' xmlns ..."
ScriptLimits (65)Timeline Frame 1MaxRecursionDepth: 1000, ScriptTimeout: 60 seconds
ExportAssets (56)Timeline Frame 1Symbol 16 as "com.newgrounds.components.FlashAd"
ExportAssets (56)Timeline Frame 1Symbol 15 as "NewgroundsAPI_fla.NewgroundsAPIAsset_FlashAd_Container_23"
ExportAssets (56)Timeline Frame 1Symbol 14 as "NewgroundsAPI_fla.NewgroundsAPIAsset_Load_Indicator_3"
ExportAssets (56)Timeline Frame 2Symbol 18 as "Res__yd243"
ExportAssets (56)Timeline Frame 2Symbol 72 as "titlescreen_symbol"
ExportAssets (56)Timeline Frame 2Symbol 73 as "Res__is482"
ExportAssets (56)Timeline Frame 2Symbol 74 as "Res__pp836"
ExportAssets (56)Timeline Frame 2Symbol 75 as "Res__mm926"
ExportAssets (56)Timeline Frame 2Symbol 76 as "Res__mv827"
ExportAssets (56)Timeline Frame 2Symbol 77 as "Res__wv845"
ExportAssets (56)Timeline Frame 2Symbol 78 as "Res__vc110"
ExportAssets (56)Timeline Frame 2Symbol 79 as "Res__fj883"
ExportAssets (56)Timeline Frame 2Symbol 80 as "Res__gg160"
ExportAssets (56)Timeline Frame 2Symbol 81 as "Res__bd797"
ExportAssets (56)Timeline Frame 2Symbol 82 as "Res__nd879"
ExportAssets (56)Timeline Frame 2Symbol 83 as "Res__na895"
ExportAssets (56)Timeline Frame 2Symbol 84 as "Res__pd402"
ExportAssets (56)Timeline Frame 2Symbol 85 as "Res__mu766"
ExportAssets (56)Timeline Frame 2Symbol 86 as "Res__fb402"
ExportAssets (56)Timeline Frame 2Symbol 87 as "Res__bm575"
ExportAssets (56)Timeline Frame 2Symbol 88 as "Res__io428"
ExportAssets (56)Timeline Frame 2Symbol 116 as "Bloke_Idle_symbol"
ExportAssets (56)Timeline Frame 2Symbol 117 as "Res__tu655"
ExportAssets (56)Timeline Frame 2Symbol 118 as "Res__fh818"
ExportAssets (56)Timeline Frame 2Symbol 119 as "Res__kj556"
ExportAssets (56)Timeline Frame 2Symbol 145 as "Bloke_Gameover_symbol"
ExportAssets (56)Timeline Frame 2Symbol 146 as "Res__vw912"
ExportAssets (56)Timeline Frame 2Symbol 147 as "Res__mi142"
ExportAssets (56)Timeline Frame 2Symbol 148 as "Res__pc390"
ExportAssets (56)Timeline Frame 2Symbol 149 as "Res__pw219"
ExportAssets (56)Timeline Frame 2Symbol 162 as "Bloke_Scribble_symbol"
ExportAssets (56)Timeline Frame 2Symbol 163 as "Res__ny148"
ExportAssets (56)Timeline Frame 2Symbol 164 as "Res__tv248"
ExportAssets (56)Timeline Frame 2Symbol 185 as "Bloke_ScribbleWrong_symbol"
ExportAssets (56)Timeline Frame 2Symbol 186 as "Res__ja755"
ExportAssets (56)Timeline Frame 2Symbol 187 as "Res__cl804"
ExportAssets (56)Timeline Frame 2Symbol 214 as "Bloke_Bombshock_symbol"
ExportAssets (56)Timeline Frame 2Symbol 215 as "Res__bk881"
ExportAssets (56)Timeline Frame 2Symbol 216 as "Res__lq779"
ExportAssets (56)Timeline Frame 2Symbol 217 as "Res__px850"
ExportAssets (56)Timeline Frame 2Symbol 218 as "Res__mf50"
ExportAssets (56)Timeline Frame 2Symbol 219 as "Res__mt157"
ExportAssets (56)Timeline Frame 2Symbol 220 as "Res__dt536"
ExportAssets (56)Timeline Frame 2Symbol 221 as "Res__cp93"
ExportAssets (56)Timeline Frame 2Symbol 222 as "Res__xt781"
ExportAssets (56)Timeline Frame 2Symbol 223 as "Res__bw153"
ExportAssets (56)Timeline Frame 2Symbol 227 as "Bloke_Idle2_symbol"
ExportAssets (56)Timeline Frame 2Symbol 228 as "Res__ng740"
ExportAssets (56)Timeline Frame 2Symbol 229 as "Res__ma796"
ExportAssets (56)Timeline Frame 2Symbol 230 as "Res__sk382"
ExportAssets (56)Timeline Frame 2Symbol 231 as "Res__jy51"
ExportAssets (56)Timeline Frame 2Symbol 232 as "Res__en241"
ExportAssets (56)Timeline Frame 2Symbol 233 as "Res__be605"
ExportAssets (56)Timeline Frame 2Symbol 248 as "Bloke_Scared_symbol"
ExportAssets (56)Timeline Frame 2Symbol 249 as "Res__tq79"
ExportAssets (56)Timeline Frame 2Symbol 259 as "logo_symbol"
ExportAssets (56)Timeline Frame 2Symbol 260 as "Res__st785"
ExportAssets (56)Timeline Frame 2Symbol 261 as "Res__kg314"
ExportAssets (56)Timeline Frame 2Symbol 262 as "Res__pj667"
ExportAssets (56)Timeline Frame 2Symbol 263 as "Res__hi317"
ExportAssets (56)Timeline Frame 2Symbol 264 as "Res__wj809"
ExportAssets (56)Timeline Frame 2Symbol 281 as "Bloke_Happydance_symbol"
SerialNumber (41)Timeline Frame 1

Labels

"Preloader"Frame 1
"Main"Frame 2




http://swfchan.com/47/231559/info.shtml
Created: 8/2 -2020 15:10:46 Last modified: 8/2 -2020 15:10:46 Server time: 22/12 -2024 10:56:30