[Tools][Expand/Collapse All]Note that automatic extraction of ActionScript 3 is still pretty much unsupported by swfchan. AS1/AS2 works okay most of the time.Frame 1 (769 B)
function toggleQuality() {
trace((Key.getCode() + " == ") + 81);
if (Key.getCode() == 81) {
trace("qualiteh.");
var _local2 = _root._quality;
_local2 = _local2.toLowerCase();
switch (_local2) {
case "high" :
trace("high to medium");
_root._quality = "medium";
break;
case "medium" :
trace("medium to low");
_root._quality = "low";
break;
case "low" :
trace("low to high");
_root._quality = "high";
}
}
}
NewgroundsAPI.connectMovie(6024);
stopAllSounds();
_quality = "high";
_root.API_Settings = {movie_id:4940, enc_key:"f3473ad14a998ca13d2e948da1b64b69", debug_mode:false, movie_version:""};
var listener = new Object();
listener.onKeyDown = toggleQuality;
Key.addListener(listener);
Frame 4 (8 B)
stop();
Frame 81 (32.06 KiB) ● ● ● ●
function updateMedalList() {
medal_list = com.Newgrounds.NewgroundsAPI.getMedals();
trace(medal_list);
}
function hasMedal(n) {
for (i in medal_list) {
if (medal_list[i].medal_name == n) {
return(medal_list[i].medal_unlocked);
}
}
}
function fadein(i, s) {
vol = s.getVolume();
s.setVolume(vol + 1);
if (s.getVolume() > 100) {
s.setVolume(100);
clearInterval(i);
}
}
function fadeout(i, s) {
trace("fadin' out");
vol = s.getVolume();
s.setVolume(vol - 1);
if (s.getVolume() < 0) {
s.setVolume(0);
trace(i);
clearInterval(i);
}
}
function createObstacle(obst) {
mc = omc.attachMovie(obst, "o" + (obs++), omc.getNextHighestDepth());
obstacleInit(mc);
weg.push(mc);
mc.i = weg.length - 1;
}
function createTerrain(place) {
if (place == "bottom") {
if (((ts > 3) && (random(maxChance) < chance)) && (bodeee == "flat")) {
bodeee = terrains[random(terrains.length)];
mc = terrain.attachMovie(bodeee, "t" + (ts++), terrain.getNextHighestDepth());
} else {
bodeee = "flat";
mc = terrain.attachMovie(bodeee, "t" + (ts++), terrain.getNextHighestDepth());
}
if (prevBody == null) {
mc._x = 0;
} else {
mc._x = (prevBody._x + prevBody._width) - 1;
}
mc._y = bottom;
mc.sprite._xscale = ((random(2) == 0) ? 100 : -100);
mc.recursed = false;
mc.placement = "bottom";
mc.onEnterFrame = terrainLoop;
} else if (place == "top") {
if (((ts > 3) && (random(maxChance) < topChance)) && (bodeee == "flat")) {
bodeee = terrains[random(terrains.length)];
mc = tterrain.attachMovie(bodeee, "tt" + (ts++), tterrain.getNextHighestDepth());
} else {
bodeee = "flat";
mc = tterrain.attachMovie(bodeee, "tt" + (ts++), tterrain.getNextHighestDepth());
}
if (topPrevBody == null) {
mc._x = 0;
} else {
mc._x = (topPrevBody._x + topPrevBody._width) - 1;
}
mc._y = mc.sprite.hit._height;
mc.sprite._yscale = -100;
mc.sprite._xscale = ((random(2) == 0) ? 100 : -100);
mc.recursed = false;
mc.placement = "top";
mc.onEnterFrame = terrainLoop;
}
}
function createSwarm(obst) {
baseyy = Stage.height / 2;
i = 0;
while (i < (minSwarm + random(maxSwarm - minSwarm))) {
ex = (right + 100) + (random(xDistribute) + random(xDistribute));
why = baseyy + (random(yDistribute) - random(yDistribute));
mc = omc.attachMovie(obst, "o" + (obs++), omc.getNextHighestDepth());
weg.push(mc);
mc.i = weg.length - 1;
swarmInit(mc, ex, why);
i++;
}
}
function createFish() {
baseyy = Stage.height / 2;
i = 0;
while (i < (fish_minSwarm + random(fish_maxSwarm - fish_minSwarm))) {
ex = (right + 100) + (random(fish_xDistr) + random(fish_xDistr));
why = baseyy + (random(fish_yDistr) - random(fish_yDistr));
mc = omc.attachMovie("fish", "o" + (obs++), omc.getNextHighestDepth());
weg.push(mc);
mc.i = weg.length - 1;
mc.asdf = why;
fishInit(mc, ex, why);
i++;
}
}
function createBlackTampon() {
mc = omc.attachMovie("blacktampon", "o" + (obs++), omc.getNextHighestDepth());
blackTamponInit(mc);
weg.push(mc);
mc.i = weg.length - 1;
}
function createBft() {
wy = random(bottom);
ex = right + 100;
mc = omc.attachMovie("bft", "o" + (obs++), omc.getNextHighestDepth());
weg.push(mc);
mc.i = weg.length - 1;
bftInit(mc, ex, wy);
}
function movePlayer() {
vx = vx + ((control * accel) * (Key.isDown(39) - Key.isDown(37)));
vy = vy + ((control * accel) * (Key.isDown(40) - Key.isDown(38)));
rotSpeed = rotSpeed + ((vx + vy) * rotAccel);
if (vx > ms) {
vx = ms;
} else if (vx < (-ms)) {
vx = -ms;
}
if (vy > ms) {
vy = ms;
} else if (vy < (-ms)) {
vy = -ms;
}
player._y = player._y + (vy + (Math.cos(cycle) * bobrange));
player._x = player._x + vx;
if (player._rotation < minAngle) {
rotSpeed = minAngle;
player._rotation = minAngle;
} else if (player._rotation > maxAngle) {
rotSpeed = maxAngle;
player._rotation = maxAngle;
} else if ((player._rotation >= minAngle) && (player._rotation <= maxAngle)) {
player._rotation = rotSpeed;
}
if (!movementKeysDown().h) {
vx = vx * decay;
}
if (!movementKeysDown().v) {
vy = vy * decay;
}
if ((!movementKeysDown().h) && (!movementKeysDown().v)) {
rotSpeed = rotSpeed * rotDecay;
}
cycle = cycle + incr;
oldy = player._y;
oldx = player._x;
}
function movementKeysDown() {
if (control) {
return({h:Key.isDown(39) || (Key.isDown(37)), v:Key.isDown(38) || (Key.isDown(40))});
}
return(0);
}
function increaseScore(num) {
_root.score = _root.score + num;
scoremc.gotoAndPlay("anim");
}
function hurt() {
if (lives > 0) {
lives--;
increaseCharge(Math.round(-charge));
updateLives();
} else {
setTimeout(lose, ((1 + random(8)) / 40) * 1000);
}
canMove = false;
if (!boss_dying) {
canBeHurt = false;
}
canShoot = false;
chargemc.chargebarmain.cbp.gotoAndStop(1);
shotType = 0;
player.sprite.gotoAndStop("dead");
}
function setBlink() {
player._x = initial.x;
player._y = initial.y;
player._rotation = initial.rot;
oldx = player._x;
oldy = player._y;
vx = 0;
vy = 0;
canMove = true;
if (!boss_dying) {
canShoot = true;
}
blinkedFaster = false;
b = setInterval(blink, blinkTimer);
}
function blink() {
player._visible = !player._visible;
blinked++;
if (((blinked / blinkMax) >= 0.3) && (!blinkedFaster)) {
clearInterval(b);
blinkedFaster = true;
b = setInterval(blink, fastBlinkTimer);
}
if (blinked >= blinkMax) {
blinked = 0;
blinkedFaster = false;
clearInterval(b);
canBeHurt = true;
canShoot = true;
canMove = true;
player._visible = true;
}
}
function createBullet(x, y, vx, vy) {
mc = smc.attachMovie("shotl1", "s" + shots, smc.getNextHighestDepth());
mc._x = player._x + x;
mc._y = player._y + y;
mc.vx = vx;
mc.vy = vy;
mc.onEnterFrame = shotLoop;
}
function shoot() {
switch (shotType) {
case 0 :
createBullet(player._width / 4, 0, shotSpeed, Math.sin((player._rotation * Math.PI) / 180) * shotSpeed);
return;
case 1 :
createBullet(player._width / 4, (-player._height) / 4, shotSpeed, Math.sin((player._rotation * Math.PI) / 180) * shotSpeed);
createBullet(player._width / 4, player._height / 4, shotSpeed, Math.sin((player._rotation * Math.PI) / 180) * shotSpeed);
return;
case 2 :
createBullet(player._width / 4, (-player._height) / 8, shotSpeed, Math.sin(((player._rotation - 15) * Math.PI) / 180) * shotSpeed);
createBullet(player._width / 4, 0, shotSpeed, Math.sin((player._rotation * Math.PI) / 180) * shotSpeed);
createBullet(player._width / 4, player._height / 8, shotSpeed, Math.sin(((player._rotation + 15) * Math.PI) / 180) * shotSpeed);
return;
case 3 :
createBullet(player._width / 4, (-player._height) / 8, shotSpeed, Math.sin(((player._rotation - 15) * Math.PI) / 180) * shotSpeed);
createBullet(player._width / 4, (-player._height) / 4, shotSpeed, Math.sin((player._rotation * Math.PI) / 180) * shotSpeed);
createBullet(player._width / 4, player._height / 4, shotSpeed, Math.sin((player._rotation * Math.PI) / 180) * shotSpeed);
createBullet(player._width / 4, player._height / 8, shotSpeed, Math.sin(((player._rotation + 15) * Math.PI) / 180) * shotSpeed);
}
}
function shotLoop() {
if (!paused) {
a = 0;
while (a < mi) {
i = 0;
while (i < _root.weg.length) {
mc = _root.weg[i];
if ((mc.hitTest(this._x, this._y, true) && (!mc.dead)) && (!this.dead)) {
_root.increaseScore(shootScore);
_root.obstacleDie(mc);
_root.increaseCharge(mc.charge);
removeMovieClip(this);
}
i++;
}
this._x = this._x + (this.vx / mi);
this._y = this._y + (this.vy / mi);
a++;
}
if ((((this._x > (right + this._width)) || (this._x < (left - this._width))) || (this._y > (bottom + this._height))) || (this._y < (top - this._height))) {
removeMovieClip(this);
}
}
}
function updateChargeBar() {
if (charge < 200) {
chargemc.chargebarmain.cbp._xscale = ((charge - getChargeDealio(-1)) / (getChargeDealio(0) - getChargeDealio(-1))) * 100;
} else {
chargemc.chargebarmain.cbp._xscale = 100;
}
}
function getChargeDealio(offset) {
if ((shotType + offset) < 0) {
return(0);
}
if ((shotType + offset) > (chargeThresholds.length - 1)) {
return(chargeThresholds[chargeThresholds.length - 1]);
}
if (((shotType + offset) >= 0) && ((shotType + offset) <= (chargeThresholds.length - 1))) {
return(chargeThresholds[shotType + offset]);
}
}
function increaseCharge(num) {
charge = charge + num;
if (charge > chargeMax) {
charge = chargeMax;
} else if (charge < 0) {
charge = 0;
}
if (charge > getChargeDealio(0)) {
shotType++;
chargemc.chargebarmain.cbp.nextFrame();
}
if (charge >= 200) {
shotType = 3;
charge = 200;
chargemc.chargebarmain.cbp.nextFrame();
}
updateChargeBar();
}
function lose() {
paused = true;
var _local4 = new flash.filters.BlurFilter(5, 5, 3);
var _local3 = new flash.display.BitmapData(Stage.width, Stage.height, false);
var _local2 = _root.createEmptyMovieClip("bmpmcc", 150);
_local2.attachBitmap(_local3, _local2.getNextHighestDepth());
_local3.draw(_root);
_local2.filters = [_local4];
gameovermc.swapDepths(_root.getNextHighestDepth());
gameovermc.play();
fadedatshitnigga = setInterval(fadeout, 10, fadedatshitnigga, song);
gameoverm.start(0, 0);
yeahthistoo = setInterval(fadein, 50, yeahthistoo, gameoverm);
}
function bgLoop() {
if (!_root.paused) {
this._x = this._x - bgspeed;
if ((this._x < (Stage.width - this._width)) && (!this.recursed)) {
createBg(this._x + this._width);
this.recursed = true;
}
if (this._x < (-this._width)) {
removeMovieClip(this);
}
}
}
function createBg(ex) {
mc = bgh.attachMovie("bg", "bgg" + numbgs, bgh.getNextHighestDepth());
mc._x = ex;
mc.recursed = false;
mc.bgmc._xscale = 100 * bgwm;
bgwm = -bgwm;
mc.onEnterFrame = bgLoop;
}
function obstacleInit(mc) {
mc._x = right + mc._width;
mc._y = random(bottom);
mc.vx = getRandomObstacleSpeed();
mc.dead = false;
mc.charge = obstacleCharge;
mc.health = obstacleHealth;
mc.onEnterFrame = obstacleLoop;
}
function swarmInit(mc, ex, wy) {
mc._x = ex;
mc._y = wy;
mc.health = swarmHealth;
mc.cycle = Math.random() * (Math.PI*2);
mc._xscale = (mc._yscale = minSwarmSize + random(maxSwarmSize - minSwarmSize));
mc.vx = minSwarmSpeed + random(maxSwarmSpeed - minSwarmSpeed);
mc.yRange = minSwarmYRange + random(maxSwarmYRange - minSwarmYRange);
mc.dead = false;
mc.charge = swarmCharge;
mc.onEnterFrame = swarmLoop;
}
function fishInit(mc, ex, wy) {
mc._x = ex;
mc._y = wy;
mc._xscale = (mc._yscale = 60);
mc.asdf = wy;
mc.cycle = Math.random() * (Math.PI*2);
mc.vx = fish_minSpeed + random(fish_maxSpeed - fish_minSpeed);
mc.yr = fish_minYRange + random(fish_maxYRange - fish_minYRange);
mc.xr = fish_minXRange + random(fish_maxXRange - fish_minXRange);
mc.dead = false;
mc.health = fish_health;
mc.charge = fish_charge;
mc.onEnterFrame = fishLoop;
}
function bftInit(mc, ex, wy) {
mc._x = ex;
mc._y = wy;
mc.vx = bft_minSpeed + random(bft_maxSpeed - bft_minSpeed);
mc.dead = false;
mc.health = bft_health;
mc.charge = bft_charge;
mc.onEnterFrame = bftLoop;
}
function blackTamponInit(mc) {
mc._x = right + mc._width;
mc._y = random(bottom);
mc.vx = getRandomObstacleSpeed();
mc.dead = false;
mc.charge = obstacleCharge;
mc.health = obstacleHealth;
mc.timer = btbt / 2;
mc.onEnterFrame = blackTamponLoop;
}
function getRandomObstacleSpeed() {
spd = omis + random(omas - omis);
return(spd);
}
function updateLives() {
if (lives >= 0) {
livescounter.wlt.text = lives;
livescounter.ylt.text = lives;
}
}
function obstacleDie(mc) {
mc.health--;
if (mc.health <= 0) {
mc.dead = true;
newsplice(mc.i);
}
mc.gotoAndPlay("hurt");
}
function newsplice(i) {
var _local2 = weg[i];
weg[i] = weg[weg.length - 1];
weg[weg.length - 1] = _local2;
weg[i].i = i;
weg.pop();
}
function obstacleLoop() {
if (!_root.paused) {
this._x = this._x - this.vx;
if (this._x < (left - this._width)) {
_root.dodged++;
newsplice(this.i);
removeMovieClip(this);
} else if ((this.sprite.hit.hitTest(_root.player.hit) && (_root.canBeHurt)) && (!this.dead)) {
_root.hurt();
obstacleDie(this);
}
}
}
function swarmLoop() {
if (!_root.paused) {
this._x = this._x - this.vx;
this._y = this._y + (Math.sin((this.cycle = this.cycle + swarmCycleIncrease)) * this.yRange);
if (this._x < (left - this._width)) {
newsplice(this.i);
_root.dodged++;
removeMovieClip(this);
} else if ((this.sprite.hit.hitTest(_root.player.hit) && (_root.canBeHurt)) && (!this.dead)) {
_root.hurt();
obstacleDie(this);
}
}
}
function fishLoop() {
if (!_root.paused) {
this._x = this._x + (Math.cos(this.cycle) * this.xr);
this._x = this._x - this.vx;
this._y = this.asdf + (Math.sin(this.cycle * 2) * this.yr);
this.cycle = this.cycle + fish_cycleIncr;
if (this._x < (left - this._width)) {
newsplice(this.i);
_root.dodged++;
removeMovieClip(this);
} else if ((this.hitTest(_root.player.hit) && (_root.canBeHurt)) && (!this.dead)) {
_root.hurt();
obstacleDie(this);
}
}
}
function bftLoop() {
if (!_root.paused) {
this._x = this._x - this.vx;
this._rotation = this._rotation - this.vx;
if (this._x < (left - this._width)) {
_root.dodged++;
newsplice(this.i);
removeMovieClip(this);
} else if ((this.hit.hitTest(_root.player.hit) && (_root.canBeHurt)) && (!this.dead)) {
_root.hurt();
obstacleDie(this);
}
}
}
function blackTamponLoop() {
if (!_root.paused) {
this._x = this._x - this.vx;
this.timer--;
if (this.timer <= 0) {
this.timer = btbt;
createBomb(this);
}
if (this._x < (-this._width)) {
newsplice(this.i);
_root.dodged++;
removeMovieClip(this);
} else if ((this.sprite.hit.hitTest(_root.player.hit) && (_root.canBeHurt)) && (!this.dead)) {
_root.hurt();
obstacleDie(this);
}
}
}
function createBomb(src) {
mc = omc.attachMovie("tamponbomb", "o" + (obs++), omc.getNextHighestDepth());
mc._x = src._x + (src._width / 4);
mc._y = src._y;
dx = mc._x - player._x;
dy = mc._y - player._y;
ang = Math.atan2(dy, dx);
mc.vx = Math.cos(ang) * terrainSpeed;
mc.vy = Math.sin(ang) * terrainSpeed;
mc.sprite._rotation = (ang * 180) / Math.PI;
mc.onEnterFrame = bombLoop;
}
function bombLoop() {
this._x = this._x - this.vx;
this._x = this._x - terrainSpeed;
this._y = this._y - this.vy;
if ((((this._x < (-this._width)) || (this._y > bottom)) || (this._y < top)) || (this._x > (Stage.width + this))) {
_root.dodged++;
removeMovieClip(this);
} else if ((this.hitTest(_root.player.hit) && (_root.canBeHurt)) && (!this.dead)) {
_root.hurt();
removeMovieClip(this);
}
}
function terrainLoop() {
if (!_root.paused) {
this._x = this._x - terrainSpeed;
if ((this._x <= (Stage.width - (this._width / 2))) && (!this.recursed)) {
this.recursed = true;
if (this.placement == "bottom") {
_root.prevBody = this;
} else {
_root.topPrevBody = this;
}
_root.createTerrain(this.placement);
}
if (this.sprite.hit.hitTest(_root.player._x + _root.player.hit._x, _root.player._y + _root.player.hit._y, true) && (_root.canBeHurt)) {
_root.hurt();
}
if (this._x < (-this._width)) {
removeMovieClip(this);
}
}
}
function updateDistanceBar() {
if (!atBoss) {
percent = ((control * (getTimer() - timeStarted)) / (timeToEnd - timeStarted)) * 100;
if ((((control && (percent >= 50)) && (level == 1)) && (percent != Infinity)) && (percent != NaN)) {
trace("new enemies");
level = level + 5;
clearInterval(swarmTimer);
clearInterval(obstacleTimer);
minSwarm = loweredMinSwarm;
maxSwarm = loweredMaxSwarm;
_root.blackTamponTimer = setInterval(createBlackTampon, loweredObstacleTime);
_root.swarmTimer = setInterval(createSwarm, loweredSwarmTime, "spore");
_root.bfttimer = setInterval(createBft, bft_timer);
_root.fishtimer = setInterval(createFish, fishTimer);
}
if (percent >= 100) {
percent = 100;
if (dodged > 1) {
clearInterval(swarmTimer);
clearInterval(bfttimer);
clearInterval(fishtimer);
clearInterval(blackTamponTimer);
gameOver = true;
chance = 0;
topChance = 0;
trace(weg);
if ((weg.length < 1) || (weg[0] == undefined)) {
if (!hasMedal("Supasperm")) {
_root.medal_popup.unlockMedal("Supasperm");
updateMedalList();
}
if ((!hasMedal("Impotent")) && (shots == 0)) {
_root.secondary_medal_popup.unlockMedal("Impotent");
updateMedalList();
}
canMove = false;
canShoot = false;
canBeHurt = false;
player._x = player._x + 10;
player._rotation = initial.rot;
if (player._x > (Stage.width + 100)) {
_root.fadeToBlack._visible = true;
_root.fadeToBlack._alpha = _root.fadeToBlack._alpha + 1.5;
song.setVolume(song.getVolume() - 1.5);
if (song.getVolume() <= 0) {
atBoss = true;
song.setVolume(100);
song.stop();
initBoss();
}
}
}
}
}
db.barmain.mask._xscale = percent;
db.male._x = ix + (fx * (percent / 100));
}
}
function init() {
distlabel._visible = true;
db._visible = true;
control = true;
canShoot = true;
canMove = true;
canBeHurt = true;
_root.obstacleTimer = setInterval(createObstacle, otl, "tampon");
_root.swarmTimer = setInterval(createSwarm, swarmTime, "spore");
_root.timeStarted = getTimer();
_root.timeToEnd = timeStarted + (1000 * gameLength);
trace((timeStarted + " ") + timeToEnd);
}
function initBoss() {
_root.statee = 1;
removeMovieClip(distlabel);
removeMovieClip(db);
_root.attachMovie("bosshealthbar", "bhb", _root.getNextHighestDepth());
bhb._x = 413.4;
bhb._y = 380.5;
delete shotLoop;
song.attachSound("bossintro");
song.start(0, 0);
song.onSoundComplete = function () {
song.stop();
song.attachSound("bossloop");
song.start(0, 999);
delete song.onSoundComplete;
};
removeMovieClip(bgh);
removeMovieClip(terrain);
removeMovieClip(tterrain);
if (zomgboss._currentframe == 1) {
zomgboss.play();
}
player._x = -player._width;
player._y = initial.y;
player._rotation = initial.rot;
_root.attachMovie("bossbgmc", "bbmc", 2);
bbmc._x = Stage.width;
bbmc._y = Stage.height / 2;
_root.attachMovie("bossterrainmc", "btmc", 4);
btmc._x = Stage.width;
btmc._y = Stage.height / 2;
_root.createEmptyMovieClip("bc", 3);
_root.bosss = bc.attachMovie("boss main", "baby", bc.getNextHighestDepth());
_root.boss_trans = new flash.geom.Transform(bosss);
bosss.health = boss_health;
smc.swapDepths(2);
delete _root.onEnterFrame;
_root.onEnterFrame = newLoop;
fadeToBlack.swapDepths(_root.getNextHighestDepth());
_root.shotLoop = function () {
if (!paused) {
a = 0;
while (a < mi) {
if ((bosss.bb.head.hitTest(this._x, this._y, true) && (!mc.dead)) && (!this.dead)) {
_root.bossHurt();
_root.babehHitMc.gotoAndPlay("hit" + (1 + random(2)));
_root.increaseCharge(boss_charge);
removeMovieClip(this);
}
this._x = this._x + (this.vx / mi);
this._y = this._y + (this.vy / mi);
a++;
}
if ((((this._x > (right + this._width)) || (this._x < (left - this._width))) || (this._y > (bottom + this._height))) || (this._y < (top - this._height))) {
removeMovieClip(this);
}
}
};
}
function newLoop() {
if (!paused) {
if (statee == 1) {
fadeToBlack._alpha = fadeToBlack._alpha - 0.5;
player._x = 100 - fadeToBlack._alpha;
if (fadeToBlack._alpha <= 0) {
fadeToBlack._visible = false;
statee++;
}
} else if (statee == 2) {
if ((!bosss.introo) && (!past_boss_intro)) {
past_boss_intro = true;
control = true;
canMove = true;
canShoot = true;
canBeHurt = true;
trace("balls");
}
if (canBeHurt && ((((player._x > (right + player._width)) || (player._x < (-player._width))) || (player._y > (bottom + player._height))) || (player._y < (-player._height)))) {
hurt();
_root.playerDeadFromBoss = true;
}
if (player._x < 0) {
player._x = 0;
}
shotTimer--;
if ((Key.isDown(shootKey) && (shotTimer <= 0)) && (canShoot)) {
shoot();
shotTimer = shotTimerReset;
shots++;
}
if (canMove) {
movePlayer();
}
if ((((bc.hitTest(player._x + player.hit._x, player._y + player.hit._y, true) || (bossHitPlayer())) && (canBeHurt)) && (!bosss.introo)) && (!boss_dead)) {
hurt();
_root.playerDeadFromBoss = true;
}
if (!bosss.doingSomething) {
boss_doSumfin();
}
if (boss_dead && (statee == 2)) {
trace("BOSS ARE DEAD LOL");
stateetimer = 0;
trace("SMEH " + stateetimer);
canMove = false;
canBeHurt = false;
statee++;
}
} else if (statee == 3) {
trace("POOP LOL");
stateetimer++;
player._x = player._x + 10;
player._rotation = initial.rot;
trace(stateetimer / 40);
if ((stateetimer / 40) > 5) {
statee++;
}
} else if (statee == 4) {
trace("wtfffff");
fadeToBlack._visible = true;
fadeToBlack._alpha++;
song.setVolume(100 - fadeToBlack._alpha);
if (fadeToBlack._alpha >= 100) {
song.stop();
_root.bosss.gotoAndStop("endingcinematic");
bc.swapDepths(_root.getNextHighestDepth());
fadeToBlack._visible = false;
statee++;
}
}
}
}
function bossHitPlayer() {
if (((bc.hitTest(player._x + player.top._x, player._y + player.top._y, true) || (bc.hitTest(player._x + player.bottom._x, player._y + player.bottom._y, true))) || (bc.hitTest(player._x + player.right._x, player._y + player.right._y, true))) || (bc.hitTest(player._x + player.left._x, player._y + player.left._y, true))) {
return(true);
}
return(false);
}
function boss_doSumfin() {
rndnm = 1 + Math.round((Math.random() * 30) / 10);
rndatk = "attack" + rndnm;
bosss.gotoAndStop(rndatk);
}
function createLarva(ex, wy) {
mc = bc.attachMovie("larva", "obs" + (obs++), bc.getNextHighestDepth());
mc._x = ex + bosss.bb._x;
mc._y = wy + bosss.bb._y;
mc.vx = -5 - random(10);
mc.vy = -5 - random(10);
mc.onEnterFrame = larvaLoop;
}
function createLaser(ex, wy) {
mc = bc.attachMovie("bossLaser", "obs" + (obs++), bc.getNextHighestDepth());
mc._x = ex + bosss.bb._x;
mc._y = wy + bosss.bb._y;
dx = mc._x - player._x;
dy = (mc._y + (mc._height / 2)) - player._y;
ang = Math.atan2(dy, dx) + (random(boss_laserCone) - random(boss_laserCone));
mc.vx = Math.cos(ang) * boss_laserSpeed;
mc.vy = Math.sin(ang) * boss_laserSpeed;
mc.onEnterFrame = laserLoop;
}
function bossPound() {
bbmc.play();
bx = player._x;
i = 0;
while (i < (boss_minCrumbles + random(boss_maxCrumbles - boss_minCrumbles))) {
mc = bc.attachMovie("crumble", "obs" + (obs++), bc.getNextHighestDepth());
mc._y = -mc._height;
mc._x = (bx + random(boss_crumble_range)) - random(boss_crumble_range);
mc._xscale = (mc._yscale = 75 + random(25));
mc.g._rotation = random(360);
mc.vy = 0;
mc.onEnterFrame = crumbleLoop;
i++;
}
}
function larvaLoop() {
this._x = this._x + this.vx;
this._y = this._y + this.vy;
this.vy = this.vy + gravity;
this.g._rotation = this.g._rotation + this.vx;
if (btmc.hit.hitTest(this._x, this._y + (this._height / 2), true)) {
this._y = this._y - this.vy;
this.vy = this.vy * bounce;
}
if (this._x < (-this._width)) {
removeMovieClip(this);
}
}
function laserLoop() {
i = 0;
while (i < mi) {
this._x = this._x - (this.vx / mi);
this._y = this._y - (this.vy / mi);
i++;
}
if (this._x < (-this._width)) {
removeMovieClip(this);
}
}
function crumbleLoop() {
this._y = this._y + this.vy;
this.vy = this.vy + gravity;
if (this._y > (bottom + this._height)) {
removeMovieClip(this);
}
}
function bossHurt() {
bosss.health--;
bhb.meter.hb._xscale = (bosss.health / boss_health) * 100;
if ((!boss_intense) && ((bosss.health / boss_health) < boss_intenseThreshold)) {
boss_intense = true;
boss_chance = boss_higherChance;
}
if (bosss.health <= 0) {
boss_dying = true;
_root.canShoot = false;
_root.canBeHurt = false;
if (!hasMedal("Preggerz")) {
_root.medal_popup.unlockMedal("Preggerz");
updateMedalList();
}
if ((!hasMedal("Aborted")) && (!_root.playerDeadFromBoss)) {
secondary_medal_popup.unlockMedal("Aborted");
updateMedalList();
}
bosss.gotoAndStop("barf");
if (cinbars._currentframe == 1) {
cinbars.swapDepths(_root.getNextHighestDepth());
medal_popup.swapDepths(_root.getNextHighestDepth());
secondary_medal_popup.swapDepths(_root.getNextHighestDepth());
cinbars.play();
}
}
boss_trans = new flash.geom.Transform(bosss.bb.head);
boss_trans.colorTransform = boss_colTrans;
setTimeout(bossBackToNormCol, bossFlashWhiteLength);
}
function bossBackToNormCol() {
boss_trans.colorTransform = boss_normTrans;
}
function reset() {
delete _root.onEnterFrame;
clearInterval(obstacleTimer);
clearInterval(swarmTimer);
clearInterval(bfttimer);
clearInterval(fishtimer);
clearInterval(blackTamponTimer);
clearInterval(fadedatshitnigga);
clearInterval(yeahthistoo);
stopAllSounds();
for (i in _root) {
trace((i + "\t") + i.getDepth());
if (_root[i].getDepth() >= 0) {
removeMovieClip(_root[i]);
}
}
_root.gotoAndPlay("menu");
}
_quality = "low";
stop();
stopAllSounds();
var medal_list = com.Newgrounds.NewgroundsAPI.getMedals();
var bottom = Stage.height;
var right = Stage.width;
var top = 0;
var left = 0;
var control = false;
var canShoot = false;
var canMove = false;
var canBeHurt = false;
var initial = new Object();
initial.x = player._x;
initial.y = player._y;
initial.rot = player._rotation;
var blinked = 0;
var decay = 0.5;
var vx = 0;
var vy = 0;
var accel = 0.75;
var ms = 7;
var lives = 10;
player._x = -100;
var cycle = 0;
var incr = 0.05;
var bobrange = 0.55;
var oldx = player._x;
var oldy = player._y;
var rotateRange = 4;
var rotDecay = 0.75;
var rotSpeed = 0;
var rotAccel = 0.2;
var playerDeadFromBoss = false;
var fadedatshitnigga;
var yeahthistoo;
var gameState = "main";
var bounce = -0.7;
var gravity = 0.5;
var crumbleGravity = 0.05;
var atBoss = false;
var gameOver = false;
var gameLength = 60;
var timeStarted = 1;
var timeToEnd = 10000000;
var shotType = 0;
var blinkedFaster = false;
var minAngle = -45;
var maxAngle = 45;
var blinkTimer = 100;
var fastBlinkTimer = 50;
var b;
var blinkMax = 40;
var shootKey = 65;
var paused = false;
var level = 1;
var score = 0;
var dodged = 0;
var otl = 600;
var swarmTime = 5000;
var loweredSwarmTime = 8000;
var loweredObstacleTime = 1300;
var ease = 0.1;
var bgspeed = 4;
var bglen = bg.bgmc._width;
var bgs = 7;
var bgwm = 1;
var bgh = _root.createEmptyMovieClip("backgroundholder", _root.getNextHighestDepth());
var numbgs = 0;
var smc = _root.createEmptyMovieClip("shotparticles", _root.getNextHighestDepth());
var leaveScore = 10;
var shootScore = 25;
var shots = 0;
var hits = 0;
var shotSpeed = 10;
var activeShots = new Array();
var mi = 4;
var shotTimerReset = 10;
var shotTimer = 0;
var charge = 0;
var chargeThresholds = [50, 100, 200];
var chargeMax = chargeThresholds[chargeThresholds.length - 1];
var swarmCharge = 3;
var obstacleCharge = 9;
var maxChargedBulletSize = 50;
var fx = 356.2;
var ix = -7.5;
var btbt = 70;
var swarmHealth = 1;
var obstacleHealth = 1;
var minSwarm = 5;
var maxSwarm = 15;
var loweredMinSwarm = 2;
var loweredMaxSwarm = 8;
var minSwarmSize = 45;
var maxSwarmSize = 80;
var minSwarmSpeed = 3;
var maxSwarmSpeed = 8;
var minSwarmYRange = 2;
var maxSwarmYRange = 6;
var swarmCycleIncrease = 0.05;
var yDistribute = 150;
var xDistribute = 200;
var weg = new Array();
var omc = _root.createEmptyMovieClip("obstaclemc", _root.getNextHighestDepth());
var obstacles = new Array("condom");
var omas = 15;
var omis = 8;
var obs = 0;
var fish_minSpeed = 4;
var fish_maxSpeed = 10;
var fish_maxYRange = 40;
var fish_minYRange = 20;
var fish_minXRange = 4;
var fish_maxXRange = 7;
var fish_minSwarm = 2;
var fish_maxSwarm = 5;
var fish_yDistr = 200;
var fish_xDistr = 150;
var fishTimer = 2800;
var fish_cycleIncr = 0.05;
var fish_health = 3;
var fish_charge = 5;
var bft_minSpeed = 3;
var bft_maxSpeed = 7;
var bft_health = 20;
var bft_timer = 8000;
var bft_charge = 3;
var prevBody = null;
var prevBodyType = null;
var topPrevBody = null;
var topPrevBodyType = null;
var terrain = _root.createEmptyMovieClip("terrainmc", _root.getNextHighestDepth());
var tterrain = _root.createEmptyMovieClip("topterrainmc", _root.getNextHighestDepth());
var chance = 50;
var topChance = 25;
var maxChance = 100;
var tn = 1;
var ts = 0;
var terrains = new Array("flat", "hump", "tiered", "prongs", "warty");
var terrainSpeed = 7;
var bodeee;
var boss_trans;
var boss_colTrans = (new flash.geom.ColorTransform(1, 0.25, 0.25, 25, 0, 0, 0, 0));
var boss_normTrans = (new flash.geom.ColorTransform(1, 1, 1, 1, 0, 0, 0, 0));
var boss_laserSpeed = 23;
var boss_laserCone = 0.523598775598299;
var boss_minCrumbles = 4;
var boss_maxCrumbles = 6;
var boss_crumble_range = 130;
var boss_health = 500;
var boss_intenseThreshold = 0.3;
var boss_charge = 5;
var bossFlashWhiteLength = 80;
var boss_chance = 65;
var boss_higherChance = 100;
var boss_dying = false;
var boss_dead = false;
var boss_intense = false;
var boss_barfTime = 400;
var past_boss_intro = false;
var song = new Sound(mgm);
song.attachSound("Groove Tube");
song.setVolume(100);
song.start(0, 999);
var gameoverm = new Sound(gom);
gameoverm.attachSound("gaimovermuzak");
gameoverm.setVolume(0);
updateLives();
updateChargeBar();
createTerrain("bottom");
createTerrain("top");
createBg(0);
_root.onEnterFrame = function () {
if (!paused) {
if (gameState == "main") {
if (control) {
if (_root.missionstart) {
player._x = 100 - (_root.missionstart._alpha * 2);
_root.missionstart._alpha = _root.missionstart._alpha - 2;
if (_root.missionstart._alpha <= 0) {
init();
removeMovieClip(_root.missionstart);
}
}
}
if (canBeHurt && ((((player._x > (right + player._width)) || (player._x < (-player._width))) || (player._y > (bottom + player._height))) || (player._y < (-player._height)))) {
hurt();
}
shotTimer--;
if ((Key.isDown(shootKey) && (shotTimer <= 0)) && (canShoot)) {
shoot();
shotTimer = shotTimerReset;
shots++;
}
if (canMove) {
movePlayer();
}
updateDistanceBar();
} else if (gameState == "dead") {
song.setVolume(song.getVolume() - 1);
if (song.getVolume <= 0) {
song.setVolume(0);
song.stop();
gameState = "dead2";
}
} else if (gameState == "dead2") {
song.setVolume(100);
song.attachSound("gaimovermuzak");
song.start(0, 0);
}
}
};
player.swapDepths(_root.getNextHighestDepth());
livescounter.swapDepths(_root.getNextHighestDepth());
liveslabel.swapDepths(_root.getNextHighestDepth());
chargemc.swapDepths(_root.getNextHighestDepth());
scoremc.swapDepths(_root.getNextHighestDepth());
distlabel.swapDepths(_root.getNextHighestDepth());
db.swapDepths(_root.getNextHighestDepth());
missionstart.swapDepths(_root.getNextHighestDepth());
zomgboss.swapDepths(_root.getNextHighestDepth());
fadeToBlack.swapDepths(_root.getNextHighestDepth());
medal_popup.swapDepths(_root.getNextHighestDepth());
secondary_medal_popup.swapDepths(_root.getNextHighestDepth());
fadeToBlack._visible = false;
fadeToBlack._alpha = 0;
distlabel._visible = false;
db._visible = false;
Stage.showMenu = false;
Symbol 32 MovieClip [bg] Frame 1 (8 B)
stop();
Symbol 92 MovieClip Frame 23 (26 B)
removeMovieClip(_parent);
Symbol 93 MovieClip [spore] Frame 1 (8 B)
stop();
Symbol 93 MovieClip [spore] Frame 2 (8 B)
play();
Symbol 93 MovieClip [spore] Frame 4 (73 B)
if (this.dead) {
gotoAndStop ("dead");
} else {
gotoAndStop (1);
}
Symbol 93 MovieClip [spore] Frame 5 (8 B)
stop();
Symbol 107 MovieClip [blacktampon] Frame 1 (8 B)
stop();
Symbol 107 MovieClip [blacktampon] Frame 2 (8 B)
play();
Symbol 107 MovieClip [blacktampon] Frame 4 (73 B)
if (this.dead) {
gotoAndStop ("dead");
} else {
gotoAndStop (1);
}
Symbol 107 MovieClip [blacktampon] Frame 5 (23 B)
removeMovieClip(this);
Symbol 108 MovieClip [tampon] Frame 1 (8 B)
stop();
Symbol 108 MovieClip [tampon] Frame 2 (8 B)
play();
Symbol 108 MovieClip [tampon] Frame 4 (73 B)
if (this.dead) {
gotoAndStop ("dead");
} else {
gotoAndStop (1);
}
Symbol 108 MovieClip [tampon] Frame 5 (23 B)
removeMovieClip(this);
Symbol 131 MovieClip [bossbgmc] Frame 1 (8 B)
stop();
Symbol 131 MovieClip [bossbgmc] Frame 19 (17 B)
gotoAndStop (1);
Symbol 131 MovieClip [bossbgmc] Frame 29 (27 B)
gotoAndPlay ("ubershake");
Symbol 142 MovieClip [fishdie] Frame 11 (26 B)
removeMovieClip(_parent);
Symbol 156 MovieClip [fish] Frame 1 (8 B)
stop();
Symbol 156 MovieClip [fish] Frame 2 (8 B)
play();
Symbol 156 MovieClip [fish] Frame 4 (73 B)
if (this.dead) {
gotoAndStop ("dead");
} else {
gotoAndStop (1);
}
Symbol 156 MovieClip [fish] Frame 5 (8 B)
stop();
Symbol 172 MovieClip [hairballdie] Frame 19 (35 B)
removeMovieClip(_parent);
stop();
Symbol 173 MovieClip [bft] Frame 1 (8 B)
stop();
Symbol 173 MovieClip [bft] Frame 4 (73 B)
if (this.dead) {
gotoAndStop ("dead");
} else {
gotoAndStop (1);
}
Symbol 173 MovieClip [bft] Frame 5 (8 B)
stop();
Symbol 231 MovieClip Frame 140 (29 B)
_parent.gotoAndStop("idle");
Symbol 235 MovieClip Frame 1 (60 B)
randframe = "g" + (1 + random(6));
gotoAndPlay(randframe);
Symbol 236 MovieClip Frame 17 (103 B)
if (_root.boss_intense) {
_parent.doingSomething = false;
}
if (_root.paused) {
growl.stop();
}
Symbol 236 MovieClip Frame 30 (79 B)
if (random(100) < _root.boss_chance) {
_parent.doingSomething = false;
}
Symbol 244 MovieClip Frame 1 (9 B)
hit = 1;
Symbol 244 MovieClip Frame 25 (19 B)
_root.bossPound();
Symbol 244 MovieClip Frame 33 (79 B)
if (_root.boss_intense && (hit == 1)) {
hit++;
gotoAndPlay (2);
}
Symbol 244 MovieClip Frame 68 (29 B)
_parent.gotoAndStop("idle");
Symbol 247 MovieClip Frame 71 (8 B)
stop();
Symbol 248 MovieClip Frame 38 (30 B)
_root.createLarva(68.5, 240);
Symbol 248 MovieClip Frame 40 (61 B)
if (_root.boss_intense) {
_root.createLarva(68.5, 240);
}
Symbol 248 MovieClip Frame 43 (30 B)
_root.createLarva(68.5, 240);
Symbol 248 MovieClip Frame 45 (61 B)
if (_root.boss_intense) {
_root.createLarva(68.5, 240);
}
Symbol 248 MovieClip Frame 48 (30 B)
_root.createLarva(68.5, 240);
Symbol 248 MovieClip Frame 50 (61 B)
if (_root.boss_intense) {
_root.createLarva(68.5, 240);
}
Symbol 248 MovieClip Frame 53 (30 B)
_root.createLarva(68.5, 240);
Symbol 248 MovieClip Frame 105 (29 B)
_parent.gotoAndStop("idle");
Symbol 255 MovieClip Frame 28 (32 B)
_root.createLaser(64.5, 232.8);
Symbol 255 MovieClip Frame 35 (63 B)
if (_root.boss_intense) {
_root.createLaser(64.5, 232.8);
}
Symbol 255 MovieClip Frame 50 (29 B)
_parent.gotoAndStop("idle");
Symbol 258 MovieClip Frame 24 (252 B)
var timer = 0;
_root.boss_dying = true;
this.onEnterFrame = function () {
if ((timer % 4) == 0) {
_root.createLarva(68.5, 240);
}
timer++;
if (timer > _root.boss_barfTime) {
delete this.onEnterFrame;
this.play();
}
};
stop();
Symbol 258 MovieClip Frame 29 (30 B)
_root.createLarva(68.5, 240);
Symbol 258 MovieClip Frame 34 (30 B)
_root.createLarva(68.5, 240);
Symbol 258 MovieClip Frame 39 (30 B)
_root.createLarva(68.5, 240);
Symbol 258 MovieClip Frame 91 (28 B)
_parent.gotoAndStop("die");
Symbol 314 MovieClip Frame 103 (8 B)
stop();
Symbol 315 MovieClip Frame 1 (19 B)
_root.bbmc.stop();
Symbol 315 MovieClip Frame 84 (24 B)
_root.boss_dead = true;
Symbol 315 MovieClip Frame 146 (8 B)
stop();
Symbol 322 MovieClip Frame 1 (7 B)
c = 2;
Symbol 322 MovieClip Frame 2 (485 B)
if (c > 100) {
gotoAndStop (4);
} else {
duplicateMovieClip ("snow1", "snow" & c, 100 - c);
setProperty("snow" & c, _x , getProperty("snow" & (c - 1), _x) + random(800));
setProperty("snow" & c, _y , getProperty("snow" & (c - 1), _y) + random(400));
setProperty("snow" & c, _xscale , random(70));
setProperty("snow" & c, _yscale , getProperty("snow" & c, _xscale));
setProperty("snow" & c, _rotation , random(10));
c = c + 1;
}
Symbol 322 MovieClip Frame 3 (17 B)
gotoAndPlay (2);
Symbol 322 MovieClip Frame 4 (8 B)
stop();
Symbol 420 MovieClip Frame 60 (8 B)
stop();
Symbol 515 MovieClip Frame 100 (88 B)
stop();
this.onMouseDown = function () {
this.play();
delete this.onMouseDown;
};
Symbol 515 MovieClip Frame 200 (15 B)
_root.reset();
Symbol 516 MovieClip Frame 1 (32 B)
removeMovieClip(_root.cinbars);
Symbol 516 MovieClip Frame 951 (8 B)
stop();
Symbol 517 MovieClip [boss main] Frame 1 (58 B)
stop();
this.doingSomething = true;
this.introo = true;
Symbol 517 MovieClip [boss main] Frame 7 (46 B)
stop();
trace("idle");
this.introo = false;
Symbol 517 MovieClip [boss main] Frame 12 (56 B)
stop();
this.doingSomething = true;
trace("attack1");
Symbol 517 MovieClip [boss main] Frame 19 (56 B)
stop();
this.doingSomething = true;
trace("attack2");
Symbol 517 MovieClip [boss main] Frame 26 (56 B)
stop();
this.doingSomething = true;
trace("attack3");
Symbol 517 MovieClip [boss main] Frame 33 (46 B)
stop();
_root.bbmc.gotoAndPlay("ubershake");
Symbol 517 MovieClip [boss main] Frame 38 (37 B)
stop();
this.doingSomething = true;
Symbol 517 MovieClip [boss main] Frame 43 (8 B)
stop();
Symbol 528 MovieClip Frame 40 (8 B)
stop();
Symbol 529 MovieClip [bosshealthbar] Frame 7 (8 B)
stop();
Symbol 548 MovieClip Frame 40 (8 B)
stop();
Symbol 562 Button (55 B)
on (press) {
tellTarget (_root) {
nextFrame();
};
}
Symbol 563 Button (51 B)
on (press) {
gotoAndStop ("end");
_root.play();
}
Instance of Symbol 538 MovieClip in Symbol 564 MovieClip Frame 1 (451 B)
onClipEvent (load) {
_root.stop();
PercentLoaded = int((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
if (PercentLoaded != 100) {
_parent.gotoAndStop(PercentLoaded);
} else {
_parent.gotoAndStop("lastframe");
}
}
onClipEvent (enterFrame) {
PercentLoaded = int((_root.getBytesLoaded() / _root.getBytesTotal()) * 100);
if (PercentLoaded != 100) {
_parent.gotoAndStop(PercentLoaded);
} else {
_parent.gotoAndPlay("loaded");
}
}
Symbol 564 MovieClip Frame 101 (8 B)
play();
Symbol 564 MovieClip Frame 165 (8 B)
stop();
Symbol 570 Button (49 B)
on (release) {
NewgroundsAPI.loadNewgrounds();
}
Symbol 575 Button (49 B)
on (release) {
NewgroundsAPI.loadNewgrounds();
}
Symbol 577 MovieClip Frame 1 (0.98 KiB)
function startAd(ngad_url) {
trace("opening " + ngad_url);
System.security.allowDomain("70.87.128.99");
System.security.allowInsecureDomain("70.87.128.99");
System.security.allowDomain("ads.shizmoo.com");
System.security.allowInsecureDomain("ads.shizmoo.com");
System.security.allowDomain("www.cpmstar.com");
System.security.allowInsecureDomain("www.cpmstar.com");
System.security.allowDomain("server.cpmstar.com");
System.security.allowInsecureDomain("server.cpmstar.com");
var ngads_redirect = new XML();
ngads_redirect.ignoreWhite = true;
ngads_redirect.onLoad = function (success) {
trace("[NEWGROUNDS FLASH ADS] :: You may get a 'Security Sandbox Violation' ... this is normal, do not freak out!");
if (success) {
ng_ad.loadMovie(ngads_redirect.toString(), "GET");
}
};
ngads_redirect.load(ngad_url);
}
if (NewgroundsAPI.getAdURL()) {
startAd(NewgroundsAPI.getAdURL());
}
NewgroundsAPI.onAdsApproved = function (ad_url) {
startAd(ad_url);
};
stop();
Symbol 821 MovieClip [__Packages.NewgroundsAPI] Frame 0 (12.42 KiB) ● ●
class NewgroundsAPI
{
static var tracker_id, host, version, debug, error_format, header_format, normal_format, link_format;
function NewgroundsAPI () {
}
static function connectMovie(id) {
if (!id) {
SendError("Missing required 'id' parameter in NewgroundsAPI.connectMovie(id:Number)");
} else if (!tracker_id) {
SendMessage("Connecting to API gateway...");
tracker_id = id;
host = _url.split("/")[2].toLowerCase();
if (host.length < 1) {
host = "localhost";
}
var _local2 = new Object();
SendEvent(MOVIE_VIEWS);
}
}
static function setMovieVersion(movie_version) {
if (!movie_version) {
SendError("Missing required 'version' in NewgroundsAPI.setMovieVersion(version:String)");
} else {
version = movie_version;
}
}
static function debugMode() {
debug = true;
}
static function addCustomEvent(stat_id, stat_name) {
if (!stat_id) {
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else if (!stat_name) {
SendError("Missing required 'event_name' parameter in NewgroundsAPI.AddCustomEvent(id:Number, event_name:String)");
} else {
custom_events[stat_name] = CUSTOM_STATS + stat_id;
SendMessage("Created custom event: " + stat_name);
}
}
static function addCustomLink(stat_id, stat_name) {
if (!stat_id) {
SendError("Missing required 'id' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else if (!stat_name) {
SendError("Missing required 'link_name' parameter in NewgroundsAPI.AddCustomLink(id:Number, link_name:String)");
} else {
custom_links[stat_name] = CUSTOM_STATS + stat_id;
SendMessage((("Created custom link " + stat_id) + ": ") + stat_name);
}
}
static function loadMySite() {
SendLink(AUTHOR_SITE);
}
static function loadNewgrounds(special) {
if (special) {
var _local1 = {page:special};
}
SendLink(NEWGROUNDS, _local1);
}
static function logCustomEvent(event_name) {
if (!event_name) {
SendError("Missing required 'event_name' parameter in NewgroundsAPI.logCustomEvent(event_name:String)");
} else if (!custom_events[event_name]) {
SendError("Attempted to log undefined custom event: " + event_name);
} else {
SendEvent(custom_events[event_name]);
}
}
static function loadCustomLink(link_name) {
if (!link_name) {
SendError("Missing required 'link_name' parameter in NewgroundsAPI.loadCustomLink(link_name:String)");
} else if (!custom_links[link_name]) {
SendError("Attempted to open undefined custom link: " + link_name);
} else {
SendLink(custom_links[link_name]);
}
}
static function getAdURL() {
return(movie_options.ad_url);
}
static function getMovieURL() {
if (movie_options.movie_url) {
return(movie_options.movie_url);
}
return("Newgrounds.com");
}
static function getNewVersionURL() {
return((((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + NEW_VERSION);
}
static function SendEvent(id) {
SendStat(id, false);
}
static function SendLink(id, extra) {
SendStat(id, true, extra);
}
static function ReadGatewayData(params) {
for (var _local2 in params) {
params[_local2] = unescape(params[_local2]);
movie_options[_local2] = params[_local2];
}
if (params.settings_loaded) {
SendMessage("You have successfully connected to the Newgrounds API gateway!");
SendMessage(("Movie Identified as '" + movie_options.movie_name) + "'");
if (movie_options.message) {
SendMessage(movie_options.message);
}
if (movie_options.ad_url) {
SendMessage("Your movie has been approved to run Flash Ads");
onAdsApproved(movie_options.ad_url);
}
if (movie_options.movie_version and (movie_options.movie_version.toString() != version.toString())) {
SendMessage("WARNING: The movie version configured in your API settings does not match this movie's version!");
onNewVersionAvailable(movie_options.movie_version, getMovieURL(), getNewVersionURL());
}
if (movie_options.deny_host) {
SendMessage("You have blocked 'localHost' in your API settings.");
SendMessage("If you wish to test your movie you will need to remove this block.");
onDenyHost(host, getMovieURL(), getNewVersionURL());
}
if (movie_options.request_portal_url == 1) {
var _local4 = (((GATEWAY_URL + "?&id=") + tracker_id) + "&portal_url=") + escape(_url);
var _local3 = new XML();
_local3.ignoreWhite = true;
_local3.load(_local4);
}
} else if (!movie_options.settings_loaded) {
SendError("Could not establish connection to the API gateway.");
}
}
static function SendStat(stat_id, open_in_browser, extra) {
if (!tracker_id) {
SendError("API calls cannot be made without a valid movie id.");
SendError("Did you remember to add the \"NewgroundsAPI.connectMovie()\" code?");
} else {
var _local7 = (((((GATEWAY_URL + "?&id=") + tracker_id) + "&host=") + escape(host)) + "&stat=") + stat_id;
for (var _local9 in extra) {
_local7 = _local7 + ((("&" + escape(_local9)) + "=") + escape(extra[_local9]));
}
trace(_local7);
if (debug) {
_local7 = _local7 + "&debug=1";
}
if (open_in_browser) {
getURL (_local7, "_blank");
} else {
var _local10 = new XML();
_local10.ignoreWhite = true;
_local10.onLoad = function (success) {
var _local6 = new Object();
var _local3 = 0;
while (_local3 < this.firstChild.childNodes.length) {
var _local4 = this.firstChild.childNodes[_local3];
var _local5 = _local4.nodeName;
var _local2 = _local4.attributes.value;
if (_local2 == Number(_local2)) {
_local2 = Number(_local2);
}
_local6[_local5] = _local2;
_local3++;
}
NewgroundsAPI.ReadGatewayData(_local6);
};
_local10.load(_local7);
}
}
}
static function SendError(msg) {
trace("[NEWGROUNDS API ERROR] :: " + msg);
}
static function SendMessage(msg) {
trace("[NEWGROUNDS API] :: " + msg);
}
static function InitTextFormats() {
if (!error_format) {
error_format = new TextFormat();
error_format.font = "Arial Black";
error_format.size = 48;
error_format.color = 16711680 /* 0xFF0000 */;
}
if (!header_format) {
header_format = new TextFormat();
header_format.font = "Arial Black";
header_format.size = 24;
header_format.color = 16777215 /* 0xFFFFFF */;
}
if (!normal_format) {
normal_format = new TextFormat();
normal_format.font = "Arial";
normal_format.bold = true;
normal_format.size = 12;
normal_format.color = 16777215 /* 0xFFFFFF */;
}
if (!link_format) {
link_format = new TextFormat();
link_format.color = 16776960 /* 0xFFFF00 */;
link_format.underline = true;
}
}
static function onNewVersionAvailable(version, movie_url, redirect_url) {
InitTextFormats();
var _local2 = new Object();
_local2.x = Stage.width / 2;
_local2.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(_local2.x - 240, _local2.y - 120);
_root.NGAPI_new_version_overlay.lineTo(_local2.x + 240, _local2.y - 120);
_root.NGAPI_new_version_overlay.lineTo(_local2.x + 240, _local2.y + 80);
_root.NGAPI_new_version_overlay.lineTo(_local2.x - 240, _local2.y + 80);
_root.NGAPI_new_version_overlay.lineTo(_local2.x - 240, _local2.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(_local2.x + 210, _local2.y - 110);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 230, _local2.y - 110);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 230, _local2.y - 90);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 210, _local2.y - 90);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 210, _local2.y - 110);
_root.NGAPI_new_version_overlay.exit.endFill();
_root.NGAPI_new_version_overlay.exit.moveTo(_local2.x + 214, _local2.y - 106);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 226, _local2.y - 94);
_root.NGAPI_new_version_overlay.exit.moveTo(_local2.x + 226, _local2.y - 106);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 214, _local2.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 _local3 = (("Version " + version) + " is now available at:") + newline;
var _local5 = _local3.length;
_local3 = _local3 + movie_url;
var _local4 = _local3.length;
_root.NGAPI_new_version_overlay.createTextField("mouseblocker", 99, -10, -10, 1000, 1000);
_root.NGAPI_new_version_overlay.createTextField("newversion", 100, _local2.x - 210, _local2.y - 90, 400, 80);
_root.NGAPI_new_version_overlay.newversion.text = "New Version Available!";
_root.NGAPI_new_version_overlay.newversion.setTextFormat(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 = _local3;
_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(normal_format);
link_format.url = redirect_url;
_root.NGAPI_new_version_overlay.message.setTextFormat(_local5, _local4, link_format);
}
static function onDenyHost(hostname, movie_url, redirect_url) {
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 _local2 = ("This movie has not been approved for use on " + hostname) + ".";
_local2 = _local2 + "\r\rFor an aproved copy, please visit:\r";
var _local4 = _local2.length;
_local2 = _local2 + movie_url;
var _local3 = _local2.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(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 = _local2;
_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(normal_format);
link_format.url = redirect_url;
_root.NGAPI_deny_host_overlay.message.setTextFormat(_local4, _local3, link_format);
}
static function isInstalled() {
return(true);
}
static function onAdsApproved(ad_url) {
}
static var movie_options = new Object();
static var custom_events = new Object();
static var custom_links = new Object();
static var MOVIE_VIEWS = 1;
static var AUTHOR_SITE = 2;
static var NEWGROUNDS = 3;
static var NEW_VERSION = 4;
static var CUSTOM_STATS = 50;
static var GATEWAY_URL = "http://www.ngads.com/gateway.php";
}
Symbol 822 MovieClip [__Packages.com.Newgrounds.BaseN] Frame 0 (2.88 KiB) ●
class com.Newgrounds.BaseN
{
var ceiling, hashIndex, bitSize, hashVal, i;
function BaseN (hash) {
ceiling = 100000000000000;
if (hash) {
hashIndex = hash;
} else {
hashIndex = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ`~@#$%^&*()+|;/";
}
bitSize = hashIndex.length;
hashVal = new Object();
i = 0;
while (i < bitSize) {
hashVal[hashIndex.charAt(i)] = i;
i++;
}
}
function verify(s) {
if (hashVal[s] != undefined) {
return(true);
}
return(false);
}
function encode(n, minchars) {
debug.lastencode = "";
if (typeof(i) != "string") {
n = n.toString();
}
if (n.charAt(0) == "-") {
var _local3 = "-";
n = n.substring(1);
} else {
var _local3 = "";
}
if (String(n).indexOf(".") > -1) {
var _local4 = String(n).split(".", 2);
return(((_local3 + baseNEncoder(_local4[0], minchars)) + ".") + baseNEncoder(_local4[1]));
}
debug.lastencode = debug.lastencode + "\tNo decimal\r";
return(_local3 + baseNEncoder(n, minchars));
}
function decode(s) {
var _local4 = 1;
if (s.charAt(0) == "-") {
_local4 = -1;
s = s.substring(1, s.length);
}
var _local3 = s.indexOf(".");
if (_local3 > -1) {
var _local5 = Math.pow(10, baseNDecoder(s.substring(_local3 + 1, s.length)));
return((baseNDecoder(s.substring(0, _local3)) / _local5) * _local4);
}
return(baseNDecoder(s) * _local4);
}
function baseNEncoder(n, minchars) {
if (!minchars) {
minchars = 1;
}
var _local4 = "";
while (n != 0) {
n = Math.round(n);
var _local3 = n % bitSize;
if (Math.round(_local3) != _local3) {
trace((((((((("BaseN failed on " + n) + "%") + bitSize) + " = ") + _local3) + " ") + int(n)) + " ") + int(bitSize));
}
_local4 = hashIndex.charAt(_local3) + _local4;
debug.lastencode = debug.lastencode + (((((((("\t-> n:" + n) + " % bitSize:") + bitSize) + " = ") + _local3) + ", final char=") + _local4) + newline);
n = n - _local3;
n = n / bitSize;
}
if (minchars) {
while (_local4.length < minchars) {
_local4 = hashIndex.charAt(0) + _local4;
}
}
return(_local4);
}
function baseNDecoder(s) {
var _local2 = 0;
var _local6 = 0;
i = 0;
while (i < s.length) {
var _local3 = s.charAt((s.length - i) - 1);
if (_local3 == hashIndex.charAt(0)) {
var _local5 = 0;
} else {
var _local5 = hashVal[_local3] * Math.pow(bitSize, i);
}
_local2 = _local2 + _local5;
if (_local2 >= ceiling) {
_local6 = _local6 + ((_local2 - (_local2 % ceiling)) / ceiling);
_local2 = _local2 % ceiling;
}
i++;
}
if (_local6 > 0) {
_local2 = "" + _local2;
while (_local2.length < (ceiling.toString().length - 1)) {
_local2 = "0" + _local2;
}
_local2 = ("" + _local6) + _local2;
}
return(_local2);
}
var debug = new Object();
}
Symbol 823 MovieClip [__Packages.com.Newgrounds.NewgroundsAPIError] Frame 0 (1.87 KiB) ●
class com.Newgrounds.NewgroundsAPIError
{
var message, name, alias;
function NewgroundsAPIError (error, msg) {
if (Number(error).toString() == String(error)) {
error = Number(error);
} else if (error_codes[String(error)]) {
error = error_codes[String(error)];
} else {
error = 0;
}
code = error;
message = msg;
name = error_names[error];
alias = aliases[error];
}
static function init_codes() {
var _local2 = new Object();
var _local1 = 0;
while (_local1 < aliases.length) {
_local2[aliases[_local1]] = _local1;
_local1++;
}
return(_local2);
}
static function init_names() {
var _local5 = new Array();
var _local3 = 0;
while (_local3 < aliases.length) {
var _local2 = aliases[_local3].toLowerCase().split("_");
var _local1 = 0;
while (_local1 < _local2.length) {
_local2[_local1] = _local2[_local1].substr(0, 1).toUpperCase() + _local2[_local1].substr(1, _local2[_local1].length);
for (var _local4 in always_caps) {
if (_local2[_local1].toUpperCase() == always_caps[_local4]) {
_local2[_local1] = _local2[_local1].toUpperCase();
}
}
_local1++;
}
_local5[_local3] = _local2.join(" ");
_local3++;
}
return(_local5);
}
function isError() {
return(true);
}
static var 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_FOLDER", "FILE_NOT_FOUND", "SITE_ID_REQUIRED", "UPLOAD_IN_PROGRESS", "USER_CANCELLED", "CONFIRM_REQUEST", "CONNECTION_FAILED");
static var always_caps = new Array("API", "URL", "ID");
static var error_codes = init_codes();
static var error_names = init_names();
var code = 0;
}
Symbol 824 MovieClip [__Packages.com.Newgrounds.NewgroundsAPI] Frame 0 (32.18 KiB) ● ● ● ●
class com.Newgrounds.NewgroundsAPI
{
static var version, user_email, movie_id, debug, session_id, publisher_id, timeout, connected, tracker_id, encryption_key, user_id, user_name, host, error_format, normal_format, link_format, header_format, ad_url, ad_swf_url;
function NewgroundsAPI () {
}
static function setMovieVersion(v) {
if (v) {
version = String(v);
}
}
static function setUserEmail(e) {
user_email = e;
}
static function getOfficialVersionURL() {
var _local1 = (((((GATEWAY_URL + "?tracker_id=") + movie_id) + "&command_id=") + getCommandID("loadOfficalVersion")) + "&seed=") + Math.random();
if (debug) {
_local1 = _local1 + "&debug=1";
}
return(_local1);
}
static function hasUserSession() {
if (session_id && (publisher_id)) {
return(true);
}
if (_root.NewgroundsAPI_PublisherID && (_root.NewgroundsAPI_SessionID)) {
return(true);
}
return(false);
}
static function isNewgrounds() {
return(((publisher_id == 1) || (_root.NewgroundsAPI_PublisherID == 1)) || (getHost().toLowerCase().indexOf("ungrounded.net") > -1));
}
static function hasPublisher() {
return(publisher_id || (_root.NewgroundsAPI_PublisherID));
}
static function hasUserEmail() {
if (user_email) {
return(true);
}
return(false);
}
static function connectionTimeOut() {
clearInterval(timeout);
callListener(events.MOVIE_CONNECTED, false, new com.Newgrounds.NewgroundsAPIError("CONNECTION_FAILED", "Connection to NewgroundsAPI gateway timed out."));
}
static function connectMovie(m_id, encrypt_key, debug_mode) {
if (connected) {
return(undefined);
}
var _local2 = function () {
com.Newgrounds.NewgroundsAPI.connectionTimeOut();
};
timeout = setInterval(_local2, 8000, null);
if (!m_id) {
fatalError("NewgroundsAPI.connectMovie() - missing required movie_id parameter", "connectMovie");
}
movie_id = String(m_id);
tracker_id = Number(movie_id.substring(0, movie_id.indexOf(":")));
encryption_key = encrypt_key;
debug = debug_mode;
if (_root.NewgroundsAPI_PublisherID) {
publisher_id = _root.NewgroundsAPI_PublisherID;
if (_root.NewgroundsAPI_SessionID) {
session_id = _root.NewgroundsAPI_SessionID;
}
} else {
publisher_id = 1;
session_id = null;
user_id = 0;
user_name = "Guest";
}
if (_root.NewgroundsAPI_UserName) {
user_name = _root.NewgroundsAPI_UserName;
}
if (_root.NewgroundsAPI_UserID) {
user_id = _root.NewgroundsAPI_UserID;
}
connected = true;
sendCommand("connectMovie", {host:getHost(), movie_version:version});
}
static function getHost() {
if (!host) {
var _local1 = _url;
if ((_local1.indexOf("http://") > -1) or (_local1.indexOf("https://") > -1)) {
host = _local1.split("/")[2].toLowerCase();
} else {
host = "localhost";
}
}
return(host);
}
static function loadNewgrounds() {
sendCommand("loadNewgrounds", {host:getHost()}, true);
}
static function loadMySite() {
sendCommand("loadMySite", {host:getHost()});
}
static function loadCustomLink(link) {
sendCommand("loadCustomLink", {host:getHost(), link:link}, true);
}
static function logCustomEvent(event) {
sendCommand("logCustomEvent", {host:getHost(), event:event});
}
static function postScore(score, value, get_best) {
if ((!score) or (value == undefined)) {
sendError({command_id:getCommandID("postScore")}, new com.Newgrounds.NewgroundsAPIError("MISSING_PARAM", "missing required parameter(s)"));
return(undefined);
}
sendSecureCommand("postScore", {score:score, value:value, get_best:get_best});
}
static function getTodaysScores(score, params) {
getScores(score, "t", params, "getTodaysScores");
}
static function getYesterdaysScores(score, params) {
getScores(score, "y", params, "getYesterdaysScores");
}
static function getThisWeeksScores(score, params) {
getScores(score, "w", params, "getThisWeeksScores");
}
static function getThisMonthsScores(score, params) {
getScores(score, "m", params, "getThisMonthsScores");
}
static function getThisYearsScores(score, params) {
getScores(score, "y", params, "getThisYearsScores");
}
static function getAlltimeScores(score, params) {
getScores(score, "a", params, "getAlltimeScores");
}
static function getScores(score, period, params, command_name) {
if (!score) {
sendError({command_id:getCommandID(command_name)}, new com.Newgrounds.NewgroundsAPIError("MISSING_PARAM", "missing required score name"));
return(undefined);
}
if (!params) {
params = new Object();
}
if (!hasUserSession()) {
callListener(events.SCORES_LOADED, false, new com.Newgrounds.NewgroundsAPIError("SITE_ID_REQUIRED", ("Host '" + getHost()) + "' does not have high scores enabled"));
return(undefined);
}
params.publisher_id = publisher_id;
params.period = period;
params.score = score;
if (params.user_id) {
var _local3 = period;
} else {
var _local3 = period + "-u";
}
if (score_page_counts[_local3] == undefined) {
params.request_page_count = true;
}
sendCommand("getScores", params);
}
static function unlockMedal(medal, get_score) {
if (!medal) {
sendError({command_id:getCommandID("unlockMedal")}, new com.Newgrounds.NewgroundsAPIError("MISSING_PARAM", "missing required medal name"));
return(undefined);
}
var _local1 = new Object();
_local1.medal = medal;
if (get_score) {
_local1.get_score = get_score;
}
sendSecureCommand("unlockMedal", _local1);
}
static function loadMedals() {
if (medals) {
callListener(events.MEDALS_LOADED, true, {medals:medals});
return(undefined);
}
var _local1 = new Object();
if (hasUserSession()) {
_local1.publisher_id = publisher_id;
_local1.user_id = user_id;
}
sendCommand("getMedals", _local1);
}
static function getMedals() {
return(medals);
}
static function saveLocal(save_id, save_data, size_allocation) {
if (!sharedObjects[save_id]) {
sharedObjects[save_id] = SharedObject.getLocal((("ng_ap_secure_" + movie_id) + "_") + save_id);
}
sharedObjects[save_id].data[save_id] = encodeData(save_data);
sharedObjects[save_id].flush();
}
static function loadLocal(save_id) {
if (!sharedObjects[save_id]) {
sharedObjects[save_id] = SharedObject.getLocal((("ng_ap_secure_" + movie_id) + "_") + save_id);
}
sharedObjects[save_id].flush();
if (sharedObjects[save_id].data[save_id]) {
return(decodeData(sharedObjects[save_id].data[save_id]));
}
return(null);
}
static function encodeData(data) {
return(compressHex(com.Newgrounds.RC4.encrypt(com.Newgrounds.JSON.encode(data), encryption_key)));
}
static function decodeData(base) {
return(com.Newgrounds.JSON.decode(com.Newgrounds.RC4.decrypt(uncompressHex(base), encryption_key)));
}
static function compressHex(hex_value) {
var _local5 = hex_value.length % 6;
var _local4 = "";
var _local1 = 0;
while (_local1 < hex_value.length) {
var _local2 = Number("0x" + hex_value.substr(_local1, 6));
_local4 = _local4 + compressor.encode(_local2, 4);
_local1 = _local1 + 6;
}
return(_local5 + _local4);
}
static function uncompressHex(base_value) {
var _local8 = Number(base_value.charAt(0));
var _local7 = "";
var _local3;
var _local2 = 1;
while (_local2 < base_value.length) {
var _local6 = base_value.substr(_local2, 4);
var _local5 = compressor.decode(_local6);
var _local1 = dec2hex(_local5);
if ((_local2 + 4) < base_value.length) {
_local3 = 6;
} else {
_local3 = _local8;
}
while (_local1.length < _local3) {
_local1 = "0" + _local1;
}
_local7 = _local7 + _local1;
_local2 = _local2 + 4;
}
return(_local7);
}
static function dec2hex(dec) {
var _local4 = "0123456789ABCDEF";
var _local3 = "";
while (dec > 0) {
var _local2 = dec % 16;
_local3 = _local4.charAt(_local2) + _local3;
dec = (dec - _local2) / 16;
}
return(_local3);
}
static function saveFile(folder, filename, contents, thumbnail_source) {
if (!save_file) {
save_file = new com.Newgrounds.NewgroundsAPISaveFile(movie_id, folder, filename);
save_file.setContents(contents);
if (thumbnail_source) {
save_file.setThumbnail(thumbnail_source);
}
save_file.onError = function (msg) {
var _local1 = new com.Newgrounds.NewgroundsAPIError("PERMISSION_DENIED", msg);
com.Newgrounds.NewgroundsAPI.sendError({command_id:com.Newgrounds.NewgroundsAPI.getCommandID("saveFile")}, _local1);
com.Newgrounds.NewgroundsAPI.callListener(com.Newgrounds.NewgroundsAPI.events.FILE_SAVED, false, _local1);
};
save_file.onCancel = function (msg) {
var _local1 = new com.Newgrounds.NewgroundsAPIError("USER_CANCELLED", msg);
com.Newgrounds.NewgroundsAPI.callListener(com.Newgrounds.NewgroundsAPI.events.FILE_SAVED, false, _local1);
};
save_file.submit();
} else {
var _local1 = new com.Newgrounds.NewgroundsAPIError("UPLOAD_IN_PROGRESS", "Please wait for the previous file to finish uploading");
sendError({command_id:getCommandID("saveFile")}, _local1);
callListener(events.FILE_SAVED, false, _local1);
}
}
static function checkFilePrivs(folder, filename) {
if (user_id) {
var _local1 = user_id;
} else {
var _local1 = 0;
}
var _local2 = {folder:folder, filename:filename, user_id:_local1, publisher_id:publisher_id};
sendCommand("checkFilePrivs", _local2);
}
static function finishFileSave(folder, filename, description, share, file, thumbnail) {
var _local2;
_local2 = {folder:folder, filename:filename, description:description, share:share};
var _local1;
_local1 = {file:file, thumbnail:thumbnail};
sendSecureCommand("saveFile", _local2, null, _local1);
}
static function getFiles(folder, options) {
var _local7 = {name:1, date:2, score:3};
var _local2 = {user_only:false, sort_on:"date", page:1, results_per_page:20, sort_descending:true};
var _local6 = new Array();
for (var _local10 in _local7) {
_local6.push(("'" + _local10) + "'");
}
var _local4 = new Array();
for (var _local9 in _local2) {
_local4.push(("'" + _local9) + "'");
}
if (options.sort_descending && (!_local7[options.sort_descending])) {
var _local3 = new com.Newgrounds.NewgroundsAPIError("MISSING_PARAM", (("'" + options.sort_descending) + "' is not a valid sort_on value. Valid values are: ") + _local6.join(", "));
sendError({command_id:getCommandID("getFiles")}, _local3);
delete options.sort_descending;
}
var _local8;
if (options) {
for (var _local10 in options) {
if (_local2[_local10] == undefined) {
var _local3 = new com.Newgrounds.NewgroundsAPIError("MISSING_PARAM", (("'" + _local10) + "' is not a valid option. Valid options are: ") + _local4.join(", "));
sendError({command_id:getCommandID("getFiles")}, _local3);
delete options[_local10];
} else if (typeof(options[_local10]) != typeof(_local2[_local10])) {
var _local3 = new com.Newgrounds.NewgroundsAPIError("MISSING_PARAM", (("option '" + _local10) + "' should be the following type: ") + typeof(_local2[_local10]));
sendError({command_id:getCommandID("getFiles")}, _local3);
delete options[_local10];
}
}
_local8 = options;
} else {
_local8 = new Object();
}
if (hasUserSession()) {
_local8.publisher_id = publisher_id;
_local8.user_id = user_id;
}
_local8.folder = folder;
sendCommand("getFiles", _local8);
}
static function getConfirmation(command_name, event, msg, target, confirm, cancel) {
var _local1 = new com.Newgrounds.NewgroundsAPIError("CONFIRM_REQUEST", msg);
_local1.confirm = function () {
target[confirm]();
};
_local1.cancel = function () {
target[cancel]();
};
_local1.command = getCommandID(command_name);
callListener(event, false, _local1);
}
static function doBlockHost(event) {
_root.stop();
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 _local2 = ("This movie has not been approved for use on " + getHost()) + ".";
_local2 = _local2 + "\r\rFor an aproved copy, please visit:\r";
var _local4 = _local2.length;
_local2 = _local2 + event.data.movie_url;
var _local3 = _local2.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(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 = _local2;
_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(normal_format);
link_format.url = event.data.redirect_url;
_root.NGAPI_deny_host_overlay.message.setTextFormat(_local4, _local3, link_format);
}
static function onNewVersionAvailable(event) {
_root.stop();
initTextFormats();
var _local2 = new Object();
_local2.x = Stage.width / 2;
_local2.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(_local2.x - 240, _local2.y - 120);
_root.NGAPI_new_version_overlay.lineTo(_local2.x + 240, _local2.y - 120);
_root.NGAPI_new_version_overlay.lineTo(_local2.x + 240, _local2.y + 80);
_root.NGAPI_new_version_overlay.lineTo(_local2.x - 240, _local2.y + 80);
_root.NGAPI_new_version_overlay.lineTo(_local2.x - 240, _local2.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(_local2.x + 210, _local2.y - 110);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 230, _local2.y - 110);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 230, _local2.y - 90);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 210, _local2.y - 90);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 210, _local2.y - 110);
_root.NGAPI_new_version_overlay.exit.endFill();
_root.NGAPI_new_version_overlay.exit.moveTo(_local2.x + 214, _local2.y - 106);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 226, _local2.y - 94);
_root.NGAPI_new_version_overlay.exit.moveTo(_local2.x + 226, _local2.y - 106);
_root.NGAPI_new_version_overlay.exit.lineTo(_local2.x + 214, _local2.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 _local3 = (("Version " + event.data.movie_version) + " is now available at:") + newline;
var _local6 = _local3.length;
_local3 = _local3 + event.data.movie_url;
var _local4 = _local3.length;
_root.NGAPI_new_version_overlay.createTextField("mouseblocker", 99, -10, -10, 1000, 1000);
_root.NGAPI_new_version_overlay.createTextField("newversion", 100, _local2.x - 210, _local2.y - 90, 400, 80);
_root.NGAPI_new_version_overlay.newversion.text = "New Version Available!";
_root.NGAPI_new_version_overlay.newversion.setTextFormat(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 = _local3;
_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(normal_format);
link_format.url = event.data.redirect_url;
_root.NGAPI_new_version_overlay.message.setTextFormat(_local6, _local4, link_format);
}
static function initTextFormats() {
if (!error_format) {
error_format = new TextFormat();
error_format.font = "Arial Black";
error_format.size = 48;
error_format.color = 16711680 /* 0xFF0000 */;
}
if (!header_format) {
header_format = new TextFormat();
header_format.font = "Arial Black";
header_format.size = 24;
header_format.color = 16777215 /* 0xFFFFFF */;
}
if (!normal_format) {
normal_format = new TextFormat();
normal_format.font = "Arial";
normal_format.bold = true;
normal_format.size = 12;
normal_format.color = 16777215 /* 0xFFFFFF */;
}
if (!link_format) {
link_format = new TextFormat();
link_format.color = 16776960 /* 0xFFFF00 */;
link_format.underline = true;
}
}
static function doEvent(e) {
switch (getCommandName(e.command_id)) {
case "connectMovie" :
clearInterval(timeout);
sendMessage("You have successfully connected to the Newgrounds API Gateway");
sendMessage(("Movie identified as \"" + e.movie_name) + "\"");
callListener(events.MOVIE_CONNECTED, e.success, {movie_name:e.movie_name});
var _local4 = false;
if (e.ad_status === -1) {
var _local6 = "This movie was not approved to run Flash Ads.";
sendWarning(_local6);
sendWarning(("visit " + AD_TERMS_URL) + " to view our approval guidelines");
if (!e.ad_url) {
callListener(events.ADS_APPROVED, false, new com.Newgrounds.NewgroundsAPIError("FLASH_ADS_NOT_APPROVED", _local6));
} else {
_local4 = true;
}
} else if (e.ad_status === 0) {
var _local6 = "Flash Ads are currently awaiting approval.";
sendNotice(_local6);
if (!e.ad_url) {
callListener(events.ADS_APPROVED, false, new com.Newgrounds.NewgroundsAPIError("FLASH_ADS_NOT_APPROVED", _local6));
} else {
_local4 = true;
}
}
if (e.ad_url) {
ad_url = unescape(e.ad_url);
if (!_local4) {
sendMessage("This movie has been approved to run Flash Ads!");
}
callListener(events.ADS_APPROVED, true);
}
if (e.deny_host) {
var _local6 = getHost() + " does not have permission to run this movie!";
sendWarning(_local6);
sendWarning("\tUpdate your API configuration to unblock " + getHost());
callListener(events.HOST_BLOCKED, true, {movie_url:unescape(e.movie_url), redirect_url:getOfficialVersionURL()});
}
if (e.movie_version) {
sendWarning("According to your API Configuration, this version is out of date.");
if (version) {
sendWarning("\tThe this movie is version " + version);
}
sendWarning("\tThe most current version is " + e.movie_version);
callListener(events.NEW_VERSION_AVAILABLE, true, {movie_version:e.movie_version, movie_url:unescape(e.movie_url), redirect_url:getOfficialVersionURL()});
}
if (e.request_portal_url) {
sendCommand("setPortalID", {portal_url:_url});
}
break;
case "logCustomEvent" :
if (e.success) {
sendMessage(("Event '" + e.event) + "' was logged.");
}
callListener(events.EVENT_LOGGED, e.success, {event:e.event});
break;
case "postScore" :
var _local7;
if (e.success) {
var _local3 = "User";
if (user_email) {
_local3 = user_email;
} else if (user_name) {
_local3 = user_name;
}
sendMessage(((((_local3 + " posted ") + e.value) + " to '") + e.score) + "'");
_local7 = {score:e.score, value:e.value, username:_local3};
}
callListener(events.SCORE_POSTED, e.success, _local7);
break;
case "getScores" :
_local7 = new Object();
if (e.user_id) {
var _local5 = e.period;
} else {
var _local5 = e.period + "-u";
}
if (e.total_pages) {
score_page_counts[_local5] = e.total_pages;
}
_local7.user_id = e.user_id;
_local7.current_page = e.current_page;
_local7.total_pages = score_page_counts[_local5];
_local7.scores = e.scores;
_local7.period = getPeriodName(e.period);
callListener(events.SCORES_LOADED, e.success, _local7);
break;
case "unlockMedal" :
if (medals) {
var _local2 = 0;
while (_local2 < medals.length) {
if (medals[_local2].medal_name === e.medal_name) {
medals[_local2].medal_unlocked = true;
break;
}
_local2++;
}
}
_local7 = {medal_name:e.medal_name, medal_value:e.medal_value, medal_difficulty:e.medal_difficulty};
callListener(events.MEDAL_UNLOCKED, e.success, _local7);
break;
case "getMedals" :
medals = e.medals;
_local7 = {medals:e.medals};
callListener(events.MEDALS_LOADED, e.success, _local7);
break;
case "getFiles" :
break;
case "getSystemFiles" :
break;
case "saveFile" :
save_file = null;
_local7 = {file_id:e.file_id, filename:e.filename, file_url:e.file_url, thumbnail:e.thumbnail, icon:e.icon};
callListener(events.FILE_SAVED, e.success, _local7);
break;
case "checkFilePrivs" :
if (save_file) {
save_file.checkPrivs(e);
} else {
_local7 = {filename:e.filename, folder:e.folder, can_read:e.can_read, can_write:e.can_write};
callListener(events.FILE_PRIVS_LOADED, e.success, _local7);
}
}
}
static function setDefaultListeners() {
var _local1 = new Array();
_local1[events.HOST_BLOCKED] = {listener:doBlockHost};
_local1[events.NEW_VERSION_AVAILABLE] = {listener:onNewVersionAvailable};
return(_local1);
}
static function addEventListener(event, listener, params) {
listeners[event] = {listener:listener, params:params};
}
static function removeEventListener(event) {
delete listeners[event];
}
static function getEventName(event) {
for (var _local2 in events) {
if (events[_local2] == event) {
return(_local2);
}
}
return(undefined);
}
static function callListener(event, success, data, target) {
echo("Fired Event: " + getEventName(event));
if (listeners[event]) {
if (data.isError()) {
listeners[event].listener({event:event, success:success, error:data, target:target}, listeners[event].params);
} else {
listeners[event].listener({event:event, success:success, data:data, target:target}, listeners[event].params);
}
}
}
static function getCommandName(id) {
return(id);
}
static function getCommandID(name) {
return(name);
}
static function getPeriodAliases() {
var _local1 = new Object();
for (var _local2 in period_aliases) {
_local1[period_aliases[_local2].alias] = _local2;
}
return(_local1);
}
static function getPeriodName(p) {
for (var _local2 in period_aliases) {
if (_local2 == p) {
return(period_aliases[_local2].name);
}
}
return(null);
}
static function getPeriodAlias(p) {
for (var _local2 in period_aliases) {
if (_local2 == p) {
return(period_aliases[_local2].alias);
}
}
return(null);
}
static function sendError(c, e) {
trace((((((("[NewgroundsAPI ERROR] :: " + getCommandName(c.command_id)) + "() - ") + e.name) + ":") + newline) + "\t\t\t\t") + e.message);
}
static function sendWarning(m, c) {
if (c) {
m = m + ((("\r[NewgroundsAPI WARNING] :: \tSee " + COMMANDS_WIKI_URL) + c.toLowerCase()) + " for additional information.");
}
trace("[NewgroundsAPI WARNING] :: " + m);
}
static function sendNotice(m, c) {
if (c) {
m = m + ((("\r[NewgroundsAPI NOTICE] :: \tSee " + COMMANDS_WIKI_URL) + c.toLowerCase()) + " for additional information.");
}
trace("[NewgroundsAPI NOTICE] :: " + m);
}
static function fatalError(m, c) {
if (c) {
m = m + ((("\r\tSee " + COMMANDS_WIKI_URL) + c.toLowerCase()) + " for additional information.");
}
throw (((("***ERROR*** frame=" + _root._currentframe) + ", class=NewgroundsAPI") + newline) + newline) + m;
}
static function sendSecureCommand(command, secure_params, unsecure_params, files) {
if (((!debug) && (!hasUserSession())) && (!hasUserEmail())) {
sendError({command_id:getCommandID(command)}, new com.Newgrounds.NewgroundsAPIError("IDENTIFICATION_REQUIRED", ("You must be logged in or provide an e-mail address ( using NewgroundsAPI.setUserEmail(\"name@domain.com\"); ) to use " + command) + "()."));
return(undefined);
}
if (!command) {
fatalError("Missing command", "sendSecureCommand");
}
if (!secure_params) {
fatalError("Missing secure_params", "sendSecureCommand");
}
if (!unsecure_params) {
unsecure_params = new Object();
}
var _local2 = "";
var _local1 = 0;
while (_local1 < 16) {
_local2 = _local2 + compression_radix.charAt(Math.floor(Math.random() * compression_radix.length));
_local1++;
}
if (debug) {
secure_params.session_id = "";
} else {
secure_params.session_id = session_id;
}
secure_params.as_version = 2;
secure_params.user_email = user_email;
secure_params.publisher_id = publisher_id;
secure_params.seed = _local2;
secure_params.command_id = getCommandID(command);
var _local8 = com.Newgrounds.MD5.calculate(_local2);
var _local6 = com.Newgrounds.RC4.encrypt(com.Newgrounds.JSON.encode(secure_params), encryption_key);
var _local7 = _local8 + _local6;
unsecure_params.secure = compressHex(_local7);
sendCommand("securePacket", unsecure_params, false, files);
}
static function sendCommand(command, params, open_browser, files) {
if ((!connected) and (command != "connectMovie")) {
var _local11 = (("NewgroundsAPI." + command) + "() - NewgroundsAPI.connectMovie() must be called before this command can be called") + newline;
fatalError(_local11, "connectMovie");
}
if (open_browser) {
var _local1 = new Object();
} else {
var _local1 = new LoadVars();
}
_local1.command_id = getCommandID(command);
_local1.tracker_id = movie_id;
if (debug) {
_local1.debug = debug;
}
if (params) {
for (var _local8 in params) {
_local1[_local8] = params[_local8];
}
}
if (files) {
for (var _local8 in files) {
_local1[_local8] = files[_local8];
}
}
echo(("OUTPUT: \r" + com.Newgrounds.JSON.encode(_local1)) + newline);
if (open_browser) {
var _local5 = (GATEWAY_URL + "?seed=") + Math.random();
for (var _local8 in _local1) {
_local5 = _local5 + ((("&" + escape(_local8)) + "=") + escape(_local1[_local8]));
}
getURL (_local5, "_blank");
_local1.removeMovieClip();
} else {
var _local9 = new LoadVars();
_local9.onData = function (data) {
com.Newgrounds.NewgroundsAPI.echo(("INPUT: \r" + data) + newline);
if (data) {
var _local1 = com.Newgrounds.JSON.decode(data);
} else {
var _local1 = {success:false};
}
if (!_local1.success) {
var _local3 = new com.Newgrounds.NewgroundsAPIError(_local1.error_code, _local1.error_msg);
com.Newgrounds.NewgroundsAPI.sendError(_local1, _local3);
} else {
com.Newgrounds.NewgroundsAPI.doEvent(_local1);
}
};
var _local4 = new Array();
for (var _local7 in _local1) {
_local4.push((_local7 + "=") + escape(_local1[_local7]));
}
echo((("POST " + GATEWAY_URL) + "?") + _local4.join("&"));
_local1.sendAndLoad((GATEWAY_URL + "?seed=") + Math.random(), _local9, "POST");
}
}
static function renderAd(target) {
if (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 (ad_swf_url, target.clip.ad);
callListener(events.AD_ATTACHED, true, null, target);
} else {
callListener(events.AD_ATTACHED, false, new com.Newgrounds.NewgroundsAPIError("FLASH_ADS_NOT_APPROVED", "Unable to render ad"));
}
}
static function attachFlashAd(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");
sendMessage("You may get a security sandbox violation from this ad. This is nothing to worry about!");
if (resetAdTimer()) {
if (ad_url) {
var _local1 = new LoadVars();
_local1.onData = function (data) {
if (data) {
com.Newgrounds.NewgroundsAPI.ad_swf_url = data;
} else {
com.Newgrounds.NewgroundsAPI.ad_swf_url = null;
}
com.Newgrounds.NewgroundsAPI.renderAd(target);
};
if (ad_url.indexOf("?") > -1) {
_local1.load((ad_url + "&random=") + Math.random());
} else {
_local1.load((ad_url + "?random=") + Math.random());
}
}
} else {
renderAd(target);
}
}
static function resetAdTimer() {
if (!ad_url) {
return(false);
}
var _local1 = new Date();
if (_local1.getTime() >= ad_reset) {
ad_reset = _local1.getTime() + 300000;
return(true);
}
return(false);
}
static function sendMessage(m, r) {
var _local1 = "[NewgroundsAPI] :: " + m;
if (r) {
return(_local1);
}
trace(_local1);
}
static function echo(m) {
if (do_echo) {
trace(m);
}
}
static var do_echo = false;
static var GATEWAY_URL = "http://www.ngads.com/gateway_v2.php";
static var AD_TERMS_URL = "http://www.newgrounds.com/wiki/flashads/terms/";
static var COMMANDS_WIKI_URL = "http://www.newgrounds.com/wiki/flashapi/commands/";
static var ad_reset = 0;
static var save_file = null;
static var medals = null;
static var score_page_counts = new Object();
static var compression_radix = "/g8236klvBQ#&|;Zb*7CEA59%s`Oue1wziFp$rDVY@TKxUPWytSaGHJ>dmoMR^<0~4qNLhc(I+fjn)X";
static var compressor = new com.Newgrounds.BaseN(compression_radix);
static var errors = com.Newgrounds.NewgroundsAPIError.init_codes();
static var sharedObjects = new Object();
static var events = {MOVIE_CONNECTED:1, ADS_APPROVED:2, AD_ATTACHED:3, HOST_BLOCKED:4, NEW_VERSION_AVAILABLE:5, EVENT_LOGGED:6, SCORE_POSTED:7, SCORES_LOADED:8, MEDAL_UNLOCKED:9, MEDALS_LOADED:10, FILE_PRIVS_LOADED:11, FILE_SAVED:12};
static var listeners = setDefaultListeners();
static var periods = getPeriodAliases();
static var period_aliases = {t:{name:"Today", alias:"TODAY"}, p:{name:"Yesterday", alias:"YESTERDAY"}, w:{name:"This Week", alias:"THIS_WEEK"}, m:{name:"This Month", alias:"THIS_MONTH"}, y:{name:"This Year", alias:"THIS_YEAR"}, a:{name:"All-Time", alias:"ALL_TIME"}};
}
Symbol 825 MovieClip [__Packages.com.Newgrounds.NewgroundsAPISaveFile] Frame 0 (2.09 KiB) ●
class com.Newgrounds.NewgroundsAPISaveFile
{
var tracker_id, folder, filename, contents, thumbnail, icon_url, thumbnail_url, description, scan, scanner;
function NewgroundsAPISaveFile (tracker_id, folder, filename) {
this.tracker_id = tracker_id;
this.folder = folder;
this.filename = filename;
contents = null;
thumbnail = null;
icon_url = null;
thumbnail_url = null;
}
function setDescription(description) {
this.description = description;
}
function setShared(share) {
this.share = share;
}
function setContents(contents) {
this.contents = contents;
}
function setThumbnail(thumb) {
if (thumb) {
thumbnail = thumb;
} else {
thumbnail = null;
}
}
function onError(msg) {
trace("[NewgroundsAPISaveFile ERROR] :: " + msg);
}
function onCancel(msg) {
trace("[NewgroundsAPISaveFile] :: " + msg);
}
function submit() {
scan = null;
com.Newgrounds.NewgroundsAPI.checkFilePrivs(folder, filename);
}
function checkPrivs(p) {
if (p.success) {
if (p.can_write) {
can_write = p.can_write;
if (p.exists) {
com.Newgrounds.NewgroundsAPI.getConfirmation("saveFile", com.Newgrounds.NewgroundsAPI.events.FILE_SAVED, ("File '" + filename) + "' exists, overwrite?", this, "startFile", "cancelFile");
} else {
startFile();
}
} else {
onError("This filename is owned by another user.");
}
} else {
onError("There was a problem looking up your file's details");
}
}
function cancelFile() {
onCancel("Overwrite was cancelled");
}
function startFile() {
if (can_write) {
if (thumbnail) {
scanner = new com.Newgrounds.ImageScanner(thumbnail);
scanner.setCallback(this, "writeFile");
scanner.startScan(100, 100, true);
} else {
writeFile();
}
} else {
onError(("You cannot write to filename \"" + filename) + "\"");
}
}
function writeFile(img) {
trace("FINISHED");
com.Newgrounds.NewgroundsAPI.finishFileSave(folder, filename, description, share, com.Newgrounds.JSON.encode(contents), img);
}
var can_write = false;
var share = true;
}
Symbol 826 MovieClip [__Packages.com.Newgrounds.ImageScanner] Frame 0 (6.3 KiB) ● ●
class com.Newgrounds.ImageScanner
{
var image_source, source_width, source_height, sourceBitmap, callback_target, callback_function, hash, cube, basen, xpos, ypos, pixels, busy, canvas_width, canvas_height, resizedBitmap, copyBitmap, output, draw_interval, callback_interval;
function ImageScanner (the_source) {
if (the_source) {
image_source = the_source;
} else {
image_source = _root;
}
reset();
if (typeof(image_source) == "movieclip") {
if (image_source == _root) {
source_width = Stage.width;
source_height = Stage.height;
} else {
source_width = Math.floor(image_source._width);
source_height = Math.floor(image_source._height);
}
sourceBitmap = new flash.display.BitmapData(source_width, source_height, false, 4294967295);
sourceBitmap.draw(_root);
} else if (image_source.width) {
source_width = image_source.width;
source_height = image_source.height;
sourceBitmap = image_source;
} else {
error("You can only use BitMaptData and MovieClip objects to create images");
}
}
function setCallback(target, funct) {
if (target && (funct)) {
callback_target = target;
callback_function = funct;
}
}
function reset() {
callback_target = null;
callback_function = null;
debug.bad_pixels = 0;
hash = "0123456789aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ<>?:;-_=+()!&";
var _local3 = Math.pow(hash.length, 2);
trace("MAX COLORS: " + _local3);
var _local2 = Math.floor(Math.pow(_local3, 0.333333333333333)) - 1;
var _local4 = Math.pow(_local2, 3);
cube = _local2;
basen = new com.Newgrounds.BaseN(hash);
xpos = 0;
ypos = 0;
pixels = 0;
busy = false;
}
function startScan(w, h, s) {
if (w) {
image_width = w;
}
if (h) {
image_height = h;
}
if (s != undefined) {
crop = s;
}
var _local7 = _root.getNextHighestDepth();
var _local6 = _root.createEmptyMovieClip("API_image_container_" + _local7, _local7);
var _local5 = _local6.createEmptyMovieClip("canvas", 100);
_local5.attachBitmap(sourceBitmap, 100);
if (crop) {
if ((image_width / source_width) > (image_height / source_height)) {
canvas_width = image_width;
canvas_height = Math.ceil(source_height * (image_width / source_width));
} else {
canvas_height = image_height;
canvas_width = Math.ceil(source_width * (image_height / source_height));
}
} else {
canvas_width = image_width;
canvas_height = image_height;
}
_local5._x = Math.round((image_width - canvas_width) / 2);
_local5._width = canvas_width;
_local5._height = canvas_height;
resizedBitmap = new flash.display.BitmapData(image_width, image_height, false, 4294967295);
resizedBitmap.draw(_local6);
_local6.removeMovieClip();
copyBitmap = new flash.display.BitmapData(image_width, image_height, false, 4294967295);
var _local3 = "" + image_width;
while (_local3.length < 3) {
_local3 = "0" + _local3;
}
var _local4 = "" + image_height;
while (_local4.length < 3) {
_local4 = "0" + _local4;
}
output = _local3 + _local4;
draw_interval = setInterval(this, "drawChunk", 10);
busy = false;
return(resizedBitmap);
}
function getBitmapData() {
return(copyBitmap);
}
function getBytesTotal() {
return((image_width * image_height) * 2);
}
function getBytesScanned() {
return(pixels * 2);
}
function drawChunk() {
if (!busy) {
busy = true;
var _local2 = 0;
while (_local2 < 250) {
if (!nextPixel()) {
clearInterval(draw_interval);
callback_interval = setInterval(this, "doCallback", 25);
busy = true;
break;
}
_local2++;
}
busy = false;
}
}
function doCallback() {
busy = false;
clearInterval(callback_interval);
if (callback_target and callback_function) {
callback_target[callback_function](output);
} else {
onScanComplete(output);
}
}
function onScanComplete(packet) {
sendMessage(("packet size: " + output.length) + " bytes", "onScanComplete");
}
function nextPixel() {
var _local15 = xpos;
var _local14 = ypos;
var _local7 = resizedBitmap.getPixel(_local15, _local14);
var _local17 = (_local7 >> 16) & 255;
var _local20 = (_local7 >> 8) & 255;
var _local16 = (_local7 >> 0) & 255;
var _local11 = Math.round(((_local17 + 1) / 256) * cube);
var _local10 = Math.round(((_local20 + 1) / 256) * cube);
var _local13 = Math.round(((_local16 + 1) / 256) * cube);
var _local12 = (((_local11 * (cube + 1)) * (cube + 1)) + (_local10 * (cube + 1))) + _local13;
var _local6 = basen.encode(_local12, 2);
output = output + _local6;
if (_local6.length != 2) {
trace("bad pixel " + _local6);
}
var _local5 = basen.decode(_local6);
var _local18 = _local5;
var _local8 = _local5 % (cube + 1);
_local5 = (_local5 - _local8) / (cube + 1);
var _local9 = _local5 % (cube + 1);
var _local19 = (_local5 - _local9) / (cube + 1);
if (((_local13 != _local8) and (_local10 != _local9)) and (_local11 != _local10)) {
debug.bad_pixels++;
trace((((((("BAD PIXEL " + debug.bad_pixels) + ") ") + _local12) + " != ") + _local18) + " ") + _local6);
trace(basen.debug.lastencode);
}
var _local2 = Math.round((_local19 / cube) * 255).toString(16);
var _local4 = Math.round((_local9 / cube) * 255).toString(16);
var _local3 = Math.round((_local8 / cube) * 255).toString(16);
while (_local2.length < 2) {
_local2 = "0" + _local2;
}
while (_local4.length < 2) {
_local4 = "0" + _local4;
}
while (_local3.length < 2) {
_local3 = "0" + _local3;
}
copyBitmap.setPixel(_local15, _local14, Number((("0x" + _local2) + _local4) + _local3));
pixels++;
if (pixels >= (image_width * image_height)) {
return(false);
}
xpos++;
if (xpos >= image_width) {
xpos = 0;
ypos++;
}
return(true);
}
function error(e, f) {
sendMessage(e, f, "ERROR");
}
function sendMessage(msg, func, type) {
var _local1 = "ImageScanner";
if (func) {
_local1 = _local1 + (("." + func) + "()");
}
if (type) {
_local1 = (type + " in ") + _local1;
}
_local1 = _local1 + (" :: " + msg);
trace(_local1);
}
var image_width = 100;
var image_height = 100;
var crop = true;
var debug = new Object();
}
Symbol 827 MovieClip [__Packages.com.Newgrounds.JSON] Frame 0 (7.05 KiB) ● ●
class com.Newgrounds.JSON
{
function JSON () {
}
static function encode(arg, noquotes) {
var _local3;
var _local2;
var _local6;
var _local1 = "";
var _local4;
if (arg.isSServerVar()) {
var _local8 = "sservervariable";
} else {
var _local8 = typeof(arg);
}
switch (_local8) {
case "sservervariable" :
return("?" + arg.getEncodedValue());
case "object" :
if (arg) {
if (arg instanceof Array) {
_local2 = 0;
while (_local2 < arg.length) {
_local4 = encode(arg[_local2]);
if (_local1) {
_local1 = _local1 + ",";
}
_local1 = _local1 + _local4;
_local2++;
}
return(("[" + _local1) + "]");
}
if (typeof(arg.toString) != "undefined") {
for (_local2 in arg) {
_local4 = arg[_local2];
if ((typeof(_local4) != "undefined") && (typeof(_local4) != "function")) {
_local4 = encode(_local4);
if (_local1) {
_local1 = _local1 + ",";
}
_local1 = _local1 + ((encode(_local2) + ":") + _local4);
}
}
return(("{" + _local1) + "}");
}
}
return("null");
case "number" :
return((isFinite(arg) ? (String(arg)) : "null"));
case "string" :
_local6 = arg.length;
if (noquotes) {
var _local7 = "";
} else {
var _local7 = "\"";
}
_local1 = _local7;
_local2 = 0;
while (_local2 < _local6) {
_local3 = arg.charAt(_local2);
if (_local3 >= " ") {
if ((_local3 == "\\\\") || (_local3 == "\"")) {
_local1 = _local1 + "\\\\";
}
_local1 = _local1 + _local3;
} else {
switch (_local3) {
case "\\b" :
_local1 = _local1 + "\\\\b";
break;
case "\\f" :
_local1 = _local1 + "\\\\f";
break;
case "\\n" :
_local1 = _local1 + "\\\\n";
break;
case "\\r" :
_local1 = _local1 + "\\\\r";
break;
case "\\t" :
_local1 = _local1 + "\\\\t";
break;
default :
_local3 = _local3.charCodeAt();
_local1 = _local1 + (("\\\\u00" + Math.floor(_local3 / 16).toString(16)) + (_local3 % 16).toString(16));
}
}
_local2 = _local2 + 1;
}
return(_local1 + _local7);
case "boolean" :
return(String(arg));
}
return("null");
}
static function decode(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 = at + 1;
return(ch);
};
var _white = function () {
while (ch) {
if (ch <= " ") {
_next();
} else if (ch == "/") {
switch (_next()) {
case "/" :
while ((_next() && (ch != "\\n")) && (ch != "\\r")) {
}
break;
case "*" :
_next();
for(;;){
if (ch) {
if (ch == "*") {
if (_next() == "/") {
_next();
// unexpected jump
}
} else {
_next();
}
} else {
_error("Unterminated comment");
}
};
break;
default :
_error("Syntax error");
}
} else {
return;
}
}
};
var _string = function () {
var _local4;
var _local1 = "";
var _local3;
var _local2;
var _local5 = false;
if (ch == "\"") {
while (_next()) {
if (ch == "\"") {
_next();
return(_local1);
}
if (ch == "\\\\") {
switch (_next()) {
case "b" :
_local1 = _local1 + "\\b";
break;
case "f" :
_local1 = _local1 + "\\f";
break;
case "n" :
_local1 = _local1 + "\\n";
break;
case "r" :
_local1 = _local1 + "\\r";
break;
case "t" :
_local1 = _local1 + "\\t";
break;
case "u" :
_local2 = 0;
_local4 = 0;
while (_local4 < 4) {
_local3 = parseInt(_next(), 16);
if (!isFinite(_local3)) {
_local5 = true;
break;
}
_local2 = (_local2 * 16) + _local3;
_local4 = _local4 + 1;
}
if (_local5) {
_local5 = false;
break;
}
_local1 = _local1 + String.fromCharCode(_local2);
break;
default :
_local1 = _local1 + ch;
}
} else {
_local1 = _local1 + ch;
}
}
}
_error("Bad string");
};
var _array = function () {
var _local1 = [];
if (ch == "[") {
_next();
_white();
if (ch == "]") {
_next();
return(_local1);
}
while (ch) {
_local1.push(_value());
_white();
if (ch == "]") {
_next();
return(_local1);
}
if (ch != ",") {
break;
}
_next();
_white();
}
}
_error("Bad array");
};
var _object = function () {
var _local2;
var _local1 = {};
if (ch == "{") {
_next();
_white();
if (ch == "}") {
_next();
return(_local1);
}
while (ch) {
_local2 = _string();
_white();
if (ch != ":") {
break;
}
_next();
_local1[_local2] = _value();
_white();
if (ch == "}") {
_next();
return(_local1);
}
if (ch != ",") {
break;
}
_next();
_white();
}
}
_error("Bad object");
};
var _number = function () {
var _local1 = "";
var _local2;
if (ch == "-") {
_local1 = "-";
_next();
}
while ((ch >= "0") && (ch <= "9")) {
_local1 = _local1 + ch;
_next();
}
if (ch == ".") {
_local1 = _local1 + ".";
while ((_next() && (ch >= "0")) && (ch <= "9")) {
_local1 = _local1 + ch;
}
}
_local2 = 1 * _local1;
if (!isFinite(_local2)) {
_error("Bad number");
} else {
return(_local2);
}
};
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"))) {
break;
}
_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());
}
}
Symbol 828 MovieClip [__Packages.com.Newgrounds.RC4] Frame 0 (2.81 KiB) ●
class com.Newgrounds.RC4
{
function RC4 () {
}
static function encrypt(src, key) {
var _local3 = strToChars(src);
var _local1 = strToChars(key);
var _local2 = calculate(_local3, _local1);
return(charsToHex(_local2));
}
static function encryptbin(src, key) {
var _local3 = strToChars(src);
var _local1 = strToChars(key);
var _local2 = calculate(_local3, _local1);
return(_local2);
}
static function decrypt(src, key) {
var _local3 = hexToChars(src);
var _local1 = strToChars(key);
var _local2 = calculate(_local3, _local1);
return(charsToStr(_local2));
}
static function initialize(pwd) {
var _local2 = 0;
var _local3;
var _local4 = pwd.length;
var _local1 = 0;
while (_local1 <= 255) {
mykey[_local1] = pwd[_local1 % _local4];
sbox[_local1] = _local1;
_local1++;
}
_local1 = 0;
while (_local1 <= 255) {
_local2 = ((_local2 + sbox[_local1]) + mykey[_local1]) % 256;
_local3 = sbox[_local1];
sbox[_local1] = sbox[_local2];
sbox[_local2] = _local3;
_local1++;
}
}
static function calculate(plaintxt, psw) {
initialize(psw);
var _local1 = 0;
var _local2 = 0;
var _local9 = new Array();
var _local7;
var _local5;
var _local6;
var _local3 = 0;
while (_local3 < plaintxt.length) {
_local1 = (_local1 + 1) % 256;
_local2 = (_local2 + sbox[_local1]) % 256;
_local5 = sbox[_local1];
sbox[_local1] = sbox[_local2];
sbox[_local2] = _local5;
var _local4 = (sbox[_local1] + sbox[_local2]) % 256;
_local7 = sbox[_local4];
_local6 = plaintxt[_local3] ^ _local7;
_local9.push(_local6);
_local3++;
}
return(_local9);
}
static function charsToHex(chars) {
var _local4 = new String("");
var _local3 = new Array("0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "a", "b", "c", "d", "e", "f");
var _local1 = 0;
while (_local1 < chars.length) {
_local4 = _local4 + (_local3[chars[_local1] >> 4] + _local3[chars[_local1] & 15]);
_local1++;
}
return(_local4);
}
static function hexToChars(hex) {
var _local3 = new Array();
var _local1 = ((hex.substr(0, 2) == "0x") ? 2 : 0);
while (_local1 < hex.length) {
_local3.push(parseInt(hex.substr(_local1, 2), 16));
_local1 = _local1 + 2;
}
return(_local3);
}
static function charsToStr(chars) {
var _local3 = new String("");
var _local1 = 0;
while (_local1 < chars.length) {
_local3 = _local3 + String.fromCharCode(chars[_local1]);
_local1++;
}
return(_local3);
}
static function strToChars(str) {
var _local3 = new Array();
var _local1 = 0;
while (_local1 < str.length) {
_local3.push(str.charCodeAt(_local1));
_local1++;
}
return(_local3);
}
static var sbox = new Array(255);
static var mykey = new Array(255);
}
Symbol 829 MovieClip [__Packages.com.Newgrounds.MD5] Frame 0 (8.2 KiB) ● ●
class com.Newgrounds.MD5
{
function MD5 () {
}
static function calculate(src) {
return(hex_md5(src));
}
static function hex_md5(src) {
return(binl2hex(core_md5(str2binl(src), src.length * 8)));
}
static function core_md5(x, len) {
x[len >> 5] = x[len >> 5] | (128 << (len % 32));
x[(((len + 64) >>> 9) << 4) + 14] = len;
var _local4 = 1732584193 /* 0x67452301 */;
var _local3 = -271733879;
var _local2 = -1732584194;
var _local1 = 271733878 /* 0x10325476 */;
var _local5 = 0;
while (_local5 < x.length) {
var _local10 = _local4;
var _local9 = _local3;
var _local8 = _local2;
var _local7 = _local1;
_local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 0], 7, -680876936);
_local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 1], 12, -389564586);
_local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 2], 17, 606105819);
_local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 3], 22, -1044525330);
_local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 4], 7, -176418897);
_local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 5], 12, 1200080426);
_local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 6], 17, -1473231341);
_local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 7], 22, -45705983);
_local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 8], 7, 1770035416);
_local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 9], 12, -1958414417);
_local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 10], 17, -42063);
_local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 11], 22, -1990404162);
_local4 = md5_ff(_local4, _local3, _local2, _local1, x[_local5 + 12], 7, 1804603682);
_local1 = md5_ff(_local1, _local4, _local3, _local2, x[_local5 + 13], 12, -40341101);
_local2 = md5_ff(_local2, _local1, _local4, _local3, x[_local5 + 14], 17, -1502002290);
_local3 = md5_ff(_local3, _local2, _local1, _local4, x[_local5 + 15], 22, 1236535329);
_local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 1], 5, -165796510);
_local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 6], 9, -1069501632);
_local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 11], 14, 643717713);
_local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 0], 20, -373897302);
_local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 5], 5, -701558691);
_local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 10], 9, 38016083);
_local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 15], 14, -660478335);
_local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 4], 20, -405537848);
_local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 9], 5, 568446438);
_local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 14], 9, -1019803690);
_local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 3], 14, -187363961);
_local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 8], 20, 1163531501);
_local4 = md5_gg(_local4, _local3, _local2, _local1, x[_local5 + 13], 5, -1444681467);
_local1 = md5_gg(_local1, _local4, _local3, _local2, x[_local5 + 2], 9, -51403784);
_local2 = md5_gg(_local2, _local1, _local4, _local3, x[_local5 + 7], 14, 1735328473);
_local3 = md5_gg(_local3, _local2, _local1, _local4, x[_local5 + 12], 20, -1926607734);
_local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 5], 4, -378558);
_local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 8], 11, -2022574463);
_local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 11], 16, 1839030562);
_local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 14], 23, -35309556);
_local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 1], 4, -1530992060);
_local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 4], 11, 1272893353);
_local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 7], 16, -155497632);
_local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 10], 23, -1094730640);
_local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 13], 4, 681279174);
_local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 0], 11, -358537222);
_local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 3], 16, -722521979);
_local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 6], 23, 76029189);
_local4 = md5_hh(_local4, _local3, _local2, _local1, x[_local5 + 9], 4, -640364487);
_local1 = md5_hh(_local1, _local4, _local3, _local2, x[_local5 + 12], 11, -421815835);
_local2 = md5_hh(_local2, _local1, _local4, _local3, x[_local5 + 15], 16, 530742520);
_local3 = md5_hh(_local3, _local2, _local1, _local4, x[_local5 + 2], 23, -995338651);
_local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 0], 6, -198630844);
_local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 7], 10, 1126891415);
_local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 14], 15, -1416354905);
_local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 5], 21, -57434055);
_local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 12], 6, 1700485571);
_local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 3], 10, -1894986606);
_local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 10], 15, -1051523);
_local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 1], 21, -2054922799);
_local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 8], 6, 1873313359);
_local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 15], 10, -30611744);
_local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 6], 15, -1560198380);
_local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 13], 21, 1309151649);
_local4 = md5_ii(_local4, _local3, _local2, _local1, x[_local5 + 4], 6, -145523070);
_local1 = md5_ii(_local1, _local4, _local3, _local2, x[_local5 + 11], 10, -1120210379);
_local2 = md5_ii(_local2, _local1, _local4, _local3, x[_local5 + 2], 15, 718787259);
_local3 = md5_ii(_local3, _local2, _local1, _local4, x[_local5 + 9], 21, -343485551);
_local4 = safe_add(_local4, _local10);
_local3 = safe_add(_local3, _local9);
_local2 = safe_add(_local2, _local8);
_local1 = safe_add(_local1, _local7);
_local5 = _local5 + 16;
}
return(new Array(_local4, _local3, _local2, _local1));
}
static function md5_cmn(q, a, b, x, s, t) {
return(safe_add(bit_rol(safe_add(safe_add(a, q), safe_add(x, t)), s), b));
}
static function md5_ff(a, b, c, d, x, s, t) {
return(md5_cmn((b & c) | ((~b) & d), a, b, x, s, t));
}
static function md5_gg(a, b, c, d, x, s, t) {
return(md5_cmn((b & d) | (c & (~d)), a, b, x, s, t));
}
static function md5_hh(a, b, c, d, x, s, t) {
return(md5_cmn((b ^ c) ^ d, a, b, x, s, t));
}
static function md5_ii(a, b, c, d, x, s, t) {
return(md5_cmn(c ^ (b | (~d)), a, b, x, s, t));
}
static function bit_rol(num, cnt) {
return((num << cnt) | (num >>> (32 - cnt)));
}
static function safe_add(x, y) {
var _local1 = (x & 65535) + (y & 65535);
var _local2 = ((x >> 16) + (y >> 16)) + (_local1 >> 16);
return((_local2 << 16) | (_local1 & 65535));
}
static function str2binl(str) {
var _local3 = new Array();
var _local4 = 255;
var _local1 = 0;
while (_local1 < (str.length * 8)) {
_local3[_local1 >> 5] = _local3[_local1 >> 5] | ((str.charCodeAt(_local1 / 8) & _local4) << (_local1 % 32));
_local1 = _local1 + 8;
}
return(_local3);
}
static function binl2hex(binarray) {
var _local4 = new String("");
var _local3 = new String("0123456789abcdef");
var _local1 = 0;
while (_local1 < (binarray.length * 4)) {
_local4 = _local4 + (_local3.charAt((binarray[_local1 >> 2] >> (((_local1 % 4) * 8) + 4)) & 15) + _local3.charAt((binarray[_local1 >> 2] >> ((_local1 % 4) * 8)) & 15));
_local1++;
}
return(_local4);
}
}
Symbol 613 Button (33 B)
on (release) {
_parent.play();
}
Symbol 614 Button (61 B)
on (release) {
getURL ("http://newgrounds.com", "_blank");
}
Symbol 636 MovieClip Frame 44 (8 B)
stop();
Symbol 636 MovieClip Frame 46 (8 B)
stop();
Symbol 640 Button (61 B)
on (release) {
getURL ("http://newgrounds.com", "_blank");
}
Symbol 656 MovieClip Frame 2827 (8 B)
stop();
Symbol 659 Button (40 B)
on (release) {
this._visible = false;
}
Symbol 667 MovieClip Frame 1 (756 B)
_visible = false;
var checkConnection = function (event) {
if (!event.success) {
_visible = true;
gotoAndStop (3);
}
};
if (com.Newgrounds.NewgroundsAPI.isNewgrounds() || (_root.API_Settings.debug_mode)) {
com.Newgrounds.NewgroundsAPI.addEventListener(com.Newgrounds.NewgroundsAPI.events.MOVIE_CONNECTED, checkConnection);
if ((!com.Newgrounds.NewgroundsAPI.hasUserSession()) && (!_root.API_Settings.debug_mode)) {
_visible = true;
gotoAndStop (2);
}
}
com.Newgrounds.NewgroundsAPI.setMovieVersion(_root.API_Settings.movie_version);
com.Newgrounds.NewgroundsAPI.connectMovie(_root.API_Settings.movie_id, _root.API_Settings.enc_key, _root.API_Settings.debug_mode);
com.Newgrounds.NewgroundsAPI.loadMedals();
stop();
Symbol 681 MovieClip Frame 35 (49 B)
_root.setBlink();
_parent.gotoAndStop("alive");
Symbol 682 MovieClip Frame 1 (8 B)
stop();
Symbol 686 MovieClip Frame 1 (8 B)
stop();
Symbol 718 MovieClip Frame 95 (31 B)
stop();
_root.control = true;
Symbol 735 MovieClip Frame 1 (8 B)
stop();
Symbol 735 MovieClip Frame 111 (8 B)
stop();
Symbol 767 MovieClip Frame 1 (8 B)
stop();
Symbol 776 MovieClip Frame 1 (8 B)
stop();
Symbol 776 MovieClip Frame 7 (21 B)
this.gotoAndStop(1);
Symbol 800 MovieClip Frame 1 (8 B)
stop();
Symbol 800 MovieClip Frame 280 (15 B)
_root.reset();
Symbol 807 MovieClip Frame 1 (8 B)
stop();
Symbol 807 MovieClip Frame 17 (8 B)
stop();
Symbol 807 MovieClip Frame 18 (13 B)
prevFrame();
Symbol 819 MovieClip Frame 1 (652 B)
function unlockMedal(m_name) {
clearInterval(pop_delay);
var _local1 = com.Newgrounds.NewgroundsAPI.getMedals();
var _local2 = null;
for (i in _local1) {
if (_local1[i].medal_name == m_name) {
_local2 = _local1[i];
medal_name = _local2.medal_name;
medal_value = _local2.medal_value + "pts";
com.Newgrounds.NewgroundsAPI.unlockMedal(medal_name);
pop_delay = setInterval(endDelay, 3000);
_visible = true;
gotoAndPlay (2);
break;
}
}
}
function endDelay(params) {
gotoAndPlay (10);
clearInterval(pop_delay);
}
var pop_delay;
var medal_name = "?????";
var medal_value = "???";
_visible = false;
Symbol 819 MovieClip Frame 10 (131 B)
var myBitmapData = flash.display.BitmapData.loadBitmap(medal_name + ".gif");
medal_icon.attachBitmap(myBitmapData, 111);
stop();
Symbol 820 MovieClip Frame 1 (8 B)
stop();
Symbol 820 MovieClip Frame 3 (17 B)
gotoAndStop (1);
Symbol 820 MovieClip Frame 5 (17 B)
gotoAndStop (1);