Section 1
//AdLoader (CPMStar.AdLoader)
package CPMStar {
import flash.display.*;
import flash.events.*;
import flash.net.*;
import flash.system.*;
public class AdLoader extends Sprite {
private var contentspotid:String;
private var cpmstarLoader:Loader;
public function AdLoader(_arg1:String){
this.contentspotid = _arg1;
addEventListener(Event.ADDED, addedHandler);
}
private function addedHandler(_arg1:Event):void{
var _local2:String;
var _local3:DisplayObjectContainer;
removeEventListener(Event.ADDED, addedHandler);
Security.allowDomain("server.cpmstar.com");
_local2 = "http://server.cpmstar.com/adviewas3.swf";
_local3 = parent;
cpmstarLoader = new Loader();
cpmstarLoader.contentLoaderInfo.addEventListener(Event.INIT, dispatchHandler);
cpmstarLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, dispatchHandler);
cpmstarLoader.load(new URLRequest(((_local2 + "?contentspotid=") + contentspotid)));
addChild(cpmstarLoader);
}
private function dispatchHandler(_arg1:Event):void{
dispatchEvent(_arg1);
}
}
}//package CPMStar
Section 2
//myVerdana_0 (game_fla.myVerdana_0)
package game_fla {
import flash.text.*;
public dynamic class myVerdana_0 extends Font {
}
}//package game_fla
Section 3
//mMovieParticle (main.particles.mMovieParticle)
package main.particles {
import flash.display.*;
public class mMovieParticle extends mParticle {
public var obj;
public var incScale:Number;
public var rot;
public function mMovieParticle(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13:Number, _arg14:uint):void{
super(_arg1, _arg4, _arg5, _arg7, _arg8, _arg9, _arg10, _arg13, _arg14);
incScale = _arg12;
paintedType = 1;
obj = _arg2;
obj.width = (obj.width * _arg6);
obj.height = (obj.height * _arg6);
rot = _arg11;
if (_arg3 > 0){
obj.gotoAndStop(_arg3);
};
alpha = 1;
addChild(obj);
cacheAsBitmap = true;
}
}
}//package main.particles
Section 4
//mParticle (main.particles.mParticle)
package main.particles {
import flash.display.*;
public class mParticle extends MovieClip {
public var parentClip:MovieClip;
public var ay;
public var ax;
public var paintedType:Number;// = 0
public var color:uint;
public var sy;
public var timeLife:Number;
public var sx;
public var dy;
public var nextParticle:mParticle;
public var prevParticle;
public function mParticle(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8:Number, _arg9:uint):void{
paintedType = 0;
super();
x = _arg2;
y = _arg3;
sx = _arg4;
sy = _arg5;
ax = _arg6;
ay = _arg7;
dy = 0;
color = _arg9;
timeLife = _arg8;
parentClip = _arg1;
prevParticle = null;
nextParticle = parentClip.particleList;
if (parentClip.particleList){
parentClip.particleList.prevParticle = this;
};
parentClip.particleList = this;
parentClip.particleCount++;
paintedType = 0;
}
public function destroy():void{
if (parentClip.particleCount > 0){
if (prevParticle){
prevParticle.nextParticle = nextParticle;
};
if (nextParticle){
nextParticle.prevParticle = prevParticle;
};
if (this == parentClip.particleList){
parentClip.particleList = nextParticle;
};
parentClip.particleCount--;
if (parentClip.particleCount == 0){
parentClip.particleList = null;
};
parent.removeChild(this);
} else {
visible = false;
};
}
}
}//package main.particles
Section 5
//mParticleEngine (main.particles.mParticleEngine)
package main.particles {
import flash.display.*;
import flash.geom.*;
import main.*;
public class mParticleEngine extends MovieClip {
private const t_fire_frict = 0.1;
public var particleCount:Number;// = 0
public var particleList:mParticle;
public var gameStep;// = 0
public function mParticleEngine(_arg1:Number):void{
gameStep = 0;
particleCount = 0;
super();
gameStep = _arg1;
}
public function addTextParticle(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13, _arg14, _arg15, _arg16:Number):void{
var _local17:*;
_local17 = new mTextParticle(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13, _arg14, _arg15, _arg16);
addChild(_local17);
}
public function addMovieParticle(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13:Number, _arg14:uint):void{
var _local15:*;
_local15 = new mMovieParticle(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13, _arg14);
addChild(_local15);
}
public function update(_arg1:Sprite):void{
var _local2:mParticle;
_local2 = particleList;
while (_local2) {
_local2.x = (_local2.x + _local2.sx);
_local2.y = (_local2.y + _local2.sy);
_local2.sx = (_local2.sx + _local2.ax);
_local2.sy = (_local2.sy + _local2.ay);
if (_local2.paintedType == 1){
_local2.width = (_local2.width + mMovieParticle(_local2).incScale);
_local2.height = (_local2.height + mMovieParticle(_local2).incScale);
_local2.rotation = (_local2.rotation + mMovieParticle(_local2).rot);
} else {
if (_local2.paintedType == 2){
} else {
if (Math.floor((Math.random() * 2)) == 1){
_arg1.graphics.lineStyle(2, 0xFFCC00);
} else {
_arg1.graphics.lineStyle(2, 16777113);
};
_arg1.graphics.moveTo(_local2.x, _local2.y);
_arg1.graphics.lineTo((_local2.x + (_local2.sx * 2)), (_local2.y + (_local2.sy * 2)));
};
};
_local2.timeLife = (_local2.timeLife - 1);
if (_local2.timeLife < 0){
if (_local2.paintedType == 1){
mMovieParticle(_local2).alpha = (mMovieParticle(_local2).alpha - 0.09);
if (mMovieParticle(_local2).alpha < 0.1){
_local2.destroy();
};
} else {
if (_local2.paintedType == 2){
mTextParticle(_local2).alpha = (mTextParticle(_local2).alpha - 0.09);
if (mTextParticle(_local2).alpha < 0.1){
mTextParticle(_local2).grad.mask = null;
_local2.removeChild(mTextParticle(_local2).grad);
_local2.removeChild(mTextParticle(_local2).obj);
_local2.destroy();
};
} else {
_local2.destroy();
};
};
};
_local2 = _local2.nextParticle;
};
}
public function addExp(_arg1, _arg2:Number):void{
var _local3:*;
var _local4:*;
_local3 = 0;
while (_local3 < 4) {
_local4 = new mParticle(this, _arg1, _arg2, ((Math.random() * 10) - 5), ((Math.random() * 10) - 5), 0, 0.25, 30, 0xFFCC00);
addChild(_local4);
_local3++;
};
}
}
}//package main.particles
Section 6
//mTextParticle (main.particles.mTextParticle)
package main.particles {
import flash.display.*;
import flash.text.*;
import main.*;
public class mTextParticle extends mParticle {
public var obj;
public var incScale:Number;
public var grad;
public var rot;
public function mTextParticle(_arg1, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7, _arg8, _arg9, _arg10, _arg11, _arg12, _arg13, _arg14, _arg15, _arg16:Number):void{
super(_arg1, _arg4, _arg5, _arg10, _arg11, _arg12, _arg13, _arg16, 0);
incScale = _arg15;
paintedType = 2;
obj = new mText(_arg1, 0, 0, _arg6, _arg7, _arg3, _arg9, _arg8, 0, true, 0);
obj.x = (width / 2);
obj.autoSize = TextFieldAutoSize.LEFT;
addChild(obj);
grad = _arg2;
grad.width = _arg6;
grad.height = _arg7;
grad.x = (width / 2);
grad.y = 0;
addChild(grad);
grad.mask = obj;
rot = _arg14;
alpha = 1;
}
}
}//package main.particles
Section 7
//game (main.game)
package main {
import flash.display.*;
import flash.events.*;
import mochi.as3.*;
import flash.geom.*;
import flash.text.*;
import flash.net.*;
import flash.media.*;
import main.particles.*;
public dynamic class game extends MovieClip {
public var shakeTth;// = -1
public var enemyTthConst;// = 0
public var panel;
public var bonusTth;// = 0
public var soundChan1;
public var map;
public var enemyTth;// = 0
public var preloader;
public var playerPlane;
public var lastTime:Number;// = 0
public var sEngine;
public var partSprite:Sprite;
public var bonusTthConst;// = 160
public var mouseCross;
public var levelZeppelin;
public var interFaceDummy;
public var currentLevel;// = 0
public var levelTth;// = 0
public var m_flash:MovieClip;
public var enemyTthDefault;// = 40
public var levelTthConst;// = 450
static var bulletList:mBullet;
static var comboTth = 0;
static var totalScores;
static var comboTthConst = 15;
static var allClip;
static var planeCount:Number = 0;
static var comboLevel = 1;
static var planeList:mBasePlane;
static var bonusList:mBonus;
static var gameStep;
static var backFon;
static var particleEngine:mParticleEngine;
static var fps;
static var globalPause:Boolean = false;
static var globalSound:Boolean = true;
static var bonusCount:Number = 0;
static var scoreMultiplier:Number = 1;
static var bulletCount:Number = 0;
static var playerHealthLine;
static var titleMenuNow:Boolean = false;
public function game():void{
var _local1:String;
var _local2:*;
bonusTthConst = (20 * 8);
bonusTth = 0;
enemyTthDefault = 40;
enemyTthConst = 0;
enemyTth = 0;
levelTthConst = 450;
levelTth = 0;
shakeTth = -1;
lastTime = 0;
currentLevel = 0;
sEngine = new sEngineWav();
soundChan1 = new SoundChannel();
super();
addFrameScript(0, frame1, 2, frame3);
_local1 = root.loaderInfo.url;
_local2 = true;
if (_local1.substr(0, 26) == "http://chat.kongregate.com"){
_local2 = false;
};
MochiServices.connect("98dfea0007fe238b", root);
mouseEnabled = false;
preloader = new mPreloader(275, 200, _local2);
addChild(preloader);
addEventListener(Event.ENTER_FRAME, preUpdate, false, 0, true);
}
public function m_flashUpdate():void{
if (m_flash != null){
m_flash.alpha = (m_flash.alpha - (0.2 * gameStep));
if (m_flash.alpha < 0.1){
removeChild(m_flash);
m_flash = null;
};
};
}
public function loadInterFace():void{
var tempText:*;
var panelGlass:*;
var button:*;
interFaceDummy = new MovieClip();
addChild(interFaceDummy);
panel = new mPanel();
panel.x = 275;
panel.y = 15;
interFaceDummy.addChild(panel);
tempText = new mText(interFaceDummy, 100, 15, 70, 20, "HP:", "left", 14, 0, true, 0);
playerHealthLine = new mHealthLine(interFaceDummy, 150, 16, 100);
tempText = new mText(interFaceDummy, 300, 15, 70, 20, "Total:", "left", 14, 0, true, 0);
totalScores = new mText(interFaceDummy, 338, 15, 50, 20, "0", "left", 14, 0, true, 0);
panelGlass = new mPanelGlass();
panelGlass.x = 275;
panelGlass.y = 9;
panelGlass.alpha = 0.28;
interFaceDummy.addChild(panelGlass);
button = new mButton(interFaceDummy, 30, 15, 50, 20, 50, 20, true, "MENU", 14, function (){
ViewPauseMenu();
});
button = new mButton(interFaceDummy, 450, 15, 62, 20, 62, 20, true, "SOUND", 14, function (){
SoundOnOff();
});
button = new mButton(interFaceDummy, 515, 15, 60, 20, 60, 20, true, "MUSIC", 14, function (){
});
mouseCross = new mMouseCross(interFaceDummy, 0, 0);
}
public function clearAll():void{
var _local1:mBasePlane;
if (levelZeppelin != null){
backFon.removeChild(levelZeppelin);
levelZeppelin = null;
};
soundChan1.removeEventListener(Event.SOUND_COMPLETE, sEngineComplete);
soundChan1.stop();
if (playerPlane != null){
playerPlane.destroy;
playerPlane = null;
};
_local1 = planeList;
while (_local1) {
_local1.destroy();
_local1 = _local1.nextPlane;
};
bonusList = null;
bonusCount = 0;
bulletList = null;
bulletCount = 0;
planeList = null;
planeCount = 0;
removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
while (0 < numChildren) {
removeChildAt(0);
};
}
public function loadgame(_arg1:Event):void{
preloader.adBox.visible = false;
preloader.removeChild(preloader.adBox);
removeChild(preloader);
removeEventListener(Event.ENTER_FRAME, preUpdate);
gotoAndStop(3);
gameStep = (24 / stage.frameRate);
addEventListener(Event.ENTER_FRAME, update, false, 0, true);
m_flash = null;
loadTitleMenu();
}
public function mouseUpHandler(_arg1:MouseEvent):void{
playerPlane.stopFire();
}
public function addBonus(_arg1, _arg2, _arg3, _arg4, _arg5:Number):void{
var _local6:mBonus;
_local6 = new mBonus(map, _arg1, _arg2, _arg3, _arg4, _arg5);
}
public function addEnemyPlane(_arg1, _arg2, _arg3:Number, _arg4, _arg5, _arg6, _arg7:Number):void{
var _local8:mEnemyPlane;
_local8 = new mEnemyPlane(map, _arg1, _arg2, -550, (Math.round((Math.random() * 500)) - 50), _arg3, _arg4, _arg5, _arg6, _arg7);
}
public function ViewPauseMenu():void{
var pauseMenu:*;
var button:mButton;
globalPause = true;
pauseMenu = new mDummy();
addChild(pauseMenu);
interFaceDummy.visible = false;
button = new mButton(pauseMenu, 275, 175, 180, 37, 180, 28, true, "CONTINUE", 18, function (){
removeChild(pauseMenu);
globalPause = false;
interFaceDummy.visible = true;
});
button = new mButton(pauseMenu, 275, 225, 180, 37, 180, 28, true, "TO MAIN MENU", 18, function (){
loadTitleMenu();
});
}
public function playerIsKilled():void{
var button:mButton;
var tempText:*;
soundChan1.removeEventListener(Event.SOUND_COMPLETE, sEngineComplete);
soundChan1.stop();
playerPlane.soundChan1.stop();
playerPlane.playExp();
removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
globalPause = true;
interFaceDummy.visible = false;
tempText = new mText(this, 275, 75, 550, 50, ("Total Scores: " + String(totalScores.text)), "center", 30, 0, true, 0);
button = new mButton(this, 275, 150, 180, 37, 180, 28, true, "SUBMIT SCORES", 18, function (){
MochiScores.showLeaderboard({res:"550x400", boardID:"60b36f57f4359e0e", score:String(totalScores.text)});
});
button = new mButton(this, 275, 200, 180, 37, 180, 28, true, "TRY AGAIN", 18, function (){
newGame(1);
});
button = new mButton(this, 275, 250, 180, 37, 180, 28, true, "TO MAIN MENU", 18, function (){
loadTitleMenu();
});
}
public function preUpdate(_arg1:Event):void{
if (preloader.loadingComplete){
loadgame(null);
};
}
public function shakeScreen(_arg1:Number):void{
shakeTth = _arg1;
}
public function highScores():void{
MochiScores.showLeaderboard({res:"550x400", boardID:"60b36f57f4359e0e"});
}
function frame1(){
stop();
}
public function SoundOnOff():void{
globalSound = !(globalSound);
if (globalSound){
soundChan1.removeEventListener(Event.SOUND_COMPLETE, sEngineComplete);
soundChan1.stop();
soundChan1 = sEngine.play();
soundChan1.addEventListener(Event.SOUND_COMPLETE, sEngineComplete);
} else {
soundChan1.removeEventListener(Event.SOUND_COMPLETE, sEngineComplete);
soundChan1.stop();
};
}
function frame3(){
MochiBot.track(this, "cb142f2f");
}
public function moreGames(){
navigateToURL(new URLRequest("http://pegames.ucoz.ru/stuff"), "_BLANK");
}
public function bonusesUpdate():void{
var _local1:mBonus;
_local1 = bonusList;
while (_local1) {
_local1.update();
if (_local1.visible){
if (playerPlane != null){
if (!playerPlane.injured){
if (playerPlane.hitTestPoint(_local1.box.localToGlobal(new Point(0, 0)).x, _local1.box.localToGlobal(new Point(0, 0)).y)){
_local1.visible = false;
playerPlane.setBonus(_local1.bonusType);
_local1.playSound();
particleEngine.addMovieParticle(particleEngine, new mBox1(), _local1.bonusType, _local1.x, _local1.y, 1, 0, 0, 0, 0, 0, 3, 10, 0xFFCC00);
};
};
};
};
_local1 = _local1.nextBonus;
};
}
public function mouseDownHandler(_arg1:MouseEvent):void{
playerPlane.startFire();
}
public function tthsToDefault():void{
enemyTthConst = enemyTthDefault;
enemyTth = Math.round((enemyTthConst / game.gameStep));
bonusTth = Math.round((bonusTthConst / game.gameStep));
shakeTth = -1;
levelTth = 0;
comboLevel = 1;
}
public function shakeUpdate():void{
if (shakeTth > 0){
if (allClip != null){
allClip.x = ((Math.random() * 10) - 5);
allClip.y = ((Math.random() * 10) - 5);
};
shakeTth--;
};
if (shakeTth == 0){
shakeTth = -1;
allClip.x = 0;
allClip.y = 0;
};
}
public function loadTitleMenu():void{
var tempTitle:*;
var tempCred:*;
var button:mButton;
clearAll();
loadAllClip();
tempTitle = new mTitle();
tempTitle.x = 275;
tempTitle.y = 50;
addChild(tempTitle);
tempCred = new mCredits();
tempCred.x = 350;
tempCred.y = 200;
addChild(tempCred);
tempCred.visible = false;
button = new mButton(this, 100, 125, 150, 32, 150, 28, true, "PLAY", 18, function (){
newGame(1);
});
button = new mButton(this, 100, 175, 150, 32, 150, 28, true, "HIGH SCORES", 18, function (){
highScores();
});
button = new mButton(this, 100, 225, 150, 32, 150, 28, true, "MORE GAMES", 18, function (){
moreGames();
});
button = new mButton(this, 100, 275, 150, 32, 150, 28, true, "CREDITS", 18, function (){
tempCred.visible = !(tempCred.visible);
});
globalPause = false;
addFlash();
tthsToDefault();
titleMenuNow = true;
}
public function newGame(_arg1:Number):void{
clearAll();
loadAllClip();
playerPlane = new mBasePlane(map, 70, 200, 0.1, 1);
addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
tthsToDefault();
globalPause = false;
titleMenuNow = false;
addFlash();
loadInterFace();
currentLevel = 0;
if (globalSound){
soundChan1.stop();
soundChan1 = sEngine.play();
soundChan1.addEventListener(Event.SOUND_COMPLETE, sEngineComplete);
};
}
public function update(_arg1:Event):void{
var _local2:mEnemyPlane;
var _local3:*;
if (playerPlane != null){
if ((((((((mouseX > 550)) || ((mouseX < 0)))) || ((mouseY > 400)))) || ((mouseY < 0)))){
};
};
if (comboTth > 0){
comboTth--;
};
shakeUpdate();
m_flashUpdate();
if (particleEngine != null){
partSprite.graphics.clear();
particleEngine.update(partSprite);
};
if (playerHealthLine){
playerHealthLine.update();
};
if (!globalPause){
if (levelZeppelin != null){
levelZeppelin.x = (levelZeppelin.x - (5 * gameStep));
if (levelZeppelin.x < -100){
levelZeppelin.visible = false;
};
};
if (mouseCross != null){
mouseCross.update(mouseX, mouseY);
};
planesUpdate();
bonusesUpdate();
bulletsUpdate();
if (titleMenuNow){
enemyTth--;
if (enemyTth == 0){
enemyTth = Math.round((enemyTthConst / game.gameStep));
_local3 = (Math.floor((Math.random() * 3.9)) + 1);
if (_local3 > 4){
_local3 = 4;
};
_local2 = new mEnemyPlane(map, 600, (Math.round((Math.random() * 340)) + 30), -550, (Math.round((Math.random() * 500)) - 50), _local3, ((5 + Math.round((Math.random() * 10))) * gameStep), 40, 1, 1);
if (Math.random() > 0.5){
_local2.setInjured();
_local2.hitPoints = 49;
};
};
} else {
bonusTth--;
if (bonusTth == 0){
bonusTth = Math.round((bonusTthConst / game.gameStep));
_local3 = (Math.floor((Math.random() * 2.9)) + 1);
if (_local3 > 3){
_local3 = 3;
};
addBonus(575, 30, (148 + (Math.random() * 25)), 5, _local3);
};
enemyTth--;
if (enemyTth == 0){
enemyTth = Math.round((enemyTthConst / game.gameStep));
if (currentLevel == 1){
addEnemyPlane(600, (Math.round((Math.random() * 340)) + 30), 1, ((10 + Math.round((Math.random() * 5))) * gameStep), 40, 1, 1);
};
if (currentLevel == 2){
if (Math.random() > 0.7){
addEnemyPlane(600, (Math.round((Math.random() * 340)) + 30), 1, ((10 + Math.round((Math.random() * 5))) * gameStep), 40, 1, 1);
} else {
addEnemyPlane(600, (Math.round((Math.random() * 340)) + 30), 3, (5 * gameStep), 30, 2, 2);
};
};
if (currentLevel == 3){
_local3 = Math.random();
if ((((_local3 >= 0.3)) && ((_local3 <= 0.6)))){
addEnemyPlane(600, (Math.round((Math.random() * 340)) + 30), 2, ((5 + Math.round((Math.random() * 5))) * gameStep), 10, 2, 1);
};
if (_local3 > 0.6){
addEnemyPlane(600, (Math.round((Math.random() * 340)) + 30), 3, (5 * gameStep), 30, 2, 2);
};
if (_local3 < 0.3){
addEnemyPlane(600, (Math.round((Math.random() * 340)) + 30), 1, ((10 + Math.round((Math.random() * 5))) * gameStep), 40, 1, 1);
};
};
if ((((currentLevel > 3)) && ((currentLevel < 6)))){
_local3 = Math.random();
if (_local3 <= 0.25){
addEnemyPlane(600, (Math.round((Math.random() * 340)) + 30), 1, ((10 + Math.round((Math.random() * 5))) * gameStep), 40, 1, 1);
};
if ((((_local3 > 0.25)) && ((_local3 <= 0.5)))){
addEnemyPlane(600, (Math.round((Math.random() * 340)) + 30), 2, ((5 + Math.round((Math.random() * 5))) * gameStep), 10, 2, 1);
};
if ((((_local3 > 0.5)) && ((_local3 <= 0.75)))){
addEnemyPlane(600, (Math.round((Math.random() * 340)) + 30), 4, ((5 + Math.round((Math.random() * 5))) * gameStep), 40, 3, 3);
};
if (_local3 > 0.75){
addEnemyPlane(600, (Math.round((Math.random() * 340)) + 30), 3, (5 * gameStep), 30, 2, 2);
};
};
if ((((currentLevel >= 6)) && ((currentLevel < 11)))){
_local3 = Math.random();
if (_local3 <= 0.25){
addEnemyPlane(600, (Math.round((Math.random() * 340)) + 30), 1, ((10 + Math.round((Math.random() * 5))) * gameStep), 30, 1, 2);
};
if ((((_local3 > 0.25)) && ((_local3 <= 0.5)))){
addEnemyPlane(600, (Math.round((Math.random() * 340)) + 30), 2, ((5 + Math.round((Math.random() * 5))) * gameStep), 7.5, 2, 2);
};
if ((((_local3 > 0.5)) && ((_local3 <= 0.75)))){
addEnemyPlane(600, (Math.round((Math.random() * 340)) + 30), 4, ((5 + Math.round((Math.random() * 5))) * gameStep), 30, 3, 4);
};
if (_local3 > 0.75){
addEnemyPlane(600, (Math.round((Math.random() * 340)) + 30), 3, (5 * gameStep), 20, 2, 3);
};
};
};
if (enemyTthConst > 2){
levelTth--;
if (levelTth < 0){
currentLevel++;
if (currentLevel < 11){
addLevelZeppelin(650, 200, ("Level " + String(currentLevel)));
levelTth = (currentLevel * Math.round((levelTthConst / game.gameStep)));
};
if (currentLevel == 11){
addLevelZeppelin(650, 200, "The End");
levelTth = (0.15 * Math.round((levelTthConst / game.gameStep)));
};
if (currentLevel == 12){
playerIsWin();
};
if (currentLevel == 1){
enemyTthConst = 20;
};
if (currentLevel == 2){
enemyTthConst = 20;
};
if (currentLevel == 3){
enemyTthConst = 20;
};
if (currentLevel == 4){
enemyTthConst = 20;
};
if (currentLevel > 4){
enemyTthConst = (20 - Math.round((currentLevel / 2)));
};
};
};
};
backFon.update(gameStep);
};
}
public function addLevelZeppelin(_arg1, _arg2, _arg3):void{
var _local4:*;
if (levelZeppelin == null){
levelZeppelin = new mLevelZeppelin();
};
levelZeppelin.levText.text = String(_arg3);
_local4 = new TextFormat();
_local4.font = "Verdana";
_local4.color = 0;
_local4.size = 16;
_local4.bold = true;
_local4.align = "center";
levelZeppelin.levText.setTextFormat(_local4);
levelZeppelin.selectable = false;
levelZeppelin.x = _arg1;
levelZeppelin.y = _arg2;
levelZeppelin.visible = true;
backFon.addChild(levelZeppelin);
}
public function loadAllClip():void{
allClip = new mDummy();
addChild(allClip);
backFon = new mBackFon(this);
allClip.addChild(backFon);
map = new mDummy();
allClip.addChild(map);
partSprite = new Sprite();
allClip.addChild(partSprite);
particleEngine = new mParticleEngine(gameStep);
allClip.addChild(particleEngine);
}
public function addFlash():void{
if (m_flash == null){
m_flash = new mFlashMovie();
m_flash.x = 0;
m_flash.y = 0;
addChild(m_flash);
};
}
public function bulletsUpdate():void{
var _local1:mBullet;
var _local2:mBasePlane;
var _local3:*;
_local1 = bulletList;
while (_local1) {
_local1.update();
_local2 = planeList;
while (_local2) {
if (_local1.ownerClip != _local2){
if (_local1.visible){
if (_local2.hitTestPoint(_local1.x, _local1.y, true)){
_local1.visible = false;
if (_local2 == playerPlane){
if (!playerPlane.undead){
_local2.hitPoints = (_local2.hitPoints - (_local1.power / _local2.defence));
shakeScreen(20);
_local2.playPopa();
playerHealthLine.setToValue(_local2.hitPoints);
};
} else {
_local2.hitPoints = (_local2.hitPoints - (_local1.power / _local2.defence));
};
if (_local2.hitPoints < _local2.injurePoint){
_local2.setInjured();
if (_local2 == playerPlane){
_local2.speed = (10 * game.gameStep);
};
};
if (_local2.hitPoints >= 1){
_local3 = 0;
while (_local3 < 2) {
particleEngine.addMovieParticle(particleEngine, new mFragments(), (Math.round((Math.random() * 5.9)) + 1), _local1.x, _local1.y, (0.5 + (Math.random() * 1)), ((Math.random() * 20) - 10), ((Math.random() * 20) - 10), 0, 0.5, ((Math.random() * 20) - 10), 0, 40, 0xFFCC00);
_local3++;
};
particleEngine.addExp(_local1.x, _local1.y);
} else {
if (_local2 != playerPlane){
_local2.kill();
};
};
};
};
};
_local2 = _local2.nextPlane;
};
_local1 = _local1.nextBullet;
};
}
public function planesUpdate():void{
var _local1:mBasePlane;
var _local2:*;
_local1 = planeList;
while (_local1) {
if (_local1 != playerPlane){
_local1.update(0, 0);
if (playerPlane != null){
if (_local1.hitTest(playerPlane, new Rectangle(0, 0, 80, 20))){
_local2 = 0;
while (_local2 < 3) {
particleEngine.addMovieParticle(particleEngine, new mPlaneFragments(), ((_local2 + 1) + ((_local1.planeType - 1) * 3)), _local1.x, _local1.y, 1, ((Math.random() * 5) - 2.5), ((Math.random() * 5) - 2.5), 0, 0.2, ((Math.random() * 20) - 10), 0, 40, 0xFFCC00);
particleEngine.addMovieParticle(particleEngine, new mPlaneFragments(), ((_local2 + 1) + ((playerPlane.planeType - 1) * 3)), playerPlane.x, playerPlane.y, 1, ((Math.random() * 5) - 2.5), ((Math.random() * 5) - 2.5), 0, 0.2, ((Math.random() * 20) - 10), 0, 40, 0xFFCC00);
_local2++;
};
_local2 = 0;
while (_local2 < 1) {
particleEngine.addMovieParticle(particleEngine, new mExp1(), 0, ((_local1.x + playerPlane.x) / 2), ((_local1.y + playerPlane.y) / 2), 1, 0, 0, 0, 0, 0, 0, 30, 0xFFCC00);
_local2++;
};
_local1.destroy();
if (!playerPlane.undead){
playerHealthLine.setToValue(0);
playerPlane.destroy();
shakeScreen(20);
playerIsKilled();
} else {
particleEngine.addTextParticle(particleEngine, new mGradient1(), ("+" + String(((10 * scoreMultiplier) * _local1.scoresMult))), _local1.x, _local1.y, 100, 50, 28, "left", 0, -1, 0, 0, 0, 0, 20);
totalScores.newText(String((Number(totalScores.text) + ((10 * scoreMultiplier) * _local1.scoresMult))));
comboCheck(_local1.x, (_local1.y - 40));
_local1.playExp();
};
};
};
} else {
_local1.update(mouseCross.x, mouseCross.y);
if (_local1.y > _local1.fallHeight){
if (_local1.injured){
playerIsKilled();
};
};
};
_local1 = _local1.nextPlane;
};
}
public function sEngineComplete(_arg1:Event):void{
soundChan1.removeEventListener(Event.SOUND_COMPLETE, sEngineComplete);
if (globalSound){
soundChan1.stop();
soundChan1 = sEngine.play();
soundChan1.addEventListener(Event.SOUND_COMPLETE, sEngineComplete);
};
}
public function playerIsWin():void{
var button:mButton;
var tempText:*;
soundChan1.removeEventListener(Event.SOUND_COMPLETE, sEngineComplete);
soundChan1.stop();
playerPlane.soundChan1.stop();
removeEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
addFlash();
globalPause = true;
interFaceDummy.visible = false;
tempText = new mText(this, 275, 75, 550, 50, ("Total Scores: " + String(totalScores.text)), "center", 30, 0, true, 0);
button = new mButton(this, 275, 150, 180, 37, 180, 28, true, "SUBMIT SCORES", 18, function (){
MochiScores.showLeaderboard({res:"550x400", boardID:"60b36f57f4359e0e", score:String(totalScores.text)});
});
button = new mButton(this, 275, 200, 180, 37, 180, 28, true, "TRY AGAIN", 18, function (){
newGame(1);
});
button = new mButton(this, 275, 250, 180, 37, 180, 28, true, "TO MAIN MENU", 18, function (){
loadTitleMenu();
});
}
public static function refreshScores():void{
}
public static function comboCheck(_arg1, _arg2:Number):void{
var _local3:*;
if (comboTth > 0){
comboLevel++;
_local3 = ((comboLevel * 2) + 14);
if (_local3 > 28){
_local3 = 28;
};
particleEngine.addTextParticle(particleEngine, new mGradient3(), (((("+" + String(((comboLevel * 10) * game.scoreMultiplier))) + " ") + "COMBO x") + String(comboLevel)), _arg1, _arg2, 300, 50, _local3, "left", 0, -1, 0, 0, 0, 0, 20);
totalScores.newText(String((Number(totalScores.text) + ((comboLevel * 10) * game.scoreMultiplier))));
} else {
comboLevel = 1;
};
comboTth = Math.round((comboTthConst / gameStep));
}
}
}//package main
Section 8
//mBackFon (main.mBackFon)
package main {
import flash.display.*;
import flash.geom.*;
public class mBackFon extends MovieClip {
private var fonTth;
public var fon2;
public var fon3;
public var fon1;
public var fon4;
public var dayFilt;
public var sunMoon;
public var isNight:Boolean;
public var ground;
private var fonTthConst:Number;// = 20
public var nightFilt;
public var fon;
public function mBackFon(_arg1:MovieClip):void{
fonTthConst = 20;
super();
sunMoon = new mSun();
sunMoon.x = 500;
sunMoon.y = 350;
sunMoon.gotoAndStop(1);
addChild(sunMoon);
ground = new mGround1();
ground.x = -10;
ground.y = 292.5;
addChild(ground);
fon = new mDummy();
fon.x = 275;
fon.y = 200;
addChild(fon);
fon1 = new mDummy();
addChild(fon1);
fon2 = new mDummy();
addChild(fon2);
fon3 = new mDummy();
addChild(fon3);
fon4 = new mDummy();
addChild(fon4);
nightFilt = new mNightFilter();
nightFilt.x = 275;
nightFilt.y = 200;
nightFilt.alpha = 0;
addChild(nightFilt);
isNight = false;
fonTth = 1;
}
public function update(_arg1:Number):void{
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
sunMoon.x = (sunMoon.x - (_arg1 * 0.5));
_local2 = -(Math.sin((sunMoon.x / 159.235)));
sunMoon.y = (350 + (300 * _local2));
if (sunMoon.x < 50){
if (!isNight){
if (nightFilt.alpha < 0.95){
nightFilt.alpha = (nightFilt.alpha + 0.01);
} else {
sunMoon.gotoAndStop(2);
sunMoon.x = 500;
isNight = true;
};
} else {
if (nightFilt.alpha > 0){
nightFilt.alpha = (nightFilt.alpha - 0.01);
} else {
sunMoon.gotoAndStop(1);
sunMoon.x = 500;
isNight = false;
};
};
};
fonTth--;
if (fonTth == 0){
fonTth = Math.round((fonTthConst / _arg1));
if (Math.random() > 0.5){
_local4 = new mCloud();
_local4.gotoAndStop((Math.floor((Math.random() * 3.9)) + 1));
_local4.x = 350;
_local4.y = (-200 + (Math.random() * 200));
_local4.scaleX = (0.2 + (Math.random() * 1));
_local4.scaleY = _local4.scaleX;
if (Math.random() > 0.5){
_local4.scaleX = -(_local4.scaleX);
_local4.cacheAsBitmap = true;
};
fon.addChild(_local4);
} else {
_local4 = new mFonObjs1();
_local5 = (Math.floor((Math.random() * 4.9)) + 1);
if (_local5 > 5){
_local5 = 5;
};
_local4.obj.gotoAndStop(_local5);
_local4.shad.gotoAndStop(_local5);
_local4.x = 600;
_local4.scaleX = (0.05 + (Math.random() * 0.25));
_local4.scaleY = _local4.scaleX;
if (_local4.scaleX < 0.1){
_local4.y = 320;
fon1.addChild(_local4);
};
if ((((_local4.scaleX >= 0.1)) && ((_local4.scaleX < 0.15)))){
_local4.y = 345;
fon2.addChild(_local4);
};
if ((((_local4.scaleX >= 0.15)) && ((_local4.scaleX < 0.2)))){
_local4.y = 370;
fon3.addChild(_local4);
};
if ((((_local4.scaleX >= 0.2)) && ((_local4.scaleX < 0.25)))){
_local4.y = 395;
fon4.addChild(_local4);
};
_local4.cacheAsBitmap = true;
};
};
if (isNight){
_local2 = -1.1;
};
_local3 = 1;
while (_local3 < fon.numChildren) {
_local6 = fon.getChildAt(_local3).height;
fon.getChildAt(_local3).x = (fon.getChildAt(_local3).x - (Math.sqrt(_local6) * _arg1));
if (fon.getChildAt(_local3).x < -375){
fon.removeChildAt(_local3);
};
_local3++;
};
_local3 = 0;
while (_local3 < fon1.numChildren) {
fon1.getChildAt(_local3).x = (fon1.getChildAt(_local3).x - ((1 * 5) * _arg1));
fon1.getChildAt(_local3).shad.alpha = (0.65 + (_local2 / 2));
if (fon1.getChildAt(_local3).x < -100){
fon1.removeChildAt(_local3);
};
_local3++;
};
_local3 = 0;
while (_local3 < fon2.numChildren) {
fon2.getChildAt(_local3).x = (fon2.getChildAt(_local3).x - ((1.1 * 5) * _arg1));
fon2.getChildAt(_local3).shad.alpha = (0.65 + (_local2 / 2));
if (fon2.getChildAt(_local3).x < -100){
fon2.removeChildAt(_local3);
};
_local3++;
};
_local3 = 0;
while (_local3 < fon3.numChildren) {
fon3.getChildAt(_local3).x = (fon3.getChildAt(_local3).x - ((1.2 * 5) * _arg1));
fon3.getChildAt(_local3).shad.alpha = (0.65 + (_local2 / 2));
if (fon3.getChildAt(_local3).x < -100){
fon3.removeChildAt(_local3);
};
_local3++;
};
_local3 = 0;
while (_local3 < fon4.numChildren) {
fon4.getChildAt(_local3).x = (fon4.getChildAt(_local3).x - ((1.3 * 5) * _arg1));
fon4.getChildAt(_local3).shad.alpha = (0.65 + (_local2 / 2));
if (fon4.getChildAt(_local3).x < -100){
fon4.removeChildAt(_local3);
};
_local3++;
};
}
}
}//package main
Section 9
//mBasePlane (main.mBasePlane)
package main {
import flash.display.*;
import flash.events.*;
import flash.geom.*;
import flash.media.*;
public class mBasePlane extends MovieClip {
public var destroyed:Boolean;// = false
public var targetRotation:Number;// = 0
public var shotFire:mShotFire;
public var defence:Number;
public var hitPoints:Number;// = 100
public var speed:Number;// = 0
public var sy:Number;// = 0
public var rotKoeff:Number;
public var sx;
public var tx;
public var ty;
public var fallHeight:Number;// = 0
public var killed:Boolean;// = false
public var fireTthConst:Number;// = 1
public var sExp;
public var undead:Boolean;// = false
public var handling:Boolean;// = true
public var sFireSlow;
public var fired:Boolean;// = false
public var scoresMult:Number;
public var bonused:Boolean;// = false
public var parentClip:MovieClip;
public var sVeryFireFast;
public var nextPlane:mBasePlane;
public var sPopa;
public var sFireFast;
public var bonusTth:Number;// = 0
public var soundChan1:SoundChannel;
public var soundChan2:SoundChannel;
public var injured:Boolean;// = false
public var bonusTthConst:Number;// = 120
public var planeType:Number;
public var fireTth:Number;// = 0
public var prevPlane;
public var injurePoint:Number;// = 1
public var bonusType:Number;// = 0
public function mBasePlane(_arg1:MovieClip, _arg2, _arg3, _arg4:Number, _arg5:Number):void{
fired = false;
fireTthConst = 1;
fireTth = 0;
targetRotation = 0;
sy = 0;
speed = 0;
injured = false;
killed = false;
hitPoints = 100;
injurePoint = 1;
bonusTth = 0;
bonusType = 0;
bonusTthConst = 120;
bonused = false;
handling = true;
destroyed = false;
fallHeight = 0;
undead = false;
sFireFast = new sFireFastWav();
sFireSlow = new sFireSlowWav();
sVeryFireFast = new sFireVeryFastWav();
sPopa = new sPopaWav();
sExp = new sExpWav();
super();
x = _arg2;
y = _arg3;
planeType = _arg5;
_arg1.addChild(this);
parentClip = _arg1;
fireTth = Math.round((fireTthConst / game.gameStep));
if (fireTth < 1){
fireTth = 1;
};
rotKoeff = (_arg4 * game.gameStep);
speed = (30 * game.gameStep);
shotFire.gotoAndStop(6);
prevPlane = null;
nextPlane = game.planeList;
if (game.planeList){
game.planeList.prevPlane = this;
};
game.planeList = this;
game.planeCount++;
gotoAndStop(_arg5);
defence = 1;
scoresMult = 1;
soundChan1 = new SoundChannel();
soundChan2 = new SoundChannel();
}
public function playExp():void{
if (game.globalSound){
soundChan2.stop();
soundChan2 = sExp.play(Math.round((Math.random() * 100)), 0, new SoundTransform(0.9, 0));
};
}
public function setInjured():void{
soundChan1.stop();
handling = false;
fallHeight = 400;
fireTthConst = 2;
fireTth = Math.round((fireTthConst / game.gameStep));
injured = true;
tx = (x + (scaleX * Math.round((Math.random() * 500))));
ty = 600;
rotKoeff = 0.04;
}
public function hitTest(_arg1:MovieClip, _arg2:Rectangle):Boolean{
var _local3:Boolean;
var _local4:Point;
_local3 = false;
if (hitTestObject(_arg1)){
_local4 = new Point((_arg2.x - (_arg2.width / 2)), (_arg2.y + (_arg2.height / 2)));
if (hitTestPoint(_arg1.localToGlobal(_local4).x, _arg1.localToGlobal(_local4).y, true)){
_local3 = true;
};
_local4 = new Point((_arg2.x - (_arg2.width / 2)), (_arg2.y - (_arg2.height / 2)));
if (hitTestPoint(_arg1.localToGlobal(_local4).x, _arg1.localToGlobal(_local4).y, true)){
_local3 = true;
};
_local4 = new Point((_arg2.x + (_arg2.width / 2)), (_arg2.y + (_arg2.height / 2)));
if (hitTestPoint(_arg1.localToGlobal(_local4).x, _arg1.localToGlobal(_local4).y, true)){
_local3 = true;
};
_local4 = new Point((_arg2.x + (_arg2.width / 2)), (_arg2.y - (_arg2.height / 2)));
if (hitTestPoint(_arg1.localToGlobal(_local4).x, _arg1.localToGlobal(_local4).y, true)){
_local3 = true;
};
};
return (_local3);
}
public function update(_arg1, _arg2:Number):void{
if (handling){
baseUpdate(_arg1, _arg2);
} else {
baseUpdate(tx, ty);
};
y = (y + sy);
if (fired){
if (!injured){
fireTth--;
if (fireTth == 0){
if (bonusType == 1){
addBullet(2);
} else {
addBullet(1);
};
fireTth = Math.round((fireTthConst / game.gameStep));
if (fireTth < 1){
fireTth = 1;
};
};
};
};
if (bonused){
bonusTth--;
if (bonusTth == 0){
disableBonuses();
};
if (bonusType == 2){
if (Math.floor((bonusTth / 3)) == (bonusTth / 3)){
game.particleEngine.addMovieParticle(game.particleEngine, new mPowerUp1(), 0, ((x + (Math.random() * 40)) - 20), y, 1, ((Math.random() * 2) - 1), 0, 0, -0.25, 0, 4, 5, 0xFFCC00);
};
};
if (bonusType == 3){
if (bonusTth < (48 / game.gameStep)){
alpha = (0.5 + (Math.cos((bonusTth * 0.5)) * 0.3));
} else {
alpha = (0.5 + (Math.cos(bonusTth) * 0.3));
};
};
};
}
public function setBonus(_arg1:Number){
if (_arg1 == 1){
disableBonuses();
bonusType = 1;
bonused = true;
bonusTth = Math.round((bonusTthConst / game.gameStep));
fireTthConst = 0.25;
if (game.globalSound){
if (fired){
soundChan1.stop();
soundChan1 = sVeryFireFast.play(0, 10, new SoundTransform(1, 0));
};
};
};
if (_arg1 == 2){
disableBonuses();
bonusType = 2;
bonused = true;
bonusTth = 15;
hitPoints = 100;
game.playerHealthLine.setToValue(100);
};
if (_arg1 == 3){
disableBonuses();
bonusType = 3;
bonused = true;
undead = true;
bonusTth = Math.round((bonusTthConst / game.gameStep));
};
}
public function baseUpdate(_arg1, _arg2:Number):void{
var _local3:*;
var _local4:*;
var _local5:*;
var _local6:*;
if (visible){
_local3 = (_arg1 - x);
_local4 = (_arg2 - y);
_local5 = Math.sqrt(((_local3 * _local3) + (_local4 * _local4)));
if (_local4 > 0){
targetRotation = ((Math.acos((_local3 / _local5)) * 180) / Math.PI);
} else {
targetRotation = ((-(Math.acos((_local3 / _local5))) * 180) / Math.PI);
};
if (scaleX == 1){
rotation = (rotation + ((targetRotation - rotation) * rotKoeff));
};
if (scaleX == -1){
if (ty > y){
rotation = (rotation + (((targetRotation - rotation) - 180) * rotKoeff));
} else {
rotation = (rotation + (((targetRotation - rotation) + 180) * rotKoeff));
};
};
sx = ((Math.cos(((rotation * Math.PI) / 180)) * speed) * scaleX);
sy = (Math.sin(((rotation * Math.PI) / 180)) * speed);
if (hitPoints < injurePoint){
fireTth--;
if (fireTth == 0){
game.particleEngine.addMovieParticle(game.particleEngine, new mSmoke(), 1, localToGlobal(new Point(30, 0)).x, localToGlobal(new Point(30, 0)).y, 0.5, 0, 0, 0, -0.03, ((Math.random() * 5) - 2.5), 1, 50, 0xFFCC00);
fireTth = Math.round((fireTthConst / game.gameStep));
if (fireTth < 1){
fireTth = 1;
};
};
};
if (y > fallHeight){
if (injured){
destroy();
if (x < 0){
_local6 = 0;
} else {
_local6 = x;
};
if (!game.titleMenuNow){
game.particleEngine.addTextParticle(game.particleEngine, new mGradient1(), ("+" + String(((5 * game.scoreMultiplier) * scoresMult))), _local6, y, 100, 35, 28, "left", 0, -1, 0, 0, 0, 0, 30);
game.totalScores.newText(String((Number(game.totalScores.text) + ((5 * game.scoreMultiplier) * scoresMult))));
game.comboCheck(x, (y - 40));
};
playPopa();
};
};
};
}
public function disableBonuses():void{
bonusType = 0;
undead = false;
bonused = false;
fireTthConst = 1;
if (!game.globalPause){
if (game.globalSound){
if (fired){
soundChan1.stop();
soundChan1 = sFireFast.play(0, 10, new SoundTransform(1, 0));
};
};
};
alpha = 1;
}
public function addBullet(_arg1:Number):void{
var _local2:Point;
var _local3:*;
_local2 = new Point(37, 3);
_local3 = new mBullet(parentClip, localToGlobal(_local2).x, localToGlobal(_local2).y, rotation, 25, _arg1);
_local3.ownerClip = this;
}
public function stopFire():void{
fired = false;
shotFire.gotoAndStop(6);
soundChan1.stop();
soundChan1.removeEventListener(Event.SOUND_COMPLETE, sFireComplete);
}
public function kill():void{
var _local1:*;
if (!killed){
_local1 = 0;
while (_local1 < 3) {
game.particleEngine.addMovieParticle(game.particleEngine, new mPlaneFragments(), ((_local1 + 1) + ((planeType - 1) * 3)), x, y, 1, ((Math.random() * 5) - 2.5), ((Math.random() * 5) - 2.5), 0, 0.2, ((Math.random() * 20) - 10), 0, 40, 0xFFCC00);
_local1++;
};
game.particleEngine.addMovieParticle(game.particleEngine, new mExp1(), 0, x, y, 1, 0, 0, 0, 0, 0, 0, 30, 0xFFCC00);
if (!game.titleMenuNow){
game.particleEngine.addTextParticle(game.particleEngine, new mGradient1(), ("+" + String(((10 * game.scoreMultiplier) * scoresMult))), x, y, 100, 50, 28, "left", 0, -1, 0, 0, 0, 0, 20);
game.totalScores.newText(String((Number(game.totalScores.text) + ((10 * game.scoreMultiplier) * scoresMult))));
game.comboCheck(x, (y - 40));
};
killed = true;
playExp();
};
}
public function playPopa():void{
if (game.globalSound){
soundChan2.stop();
soundChan2 = sPopa.play(0, 0, new SoundTransform(0.9, 0));
};
}
public function sFireComplete(_arg1:Event):void{
soundChan1.removeEventListener(Event.SOUND_COMPLETE, sFireComplete);
if (!game.globalPause){
if (game.globalSound){
if (fired){
soundChan1.stop();
if (bonusType == 1){
soundChan1 = sVeryFireFast.play(0, 20, new SoundTransform(1, 0));
} else {
soundChan1 = sFireFast.play(0, 20, new SoundTransform(1, 0));
};
soundChan1.addEventListener(Event.SOUND_COMPLETE, sFireComplete);
};
};
};
}
public function startFire():void{
if (!game.globalPause){
fired = true;
shotFire.gotoAndPlay(1);
if (game.globalSound){
soundChan1.stop();
if (bonusType == 1){
soundChan1 = sVeryFireFast.play(0, 20, new SoundTransform(1, 0));
} else {
soundChan1 = sFireFast.play(0, 20, new SoundTransform(1, 0));
};
soundChan1.addEventListener(Event.SOUND_COMPLETE, sFireComplete);
};
};
}
public function destroy():void{
soundChan1.stop();
if (game.planeCount > 0){
if (!destroyed){
this.parent.removeChild(this);
if (prevPlane){
prevPlane.nextPlane = nextPlane;
};
if (nextPlane){
nextPlane.prevPlane = prevPlane;
};
if (this == game.planeList){
game.planeList = nextPlane;
};
game.planeCount--;
if (game.planeCount == 0){
game.planeList = null;
};
destroyed = true;
};
} else {
visible = false;
};
}
}
}//package main
Section 10
//mBonus (main.mBonus)
package main {
import flash.display.*;
import flash.geom.*;
import flash.media.*;
public class mBonus extends MovieClip {
public var nextBonus;
public var time1;
public var parentClip:MovieClip;
public var soundChan1;
public var speed;
public var sBonus;
public var dy;
public var prevBonus;
public var dx;
public var box:mBox1;
public var bonusType:Number;
public function mBonus(_arg1:MovieClip, _arg2, _arg3, _arg4, _arg5, _arg6:Number):void{
var _local7:*;
sBonus = new sBonusWav();
soundChan1 = new SoundChannel();
super();
x = _arg2;
y = _arg3;
_local7 = _arg4;
parentClip = _arg1;
parentClip.addChild(this);
prevBonus = null;
nextBonus = game.bonusList;
if (game.bonusList){
game.bonusList.prevBonus = this;
};
game.bonusList = this;
game.bonusCount++;
speed = (_arg5 * game.gameStep);
bonusType = _arg6;
box.gotoAndStop(bonusType);
dx = (Math.cos(((_local7 * Math.PI) / 180)) * speed);
dy = (Math.sin(((_local7 * Math.PI) / 180)) * speed);
time1 = 0;
}
public function destroy():void{
this.parent.removeChild(this);
if (prevBonus){
prevBonus.nextBonus = nextBonus;
};
if (nextBonus){
nextBonus.prevBonus = prevBonus;
};
if (this == game.bonusList){
game.bonusList = nextBonus;
};
game.bonusCount--;
if (game.bonusCount == 0){
game.bonusList = null;
};
}
public function playSound():void{
if (game.globalSound){
soundChan1.stop();
soundChan1 = sBonus.play(0, 0, new SoundTransform(0.9, 0));
};
}
public function update():void{
x = (x + dx);
y = (y + dy);
time1++;
rotation = (0 + (20 * Math.cos((time1 / 20))));
if ((((((((y > 450)) || ((y < -50)))) || ((x > 600)))) || ((x < -50)))){
destroy();
};
}
}
}//package main
Section 11
//mBullet (main.mBullet)
package main {
import flash.display.*;
import flash.geom.*;
public class mBullet extends MovieClip {
public var power:Number;
public var parentClip;
public var prevBullet;
public var speed:Number;
public var dy;
public var dx;
public var ownerClip:MovieClip;
public var nextBullet;
public function mBullet(_arg1:MovieClip, _arg2, _arg3, _arg4, _arg5:Number, _arg6:Number):void{
x = _arg2;
y = _arg3;
rotation = ((_arg4 - 2.5) + (Math.random() * 5));
parentClip = _arg1;
parentClip.addChild(this);
prevBullet = null;
nextBullet = game.bulletList;
if (game.bulletList){
game.bulletList.prevBullet = this;
};
game.bulletList = this;
game.bulletCount++;
speed = ((50 + (Math.random() * 10)) * game.gameStep);
dx = (Math.cos(((rotation * Math.PI) / 180)) * speed);
dy = (Math.sin(((rotation * Math.PI) / 180)) * speed);
power = _arg5;
gotoAndStop(_arg6);
cacheAsBitmap = true;
}
public function destroy():void{
this.parent.removeChild(this);
if (prevBullet){
prevBullet.nextBullet = nextBullet;
};
if (nextBullet){
nextBullet.prevBullet = prevBullet;
};
if (this == game.bulletList){
game.bulletList = nextBullet;
};
game.bulletCount--;
if (game.bulletCount == 0){
game.bulletList = null;
};
}
public function update():void{
x = (x + dx);
y = (y + dy);
if ((((((((y > 400)) || ((y < 0)))) || ((x > 550)))) || ((x < 0)))){
destroy();
};
}
}
}//package main
Section 12
//mButton (main.mButton)
package main {
import flash.display.*;
import flash.events.*;
import flash.media.*;
public class mButton extends MovieClip {
public var defH:Number;
public var parentClip:MovieClip;
public var upLine;
public var buttonBack:mButtonBack;
public var soundChan1:SoundChannel;
public var buttonText:mText;
public var posX;
public var rigthLine;
public var posY;
public var sButton:Sound;
public var buttonEnabled:Boolean;// = true
public var leftLine;
public var downLine;
public var downed:Boolean;// = false
public var onClickProc:Function;
public var defW;
public function mButton(_arg1:MovieClip, _arg2, _arg3, _arg4, _arg5, _arg6, _arg7:Number, _arg8:Boolean, _arg9:String, _arg10:Number, _arg11:Function){
var _local12:*;
buttonEnabled = true;
downed = false;
sButton = new sButtonWav();
super();
parentClip = _arg1;
x = _arg2;
y = _arg3;
posX = _arg2;
posY = _arg3;
buttonText = new mText(this, 0, 0, _arg4, _arg7, _arg9, "center", _arg10, 0, true, 0);
onClickProc = _arg11;
buttonEnabled = _arg8;
if (Math.random() > 0.5){
buttonBack.rotation = (buttonBack.rotation + 180);
};
if (Math.random() > 0.5){
buttonBack.scaleX = -1;
};
buttonBack.width = _arg4;
buttonBack.x = 0;
buttonBack.height = _arg5;
buttonBack.y = 0;
addEventListener(MouseEvent.MOUSE_OUT, mouseOutHandler);
addEventListener(MouseEvent.MOUSE_DOWN, mouseDownHandler);
_local12 = new mButtonUp();
_local12.width = _arg4;
_local12.x = 0;
_local12.height = _arg5;
_local12.y = 0;
_local12.alpha = 0.5;
addChild(_local12);
defW = width;
defH = height;
setEnabling(buttonEnabled);
parentClip.addChild(this);
}
public function setEnabling(_arg1:Boolean){
buttonEnabled = _arg1;
if (buttonEnabled){
addEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
addEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
} else {
removeEventListener(MouseEvent.MOUSE_UP, mouseUpHandler);
removeEventListener(MouseEvent.MOUSE_OVER, mouseOverHandler);
};
}
public function mouseUpHandler(_arg1:MouseEvent){
x = posX;
y = posY;
if (game.globalSound){
soundChan1 = sButton.play(0, 0, new SoundTransform(0.9, 0));
};
if (downed){
downed = false;
onClickProc(null);
};
}
public function mouseDownHandler(_arg1:MouseEvent){
if (buttonEnabled){
x = (x + 2.5);
y = (y + 2.5);
};
downed = true;
}
public function mouseOutHandler(_arg1:MouseEvent){
width = defW;
height = defH;
x = posX;
y = posY;
downed = false;
}
public function mouseOverHandler(_arg1:MouseEvent){
width = (defW + 5);
height = (defH + 2.5);
}
}
}//package main
Section 13
//mEnemyPlane (main.mEnemyPlane)
package main {
import flash.display.*;
import flash.geom.*;
import flash.media.*;
public class mEnemyPlane extends mBasePlane {
var sOneFire;
public function mEnemyPlane(_arg1:MovieClip, _arg2, _arg3, _arg4, _arg5:Number, _arg6:Number, _arg7, _arg8, _arg9, _arg10:Number):void{
sOneFire = new sOneFireWav();
super(_arg1, _arg2, _arg3, 0.15, _arg6);
tx = _arg4;
ty = _arg5;
scaleX = -1;
speed = _arg7;
fireTthConst = _arg8;
injurePoint = 51;
defence = _arg10;
scoresMult = _arg9;
}
override public function update(_arg1, _arg2:Number):void{
baseUpdate(tx, ty);
x = (x + sx);
y = (y + -(sy));
if ((((((((y > 500)) || ((y < -50)))) || ((x > 700)))) || ((x < -50)))){
if (!injured){
if (!game.titleMenuNow){
game.particleEngine.addTextParticle(game.particleEngine, new mGradient2(), ("-" + String(((10 * game.scoreMultiplier) * scoresMult))), (x + 55), y, 100, 50, 28, "left", 0, -1, 0, 0, 0, 0, 20);
game.totalScores.newText(String((Number(game.totalScores.text) - ((10 * game.scoreMultiplier) * scoresMult))));
};
destroy();
};
};
if (!injured){
fireTth--;
if (fireTth == 0){
addBullet(1);
if (game.globalSound){
soundChan1 = sOneFire.play(0, 0, new SoundTransform(((Math.random() * 0.4) + 0.5), 0));
};
shotFire.gotoAndPlay(1);
fireTth = Math.round((fireTthConst / game.gameStep));
if (fireTth < 1){
fireTth = 1;
};
};
if (fireTth == (Math.round((fireTthConst / game.gameStep)) - 5)){
shotFire.gotoAndStop(6);
};
};
if (hitPoints < 1){
destroy();
game.particleEngine.addExp(x, y);
};
}
override public function addBullet(_arg1:Number):void{
var _local2:Point;
var _local3:*;
_local2 = new Point(37, 3);
_local3 = new mBullet(parentClip, localToGlobal(_local2).x, localToGlobal(_local2).y, (rotation + 180), 10, _arg1);
_local3.ownerClip = this;
}
}
}//package main
Section 14
//mHealthLine (main.mHealthLine)
package main {
import flash.display.*;
import flash.geom.*;
public class mHealthLine extends MovieClip {
public var bar:mColorBar;
var HPText:mText;
public var glass:mHealthGlass;
var targetWidth:Number;
public function mHealthLine(_arg1:MovieClip, _arg2, _arg3:Number, _arg4:Number):void{
x = _arg2;
y = _arg3;
bar.width = ((_arg4 / 100) * width);
_arg1.addChild(this);
glass.alpha = 0.28;
HPText = new mText(_arg1, (_arg2 + 90), (_arg3 - 1), 70, 20, "100", "left", 14, 0, true, 0);
}
public function setToValue(_arg1:Number){
targetWidth = ((_arg1 / 100) * width);
if (targetWidth < 0){
targetWidth = 0;
};
if (targetWidth < 0){
targetWidth = 0;
};
if (targetWidth > 100){
targetWidth = 100;
};
}
public function update(){
var _local1:*;
var _local2:uint;
bar.width = (bar.width - ((bar.width - targetWidth) * 0.1));
glass.width = bar.width;
HPText.newText(String(Math.round(bar.width)));
_local1 = new ColorTransform();
if (bar.width > 50){
_local2 = (0xFF00 + (0xFF0000 * Math.round(((bar.width - 101) * 5))));
} else {
_local2 = (0xFFFF00 + (0x0100 * Math.round(((bar.width - 50) * 5.12))));
};
_local1.color = _local2;
bar.transform.colorTransform = _local1;
}
}
}//package main
Section 15
//mMouseCross (main.mMouseCross)
package main {
import flash.display.*;
public class mMouseCross extends MovieClip {
public function mMouseCross(_arg1:MovieClip, _arg2, _arg3:Number):void{
x = _arg2;
y = _arg3;
_arg1.addChild(this);
}
public function update(_arg1, _arg2:Number):void{
x = _arg1;
y = _arg2;
if (x < 140){
x = 140;
};
if (y < 40){
y = 40;
};
if (y > 400){
y = 400;
};
if (x > 550){
x = 550;
};
}
}
}//package main
Section 16
//mPreloader (main.mPreloader)
package main {
import flash.display.*;
import flash.events.*;
import CPMStar.*;
public class mPreloader extends MovieClip {
public var adCloseButton:mCloseAds;
public var loadingComplete:Boolean;// = false
public var adBox:MovieClip;
public var colorBar:mColorBar;
public function mPreloader(_arg1, _arg2:Number, _arg3:Boolean){
var _local4:String;
var _local5:DisplayObject;
loadingComplete = false;
super();
x = _arg1;
y = _arg2;
addEventListener(Event.ENTER_FRAME, update, false, 0, true);
_local4 = "1353Q34D7C671";
_local5 = new AdLoader(_local4);
adBox.addChild(_local5);
adCloseButton.addEventListener(MouseEvent.CLICK, closeAd);
if (!_arg3){
adBox.visible = false;
adCloseButton.visible = false;
};
}
public function closeAd(_arg1:MouseEvent):void{
adBox.visible = false;
adCloseButton.visible = false;
}
public function update(_arg1:Event):void{
var _local2:Number;
var _local3:Number;
_local2 = stage.loaderInfo.bytesLoaded;
_local3 = stage.loaderInfo.bytesTotal;
if (_local2 == _local3){
if (colorBar.width > 479){
colorBar.width = 500;
removeEventListener(Event.ENTER_FRAME, update);
loadingComplete = true;
} else {
colorBar.width = (colorBar.width + 2);
};
} else {
colorBar.width = ((_local2 / _local3) * 400);
};
}
public function onClick(_arg1:MouseEvent):void{
}
}
}//package main
Section 17
//mText (main.mText)
package main {
import flash.display.*;
import flash.text.*;
public class mText extends TextField {
var format:TextFormat;
public function mText(_arg1:MovieClip, _arg2, _arg3, _arg4, _arg5:Number, _arg6:String, _arg7:String, _arg8:Number, _arg9:uint, _arg10:Boolean, _arg11:Number):void{
text = _arg6;
format = new TextFormat();
format.font = "Verdana";
format.color = _arg9;
format.size = _arg8;
format.align = _arg7;
format.bold = true;
format.letterSpacing = _arg11;
_arg1.addChild(this);
embedFonts = _arg10;
selectable = false;
setTextFormat(format);
width = _arg4;
height = _arg5;
x = (_arg2 - (width / 2));
y = (_arg3 - (height / 2));
}
public function setColor(_arg1:uint):void{
textColor = _arg1;
}
public function newText(_arg1:String):void{
text = _arg1;
setTextFormat(format);
}
}
}//package main
Section 18
//MochiCoins (mochi.as3.MochiCoins)
package mochi.as3 {
public class MochiCoins {
public static const STORE_HIDE:String = "StoreHide";
public static const NO_USER:String = "NoUser";
public static const IO_ERROR:String = "IOError";
public static const ITEM_NEW:String = "ItemNew";
public static const ITEM_OWNED:String = "ItemOwned";
public static const STORE_ITEMS:String = "StoreItems";
public static const ERROR:String = "Error";
public static const STORE_SHOW:String = "StoreShow";
public static var _inventory:MochiInventory;
public static function triggerEvent(_arg1:String, _arg2:Object):void{
MochiSocial.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
MochiSocial.removeEventListener(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
MochiSocial.addEventListener(_arg1, _arg2);
}
public static function getStoreItems():void{
MochiServices.send("coins_getStoreItems");
}
public static function get inventory():MochiInventory{
return (_inventory);
}
public static function showStore(_arg1:Object=null):void{
MochiServices.bringToTop();
MochiServices.send("coins_showStore", {options:_arg1}, null, null);
}
public static function showItem(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showItem call must pass an Object with an item key");
return;
};
MochiServices.bringToTop();
MochiServices.send("coins_showItem", {options:_arg1}, null, null);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showVideo(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showVideo call must pass an Object with an item key");
return;
};
MochiServices.bringToTop();
MochiServices.send("coins_showVideo", {options:_arg1}, null, null);
}
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_inventory = new MochiInventory();
});
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_inventory = null;
});
}
}//package mochi.as3
Section 19
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Sibling:MochiDigits;
private var Fragment:Number;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function reencode():void{
var _local1:uint;
_local1 = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function toString():String{
var _local1:String;
_local1 = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
public function get value():Number{
return (Number(this.toString()));
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String;
_local3 = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
Fragment = (_local3.charCodeAt(_temp1) ^ Encoder);
if (_arg2 < _local3.length){
Sibling = new MochiDigits(_arg1, _arg2);
} else {
Sibling = null;
};
reencode();
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
}
}//package mochi.as3
Section 20
//MochiEventDispatcher (mochi.as3.MochiEventDispatcher)
package mochi.as3 {
public class MochiEventDispatcher {
private var eventTable:Object;
public function MochiEventDispatcher():void{
eventTable = {};
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
return;
};
for (_local3 in eventTable[_arg1]) {
var _local6 = eventTable[_arg1];
_local6[_local3](_arg2);
};
}
public function removeEventListener(_arg1:String, _arg2:Function):void{
var _local3:Object;
if (eventTable[_arg1] == undefined){
eventTable[_arg1] = [];
return;
};
for (_local3 in eventTable[_arg1]) {
if (eventTable[_arg1][_local3] != _arg2){
} else {
eventTable[_arg1].splice(Number(_local3), 1);
};
};
}
public function addEventListener(_arg1:String, _arg2:Function):void{
removeEventListener(_arg1, _arg2);
eventTable[_arg1].push(_arg2);
}
}
}//package mochi.as3
Section 21
//MochiEvents (mochi.as3.MochiEvents)
package mochi.as3 {
import flash.display.*;
public class MochiEvents {
public static const ALIGN_BOTTOM_LEFT:String = "ALIGN_BL";
public static const FORMAT_LONG:String = "LongForm";
public static const ALIGN_BOTTOM:String = "ALIGN_B";
public static const ACHIEVEMENT_RECEIVED:String = "AchievementReceived";
public static const FORMAT_SHORT:String = "ShortForm";
public static const ALIGN_TOP_RIGHT:String = "ALIGN_TR";
public static const ALIGN_BOTTOM_RIGHT:String = "ALIGN_BR";
public static const ALIGN_TOP:String = "ALIGN_T";
public static const ALIGN_LEFT:String = "ALIGN_L";
public static const ALIGN_RIGHT:String = "ALIGN_R";
public static const ALIGN_TOP_LEFT:String = "ALIGN_TL";
public static const ALIGN_CENTER:String = "ALIGN_C";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
private static var gameStart:Number;
private static var levelStart:Number;
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function startSession(_arg1:String):void{
MochiServices.send("events_beginSession", {achievementID:_arg1}, null, null);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function setNotifications(_arg1:MovieClip, _arg2:Object):void{
var _local3:Object;
var _local4:Object;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
_local3.clip = _arg1;
MochiServices.send("events_setNotifications", _local3, null, null);
}
public static function endGame():void{
var _local1:Number;
_local1 = (new Date().time - gameStart);
trigger("end_game", {time:_local1});
}
public static function startGame():void{
gameStart = new Date().time;
trigger("start_game");
}
public static function trigger(_arg1:String, _arg2:Object=null):void{
if (_arg2 == null){
_arg2 = {};
} else {
if (_arg2["kind"] != undefined){
trace("WARNING: optional arguments package contains key 'id', it will be overwritten");
_arg2["kind"] = _arg1;
};
};
MochiServices.send("events_triggerEvent", {eventObject:_arg2}, null, null);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function startLevel():void{
levelStart = new Date().time;
trigger("start_level");
}
public static function endLevel():void{
var _local1:Number;
_local1 = (new Date().time - levelStart);
trigger("end_level", {time:_local1});
}
}
}//package mochi.as3
Section 22
//MochiInventory (mochi.as3.MochiInventory)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
public dynamic class MochiInventory extends Proxy {
private var _timer:Timer;
private var _names:Array;
private var _consumableProperties:Object;
private var _syncID:Number;
private var _storeSync:Object;
private var _outstandingID:Number;
private var _syncPending:Boolean;
public static const READY:String = "InvReady";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IoError";
private static const KEY_SALT:String = " syncMaint";
public static const WRITTEN:String = "InvWritten";
public static const NOT_READY:String = "InvNotReady";
public static const VALUE_ERROR:String = "InvValueError";
private static const CONSUMER_KEY:String = "MochiConsumables";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public function MochiInventory():void{
MochiCoins.addEventListener(MochiCoins.ITEM_OWNED, itemOwned);
MochiCoins.addEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, loggedOut);
_storeSync = new Object();
_syncPending = false;
_outstandingID = 0;
_syncID = 0;
_timer = new Timer(1000);
_timer.addEventListener(TimerEvent.TIMER, sync);
_timer.start();
if (MochiSocial.loggedIn){
loggedIn();
} else {
loggedOut();
};
}
private function newItems(_arg1:Object):void{
if (!this[(_arg1.id + KEY_SALT)]){
this[(_arg1.id + KEY_SALT)] = 0;
};
if (!this[_arg1.id]){
this[_arg1.id] = 0;
};
this[(_arg1.id + KEY_SALT)] = (this[(_arg1.id + KEY_SALT)] + _arg1.count);
this[_arg1.id] = (this[_arg1.id] + _arg1.count);
if (_arg1.privateProperties.consumable){
if (!this[_arg1.privateProperties.tag]){
this[_arg1.privateProperties.tag] = 0;
};
this[_arg1.privateProperties.tag] = (this[_arg1.privateProperties.tag] + (_arg1.privateProperties.inc * _arg1.count));
};
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (-1);
};
if (_consumableProperties[_arg1]){
return (MochiDigits(_consumableProperties[_arg1]).value);
};
return (undefined);
}
public function release():void{
MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, loggedOut);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (false);
};
if (_consumableProperties[_arg1] == undefined){
return (false);
};
return (true);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
return (((_arg1)>=_names.length) ? 0 : (_arg1 + 1));
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:MochiDigits;
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return;
};
if (!(_arg2 is Number)){
triggerEvent(ERROR, {type:VALUE_ERROR, error:"Invalid type", arg:_arg2});
return;
};
if (_consumableProperties[_arg1]){
_local3 = MochiDigits(_consumableProperties[_arg1]);
if (_local3.value == _arg2){
return;
};
_local3.value = _arg2;
} else {
_names.push(_arg1);
_consumableProperties[_arg1] = new MochiDigits(_arg2);
};
_syncID++;
}
private function sync(_arg1:Event=null):void{
var _local2:Object;
var _local3:String;
if (((_syncPending) || ((_syncID == _outstandingID)))){
return;
};
_outstandingID = _syncID;
_local2 = {};
for (_local3 in _consumableProperties) {
_local2[_local3] = MochiDigits(_consumableProperties[_local3]).value;
};
MochiUserData.put(CONSUMER_KEY, _local2, putConsumableBag);
_syncPending = true;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return (_names[(_arg1 - 1)]);
}
private function loggedIn(_arg1:Object=null):void{
MochiUserData.get(CONSUMER_KEY, getConsumableBag);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{
if (!_consumableProperties[_arg1]){
return (false);
};
_names.splice(_names.indexOf(_arg1), 1);
delete _consumableProperties[_arg1];
return (true);
}
private function itemOwned(_arg1:Object):void{
_storeSync[_arg1.id] = {properties:_arg1.properties, count:_arg1.count};
}
private function putConsumableBag(_arg1:MochiUserData):void{
_syncPending = false;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
_outstandingID = -1;
};
triggerEvent(WRITTEN, {});
}
private function getConsumableBag(_arg1:MochiUserData):void{
var _local2:String;
var _local3:Number;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
return;
};
_consumableProperties = {};
_names = new Array();
if (_arg1.data){
for (_local2 in _arg1.data) {
_names.push(_local2);
_consumableProperties[_local2] = new MochiDigits(_arg1.data[_local2]);
};
};
for (_local2 in _storeSync) {
_local3 = _storeSync[_local2].count;
if (_consumableProperties[(_local2 + KEY_SALT)]){
_local3 = (_local3 - _consumableProperties[_local2]);
};
if (_local3 == 0){
} else {
newItems({id:_local2, count:_local3, properties:_storeSync[_local2].properties});
};
};
triggerEvent(READY, {});
}
private function loggedOut(_arg1:Object=null):void{
_consumableProperties = null;
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
}
}//package mochi.as3
Section 23
//MochiScores (mochi.as3.MochiScores)
package mochi.as3 {
import flash.display.*;
import flash.text.*;
public class MochiScores {
private static var boardID:String;
public static var onErrorHandler:Object;
public static var onCloseHandler:Object;
public static function showLeaderboard(_arg1:Object=null):void{
var n:Number;
var options = _arg1;
if (options != null){
delete options.clip;
MochiServices.setContainer();
MochiServices.bringToTop();
if (options.name != null){
if ((options.name is TextField)){
if (options.name.text.length > 0){
options.name = options.name.text;
};
};
};
if (options.score != null){
if ((options.score is TextField)){
if (options.score.text.length > 0){
options.score = options.score.text;
};
} else {
if ((options.score is MochiDigits)){
options.score = options.score.value;
};
};
n = Number(options.score);
if (isNaN(n)){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((n == Number.NEGATIVE_INFINITY)) || ((n == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + options.score) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(n) != n){
trace((("WARNING: Submitted score '" + options.score) + "' will be truncated"));
};
options.score = n;
};
};
};
if (options.onDisplay != null){
options.onDisplay();
} else {
if (MochiServices.clip != null){
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
};
} else {
options = {};
if ((MochiServices.clip is MovieClip)){
MochiServices.clip.stop();
} else {
trace("Warning: Container is not a MovieClip, cannot call default onDisplay.");
};
};
if (options.onClose != null){
onCloseHandler = options.onClose;
} else {
onCloseHandler = function ():void{
if ((MochiServices.clip is MovieClip)){
} else {
trace("Warning: Container is not a MovieClip, cannot call default onClose.");
};
};
};
if (options.onError != null){
onErrorHandler = options.onError;
} else {
onErrorHandler = null;
};
if (options.boardID == null){
if (MochiScores.boardID != null){
options.boardID = MochiScores.boardID;
};
};
MochiServices.warnID(options.boardID, true);
trace("[MochiScores] NOTE: Security Sandbox Violation errors below are normal");
MochiServices.send("scores_showLeaderboard", {options:options}, null, onClose);
}
public static function closeLeaderboard():void{
MochiServices.send("scores_closeLeaderboard");
}
public static function getPlayerInfo(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_getPlayerInfo", null, _arg1, _arg2);
}
public static function requestList(_arg1:Object, _arg2:Object=null):void{
MochiServices.send("scores_requestList", null, _arg1, _arg2);
}
public static function scoresArrayToObjects(_arg1:Object):Object{
var _local2:Object;
var _local3:Number;
var _local4:Number;
var _local5:Object;
var _local6:Object;
var _local7:String;
var _local8:String;
_local2 = {};
for (_local7 in _arg1) {
if (typeof(_arg1[_local7]) == "object"){
if (((!((_arg1[_local7].cols == null))) && (!((_arg1[_local7].rows == null))))){
_local2[_local7] = [];
_local5 = _arg1[_local7];
_local4 = 0;
while (_local4 < _local5.rows.length) {
_local6 = {};
_local3 = 0;
while (_local3 < _local5.cols.length) {
_local6[_local5.cols[_local3]] = _local5.rows[_local4][_local3];
_local3++;
};
_local2[_local7].push(_local6);
_local4++;
};
} else {
_local2[_local7] = {};
for (_local8 in _arg1[_local7]) {
_local2[_local7][_local8] = _arg1[_local7][_local8];
};
};
} else {
_local2[_local7] = _arg1[_local7];
};
};
return (_local2);
}
public static function submit(_arg1:Number, _arg2:String, _arg3:Object=null, _arg4:Object=null):void{
_arg1 = Number(_arg1);
if (isNaN(_arg1)){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is 'Not a Number'"));
} else {
if ((((_arg1 == Number.NEGATIVE_INFINITY)) || ((_arg1 == Number.POSITIVE_INFINITY)))){
trace((("ERROR: Submitted score '" + String(_arg1)) + "' will be rejected, score is an infinite"));
} else {
if (Math.floor(_arg1) != _arg1){
trace((("WARNING: Submitted score '" + String(_arg1)) + "' will be truncated"));
};
_arg1 = Number(_arg1);
};
};
MochiServices.send("scores_submit", {score:_arg1, name:_arg2}, _arg3, _arg4);
}
public static function onClose(_arg1:Object=null):void{
if (((((_arg1) && ((_arg1.error == true)))) && (onErrorHandler))){
if (_arg1.errorCode == null){
_arg1.errorCode = "IOError";
};
onErrorHandler(_arg1.errorCode);
MochiServices.doClose();
return;
};
onCloseHandler();
MochiServices.doClose();
}
public static function setBoardID(_arg1:String):void{
MochiServices.warnID(_arg1, true);
MochiScores.boardID = _arg1;
MochiServices.send("scores_setBoardID", {boardID:_arg1});
}
}
}//package mochi.as3
Section 24
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.display.*;
import flash.events.*;
import flash.utils.*;
import flash.geom.*;
import flash.net.*;
import flash.system.*;
public class MochiServices {
private static var _container:Object;
private static var _connected:Boolean = false;
private static var _swfVersion:String;
private static var _preserved:Object;
public static var netupAttempted:Boolean = false;
private static var _sendChannel:LocalConnection;
public static var servicesSync:MochiSync = new MochiSync();
private static var _clip:MovieClip;
private static var _id:String;
private static var _services:String = "services.swf";
private static var _servURL:String = "http://www.mochiads.com/static/lib/services/";
public static var widget:Boolean = false;
private static var _timer:Timer;
private static var _sendChannelName:String;
private static var _loader:Loader;
private static var _connecting:Boolean = false;
private static var _mochiLocalConnection:MovieClip;
private static var _listenChannelName:String = "__ms_";
public static var onError:Object;
public static var netup:Boolean = true;
private static var _mochiLC:String = "MochiLC.swf";
public static function isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function get connected():Boolean{
return (_connected);
}
private static function onReceive(_arg1:Object):void{
var cb:String;
var cblst:Object;
var method:*;
var methodName:String;
var obj:Object;
var pkg = _arg1;
cb = pkg.callbackID;
cblst = _clip._callbacks[cb];
if (!cblst){
return;
};
method = cblst.callbackMethod;
methodName = "";
obj = cblst.callbackObject;
if (((obj) && ((typeof(method) == "string")))){
methodName = method;
if (obj[method] != null){
method = obj[method];
} else {
trace((("Error: Method " + method) + " does not exist."));
};
};
if (method != undefined){
try {
method.apply(obj, pkg.args);
} catch(error:Error) {
trace(((("Error invoking callback method '" + methodName) + "': ") + error.toString()));
};
} else {
if (obj != null){
try {
obj(pkg.args);
} catch(error:Error) {
trace(("Error invoking method on object: " + error.toString()));
};
};
};
delete _clip._callbacks[cb];
}
public static function get childClip():Object{
return (_clip);
}
public static function send(_arg1:String, _arg2:Object=null, _arg3:Object=null, _arg4:Object=null):void{
if (_connected){
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
} else {
if ((((_clip == null)) || (!(_connecting)))){
trace(("Error: MochiServices not connected. Please call MochiServices.connect(). Function: " + _arg1));
handleError(_arg2, _arg3, _arg4);
flush(true);
return;
};
_clip._queue.push({methodName:_arg1, args:_arg2, callbackID:_clip._nextcallbackID});
};
if (_clip != null){
if (((!((_clip._callbacks == null))) && (!((_clip._nextcallbackID == null))))){
_clip._callbacks[_clip._nextcallbackID] = {callbackObject:_arg3, callbackMethod:_arg4};
_clip._nextcallbackID++;
};
};
}
private static function init(_arg1:String, _arg2:Object):void{
_id = _arg1;
if (_arg2 != null){
_container = _arg2;
loadCommunicator(_arg1, _container);
};
}
private static function clickMovie(_arg1:String, _arg2:Function):MovieClip{
var _local3:Array;
var _local4:int;
var _local5:Array;
var _local6:Array;
var _local7:MovieClip;
var _local8:LocalConnection;
var _local9:String;
var _local10:ByteArray;
var _local11:ByteArray;
var _local12:uint;
var _local13:uint;
var _local14:Loader;
_local3 = [150, 21, 0, 7, 1, 0, 0, 0, 0, 98, 116, 110, 0, 7, 2, 0, 0, 0, 0, 116, 104, 105, 115, 0, 28, 150, 22, 0, 0, 99, 114, 101, 97, 116, 101, 69, 109, 112, 116, 121, 77, 111, 118, 105, 101, 67, 108, 105, 112, 0, 82, 135, 1, 0, 0, 23, 150, 13, 0, 4, 0, 0, 111, 110, 82, 101, 108, 101, 97, 115, 101, 0, 142, 8, 0, 0, 0, 0, 2, 42, 0, 114, 0, 150, 17, 0, 0, 32, 0, 7, 1, 0, 0, 0, 8, 0, 0, 115, 112, 108, 105, 116, 0, 82, 135, 1, 0, 1, 23, 150, 7, 0, 4, 1, 7, 0, 0, 0, 0, 78, 150, 8, 0, 0, 95, 98, 108, 97, 110, 107, 0, 154, 1, 0, 0, 150, 7, 0, 0, 99, 108, 105, 99, 107, 0, 150, 7, 0, 4, 1, 7, 1, 0, 0, 0, 78, 150, 27, 0, 7, 2, 0, 0, 0, 7, 0, 0, 0, 0, 0, 76, 111, 99, 97, 108, 67, 111, 110, 110, 101, 99, 116, 105, 111, 110, 0, 64, 150, 6, 0, 0, 115, 101, 110, 100, 0, 82, 79, 150, 15, 0, 4, 0, 0, 95, 97, 108, 112, 104, 97, 0, 7, 0, 0, 0, 0, 79, 150, 23, 0, 7, 0xFF, 0, 0xFF, 0, 7, 1, 0, 0, 0, 4, 0, 0, 98, 101, 103, 105, 110, 70, 105, 108, 108, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 109, 111, 118, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 100, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 100, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 25, 0, 7, 0, 0, 0, 0, 7, 0, 0, 0, 0, 7, 2, 0, 0, 0, 4, 0, 0, 108, 105, 110, 101, 84, 111, 0, 82, 23, 150, 16, 0, 7, 0, 0, 0, 0, 4, 0, 0, 101, 110, 100, 70, 105, 108, 108, 0, 82, 23];
_local5 = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
_local6 = [0, 64, 0, 0, 0];
_local7 = new MovieClip();
_local8 = new LocalConnection();
_local9 = ((("_click_" + Math.floor((Math.random() * 999999))) + "_") + Math.floor(new Date().time));
_local8 = new LocalConnection();
_local7.lc = _local8;
_local7.click = _arg2;
_local8.client = _local7;
_local8.connect(_local9);
_local10 = new ByteArray();
_local11 = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
_local12 = ((_local3.length + _local11.length) + 4);
_local13 = (_local12 + 35);
_local10.endian = Endian.LITTLE_ENDIAN;
_local10.writeUTFBytes("FWS");
_local10.writeByte(8);
_local10.writeUnsignedInt(_local13);
for each (_local4 in _local5) {
_local10.writeByte(_local4);
};
_local10.writeUnsignedInt(_local12);
_local10.writeByte(136);
_local10.writeShort(_local11.length);
_local10.writeBytes(_local11);
for each (_local4 in _local3) {
_local10.writeByte(_local4);
};
for each (_local4 in _local6) {
_local10.writeByte(_local4);
};
_local14 = new Loader();
_local14.loadBytes(_local10);
_local7.addChild(_local14);
return (_local7);
}
public static function stayOnTop():void{
_container.addEventListener(Event.ENTER_FRAME, MochiServices.bringToTop, false, 0, true);
if (_clip != null){
_clip.visible = true;
};
}
public static function addLinkEvent(_arg1:String, _arg2:String, _arg3:DisplayObjectContainer, _arg4:Function=null):void{
var vars:Object;
var avm1Click:DisplayObject;
var s:String;
var i:Number;
var x:String;
var req:URLRequest;
var loader:Loader;
var setURL:Function;
var err:Function;
var complete:Function;
var url = _arg1;
var burl = _arg2;
var btn = _arg3;
var onClick = _arg4;
vars = new Object();
vars["mav"] = getVersion();
vars["swfv"] = "9";
vars["swfurl"] = btn.loaderInfo.loaderURL;
vars["fv"] = Capabilities.version;
vars["os"] = Capabilities.os;
vars["lang"] = Capabilities.language;
vars["scres"] = ((Capabilities.screenResolutionX + "x") + Capabilities.screenResolutionY);
s = "?";
i = 0;
for (x in vars) {
if (i != 0){
s = (s + "&");
};
i = (i + 1);
s = (((s + x) + "=") + escape(vars[x]));
};
req = new URLRequest("http://x.mochiads.com/linkping.swf");
loader = new Loader();
setURL = function (_arg1:String):void{
var _local2:Rectangle;
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
_local2 = btn.getBounds(btn);
btn.addChild(avm1Click);
avm1Click.x = _local2.x;
avm1Click.y = _local2.y;
avm1Click.scaleX = (0.01 * _local2.width);
avm1Click.scaleY = (0.01 * _local2.height);
};
err = function (_arg1:Object):void{
netup = false;
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
setURL(burl);
};
complete = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
if (netup){
setURL((url + s));
} else {
setURL(burl);
};
if (!((netupAttempted) || (_connected))){
netupAttempted = true;
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, err);
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.load(req);
};
}
public static function warnID(_arg1:String, _arg2:Boolean):void{
var _local3:Number;
_arg1 = _arg1.toLowerCase();
if (_arg1.length != 16){
trace((("WARNING: " + (_arg2) ? "board" : "game") + " ID is not the appropriate length"));
return;
} else {
if (_arg1 == "1e113c7239048b3f"){
if (_arg2){
trace("WARNING: Using testing board ID");
} else {
trace("WARNING: Using testing board ID as game ID");
};
return;
} else {
if (_arg1 == "84993a1de4031cd8"){
if (_arg2){
trace("WARNING: Using testing game ID as board ID");
} else {
trace("WARNING: Using testing game ID");
};
return;
};
};
};
_local3 = 0;
while (_local3 < _arg1.length) {
switch (_arg1.charAt(_local3)){
case "0":
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
case "a":
case "b":
case "c":
case "d":
case "e":
case "f":
break;
default:
trace(("WARNING: Board ID contains illegal characters: " + _arg1));
return;
};
_local3++;
};
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_mochiLocalConnection.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function getVersion():String{
return ("3.7 as3");
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (((_clip) && (_clip._queue))){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
}
public static function get id():String{
return (_id);
}
private static function onEvent(_arg1:Object):void{
var _local2:String;
var _local3:String;
_local2 = _arg1.target;
_local3 = _arg1.event;
switch (_local2){
case "events":
MochiEvents.triggerEvent(_arg1.event, _arg1.args);
break;
case "coins":
MochiCoins.triggerEvent(_arg1.event, _arg1.args);
break;
case "sync":
servicesSync.triggerEvent(_arg1.event, _arg1.args);
break;
};
}
private static function urlOptions(_arg1:Object):Object{
var _local2:Object;
var _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
_local2 = {};
if (_arg1.stage){
_local3 = _arg1.stage.loaderInfo.parameters.mochiad_options;
} else {
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
};
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
private static function loadError(_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
}
private static function initComChannels():void{
if (!_connected){
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"registerGame", preserved:_preserved, id:_id, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_clip.onReceive = onReceive;
_clip.onEvent = onEvent;
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
while (_clip._queue.length > 0) {
_mochiLocalConnection.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function loadLCBridge(_arg1:Object):void{
var loader:Loader;
var mochiLCURL:String;
var req:URLRequest;
var complete:Function;
var clip = _arg1;
loader = new Loader();
mochiLCURL = (_servURL + _mochiLC);
req = new URLRequest(mochiLCURL);
complete = function (_arg1:Object):void{
_mochiLocalConnection = MovieClip(loader.content);
listen();
};
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, complete);
loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
loader.load(req);
clip.addChild(loader);
}
private static function listen():void{
_mochiLocalConnection.connect(_listenChannelName);
_clip.handshake = function (_arg1:Object):void{
MochiServices.comChannelName = _arg1.newChannel;
};
trace("Waiting for MochiAds services to connect...");
}
public static function get clip():Object{
return (_container);
}
public static function set comChannelName(_arg1:String):void{
if (_arg1 != null){
if (_arg1.length > 3){
_sendChannelName = (_arg1 + "_fromgame");
initComChannels();
};
};
}
private static function loadCommunicator(_arg1:String, _arg2:Object):MovieClip{
var _local3:String;
var _local4:String;
var _local5:URLRequest;
var _local6:URLVariables;
_local3 = ("_mochiservices_com_" + _arg1);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(_arg2).servURL){
_servURL = urlOptions(_arg2).servURL;
};
_local4 = (_servURL + _services);
if (urlOptions(_arg2).servicesURL){
_local4 = urlOptions(_arg2).servicesURL;
};
_listenChannelName = (_listenChannelName + ((Math.floor(new Date().time) + "_") + Math.floor((Math.random() * 99999))));
MochiServices.allowDomains(_local4);
_clip = createEmptyMovieClip(_arg2, _local3, 10336, false);
loadLCBridge(_clip);
_loader = new Loader();
_loader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, loadError);
_local5 = new URLRequest(_local4);
_local6 = new URLVariables();
_local6.listenLC = _listenChannelName;
_local6.mochiad_options = _arg2.loaderInfo.parameters.mochiad_options;
_local6.api_version = getVersion();
if (widget){
_local6.widget = true;
};
_local5.data = _local6;
_loader.load(_local5);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_clip._nextcallbackID = 0;
_clip._callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
warnID(id, false);
if ((clip is DisplayObject)){
if (clip.stage == null){
trace("MochiServices connect requires the containing clip be attached to the stage");
};
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var mc:MovieClip;
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
mc = new MovieClip();
if (doAdd){
if (((false) && (depth))){
parent.addChildAt(mc, depth);
} else {
parent.addChild(mc);
};
};
try {
parent[name] = mc;
} catch(e:Error) {
throw (new Error("MochiServices requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
mc["_name"] = name;
return (mc);
}
public static function bringToTop(_arg1:Event=null):void{
var e = _arg1;
if (((!((MochiServices.clip == null))) && (!((MochiServices.childClip == null))))){
try {
if (MochiServices.clip.numChildren > 1){
MochiServices.clip.setChildIndex(MochiServices.childClip, (MochiServices.clip.numChildren - 1));
};
} catch(errorObject:Error) {
trace("Warning: Depth sort error.");
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
};
};
}
public static function connectWait(_arg1:TimerEvent):void{
if (!_connected){
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load. (timeout)");
MochiServices.disconnect();
MochiServices.onError("IOError");
};
}
}
}//package mochi.as3
Section 25
//MochiSocial (mochi.as3.MochiSocial)
package mochi.as3 {
public class MochiSocial {
public static const LOGGED_IN:String = "LoggedIn";
public static const PROFILE_HIDE:String = "ProfileHide";
public static const NO_USER:String = "NoUser";
public static const PROPERTIES_SIZE:String = "PropertiesSize";
public static const IO_ERROR:String = "IOError";
public static const PROPERTIES_SAVED:String = "PropertySaved";
public static const WIDGET_LOADED:String = "WidgetLoaded";
public static const USER_INFO:String = "UserInfo";
public static const ERROR:String = "Error";
public static const LOGIN_SHOW:String = "LoginShow";
public static const LOGGED_OUT:String = "LoggedOut";
public static const PROFILE_SHOW:String = "ProfileShow";
public static const LOGIN_SHOWN:String = "LoginShown";
public static const LOGIN_HIDE:String = "LoginHide";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static var _user_info:Object = null;
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function saveUserProperties(_arg1:Object):void{
MochiServices.send("coins_saveUserProperties", _arg1);
}
public static function get loggedIn():Boolean{
return (!((_user_info == null)));
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function getUserInfo():void{
MochiServices.send("coins_getUserInfo");
}
public static function showLoginWidget(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showLoginWidget", {options:_arg1});
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function requestLogin():void{
MochiServices.send("coins_requestLogin");
}
public static function getAPIURL():String{
if (!_user_info){
return (null);
};
return (_user_info.api_url);
}
public static function hideLoginWidget():void{
MochiServices.send("coins_hideLoginWidget");
}
public static function getAPIToken():String{
if (!_user_info){
return (null);
};
return (_user_info.api_token);
}
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_user_info = _arg1;
});
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_user_info = null;
});
}
}//package mochi.as3
Section 26
//MochiSync (mochi.as3.MochiSync)
package mochi.as3 {
import flash.utils.*;
public dynamic class MochiSync extends Proxy {
private var _syncContainer:Object;
public static var SYNC_PROPERTY:String = "UpdateProperty";
public static var SYNC_REQUEST:String = "SyncRequest";
public function MochiSync():void{
_syncContainer = {};
}
public function triggerEvent(_arg1:String, _arg2:Object):void{
switch (_arg1){
case SYNC_REQUEST:
MochiServices.send("sync_syncronize", _syncContainer);
break;
case SYNC_PROPERTY:
_syncContainer[_arg2.name] = _arg2.value;
break;
};
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
return (_syncContainer[_arg1]);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:String;
if (_syncContainer[_arg1] == _arg2){
return;
};
_local3 = _arg1.toString();
_syncContainer[_local3] = _arg2;
MochiServices.send("sync_propUpdate", {name:_local3, value:_arg2});
}
}
}//package mochi.as3
Section 27
//MochiUserData (mochi.as3.MochiUserData)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
public class MochiUserData extends EventDispatcher {
public var callback:Function;// = null
public var error:Event;// = null
public var key:String;// = null
public var operation:String;// = null
public var data;// = null
public var _loader:URLLoader;
public function MochiUserData(_arg1:String="", _arg2:Function=null){
key = null;
data = null;
error = null;
operation = null;
callback = null;
super();
this.key = _arg1;
this.callback = _arg2;
}
public function securityErrorHandler(_arg1:SecurityErrorEvent):void{
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.toString())));
}
public function putEvent(_arg1):void{
request("put", serialize(_arg1));
}
public function request(_arg1:String, _arg2:ByteArray):void{
var api_url:String;
var api_token:String;
var args:URLVariables;
var req:URLRequest;
var _operation = _arg1;
var _data = _arg2;
operation = _operation;
api_url = MochiSocial.getAPIURL();
api_token = MochiSocial.getAPIToken();
if ((((api_url == null)) || ((api_token == null)))){
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, "not logged in"));
return;
};
_loader = new URLLoader();
args = new URLVariables();
args.op = _operation;
args.key = key;
req = new URLRequest((((MochiSocial.getAPIURL() + "/") + "MochiUserData?") + args.toString()));
req.method = URLRequestMethod.POST;
req.contentType = "application/x-mochi-userdata";
req.requestHeaders = [new URLRequestHeader("x-mochi-services-version", MochiServices.getVersion()), new URLRequestHeader("x-mochi-api-token", api_token)];
req.data = _data;
_loader.dataFormat = URLLoaderDataFormat.BINARY;
_loader.addEventListener(Event.COMPLETE, completeHandler);
_loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
try {
_loader.load(req);
} catch(e:SecurityError) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + e.toString())));
};
}
public function completeHandler(_arg1:Event):void{
var event = _arg1;
try {
if (_loader.data.length){
data = deserialize(_loader.data);
} else {
data = null;
};
} catch(e:Error) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("deserialize error: " + e.toString())));
return;
};
if (callback != null){
performCallback();
} else {
dispatchEvent(event);
};
close();
}
public function performCallback():void{
try {
callback(this);
} catch(e:Error) {
trace(("[MochiUserData] exception during callback: " + e));
};
}
public function serialize(_arg1):ByteArray{
var _local2:ByteArray;
_local2 = new ByteArray();
_local2.objectEncoding = ObjectEncoding.AMF3;
_local2.writeObject(_arg1);
_local2.compress();
return (_local2);
}
public function errorHandler(_arg1:IOErrorEvent):void{
data = null;
error = _arg1;
if (callback != null){
performCallback();
} else {
dispatchEvent(_arg1);
};
close();
}
public function getEvent():void{
request("get", serialize(null));
}
override public function toString():String{
return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]"));
}
public function close():void{
if (_loader){
_loader.removeEventListener(Event.COMPLETE, completeHandler);
_loader.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
_loader.close();
_loader = null;
};
error = null;
callback = null;
}
public function deserialize(_arg1:ByteArray){
_arg1.objectEncoding = ObjectEncoding.AMF3;
_arg1.uncompress();
return (_arg1.readObject());
}
public static function get(_arg1:String, _arg2:Function):void{
var _local3:MochiUserData;
_local3 = new MochiUserData(_arg1, _arg2);
_local3.getEvent();
}
public static function put(_arg1:String, _arg2, _arg3:Function):void{
var _local4:MochiUserData;
_local4 = new MochiUserData(_arg1, _arg3);
_local4.putEvent(_arg2);
}
}
}//package mochi.as3
Section 28
//i6introsmall (i6introsmall)
package {
import flash.display.*;
public dynamic class i6introsmall extends MovieClip {
}
}//package
Section 29
//i6LOADBAR (i6LOADBAR)
package {
import flash.display.*;
public dynamic class i6LOADBAR extends MovieClip {
}
}//package
Section 30
//i6LOADER (i6LOADER)
package {
import flash.display.*;
public dynamic class i6LOADER extends MovieClip {
public var bar:i6LOADBAR;
public function i6LOADER(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 31
//mBox1 (mBox1)
package {
import flash.display.*;
public dynamic class mBox1 extends MovieClip {
}
}//package
Section 32
//mButtonBack (mButtonBack)
package {
import flash.display.*;
public dynamic class mButtonBack extends MovieClip {
}
}//package
Section 33
//mButtonUp (mButtonUp)
package {
import flash.display.*;
public dynamic class mButtonUp extends MovieClip {
}
}//package
Section 34
//mCloseAds (mCloseAds)
package {
import flash.display.*;
public dynamic class mCloseAds extends SimpleButton {
}
}//package
Section 35
//mCloud (mCloud)
package {
import flash.display.*;
public dynamic class mCloud extends MovieClip {
}
}//package
Section 36
//mColorBar (mColorBar)
package {
import flash.display.*;
public dynamic class mColorBar extends MovieClip {
}
}//package
Section 37
//mCredGlass (mCredGlass)
package {
import flash.display.*;
public dynamic class mCredGlass extends MovieClip {
}
}//package
Section 38
//mCredits (mCredits)
package {
import flash.display.*;
public dynamic class mCredits extends MovieClip {
}
}//package
Section 39
//mDayFilter (mDayFilter)
package {
import flash.display.*;
public dynamic class mDayFilter extends MovieClip {
}
}//package
Section 40
//mDummy (mDummy)
package {
import flash.display.*;
public dynamic class mDummy extends MovieClip {
}
}//package
Section 41
//mExp1 (mExp1)
package {
import flash.display.*;
public dynamic class mExp1 extends MovieClip {
}
}//package
Section 42
//mExplosion (mExplosion)
package {
import flash.display.*;
public dynamic class mExplosion extends MovieClip {
}
}//package
Section 43
//mFlashMovie (mFlashMovie)
package {
import flash.display.*;
public dynamic class mFlashMovie extends MovieClip {
}
}//package
Section 44
//mFonObjs1 (mFonObjs1)
package {
import flash.display.*;
public dynamic class mFonObjs1 extends MovieClip {
public var obj:mTree1;
public var shad:mFonObjs1Shad;
}
}//package
Section 45
//mFonObjs1Shad (mFonObjs1Shad)
package {
import flash.display.*;
public dynamic class mFonObjs1Shad extends MovieClip {
}
}//package
Section 46
//mFragments (mFragments)
package {
import flash.display.*;
public dynamic class mFragments extends MovieClip {
}
}//package
Section 47
//mGradient1 (mGradient1)
package {
import flash.display.*;
public dynamic class mGradient1 extends MovieClip {
}
}//package
Section 48
//mGradient2 (mGradient2)
package {
import flash.display.*;
public dynamic class mGradient2 extends MovieClip {
}
}//package
Section 49
//mGradient3 (mGradient3)
package {
import flash.display.*;
public dynamic class mGradient3 extends MovieClip {
}
}//package
Section 50
//mGround1 (mGround1)
package {
import flash.display.*;
public dynamic class mGround1 extends MovieClip {
}
}//package
Section 51
//mHealthGlass (mHealthGlass)
package {
import flash.display.*;
public dynamic class mHealthGlass extends MovieClip {
}
}//package
Section 52
//mLevelTexty (mLevelTexty)
package {
import flash.display.*;
public dynamic class mLevelTexty extends MovieClip {
}
}//package
Section 53
//mLevelZeppelin (mLevelZeppelin)
package {
import flash.display.*;
import flash.text.*;
public dynamic class mLevelZeppelin extends MovieClip {
public var levText:TextField;
}
}//package
Section 54
//mMinus1 (mMinus1)
package {
import flash.display.*;
public dynamic class mMinus1 extends MovieClip {
}
}//package
Section 55
//mNightFilter (mNightFilter)
package {
import flash.display.*;
public dynamic class mNightFilter extends MovieClip {
}
}//package
Section 56
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
var _local3:MochiBot;
var _local4:String;
var _local5:URLVariables;
var _local6:String;
var _local7:URLRequest;
var _local8:Loader;
if (Security.sandboxType == "localWithFile"){
return (null);
};
_local3 = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
_local4 = "http://core.mochibot.com/my/core.swf";
_local5 = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
_local6 = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
_local7 = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
_local8 = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 57
//mPanel (mPanel)
package {
import flash.display.*;
public dynamic class mPanel extends MovieClip {
}
}//package
Section 58
//mPanelGlass (mPanelGlass)
package {
import flash.display.*;
public dynamic class mPanelGlass extends MovieClip {
}
}//package
Section 59
//mPlane (mPlane)
package {
import flash.display.*;
public dynamic class mPlane extends MovieClip {
}
}//package
Section 60
//mPlaneFragments (mPlaneFragments)
package {
import flash.display.*;
public dynamic class mPlaneFragments extends MovieClip {
}
}//package
Section 61
//mPlus1 (mPlus1)
package {
import flash.display.*;
public dynamic class mPlus1 extends MovieClip {
}
}//package
Section 62
//mPlus2 (mPlus2)
package {
import flash.display.*;
public dynamic class mPlus2 extends MovieClip {
}
}//package
Section 63
//mPowerUp1 (mPowerUp1)
package {
import flash.display.*;
public dynamic class mPowerUp1 extends MovieClip {
}
}//package
Section 64
//mPowerUp2 (mPowerUp2)
package {
import flash.display.*;
public dynamic class mPowerUp2 extends MovieClip {
}
}//package
Section 65
//mPropeller (mPropeller)
package {
import flash.display.*;
public dynamic class mPropeller extends MovieClip {
}
}//package
Section 66
//mShotFire (mShotFire)
package {
import flash.display.*;
public dynamic class mShotFire extends MovieClip {
}
}//package
Section 67
//mSmoke (mSmoke)
package {
import flash.display.*;
public dynamic class mSmoke extends MovieClip {
}
}//package
Section 68
//mSun (mSun)
package {
import flash.display.*;
public dynamic class mSun extends MovieClip {
}
}//package
Section 69
//mTitle (mTitle)
package {
import flash.display.*;
public dynamic class mTitle extends MovieClip {
}
}//package
Section 70
//mTree1 (mTree1)
package {
import flash.display.*;
public dynamic class mTree1 extends MovieClip {
}
}//package
Section 71
//mZeppelin (mZeppelin)
package {
import flash.display.*;
public dynamic class mZeppelin extends MovieClip {
}
}//package
Section 72
//sBonusWav (sBonusWav)
package {
import flash.media.*;
public dynamic class sBonusWav extends Sound {
}
}//package
Section 73
//sButtonWav (sButtonWav)
package {
import flash.media.*;
public dynamic class sButtonWav extends Sound {
}
}//package
Section 74
//secondframesounds (secondframesounds)
package {
import flash.display.*;
public dynamic class secondframesounds extends MovieClip {
public function secondframesounds(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 75
//sEngineWav (sEngineWav)
package {
import flash.media.*;
public dynamic class sEngineWav extends Sound {
}
}//package
Section 76
//sExpWav (sExpWav)
package {
import flash.media.*;
public dynamic class sExpWav extends Sound {
}
}//package
Section 77
//sFireFastWav (sFireFastWav)
package {
import flash.media.*;
public dynamic class sFireFastWav extends Sound {
}
}//package
Section 78
//sFireSlowWav (sFireSlowWav)
package {
import flash.media.*;
public dynamic class sFireSlowWav extends Sound {
}
}//package
Section 79
//sFireVeryFastWav (sFireVeryFastWav)
package {
import flash.media.*;
public dynamic class sFireVeryFastWav extends Sound {
}
}//package
Section 80
//sOneFireWav (sOneFireWav)
package {
import flash.media.*;
public dynamic class sOneFireWav extends Sound {
}
}//package
Section 81
//sPopaWav (sPopaWav)
package {
import flash.media.*;
public dynamic class sPopaWav extends Sound {
}
}//package
Section 82
//Stripes (Stripes)
package {
import flash.display.*;
public dynamic class Stripes extends MovieClip {
}
}//package
Section 83
//wallp07jpg (wallp07jpg)
package {
import flash.display.*;
public dynamic class wallp07jpg extends BitmapData {
public function wallp07jpg(_arg1:Number, _arg2:Number){
super(_arg1, _arg2);
}
}
}//package