Section 1
//KongregateEvent (com.kongregate.as3.client.events.KongregateEvent)
package com.kongregate.as3.client.events {
import flash.events.*;
public class KongregateEvent extends Event {
public static const COMPLETE:String = "component_api_available";
public function KongregateEvent(_arg1:String){
super(_arg1);
}
}
}//package com.kongregate.as3.client.events
Section 2
//AbstractShadowService (com.kongregate.as3.client.services.AbstractShadowService)
package com.kongregate.as3.client.services {
import flash.events.*;
public class AbstractShadowService extends EventDispatcher {
protected function alert(_arg1:String, _arg2:String, _arg3="", _arg4:String=""):void{
trace(((((((("Kongregate API: " + _arg1) + ".") + _arg2) + "(") + _arg3) + ") ") + _arg4));
}
}
}//package com.kongregate.as3.client.services
Section 3
//HighScoreServiceShadow (com.kongregate.as3.client.services.HighScoreServiceShadow)
package com.kongregate.as3.client.services {
public class HighScoreServiceShadow extends AbstractShadowService implements IHighScoreServices {
private var mode:String;
public function HighScoreServiceShadow(){
mode = "";
}
public function submit(_arg1:Number, _arg2:String=null):void{
alert("IHighScoreServices", "submit", arguments);
}
public function connect():Boolean{
alert("IKongregateServices", "connect");
return (true);
}
public function requestList(_arg1:Function):void{
alert("IHighScoreServices", "requestList", "", (("[Mode: " + mode) + "]"));
_arg1({success:false});
}
public function setMode(_arg1:String):void{
alert("IHighScoreServices", "setMode", arguments);
this.mode = _arg1;
}
}
}//package com.kongregate.as3.client.services
Section 4
//IHighScoreServices (com.kongregate.as3.client.services.IHighScoreServices)
package com.kongregate.as3.client.services {
public interface IHighScoreServices {
function setMode(_arg1:String):void;
function submit(_arg1:Number, _arg2:String=null):void;
function requestList(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 5
//IKongregateServices (com.kongregate.as3.client.services.IKongregateServices)
package com.kongregate.as3.client.services {
import flash.events.*;
public interface IKongregateServices extends IEventDispatcher {
function getPlayerInfo(_arg1:Function):void;
function connect(_arg1:Number=-1):Boolean;
}
}//package com.kongregate.as3.client.services
Section 6
//IStatServices (com.kongregate.as3.client.services.IStatServices)
package com.kongregate.as3.client.services {
public interface IStatServices {
function submitArray(_arg1:Array):void;
function submit(_arg1:String, _arg2:Number):void;
}
}//package com.kongregate.as3.client.services
Section 7
//IUserServices (com.kongregate.as3.client.services.IUserServices)
package com.kongregate.as3.client.services {
public interface IUserServices {
function getName():String;
function getPlayerInfo(_arg1:Function):void;
}
}//package com.kongregate.as3.client.services
Section 8
//KongregateServiceShadow (com.kongregate.as3.client.services.KongregateServiceShadow)
package com.kongregate.as3.client.services {
public class KongregateServiceShadow extends AbstractShadowService implements IKongregateServices {
public function getName():String{
alert("IKongregateServices", "getName");
return ("Guest");
}
public function connect(_arg1:Number=-1):Boolean{
alert("IKongregateServices", "connect", arguments);
return (true);
}
public function getPlayerInfo(_arg1:Function):void{
alert("IKongregateServices", "getPlayerInfo");
_arg1(new Object());
}
}
}//package com.kongregate.as3.client.services
Section 9
//StatServiceShadow (com.kongregate.as3.client.services.StatServiceShadow)
package com.kongregate.as3.client.services {
public class StatServiceShadow extends AbstractShadowService implements IStatServices {
public function submitArray(_arg1:Array):void{
alert("IStatServices", "submitArray", arguments);
}
public function submit(_arg1:String, _arg2:Number):void{
alert("IStatServices", "submitStat", arguments);
}
}
}//package com.kongregate.as3.client.services
Section 10
//UserServiceShadow (com.kongregate.as3.client.services.UserServiceShadow)
package com.kongregate.as3.client.services {
public class UserServiceShadow extends AbstractShadowService implements IUserServices {
public function getName():String{
alert("UserService", "getName");
return ("Guest");
}
public function getPlayerInfo(_arg1:Function):void{
alert("UserService", "getPlayerInfo");
_arg1({isGuest:true, name:"Guest", points:0, level:0, isMode:false, isAdmin:false, isDeveloper:false, avatarPath:"", chatAvatarPath:""});
}
}
}//package com.kongregate.as3.client.services
Section 11
//IAPIBootstrap (com.kongregate.as3.client.IAPIBootstrap)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
public interface IAPIBootstrap {
function init(_arg1:Event=null, _arg2:Stage=null):void;
function hideLog():void;
function showLog(_arg1:int=0):void;
}
}//package com.kongregate.as3.client
Section 12
//KongregateAPI (com.kongregate.as3.client.KongregateAPI)
package com.kongregate.as3.client {
import flash.events.*;
import flash.display.*;
import com.kongregate.as3.client.services.*;
import com.kongregate.as3.client.events.*;
import flash.system.*;
import flash.utils.*;
import flash.net.*;
import flash.errors.*;
public class KongregateAPI extends Sprite {
private const VERSION:Number = 1;
private var loader:Loader;
private var loadedDomain:ApplicationDomain;
private static const CLASS_USER:String = "com.kongregate.as3.client.services.UserServices";
private static const CLASS_STATS:String = "com.kongregate.as3.client.services.StatServices";
private static const CLASS_SERVICES:String = "com.kongregate.as3.client.services.KongregateServices";
private static const CLASS_SCORES:String = "com.kongregate.as3.client.services.HighScoreServices";
private static const DEBUG_API_URL:String = "//Linuxpc/kongregate/public/flash/API_AS3.swf";
private static var _connected:Boolean;
private static var kUser:IUserServices;
private static var _loaded:Boolean;
private static var kServices:IKongregateServices;
private static var kScores:IHighScoreServices;
private static var mInstance:KongregateAPI;
private static var kStats:IStatServices;
private static var kAPI:IAPIBootstrap;
public function KongregateAPI(){
if (mInstance != null){
throw (new Error("Warning: KongregateAPI has been added to stage more than once or accessed improperly. Use getInstance() or a stage reference to access."));
};
mInstance = this;
this.addEventListener(Event.ADDED_TO_STAGE, init, false, 0, true);
}
public function get loaded():Boolean{
return (_loaded);
}
public function get connected():Boolean{
return (_connected);
}
private function alertConnected(_arg1:TimerEvent=null):void{
var _local2:KongregateEvent;
var _local3:Boolean;
_local2 = new KongregateEvent(KongregateEvent.COMPLETE);
_local3 = this.dispatchEvent(_local2);
}
private function init(_arg1:Event):void{
var _local2:Object;
var _local3:String;
var _local4:URLRequest;
var _local5:LoaderContext;
this.removeEventListener(Event.ADDED_TO_STAGE, init);
_loaded = false;
_connected = false;
_local2 = LoaderInfo(root.loaderInfo).parameters;
_local3 = _local2.api_path;
if (_local3 == null){
trace("Alert: Kongregate API could not be loaded, due to local testing. API will load when the game is uploaded.");
createShadowServices();
return;
};
Security.allowDomain("*.kongregate.com");
Security.allowDomain("kongregatetrunk.com");
_local4 = new URLRequest(_local3);
_local5 = new LoaderContext(false);
_local5.applicationDomain = ApplicationDomain.currentDomain;
_local5.securityDomain = SecurityDomain.currentDomain;
loader = new Loader();
loader.contentLoaderInfo.addEventListener(Event.COMPLETE, loadComplete);
loader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler);
loader.load(_local4, _local5);
}
public function get api():IAPIBootstrap{
return (kAPI);
}
private function loadComplete(_arg1:Event):void{
getServices();
}
public function get scores():IHighScoreServices{
return (kScores);
}
private function ioErrorHandler(_arg1:IOErrorEvent):void{
throw (new IOError(("API file not found. " + _arg1)));
}
public function get services():IKongregateServices{
return (kServices);
}
public function get stats():IStatServices{
return (kStats);
}
private function createShadowServices():void{
var _local1:Timer;
trace(">>> Kongregate Shadow Services instantiated for local development..");
kServices = new KongregateServiceShadow();
kScores = new HighScoreServiceShadow();
kStats = new StatServiceShadow();
kUser = new UserServiceShadow();
_local1 = new Timer(200, 1);
_local1.addEventListener(TimerEvent.TIMER_COMPLETE, alertConnected);
_local1.start();
_connected = true;
}
public function get user():IUserServices{
return (kUser);
}
private function getServices():void{
var _local1:ApplicationDomain;
var _local2:*;
var _local3:*;
var _local4:*;
var _local5:*;
_local1 = ApplicationDomain.currentDomain;
kAPI = IAPIBootstrap(loader.getChildAt(0));
this.addChild(loader);
_local2 = _local1.getDefinition(CLASS_SERVICES);
trace(_local2);
kServices = _local2.getInstance();
_local3 = _local1.getDefinition(CLASS_SCORES);
kScores = _local3.getInstance();
_local4 = _local1.getDefinition(CLASS_STATS);
kStats = _local4.getInstance();
_local5 = _local1.getDefinition(CLASS_USER);
kUser = _local5.getInstance();
kServices.connect(VERSION);
_loaded = true;
_connected = true;
alertConnected();
}
public static function getInstance():KongregateAPI{
if (!mInstance){
throw (new IllegalOperationError("You must add the Kongregate API component to the stage before attempting to access it."));
};
return (mInstance);
}
}
}//package com.kongregate.as3.client
Section 13
//MainTimeline (main_fla.MainTimeline)
package main_fla {
import flash.events.*;
import flash.display.*;
import com.kongregate.as3.client.*;
import flash.geom.*;
import flash.media.*;
import flash.system.*;
import flash.filters.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.errors.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.external.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var myTiros:MovieClip;
public var explosions:MovieClip;
public var t2:Timer;
public var m:TextField;
public var st:SimpleButton;
public var allEnemy:MovieClip;
public var t:Timer;
public var a:TextField;
public var level:int;
public var s:TextField;
public var maxLevel:Array;
public var again:SimpleButton;
public var allMoney:MovieClip;
public var score:int;
public var enemyTiros:MovieClip;
public var particleContainer:MovieClip;
public var kongregate:KongregateAPI;
public var player:MovieClip;
public var money:int;
public function MainTimeline(){
addFrameScript(0, frame1, 1, frame2, 30, frame31, 31, frame32, 32, frame33, 100, frame101, 144, frame145, 189, frame190, 191, frame192, 244, frame245, 245, frame246, 270, frame271);
}
public function restart(_arg1:MouseEvent){
score = 0;
level = 1;
money = 0;
t.reset();
s.text = "0";
a.text = "HP: 10";
m.text = "0";
gotoAndPlay(1);
again.removeEventListener(MouseEvent.MOUSE_UP, restart);
}
public function hKeyDown(_arg1:KeyboardEvent){
trace(_arg1.charCode);
if (money >= 500){
if (_arg1.charCode == 49){
trace("shields!");
player.shieldOn();
};
if (_arg1.charCode == 50){
trace("newFire!");
player.tripleFire();
};
};
}
public function createMonster(_arg1:TimerEvent){
var _local2:EnemyLinear;
var _local3:EnemyX;
var _local4:testEnemy;
var _local5:Boss;
if (level == 1){
_local2 = new EnemyLinear();
_local2.x = (Math.random() * stage.stageWidth);
_local2.y = -100;
allEnemy.addChild(_local2);
};
if (t.currentCount == maxLevel[1]){
gotoAndPlay("level2");
t.delay = 600;
level = 2;
};
if (level == 2){
_local3 = new EnemyX();
_local3.x = (Math.random() * stage.stageWidth);
_local3.y = -100;
allEnemy.addChild(_local3);
};
if (t.currentCount == maxLevel[2]){
gotoAndPlay("level3");
t.delay = 700;
level = 3;
};
if (level == 3){
_local4 = new testEnemy();
_local4.x = (Math.random() * stage.stageWidth);
_local4.y = -100;
allEnemy.addChild(_local4);
};
if (t.currentCount == maxLevel[3]){
gotoAndPlay("level4");
t.delay = 1000;
level = 4;
_local5 = new Boss();
_local5.x = (stage.stageWidth / 2);
_local5.y = -100;
allEnemy.addChild(_local5);
};
}
function frame190(){
stop();
}
public function focusMe(_arg1:TimerEvent){
stage.focus = this;
}
function frame1(){
MochiAd.showPreGameAd({clip:root, id:"dd0041796506a26b", res:"500x450"});
}
function frame31(){
kongregate = new KongregateAPI();
this.addChild(kongregate);
stop();
st.addEventListener(MouseEvent.MOUSE_UP, begin);
}
function frame245(){
stop();
}
function frame246(){
Mouse.show();
removeALL();
player.removeListeners();
removeChild(player);
player.removeEventListener(Event.ENTER_FRAME, player.hitTest);
again.addEventListener(MouseEvent.MOUSE_UP, restart);
kongregate.scores.submit(score);
stop();
}
public function begin(_arg1:MouseEvent){
nextScene();
}
function frame33(){
Mouse.hide();
myTiros = new MovieClip();
addChild(myTiros);
explosions = new MovieClip();
addChild(explosions);
allMoney = new MovieClip();
addChild(allMoney);
enemyTiros = new MovieClip();
addChild(enemyTiros);
allEnemy = new MovieClip();
addChild(allEnemy);
player = new Player();
addChild(player);
player.x = (stage.stageWidth / 2);
player.y = ((stage.stageHeight * 4) / 5);
level = 1;
score = 0;
money = 0;
maxLevel = [0, 70, 130, 168];
t = new Timer(400);
t.addEventListener(TimerEvent.TIMER, createMonster);
addEventListener(KeyboardEvent.KEY_DOWN, hKeyDown);
t2 = new Timer(50);
t2.addEventListener(TimerEvent.TIMER, focusMe);
t2.start();
}
function frame2(){
stage.addEventListener(Event.ENTER_FRAME, generateParticles);
if (particleContainer == null){
particleContainer = new MovieClip();
addChild(particleContainer);
};
}
public function removeALL(){
var _local1:int;
var _local2:int;
var _local3:MovieClip;
var _local4:MovieClip;
_local1 = allEnemy.numChildren;
_local2 = 0;
while (_local2 < _local1) {
_local3 = MovieClip(root).allEnemy.getChildAt(0);
_local3.destroy();
_local2++;
};
_local1 = enemyTiros.numChildren;
_local2 = 0;
while (_local2 < _local1) {
_local4 = MovieClip(root).enemyTiros.getChildAt(0);
_local4.removeEventListener(Event.ENTER_FRAME, _local4.move);
enemyTiros.removeChild(_local4);
_local2++;
};
}
function frame32(){
SoundMixer.stopAll();
}
public function generateParticles(_arg1:Event):void{
var _local2:int;
var _local3:Shape;
var _local4:int;
var _local5:Object;
if ((Math.random() * 10) < 2){
_local3 = new Shape();
_local4 = (int((Math.random() * 5)) + 1);
_local3.graphics.beginFill(0xCCCCCC, Math.random());
_local3.graphics.drawRect(_local4, _local4, _local4, _local4);
_local3.x = int((Math.random() * stage.stageWidth));
_local3.y = -10;
particleContainer.addChild(_local3);
};
_local2 = 0;
while (_local2 < particleContainer.numChildren) {
_local5 = particleContainer.getChildAt(_local2);
particleContainer.getChildAt(_local2).y = (_local5.y + (3 * 0.5));
if (_local5.y >= 400){
};
_local2++;
};
}
function frame192(){
SoundMixer.stopAll();
}
function frame145(){
stop();
}
function frame101(){
t.start();
stop();
}
function frame271(){
Mouse.show();
removeALL();
again.addEventListener(MouseEvent.CLICK, restart);
kongregate.scores.submit(score);
stop();
}
}
}//package main_fla
Section 14
//Title_1 (main_fla.Title_1)
package main_fla {
import flash.display.*;
public dynamic class Title_1 extends MovieClip {
public var st:SimpleButton;
}
}//package main_fla
Section 15
//Boss (Boss)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class Boss extends Enemy {
var tetha:Number;// = 0.785398163397448
var a:Boolean;// = true
var v:int;// = 400
public function Boss(){
tetha = (Math.PI / 4);
v = 400;
a = true;
addFrameScript(0, frame1);
super();
cannon = new Point(0, 15);
score = 199283;
timer.delay = (Math.random() * 4000);
HP = 500;
}
override function updateCannon(){
if (timer.currentCount > 0){
timer.delay = 10;
};
if (v < 400){
a = true;
};
if (v > 1200){
a = false;
};
if (a){
v++;
} else {
v--;
};
cannon.x = (Math.cos(tetha) * (v / 150));
cannon.y = (Math.sin(tetha) * (v / 150));
if (HP == 100){
tetha = (Math.PI / 2);
};
if (HP > 300){
tetha = (tetha + ((Math.PI / 2) + 0.03));
timer.delay = 10;
} else {
if (HP > 100){
timer.delay = 1;
tetha = (tetha + 1);
} else {
if (HP > 0){
tetha = (tetha + 0.04);
};
};
};
}
function frame1(){
stop();
}
override function enemyMove(_arg1:Event):void{
if (y < 150){
x = (x + speed.x);
y = (y + speed.y);
};
}
override public function createExplosion(){
var _local1:Explosion;
_local1 = new Explosion(x, y);
MovieClip(root).explosions.addChild(_local1);
MovieClip(root).gotoAndPlay("win");
}
}
}//package
Section 16
//Cling (Cling)
package {
import flash.media.*;
public dynamic class Cling extends Sound {
}
}//package
Section 17
//Enemy (Enemy)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
public class Enemy extends MovieClip {
var HP:int;// = 5
var timer:Timer;
var speed:Point;
var score:int;// = 78
var hit:int;// = 78
var cannon:Point;
public function Enemy():void{
speed = new Point(0, 3);
HP = 5;
timer = new Timer(300);
cannon = new Point(0, 15);
score = 78;
hit = 78;
super();
addEventListener(Event.ENTER_FRAME, enemyMove);
addEventListener(Event.ENTER_FRAME, hitTest);
timer.start();
timer.addEventListener(TimerEvent.TIMER, fire);
}
public function destroy(){
createExplosion2();
removeListeners();
parent.removeChild(this);
}
public function removeListeners(){
removeEventListener(Event.ENTER_FRAME, hitTest);
removeEventListener(Event.ENTER_FRAME, enemyMove);
timer.removeEventListener(TimerEvent.TIMER, fire);
}
function updateCannon(){
}
function fire(_arg1:TimerEvent):void{
var _local2:Tiro;
updateCannon();
_local2 = new TiroRed(new Point(cannon.x, cannon.y), x, y);
MovieClip(root).enemyTiros.addChild(_local2);
}
function enemyMove(_arg1:Event):void{
x = (x + speed.x);
y = (y + speed.y);
}
public function createExplosion(){
var _local1:Explosion;
var _local2:Money;
_local1 = new Explosion(x, y);
MovieClip(root).explosions.addChild(_local1);
_local2 = new Money(x, y);
MovieClip(root).explosions.addChild(_local2);
}
function hitTest(_arg1:Event):void{
var _local2:int;
var _local3:MovieClip;
var _local4:enemyHit;
var _local5:SoundTransform;
var _local6:SoundChannel;
_local2 = 0;
while (_local2 < MovieClip(root).myTiros.numChildren) {
_local3 = MovieClip(root).myTiros.getChildAt(_local2);
if (hitTestObject(_local3)){
_local3.removeListeners();
MovieClip(root).myTiros.removeChild(_local3);
MovieClip(root).score = (MovieClip(root).score + this.hit);
MovieClip(root).s.text = MovieClip(root).score;
HP--;
if (HP <= 0){
createExplosion();
removeListeners();
MovieClip(root).score = (MovieClip(root).score + this.score);
MovieClip(root).s.text = MovieClip(root).score;
parent.removeChild(this);
return;
};
gotoAndPlay("damage");
_local4 = new enemyHit();
_local5 = new SoundTransform(0.3);
_local6 = _local4.play();
_local6.soundTransform = _local5;
};
_local2++;
};
}
public function createExplosion2(){
var _local1:Explosion;
var _local2:Money;
_local1 = new Explosion(x, y);
MovieClip(root).explosions.addChild(_local1);
_local2 = new Money(x, y);
MovieClip(root).explosions.addChild(_local2);
}
}
}//package
Section 18
//enemyHit (enemyHit)
package {
import flash.media.*;
public dynamic class enemyHit extends Sound {
}
}//package
Section 19
//EnemyLinear (EnemyLinear)
package {
import flash.events.*;
import flash.geom.*;
public class EnemyLinear extends Enemy {
public function EnemyLinear(){
addFrameScript(0, frame1);
super();
HP = 2;
score = 254;
cannon = new Point(0, 7);
timer.delay = 1000;
}
override function updateCannon(){
if (timer.currentCount > 0){
timer.delay = 1000;
};
if (timer.currentCount > 3){
timer.removeEventListener(TimerEvent.TIMER, fire);
};
}
function frame1(){
stop();
}
}
}//package
Section 20
//EnemyX (EnemyX)
package {
import flash.events.*;
import flash.geom.*;
public class EnemyX extends Enemy {
var tetha:Number;// = 0.785398163397448
public function EnemyX(){
tetha = (Math.PI / 4);
addFrameScript(0, frame1);
super();
cannon = new Point(0, 0);
timer.delay = (Math.random() * 4000);
HP = 4;
}
override function updateCannon(){
if (timer.currentCount > 0){
timer.delay = 10;
};
cannon.x = (Math.cos(tetha) * 10);
cannon.y = (Math.sin(tetha) * 10);
tetha = (tetha + (Math.PI / 2));
if (tetha > ((Math.random() * 100) + 150)){
timer.removeEventListener(TimerEvent.TIMER, fire);
};
}
function frame1(){
stop();
}
}
}//package
Section 21
//Explosion (Explosion)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.filters.*;
import flash.utils.*;
public class Explosion extends MovieClip {
var speed:Point;
public var a:ColorMatrixFilter;
var t:Timer;
public function Explosion(_arg1:int, _arg2:int){
var _local3:explosionmp3;
var _local4:SoundTransform;
var _local5:SoundChannel;
speed = new Point(0, 3);
t = new Timer(30);
super();
addFrameScript(0, frame1, 24, frame25);
_local3 = new explosionmp3();
_local4 = new SoundTransform(0.5);
_local5 = _local3.play();
if (_local5 != null){
_local5.soundTransform = _local4;
};
this.x = _arg1;
this.y = _arg2;
shakeScreen();
addEventListener(Event.ENTER_FRAME, move);
}
function shakeScreen(){
t.reset();
t.start();
t.addEventListener(TimerEvent.TIMER, startShake);
}
function removeListeners(){
removeEventListener(Event.ENTER_FRAME, move);
}
function frame1(){
this.rotation = (Math.random() * 10);
a = new ColorMatrixFilter([231, 42, 51]);
}
function frame25(){
stop();
}
function move(_arg1:Event){
x = (x + speed.x);
y = (y + speed.y);
if ((((((((x > (stage.stageWidth + 100))) || ((x < -100)))) || ((y > (stage.stageHeight + 100))))) || ((y < -100)))){
removeListeners();
parent.removeChild(this);
};
}
function startShake(_arg1:TimerEvent){
switch (t.currentCount){
case 1:
MovieClip(root).x = (MovieClip(root).x + 3);
break;
case 2:
MovieClip(root).x = (MovieClip(root).x - 6);
break;
case 3:
MovieClip(root).y = (MovieClip(root).y + 3);
break;
case 4:
MovieClip(root).y = (MovieClip(root).y - 6);
break;
case 5:
MovieClip(root).x = (MovieClip(root).x + 3);
MovieClip(root).y = (MovieClip(root).y + 3);
t.removeEventListener(TimerEvent.TIMER, startShake);
break;
};
}
}
}//package
Section 22
//explosionmp3 (explosionmp3)
package {
import flash.media.*;
public dynamic class explosionmp3 extends Sound {
}
}//package
Section 23
//MochiAd (MochiAd)
package {
import flash.events.*;
import flash.display.*;
import flash.system.*;
import flash.utils.*;
import flash.net.*;
public class MochiAd {
public static function getVersion():String{
return ("2.7");
}
public static function showClickAwayAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_timeout:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var sendHostProgress:Boolean;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, regpt:"o", method:"showClickAwayAd", res:"300x250", no_bg:true, ad_started:function ():void{
}, ad_finished:function ():void{
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
sendHostProgress = false;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
_local3 = true;
chk.started = getTimer();
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (this.root == null){
_local3 = true;
};
if (_local3){
delete this.onEnterFrame;
};
};
doOnEnterFrame(chk);
}
public static function _isNetworkAvailable():Boolean{
return (!((Security.sandboxType == "localWithFile")));
}
public static function _allowDomains(_arg1:String):String{
var _local2:String;
_local2 = _arg1.split("/")[2].split(":")[0];
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:2000, fadeout_time:250, regpt:"o", method:"showTimedAd", ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showInterLevelAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
MochiAd._cleanup(mc);
options.ad_finished();
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
mc.unloadAd = function ():void{
MochiAd.unload(clip);
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = (_arg1 - 250);
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Number;
var _local3:Boolean;
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
_local1 = this.parent._mochiad_ctr;
_local2 = (getTimer() - this.started);
_local3 = false;
if (!chk.showing){
_local4 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local4 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if (_local2 > chk.ad_timeout){
options.ad_failed();
_local3 = true;
};
};
};
if (_local2 > chk.ad_msec){
_local3 = true;
};
if (_local3){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = this.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function _parseOptions(_arg1:Object, _arg2:Object):Object{
var _local3:Object;
var _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
_local3 = {};
for (_local4 in _arg2) {
_local3[_local4] = _arg2[_local4];
};
if (_arg1){
for (_local4 in _arg1) {
_local3[_local4] = _arg1[_local4];
};
};
if (_local3.clip == undefined){
throw (new Error("MochiAd is missing the 'clip' parameter. This should be a MovieClip, Sprite or an instance of a class that extends MovieClip or Sprite."));
};
_arg1 = _local3.clip.loaderInfo.parameters.mochiad_options;
if (_arg1){
_local5 = _arg1.split("&");
_local6 = 0;
while (_local6 < _local5.length) {
_local7 = _local5[_local6].split("=");
_local3[unescape(_local7[0])] = unescape(_local7[1]);
_local6++;
};
};
if (_local3.id == "test"){
trace("[MochiAd] WARNING: Using the MochiAds test identifier, make sure to use the code from your dashboard, not this example!");
};
return (_local3);
}
public static function _cleanup(_arg1:Object):void{
var idx:Number;
var k:String;
var lc:LocalConnection;
var f:Function;
var mc = _arg1;
if (("lc" in mc)){
lc = mc.lc;
f = function ():void{
try {
lc.client = null;
lc.close();
} catch(e:Error) {
};
};
setTimeout(f, 0);
};
idx = DisplayObjectContainer(mc).numChildren;
while (idx > 0) {
idx = (idx - 1);
DisplayObjectContainer(mc).removeChildAt(idx);
};
for (k in mc) {
delete mc[k];
};
}
public static function load(_arg1:Object):MovieClip{
var DEFAULTS:Object;
var clip:Object;
var depth:Number;
var mc:MovieClip;
var wh:Array;
var lv:URLVariables;
var k:String;
var server:String;
var hostname:String;
var lc:LocalConnection;
var name:String;
var loader:Loader;
var g:Function;
var req:URLRequest;
var v:Object;
var options = _arg1;
DEFAULTS = {server:"http://x.mochiads.com/srv/1/", method:"load", depth:10333, id:"_UNKNOWN_"};
options = MochiAd._parseOptions(options, DEFAULTS);
options.swfv = 9;
options.mav = MochiAd.getVersion();
clip = options.clip;
if (!MochiAd._isNetworkAvailable()){
return (null);
};
try {
if (clip._mochiad_loaded){
return (null);
};
} catch(e:Error) {
throw (new Error("MochiAd requires a clip that is an instance of a dynamic class. If your class extends Sprite or MovieClip, you must make it dynamic."));
};
depth = options.depth;
delete options.depth;
mc = createEmptyMovieClip(clip, "_mochiad", depth);
wh = MochiAd._getRes(options, clip);
options.res = ((wh[0] + "x") + wh[1]);
options.server = (options.server + options.id);
delete options.id;
clip._mochiad_loaded = true;
if (clip.loaderInfo.loaderURL.indexOf("http") == 0){
options.as3_swf = clip.loaderInfo.loaderURL;
};
lv = new URLVariables();
for (k in options) {
v = options[k];
if (!(v is Function)){
lv[k] = v;
};
};
server = lv.server;
delete lv.server;
hostname = _allowDomains(server);
lc = new LocalConnection();
lc.client = mc;
name = ["", Math.floor(new Date().getTime()), Math.floor((Math.random() * 999999))].join("_");
lc.allowDomain("*", "localhost");
lc.allowInsecureDomain("*", "localhost");
lc.connect(name);
mc.lc = lc;
mc.lcName = name;
lv.lc = name;
lv.st = getTimer();
loader = new Loader();
g = function (_arg1:Object):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
MochiAd.unload(clip);
};
loader.contentLoaderInfo.addEventListener(Event.UNLOAD, g);
req = new URLRequest(((server + ".swf?cacheBust=") + new Date().getTime()));
req.contentType = "application/x-www-form-urlencoded";
req.method = URLRequestMethod.POST;
req.data = lv;
loader.load(req);
mc.addChild(loader);
mc._mochiad_ctr = loader;
return (mc);
}
public static function runMethod(_arg1:Object, _arg2:String, _arg3:Array):Object{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
if (typeof(_arg1[_local4[_local5]]) == "function"){
return (_arg1[_local4[_local5]].apply(_arg1, _arg3));
};
return (undefined);
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number):MovieClip{
var _local4:MovieClip;
_local4 = new MovieClip();
if (((false) && (_arg3))){
_arg1.addChildAt(_local4, _arg3);
} else {
_arg1.addChild(_local4);
};
_arg1[_arg2] = _local4;
_local4["_name"] = _arg2;
return (_local4);
}
public static function _getRes(_arg1:Object, _arg2:Object):Array{
var _local3:Object;
var _local4:Number;
var _local5:Number;
var _local6:Array;
_local3 = _arg2.getBounds(_arg2.root);
_local4 = 0;
_local5 = 0;
if (typeof(_arg1.res) != "undefined"){
_local6 = _arg1.res.split("x");
_local4 = parseFloat(_local6[0]);
_local5 = parseFloat(_local6[1]);
} else {
_local4 = (_local3.xMax - _local3.xMin);
_local5 = (_local3.yMax - _local3.yMin);
};
if ((((_local4 == 0)) || ((_local5 == 0)))){
_local4 = _arg2.stage.stageWidth;
_local5 = _arg2.stage.stageHeight;
};
return ([_local4, _local5]);
}
public static function adShowing(_arg1:Object):void{
_arg1.origFrameRate = _arg1.stage.frameRate;
_arg1.stage.frameRate = 30;
}
public static function getValue(_arg1:Object, _arg2:String):Object{
var _local3:Array;
var _local4:Number;
_local3 = _arg2.split(".");
_local4 = 0;
while (_local4 < (_local3.length - 1)) {
if ((((_arg1[_local3[_local4]] == undefined)) || ((_arg1[_local3[_local4]] == null)))){
return (undefined);
};
_arg1 = _arg1[_local3[_local4]];
_local4++;
};
return (_arg1[_local3[_local4]]);
}
public static function rpc(_arg1:Object, _arg2:Number, _arg3:Object):void{
var _local4:Object;
var _local5:Object;
switch (_arg3.id){
case "setValue":
MochiAd.setValue(_arg1, _arg3.objectName, _arg3.value);
break;
case "getValue":
_local4 = MochiAd.getValue(_arg1, _arg3.objectName);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local4);
break;
case "runMethod":
_local5 = MochiAd.runMethod(_arg1, _arg3.method, _arg3.args);
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "rpcResult", _arg2, _local5);
break;
default:
trace(("[mochiads rpc] unknown rpc id: " + _arg3.id));
};
}
public static function setValue(_arg1:Object, _arg2:String, _arg3:Object):void{
var _local4:Array;
var _local5:Number;
_local4 = _arg2.split(".");
_local5 = 0;
while (_local5 < (_local4.length - 1)) {
if ((((_arg1[_local4[_local5]] == undefined)) || ((_arg1[_local4[_local5]] == null)))){
return;
};
_arg1 = _arg1[_local4[_local5]];
_local5++;
};
_arg1[_local4[_local5]] = _arg3;
}
public static function showPreGameAd(_arg1:Object):void{
var DEFAULTS:Object;
var clip:Object;
var ad_msec:Number;
var ad_timeout:Number;
var fadeout_time:Number;
var mc:MovieClip;
var wh:Array;
var w:Number;
var h:Number;
var chk:MovieClip;
var bar:MovieClip;
var bar_color:Number;
var bar_background:Number;
var bar_outline:Number;
var backing_mc:MovieClip;
var backing:Object;
var inside_mc:MovieClip;
var inside:Object;
var outline_mc:MovieClip;
var outline:Object;
var complete:Boolean;
var unloaded:Boolean;
var f:Function;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
DEFAULTS = {ad_timeout:3000, fadeout_time:250, regpt:"o", method:"showPreloaderAd", color:0xFF8A00, background:16777161, outline:13994812, no_progress_bar:false, ad_started:function ():void{
if ((this.clip is MovieClip)){
this.clip.stop();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_finished:function ():void{
if ((this.clip is MovieClip)){
this.clip.play();
} else {
throw (new Error("MochiAd.showPreGameAd requires a clip that is a MovieClip or is an instance of a class that extends MovieClip. If your clip is a Sprite, then you must provide custom ad_started and ad_finished handlers."));
};
}, ad_loaded:function (_arg1:Number, _arg2:Number):void{
}, ad_failed:function ():void{
trace("[MochiAd] Couldn't load an ad, make sure your game's local security sandbox is configured for Access Network Only and that you are not using ad blocking software");
}, ad_skipped:function ():void{
}, ad_progress:function (_arg1:Number):void{
}};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
ad_msec = 11000;
ad_timeout = options.ad_timeout;
delete options.ad_timeout;
fadeout_time = options.fadeout_time;
delete options.fadeout_time;
if (!MochiAd.load(options)){
options.ad_failed();
options.ad_finished();
return;
};
options.ad_started();
mc = clip._mochiad;
mc["onUnload"] = function ():void{
var fn:Function;
MochiAd._cleanup(mc);
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
wh = MochiAd._getRes(options, clip);
w = wh[0];
h = wh[1];
mc.x = (w * 0.5);
mc.y = (h * 0.5);
chk = createEmptyMovieClip(mc, "_mochiad_wait", 3);
chk.x = (w * -0.5);
chk.y = (h * -0.5);
bar = createEmptyMovieClip(chk, "_mochiad_bar", 4);
if (options.no_progress_bar){
bar.visible = false;
delete options.no_progress_bar;
} else {
bar.x = 10;
bar.y = (h - 20);
};
bar_color = options.color;
delete options.color;
bar_background = options.background;
delete options.background;
bar_outline = options.outline;
delete options.outline;
backing_mc = createEmptyMovieClip(bar, "_outline", 1);
backing = backing_mc.graphics;
backing.beginFill(bar_background);
backing.moveTo(0, 0);
backing.lineTo((w - 20), 0);
backing.lineTo((w - 20), 10);
backing.lineTo(0, 10);
backing.lineTo(0, 0);
backing.endFill();
inside_mc = createEmptyMovieClip(bar, "_inside", 2);
inside = inside_mc.graphics;
inside.beginFill(bar_color);
inside.moveTo(0, 0);
inside.lineTo((w - 20), 0);
inside.lineTo((w - 20), 10);
inside.lineTo(0, 10);
inside.lineTo(0, 0);
inside.endFill();
inside_mc.scaleX = 0;
outline_mc = createEmptyMovieClip(bar, "_outline", 3);
outline = outline_mc.graphics;
outline.lineStyle(0, bar_outline, 100);
outline.moveTo(0, 0);
outline.lineTo((w - 20), 0);
outline.lineTo((w - 20), 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_local1 = (100 * (1 - ((getTimer() - this.fadeout_start) / this.fadeout_time)));
if (_local1 > 0){
this.parent.alpha = (_local1 * 0.01);
} else {
MochiAd.unload(clip);
delete this["onEnterFrame"];
};
};
complete = false;
unloaded = false;
f = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_local2 = mc._mochiad_wait;
_local2.server_control = true;
_local2.showing = true;
_local2.started = getTimer();
_local2.ad_msec = _arg1;
};
mc.rpc = function (_arg1:Number, _arg2:Object):void{
MochiAd.rpc(clip, _arg1, _arg2);
};
mc.rpcTestFn = function (_arg1:String):Object{
trace(("[MOCHIAD rpcTestFn] " + _arg1));
return (_arg1);
};
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
sendHostProgress = false;
mc.sendHostLoadProgress = function (_arg1:String):void{
sendHostProgress = true;
};
chk["onEnterFrame"] = function ():void{
var _local1:Object;
var _local2:Object;
var _local3:Number;
var _local4:Boolean;
var _local5:Number;
var _local6:Number;
var _local7:Number;
var _local8:Number;
var _local9:Object;
var _local10:Number;
var _local11:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
_local1 = this.parent.parent.root;
_local2 = this.parent._mochiad_ctr;
_local3 = (getTimer() - this.started);
_local4 = false;
_local5 = _local1.loaderInfo.bytesTotal;
_local6 = _local1.loaderInfo.bytesLoaded;
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
_local7 = ((100 * _local6) / _local5);
_local8 = ((100 * _local3) / chk.ad_msec);
_local9 = this._mochiad_bar._inside;
_local10 = Math.min(100, Math.min(((_local7) || (0)), _local8));
_local10 = Math.max(this.last_pcnt, _local10);
this.last_pcnt = _local10;
_local9.scaleX = (_local10 * 0.01);
options.ad_progress(_local10);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local7});
if (_local7 == 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local11 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local11 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local7 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (this.server_control){
delete this.onEnterFrame;
} else {
this.fadeout_start = getTimer();
this.onEnterFrame = chk.fadeFunction;
};
};
};
doOnEnterFrame(chk);
}
public static function showPreloaderAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showPreloaderAd was renamed to showPreGameAd in 2.0");
MochiAd.showPreGameAd(_arg1);
}
public static function showTimedAd(_arg1:Object):void{
trace("[MochiAd] DEPRECATED: showTimedAd was renamed to showInterLevelAd in 2.0");
MochiAd.showInterLevelAd(_arg1);
}
public static function doOnEnterFrame(_arg1:MovieClip):void{
var f:Function;
var mc = _arg1;
f = function (_arg1:Object):void{
if (((("onEnterFrame" in mc)) && (mc.onEnterFrame))){
mc.onEnterFrame();
} else {
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
};
};
mc.addEventListener(Event.ENTER_FRAME, f);
}
}
}//package
Section 24
//Money (Money)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
public class Money extends MovieClip {
var timer:Timer;
var speed:Point;
var t:Timer;
public function Money(_arg1:int, _arg2:int){
var _local3:Number;
timer = new Timer(150);
t = new Timer(100);
speed = new Point(0, 2);
super();
this.x = _arg1;
this.y = _arg2;
addEventListener(Event.ENTER_FRAME, moneyMove);
addEventListener(Event.ENTER_FRAME, hitTest);
_local3 = (Math.random() * 2);
if (_local3 > 1){
_local3 = -1;
} else {
_local3 = 1;
};
speed.x = (speed.x + (_local3 * Math.random()));
}
function removeListeners(){
removeEventListener(Event.ENTER_FRAME, hitTest);
removeEventListener(Event.ENTER_FRAME, moneyMove);
}
function moneyMove(_arg1:Event):void{
x = (x + speed.x);
y = (y + speed.y);
if ((((((((x > (stage.stageWidth + 100))) || ((x < -100)))) || ((y > (stage.stageHeight + 100))))) || ((y < -100)))){
removeListeners();
parent.removeChild(this);
};
}
public function hitTest(_arg1:Event):void{
var _local2:MovieClip;
var _local3:Cling;
var _local4:SoundTransform;
var _local5:SoundChannel;
_local2 = MovieClip(root).player;
if (hitTestObject(_local2)){
_local3 = new Cling();
_local4 = new SoundTransform(2);
_local5 = _local3.play();
_local5.soundTransform = _local4;
removeListeners();
MovieClip(root).money = (MovieClip(root).money + (25 + (Math.random() * 100)));
MovieClip(root).m.text = MovieClip(root).money;
parent.removeChild(this);
};
}
}
}//package
Section 25
//Player (Player)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
public class Player extends MovieClip {
var HP:int;// = 10
var lives:int;// = 3
var shields:int;// = 3
var myShield:Boolean;// = false
var timer:Timer;
var speed:Number;// = 0.2
var shieldTimer:Timer;
var t:Timer;
var tripleTimer:Timer;
public var fireType:int;// = 1
var indestrutivel:Boolean;// = false
public function Player(){
speed = (1 / 5);
timer = new Timer(150);
t = new Timer(100);
fireType = 1;
indestrutivel = false;
myShield = false;
shields = 3;
shieldTimer = new Timer(10000);
tripleTimer = new Timer(10000);
HP = 10;
lives = 3;
super();
addFrameScript(0, frame1, 44, frame45);
addEventListener(Event.ENTER_FRAME, playerMove);
addEventListener(Event.ENTER_FRAME, hitTest);
timer.addEventListener(TimerEvent.TIMER, fire);
timer.start();
startFlick();
}
public function flick(_arg1:TimerEvent){
if (visible){
visible = false;
} else {
visible = true;
};
if (t.currentCount > 12){
visible = true;
indestrutivel = false;
removeEventListener(TimerEvent.TIMER, flick);
};
}
function shieldTiming(_arg1:TimerEvent){
shieldTimer.removeEventListener(TimerEvent.TIMER, shieldTiming);
myShield = false;
gotoAndStop("wait");
}
public function removeListeners(){
MovieClip(root).t.removeEventListener(TimerEvent.TIMER, MovieClip(root).createMonster);
removeEventListener(Event.ENTER_FRAME, hitTest);
removeEventListener(TimerEvent.TIMER, flick);
removeEventListener(Event.ENTER_FRAME, playerMove);
timer.removeEventListener(TimerEvent.TIMER, fire);
}
function fire(_arg1:TimerEvent):void{
var _local2:Tiro;
var _local3:shot;
var _local4:SoundTransform;
var _local5:SoundChannel;
_local3 = new shot();
_local4 = new SoundTransform(0.05);
_local5 = _local3.play();
_local5.soundTransform = _local4;
if (fireType == 4){
_local2 = new Tiro(new Point(-4, -10), x, y);
MovieClip(root).myTiros.addChild(_local2);
_local2 = new Tiro(new Point(4, -10), x, y);
MovieClip(root).myTiros.addChild(_local2);
_local2 = new Tiro(new Point(0, -15), x, y);
MovieClip(root).myTiros.addChild(_local2);
} else {
_local2 = new Tiro(new Point(0, -15), x, y);
MovieClip(root).myTiros.addChild(_local2);
};
}
function tripleTiming(_arg1:TimerEvent){
tripleTimer.removeEventListener(TimerEvent.TIMER, tripleTiming);
fireType = 1;
}
function frame1(){
stop();
}
public function shieldOn(){
myShield = true;
MovieClip(root).money = (MovieClip(root).money - 500);
MovieClip(root).m.text = MovieClip(root).money;
gotoAndPlay("shield");
shieldTimer.reset();
shieldTimer.start();
shieldTimer.addEventListener(TimerEvent.TIMER, shieldTiming);
}
function playerMove(_arg1:Event):void{
var _local2:Point;
_local2 = new Point();
_local2.x = (parent.mouseX - x);
_local2.y = (parent.mouseY - y);
x = (x + (_local2.x * speed));
y = (y + (_local2.y * speed));
}
function frame45(){
gotoAndPlay("shield");
}
public function tripleFire(){
MovieClip(root).money = (MovieClip(root).money - 500);
MovieClip(root).m.text = MovieClip(root).money;
fireType = 4;
tripleTimer.reset();
tripleTimer.start();
tripleTimer.addEventListener(TimerEvent.TIMER, tripleTiming);
}
public function hitTest(_arg1:Event):void{
var _local2:int;
var _local3:MovieClip;
var _local4:Explosion;
var _local5:playerHit;
var _local6:SoundTransform;
var _local7:SoundChannel;
_local5 = new playerHit();
_local6 = new SoundTransform(0.7);
_local2 = 0;
while (_local2 < MovieClip(root).enemyTiros.numChildren) {
_local3 = MovieClip(root).enemyTiros.getChildAt(_local2);
if (hitTestObject(_local3)){
_local3.removeListeners();
MovieClip(root).enemyTiros.removeChild(_local3);
if (((!(indestrutivel)) && (!(myShield)))){
indestrutivel = true;
startFlick();
HP--;
MovieClip(root).a.text = ("HP: " + HP);
_local7 = _local5.play();
_local7.soundTransform = _local6;
};
if (HP == 0){
lives--;
removeListeners();
MovieClip(root).gotoAndPlay("gameover");
_local4 = new Explosion(x, y);
MovieClip(root).explosions.addChild(_local4);
parent.removeChild(this);
return;
};
};
_local2++;
};
_local2 = 0;
while (_local2 < MovieClip(root).allEnemy.numChildren) {
_local3 = MovieClip(root).allEnemy.getChildAt(_local2);
if (hitTestObject(_local3)){
if (((!(indestrutivel)) && (!(myShield)))){
indestrutivel = true;
startFlick();
HP--;
MovieClip(root).a.text = ("HP: " + HP);
_local7 = _local5.play();
_local7.soundTransform = _local6;
};
if (HP == 0){
lives--;
removeListeners();
MovieClip(root).gotoAndPlay("gameover");
_local4 = new Explosion(x, y);
MovieClip(root).explosions.addChild(_local4);
parent.removeChild(this);
return;
};
};
_local2++;
};
}
public function startFlick(){
t.reset();
t.start();
t.addEventListener(TimerEvent.TIMER, flick);
}
}
}//package
Section 26
//playerHit (playerHit)
package {
import flash.media.*;
public dynamic class playerHit extends Sound {
}
}//package
Section 27
//shot (shot)
package {
import flash.media.*;
public dynamic class shot extends Sound {
}
}//package
Section 28
//testEnemy (testEnemy)
package {
import flash.events.*;
import flash.geom.*;
public class testEnemy extends Enemy {
var tetha:Number;// = 0
public function testEnemy(){
tetha = 0;
addFrameScript(0, frame1, 34, frame35);
super();
cannon = new Point(0, 15);
score = 452;
timer.delay = (Math.random() * 4000);
}
override function updateCannon(){
if (timer.currentCount > 0){
timer.delay = 10;
};
cannon.x = (Math.cos(tetha) * 2.5);
cannon.y = (Math.sin(tetha) * 2.5);
tetha = (tetha + 1);
if (tetha > 70){
timer.removeEventListener(TimerEvent.TIMER, fire);
};
}
function frame1(){
stop();
}
function frame35(){
gotoAndStop(1);
}
}
}//package
Section 29
//Tiro (Tiro)
package {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
public class Tiro extends MovieClip {
var speed:Point;
public function Tiro(_arg1:Point, _arg2:int, _arg3:int){
this.x = _arg2;
this.y = _arg3;
this.speed = _arg1;
addEventListener(Event.ENTER_FRAME, move);
}
public function removeListeners():void{
removeEventListener(Event.ENTER_FRAME, move);
}
public function move(_arg1:Event):void{
this.y = (this.y + speed.y);
this.x = (this.x + speed.x);
if ((((((((x > (stage.stageWidth + 10))) || ((x < -10)))) || ((y > (stage.stageHeight + 10))))) || ((y < -10)))){
removeListeners();
parent.removeChild(this);
};
}
}
}//package
Section 30
//TiroRed (TiroRed)
package {
import flash.geom.*;
public class TiroRed extends Tiro {
public function TiroRed(_arg1:Point, _arg2:int, _arg3:int){
super(_arg1, _arg2, _arg3);
}
}
}//package