Section 1
//None (fl.transitions.easing.None)
package fl.transitions.easing {
public class None {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
public static function easeNone(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
}
}
}//package fl.transitions.easing
Section 2
//AutoAlphaPlugin (gs.plugins.AutoAlphaPlugin)
package gs.plugins {
import gs.*;
import flash.display.*;
public class AutoAlphaPlugin extends TweenPlugin {
protected var _tweenVisible:Boolean;
protected var _tween:TweenLite;
protected var _visible:Boolean;
protected var _target:Object;
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function AutoAlphaPlugin(){
this.propName = "autoAlpha";
this.overwriteProps = ["alpha", "visible"];
this.onComplete = onCompleteTween;
}
override public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
if (((!((_target.visible == true))) && (_tweenVisible))){
_target.visible = true;
};
}
public function onCompleteTween():void{
if (((((_tweenVisible) && (!((_tween.vars.runBackwards == true))))) && ((_tween.ease == _tween.vars.ease)))){
_target.visible = _visible;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_tween = _arg3;
_visible = Boolean(!((_arg2 == 0)));
_tweenVisible = true;
addTween(_arg1, "alpha", _arg1.alpha, _arg2, "alpha");
return (true);
}
override public function killProps(_arg1:Object):void{
super.killProps(_arg1);
_tweenVisible = !(Boolean(("visible" in _arg1)));
}
}
}//package gs.plugins
Section 3
//EndArrayPlugin (gs.plugins.EndArrayPlugin)
package gs.plugins {
import gs.*;
import gs.utils.tween.*;
public class EndArrayPlugin extends TweenPlugin {
protected var _info:Array;
protected var _a:Array;
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function EndArrayPlugin(){
_info = [];
super();
this.propName = "endArray";
this.overwriteProps = ["endArray"];
}
override public function set changeFactor(_arg1:Number):void{
var _local2:int;
var _local3:ArrayTweenInfo;
var _local4:Number;
var _local5:int;
if (this.round){
_local2 = (_info.length - 1);
while (_local2 > -1) {
_local3 = _info[_local2];
_local4 = (_local3.start + (_local3.change * _arg1));
_local5 = ((_local4)<0) ? -1 : 1;
_a[_local3.index] = ((((_local4 % 1) * _local5))>0.5) ? (int(_local4) + _local5) : int(_local4);
_local2--;
};
} else {
_local2 = (_info.length - 1);
while (_local2 > -1) {
_local3 = _info[_local2];
_a[_local3.index] = (_local3.start + (_local3.change * _arg1));
_local2--;
};
};
}
public function init(_arg1:Array, _arg2:Array):void{
var _local3:int;
_a = _arg1;
_local3 = (_arg2.length - 1);
while (_local3 > -1) {
if (((!((_arg1[_local3] == _arg2[_local3]))) && (!((_arg1[_local3] == null))))){
_info[_info.length] = new ArrayTweenInfo(_local3, _a[_local3], (_arg2[_local3] - _a[_local3]));
};
_local3--;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (((!((_arg1 is Array))) || (!((_arg2 is Array))))){
return (false);
};
init((_arg1 as Array), _arg2);
return (true);
}
}
}//package gs.plugins
Section 4
//FramePlugin (gs.plugins.FramePlugin)
package gs.plugins {
import gs.*;
import flash.display.*;
public class FramePlugin extends TweenPlugin {
public var frame:int;
protected var _target:MovieClip;
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function FramePlugin(){
this.propName = "frame";
this.overwriteProps = ["frame"];
this.round = true;
}
override public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
_target.gotoAndStop(this.frame);
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (((!((_arg1 is MovieClip))) || (isNaN(_arg2)))){
return (false);
};
_target = (_arg1 as MovieClip);
this.frame = _target.currentFrame;
addTween(this, "frame", this.frame, _arg2, "frame");
return (true);
}
}
}//package gs.plugins
Section 5
//RemoveTintPlugin (gs.plugins.RemoveTintPlugin)
package gs.plugins {
public class RemoveTintPlugin extends TintPlugin {
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function RemoveTintPlugin(){
this.propName = "removeTint";
}
}
}//package gs.plugins
Section 6
//TintPlugin (gs.plugins.TintPlugin)
package gs.plugins {
import gs.*;
import flash.display.*;
import flash.geom.*;
import gs.utils.tween.*;
public class TintPlugin extends TweenPlugin {
protected var _ct:ColorTransform;
protected var _ignoreAlpha:Boolean;
protected var _target:DisplayObject;
public static const VERSION:Number = 1.1;
public static const API:Number = 1;
protected static var _props:Array = ["redMultiplier", "greenMultiplier", "blueMultiplier", "alphaMultiplier", "redOffset", "greenOffset", "blueOffset", "alphaOffset"];
public function TintPlugin(){
this.propName = "tint";
this.overwriteProps = ["tint"];
}
override public function set changeFactor(_arg1:Number):void{
var _local2:ColorTransform;
updateTweens(_arg1);
if (_ignoreAlpha){
_local2 = _target.transform.colorTransform;
_ct.alphaMultiplier = _local2.alphaMultiplier;
_ct.alphaOffset = _local2.alphaOffset;
};
_target.transform.colorTransform = _ct;
}
public function init(_arg1:DisplayObject, _arg2:ColorTransform):void{
var _local3:int;
var _local4:String;
_target = _arg1;
_ct = _target.transform.colorTransform;
_local3 = (_props.length - 1);
while (_local3 > -1) {
_local4 = _props[_local3];
if (_ct[_local4] != _arg2[_local4]){
_tweens[_tweens.length] = new TweenInfo(_ct, _local4, _ct[_local4], (_arg2[_local4] - _ct[_local4]), "tint", false);
};
_local3--;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
var _local4:ColorTransform;
if (!(_arg1 is DisplayObject)){
return (false);
};
_local4 = new ColorTransform();
if (((!((_arg2 == null))) && (!((_arg3.exposedVars.removeTint == true))))){
_local4.color = uint(_arg2);
};
_ignoreAlpha = true;
init((_arg1 as DisplayObject), _local4);
return (true);
}
}
}//package gs.plugins
Section 7
//TweenPlugin (gs.plugins.TweenPlugin)
package gs.plugins {
import gs.*;
import gs.utils.tween.*;
public class TweenPlugin {
public var overwriteProps:Array;
protected var _tweens:Array;
public var round:Boolean;
public var onComplete:Function;
public var propName:String;
protected var _changeFactor:Number;// = 0
public static const VERSION:Number = 1.03;
public static const API:Number = 1;
public function TweenPlugin(){
_tweens = [];
_changeFactor = 0;
super();
}
protected function updateTweens(_arg1:Number):void{
var _local2:int;
var _local3:TweenInfo;
var _local4:Number;
var _local5:int;
if (this.round){
_local2 = (_tweens.length - 1);
while (_local2 > -1) {
_local3 = _tweens[_local2];
_local4 = (_local3.start + (_local3.change * _arg1));
_local5 = ((_local4)<0) ? -1 : 1;
_local3.target[_local3.property] = ((((_local4 % 1) * _local5))>0.5) ? (int(_local4) + _local5) : int(_local4);
_local2--;
};
} else {
_local2 = (_tweens.length - 1);
while (_local2 > -1) {
_local3 = _tweens[_local2];
_local3.target[_local3.property] = (_local3.start + (_local3.change * _arg1));
_local2--;
};
};
}
public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
_changeFactor = _arg1;
}
protected function addTween(_arg1:Object, _arg2:String, _arg3:Number, _arg4, _arg5:String=null):void{
var _local6:Number;
if (_arg4 != null){
_local6 = ((typeof(_arg4))=="number") ? (_arg4 - _arg3) : Number(_arg4);
if (_local6 != 0){
_tweens[_tweens.length] = new TweenInfo(_arg1, _arg2, _arg3, _local6, ((_arg5) || (_arg2)), false);
};
};
}
public function killProps(_arg1:Object):void{
var _local2:int;
_local2 = (this.overwriteProps.length - 1);
while (_local2 > -1) {
if ((this.overwriteProps[_local2] in _arg1)){
this.overwriteProps.splice(_local2, 1);
};
_local2--;
};
_local2 = (_tweens.length - 1);
while (_local2 > -1) {
if ((_tweens[_local2].name in _arg1)){
_tweens.splice(_local2, 1);
};
_local2--;
};
}
public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
addTween(_arg1, this.propName, _arg1[this.propName], _arg2, this.propName);
return (true);
}
public function get changeFactor():Number{
return (_changeFactor);
}
public static function activate(_arg1:Array):Boolean{
var _local2:int;
var _local3:Object;
_local2 = (_arg1.length - 1);
while (_local2 > -1) {
_local3 = new (_arg1[_local2]);
TweenLite.plugins[_local3.propName] = _arg1[_local2];
_local2--;
};
return (true);
}
}
}//package gs.plugins
Section 8
//VisiblePlugin (gs.plugins.VisiblePlugin)
package gs.plugins {
import gs.*;
import flash.display.*;
public class VisiblePlugin extends TweenPlugin {
protected var _tween:TweenLite;
protected var _visible:Boolean;
protected var _target:Object;
public static const VERSION:Number = 1;
public static const API:Number = 1;
public function VisiblePlugin(){
this.propName = "visible";
this.overwriteProps = ["visible"];
this.onComplete = onCompleteTween;
}
override public function set changeFactor(_arg1:Number):void{
if (_target.visible != true){
_target.visible = true;
};
}
public function onCompleteTween():void{
if (((!((_tween.vars.runBackwards == true))) && ((_tween.ease == _tween.vars.ease)))){
_target.visible = _visible;
};
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
_target = _arg1;
_tween = _arg3;
_visible = Boolean(_arg2);
return (true);
}
}
}//package gs.plugins
Section 9
//VolumePlugin (gs.plugins.VolumePlugin)
package gs.plugins {
import gs.*;
import flash.display.*;
import flash.media.*;
public class VolumePlugin extends TweenPlugin {
protected var _st:SoundTransform;
protected var _target:Object;
public static const VERSION:Number = 1.01;
public static const API:Number = 1;
public function VolumePlugin(){
this.propName = "volume";
this.overwriteProps = ["volume"];
}
override public function set changeFactor(_arg1:Number):void{
updateTweens(_arg1);
_target.soundTransform = _st;
}
override public function onInitTween(_arg1:Object, _arg2, _arg3:TweenLite):Boolean{
if (((isNaN(_arg2)) || (!(_arg1.hasOwnProperty("soundTransform"))))){
return (false);
};
_target = _arg1;
_st = _target.soundTransform;
addTween(_st, "volume", _st.volume, _arg2, "volume");
return (true);
}
}
}//package gs.plugins
Section 10
//ArrayTweenInfo (gs.utils.tween.ArrayTweenInfo)
package gs.utils.tween {
public class ArrayTweenInfo {
public var change:Number;
public var index:uint;
public var start:Number;
public function ArrayTweenInfo(_arg1:uint, _arg2:Number, _arg3:Number){
this.index = _arg1;
this.start = _arg2;
this.change = _arg3;
}
}
}//package gs.utils.tween
Section 11
//TweenInfo (gs.utils.tween.TweenInfo)
package gs.utils.tween {
public class TweenInfo {
public var start:Number;
public var name:String;
public var change:Number;
public var target:Object;
public var property:String;
public var isPlugin:Boolean;
public function TweenInfo(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Number, _arg5:String, _arg6:Boolean){
this.target = _arg1;
this.property = _arg2;
this.start = _arg3;
this.change = _arg4;
this.name = _arg5;
this.isPlugin = _arg6;
}
}
}//package gs.utils.tween
Section 12
//TweenLite (gs.TweenLite)
package gs {
import flash.events.*;
import flash.display.*;
import gs.utils.tween.*;
import gs.plugins.*;
import flash.utils.*;
public class TweenLite {
public var delay:Number;
protected var _hasUpdate:Boolean;
protected var _hasPlugins:Boolean;
public var started:Boolean;
public var initted:Boolean;
public var active:Boolean;
public var startTime:Number;
public var target:Object;
public var duration:Number;
public var gc:Boolean;
public var vars:Object;
public var ease:Function;
public var tweens:Array;
public var exposedVars:Object;
public var combinedTimeScale:Number;
public var initTime:Number;
public static const version:Number = 10.09;
private static var _timer:Timer = new Timer(2000);
public static var defaultEase:Function = TweenLite.easeOut;
public static var plugins:Object = {};
public static var currentTime:uint;
public static var masterList:Dictionary = new Dictionary(false);
protected static var _reservedProps:Object = {ease:1, delay:1, overwrite:1, onComplete:1, onCompleteParams:1, runBackwards:1, startAt:1, onUpdate:1, onUpdateParams:1, roundProps:1, onStart:1, onStartParams:1, persist:1, renderOnStart:1, proxiedEase:1, easeParams:1, yoyo:1, loop:1, onCompleteListener:1, onUpdateListener:1, onStartListener:1, orientToBezier:1, timeScale:1};
public static var killDelayedCallsTo:Function = TweenLite.killTweensOf;
public static var timingSprite:Sprite = new Sprite();
public static var overwriteManager:Object;
private static var _tlInitted:Boolean;
public function TweenLite(_arg1:Object, _arg2:Number, _arg3:Object){
var _local4:int;
super();
if (_arg1 == null){
return;
};
if (!_tlInitted){
TweenPlugin.activate([TintPlugin, RemoveTintPlugin, FramePlugin, AutoAlphaPlugin, VisiblePlugin, VolumePlugin, EndArrayPlugin]);
currentTime = getTimer();
timingSprite.addEventListener(Event.ENTER_FRAME, updateAll, false, 0, true);
if (overwriteManager == null){
overwriteManager = {mode:1, enabled:false};
};
_timer.addEventListener("timer", killGarbage, false, 0, true);
_timer.start();
_tlInitted = true;
};
this.vars = _arg3;
this.duration = ((_arg2) || (0.001));
this.delay = ((_arg3.delay) || (0));
this.combinedTimeScale = ((_arg3.timeScale) || (1));
this.active = Boolean((((_arg2 == 0)) && ((this.delay == 0))));
this.target = _arg1;
if (typeof(this.vars.ease) != "function"){
this.vars.ease = defaultEase;
};
if (this.vars.easeParams != null){
this.vars.proxiedEase = this.vars.ease;
this.vars.ease = easeProxy;
};
this.ease = this.vars.ease;
this.exposedVars = ((this.vars.isTV)==true) ? this.vars.exposedVars : this.vars;
this.tweens = [];
this.initTime = currentTime;
this.startTime = (this.initTime + (this.delay * 1000));
_local4 = ((((_arg3.overwrite == undefined)) || (((!(overwriteManager.enabled)) && ((_arg3.overwrite > 1)))))) ? overwriteManager.mode : int(_arg3.overwrite);
if (((!((_arg1 in masterList))) || ((_local4 == 1)))){
masterList[_arg1] = [this];
} else {
masterList[_arg1].push(this);
};
if ((((((this.vars.runBackwards == true)) && (!((this.vars.renderOnStart == true))))) || (this.active))){
initTweenVals();
if (this.active){
render((this.startTime + 1));
} else {
render(this.startTime);
};
if (((((!((this.exposedVars.visible == null))) && ((this.vars.runBackwards == true)))) && ((this.target is DisplayObject)))){
this.target.visible = this.exposedVars.visible;
};
};
}
public function set enabled(_arg1:Boolean):void{
var _local2:Array;
var _local3:Boolean;
var _local4:int;
if (_arg1){
if (!(this.target in masterList)){
masterList[this.target] = [this];
} else {
_local2 = masterList[this.target];
_local4 = (_local2.length - 1);
while (_local4 > -1) {
if (_local2[_local4] == this){
_local3 = true;
break;
};
_local4--;
};
if (!_local3){
_local2[_local2.length] = this;
};
};
};
this.gc = (_arg1) ? false : true;
if (this.gc){
this.active = false;
} else {
this.active = this.started;
};
}
public function clear():void{
this.tweens = [];
this.vars = (this.exposedVars = {ease:this.vars.ease});
_hasUpdate = false;
}
public function render(_arg1:uint):void{
var _local2:Number;
var _local3:Number;
var _local4:TweenInfo;
var _local5:int;
_local2 = ((_arg1 - this.startTime) * 0.001);
if (_local2 >= this.duration){
_local2 = this.duration;
_local3 = ((((this.ease == this.vars.ease)) || ((this.duration == 0.001)))) ? 1 : 0;
} else {
_local3 = this.ease(_local2, 0, 1, this.duration);
};
_local5 = (this.tweens.length - 1);
while (_local5 > -1) {
_local4 = this.tweens[_local5];
_local4.target[_local4.property] = (_local4.start + (_local3 * _local4.change));
_local5--;
};
if (_hasUpdate){
this.vars.onUpdate.apply(null, this.vars.onUpdateParams);
};
if (_local2 == this.duration){
complete(true);
};
}
public function activate():void{
this.started = (this.active = true);
if (!this.initted){
initTweenVals();
};
if (this.vars.onStart != null){
this.vars.onStart.apply(null, this.vars.onStartParams);
};
if (this.duration == 0.001){
this.startTime = (this.startTime - 1);
};
}
public function get enabled():Boolean{
return ((this.gc) ? false : true);
}
public function initTweenVals():void{
var _local1:String;
var _local2:int;
var _local3:*;
var _local4:TweenInfo;
if (((!((this.exposedVars.timeScale == undefined))) && ((this.target is TweenLite)))){
this.tweens[this.tweens.length] = new TweenInfo(this.target, "timeScale", this.target.timeScale, (this.exposedVars.timeScale - this.target.timeScale), "timeScale", false);
};
for (_local1 in this.exposedVars) {
if ((_local1 in _reservedProps)){
} else {
if ((_local1 in plugins)){
_local3 = new (plugins[_local1]);
if (_local3.onInitTween(this.target, this.exposedVars[_local1], this) == false){
this.tweens[this.tweens.length] = new TweenInfo(this.target, _local1, this.target[_local1], ((typeof(this.exposedVars[_local1]))=="number") ? (this.exposedVars[_local1] - this.target[_local1]) : Number(this.exposedVars[_local1]), _local1, false);
} else {
this.tweens[this.tweens.length] = new TweenInfo(_local3, "changeFactor", 0, 1, ((_local3.overwriteProps.length)==1) ? _local3.overwriteProps[0] : "_MULTIPLE_", true);
_hasPlugins = true;
};
} else {
this.tweens[this.tweens.length] = new TweenInfo(this.target, _local1, this.target[_local1], ((typeof(this.exposedVars[_local1]))=="number") ? (this.exposedVars[_local1] - this.target[_local1]) : Number(this.exposedVars[_local1]), _local1, false);
};
};
};
if (this.vars.runBackwards == true){
_local2 = (this.tweens.length - 1);
while (_local2 > -1) {
_local4 = this.tweens[_local2];
this.tweens[_local2].start = (_local4.start + _local4.change);
_local4.change = -(_local4.change);
_local2--;
};
};
if (this.vars.onUpdate != null){
_hasUpdate = true;
};
if (((TweenLite.overwriteManager.enabled) && ((this.target in masterList)))){
overwriteManager.manageOverwrites(this, masterList[this.target]);
};
this.initted = true;
}
protected function easeProxy(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return (this.vars.proxiedEase.apply(null, arguments.concat(this.vars.easeParams)));
}
public function killVars(_arg1:Object):void{
if (overwriteManager.enabled){
overwriteManager.killVars(_arg1, this.exposedVars, this.tweens);
};
}
public function complete(_arg1:Boolean=false):void{
var _local2:int;
if (!_arg1){
if (!this.initted){
initTweenVals();
};
this.startTime = (currentTime - ((this.duration * 1000) / this.combinedTimeScale));
render(currentTime);
return;
};
if (_hasPlugins){
_local2 = (this.tweens.length - 1);
while (_local2 > -1) {
if (((this.tweens[_local2].isPlugin) && (!((this.tweens[_local2].target.onComplete == null))))){
this.tweens[_local2].target.onComplete();
};
_local2--;
};
};
if (this.vars.persist != true){
this.enabled = false;
};
if (this.vars.onComplete != null){
this.vars.onComplete.apply(null, this.vars.onCompleteParams);
};
}
public static function updateAll(_arg1:Event=null):void{
var _local2:uint;
var _local3:Dictionary;
var _local4:Array;
var _local5:int;
var _local6:TweenLite;
_local2 = (currentTime = getTimer());
_local3 = masterList;
for each (_local4 in _local3) {
_local5 = (_local4.length - 1);
while (_local5 > -1) {
_local6 = _local4[_local5];
if (_local6.active){
_local6.render(_local2);
} else {
if (_local6.gc){
_local4.splice(_local5, 1);
} else {
if (_local2 >= _local6.startTime){
_local6.activate();
_local6.render(_local2);
};
};
};
_local5--;
};
};
}
public static function removeTween(_arg1:TweenLite, _arg2:Boolean=true):void{
if (_arg1 != null){
if (_arg2){
_arg1.clear();
};
_arg1.enabled = false;
};
}
public static function killTweensOf(_arg1:Object=null, _arg2:Boolean=false):void{
var _local3:Array;
var _local4:int;
var _local5:TweenLite;
if (((!((_arg1 == null))) && ((_arg1 in masterList)))){
_local3 = masterList[_arg1];
_local4 = (_local3.length - 1);
while (_local4 > -1) {
_local5 = _local3[_local4];
if (((_arg2) && (!(_local5.gc)))){
_local5.complete(false);
};
_local5.clear();
_local4--;
};
delete masterList[_arg1];
};
}
public static function from(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
_arg3.runBackwards = true;
return (new TweenLite(_arg1, _arg2, _arg3));
}
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
protected static function killGarbage(_arg1:TimerEvent):void{
var _local2:Dictionary;
var _local3:Object;
_local2 = masterList;
for (_local3 in _local2) {
if (_local2[_local3].length == 0){
delete _local2[_local3];
};
};
}
public static function delayedCall(_arg1:Number, _arg2:Function, _arg3:Array=null):TweenLite{
return (new TweenLite(_arg2, 0, {delay:_arg1, onComplete:_arg2, onCompleteParams:_arg3, overwrite:0}));
}
public static function to(_arg1:Object, _arg2:Number, _arg3:Object):TweenLite{
return (new TweenLite(_arg1, _arg2, _arg3));
}
}
}//package gs
Section 13
//MochiAd (mochi.as3.MochiAd)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiAd {
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showClickAwayAd(_arg1:Object):void{
var 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];
if (Security.sandboxType == "application"){
return (_local2);
};
Security.allowDomain("*");
Security.allowDomain(_local2);
Security.allowInsecureDomain("*");
Security.allowInsecureDomain(_local2);
return (_local2);
}
public static function unload(_arg1:Object):Boolean{
if (((_arg1.clip) && (_arg1.clip._mochiad))){
_arg1 = _arg1.clip;
};
if (_arg1.origFrameRate != undefined){
_arg1.stage.frameRate = _arg1.origFrameRate;
};
if (!_arg1._mochiad){
return (false);
};
if (_arg1._mochiad._containerLCName != undefined){
_arg1._mochiad.lc.send(_arg1._mochiad._containerLCName, "notify", {id:"unload"});
};
if (_arg1._mochiad.onUnload){
_arg1._mochiad.onUnload();
};
delete _arg1._mochiad_loaded;
delete _arg1._mochiad;
return (true);
}
public static function showInterLevelAd(_arg1:Object):void{
var 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;
} else {
trace("[MochiAd] NOTE: Security Sandbox Violation errors below are normal");
};
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.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, function (_arg1:IOErrorEvent):void{
trace("[MochiAds] Blocked URL");
});
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_w:Number;
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{
}, bar_offset:0};
options = MochiAd._parseOptions(options, DEFAULTS);
if ("c862232051e0a94e1c3609b3916ddb17".substr(0) == "dfeada81ac97cde83665f81c12da7def"){
options.ad_started();
fn = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
return;
};
clip = options.clip;
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 + options.bar_offset);
bar.y = (h - 20);
};
bar_w = (w - 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(bar_w, 0);
backing.lineTo(bar_w, 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(bar_w, 0);
inside.lineTo(bar_w, 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(bar_w, 0);
outline.lineTo(bar_w, 10);
outline.lineTo(0, 10);
outline.lineTo(0, 0);
chk.ad_msec = ad_msec;
chk.ad_timeout = ad_timeout;
chk.started = getTimer();
chk.showing = false;
chk.last_pcnt = 0;
chk.fadeout_time = fadeout_time;
chk.fadeFunction = function ():void{
var _local1:Number;
_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);
};
};
if (clip.loaderInfo.bytesLoaded == clip.loaderInfo.bytesTotal){
complete = true;
} else {
if ((clip.root is MovieClip)){
r = (clip.root as MovieClip);
if (r.framesLoaded >= r.totalFrames){
complete = true;
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
} else {
clip.loaderInfo.addEventListener(Event.COMPLETE, f);
};
};
mc.unloadAd = function ():void{
unloaded = true;
if (complete){
MochiAd.unload(clip);
};
};
mc.adLoaded = options.ad_loaded;
mc.adSkipped = options.ad_skipped;
mc.adjustProgress = function (_arg1:Number):void{
var _local2:Object;
_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 mochi.as3
Section 14
//MochiCoins (mochi.as3.MochiCoins)
package mochi.as3 {
public class MochiCoins {
public static const STORE_HIDE:String = "StoreHide";
public static const LOGGED_IN:String = "LoggedIn";
public static const STORE_ITEMS:String = "StoreItems";
public static const NO_USER:String = "NoUser";
public static const PROPERTIES_SIZE:String = "PropertiesSize";
public static const ITEM_NEW:String = "ItemNew";
public static const USER_INFO:String = "UserInfo";
public static const IO_ERROR:String = "IOError";
public static const ITEM_OWNED:String = "ItemOwned";
public static const PROPERTIES_SAVED:String = "PropertySaved";
public static const WIDGET_LOADED:String = "WidgetLoaded";
public static const ERROR:String = "Error";
public static const LOGGED_OUT:String = "LoggedOut";
public static const PROFILE_SHOW:String = "ProfileShow";
public static const LOGIN_HIDE:String = "LoginHide";
public static const LOGIN_SHOW:String = "LoginShow";
public static const STORE_SHOW:String = "StoreShow";
public static const PROFILE_HIDE:String = "ProfileHide";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
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 saveUserProperties(_arg1:Object):void{
MochiServices.send("coins_saveUserProperties", _arg1);
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function showLoginWidget(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showLoginWidget", {options:_arg1});
}
public static function getStoreItems():void{
MochiServices.send("coins_getStoreItems");
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showStore(_arg1:Object=null):void{
MochiServices.bringToTop();
MochiServices.send("coins_showStore", {options:_arg1}, null, null);
}
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 hideLoginWidget():void{
MochiServices.send("coins_hideLoginWidget");
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
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);
}
}
}//package mochi.as3
Section 15
//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 16
//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 arguements 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 17
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
public class MochiServices {
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.2 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 = {};
_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, clip:_container, 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 (((!(_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 18
//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 19
//assetholder_1 (towertest5_fla.assetholder_1)
package towertest5_fla {
import flash.display.*;
public dynamic class assetholder_1 extends MovieClip {
public function assetholder_1(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package towertest5_fla
Section 20
//gummystripinside_71 (towertest5_fla.gummystripinside_71)
package towertest5_fla {
import flash.display.*;
public dynamic class gummystripinside_71 extends MovieClip {
public function gummystripinside_71(){
addFrameScript(14, frame15);
}
function frame15(){
gotoAndPlay(1);
}
}
}//package towertest5_fla
Section 21
//insidebluetower_47 (towertest5_fla.insidebluetower_47)
package towertest5_fla {
import flash.display.*;
public dynamic class insidebluetower_47 extends MovieClip {
public function insidebluetower_47(){
addFrameScript(0, frame1, 4, frame5, 9, frame10);
}
function frame10(){
gotoAndStop(1);
}
function frame1(){
stop();
}
function frame5(){
gotoAndStop(1);
}
}
}//package towertest5_fla
Section 22
//insidegreentower_79 (towertest5_fla.insidegreentower_79)
package towertest5_fla {
import flash.display.*;
public dynamic class insidegreentower_79 extends MovieClip {
public function insidegreentower_79(){
addFrameScript(0, frame1, 3, frame4, 9, frame10);
}
function frame10(){
this.gotoAndStop(1);
}
function frame1(){
stop();
}
function frame4(){
this.gotoAndStop(1);
}
}
}//package towertest5_fla
Section 23
//insideredtower_76 (towertest5_fla.insideredtower_76)
package towertest5_fla {
import flash.display.*;
public dynamic class insideredtower_76 extends MovieClip {
public function insideredtower_76(){
addFrameScript(4, frame5, 10, frame11);
}
function frame5(){
gotoAndStop(1);
}
function frame11(){
gotoAndStop(1);
}
}
}//package towertest5_fla
Section 24
//light_7 (towertest5_fla.light_7)
package towertest5_fla {
import flash.events.*;
import flash.display.*;
public dynamic class light_7 extends MovieClip {
public function light_7(){
addFrameScript(0, frame1);
}
function frame1(){
this.addEventListener(Event.ENTER_FRAME, onThisEnter);
stop();
}
public function onThisEnter(_arg1:Event):void{
if (Math.round((Math.random() * 150)) == 1){
this.play();
};
}
}
}//package towertest5_fla
Section 25
//loadedanimation_44 (towertest5_fla.loadedanimation_44)
package towertest5_fla {
import flash.display.*;
import flash.text.*;
public dynamic class loadedanimation_44 extends MovieClip {
public var loader_txt:TextField;
public var bar_mc:MovieClip;
public var grass_mc:MovieClip;
public function loadedanimation_44(){
addFrameScript(355, frame356);
}
function frame356(){
MovieClip(root).play();
}
}
}//package towertest5_fla
Section 26
//MainTimeline (towertest5_fla.MainTimeline)
package towertest5_fla {
import gs.*;
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import mochi.as3.*;
import fl.transitions.easing.*;
import flash.media.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class MainTimeline extends MovieClip {
public var gumPrice_txt:TextField;
public var gumSlow:Number;
public var yellowTower_btn:SimpleButton;
public var towerG_range:Number;
public var powerUp_btn:SimpleButton;
public var towerG_rate:Number;
public var maxEnemies:Number;
public var animation_mc:MovieClip;
public var power_txt:TextField;
public var final_song:FinalMetal;
public var loader_txt:TextField;
public var gumStrip_btn:SimpleButton;
public var enemyList:Array;
public var enemyHP_txt:TextField;
public var sum:Number;
public var sellAmount:Number;
public var rangeUp_btn:SimpleButton;
public var skip_mc:MovieClip;
public var speed:Number;
public var towerB:Btower;
public var greenTower_btn:SimpleButton;
public var stripG:Gstrip;
public var towerR:Rtower;
public var health:Number;
public var towerG:Gtower;
public var range_txt:TextField;
public var money_txt:TextField;
public var towerY:Ytower;
public var tgrPrice:Number;
public var towerGr_rate:Number;
public var eir:Number;
public var redTower_btn:SimpleButton;
public var gameDone:GameDone;
public var calcY:Number;
public var bossmetal_song:Bossmetal;
public var coin:Coin;
public var disObjects:Number;
public var tgPrice:Number;
public var towerY_power:Number;
public var cmenu_mc:MovieClip;
public var tower_tester:Number;
public var towerY_range:Number;
public var grass_mc:MovieClip;
public var name_txt:TextField;
public var road_tester:Number;
public var bulletList:Array;
public var rUpCost_txt:TextField;
public var money:Number;
public var calcX:Number;
public var cheat:Number;
public var tgrPrice_txt:TextField;
public var towerGr_power:Number;
public var blueTower_btn:SimpleButton;
public var enemyType:String;
public var towerR_rate:Number;
public var music_channel:SoundChannel;
public var grayTower_btn:SimpleButton;
public var towerB_rate:Number;
public var bullet:Bullet;
public var lives:Number;
public var towerGr_range:Number;
public var spawnRate:Number;
public var explosion:Explosion;
public var send_btn:SimpleButton;
public var myResult:Number;
public var UFOstreet_song:UFOstreet;
public var level_txt:TextField;
public var enemy_txt:TextField;
public var regainSpeed:Number;
public var lives_txt:TextField;
public var bar_mc:MovieClip;
public var tgPrice_txt:TextField;
public var pUpCost_txt:TextField;
public var towerList:Array;
public var dragging:Boolean;
public var songList:Array;
public var towerY_rate:Number;
public var info_txt:TextField;
public var gumPrice:Number;
public var enemyDesc_txt:TextField;
public var trPrice:Number;
public var tyPrice_txt:TextField;
public var menu:Menu;
public var bus_song:BusStreet;
public var tbPrice:Number;
public var level:Number;
public var playmusic:Boolean;
public var dmenu_mc:MovieClip;
public var eSpeed_txt:TextField;
public var enemy:Enemy;
public var click_sound:SimpleClick;
public var trPrice_txt:TextField;
public var songPlaying:Boolean;
public var moneyList:Array;
public var eMoney_txt:TextField;
public var tbPrice_txt:TextField;
public var towerR_power:Number;
public var tankmetal_song:Tankmetal;
public var roundsUp_btn:SimpleButton;
public var towerB_power:Number;
public var rangeShowing:Boolean;
public var hpList:Array;
public var send_timer:Timer;
public var towerGr:Grtower;
public var rounds_txt:TextField;
public var rsUpCost_txt:TextField;
public var hiphop_song:Hiphop;
public var mousedOver:Boolean;
public var died:Boolean;
public var roadList:Array;
public var gameOver:GameOver;
public var towerG_power:Number;
public var towerR_range:Number;
public var sell_btn:SimpleButton;
public var music_mc:MovieClip;
public var tyPrice:Number;
public var towerB_range:Number;
public var range_mc:Range;
public var counter:Number;
public function MainTimeline(){
addFrameScript(0, frame1, 3, frame4, 4, frame5);
}
public function onCoinEnter(_arg1:Event):void{
if (_arg1.target.currentFrame == _arg1.target.totalFrames){
_arg1.target.removeEventListener(Event.ENTER_FRAME, onCoinEnter);
stage.removeChild(Coin(_arg1.target));
};
}
public function shoot(_arg1:Event):void{
var _local2:int;
var _local3:int;
var _local4:int;
_arg1.target.counter++;
if ((((((((_arg1.target.dragging == true)) && ((dragging == true)))) && ((_arg1.target.numChildren == 1)))) || ((((_arg1.target.targeted == true)) && ((_arg1.target.numChildren == 1)))))){
stage.setChildIndex(DisplayObject(_arg1.target), (stage.numChildren - 1));
range_mc = new Range();
_arg1.target.addChildAt(range_mc, 0);
range_mc.alpha = 0.5;
range_mc.scaleX = (_arg1.target.range / 100);
range_mc.scaleY = (_arg1.target.range / 100);
} else {
if ((((((dragging == false)) && ((_arg1.target.numChildren == 2)))) && ((_arg1.target.targeted == false)))){
_arg1.target.removeChildAt(0);
pUpCost_txt.visible = false;
rUpCost_txt.visible = false;
rsUpCost_txt.visible = false;
powerUp_btn.visible = false;
rangeUp_btn.visible = false;
roundsUp_btn.visible = false;
sell_btn.visible = false;
};
};
if (_arg1.target.num != 5){
_local2 = 0;
while (_local2 < _arg1.target.shots) {
_local3 = 0;
while (_local3 < enemyList.length) {
if (enemyList[(_local3 + _local2)] == "[object Enemy]"){
enemyList[(_local3 + _local2)].distanceX = (_arg1.target.x - enemyList[(_local3 + _local2)].x);
enemyList[(_local3 + _local2)].distanceY = (_arg1.target.y - enemyList[(_local3 + _local2)].y);
enemyList[(_local3 + _local2)].distanceTotal = Math.sqrt(((enemyList[(_local3 + _local2)].distanceX * enemyList[(_local3 + _local2)].distanceX) + (enemyList[(_local3 + _local2)].distanceY * enemyList[(_local3 + _local2)].distanceY)));
if (enemyList[(_local3 + _local2)].distanceTotal <= (_arg1.target.range - 12)){
if (((((((((_arg1.target.counter % _arg1.target.shootRate) == 0)) && ((_arg1.target.shooting == false)))) && ((_arg1.target.dragging == false)))) && ((_arg1.target.shotsTaken < _arg1.target.shots)))){
_arg1.target.shotsTaken++;
_arg1.target.tower_mc.play();
bullet = new Bullet();
stage.addChild(bullet);
bullet.bulletSlot = _arg1.target.num;
bullet.gotoAndStop(bullet.bulletSlot);
bullet.bulletKind = _arg1.target.towerType;
_arg1.target.travelTime = ((enemyList[(_local3 + _local2)].distanceTotal * _arg1.target.shootSpeed) / 140);
if (_arg1.target.num == 4){
calcX = (enemyList[(_local3 + _local2)].x - _arg1.target.x);
calcY = (enemyList[(_local3 + _local2)].y - _arg1.target.y);
sum = Math.atan2(calcY, calcX);
myResult = ((sum * 180) / Math.PI);
_arg1.target.rotation = (myResult + 90);
};
calcX = (enemyList[(_local3 + _local2)].x - _arg1.target.x);
calcY = (enemyList[(_local3 + _local2)].y - _arg1.target.y);
sum = Math.atan2(calcY, calcX);
myResult = ((sum * 180) / Math.PI);
bullet.rotation = myResult;
bullet.power = _arg1.target.power;
bullet.x = _arg1.target.x;
bullet.y = _arg1.target.y;
bullet.targetEnemy = (_local3 + _local2);
TweenLite.to(bullet, _arg1.target.travelTime, {x:enemyList[(_local3 + _local2)].x, y:enemyList[(_local3 + _local2)].y, ease:None.easeNone});
bullet.addEventListener(Event.ENTER_FRAME, bulletCheck);
bullet.displayTime = _arg1.target.travelTime;
bullet.counter = 0;
if (_arg1.target.shotsTaken == _arg1.target.shots){
_arg1.target.shooting = true;
_arg1.target.counter = 0;
};
} else {
if ((((((((_arg1.target.counter % _arg1.target.shootRate) - 1) == 0)) && ((_arg1.target.shooting == true)))) && (!(((_arg1.target.counter % _arg1.target.shootRate) == 0))))){
_arg1.target.shooting = false;
_arg1.target.shotsTaken = 0;
};
};
};
};
_local3++;
};
_local2++;
};
} else {
if ((((_arg1.target.num == 5)) && ((_arg1.target.dragging == false)))){
stage.setChildIndex(Gstrip(_arg1.target), 1);
_local4 = 0;
while (_local4 < enemyList.length) {
if (_arg1.target.hitTestObject(enemyList[_local4])){
if ((((((enemyList[_local4].speed == enemyList[_local4].maxSpeed)) && (!((enemyList[_local4].currentFrame == 3))))) && (!((enemyList[_local4].currentFrame == 6))))){
enemyList[_local4].speed = (enemyList[_local4].speed - _arg1.target.power);
if (enemyList[_local4].speed <= 0){
enemyList[_local4].speed = 0.35;
};
};
};
_local4++;
};
};
};
}
public function onSendTimer(_arg1:TimerEvent):void{
engine();
}
public function exCheck(_arg1:Event):void{
if (_arg1.target.explosion_mc.currentFrame == _arg1.target.explosion_mc.totalFrames){
_arg1.target.removeEventListener(Event.ENTER_FRAME, exCheck);
stage.removeChild(DisplayObject(_arg1.target));
};
}
public function stopSong():void{
music_channel.stop();
}
public function onRestartClick(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
died = false;
_arg1.target.removeEventListener(MouseEvent.CLICK, onRestartClick);
stage.removeChild(gameOver);
_local2 = 0;
while (_local2 < towerList.length) {
towerList[_local2].removeEventListener(Event.ENTER_FRAME, shoot);
towerList[_local2].removeEventListener(MouseEvent.MOUSE_UP, towerInfo);
stage.removeChild(towerList[_local2]);
_local2++;
};
_local3 = 0;
while (_local3 < enemyList.length) {
if (enemyList[_local3] == "[object Enemy]"){
enemyList[_local3].removeEventListener(Event.ENTER_FRAME, enemyCheck);
stage.removeChild(enemyList[_local3]);
};
_local3++;
};
towerList.length = 0;
enemyList.length = 0;
money = 50;
lives = 20;
level = 0;
health = 0;
lives_txt.text = ("Lives: " + lives.toString());
money_txt.text = ("$" + Math.round(money).toString());
level_txt.text = ("Level: " + level.toString());
send_timer.stop();
}
public function onSkipClick(_arg1:MouseEvent):void{
skip_mc.skip_btn.removeEventListener(MouseEvent.CLICK, onSkipClick);
play();
}
public function enemyCheck(_arg1:Event):void{
var _local2:int;
var _local3:int;
if (_arg1.target.speed < _arg1.target.maxSpeed){
_local2 = 0;
while (_local2 < towerList.length) {
if (towerList[_local2].num == 5){
if (!_arg1.target.hitTestObject(towerList[_local2])){
_arg1.target.speed = (_arg1.target.speed + regainSpeed);
};
};
_local2++;
};
} else {
_arg1.target.speed = _arg1.target.maxSpeed;
};
_arg1.target.health_mc.scaleX = (_arg1.target.health / _arg1.target.totalHealth);
if (_arg1.target.health <= 0){
if ((((eir >= maxEnemies)) && ((enemyList.length <= 1)))){
TweenLite.to(music_channel, 3, {volume:0, onComplete:stopSong});
};
if (level == 50){
gameDone = new GameDone();
stage.addChild(gameDone);
gameDone.x = (stage.stageWidth / 2);
gameDone.y = (stage.stageHeight / 2);
};
_local3 = 0;
while (_local3 < enemyList.length) {
if (enemyList[_local3].name == _arg1.target.name){
enemyList.splice(_local3, 1);
};
_local3++;
};
coin = new Coin();
stage.addChild(coin);
coin.x = _arg1.target.x;
coin.y = (_arg1.target.y - 6);
coin.addEventListener(Event.ENTER_FRAME, onCoinEnter);
_arg1.target.removeEventListener(Event.ENTER_FRAME, enemyCheck);
stage.removeChild(DisplayObject(_arg1.target));
if (_arg1.target.giveMoney == true){
money = (money + moneyList[level]);
} else {
money = (money + moneyList[level]);
};
money_txt.text = ("$" + Math.round(money).toString());
};
if ((((_arg1.target.y > (stage.stageHeight + 30))) && ((_arg1.target.health > 0)))){
_arg1.target.giveMoney = false;
_arg1.target.health = 0;
if (_arg1.target.scaleX == 1){
lives--;
} else {
if (_arg1.target.scaleX == 1.5){
lives = (lives - 5);
};
};
lives_txt.text = ("Lives: " + lives.toString());
TweenLite.from(lives_txt, 0.15, {scaleX:3, scaleY:3, overwrite:false, tint:0x990000, x:(lives_txt.x - 25), y:(lives_txt.y - 20)});
if ((((lives <= 0)) && ((died == false)))){
died = true;
lives = 0;
gameOver = new GameOver();
stage.addChild(gameOver);
gameOver.x = (stage.stageWidth / 2);
gameOver.y = (stage.stageHeight / 2);
gameOver.restart_btn.addEventListener(MouseEvent.CLICK, onRestartClick);
};
};
if ((((_arg1.target.y < 100)) && ((_arg1.target.x <= 335)))){
_arg1.target.x = (_arg1.target.x + _arg1.target.speed);
} else {
if ((((_arg1.target.x > 335)) && ((_arg1.target.y <= 225)))){
_arg1.target.y = (_arg1.target.y + _arg1.target.speed);
_arg1.target.enemy_mc.rotation = 180;
} else {
if ((((((_arg1.target.y > 225)) && ((_arg1.target.x >= 185)))) && ((_arg1.target.y < 250)))){
_arg1.target.x = (_arg1.target.x - _arg1.target.speed);
_arg1.target.enemy_mc.rotation = 270;
} else {
if ((((((((_arg1.target.x < 185)) && ((_arg1.target.y >= 180)))) && ((_arg1.target.x > 80)))) && ((_arg1.target.y < 250)))){
_arg1.target.y = (_arg1.target.y - _arg1.target.speed);
_arg1.target.enemy_mc.rotation = 0;
} else {
if ((((_arg1.target.y < 180)) && ((_arg1.target.x >= 80)))){
_arg1.target.x = (_arg1.target.x - _arg1.target.speed);
_arg1.target.enemy_mc.rotation = 270;
} else {
if ((((_arg1.target.x < 80)) && ((_arg1.target.y <= 380)))){
_arg1.target.y = (_arg1.target.y + _arg1.target.speed);
_arg1.target.enemy_mc.rotation = 180;
} else {
if ((((_arg1.target.y > 380)) && ((_arg1.target.x <= 345)))){
_arg1.target.x = (_arg1.target.x + _arg1.target.speed);
_arg1.target.enemy_mc.rotation = 90;
} else {
if (_arg1.target.x > 345){
_arg1.target.y = (_arg1.target.y + _arg1.target.speed);
_arg1.target.enemy_mc.rotation = 180;
};
};
};
};
};
};
};
};
}
public function clickListener(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
if (_arg1.target == "[object SimpleButton]"){
click_sound.play();
};
switch (_arg1.target.name){
case "blueTower_btn":
if (money >= tbPrice){
money = (money - tbPrice);
money_txt.text = ("$" + Math.round(money).toString());
towerB = new Btower();
stage.addChild(towerB);
towerList.push(towerB);
towerB.x = mouseX;
towerB.y = mouseY;
towerB.counter = 0;
towerB.shooting = false;
towerB.power = towerB_power;
towerB.stockPower = towerB_power;
towerB.shootSpeed = 0.15;
towerB.shootRate = towerB_rate;
towerB.maxRps = 600;
dragging = true;
towerB.dragging = true;
towerB.towerType = "blue";
towerB.range = towerB_range;
towerB.maxRange = 177;
towerB.upgrade = 1;
towerB.targeted = false;
towerB.price = tbPrice;
towerB.num = 1;
towerB.shots = 1;
towerB.shotsTaken = 0;
towerB.name = "Blue Tower";
towerB.addEventListener(Event.ENTER_FRAME, shoot);
towerB.tower_mc.addEventListener(MouseEvent.MOUSE_UP, towerInfo);
towerB.startDrag();
};
break;
case "redTower_btn":
if (money >= trPrice){
money = (money - trPrice);
money_txt.text = ("$" + Math.round(money).toString());
towerR = new Rtower();
stage.addChild(towerR);
towerList.push(towerR);
towerR.x = mouseX;
towerR.y = mouseY;
towerR.counter = 0;
towerR.shooting = false;
towerR.power = towerR_power;
towerR.stockPower = towerR_power;
towerR.shootSpeed = 0.2;
towerR.shootRate = towerR_rate;
towerR.maxRps = 300;
dragging = true;
towerR.dragging = true;
towerR.towerType = "red";
towerR.range = towerR_range;
towerR.maxRange = 135;
towerR.upgrade = 1;
towerR.targeted = false;
towerR.price = trPrice;
towerR.num = 2;
towerR.shots = 1;
towerR.shotsTaken = 0;
towerR.name = "Red Tower";
towerR.addEventListener(Event.ENTER_FRAME, shoot);
towerR.tower_mc.addEventListener(MouseEvent.MOUSE_UP, towerInfo);
towerR.startDrag();
};
break;
case "greenTower_btn":
if (money >= tgPrice){
money = (money - tgPrice);
money_txt.text = ("$" + Math.round(money).toString());
towerG = new Gtower();
stage.addChild(towerG);
towerList.push(towerG);
towerG.x = mouseX;
towerG.y = mouseY;
towerG.counter = 0;
towerG.shooting = false;
towerG.power = towerG_power;
towerG.stockPower = towerG_power;
towerG.shootSpeed = 0.1;
towerG.shootRate = towerG_rate;
towerG.maxRps = 900;
dragging = true;
towerG.dragging = true;
towerG.towerType = "green";
towerG.range = towerG_range;
towerG.maxRange = 135;
towerG.upgrade = 1;
towerG.targeted = false;
towerG.price = tgPrice;
towerG.num = 3;
towerG.shots = 1;
towerG.shotsTaken = 0;
towerG.name = "Green Tower";
towerG.addEventListener(Event.ENTER_FRAME, shoot);
towerG.tower_mc.addEventListener(MouseEvent.MOUSE_UP, towerInfo);
towerG.startDrag();
};
break;
case "grayTower_btn":
if (money >= tgrPrice){
money = (money - tgrPrice);
money_txt.text = ("$" + Math.round(money).toString());
towerGr = new Grtower();
stage.addChild(towerGr);
towerList.push(towerGr);
towerGr.x = mouseX;
towerGr.y = mouseY;
towerGr.counter = 0;
towerGr.shooting = false;
towerGr.power = towerGr_power;
towerGr.stockPower = towerGr_power;
towerGr.shootSpeed = 0.15;
towerGr.shootRate = towerGr_rate;
towerGr.maxRps = 200;
dragging = true;
towerGr.dragging = true;
towerGr.towerType = "gray";
towerGr.range = towerGr_range;
towerGr.maxRange = 177;
towerGr.upgrade = 1;
towerGr.targeted = false;
towerGr.price = tgrPrice;
towerGr.num = 4;
towerGr.shots = 1;
towerGr.shotsTaken = 0;
towerGr.name = "Gray Tower";
towerGr.addEventListener(Event.ENTER_FRAME, shoot);
towerGr.tower_mc.addEventListener(MouseEvent.MOUSE_UP, towerInfo);
towerGr.startDrag();
};
break;
case "gumStrip_btn":
if (money >= gumPrice){
money = (money - gumPrice);
money_txt.text = ("$" + Math.round(money).toString());
stripG = new Gstrip();
stage.addChild(stripG);
towerList.push(stripG);
stripG.x = mouseX;
stripG.y = mouseY;
stripG.counter = 0;
stripG.shooting = false;
stripG.power = gumSlow;
stripG.shootSpeed = 0;
stripG.shootRate = 0;
stripG.maxRps = 0;
dragging = true;
stripG.dragging = true;
stripG.towerType = "pink";
stripG.range = 0;
stripG.maxRange = 0;
stripG.upgrade = 1;
stripG.targeted = false;
stripG.price = gumPrice;
stripG.num = 5;
stripG.shots = 0;
stripG.shotsTaken = 0;
stripG.name = "Gummy Strip";
stripG.addEventListener(Event.ENTER_FRAME, shoot);
stripG.addEventListener(MouseEvent.MOUSE_UP, towerInfo);
stripG.startDrag();
};
break;
case "yellowTower_btn":
if (money >= tyPrice){
money = (money - tyPrice);
money_txt.text = ("$" + Math.round(money).toString());
towerY = new Ytower();
stage.addChild(towerY);
towerList.push(towerY);
towerY.x = mouseX;
towerY.y = mouseY;
towerY.counter = 0;
towerY.shooting = false;
towerY.power = towerY_power;
towerY.stockPower = towerY_power;
towerY.shootSpeed = 0.15;
towerY.shootRate = towerY_rate;
towerY.maxRps = 300;
dragging = true;
towerY.dragging = true;
towerY.towerType = "yellow";
towerY.range = towerY_range;
towerY.maxRange = 135;
towerY.upgrade = 1;
towerY.targeted = false;
towerY.price = tyPrice;
towerY.num = 6;
towerY.shots = 4;
towerY.shotsTaken = 0;
towerY.name = "Yellow Tower";
towerY.addEventListener(Event.ENTER_FRAME, shoot);
towerY.tower_mc.addEventListener(MouseEvent.MOUSE_UP, towerInfo);
towerY.startDrag();
};
break;
case "send_btn":
disObjects = stage.numChildren;
if (send_timer.running == false){
songPlaying = false;
music_channel.stop();
level++;
eir = 0;
send_timer.start();
};
break;
case "powerUp_btn":
_local2 = 0;
while (_local2 < towerList.length) {
if ((((towerList[_local2].targeted == true)) && (!((towerList[_local2].num == 5))))){
if (money >= Math.round(((towerList[_local2].power * 7.5) - towerList[_local2].stockPower))){
money = (money - Math.round(((towerList[_local2].power * 7.5) - towerList[_local2].stockPower)));
money_txt.text = ("$" + Math.round(money).toString());
towerList[_local2].power = (towerList[_local2].power + Math.round(((towerList[_local2].power / 4) + towerList[_local2].stockPower)));
};
power_txt.text = ("Power: " + towerList[_local2].power);
pUpCost_txt.text = ((("+" + Math.round(((towerList[_local2].power / 4) + towerList[_local2].stockPower))) + " $") + Math.round(((towerList[_local2].power * 7.5) - towerList[_local2].stockPower)));
} else {
if ((((towerList[_local2].targeted == true)) && ((towerList[_local2].num == 5)))){
if (towerList[_local2].power < 0.7){
if (money >= Math.round((towerList[_local2].power * 1000))){
money = (money - Math.round((towerList[_local2].power * 1000)));
money_txt.text = ("$" + Math.round(money).toString());
towerList[_local2].power = (towerList[_local2].power + (Math.round((0.1 / 0.01)) * 0.01));
};
pUpCost_txt.text = ((("+" + 1) + " $") + Math.round((towerList[_local2].power * 1000)));
} else {
pUpCost_txt.text = "MAX";
};
power_txt.text = ("Power: " + (Math.round((towerList[_local2].power / 0.01)) * 0.01));
};
};
_local2++;
};
break;
case "rangeUp_btn":
_local3 = 0;
while (_local3 < towerList.length) {
if (towerList[_local3].targeted == true){
if (towerList[_local3].range <= towerList[_local3].maxRange){
if (money >= Math.round(((towerList[_local3].range / 2) + (towerList[_local3].price / 2)))){
money = (money - Math.round(((towerList[_local3].range / 2) + (towerList[_local3].price / 2))));
money_txt.text = ("$" + Math.round(money).toString());
towerList[_local3].range = (towerList[_local3].range + Math.round((towerList[_local3].range / 10)));
towerList[_local3].getChildAt(0).scaleX = (towerList[_local3].getChildAt(0).scaleX + (Math.round((towerList[_local3].range / 10)) / 100));
towerList[_local3].getChildAt(0).scaleY = (towerList[_local3].getChildAt(0).scaleY + (Math.round((towerList[_local3].range / 10)) / 100));
};
range_txt.text = ("Range: " + towerList[_local3].range);
rUpCost_txt.text = ((("+" + Math.round((towerList[_local3].range / 10))) + " $") + Math.round(((towerList[_local3].range / 2) + (towerList[_local3].price / 2))));
} else {
range_txt.text = ("Range: " + towerList[_local3].range);
rUpCost_txt.text = "MAX";
rangeUp_btn.visible = false;
};
};
_local3++;
};
break;
case "roundsUp_btn":
_local4 = 0;
while (_local4 < towerList.length) {
if (towerList[_local4].targeted == true){
if (Math.round(((stage.frameRate / towerList[_local4].shootRate) * 60)) < towerList[_local4].maxRps){
if ((((money >= Math.round(((((stage.frameRate / towerList[_local4].shootRate) * 60) / 1.5) + (towerList[_local4].price / 4))))) && ((towerList[_local4].shootRate > 2)))){
money = (money - Math.round(((((stage.frameRate / towerList[_local4].shootRate) * 60) / 1.5) + (towerList[_local4].price / 4))));
money_txt.text = ("$" + Math.round(money).toString());
towerList[_local4].shootRate = (towerList[_local4].shootRate - int(1));
};
rounds_txt.text = ("RPM: " + Math.round(((stage.frameRate / towerList[_local4].shootRate) * 60)));
rsUpCost_txt.text = ((("+" + Math.round((((stage.frameRate / (towerList[_local4].shootRate - 1)) * 60) - ((stage.frameRate / towerList[_local4].shootRate) * 60)))) + " $") + Math.round(((((stage.frameRate / towerList[_local4].shootRate) * 60) / 1.5) + (towerList[_local4].price / 4))));
} else {
rounds_txt.text = ("RPS: " + Math.round(((stage.frameRate / towerList[_local4].shootRate) * 60)));
rsUpCost_txt.text = "MAX";
roundsUp_btn.visible = false;
};
};
_local4++;
};
break;
case "sell_btn":
_local5 = 0;
while (_local5 < towerList.length) {
if (towerList[_local5].targeted == true){
if (towerList[_local5].num != 5){
money = (money + Math.round(((towerList[_local5].power + (towerList[_local5].range / 12)) + (30 / towerList[_local5].shootRate))));
} else {
money = (money + Math.round((towerList[_local5].power * 900)));
};
money_txt.text = ("$" + Math.round(money).toString());
towerList[_local5].removeEventListener(Event.ENTER_FRAME, shoot);
towerList[_local5].removeEventListener(MouseEvent.MOUSE_UP, towerInfo);
stage.removeChild(towerList[_local5]);
towerList.splice(_local5, 1);
name_txt.visible = false;
power_txt.visible = false;
range_txt.visible = false;
rounds_txt.visible = false;
pUpCost_txt.visible = false;
rUpCost_txt.visible = false;
rsUpCost_txt.visible = false;
powerUp_btn.visible = false;
rangeUp_btn.visible = false;
roundsUp_btn.visible = false;
sell_btn.visible = false;
};
_local5++;
};
break;
case "music_mc":
if (music_mc.currentFrame == 1){
TweenLite.to(music_channel, 0.5, {volume:0, overwrite:false});
playmusic = false;
} else {
TweenLite.to(music_channel, 0.5, {volume:1, overwrite:false});
playmusic = true;
};
music_mc.play();
break;
};
}
function frame4(){
stop();
skip_mc.skip_btn.addEventListener(MouseEvent.CLICK, onSkipClick);
}
function frame5(){
songList = new Array();
click_sound = new SimpleClick();
music_channel = new SoundChannel();
hiphop_song = new Hiphop();
tankmetal_song = new Tankmetal();
bossmetal_song = new Bossmetal();
UFOstreet_song = new UFOstreet();
final_song = new FinalMetal();
bus_song = new BusStreet();
hpList = new Array();
moneyList = new Array();
enemyList = new Array();
bulletList = new Array();
towerList = new Array();
roadList = new Array();
speed = new Number(2);
regainSpeed = new Number(0.0075);
counter = new Number(0);
lives = new Number(20);
spawnRate = new Number(1);
level = new Number(0);
health = new Number(0);
maxEnemies = new Number(20);
enemyType = new String();
eir = new Number(0);
money = new Number(50);
dragging = new Boolean(false);
tower_tester = new Number(0);
road_tester = new Number(0);
mousedOver = new Boolean(false);
sellAmount = new Number();
rangeShowing = new Boolean(false);
send_timer = new Timer((spawnRate * 1000), 0);
died = new Boolean(false);
disObjects = new Number(stage.numChildren);
menu = new Menu();
cheat = new Number(0);
songPlaying = new Boolean(false);
playmusic = new Boolean(true);
tbPrice = new Number(30);
trPrice = new Number(60);
tgPrice = new Number(200);
tgrPrice = new Number(7000);
gumPrice = new Number(850);
tyPrice = new Number(1000);
towerB_power = new Number(5);
towerR_power = new Number(15);
towerG_power = new Number(1);
gumSlow = new Number(0.5);
towerGr_power = new Number(3000);
towerY_power = new Number(250);
towerB_range = new Number(100);
towerR_range = new Number(75);
towerG_range = new Number(90);
towerGr_range = new Number(130);
towerY_range = new Number(110);
towerB_rate = new Number(10);
towerR_rate = new Number(20);
towerG_rate = new Number(5);
towerGr_rate = new Number(40);
towerY_rate = new Number(25);
stop();
lives_txt.text = ("Lives: " + lives.toString());
money_txt.text = ("$" + Math.round(money).toString());
level_txt.text = ("Level: " + level.toString());
tbPrice_txt.text = ("$" + tbPrice);
trPrice_txt.text = ("$" + trPrice);
tgPrice_txt.text = ("$" + tgPrice);
tgrPrice_txt.text = ("$" + tgrPrice);
gumPrice_txt.text = ("$" + gumPrice);
tyPrice_txt.text = ("$" + tyPrice);
powerUp_btn.visible = false;
rangeUp_btn.visible = false;
roundsUp_btn.visible = false;
sell_btn.visible = false;
stage.addEventListener(MouseEvent.MOUSE_DOWN, stageDown);
this.addEventListener(MouseEvent.CLICK, clickListener);
this.addEventListener(MouseEvent.MOUSE_OVER, overListener);
send_timer.addEventListener(TimerEvent.TIMER, onSendTimer);
stage.addEventListener(KeyboardEvent.KEY_DOWN, onKDown);
hpList = [0, 20, 35, 110, 115, 200, 350, 325, 415, 600, 750, 3000, 1000, 800, 950, 1500, 1600, 7300, 2000, 1700, 2400, 1500, 0x1900, 3500, 5000, 6100, 4500, 8000, 8200, 5700, 95000, 8000, 13000, 19000, 12000, 23000, 15100, 16500, 18000, 0x7D00, 130000, 31000, 47000, 37000, 46000, 250000, 100000, 350000, 650000, 42000, 0x3D0900];
moneyList = [0, 2, 3, 5, 8, 10, 15, 16, 20, 22, 23, 700, 35, 37, 40, 41, 43, 1300, 51, 52, 53, 57, 3000, 64, 65, 66, 67, 68, 69, 70, 6000, 75, 76, 80, 82, 84, 100, 101, 103, 105, 8000, 115, 120, 123, 125, 13000, 10000, 15000, 17000, 7500, 25000];
stage.addChild(menu);
menu.x = (stage.stageWidth / 2);
menu.y = (stage.stageHeight / 2);
menu.continue_btn.addEventListener(MouseEvent.CLICK, onContClick);
}
function frame1(){
MochiAd.showPreGameAd({clip:root, id:"e1ae53c8d8206413", res:"650x500", background:10133146, color:6447456, outline:2170654, no_bg:true});
}
public function onContClick(_arg1:MouseEvent):void{
if (menu.currentFrame != menu.totalFrames){
menu.play();
} else {
_arg1.target.removeEventListener(MouseEvent.CLICK, onContClick);
stage.removeChild(DisplayObject(_arg1.target.parent));
};
}
public function stageDown(_arg1:MouseEvent):void{
var _local2:int;
if (((((((!((_arg1.target.name == "powerUp_btn"))) && (!((_arg1.target.name == "rangeUp_btn"))))) && (!((_arg1.target.name == "roundsUp_btn"))))) && (!((_arg1.target.name == "sell_btn"))))){
_local2 = 0;
while (_local2 < towerList.length) {
towerList[_local2].targeted = false;
_local2++;
};
name_txt.visible = false;
power_txt.visible = false;
range_txt.visible = false;
rounds_txt.visible = false;
info_txt.visible = false;
};
}
public function engine():void{
enemy = new Enemy();
stage.addChild(enemy);
enemyList.push(enemy);
health = hpList[level];
if ((level % 1) == 0){
if ((((((((((((((((((((((((songPlaying == false)) && (!(((level % 3) == 0))))) && (!(((level % 11) == 0))))) && (!(((level % 4) == 0))))) && (!((level == 17))))) && ((playmusic == true)))) && (!((level == 46))))) && (!((level == 47))))) && (!((level == 48))))) && (!((level == 49))))) && (!((level == 50))))) && (!(((level % 5) == 0))))){
songPlaying = true;
music_channel = hiphop_song.play();
};
enemyType = "Truck";
enemyDesc_txt.text = "Average defense, average speed, weak against Blue Towers.";
speed = 1.7;
spawnRate = 1;
send_timer.delay = (spawnRate * 1000);
maxEnemies = 20;
};
if ((level % 3) == 0){
if ((((((((((((songPlaying == false)) && (!(((level % 4) == 0))))) && (!((level == 11))))) && ((playmusic == true)))) && (!((level == 30))))) && (!((level == 45))))){
songPlaying = true;
music_channel = tankmetal_song.play();
};
enemyType = "Tank";
enemyDesc_txt.text = "Slow, good defense, weak against Red Towers.";
enemy.gotoAndStop(2);
speed = 1.2;
spawnRate = 2;
send_timer.delay = (spawnRate * 1000);
maxEnemies = 15;
};
if (((((level % 4) == 0)) || ((level == 49)))){
if ((((((((((songPlaying == false)) && (!((level == 11))))) && (!(((level % 5) == 0))))) && ((playmusic == true)))) && (!((level == 48))))){
songPlaying = true;
music_channel = UFOstreet_song.play();
};
enemyType = "UFO";
enemyDesc_txt.text = "Fast, unnaffected by Gummy Strips, weak against Green Towers.";
enemy.gotoAndStop(3);
speed = 3;
spawnRate = 2.5;
send_timer.delay = (spawnRate * 1000);
maxEnemies = 10;
if (level == 36){
enemyType = "Speed UFOs";
enemyDesc_txt.text = "Extra fast versions of UFO's.";
speed = 6;
maxEnemies = 15;
} else {
if (level == 49){
enemyType = "Crowded UFOs";
enemyDesc_txt.text = "Overloaded UFO's.";
speed = 3;
maxEnemies = 50;
spawnRate = 0.25;
send_timer.delay = (spawnRate * 1000);
};
};
};
if (((((((level % 5) == 0)) && (!((level == 45))))) && (!((level == 50))))){
if ((((((((((((songPlaying == false)) && ((playmusic == true)))) && (!((level == 30))))) && (!((level == 40))))) && (!((level == 45))))) && (!((level == 50))))){
songPlaying = true;
music_channel = bus_song.play();
};
enemyType = "School Bus";
enemyDesc_txt.text = "A little slow, pretty good defense, no weakness.";
enemy.gotoAndStop(4);
speed = 1.4;
spawnRate = 2.5;
send_timer.delay = (spawnRate * 1000);
maxEnemies = 12;
};
if ((((((((((((((((((((level == 11)) || ((level == 17)))) || ((level == 22)))) || ((level == 30)))) || ((level == 40)))) || ((level == 45)))) || ((level == 46)))) || ((level == 47)))) || ((level == 48)))) || ((level == 50)))){
if ((((songPlaying == false)) && ((playmusic == true)))){
songPlaying = true;
if (level != 50){
music_channel = bossmetal_song.play();
} else {
music_channel = final_song.play();
};
};
if (level == 11){
enemyType = "Boss Truck";
enemyDesc_txt.text = "Super defense, weak against blue towers.";
enemy.gotoAndStop(1);
speed = 1.3;
maxEnemies = 0;
spawnRate = 1.3;
} else {
if (level == 17){
enemyType = "Boss Bus";
enemyDesc_txt.text = "Super defense, a little slow.";
enemy.gotoAndStop(4);
speed = 1.1;
maxEnemies = 0;
spawnRate = 1.3;
} else {
if (level == 22){
enemyType = "Boss UFO";
enemyDesc_txt.text = "Super defense, fast, weak against green towers.";
enemy.gotoAndStop(3);
speed = 2.5;
maxEnemies = 0;
spawnRate = 1.3;
} else {
if (level == 30){
enemyType = "Boss Tank";
enemyDesc_txt.text = "Mega defense, weak against red towers.";
enemy.gotoAndStop(2);
speed = 0.7;
maxEnemies = 0;
spawnRate = 1.3;
} else {
if (level == 40){
enemyType = "Boss Truck";
enemyDesc_txt.text = "Double Boss trucks, weak against blue towers.";
enemy.gotoAndStop(1);
speed = 1.3;
maxEnemies = 1;
spawnRate = 1.5;
} else {
if (level == 45){
enemyType = "Boss Bus";
enemyDesc_txt.text = "Double Boss Bus's.";
enemy.gotoAndStop(4);
speed = 1.1;
maxEnemies = 1;
spawnRate = 8;
} else {
if (level == 46){
enemyType = "Boss UFO";
enemyDesc_txt.text = "Five Boss UFO's.";
enemy.gotoAndStop(3);
speed = 2.5;
maxEnemies = 4;
spawnRate = 2;
} else {
if (level == 47){
enemyType = "Boss Truck";
enemyDesc_txt.text = "Six Boss Trucks.";
enemy.gotoAndStop(1);
speed = 1.2;
maxEnemies = 5;
spawnRate = 3;
} else {
if (level == 48){
enemyType = "Boss Tank";
enemyDesc_txt.text = "Six Boss Tanks.";
enemy.gotoAndStop(2);
speed = 0.9;
maxEnemies = 5;
spawnRate = 5.5;
} else {
if (level == 50){
enemyType = "Final Boss Helicopter";
enemyDesc_txt.text = "Ultimate defense, unnafected by gummy strips.";
enemy.gotoAndStop(6);
speed = 1;
maxEnemies = 0;
spawnRate = 1;
};
};
};
};
};
};
};
};
};
};
send_timer.delay = (spawnRate * 1000);
enemy.scaleX = 1.5;
enemy.scaleY = 1.5;
};
if (level == 21){
if (songPlaying == false){
songPlaying = true;
music_channel = bossmetal_song.play();
};
enemyType = "Red Trucks";
enemyDesc_txt.text = "Immune to blue towers.";
enemy.gotoAndStop(5);
speed = 1.7;
spawnRate = 2;
maxEnemies = 20;
};
enemy_txt.text = ("Enemy: " + enemyType);
enemyHP_txt.text = ("Enemy HP: " + Math.round(health));
eMoney_txt.text = ("Worth: $" + moneyList[level]);
eSpeed_txt.text = ("Speed: " + speed);
eir++;
enemy.x = -20;
enemy.y = 75;
enemy.totalHealth = health;
enemy.health = health;
enemy.counter = 0;
enemy.burning = false;
enemy.burnAmount = 0;
enemy.travel = 0;
enemy.inMotion = false;
enemy.giveMoney = true;
enemy.speed = speed;
enemy.maxSpeed = speed;
enemy.addEventListener(Event.ENTER_FRAME, enemyCheck);
stage.removeEventListener(Event.ENTER_FRAME, engine);
if (eir > maxEnemies){
send_timer.stop();
};
level_txt.text = ("Level: " + level.toString());
}
public function onKDown(_arg1:KeyboardEvent):void{
var _local2:int;
switch (_arg1.keyCode){
case Keyboard.UP:
cheat = 1;
break;
case Keyboard.LEFT:
if (cheat == 1){
cheat = 2;
} else {
if (cheat == 3){
cheat = 4;
_local2 = 0;
while (_local2 < enemyList.length) {
_local2++;
};
level_txt.text = ("Level: " + level.toString());
money_txt.text = ("$" + money.toString());
} else {
cheat = 0;
};
};
break;
case Keyboard.RIGHT:
if (cheat == 2){
cheat = 3;
} else {
cheat = 0;
};
};
}
public function towerInfo(_arg1:MouseEvent):void{
var _local2:int;
var _local3:int;
var _local4:int;
_arg1.target.parent.targeted = true;
name_txt.visible = true;
power_txt.visible = true;
range_txt.visible = true;
rounds_txt.visible = true;
pUpCost_txt.visible = true;
powerUp_btn.visible = true;
powerUp_btn.useHandCursor = true;
rangeUp_btn.useHandCursor = true;
roundsUp_btn.useHandCursor = true;
sell_btn.visible = true;
name_txt.text = _arg1.target.parent.name;
if (_arg1.target.parent.num != 5){
rUpCost_txt.visible = true;
rsUpCost_txt.visible = true;
power_txt.text = ("Power: " + _arg1.target.parent.power);
range_txt.text = ("Range: " + _arg1.target.parent.range);
if (_arg1.target.parent.range <= _arg1.target.parent.maxRange){
rangeUp_btn.visible = true;
rUpCost_txt.text = ((("+" + Math.round((_arg1.target.parent.range / 10))) + " $") + Math.round(((_arg1.target.parent.range / 2) + (_arg1.target.parent.price / 2))));
} else {
rangeUp_btn.useHandCursor = false;
rUpCost_txt.text = "MAX";
};
if (Math.round(((stage.frameRate / _arg1.target.parent.shootRate) * 60)) < _arg1.target.parent.maxRps){
roundsUp_btn.visible = true;
rsUpCost_txt.text = ((("+" + Math.round((((stage.frameRate / (_arg1.target.parent.shootRate - 1)) * 60) - ((stage.frameRate / _arg1.target.parent.shootRate) * 60)))) + " $") + Math.round(((((stage.frameRate / _arg1.target.parent.shootRate) * 60) / 1.5) + (_arg1.target.parent.price / 4))));
} else {
roundsUp_btn.visible = false;
rsUpCost_txt.text = "MAX";
};
rounds_txt.text = ("RPM: " + Math.round(((stage.frameRate / _arg1.target.parent.shootRate) * 60)));
pUpCost_txt.text = ((("+" + Math.round(((_arg1.target.parent.power / 4) + _arg1.target.parent.stockPower))) + " $") + Math.round(((_arg1.target.parent.power * 7.5) - _arg1.target.parent.stockPower)));
} else {
if (_arg1.target.parent.num == 5){
if (_arg1.target.parent.power < 1){
pUpCost_txt.visible = false;
powerUp_btn.visible = false;
pUpCost_txt.text = ((("+" + 0.1) + " $") + Math.round((_arg1.target.parent.power * 750)));
} else {
pUpCost_txt.text = "MAX";
pUpCost_txt.visible = false;
powerUp_btn.visible = false;
};
money_txt.text = ("$" + Math.round(money).toString());
power_txt.text = ("Power: " + (Math.round((_arg1.target.parent.power / 0.01)) * 0.01));
range_txt.text = "";
rounds_txt.text = "";
rUpCost_txt.text = "";
rsUpCost_txt.text = "";
};
};
tower_tester = 0;
road_tester = 0;
if (dragging == true){
_local2 = 0;
while (_local2 < roadList.length) {
if (_arg1.target.parent.num != 5){
if (!_arg1.target.hitTestObject(roadList[_local2])){
road_tester++;
} else {
if (_arg1.target.hitTestObject(roadList[_local2])){
_arg1.target.gotoAndPlay("noplace");
};
};
} else {
if (_arg1.target.parent.num == 5){
if (_arg1.target.hitTestObject(roadList[_local2])){
_arg1.target.stopDrag();
dragging = false;
_arg1.target.parent.dragging = false;
} else {
if (_arg1.target.hitTestObject(grass_mc)){
_local4 = 0;
while (_local4 < roadList.length) {
if (_arg1.target.hitTestObject(roadList[_local4])){
road_tester++;
};
_local4++;
};
if (road_tester == 0){
_arg1.target.gotoAndPlay("noplace");
};
};
};
};
};
_local2++;
};
_local3 = 0;
while (_local3 < towerList.length) {
if (!_arg1.target.hitTestObject(towerList[_local3])){
tower_tester++;
} else {
if (_arg1.target.hitTestObject(towerList[_local3])){
};
};
_local3++;
};
if ((((((((((tower_tester == (towerList.length - 1))) && ((road_tester == roadList.length)))) && (!(_arg1.target.hitTestObject(cmenu_mc))))) && (!(_arg1.target.hitTestObject(dmenu_mc))))) && (!((_arg1.target.parent.num == 5))))){
_arg1.target.stopDrag();
dragging = false;
_arg1.target.parent.dragging = false;
};
};
}
public function bulletCheck(_arg1:Event):void{
_arg1.target.counter++;
if ((stage.frameRate * _arg1.target.displayTime) <= (_arg1.target.counter - 1)){
_arg1.target.removeEventListener(Event.ENTER_FRAME, bulletCheck);
stage.removeChild(DisplayObject(_arg1.target));
} else {
if (enemyList[_arg1.target.targetEnemy] == "[object Enemy]"){
if (_arg1.target.shot_mc.hitTestObject(enemyList[_arg1.target.targetEnemy].enemy_mc)){
explosion = new Explosion();
stage.addChild(explosion);
explosion.gotoAndStop(_arg1.target.bulletSlot);
explosion.x = enemyList[_arg1.target.targetEnemy].x;
explosion.y = enemyList[_arg1.target.targetEnemy].y;
explosion.rotation = Math.round((Math.random() * 360));
explosion.addEventListener(Event.ENTER_FRAME, exCheck);
if (_arg1.target.bulletSlot == enemyList[_arg1.target.targetEnemy].currentFrame){
enemyList[_arg1.target.targetEnemy].health = (enemyList[_arg1.target.targetEnemy].health - (_arg1.target.power / 2.4));
};
if ((((enemyList[_arg1.target.targetEnemy].currentFrame == 5)) && ((_arg1.target.bulletSlot == 1)))){
} else {
enemyList[_arg1.target.targetEnemy].health = (enemyList[_arg1.target.targetEnemy].health - _arg1.target.power);
};
enemyList[_arg1.target.targetEnemy].slot = _arg1.target.targetEnemy;
if (_arg1.target.bulletSlot == 4){
if (enemyList[(_arg1.target.targetEnemy - 1)] == "[object Enemy]"){
enemyList[(_arg1.target.targetEnemy - 1)].health = (enemyList[(_arg1.target.targetEnemy - 1)].health - (_arg1.target.power / 2));
enemyList[(_arg1.target.targetEnemy - 1)].slot = (_arg1.target.targetEnemy - 1);
};
if (enemyList[(_arg1.target.targetEnemy + 1)] == "[object Enemy]"){
enemyList[(_arg1.target.targetEnemy + 1)].health = (enemyList[(_arg1.target.targetEnemy + 1)].health - (_arg1.target.power / 2));
enemyList[(_arg1.target.targetEnemy + 1)].slot = (_arg1.target.targetEnemy + 1);
};
};
_arg1.target.removeEventListener(Event.ENTER_FRAME, bulletCheck);
stage.removeChild(DisplayObject(_arg1.target));
};
};
};
}
public function overListener(_arg1:MouseEvent):void{
var _local2:int;
switch (_arg1.target.name){
case "blueTower_btn":
name_txt.text = "Blue Tower";
power_txt.text = ("Power: " + towerB_power);
range_txt.text = ("Range: " + towerB_range);
rounds_txt.text = ("RPM: " + Math.round(((stage.frameRate / towerB_rate) * 60)));
info_txt.text = "Well rounded, most noted for it's range. Strong against trucks.";
break;
case "redTower_btn":
name_txt.text = "Red Tower";
power_txt.text = ("Power: " + towerR_power);
range_txt.text = ("Range: " + towerR_range);
rounds_txt.text = ("RPM: " + Math.round(((stage.frameRate / towerR_rate) * 60)));
info_txt.text = "It's shots are slow, but it packs a punch. Strong against tanks.";
break;
case "greenTower_btn":
name_txt.text = "Green Tower";
power_txt.text = ("Power: " + towerG_power);
range_txt.text = ("Range: " + towerG_range);
rounds_txt.text = ("RPM: " + Math.round(((stage.frameRate / towerG_rate) * 60)));
info_txt.text = "Shoots very weak shots, but fires them fast. Strong against UFOs.";
break;
case "grayTower_btn":
name_txt.text = "Gray Tower";
power_txt.text = ("Power: " + towerGr_power);
range_txt.text = ("Range: " + towerGr_range);
rounds_txt.text = ("RPM: " + Math.round(((stage.frameRate / towerGr_rate) * 60)));
info_txt.text = "Shoots super strong shots, does 1/2 damage to enemy in front and in back of target.";
break;
case "gumStrip_btn":
name_txt.text = "Gummy Strip";
power_txt.text = ("Slow: " + gumSlow);
range_txt.text = "";
rounds_txt.text = "";
info_txt.text = "Place these on the road to to subtract enemy speed.";
break;
case "yellowTower_btn":
name_txt.text = "Yellow Tower";
power_txt.text = ("Power: " + towerY_power);
range_txt.text = ("Range: " + towerY_range);
rounds_txt.text = ("RPM: " + Math.round(((stage.frameRate / towerY_rate) * 60)));
info_txt.text = "Can shoot up to 4 enemies within it's range.";
break;
};
if ((((((((((((_arg1.target.name == "blueTower_btn")) || ((_arg1.target.name == "redTower_btn")))) || ((_arg1.target.name == "greenTower_btn")))) || ((_arg1.target.name == "grayTower_btn")))) || ((_arg1.target.name == "gumStrip_btn")))) || ((_arg1.target.name == "yellowTower_btn")))){
mousedOver = true;
name_txt.visible = true;
power_txt.visible = true;
range_txt.visible = true;
rounds_txt.visible = true;
info_txt.visible = true;
_local2 = 0;
while (_local2 < towerList.length) {
towerList[_local2].targeted = false;
_local2++;
};
};
}
}
}//package towertest5_fla
Section 27
//manholeanimation_54 (towertest5_fla.manholeanimation_54)
package towertest5_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class manholeanimation_54 extends MovieClip {
public function manholeanimation_54(){
addFrameScript(0, frame1);
}
public function onManholeEnter(_arg1:Event):void{
if ((((MovieClip(root).enemyList == 0)) && ((this.currentFrame == 1)))){
this.play();
} else {
if ((((this.currentFrame == 1)) && (!((MovieClip(root).enemyList == 0))))){
this.stop();
};
};
}
function frame1(){
this.addEventListener(Event.ENTER_FRAME, onManholeEnter);
}
}
}//package towertest5_fla
Section 28
//on_67 (towertest5_fla.on_67)
package towertest5_fla {
import flash.display.*;
public dynamic class on_67 extends MovieClip {
public function on_67(){
addFrameScript(0, frame1, 1, frame2);
}
function frame1(){
stop();
}
function frame2(){
stop();
}
}
}//package towertest5_fla
Section 29
//road_51 (towertest5_fla.road_51)
package towertest5_fla {
import flash.events.*;
import flash.display.*;
import flash.geom.*;
import flash.media.*;
import flash.utils.*;
import flash.text.*;
import flash.net.*;
import flash.system.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.printing.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class road_51 extends MovieClip {
public var road_mc:MovieClip;
public function road_51(){
addFrameScript(0, frame1);
}
function frame1(){
MovieClip(root).roadList.push(this);
}
}
}//package towertest5_fla
Section 30
//skipmovieclip_49 (towertest5_fla.skipmovieclip_49)
package towertest5_fla {
import flash.display.*;
public dynamic class skipmovieclip_49 extends MovieClip {
public var skip_btn:SimpleButton;
public function skipmovieclip_49(){
addFrameScript(59, frame60, 79, frame80);
}
function frame80(){
stop();
}
function frame60(){
stop();
}
}
}//package towertest5_fla
Section 31
//yellowtowerinside_69 (towertest5_fla.yellowtowerinside_69)
package towertest5_fla {
import flash.display.*;
public dynamic class yellowtowerinside_69 extends MovieClip {
public function yellowtowerinside_69(){
addFrameScript(0, frame1, 5, frame6, 11, frame12);
}
function frame12(){
gotoAndStop(1);
}
function frame6(){
gotoAndStop(1);
}
function frame1(){
stop();
}
}
}//package towertest5_fla
Section 32
//BlueCannon (BlueCannon)
package {
import flash.display.*;
public dynamic class BlueCannon extends MovieClip {
}
}//package
Section 33
//Bossmetal (Bossmetal)
package {
import flash.media.*;
public dynamic class Bossmetal extends Sound {
}
}//package
Section 34
//Btower (Btower)
package {
import flash.display.*;
public dynamic class Btower extends MovieClip {
public var tower_mc:MovieClip;
public function Btower(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 35
//Bullet (Bullet)
package {
import flash.display.*;
public dynamic class Bullet extends MovieClip {
public var shot_mc:MovieClip;
}
}//package
Section 36
//BusStreet (BusStreet)
package {
import flash.media.*;
public dynamic class BusStreet extends Sound {
}
}//package
Section 37
//Coin (Coin)
package {
import flash.display.*;
public dynamic class Coin extends MovieClip {
}
}//package
Section 38
//Enemy (Enemy)
package {
import flash.display.*;
public dynamic class Enemy extends MovieClip {
public var health_mc:MovieClip;
public var enemy_mc:MovieClip;
public function Enemy(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6);
}
function frame3(){
stop();
}
function frame1(){
stop();
}
function frame6(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame2(){
stop();
}
}
}//package
Section 39
//Explosion (Explosion)
package {
import flash.display.*;
public dynamic class Explosion extends MovieClip {
public var explosion_mc:MovieClip;
public function Explosion(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 5, frame6);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame2(){
stop();
}
}
}//package
Section 40
//FinalMetal (FinalMetal)
package {
import flash.media.*;
public dynamic class FinalMetal extends Sound {
}
}//package
Section 41
//GameDone (GameDone)
package {
import flash.display.*;
public dynamic class GameDone extends MovieClip {
}
}//package
Section 42
//GameOver (GameOver)
package {
import flash.display.*;
public dynamic class GameOver extends MovieClip {
public var restart_btn:SimpleButton;
}
}//package
Section 43
//Grtower (Grtower)
package {
import flash.display.*;
public dynamic class Grtower extends MovieClip {
public var tower_mc:MovieClip;
}
}//package
Section 44
//Gstrip (Gstrip)
package {
import flash.display.*;
public dynamic class Gstrip extends MovieClip {
public var tower_mc:MovieClip;
public function Gstrip(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 45
//Gtower (Gtower)
package {
import flash.display.*;
public dynamic class Gtower extends MovieClip {
public var tower_mc:MovieClip;
public function Gtower(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 46
//Hiphop (Hiphop)
package {
import flash.media.*;
public dynamic class Hiphop extends Sound {
}
}//package
Section 47
//Menu (Menu)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Menu extends MovieClip {
public var powerUp_btn:SimpleButton;
public var power_txt:TextField;
public var lives_txt:TextField;
public var enemy_txt:TextField;
public var pUpCost_txt:TextField;
public var enemyHP_txt:TextField;
public var enemyDesc_txt:TextField;
public var rangeUp_btn:SimpleButton;
public var money_txt:TextField;
public var range_txt:TextField;
public var eSpeed_txt:TextField;
public var eMoney_txt:TextField;
public var roundsUp_btn:SimpleButton;
public var name_txt:TextField;
public var rUpCost_txt:TextField;
public var continue_btn:SimpleButton;
public var rounds_txt:TextField;
public var rsUpCost_txt:TextField;
public function Menu(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8);
}
function frame3(){
stop();
}
function frame6(){
stop();
}
function frame1(){
stop();
}
function frame4(){
stop();
}
function frame5(){
stop();
}
function frame8(){
stop();
}
function frame2(){
stop();
}
function frame7(){
stop();
}
}
}//package
Section 48
//Range (Range)
package {
import flash.display.*;
public dynamic class Range extends MovieClip {
}
}//package
Section 49
//Rtower (Rtower)
package {
import flash.display.*;
public dynamic class Rtower extends MovieClip {
public var tower_mc:MovieClip;
public function Rtower(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package
Section 50
//SimpleClick (SimpleClick)
package {
import flash.media.*;
public dynamic class SimpleClick extends Sound {
}
}//package
Section 51
//Tankmetal (Tankmetal)
package {
import flash.media.*;
public dynamic class Tankmetal extends Sound {
}
}//package
Section 52
//UFOstreet (UFOstreet)
package {
import flash.media.*;
public dynamic class UFOstreet extends Sound {
}
}//package
Section 53
//Ytower (Ytower)
package {
import flash.display.*;
public dynamic class Ytower extends MovieClip {
public var tower_mc:MovieClip;
}
}//package