Section 1
//BGImages_6 (BubbleSifter__fla.BGImages_6)
package BubbleSifter__fla {
import flash.display.*;
public dynamic class BGImages_6 extends MovieClip {
public function BGImages_6(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package BubbleSifter__fla
Section 2
//Bubble_63 (BubbleSifter__fla.Bubble_63)
package BubbleSifter__fla {
import flash.display.*;
public dynamic class Bubble_63 extends MovieClip {
public var hit:MovieClip;
public function Bubble_63(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package BubbleSifter__fla
Section 3
//Instructions_39 (BubbleSifter__fla.Instructions_39)
package BubbleSifter__fla {
import flash.events.*;
import flash.display.*;
public dynamic class Instructions_39 extends MovieClip {
public var nextStep:MovieClip;
public var startGame:MovieClip;
public var prevStep:MovieClip;
public function Instructions_39(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5);
}
function frame1(){
stop();
nextStep.buttonMode = true;
nextStep.addEventListener(MouseEvent.CLICK, nextClick);
}
function frame2(){
stop();
prevStep.buttonMode = true;
prevStep.addEventListener(MouseEvent.CLICK, prevClick);
nextStep.buttonMode = true;
nextStep.addEventListener(MouseEvent.CLICK, nextClick);
}
function frame3(){
stop();
prevStep.buttonMode = true;
prevStep.addEventListener(MouseEvent.CLICK, prevClick);
nextStep.buttonMode = true;
nextStep.addEventListener(MouseEvent.CLICK, nextClick);
}
function frame4(){
stop();
prevStep.buttonMode = true;
prevStep.addEventListener(MouseEvent.CLICK, prevClick);
nextStep.buttonMode = true;
nextStep.addEventListener(MouseEvent.CLICK, nextClick);
}
public function prevClick(_arg1:MouseEvent){
this.prevFrame();
}
function frame5(){
stop();
prevStep.buttonMode = true;
prevStep.addEventListener(MouseEvent.CLICK, prevClick);
startGame.buttonMode = true;
startGame.addEventListener(MouseEvent.CLICK, startGameFn);
}
public function nextClick(_arg1:MouseEvent){
this.nextFrame();
}
public function startGameFn(_arg1:MouseEvent){
this.gotoAndStop(1);
this.y = -710;
}
}
}//package BubbleSifter__fla
Section 4
//New_Canon_1_10 (BubbleSifter__fla.New_Canon_1_10)
package BubbleSifter__fla {
import flash.display.*;
public dynamic class New_Canon_1_10 extends MovieClip {
public function New_Canon_1_10(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package BubbleSifter__fla
Section 5
//SoundBtn_21 (BubbleSifter__fla.SoundBtn_21)
package BubbleSifter__fla {
import flash.display.*;
public dynamic class SoundBtn_21 extends MovieClip {
public function SoundBtn_21(){
addFrameScript(0, frame1);
}
function frame1(){
stop();
}
}
}//package BubbleSifter__fla
Section 6
//Vr_LogoContainer_25 (BubbleSifter__fla.Vr_LogoContainer_25)
package BubbleSifter__fla {
import flash.display.*;
public dynamic class Vr_LogoContainer_25 extends MovieClip {
public var lavr_link:String;
public var shade:Number;
public function Vr_LogoContainer_25(){
addFrameScript(0, frame1, 1, frame2, 2, frame3, 3, frame4, 4, frame5, 5, frame6, 6, frame7, 7, frame8, 8, frame9, 9, frame10, 10, frame11, 11, frame12, 12, frame13, 13, frame14, 14, frame15, 15, frame16, 16, frame17, 17, frame18, 18, frame19, 19, frame20, 20, frame21, 21, frame22, 22, frame23, 23, frame24, 24, frame25, 25, frame26, 26, frame27, 27, frame28, 28, frame29, 29, frame30, 30, frame31, 31, frame32, 32, frame33, 33, frame34, 34, frame35, 35, frame36, 36, frame37, 37, frame38, 38, frame39, 39, frame40, 40, frame41, 41, frame42, 42, frame43, 43, frame44, 44, frame45, 45, frame46, 46, frame47, 47, frame48, 48, frame49, 49, frame50, 50, frame51, 51, frame52, 52, frame53, 53, frame54, 54, frame55, 55, frame56, 56, frame57, 57, frame58, 58, frame59, 59, frame60, 60, frame61, 61, frame62, 62, frame63, 63, frame64, 64, frame65, 65, frame66, 66, frame67, 67, frame68, 68, frame69, 69, frame70, 70, frame71, 71, frame72, 72, frame73, 73, frame74, 74, frame75);
}
function frame63(){
lavr_link = "http://www.octogames.com/";
shade = 2;
}
function frame64(){
lavr_link = "http://www.ugotgames.com/";
shade = 1;
}
function frame70(){
lavr_link = "http://www.bijuegos.com";
shade = 2;
}
function frame71(){
lavr_link = "http://www.mofunzone.com";
shade = 2;
}
function frame73(){
lavr_link = "http://www.y8.com/";
shade = 1;
}
function frame30(){
lavr_link = "http://www.t45ol.com";
shade = 2;
}
function frame31(){
lavr_link = "http://www.thegamesonline.com/";
shade = 1;
}
function frame32(){
lavr_link = "http://www.ultimatearcade.com";
shade = 1;
}
function frame33(){
lavr_link = "http://www.girlgames4u.com/";
shade = 1;
}
function frame34(){
lavr_link = "http://www.gamesfree.ca/";
shade = 1;
}
function frame35(){
lavr_link = "http://www.stickpage.com/";
shade = 1;
}
function frame37(){
lavr_link = "http://www.flashgames.it/";
shade = 1;
}
function frame38(){
lavr_link = "http://www.gamesgirl.ca/";
shade = 1;
}
function frame39(){
lavr_link = "http://www.hallpass.com/";
shade = 2;
}
function frame36(){
lavr_link = "http://www.gamespond.net/";
shade = 2;
}
function frame74(){
lavr_link = "http://www.y3.com/";
shade = 1;
}
function frame75(){
lavr_link = "http://flash.178.com/";
shade = 0;
}
function frame72(){
lavr_link = "http://www.freegamespy.com/";
shade = 2;
}
function frame40(){
lavr_link = "http://www.addictinggames.com/";
shade = 1;
}
function frame41(){
lavr_link = "http://www.benz.be";
shade = 2;
}
function frame42(){
lavr_link = "http://www.net-games.co.il/";
shade = 1;
}
function frame43(){
lavr_link = "http://www.net-games.biz/";
shade = 1;
}
function frame45(){
lavr_link = "http://www.komikler.com/index.php";
shade = 2;
}
function frame46(){
lavr_link = "http://www.twizl.com/";
shade = 1;
}
function frame47(){
lavr_link = "http://www.a10.com/";
shade = 1;
}
function frame48(){
lavr_link = "http://www.bonniegames.com/";
shade = 1;
}
function frame49(){
lavr_link = "http://www.ug2.com/";
shade = 0;
}
function frame44(){
lavr_link = "http://www.pinkyarcade.com/";
shade = 1;
}
function frame50(){
lavr_link = "http://www.agame.com";
shade = 1;
}
function frame51(){
lavr_link = "http://www.gamesclub.com/";
shade = 1;
}
function frame52(){
lavr_link = "http://www.killhours.com/";
shade = 1;
}
function frame53(){
lavr_link = "http://www.flasharcadegamessite.com/";
shade = 1;
}
function frame10(){
lavr_link = "http://www.2flashgames.com";
shade = 2;
}
function frame11(){
lavr_link = "http://www.flashninjaclan.com";
shade = 1;
}
function frame12(){
lavr_link = "http://www.dailyaddictinggames.com/";
shade = 1;
}
function frame13(){
lavr_link = "http://www.funny-games.biz";
shade = 1;
}
function frame14(){
lavr_link = "http://www.gameitnow.com";
shade = 2;
}
function frame15(){
lavr_link = "http://www.gamesplz.com";
shade = 2;
}
function frame16(){
lavr_link = "http://www.onjogos.com.br";
shade = 1;
}
function frame17(){
lavr_link = "http://www.gamesfreak.net";
shade = 2;
}
function frame18(){
lavr_link = "http://www.stoneagegames.com";
shade = 1;
}
function frame19(){
lavr_link = "http://www.jarkey.net";
shade = 2;
}
function frame57(){
lavr_link = "http://www.flash-games.net/";
shade = 1;
}
function frame58(){
lavr_link = "http://www.flash-game.net/";
shade = 1;
}
function frame59(){
lavr_link = "http://www.kingofgames.net";
shade = 1;
}
function frame54(){
lavr_link = "http://www.roundgames.com/";
shade = 2;
}
function frame55(){
lavr_link = "http://www.arcadegangsta.com/";
shade = 1;
}
function frame56(){
lavr_link = "http://www.gamebusted.com/";
shade = 0;
}
function frame1(){
lavr_link = "http://www.neodelight.com";
shade = 1;
}
function frame2(){
lavr_link = "http://www.andkon.com";
shade = 2;
}
function frame3(){
lavr_link = "http://www.anyad.rulez.org";
shade = 1;
}
function frame4(){
lavr_link = "http://www.girldressupgames.biz";
shade = 1;
}
function frame5(){
lavr_link = "http://www.bringler.com";
shade = 1;
}
function frame6(){
lavr_link = "http://www.bubblebox.com";
shade = 1;
}
function frame7(){
lavr_link = "http://www.bunnygames.com";
shade = 1;
}
function frame20(){
lavr_link = "http://www.gamesgames.com/";
shade = 1;
}
function frame9(){
lavr_link = "http://www.directgamez.com";
shade = 2;
}
function frame22(){
lavr_link = "http://www.microjogos.com";
shade = 1;
}
function frame23(){
lavr_link = "http://www.minijuegos.com";
shade = 2;
}
function frame24(){
lavr_link = "http://www.oyunskor.com/";
shade = 1;
}
function frame25(){
lavr_link = "http://www.mostfungames.com";
shade = 2;
}
function frame26(){
lavr_link = "http://www.gameshot.org";
shade = 1;
}
function frame8(){
lavr_link = "http://www.dailyfreegames.com";
shade = 1;
}
function frame21(){
lavr_link = "http://www.keepbusy.net";
shade = 1;
}
function frame29(){
lavr_link = "http://www.spele.nl";
shade = 1;
}
function frame67(){
lavr_link = "http://www.kraloyun.com/";
shade = 0;
}
function frame60(){
lavr_link = "http://www.stungames.com/";
shade = 2;
}
function frame61(){
lavr_link = "http://www.123spill.no/";
shade = 1;
}
function frame62(){
lavr_link = "http://www.dailygames.com/";
shade = 1;
}
function frame27(){
lavr_link = "http://www.online-games-zone.com/";
shade = 2;
}
function frame28(){
lavr_link = "http://www.puffgames.com";
shade = 2;
}
function frame65(){
lavr_link = "http://www.fupa.com/";
shade = 1;
}
function frame66(){
lavr_link = "http://www.kibagames.com/";
shade = 0;
}
function frame68(){
lavr_link = "http://www.spielaffe.de/";
shade = 0;
}
function frame69(){
lavr_link = "http://www.39games.com";
shade = 2;
}
}
}//package BubbleSifter__fla
Section 7
//Vr_MainContainer_24 (BubbleSifter__fla.Vr_MainContainer_24)
package BubbleSifter__fla {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.text.*;
import flash.system.*;
import flash.geom.*;
import adobe.utils.*;
import flash.accessibility.*;
import flash.errors.*;
import flash.external.*;
import flash.filters.*;
import flash.media.*;
import flash.printing.*;
import flash.profiler.*;
import flash.sampler.*;
import flash.ui.*;
import flash.xml.*;
public dynamic class Vr_MainContainer_24 extends MovieClip {
public var lavr:Number;
public var boxx:MovieClip;
public function Vr_MainContainer_24(){
addFrameScript(0, frame1, 19, frame20);
}
public function mOut(_arg1:MouseEvent){
_arg1.target.parent.gotoAndPlay(21);
}
public function mOver(_arg1:MouseEvent){
_arg1.target.parent.gotoAndPlay(2);
}
function frame20(){
stop();
}
function frame1(){
lavr = 34;
this.addEventListener(Event.ENTER_FRAME, enterFrameHandler);
boxx.buttonMode = true;
boxx.addEventListener(MouseEvent.ROLL_OVER, mOver);
boxx.addEventListener(MouseEvent.ROLL_OUT, mOut);
boxx.addEventListener(MouseEvent.CLICK, mClick);
stop();
}
public function enterFrameHandler(_arg1:Event){
boxx.gotoAndStop(lavr);
if (lavr != 0){
this.alpha = 100;
} else {
this.alpha = 0;
};
}
public function mClick(_arg1:MouseEvent){
navigateToURL(new URLRequest(boxx.lavr_link), "_blank");
}
}
}//package BubbleSifter__fla
Section 8
//Regular (fl.transitions.easing.Regular)
package fl.transitions.easing {
public class Regular {
public static function easeOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((-(_arg3) * _arg1) * (_arg1 - 2)) + _arg2));
}
public static function easeIn(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / _arg4);
return ((((_arg3 * _arg1) * _arg1) + _arg2));
}
public static function easeInOut(_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
_arg1 = (_arg1 / (_arg4 / 2));
if (_arg1 < 1){
return (((((_arg3 / 2) * _arg1) * _arg1) + _arg2));
};
--_arg1;
return ((((-(_arg3) / 2) * ((_arg1 * (_arg1 - 2)) - 1)) + _arg2));
}
}
}//package fl.transitions.easing
Section 9
//Tween (fl.transitions.Tween)
package fl.transitions {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
public class Tween extends EventDispatcher {
private var _position:Number;// = NAN
public var prevTime:Number;// = NAN
public var prevPos:Number;// = NAN
public var isPlaying:Boolean;// = false
private var _fps:Number;// = NAN
private var _time:Number;// = NAN
public var begin:Number;// = NAN
private var _finish:Number;// = NAN
public var change:Number;// = NAN
public var looping:Boolean;// = false
private var _intervalID:uint;// = 0
public var func:Function;
private var _timer:Timer;// = null
private var _startTime:Number;// = NAN
public var prop:String;// = ""
private var _duration:Number;// = NAN
public var obj:Object;// = null
public var useSeconds:Boolean;// = false
protected static var _mc:MovieClip = new MovieClip();
public function Tween(_arg1:Object, _arg2:String, _arg3:Function, _arg4:Number, _arg5:Number, _arg6:Number, _arg7:Boolean=false){
this.func = function (_arg1:Number, _arg2:Number, _arg3:Number, _arg4:Number):Number{
return ((((_arg3 * _arg1) / _arg4) + _arg2));
};
super();
if (!arguments.length){
return;
};
this.obj = _arg1;
this.prop = _arg2;
this.begin = _arg4;
this.position = _arg4;
this.duration = _arg6;
this.useSeconds = _arg7;
if ((_arg3 is Function)){
this.func = _arg3;
};
this.finish = _arg5;
this._timer = new Timer(100);
this.start();
}
public function continueTo(_arg1:Number, _arg2:Number):void{
this.begin = this.position;
this.finish = _arg1;
if (!isNaN(_arg2)){
this.duration = _arg2;
};
this.start();
}
protected function startEnterFrame():void{
var _local1:Number;
if (isNaN(this._fps)){
_mc.addEventListener(Event.ENTER_FRAME, this.onEnterFrame, false, 0, true);
} else {
_local1 = (1000 / this._fps);
this._timer.delay = _local1;
this._timer.addEventListener(TimerEvent.TIMER, this.timerHandler, false, 0, true);
this._timer.start();
};
this.isPlaying = true;
}
public function stop():void{
this.stopEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_STOP, this._time, this._position));
}
private function fixTime():void{
if (this.useSeconds){
this._startTime = (getTimer() - (this._time * 1000));
};
}
public function set FPS(_arg1:Number):void{
var _local2:Boolean = this.isPlaying;
this.stopEnterFrame();
this._fps = _arg1;
if (_local2){
this.startEnterFrame();
};
}
public function get finish():Number{
return ((this.begin + this.change));
}
public function get duration():Number{
return (this._duration);
}
protected function stopEnterFrame():void{
if (isNaN(this._fps)){
_mc.removeEventListener(Event.ENTER_FRAME, this.onEnterFrame);
} else {
this._timer.stop();
};
this.isPlaying = false;
}
public function set time(_arg1:Number):void{
this.prevTime = this._time;
if (_arg1 > this.duration){
if (this.looping){
this.rewind((_arg1 - this._duration));
this.update();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_LOOP, this._time, this._position));
} else {
if (this.useSeconds){
this._time = this._duration;
this.update();
};
this.stop();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_FINISH, this._time, this._position));
};
} else {
if (_arg1 < 0){
this.rewind();
this.update();
} else {
this._time = _arg1;
this.update();
};
};
}
public function getPosition(_arg1:Number=NaN):Number{
if (isNaN(_arg1)){
_arg1 = this._time;
};
return (this.func(_arg1, this.begin, this.change, this._duration));
}
public function set finish(_arg1:Number):void{
this.change = (_arg1 - this.begin);
}
public function set duration(_arg1:Number):void{
this._duration = ((_arg1)<=0) ? Infinity : _arg1;
}
public function get position():Number{
return (this.getPosition(this._time));
}
public function setPosition(_arg1:Number):void{
this.prevPos = this._position;
if (this.prop.length){
this.obj[this.prop] = (this._position = _arg1);
};
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_CHANGE, this._time, this._position));
}
public function resume():void{
this.fixTime();
this.startEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_RESUME, this._time, this._position));
}
public function fforward():void{
this.time = this._duration;
this.fixTime();
}
protected function onEnterFrame(_arg1:Event):void{
this.nextFrame();
}
public function yoyo():void{
this.continueTo(this.begin, this.time);
}
public function nextFrame():void{
if (this.useSeconds){
this.time = ((getTimer() - this._startTime) / 1000);
} else {
this.time = (this._time + 1);
};
}
protected function timerHandler(_arg1:TimerEvent):void{
this.nextFrame();
_arg1.updateAfterEvent();
}
public function get FPS():Number{
return (this._fps);
}
public function rewind(_arg1:Number=0):void{
this._time = _arg1;
this.fixTime();
this.update();
}
public function set position(_arg1:Number):void{
this.setPosition(_arg1);
}
public function get time():Number{
return (this._time);
}
private function update():void{
this.setPosition(this.getPosition(this._time));
}
public function start():void{
this.rewind();
this.startEnterFrame();
this.dispatchEvent(new TweenEvent(TweenEvent.MOTION_START, this._time, this._position));
}
public function prevFrame():void{
if (!this.useSeconds){
this.time = (this._time - 1);
};
}
}
}//package fl.transitions
Section 10
//TweenEvent (fl.transitions.TweenEvent)
package fl.transitions {
import flash.events.*;
public class TweenEvent extends Event {
public var position:Number;// = NAN
public var time:Number;// = NAN
public static const MOTION_START:String = "motionStart";
public static const MOTION_STOP:String = "motionStop";
public static const MOTION_LOOP:String = "motionLoop";
public static const MOTION_CHANGE:String = "motionChange";
public static const MOTION_FINISH:String = "motionFinish";
public static const MOTION_RESUME:String = "motionResume";
public function TweenEvent(_arg1:String, _arg2:Number, _arg3:Number, _arg4:Boolean=false, _arg5:Boolean=false){
super(_arg1, _arg4, _arg5);
this.time = _arg2;
this.position = _arg3;
}
override public function clone():Event{
return (new TweenEvent(this.type, this.time, this.position, this.bubbles, this.cancelable));
}
}
}//package fl.transitions
Section 11
//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 clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {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;
var ad_timeout:Number = 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();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = 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);
};
var sendHostProgress:Boolean;
mc.regContLC = function (_arg1:String):void{
mc._containerLCName = _arg1;
};
chk["onEnterFrame"] = function ():void{
var _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
return;
};
var _local1:Object = this.parent._mochiad_ctr;
var _local2:Number = (getTimer() - this.started);
var _local3:Boolean;
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 = _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 clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {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;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
delete options.ad_timeout;
var fadeout_time:Number = 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();
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = 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{
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var _local1:Number = (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 = 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 _local4:Number;
if (!this.parent){
delete this.onEnterFrame;
delete this.fadeFunction;
return;
};
var _local1:Object = this.parent._mochiad_ctr;
var _local2:Number = (getTimer() - this.started);
var _local3:Boolean;
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 _local4:String;
var _local5:Array;
var _local6:Number;
var _local7:Array;
var _local3:Object = {};
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 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);
};
var idx:Number = 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 clip:Object;
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;
var DEFAULTS:Object = {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 (!(clip is DisplayObject)){
trace("Warning: Object passed as container clip not a descendant of the DisplayObject type");
return (null);
};
if (MovieClip(clip).stage == null){
trace("Warning: Container clip for ad is not attached to the stage");
return (null);
};
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."));
};
var depth:Number = options.depth;
delete options.depth;
var mc:MovieClip = createEmptyMovieClip(clip, "_mochiad", depth);
var wh:Array = 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");
};
var lv:URLVariables = 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");
});
if (!options.skip){
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 = _arg2.split(".");
var _local5:Number = 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 = 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 _local6:Array;
var _local3:Object = _arg2.getBounds(_arg2.root);
var _local4:Number = 0;
var _local5:Number = 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 = _arg2.split(".");
var _local4:Number = 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 = _arg2.split(".");
var _local5:Number = 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 clip:Object;
var mc:MovieClip;
var chk:MovieClip;
var complete:Boolean;
var unloaded:Boolean;
var sendHostProgress:Boolean;
var fn:Function;
var r:MovieClip;
var options = _arg1;
var DEFAULTS:Object = {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{
}, progress_override:function (_arg1:Object):Number{
return (NaN);
}, 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;
var ad_msec:Number = 11000;
var ad_timeout:Number = options.ad_timeout;
if (options.skip){
ad_timeout = 0;
};
delete options.ad_timeout;
var fadeout_time:Number = 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);
var fn:Function = function ():void{
options.ad_finished();
};
setTimeout(fn, 100);
};
var wh:Array = MochiAd._getRes(options, clip);
var w:Number = wh[0];
var h:Number = 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);
var bar:MovieClip = 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);
};
var bar_w:Number = ((w - bar.x) - 10);
var bar_color:Number = options.color;
delete options.color;
var bar_background:Number = options.background;
delete options.background;
var bar_outline:Number = options.outline;
delete options.outline;
var backing_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 1);
var backing:Object = 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();
var inside_mc:MovieClip = createEmptyMovieClip(bar, "_inside", 2);
var inside:Object = 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;
var outline_mc:MovieClip = createEmptyMovieClip(bar, "_outline", 3);
var outline:Object = 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 = (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;
var progress:Number = Math.min(1, options.progress_override(clip));
var f:Function = function (_arg1:Event):void{
_arg1.target.removeEventListener(_arg1.type, arguments.callee);
complete = true;
if (unloaded){
MochiAd.unload(clip);
};
};
if (!isNaN(progress)){
complete = (progress == 1);
} else {
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 = 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 _local12:Number;
if (((!(this.parent)) || (!(this.parent.parent)))){
delete this["onEnterFrame"];
return;
};
var _local1:Object = this.parent.parent.root;
var _local2:Object = this.parent._mochiad_ctr;
var _local3:Number = (getTimer() - this.started);
var _local4:Boolean;
var _local5:Number = _local1.loaderInfo.bytesTotal;
var _local6:Number = _local1.loaderInfo.bytesLoaded;
var _local7:Number = Math.min(1, options.progress_override(_local1));
if (_local7 == 1){
complete = true;
};
if (complete){
_local6 = Math.max(1, _local6);
_local5 = _local6;
};
var _local8:Number = ((100 * _local6) / _local5);
if (!isNaN(_local7)){
_local8 = (100 * _local7);
};
var _local9:Number = ((100 * _local3) / chk.ad_msec);
var _local10:Object = this._mochiad_bar._inside;
var _local11:Number = Math.min(100, Math.min(((_local8) || (0)), _local9));
_local11 = Math.max(this.last_pcnt, _local11);
this.last_pcnt = _local11;
_local10.scaleX = (_local11 * 0.01);
options.ad_progress(_local11);
if (sendHostProgress){
clip._mochiad.lc.send(clip._mochiad._containerLCName, "notify", {id:"hostLoadPcnt", pcnt:_local8});
if (_local8 >= 100){
sendHostProgress = false;
};
};
if (!chk.showing){
_local12 = this.parent._mochiad_ctr.contentLoaderInfo.bytesTotal;
if (_local12 > 0){
chk.showing = true;
chk.started = getTimer();
MochiAd.adShowing(clip);
} else {
if ((((_local3 > chk.ad_timeout)) && ((_local8 == 100)))){
options.ad_failed();
_local4 = true;
};
};
};
if (_local3 > chk.ad_msec){
_local4 = true;
};
if (((complete) && (_local4))){
if (unloaded){
MochiAd.unload(_local1);
} else {
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 mc = _arg1;
var f:Function = 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 12
//MochiCoins (mochi.as3.MochiCoins)
package mochi.as3 {
public class MochiCoins {
public static const STORE_HIDE:String = "StoreHide";
public static const NO_USER:String = "NoUser";
public static const IO_ERROR:String = "IOError";
public static const ITEM_NEW:String = "ItemNew";
public static const ITEM_OWNED:String = "ItemOwned";
public static const STORE_ITEMS:String = "StoreItems";
public static const ERROR:String = "Error";
public static const STORE_SHOW:String = "StoreShow";
public static var _inventory:MochiInventory;
public static function triggerEvent(_arg1:String, _arg2:Object):void{
MochiSocial.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
MochiSocial.removeEventListener(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
MochiSocial.addEventListener(_arg1, _arg2);
}
public static function getStoreItems():void{
MochiServices.send("coins_getStoreItems");
}
public static function get inventory():MochiInventory{
return (_inventory);
}
public static function showStore(_arg1:Object=null):void{
MochiServices.bringToTop();
MochiServices.send("coins_showStore", {options:_arg1}, null, null);
}
public static function showItem(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showItem call must pass an Object with an item key");
return;
};
MochiServices.bringToTop();
MochiServices.send("coins_showItem", {options:_arg1}, null, null);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function showVideo(_arg1:Object=null):void{
if (((!(_arg1)) || (!((typeof(_arg1.item) == "string"))))){
trace("ERROR: showVideo call must pass an Object with an item key");
return;
};
MochiServices.bringToTop();
MochiServices.send("coins_showVideo", {options:_arg1}, null, null);
}
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_inventory = new MochiInventory();
});
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_inventory = null;
});
}
}//package mochi.as3
Section 13
//MochiDigits (mochi.as3.MochiDigits)
package mochi.as3 {
public final class MochiDigits {
private var Sibling:MochiDigits;
private var Fragment:Number;
private var Encoder:Number;
public function MochiDigits(_arg1:Number=0, _arg2:uint=0):void{
Encoder = 0;
setValue(_arg1, _arg2);
}
public function reencode():void{
var _local1:uint = int((2147483647 * Math.random()));
Fragment = (Fragment ^ (_local1 ^ Encoder));
Encoder = _local1;
}
public function set value(_arg1:Number):void{
setValue(_arg1);
}
public function toString():String{
var _local1:String = String.fromCharCode((Fragment ^ Encoder));
if (Sibling != null){
_local1 = (_local1 + Sibling.toString());
};
return (_local1);
}
public function setValue(_arg1:Number=0, _arg2:uint=0):void{
var _local3:String = _arg1.toString();
var _temp1 = _arg2;
_arg2 = (_arg2 + 1);
Fragment = (_local3.charCodeAt(_temp1) ^ Encoder);
if (_arg2 < _local3.length){
Sibling = new MochiDigits(_arg1, _arg2);
} else {
Sibling = null;
};
reencode();
}
public function get value():Number{
return (Number(this.toString()));
}
public function addValue(_arg1:Number):void{
value = (value + _arg1);
}
}
}//package mochi.as3
Section 14
//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 15
//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 _local4:Object;
var _local3:Object = {};
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 = (new Date().time - gameStart);
trigger("end_game", {time:_local1});
}
public static function startGame():void{
gameStart = new Date().time;
trigger("start_game");
}
public static function trigger(_arg1:String, _arg2:Object=null):void{
if (_arg2 == null){
_arg2 = {};
} else {
if (_arg2["kind"] != undefined){
trace("WARNING: optional arguments package contains key 'id', it will be overwritten");
_arg2["kind"] = _arg1;
};
};
MochiServices.send("events_triggerEvent", {eventObject:_arg2}, null, null);
}
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function startLevel():void{
levelStart = new Date().time;
trigger("start_level");
}
public static function endLevel():void{
var _local1:Number = (new Date().time - levelStart);
trigger("end_level", {time:_local1});
}
}
}//package mochi.as3
Section 16
//MochiInventory (mochi.as3.MochiInventory)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
public dynamic class MochiInventory extends Proxy {
private var _timer:Timer;
private var _names:Array;
private var _syncID:Number;
private var _consumableProperties:Object;
private var _storeSync:Object;
private var _outstandingID:Number;
private var _syncPending:Boolean;
public static const READY:String = "InvReady";
public static const ERROR:String = "Error";
public static const IO_ERROR:String = "IoError";
private static const KEY_SALT:String = " syncMaint";
public static const WRITTEN:String = "InvWritten";
public static const NOT_READY:String = "InvNotReady";
public static const VALUE_ERROR:String = "InvValueError";
private static const CONSUMER_KEY:String = "MochiConsumables";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public function MochiInventory():void{
MochiCoins.addEventListener(MochiCoins.ITEM_OWNED, itemOwned);
MochiCoins.addEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, loggedOut);
_storeSync = new Object();
_syncPending = false;
_outstandingID = 0;
_syncID = 0;
_timer = new Timer(1000);
_timer.addEventListener(TimerEvent.TIMER, sync);
_timer.start();
if (MochiSocial.loggedIn){
loggedIn();
} else {
loggedOut();
};
}
private function newItems(_arg1:Object):void{
if (!this[(_arg1.id + KEY_SALT)]){
this[(_arg1.id + KEY_SALT)] = 0;
};
if (!this[_arg1.id]){
this[_arg1.id] = 0;
};
this[(_arg1.id + KEY_SALT)] = (this[(_arg1.id + KEY_SALT)] + _arg1.count);
this[_arg1.id] = (this[_arg1.id] + _arg1.count);
if (_arg1.privateProperties.consumable){
if (!this[_arg1.privateProperties.tag]){
this[_arg1.privateProperties.tag] = 0;
};
this[_arg1.privateProperties.tag] = (this[_arg1.privateProperties.tag] + (_arg1.privateProperties.inc * _arg1.count));
};
}
public function release():void{
MochiCoins.removeEventListener(MochiCoins.ITEM_NEW, newItems);
MochiSocial.removeEventListener(MochiSocial.LOGGED_IN, loggedIn);
MochiSocial.removeEventListener(MochiSocial.LOGGED_OUT, loggedOut);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (-1);
};
if (_consumableProperties[_arg1]){
return (MochiDigits(_consumableProperties[_arg1]).value);
};
return (undefined);
}
private function loggedIn(_arg1:Object=null):void{
MochiUserData.get(CONSUMER_KEY, getConsumableBag);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function hasProperty(_arg1):Boolean{
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return (false);
};
if (_consumableProperties[_arg1] == undefined){
return (false);
};
return (true);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextNameIndex(_arg1:int):int{
return (((_arg1)>=_names.length) ? 0 : (_arg1 + 1));
}
private function putConsumableBag(_arg1:MochiUserData):void{
_syncPending = false;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
_outstandingID = -1;
};
triggerEvent(WRITTEN, {});
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
var _local3:MochiDigits;
if (_consumableProperties == null){
triggerEvent(ERROR, {type:NOT_READY});
return;
};
if (!(_arg2 is Number)){
triggerEvent(ERROR, {type:VALUE_ERROR, error:"Invalid type", arg:_arg2});
return;
};
if (_consumableProperties[_arg1]){
_local3 = MochiDigits(_consumableProperties[_arg1]);
if (_local3.value == _arg2){
return;
};
_local3.value = _arg2;
} else {
_names.push(_arg1);
_consumableProperties[_arg1] = new MochiDigits(_arg2);
};
_syncID++;
}
private function itemOwned(_arg1:Object):void{
_storeSync[_arg1.id] = {properties:_arg1.properties, count:_arg1.count};
}
private function sync(_arg1:Event=null):void{
var _local3:String;
if (((_syncPending) || ((_syncID == _outstandingID)))){
return;
};
_outstandingID = _syncID;
var _local2:Object = {};
for (_local3 in _consumableProperties) {
_local2[_local3] = MochiDigits(_consumableProperties[_local3]).value;
};
MochiUserData.put(CONSUMER_KEY, _local2, putConsumableBag);
_syncPending = true;
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function nextName(_arg1:int):String{
return (_names[(_arg1 - 1)]);
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function deleteProperty(_arg1):Boolean{
if (!_consumableProperties[_arg1]){
return (false);
};
_names.splice(_names.indexOf(_arg1), 1);
delete _consumableProperties[_arg1];
return (true);
}
private function getConsumableBag(_arg1:MochiUserData):void{
var _local2:String;
var _local3:Number;
if (_arg1.error){
triggerEvent(ERROR, {type:IO_ERROR, error:_arg1.error});
return;
};
_consumableProperties = {};
_names = new Array();
if (_arg1.data){
for (_local2 in _arg1.data) {
_names.push(_local2);
_consumableProperties[_local2] = new MochiDigits(_arg1.data[_local2]);
};
};
for (_local2 in _storeSync) {
_local3 = _storeSync[_local2].count;
if (_consumableProperties[(_local2 + KEY_SALT)]){
_local3 = (_local3 - _consumableProperties[_local2]);
};
if (_local3 == 0){
} else {
newItems({id:_local2, count:_local3, properties:_storeSync[_local2].properties});
};
};
triggerEvent(READY, {});
}
private function loggedOut(_arg1:Object=null):void{
_consumableProperties = null;
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
}
}//package mochi.as3
Section 17
//MochiServices (mochi.as3.MochiServices)
package mochi.as3 {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import flash.net.*;
import flash.system.*;
import flash.geom.*;
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 methodName:String;
var pkg = _arg1;
var cb:String = pkg.callbackID;
var cblst:Object = _clip._callbacks[cb];
if (!cblst){
return;
};
var method:* = cblst.callbackMethod;
methodName = "";
var obj:Object = 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 _local4:int;
var _local14:Loader;
var _local3:Array = [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];
var _local5:Array = [104, 0, 31, 64, 0, 7, 208, 0, 0, 12, 1, 0, 67, 2, 0xFF, 0xFF, 0xFF, 63, 3];
var _local6:Array = [0, 64, 0, 0, 0];
var _local7:MovieClip = new MovieClip();
var _local8:LocalConnection = new LocalConnection();
var _local9:String = ((("_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);
var _local10:ByteArray = new ByteArray();
var _local11:ByteArray = new ByteArray();
_local11.endian = Endian.LITTLE_ENDIAN;
_local11.writeShort(1);
_local11.writeUTFBytes(((_arg1 + " ") + _local9));
_local11.writeByte(0);
var _local12:uint = ((_local3.length + _local11.length) + 4);
var _local13:uint = (_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 avm1Click:DisplayObject;
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;
var vars:Object = 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);
var s = "?";
var i:Number = 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{
if (avm1Click){
btn.removeChild(avm1Click);
};
avm1Click = clickMovie(_arg1, onClick);
var _local2:Rectangle = 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{
_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;
};
};
};
var _local3:Number = 0;
while (_local3 < _arg1.length) {
switch (_arg1.charAt(_local3)){
case "0":
case "1":
case "2":
case "3":
case "4":
case "5":
case "6":
case "7":
case "8":
case "9":
case "a":
case "b":
case "c":
case "d":
case "e":
case "f":
break;
default:
trace(("WARNING: Board ID contains illegal characters: " + _arg1));
return;
};
_local3++;
};
}
public static function disconnect():void{
if (((_connected) || (_connecting))){
if (_clip != null){
if (_clip.parent != null){
if ((_clip.parent is Sprite)){
Sprite(_clip.parent).removeChild(_clip);
_clip = null;
};
};
};
_connecting = (_connected = false);
flush(true);
try {
_mochiLocalConnection.close();
} catch(error:Error) {
};
};
if (_timer != null){
try {
_timer.stop();
} catch(error:Error) {
};
};
}
public static function allowDomains(_arg1:String):String{
var _local2:String;
if (Security.sandboxType != "application"){
Security.allowDomain("*");
Security.allowInsecureDomain("*");
};
if (_arg1.indexOf("http://") != -1){
_local2 = _arg1.split("/")[2].split(":")[0];
if (Security.sandboxType != "application"){
Security.allowDomain(_local2);
Security.allowInsecureDomain(_local2);
};
};
return (_local2);
}
public static function getVersion():String{
return ("3.7 as3");
}
public static function doClose():void{
_container.removeEventListener(Event.ENTER_FRAME, MochiServices.bringToTop);
}
private static function flush(_arg1:Boolean):void{
var _local2:Object;
var _local3:Object;
if (((_clip) && (_clip._queue))){
while (_clip._queue.length > 0) {
_local2 = _clip._queue.shift();
_local3 = null;
if (_local2 != null){
if (_local2.callbackID != null){
_local3 = _clip._callbacks[_local2.callbackID];
};
delete _clip._callbacks[_local2.callbackID];
if (((_arg1) && (!((_local3 == null))))){
handleError(_local2.args, _local3.callbackObject, _local3.callbackMethod);
};
};
};
};
}
public static function get id():String{
return (_id);
}
private static function onEvent(_arg1:Object):void{
var _local2:String = _arg1.target;
var _local3:String = _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 _local3:String;
var _local4:Array;
var _local5:Number;
var _local6:Array;
var _local2:Object = {};
if (_arg1.stage){
_local3 = _arg1.stage.loaderInfo.parameters.mochiad_options;
} else {
_local3 = _arg1.loaderInfo.parameters.mochiad_options;
};
if (_local3){
_local4 = _local3.split("&");
_local5 = 0;
while (_local5 < _local4.length) {
_local6 = _local4[_local5].split("=");
_local2[unescape(_local6[0])] = unescape(_local6[1]);
_local5++;
};
};
return (_local2);
}
public static function setContainer(_arg1:Object=null, _arg2:Boolean=true):void{
if (_arg1 != null){
if ((_arg1 is Sprite)){
_container = _arg1;
};
};
if (_arg2){
if ((_container is Sprite)){
Sprite(_container).addChild(_clip);
};
};
}
private static function handleError(_arg1:Object, _arg2:Object, _arg3:Object):void{
var args = _arg1;
var callbackObject = _arg2;
var callbackMethod = _arg3;
if (args != null){
if (args.onError != null){
args.onError.apply(null, ["NotConnected"]);
};
if (((!((args.options == null))) && (!((args.options.onError == null))))){
args.options.onError.apply(null, ["NotConnected"]);
};
};
if (callbackMethod != null){
args = {};
args.error = true;
args.errorCode = "NotConnected";
if (((!((callbackObject == null))) && ((callbackMethod is String)))){
try {
var _local5 = callbackObject;
_local5[callbackMethod](args);
} catch(error:Error) {
};
} else {
if (callbackMethod != null){
try {
callbackMethod.apply(args);
} catch(error:Error) {
};
};
};
};
}
private static function loadError(_arg1:Object):void{
_clip._mochiad_ctr_failed = true;
trace("MochiServices could not load.");
MochiServices.disconnect();
MochiServices.onError("IOError");
}
private static function initComChannels():void{
if (!_connected){
trace("[SERVICES_API] connected!");
_connecting = false;
_connected = true;
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"handshakeDone"});
_mochiLocalConnection.send(_sendChannelName, "onReceive", {methodName:"registerGame", preserved:_preserved, id:_id, version:getVersion(), parentURL:_container.loaderInfo.loaderURL});
_clip.onReceive = onReceive;
_clip.onEvent = onEvent;
_clip.onError = function ():void{
MochiServices.onError("IOError");
};
while (_clip._queue.length > 0) {
_mochiLocalConnection.send(_sendChannelName, "onReceive", _clip._queue.shift());
};
};
}
private static function loadLCBridge(_arg1:Object):void{
var loader:Loader;
var clip = _arg1;
loader = new Loader();
var mochiLCURL:String = (_servURL + _mochiLC);
var req:URLRequest = new URLRequest(mochiLCURL);
var complete:Function = 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 = ("_mochiservices_com_" + _arg1);
if (_clip != null){
return (_clip);
};
if (!MochiServices.isNetworkAvailable()){
return (null);
};
if (urlOptions(_arg2).servURL){
_servURL = urlOptions(_arg2).servURL;
};
var _local4:String = (_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);
var _local5:URLRequest = new URLRequest(_local4);
var _local6:URLVariables = new URLVariables();
_local6.listenLC = _listenChannelName;
_local6.mochiad_options = _arg2.loaderInfo.parameters.mochiad_options;
_local6.api_version = getVersion();
if (widget){
_local6.widget = true;
};
_local5.data = _local6;
_loader.load(_local5);
_clip.addChild(_loader);
_clip._mochiservices_com = _loader;
_sendChannel = new LocalConnection();
_clip._queue = [];
_clip._nextcallbackID = 0;
_clip._callbacks = {};
_timer = new Timer(10000, 1);
_timer.addEventListener(TimerEvent.TIMER, connectWait);
_timer.start();
return (_clip);
}
public static function connect(_arg1:String, _arg2:Object, _arg3:Object=null):void{
var id = _arg1;
var clip = _arg2;
var onError = _arg3;
warnID(id, false);
if ((clip is DisplayObject)){
if (clip.stage == null){
trace("MochiServices connect requires the containing clip be attached to the stage");
};
if (((!(_connected)) && ((_clip == null)))){
trace("MochiServices Connecting...");
_connecting = true;
init(id, clip);
};
} else {
trace("Error, MochiServices requires a Sprite, Movieclip or instance of the stage.");
};
if (onError != null){
MochiServices.onError = onError;
} else {
if (MochiServices.onError == null){
MochiServices.onError = function (_arg1:String):void{
trace(_arg1);
};
};
};
}
public static function createEmptyMovieClip(_arg1:Object, _arg2:String, _arg3:Number, _arg4:Boolean=true):MovieClip{
var parent = _arg1;
var name = _arg2;
var depth = _arg3;
var doAdd = _arg4;
var mc:MovieClip = 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
//MochiSocial (mochi.as3.MochiSocial)
package mochi.as3 {
public class MochiSocial {
public static const LOGGED_IN:String = "LoggedIn";
public static const PROFILE_HIDE:String = "ProfileHide";
public static const NO_USER:String = "NoUser";
public static const PROPERTIES_SIZE:String = "PropertiesSize";
public static const IO_ERROR:String = "IOError";
public static const PROPERTIES_SAVED:String = "PropertySaved";
public static const WIDGET_LOADED:String = "WidgetLoaded";
public static const USER_INFO:String = "UserInfo";
public static const ERROR:String = "Error";
public static const LOGIN_SHOW:String = "LoginShow";
public static const LOGGED_OUT:String = "LoggedOut";
public static const PROFILE_SHOW:String = "ProfileShow";
public static const LOGIN_SHOWN:String = "LoginShown";
public static const LOGIN_HIDE:String = "LoginHide";
private static var _dispatcher:MochiEventDispatcher = new MochiEventDispatcher();
public static var _user_info:Object = null;
public static function getVersion():String{
return (MochiServices.getVersion());
}
public static function saveUserProperties(_arg1:Object):void{
MochiServices.send("coins_saveUserProperties", _arg1);
}
public static function get loggedIn():Boolean{
return (!((_user_info == null)));
}
public static function triggerEvent(_arg1:String, _arg2:Object):void{
_dispatcher.triggerEvent(_arg1, _arg2);
}
public static function addEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.addEventListener(_arg1, _arg2);
}
public static function getUserInfo():void{
MochiServices.send("coins_getUserInfo");
}
public static function showLoginWidget(_arg1:Object=null):void{
MochiServices.setContainer();
MochiServices.bringToTop();
MochiServices.send("coins_showLoginWidget", {options:_arg1});
}
public static function removeEventListener(_arg1:String, _arg2:Function):void{
_dispatcher.removeEventListener(_arg1, _arg2);
}
public static function requestLogin():void{
MochiServices.send("coins_requestLogin");
}
public static function getAPIURL():String{
if (!_user_info){
return (null);
};
return (_user_info.api_url);
}
public static function hideLoginWidget():void{
MochiServices.send("coins_hideLoginWidget");
}
public static function getAPIToken():String{
if (!_user_info){
return (null);
};
return (_user_info.api_token);
}
MochiSocial.addEventListener(MochiSocial.LOGGED_IN, function (_arg1:Object):void{
_user_info = _arg1;
});
MochiSocial.addEventListener(MochiSocial.LOGGED_OUT, function (_arg1:Object):void{
_user_info = null;
});
}
}//package mochi.as3
Section 19
//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 = {};
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function setProperty(_arg1, _arg2):void{
if (_syncContainer[_arg1] == _arg2){
return;
};
var _local3:String = _arg1.toString();
_syncContainer[_local3] = _arg2;
MochiServices.send("sync_propUpdate", {name:_local3, value:_arg2});
}
override "http://www.adobe.com/2006/actionscript/flash/proxy"?? function getProperty(_arg1){
return (_syncContainer[_arg1]);
}
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;
};
}
}
}//package mochi.as3
Section 20
//MochiUserData (mochi.as3.MochiUserData)
package mochi.as3 {
import flash.events.*;
import flash.utils.*;
import flash.net.*;
public class MochiUserData extends EventDispatcher {
public var callback:Function;// = null
public var operation:String;// = null
public var error:Event;// = null
public var data;// = null
public var _loader:URLLoader;
public var key:String;// = null
public function MochiUserData(_arg1:String="", _arg2:Function=null){
this.key = _arg1;
this.callback = _arg2;
}
public function serialize(_arg1):ByteArray{
var _local2:ByteArray = new ByteArray();
_local2.objectEncoding = ObjectEncoding.AMF3;
_local2.writeObject(_arg1);
_local2.compress();
return (_local2);
}
public function errorHandler(_arg1:IOErrorEvent):void{
data = null;
error = _arg1;
if (callback != null){
performCallback();
} else {
dispatchEvent(_arg1);
};
close();
}
public function putEvent(_arg1):void{
request("put", serialize(_arg1));
}
public function deserialize(_arg1:ByteArray){
_arg1.objectEncoding = ObjectEncoding.AMF3;
_arg1.uncompress();
return (_arg1.readObject());
}
public function securityErrorHandler(_arg1:SecurityErrorEvent):void{
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + _arg1.toString())));
}
public function getEvent():void{
request("get", serialize(null));
}
override public function toString():String{
return ((((((((("[MochiUserData operation=" + operation) + " key=\"") + key) + "\" data=") + data) + " error=\"") + error) + "\"]"));
}
public function performCallback():void{
try {
callback(this);
} catch(e:Error) {
trace(("[MochiUserData] exception during callback: " + e));
};
}
public function request(_arg1:String, _arg2:ByteArray):void{
var _operation = _arg1;
var _data = _arg2;
operation = _operation;
var api_url:String = MochiSocial.getAPIURL();
var api_token:String = MochiSocial.getAPIToken();
if ((((api_url == null)) || ((api_token == null)))){
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, "not logged in"));
return;
};
_loader = new URLLoader();
var args:URLVariables = new URLVariables();
args.op = _operation;
args.key = key;
var req:URLRequest = new URLRequest((((MochiSocial.getAPIURL() + "/") + "MochiUserData?") + args.toString()));
req.method = URLRequestMethod.POST;
req.contentType = "application/x-mochi-userdata";
req.requestHeaders = [new URLRequestHeader("x-mochi-services-version", MochiServices.getVersion()), new URLRequestHeader("x-mochi-api-token", api_token)];
req.data = _data;
_loader.dataFormat = URLLoaderDataFormat.BINARY;
_loader.addEventListener(Event.COMPLETE, completeHandler);
_loader.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
try {
_loader.load(req);
} catch(e:SecurityError) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("security error: " + e.toString())));
};
}
public function completeHandler(_arg1:Event):void{
var event = _arg1;
try {
if (_loader.data.length){
data = deserialize(_loader.data);
} else {
data = null;
};
} catch(e:Error) {
errorHandler(new IOErrorEvent(IOErrorEvent.IO_ERROR, false, false, ("deserialize error: " + e.toString())));
return;
};
if (callback != null){
performCallback();
} else {
dispatchEvent(event);
};
close();
}
public function close():void{
if (_loader){
_loader.removeEventListener(Event.COMPLETE, completeHandler);
_loader.removeEventListener(IOErrorEvent.IO_ERROR, errorHandler);
_loader.removeEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
_loader.close();
_loader = null;
};
error = null;
callback = null;
}
public static function get(_arg1:String, _arg2:Function):void{
var _local3:MochiUserData = new MochiUserData(_arg1, _arg2);
_local3.getEvent();
}
public static function put(_arg1:String, _arg2, _arg3:Function):void{
var _local4:MochiUserData = new MochiUserData(_arg1, _arg3);
_local4.putEvent(_arg2);
}
}
}//package mochi.as3
Section 21
//Cache (popthebubble.Cache)
package popthebubble {
import Utils.*;
public class Cache {
public static var prevX:Number;
public static var prevY:Number;
public static var launcherSpeed:Number = 5;
public static var currentLevel:Number = 1;
public static var bubbleTypeLeft:Array = new Array();
public static var init:Boolean = false;
public static var bubbleSpeed:Number = 15;
public static var randNum:Number = 0;
public static var rightKey:Boolean = false;
public static var lost:Boolean = false;
public static var bubbleInLaunchPosition:Bubble;
public static var onGamesFree:Boolean = false;
public static var checkArray:Array = new Array();
public static var foundHex:Boolean = false;
public static var difficulty:String = "easy";
public static var bubblesWaitArray:Array = new Array();
public static var main:Main;
public static var timer:CustomTimer;
public static var grid:Array = new Array();
public static var bubblesGrid:Array = new Array();
public static var bubblePointArray:Array = new Array();
public static var leftKey:Boolean = false;
public static var holdShot:Boolean = false;
public static var win:Boolean = false;
public static var noSound:Boolean = false;
public static var scoreNextLevel:Number = 0;
public static var bubblesBeingDestroyed:Array = new Array();
public static var bubblesBeingDestroyedFromNoLink:Array = new Array();
public static var gridSize:Number = 0;
public static var bubbleInHoldPosition:Bubble;
public static var hitWall:Boolean = false;
public static var destroyArray:Array = new Array();
}
}//package popthebubble
Section 22
//Game (popthebubble.Game)
package popthebubble {
import flash.events.*;
import flash.display.*;
import flash.utils.*;
import fl.transitions.*;
import Utils.*;
import fl.transitions.easing.*;
import flash.net.*;
import flash.geom.*;
import flash.ui.*;
public class Game extends MovieClip {
public var redState:String;// = "goUp"
public var score:Number;// = 0
private var tweenSpeed:Number;// = 0.5
public var bonus:Number;// = 0
public var randNum:Number;
public var accepted:String;// = "true"
private var tweenDict:Dictionary;
private var firstCheck:Boolean;// = false
public var scoreToWin:Number;// = 25000
private var secondCheck:Boolean;// = false
public function Game(){
tweenDict = new Dictionary();
super();
}
function destroyLonelyBubbles(){
var _local5:int;
var _local6:Number;
var _local7:Number;
var _local8:int;
var _local9:int;
var _local1:int;
while (_local1 < Cache.main.hexGrid.gridYSize) {
Cache.destroyArray[_local1] = new Array();
_local5 = 0;
while (_local5 < Cache.main.hexGrid.gridXSize) {
Cache.destroyArray[_local1][_local5] = false;
_local5++;
};
_local1++;
};
var _local2:int;
while (_local2 < Cache.checkArray.length) {
_local6 = (Cache.checkArray[_local2] % Cache.main.hexGrid.gridXSize);
_local7 = Math.floor((Cache.checkArray[_local2] / Cache.main.hexGrid.gridXSize));
Cache.destroyArray[_local7][_local6] = true;
_local2++;
};
var _local3:int;
while (_local3 < Cache.bubblesGrid.length) {
_local8 = 0;
while (_local8 < Cache.bubblesGrid[_local3].length) {
if (((!((Cache.bubblesGrid[_local3][_local8] == null))) && ((Cache.destroyArray[_local3][_local8] == false)))){
_local9 = 0;
while (_local9 <= Cache.bubblesBeingDestroyedFromNoLink.length) {
if (_local9 == Cache.bubblesBeingDestroyedFromNoLink.length){
Cache.bubblesBeingDestroyedFromNoLink.push(Cache.bubblesGrid[_local3][_local8]);
break;
} else {
if (Cache.bubblesBeingDestroyedFromNoLink[_local9] == null){
Cache.bubblesBeingDestroyedFromNoLink[_local9] = Cache.bubblesGrid[_local3][_local8];
break;
};
};
_local9++;
};
Cache.bubblesGrid[_local3][_local8].gotoAndPlay(15);
Cache.bubblesGrid[_local3][_local8] = null;
};
_local8++;
};
_local3++;
};
var _local4:int;
while (_local4 < Cache.destroyArray.length) {
Cache.destroyArray[_local1] = null;
_local4++;
};
Cache.destroyArray = null;
}
public function lostFunc(){
Cache.timer.stop();
Mouse.show();
Cache.scoreNextLevel = 0;
if (Cache.onGamesFree == true){
Cache.main.lostBox.y = 0;
Cache.main.lostBox.invalidEmail.visible = false;
Cache.main.lostBox.invalidName.visible = false;
Cache.main.lostBox.timeText.text = String(score);
Cache.main.lostBox.sendBtn.buttonMode = true;
Cache.main.lostBox.sendBtn.useHandCursor = true;
Cache.main.lostBox.sendBtn.addEventListener(MouseEvent.ROLL_OVER, btnOver);
Cache.main.lostBox.sendBtn.addEventListener(MouseEvent.ROLL_OUT, btnOut);
Cache.main.lostBox.sendBtn.addEventListener(MouseEvent.CLICK, sendScore);
Cache.main.lostBox.checkBtn.buttonMode = true;
Cache.main.lostBox.checkBtn.useHandCursor = true;
Cache.main.lostBox.checkCross.visible = true;
Cache.main.lostBox.cancelBtn.buttonMode = true;
Cache.main.lostBox.cancelBtn.useHandCursor = true;
Cache.main.lostBox.cancelBtn.addEventListener(MouseEvent.ROLL_OVER, btnOver);
Cache.main.lostBox.cancelBtn.addEventListener(MouseEvent.ROLL_OUT, btnOut);
Cache.main.lostBox.cancelBtn.addEventListener(MouseEvent.CLICK, replayClick);
Cache.main.lostBox.checkBtn.addEventListener(MouseEvent.CLICK, toggleCheck);
} else {
Cache.main.lostBox2.y = 0;
Cache.main.lostBox2.timeText.text = String(score);
Cache.main.lostBox2.replayBtn.buttonMode = true;
Cache.main.lostBox2.replayBtn.addEventListener(MouseEvent.ROLL_OVER, btnOver);
Cache.main.lostBox2.replayBtn.addEventListener(MouseEvent.ROLL_OUT, btnOut);
Cache.main.lostBox2.replayBtn.addEventListener(MouseEvent.CLICK, replayClick3);
Cache.main.lostBox2.gfBtn.buttonMode = true;
Cache.main.lostBox2.gfBtn.addEventListener(MouseEvent.CLICK, gfBtnClick);
};
Cache.currentLevel = 1;
}
private function securityErrorHandler(_arg1:SecurityErrorEvent):void{
trace(("securityErrorHandler:" + _arg1));
}
private function gfBtnClick(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.gamesfree.ca/more_our_games.html"), "_blank");
}
public function moveTheBubble(_arg1:Event){
var _local2:int;
var _local3:int;
var _local4:int;
var _local5:int;
Cache.prevX = _arg1.target.x;
Cache.prevY = _arg1.target.y;
_arg1.target.x = (_arg1.target.x + (Cache.bubbleSpeed * Math.sin(((Math.PI / 180) * Number(_arg1.target.name)))));
_arg1.target.y = (_arg1.target.y - (Cache.bubbleSpeed * Math.cos(((Math.PI / 180) * Number(_arg1.target.name)))));
if (_arg1.target.y < Cache.grid[0][0].y){
Cache.holdShot = false;
score = (score - 500);
Cache.main.score.text = String(score);
_arg1.target.removeEventListener(Event.ENTER_FRAME, moveTheBubble);
_arg1.target.parent.removeChild(_arg1.target);
ObjectManager.removeObject(_arg1.target, "Bubble");
Cache.foundHex = false;
if (Cache.bubbleInHoldPosition != null){
moveBubbleOnHoldToLaunchPosition();
addBubbleOnHold();
};
return;
} else {
_local2 = 0;
while (_local2 < Cache.bubblesGrid.length) {
if (Cache.foundHex == true){
break;
};
_local3 = 0;
while (_local3 < Cache.bubblesGrid[_local2].length) {
if (Cache.foundHex == true){
break;
};
if (Cache.bubblesGrid[_local2][_local3] != null){
Cache.bubblePointArray[0] = new Point(_arg1.target.bubble.hit.x, (_arg1.target.bubble.hit.y - (_arg1.target.bubble.hit.height / 2)));
Cache.bubblePointArray[1] = new Point(_arg1.target.bubble.hit.x, (_arg1.target.bubble.hit.y + (_arg1.target.bubble.hit.height / 2)));
Cache.bubblePointArray[2] = new Point((_arg1.target.bubble.hit.x - (_arg1.target.bubble.hit.width / 2)), _arg1.target.bubble.hit.y);
Cache.bubblePointArray[3] = new Point((_arg1.target.bubble.hit.x + (_arg1.target.bubble.hit.width / 2)), _arg1.target.bubble.hit.y);
_local4 = 0;
while (_local4 < Cache.bubblePointArray.length) {
if (Cache.bubblesGrid[_local2][_local3].hitTestPoint(_arg1.target.bubble.hit.localToGlobal(Cache.bubblePointArray[_local4]).x, _arg1.target.bubble.hit.localToGlobal(Cache.bubblePointArray[_local4]).y)){
if ((((((((Math.atan2((Cache.bubblesGrid[_local2][_local3].y - Cache.prevY), (Cache.bubblesGrid[_local2][_local3].x - Cache.prevX)) * 180) / Math.PI) < -150)) && ((((Math.atan2((Cache.bubblesGrid[_local2][_local3].y - Cache.prevY), (Cache.bubblesGrid[_local2][_local3].x - Cache.prevX)) * 180) / Math.PI) >= -180)))) || ((((((Math.atan2((Cache.bubblesGrid[_local2][_local3].y - Cache.prevY), (Cache.bubblesGrid[_local2][_local3].x - Cache.prevX)) * 180) / Math.PI) >= 150)) && ((((Math.atan2((Cache.bubblesGrid[_local2][_local3].y - Cache.prevY), (Cache.bubblesGrid[_local2][_local3].x - Cache.prevX)) * 180) / Math.PI) <= 180)))))){
_arg1.target.x = Cache.grid[_local2][(_local3 + 1)].x;
_arg1.target.y = Cache.grid[_local2][(_local3 + 1)].y;
Cache.bubblesGrid[_local2][(_local3 + 1)] = _arg1.target;
_arg1.target.name = Cache.grid[_local2][(_local3 + 1)].name;
} else {
if ((((((Math.atan2((Cache.bubblesGrid[_local2][_local3].y - Cache.prevY), (Cache.bubblesGrid[_local2][_local3].x - Cache.prevX)) * 180) / Math.PI) >= 90)) && ((((Math.atan2((Cache.bubblesGrid[_local2][_local3].y - Cache.prevY), (Cache.bubblesGrid[_local2][_local3].x - Cache.prevX)) * 180) / Math.PI) < 150)))){
_arg1.target.x = Cache.grid[(_local2 - 1)][(_local3 + 1)].x;
_arg1.target.y = Cache.grid[(_local2 - 1)][(_local3 + 1)].y;
Cache.bubblesGrid[(_local2 - 1)][(_local3 + 1)] = _arg1.target;
_arg1.target.name = Cache.grid[(_local2 - 1)][(_local3 + 1)].name;
} else {
if ((((((Math.atan2((Cache.bubblesGrid[_local2][_local3].y - Cache.prevY), (Cache.bubblesGrid[_local2][_local3].x - Cache.prevX)) * 180) / Math.PI) >= 30)) && ((((Math.atan2((Cache.bubblesGrid[_local2][_local3].y - Cache.prevY), (Cache.bubblesGrid[_local2][_local3].x - Cache.prevX)) * 180) / Math.PI) < 90)))){
_arg1.target.x = Cache.grid[(_local2 - 1)][(_local3 - 1)].x;
_arg1.target.y = Cache.grid[(_local2 - 1)][(_local3 - 1)].y;
Cache.bubblesGrid[(_local2 - 1)][(_local3 - 1)] = _arg1.target;
_arg1.target.name = Cache.grid[(_local2 - 1)][(_local3 - 1)].name;
} else {
if ((((((Math.atan2((Cache.bubblesGrid[_local2][_local3].y - Cache.prevY), (Cache.bubblesGrid[_local2][_local3].x - Cache.prevX)) * 180) / Math.PI) >= -30)) && ((((Math.atan2((Cache.bubblesGrid[_local2][_local3].y - Cache.prevY), (Cache.bubblesGrid[_local2][_local3].x - Cache.prevX)) * 180) / Math.PI) < 30)))){
_arg1.target.x = Cache.grid[_local2][(_local3 - 1)].x;
_arg1.target.y = Cache.grid[_local2][(_local3 - 1)].y;
Cache.bubblesGrid[_local2][(_local3 - 1)] = _arg1.target;
_arg1.target.name = Cache.grid[_local2][(_local3 - 1)].name;
} else {
if ((((((Math.atan2((Cache.bubblesGrid[_local2][_local3].y - Cache.prevY), (Cache.bubblesGrid[_local2][_local3].x - Cache.prevX)) * 180) / Math.PI) >= -90)) && ((((Math.atan2((Cache.bubblesGrid[_local2][_local3].y - Cache.prevY), (Cache.bubblesGrid[_local2][_local3].x - Cache.prevX)) * 180) / Math.PI) < -30)))){
if (((((_local2 % 2) == 0)) && ((_local3 == 0)))){
_arg1.target.x = Cache.grid[(_local2 + 1)][(_local3 + 1)].x;
_arg1.target.y = Cache.grid[(_local2 + 1)][(_local3 + 1)].y;
Cache.bubblesGrid[(_local2 + 1)][(_local3 + 1)] = _arg1.target;
_arg1.target.name = Cache.grid[(_local2 + 1)][(_local3 + 1)].name;
} else {
if ((_local2 % 2) == 0){
_arg1.target.x = Cache.grid[(_local2 + 1)][(_local3 - 1)].x;
_arg1.target.y = Cache.grid[(_local2 + 1)][(_local3 - 1)].y;
Cache.bubblesGrid[(_local2 + 1)][(_local3 - 1)] = _arg1.target;
_arg1.target.name = Cache.grid[(_local2 + 1)][(_local3 - 1)].name;
} else {
if ((_local2 % 2) == 1){
_arg1.target.x = Cache.grid[(_local2 + 1)][_local3].x;
_arg1.target.y = Cache.grid[(_local2 + 1)][_local3].y;
Cache.bubblesGrid[(_local2 + 1)][_local3] = _arg1.target;
_arg1.target.name = Cache.grid[(_local2 + 1)][_local3].name;
};
};
};
} else {
if ((((((Math.atan2((Cache.bubblesGrid[_local2][_local3].y - Cache.prevY), (Cache.bubblesGrid[_local2][_local3].x - Cache.prevX)) * 180) / Math.PI) >= -150)) && ((((Math.atan2((Cache.bubblesGrid[_local2][_local3].y - Cache.prevY), (Cache.bubblesGrid[_local2][_local3].x - Cache.prevX)) * 180) / Math.PI) < -90)))){
if (((((_local2 % 2) == 1)) && ((_local3 == 12)))){
_arg1.target.x = Cache.grid[(_local2 + 1)][_local3].x;
_arg1.target.y = Cache.grid[(_local2 + 1)][_local3].y;
Cache.bubblesGrid[(_local2 + 1)][_local3] = _arg1.target;
_arg1.target.name = Cache.grid[(_local2 + 1)][_local3].name;
} else {
if ((_local2 % 2) == 0){
_arg1.target.x = Cache.grid[(_local2 + 1)][_local3].x;
_arg1.target.y = Cache.grid[(_local2 + 1)][_local3].y;
Cache.bubblesGrid[(_local2 + 1)][_local3] = _arg1.target;
_arg1.target.name = Cache.grid[(_local2 + 1)][_local3].name;
} else {
if ((_local2 % 2) == 1){
_arg1.target.x = Cache.grid[(_local2 + 1)][(_local3 + 1)].x;
_arg1.target.y = Cache.grid[(_local2 + 1)][(_local3 + 1)].y;
Cache.bubblesGrid[(_local2 + 1)][(_local3 + 1)] = _arg1.target;
_arg1.target.name = Cache.grid[(_local2 + 1)][(_local3 + 1)].name;
};
};
};
};
};
};
};
};
};
Cache.foundHex = true;
break;
};
_local4++;
};
};
_local3++;
};
_local2++;
};
};
if (Cache.foundHex == true){
Cache.bubbleInLaunchPosition = null;
_arg1.target.removeEventListener(Event.ENTER_FRAME, moveTheBubble);
Cache.foundHex = false;
Cache.holdShot = false;
Cache.checkArray = null;
Cache.destroyArray = null;
Cache.checkArray = new Array();
Cache.destroyArray = new Array();
Cache.checkArray.push(_arg1.target.name);
checkForMatch(_arg1.target);
destroyMatch();
Cache.checkArray = null;
Cache.destroyArray = null;
Cache.checkArray = new Array();
Cache.destroyArray = new Array();
_local5 = 0;
while (_local5 < Cache.bubblesGrid[0].length) {
if (Cache.bubblesGrid[0][_local5] != null){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[0][_local5].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[0][_local5].name);
};
checkForLonelyBubbles(Cache.bubblesGrid[0][_local5]);
};
_local5++;
};
destroyLonelyBubbles();
if (Cache.bubbleInHoldPosition != null){
moveBubbleOnHoldToLaunchPosition();
addBubbleOnHold();
};
} else {
if (((((_arg1.target.x + (_arg1.target.width / 2)) > (Cache.main.gameContainer.gameBackground.x + Cache.main.gameContainer.gameBackground.width))) || (((_arg1.target.x - (_arg1.target.width / 2)) < Cache.main.gameContainer.gameBackground.x)))){
_arg1.target.name = String(Number(-(_arg1.target.name)));
Cache.hitWall = true;
} else {
if (Cache.main.gameContainer.gameBackground.hitTestPoint(_arg1.target.x, _arg1.target.y)){
Cache.hitWall = false;
};
};
};
}
public function init(){
Cache.scoreNextLevel = (Cache.scoreNextLevel + (((Cache.currentLevel - 1) * 2000) + 10000));
Cache.main.gameContainer.back.gotoAndStop(((Cache.currentLevel % 6) + 1));
Cache.main.nextScore.text = String(Cache.scoreNextLevel);
Cache.main.level.text = String(Cache.currentLevel);
Cache.main.soundBtn.buttonMode = true;
Cache.main.soundBtn.addEventListener(MouseEvent.CLICK, soundBtnClick);
Cache.main.gameContainer.redBack.alpha = 0;
Cache.holdShot = false;
Cache.main.score.text = String(score);
Cache.main.resetBtn.buttonMode = true;
Cache.main.resetBtn.addEventListener(MouseEvent.ROLL_OVER, btnOver);
Cache.main.resetBtn.addEventListener(MouseEvent.ROLL_OUT, btnOut);
Cache.main.resetBtn.addEventListener(MouseEvent.CLICK, reset);
Cache.main.instructionsBtn.buttonMode = true;
Cache.main.instructionsBtn.addEventListener(MouseEvent.ROLL_OVER, btnOver);
Cache.main.instructionsBtn.addEventListener(MouseEvent.ROLL_OUT, btnOut);
Cache.main.instructionsBtn.addEventListener(MouseEvent.CLICK, showInstructions);
Cache.main.highScoreBtn.buttonMode = true;
Cache.main.highScoreBtn.addEventListener(MouseEvent.CLICK, showHighScore);
Cache.main.counterContainer.counter.text = "00:00.0";
Cache.main.gameContainer.bubbleLauncher.addEventListener(Event.ENTER_FRAME, checkWaitArray);
Cache.main.gameContainer.bubbleLauncher.addEventListener(Event.ENTER_FRAME, checkLost);
Cache.main.gameContainer.bubbleLauncher.addEventListener(Event.ENTER_FRAME, moveLauncher);
Cache.main.gameContainer.bubbleLauncher.addEventListener(Event.ENTER_FRAME, rotateLauncher);
Cache.main.gameContainer.bubbleLauncher.addEventListener(Event.ENTER_FRAME, checkDestroy);
Cache.main.gameContainer.redBack.addEventListener(Event.ENTER_FRAME, checkForRedBack);
Cache.main.gameContainer.addEventListener(MouseEvent.CLICK, mouseClick);
Cache.win = false;
Cache.lost = false;
var _local1:Bubble = ObjectManager.getObject("Bubble");
Cache.main.gameContainer.addChild(_local1);
_local1.x = Cache.main.gameContainer.bubbleLauncher.x;
_local1.y = Cache.main.gameContainer.bubbleLauncher.y;
_local1.name = "first";
randNum = (Math.round((Math.random() * (_local1.bubble.totalFrames - 1))) + 1);
_local1.bubble.gotoAndStop(randNum);
Cache.bubbleInLaunchPosition = _local1;
addBubbleOnHold();
}
public function moveLauncher(_arg1:Event){
if ((((((Cache.leftKey == true)) && ((Cache.rightKey == false)))) && ((Cache.main.gameContainer.bubbleLauncher.x > 110)))){
Cache.main.gameContainer.bubbleLauncher.x = (Cache.main.gameContainer.bubbleLauncher.x - Cache.launcherSpeed);
Cache.main.gameContainer.bubbleLauncherBase.x = Cache.main.gameContainer.bubbleLauncher.x;
if (Cache.bubbleInLaunchPosition.y == Cache.main.gameContainer.bubbleLauncher.y){
Cache.bubbleInLaunchPosition.x = Cache.main.gameContainer.bubbleLauncher.x;
};
} else {
if ((((((Cache.rightKey == true)) && ((Cache.leftKey == false)))) && ((Cache.main.gameContainer.bubbleLauncher.x < 400)))){
Cache.main.gameContainer.bubbleLauncher.x = (Cache.main.gameContainer.bubbleLauncher.x + Cache.launcherSpeed);
Cache.main.gameContainer.bubbleLauncherBase.x = Cache.main.gameContainer.bubbleLauncher.x;
if (Cache.bubbleInLaunchPosition.y == Cache.main.gameContainer.bubbleLauncher.y){
Cache.bubbleInLaunchPosition.x = Cache.main.gameContainer.bubbleLauncher.x;
};
};
};
}
private function showHighScore(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.gamesfree.ca/hs/bubblesifterhs.php"), "_blank");
}
private function toggleCheck(_arg1:MouseEvent){
if (Cache.main.lostBox.checkCross.visible == true){
Cache.main.lostBox.checkCross.visible = false;
} else {
Cache.main.lostBox.checkCross.visible = true;
};
}
public function rotateLauncher(_arg1:Event){
if (((((((Math.atan2((Cache.main.gameContainer.mouseY - Cache.main.gameContainer.bubbleLauncher.y), (Cache.main.gameContainer.mouseX - Cache.main.gameContainer.bubbleLauncher.x)) * 180) / Math.PI) + 90) > 85)) && (((((Math.atan2((Cache.main.gameContainer.mouseY - Cache.main.gameContainer.bubbleLauncher.y), (Cache.main.gameContainer.mouseX - Cache.main.gameContainer.bubbleLauncher.x)) * 180) / Math.PI) + 90) <= 180)))){
Cache.main.gameContainer.bubbleLauncher.rotation = 85;
} else {
if (((((((Math.atan2((Cache.main.gameContainer.mouseY - Cache.main.gameContainer.bubbleLauncher.y), (Cache.main.gameContainer.mouseX - Cache.main.gameContainer.bubbleLauncher.x)) * 180) / Math.PI) + 90) < -85)) || (((((Math.atan2((Cache.main.gameContainer.mouseY - Cache.main.gameContainer.bubbleLauncher.y), (Cache.main.gameContainer.mouseX - Cache.main.gameContainer.bubbleLauncher.x)) * 180) / Math.PI) + 90) > 180)))){
Cache.main.gameContainer.bubbleLauncher.rotation = -85;
} else {
Cache.main.gameContainer.bubbleLauncher.rotation = (((Math.atan2((Cache.main.gameContainer.mouseY - Cache.main.gameContainer.bubbleLauncher.y), (Cache.main.gameContainer.mouseX - Cache.main.gameContainer.bubbleLauncher.x)) * 180) / Math.PI) + 90);
};
};
}
public function checkForMatch(_arg1){
var _local2:* = (_arg1.name % Cache.main.hexGrid.gridXSize);
var _local3:* = Math.floor((_arg1.name / Cache.main.hexGrid.gridXSize));
var _local4:int;
while (_local4 < 6) {
if ((Math.floor((Cache.bubblesGrid[_local3][_local2].name / Cache.main.hexGrid.gridXSize)) % 2) == 0){
if (_local4 == 0){
if (((((!((Cache.bubblesGrid[(_local3 - 1)] == undefined))) && (!((Cache.bubblesGrid[(_local3 - 1)][(_local2 - 1)] == undefined))))) && ((Cache.bubblesGrid[(_local3 - 1)][(_local2 - 1)].bubble.currentFrame == Cache.bubblesGrid[_local3][_local2].bubble.currentFrame)))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[(_local3 - 1)][(_local2 - 1)].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[(_local3 - 1)][(_local2 - 1)].name);
checkForMatch(Cache.bubblesGrid[(_local3 - 1)][(_local2 - 1)]);
};
};
} else {
if (_local4 == 1){
if (((((!((Cache.bubblesGrid[(_local3 - 1)] == undefined))) && (!((Cache.bubblesGrid[(_local3 - 1)][_local2] == undefined))))) && ((Cache.bubblesGrid[(_local3 - 1)][_local2].bubble.currentFrame == Cache.bubblesGrid[_local3][_local2].bubble.currentFrame)))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[(_local3 - 1)][_local2].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[(_local3 - 1)][_local2].name);
checkForMatch(Cache.bubblesGrid[(_local3 - 1)][_local2]);
};
};
} else {
if (_local4 == 2){
if (((!((Cache.bubblesGrid[_local3][(_local2 + 1)] == undefined))) && ((Cache.bubblesGrid[_local3][(_local2 + 1)].bubble.currentFrame == Cache.bubblesGrid[_local3][_local2].bubble.currentFrame)))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[_local3][(_local2 + 1)].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[_local3][(_local2 + 1)].name);
checkForMatch(Cache.bubblesGrid[_local3][(_local2 + 1)]);
};
};
} else {
if (_local4 == 3){
if (((((!((Cache.bubblesGrid[(_local3 + 1)] == undefined))) && (!((Cache.bubblesGrid[(_local3 + 1)][_local2] == undefined))))) && ((Cache.bubblesGrid[(_local3 + 1)][_local2].bubble.currentFrame == Cache.bubblesGrid[_local3][_local2].bubble.currentFrame)))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[(_local3 + 1)][_local2].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[(_local3 + 1)][_local2].name);
checkForMatch(Cache.bubblesGrid[(_local3 + 1)][_local2]);
};
};
} else {
if (_local4 == 4){
if (((((!((Cache.bubblesGrid[(_local3 + 1)] == undefined))) && (!((Cache.bubblesGrid[(_local3 + 1)][(_local2 - 1)] == undefined))))) && ((Cache.bubblesGrid[(_local3 + 1)][(_local2 - 1)].bubble.currentFrame == Cache.bubblesGrid[_local3][_local2].bubble.currentFrame)))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[(_local3 + 1)][(_local2 - 1)].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[(_local3 + 1)][(_local2 - 1)].name);
checkForMatch(Cache.bubblesGrid[(_local3 + 1)][(_local2 - 1)]);
};
};
} else {
if (_local4 == 5){
if (((!((Cache.bubblesGrid[_local3][(_local2 - 1)] == undefined))) && ((Cache.bubblesGrid[_local3][(_local2 - 1)].bubble.currentFrame == Cache.bubblesGrid[_local3][_local2].bubble.currentFrame)))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[_local3][(_local2 - 1)].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[_local3][(_local2 - 1)].name);
checkForMatch(Cache.bubblesGrid[_local3][(_local2 - 1)]);
};
};
};
};
};
};
};
};
} else {
if ((Math.floor((Cache.bubblesGrid[_local3][_local2].name / Cache.main.hexGrid.gridXSize)) % 2) == 1){
if (_local4 == 0){
if (((((!((Cache.bubblesGrid[(_local3 - 1)] == undefined))) && (!((Cache.bubblesGrid[(_local3 - 1)][_local2] == undefined))))) && ((Cache.bubblesGrid[(_local3 - 1)][_local2].bubble.currentFrame == Cache.bubblesGrid[_local3][_local2].bubble.currentFrame)))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[(_local3 - 1)][_local2].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[(_local3 - 1)][_local2].name);
checkForMatch(Cache.bubblesGrid[(_local3 - 1)][_local2]);
};
};
} else {
if (_local4 == 1){
if (((((!((Cache.bubblesGrid[(_local3 - 1)] == undefined))) && (!((Cache.bubblesGrid[(_local3 - 1)][(_local2 + 1)] == undefined))))) && ((Cache.bubblesGrid[(_local3 - 1)][(_local2 + 1)].bubble.currentFrame == Cache.bubblesGrid[_local3][_local2].bubble.currentFrame)))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[(_local3 - 1)][(_local2 + 1)].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[(_local3 - 1)][(_local2 + 1)].name);
checkForMatch(Cache.bubblesGrid[(_local3 - 1)][(_local2 + 1)]);
};
};
} else {
if (_local4 == 2){
if (((!((Cache.bubblesGrid[_local3][(_local2 + 1)] == undefined))) && ((Cache.bubblesGrid[_local3][(_local2 + 1)].bubble.currentFrame == Cache.bubblesGrid[_local3][_local2].bubble.currentFrame)))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[_local3][(_local2 + 1)].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[_local3][(_local2 + 1)].name);
checkForMatch(Cache.bubblesGrid[_local3][(_local2 + 1)]);
};
};
} else {
if (_local4 == 3){
if (((((!((Cache.bubblesGrid[(_local3 + 1)] == undefined))) && (!((Cache.bubblesGrid[(_local3 + 1)][(_local2 + 1)] == undefined))))) && ((Cache.bubblesGrid[(_local3 + 1)][(_local2 + 1)].bubble.currentFrame == Cache.bubblesGrid[_local3][_local2].bubble.currentFrame)))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[(_local3 + 1)][(_local2 + 1)].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[(_local3 + 1)][(_local2 + 1)].name);
checkForMatch(Cache.bubblesGrid[(_local3 + 1)][(_local2 + 1)]);
};
};
} else {
if (_local4 == 4){
if (((((!((Cache.bubblesGrid[(_local3 + 1)] == undefined))) && (!((Cache.bubblesGrid[(_local3 + 1)][_local2] == undefined))))) && ((Cache.bubblesGrid[(_local3 + 1)][_local2].bubble.currentFrame == Cache.bubblesGrid[_local3][_local2].bubble.currentFrame)))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[(_local3 + 1)][_local2].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[(_local3 + 1)][_local2].name);
checkForMatch(Cache.bubblesGrid[(_local3 + 1)][_local2]);
};
};
} else {
if (_local4 == 5){
if (((!((Cache.bubblesGrid[_local3][(_local2 - 1)] == undefined))) && ((Cache.bubblesGrid[_local3][(_local2 - 1)].bubble.currentFrame == Cache.bubblesGrid[_local3][_local2].bubble.currentFrame)))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[_local3][(_local2 - 1)].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[_local3][(_local2 - 1)].name);
checkForMatch(Cache.bubblesGrid[_local3][(_local2 - 1)]);
};
};
};
};
};
};
};
};
};
};
_local4++;
};
_local2 = null;
_local3 = null;
}
public function addRow(){
var _local4:int;
var _local5:*;
var _local1:int = (Cache.bubblesGrid.length - 1);
while (_local1 >= 0) {
_local4 = (Cache.bubblesGrid[_local1].length - 1);
while (_local4 >= 0) {
if (Cache.bubblesGrid[_local1][_local4] != null){
Cache.bubblesGrid[_local1][_local4].x = Cache.grid[(_local1 + 1)][_local4].x;
Cache.bubblesGrid[_local1][_local4].y = Cache.grid[(_local1 + 1)][_local4].y;
Cache.bubblesGrid[_local1][_local4].name = Cache.grid[(_local1 + 1)][_local4].name;
Cache.bubblesGrid[(_local1 + 1)][_local4] = Cache.bubblesGrid[_local1][_local4];
Cache.bubblesGrid[_local1][_local4] = null;
};
_local4--;
};
_local1--;
};
var _local2:int;
while (_local2 < Cache.bubblesGrid[0].length) {
_local5 = ObjectManager.getObject("Bubble");
Cache.main.gameContainer.addChild(_local5);
Cache.bubblesGrid[0][_local2] = _local5;
_local5.x = Cache.grid[0][_local2].x;
_local5.y = Cache.grid[0][_local2].y;
_local5.name = Cache.grid[0][_local2].name;
randNum = (Math.round((Math.random() * (5 - 1))) + 1);
if (_local5.bubble == null){
Cache.bubblesWaitArray.push(_local5);
} else {
_local5.bubble.gotoAndStop(randNum);
};
_local2++;
};
Cache.checkArray = null;
Cache.destroyArray = null;
Cache.checkArray = new Array();
Cache.destroyArray = new Array();
var _local3:int;
while (_local3 < Cache.bubblesGrid[0].length) {
if (Cache.bubblesGrid[0][_local3] != null){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[0][_local3].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[0][_local3].name);
};
checkForLonelyBubbles(Cache.bubblesGrid[0][_local3]);
};
_local3++;
};
destroyLonelyBubbles();
}
public function addBubbleOnHold(){
var _local1:* = ObjectManager.getObject("Bubble");
if (Cache.win == true){
return;
};
Cache.main.gameContainer.addChild(_local1);
_local1.x = Cache.main.gameContainer.bubbleOnHold.x;
_local1.y = Cache.main.gameContainer.bubbleOnHold.y;
randNum = (Math.round((Math.random() * (5 - 1))) + 1);
if (_local1.bubble == null){
Cache.bubblesWaitArray.push(_local1);
} else {
_local1.bubble.gotoAndStop(randNum);
};
Cache.bubbleInHoldPosition = _local1;
}
public function checkForRedBack(_arg1:Event){
var _local2:int;
while (_local2 <= Cache.bubblesGrid[(Cache.bubblesGrid.length - 2)].length) {
if (_local2 == Cache.bubblesGrid[(Cache.bubblesGrid.length - 2)].length){
_arg1.target.alpha = 0;
redState = "goUp";
break;
} else {
if (Cache.bubblesGrid[(Cache.bubblesGrid.length - 2)][_local2] != null){
if ((((_arg1.target.alpha <= 0)) && ((redState == "goDown")))){
redState = "goUp";
} else {
if ((((_arg1.target.alpha > 0.3)) && ((redState == "goUp")))){
redState = "goDown";
};
};
if (redState == "goUp"){
_arg1.target.alpha = (_arg1.target.alpha + 0.01);
} else {
if (redState == "goDown"){
_arg1.target.alpha = (_arg1.target.alpha - 0.01);
};
};
break;
};
};
_local2++;
};
}
public function soundBtnClick(_arg1:MouseEvent){
if (Cache.noSound == true){
Cache.noSound = false;
Cache.main.soundBtn.gotoAndStop(1);
} else {
Cache.noSound = true;
Cache.main.soundBtn.gotoAndStop(2);
};
}
public function checkWaitArray(_arg1:Event){
var _local2:int;
while (_local2 < Cache.bubblesWaitArray.length) {
if (Cache.bubblesWaitArray[_local2] != null){
if (Cache.bubblesWaitArray[_local2].bubble != null){
randNum = (Math.round((Math.random() * (5 - 1))) + 1);
Cache.bubblesWaitArray[_local2].bubble.gotoAndStop(randNum);
Cache.bubblesWaitArray[_local2] = null;
};
};
_local2++;
};
}
private function loaderCompleteHandler(_arg1:Event):void{
var _local2:* = URLVariables(_arg1.target.data);
trace(("responseVars: " + _local2));
}
public function checkForLonelyBubbles(_arg1){
var _local2:* = (_arg1.name % Cache.main.hexGrid.gridXSize);
var _local3:* = Math.floor((_arg1.name / Cache.main.hexGrid.gridXSize));
var _local4:int;
while (_local4 < 6) {
if ((Math.floor((Cache.bubblesGrid[_local3][_local2].name / Cache.main.hexGrid.gridXSize)) % 2) == 0){
if (_local4 == 0){
if (((!((Cache.bubblesGrid[(_local3 - 1)] == undefined))) && (!((Cache.bubblesGrid[(_local3 - 1)][(_local2 - 1)] == undefined))))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[(_local3 - 1)][(_local2 - 1)].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[(_local3 - 1)][(_local2 - 1)].name);
checkForLonelyBubbles(Cache.bubblesGrid[(_local3 - 1)][(_local2 - 1)]);
};
};
} else {
if (_local4 == 1){
if (((!((Cache.bubblesGrid[(_local3 - 1)] == undefined))) && (!((Cache.bubblesGrid[(_local3 - 1)][_local2] == undefined))))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[(_local3 - 1)][_local2].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[(_local3 - 1)][_local2].name);
checkForLonelyBubbles(Cache.bubblesGrid[(_local3 - 1)][_local2]);
};
};
} else {
if (_local4 == 2){
if (Cache.bubblesGrid[_local3][(_local2 + 1)] != undefined){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[_local3][(_local2 + 1)].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[_local3][(_local2 + 1)].name);
checkForLonelyBubbles(Cache.bubblesGrid[_local3][(_local2 + 1)]);
};
};
} else {
if (_local4 == 3){
if (((!((Cache.bubblesGrid[(_local3 + 1)] == undefined))) && (!((Cache.bubblesGrid[(_local3 + 1)][_local2] == undefined))))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[(_local3 + 1)][_local2].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[(_local3 + 1)][_local2].name);
checkForLonelyBubbles(Cache.bubblesGrid[(_local3 + 1)][_local2]);
};
};
} else {
if (_local4 == 4){
if (((!((Cache.bubblesGrid[(_local3 + 1)] == undefined))) && (!((Cache.bubblesGrid[(_local3 + 1)][(_local2 - 1)] == undefined))))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[(_local3 + 1)][(_local2 - 1)].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[(_local3 + 1)][(_local2 - 1)].name);
checkForLonelyBubbles(Cache.bubblesGrid[(_local3 + 1)][(_local2 - 1)]);
};
};
} else {
if (_local4 == 5){
if (Cache.bubblesGrid[_local3][(_local2 - 1)] != undefined){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[_local3][(_local2 - 1)].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[_local3][(_local2 - 1)].name);
checkForLonelyBubbles(Cache.bubblesGrid[_local3][(_local2 - 1)]);
};
};
};
};
};
};
};
};
} else {
if ((Math.floor((Cache.bubblesGrid[_local3][_local2].name / Cache.main.hexGrid.gridXSize)) % 2) == 1){
if (_local4 == 0){
if (((!((Cache.bubblesGrid[(_local3 - 1)] == undefined))) && (!((Cache.bubblesGrid[(_local3 - 1)][_local2] == undefined))))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[(_local3 - 1)][_local2].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[(_local3 - 1)][_local2].name);
checkForLonelyBubbles(Cache.bubblesGrid[(_local3 - 1)][_local2]);
};
};
} else {
if (_local4 == 1){
if (((!((Cache.bubblesGrid[(_local3 - 1)] == undefined))) && (!((Cache.bubblesGrid[(_local3 - 1)][(_local2 + 1)] == undefined))))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[(_local3 - 1)][(_local2 + 1)].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[(_local3 - 1)][(_local2 + 1)].name);
checkForLonelyBubbles(Cache.bubblesGrid[(_local3 - 1)][(_local2 + 1)]);
};
};
} else {
if (_local4 == 2){
if (Cache.bubblesGrid[_local3][(_local2 + 1)] != undefined){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[_local3][(_local2 + 1)].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[_local3][(_local2 + 1)].name);
checkForLonelyBubbles(Cache.bubblesGrid[_local3][(_local2 + 1)]);
};
};
} else {
if (_local4 == 3){
if (((!((Cache.bubblesGrid[(_local3 + 1)] == undefined))) && (!((Cache.bubblesGrid[(_local3 + 1)][(_local2 + 1)] == undefined))))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[(_local3 + 1)][(_local2 + 1)].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[(_local3 + 1)][(_local2 + 1)].name);
checkForLonelyBubbles(Cache.bubblesGrid[(_local3 + 1)][(_local2 + 1)]);
};
};
} else {
if (_local4 == 4){
if (((!((Cache.bubblesGrid[(_local3 + 1)] == undefined))) && (!((Cache.bubblesGrid[(_local3 + 1)][_local2] == undefined))))){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[(_local3 + 1)][_local2].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[(_local3 + 1)][_local2].name);
checkForLonelyBubbles(Cache.bubblesGrid[(_local3 + 1)][_local2]);
};
};
} else {
if (_local4 == 5){
if (Cache.bubblesGrid[_local3][(_local2 - 1)] != undefined){
if (ArrayTools.compareData(Cache.checkArray, Cache.bubblesGrid[_local3][(_local2 - 1)].name) == false){
Cache.checkArray.push(Cache.bubblesGrid[_local3][(_local2 - 1)].name);
checkForLonelyBubbles(Cache.bubblesGrid[_local3][(_local2 - 1)]);
};
};
};
};
};
};
};
};
};
};
_local4++;
};
_local2 = null;
_local3 = null;
}
public function winFunc(){
Cache.main.winBox.y = 0;
Cache.main.winBox.lvlVar.text = String(Cache.currentLevel);
Cache.currentLevel++;
Cache.lost = true;
Cache.timer.stop();
Cache.main.gameContainer.bubbleLauncher.removeEventListener(Event.ENTER_FRAME, rotateLauncher);
Cache.main.gameContainer.bubbleLauncher.removeEventListener(Event.ENTER_FRAME, checkDestroy);
Cache.main.gameContainer.removeEventListener(MouseEvent.CLICK, mouseClick);
Cache.win = true;
Cache.main.winBox.cancelBtn.buttonMode = true;
Cache.main.winBox.cancelBtn.useHandCursor = true;
Cache.main.winBox.cancelBtn.addEventListener(MouseEvent.ROLL_OVER, btnOver);
Cache.main.winBox.cancelBtn.addEventListener(MouseEvent.ROLL_OUT, btnOut);
Cache.main.winBox.cancelBtn.addEventListener(MouseEvent.CLICK, replayClick2);
Cache.timer.stop();
Mouse.show();
}
private function onIOError(_arg1:IOErrorEvent){
trace(_arg1);
}
private function removeFromDict(_arg1:TweenEvent){
tweenDict[_arg1.currentTarget] = null;
delete tweenDict[_arg1.currentTarget];
}
private function showInstructions(_arg1:MouseEvent){
Mouse.show();
Cache.main.instructions.visible = true;
Cache.main.instructions.y = 300;
}
public function checkLost(_arg1:Event){
var _local2:int;
if ((((((score >= Cache.scoreNextLevel)) && ((Cache.win == false)))) && ((Cache.lost == false)))){
Cache.win = true;
winFunc();
};
if ((((Cache.lost == false)) && ((Cache.win == false)))){
_local2 = 0;
while (_local2 < Cache.bubblesGrid[0].length) {
if (Cache.bubblesGrid[(Cache.bubblesGrid.length - 1)][_local2] != null){
Cache.lost = true;
lostFunc();
};
_local2++;
};
};
}
private function reset(_arg1:MouseEvent){
var _local3:int;
if ((((Cache.win == false)) && ((Cache.lost == false)))){
Cache.scoreNextLevel = 0;
};
Cache.timer.reset();
var _local2:int;
while (_local2 < Cache.bubblesGrid.length) {
_local3 = 0;
while (_local3 < Cache.bubblesGrid[_local2].length) {
if (Cache.bubblesGrid[_local2][_local3] != null){
Cache.bubblesGrid[_local2][_local3].parent.removeChild(Cache.bubblesGrid[_local2][_local3]);
ObjectManager.removeObject(Cache.bubblesGrid[_local2][_local3], "Bubble");
Cache.bubblesGrid[_local2][_local3] = null;
};
_local3++;
};
_local2++;
};
if (Cache.bubbleInLaunchPosition.hasEventListener(Event.ENTER_FRAME)){
Cache.bubbleInLaunchPosition.removeEventListener(Event.ENTER_FRAME, moveTheBubble);
};
Cache.bubbleInLaunchPosition.parent.removeChild(Cache.bubbleInLaunchPosition);
ObjectManager.removeObject(Cache.bubbleInLaunchPosition, "Bubble");
Cache.bubbleInHoldPosition.parent.removeChild(Cache.bubbleInHoldPosition);
ObjectManager.removeObject(Cache.bubbleInHoldPosition, "Bubble");
Cache.bubbleInLaunchPosition = null;
Cache.bubbleInHoldPosition = null;
Cache.main.hexGrid.init();
bonus = 0;
init();
}
private function btnOver(_arg1:MouseEvent){
var _local2:Tween = new Tween(_arg1.currentTarget.overState, "alpha", Regular.easeOut, _arg1.currentTarget.overState.alpha, 1, tweenSpeed, true);
_local2.addEventListener(TweenEvent.MOTION_FINISH, removeFromDict);
tweenDict[_local2] = _local2;
}
private function btnOut(_arg1:MouseEvent){
var _local2:Tween = new Tween(_arg1.currentTarget.overState, "alpha", Regular.easeOut, _arg1.currentTarget.overState.alpha, 0, tweenSpeed, true);
_local2.addEventListener(TweenEvent.MOTION_FINISH, removeFromDict);
tweenDict[_local2] = _local2;
}
public function checkDestroy(_arg1:Event){
var _local4:int;
var _local5:int;
var _local2:int;
while (_local2 <= Cache.bubblesBeingDestroyed.length) {
if (_local2 == Cache.bubblesBeingDestroyed.length){
firstCheck = false;
break;
} else {
if (Cache.bubblesBeingDestroyed[_local2] != null){
firstCheck = true;
break;
};
};
_local2++;
};
var _local3:int;
while (_local3 <= Cache.bubblesBeingDestroyedFromNoLink.length) {
if (_local3 == Cache.bubblesBeingDestroyedFromNoLink.length){
secondCheck = false;
break;
} else {
if (Cache.bubblesBeingDestroyedFromNoLink[_local3] != null){
secondCheck = true;
break;
};
};
_local3++;
};
if (firstCheck == true){
_local4 = 0;
while (_local4 < Cache.bubblesBeingDestroyed.length) {
if (Cache.bubblesBeingDestroyed[_local4] != null){
if (Cache.bubblesBeingDestroyed[_local4].currentFrame == 14){
Cache.bubblesBeingDestroyed[_local4].parent.removeChild(Cache.bubblesBeingDestroyed[_local4]);
ObjectManager.removeObject(Cache.bubblesBeingDestroyed[_local4], "Bubble");
Cache.bubblesBeingDestroyed[_local4] = null;
};
};
_local4++;
};
};
if (secondCheck == true){
_local5 = 0;
while (_local5 < Cache.bubblesBeingDestroyedFromNoLink.length) {
if (Cache.bubblesBeingDestroyedFromNoLink[_local5] != null){
if (Cache.bubblesBeingDestroyedFromNoLink[_local5].currentFrame == 34){
Cache.bubblesBeingDestroyedFromNoLink[_local5].parent.removeChild(Cache.bubblesBeingDestroyedFromNoLink[_local5]);
ObjectManager.removeObject(Cache.bubblesBeingDestroyedFromNoLink[_local5], "Bubble");
Cache.bubblesBeingDestroyedFromNoLink[_local5] = null;
};
};
_local5++;
};
};
}
public function moveBubbleOnHoldToLaunchPosition(){
Cache.bubbleInHoldPosition.x = Cache.main.gameContainer.bubbleLauncher.x;
Cache.bubbleInHoldPosition.y = Cache.main.gameContainer.bubbleLauncher.y;
Cache.bubbleInLaunchPosition = Cache.bubbleInHoldPosition;
Cache.bubbleInHoldPosition = null;
}
public function mouseClick(_arg1:MouseEvent){
if (Cache.holdShot == false){
if (Cache.bubbleInLaunchPosition != null){
if (Cache.bubbleInLaunchPosition.name == "first"){
Cache.timer.start();
};
if (Cache.noSound == true){
Cache.main.gameContainer.bubbleLauncher.gotoAndPlay(3);
} else {
Cache.main.gameContainer.bubbleLauncher.gotoAndPlay(2);
};
Cache.bubbleInLaunchPosition.addEventListener(Event.ENTER_FRAME, moveTheBubble);
Cache.bubbleInLaunchPosition.name = String(Cache.main.gameContainer.bubbleLauncher.rotation);
Cache.holdShot = true;
};
};
}
private function sendScore(_arg1:MouseEvent){
var _local2:URLRequest = new URLRequest("http://www.gamesfree.ca/hs/bubblesifter.php?submit=1");
var _local3:URLVariables = new URLVariables();
var _local4:URLLoader = new URLLoader();
if (Cache.main.lostBox.checkCross.visible == true){
accepted = "true";
} else {
accepted = "false";
};
_local3.username = Cache.main.lostBox.nameText.text;
_local3.usermail = Cache.main.lostBox.emailText.text;
_local3.accepted = accepted;
_local3.score = score;
_local2.data = _local3;
_local2.method = URLRequestMethod.POST;
_local4.load(_local2);
_local4.addEventListener(IOErrorEvent.IO_ERROR, onIOError);
_local4.addEventListener(Event.COMPLETE, loaderCompleteHandler, false, 0, true);
_local4.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler, false, 0, true);
Cache.main.resetBtn.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
Cache.main.lostBox.y = -710;
score = 0;
}
public function destroyMatch(){
var _local1:int;
var _local2:int;
if (Cache.checkArray.length >= 3){
score = (score + (Cache.checkArray.length * 100));
Cache.main.score.text = String(score);
_local1 = 0;
while (_local1 < Cache.checkArray.length) {
_local2 = 0;
while (_local2 <= Cache.bubblesBeingDestroyed.length) {
if (_local2 == Cache.bubblesBeingDestroyed.length){
Cache.bubblesBeingDestroyed.push(Cache.bubblesGrid[Math.floor((Cache.checkArray[_local1] / Cache.main.hexGrid.gridXSize))][(Cache.checkArray[_local1] % Cache.main.hexGrid.gridXSize)]);
break;
} else {
if (Cache.bubblesBeingDestroyed[_local2] == null){
Cache.bubblesBeingDestroyed[_local2] = Cache.bubblesGrid[Math.floor((Cache.checkArray[_local1] / Cache.main.hexGrid.gridXSize))][(Cache.checkArray[_local1] % Cache.main.hexGrid.gridXSize)];
break;
};
};
_local2++;
};
Cache.bubblesGrid[Math.floor((Cache.checkArray[_local1] / Cache.main.hexGrid.gridXSize))][(Cache.checkArray[_local1] % Cache.main.hexGrid.gridXSize)].gotoAndPlay(2);
Cache.bubblesGrid[Math.floor((Cache.checkArray[_local1] / Cache.main.hexGrid.gridXSize))][(Cache.checkArray[_local1] % Cache.main.hexGrid.gridXSize)] = null;
_local1++;
};
};
}
private function replayClick2(_arg1:MouseEvent){
Cache.main.winBox.cancelBtn.dispatchEvent(new MouseEvent(MouseEvent.ROLL_OUT));
Cache.main.winBox.cancelBtn.buttonMode = false;
Cache.main.winBox.cancelBtn.useHandCursor = false;
Cache.main.winBox.cancelBtn.removeEventListener(MouseEvent.ROLL_OVER, btnOver);
Cache.main.winBox.cancelBtn.removeEventListener(MouseEvent.ROLL_OUT, btnOut);
Cache.main.winBox.cancelBtn.removeEventListener(MouseEvent.CLICK, replayClick);
Cache.main.winBox.y = -710;
Cache.main.resetBtn.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
private function replayClick3(_arg1:MouseEvent){
Cache.main.lostBox2.y = 0;
Cache.main.lostBox2.replayBtn.buttonMode = false;
Cache.main.lostBox2.replayBtn.removeEventListener(MouseEvent.ROLL_OVER, btnOver);
Cache.main.lostBox2.replayBtn.removeEventListener(MouseEvent.ROLL_OUT, btnOut);
Cache.main.lostBox2.replayBtn.removeEventListener(MouseEvent.CLICK, replayClick3);
Cache.main.lostBox2.gfBtn.buttonMode = true;
Cache.main.lostBox2.gfBtn.removeEventListener(MouseEvent.CLICK, gfBtnClick);
Cache.main.lostBox2.y = -710;
Cache.main.resetBtn.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
private function replayClick(_arg1:MouseEvent){
Cache.main.lostBox.cancelBtn.dispatchEvent(new MouseEvent(MouseEvent.ROLL_OUT));
Cache.main.lostBox.cancelBtn.buttonMode = false;
Cache.main.lostBox.cancelBtn.useHandCursor = false;
Cache.main.lostBox.cancelBtn.removeEventListener(MouseEvent.ROLL_OVER, btnOver);
Cache.main.lostBox.cancelBtn.removeEventListener(MouseEvent.ROLL_OUT, btnOut);
Cache.main.lostBox.cancelBtn.removeEventListener(MouseEvent.CLICK, replayClick);
Cache.main.lostBox.sendBtn.buttonMode = false;
Cache.main.lostBox.sendBtn.useHandCursor = false;
Cache.main.lostBox.sendBtn.removeEventListener(MouseEvent.ROLL_OVER, btnOver);
Cache.main.lostBox.sendBtn.removeEventListener(MouseEvent.ROLL_OUT, btnOut);
Cache.main.lostBox.sendBtn.removeEventListener(MouseEvent.CLICK, sendScore);
Cache.main.lostBox.checkBtn.buttonMode = false;
Cache.main.lostBox.checkBtn.useHandCursor = false;
Cache.main.lostBox.checkBtn.removeEventListener(MouseEvent.CLICK, toggleCheck);
Cache.main.lostBox.invalidEmail.visible = false;
Cache.main.lostBox.invalidName.visible = false;
Cache.main.lostBox.timeText.text = "";
Cache.main.lostBox.y = -710;
Cache.main.resetBtn.dispatchEvent(new MouseEvent(MouseEvent.CLICK));
}
}
}//package popthebubble
Section 23
//Main (popthebubble.Main)
package popthebubble {
import flash.events.*;
import flash.display.*;
import mochi.as3.*;
import Utils.*;
import flash.net.*;
import flash.text.*;
import flash.ui.*;
public dynamic class Main extends MovieClip {
public var myAim:MovieClip;
public var hexGrid:HexGrid;
public var level:TextField;
public var lostBox:WinBox;
public var preload:MovieClip;
public var lostBox2:MovieClip;
public var resetBtn:MovieClip;
public var score:TextField;
public var instructions:MovieClip;
public var highScoreBtn:MovieClip;
public var gameContainer:MovieClip;
public var logoBtn:MovieClip;
public var timer:CustomTimer;
public var facebook:MovieClip;
public var clickS:MovieClip;
public var showMochi:Boolean;// = true
public var soundBtn:MovieClip;
public var winBox:MovieClip;
public var moreGamesBtn:MovieClip;
public var highScoreContainer:MovieClip;
public var counterContainer:MovieClip;
public var nextScore:TextField;
public var game:Game;
public var instructionsBtn:MovieClip;
public var branding:MovieClip;
public function Main(){
hexGrid = new HexGrid();
game = new Game();
timer = new CustomTimer();
super();
addFrameScript(0, frame1, 9, frame10);
preload.addEventListener(Event.ENTER_FRAME, preloadIt);
if (showMochi == true){
MochiAd.showPreGameAd({clip:root, id:"9221a450a9c4bda5", res:"800x600"});
MochiBot.track(this, "a95b68c6");
};
Cache.main = this;
}
public function init(){
facebook.buttonMode = true;
facebook.addEventListener(MouseEvent.CLICK, facebookClick);
if (this.loaderInfo.url.substr(0, 7) == "http://"){
if (this.loaderInfo.url.substr(7, 4) == "www."){
if (this.loaderInfo.url.substr(11, 12) == "gamesfree.ca"){
Cache.onGamesFree = true;
};
} else {
if (this.loaderInfo.url.substr(7, 12) == "gamesfree.ca"){
Cache.onGamesFree = true;
};
};
};
instructions.y = -710;
Mouse.hide();
myAim.mouseEnabled = false;
stage.addEventListener(MouseEvent.MOUSE_MOVE, followMouse);
Cache.timer = timer;
moreGamesBtn.buttonMode = true;
moreGamesBtn.addEventListener(MouseEvent.CLICK, logoBtnClick);
logoBtn.buttonMode = true;
logoBtn.addEventListener(MouseEvent.CLICK, logoBtnClick);
clickS.buttonMode = true;
clickS.addEventListener(MouseEvent.CLICK, clickSClick);
stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDownHandler, false, 0, true);
stage.addEventListener(KeyboardEvent.KEY_UP, keyUpHandler, false, 0, true);
hexGrid.init();
game.init();
gameContainer.addChild(hexGrid);
}
public function preloadIt(_arg1:Event){
preload.preloadText.text = String(Math.ceil(((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) * 100)));
if ((((showMochi == false)) && (((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) >= 1)))){
_arg1.target.removeEventListener(Event.ENTER_FRAME, preloadIt);
this.gotoAndStop(10);
} else {
if ((this.loaderInfo.bytesLoaded / this.loaderInfo.bytesTotal) >= 1){
_arg1.target.removeEventListener(Event.ENTER_FRAME, preloadIt);
};
};
}
public function keyUpHandler(_arg1:KeyboardEvent){
if ((((_arg1.keyCode == 37)) || ((String.fromCharCode(_arg1.keyCode).toLowerCase() == "a")))){
Cache.leftKey = false;
};
if ((((_arg1.keyCode == 39)) || ((String.fromCharCode(_arg1.keyCode).toLowerCase() == "d")))){
Cache.rightKey = false;
};
}
function frame10(){
stop();
init();
}
public function logoBtnClick(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.gamesfree.ca/more_our_games.html"), "_blank");
}
public function facebookClick(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.facebook.com/home.php?#/gamesfree/?_fb_q=1&ref=ts&_fb_qsub=apps.facebook.com"), "_blank");
}
function frame1(){
stop();
}
public function keyDownHandler(_arg1:KeyboardEvent){
if ((((_arg1.keyCode == 37)) || ((String.fromCharCode(_arg1.keyCode).toLowerCase() == "a")))){
Cache.leftKey = true;
};
if ((((_arg1.keyCode == 39)) || ((String.fromCharCode(_arg1.keyCode).toLowerCase() == "d")))){
Cache.rightKey = true;
};
}
public function followMouse(_arg1:MouseEvent){
if ((((((((stage.mouseX < gameContainer.x)) || ((stage.mouseX > (gameContainer.x + gameContainer.width))))) || ((stage.mouseY < gameContainer.y)))) || ((stage.mouseY > (gameContainer.y + gameContainer.height))))){
myAim.visible = false;
Mouse.show();
return;
};
if (myAim.visible == false){
if (Cache.main.instructions.y == -710){
Mouse.hide();
myAim.visible = true;
} else {
myAim.visible = false;
Mouse.show();
};
};
myAim.x = stage.mouseX;
myAim.y = stage.mouseY;
}
public function clickSClick(_arg1:MouseEvent){
navigateToURL(new URLRequest("http://www.gamesfree.ca"), "_blank");
}
}
}//package popthebubble
Section 24
//ArrayTools (Utils.ArrayTools)
package Utils {
public class ArrayTools {
public static function compareData(_arg1:Array, _arg2){
var _local3:int;
while (_local3 <= _arg1.length) {
if (_local3 == _arg1.length){
return (false);
};
if (_arg1[_local3] == _arg2){
return (true);
};
_local3++;
};
}
}
}//package Utils
Section 25
//CustomTimer (Utils.CustomTimer)
package Utils {
import flash.events.*;
import flash.utils.*;
import popthebubble.*;
public class CustomTimer {
private var timer:Timer;
public var seconds:Number;// = 0
public var hours:Number;// = 0
private var time:String;// = ""
private var wait:Boolean;// = false
private var msCounter:Number;// = 0
private var secondsCounter:Number;// = 0
public var minutes:Number;// = 0
public function CustomTimer(){
timer = new Timer(100);
super();
}
public function start(){
wait = false;
timer.addEventListener(TimerEvent.TIMER, getTime);
timer.start();
}
public function getTime(_arg1:TimerEvent){
if (msCounter >= 9){
msCounter = 0;
} else {
msCounter++;
};
secondsCounter = (_arg1.target.currentCount / 10);
time = "";
hours = Math.floor((secondsCounter / 3600));
minutes = Math.floor(((secondsCounter / 60) - (hours * 60)));
seconds = Math.floor(((secondsCounter - (hours * 3600)) - (minutes * 60)));
if ((((((((((((Cache.currentLevel <= 11)) && (((seconds % (15 - (Cache.currentLevel - 1))) == 0)))) || ((((Cache.currentLevel >= 10)) && (((seconds % 5) == 0)))))) && ((msCounter == 0)))) && (((!((minutes == 0))) || (!((seconds == 0))))))) || ((wait == true)))){
if (Cache.holdShot == true){
wait = true;
} else {
Cache.main.game.addRow();
wait = false;
};
};
if (hours != 0){
time = (time + (String(hours) + ":"));
};
if (minutes == 0){
time = (time + "00:");
} else {
time = (time + (String(minutes) + ":"));
};
if (seconds < 10){
time = (time + ("0" + String(seconds)));
} else {
time = (time + String(seconds));
};
Cache.main.counterContainer.counter.text = ((time + ".") + msCounter);
}
public function reset(){
timer.reset();
}
public function setDelay(_arg1:Number){
timer.delay = _arg1;
}
public function stop(){
seconds = 0;
minutes = 0;
hours = 0;
msCounter = 0;
timer.stop();
}
}
}//package Utils
Section 26
//HexGrid (Utils.HexGrid)
package Utils {
import flash.events.*;
import flash.display.*;
import popthebubble.*;
public class HexGrid extends MovieClip {
public var sectorWidth:Number;
public var hexHeight:Number;
public var hexWidth:Number;
public var sectorHeight:Number;
public var gradient:Number;
public var gridXSize:Number;
public var gridYSize:Number;
public function hexOut(_arg1:MouseEvent){
_arg1.currentTarget.gotoAndStop(1);
}
public function init(){
var _local2:*;
var _local3:Hexagon;
var _local4:Bubble;
var _local5:int;
hexWidth = 37;
hexHeight = 41;
gridXSize = 13;
gridYSize = 15;
sectorWidth = hexWidth;
sectorHeight = ((hexHeight / 4) * 3);
gradient = ((hexHeight / 4) / (hexWidth / 2));
var _local1:* = 0;
while (_local1 < gridYSize) {
_local2 = 0;
while (_local2 < gridXSize) {
_local3 = new Hexagon();
_local3.name = String((_local2 + (_local1 * gridXSize)));
_local3.x = (((hexWidth * _local2) + (((_local1 % 2) * hexWidth) / 2)) + (_local3.width / 3));
_local3.y = ((((hexHeight * _local1) / 4) * 3) + (_local3.height / 2));
Cache.gridSize++;
if (_local2 == 0){
Cache.grid[_local1] = new Array();
Cache.bubblesGrid[_local1] = new Array();
};
Cache.bubblesGrid[_local1][_local2] = null;
if ((((((((Cache.difficulty == "easy")) && ((_local1 <= 7)))) || ((((Cache.difficulty == "medium")) && ((_local1 <= 9)))))) || ((((Cache.difficulty == "hard")) && ((_local1 <= 11)))))){
_local4 = ObjectManager.getObject("Bubble");
if ((((_local1 == 0)) && ((_local2 == 0)))){
_local5 = 0;
while (_local5 < _local4.bubble.totalFrames) {
Cache.bubbleTypeLeft[_local5] = false;
_local5++;
};
};
Cache.randNum = (Math.round((Math.random() * 5)) + 1);
Cache.bubblesWaitArray.push(_local4);
_local4.name = _local3.name;
_local4.x = _local3.x;
_local4.y = _local3.y;
Cache.main.gameContainer.addChild(_local4);
Cache.bubblesGrid[_local1][_local2] = _local4;
};
_local3.txt.text = _local3.name;
_local3.gotoAndStop(1);
_local3.buttonMode = true;
_local3.addEventListener(MouseEvent.ROLL_OVER, hexOver);
_local3.addEventListener(MouseEvent.ROLL_OUT, hexOut);
Cache.grid[_local1][_local2] = _local3;
_local2++;
};
_local1++;
};
}
public function hexOver(_arg1:MouseEvent){
_arg1.currentTarget.gotoAndStop(2);
}
}
}//package Utils
Section 27
//ObjectManager (Utils.ObjectManager)
package Utils {
import flash.utils.*;
public class ObjectManager {
public static var dict:Dictionary = new Dictionary();
public static var obj;
public static var cls:Class;
public function ObjectCreator(){
}
public static function removeObject(_arg1, _arg2:String){
var _local3:int;
while (_local3 <= dict[_arg2].length) {
if (_local3 == dict[_arg2].length){
dict[_arg2][dict[_arg2].length] = _arg1;
break;
};
if (dict[_arg2][_local3] == null){
dict[_arg2][_local3] = _arg1;
break;
};
_local3++;
};
}
public static function getObject(_arg1:String){
if (ObjectManager.dict[_arg1] == undefined){
ObjectManager.dict[_arg1] = new Array();
};
var _local2:int;
while (_local2 <= dict[_arg1].length) {
if (_local2 == dict[_arg1].length){
cls = Tools.instantiateClass(_arg1);
obj = new cls();
obj.mouseEnabled = false;
return (obj);
};
if (dict[_arg1][_local2] != null){
obj = null;
obj = dict[_arg1][_local2];
obj.gotoAndStop(1);
dict[_arg1][_local2] = null;
delete dict[_arg1][_local2];
return (obj);
};
_local2++;
};
}
}
}//package Utils
Section 28
//Tools (Utils.Tools)
package Utils {
import flash.utils.*;
public class Tools {
private static var classType:Class;
public static function instantiateClass(_arg1:String){
classType = (getDefinitionByName(_arg1) as Class);
return (classType);
}
}
}//package Utils
Section 29
//Bubble (Bubble)
package {
import flash.display.*;
public dynamic class Bubble extends MovieClip {
public var bubble:MovieClip;
public function Bubble(){
addFrameScript(0, frame1, 13, frame14, 33, frame34);
}
function frame14(){
stop();
}
function frame1(){
stop();
}
function frame34(){
stop();
}
}
}//package
Section 30
//Hexagon (Hexagon)
package {
import flash.display.*;
import flash.text.*;
public dynamic class Hexagon extends MovieClip {
public var txt:TextField;
public var hit:MovieClip;
}
}//package
Section 31
//MochiBot (MochiBot)
package {
import flash.display.*;
import flash.net.*;
import flash.system.*;
public dynamic class MochiBot extends Sprite {
public static function track(_arg1:Sprite, _arg2:String):MochiBot{
if (Security.sandboxType == "localWithFile"){
return (null);
};
var _local3:MochiBot = new (MochiBot);
_arg1.addChild(_local3);
Security.allowDomain("*");
Security.allowInsecureDomain("*");
var _local4 = "http://core.mochibot.com/my/core.swf";
var _local5:URLVariables = new URLVariables();
_local5["sb"] = Security.sandboxType;
_local5["v"] = Capabilities.version;
_local5["swfid"] = _arg2;
_local5["mv"] = "8";
_local5["fv"] = "9";
var _local6:String = _local3.root.loaderInfo.loaderURL;
if (_local6.indexOf("http") == 0){
_local5["url"] = _local6;
} else {
_local5["url"] = "local";
};
var _local7:URLRequest = new URLRequest(_local4);
_local7.contentType = "application/x-www-form-urlencoded";
_local7.method = URLRequestMethod.POST;
_local7.data = _local5;
var _local8:Loader = new Loader();
_local3.addChild(_local8);
_local8.load(_local7);
return (_local3);
}
}
}//package
Section 32
//WinBox (WinBox)
package {
import flash.display.*;
import flash.text.*;
public dynamic class WinBox extends MovieClip {
public var cancelBtn:MovieClip;
public var checkBtn:MovieClip;
public var invalidEmail:MovieClip;
public var emailText:TextField;
public var invalidName:MovieClip;
public var sendBtn:MovieClip;
public var nameText:TextField;
public var timeText:TextField;
public var checkCross:MovieClip;
}
}//package