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/21908090?noj=FRM21908090-22DC" width="1" height="1"></div>

Ching-Chong-Beautiful.swf

This is the info page for
Flash #111085

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


ActionScript [AS1/AS2]
Combined Code
movieClip 19 { } movieClip 22 { } movieClip 32 { } movieClip 34 { frame 40 { stop(); } } movieClip 40 { } button 41 { on (release) { startMovie(); } } movieClip 42 Preloader Bar (NewgroundsAPI) { #initclip Object.registerClass('Preloader Bar (NewgroundsAPI)', com.newgrounds.components.PreloaderBar); #endinitclip } button 66 { on (release) { com.newgrounds.API.loadNewgrounds(); } } // unknown tag 88 length 69 // unknown tag 88 length 75 // unknown tag 88 length 75 // unknown tag 88 length 75 movieClip 78 { } // unknown tag 88 length 75 button 84 { on (release) { nextFrame(); } } button 85 { on (release) { prevFrame(); } } // unknown tag 88 length 75 // unknown tag 88 length 75 button 89 { on (release) { selectPeriod('Today'); } } // unknown tag 88 length 75 // unknown tag 88 length 75 button 92 { on (release) { selectPeriod('This Week'); } } // unknown tag 88 length 75 // unknown tag 88 length 75 button 95 { on (release) { selectPeriod('This Month'); } } // unknown tag 88 length 75 // unknown tag 88 length 75 button 98 { on (release) { selectPeriod('This Year'); } } // unknown tag 88 length 75 // unknown tag 88 length 75 button 101 { on (release) { selectPeriod('All-Time'); } } movieClip 102 { frame 1 { function selectPeriod(p) { _parent.loadScores(10, p); period = p; gotoAndStop(1); } stop(); } } movieClip 103 Score Board (NewgroundsAPI) { #initclip Object.registerClass('Score Board (NewgroundsAPI)', com.newgrounds.components.ScoreTable); #endinitclip frame 1 { loadScores(10); } } // unknown tag 88 length 79 movieClip 112 { frame 1 { onEnterFrame = function () { if (_visible) { _rotation = _rotation + 30; } else { delete onEnterFrame; } }; } } // unknown tag 88 length 79 movieClip 114 { frame 10 { stop(); } } // unknown tag 88 length 79 movieClip 116 { frame 37 { _parent.setGotoFrame('done'); stop(); } } movieClip 118 { } movieClip 120 NewgroundsAPIAsset_Medal_Icon_Placeholder { } // unknown tag 88 length 79 // unknown tag 88 length 84 // unknown tag 88 length 84 movieClip 128 NewgroundsAPIAsset_Medal_Popup { frame 1 { function endDelay() { clearInterval(pop_delay); gotoAndPlay('closeme'); } _visible = true; icon._visible = false; pop_delay = setInterval(endDelay, 3000); } frame 2 { medal.attachIcon(icon); } frame 10 { icon._visible = true; medal_name = medal.getName(); medal_value = medal.getValue() + 'pts'; stop(); } frame 21 { this.removeMovieClip(); _visible = false; stop(); } } // unknown tag 88 length 84 // unknown tag 88 length 79 movieClip 134 NewgroundsAPIAsset_Login_Warning { frame 1 { function endDelay() { clearInterval(pop_delay); gotoAndPlay('closeme'); } _x = 0; _y = 0; _visible = true; pop_delay = setInterval(endDelay, 6000); } frame 10 { stop(); } frame 21 { this.removeMovieClip(); _visible = false; stop(); } } // unknown tag 88 length 79 // unknown tag 88 length 84 movieClip 137 NewgroundsAPIAsset_Connection_Error { frame 1 { function endDelay() { clearInterval(pop_delay); gotoAndPlay('closeme'); } _x = 0; _y = 0; _visible = true; pop_delay = setInterval(endDelay, 6000); } frame 10 { stop(); } frame 21 { this.removeMovieClip(); _visible = false; stop(); } } movieClip 139 { } movieClip 141 { } movieClip 143 { } movieClip 145 { } movieClip 147 { } movieClip 149 { } movieClip 151 { } movieClip 153 { } movieClip 155 { } movieClip 157 { } movieClip 158 NewgroundsAPIAsset_big_popup_background { frame 1 { var w = Math.round(this._width); var h = Math.round(this._height); if (w < 80) { w = 80; } if (h < 80) { h = 80; } this._width = 350; this._height = 120; t._width = w - 2; t._x = 1; b._width = w - 2; b._x = 1; c._width = w - 2; c._x = 1; c._height = h - 2; c._y = 1; l._height = h - 2; l._y = 1; r._height = h - 2; r._y = 1; tr._x = w - 7; r._x = w - 7; br._x = w - 7; b._y = h - 7; bl._y = h - 7; br._y = h - 7; shadow._width = w + 10; shadow._height = h + 10; } } button 162 { on (release) { this._visible = false; this.removeMovieClip(); } } // unknown tag 88 length 143 // unknown tag 88 length 79 button 169 { on (release) { getURL(official_version_url, '_blank'); } } // unknown tag 88 length 84 movieClip 171 NewgroundsAsset_New_Version_Available { frame 1 { _x = Stage.width / 2; _y = Stage.height / 2; background._width = Stage.width + 200; background._height = Stage.height + 200; background._x = -(_x + 100); background._y = -(_y + 100); } } button 172 { on (release) { getURL(official_version_url, '_blank'); } } // unknown tag 88 length 143 // unknown tag 88 length 79 // unknown tag 88 length 84 movieClip 176 NewgroundsAsset_Illegal_Host { frame 1 { _x = Stage.width / 2; _y = Stage.height / 2; background._width = Stage.width + 200; background._height = Stage.height + 200; background._x = -(_x + 100); background._y = -(_y + 100); } } movieClip 177 API Connector (NewgroundsAPI) { #initclip Object.registerClass('API Connector (NewgroundsAPI)', com.newgrounds.components.APIConnector); #endinitclip frame 20 { _visible = false; } } movieClip 186 { frame 11 { gotoAndPlay(1); } } movieClip 187 Flash Ad (NewgroundsAPI) { #initclip Object.registerClass('Flash Ad (NewgroundsAPI)', com.newgrounds.components.FlashAd); #endinitclip } frame 1 { function itemHandlerNONE(obj, item) {} function itemHandler0(obj, item) { getURL('http://www.newgrounds.com/game/', 'blank'); } function itemHandler1(obj, item) { getURL('http://www.theswain.com', 'blank'); } function itemHandlerNONE(obj, item) {} function itemHandler3(obj, item) { _quality = 'HIGH'; (SharedObject.getLocal('chingchong')).data.player_quality = 'high'; _root.my_quality = 'high'; } function itemHandler4(obj, item) { _quality = 'MEDIUM'; (SharedObject.getLocal('chingchong')).data.player_quality = 'med'; _root.my_quality = 'med'; } function itemHandler5(obj, item) { _quality = 'LOW'; (SharedObject.getLocal('chingchong')).data.player_quality = 'low'; _root.my_quality = 'low'; } stop(); myMenu = new ContextMenu(); myMenu.hideBuiltInItems(); myMenu.customItems.push(new ContextMenuItem('More Games:', itemHandlerNONE)); myMenu.customItems.push(new ContextMenuItem('== Newgrounds.com', itemHandler0)); myMenu.customItems.push(new ContextMenuItem('== TheSwain.com', itemHandler1)); myMenu.customItems.push(new ContextMenuItem('Quality:', itemHandlerNONE)); myMenu.customItems.push(new ContextMenuItem('== High', itemHandler3)); myMenu.customItems.push(new ContextMenuItem('== Med', itemHandler4)); myMenu.customItems.push(new ContextMenuItem('== Low', itemHandler5)); myMenu.customItems[3].separatorBefore = true; _root.menu = myMenu; } movieClip 193 { } movieClip 198 { } button 206 { on (release) { startMovie(); } } movieClip 208 { frame 1 { function timerHandler() { if (!loadingComplete) { var v4 = _root.getBytesLoaded() / _root.getBytesTotal(); trace('Loaded: ' + v4); bar._xscale = 100 * v4; if (v4 == 1) { loadingComplete = true; if (AUTO_PLAY) { startMovie(); } else { gotoAndStop('loaded'); } return undefined; } } dt = getTimer() - time; time += dt; frameAccum += dt; var v3 = 0; for (;;) { if (!(frameAccum >= FRAME_TIME && v3 < MAX_FRAME_SKIP)) break; advanceFrame(tankLogo, true, true); advanceFrame(loadingText, false, true); advanceFrame(barGfx, false, true); if (loadingComplete) { advanceFrame(this, false, false); } frameAccum -= FRAME_TIME; v3++; } updateAfterEvent(); } function advanceFrame(clip, recurse, loop) { if (!clip) { return undefined; } clip.stop(); if (clip._currentframe == clip._totalframes) { if (loop) { clip.gotoAndStop(1); } } else { clip.nextFrame(); } if (recurse) { for (childName in clip) { if (typeof clip[childName] == 'movieclip') { advanceFrame(clip[childName], recurse, loop); } } } } function startMovie() { clearInterval(intervalId); _root.play(); } _root.stop(); stop(); var FRAME_TIME = 33.33333333333334; var AUTO_PLAY = false; var MAX_FRAME_SKIP = 5; var loadingComplete; var intervalId; var time; var frameAccum; loadingComplete = false; intervalId = setInterval(this, 'timerHandler', FRAME_TIME / 2); frameAccum = 0; time = getTimer(); timerHandler(); } frame 2 { stop(); } } instance of movieClip 187 Flash Ad (NewgroundsAPI) { onClipEvent (construct) { show_background = true; } } button 211 { on (press) { getURL('http://www.theswain.com', 'blank'); } } button 213 { on (press) { getURL('http://www.newgrounds.com/game/', 'blank'); } } instance of movieClip 177 API Connector (NewgroundsAPI) { onClipEvent (construct) { encryption_key = 'FUmAqupwxBkuSm2nNZVBIo7MTkzxjXDt'; movie_id = '10166'; movie_version = ''; fake_session = false; debug = false; } } movieClip 215 { } movieClip 44 __Packages.com.newgrounds.API { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.API) { var v1 = function () {}; com.newgrounds.API = v1; var v2 = v1.prototype; v1.setMovieVersion = function (v) { if (v) { com.newgrounds.API.version = String(v); } }; v1.setUserEmail = function (e) { com.newgrounds.API.user_email = e; }; v1.setFakeSession = function (fake) { com.newgrounds.API.fake_session = fake; }; v1.setPreload = function (p) { com.newgrounds.API.preload = p; }; v1.getPercentLoaded = function () { var v2; if (com.newgrounds.API.preload && com.newgrounds.API.preload_items > 0) { v2 = 80; var v4 = Math.round((com.newgrounds.API.preload_items_loaded / com.newgrounds.API.preload_items) * 20); var v3 = Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * v2) + v4; return v3; } v2 = 100; v3 = Math.round((_root.getBytesLoaded() / _root.getBytesTotal()) * v2); return v3; }; v1.reportNewAsset = function () { if (com.newgrounds.API.preload) { ++com.newgrounds.API.preload_items; } }; v1.reportAssetLoaded = function () { if (com.newgrounds.API.preload) { ++com.newgrounds.API.preload_items_loaded; } }; v1.populateMedals = function (medal_list) { if (com.newgrounds.API.medals === null) { com.newgrounds.API.medals = new Array(); var v2 = 0; while (v2 < medal_list.length) { var v1 = medal_list[v2]; com.newgrounds.API.medals.push(new com.newgrounds.Medal(v1.medal_id, v1.medal_name, v1.medal_value, v1.medal_difficulty, v1.medal_unlocked, v1.medal_icon)); ++v2; } } }; v1.populateSaveGroups = function (save_group_list, file_path) { com.newgrounds.SaveFile.setFilePath(file_path); com.newgrounds.API.save_groups = new Array(); var v6 = 0; while (v6 < save_group_list.length) { var v2 = save_group_list[v6]; var v5 = new com.newgrounds.SaveGroup(v2.group_id, v2.group_name, v2.group_type); var v4 = 0; while (v4 < v2.keys.length) { var v3 = v2.keys[v4]; v5.addKey(v3.id, v3.name, v3.type); ++v4; } v4 = 0; while (v4 < v2.ratings.length) { var v1 = v2.ratings[v4]; v5.addRating(v1.id, v1.name, v1.min, v1.max, v1.float); ++v4; } com.newgrounds.API.save_groups.push(v5); ++v6; } }; v1.populateScoreBoards = function (score_boards) { com.newgrounds.API.scoreboards = new Array(); var v1 = 0; while (v1 < score_boards.length) { com.newgrounds.API.scoreboards.push(new com.newgrounds.ScoreBoard(score_boards[v1].id, score_boards[v1].name)); ++v1; } }; v1.getOfficialVersionURL = function () { var v1 = com.newgrounds.API.GATEWAY_URL + '?tracker_id=' + com.newgrounds.API.movie_id + '&command_id=' + com.newgrounds.API.getCommandID('loadOfficalVersion') + '&seed=' + Math.random(); if (com.newgrounds.API.debug) { v1 += '&debug=1'; } return v1; }; v1.hasUserSession = function () { if (com.newgrounds.API.session_id && com.newgrounds.API.publisher_id) { return true; return false; } if (_root.NewgroundsAPI_PublisherID && _root.NewgroundsAPI_SessionID) { return true; } return false; }; v1.isNewgrounds = function () { return com.newgrounds.API.publisher_id == 1 || _root.NewgroundsAPI_PublisherID == 1 || ((com.newgrounds.API.getHost()).toLowerCase()).indexOf('ungrounded.net') > -1; }; v1.hasPublisher = function () { return com.newgrounds.API.publisher_id || _root.NewgroundsAPI_PublisherID; }; v1.hasUserEmail = function () { if (com.newgrounds.API.user_email) { return true; } return false; }; v1.isConnected = function () { return com.newgrounds.API.connected; }; v1.getTrackerID = function () { return com.newgrounds.API.tracker_id; }; v1.connectionTimeOut = function () { com.newgrounds.API.reportAssetLoaded(); clearInterval(com.newgrounds.API.timeout); com.newgrounds.API.callListener(com.newgrounds.APIEvent.MOVIE_CONNECTED, false, new com.newgrounds.APIError('CONNECTION_FAILED', 'Connection to API gateway timed out.')); }; v1.connectMovie = function (m_id, encrypt_key, debug_mode) { if (com.newgrounds.API.connected) { return undefined; } com.newgrounds.API.sendMessage('Connecting to the Newgrounds API Gateway...'); var v2 = function () { com.newgrounds.API.connectionTimeOut(); }; com.newgrounds.API.timeout = setInterval(v2, 10000, null); if (!m_id) { com.newgrounds.API.fatalError('API.connectMovie() - missing required movie_id parameter', 'connectMovie'); } com.newgrounds.API.movie_id = String(m_id); com.newgrounds.API.tracker_id = Number(com.newgrounds.API.movie_id.substring(0, com.newgrounds.API.movie_id.indexOf(':'))); com.newgrounds.API.encryption_key = encrypt_key; com.newgrounds.API.debug = debug_mode; if (_root.NewgroundsAPI_PublisherID) { com.newgrounds.API.publisher_id = _root.NewgroundsAPI_PublisherID; if (_root.NewgroundsAPI_SessionID) { com.newgrounds.API.session_id = _root.NewgroundsAPI_SessionID; } } else { if (com.newgrounds.API.fake_session) { com.newgrounds.API.publisher_id = 1; com.newgrounds.API.session_id = 'D3bu64p1U53R'; com.newgrounds.API.user_id = 10; com.newgrounds.API.user_name = 'API-Debugger'; } else { if (com.newgrounds.API.debug) { com.newgrounds.API.publisher_id = 1; } com.newgrounds.API.session_id = null; com.newgrounds.API.user_id = 0; com.newgrounds.API.user_name = 'Guest'; } } if (_root.NewgroundsAPI_UserName) { com.newgrounds.API.user_name = _root.NewgroundsAPI_UserName; } if (_root.NewgroundsAPI_UserID) { com.newgrounds.API.user_id = _root.NewgroundsAPI_UserID; } com.newgrounds.API.reportNewAsset(); com.newgrounds.API.connected = true; com.newgrounds.API.sendCommand('connectMovie', {'host': com.newgrounds.API.getHost(), 'movie_version': com.newgrounds.API.version}); }; v1.getHost = function () { if (!com.newgrounds.API.host) { var v1 = _url; if (v1.indexOf('http://') > -1 or v1.indexOf('https://') > -1) { com.newgrounds.API.host = (v1.split('/'))[2].toLowerCase(); return com.newgrounds.API.host; } com.newgrounds.API.host = com.newgrounds.API.LOCAL_HOST; } return com.newgrounds.API.host; }; v1.isPublishedHost = function () { for (var v1 in com.newgrounds.API.PREVIEW_HOSTS) { if (com.newgrounds.API.getHost() == com.newgrounds.API.PREVIEW_HOSTS[v1]) { return false; } } return true; }; v1.loadNewgrounds = function () { com.newgrounds.API.sendCommand('loadNewgrounds', {'host': com.newgrounds.API.getHost()}, true); }; v1.loadMySite = function () { com.newgrounds.API.sendCommand('loadMySite', {'host': com.newgrounds.API.getHost()}, true); }; v1.loadCustomLink = function (link) { com.newgrounds.API.sendCommand('loadCustomLink', {'host': com.newgrounds.API.getHost(), 'link': link}, true); }; v1.logCustomEvent = function (event) { com.newgrounds.API.sendCommand('logCustomEvent', {'host': com.newgrounds.API.getHost(), 'event': event}); }; v1.getScoreBoard = function (board) { for (var v2 in com.newgrounds.API.scoreboards) { if (typeof board == 'string' && com.newgrounds.API.scoreboards[v2].name == board) { return com.newgrounds.API.scoreboards[v2]; } else { if (typeof board == 'number' && com.newgrounds.API.scoreboards[v2].id == board) { return com.newgrounds.API.scoreboards[v2]; } } } }; v1.postScore = function (board, value, get_best) { if (!board or value == undefined) { com.newgrounds.API.sendError({'command_id': com.newgrounds.API.getCommandID('postScore')}, new com.newgrounds.APIError('MISSING_PARAM', 'missing required parameter(s)')); return undefined; } com.newgrounds.API.sendSecureCommand('postScore', {'user_name': com.newgrounds.API.user_name, 'board': board, 'value': value, 'get_best': get_best, 'publisher_id': com.newgrounds.API.publisher_id}); }; v1.loadScores = function (board) { var v3 = 'loadScores'; if (!board.__get__id()) { com.newgrounds.API.sendError({'command_id': com.newgrounds.API.getCommandID(v3)}, new com.newgrounds.APIError('MISSING_PARAM', 'missing required ScoreBoard instance')); return undefined; } if (!com.newgrounds.API.hasUserSession()) { com.newgrounds.API.callListener(com.newgrounds.APIEvent.SCORES_LOADED, false, new com.newgrounds.APIError('SITE_ID_REQUIRED', 'Host \'' + com.newgrounds.API.getHost() + '\' does not have high scores enabled')); return undefined; } var v1 = {}; v1.publisher_id = com.newgrounds.API.publisher_id; v1.period = board.period; v1.board = board.id; v1.num_results = board.num_results; v1.page = board.page; com.newgrounds.API.sendCommand(v3, v1); }; v1.unlockMedal = function (medal) { if (!medal) { com.newgrounds.API.sendError({'command_id': com.newgrounds.API.getCommandID('unlockMedal')}, new com.newgrounds.APIError('MISSING_PARAM', 'missing required medal name')); return undefined; } if (typeof medal != 'object') { medal = com.newgrounds.API.getMedal(medal); } com.newgrounds.API.callListener(com.newgrounds.APIEvent.UNLOCK_MEDAL, true, {'medal': medal}); if (com.newgrounds.API.hasUserSession() or com.newgrounds.API.debug) { com.newgrounds.API.sendMessage('Attempting to unlock \'' + medal.getName() + '\''); var v2 = new Object(); v2.medal_id = medal.getID(); com.newgrounds.API.sendSecureCommand('unlockMedal', v2); } else { com.newgrounds.API.sendMessage('Unlocking \'' + medal.getName() + '\''); medal.setUnlocked(true); var v1 = com.newgrounds.API.loadLocal('medals_unlocked'); if (!v1) { v1 = new Object(); } v1[medal.getID()] = true; com.newgrounds.API.saveLocal('medals_unlocked', v1); com.newgrounds.API.callListener(com.newgrounds.APIEvent.UNLOCK_MEDAL, true, {'medal': medal}); } }; v1.loadMedals = function () { if (com.newgrounds.API.medals) { com.newgrounds.API.callListener(com.newgrounds.APIEvent.MEDALS_LOADED, true, {'medals': com.newgrounds.API.medals}); return undefined; } var v1 = new Object(); if (com.newgrounds.API.hasUserSession()) { v1.publisher_id = com.newgrounds.API.publisher_id; v1.user_id = com.newgrounds.API.user_id; } com.newgrounds.API.sendCommand('getMedals', v1); }; v1.getMedals = function () { return com.newgrounds.API.medals; }; v1.getMedal = function (identifier) { for (var v3 in com.newgrounds.API.medals) { var v1 = com.newgrounds.API.medals[v3]; if (typeof identifier == 'string' && v1.getName() == identifier) { return v1; } else { if (v1.getID() == identifier) { return v1; } } } com.newgrounds.API.sendWarning('Could not find the medal \'' + identifier + '\''); }; v1.saveLocal = function (save_id, save_data, size_allocation) { if (!com.newgrounds.API.sharedObjects[save_id]) { com.newgrounds.API.sharedObjects[save_id] = SharedObject.getLocal('ng_ap_secure_' + com.newgrounds.API.movie_id + '_' + save_id); } com.newgrounds.API.sharedObjects[save_id].data[save_id] = com.newgrounds.API.encodeData(save_data); com.newgrounds.API.sharedObjects[save_id].flush(); }; v1.loadLocal = function (save_id) { if (!com.newgrounds.API.sharedObjects[save_id]) { com.newgrounds.API.sharedObjects[save_id] = SharedObject.getLocal('ng_ap_secure_' + com.newgrounds.API.movie_id + '_' + save_id); } com.newgrounds.API.sharedObjects[save_id].flush(); com.newgrounds.API.echo('sharedobject ' + save_id + ' is: ' + com.newgrounds.API.sharedObjects[save_id].data[save_id]); if (com.newgrounds.API.sharedObjects[save_id].data[save_id]) { com.newgrounds.API.echo('decoded: ' + com.newgrounds.API.decodeData(com.newgrounds.API.sharedObjects[save_id].data[save_id])); return com.newgrounds.API.decodeData(com.newgrounds.API.sharedObjects[save_id].data[save_id]); } else { return null; } }; v1.encodeData = function (data) { return com.newgrounds.API.compressHex(com.newgrounds.encoders.RC4.encrypt(com.newgrounds.encoders.JSON.encode(data), com.newgrounds.API.encryption_key)); }; v1.decodeData = function (base) { return com.newgrounds.encoders.JSON.decode(com.newgrounds.encoders.RC4.decrypt(com.newgrounds.API.uncompressHex(base), com.newgrounds.API.encryption_key)); }; v1.compressHex = function (hex_value) { var v6 = hex_value.length % 6; var v4 = ''; var v5 = new com.newgrounds.encoders.BaseN(com.newgrounds.API.compression_radix); var v1 = 0; while (v1 < hex_value.length) { var v2 = Number('0x' + hex_value.substr(v1, 6)); v4 += v5.encode(v2, 4); v1 += 6; } return v6 + v4; }; v1.uncompressHex = function (base_value) { var v9 = Number(base_value.charAt(0)); var v7 = ''; var v3; var v8 = new com.newgrounds.encoders.BaseN(com.newgrounds.API.compression_radix); var v2 = 1; while (v2 < base_value.length) { var v6 = base_value.substr(v2, 4); var v5 = v8.decode(v6); var v1 = com.newgrounds.API.dec2hex(v5); if (v2 + 4 < base_value.length) { v3 = 6; } else { v3 = v9; } while (v1.length < v3) { v1 = '0' + v1; } v7 += v1; v2 += 4; } return v7; }; v1.dec2hex = function (dec) { var v4 = '0123456789ABCDEF'; var v3 = ''; while (dec > 0) { var v2 = dec % 16; v3 = v4.charAt(v2) + v3; dec = (dec - v2) / 16; } return v3; }; v1.getSaveGroup = function (group) { if (com.newgrounds.API.save_groups == null || com.newgrounds.API.save_groups.length < 1) { trace('Save groups is null'); return null; } var v1 = 0; while (v1 <= com.newgrounds.API.save_groups.length) { if (typeof group == 'number' or (Number(group)).toString() == String(group)) { if (com.newgrounds.API.save_groups[v1].getID() == Number(group)) { return com.newgrounds.API.save_groups[v1]; } } else { if (typeof group == 'string') { if ((com.newgrounds.API.save_groups[v1].getName()).toLowerCase() == group.toLowerCase()) { return com.newgrounds.API.save_groups[v1]; } } } ++v1; } return null; }; v1.lookupSaveFiles = function (save_group) { var v1 = 'lookupSaveFiles'; var v2 = {'publisher_id': com.newgrounds.API.publisher_id, 'group_id': save_group.getID(), 'query': com.newgrounds.encoders.JSON.encode(save_group.getQuery(true))}; com.newgrounds.API.sendCommand(v1, v2); }; v1.newSaveFile = function (group) { var v1 = com.newgrounds.API.getSaveGroup(group); if (v1) { return v1.newFile(); } else { var v2 = new com.newgrounds.APIError('INVALID_SAVE_GROUP', '\'' + group + '\' is not a valid save group.'); com.newgrounds.API.sendError({'command_id': 'newSaveFile'}, v2); } }; v1.checkFilePrivs = function (file) { if (com.newgrounds.API.user_id) { var v1 = com.newgrounds.API.user_id; } else { var v1 = 0; } var v2 = {'group': (file.getGroup()).getID(), 'filename': file.getName(), 'user_id': v1, 'publisher_id': com.newgrounds.API.publisher_id}; com.newgrounds.API.sendCommand('checkFilePrivs', v2); }; v1.saveFile = function (file, overwrite) { var v1; v1 = {'group': (file.getGroup()).getID(), 'filename': file.getName(), 'description': file.getDescription(), 'shared': file.getShared(), 'user_name': com.newgrounds.API.user_name}; if (overwrite) { v1.overwrite = overwrite; } if (file.getDuplicateID()) { v1.save_id = file.getDuplicateID(); } if ((file.getKeys()).length > 0) { v1.keys = file.getKeys(); } var v3; v3 = {'file': file.getRawContents()}; if (file.getThumbnailImageScan()) { v3.thumbnail = file.getThumbnailImageScan(); } com.newgrounds.API.sendSecureCommand('saveFile', v1, null, v3); }; v1.rateSaveFile = function (file, rating, vote) { var v1 = {'group': (file.getGroup()).getID(), 'save_id': file.getID(), 'rating_id': rating.rating_id, 'vote': vote, 'user_id': com.newgrounds.API.user_id}; com.newgrounds.API.sendSecureCommand('rateSaveFile', v1); }; v1.getFiles = function (folder, options) { var v7 = {'name': 1, 'date': 2, 'score': 3}; var v2 = {'user_only': false, 'sort_on': 'date', 'page': 1, 'results_per_page': 20, 'sort_descending': true}; var v6 = new Array(); for (var v10 in v7) { v6.push('\'' + v10 + '\''); } var v4 = new Array(); for (var v9 in v2) { v4.push('\'' + v9 + '\''); } if (options.sort_descending && !v7[options.sort_descending]) { var v3 = new com.newgrounds.APIError('MISSING_PARAM', '\'' + options.sort_descending + '\' is not a valid sort_on value. Valid values are: ' + v6.join(', ')); com.newgrounds.API.sendError({'command_id': com.newgrounds.API.getCommandID('getFiles')}, v3); delete options.sort_descending; } var v8; if (options) { for (v10 in options) { if (v2[v10] == undefined) { v3 = new com.newgrounds.APIError('MISSING_PARAM', '\'' + v10 + '\' is not a valid option. Valid options are: ' + v4.join(', ')); com.newgrounds.API.sendError({'command_id': com.newgrounds.API.getCommandID('getFiles')}, v3); delete options[v10]; } else { if (typeof options[v10] != typeof v2[v10]) { v3 = new com.newgrounds.APIError('MISSING_PARAM', 'option \'' + v10 + '\' should be the following type: ' + typeof v2[v10]); com.newgrounds.API.sendError({'command_id': com.newgrounds.API.getCommandID('getFiles')}, v3); delete options[v10]; } } } v8 = options; } else { v8 = new Object(); } if (com.newgrounds.API.hasUserSession()) { v8.publisher_id = com.newgrounds.API.publisher_id; v8.user_id = com.newgrounds.API.user_id; } v8.folder = folder; com.newgrounds.API.sendCommand('getFiles', v8); }; v1.getConfirmation = function (command_name, event, msg, target, confirm, cancel) { var v1 = new com.newgrounds.APIError('CONFIRM_REQUEST', msg); v1.confirm = function () { target[confirm](); }; v1.cancel = function () { target[cancel](); }; v1.command = com.newgrounds.API.getCommandID(command_name); com.newgrounds.API.callListener(event, false, v1); }; v1.doBlockHost = function (event) { _root.stop(); com.newgrounds.API.initTextFormats(); _root.createEmptyMovieClip('NGAPI_deny_host_overlay', _root.getNextHighestDepth()); _root.NGAPI_deny_host_overlay.lineStyle(20, 0, 100); _root.NGAPI_deny_host_overlay.beginFill(6684672); _root.NGAPI_deny_host_overlay.moveTo(0, 0); _root.NGAPI_deny_host_overlay.lineTo(Stage.width, 0); _root.NGAPI_deny_host_overlay.lineTo(Stage.width, Stage.height); _root.NGAPI_deny_host_overlay.lineTo(0, Stage.height); _root.NGAPI_deny_host_overlay.lineTo(0, 0); _root.NGAPI_deny_host_overlay.endFill(); var v2 = 'This movie has not been approved for use on ' + com.newgrounds.API.getHost() + '.'; v2 += '\r\rFor an aproved copy, please visit:\r'; var v4 = v2.length; v2 += event.data.movie_url; var v3 = v2.length; _root.NGAPI_deny_host_overlay.createTextField('mousekill', 100, 0, 0, Stage.width, Stage.height); _root.NGAPI_deny_host_overlay.createTextField('error', 101, (Stage.width - 400) / 2, Stage.height / 2 - 100, 400, 200); _root.NGAPI_deny_host_overlay.error.text = 'ERROR!'; _root.NGAPI_deny_host_overlay.error.setTextFormat(com.newgrounds.API.error_format); _root.NGAPI_deny_host_overlay.createTextField('message', 102, (Stage.width - 400) / 2, Stage.height / 2, 400, 200); _root.NGAPI_deny_host_overlay.message.text = v2; _root.NGAPI_deny_host_overlay.message.multiline = true; _root.NGAPI_deny_host_overlay.message.wordWrap = true; _root.NGAPI_deny_host_overlay.message.html = true; _root.NGAPI_deny_host_overlay.message.setTextFormat(com.newgrounds.API.normal_format); com.newgrounds.API.link_format.url = event.data.redirect_url; _root.NGAPI_deny_host_overlay.message.setTextFormat(v4, v3, com.newgrounds.API.link_format); }; v1.onNewVersionAvailable = function (event) { _root.stop(); com.newgrounds.API.initTextFormats(); var v2 = new Object(); v2.x = Stage.width / 2; v2.y = Stage.height / 2; _root.createEmptyMovieClip('NGAPI_new_version_overlay', _root.getNextHighestDepth()); _root.NGAPI_new_version_overlay.lineStyle(1, 0, 100); _root.NGAPI_new_version_overlay.beginFill(0, 70); _root.NGAPI_new_version_overlay.moveTo(-10, -10); _root.NGAPI_new_version_overlay.lineTo(-10, 1000); _root.NGAPI_new_version_overlay.lineTo(1000, 1000); _root.NGAPI_new_version_overlay.lineTo(1000, -10); _root.NGAPI_new_version_overlay.lineTo(-10, -10); _root.NGAPI_new_version_overlay.endFill(); _root.NGAPI_new_version_overlay.lineStyle(10, 0, 100); _root.NGAPI_new_version_overlay.beginFill(51); _root.NGAPI_new_version_overlay.moveTo(v2.x - 240, v2.y - 120); _root.NGAPI_new_version_overlay.lineTo(v2.x + 240, v2.y - 120); _root.NGAPI_new_version_overlay.lineTo(v2.x + 240, v2.y + 80); _root.NGAPI_new_version_overlay.lineTo(v2.x - 240, v2.y + 80); _root.NGAPI_new_version_overlay.lineTo(v2.x - 240, v2.y - 120); _root.NGAPI_new_version_overlay.endFill(); _root.NGAPI_new_version_overlay.createEmptyMovieClip('exit', 1000); _root.NGAPI_new_version_overlay.exit.lineStyle(2, 39423, 100); _root.NGAPI_new_version_overlay.exit.beginFill(0, 50); _root.NGAPI_new_version_overlay.exit.moveTo(v2.x + 210, v2.y - 110); _root.NGAPI_new_version_overlay.exit.lineTo(v2.x + 230, v2.y - 110); _root.NGAPI_new_version_overlay.exit.lineTo(v2.x + 230, v2.y - 90); _root.NGAPI_new_version_overlay.exit.lineTo(v2.x + 210, v2.y - 90); _root.NGAPI_new_version_overlay.exit.lineTo(v2.x + 210, v2.y - 110); _root.NGAPI_new_version_overlay.exit.endFill(); _root.NGAPI_new_version_overlay.exit.moveTo(v2.x + 214, v2.y - 106); _root.NGAPI_new_version_overlay.exit.lineTo(v2.x + 226, v2.y - 94); _root.NGAPI_new_version_overlay.exit.moveTo(v2.x + 226, v2.y - 106); _root.NGAPI_new_version_overlay.exit.lineTo(v2.x + 214, v2.y - 94); _root.NGAPI_new_version_overlay.exit.onMouseUp = function () { if (_root.NGAPI_new_version_overlay.exit.hitTest(_root._xmouse, _root._ymouse)) { _root.NGAPI_new_version_overlay.removeMovieClip(); } }; var v3 = 'Version ' + event.data.movie_version + ' is now available at:' + '\n'; var v6 = v3.length; v3 += event.data.movie_url; var v4 = v3.length; _root.NGAPI_new_version_overlay.createTextField('mouseblocker', 99, -10, -10, 1000, 1000); _root.NGAPI_new_version_overlay.createTextField('newversion', 100, v2.x - 210, v2.y - 90, 400, 80); _root.NGAPI_new_version_overlay.newversion.text = 'New Version Available!'; _root.NGAPI_new_version_overlay.newversion.setTextFormat(com.newgrounds.API.header_format); _root.NGAPI_new_version_overlay.createTextField('message', 101, (Stage.width - 400) / 2, Stage.height / 2, 400, 40); _root.NGAPI_new_version_overlay.message.text = v3; _root.NGAPI_new_version_overlay.message.multiline = true; _root.NGAPI_new_version_overlay.message.wordWrap = true; _root.NGAPI_new_version_overlay.message.html = true; _root.NGAPI_new_version_overlay.message.setTextFormat(com.newgrounds.API.normal_format); com.newgrounds.API.link_format.url = event.data.redirect_url; _root.NGAPI_new_version_overlay.message.setTextFormat(v6, v4, com.newgrounds.API.link_format); }; v1.initTextFormats = function () { if (!com.newgrounds.API.error_format) { com.newgrounds.API.error_format = new TextFormat(); com.newgrounds.API.error_format.font = 'Arial Black'; com.newgrounds.API.error_format.size = 48; com.newgrounds.API.error_format.color = 16711680; } if (!com.newgrounds.API.header_format) { com.newgrounds.API.header_format = new TextFormat(); com.newgrounds.API.header_format.font = 'Arial Black'; com.newgrounds.API.header_format.size = 24; com.newgrounds.API.header_format.color = 16777215; } if (!com.newgrounds.API.normal_format) { com.newgrounds.API.normal_format = new TextFormat(); com.newgrounds.API.normal_format.font = 'Arial'; com.newgrounds.API.normal_format.bold = true; com.newgrounds.API.normal_format.size = 12; com.newgrounds.API.normal_format.color = 16777215; } if (!com.newgrounds.API.link_format) { com.newgrounds.API.link_format = new TextFormat(); com.newgrounds.API.link_format.color = 16776960; com.newgrounds.API.link_format.underline = true; } }; v1.doEvent = function (e) { switch (com.newgrounds.API.getCommandName(e.command_id)) { case 'connectMovie': clearInterval(com.newgrounds.API.timeout); com.newgrounds.API.sendMessage('You have successfully connected to the Newgrounds API Gateway'); com.newgrounds.API.sendMessage('Movie identified as "' + e.movie_name + '"'); com.newgrounds.API.callListener(com.newgrounds.APIEvent.MOVIE_CONNECTED, e.success, {'movie_name': e.movie_name}); var v7 = false; if (e.ad_status === -1) { var v11 = 'This movie was not approved to run Flash Ads.'; com.newgrounds.API.sendWarning(v11); com.newgrounds.API.sendWarning('visit ' + com.newgrounds.API.AD_TERMS_URL + ' to view our approval guidelines'); if (!e.ad_url) { com.newgrounds.API.callListener(com.newgrounds.APIEvent.ADS_APPROVED, false, new com.newgrounds.APIError('FLASH_ADS_NOT_APPROVED', v11)); } else { v7 = true; } } else { if (e.ad_status === 0) { var v11 = 'Flash Ads are currently awaiting approval.'; com.newgrounds.API.sendNotice(v11); if (!e.ad_url) { com.newgrounds.API.callListener(com.newgrounds.APIEvent.ADS_APPROVED, false, new com.newgrounds.APIError('FLASH_ADS_NOT_APPROVED', v11)); } else { v7 = true; } } } if (e.ad_url) { com.newgrounds.API.ad_url = unescape(e.ad_url); if (!v7) { com.newgrounds.API.sendMessage('This movie has been approved to run Flash Ads!'); } com.newgrounds.API.callListener(com.newgrounds.APIEvent.ADS_APPROVED, true); } if (e.deny_host) { v11 = com.newgrounds.API.getHost() + ' does not have permission to run this movie!'; com.newgrounds.API.sendWarning(v11); com.newgrounds.API.sendWarning('\tUpdate your API configuration to unblock ' + com.newgrounds.API.getHost()); com.newgrounds.API.callListener(com.newgrounds.APIEvent.HOST_BLOCKED, true, {'movie_url': unescape(e.movie_url), 'redirect_url': com.newgrounds.API.getOfficialVersionURL()}); } else { if (e.movie_version) { com.newgrounds.API.sendWarning('According to your API Configuration, this version is out of date.'); if (com.newgrounds.API.version) { com.newgrounds.API.sendWarning('\tThe this movie is version ' + com.newgrounds.API.version); } com.newgrounds.API.sendWarning('\tThe most current version is ' + e.movie_version); com.newgrounds.API.callListener(com.newgrounds.APIEvent.NEW_VERSION_AVAILABLE, true, {'movie_version': e.movie_version, 'movie_url': unescape(e.movie_url), 'redirect_url': com.newgrounds.API.getOfficialVersionURL()}); } } if (e.request_portal_url) { com.newgrounds.API.sendCommand('setPortalID', {'portal_url': _url}); } if (com.newgrounds.API.preload) { com.newgrounds.API.reportNewAsset(); var v8 = {}; if (com.newgrounds.API.hasUserSession()) { v8.publisher_id = com.newgrounds.API.publisher_id; v8.user_id = com.newgrounds.API.user_id; } com.newgrounds.API.sendCommand('preloadSettings', v8); } com.newgrounds.API.reportAssetLoaded(); break; case 'preloadSettings': if (e.medals) { com.newgrounds.API.populateMedals(e.medals); if (!com.newgrounds.API.hasUserSession() and !com.newgrounds.API.debug) { com.newgrounds.API.echo('checking for sharedobject medals...'); var v3 = com.newgrounds.API.loadLocal('medals_unlocked'); if (v3) { for (var v5 in v3) { v5 = Number(v5); if (v3[v5]) { var v2 = com.newgrounds.API.getMedal(v5); com.newgrounds.API.echo('now unlocking ' + v2.getName()); v2.setUnlocked(true); } } } } } if (e.save_groups) { com.newgrounds.API.populateSaveGroups(e.save_groups, e.save_file_path); } if (e.score_boards) { com.newgrounds.API.populateScoreBoards(e.score_boards); } com.newgrounds.API.reportAssetLoaded(); break; case 'logCustomEvent': if (e.success) { com.newgrounds.API.sendMessage('Event \'' + e.event + '\' was logged.'); } com.newgrounds.API.callListener(com.newgrounds.APIEvent.EVENT_LOGGED, e.success, {'event': e.event}); break; case 'postScore': var v9; if (e.success) { var v4 = 'User'; if (com.newgrounds.API.user_email) { v4 = com.newgrounds.API.user_email; } else { if (com.newgrounds.API.user_name) { v4 = com.newgrounds.API.user_name; } } var v6 = com.newgrounds.API.getScoreBoard(e.board); com.newgrounds.API.sendMessage(v4 + ' posted ' + e.value + ' to \'' + v6.name + '\''); v9 = {'board': v6, 'value': e.value, 'username': v4}; } com.newgrounds.API.callListener(com.newgrounds.APIEvent.SCORE_POSTED, e.success, v9); break; case 'loadScores': var v9 = new Object(); var v6 = com.newgrounds.API.getScoreBoard(e.board); if (v6.exists()) { v6.setScores(e.scores, e.period, e.page, e.num_results); } com.newgrounds.API.callListener(com.newgrounds.APIEvent.SCORES_LOADED, e.success, v6); break; case 'unlockMedal': var v21 = com.newgrounds.API.getMedal(e.medal_name); v21.setUnlocked(true); com.newgrounds.API.sendMessage('Successfuly unlocked \'' + v21.getName() + '\''); com.newgrounds.API.callListener(com.newgrounds.APIEvent.MEDAL_UNLOCKED, e.success, {'medal': v21}); break; case 'getMedals': com.newgrounds.API.populateMedals(e.medals); com.newgrounds.API.callListener(com.newgrounds.APIEvent.MEDALS_LOADED, e.success, {'medals': com.newgrounds.API.medals}); break; case 'lookupSaveFiles': var v12 = (com.newgrounds.API.getSaveGroup(e.group_id)).getQuery(); v12.onExecuted(e.files); com.newgrounds.API.in_save_query = false; break; case 'getFiles': break; case 'getSystemFiles': break; case 'rateSaveFile': var v16 = com.newgrounds.API.getSaveGroup(e.group_id); var v10 = v16.getFile(e.save_id); v10.onVoted(e); break; case 'saveFile': if (com.newgrounds.API.save_file) { if (!com.newgrounds.API.save_file.exists()) { com.newgrounds.API.save_file.setID(e.save_id, true); } com.newgrounds.API.save_file.onSaved(); } com.newgrounds.API.save_file = null; var v9 = {'save_id': e.save_id, 'group_id': e.group_id, 'filename': e.filename, 'file_url': e.file_url, 'thumbnail_url': e.thumbnail, 'icon_url': e.icon}; com.newgrounds.API.callListener(com.newgrounds.APIEvent.FILE_SAVED, e.success, v9); break; case 'checkFilePrivs': if (com.newgrounds.API.save_file) { com.newgrounds.API.save_file.checkPrivs(e); } else { var v9 = {'filename': e.filename, 'group': e.group, 'exists': e.exists, 'can_write': e.can_write}; if (e.duplicate_id) { v9.duplicate_id = e.duplicate_id; } com.newgrounds.API.callListener(com.newgrounds.APIEvent.FILE_PRIVS_LOADED, e.success, v9); } } }; v1.setDefaultListeners = function () { var v1 = new Array(); v1[com.newgrounds.APIEvent.HOST_BLOCKED] = {'listener': com.newgrounds.API.doBlockHost, 'is_default_listener': true}; v1[com.newgrounds.APIEvent.NEW_VERSION_AVAILABLE] = {'listener': com.newgrounds.API.onNewVersionAvailable, 'is_default_listener': true}; return v1; }; v1.addDefaultEventListener = function (event, listener, params) { if (!com.newgrounds.API.listeners[event] or com.newgrounds.API.listeners[event].is_default_listener == true) { com.newgrounds.API.echo('adding default event ' + event); com.newgrounds.API.listeners[event] = {'listener': listener, 'params': params, 'is_default_listener': true}; } }; v1.addEventListener = function (event, listener, params) { com.newgrounds.API.echo('adding event ' + event); com.newgrounds.API.listeners[event] = {'listener': listener, 'params': params}; }; v1.removeEventListener = function (event) { delete com.newgrounds.API.listeners[event]; }; v1.callListener = function (event, success, data, target) { com.newgrounds.API.echo('Fired Event: ' + event); if (com.newgrounds.API.listeners[event]) { if (data.isError()) { com.newgrounds.API.listeners[event].listener({'event': event, 'success': success, 'error': data, 'target': target}, com.newgrounds.API.listeners[event].params); } else { com.newgrounds.API.listeners[event].listener({'event': event, 'success': success, 'data': data, 'target': target}, com.newgrounds.API.listeners[event].params); } } if (event == com.newgrounds.APIEvent.MOVIE_CONNECTED && !success) { com.newgrounds.API.connected = false; } }; v1.getCommandName = function (id) { return id; }; v1.getCommandID = function (name) { return name; }; v1.sendError = function (c, e) { if (com.newgrounds.API.getCommandName(c.command_id) !== 'connectMovie') { } else { clearInterval(com.newgrounds.API.timeout); com.newgrounds.API.callListener(com.newgrounds.APIEvent.MOVIE_CONNECTED, false, e); } trace('[Newgrounds API ERROR] :: ' + com.newgrounds.API.getCommandName(c.command_id) + '() - ' + e.name + ':' + '\n' + '\t\t\t\t' + e.message); }; v1.sendWarning = function (m, c) { if (c) { m += '\r[Newgrounds API WARNING] :: \tSee ' + com.newgrounds.API.COMMANDS_WIKI_URL + c.toLowerCase() + ' for additional information.'; } trace('[Newgrounds API WARNING] :: ' + m); }; v1.sendNotice = function (m, c) { if (c) { m += '\r[Newgrounds API NOTICE] :: \tSee ' + com.newgrounds.API.COMMANDS_WIKI_URL + c.toLowerCase() + ' for additional information.'; } trace('[Newgrounds API NOTICE] :: ' + m); }; v1.fatalError = function (m, c) { if (c) { m += '\r\tSee ' + com.newgrounds.API.COMMANDS_WIKI_URL + c.toLowerCase() + ' for additional information.'; } throw '***ERROR*** frame=' + _root._currentframe + ', class=API' + '\n' + '\n' + m; }; v1.sendSecureCommand = function (command, secure_params, unsecure_params, files) { if (!com.newgrounds.API.debug && !com.newgrounds.API.hasUserSession() && !com.newgrounds.API.hasUserEmail()) { com.newgrounds.API.sendError({'command_id': com.newgrounds.API.getCommandID(command)}, new com.newgrounds.APIError('IDENTIFICATION_REQUIRED', 'You must be logged in, or provide an e-mail address using \'API.setUserEmail("name@domain.com");\' to use ' + command + '().')); return undefined; } if (!command) { com.newgrounds.API.fatalError('Missing command', 'sendSecureCommand'); } if (!secure_params) { com.newgrounds.API.fatalError('Missing secure_params', 'sendSecureCommand'); } if (!unsecure_params) { unsecure_params = new Object(); } var v2 = ''; var v1 = 0; while (v1 < 16) { v2 += com.newgrounds.API.compression_radix.charAt(Math.floor(Math.random() * com.newgrounds.API.compression_radix.length)); ++v1; } if (com.newgrounds.API.debug && !com.newgrounds.API.fake_session) { secure_params.session_id = ''; } else { secure_params.session_id = com.newgrounds.API.session_id; } secure_params.as_version = 2; secure_params.user_email = com.newgrounds.API.user_email; secure_params.publisher_id = com.newgrounds.API.publisher_id; secure_params.seed = v2; secure_params.command_id = com.newgrounds.API.getCommandID(command); var v8 = com.newgrounds.encoders.MD5.calculate(v2); var v6 = com.newgrounds.encoders.RC4.encrypt(com.newgrounds.encoders.JSON.encode(secure_params), com.newgrounds.API.encryption_key); var v7 = v8 + v6; unsecure_params.secure = com.newgrounds.API.compressHex(v7); com.newgrounds.API.sendCommand('securePacket', unsecure_params, false, files); }; v1.sendCommand = function (command, params, open_browser, files) { if (!com.newgrounds.API.connected and command != 'connectMovie') { var v12 = 'API.' + command + '() - API.connectMovie() must be called before this command can be called' + '\n'; com.newgrounds.API.fatalError(v12, 'connectMovie'); } if (open_browser) { var v2 = new Object(); } else { var v2 = new LoadVars(); } v2.command_id = com.newgrounds.API.getCommandID(command); v2.tracker_id = com.newgrounds.API.movie_id; if (com.newgrounds.API.debug) { v2.debug = com.newgrounds.API.debug; } if (params) { for (var v9 in params) { v2[v9] = params[v9]; } } if (files) { for (v9 in files) { v2[v9] = files[v9]; } } if (open_browser) { var v7 = com.newgrounds.API.GATEWAY_URL + '?seed=' + Math.random(); for (v9 in v2) { v7 += '&' + escape(v9) + '=' + escape(v2[v9]); } getURL(v7, '_blank'); v2.removeMovieClip(); } else { var v10 = new LoadVars(); v10.remember_command_id = v2.command_id; v10.onData = function (data) { com.newgrounds.API.echo('INPUT: \r' + data + '\n'); if (data) { var v2 = com.newgrounds.encoders.JSON.decode(data); } else { var v2 = {'success': false}; } if (!v2.success) { if (!v2.error_code && !v2.error_msg) { v2.error_code = 'CONNECTION_FAILED'; v2.error_msg = 'Could not contact the API Gateway'; v2.command_id = this.remember_command_id; } var v4 = new com.newgrounds.APIError(v2.error_code, v2.error_msg); com.newgrounds.API.sendError(v2, v4); } else { com.newgrounds.API.doEvent(v2); } }; var v6 = new Array(); for (var v8 in v2) { v6.push(v8 + '=' + escape(v2[v8])); } com.newgrounds.API.echo('POST ' + com.newgrounds.API.GATEWAY_URL + '?' + v6.join('&')); v2.sendAndLoad(com.newgrounds.API.GATEWAY_URL + '?seed=' + Math.random(), v10, 'POST'); com.newgrounds.API.last_command = v2.command_id; } }; v1.renderAd = function (target) { if (com.newgrounds.API.ad_swf_url) { target.background = target.createEmptyMovieClip('background', 100); target.background.beginFill(0); target.background.moveTo(0, 0); target.background.lineTo(300, 0); target.background.lineTo(300, 250); target.background.lineTo(0, 250); target.background.lineTo(0, 0); target.background.endFill(); target.mask = target.createEmptyMovieClip('mask', 101); target.mask.beginFill(0); target.mask.moveTo(0, 0); target.mask.lineTo(300, 0); target.mask.lineTo(300, 250); target.mask.lineTo(0, 250); target.mask.lineTo(0, 0); target.mask.endFill(); target.clip = target.createEmptyMovieClip('clip', 102); target.clip.ad = target.clip.createEmptyMovieClip('ad', 100); target.clip.setMask(target.mask); loadMovie(com.newgrounds.API.ad_swf_url, target.clip.ad); com.newgrounds.API.callListener(com.newgrounds.APIEvent.AD_ATTACHED, true, null, target); } else { com.newgrounds.API.callListener(com.newgrounds.APIEvent.AD_ATTACHED, false, new com.newgrounds.APIError('FLASH_ADS_NOT_APPROVED', 'Unable to render ad')); } }; v1.attachFlashAd = function (target) { System.security.allowDomain('http://server.cpmstar.com'); System.security.allowDomain('http://www.cpmstar.com'); System.security.allowDomain('https://server.cpmstar.com'); System.security.allowDomain('https://www.cpmstar.com'); System.security.allowInsecureDomain('http://server.cpmstar.com'); System.security.allowInsecureDomain('http://www.cpmstar.com'); System.security.allowInsecureDomain('https://server.cpmstar.com'); System.security.allowInsecureDomain('https://www.cpmstar.com'); if (com.newgrounds.API.checkAdFlood()) { com.newgrounds.API.ad_swf_url = null; } else { if (com.newgrounds.API.checkAdCache()) { com.newgrounds.API.reportNewAsset(); var v1 = new LoadVars(); v1.onData = function (data) { if (data) { com.newgrounds.API.ad_swf_url = data; } else { com.newgrounds.API.ad_swf_url = null; } com.newgrounds.API.reportAssetLoaded(); com.newgrounds.API.renderAd(target); }; if (com.newgrounds.API.ad_url.indexOf('?') > -1) { v1.load(com.newgrounds.API.ad_url + '&random=' + Math.random()); } else { v1.load(com.newgrounds.API.ad_url + '?random=' + Math.random()); } if (!com.newgrounds.API.ad_warning) { com.newgrounds.API.ad_warning = true; com.newgrounds.API.sendMessage('You may get a security sandbox violation from this ad. This is nothing to worry about!'); } } else { if (com.newgrounds.API.ad_swf_url) { com.newgrounds.API.renderAd(target); } } } }; v1.checkAdFlood = function () { if (!com.newgrounds.API.ad_url) { return false; } var v2 = new Date(); var v1 = v2.getTime(); if (v1 >= com.newgrounds.API.ad_flood) { if (v1 - com.newgrounds.API.ad_flood > 1000) { com.newgrounds.API.ad_flood = v1 + 1000; return false; } com.newgrounds.API.ad_flood = v1; com.newgrounds.API.sendWarning('This movie is attempting to load multiple ads at too high of a frequency; you may have a bad preloader loop.'); return true; } return false; }; v1.checkAdCache = function () { if (!com.newgrounds.API.ad_url) { return false; } var v2 = new Date(); var v1 = v2.getTime(); if (v1 >= com.newgrounds.API.ad_url_cache) { com.newgrounds.API.ad_url_cache = v1 + 300000; return true; } return false; }; v1.sendMessage = function (m, r) { var v1 = '[Newgrounds API] :: ' + m; if (r) { return v1; } else { trace(v1); } }; v1.echo = function (m) { if (com.newgrounds.API.do_echo) { trace(m); } }; v1.do_echo = false; v1.GATEWAY_URL = 'http://www.ngads.com/gateway_v2.php'; v1.AD_TERMS_URL = 'http://www.newgrounds.com/wiki/flashads/terms/'; v1.COMMANDS_WIKI_URL = 'http://www.newgrounds.com/wiki/flashapi/commands/'; v1.LOCAL_HOST = 'localhost'; v1.PREVIEW_HOSTS = new Array(com.newgrounds.API.LOCAL_HOST); v1.ad_url_cache = 0; v1.ad_flood = 0; v1.ad_warning = false; v1.in_save_query = null; v1.save_file = null; v1.publisher_id = 1; v1.fake_session = false; v1.medals = null; v1.scoreboards = new Array(); v1.save_groups = null; v1.compression_radix = '/g8236klvBQ#&|;Zb*7CEA59%s`Oue1wziFp$rDVY@TKxUPWytSaGHJ>dmoMR^<0~4qNLhc(I+fjn)X'; v1.errors = com.newgrounds.APIError.init_codes(); v1.sharedObjects = new Object(); v1.preload = false; v1.preload_items = 0; v1.preload_items_loaded = 0; v1.listeners = com.newgrounds.API.setDefaultListeners(); ASSetPropFlags(com.newgrounds.API.prototype, null, 1); } #endinitclip } movieClip 45 __Packages.com.newgrounds.SaveFile { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.SaveFile) { var v1 = function (group) { this.group = group; this.filename = null; this.file_id = null; this.contents = null; this.thumbnail = null; this.thumbnail_url = null; this.raw = null; this.callbacks = new Object(); this.img = null; this.share = false; this.keys = new Array(); this.ratings = new Array(); this.file_url = null; }; com.newgrounds.SaveFile = v1; var v2 = v1.prototype; v1.setFilePath = function (path) { com.newgrounds.SaveFile.file_path = path + '/'; }; v2.getID = function () { return this.file_id; }; v2.exists = function () { return this.file_id !== null; }; v2.getGroup = function () { return this.group; }; v2.getName = function () { return this.filename; }; v2.isPrivate = function () { return this.status == com.newgrounds.SaveFile.STATUS.PRIVATE; }; v2.isShared = function () { return this.status > com.newgrounds.SaveFile.STATUS.PRIVATE; }; v2.isApproved = function () { return this.status > com.newgrounds.SaveFile.STATUS.UNAPPROVED; }; v2.isPublic = function () { if (this.isPrivate()) { return false; return false; } if (this.group.isType('SYSTEM') or this.group.isType('PRIVATE')) { return false; return false; } if (this.group.isType('PUBLIC')) { return true; return false; } if (this.isApproved()) { return true; } return false; }; v2.isLocked = function () { return this.locked; }; v2.getDescription = function () { return this.description; }; v2.getShared = function () { return this.share; }; v2.getThumbnailImageScan = function () { return this.img; }; v2.getThumbnailURL = function () { return com.newgrounds.SaveFile.file_path + this.thumbnail_url; }; v2.getRawContents = function () { return this.raw; }; v2.getDuplicateID = function () { return this.duplicate_id; }; v2.getKeys = function () { return this.keys; }; v2.getKey = function (key) { var v3 = (this.getGroup()).getKey(key); var v2 = 0; while (v2 < this.keys.length) { if (this.keys[v2].id == v3.key_id) { return this.keys[v2].value; } ++v2; } }; v2.getRating = function (rating) { var v2 = (this.getGroup()).getRating(rating); if (this.ratings[v2.rating_id]) { return this.ratings[v2.rating_id]; } else { return null; } }; v2.overwriteAllowed = function () { return this.overwrite; }; v2.getFileURL = function () { return com.newgrounds.SaveFile.file_path + this.file_url; }; v2.overwriteExisting = function () { this.overwrite = true; }; v2.setID = function (id, add_to_group) { this.file_id = id; if (add_to_group) { (this.getGroup()).addFile(this); } }; v2.setName = function (filename, locked) { this.filename = filename; this.locked = locked; }; v2.setDescription = function (description) { this.description = description; }; v2.setShared = function (share) { this.share = share; }; v2.setContents = function (contents) { this.contents = contents; }; v2.setThumbnail = function (thumb) { if (thumb) { this.thumbnail = thumb; } else { this.thumbnail = null; } }; v2.setThumbnailURL = function (url) { this.thumbnail_url = url; }; v2.setFileURL = function (url) { this.file_url = url; }; v2.setPermissions = function (status, locked) { this.locked = locked; this.status = status; }; v2.setKey = function (key, val) { var v4 = this.group.getKeyID(key); var v2; if (!v4) { this.onError('\'' + key + '\' is not a valid key for the \'' + this.group.getKeyType(key, true) + '\' save group', 'setKey', 'INVALID_VALUE', true); return undefined; } if (!this.group.keyValueIsValid(key, val) && val !== null) { this.onError('\'' + val + '\' is not a valid ' + this.group.getKeyType(key, true), 'setKey', 'INVALID_VALUE', true); return undefined; } switch (this.group.getKeyType(key, true)) { case 'string': if (val) { val = String(val); } else { val = undefined; } break; default: val = Number(val); } var v5 = {'id': v4, 'value': val}; for (var v7 in this.keys) { v2 = this.keys[v7]; if (v2.id == v4) { this.keys[v7] = v5; return undefined; } } this.keys.push(v5); }; v2.setRating = function (rating, votes, score) { var v2 = (this.getGroup()).getRating(rating); if (!votes) { votes = 0; } if (!score) { score = 0; } if (!v2.is_float) { score = Math.round(Number(score)); } this.ratings[v2.rating_id] = {'id': Number(v2.rating_id), 'name': v2.rating_name, 'votes': Number(votes), 'score': Number(score)}; return this.ratings[v2.rating_id]; }; v2.clearBuffer = function () { this.contents = null; this.raw = null; this.img = null; this.scanner = null; this.overwrite = false; this.duplicate_id = null; }; v2.onError = function (msg, funct, code, skip_callback) { com.newgrounds.SaveFile.busy = false; if (!code) { code = 'SAVE_FILE_ERROR'; } if (!funct) { funct = 'unknown_function'; } var v3 = 'getSaveGroup(\'' + this.group.getName() + '\')'; if (this.exists()) { funct = v3 + '.getFile(\'' + this.getName() + '\').' + funct; } else { funct = v3 + '.getNewFile().' + funct; } var v4 = new com.newgrounds.APIError(code, msg); com.newgrounds.API.sendError({'command_id': funct}, v4); if (!skip_callback and this.callbacks[com.newgrounds.SaveFile.EVENT.ERROR]) { this.callbacks[com.newgrounds.SaveFile.EVENT.ERROR](this, v4); } }; v2.onSaved = function (p) { com.newgrounds.SaveFile.busy = false; if (!this.exists()) { this.setID(p.save_id, true); } this.setName(p.filename); this.setFileURL(p.file_url); if (p.thumbnail_url) { this.setThumbnailURL(p.thumbnail_url); } if (this.callbacks[com.newgrounds.SaveFile.EVENT.SAVED]) { this.callbacks[com.newgrounds.SaveFile.EVENT.SAVED](this); } }; v2.onVoted = function (p) { if (p.already_voted) { var v4 = false; var v3 = {'message': 'You have already voted on this today'}; } else { if (!p.success) { var v4 = false; var v3 = {'message': p.message}; } else { var v4 = true; var v5 = this.setRating(p.rating_id, p.votes, p.score); var v3 = v5; } } v3.file = this; if (this.callbacks[com.newgrounds.SaveFile.EVENT.VOTED]) { this.callbacks[com.newgrounds.SaveFile.EVENT.VOTED](v4, v3); } }; v2.sendRating = function (rating, vote, callback) { if (!com.newgrounds.API.hasUserSession()) { this.onVoted({'success': false, 'message': 'You must be logged in to vote on save files'}); return undefined; } var v2 = this.group.getRating(rating); if (!v2) { this.onVoted({'success': false, 'message': '\'' + rating + '\' is not a valid rating for the \'' + this.group.getName() + '\' save group'}); return undefined; } if (v2.voted === true) { this.onVoted({'success': false, 'message': 'You already cast a vote for \'' + rating + '\''}); return undefined; } if (vote < v2.min_value or vote > v2.max_value) { this.onVoted({'success': false, 'message': '\'' + rating + '\' votes must be between ' + v2.min_value + ' and ' + v2.max_value}); return undefined; } if (callback) { this.callbacks[com.newgrounds.SaveFile.EVENT.VOTED] = callback; } v2.voted = true; com.newgrounds.API.rateSaveFile(this, v2, vote); }; v2.replace = function (response_handler, error_handler) { if (com.newgrounds.SaveFile.busy) { this.onError('Another file is currently being saved, please try again later', 'replace'); return undefined; } this.overwriteExisting(); this.save(response_handler, error_handler); }; v2.save = function (response_handler, error_handler) { if (com.newgrounds.SaveFile.busy) { this.onError('Another file is currently being saved, please try again later', 'save', 'UPLOAD_IN_PROGRESS'); return undefined; } com.newgrounds.SaveFile.busy = true; this.callbacks[com.newgrounds.SaveFile.EVENT.SAVED] = response_handler; this.callbacks[com.newgrounds.SaveFile.EVENT.ERROR] = error_handler; if (this.isLocked()) { this.onError('This file is locked and cannot be overwritten.', 'save', 'PERMISSION_DENIED'); return undefined; } if (!this.filename) { this.onError('Please provide a name for your file.', 'save', 'MISSING_PARAM'); return undefined; } else { if (!this.contents) { this.onError('The file is empty.', 'save', 'MISSING_PARAM'); return undefined; } } this.img = null; com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.FILE_PRIVS_LOADED, function (e, d) { var v1 = e.data; v1.success = e.success; d.file.checkPrivs(v1); }, {'file': this}); this.callbacks[com.newgrounds.SaveFile.EVENT.PROGRESS] = function () { return {'task': 'checking permissions', 'progress': null}; }; com.newgrounds.API.checkFilePrivs(this); }; v2.checkPrivs = function (p) { if (p.success) { if (p.can_write) { this.can_write = p.can_write; if (p.duplicate_id) { trace('This file is a duplicate of file_id ' + p.duplicate_id); this.duplicate_id = p.duplicate_id; } if (p.exists && !this.overwriteAllowed()) { this.onError('You already have a file named \'' + this.getName() + '\'', 'save', 'CONFIRM_REQUEST'); } else { this.startFile(); } } else { this.onError('This file is locked and cannot be overwritten', 'save', 'PERMISSION_DENIED'); } } else { this.onError('There was a problem looking up your file\'s details. The server may be down.', 'save', 'UNKNOWN_ERROR'); } }; v2.startFile = function () { if (this.can_write) { this.callbacks[com.newgrounds.SaveFile.EVENT.PROGRESS] = function () { return {'task': 'encoding data', 'progress': null}; }; if (this.thumbnail) { this.scanner = new com.newgrounds.encoders.ImageScanner(this.thumbnail); this.scanner.setCallback(this, 'encodeFile'); this.scanner.startScan(100, 100, true); } else { this.encodeFile(); } } else { this.onError('You do not have permission to save this file.', 'save', 'PERMISSION_DENIED'); } }; v2.encodeFile = function (img) { this.img = img; this.raw = (com.newgrounds.encoders.SerialXML.encode(this.contents)).toString(); this.compressFile(); }; v2.compressFile = function () { this.callbacks[com.newgrounds.SaveFile.EVENT.PROGRESS] = function () { return {'task': 'compressing data', 'progress': com.newgrounds.encoders.LZW2.getProgress()}; }; com.newgrounds.encoders.LZW2.compress(this.raw, function (s, p) { p.file.onCompressed(s); }, {'file': this}); }; v2.onCompressed = function (compressed) { this.raw = escape(compressed); this.callbacks[com.newgrounds.SaveFile.EVENT.PROGRESS] = function () { return {'task': 'saving file', 'progress': null}; }; this.writeFile(); }; v2.getProgress = function () { if (this.scanner != null && this.scanner.getProgress() < 100 && this.scanner.getProgress() !== null) { return {'task': 'generating thumbnail', 'progress': this.scanner.getProgress()}; } else { if (this.callbacks[com.newgrounds.SaveFile.EVENT.PROGRESS]) { return this.callbacks[com.newgrounds.SaveFile.EVENT.PROGRESS](); } else { return {'task': 'idle', 'progress': null}; } } }; v2.writeFile = function () { com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.FILE_SAVED, function (e, d) { var v1 = e.data; v1.success = e.success; d.file.onSaved(v1); }, {'file': this}); ((this.getGroup()).getQuery()).clearCache(); com.newgrounds.API.saveFile(this); this.clearBuffer(); }; v2.getContents = function (callback) { if (this.contents) { callback(this, this.contents); return undefined; } if (!this.getFileURL()) { trace('Error: Attempted to load contents of an unsaved file'); callback(null, null); return undefined; } this.callbacks[com.newgrounds.SaveFile.EVENT.LOADED] = callback; var v2 = new LoadVars(); v2.target = this; var target = this; v2.onData = function (encoded) { target.onLoaded(encoded); }; v2.load(this.getFileURL()); }; v2.onLoaded = function (encoded) { com.newgrounds.encoders.LZW.setXMLSafe(true); this.contents = com.newgrounds.encoders.SerialXML.decode(com.newgrounds.encoders.LZW.decompress(encoded)); if (this.callbacks[com.newgrounds.SaveFile.EVENT.LOADED]) { this.callbacks[com.newgrounds.SaveFile.EVENT.LOADED](this, this.contents); } }; v1.busy = false; v2.can_write = false; v2.share = false; v2.status = 0; v2.locked = false; v2.overwrite = false; v2.duplicate_id = null; v2.keys = null; v2.ratings = null; v1.EVENT = {'SAVED': 1, 'LOADED': 2, 'ERROR': 3, 'PROGRESS': 4, 'VOTED': 5}; v1.STATUS = {'PRIVATE': 1, 'PUBLIC': 2, 'UNAPPROVED': 3, 'APPROVED': 4}; ASSetPropFlags(com.newgrounds.SaveFile.prototype, null, 1); } #endinitclip } movieClip 46 __Packages.com.newgrounds.SaveGroup { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.SaveGroup) { var v1 = function (group_id, group_name, group_type) { this.group_name = group_name; this.group_id = group_id; this.group_type = group_type; this.query = new com.newgrounds.SaveGroupQuery(this); this.ratings = new Array(); this.keys = new Array(); this.files = new Array(); }; com.newgrounds.SaveGroup = v1; var v2 = v1.prototype; v2.addFile = function (file) { var v2 = 0; while (v2 < this.files.length) { if (this.files[v2].getID() == file.getID()) { this.files[v2] = file; return undefined; } ++v2; } this.files.push(file); }; v2.getFile = function (file_id) { var v2 = 0; while (v2 < this.files.length) { if (com.newgrounds.SaveGroup.isNumeric(file_id) and this.files[v2].getID() == Number(file_id)) { return this.files[v2]; } else { if (this.files[v2].getName() == file_id) { return this.files[v2]; } } ++v2; } return null; }; v2.addRating = function (rating_id, rating_name, min_value, max_value, is_float) { var v3 = {'rating_id': rating_id, 'rating_name': rating_name, 'min_value': min_value, 'max_value': max_value, 'is_float': is_float}; if (!this.getRatingID(rating_name)) { this.ratings.push(v3); } }; v2.getRating = function (rating_id) { var v2 = 0; while (v2 < this.ratings.length) { if (com.newgrounds.SaveGroup.isNumeric(rating_id) and this.ratings[v2].rating_id == rating_id) { return this.ratings[v2]; } else { if (this.ratings[v2].rating_name == rating_id) { return this.ratings[v2]; } } ++v2; } return null; }; v2.getRatingID = function (rating_id) { var v2 = this.getRating(rating_id); if (v2) { return v2.rating_id; } return null; }; v2.getRatingName = function (rating_id) { var v2 = this.getRating(rating_id); if (v2) { return v2.rating_name; } return null; }; v2.addKey = function (key_id, key_name, key_type) { var v2 = {'key_id': key_id, 'key_name': key_name, 'key_type': key_type}; if (!this.getKey(key_name)) { this.keys.push(v2); } }; v2.getKey = function (key_id) { var v2 = 0; while (v2 < this.keys.length) { if (com.newgrounds.SaveGroup.isNumeric(key_id) and this.keys[v2].key_id == key_id) { return this.keys[v2]; } else { if (this.keys[v2].key_name == key_id) { return this.keys[v2]; } } ++v2; } return null; }; v2.getKeyType = function (key_name, as_string) { var v2 = this.getKey(key_name); if (v2) { return as_string ? com.newgrounds.SaveGroup.KEY_TYPES[v2.key_type] : v2.key_type; } return null; }; v2.getKeyID = function (key_id) { var v2 = this.getKey(key_id); if (v2) { return v2.key_id; } return null; }; v2.getKeyName = function (key_id) { var v2 = this.getKey(key_id); if (v2) { return v2.key_name; } return null; }; v2.keyValueIsValid = function (key, value) { var v4; var v7; if (typeof value == 'number' or (Number(value)).toString() == String(value)) { value = Number(value); v4 = (Math.round(value) === value) ? 'integer' : 'float'; } else { v4 = typeof value; if (v4 == 'string') { var v6 = '01234567890.-'; var v5 = true; var v2 = 0; while (v2 < value.length) { if (v6.indexOf(value.charAt(v2)) < 0) { v5 = false; break; } ++v2; } if (v5) { value = Number(value); v4 = 'float'; } } } switch (this.getKeyType(key, true)) { case 'integer': v7 = v4 == 'integer' or v4 == 'boolean'; return v7; case 'float': v7 = v4 == 'float' or v4 == 'integer' or v4 == 'boolean'; return v7; case 'string': v7 = v4 == 'string' or v4 == 'float' or v4 == 'integer' or v4 == 'boolean'; return v7; case 'boolean': v7 = v4 == 'boolean' or value == 1 or value == 0 or value == ''; return v7; } v7 = false; return v7; }; v2.isType = function (type) { return this.group_type == com.newgrounds.SaveGroup.TYPES[type.toUpperCase()]; }; v2.getID = function () { return this.group_id; }; v2.getName = function () { return this.group_name; }; v2.getType = function () { return this.group_type; }; v2.isSystem = function () { return undefined; }; v2.getQuery = function (as_object) { if (as_object) { return this.query.toObject(); } return this.query; }; v2.newQuery = function () { this.query.reset(); return this.query; }; v2.clearQuery = function () { this.query.reset(); }; v2.newFile = function () { var v2 = new com.newgrounds.SaveFile(this); return v2; }; v1.isNumeric = function (value) { return typeof value == 'number' or (Number(value)).toString() == String(value); }; v1.KEY_TYPES = [null, 'float', 'integer', 'string', 'boolean']; v1.TYPES = {'SYSTEM': 0, 'PRIVATE': 1, 'PUBLIC': 2, 'MODERATED': 3}; ASSetPropFlags(com.newgrounds.SaveGroup.prototype, null, 1); } #endinitclip } movieClip 48 __Packages.com.newgrounds.SaveGroupQuery { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.SaveGroupQuery) { var v1 = function (group) { this.group = group; this.reset(); }; com.newgrounds.SaveGroupQuery = v1; var v2 = v1.prototype; v2.clearCache = function () { this.result = null; }; v2.reset = function () { this.file_conditions = new Array(); this.key_conditions = new Array(); this.rating_conditions = new Array(); this.sort_conditions = new Array(); this.lookup_keys = new Object(); this.lookup_ratings = new Object(); this.num_results = 20; this.page = 1; this.randomize_results = false; this.group_by = new Array(); this.clearCache(); }; v2.getGroup = function () { return this.group; }; v2.getGroupID = function () { return this.group.getID(); }; v2.isRandomized = function () { return this.randomize_results; }; v2.toObject = function () { var v2; var v11 = {'page': this.page, 'num_results': this.num_results}; if (this.randomize_results) { v11.randomize = 1; } if (!com.newgrounds.ValidationTools.isEmpty(this.file_conditions)) { var v12 = []; v2 = 0; while (v2 < this.file_conditions.length) { var v6 = this.file_conditions[v2]; v12.push({'field': com.newgrounds.SaveGroupQuery.file_fields[v6.field.toUpperCase()].id, 'operator': v6.operator, 'value': v6.value}); ++v2; } v11.file_conditions = v12; } if (!com.newgrounds.ValidationTools.isEmpty(this.key_conditions)) { v11.key_conditions = this.key_conditions; } if (!com.newgrounds.ValidationTools.isEmpty(this.rating_conditions)) { v11.rating_conditions = this.rating_conditions; } if (!com.newgrounds.ValidationTools.isEmpty(this.sort_conditions)) { var v14 = []; v2 = 0; while (v2 < this.sort_conditions.length) { var v3 = this.sort_conditions[v2]; if (v3.table == com.newgrounds.SaveGroupQuery.TABLE_FILES) { var v8 = com.newgrounds.SaveGroupQuery.file_fields[v3.field.toUpperCase()].id; } else { var v8 = v3.field; } var v5 = {'field': v8, 'table': v3.table}; if (v3.desc) { v5.desc = 1; } if (v3.extra) { v5.extra = v3.extra; } v14.push(v5); ++v2; } v11.sort_conditions = v14; } if (!com.newgrounds.ValidationTools.isEmpty(this.lookup_keys)) { var v15 = []; for (v2 in this.lookup_keys) { v15.push(v2); } v11.lookup_keys = v15; } if (!com.newgrounds.ValidationTools.isEmpty(this.lookup_ratings)) { var v13 = []; for (v2 in this.lookup_ratings) { v13.push(v2); } v11.lookup_ratings = v13; } if (!com.newgrounds.ValidationTools.isEmpty(this.group_by)) { var v16 = []; v2 = 0; while (v2 < this.group_by.length) { var v4 = this.group_by[v2]; if (v4.table == com.newgrounds.SaveGroupQuery.TABLE_FILES) { v8 = com.newgrounds.SaveGroupQuery.file_fields[v4.field.toUpperCase()].id; } else { v8 = v4.field; } v16.push({'field': v8, 'table': v4.table}); ++v2; } v11.group_by = v16; } return v11; }; v2.toString = function () { var v9; var v2; var v11 = []; v9 = 'Lookup:\r'; var v13 = []; for (var v6 in com.newgrounds.SaveGroupQuery.file_fields) { v13.push(' ' + v6); v2 = true; } v9 += v13.join('\n'); v11.push(v9); v9 = ''; v2 = false; var v15 = []; for (v6 in this.lookup_keys) { v15.push(' KEY \'' + this.group.getKeyName(v6) + '\''); v2 = true; } if (v2) { v9 += v15.join('\n'); v11.push(v9); } v9 = ''; v2 = false; var v14 = []; for (v6 in this.lookup_ratings) { v14.push(' RATING \'' + this.group.getRatingName(v6) + '\''); v2 = true; } if (v2) { v9 += v14.join('\n'); v11.push(v9); } v9 = 'Where:\r'; v2 = false; var v8 = []; v6 = 0; while (v6 < this.file_conditions.length) { var v7 = this.file_conditions[v6]; var v10 = ' ' + v7.field + ' ' + v7.operator + ' ' + v7.value; v8.push(v10); v2 = true; ++v6; } v6 = 0; while (v6 < this.key_conditions.length) { v7 = this.key_conditions[v6]; v10 = ' KEY \'' + this.group.getKeyName(v7.key_id) + '\' ' + v7.operator + ' ' + v7.value; v8.push(v10); v2 = true; ++v6; } v6 = 0; while (v6 < this.rating_conditions.length) { v7 = this.rating_conditions[v6]; v10 = ' RATING \'' + this.group.getRatingName(v7.rating_id) + '\' ' + v7.operator + ' ' + v7.value; v8.push(v10); v2 = true; ++v6; } if (v2) { v9 += v8.join('\n'); v11.push(v9); } v9 = 'Group By:\r'; v2 = false; var v16 = []; v6 = 0; while (v6 < this.group_by.length) { var v4 = this.group_by[v6]; var v5; if (v4.table == com.newgrounds.SaveGroupQuery.TABLE_KEYS) { v5 = ' KEY \'' + this.group.getKeyName(v4.field) + '\''; } else { if (v4.table == com.newgrounds.SaveGroupQuery.TABLE_RATINGS) { v5 = ' RATING \'' + this.group.getRatingName(v4.field) + '\''; } else { v5 = ' ' + v4.field; } } v16.push(v5); v2 = true; ++v6; } if (v2) { v9 += v16.join('\n'); v11.push(v9); } v9 = 'Order By:\r'; v2 = false; var v12 = []; if (this.isRandomized()) { v12.push(' RANDOM'); v2 = true; } v6 = 0; while (v6 < this.sort_conditions.length) { var v3 = this.sort_conditions[v6]; if (v3.table == com.newgrounds.SaveGroupQuery.TABLE_KEYS) { v5 = ' KEY \'' + this.group.getKeyName(v3.field) + '\''; } else { if (v3.table == com.newgrounds.SaveGroupQuery.TABLE_RATINGS) { v5 = ' RATING \'' + this.group.getRatingName(v3.field) + '\' ' + ((v3.extra == 'votes') ? 'VOTES' : 'SCORE'); } else { v5 = ' ' + v3.field; } } v5 += v3.desc ? ' (DESCENDING)' : ''; v12.push(v5); v2 = true; ++v6; } if (v2) { v9 += v12.join('\n'); v11.push(v9); } v11.push('Page:\r ' + this.page); v11.push('Results Per Page:\r ' + this.num_results); return v11.join('\n'); }; v2.setResultsPerPage = function (r) { this.num_results = r; this.clearCache(); }; v2.setPage = function (p) { this.page = p; this.clearCache(); }; v2.randomize = function (bool) { this.randomize_results = true; }; v2.includeKey = function (key) { this.lookup_keys[this.group.getKeyID(key)] = 1; this.clearCache(); }; v2.includeRating = function (rating) { this.lookup_ratings[this.group.getRatingID(rating)] = 1; this.clearCache(); }; v2.groupBy = function (field) { this.addGroupItem(com.newgrounds.SaveGroupQuery.TABLE_FILES, field); }; v2.groupByKey = function (key) { if (!this.group.getKeyID(key)) { this.error('\'' + key + '\' is not a valid key for the \'' + this.group.getName() + '\' group'); return undefined; } this.addGroupItem(com.newgrounds.SaveGroupQuery.TABLE_KEYS, this.group.getKeyID(key)); }; v2.groupByRating = function (raring) { if (!this.group.getRatingID(raring)) { this.error('\'' + raring + '\' is not a valid rating for the \'' + this.group.getName() + '\' group'); return undefined; } this.addGroupItem(com.newgrounds.SaveGroupQuery.TABLE_RATINGS, this.group.getRatingID(raring)); }; v2.addGroupItem = function (table, field) { this.group_by.push({'table': table, 'field': field}); this.clearCache(); }; v2.excludeKey = function (key) { delete this.lookup_keys[this.group.getKeyID(key)]; this.clearCache(); }; v2.excludeRating = function (rating) { delete this.lookup_ratings[this.group.getRatingID(rating)]; this.clearCache(); }; v2.addCondition = function (field, operator, value) { if (field == 'FILE_STATUS' && typeof value == 'string' && com.newgrounds.SaveFile.STATUS[value.toUpperCase()] !== undefined) { value = com.newgrounds.SaveFile.STATUS[value.toUpperCase()]; } if (operator == '==') { operator = '='; } if (!this.validateOperator(operator) or !this.validateValue(field, value)) { return undefined; } this.file_conditions.push({'field': field, 'operator': operator, 'value': value}); this.clearCache(); }; v2.addKeyCondition = function (key, operator, value) { if (!this.group.getKeyID(key)) { this.error('\'' + key + '\' is not a valid key for the \'' + this.group.getName() + '\' save group'); } else { if (!this.validateOperator(operator) or !this.validateKeyValue(key, value)) { return undefined; } } this.key_conditions.push({'key_id': this.group.getKeyID(key), 'operator': operator, 'value': value}); this.clearCache(); }; v2.addRatingCondition = function (rating, operator, value, column) { if (!column) { column = 'SCORE'; } if (!this.group.getRatingID(rating)) { this.error('\'' + rating + '\' is not a valid rating for the \'' + this.group.getName() + '\' save group'); } else { if (!this.validateOperator(operator)) { return undefined; } else { if (!com.newgrounds.ValidationTools.isNumber(value)) { this.error('Expected numeric value for rating \'' + rating + '\''); return undefined; } } } if (!com.newgrounds.SaveGroupQuery.rating_columns[column]) { var v2 = []; for (var v3 in com.newgrounds.SaveGroupQuery.rating_columns) { v2.push(v3); } this.error('Invalid rating column \'' + column + '\'. Valid columns are ' + v2.join(', ')); return undefined; } this.rating_conditions.push({'rating_id': this.group.getRatingID(rating), 'operator': operator, 'value': value, 'column': com.newgrounds.SaveGroupQuery.rating_columns[column]}); this.clearCache(); }; v2.sortOn = function (field, order) { if (!com.newgrounds.SaveGroupQuery.file_fields[field]) { var v2 = []; for (var v3 in com.newgrounds.SaveGroupQuery.file_fields) { v2.push(v3); } this.error('\'' + field + '\' is not a valid sort field. Valid fields are: ' + v2.join(', ')); return undefined; } this.addSortCondition(com.newgrounds.SaveGroupQuery.TABLE_FILES, field, order); }; v2.sortOnKey = function (key, order) { if (!this.group.getKeyID(key)) { this.error('\'' + key + '\' is not a valid key for the \'' + this.group.getName() + '\' group'); return undefined; } this.addSortCondition(com.newgrounds.SaveGroupQuery.TABLE_KEYS, this.group.getKeyID(key), order); }; v2.sortOnRating = function (rating, order, column) { if (!this.group.getRatingID(rating)) { this.error('\'' + rating + '\' is not a valid rating for the \'' + this.group.getName() + '\' group'); return undefined; } if (!column) { column = 'score'; } this.addSortCondition(com.newgrounds.SaveGroupQuery.TABLE_RATINGS, this.group.getRatingID(rating), order, column); }; v2.sortOnRatingScore = function (rating, order) { this.sortOnRating(rating, order, 'score'); }; v2.sortOnRatingVotes = function (rating, order) { this.sortOnRating(rating, order, 'votes'); }; v2.addSortCondition = function (table, field, order, extra) { var v7; if (!order or order == '' or order.toUpperCase() == 'ASC') { v7 = false; } else { if (order.toUpperCase() == 'DESC') { v7 = true; } else { this.error('\'' + order + '\' is not a valid sort order!'); return undefined; } } var v3 = {'table': table, 'field': field, 'desc': v7}; if (extra) { v3.extra = extra; } this.sort_conditions.push(v3); this.clearCache(); }; v2.getResult = function () { return this.result; }; v2.onExecuted = function (results) { this.result = []; var v6 = 0; while (v6 < results.length) { var v2 = results[v6]; var v4 = new com.newgrounds.SaveFile(this.group); v4.setName(v2.filename); v4.setID(v2.save_id); v4.setDescription(v2.description); v4.setThumbnailURL(v2.thumb); v4.setFileURL(v2.file); v4.setPermissions(v2.status, v2.locked); var v5 = 0; while (v5 < v2.keys.length) { v4.setKey(v2.keys[v5].id, v2.keys[v5].value); ++v5; } var v3 = 0; while (v3 < v2.ratings.length) { v4.setRating(v2.ratings[v3].id, v2.ratings[v3].votes, v2.ratings[v3].score); ++v3; } this.result.push(v4); ++v6; } if (this.callback) { this.callback(this, this.result); } }; v2.onError = function (error) { if (this.error_handler) { this.error_handler(this, error); } }; v2.execute = function (cb, eh) { this.callback = cb; this.error_handler = eh; if (this.result !== null && !this.isRandomized()) { this.callback(this, this.result); return undefined; } com.newgrounds.API.lookupSaveFiles(this.group); }; v2.processResults = function (files) { return null; }; v2.validateKeyValue = function (key, value) { var v3 = this.group.getKeyType(key); if (v3) { var v2 = com.newgrounds.SaveGroup.KEY_TYPES[v3]; if (v2 == 'float' and com.newgrounds.ValidationTools.isFloat(value)) { return true; } else { if (v2 == 'integer' and com.newgrounds.ValidationTools.isInteger(value)) { return true; } else { if (v2 == 'string' and com.newgrounds.ValidationTools.isString(value)) { return true; } } } this.error('Expected type ' + v2 + ' for key \'' + key + '\''); } return false; }; v2.validateValue = function (field, value) { if (com.newgrounds.SaveGroupQuery.file_fields[field]) { if (com.newgrounds.SaveGroupQuery.file_fields[field].type == 'integer' and com.newgrounds.ValidationTools.isInteger(value)) { return true; } else { if (com.newgrounds.SaveGroupQuery.file_fields[field].type == 'float' and com.newgrounds.ValidationTools.isFloat(value)) { return true; } else { if (com.newgrounds.SaveGroupQuery.file_fields[field].type == 'string' and com.newgrounds.ValidationTools.isString(value)) { return true; } else { this.error('Expecting ' + com.newgrounds.SaveGroupQuery.file_fields[field].type + ' value on \'' + field + '\' condition'); } } } return false; } var v2 = []; for (var v4 in com.newgrounds.SaveGroupQuery.file_fields) { v2.push(v4); } this.error('\'' + field + '\' is not a searchable field. Valid fields are: ' + v2.join(', ')); return false; }; v2.validateOperator = function (operator) { var v2 = 0; while (v2 < com.newgrounds.SaveGroupQuery.valid_operators.length) { if (operator == com.newgrounds.SaveGroupQuery.valid_operators[v2]) { return true; } ++v2; } this.error('\'' + operator + '\' is not a valid lookup operation. Valid operations are: ' + com.newgrounds.SaveGroupQuery.valid_operators.join(', ')); return false; }; v2.error = function (msg) { trace('[QUERY ERROR] :: ' + msg); }; v1.TABLE_FILES = 1; v1.TABLE_KEYS = 2; v1.TABLE_RATINGS = 3; v1.file_fields = {'AUTHOR_ID': {'id': 1, 'field': 'user_id', 'type': 'integer'}, 'AUTHOR_NAME': {'id': 2, 'field': 'user_name', 'type': 'string'}, 'FILE_NAME': {'id': 3, 'field': 'file_name', 'type': 'string'}, 'CREATED_ON': {'id': 4, 'field': 'created', 'type': 'string'}, 'UPDATED_ON': {'id': 5, 'field': 'last_update', 'type': 'string'}, 'TOTAL_VIEWS': {'id': 6, 'field': 'views', 'type': 'integer'}, 'FILE_STATUS': {'id': 7, 'field': 'status', 'type': 'integer'}}; v1.rating_columns = {'TOTAL_VOTES': 'votes', 'SCORE': 'score'}; v1.valid_operators = ['=', '<', '>', '!=', '<>', '<=', '>=']; ASSetPropFlags(com.newgrounds.SaveGroupQuery.prototype, null, 1); } #endinitclip } movieClip 50 __Packages.com.newgrounds.encoders.ImageScanner { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.encoders) { _global.com.newgrounds.encoders = new Object(); } if (!_global.com.newgrounds.encoders.ImageScanner) { var v1 = function (the_source) { if (the_source) { this.image_source = the_source; } else { this.image_source = _root; } this.reset(); if (typeof this.image_source == 'movieclip') { if (this.image_source == _root) { this.source_width = Stage.width; this.source_height = Stage.height; } else { this.source_width = Math.floor(this.image_source._width); this.source_height = Math.floor(this.image_source._height); } this.sourceBitmap = new flash.display.BitmapData(this.source_width, this.source_height, false, 4294967295.0); this.sourceBitmap.draw(_root); } else { if (this.image_source.width) { this.source_width = this.image_source.width; this.source_height = this.image_source.height; this.sourceBitmap = this.image_source; } else { this.error('You can only use BitMaptData and MovieClip objects to create images'); } } }; com.newgrounds.encoders.ImageScanner = v1; var v2 = v1.prototype; v2.setCallback = function (target, funct) { if (target && funct) { this.callback_target = target; this.callback_function = funct; } }; v2.reset = function () { this.callback_target = null; this.callback_function = null; this.debug.bad_pixels = 0; this.hash = '0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ<>?:;-_=+()!&'; var v3 = Math.pow(this.hash.length, 2); trace('MAX COLORS: ' + v3); var v2 = Math.floor(Math.pow(v3, 0.3333333333333333)) - 1; var v4 = Math.pow(v2, 3); this.cube = v2; this.basen = new com.newgrounds.encoders.BaseN(this.hash); this.xpos = 0; this.ypos = 0; this.pixels = 0; this.busy = false; }; v2.startScan = function (w, h, s) { if (w) { this.image_width = w; } if (h) { this.image_height = h; } if (s != undefined) { this.crop = s; } var v7 = _root.getNextHighestDepth(); var v6 = _root.createEmptyMovieClip('API_image_container_' + v7, v7); var v5 = v6.createEmptyMovieClip('canvas', 100); v5.attachBitmap(this.sourceBitmap, 100); if (this.crop) { if (this.image_width / this.source_width > this.image_height / this.source_height) { this.canvas_width = this.image_width; this.canvas_height = Math.ceil(this.source_height * (this.image_width / this.source_width)); } else { this.canvas_height = this.image_height; this.canvas_width = Math.ceil(this.source_width * (this.image_height / this.source_height)); } } else { this.canvas_width = this.image_width; this.canvas_height = this.image_height; } v5._x = Math.round((this.image_width - this.canvas_width) / 2); v5._width = this.canvas_width; v5._height = this.canvas_height; this.resizedBitmap = new flash.display.BitmapData(this.image_width, this.image_height, false, 4294967295.0); this.resizedBitmap.draw(v6); v6.removeMovieClip(); this.copyBitmap = new flash.display.BitmapData(this.image_width, this.image_height, false, 4294967295.0); var v3 = '' + this.image_width; while (v3.length < 3) { v3 = '0' + v3; } var v4 = '' + this.image_height; while (v4.length < 3) { v4 = '0' + v4; } this.output = v3 + v4; this.draw_interval = setInterval(this, 'drawChunk', 10); this.busy = false; return this.resizedBitmap; }; v2.getBitmapData = function () { return this.copyBitmap; }; v2.getBytesTotal = function () { return this.image_width * this.image_height * 2; }; v2.getBytesScanned = function () { return this.pixels * 2; }; v2.getProgress = function () { return Math.round((this.getBytesScanned() / this.getBytesTotal()) * 100); }; v2.drawChunk = function () { if (!this.busy) { this.busy = true; var v2 = 0; while (v2 < this.pixels_per_chunk) { if (!this.nextPixel()) { clearInterval(this.draw_interval); this.callback_interval = setInterval(this, 'doCallback', 25); this.busy = true; break; } ++v2; } this.busy = false; } }; v2.doCallback = function () { this.busy = false; clearInterval(this.callback_interval); if (this.callback_target and this.callback_function) { this.callback_target[this.callback_function](this.output); } else { this.onScanComplete(this.output); } }; v2.onScanComplete = function (packet) { this.sendMessage('packet size: ' + this.output.length + ' bytes', 'onScanComplete'); }; v2.nextPixel = function () { var v15 = this.xpos; var v14 = this.ypos; var v7 = this.resizedBitmap.getPixel(v15, v14); var v17 = v7 >> 16 & 255; var v20 = v7 >> 8 & 255; var v16 = v7 >> 0 & 255; var v11 = Math.round(((v17 + 1) / 256) * this.cube); var v10 = Math.round(((v20 + 1) / 256) * this.cube); var v13 = Math.round(((v16 + 1) / 256) * this.cube); var v12 = v11 * (this.cube + 1) * (this.cube + 1) + v10 * (this.cube + 1) + v13; var v6 = this.basen.encode(v12, 2); this.output += v6; if (v6.length != 2) { trace('bad pixel ' + v6); } var v5 = this.basen.decode(v6); var v18 = v5; var v8 = v5 % (this.cube + 1); v5 = (v5 - v8) / (this.cube + 1); var v9 = v5 % (this.cube + 1); var v19 = (v5 - v9) / (this.cube + 1); if (v13 != v8 and v10 != v9 and v11 != v10) { ++this.debug.bad_pixels; trace('BAD PIXEL ' + this.debug.bad_pixels + ') ' + v12 + ' != ' + v18 + ' ' + v6); trace(this.basen.debug.lastencode); } var v2 = (Math.round((v19 / this.cube) * 255)).toString(16); var v4 = (Math.round((v9 / this.cube) * 255)).toString(16); var v3 = (Math.round((v8 / this.cube) * 255)).toString(16); while (v2.length < 2) { v2 = '0' + v2; } while (v4.length < 2) { v4 = '0' + v4; } while (v3.length < 2) { v3 = '0' + v3; } this.copyBitmap.setPixel(v15, v14, Number('0x' + v2 + v4 + v3)); ++this.pixels; if (this.pixels >= this.image_width * this.image_height) { return false; } ++this.xpos; if (this.xpos >= this.image_width) { this.xpos = 0; ++this.ypos; } return true; }; v2.error = function (e, f) { this.sendMessage(e, f, 'ERROR'); }; v2.sendMessage = function (msg, func, type) { var v1 = 'ImageScanner'; if (func) { v1 += '.' + func + '()'; } if (type) { v1 = type + ' in ' + v1; } v1 += ' :: ' + msg; trace(v1); }; v2.image_width = 100; v2.image_height = 100; v2.crop = true; v2.pixels_per_chunk = 500; v2.debug = new Object(); ASSetPropFlags(com.newgrounds.encoders.ImageScanner.prototype, null, 1); } #endinitclip } movieClip 49 __Packages.com.newgrounds.encoders.BaseN { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.encoders) { _global.com.newgrounds.encoders = new Object(); } if (!_global.com.newgrounds.encoders.BaseN) { var v1 = function (hash) { this.ceiling = 100000000000000.0; if (hash) { this.hashIndex = hash; } else { this.hashIndex = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~@#$%^&*()+|;/'; } this.bitSize = this.hashIndex.length; this.hashVal = new Object(); this.i = 0; while (this.i < this.bitSize) { this.hashVal[this.hashIndex.charAt(this.i)] = this.i; ++this.i; } }; com.newgrounds.encoders.BaseN = v1; var v2 = v1.prototype; v2.verify = function (s) { if (this.hashVal[s] != undefined) { return true; } else { return false; } }; v2.encode = function (n, minchars) { this.debug.lastencode = ''; if (typeof this.i != 'string') { n = n.toString(); } if (n.charAt(0) == '-') { var v3 = '-'; n = n.substring(1); } else { var v3 = ''; } if ((String(n)).indexOf('.') > -1) { var v4 = (String(n)).split('.', 2); return v3 + this.baseNEncoder(v4[0], minchars) + '.' + this.baseNEncoder(v4[1]); } else { this.debug.lastencode += '\tNo decimal\r'; return v3 + this.baseNEncoder(n, minchars); } }; v2.decode = function (s) { var v4 = 1; if (s.charAt(0) == '-') { v4 = -1; s = s.substring(1, s.length); } var v3 = s.indexOf('.'); if (v3 > -1) { var v5 = Math.pow(10, this.baseNDecoder(s.substring(v3 + 1, s.length))); return (this.baseNDecoder(s.substring(0, v3)) / v5) * v4; } else { return this.baseNDecoder(s) * v4; } }; v2.baseNEncoder = function (n, minchars) { if (!minchars) { minchars = 1; } var v4 = ''; while (n != 0) { n = Math.round(n); var v3 = n % this.bitSize; if (Math.round(v3) != v3) { trace('BaseN failed on ' + n + '%' + this.bitSize + ' = ' + v3 + ' ' + int(n) + ' ' + int(this.bitSize)); } v4 = this.hashIndex.charAt(v3) + v4; this.debug.lastencode += '\t-> n:' + n + ' % bitSize:' + this.bitSize + ' = ' + v3 + ', final char=' + v4 + '\n'; n -= v3; n /= this.bitSize; } if (minchars) { while (v4.length < minchars) { v4 = this.hashIndex.charAt(0) + v4; } } return v4; }; v2.baseNDecoder = function (s) { var v2 = 0; var v6 = 0; this.i = 0; while (this.i < s.length) { var v3 = s.charAt(s.length - this.i - 1); if (v3 == this.hashIndex.charAt(0)) { var v5 = 0; } else { var v5 = this.hashVal[v3] * Math.pow(this.bitSize, this.i); } v2 += v5; if (v2 >= this.ceiling) { v6 += (v2 - v2 % this.ceiling) / this.ceiling; v2 %= this.ceiling; } ++this.i; } if (v6 > 0) { v2 = '' + v2; while (v2.length < (this.ceiling.toString()).length - 1) { v2 = '0' + v2; } v2 = '' + v6 + v2; } return v2; }; v2.debug = new Object(); ASSetPropFlags(com.newgrounds.encoders.BaseN.prototype, null, 1); } #endinitclip } movieClip 56 __Packages.com.newgrounds.ScoreBoard { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.ScoreBoard) { var v1 = function (id, name) { this._name = name; this._id = id; }; com.newgrounds.ScoreBoard = v1; var v2 = v1.prototype; v2.exists = function () { return Number(this._id) > 0; }; v2.__get__id = function () { return this._id; }; v2.__get__name = function () { return this._name; }; v2.__get__period = function () { return this._period; }; v2.__get__page = function () { return this._page; }; v2.__get__num_results = function () { return this._num_results; }; v2.__get__scores = function () { return this._scores; }; v2.postScore = function (value, get_best, callback, params) { if (callback) { com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.SCORE_POSTED, callback, params); } com.newgrounds.API.postScore(this._name, value, get_best); }; v2.loadScores = function (period, page, num_results, callback, params) { if (callback) { com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.SCORES_LOADED, callback, params); } if (period) { this._period = period; } if (page) { this._page = page; } if (num_results) { this._num_results = num_results; } this._scores = []; com.newgrounds.API.loadScores(this); }; v2.setScores = function (scores, period, page, num_results) { if (period) { this._period = period; } if (page) { this._page = page; } if (num_results) { this._num_results = num_results; } this._scores = []; var v2 = 0; while (v2 < scores.length) { var v4 = this._num_results * (this._page - 1) + 1 + v2; this._scores.push(new com.newgrounds.Score(this, v4, scores[v2].username, scores[v2].value, scores[v2].numeric_value)); ++v2; } }; v2._period = 'Today'; v2._num_results = 10; v2._page = 1; v2.addProperty('id', v2.__get__id, function () {}); v2.addProperty('name', v2.__get__name, function () {}); v2.addProperty('num_results', v2.__get__num_results, function () {}); v2.addProperty('page', v2.__get__page, function () {}); v2.addProperty('period', v2.__get__period, function () {}); v2.addProperty('scores', v2.__get__scores, function () {}); ASSetPropFlags(com.newgrounds.ScoreBoard.prototype, null, 1); } #endinitclip } movieClip 43 __Packages.com.newgrounds.APIError { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.APIError) { var v1 = function (error, msg) { if ((Number(error)).toString() == String(error)) { error = Number(error); } else { if (com.newgrounds.APIError.error_codes[String(error)]) { error = com.newgrounds.APIError.error_codes[String(error)]; } else { error = 0; } } this.code = error; this.message = msg; this.name = com.newgrounds.APIError.error_names[error]; this.alias = com.newgrounds.APIError.aliases[error]; }; com.newgrounds.APIError = v1; var v2 = v1.prototype; v1.init_codes = function () { var v2 = new Object(); var v1 = 0; while (v1 < com.newgrounds.APIError.aliases.length) { v2[com.newgrounds.APIError.aliases[v1]] = v1; ++v1; } return v2; }; v1.init_names = function () { var v5 = new Array(); var v3 = 0; while (v3 < com.newgrounds.APIError.aliases.length) { var v2 = (com.newgrounds.APIError.aliases[v3].toLowerCase()).split('_'); var v1 = 0; while (v1 < v2.length) { v2[v1] = (v2[v1].substr(0, 1)).toUpperCase() + v2[v1].substr(1, v2[v1].length); for (var v4 in com.newgrounds.APIError.always_caps) { if (v2[v1].toUpperCase() == com.newgrounds.APIError.always_caps[v4]) { v2[v1] = v2[v1].toUpperCase(); } } ++v1; } v5[v3] = v2.join(' '); ++v3; } return v5; }; v2.isError = function () { return true; }; v1.aliases = 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_SAVE_GROUP', 'FILE_NOT_FOUND', 'SITE_ID_REQUIRED', 'UPLOAD_IN_PROGRESS', 'USER_CANCELLED', 'CONFIRM_REQUEST', 'ILLEGAL_REQUEST', 'CONNECTION_FAILED', 'QUERY_INCOMPLETE', 'SAVE_FILE_ERROR', 'INVALID_VALUE', 'SERVER_ERROR'); v1.always_caps = new Array('API', 'URL', 'ID'); v1.error_codes = com.newgrounds.APIError.init_codes(); v1.error_names = com.newgrounds.APIError.init_names(); v2.code = 0; ASSetPropFlags(com.newgrounds.APIError.prototype, null, 1); } #endinitclip } movieClip 11 __Packages.com.newgrounds.components.PreloaderBar { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.components) { _global.com.newgrounds.components = new Object(); } if (!_global.com.newgrounds.components.PreloaderBar) { var v1 = function () { super(); }; com.newgrounds.components.PreloaderBar = v1; com.newgrounds.components.PreloaderBar extends MovieClip; var v2 = v1.prototype; v2.onLoad = function () { _root.stop(); var v3 = com.newgrounds.API.getPercentLoaded(); if (v3 == 100) { if (this.AUTO_PLAY) { this.startMovie(); } else { this.gotoAndStop(this._totalframes); } } else { this.advanceFrame(this, false, false); this.FRAME_TIME = 1000 / this.FRAME_RATE; this.loadingComplete = false; this.intervalId = setInterval(this, 'timerHandler', this.FRAME_TIME / 2); this.frameAccum = 0; this.time = getTimer(); this.timerHandler(); } }; v2.timerHandler = function () { if (!this.loadingComplete) { var v4 = com.newgrounds.API.getPercentLoaded(); this.bar._xscale = v4; if (v4 == 100) { this.loadingComplete = true; if (this.AUTO_PLAY) { this.startMovie(); } return undefined; } } var v3 = getTimer() - this.time; this.time += v3; this.frameAccum += v3; var v2 = 0; for (;;) { if (!(this.frameAccum >= this.FRAME_TIME && v2 < this.MAX_FRAME_SKIP)) break; if (this.loadingComplete) { this.advanceFrame(this, false, false); } this.frameAccum -= this.FRAME_TIME; v2++; } updateAfterEvent(); }; v2.advanceFrame = function (clip, recurse, loop) { if (!clip) { return undefined; } clip.stop(); if (clip._currentframe == clip._totalframes) { if (loop) { clip.gotoAndStop(1); } } else { clip.nextFrame(); } if (recurse) { for (var v5 in clip) { if (typeof clip[v5] == 'movieclip') { this.advanceFrame(clip[v5], recurse, loop); } } } }; v2.startMovie = function () { clearInterval(this.intervalId); _root.play(); }; v1.symbolName = 'preloaderBar'; v1.symbolOwner = 'com.newgrounds.API'; v2.AUTO_PLAY = false; v2.FRAME_RATE = 30; v2.MAX_FRAME_SKIP = 5; v2.loadingComplete = false; v2.frameAccum = 0; ASSetPropFlags(com.newgrounds.components.PreloaderBar.prototype, null, 1); } #endinitclip } movieClip 47 __Packages.com.newgrounds.ValidationTools { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.ValidationTools) { var v1 = function () {}; com.newgrounds.ValidationTools = v1; var v2 = v1.prototype; v1.isNumber = function (v) { if (typeof v == 'number') { return true; return false; } if (typeof v == 'string' and (Number(v)).toString() == v) { return true; } return false; }; v1.isInteger = function (v) { if (com.newgrounds.ValidationTools.isNumber(v)) { v = Number(v); return Math.floor(v) == v; } return false; }; v1.isFloat = function (v) { return com.newgrounds.ValidationTools.isNumber(v); }; v1.isString = function (v) { if (typeof v == 'string' or typeof v == 'number') { return true; } return false; }; v1.isEmpty = function (o) { for (var v2 in o) { return false; } return true; }; ASSetPropFlags(com.newgrounds.ValidationTools.prototype, null, 1); } #endinitclip } movieClip 51 __Packages.com.newgrounds.APIEvent { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.APIEvent) { var v1 = function () {}; com.newgrounds.APIEvent = v1; var v2 = v1.prototype; v2.NewgroundsAPIEvent = function (type, success, data) { this._type = type; this._data = data; this._success = success; }; v2.__get__type = function () { return this._type; }; v2.__get__success = function () { return this._success; }; v2.__get__data = function () { return this._data; }; v1.MOVIE_CONNECTED = 'movieConnected'; v1.ADS_APPROVED = 'adsApproved'; v1.AD_ATTACHED = 'adAttached'; v1.HOST_BLOCKED = 'hostBlocked'; v1.NEW_VERSION_AVAILABLE = 'newVersionAvailable'; v1.EVENT_LOGGED = 'eventLogged'; v1.SCORE_POSTED = 'scorePosted'; v1.SCORES_LOADED = 'scoresLoaded'; v1.UNLOCK_MEDAL = 'unlockMedal'; v1.MEDAL_UNLOCKED = 'medalUnlocked'; v1.MEDALS_LOADED = 'medalsLoaded'; v1.METADATA_LOADED = 'metadataLoaded'; v1.FILE_PRIVS_LOADED = 'filePrivsLoaded'; v1.FILE_SAVED = 'fileSaved'; v1.FILE_LOADED = 'fileLoaded'; v1.QUERY_COMPLETE = 'queryComplete'; v1.VOTE_COMPLETE = 'voteComplete'; v2.addProperty('data', v2.__get__data, function () {}); v2.addProperty('success', v2.__get__success, function () {}); v2.addProperty('type', v2.__get__type, function () {}); ASSetPropFlags(com.newgrounds.APIEvent.prototype, null, 1); } #endinitclip } movieClip 52 __Packages.com.newgrounds.encoders.SerialXML { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.encoders) { _global.com.newgrounds.encoders = new Object(); } if (!_global.com.newgrounds.encoders.SerialXML) { var v1 = function () {}; com.newgrounds.encoders.SerialXML = v1; var v2 = v1.prototype; v1.decode = function (xml) { if (!(xml instanceof XML)) { xml = new XML(xml); } var v2 = com.newgrounds.encoders.SerialXML.populateObject(xml.firstChild, {}); return v2.DATA; }; v1.encode = function (obj) { var v1 = new XML(); com.newgrounds.encoders.SerialXML.populateXML(v1, obj, 'DATA'); return v1; }; v1.populateObject = function (child, object) { var v6 = child.nodeName; var v5 = com.newgrounds.encoders.SerialXML.getValue(v6, child.attributes.v); var v4 = child.attributes.n; if (object instanceof Array) { v4 = object.length; object.push(v5); } else { object[v4] = v5; } if (child.hasChildNodes()) { var v1 = 0; while (v1 < child.childNodes.length) { com.newgrounds.encoders.SerialXML.populateObject(child.childNodes[v1], object[v4]); ++v1; } } return object; }; v1.populateXML = function (child, obj, name) { if (obj === undefined) { return undefined; } var v5 = new XML(); var v2; if (obj instanceof Array) { v2 = v5.createElement(com.newgrounds.encoders.SerialXML.getType(obj)); if (name) { v2.attributes.n = name; } child.appendChild(v2); var v4 = 0; while (v4 < obj.length) { com.newgrounds.encoders.SerialXML.populateXML(v2, obj[v4]); ++v4; } } else { if (typeof obj == 'object') { v2 = v5.createElement(com.newgrounds.encoders.SerialXML.getType(obj)); if (name) { v2.attributes.n = name; } child.appendChild(v2); for (var v4 in obj) { com.newgrounds.encoders.SerialXML.populateXML(v2, obj[v4], v4); } } else { v2 = v5.createElement(com.newgrounds.encoders.SerialXML.getType(obj)); if (name) { v2.attributes.n = name; } if ((com.newgrounds.encoders.SerialXML.getType(obj)).length == 1) { v2.attributes.v = obj; } child.appendChild(v2); } } }; v1.getValue = function (type, stringval) { switch (type.toUpperCase()) { case 'O': return new Object(); break; case 'A': return new Array(); break; case 'N': return Number(stringval); break; case 'S': return String(stringval); break; case 'TRUE': return true; break; case 'FALSE': return false; break; default: return null; } }; v1.getType = function (obj) { switch (obj instanceof Array ? 'array' : typeof obj) { case 'array': return 'A'; break; case 'object': return 'O'; break; case 'string': return 'S'; break; case 'number': return 'N'; case 'boolean': return (obj === true) ? 'TRUE' : 'FALSE'; break; default: return 'NULL'; } }; ASSetPropFlags(com.newgrounds.encoders.SerialXML.prototype, null, 1); } #endinitclip } movieClip 53 __Packages.com.newgrounds.encoders.LZW2 { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.encoders) { _global.com.newgrounds.encoders = new Object(); } if (!_global.com.newgrounds.encoders.LZW2) { var v1 = function () {}; com.newgrounds.encoders.LZW2 = v1; var v2 = v1.prototype; v1.doCompressorConfig = function () { com.newgrounds.encoders.LZW2.comp_dict = []; var v1 = 0; while (v1 < 256) { com.newgrounds.encoders.LZW2.comp_dict[String.fromCharCode(v1)] = v1; ++v1; } com.newgrounds.encoders.LZW2.comp_dict.< = 256; com.newgrounds.encoders.LZW2.comp_dict.> = 257; com.newgrounds.encoders.LZW2.comp_dict.& = 258; com.newgrounds.encoders.LZW2.comp_dict." = 259; com.newgrounds.encoders.LZW2.comp_dict.\' = 260; com.newgrounds.encoders.LZW2.pos = 0; com.newgrounds.encoders.LZW2.result = ''; com.newgrounds.encoders.LZW2.buffer = ''; com.newgrounds.encoders.LZW2.nbChar = 256 + com.newgrounds.encoders.LZW2.skipnum; }; v1.compress = function (string, callback, callback_params) { com.newgrounds.encoders.LZW2.doCompressorConfig(); if (com.newgrounds.encoders.LZW2.busy) { trace('[LZW COMPRESSOR] :: Compression can not begin until previous compression or decompression is complete!'); return undefined; } com.newgrounds.encoders.LZW2.splitStr = string.split(''); string = ''; com.newgrounds.encoders.LZW2.len = com.newgrounds.encoders.LZW2.splitStr.length; com.newgrounds.encoders.LZW2.local = {'delay': 30, 'callback': callback, 'callback_params': callback_params, 'compress_chunk': function () { com.newgrounds.encoders.LZW2.compress_chunk(); }, 'busy': false, 'complete': false}; com.newgrounds.encoders.LZW2.interval = setInterval(com.newgrounds.encoders.LZW2.local, 'compress_chunk', 5); }; v1.getProgress = function () { return Math.round((com.newgrounds.encoders.LZW2.pos / com.newgrounds.encoders.LZW2.len) * 100); }; v1.compress_chunk = function () { if (com.newgrounds.encoders.LZW2.local.delay > 0) { --com.newgrounds.encoders.LZW2.local.delay; } else { if (!com.newgrounds.encoders.LZW2.local.busy) { com.newgrounds.encoders.LZW2.local.busy = true; var v1 = 0; while (v1 < com.newgrounds.encoders.LZW2.max_chunk_length) { com.newgrounds.encoders.LZW2.encode_next(); if (com.newgrounds.encoders.LZW2.local.complete) { break; } ++v1; } com.newgrounds.encoders.LZW2.local.busy = false; } } if (com.newgrounds.encoders.LZW2.local.complete) { trace('LZW2 complete ' + com.newgrounds.encoders.LZW2.nbChar + ' ' + com.newgrounds.encoders.LZW2.comp_dict.length + ' ' + com.newgrounds.encoders.LZW2.len + ' ' + com.newgrounds.encoders.LZW2.pos + ' ' + com.newgrounds.encoders.LZW2.skipnum); clearInterval(com.newgrounds.encoders.LZW2.interval); com.newgrounds.encoders.LZW2.local.callback(com.newgrounds.encoders.LZW2.result, com.newgrounds.encoders.LZW2.local.callback_params); com.newgrounds.encoders.LZW2.result = ''; com.newgrounds.encoders.LZW2.buffer = ''; } }; v1.encode_next = function () { if (com.newgrounds.encoders.LZW2.pos <= com.newgrounds.encoders.LZW2.len) { var v1 = com.newgrounds.encoders.LZW2.splitStr[com.newgrounds.encoders.LZW2.pos]; if (com.newgrounds.encoders.LZW2.comp_dict[com.newgrounds.encoders.LZW2.buffer + v1] !== undefined) { com.newgrounds.encoders.LZW2.buffer += v1; } else { com.newgrounds.encoders.LZW2.result += String.fromCharCode(com.newgrounds.encoders.LZW2.comp_dict[com.newgrounds.encoders.LZW2.buffer]); com.newgrounds.encoders.LZW2.comp_dict[com.newgrounds.encoders.LZW2.buffer + v1] = com.newgrounds.encoders.LZW2.nbChar; ++com.newgrounds.encoders.LZW2.nbChar; com.newgrounds.encoders.LZW2.buffer = v1; } ++com.newgrounds.encoders.LZW2.pos; } else { com.newgrounds.encoders.LZW2.local.complete = true; return undefined; } }; v1.comp_config = false; v1.skipnum = 5; v1.busy = false; v1.max_chunk_length = 12000; ASSetPropFlags(com.newgrounds.encoders.LZW2.prototype, null, 1); } #endinitclip } movieClip 54 __Packages.com.newgrounds.encoders.LZW { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.encoders) { _global.com.newgrounds.encoders = new Object(); } if (!_global.com.newgrounds.encoders.LZW) { var v1 = function () {}; com.newgrounds.encoders.LZW = v1; var v2 = v1.prototype; v1.setXMLSafe = function (x) { com.newgrounds.encoders.LZW.xmlsafe = x; }; v1.compress = function (str, escape_chars) { var v2 = new Array(); var v11 = com.newgrounds.encoders.LZW.xmlsafe ? 5 : 0; var v5 = 0; while (v5 < 256) { v2[String.fromCharCode(v5)] = v5; ++v5; } if (com.newgrounds.encoders.LZW.xmlsafe) { v2.< = 256; v2.> = 257; v2.& = 258; v2." = 259; v2.\' = 260; } var v7 = ''; var v8 = str.split(''); var v9 = v8.length; var v6 = 256 + v11; var v1 = ''; var v4; v5 = 0; while (v5 <= v9) { var v3 = v8[v5]; if (v2[v1 + v3] !== undefined) { v1 += v3; } else { v4 = String.fromCharCode(v2[v1]); if (escape_chars and (v2[v1] < 33 or v2[v1] > 126 or v4 == '%')) { v4 = escape(v4); } v7 += v4; v2[v1 + v3] = v6; ++v6; v1 = v3; } ++v5; } return v7; }; v1.decompress = function (str) { var v4 = new Array(); var v10 = com.newgrounds.encoders.LZW.xmlsafe ? 5 : 0; var v6 = 0; while (v6 < 256) { var v9 = String.fromCharCode(v6); v4[v6] = v9; ++v6; } if (com.newgrounds.encoders.LZW.xmlsafe) { v4[256] = '<'; v4[257] = '>'; v4[258] = '&'; v4[259] = '"'; v4[260] = '\''; } var v11 = str; var v13 = v11.split(''); var v12 = v13.length; var v7 = 256 + v10; var v1 = ''; var v2 = ''; var v8 = ''; v6 = 0; while (v6 < v12) { var v5 = v11.charCodeAt(v6); var v3 = v4[v5]; if (v1 == '') { v1 = v3; v8 += v3; } else { if (v5 <= 255 + v10) { v8 += v3; v2 = v1 + v3; v4[v7] = v2; ++v7; v1 = v3; } else { v2 = v4[v5]; if (v2 == undefined) { v2 = v1 + v1.slice(0, 1); } v8 += v2; v4[v7] = v1 + v2.slice(0, 1); ++v7; v1 = v2; } } ++v6; } return v8; }; v1.compress_fp6 = function (str) { var v3 = new Array(); var v10 = com.newgrounds.encoders.LZW.xmlsafe ? 5 : 0; var v4 = 0; while (v4 < 256) { v3[String(v4)] = v4; ++v4; } if (com.newgrounds.encoders.LZW.xmlsafe) { var v14 = String((new String('<')).charCodeAt(0)); var v11 = String((new String('>')).charCodeAt(0)); var v13 = String((new String('&')).charCodeAt(0)); var v15 = String((new String('"')).charCodeAt(0)); var v12 = String((new String('\'')).charCodeAt(0)); v3[v14] = 256; v3[v11] = 257; v3[v13] = 258; v3[v15] = 259; v3[v12] = 260; } var v7 = ''; var v16 = str; var v8 = v16.split(''); var v9 = v8.length; var v6 = 256 + v10; var v1 = new Array(); v4 = 0; while (v4 <= v9) { var v2 = v8[v4]; if (v1.length == 0) { var v5 = String(v2.charCodeAt(0)); } else { var v5 = v1.join('-') + '-' + String(v2.charCodeAt(0)); } if (v3[v5] !== undefined) { v1.push(v2.charCodeAt(0)); } else { v7 += String.fromCharCode(v3[v1.join('-')]); v3[v5] = v6; ++v6; false; v1 = new Array(); v1.push(v2.charCodeAt(0)); } ++v4; } return v7; }; v1.xmlsafe = false; ASSetPropFlags(com.newgrounds.encoders.LZW.prototype, null, 1); } #endinitclip } movieClip 55 __Packages.com.newgrounds.Medal { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.Medal) { var v1 = function (id, name, value, difficulty, unlocked, icon_url) { if (id == undefined || name == undefined || value == undefined || difficulty == undefined) { com.newgrounds.API.fatalError('Medal instances require an id, name, value and difficulty'); } this.medal_id = id; this.medal_name = name; this.medal_value = value; this.medal_difficulty = difficulty; if (unlocked) { this.medal_unlocked = true; } if (icon_url) { this.icon_url = icon_url; } }; com.newgrounds.Medal = v1; var v2 = v1.prototype; v2.isUnlocked = function () { return this.medal_unlocked; }; v2.unlock = function () { if (!this.isUnlocked()) { com.newgrounds.API.unlockMedal(this); } }; v2.setUnlocked = function (u) { this.medal_unlocked = u; }; v2.attachIcon = function (target, depth) { if (!depth) { depth = target.getNextHighestDepth(); } var v3 = target.createEmptyMovieClip('Asset_Medal_Icon_' + this.getID(), depth); if (this.icon_url) { v3.loadMovie(this.icon_url); } else { var v4 = flash.display.BitmapData.loadBitmap('Asset_default_medal_icon_' + this.getDifficulty(), depth); v3.attachBitmap(v4, depth, true); } }; v2.getID = function () { return this.medal_id; }; v2.getName = function () { return this.medal_name; }; v2.getValue = function () { return this.medal_value; }; v2.getDifficulty = function (as_string) { if (as_string) { return com.newgrounds.Medal.difficulty_names[this.medal_difficulty]; } else { return this.medal_difficulty; } }; v2.medal_unlocked = false; v2.icon_loaded = false; v2.icon_width = 50; v2.icon_height = 50; v2.icon_url = null; v1.difficulty_names = new Array(null, 'Easy', 'Moderate', 'Challenging', 'Difficult', 'Brutal'); ASSetPropFlags(com.newgrounds.Medal.prototype, null, 1); } #endinitclip } movieClip 57 __Packages.com.newgrounds.Score { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.Score) { var v1 = function (board, position, username, value, numeric_value) { this._board = board; this._position = position; this._username = username; this._value = value; this._numeric_value = numeric_value; }; com.newgrounds.Score = v1; var v2 = v1.prototype; v2.__get__board = function () { return this._board; }; v2.__get__position = function () { return this._position; }; v2.__get__username = function () { return this._username; }; v2.__get__value = function () { return this._value; }; v2.__get__numeric_value = function () { return this._numeric_value; }; v2.addProperty('board', v2.__get__board, function () {}); v2.addProperty('numeric_value', v2.__get__numeric_value, function () {}); v2.addProperty('position', v2.__get__position, function () {}); v2.addProperty('username', v2.__get__username, function () {}); v2.addProperty('value', v2.__get__value, function () {}); ASSetPropFlags(com.newgrounds.Score.prototype, null, 1); } #endinitclip } movieClip 58 __Packages.com.newgrounds.encoders.RC4 { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.encoders) { _global.com.newgrounds.encoders = new Object(); } if (!_global.com.newgrounds.encoders.RC4) { var v1 = function () {}; com.newgrounds.encoders.RC4 = v1; var v2 = v1.prototype; v1.encrypt = function (src, key) { var v3 = com.newgrounds.encoders.RC4.strToChars(src); var v1 = com.newgrounds.encoders.RC4.strToChars(key); var v2 = com.newgrounds.encoders.RC4.calculate(v3, v1); return com.newgrounds.encoders.RC4.charsToHex(v2); }; v1.encryptbin = function (src, key) { var v3 = com.newgrounds.encoders.RC4.strToChars(src); var v1 = com.newgrounds.encoders.RC4.strToChars(key); var v2 = com.newgrounds.encoders.RC4.calculate(v3, v1); return v2; }; v1.decrypt = function (src, key) { var v3 = com.newgrounds.encoders.RC4.hexToChars(src); var v1 = com.newgrounds.encoders.RC4.strToChars(key); var v2 = com.newgrounds.encoders.RC4.calculate(v3, v1); return com.newgrounds.encoders.RC4.charsToStr(v2); }; v1.initialize = function (pwd) { var v2 = 0; var v3; var v4 = pwd.length; var v1 = 0; while (v1 <= 255) { com.newgrounds.encoders.RC4.mykey[v1] = pwd[v1 % v4]; com.newgrounds.encoders.RC4.sbox[v1] = v1; ++v1; } v1 = 0; while (v1 <= 255) { v2 = (v2 + com.newgrounds.encoders.RC4.sbox[v1] + com.newgrounds.encoders.RC4.mykey[v1]) % 256; v3 = com.newgrounds.encoders.RC4.sbox[v1]; com.newgrounds.encoders.RC4.sbox[v1] = com.newgrounds.encoders.RC4.sbox[v2]; com.newgrounds.encoders.RC4.sbox[v2] = v3; ++v1; } }; v1.calculate = function (plaintxt, psw) { com.newgrounds.encoders.RC4.initialize(psw); var v1 = 0; var v2 = 0; var v9 = new Array(); var v7; var v5; var v6; var v3 = 0; while (v3 < plaintxt.length) { v1 = (v1 + 1) % 256; v2 = (v2 + com.newgrounds.encoders.RC4.sbox[v1]) % 256; v5 = com.newgrounds.encoders.RC4.sbox[v1]; com.newgrounds.encoders.RC4.sbox[v1] = com.newgrounds.encoders.RC4.sbox[v2]; com.newgrounds.encoders.RC4.sbox[v2] = v5; var v4 = (com.newgrounds.encoders.RC4.sbox[v1] + com.newgrounds.encoders.RC4.sbox[v2]) % 256; v7 = com.newgrounds.encoders.RC4.sbox[v4]; v6 = plaintxt[v3] ^ v7; v9.push(v6); ++v3; } return v9; }; v1.charsToHex = function (chars) { var v4 = new String(''); var v3 = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); var v1 = 0; while (v1 < chars.length) { v4 += v3[chars[v1] >> 4] + v3[chars[v1] & 15]; ++v1; } return v4; }; v1.hexToChars = function (hex) { var v3 = new Array(); var v1 = (hex.substr(0, 2) == '0x') ? 2 : 0; while (v1 < hex.length) { v3.push(parseInt(hex.substr(v1, 2), 16)); v1 += 2; } return v3; }; v1.charsToStr = function (chars) { var v3 = new String(''); var v1 = 0; while (v1 < chars.length) { v3 += String.fromCharCode(chars[v1]); ++v1; } return v3; }; v1.strToChars = function (str) { var v3 = new Array(); var v1 = 0; while (v1 < str.length) { v3.push(str.charCodeAt(v1)); ++v1; } return v3; }; v1.sbox = new Array(255); v1.mykey = new Array(255); ASSetPropFlags(com.newgrounds.encoders.RC4.prototype, null, 1); } #endinitclip } movieClip 59 __Packages.com.newgrounds.encoders.JSON { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.encoders) { _global.com.newgrounds.encoders = new Object(); } if (!_global.com.newgrounds.encoders.JSON) { var v1 = function () {}; com.newgrounds.encoders.JSON = v1; var v2 = v1.prototype; v1.encode = function (arg, noquotes) { var v3; var v2; var v6; var v1 = ''; var v4; if (arg.isSServerVar()) { var v8 = 'sservervariable'; } else { var v8 = typeof arg; } switch (v8) { return 'null'; case 'sservervariable': return '?' + arg.getEncodedValue(); break; case 'object': if (arg) { if (arg instanceof Array) { v2 = 0; while (v2 < arg.length) { v4 = com.newgrounds.encoders.JSON.encode(arg[v2]); if (v1) { v1 += ','; } v1 += v4; ++v2; } return '[' + v1 + ']'; } else { if (typeof arg.toString != 'undefined') { for (v2 in arg) { v4 = arg[v2]; if (typeof v4 != 'undefined' && typeof v4 != 'function') { v4 = com.newgrounds.encoders.JSON.encode(v4); if (v1) { v1 += ','; } v1 += com.newgrounds.encoders.JSON.encode(v2) + ':' + v4; } } return '{' + v1 + '}'; } } } return 'null'; case 'number': return isFinite(arg) ? String(arg) : 'null'; case 'string': v6 = arg.length; if (noquotes) { var v7 = ''; } else { var v7 = '"'; } v1 = v7; v2 = 0; while (v2 < v6) { v3 = arg.charAt(v2); if (v3 >= ' ') { if (v3 == '\\' || v3 == '"') { v1 += '\\'; } v1 += v3; } else { switch (v3) { case '\b': v1 += '\\b'; break; case '\f': v1 += '\\f'; break; case '\n': v1 += '\\n'; break; case '\r': v1 += '\\r'; break; case '\t': v1 += '\\t'; break; default: v3 = v3.charCodeAt(); v1 += '\\u00' + (Math.floor(v3 / 16)).toString(16) + (v3 % 16).toString(16); } } v2 += 1; } return v1 + v7; case 'boolean': return String(arg); default: return 'null'; } }; v1.background_encode = function (arg, callback) { if (com.newgrounds.encoders.JSON.busy) { trace('[Newgrounds Encoder] :: Cannot encode a new file until the previous file is completed'); return false; } else { if (!callback) { trace('[Newgrounds Encoder] :: Missing a callback function, skipping encode'); return false; } } com.newgrounds.encoders.JSON.busy = true; var v2 = new Date(); com.newgrounds.encoders.JSON.start = v2.getTime(); com.newgrounds.encoders.JSON.cache = {'busy': false, 'complete': false, 'arg': arg, 'target': arg, 'parents': [], 'encoded': '', 'callback': callback, 'encode_chunk': function () { com.newgrounds.encoders.JSON.encode_chunk(); }}; if (com.newgrounds.encoders.JSON.getType(arg) == 'object') { com.newgrounds.encoders.JSON.cache.encoded = '{'; com.newgrounds.encoders.JSON.interval = setInterval(com.newgrounds.encoders.JSON.cache, 'encode_chunk', 25); return true; } if (com.newgrounds.encoders.JSON.getType(arg) == 'array') { com.newgrounds.encoders.JSON.cache.encoded = '['; } com.newgrounds.encoders.JSON.interval = setInterval(com.newgrounds.encoders.JSON.cache, 'encode_chunk', 25); return true; }; v1.background_decode = function (arg, callback) { if (com.newgrounds.encoders.JSON.busy) { trace('[Newgrounds Encoder] :: Cannot decode a new file until the previous file is completed'); return false; } else { if (!callback) { trace('[Newgrounds Encoder] :: Missing a callback function, skipping decode'); return false; } } com.newgrounds.encoders.JSON.busy = true; var v1 = new Date(); com.newgrounds.encoders.JSON.start = v1.getTime(); com.newgrounds.encoders.JSON.cache = {'busy': false, 'callback': callback, 'complete': false, 'arg': arg, 'pos': 0, 'parents': ['root'], 'target': null, 'scratch': '', 'decode_chunk': function () { com.newgrounds.encoders.JSON.decode_chunk(); }}; com.newgrounds.encoders.JSON.interval = setInterval(com.newgrounds.encoders.JSON.cache, 'decode_chunk', 25); return true; }; v1.decode = function (text) { var at = 0; var ch = ' '; var _value; var _error = function (m) { throw {'name': 'JSONError', 'message': m, 'at': at - 1, 'text': text}; }; var _next = function () { ch = text.charAt(at); at += 1; return ch; }; var _white = function () { while (ch) { if (ch <= ' ') { _next(); } else { if (ch == '/') { switch (_next()) { case '/': for (;;) { if (!(_next() && ch != '\n' && ch != '\r')) break; } break; case '*': _next(); for (;;) { if (ch) { if (ch == '*') { if (_next() == '/') { _next(); break; } } else { _next(); } continue; } _error('Unterminated comment'); } break; default: _error('Syntax error'); } } else { break; } } } }; var _string = function () { var v4; var v1 = ''; var v3; var v2; var v5 = false; if (ch == '"') { while (_next()) { if (ch == '"') { _next(); return v1; } else { if (ch == '\\') { switch (_next()) { case 'b': v1 += '\b'; break; case 'f': v1 += '\f'; break; case 'n': v1 += '\n'; break; case 'r': v1 += '\r'; break; case 't': v1 += '\t'; break; case 'u': v2 = 0; v4 = 0; while (v4 < 4) { v3 = parseInt(_next(), 16); if (!isFinite(v3)) { v5 = true; break; } v2 = v2 * 16 + v3; v4 += 1; } if (v5) { v5 = false; } else { v1 += String.fromCharCode(v2); break; default: v1 += ch; } } } else { v1 += ch; } } } } _error('Bad string'); }; var _array = function () { var v1 = []; if (ch == '[') { _next(); _white(); if (ch == ']') { _next(); return v1; } while (ch) { v1.push(_value()); _white(); if (ch == ']') { _next(); return v1; } else { if (ch != ',') { break; } } _next(); _white(); } } _error('Bad array'); }; var _object = function () { var v2; var v1 = {}; if (ch == '{') { _next(); _white(); if (ch == '}') { _next(); return v1; } while (ch) { v2 = _string(); _white(); if (ch != ':') { break; } _next(); v1[v2] = _value(); _white(); if (ch == '}') { _next(); return v1; } else { if (ch != ',') { break; } } _next(); _white(); } } _error('Bad object'); }; var _number = function () { var v1 = ''; var v2; if (ch == '-') { v1 = '-'; _next(); } for (;;) { if (!(ch >= '0' && ch <= '9')) break; v1 += ch; _next(); } if (ch == '.') { v1 += '.'; for (;;) { if (!(_next() && ch >= '0' && ch <= '9')) break; v1 += ch; } } v2 = 1 * v1; if (!isFinite(v2)) { _error('Bad number'); } else { return v2; } }; var _word = function () { switch (ch) { case 't': if (_next() == 'r' && _next() == 'u' && _next() == 'e') { _next(); return true; } break; case 'f': if (_next() == 'a' && _next() == 'l' && _next() == 's' && _next() == 'e') { _next(); return false; } break; case 'n': if (_next() == 'u' && _next() == 'l' && _next() == 'l') { _next(); return null; } } _error('Syntax error'); }; _value = function () { _white(); switch (ch) { case '{': return _object(); case '[': return _array(); case '"': return _string(); case '-': return _number(); } return (ch >= '0' && ch <= '9') ? _number() : _word(); }; return _value(); }; v1.getType = function (v) { if (v instanceof Array) { return 'array'; } else { return typeof v; } }; v1.decode_chunk = function () { if (!com.newgrounds.encoders.JSON.cache.busy && !com.newgrounds.encoders.JSON.cache.complete) { com.newgrounds.encoders.JSON.cache.busy = true; var v1 = 0; while (v1 < com.newgrounds.encoders.JSON.decode_chunks) { com.newgrounds.encoders.JSON.chunk_decoder(); if (com.newgrounds.encoders.JSON.cache.complete) { break; } ++v1; } trace(Math.round((com.newgrounds.encoders.JSON.cache.pos / com.newgrounds.encoders.JSON.cache.arg.length) * 100) + '% decoded'); com.newgrounds.encoders.JSON.cache.busy = false; } if (com.newgrounds.encoders.JSON.cache.complete) { var v2 = new Date(); com.newgrounds.encoders.JSON.busy = false; clearInterval(com.newgrounds.encoders.JSON.interval); com.newgrounds.encoders.JSON.cache.callback(com.newgrounds.encoders.JSON.cache.root, v2.getTime() - com.newgrounds.encoders.JSON.start); com.newgrounds.encoders.JSON.cache.arg = ''; } }; v1.encode_chunk = function () { if (!com.newgrounds.encoders.JSON.cache.busy && !com.newgrounds.encoders.JSON.cache.complete) { com.newgrounds.encoders.JSON.cache.busy = true; var v1 = 0; while (v1 < com.newgrounds.encoders.JSON.encode_chunks) { com.newgrounds.encoders.JSON.chunk_encoder(); if (com.newgrounds.encoders.JSON.cache.complete) { break; } ++v1; } com.newgrounds.encoders.JSON.cache.busy = false; } if (com.newgrounds.encoders.JSON.cache.complete) { var v3 = new Date(); var v2 = v3.getTime(); com.newgrounds.encoders.JSON.busy = false; clearInterval(com.newgrounds.encoders.JSON.interval); com.newgrounds.encoders.JSON.cache.callback(com.newgrounds.encoders.JSON.cache.encoded, v2 - com.newgrounds.encoders.JSON.start); com.newgrounds.encoders.JSON.cache.encoded = ''; } }; v1.chunk_decoder = function () { function _object() { var v1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos); if (!com.newgrounds.encoders.JSON.cache.mode) { com.newgrounds.encoders.JSON.cache.mode = 'object'; ++com.newgrounds.encoders.JSON.cache.pos; v1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos); if (v1 != '"') { throw 'Malformed object key in encoded string. Keys must be wrapped in quotes ("")'; } com.newgrounds.encoders.JSON.cache.scratch = ''; _setTargetValue({}); } else { if (v1 == ',') { ++com.newgrounds.encoders.JSON.cache.pos; v1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos); if (v1 != '"') { throw 'Malformed object key in encoded string. Keys must be wrapped in quotes ("")'; } com.newgrounds.encoders.JSON.cache.scratch = ''; } else { if (v1 == '}') { _useParent(); } else { if (v1 == '"') { ++com.newgrounds.encoders.JSON.cache.pos; v1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos); if (v1 != ':') { throw 'Malformed object notation. Object keys and values must be separated by colons(:)'; } _addParent(com.newgrounds.encoders.JSON.cache.scratch); com.newgrounds.encoders.JSON.cache.mode = null; } else { if (v1 == '\\') { ++com.newgrounds.encoders.JSON.cache.pos; v1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos); } com.newgrounds.encoders.JSON.cache.scratch += v1; } } } } ++com.newgrounds.encoders.JSON.cache.pos; } function _array() { var v1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos); if (!com.newgrounds.encoders.JSON.cache.mode) { com.newgrounds.encoders.JSON.cache.mode = 'array'; ++com.newgrounds.encoders.JSON.cache.pos; v1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos); _setTargetValue([]); if (v1 != ']') { _addArrayKey(); } else { _useParent(); } return undefined; } else { if (v1 == ',') { _addArrayKey(); } else { if (v1 == ']') { _useParent(); } } } ++com.newgrounds.encoders.JSON.cache.pos; } function _boolean() { var v1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos); if (v1 == 't') { _setTargetValue(true); com.newgrounds.encoders.JSON.cache.pos += 3; } else { if (v1 == 'f') { _setTargetValue(false); com.newgrounds.encoders.JSON.cache.pos += 4; } else { throw 'Bool values must be true or false'; } } _useParent(); } function _null() { var v1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos); if (v1 == 'n') { _setTargetValue(null); com.newgrounds.encoders.JSON.cache.pos += 2; } else { throw 'Null values must be null'; } _useParent(); } function _string() { var v1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos); if (!com.newgrounds.encoders.JSON.cache.mode) { if (v1 != '"') { throw 'Strings must be wrapped in quotes ("")'; } com.newgrounds.encoders.JSON.cache.scratch = ''; com.newgrounds.encoders.JSON.cache.mode = 'string'; } else { if (v1 == '"') { _setTargetValue(com.newgrounds.encoders.JSON.cache.scratch); _useParent(); } else { if (v1 == '\\') { ++com.newgrounds.encoders.JSON.cache.pos; v1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos); switch (v1) { case 'n': v1 = '\n'; break; case 'r': v1 = '\n'; break; case 't': v1 = '\t'; break; case 'u': v1 = '\\' + v1; } } com.newgrounds.encoders.JSON.cache.scratch += v1; } } ++com.newgrounds.encoders.JSON.cache.pos; } function _number() { var v1 = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos); var v2 = '01234567890.-'; if (!com.newgrounds.encoders.JSON.cache.mode) { com.newgrounds.encoders.JSON.cache.mode = 'number'; com.newgrounds.encoders.JSON.cache.scratch = ''; } if (v2.indexOf(v1) < 0) { _setTargetValue(Number(com.newgrounds.encoders.JSON.cache.scratch)); _useParent(); } else { com.newgrounds.encoders.JSON.cache.scratch += v1; ++com.newgrounds.encoders.JSON.cache.pos; } } function _setTargetValue(newval) { var v2 = (_getParent()).obj; var v1 = com.newgrounds.encoders.JSON.cache.parents[com.newgrounds.encoders.JSON.cache.parents.length - 1]; v2[v1] = newval; } function _useParent() { com.newgrounds.encoders.JSON.cache.mode = com.newgrounds.encoders.JSON.getType((_getParent()).obj); com.newgrounds.encoders.JSON.cache.parents.pop(); } function _getParent() { var v2 = com.newgrounds.encoders.JSON.cache; var v1 = 0; while (v1 < com.newgrounds.encoders.JSON.cache.parents.length - 1) { v2 = v2[com.newgrounds.encoders.JSON.cache.parents[v1]]; ++v1; } return {'obj': v2, 'name': com.newgrounds.encoders.JSON.cache.parents[v1]}; } function _getCurrent() { var v2 = com.newgrounds.encoders.JSON.cache; var v1 = 0; while (v1 < com.newgrounds.encoders.JSON.cache.parents.length) { v2 = v2[com.newgrounds.encoders.JSON.cache.parents[v1]]; ++v1; } return {'obj': v2, 'name': com.newgrounds.encoders.JSON.cache.parents[v1]}; } function _addParent(child) { com.newgrounds.encoders.JSON.cache.parents.push(child); } function _addArrayKey() { var v1 = (_getCurrent()).obj.length; com.newgrounds.encoders.JSON.cache.parents.push(v1); com.newgrounds.encoders.JSON.cache.mode = null; } if (com.newgrounds.encoders.JSON.cache.pos >= com.newgrounds.encoders.JSON.cache.arg.length) { com.newgrounds.encoders.JSON.cache.complete = true; return undefined; } else { if (com.newgrounds.encoders.JSON.cache.mode) { ('_' + com.newgrounds.encoders.JSON.cache.mode)(); } else { var char = com.newgrounds.encoders.JSON.cache.arg.charAt(com.newgrounds.encoders.JSON.cache.pos); switch (char) { case '{': _object(); break; case '[': _array(); break; case '"': _string(); break; case 'n': _null(); break; case 't': _boolean(); break; case 'f': _boolean(); break; default: _number(); } } } }; v1.chunk_encoder = function () { if (com.newgrounds.encoders.JSON.cache.complete) { return undefined; } var v2 = com.newgrounds.encoders.JSON.getType(com.newgrounds.encoders.JSON.cache.target); switch (v2) { case 'number': com.newgrounds.encoders.JSON.cache.encoded += com.newgrounds.encoders.JSON.cache.target; com.newgrounds.encoders.JSON.getParent(); break; case 'string': com.newgrounds.encoders.JSON.cache.encoded += '"' + (com.newgrounds.encoders.JSON.cache.target.split('"')).join('\\"') + '"'; com.newgrounds.encoders.JSON.getParent(); break; case 'boolean': com.newgrounds.encoders.JSON.cache.encoded += (com.newgrounds.encoders.JSON.cache.target == true) ? 'true' : 'false'; com.newgrounds.encoders.JSON.getParent(); break; case 'null': com.newgrounds.encoders.JSON.cache.encoded += 'null'; com.newgrounds.encoders.JSON.getParent(); break; case 'array': if (com.newgrounds.encoders.JSON.cache.target.length < 1) { com.newgrounds.encoders.JSON.cache.encoded += ']'; com.newgrounds.encoders.JSON.getParent(); } else { com.newgrounds.encoders.JSON.cache.parents.push(com.newgrounds.encoders.JSON.cache.target); com.newgrounds.encoders.JSON.cache.target = com.newgrounds.encoders.JSON.cache.target[0]; if (com.newgrounds.encoders.JSON.getType(com.newgrounds.encoders.JSON.cache.target) == 'array') { com.newgrounds.encoders.JSON.cache.encoded += '['; } else { if (com.newgrounds.encoders.JSON.getType(com.newgrounds.encoders.JSON.cache.target) == 'object') { com.newgrounds.encoders.JSON.cache.encoded += '{'; } } } break; case 'object': for (var v1 in com.newgrounds.encoders.JSON.cache.target) { break; } if (v1 === undefined) { com.newgrounds.encoders.JSON.cache.encoded += '}'; com.newgrounds.encoders.JSON.getParent(); } else { com.newgrounds.encoders.JSON.cache.parents.push(com.newgrounds.encoders.JSON.cache.target); com.newgrounds.encoders.JSON.cache.target = com.newgrounds.encoders.JSON.cache.target[v1]; com.newgrounds.encoders.JSON.cache.encoded += '"' + (v1.split('"')).join('\\"') + '":'; if (com.newgrounds.encoders.JSON.getType(com.newgrounds.encoders.JSON.cache.target) == 'array') { com.newgrounds.encoders.JSON.cache.encoded += '['; } else { if (com.newgrounds.encoders.JSON.getType(com.newgrounds.encoders.JSON.cache.target) == 'object') { com.newgrounds.encoders.JSON.cache.encoded += '{'; } } } break; default: com.newgrounds.encoders.JSON.cache.encoded += 'null'; com.newgrounds.encoders.JSON.getParent(); } }; v1.getParent = function () { if (com.newgrounds.encoders.JSON.cache.parents.length > 0) { var v1 = com.newgrounds.encoders.JSON.cache.parents.pop(); if (com.newgrounds.encoders.JSON.getType(v1) == 'array') { v1.shift(); } else { for (var v3 in v1) { delete v1[v3]; break; } } if (com.newgrounds.encoders.JSON.getType(v1) == 'object' or com.newgrounds.encoders.JSON.getType(v1) == 'array') { for (var v2 in v1) { break; } if (v2 !== undefined) { com.newgrounds.encoders.JSON.cache.encoded += ','; } } com.newgrounds.encoders.JSON.cache.target = v1; } else { com.newgrounds.encoders.JSON.cache.complete = true; } }; v1.encode_chunks = 20000; v1.decode_chunks = 20000; v1.busy = false; ASSetPropFlags(com.newgrounds.encoders.JSON.prototype, null, 1); } #endinitclip } movieClip 60 __Packages.com.newgrounds.encoders.MD5 { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.encoders) { _global.com.newgrounds.encoders = new Object(); } if (!_global.com.newgrounds.encoders.MD5) { var v1 = function () {}; com.newgrounds.encoders.MD5 = v1; var v2 = v1.prototype; v1.calculate = function (src) { return com.newgrounds.encoders.MD5.hex_md5(src); }; v1.hex_md5 = function (src) { return com.newgrounds.encoders.MD5.binl2hex(com.newgrounds.encoders.MD5.core_md5(com.newgrounds.encoders.MD5.str2binl(src), src.length * 8)); }; v1.core_md5 = function (x, len) { x[len >> 5] |= 128 << len % 32; x[(len + 64 >>> 9 << 4) + 14] = len; var v4 = 1732584193; var v3 = -271733879; var v2 = -1732584194; var v1 = 271733878; var v5 = 0; while (v5 < x.length) { var v10 = v4; var v9 = v3; var v8 = v2; var v7 = v1; v4 = com.newgrounds.encoders.MD5.md5_ff(v4, v3, v2, v1, x[v5 + 0], 7, -680876936); v1 = com.newgrounds.encoders.MD5.md5_ff(v1, v4, v3, v2, x[v5 + 1], 12, -389564586); v2 = com.newgrounds.encoders.MD5.md5_ff(v2, v1, v4, v3, x[v5 + 2], 17, 606105819); v3 = com.newgrounds.encoders.MD5.md5_ff(v3, v2, v1, v4, x[v5 + 3], 22, -1044525330); v4 = com.newgrounds.encoders.MD5.md5_ff(v4, v3, v2, v1, x[v5 + 4], 7, -176418897); v1 = com.newgrounds.encoders.MD5.md5_ff(v1, v4, v3, v2, x[v5 + 5], 12, 1200080426); v2 = com.newgrounds.encoders.MD5.md5_ff(v2, v1, v4, v3, x[v5 + 6], 17, -1473231341); v3 = com.newgrounds.encoders.MD5.md5_ff(v3, v2, v1, v4, x[v5 + 7], 22, -45705983); v4 = com.newgrounds.encoders.MD5.md5_ff(v4, v3, v2, v1, x[v5 + 8], 7, 1770035416); v1 = com.newgrounds.encoders.MD5.md5_ff(v1, v4, v3, v2, x[v5 + 9], 12, -1958414417); v2 = com.newgrounds.encoders.MD5.md5_ff(v2, v1, v4, v3, x[v5 + 10], 17, -42063); v3 = com.newgrounds.encoders.MD5.md5_ff(v3, v2, v1, v4, x[v5 + 11], 22, -1990404162); v4 = com.newgrounds.encoders.MD5.md5_ff(v4, v3, v2, v1, x[v5 + 12], 7, 1804603682); v1 = com.newgrounds.encoders.MD5.md5_ff(v1, v4, v3, v2, x[v5 + 13], 12, -40341101); v2 = com.newgrounds.encoders.MD5.md5_ff(v2, v1, v4, v3, x[v5 + 14], 17, -1502002290); v3 = com.newgrounds.encoders.MD5.md5_ff(v3, v2, v1, v4, x[v5 + 15], 22, 1236535329); v4 = com.newgrounds.encoders.MD5.md5_gg(v4, v3, v2, v1, x[v5 + 1], 5, -165796510); v1 = com.newgrounds.encoders.MD5.md5_gg(v1, v4, v3, v2, x[v5 + 6], 9, -1069501632); v2 = com.newgrounds.encoders.MD5.md5_gg(v2, v1, v4, v3, x[v5 + 11], 14, 643717713); v3 = com.newgrounds.encoders.MD5.md5_gg(v3, v2, v1, v4, x[v5 + 0], 20, -373897302); v4 = com.newgrounds.encoders.MD5.md5_gg(v4, v3, v2, v1, x[v5 + 5], 5, -701558691); v1 = com.newgrounds.encoders.MD5.md5_gg(v1, v4, v3, v2, x[v5 + 10], 9, 38016083); v2 = com.newgrounds.encoders.MD5.md5_gg(v2, v1, v4, v3, x[v5 + 15], 14, -660478335); v3 = com.newgrounds.encoders.MD5.md5_gg(v3, v2, v1, v4, x[v5 + 4], 20, -405537848); v4 = com.newgrounds.encoders.MD5.md5_gg(v4, v3, v2, v1, x[v5 + 9], 5, 568446438); v1 = com.newgrounds.encoders.MD5.md5_gg(v1, v4, v3, v2, x[v5 + 14], 9, -1019803690); v2 = com.newgrounds.encoders.MD5.md5_gg(v2, v1, v4, v3, x[v5 + 3], 14, -187363961); v3 = com.newgrounds.encoders.MD5.md5_gg(v3, v2, v1, v4, x[v5 + 8], 20, 1163531501); v4 = com.newgrounds.encoders.MD5.md5_gg(v4, v3, v2, v1, x[v5 + 13], 5, -1444681467); v1 = com.newgrounds.encoders.MD5.md5_gg(v1, v4, v3, v2, x[v5 + 2], 9, -51403784); v2 = com.newgrounds.encoders.MD5.md5_gg(v2, v1, v4, v3, x[v5 + 7], 14, 1735328473); v3 = com.newgrounds.encoders.MD5.md5_gg(v3, v2, v1, v4, x[v5 + 12], 20, -1926607734); v4 = com.newgrounds.encoders.MD5.md5_hh(v4, v3, v2, v1, x[v5 + 5], 4, -378558); v1 = com.newgrounds.encoders.MD5.md5_hh(v1, v4, v3, v2, x[v5 + 8], 11, -2022574463); v2 = com.newgrounds.encoders.MD5.md5_hh(v2, v1, v4, v3, x[v5 + 11], 16, 1839030562); v3 = com.newgrounds.encoders.MD5.md5_hh(v3, v2, v1, v4, x[v5 + 14], 23, -35309556); v4 = com.newgrounds.encoders.MD5.md5_hh(v4, v3, v2, v1, x[v5 + 1], 4, -1530992060); v1 = com.newgrounds.encoders.MD5.md5_hh(v1, v4, v3, v2, x[v5 + 4], 11, 1272893353); v2 = com.newgrounds.encoders.MD5.md5_hh(v2, v1, v4, v3, x[v5 + 7], 16, -155497632); v3 = com.newgrounds.encoders.MD5.md5_hh(v3, v2, v1, v4, x[v5 + 10], 23, -1094730640); v4 = com.newgrounds.encoders.MD5.md5_hh(v4, v3, v2, v1, x[v5 + 13], 4, 681279174); v1 = com.newgrounds.encoders.MD5.md5_hh(v1, v4, v3, v2, x[v5 + 0], 11, -358537222); v2 = com.newgrounds.encoders.MD5.md5_hh(v2, v1, v4, v3, x[v5 + 3], 16, -722521979); v3 = com.newgrounds.encoders.MD5.md5_hh(v3, v2, v1, v4, x[v5 + 6], 23, 76029189); v4 = com.newgrounds.encoders.MD5.md5_hh(v4, v3, v2, v1, x[v5 + 9], 4, -640364487); v1 = com.newgrounds.encoders.MD5.md5_hh(v1, v4, v3, v2, x[v5 + 12], 11, -421815835); v2 = com.newgrounds.encoders.MD5.md5_hh(v2, v1, v4, v3, x[v5 + 15], 16, 530742520); v3 = com.newgrounds.encoders.MD5.md5_hh(v3, v2, v1, v4, x[v5 + 2], 23, -995338651); v4 = com.newgrounds.encoders.MD5.md5_ii(v4, v3, v2, v1, x[v5 + 0], 6, -198630844); v1 = com.newgrounds.encoders.MD5.md5_ii(v1, v4, v3, v2, x[v5 + 7], 10, 1126891415); v2 = com.newgrounds.encoders.MD5.md5_ii(v2, v1, v4, v3, x[v5 + 14], 15, -1416354905); v3 = com.newgrounds.encoders.MD5.md5_ii(v3, v2, v1, v4, x[v5 + 5], 21, -57434055); v4 = com.newgrounds.encoders.MD5.md5_ii(v4, v3, v2, v1, x[v5 + 12], 6, 1700485571); v1 = com.newgrounds.encoders.MD5.md5_ii(v1, v4, v3, v2, x[v5 + 3], 10, -1894986606); v2 = com.newgrounds.encoders.MD5.md5_ii(v2, v1, v4, v3, x[v5 + 10], 15, -1051523); v3 = com.newgrounds.encoders.MD5.md5_ii(v3, v2, v1, v4, x[v5 + 1], 21, -2054922799); v4 = com.newgrounds.encoders.MD5.md5_ii(v4, v3, v2, v1, x[v5 + 8], 6, 1873313359); v1 = com.newgrounds.encoders.MD5.md5_ii(v1, v4, v3, v2, x[v5 + 15], 10, -30611744); v2 = com.newgrounds.encoders.MD5.md5_ii(v2, v1, v4, v3, x[v5 + 6], 15, -1560198380); v3 = com.newgrounds.encoders.MD5.md5_ii(v3, v2, v1, v4, x[v5 + 13], 21, 1309151649); v4 = com.newgrounds.encoders.MD5.md5_ii(v4, v3, v2, v1, x[v5 + 4], 6, -145523070); v1 = com.newgrounds.encoders.MD5.md5_ii(v1, v4, v3, v2, x[v5 + 11], 10, -1120210379); v2 = com.newgrounds.encoders.MD5.md5_ii(v2, v1, v4, v3, x[v5 + 2], 15, 718787259); v3 = com.newgrounds.encoders.MD5.md5_ii(v3, v2, v1, v4, x[v5 + 9], 21, -343485551); v4 = com.newgrounds.encoders.MD5.safe_add(v4, v10); v3 = com.newgrounds.encoders.MD5.safe_add(v3, v9); v2 = com.newgrounds.encoders.MD5.safe_add(v2, v8); v1 = com.newgrounds.encoders.MD5.safe_add(v1, v7); v5 += 16; } return new Array(v4, v3, v2, v1); }; v1.md5_cmn = function (q, a, b, x, s, t) { return com.newgrounds.encoders.MD5.safe_add(com.newgrounds.encoders.MD5.bit_rol(com.newgrounds.encoders.MD5.safe_add(com.newgrounds.encoders.MD5.safe_add(a, q), com.newgrounds.encoders.MD5.safe_add(x, t)), s), b); }; v1.md5_ff = function (a, b, c, d, x, s, t) { return com.newgrounds.encoders.MD5.md5_cmn(b & c | ~b & d, a, b, x, s, t); }; v1.md5_gg = function (a, b, c, d, x, s, t) { return com.newgrounds.encoders.MD5.md5_cmn(b & d | c & ~d, a, b, x, s, t); }; v1.md5_hh = function (a, b, c, d, x, s, t) { return com.newgrounds.encoders.MD5.md5_cmn(b ^ c ^ d, a, b, x, s, t); }; v1.md5_ii = function (a, b, c, d, x, s, t) { return com.newgrounds.encoders.MD5.md5_cmn(c ^ (b | ~d), a, b, x, s, t); }; v1.bit_rol = function (num, cnt) { return num << cnt | num >>> 32 - cnt; }; v1.safe_add = function (x, y) { var v1 = (x & 65535) + (y & 65535); var v2 = (x >> 16) + (y >> 16) + (v1 >> 16); return v2 << 16 | v1 & 65535; }; v1.str2binl = function (str) { var v3 = new Array(); var v4 = 255; var v1 = 0; while (v1 < str.length * 8) { v3[v1 >> 5] |= (str.charCodeAt(v1 / 8) & v4) << v1 % 32; v1 += 8; } return v3; }; v1.binl2hex = function (binarray) { var v4 = new String(''); var v3 = new String('0123456789abcdef'); var v1 = 0; while (v1 < binarray.length * 4) { v4 += v3.charAt(binarray[v1 >> 2] >> (v1 % 4) * 8 + 4 & 15) + v3.charAt(binarray[v1 >> 2] >> (v1 % 4) * 8 & 15); ++v1; } return v4; }; ASSetPropFlags(com.newgrounds.encoders.MD5.prototype, null, 1); } #endinitclip } movieClip 61 __Packages.com.newgrounds.components.ScoreTable { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.components) { _global.com.newgrounds.components = new Object(); } if (!_global.com.newgrounds.components.ScoreTable) { var v1 = function () { if (!this.board_name) { throw '[ERROR] :: Score Board components require the \'Board Name\' parameter to be populated'; } var v2 = com.newgrounds.API.getScoreBoard(this.board_name); if (v2.exists()) { this.board = v2; } else { trace('[WARNING] :: Could not initialize the scoreboard for \'' + this.board_name + '\'.'); } this.period_select.period = this.period; }; com.newgrounds.components.ScoreTable = v1; var v2 = v1.prototype; v2.loadScores = function (num_results, p) { if (p) { this.period = p; } var v3 = 0; while (v3 < num_results) { var v2 = this['score_row_' + v3]; v2.gotoAndStop((v3 % 2 == 0) ? 1 : 2); v2.position = ''; v2.username = ''; v2.score = ''; ++v3; } var v4 = function (event, params) { params.target.scoresLoaded(params.num_results); }; this.board.loadScores(this.period, 1, num_results, v4, {'target': this, 'num_results': num_results}); }; v2.scoresLoaded = function (num_results) { var v2 = 0; while (v2 < num_results) { var v3 = this['score_row_' + v2]; if ((this.board.__get__scores())[v2]) { v3.position = (this.board.__get__scores())[v2].position + ':'; v3.username = (this.board.__get__scores())[v2].username; v3.score = (this.board.__get__scores())[v2].value; } else { v3.position = ''; v3.username = ''; v3.score = ''; } ++v2; } }; ASSetPropFlags(com.newgrounds.components.ScoreTable.prototype, null, 1); } #endinitclip } movieClip 104 __Packages.com.newgrounds.components.APIConnector { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.components) { _global.com.newgrounds.components = new Object(); } if (!_global.com.newgrounds.components.APIConnector) { var v1 = function () { super(); if (this.fake_session and com.newgrounds.API.getHost() == 'localhost') { com.newgrounds.API.setFakeSession(true); } if (this.movie_id && !com.newgrounds.API.isConnected()) { this.nextFrame(); this._visible = false; this.setGotoFrame('connect'); com.newgrounds.API.addDefaultEventListener(com.newgrounds.APIEvent.NEW_VERSION_AVAILABLE, this.onNewVersion, {'link': this}); com.newgrounds.API.addDefaultEventListener(com.newgrounds.APIEvent.HOST_BLOCKED, this.onBadHost, {'link': this}); com.newgrounds.API.addDefaultEventListener(com.newgrounds.APIEvent.MOVIE_CONNECTED, this.onConnected, {'link': this}); com.newgrounds.API.addDefaultEventListener(com.newgrounds.APIEvent.UNLOCK_MEDAL, this.doUnlock); if (com.newgrounds.API.isPublishedHost()) { this.debug = false; } if (this.movie_version) { com.newgrounds.API.setMovieVersion(this.movie_version); } if (!com.newgrounds.API.hasUserSession()) { var v3 = com.newgrounds.API.loadLocal('api_connector_data'); if (v3) { this.local_data = v3; } else { this.local_data = {'medals_unlocked': new Array()}; } } com.newgrounds.API.setPreload(true); com.newgrounds.API.connectMovie(this.movie_id, this.encryption_key, this.debug); } else { if (this.movie_id && com.newgrounds.API.isConnected()) { this._visible = false; this.setGotoFrame('done'); } } this.stop(); }; com.newgrounds.components.APIConnector = v1; com.newgrounds.components.APIConnector extends MovieClip; var v2 = v1.prototype; v2.doUnlock = function (e) { trace('DOING POPUP ROUTINE!'); var v5 = _root.attachMovie('NewgroundsAPIAsset_Medal_Popup', 'Asset_Medal_Popup_' + e.data.medal.getID(), _root.getNextHighestDepth()); v5._x = Stage.width; v5._y = Stage.height; v5.medal = e.data.medal; var v3 = com.newgrounds.API.getMedals(); var v2 = 0; while (v2 < v3.length) { if (v3[v2].getID() != e.data.medal.getID() && _root['medal_pop_' + v3[v2].getID()]) { _root['medal_pop_' + v3[v2].getID()]._y -= 70; } ++v2; } }; v2.onLoginError = function () { var v2 = _root.attachMovie('Asset_Login_Warning', 'Asset_Login_Warning', _root.getNextHighestDepth()); }; v2.onConnectionError = function () { var v3 = _root.attachMovie('Asset_Connection_Error', 'Asset_Connection_Error', _root.getNextHighestDepth()); this.setGotoFrame('done'); }; v2.onConnected = function (event, params) { if (event.success) { params.link.setGotoFrame('connected'); if (com.newgrounds.API.isPublishedHost() && com.newgrounds.API.hasPublisher() && !com.newgrounds.API.hasUserSession()) { params.link.onLoginError(); } if (!com.newgrounds.API.hasUserSession()) { params.link.populateLocalData(); } } else { params.link.onConnectionError(); } }; v2.onNewVersion = function () { var v2 = _root.attachMovie('NewgroundsAsset_New_Version_Available', 'NewgroundsAsset_New_Version_Available', _root.getNextHighestDepth()); v2.official_version_url = com.newgrounds.API.getOfficialVersionURL(); }; v2.onBadHost = function () { var v2 = _root.attachMovie('NewgroundsAsset_Illegal_Host', 'NewgroundsAsset_Illegal_Host', _root.getNextHighestDepth()); v2.official_version_url = com.newgrounds.API.getOfficialVersionURL(); }; v2.setGotoFrame = function (frame) { if (this.goto_frame == null) { this.goto_frame = frame; this.gotoframe_interval = setInterval(this, 'gotoFrameIfLoaded', 50); } }; v2.gotoFrameIfLoaded = function () { if (this.goto_frame != null && this._framesloaded == this._totalframes) { this._visible = true; this.gotoAndStop(this.goto_frame); this.goto_frame = null; clearInterval(this.gotoframe_interval); } }; v2.goto_frame = null; ASSetPropFlags(com.newgrounds.components.APIConnector.prototype, null, 1); } #endinitclip } movieClip 181 __Packages.com.newgrounds.components.FlashAd { #initclip if (!_global.com) { _global.com = new Object(); } if (!_global.com.newgrounds) { _global.com.newgrounds = new Object(); } if (!_global.com.newgrounds.components) { _global.com.newgrounds.components = new Object(); } if (!_global.com.newgrounds.components.FlashAd) { var v1 = function () { super(); this.background._visible = this.show_background; this._x = Math.round(this._x); this._y = Math.round(this._y); this._xscale = 100; this._yscale = 100; com.newgrounds.API.addEventListener(com.newgrounds.APIEvent.ADS_APPROVED, this.loadAd, {'link': this}); }; com.newgrounds.components.FlashAd = v1; com.newgrounds.components.FlashAd extends MovieClip; var v2 = v1.prototype; v2.onLoad = function () { com.newgrounds.API.attachFlashAd(this); }; v2.loadAd = function (event, params) { com.newgrounds.API.attachFlashAd(params.link); }; ASSetPropFlags(com.newgrounds.components.FlashAd.prototype, null, 1); } #endinitclip } frame 2 { function check_zone_available(this_zone) { if (this_zone == 1) { return true; return false; } if (this_zone <= 6) { var v3 = (this_zone - 2) * 6 + 1; var v5 = (this_zone - 1) * 6; var v2 = 0; var v4 = ['hard', 'med', 'easy']; i = v3; while (i <= v5) { if (_root['level_score_' + v4[_root.difficulty - 1]][i - 1] > -1) { v2 += 1; } ++i; } if (v2 == 6) { return true; } } return false; } function check_level_available(this_level) { if (this_level == 1) { return true; return false; } var v2 = ['hard', 'med', 'easy']; if (_root['level_score_' + v2[_root.difficulty - 1]][this_level - 2] > -1) { return true; } return false; } function check_zone_progress(this_zone) { var v4 = (this_zone - 1) * 6 + 1; var v5 = this_zone * 6; var v3 = 0; var v8 = 6; if (this_zone == 6) { v8 = 1; v5 = v4; } var v2 = false; var v9 = ['hard', 'med', 'easy']; i = v4; while (i <= v5) { if (_root.check_level_progress(i) == 1) { v2 = true; break; } else { v3 += _root.check_level_progress(i); } ++i; } if (this_zone == 6) { v3 *= 6; } if (v2 == true) { var v7 = 1; return v7; } if (v3 <= 15) { v7 = 2; return v7; } if (v3 <= 21) { v7 = 3; return v7; } if (v3 <= 23) { v7 = 4; return v7; } v7 = 5; return v7; } function default_selected_level() { var v3 = 0; var v4 = 1; var v2 = 1; while (v2 <= 6) { trace(v2); if (_root.check_zone_progress(v2) == 1) { v3 = v2; break; } ++v2; } trace('Lowest unfinished zone is ' + v2); _root.autoselect_zone = v3; if (_root.void_autoselect == true) { _root.autoselect_zone = 0; } } function check_level_progress(this_level) { var v3 = ['hard', 'med', 'easy']; var v2 = _root['level_score_' + v3[_root.difficulty - 1]][this_level - 1]; if (v2 < 0) { var v4 = 1; return v4; } if (v2 < 2000) { v4 = 2; return v4; } if (v2 < 2900) { v4 = 3; return v4; } v4 = 4; return v4; } function check_level_progress2(this_score) { if (this_score < 2000) { var v1 = 2; return v1; } if (this_score < 2900) { v1 = 3; return v1; } v1 = 4; return v1; } function record_score(this_score, this_stage) { if (_root.play_tutorial != true) { var v2 = ['hard', 'med', 'easy']; if (this_score > 3000) { this_score = 3000; } if (_root['level_score_' + v2[_root.difficulty - 1]][this_stage - 1] < this_score) { _root['level_score_' + v2[_root.difficulty - 1]][this_stage - 1] = this_score; } trace('Wrote Score! It was ' + this_score + ' on level ' + this_stage + ' and the array for difficulty ' + _root.difficulty + ' is now: ' + _root['level_score_' + v2[_root.difficulty - 1]]); } } function record_time(this_time, this_stage) { if (_root.play_tutorial != true) { if (_root.difficulty == 1) { this_time = _root.hard_timers[this_stage - 1] - this_time; } var v2 = ['hard', 'med', 'easy']; if (_root[v2[_root.difficulty - 1] + '_times'][this_stage - 1] > this_time or _root[v2[_root.difficulty - 1] + '_times'][this_stage - 1] == -1) { _root[v2[_root.difficulty - 1] + '_times'][this_stage - 1] = this_time; } trace('Wrote Time! It was ' + this_time + ' on level ' + this_stage + ' and the array for difficulty ' + _root.difficulty + ' is now: ' + _root[v2[_root.difficulty - 1] + '_times']); } } function process_level_time(this_time) { var v1 = Math.floor(this_time / 60); var v2 = this_time - v1 * 60; var v3 = '00:00'; v1 = String(v1); v2 = String(v2); if (v1.length == 1) { v1 = '0' + v1; } if (v2.length == 1) { v2 = '0' + v2; } v3 = v1 + ':' + v2; return v3; } function check_new_zone_opened(this_level) { if (this_level == 7 or this_level == 13 or this_level == 19 or this_level == 25 or this_level == 31) { var v3 = ['hard', 'med', 'easy']; if (_root.void_autoselect == true) { _root.autoselect_zone = 0; return false; } if (_root['level_score_' + v3[_root.difficulty - 1]][this_stage - 1] !== -1) { _root.autoselect_zone = (this_level - 1) / 6 + 1; trace('autoselect set to ' + _root.autoselect_zone); return true; return false; } _root.autoselect_zone = 0; } return false; } function save_game() { _root.savepath = SharedObject.getLocal('chingchong'); _root.savepath.data.first_time = false; _root.savepath.data.difficulty = _root.difficulty; _root.savepath.data.level_score_easy = _root.level_score_easy; _root.savepath.data.level_score_med = _root.level_score_med; _root.savepath.data.level_score_hard = _root.level_score_hard; _root.savepath.data.music_on = _root.music_on; _root.savepath.data.my_quality = _root.my_quality; _root.savepath.data.bg_quality = _root.bg_quality; _root.savepath.data.easy_times = _root.easy_times; _root.savepath.data.med_times = _root.med_times; _root.savepath.data.hard_times = _root.hard_times; _root.savepath.data.trophies_difficulty = _root.trophies_difficulty; _root.savepath.data.trophies_level = _root.trophies_level; _root.savepath.data.trophies_extra = _root.trophies_extra; _root.savepath.data.current_outfit = _root.current_outfit; _root.savepath.data.contestants_met = _root.contestants_met; _root.savepath.data.save_falls = _root.save_falls; _root.savepath.flush(); } function load_game() { _root.savepath = SharedObject.getLocal('chingchong'); if (_root.savepath.data.first_time == false) { _root.difficulty = _root.savepath.data.difficulty; _root.level_score_easy = _root.savepath.data.level_score_easy; _root.level_score_med = _root.savepath.data.level_score_med; _root.level_score_hard = _root.savepath.data.level_score_hard; _root.music_on = _root.savepath.data.music_on; _root.my_quality = _root.savepath.data.my_quality; _root.bg_quality = _root.savepath.data.bg_quality; _root.easy_times = _root.savepath.data.easy_times; _root.med_times = _root.savepath.data.med_times; _root.hard_times = _root.savepath.data.hard_times; _root.trophies_difficulty = _root.savepath.data.trophies_difficulty; _root.trophies_level = _root.savepath.data.trophies_level; _root.trophies_extra = _root.savepath.data.trophies_extra; _root.current_outfit = _root.savepath.data.current_outfit; _root.contestants_met = _root.savepath.data.contestants_met; _root.save_falls = _root.savepath.data.save_falls; _root.quality_changer(_root.my_quality); } else { _root.default_loadout(); } } function default_loadout() { _root.difficulty = 3; _root.play_tutorial = true; _root.autoselect_zone = 0; _root.level_score_easy = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; _root.level_score_med = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; _root.level_score_hard = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; _root.music_on = true; _root.my_quality = 'med'; _root.bg_quality = 'high'; _root.easy_times = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; _root.med_times = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; _root.hard_times = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; _root.trophies_difficulty = [false, false, false]; _root.trophies_level = [false, false, false, false, false, false]; _root.trophies_extra = [false, false, false, false, false, false]; _root.current_outfit = [1, 1]; _root.contestants_met = [false, false, false, false, false]; _root.save_falls = 0; _root.save_game(); } function quality_changer(this_quality) { if (this_quality == 'high') { _root._quality = 'HIGH'; } if (this_quality == 'med') { _root._quality = 'MEDIUM'; } if (this_quality == 'low') { _root._quality = 'LOW'; } trace('Attempted to change quality to ' + this_quality + ', and the actual quality of the flash is ' + _root._quality); } var world = 32; var difficulty = 3; var score = new Array(); var play_tutorial = false; var autoselect_zone = 0; var level_score_easy = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; var level_score_med = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; var level_score_hard = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; var music_on = true; var my_quality = 'high'; var bg_quality = 'high'; var easy_times = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; var med_times = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; var hard_times = [-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1]; var trophies_difficulty = [false, false, false]; var trophies_level = [false, false, false, false, false, false]; var trophies_extra = [false, false, false, false, false, false]; var current_outfit = [1, 1]; var contestants_met = [false, false, false, false, false]; var save_falls = 0; var hard_timers = [57, 30, 30, 36, 25, 21, 28, 20, 15, 40, 38, 36, 56, 52, 32, 29, 74, 23, 40, 54, 90, 115, 27, 47, 55, 41, 64, 101, 50, 80, 85]; var admin_mode = false; var void_autoselect = true; } frame 3 { this.quality_changer(my_quality); } // unknown tag 88 length 143 movieClip 349 { frame 1 { stop(); } } frame 4 { stop(); } movieClip 355 { } movieClip 364 { } movieClip 367 { frame 344 { gotoAndPlay(1); } } movieClip 373 { } // unknown tag 88 length 153 button 377 { on (press) { _root.nextFrame(); } } movieClip 404 { } movieClip 407 { } movieClip 408 { } movieClip 414 { } movieClip 416 { } movieClip 417 { frame 1 { function onPress() { timer = 600; } function onEnterFrame() { ++timer; if (timer >= 600) { if (_currentframe == _totalframes) { gotoAndStop(1); } else { nextFrame(); } timer = 0; } } var timer = 570; stop(); } } movieClip 422 { } movieClip 424 { } movieClip 429 { } movieClip 430 { } // unknown tag 88 length 64 movieClip 435 { } movieClip 439 { } movieClip 441 { } movieClip 443 { } movieClip 445 { } movieClip 447 { } movieClip 448 { } movieClip 450 { } movieClip 451 { } movieClip 453 { } movieClip 454 { } movieClip 457 { } movieClip 458 { } movieClip 460 { } movieClip 462 { } movieClip 465 { } movieClip 466 { } movieClip 487 { } movieClip 491 { } movieClip 498 { } movieClip 499 { } movieClip 501 { } movieClip 502 { frame 24 { stop(); } } movieClip 505 { } movieClip 506 { } movieClip 509 { } movieClip 538 { frame 38 { stop(); } } movieClip 542 { frame 10 { gotoAndPlay(1); } } movieClip 545 { } movieClip 558 { } movieClip 560 { } movieClip 562 { } movieClip 564 { } movieClip 566 { } movieClip 626 { frame 70 { stop(); } } movieClip 628 { } movieClip 630 { } movieClip 631 { } movieClip 672 { frame 119 { _quality = 'medium'; } instance hit_springboard of movieClip 373 { onClipEvent (enterFrame) { theAnyKey = Key.getCode(); if (Key.isDown(27) or Key.isDown(8) or Key.isDown(83)) { _root.nextFrame(); } } } frame 2693 { _root.nextFrame(); } } frame 5 { stop(); } // unknown tag 88 length 138 button 678 { on (press) { nextFrame(); } } button 680 { on (press) { _root.difficulty = 1; } } button 681 { on (press) { _root.difficulty = 2; } } button 682 { on (press) { _root.difficulty = 3; } } movieClip 689 { } movieClip 692 { } movieClip 693 { } movieClip 695 { } movieClip 696 { } movieClip 697 { } movieClip 699 { } movieClip 702 { } movieClip 703 { } movieClip 725 { } movieClip 727 { } movieClip 729 { } movieClip 732 { } movieClip 734 { } movieClip 736 { } movieClip 739 { } movieClip 741 { } movieClip 743 { } movieClip 745 { } movieClip 759 { } movieClip 782 { } movieClip 784 { } movieClip 795 { frame 2019 { stop(); } } button 797 { on (press) { play(); } } button 798 { on (press) { getURL('http://www.theswain.com/', 'blank'); } } button 799 { on (press) { getURL('http://www.newgrounds.com/', 'blank'); } } movieClip 824 { } movieClip 826 { } movieClip 828 { } movieClip 831 { } movieClip 834 { } movieClip 837 { } movieClip 839 { } movieClip 842 { } movieClip 844 { } movieClip 846 { } movieClip 848 { } movieClip 849 { } movieClip 850 { } movieClip 854 { } movieClip 856 { } movieClip 860 { } movieClip 864 { } movieClip 867 { } movieClip 871 { } movieClip 874 { } movieClip 880 { } movieClip 884 { } movieClip 885 { } movieClip 886 { } movieClip 888 { } movieClip 892 { } movieClip 894 { } movieClip 896 { } movieClip 906 { } movieClip 913 { } movieClip 920 { } movieClip 934 { } movieClip 935 { } movieClip 936 { } movieClip 937 { } movieClip 939 { } button 941 { on (press) { _parent.highscores_display.gotoAndStop(2); } } button 945 { on (press) { _parent.highscores_display.gotoAndStop(3); } } button 949 { on (press) { _parent.highscores_display.gotoAndStop(4); } } movieClip 950 { frame 1 { _parent.mode_selected.gotoAndPlay('selected2'); } frame 1 { stop(); } frame 2 { _parent.mode_selected.gotoAndPlay('selected2'); } frame 3 { _parent.mode_selected.gotoAndPlay('selected2'); } frame 4 { _parent.mode_selected.gotoAndPlay('selected2'); } } movieClip 954 { } movieClip 955 { } movieClip 956 { frame 283 { gotoAndPlay(1); } } movieClip 957 { } button 963 { on (rollOver) { if (locked != true) { this.levelhead.gotoAndStop(1); _root.difficulty = 3; _root.play_tutorial = true; } } on (press) { if (locked != true) { _root.difficulty = 2; _root.play_tutorial = true; _root.gametransition.gotoAndPlay('gotolevelselect'); mode_selected.gotoAndPlay('selected'); locked = true; } } } button 964 { on (rollOver) { if (locked != true) { this.levelhead.gotoAndStop(2); _root.difficulty = 3; _root.play_tutorial = false; } } on (press) { if (locked != true) { _root.difficulty = 3; _root.play_tutorial = false; _root.gametransition.gotoAndPlay('gotolevelselect'); mode_selected.gotoAndPlay('selected'); locked = true; } } } button 965 { on (rollOver) { if (locked != true) { this.levelhead.gotoAndStop(3); _root.difficulty = 2; _root.play_tutorial = false; } } on (press) { if (locked != true) { _root.difficulty = 2; _root.play_tutorial = false; _root.gametransition.gotoAndPlay('gotolevelselect'); mode_selected.gotoAndPlay('selected'); locked = true; } } } button 966 { on (rollOver) { if (locked != true) { this.levelhead.gotoAndStop(4); _root.difficulty = 1; _root.play_tutorial = false; } } on (press) { if (locked != true) { _root.difficulty = 1; _root.play_tutorial = false; _root.gametransition.gotoAndPlay('gotolevelselect'); mode_selected.gotoAndPlay('selected'); locked = true; } } } button 967 { on (press) { if (locked != true) { mode_selected.gotoAndPlay('change2'); gotoAndPlay('options'); } } } button 968 { on (press) { if (locked != true) { mode_selected.gotoAndPlay('change2'); gotoAndPlay('trophies'); } } } // unknown tag 88 length 101 movieClip 975 { } button 977 { on (press) { this.gotoAndStop(1); } } movieClip 978 { frame 1 { stop(); } instance dgjgdjdg of movieClip 103 Score Board (NewgroundsAPI) { onClipEvent (construct) { board_name = 'Total Time (Easy)'; period = 'Today'; } } instance fjfkjkk6re of movieClip 103 Score Board (NewgroundsAPI) { onClipEvent (construct) { board_name = 'Total Time (Medium)'; period = 'Today'; } } instance dtjjtdtjdtj of movieClip 103 Score Board (NewgroundsAPI) { onClipEvent (construct) { board_name = 'Total Time (Hard)'; period = 'Today'; } } } // unknown tag 88 length 153 movieClip 984 { frame 2 { stop(); } frame 68 { gotoAndPlay(1); } frame 102 { gotoAndPlay(1); } frame 131 { gotoAndPlay(1); } frame 154 { gotoAndPlay(1); } } // unknown tag 88 length 153 movieClip 994 { } movieClip 1001 { } movieClip 1002 { } movieClip 1009 { frame 1 { stop(); } frame 1 { _parent.mode_selected.gotoAndPlay('selected2'); } instance of movieClip 994 { onClipEvent (load) { if (_root.music_on == true) { gotoAndStop(1); } else { gotoAndStop(2); } } onClipEvent (enterFrame) { if (_root.music_on == true) { gotoAndStop(1); } else { gotoAndStop(2); } } } instance of movieClip 1001 { onClipEvent (load) { if (_root.my_quality == 'high') { gotoAndStop(1); } else { if (_root.my_quality == 'med') { gotoAndStop(2); } else { gotoAndStop(3); } } } onClipEvent (enterFrame) { if (_root.my_quality == 'high') { gotoAndStop(1); } else { if (_root.my_quality == 'med') { gotoAndStop(2); } else { gotoAndStop(3); } } } } instance of movieClip 1002 { onClipEvent (load) { if (_root.bg_quality == 'high') { gotoAndStop(1); } else { gotoAndStop(2); } } onClipEvent (enterFrame) { if (_root.bg_quality == 'high') { gotoAndStop(1); } else { gotoAndStop(2); } } } frame 2 { _parent.mode_selected.gotoAndPlay('selected2'); } frame 3 { _parent.mode_selected.gotoAndPlay('selected2'); } } button 1011 { on (rollOver) { if (locked != true) { this.levelhead.gotoAndStop(1); this.levelhead.menu_selection = 1; } } on (press) { if (locked != true) { _root.music_on = true; _root.music_box.play_music(1, false); mode_selected.gotoAndPlay('change'); _root.save_game(); } } } button 1012 { on (rollOver) { if (locked != true) { this.levelhead.gotoAndStop(1); this.levelhead.menu_selection = 1; } } on (press) { if (locked != true) { _root.music_on = false; _root.music_box.hard_stop(); mode_selected.gotoAndPlay('change'); _root.save_game(); } } } button 1013 { on (rollOver) { if (locked != true) { this.levelhead.gotoAndStop(3); this.levelhead.menu_selection = 3; } } on (press) { if (locked != true) { _root.bg_quality = 'high'; mode_selected.gotoAndPlay('change'); _root.save_game(); } } } button 1014 { on (rollOver) { if (locked != true) { this.levelhead.gotoAndStop(3); this.levelhead.menu_selection = 3; } } on (press) { if (locked != true) { _root.bg_quality = 'low'; mode_selected.gotoAndPlay('change'); _root.save_game(); } } } button 1015 { on (rollOver) { if (locked != true) { this.levelhead.gotoAndStop(2); this.levelhead.menu_selection = 2; } } on (press) { if (locked != true) { _root.my_quality = 'med'; _root.quality_changer(_root.my_quality); mode_selected.gotoAndPlay('change'); _root.save_game(); } } } button 1016 { on (rollOver) { if (locked != true) { this.levelhead.gotoAndStop(2); this.levelhead.menu_selection = 2; } } on (press) { if (locked != true) { _root.my_quality = 'low'; _root.quality_changer(_root.my_quality); mode_selected.gotoAndPlay('change'); _root.save_game(); } } } button 1017 { on (rollOver) { if (locked != true) { this.levelhead.gotoAndStop(2); this.levelhead.menu_selection = 2; } } on (press) { if (locked != true) { _root.my_quality = 'high'; _root.quality_changer(_root.my_quality); mode_selected.gotoAndPlay('change'); _root.save_game(); } } } button 1018 { on (press) { if (locked != true) { mode_selected.gotoAndPlay('change2'); gotoAndPlay('difficulty'); } } } movieClip 1027 { } // unknown tag 88 length 35 movieClip 1031 { } movieClip 1032 { frame 1 { stop(); if (_root.trophies_level[5] == true) { gotoAndStop(2); } } } movieClip 1036 { } movieClip 1037 { frame 1 { stop(); if (_root.trophies_difficulty[1] == true) { gotoAndStop(2); } } } movieClip 1041 { } movieClip 1042 { frame 1 { stop(); if (_root.trophies_difficulty[2] == true) { gotoAndStop(2); } } } movieClip 1044 { } movieClip 1047 { } movieClip 1048 { frame 1 { _root.current_outfit[0] = 1; stop(); } frame 2 { if (helm2._currentframe == 2) { _root.current_outfit[0] = 2; } else { nextFrame(); } } frame 3 { if (helm3._currentframe == 2) { _root.current_outfit[0] = 4; } else { nextFrame(); }




http://swfchan.com/23/111085/info.shtml
Created: 13/3 -2019 10:37:12 Last modified: 13/3 -2019 10:37:12 Server time: 22/12 -2024 18:40:20